diff --git a/README.md b/README.md index c65243686..927f3c645 100644 --- a/README.md +++ b/README.md @@ -305,10 +305,10 @@ * :technologist: [Lucas Elvira Martín](https://github.com/luelvira) (RISC-V and several improvements) * :technologist: [José Antonio Verde Jiménez](https://github.com/joseaverde) (Real hardware integration) * :technologist: [Álvaro Guerrero Espinosa](https://github.com/ALVAROPING1) (New compiler) - * :technologist: [Elisa Utrilla Arroyo](https://github.com/EUtrilla2002) (Real hardware integration) + * :technologist: [Elisa Utrilla Arroyo](https://github.com/EUtrilla2002) (Real hardware integration, Arduino integration) * :technologist: [Luis Daniel Casais Mezquida](https://github.com/rajayonin) (Website migration, interrupts, timers, and memory-mapped devices) * :technologist: [Jorge Ramos Santana](https://github.com/mjorgers) (core/tests rewrite, new web UI, new CLI, RV64 & Z80 architectures) - * :technologist: [Juan Carlos Cano Resa](https://github.com/Jotaceee) (SAIL integration) + * :technologist: [Juan Carlos Cano Resa](https://github.com/Jotaceee) (Sail integration) @@ -317,6 +317,24 @@
+:atom: 6.1.x + + - [x] Sail integration: + * RISC-V 32 and RISC-V 64 full specification supported + * Cache module integrated + - [x] Arduino support: + * ESP32 Microcontroller + * Arduino GPIO simulation UI + - [x] New activity bar + +
+ + - Source Code: https://github.com/creatorsim/creator-v6.1 + - Try Version: https://creatorsim.github.io/creator-v6.1 + +
+ +
:atom: 6.0.x - [x] **BREAKING CHANGES**: diff --git a/architecture/RISCV/RV32IMFD.yml b/architecture/RISCV/RV32IMFD.yml index 8cc988d99..a9434c2f8 100644 --- a/architecture/RISCV/RV32IMFD.yml +++ b/architecture/RISCV/RV32IMFD.yml @@ -8,7 +8,7 @@ config: name: RV32 word_size: 32 byte_size: 8 - description: RISC-V is an instruction set architecture (ISA) based on the RISC type and its hardware is free. This architecture was created in 2010 at the University of California, Berkeley. + description: RISC-V is a free and open standard ISA (Instruction Set Architecture) based on RISC (Reduced Instruction Set Computer) principles. It was created in 2010 at the University of California, Berkeley. endianness: big_endian memory_alignment: true main_function: main @@ -20,32 +20,33 @@ config: plugin: riscv assemblers: - name: CreatorAssembler - description: Default CREATOR assembler + description: "Default CREATOR assembler" + extensions: I: - description: RV32I Base Instruction Set + description: "RV32I Base Instruction Set" template: Base M: - description: RV32M Integer Multiply/Divide Extension + description: "RV32M Integer Multiply/Divide Extension" type: extension F: - description: RV32F Single-Precision Floating-Point Extension + description: "RV32F Single-Precision Floating-Point Extension" type: extension implies: - Zicsr D: - description: RV32D Double-Precision Floating-Point Extension + description: "RV32D Double-Precision Floating-Point Extension" type: extension implies: - F Zifencei: - description: RV32/RV64 Zifencei Standard Extension + description: "RV32/RV64 Zifencei Standard Extension" type: extension Zicsr: - description: RV32/RV64 Zicsr Standard Extension + description: "RV32/RV64 Zicsr Standard Extension" type: extension Priv: - description: RV32/RV64 Privileged instructions + description: "RV32/RV64 Privileged instructions" type: extension components: @@ -91,6 +92,7 @@ components: encoding: 2 properties: - read + - write - name: - mstatus nbits: 32 @@ -1489,8 +1491,8 @@ instructions: - field: funct3 value: "000" definition: | - if (registers[rs1] === registers[rs2]) - registers.pc = registers.pc + imm; + if (registers[rs1] === registers[rs2]) + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 and rs2 are equal. - name: bge @@ -1502,7 +1504,7 @@ instructions: value: "101" definition: | if (CAPI.FP.uint2int(registers[rs1]) >= CAPI.FP.uint2int(registers[rs2])) - registers.pc = registers.pc + imm; + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 is greater than or equal to rs2, using signed comparison. @@ -1515,7 +1517,7 @@ instructions: value: "111" definition: | if (CAPI.FP.int2uint(registers[rs1]) > CAPI.FP.int2uint(registers[rs2])) - registers.pc = registers.pc + imm; + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 is greater than or equal to rs2, using unsigned comparison. @@ -1528,9 +1530,8 @@ instructions: value: "100" definition: | if (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) - registers.pc = registers.pc + imm; - help: Take the branch if registers rs1 is less than rs2, using signed - comparison. + registers.pc = registers.pc + imm; + help: Take the branch if registers rs1 is less than rs2, using signed comparison. - name: bltu template: B @@ -1541,9 +1542,8 @@ instructions: value: "110" definition: | if (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(registers[rs2])) - registers.pc = registers.pc + imm; - help: Take the branch if registers rs1 is less than rs2, using unsigned - comparison. + registers.pc = registers.pc + imm; + help: Take the branch if registers rs1 is less than rs2, using unsigned comparison. - name: bne template: B @@ -1553,8 +1553,8 @@ instructions: - field: funct3 value: "001" definition: | - if (registers[rs1] !== registers[rs2]) - registers.pc = registers.pc + imm; + if (registers[rs1] !== registers[rs2]) + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 and rs2 are not equal. # I-type instructions @@ -1589,8 +1589,7 @@ instructions: value: "111" definition: | registers[rd] = registers[rs1] & CAPI.FP.int2uint(imm); - help: Performs bitwise AND on register rs1 and the sign-extended 12-bit - immediate and place the result in rd. + help: Performs bitwise AND on register rs1 and the sign-extended 12-bit immediate and place the result in rd. - name: jalr template: I-Offset @@ -1616,8 +1615,7 @@ instructions: value: "000" definition: | registers[rd] = CAPI.MEM.read(imm + registers[rs1], 1, rd); - help: Loads a 8-bit value from memory and sign-extends this to XLEN bits - before storing it in register rd. + help: Loads a 8-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. - name: lbu template: I-Offset @@ -1631,8 +1629,7 @@ instructions: let addr = CAPI.FP.int2uint(registers[rs1]) + imm; registers[rd] = CAPI.MEM.read(addr, 1, rd); registers[rd] = CAPI.FP.int2uint(registers[rd]); - help: Loads a 8-bit value from memory and zero-extends this to XLEN bits - before storing it in register rd. + help: Loads a 8-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. - name: lh template: I-Offset @@ -1644,8 +1641,7 @@ instructions: value: "001" definition: | registers[rd] = CAPI.MEM.read(imm + registers[rs1], 2, rd); - help: Loads a 16-bit value from memory and sign-extends this to XLEN bits - before storing it in register rd. + help: Loads a 16-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. - name: lhu template: I-Offset @@ -1659,8 +1655,7 @@ instructions: let addr = CAPI.FP.int2uint(registers[rs1], 32) + imm; registers[rd] = CAPI.MEM.read(addr, 2, rd); registers[rd] = CAPI.FP.int2uint(registers[rd]); - help: Loads a 16-bit value from memory and zero-extends this to XLEN bits - before storing it in register rd. + help: Loads a 16-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. - name: lw template: I-Offset @@ -1673,8 +1668,7 @@ instructions: definition: | let addr = CAPI.FP.int2uint(registers[rs1], 32) + imm; registers[rd] = CAPI.MEM.read(addr, 4, rd); - help: Loads a 32-bit value from memory and sign-extends this to XLEN bits - before storing it in register rd. + help: Loads a 32-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. - name: ori template: I @@ -1686,8 +1680,7 @@ instructions: value: "110" definition: | registers[rd] = registers[rs1] | imm; - help: Performs bitwise OR on register rs1 and the sign-extended 12-bit - immediate and place the result in rd. + help: Performs bitwise OR on register rs1 and the sign-extended 12-bit immediate and place the result in rd. - name: slli template: I-Shift @@ -1701,8 +1694,7 @@ instructions: value: "0000000" definition: | if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] << shamt); - help: Performs logical left shift on the value in register rs1 by the - shift amount held in the lower 5 bits of the immediate. + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: slti template: I @@ -1713,9 +1705,8 @@ instructions: - field: funct3 value: "010" definition: | - registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(imm)) ? 1 : 0; - help: Place the value 1 in register rd if register rs1 is less than the - signextended immediate when both are treated as signed numbers, else 0 is written to rd. + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(imm)) ? 1n : 0n; + help: Place the value 1 in register rd if register rs1 is less than the signextended immediate when both are treated as signed numbers, else 0 is written to rd. - name: sltiu template: I @@ -1726,9 +1717,8 @@ instructions: - field: funct3 value: "011" definition: | - registers[rd] = (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(imm)) ? 1: 0; - help: Place the value 1 in register rd if register rs1 is less than the - immediate when both are treated as unsigned numbers, else 0 is written to rd. + registers[rd] = (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(imm)) ? 1n : 0n; + help: Place the value 1 in register rd if register rs1 is less than the immediate when both are treated as unsigned numbers, else 0 is written to rd. - name: srai template: I-Shift @@ -1742,8 +1732,7 @@ instructions: value: "0100000" definition: | if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] >> shamt); - help: Performs arithmetic right shift on the value in register rs1 by the - shift amount held in the lower 5 bits of the immediate. + help: Performs arithmetic right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: srli template: I-Shift @@ -1757,8 +1746,7 @@ instructions: value: "0000000" definition: | if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] >> shamt); - help: Performs logical right shift on the value in register rs1 by the - shift amount held in the lower 5 bits of the immediate. + help: Performs logical right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: xori template: I @@ -1789,9 +1777,11 @@ instructions: - field: opcode value: "1101111" definition: | - registers[rd] = registers.pc + 4n; - registers.pc += imm; - CAPI.STACK.beginFrame(); + if (CAPI.ARDUINO.check_arduino(imm,registers.pc) === false) { + registers[rd] = registers.pc + 4n; + registers.pc = registers.pc + imm; + CAPI.STACK.beginFrame(); + } help: Jump to address and place return address in rd. # R-type instructions @@ -1827,8 +1817,7 @@ instructions: value: "111" definition: | registers[rd] = registers[rs1] & registers[rs2]; - help: Performs bitwise AND on registers rs1 and rs2 and place the result - in rd. + help: Performs bitwise AND on registers rs1 and rs2 and place the result in rd. - name: or template: R @@ -1841,8 +1830,8 @@ instructions: value: "110" definition: | registers[rd] = registers[rs1] | registers[rs2]; - help: Performs bitwise OR on registers rs1 and rs2 and place the result in - rd. + help: Performs bitwise OR on registers rs1 and rs2 and place the result in rd. + - name: sll template: R fields: @@ -1855,8 +1844,7 @@ instructions: definition: | const shiftAmount = registers[rs2] & 0x1Fn; registers[rd] = (registers[rs1] << shiftAmount) & 0xFFFFFFFFn; - help: Performs logical left shift on the value in register rs1 by the - shift amount held in the lower 5 bits of register rs2. + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. - name: slt template: R @@ -1868,9 +1856,8 @@ instructions: - field: funct3 value: "010" definition: | - registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) ? 1 : 0; - help: Place the value 1 in register rd if register rs1 is less than - register rs2 when both are treated as signed numbers, else 0 is written to rd. + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) ? 1n : 0n; + help: Place the value 1 in register rd if register rs1 is less than register rs2 when both are treated as signed numbers, else 0 is written to rd. - name: sltu template: R @@ -1914,8 +1901,7 @@ instructions: definition: | const shiftAmount = registers[rs2] & 0x1Fn; registers[rd] = (registers[rs1] >> shiftAmount) & 0xFFFFFFFFn; - help: Logical right shift on the value in register rs1 by the shift amount - held in the lower 5 bits of register rs2. + help: Logical right shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. - name: sub template: R @@ -1943,8 +1929,7 @@ instructions: value: "100" definition: | registers[rd] = (registers[rs1] ^ registers[rs2]); - help: Performs bitwise XOR on registers rs1 and rs2 and place the result - in rd. + help: Performs bitwise XOR on registers rs1 and rs2 and place the result in rd. # S-type instructions # 31-25 24-20 19-15 14-12 11-7 6-0 @@ -2107,7 +2092,7 @@ instructions: (BigInt.asIntN(32, BigInt(registers[rs1])) / BigInt.asIntN(32, BigInt(registers[rs2]))) ); } - else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); + else CAPI.VALIDATION.raise('Division by zero not allowed'); help: Perform an XLEN bits by XLEN bits signed integer division of rs1 by rs2, rounding towards zero. @@ -2127,7 +2112,7 @@ instructions: (BigInt.asUintN(32, BigInt(registers[rs1])) / BigInt.asUintN(32, BigInt(registers[rs2]))) ); } - else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); + else CAPI.VALIDATION.raise('Division by zero not allowed'); help: Perform an XLEN-bit by XLEN-bit unsigned integer division of rs1 by rs2, rounding towards zero. @@ -2255,8 +2240,7 @@ instructions: postoperation: | registers[rd] = CAPI.ARCH.NaNBox(registers[rd]); - help: Load a single-precision floating-point value from memory into - floating-point register rd. + help: Load a single-precision floating-point value from memory into floating-point register rd. - name: fadd.s template: R-Floating @@ -2338,8 +2322,7 @@ instructions: registers[rd] = CAPI.ARCH.toBigInt(registers[rd],'NaNBfloat32_64'); definition: | registers[rd] = CAPI.FP.uint2int(registers[rs1]) - help: Converts a 32-bit signed integer, in integer register rs1 into a - floating-point number in floating-point register rd. + help: Converts a 32-bit signed integer, in integer register rs1 into a floating-point number in floating-point register rd. - name: fcvt.s.wu template: R-IntToFloat @@ -2357,8 +2340,7 @@ instructions: order: 3 definition: | registers[rd] = CAPI.FP.int2uint(registers[rs1]) - help: Converts a 32-bit unsigned integer, in integer register rs1 into a - floating-point number in floating-point register rd. + help: Converts a 32-bit unsigned integer, in integer register rs1 into a floating-point number in floating-point register rd. - name: fcvt.w.s template: R-FloatToInt @@ -2386,8 +2368,7 @@ instructions: } definition: | result = parseInt(registers[rs1]); - help: Convert a floating-point number in floating-point register rs1 to a - signed 32-bit in integer register rd. + help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in integer register rd. - name: fcvt.wu.s template: R-FloatToInt @@ -2415,8 +2396,7 @@ instructions: } definition: | registers[rd] = CAPI.FP.int2uint(parseInt(rs1Number)); - help: Convert a floating-point number in floating-point register rs1 to a - signed 32-bit in unsigned integer register rd. + help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in unsigned integer register rd. - name: fdiv.s template: R-Floating @@ -2675,8 +2655,7 @@ instructions: } definition: | result = (rs2Number >= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); - help: Produce a result that takes all bits except the sign bit from rs1. - The result's sign bit is rs2's sign bit. + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. - name: fsgnjn.s template: R-Floating @@ -2699,8 +2678,7 @@ instructions: } definition: | result = (rs2Number <= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); - help: Produce a result that takes all bits except the sign bit from rs1. - The result's sign bit is rs2's sign bit. + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. - name: fsgnjx.s template: R-Floating @@ -2725,8 +2703,7 @@ instructions: let a = rs1Number < 0; let b = rs2Number < 0; result = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); - help: Produce a result that takes all bits except the sign bit from rs1. - The result's sign bit is XOR of sign bit of rs1 and rs2. + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is XOR of sign bit of rs1 and rs2. - name: fsqrt.s template: R-Floating @@ -2788,7 +2765,7 @@ instructions: } definition: | result = rs1Number - rs2Number; - help: Perform single-precision floating-point substraction. + help: Perform single-precision floating-point subtraction. - name: fmadd.s template: R4 @@ -2910,8 +2887,7 @@ instructions: definition: | let value = registers[rs2] & 0xFFFFFFFFn; CAPI.MEM.write(registers[rs1] + imm, 4, value, rs2, 'float32'); - help: Store a single-precision value from floating-point register rs2 to - memory. + help: Store a single-precision value from floating-point register rs2 to memory. D: # ____ __ __ _____ ____ ____ @@ -2936,8 +2912,7 @@ instructions: CAPI.VALIDATION.raise('The memory must be aligned'); } registers[rd] = CAPI.MEM.read(registers[rs1] + imm, 8, rd); - help: Load a double-precision floating-point value from memory into - floating-point register rd. + help: Load a double-precision floating-point value from memory into floating-point register rd. - name: fadd.d template: R-Double @@ -3035,8 +3010,7 @@ instructions: } definition: | result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual - help: Converts double floating-point register in rs1 into a double - floating-point number in floating-point register rd. + help: Converts double floating-point register in rs1 into a double floating-point number in floating-point register rd. - name: fcvt.d.w template: R-Conversion @@ -3063,8 +3037,7 @@ instructions: registers[rd] = CAPI.ARCH.toBigInt(result, 'float64'); definition: | result = CAPI.FP.uint2int(rs1Number); - help: Converts a 32-bit signed integer, in integer register rs1 into a - double-precision floating-point number in floating-point register rd. + help: Converts a 32-bit signed integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. - name: fcvt.d.wu template: R-Conversion @@ -3096,8 +3069,7 @@ instructions: } definition: | result = CAPI.FP.int2uint(parseFloat(rs1Number)); - help: Converts a 32-bit unsigned integer, in integer register rs1 into a - double-precision floating-point number in floating-point register rd. + help: Converts a 32-bit unsigned integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. - name: fcvt.s.d template: R-Conversion @@ -3129,8 +3101,7 @@ instructions: } definition: | result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual - help: Converts double floating-point register in rs1 into a floating-point - number in floating-point register rd. + help: Converts double floating-point register in rs1 into a floating-point number in floating-point register rd. - name: fcvt.w.d template: R-Conversion @@ -3162,8 +3133,7 @@ instructions: } definition: | result = CAPI.FP.int2uint(parseInt(rs1Number)); - help: Converts a double-precision floating-point number in floating-point - register rs1 to a signed 32-bit integer, in integer register rd. + help: Converts a double-precision floating-point number in floating-point register rs1 to a signed 32-bit integer, in integer register rd. - name: fcvt.wu.d template: R-Conversion @@ -3195,8 +3165,7 @@ instructions: } definition: | result = CAPI.FP.int2uint(parseInt(rs1Number)); - help: Converts a double-precision floating-point number in floating-point - register rs1 to a unsigned 32-bit integer, in integer register rd. + help: Converts a double-precision floating-point number in floating-point register rs1 to a unsigned 32-bit integer, in integer register rd. - name: fdiv.d template: R-Double @@ -3676,6 +3645,7 @@ instructions: properties: - privileged + Zicsr: # _____ _ # |__ /(_) ___ ___ _ __ @@ -3701,7 +3671,8 @@ instructions: # TODO: Implement rest of CSR instructions - Zifencei: + +Zifencei: # _____ _ __ _ # |__ /(_) / _| ___ _ __ ___ ___ (_) # / / | || |_ / _ \| '_ \ / __|/ _ \| | @@ -3736,6 +3707,7 @@ instructions: help: Provides explicit synchronization between writes to instruction memory and instruction fetches on the same hart. + pseudoinstructions: # Make sure the definitions correspond with those in the RISC-V ASM manual (TODO: Check these!) @@ -3761,8 +3733,7 @@ pseudoinstructions: type: offset_bytes definition: | bge reg1, x0, off; - help: Take the branch if the value in register rs1 is greater or equal to - 0. + help: Take the branch if the value in register rs1 is greater or equal to 0. - name: bgt fields: @@ -3887,13 +3858,13 @@ pseudoinstructions: type: imm-unsigned definition: | no_ret_op{ - tmp = Field.2.(31,0).int; - tmp_pc_offset = (reg.pc - 4) & 0xFFF; + tmp = Field.2.(31,0).int - (reg.pc - 4); tmp_low = tmp & 0x00000FFF; - tmp_hi = tmp >> 12; + tmp_low = tmp_low>0x7FF? tmp_low - 0x1000 : tmp_low; + tmp_hi = (tmp - tmp_low) >> 12; }; auipc rd, op{tmp_hi}; - addi rd, rd, op{tmp_low - (tmp_pc_offset)}; + addi rd, rd, op{tmp_low}; - name: li fields: @@ -4111,13 +4082,12 @@ interrupts: CAPI.SYSCALL.read('a0', 'char'); break; } - CAPI.INTERRUPTS.clearHighlight(); custom: | CAPI.INTERRUPTS.globalDisable(); CAPI.INTERRUPTS.setKernelMode(); - registers.epc = registers.pc; + registers.mepc = CAPI.REG.read("pc"); // get "real" PC (next instruction) // jump to handler if (registers.mtvec & 1n) { // vectored mode @@ -4134,7 +4104,6 @@ interrupts: return null; is_enabled: | - if (!(registers.mstatus & 2n ** 3n)) return false; // MIE switch (type) { case InterruptType.Software: case InterruptType.EnvironmentCall: @@ -4147,7 +4116,7 @@ interrupts: return false; is_global_enabled: | - return !(registers.mstatus & 2n ** 3n); // MIE + return !!(registers.mstatus & 2n ** 3n); // MIE enable: | switch (type) { @@ -4236,3 +4205,4 @@ timer: registers.mie |= 2n ** 7n; // MTIE = 1 disable: | registers.mie &= ~(2n ** 7n); // MTIE = 0 + diff --git a/architecture/RISCV/RV64IMFD.yml b/architecture/RISCV/RV64IMFD.yml index e358d6212..6492c5a1b 100644 --- a/architecture/RISCV/RV64IMFD.yml +++ b/architecture/RISCV/RV64IMFD.yml @@ -6,9 +6,9 @@ version: 2.0.0 config: name: RV64 - word_size: 32 # In RV64, the word size is also 32 bits + word_size: 32 # In RV64, word size is also 32 bits byte_size: 8 - description: RISC-V is an instruction set architecture (ISA) based on the RISC type and its hardware is free. This architecture was created in 2010 at the University of California, Berkeley. + description: RISC-V is a free and open standard ISA (Instruction Set Architecture) based on RISC (Reduced Instruction Set Computer) principles. It was created in 2010 at the University of California, Berkeley. endianness: big_endian memory_alignment: true main_function: main @@ -46,6 +46,9 @@ extensions: Zicsr: description: "RV32/RV64 Zicsr Standard Extension" type: extension + Priv: + description: "RV32/RV64 Privileged instructions" + type: extension components: - name: Control registers @@ -53,7 +56,7 @@ components: double_precision: false elements: - name: - - PC + - pc nbits: 64 value: 0 default_value: 0 @@ -62,6 +65,90 @@ components: - read - write - program_counter + - name: + - mepc + nbits: 64 + value: 0 + encoding: 1 + default_value: 0 + properties: + - read + - write + - exception_program_counter + - name: + - mcause + nbits: 64 + value: 0 + default_value: 0 + encoding: 0x342 + properties: + - read + - write + + - name: + - mtvec + nbits: 64 + value: 0 + default_value: 0 + encoding: 2 + properties: + - read + - write + - name: + - mstatus + nbits: 64 + value: 8 + default_value: 8 + encoding: 3 + properties: + - read + - write + - name: + - mip + nbits: 64 + value: 0 + default_value: 0 + encoding: 4 + properties: + - read + - write + - name: + - mie + nbits: 64 + value: 0x00000888 + default_value: 0x00000888 # MEIE + MTIE + MSIE + encoding: 5 + properties: + - read + - write + - name: + - mscratch + nbits: 64 + value: 0 + default_value: 0 + encoding: 6 + properties: + - read + - write + - name: + - mtime + nbits: 64 + value: 0 + default_value: 0 + encoding: 7 + properties: + - read + - write + - name: + - mtimecmp + nbits: 64 + value: 0 + default_value: 0 + encoding: 8 + properties: + - read + - write + - name: Integer registers type: int_registers double_precision: false @@ -402,6 +489,7 @@ components: properties: - read - write + - name: Floating point registers type: fp_registers double_precision: true @@ -1403,8 +1491,8 @@ instructions: - field: funct3 value: "000" definition: | - if (registers[rs1] === registers[rs2]) - registers["PC"] = registers["PC"] + imm; + if (registers[rs1] === registers[rs2]) + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 and rs2 are equal. - name: bge @@ -1416,7 +1504,7 @@ instructions: value: "101" definition: | if (CAPI.FP.uint2int(registers[rs1]) >= CAPI.FP.uint2int(registers[rs2])) - registers["PC"] = registers["PC"] + imm; + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 is greater than or equal to rs2, using signed comparison. @@ -1429,7 +1517,7 @@ instructions: value: "111" definition: | if (CAPI.FP.int2uint(registers[rs1]) > CAPI.FP.int2uint(registers[rs2])) - registers["PC"] = registers["PC"] + imm; + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 is greater than or equal to rs2, using unsigned comparison. @@ -1442,9 +1530,8 @@ instructions: value: "100" definition: | if (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) - registers["PC"] = registers["PC"] + imm; - help: Take the branch if registers rs1 is less than rs2, using signed - comparison. + registers.pc = registers.pc + imm; + help: Take the branch if registers rs1 is less than rs2, using signed comparison. - name: bltu template: B @@ -1455,9 +1542,8 @@ instructions: value: "110" definition: | if (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(registers[rs2])) - registers["PC"] = registers["PC"] + imm; - help: Take the branch if registers rs1 is less than rs2, using unsigned - comparison. + registers.pc = registers.pc + imm; + help: Take the branch if registers rs1 is less than rs2, using unsigned comparison. - name: bne template: B @@ -1467,8 +1553,8 @@ instructions: - field: funct3 value: "001" definition: | - if (registers[rs1] !== registers[rs2]) - registers["PC"] = registers["PC"] + imm; + if (registers[rs1] !== registers[rs2]) + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 and rs2 are not equal. # I-type instructions @@ -1521,8 +1607,7 @@ instructions: value: "111" definition: | registers[rd] = registers[rs1] & CAPI.FP.int2uint(imm); - help: Performs bitwise AND on register rs1 and the sign-extended 12-bit - immediate and place the result in rd. + help: Performs bitwise AND on register rs1 and the sign-extended 12-bit immediate and place the result in rd. - name: jalr template: I-Offset @@ -1533,8 +1618,8 @@ instructions: - field: funct3 value: "000" definition: | - registers[rd] = registers["PC"] + 4n; - registers["PC"] = (registers[rs1] + imm) & ~1n; + registers[rd] = registers.pc + 4n; + registers.pc = (registers[rs1] + imm) & ~1n; CAPI.STACK.endFrame(); help: Jump to address and place return address in rd. @@ -1548,8 +1633,8 @@ instructions: value: "000" definition: | registers[rd] = CAPI.MEM.read(imm + registers[rs1], 1, rd); - help: Loads a 8-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: lbu template: I-Offset type: Memory access @@ -1563,6 +1648,7 @@ instructions: registers[rd] = CAPI.MEM.read(addr, 1, rd); registers[rd] = CAPI.FP.int2uint(registers[rd]); help: Loads a 8-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. + - name: lh template: I-Offset type: Memory access @@ -1573,8 +1659,8 @@ instructions: value: "001" definition: | registers[rd] = CAPI.MEM.read(imm + registers[rs1], 2, rd); - help: Loads a 16-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: lhu template: I-Offset type: Memory access @@ -1588,6 +1674,7 @@ instructions: registers[rd] = CAPI.MEM.read(addr, 2, rd); registers[rd] = CAPI.FP.int2uint(registers[rd]); help: Loads a 16-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. + - name: lw template: I-Offset type: Memory access @@ -1599,8 +1686,7 @@ instructions: definition: | let addr = CAPI.FP.int2uint(registers[rs1], 32) + imm; registers[rd] = CAPI.MEM.read(addr, 4, rd); - help: Loads a 32-bit value from memory and sign-extends this to XLEN bits - before storing it in register rd. + help: Loads a 32-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. - name: lwu template: I-Offset @@ -1614,8 +1700,7 @@ instructions: var addr = CAPI.FP.int2uint(registers[rs1]) + imm; registers[rd] = CAPI.MEM.read(addr, 4, rd); registers[rd] = CAPI.FP.int2uint(registers[rd]); - help: Loads a 32-bit value from memory and zero-extends this to 64 bits - before storing it in register rd. + help: Loads a 32-bit value from memory and zero-extends this to 64 bits before storing it in register rd. - name: ld template: I-Offset @@ -1640,8 +1725,8 @@ instructions: value: "110" definition: | registers[rd] = registers[rs1] | imm; - help: Performs bitwise OR on register rs1 and the sign-extended 12-bit immediate and place the result in rd. + - name: slli # In RV64, slli is a 6-bit shift, so we need to slightly modify the template template: I-Shift @@ -1658,8 +1743,7 @@ instructions: startbit: 25 definition: | if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] << shamt); - help: Performs logical left shift on the value in register rs1 by the - shift amount held in the lower 5 bits of the immediate. + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: slliw template: I-Shift @@ -1677,8 +1761,7 @@ instructions: registers[rd] = temp & 0x80000000n ? temp | 0xFFFFFFFF00000000n : temp; registers[rd] = CAPI.FP.int2uint(registers[rd]); } - help: Performs logical left shift on the 32-bit of value in register rs1 - by the shift amount held in the lower 5 bits of the immediate. + help: Performs logical left shift on the 32-bit of value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: slti template: I @@ -1689,9 +1772,9 @@ instructions: - field: funct3 value: "010" definition: | - registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(imm)) ? 1 : 0; - + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(imm)) ? 1n : 0n; help: Place the value 1 in register rd if register rs1 is less than the signextended immediate when both are treated as signed numbers, else 0 is written to rd. + - name: sltiu template: I type: Logic @@ -1701,8 +1784,9 @@ instructions: - field: funct3 value: "011" definition: | - registers[rd] = (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(imm)) ? 1: 0; + registers[rd] = (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(imm)) ? 1n : 0n; help: Place the value 1 in register rd if register rs1 is less than the immediate when both are treated as unsigned numbers, else 0 is written to rd. + - name: srai template: I-Shift type: Arithmetic integer @@ -1715,8 +1799,7 @@ instructions: value: "0100000" definition: | if (shamt > 0) registers[rd] = (BigInt.asIntN(64, registers[rs1]) >> shamt); - help: Performs arithmetic right shift on the value in register rs1 by the - shift amount held in the lower 5 bits of the immediate. + help: Performs arithmetic right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: sraiw template: I-Shift @@ -1733,8 +1816,7 @@ instructions: const temp = BigInt.asIntN(32, BigInt(registers[rs1])) >> BigInt(shamt); registers[rd] = CAPI.FP.int2uint(temp); } - help: Performs arithmetic right shift on the 32-bit of value in register - rs1 by the shift amount held in the lower 5 bits of the immediate. + help: Performs arithmetic right shift on the 32-bit of value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: srli template: I-Shift @@ -1747,8 +1829,7 @@ instructions: value: "0000000" definition: | if (shamt > 0) rd = (rs1 >> shamt); - help: Performs logical right shift on the value in register rs1 by the - shift amount held in the lower 5 bits of the immediate. + help: Performs logical right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: srliw template: I-Shift @@ -1767,8 +1848,7 @@ instructions: registers[rd] = temp & 0x80000000n ? temp | 0xffffffff00000000n : temp; registers[rd] = CAPI.FP.int2uint(registers[rd]); } - help: Performs logical right shift on the 32-bit of value in register rs1 - by the shift amount held in the lower 5 bits of the immediate. + help: Performs logical right shift on the 32-bit of value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: xori template: I @@ -1799,8 +1879,8 @@ instructions: - field: opcode value: "1101111" definition: | - registers[rd] = registers["PC"] + 4n; - registers["PC"] = registers["PC"] + imm; + registers[rd] = registers.pc + 4n; + registers.pc = registers.pc + imm; CAPI.STACK.beginFrame(); help: Jump to address and place return address in rd. @@ -1824,8 +1904,7 @@ instructions: definition: | registers[rd] = registers[rs2] + registers[rs1]; help: Adds the registers rs1 and rs2 and stores the result in rd. - Arithmetic overflow is ignored and the result is simply the low XLEN - bits of the result. + Arithmetic overflow is ignored and the result is simply the low XLEN bits of the result. - name: addw template: R @@ -1855,8 +1934,8 @@ instructions: value: "111" definition: | registers[rd] = registers[rs1] & registers[rs2]; - help: Performs bitwise AND on registers rs1 and rs2 and place the result in rd. + - name: or template: R fields: @@ -1868,8 +1947,8 @@ instructions: value: "110" definition: | registers[rd] = registers[rs1] | registers[rs2]; - help: Performs bitwise OR on registers rs1 and rs2 and place the result in rd. + - name: sll template: R fields: @@ -1882,8 +1961,7 @@ instructions: definition: | const shiftAmount = registers[rs2] & 0x1Fn; registers[rd] = (registers[rs1] << shiftAmount) & 0xFFFFFFFFn; - help: Performs logical left shift on the value in register rs1 by the - shift amount held in the lower 5 bits of register rs2. + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. - name: sllw template: R @@ -1912,9 +1990,9 @@ instructions: - field: funct3 value: "010" definition: | - registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) ? 1 : 0; - + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) ? 1n : 0n; help: Place the value 1 in register rd if register rs1 is less than register rs2 when both are treated as signed numbers, else 0 is written to rd. + - name: sltu template: R fields: @@ -1926,8 +2004,10 @@ instructions: value: "011" definition: | registers[rd] = ((registers[rs1] & 0xFFFFFFFFn) < (registers[rs2] & 0xFFFFFFFFn)) ? 1n : 0n; + help: Place the value 1 in register rd if register rs1 is less than + register rs2 when both are treated as unsigned numbers, else 0 is + written to rd. - help: Place the value 1 in register rd if register rs1 is less than register rs2 when both are treated as unsigned numbers, else 0 is written to rd. - name: sra template: R fields: @@ -2034,8 +2114,7 @@ instructions: value: "100" definition: | registers[rd] = (registers[rs1] ^ registers[rs2]); - help: Performs bitwise XOR on registers rs1 and rs2 and place the result - in rd. + help: Performs bitwise XOR on registers rs1 and rs2 and place the result in rd. # S-type instructions # 31-25 24-20 19-15 14-12 11-7 6-0 @@ -2065,7 +2144,6 @@ instructions: value: "001" definition: | CAPI.MEM.write(imm + registers[rs1], 2, BigInt.asUintN(16, registers[rs2]), rs2, 'half'); - help: Store 16-bit, values from the low bits of register rs2 to memory. # The check for the @@ -2078,7 +2156,6 @@ instructions: value: "010" definition: | CAPI.MEM.write(imm + registers[rs1], 4, BigInt.asUintN(32, registers[rs2]), rs2, 'word'); - help: Store 32-bit, values from the low bits of register rs2 to memory. - name: sd @@ -2114,9 +2191,9 @@ instructions: - field: imm type: offset_bytes definition: | - registers[rd] = registers["PC"] + (imm << 12n); - + registers[rd] = registers.pc + (imm << 12n); help: Build pc-relative addresses and uses the U-type format. AUIPC forms a 32-bit offset from the 20-bit U-immediate, filling in the lowest 12 bits with zeros, adds this offset to the pc, then places the result in register rd. + - name: lui template: U fields: @@ -2144,42 +2221,8 @@ instructions: value: "0000000000000000000000000" preoperation: 'let [fa0Value, fa0Type] = CAPI.ARCH.toJSNumberD(registers["fa0"]);' definition: | - switch (registers["a7"]) { - case 1n: - CAPI.SYSCALL.print(registers["a0"], 'int32'); - break; - case 2n: - case 3n: - CAPI.SYSCALL.print(fa0Value, 'float'); - break; - case 4n: - CAPI.SYSCALL.print(registers["a0"], 'string'); - break; - case 5n: - CAPI.SYSCALL.read('registers["a0"]', 'int32'); - break; - case 6n: - CAPI.SYSCALL.read(fa0Value, 'float'); - break; - case 7n: - CAPI.SYSCALL.read(fa0Value, 'double'); - break; - case 8n: - CAPI.SYSCALL.read('registers["a0"]', 'string', 'registers["a1"]'); - break; - case 9n: - CAPI.SYSCALL.sbrk('registers["a0"]', 'registers["a0"]'); - break; - case 10n: - CAPI.SYSCALL.exit(); - break; - case 11n: - CAPI.SYSCALL.print(registers["a0"], 'char'); - break; - case 12n: - CAPI.SYSCALL.read('registers["a0"]', 'char'); - break; - } + CAPI.INTERRUPTS.create(InterruptType.EnvironmentCall); + CAPI.STACK.beginFrame(); help: Make a request to the supporting execution environment. When executed in U-mode, S-mode, or M-mode, it generates an environment-call-from-U-mode exception, environment-call-from-S-mode @@ -2231,7 +2274,7 @@ instructions: if (registers[rs2] != 0) { registers[rd] = BigInt.asIntN( 32, - (BigInt.asIntN(32, registers[rs1]) / BigInt.asIntN(32, registers[rs2])) + (BigInt.asIntN(32, BigInt(registers[rs1])) / BigInt.asIntN(32, BigInt(registers[rs2]))) ); } else CAPI.VALIDATION.raise('Division by zero not allowed'); @@ -2251,7 +2294,7 @@ instructions: if (registers[rs2] != 0) { registers[rd] = BigInt.asIntN( 32, - (BigInt.asUintN(32, registers[rs1]) / BigInt.asUintN(32, registers[rs2])) + (BigInt.asUintN(32, BigInt(registers[rs1])) / BigInt.asUintN(32, BigInt(registers[rs2]))) ); } else CAPI.VALIDATION.raise('Division by zero not allowed'); @@ -2380,11 +2423,10 @@ instructions: type: SFP-Reg definition: | registers[rd] = CAPI.MEM.read(registers[rs1] + imm, 4, rd); - postoperation: | registers[rd] = CAPI.ARCH.NaNBox(registers[rd]); - help: Load a single-precision floating-point value from memory into floating-point register rd. + - name: fadd.s template: R-Floating fields: @@ -2407,11 +2449,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = rs1Number + rs2Number; - help: Perform single-precision floating-point addition. + - name: fclass.s template: R-Floating fields: @@ -2439,7 +2480,12 @@ instructions: a.slice(1, 9), a.slice(10), )); - help: Examines the value in floating-point register rs1 and writes to integer register rd a 10-bit mask that indicates the class of the floating-point number. The corresponding bit in rd will be set if the property is true and clear otherwise. All other bits in rd are cleared. Note that exactly one bit in rd will be set. + help: Examines the value in floating-point register rs1 and writes to + integer register rd a 10-bit mask that indicates the class of the + floating-point number. The corresponding bit in rd will be set if the + property is true and clear otherwise. All other bits in rd are cleared. + Note that exactly one bit in rd will be set. + - name: fcvt.s.w template: R-IntToFloat fields: @@ -2458,8 +2504,8 @@ instructions: registers[rd] = CAPI.ARCH.toBigInt(registers[rd],'NaNBfloat32_64'); definition: | registers[rd] = CAPI.FP.uint2int(registers[rs1]) - help: Converts a 32-bit signed integer, in integer register rs1 into a floating-point number in floating-point register rd. + - name: fcvt.s.wu template: R-IntToFloat fields: @@ -2476,8 +2522,8 @@ instructions: order: 3 definition: | registers[rd] = CAPI.FP.int2uint(registers[rs1]) - help: Converts a 32-bit unsigned integer, in integer register rs1 into a floating-point number in floating-point register rd. + - name: fcvt.w.s template: R-FloatToInt fields: @@ -2502,11 +2548,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = parseInt(registers[rs1]); - help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in integer register rd. + - name: fcvt.wu.s template: R-FloatToInt fields: @@ -2533,8 +2578,8 @@ instructions: } definition: | registers[rd] = CAPI.FP.int2uint(parseInt(rs1Number)); - help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in unsigned integer register rd. + - name: fdiv.s template: R-Floating fields: @@ -2560,8 +2605,8 @@ instructions: definition: | if (rs2Number != 0) { result = rs1Number / rs2Number; } else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); - help: Perform single-precision floating-point division. + - name: feq.s template: R-Floating fields: @@ -2583,11 +2628,13 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = (rs1Number === rs2Number) ? 1 : 0; + help: Performs a quiet equal comparison between floating-point registers + rs1 and rs2 and record the Boolean result in integer register rd. Only + signaling NaN inputs cause an Invalid Operation exception. The result is + 0 if either operand is NaN. - help: Performs a quiet equal comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. - name: fle.s template: R-Floating fields: @@ -2609,11 +2656,13 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = (rs1Number <= rs2Number) ? 1 : 0; + help: Performs a quiet equal comparison between floating-point registers + rs1 and rs2 and record the Boolean result in integer register rd. Only + signaling NaN inputs cause an Invalid Operation exception. The result is + 0 if either operand is NaN. - help: Performs a quiet less or equal comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. - name: flt.s template: R-Floating fields: @@ -2635,11 +2684,13 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = (rs1Number < rs2Number) ? 1 : 0; + help: Performs a quiet less or equal comparison between floating-point + registers rs1 and rs2 and record the Boolean result in integer register + rd. Only signaling NaN inputs cause an Invalid Operation exception. The + result is 0 if either operand is NaN. - help: Performs a quiet less comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. - name: fmax.s template: R-Floating fields: @@ -2659,11 +2710,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = Math.max(rs1Number, rs2Number); - help: Write the larger of single precision data in rs1 and rs2 to rd. + - name: fmin.s template: R-Floating fields: @@ -2685,8 +2735,8 @@ instructions: } definition: | result = Math.min(rs1Number, rs2Number); - help: Write the smaller of single precision data in rs1 and rs2 to rd. + - name: fmul.s template: R-Floating fields: @@ -2711,8 +2761,8 @@ instructions: } definition: | result = rs2Number * rs1Number; - help: Perform single-precision floating-point multiplication. + - name: fmv.w.x template: R-IntToFloat fields: @@ -2733,11 +2783,12 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = CAPI.FP.uint2float32(rs1Number); + help: Move the single-precision value encoded in IEEE 754-2008 standard + encoding from the lower 32 bits of integer register rs1 to the + floating-point register rd. - help: Move the single-precision value encoded in IEEE 754-2008 standard encoding from the lower 32 bits of integer register rs1 to the floating-point register rd. - name: fmv.x.w template: R-FloatToInt fields: @@ -2761,8 +2812,10 @@ instructions: registers[rs1] = CAPI.ARCH.toBigInt(rs1Number, type_rs1); definition: | result = CAPI.FP.float322uint(rs1Number); + help: Move the single-precision value in floating-point register rs1 + represented in IEEE 754-2008 encoding to the lower 32 bits of integer + register rd. - help: Move the single-precision value in floating-point register rs1 represented in IEEE 754-2008 encoding to the lower 32 bits of integer register rd. - name: fsgnj.s template: R-Floating fields: @@ -2784,8 +2837,8 @@ instructions: } definition: | result = (rs2Number >= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); - help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. + - name: fsgnjn.s template: R-Floating fields: @@ -2808,6 +2861,7 @@ instructions: definition: | result = (rs2Number <= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. + - name: fsgnjx.s template: R-Floating fields: @@ -2832,6 +2886,7 @@ instructions: let b = rs2Number < 0; result = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is XOR of sign bit of rs1 and rs2. + - name: fsqrt.s template: R-Floating fields: @@ -2858,7 +2913,6 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | if (rs1Number >= 0) { result = Math.sqrt(rs1Number); @@ -2868,6 +2922,7 @@ instructions: ); } help: Perform single-precision square root. + - name: fsub.s template: R-Floating fields: @@ -2890,11 +2945,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = rs1Number - rs2Number; + help: Perform single-precision floating-point subtraction. - help: Perform single-precision floating-point substraction. - name: fmadd.s template: R4 fields: @@ -2918,11 +2972,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = rs1Number * rs2Number + rs3Number; - help: Perform single-precision fused multiply addition. + - name: fmsub.s template: R4 fields: @@ -2946,11 +2999,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = rs1Number * rs2Number - rs3Number; - help: Perform single-precision fused multiply addition. + - name: fnmadd.s template: R4 fields: @@ -2974,11 +3026,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = -rs1Number * rs2Number - rs3Number; - help: Perform negated single-precision fused multiply addition. + - name: fnmsub.s template: R4 fields: @@ -3002,11 +3053,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = -rs1Number * rs2Number + rs3Number; - help: Perform negated single-precision fused multiply addition. + - name: fsw template: S fields: @@ -3045,6 +3095,7 @@ instructions: } registers[rd] = CAPI.MEM.read(registers[rs1] + imm, 8, rd); help: Load a double-precision floating-point value from memory into floating-point register rd. + - name: fadd.d template: R-Double fields: @@ -3069,8 +3120,8 @@ instructions: } definition: | result = rs1Number + rs2Number; - help: Perform double-precision floating-point addition. + - name: fclass.d template: R-Double fields: @@ -3103,7 +3154,12 @@ instructions: a.slice(1, 12), a.slice(13), ); - help: Examines the value in double-precision floating-point register rs1 and writes to integer register rd a 10-bit mask that indicates the class of the floating-point number. The corresponding bit in rd will be set if the property is true and clear otherwise. All other bits in rd are cleared. Note that exactly one bit in rd will be set. + help: Examines the value in double-precision floating-point register rs1 + and writes to integer register rd a 10-bit mask that indicates the class + of the floating-point number. The corresponding bit in rd will be set if + the property is true and clear otherwise. All other bits in rd are + cleared. Note that exactly one bit in rd will be set. + - name: fcvt.d.s template: R-Conversion fields: @@ -3134,8 +3190,8 @@ instructions: } definition: | result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual - help: Converts double floating-point register in rs1 into a double floating-point number in floating-point register rd. + - name: fcvt.d.w template: R-Conversion fields: @@ -3161,8 +3217,8 @@ instructions: registers[rd] = CAPI.ARCH.toBigInt(result, 'float64'); definition: | result = CAPI.FP.uint2int(rs1Number); - help: Converts a 32-bit signed integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. + - name: fcvt.d.wu template: R-Conversion fields: @@ -3193,8 +3249,8 @@ instructions: } definition: | result = CAPI.FP.int2uint(parseFloat(rs1Number)); - help: Converts a 32-bit unsigned integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. + - name: fcvt.s.d template: R-Conversion fields: @@ -3225,8 +3281,8 @@ instructions: } definition: | result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual - help: Converts double floating-point register in rs1 into a floating-point number in floating-point register rd. + - name: fcvt.w.d template: R-Conversion fields: @@ -3255,11 +3311,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | result = CAPI.FP.int2uint(parseInt(rs1Number)); - help: Converts a double-precision floating-point number in floating-point register rs1 to a signed 32-bit integer, in integer register rd. + - name: fcvt.wu.d template: R-Conversion fields: @@ -3288,11 +3343,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | result = CAPI.FP.int2uint(parseInt(rs1Number)); - help: Converts a double-precision floating-point number in floating-point register rs1 to a unsigned 32-bit integer, in integer register rd. + - name: fdiv.d template: R-Double fields: @@ -3315,10 +3369,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | result = rs1Number / rs2Number; help: Perform double-precision floating-point division. + - name: feq.d template: R-Double fields: @@ -3335,11 +3389,18 @@ instructions: [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); postoperation: | - + if (CAPI.FP.isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } definition: | registers[rd] = (rs1Number == rs2Number) ? 1 : 0; + help: Performs a quiet equal comparison between double-precision + floating-point registers rs1 and rs2 and record the Boolean result in + integer register rd. Only signaling NaN inputs cause an Invalid + Operation exception. The result is 0 if either operand is NaN. - help: Performs a quiet equal comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. - name: fle.d template: R-Double fields: @@ -3356,11 +3417,18 @@ instructions: [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); postoperation: | - + if (CAPI.FP.isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } definition: | registers[rd] = (rs1Number <= rs2Number) ? 1 : 0; + help: Performs a quiet less or equal comparison between double-precision + floating-point registers rs1 and rs2 and record the Boolean result in + integer register rd. Only signaling NaN inputs cause an Invalid + Operation exception. The result is 0 if either operand is NaN. - help: Performs a quiet less or equal comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. - name: flt.d template: R-Double fields: @@ -3377,11 +3445,18 @@ instructions: [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); postoperation: | - + if (CAPI.FP.isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } definition: | registers[rd] = (rs1Number < rs2Number) ? 1 : 0; + help: Performs a quiet less comparison between double-precision + floating-point registers rs1 and rs2 and record the Boolean result in + integer register rd. Only signaling NaN inputs cause an Invalid + Operation exception. The result is 0 if either operand is NaN. - help: Performs a quiet less comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. - name: fmax.d template: R-Double fields: @@ -3401,11 +3476,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | result = Math.max(rs1Number, rs2Number); - help: Write the larger of double precision data in rs1 and rs2 to rd. + - name: fmin.d template: R-Double fields: @@ -3425,11 +3499,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | result = Math.min(rs1Number, rs2Number); - help: Write the smaller of double precision data in rs1 and rs2 to rd. + - name: fmul.d template: R-Double fields: @@ -3452,11 +3525,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | result = rs1Number * rs2Number; - help: Perform double-precision floating-point addition. + - name: fsgnj.d template: R-Double fields: @@ -3476,10 +3548,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | registers[rd] = (rs2Number > 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); help: Perform double-precision floating-point multiplication. + - name: fsgnjn.d template: R-Double fields: @@ -3499,11 +3571,11 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | registers[rd] = (rs2Number > 0) ? -Math.abs(rs1Number) : +Math.abs(rs1Number); + help: Produce a result that takes all bits except the sign bit from rs1. + The result's sign bit is opposite of rs2's sign bit. - help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is opposite of rs2's sign bit. - name: fsgnjx.d template: R-Double fields: @@ -3523,12 +3595,13 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | let a = rs1Number < 0; let b = rs2Number < 0; registers[rd] = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); - help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is XOR of sign bit of rs1 and rs2. + help: Produce a result that takes all bits except the sign bit from rs1. + The result's sign bit is XOR of sign bit of rs1 and rs2. + - name: fsqrt.d template: R-Double fields: @@ -3555,7 +3628,6 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | if (rs1Number >= 0) { registers[rd] = Math.sqrt(rs1Number); @@ -3565,6 +3637,7 @@ instructions: ); } help: Perform double-precision square root. + - name: fsub.d template: R-Double fields: @@ -3587,11 +3660,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | result = rs1Number - rs2Number; - help: Perform double-precision floating-point addition. + - name: fmadd.d template: R4-Double fields: @@ -3615,12 +3687,11 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); definition: | result = rs1Number * rs2Number + rs3Number; - help: Perform double-precision fused multiply addition. + - name: fmsub.d template: R4-Double fields: @@ -3644,12 +3715,11 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); definition: | result = rs1Number * rs2Number - rs3Number; - help: Perform double-precision fused multiply subtraction. + - name: fnmadd.d template: R4-Double fields: @@ -3673,12 +3743,11 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); definition: | result = -rs1Number * rs2Number - rs3Number; - help: Perform negated double-precision fused multiply addition. + - name: fnmsub.d template: R4-Double fields: @@ -3702,12 +3771,11 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); definition: | result = -rs1Number * rs2Number + rs3Number; - help: Perform negated double-precision fused multiply subtraction. + - name: fsd template: S fields: @@ -3725,17 +3793,70 @@ instructions: CAPI.MEM.addHint(registers[rs1] + imm, "float64", 64); help: Store a double-precision value from the floating-point registers to memory. - # Zicsr: - # _____ _ - # |__ /(_) ___ ___ _ __ - # / / | | / __|/ __|| '__| - # / /_ | || (__ \__ \| | - # /____||_| \___||___/|_| - # RV32/64 Zicsr Standard Extension - # TODO: Implement CSR instructions + Priv: + # ____ _ + # | _ \ _ __ (_)__ __ + # | |_) || '__|| |\ \ / / + # | __/ | | | | \ V / + # |_| |_| |_| \_/ + # RV32/64 Privileged instructions - Zifencei: + - name: mret + type: Control + template: Custom + fields: + - field: opcode + value: "1110011" + - field: funct12 + type: cop + startbit: 31 + stopbit: 20 + value: "001100000010" + - field: zeros + type: cop + startbit: 19 + stopbit: 7 + value: "0000000000000" + definition: | + registers.pc = registers.mepc; + CAPI.INTERRUPTS.globalClear(); // TODO: clear only pending interrupt + CAPI.STACK.endFrame(); + CAPI.INTERRUPTS.setUserMode(); + CAPI.INTERRUPTS.clearHighlight(); + help: Return from traps in M-mode, and mret copies mpie into mie, then + sets mpie. + properties: + - privileged + + + Zicsr: + # _____ _ + # |__ /(_) ___ ___ _ __ + # / / | | / __|/ __|| '__| + # / /_ | || (__ \__ \| | + # /____||_| \___||___/|_| + # RV32/64 Zicsr Standard Extension + + - name: csrrw + type: Transfer between registers + template: CSR + fields: + - field: opcode + value: "1110011" + - field: funct3 + value: "001" + definition: | + registers[rd] = registers[csr]; + registers[csr] = registers[rs1]; + help: Atomically swaps values in the CSRs and integer registers. CSRRW + reads the old value of the CSR, then writes it to integer register rd. + The initial value in rs1 is written to the CSR. + + # TODO: Implement rest of CSR instructions + + +Zifencei: # _____ _ __ _ # |__ /(_) / _| ___ _ __ ___ ___ (_) # / / | || |_ / _ \| '_ \ / __|/ _ \| | @@ -3770,6 +3891,7 @@ instructions: help: Provides explicit synchronization between writes to instruction memory and instruction fetches on the same hart. + pseudoinstructions: # Make sure the definitions correspond with those in the RISC-V ASM manual (TODO: Check these!) @@ -3918,13 +4040,13 @@ pseudoinstructions: type: imm-unsigned definition: | no_ret_op{ - tmp = Field.2.(31,0).int; - tmp_pc_offset = (reg.pc - 4) & 0xFFF; + tmp = Field.2.(31,0).int - (reg.pc - 4); tmp_low = tmp & 0x00000FFF; - tmp_hi = tmp >> 12 + tmp_low = tmp_low>0x7FF? tmp_low - 0x1000 : tmp_low; + tmp_hi = (tmp - tmp_low) >> 12; }; auipc rd, op{tmp_hi}; - addi rd, rd, op{tmp_low - (tmp_pc_offset)}; + addi rd, rd, op{tmp_low}; - name: li fields: @@ -4093,3 +4215,168 @@ enums: rmm: 4 dyn: 7 DEFAULT: dyn + +interrupts: + handlers: + creator_syscall: | + let [fa0Value, fa0Type] = CAPI.ARCH.toJSNumberD(registers.fa0); + switch (registers.a7) { + case 1n: + CAPI.SYSCALL.print(registers.a0, 'int32'); + break; + case 2n: + case 3n: + CAPI.SYSCALL.print(fa0Value, 'float'); + break; + case 4n: + CAPI.SYSCALL.print(registers.a0, 'string'); + break; + case 5n: + CAPI.SYSCALL.read('a0', 'int32'); + break; + case 6n: + CAPI.SYSCALL.read('fa0', 'float'); + break; + case 7n: + CAPI.SYSCALL.read('fa0', 'double'); + break; + case 8n: + CAPI.SYSCALL.read('a0', 'string', 'a1'); + break; + case 9n: + CAPI.SYSCALL.sbrk('a0', 'a0'); + break; + case 10n: + CAPI.SYSCALL.exit(); + break; + case 11n: + CAPI.SYSCALL.print(registers.a0, 'char'); + break; + case 12n: + CAPI.SYSCALL.read('a0', 'char'); + break; + } + CAPI.INTERRUPTS.clearHighlight(); + + custom: | + CAPI.INTERRUPTS.globalDisable(); + CAPI.INTERRUPTS.setKernelMode(); + registers.mepc = CAPI.REG.read("pc"); // get "real" PC (next instruction) + + // jump to handler + if (registers.mtvec & 1n) { // vectored mode + registers.pc = + (registers.mtvec >> 2n) + 4 * (registers.mcause & (2 ** 32 - 1)); + } else { // direct mode + registers.pc = registers.mtvec >> 2n + } + + check: | + if (registers.mip & (2n ** 11n)) return InterruptType.External; + if (registers.mip & (2n ** 3n)) return InterruptType.Software; + if (registers.mip & (2n ** 7n)) return InterruptType.Timer; + return null; + + is_enabled: | + switch (type) { + case InterruptType.Software: + case InterruptType.EnvironmentCall: + return !! (registers.mie & 2n ** 3n); // MSIE + case InterruptType.External: + return !! (registers.mie & 2n ** 11n); // MEIE + case InterruptType.Timer: + return !! (registers.mie & 2n ** 7n); // MTIE + } + return false; + + is_global_enabled: | + return !!(registers.mstatus & 2n ** 3n); // MIE + + enable: | + switch (type) { + case InterruptType.Software: + case InterruptType.EnvironmentCall: + registers.mie |= 2n ** 3n; // MSIE + break; + case InterruptType.External: + registers.mie |= 2n ** 11n; // MEIE + break; + case InterruptType.Timer: + registers.mie |= 2n ** 7n; // MTIE + break; + } + + disable: | + switch (type) { + case InterruptType.Software: + case InterruptType.EnvironmentCall: + registers.mie &= ~(2n ** 3n); // MSIE + break; + case InterruptType.External: + registers.mie &= ~(2n ** 11n); // MEIE + break; + case InterruptType.Timer: + registers.mie &= ~(2n ** 7n); // MTIE + break; + } + + global_enable: | + registers.mstatus | 2n ** 3n + + global_disable: | + return !(registers.mstatus | (2n ** 3n)); + + global_clear: | + registers.mip = 0n; + registers.mcause = 0n; + + clear: | + switch (type) { + case InterruptType.Software: + case InterruptType.EnvironmentCall: + registers.mip &= ~(2n ** 3n); // MSIP + break; + case InterruptType.External: + registers.mip &= ~(2n ** 11n); // MEIP + break; + case InterruptType.Timer: + registers.mip &= ~(2n ** 7n); // MTIP + break; + } + registers.mcause = 0n; + + create: | + switch (type) { + case InterruptType.Software: + registers.mcause = 2n ** 3n; + registers.mip |= 2n ** 3n; // MSIP + break; + case InterruptType.External: + registers.mcause = 2n ** 31n + 11n; + registers.mip |= 2n ** 11n; // MEIP + break; + case InterruptType.EnvironmentCall: + registers.mcause = 2n ** 8n; + registers.mip |= 2n ** 3n; // MSIP + break; + case InterruptType.Timer: + registers.mcause = 2n ** 31n + 7n; + registers.mip |= 2n ** 7n; // MTIP + break; + } + +timer: + tick_cycles: 1 + advance: | + registers.mtime = (registers.mtime + 1n) % (2n**32n - 1n); + handler: | + if (registers.mtime === registers.mtimecmp) { + CAPI.INTERRUPTS.create(InterruptType.Timer); + } + is_enabled: | + return !! (registers.mie & 2n ** 7n); // MTIE + enable: | + registers.mie |= 2n ** 7n; // MTIE = 1 + disable: | + registers.mie &= ~(2n ** 7n); // MTIE = 0 + diff --git a/architecture/RISCV/SRV32.yml b/architecture/RISCV/SRV32.yml new file mode 100644 index 000000000..acb3049ed --- /dev/null +++ b/architecture/RISCV/SRV32.yml @@ -0,0 +1,4584 @@ +# yaml-language-server: $schema=../schema.json +version: 2.0.0 + +# ASCII text generated w/ https://patorjk.com/software/taag/#p=display&h=1&f=Standard +# instruction help text extracted from https://msyksphinz-self.github.io/riscv-isadoc/html/index.html + +config: + name: SRV32 + word_size: 32 + description: RISC-V is an instruction set architecture (ISA) based on the RISC type and its hardware is free. This architecture was created in 2010 at the University of California, Berkeley. + endianness: big_endian + memory_alignment: true + main_function: main + passing_convention: true + sensitive_register_name: true + comment_prefix: "#" + start_address: 0 + pc_offset: -4 + byte_size: 8 + plugin: riscv + assemblers: + - name: "Sail" + description: Default Creator Compiler +extensions: + I: + description: RV32I Base Instruction Set + template: Base + M: + description: RV32M Integer Multiply/Divide Extension + type: extension + F: + description: RV32F Single-Precision Floating-Point Extension + type: extension + implies: + - Zicsr + D: + description: RV32D Double-Precision Floating-Point Extension + type: extension + implies: + - F + Zifencei: + description: RV32/RV64 Zifencei Standard Extension + type: extension + Zicsr: + description: RV32/RV64 Zicsr Standard Extension + type: extension +components: + - name: Control registers + type: ctrl_registers + double_precision: false + elements: + - name: + - PC + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - program_counter + - name: Integer registers + type: int_registers + double_precision: false + elements: + - name: + - x0 + - zero + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - ignore_write + - name: + - x1 + - ra + nbits: 32 + value: 4294967295 + default_value: 4294967295 + encoding: 1 + properties: + - read + - write + - name: + - x2 + - sp + nbits: 32 + value: 268435452 + default_value: 26843545 + encoding: 2 + properties: + - read + - write + - stack_pointer + - name: + - x3 + - gp + nbits: 32 + value: 0 + default_value: 0 + encoding: 3 + properties: + - read + - write + - global_pointer + - name: + - x4 + - tp + nbits: 32 + value: 0 + default_value: 0 + encoding: 4 + properties: + - read + - write + - name: + - x5 + - t0 + nbits: 32 + value: 0 + default_value: 0 + encoding: 5 + properties: + - read + - write + - name: + - x6 + - t1 + nbits: 32 + value: 0 + default_value: 0 + encoding: 6 + properties: + - read + - write + - name: + - x7 + - t2 + nbits: 32 + value: 0 + default_value: 0 + encoding: 7 + properties: + - read + - write + - name: + - x8 + - fp + - s0 + nbits: 32 + value: 0 + default_value: 0 + encoding: 8 + properties: + - read + - write + - frame_pointer + - saved + - name: + - x9 + - s1 + nbits: 32 + value: 0 + default_value: 0 + encoding: 9 + properties: + - read + - write + - saved + - name: + - x10 + - a0 + nbits: 32 + value: 0 + default_value: 0 + encoding: 10 + properties: + - read + - write + - name: + - x11 + - a1 + nbits: 32 + value: 0 + default_value: 0 + encoding: 11 + properties: + - read + - write + - name: + - x12 + - a2 + nbits: 32 + value: 0 + default_value: 0 + encoding: 12 + properties: + - read + - write + - name: + - x13 + - a3 + nbits: 32 + value: 0 + default_value: 0 + encoding: 13 + properties: + - read + - write + - name: + - x14 + - a4 + nbits: 32 + value: 0 + default_value: 0 + encoding: 14 + properties: + - read + - write + - name: + - x15 + - a5 + nbits: 32 + value: 0 + default_value: 0 + encoding: 15 + properties: + - read + - write + - name: + - x16 + - a6 + nbits: 32 + value: 0 + default_value: 0 + encoding: 16 + properties: + - read + - write + - name: + - x17 + - a7 + nbits: 32 + value: 0 + default_value: 0 + encoding: 17 + properties: + - read + - write + - name: + - x18 + - s2 + nbits: 32 + value: 0 + default_value: 0 + encoding: 18 + properties: + - read + - write + - saved + - name: + - x19 + - s3 + nbits: 32 + value: 0 + default_value: 0 + encoding: 19 + properties: + - read + - write + - saved + - name: + - x20 + - s4 + nbits: 32 + value: 0 + default_value: 0 + encoding: 20 + properties: + - read + - write + - saved + - name: + - x21 + - s5 + nbits: 32 + value: 0 + default_value: 0 + encoding: 21 + properties: + - read + - write + - saved + - name: + - x22 + - s6 + nbits: 32 + value: 0 + default_value: 0 + encoding: 22 + properties: + - read + - write + - saved + - name: + - x23 + - s7 + nbits: 32 + value: 0 + default_value: 0 + encoding: 23 + properties: + - read + - write + - saved + - name: + - x24 + - s8 + nbits: 32 + value: 0 + default_value: 0 + encoding: 24 + properties: + - read + - write + - saved + - name: + - x25 + - s9 + nbits: 32 + value: 0 + default_value: 0 + encoding: 25 + properties: + - read + - write + - saved + - name: + - x26 + - s10 + nbits: 32 + value: 0 + default_value: 0 + encoding: 26 + properties: + - read + - write + - saved + - name: + - x27 + - s11 + nbits: 32 + value: 0 + default_value: 0 + encoding: 27 + properties: + - read + - write + - saved + - name: + - x28 + - t3 + nbits: 32 + value: 0 + default_value: 0 + encoding: 28 + properties: + - read + - write + - name: + - x29 + - t4 + nbits: 32 + value: 0 + default_value: 0 + encoding: 29 + properties: + - read + - write + - name: + - x30 + - t5 + nbits: 32 + value: 0 + default_value: 0 + encoding: 30 + properties: + - read + - write + - name: + - x31 + - t6 + nbits: 32 + value: 0 + default_value: 0 + encoding: 31 + properties: + - read + - write + - name: Floating point registers + type: fp_registers + double_precision: true + elements: + - name: + - f0 + - ft0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - f1 + - ft1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 1 + properties: + - read + - write + - name: + - f2 + - ft2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 2 + properties: + - read + - write + - name: + - f3 + - ft3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 3 + properties: + - read + - write + - name: + - f4 + - ft4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 4 + properties: + - read + - write + - name: + - f5 + - ft5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 5 + properties: + - read + - write + - name: + - f6 + - ft6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 6 + properties: + - read + - write + - name: + - f7 + - ft7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 7 + properties: + - read + - write + - name: + - f8 + - fs0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 8 + properties: + - read + - write + - saved + - name: + - f9 + - fs1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 9 + properties: + - read + - write + - saved + - name: + - f10 + - fa0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 10 + properties: + - read + - write + - name: + - f11 + - fa1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 11 + properties: + - read + - write + - name: + - f12 + - fa2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 12 + properties: + - read + - write + - name: + - f13 + - fa3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 13 + properties: + - read + - write + - name: + - f14 + - fa4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 14 + properties: + - read + - write + - name: + - f15 + - fa5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 15 + properties: + - read + - write + - name: + - f16 + - fa6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 16 + properties: + - read + - write + - name: + - f17 + - fa7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 17 + properties: + - read + - write + - name: + - f18 + - fs2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 18 + properties: + - read + - write + - saved + - name: + - f19 + - fs3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 19 + properties: + - read + - write + - saved + - name: + - f20 + - fs4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 20 + properties: + - read + - write + - saved + - name: + - f21 + - fs5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 21 + properties: + - read + - write + - saved + - name: + - f22 + - fs6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 22 + properties: + - read + - write + - saved + - name: + - f23 + - fs7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 23 + properties: + - read + - write + - saved + - name: + - f24 + - fs8 + nbits: 64 + value: 0 + default_value: 0 + encoding: 24 + properties: + - read + - write + - saved + - name: + - f25 + - fs9 + nbits: 64 + value: 0 + default_value: 0 + encoding: 25 + properties: + - read + - write + - saved + - name: + - f26 + - fs10 + nbits: 64 + value: 0 + default_value: 0 + encoding: 26 + properties: + - read + - write + - saved + - name: + - f27 + - fs11 + nbits: 64 + value: 0 + default_value: 0 + encoding: 27 + properties: + - read + - write + - saved + - name: + - f28 + - ft8 + nbits: 64 + value: 0 + default_value: 0 + encoding: 28 + properties: + - read + - write + - name: + - f29 + - ft9 + nbits: 64 + value: 0 + default_value: 0 + encoding: 29 + properties: + - read + - write + - name: + - f30 + - ft10 + nbits: 64 + value: 0 + default_value: 0 + encoding: 30 + properties: + - read + - write + - name: + - f31 + - ft11 + nbits: 64 + value: 0 + default_value: 0 + encoding: 31 + properties: + - read + - write + - name: Vectorial registers + type: v_registers + double_precision: true + elements: + - name: + - v0 + - vt0 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v1 + - vt1 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v2 + - vt2 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v3 + - vt3 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v4 + - vt4 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v5 + - vt5 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v6 + - vt6 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v7 + - vt7 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v8 + - vt8 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v9 + - vt9 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v10 + - vt10 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v11 + - vt11 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v12 + - vt12 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v13 + - vt13 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v14 + - vt14 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v15 + - vt15 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v16 + - vt16 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v17 + - vt17 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v18 + - vt18 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v19 + - vt19 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v20 + - vt20 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v21 + - vt21 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v22 + - vt22 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v23 + - vt23 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v24 + - vt24 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v25 + - vt25 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v26 + - vt26 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v27 + - vt27 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v28 + - vt28 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v29 + - vt29 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v30 + - vt30 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v31 + - vt31 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: Control state registers + type: csr_registers + double_precision: false + elements: +# USER registers + - name: + - ustatus + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uie + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - utvec + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uscratch + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uepc + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - ucause + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - utval + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uip + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write +# SUPERVISOR registers + - name: + - sstatus + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sedeleg + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sideleg + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sie + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - stvec + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sscratch + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sepc + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - scause + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - stval + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sip + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - satp + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write +# MACHINE REGISTERS + - name: + - mstatus + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - misa + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - medeleg + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mideleg + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mie + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mstvec + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mscratch + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mepc + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mcause + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mtval + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mip + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mcycle + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - minstret + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write +# COMMON REGISTERS + - name: + - cycle + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - time + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - instret + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - hpmcounterX + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - hpmcounterXh + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mhartid + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + +directives: + - name: .data + action: data_segment + size: null + - name: .text + action: code_segment + size: null + - name: .bss + action: global_symbol + size: null + - name: .zero + action: space + size: 1 + - name: .space + action: space + size: 1 + - name: .align + action: align + size: null + - name: .balign + action: balign + size: null + - name: .globl + action: global_symbol + size: null + - name: .string + action: ascii_null_end + size: null + - name: .asciz + action: ascii_null_end + size: null + - name: .ascii + action: ascii_not_null_end + size: null + - name: .byte + action: byte + size: 1 + - name: .half + action: half_word + size: 2 + - name: .word + action: word + size: 4 + - name: .dword + action: double_word + size: 8 + - name: .float + action: float + size: 4 + - name: .double + action: double + size: 8 + +memory_layout: + text: + start: 0x80000000 + end: 0x80003FFF + data: + start: 0x80004000 + end: 0x80005FFF + stack: + start: 0x8000AFFC + end: 0x8000AFFF + +templates: + - name: B + type: Conditional bifurcation + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 1 + - name: rs2 + type: INT-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 2 + - name: imm + type: offset_bytes + startbit: + - 31 + - 7 + - 30 + - 11 + stopbit: + - 31 + - 7 + - 25 + - 8 + padding: 1 + order: 3 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: I + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: imm-signed + startbit: 31 + stopbit: 20 + order: 3 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: I-Offset + # Not an "official" instruction, but used for the offset in the I-type instructions + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: imm-signed + startbit: 31 + stopbit: 20 + order: 2 + space: false + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + order: 3 + prefix: ( + suffix: ) + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: I-Shift + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: shamt + type: imm-unsigned + startbit: 24 + stopbit: 20 + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: J + type: Unconditional bifurcation + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: offset_bytes + startbit: + - 31 + - 19 + - 20 + - 30 + stopbit: + - 31 + - 12 + - 20 + - 21 + padding: 1 + order: 2 + + - name: R + type: Arithmetic integer + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: INT-Reg + startbit: 24 + stopbit: 20 + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-Floating # Used in rv32f / rv64f + type: Arithmetic floating point + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-Double # Used in rv64d + nwords: 1 + type: Arithmetic floating point + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-IntToFloat # fcvt.s.w,... + nwords: 1 + type: Transfer between registers + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct5 + type: cop + startbit: 24 + stopbit: 20 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-FloatToInt # fcvt.w.s,... + type: Transfer between registers + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct5 + type: cop + startbit: 24 + stopbit: 20 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-Conversion # Generic template + type: Transfer between registers + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: Not-Set + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: Not-Set + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct5 + type: cop + startbit: 24 + stopbit: 20 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R4 + type: Arithmetic floating point + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: rs3 + type: DFP-Reg + startbit: 31 + stopbit: 27 + suffix: "," + order: 4 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + - name: funct2 + type: cop + startbit: 26 + stopbit: 25 + + - name: R4-Double + type: Arithmetic floating point + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: rs3 + type: DFP-Reg + startbit: 31 + stopbit: 27 + suffix: "," + order: 4 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + - name: funct2 + type: cop + startbit: 26 + stopbit: 25 + + - name: S + type: Memory access + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rs2 + type: INT-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 1 + - name: imm + type: imm-signed + startbit: + - 31 + - 11 + stopbit: + - 25 + - 7 + order: 2 + space: false + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + prefix: ( + suffix: ) + order: 3 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: U + type: Arithmetic integer + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: imm-unsigned + startbit: 31 + stopbit: 12 + order: 2 + + - name: CSR + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + order: 3 + - name: csr + type: Ctrl-Reg + startbit: 31 + stopbit: 20 + suffix: "," + order: 2 + + - name: Custom + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + +instructions: + I: + - name: beq + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "000" + definition: | + if (registers[rs1] === registers[rs2]) + registers["PC"] = registers["PC"] + imm; + + help: Take the branch if registers rs1 and rs2 are equal. + - name: bge + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "101" + definition: | + if (CAPI.FP.uint2int(registers[rs1]) >= CAPI.FP.uint2int(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is greater than or equal to rs2, using signed comparison. + - name: bgeu + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "111" + definition: | + if (CAPI.FP.int2uint(registers[rs1]) > CAPI.FP.int2uint(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is greater than or equal to rs2, using unsigned comparison. + - name: blt + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "100" + definition: | + if (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is less than rs2, using signed comparison. + - name: bltu + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "110" + definition: | + if (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is less than rs2, using unsigned comparison. + - name: bne + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "001" + definition: | + if (registers[rs1] !== registers[rs2]) + registers["PC"] = registers["PC"] + imm; + + help: Take the branch if registers rs1 and rs2 are not equal. + - name: addi + extension: I + template: I + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers[rs1] + imm; + + help: Adds the sign-extended 12-bit immediate to register rs1. Arithmetic overflow is ignored and the result is simply the low XLEN bits of the result. + - name: andi + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "111" + definition: | + registers[rd] = registers[rs1] & CAPI.FP.int2uint(imm); + + help: Performs bitwise AND on register rs1 and the sign-extended 12-bit immediate and place the result in rd. + - name: jalr + extension: I + template: I-Offset + type: Unconditional bifurcation + fields: + - field: opcode + value: "1100111" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers["PC"] + 4n; + registers["PC"] = (registers[rs1] + imm) & ~1n; + CAPI.CHECK_STACK.end(); CAPI.DRAW_STACK.end(registers["PC"]); + help: Jump to address and place return address in rd. + - name: lb + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "000" + definition: | + registers[rd] = CAPI.MEM.read(imm + registers[rs1], 1, rd); + + help: Loads a 8-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: lbu + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "100" + definition: | + let addr = CAPI.FP.int2uint(registers[rs1]) + imm; + registers[rd] = CAPI.MEM.read(addr, 1, rd); + registers[rd] = CAPI.FP.int2uint(registers[rd]); + help: Loads a 8-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. + - name: lh + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "001" + definition: | + registers[rd] = CAPI.MEM.read(imm + registers[rs1], 2, rd); + + help: Loads a 16-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: lhu + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "101" + definition: | + let addr = CAPI.FP.int2uint(registers[rs1], 32) + imm; + registers[rd] = CAPI.MEM.read(addr, 2, rd); + registers[rd] = CAPI.FP.int2uint(registers[rd]); + help: Loads a 16-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. + - name: lw + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "010" + definition: | + let addr = CAPI.FP.int2uint(registers[rs1], 32) + imm; + registers[rd] = CAPI.MEM.read(addr, 4, rd); + help: Loads a 32-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: ld + extension: D + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "011" + definition: | + let addr = CAPI.FP.int2uint(registers[rs1]) + imm; + registers[rd] = CAPI.MEM.read(addr, 8, rd); + help: Loads a 64-bit value from memory into register rd for RV64I. + - name: ori + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "110" + definition: | + registers[rd] = registers[rs1] | imm; + + help: Performs bitwise OR on register rs1 and the sign-extended 12-bit immediate and place the result in rd. + - name: slli + extension: I + template: I-Shift + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "001" + - field: funct7 + value: "0000000" + definition: | + if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] << shamt); + + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. + - name: slti + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "010" + definition: | + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(imm)) ? 1 : 0; + + help: Place the value 1 in register rd if register rs1 is less than the signextended immediate when both are treated as signed numbers, else 0 is written to rd. + - name: sltiu + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "011" + definition: | + registers[rd] = (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(imm)) ? 1: 0; + help: Place the value 1 in register rd if register rs1 is less than the immediate when both are treated as unsigned numbers, else 0 is written to rd. + - name: srai + extension: I + template: I-Shift + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "101" + - field: funct7 + value: "0100000" + definition: | + if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] >> shamt); + + help: Performs arithmetic right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. + - name: srli + extension: I + template: I-Shift + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "101" + - field: funct7 + value: "0000000" + definition: | + if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] >> shamt); + + help: Performs logical right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. + - name: xori + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "100" + definition: | + registers[rd] = registers[rs1] ^ imm; + + help: Performs bitwise XOR on register rs1 and the sign-extended 12-bit immediate and place the result in rd. Note, 'XORI rd, rs1, -1' performs a bitwise logical inversion of register rs1(assembler pseudo-instruction NOT rd, rs). + - name: jal + extension: I + template: J + fields: + - field: opcode + value: "1101111" + definition: | + registers[rd] = registers["PC"] + 4n; + registers["PC"] = registers["PC"] + imm; + CAPI.CHECK_STACK.begin(registers["PC"] + imm); + CAPI.DRAW_STACK.begin(registers["PC"] + imm); // This is not an accident. We only see the virtual PC here, and the virtual/physical PC sync happens after the instruction execution. + help: Jump to address and place return address in rd. + - name: add + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers[rs2] + registers[rs1]; + + help: Adds the registers rs1 and rs2 and stores the result in rd. Arithmetic overflow is ignored and the result is simply the low XLEN bits of the result. + - name: and + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "111" + definition: | + registers[rd] = registers[rs1] & registers[rs2]; + + help: Performs bitwise AND on registers rs1 and rs2 and place the result in rd. + - name: or + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "110" + definition: | + registers[rd] = registers[rs1] | registers[rs2]; + + help: Performs bitwise OR on registers rs1 and rs2 and place the result in rd. + - name: sll + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "001" + definition: | + const shiftAmount = registers[rs2] & 0x1Fn; + registers[rd] = (registers[rs1] << shiftAmount) & 0xFFFFFFFFn; + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. + - name: slt + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "010" + definition: | + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) ? 1 : 0; + + help: Place the value 1 in register rd if register rs1 is less than register rs2 when both are treated as signed numbers, else 0 is written to rd. + - name: sltu + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "011" + definition: | + registers[rd] = ((registers[rs1] & 0xFFFFFFFFn) < (registers[rs2] & 0xFFFFFFFFn)) ? 1n : 0n; + + help: Place the value 1 in register rd if register rs1 is less than register rs2 when both are treated as unsigned numbers, else 0 is written to rd. + - name: sra + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0100000" + - field: funct3 + value: "101" + definition: | + const temp = BigInt.asIntN(32, BigInt(registers[rs1])) >> BigInt(registers[rs2]); + registers[rd] = CAPI.FP.int2uint(temp); + help: Performs arithmetic right shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. + - name: srl + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "101" + definition: | + const shiftAmount = registers[rs2] & 0x1Fn; + registers[rd] = (registers[rs1] >> shiftAmount) & 0xFFFFFFFFn; + help: Logical right shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. + - name: sub + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0100000" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers[rs1] - registers[rs2]; + + help: Subs the register rs2 from rs1 and stores the result in rd. Arithmetic overflow is ignored and the result is simply the low XLEN bits of the result. + - name: xor + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "100" + definition: | + registers[rd] = (registers[rs1] ^ registers[rs2]); + + help: Performs bitwise XOR on registers rs1 and rs2 and place the result in rd. + - name: sb + extension: I + template: S + fields: + - field: opcode + value: "0100011" + - field: funct3 + value: "000" + definition: | + CAPI.MEM.write(registers[rs1] + imm, 1, BigInt.asUintN(8, registers[rs2]), rs2, 'byte'); + + help: Store 8-bit, values from the low bits of register rs2 to memory. + - name: sh + extension: I + template: S + fields: + - field: opcode + value: "0100011" + - field: funct3 + value: "001" + definition: | + CAPI.MEM.write(imm + registers[rs1], 2, BigInt.asUintN(16, registers[rs2]), rs2, 'half'); + + help: Store 16-bit, values from the low bits of register rs2 to memory. + - name: sw + extension: I + template: S + fields: + - field: opcode + value: "0100011" + - field: funct3 + value: "010" + definition: | + CAPI.MEM.write(imm + registers[rs1], 4, BigInt.asUintN(32, registers[rs2]), rs2, 'word'); + + help: Store 32-bit, values from the low bits of register rs2 to memory. + + - name: sd + extension: D + template: S + fields: + - field: opcode + value: "0100011" + - field: funct3 + value: "011" + definition: | + CAPI.MEM.write( + imm + registers[rs1], + 8, + BigInt.asUintN(64, registers[rs2]), + rs2, + "double", + ); + help: Loads a 64-bit value from memory into register rd for RV64I. + + - name: auipc + extension: I + template: U + fields: + - field: opcode + value: "0010111" + - field: imm + type: offset_bytes + definition: | + registers[rd] = registers["PC"] + (imm << 12n); + + help: Build pc-relative addresses and uses the U-type format. AUIPC forms a 32-bit offset from the 20-bit U-immediate, filling in the lowest 12 bits with zeros, adds this offset to the pc, then places the result in register rd. + - name: lui + extension: I + template: U + fields: + - field: opcode + value: "0110111" + - field: imm + type: imm-unsigned + definition: | + registers[rd] = imm << 12n; + + help: Build 32-bit constants and uses the U-type format. LUI places the U-immediate value in the top 20 bits of the destination register rd, filling in the lowest 12 bits with zeros. + - name: ecall + extension: I + template: Custom + type: Syscall + fields: + - field: opcode + value: "1110011" + - field: zeros + type: cop + startbit: 31 + stopbit: 7 + value: "0000000000000000000000000" + preoperation: 'let [fa0Value, fa0Type] = CAPI.ARCH.toJSNumberD(registers["fa0"]);' + definition: | + switch (registers["a7"]) { + case 1n: + CAPI.SYSCALL.print(registers["a0"], 'int32'); + break; + case 2n: + case 3n: + CAPI.SYSCALL.print(fa0Value, 'float'); + break; + case 4n: + CAPI.SYSCALL.print(registers["a0"], 'string'); + break; + case 5n: + CAPI.SYSCALL.read('a0', 'int'); + break; + case 6n: + CAPI.SYSCALL.read('fa0', 'float'); + break; + case 7n: + CAPI.SYSCALL.read('fa0', 'double'); + break; + case 8n: + CAPI.SYSCALL.read('a0', 'string', 'a1'); + break; + case 9n: + CAPI.SYSCALL.sbrk('a0', 'a0'); + break; + case 10n: + CAPI.SYSCALL.exit(); + break; + case 11n: + CAPI.SYSCALL.print(registers["a0"], 'char'); + break; + case 12n: + CAPI.SYSCALL.read('a0', 'char'); + break; + } + help: Make a request to the supporting execution environment. When executed in U-mode, S-mode, or M-mode, it generates an environment-call-from-U-mode exception, environment-call-from-S-mode exception, or environment-call-from-M-mode exception, respectively, and performs no other operation. + - name: ebreak + extension: I + template: Custom + type: Syscall + fields: + - field: opcode + value: "1110011" + - field: funct12 + type: cop + startbit: 31 + stopbit: 20 + value: "000000000001" + - field: zeros + type: cop + startbit: 19 + stopbit: 7 + value: "0000000000000" + definition: | + console.log('Not implemented: ebreak'); + CAPI.VALIDATION.raise('ebreak not implemented'); + help: Used by debuggers to cause control to be transferred back to a debugging environment. It generates a breakpoint exception and performs no other operation. + M: + - name: div + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "100" + definition: | + if (registers[rs2] != 0) { + registers[rd] = BigInt.asIntN( + 32, + (BigInt.asIntN(32, BigInt(registers[rs1])) / BigInt.asIntN(32, BigInt(registers[rs2]))) + ); + } + else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); + help: Perform an XLEN bits by XLEN bits signed integer division of rs1 by rs2, rounding towards zero. + - name: divu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "101" + definition: | + if (registers[rs2] != 0) { + registers[rd] = BigInt.asIntN( + 32, + (BigInt.asUintN(32, BigInt(registers[rs1])) / BigInt.asUintN(32, BigInt(registers[rs2]))) + ); + } + else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); + help: Perform an XLEN-bit by XLEN-bit unsigned integer division of rs1 by rs2, rounding towards zero. + - name: mul + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "000" + definition: | + registers[rd] = CAPI.FP.uint2int(registers[rs1]) * CAPI.FP.uint2int(registers[rs2]); + + help: Performs an XLEN-bit by XLEN-bit multiplication of signed rs1 by signed rs2 and places the lower XLEN bits in the destination register. + - name: mulh + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "001" + definition: | + registers[rd] = BigInt.asIntN( + 32, + BigInt.asIntN( + 64, + BigInt.asIntN(32, BigInt(registers[rs1])) * BigInt.asIntN(32, BigInt(registers[rs2])), + ) >> 32n, + ); + help: Performs an XLEN-bit by XLEN-bit multiplication of signed rs1 by signed rs2 and places the lower XLEN bits in the destination register. + - name: mulhsu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "010" + definition: | + registers[rd] = BigInt.asIntN( + 32, + BigInt.asIntN( + 64, + BigInt.asIntN(32, BigInt(registers[rs1])) * BigInt.asUintN(32, BigInt(registers[rs2])), + ) >> 32n, + ); + help: Performs an XLEN-bit by XLEN-bit multiplication of signed rs1 by unsigned rs2 and places the upper XLEN bits in the destination register. + - name: mulhu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "011" + definition: | + registers[rd] = BigInt.asIntN( + 32, + BigInt.asUintN( + 64, + BigInt.asUintN(32, BigInt(registers[rs1])) * BigInt.asUintN(32, BigInt(registers[rs2])), + ) >> 32n, + ); + help: Performs an XLEN-bit by XLEN-bit multiplication of unsigned rs1 by unsigned rs2 and places the upper XLEN bits in the destination register. + - name: rem + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "110" + definition: | + registers[rd] = registers[rs1] % registers[rs2]; + + help: Perform an XLEN-bit by XLEN-bit signed integer reminder of rs1 by rs2. + - name: remu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "111" + definition: | + registers[rd] = registers[rs1] % registers[rs2]; + + help: Perform an XLEN-bit by XLEN-bit unsigned integer reminder of rs1 by rs2. + F: + - name: flw + extension: F + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000111" + - field: funct3 + value: "010" + - field: rd + type: DFP-Reg + definition: | + registers[rd] = CAPI.MEM.read(registers[rs1] + imm, 4, rd); + + postoperation: | + registers[rd] = CAPI.ARCH.NaNBox(registers[rd]); + + help: Load a single-precision floating-point value from memory into floating-point register rd. + - name: fadd.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number + rs2Number; + + help: Perform single-precision floating-point addition. + - name: fclass.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1110000" + - field: funct3 + value: "001" + - field: rs1 + suffix: null + - field: rs2 + type: cop + value: "00000" + order: null + - field: rd + type: INT-Reg + preoperation: | + let rs1Value, rs2Value, type_rs1, type_rs2; + [rs1Value, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Value, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(registers[rd])) { + registers[rd] = CAPI.ARCH.toBigInt(registers[rd], "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(registers[rd], "NaNBfloat32_64"); + } + registers[rs1] = CAPI.ARCH.toBigInt(rs1Value, type_rs1); + registers[rs2] = CAPI.ARCH.toBigInt(rs2Value, type_rs2); + definition: | + let a = CAPI.FP.float2bin(registers[rs1]); + registers[rd] = CAPI.FP.check_ieee( + parseInt(a[0]), + parseInt(a.slice(1, 9), 2), + parseInt(a.slice(10), 2), + ); + help: Examines the value in floating-point register rs1 and writes to integer register rd a 10-bit mask that indicates the class of the floating-point number. The corresponding bit in rd will be set if the property is true and clear otherwise. All other bits in rd are cleared. Note that exactly one bit in rd will be set. + - name: fcvt.s.w + extension: F + template: R-IntToFloat + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101000" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + postoperation: | + registers[rd] = CAPI.ARCH.toBigInt(registers[rd],'NaNBfloat32_64'); + definition: | + registers[rd] = CAPI.FP.uint2int(registers[rs1]) + + help: Converts a 32-bit signed integer, in integer register rs1 into a floating-point number in floating-point register rd. + - name: fcvt.s.wu + extension: F + template: R-IntToFloat + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101000" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + definition: | + registers[rd] = CAPI.FP.int2uint(registers[rs1]) + + help: Converts a 32-bit unsigned integer, in integer register rs1 into a floating-point number in floating-point register rd. + - name: fcvt.w.s + extension: F + template: R-FloatToInt + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100000" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = parseInt(registers[rs1]); + + help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in integer register rd. + - name: fcvt.wu.s + extension: F + template: R-FloatToInt + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100000" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + registers[rd] = CAPI.FP.int2uint(parseInt(rs1Number)); + + help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in unsigned integer register rd. + - name: fdiv.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001100" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + if (rs2Number != 0) { result = rs1Number / rs2Number; } + else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); + + help: Perform single-precision floating-point division. + - name: feq.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010000" + - field: funct3 + value: "010" + - field: rd + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = (rs1Number === rs2Number) ? 1 : 0; + + help: Performs a quiet equal comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fle.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010000" + - field: funct3 + value: "000" + - field: rd + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = (rs1Number <= rs2Number) ? 1 : 0; + + help: Performs a quiet less or equal comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: flt.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010000" + - field: funct3 + value: "001" + - field: rd + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = (rs1Number < rs2Number) ? 1 : 0; + + help: Performs a quiet less comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fmax.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010100" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = Math.max(rs1Number, rs2Number); + + help: Write the larger of single precision data in rs1 and rs2 to rd. + - name: fmin.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010100" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = Math.min(rs1Number, rs2Number); + + help: Write the smaller of single precision data in rs1 and rs2 to rd. + - name: fmul.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = rs2Number * rs1Number; + + help: Perform single-precision floating-point multiplication. + - name: fmv.w.x + extension: F + template: R-IntToFloat + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1111000" + - field: funct5 + value: "00000" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = CAPI.FP.uint2float32(rs1Number); + + help: Move the single-precision value encoded in IEEE 754-2008 standard encoding from the lower 32 bits of integer register rs1 to the floating-point register rd. + - name: fmv.x.w + extension: F + template: R-FloatToInt + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1110000" + - field: funct5 + value: "00000" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, type_rs1; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + registers[rs1] = CAPI.ARCH.toBigInt(rs1Number, type_rs1); + definition: | + result = CAPI.FP.float322uint(rs1Number); + + help: Move the single-precision value in floating-point register rs1 represented in IEEE 754-2008 encoding to the lower 32 bits of integer register rd. + - name: fsgnj.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010000" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = (rs2Number >= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); + + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. + - name: fsgnjn.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010000" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = (rs2Number <= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. + - name: fsgnjx.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010000" + - field: funct3 + value: "010" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + let a = rs1Number < 0; + let b = rs2Number < 0; + result = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is XOR of sign bit of rs1 and rs2. + - name: fsqrt.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0101100" + - field: rs2 + type: cop + value: "00000" + order: null + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + if (rs1Number >= 0) { + result = Math.sqrt(rs1Number); + } else { + CAPI.VALIDATION.raise( + 'Square root of a negative number is not allowed.' + ); + } + help: Perform single-precision square root. + - name: fsub.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000100" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number - rs2Number; + + help: Perform single-precision floating-point subtraction. + - name: fmadd.s + extension: F + template: R4 + fields: + - field: opcode + value: "1000011" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number * rs2Number + rs3Number; + + help: Perform single-precision fused multiply addition. + - name: fmsub.s + extension: F + template: R4 + fields: + - field: opcode + value: "1000111" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number * rs2Number - rs3Number; + + help: Perform single-precision fused multiply addition. + - name: fnmadd.s + extension: F + template: R4 + fields: + - field: opcode + value: "1001111" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = -rs1Number * rs2Number - rs3Number; + + help: Perform negated single-precision fused multiply addition. + - name: fnmsub.s + extension: F + template: R4 + fields: + - field: opcode + value: "1001011" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = -rs1Number * rs2Number + rs3Number; + + help: Perform negated single-precision fused multiply addition. + - name: fsw + extension: F + template: S + fields: + - field: opcode + value: "0100111" + - field: funct3 + value: "010" + - field: rs2 + type: DFP-Reg + definition: | + let value = registers[rs2] & 0xFFFFFFFFn; + CAPI.MEM.write(registers[rs1] + imm, 4, value, rs2, 'float32'); + help: Store a single-precision value from floating-point register rs2 to memory. + D: + - name: fld + extension: D + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000111" + - field: funct3 + value: "011" + - field: rd + type: DFP-Reg + definition: | + if (CAPI.VALIDATION.isMisaligned(registers[rs1] + imm, 'd')) { + CAPI.VALIDATION.raise('The memory must be aligned'); + } + registers[rd] = CAPI.MEM.read(registers[rs1] + imm, 8, rd); + help: Load a double-precision floating-point value from memory into floating-point register rd. + - name: fadd.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = rs1Number + rs2Number; + + help: Perform double-precision floating-point addition. + - name: fclass.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1110001" + - field: funct3 + value: "001" + - field: rs1 + suffix: null + - field: rs2 + type: cop + value: "00000" + order: null + - field: rd + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + let a = CAPI.FP.float2bin(rs1Number); + registers[rd] = CAPI.FP.check_ieee( + parseInt(a[0]), + parseInt(a.slice(1, 12), 2), + parseInt(a.slice(13), 2), + ); + help: Examines the value in double-precision floating-point register rs1 and writes to integer register rd a 10-bit mask that indicates the class of the floating-point number. The corresponding bit in rd will be set if the property is true and clear otherwise. All other bits in rd are cleared. Note that exactly one bit in rd will be set. + - name: fcvt.d.s + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: rd + type: DFP-Reg + - field: rs1 + type: DFP-Reg + - field: funct7 + value: "0100001" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: null + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual + + help: Converts double floating-point register in rs1 into a double floating-point number in floating-point register rd. + - name: fcvt.d.w + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101001" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: null + - field: rd + type: DFP-Reg + - field: rs1 + type: INT-Reg + preoperation: | + let result, rs1Number, type_rs1; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + postoperation: | + registers[rd] = CAPI.ARCH.toBigInt(result, 'float64'); + definition: | + result = CAPI.FP.uint2int(rs1Number); + + help: Converts a 32-bit signed integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. + - name: fcvt.d.wu + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101001" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: null + - field: rd + type: DFP-Reg + - field: rs1 + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = CAPI.FP.int2uint(parseFloat(rs1Number)); + + help: Converts a 32-bit unsigned integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. + - name: fcvt.s.d + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0100000" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + - field: rd + type: DFP-Reg + - field: rs1 + type: DFP-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual + + help: Converts double floating-point register in rs1 into a floating-point number in floating-point register rd. + - name: fcvt.w.d + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100001" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + - field: rd + type: INT-Reg + - field: rs1 + type: DFP-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = CAPI.FP.int2uint(parseInt(rs1Number)); + + help: Converts a double-precision floating-point number in floating-point register rs1 to a signed 32-bit integer, in integer register rd. + - name: fcvt.wu.d + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100001" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + - field: rd + type: INT-Reg + - field: rs1 + type: DFP-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = CAPI.FP.int2uint(parseInt(rs1Number)); + + help: Converts a double-precision floating-point number in floating-point register rs1 to a unsigned 32-bit integer, in integer register rd. + - name: fdiv.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001101" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = rs1Number / rs2Number; + help: Perform double-precision floating-point division. + - name: feq.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010001" + - field: funct3 + value: "010" + - field: rd + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + + definition: | + registers[rd] = (rs1Number == rs2Number) ? 1 : 0; + + help: Performs a quiet equal comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fle.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010001" + - field: funct3 + value: "000" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + + definition: | + registers[rd] = (rs1Number <= rs2Number) ? 1 : 0; + + help: Performs a quiet less or equal comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: flt.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010001" + - field: funct3 + value: "001" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + + definition: | + registers[rd] = (rs1Number < rs2Number) ? 1 : 0; + + help: Performs a quiet less comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fmax.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010101" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = Math.max(rs1Number, rs2Number); + + help: Write the larger of double precision data in rs1 and rs2 to rd. + - name: fmin.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010101" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = Math.min(rs1Number, rs2Number); + + help: Write the smaller of double precision data in rs1 and rs2 to rd. + - name: fmul.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = rs1Number * rs2Number; + + help: Perform double-precision floating-point addition. + - name: fsgnj.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010001" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + registers[rd] = (rs2Number > 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); + help: Perform double-precision floating-point multiplication. + - name: fsgnjn.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010001" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + registers[rd] = (rs2Number > 0) ? -Math.abs(rs1Number) : +Math.abs(rs1Number); + + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is opposite of rs2's sign bit. + - name: fsgnjx.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010001" + - field: funct3 + value: "010" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + let a = rs1Number < 0; + let b = rs2Number < 0; + registers[rd] = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is XOR of sign bit of rs1 and rs2. + - name: fsqrt.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0101101" + - field: rs2 + type: cop + value: "00000" + order: null + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + if (rs1Number >= 0) { + registers[rd] = Math.sqrt(rs1Number); + } else { + CAPI.VALIDATION.raise( + "Square root of a negative number is not allowed." + ); + } + help: Perform double-precision square root. + - name: fsub.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000101" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = rs1Number - rs2Number; + + help: Perform double-precision floating-point addition. + - name: fmadd.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1000011" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = rs1Number * rs2Number + rs3Number; + + help: Perform double-precision fused multiply addition. + - name: fmsub.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1000111" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = rs1Number * rs2Number - rs3Number; + + help: Perform double-precision fused multiply subtraction. + - name: fnmadd.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1001111" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = -rs1Number * rs2Number - rs3Number; + + help: Perform negated double-precision fused multiply addition. + - name: fnmsub.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1001011" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = -rs1Number * rs2Number + rs3Number; + + help: Perform negated double-precision fused multiply subtraction. + - name: fsd + extension: D + template: S + fields: + - field: opcode + value: "0100111" + - field: funct3 + value: "011" + - field: rs2 + type: DFP-Reg + definition: | + let val = BigInt("0x" + CAPI.FP.split_double(registers[rs2], 0)); + CAPI.MEM.write(registers[rs1] + imm, 4, val, rs2); + val = BigInt("0x" + CAPI.FP.split_double(registers[rs2], 1)); + CAPI.MEM.write(registers[rs1] + imm + 4n, 4, val, rs2); + CAPI.MEM.addHint(registers[rs1] + imm, "float64", 64); + help: Store a double-precision value from the floating-point registers to memory. + Zifencei: + - name: fence.i + extension: D + template: Custom + type: Syscall + fields: + - field: opcode + value: "0001111" + - field: funct3 + type: cop + startbit: 14 + stopbit: 12 + value: "001" + - field: zeros + type: cop + startbit: 31 + stopbit: 15 + value: "00000000000000000" + - field: zeros2 + type: cop + startbit: 11 + stopbit: 7 + value: "00000" + definition: | + console.log('Not implemented: fence.i'); + CAPI.VALIDATION.raise('fence.i not implemented'); + help: Provides explicit synchronization between writes to instruction memory and instruction fetches on the same hart. + +pseudoinstructions: + # Make sure the definitions correspond with those in the RISC-V ASM manual (TODO: Check these!) + + # RV32I Pseudoinstructions + I: + - name: beqz + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + beq rs1, x0, off; + + - name: bgez + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bge reg1, x0, off; + help: Take the branch if the value in register rs1 is zero. + + - name: bgt + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + blt rs2, rs1, off; + + - name: bgtu + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bltu rs2, rs1, off; + + - name: bgtz + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bgt rs1, x0, off; + + - name: ble + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bge rs2, rs1, off; + + - name: bleu + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bgeu rs2, rs1, off; + + - name: blez + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + ble x0, rs1, off; + + - name: bltz + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + blt rs1, x0, off; + + - name: bnez + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bne rs1, x0, off; + + - name: j + extension: I + fields: + - field: off + type: offset_bytes + definition: | + beq zero, zero, off; + + - name: jalr + extension: I + fields: + - field: rs + type: INT-Reg + definition: | + jalr x1, 0(rs); + + - name: jr + extension: I + fields: + - field: rs + type: INT-Reg + definition: | + jalr x0, 0(rs); + + - name: la + extension: I + fields: + - field: rd + type: INT-Reg + suffix: "," + - field: addr + type: imm-unsigned + definition: | + no_ret_op{ + tmp = Field.2.(31,0).int - (reg.pc - 4); + tmp_low = tmp & 0x00000FFF; + tmp_low = tmp_low>0x7FF? tmp_low - 0x1000 : tmp_low; + tmp_hi = (tmp - tmp_low) >> 12; + }; + auipc rd, op{tmp_hi}; + addi rd, rd, op{tmp_low}; + + - name: li + extension: I + fields: + - field: rd + type: INT-Reg + suffix: "," + - field: val + type: imm-signed + definition: | + no_ret_op{ + tmp = Field.2.(31,0).int; + tmp_low = tmp & 0x00000FFF; + tmp_low -= tmp_low > 0x7FF ? 0x1000 : 0; + tmp_hi = (tmp - tmp_low) >>> 12; + }; + if (tmp_hi === 0) { + addi rd, x0, op{tmp_low}; + } + else { + lui rd, op{tmp_hi}; + addi rd, rd, op{tmp_low}; + }; + help: Load the sign-extended 6-bit immediate, imm, into register rd. + + - name: mv + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + addi reg1, reg2, 0; + help: Copy the value in register rs2 into register rd. + + - name: neg + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + sub reg1, x0, reg2; + + - name: nop + extension: I + definition: | + addi x0, x0, 0; + help: Does not change any user-visible state, except for advancing the pc. + + - name: not + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + xori reg1, reg2, -1; + + - name: ret + extension: I + definition: | + jalr x0, 0(x1); # TODO: check this! + + - name: seqz + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + sltiu reg1, reg2, 1; + + - name: sgtz + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + slt reg1, x0, reg2; + + - name: sltz + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + slt reg1, reg2, x0; + + - name: snez + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + sltu reg1, x0, reg2; + F: + # RV32F Pseudoinstructions + - name: fabs.s + extension: F + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjx.s rs1, rs2, rs2; + + - name: fmv.s + extension: F + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnj.s rs1, rs2, rs2; + + - name: fneg.s + extension: F + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjn.s rs1, rs2, rs2; + D: + # RV32D Pseudoinstructions + - name: fabs.d + extension: D + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjx.d rs1, rs2, rs2; + + - name: fmv.d + extension: D + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnj.d rs1, rs2, rs2; + + - name: fneg.d + extension: D + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjn.d rs1, rs2, rs2; + +enums: + rounding_mode: + rne: 0 + rtz: 1 + rdn: 2 + rup: 3 + rmm: 4 + dyn: 7 + DEFAULT: dyn diff --git a/architecture/RISCV/SRV64.yml b/architecture/RISCV/SRV64.yml new file mode 100644 index 000000000..ee506592c --- /dev/null +++ b/architecture/RISCV/SRV64.yml @@ -0,0 +1,4563 @@ +# yaml-language-server: $schema=../schema.json +version: 2.0.0 + +# ASCII text generated w/ https://patorjk.com/software/taag/#p=display&h=1&f=Standard +# instruction help text extracted from https://msyksphinz-self.github.io/riscv-isadoc/html/index.html + +config: + name: SRV64 + word_size: 32 + description: RISC-V is an instruction set architecture (ISA) based on the RISC type and its hardware is free. This architecture was created in 2010 at the University of California, Berkeley. + endianness: big_endian + memory_alignment: true + main_function: main + passing_convention: true + sensitive_register_name: true + comment_prefix: "#" + start_address: 0 + pc_offset: -4 + byte_size: 8 + plugin: riscv + assemblers: + - name: "Sail" + description: Default Creator Compiler +extensions: + I: + description: RV32I Base Instruction Set + template: Base + M: + description: RV32M Integer Multiply/Divide Extension + type: extension + F: + description: RV32F Single-Precision Floating-Point Extension + type: extension + implies: + - Zicsr + D: + description: RV32D Double-Precision Floating-Point Extension + type: extension + implies: + - F + Zifencei: + description: RV32/RV64 Zifencei Standard Extension + type: extension + Zicsr: + description: RV32/RV64 Zicsr Standard Extension + type: extension +components: + - name: Control registers + type: ctrl_registers + double_precision: false + elements: + - name: + - PC + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - program_counter + - name: Integer registers + type: int_registers + double_precision: false + elements: + - name: + - x0 + - zero + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - ignore_write + - name: + - x1 + - ra + nbits: 64 + value: 4294967295 + default_value: 4294967295 + encoding: 1 + properties: + - read + - write + - name: + - x2 + - sp + nbits: 64 + value: 268435452 + default_value: 26843545 + encoding: 2 + properties: + - read + - write + - stack_pointer + - name: + - x3 + - gp + nbits: 64 + value: 0 + default_value: 0 + encoding: 3 + properties: + - read + - write + - global_pointer + - name: + - x4 + - tp + nbits: 64 + value: 0 + default_value: 0 + encoding: 4 + properties: + - read + - write + - name: + - x5 + - t0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 5 + properties: + - read + - write + - name: + - x6 + - t1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 6 + properties: + - read + - write + - name: + - x7 + - t2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 7 + properties: + - read + - write + - name: + - x8 + - fp + - s0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 8 + properties: + - read + - write + - frame_pointer + - saved + - name: + - x9 + - s1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 9 + properties: + - read + - write + - saved + - name: + - x10 + - a0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 10 + properties: + - read + - write + - name: + - x11 + - a1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 11 + properties: + - read + - write + - name: + - x12 + - a2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 12 + properties: + - read + - write + - name: + - x13 + - a3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 13 + properties: + - read + - write + - name: + - x14 + - a4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 14 + properties: + - read + - write + - name: + - x15 + - a5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 15 + properties: + - read + - write + - name: + - x16 + - a6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 16 + properties: + - read + - write + - name: + - x17 + - a7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 17 + properties: + - read + - write + - name: + - x18 + - s2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 18 + properties: + - read + - write + - saved + - name: + - x19 + - s3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 19 + properties: + - read + - write + - saved + - name: + - x20 + - s4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 20 + properties: + - read + - write + - saved + - name: + - x21 + - s5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 21 + properties: + - read + - write + - saved + - name: + - x22 + - s6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 22 + properties: + - read + - write + - saved + - name: + - x23 + - s7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 23 + properties: + - read + - write + - saved + - name: + - x24 + - s8 + nbits: 64 + value: 0 + default_value: 0 + encoding: 24 + properties: + - read + - write + - saved + - name: + - x25 + - s9 + nbits: 64 + value: 0 + default_value: 0 + encoding: 25 + properties: + - read + - write + - saved + - name: + - x26 + - s10 + nbits: 64 + value: 0 + default_value: 0 + encoding: 26 + properties: + - read + - write + - saved + - name: + - x27 + - s11 + nbits: 64 + value: 0 + default_value: 0 + encoding: 27 + properties: + - read + - write + - saved + - name: + - x28 + - t3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 28 + properties: + - read + - write + - name: + - x29 + - t4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 29 + properties: + - read + - write + - name: + - x30 + - t5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 30 + properties: + - read + - write + - name: + - x31 + - t6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 31 + properties: + - read + - write + - name: Floating point registers + type: fp_registers + double_precision: true + elements: + - name: + - f0 + - ft0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - f1 + - ft1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 1 + properties: + - read + - write + - name: + - f2 + - ft2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 2 + properties: + - read + - write + - name: + - f3 + - ft3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 3 + properties: + - read + - write + - name: + - f4 + - ft4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 4 + properties: + - read + - write + - name: + - f5 + - ft5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 5 + properties: + - read + - write + - name: + - f6 + - ft6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 6 + properties: + - read + - write + - name: + - f7 + - ft7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 7 + properties: + - read + - write + - name: + - f8 + - fs0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 8 + properties: + - read + - write + - saved + - name: + - f9 + - fs1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 9 + properties: + - read + - write + - saved + - name: + - f10 + - fa0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 10 + properties: + - read + - write + - name: + - f11 + - fa1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 11 + properties: + - read + - write + - name: + - f12 + - fa2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 12 + properties: + - read + - write + - name: + - f13 + - fa3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 13 + properties: + - read + - write + - name: + - f14 + - fa4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 14 + properties: + - read + - write + - name: + - f15 + - fa5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 15 + properties: + - read + - write + - name: + - f16 + - fa6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 16 + properties: + - read + - write + - name: + - f17 + - fa7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 17 + properties: + - read + - write + - name: + - f18 + - fs2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 18 + properties: + - read + - write + - saved + - name: + - f19 + - fs3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 19 + properties: + - read + - write + - saved + - name: + - f20 + - fs4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 20 + properties: + - read + - write + - saved + - name: + - f21 + - fs5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 21 + properties: + - read + - write + - saved + - name: + - f22 + - fs6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 22 + properties: + - read + - write + - saved + - name: + - f23 + - fs7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 23 + properties: + - read + - write + - saved + - name: + - f24 + - fs8 + nbits: 64 + value: 0 + default_value: 0 + encoding: 24 + properties: + - read + - write + - saved + - name: + - f25 + - fs9 + nbits: 64 + value: 0 + default_value: 0 + encoding: 25 + properties: + - read + - write + - saved + - name: + - f26 + - fs10 + nbits: 64 + value: 0 + default_value: 0 + encoding: 26 + properties: + - read + - write + - saved + - name: + - f27 + - fs11 + nbits: 64 + value: 0 + default_value: 0 + encoding: 27 + properties: + - read + - write + - saved + - name: + - f28 + - ft8 + nbits: 64 + value: 0 + default_value: 0 + encoding: 28 + properties: + - read + - write + - name: + - f29 + - ft9 + nbits: 64 + value: 0 + default_value: 0 + encoding: 29 + properties: + - read + - write + - name: + - f30 + - ft10 + nbits: 64 + value: 0 + default_value: 0 + encoding: 30 + properties: + - read + - write + - name: + - f31 + - ft11 + nbits: 64 + value: 0 + default_value: 0 + encoding: 31 + properties: + - read + - write + - name: Vectorial registers + type: v_registers + double_precision: true + elements: + - name: + - v0 + - vt0 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v1 + - vt1 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v2 + - vt2 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v3 + - vt3 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v4 + - vt4 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v5 + - vt5 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v6 + - vt6 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v7 + - vt7 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v8 + - vt8 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v9 + - vt9 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v10 + - vt10 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v11 + - vt11 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v12 + - vt12 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v13 + - vt13 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v14 + - vt14 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v15 + - vt15 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v16 + - vt16 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v17 + - vt17 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v18 + - vt18 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v19 + - vt19 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v20 + - vt20 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v21 + - vt21 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v22 + - vt22 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v23 + - vt23 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v24 + - vt24 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v25 + - vt25 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v26 + - vt26 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v27 + - vt27 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v28 + - vt28 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v29 + - vt29 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v30 + - vt30 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v31 + - vt31 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: Control state registers + type: csr_registers + double_precision: false + elements: +# USER registers + - name: + - ustatus + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uie + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - utvec + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uscratch + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uepc + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - ucause + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - utval + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uip + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write +# SUPERVISOR registers + - name: + - sstatus + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sedeleg + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sideleg + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sie + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - stvec + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sscratch + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sepc + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - scause + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - stval + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sip + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - satp + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write +# MACHINE REGISTERS + - name: + - mstatus + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - misa + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - medeleg + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mideleg + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mie + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mstvec + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mscratch + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mepc + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mcause + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mtval + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mip + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mcycle + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - minstret + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write +# COMMON REGISTERS + - name: + - cycle + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - time + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - instret + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - hpmcounterX + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - hpmcounterXh + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mhartid + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + +directives: + - name: .data + action: data_segment + size: null + - name: .text + action: code_segment + size: null + - name: .bss + action: global_symbol + size: null + - name: .zero + action: space + size: 1 + - name: .space + action: space + size: 1 + - name: .align + action: align + size: null + - name: .balign + action: balign + size: null + - name: .globl + action: global_symbol + size: null + - name: .string + action: ascii_null_end + size: null + - name: .asciz + action: ascii_null_end + size: null + - name: .ascii + action: ascii_not_null_end + size: null + - name: .byte + action: byte + size: 1 + - name: .half + action: half_word + size: 2 + - name: .word + action: word + size: 4 + - name: .dword + action: double_word + size: 8 + - name: .float + action: float + size: 4 + - name: .double + action: double + size: 8 + +memory_layout: + text: + start: 0x0 + end: 0x1FFFF + data: + start: 0x20000 + end: 0x0FFFFFFF + stack: + start: 0x3FFFFFFC + end: 0x3FFFFFFF + +# memory_layout: +# text: +# start: 0 +# end: 131071 +# data: +# start: 131072 +# end: 70368744177663 +# stack: +# start: 140737488355324 +# end: 140737488355327 + +templates: + - name: B + type: Conditional bifurcation + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 1 + - name: rs2 + type: INT-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 2 + - name: imm + type: offset_bytes + startbit: + - 31 + - 7 + - 30 + - 11 + stopbit: + - 31 + - 7 + - 25 + - 8 + padding: 1 + order: 3 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: I + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: imm-signed + startbit: 31 + stopbit: 20 + order: 3 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: I-Offset + # Not an "official" instruction, but used for the offset in the I-type instructions + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: imm-signed + startbit: 31 + stopbit: 20 + order: 2 + space: false + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + order: 3 + prefix: ( + suffix: ) + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: I-Shift + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: shamt + type: imm-unsigned + startbit: 24 + stopbit: 20 + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: J + type: Unconditional bifurcation + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: offset_bytes + startbit: + - 31 + - 19 + - 20 + - 30 + stopbit: + - 31 + - 12 + - 20 + - 21 + padding: 1 + order: 2 + + - name: R + type: Arithmetic integer + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: INT-Reg + startbit: 24 + stopbit: 20 + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-Floating # Used in rv32f / rv64f + type: Arithmetic floating point + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-Double # Used in rv64d + nwords: 1 + type: Arithmetic floating point + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-IntToFloat # fcvt.s.w,... + nwords: 1 + type: Transfer between registers + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct5 + type: cop + startbit: 24 + stopbit: 20 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-FloatToInt # fcvt.w.s,... + type: Transfer between registers + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct5 + type: cop + startbit: 24 + stopbit: 20 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-Conversion # Generic template + type: Transfer between registers + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: Not-Set + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: Not-Set + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct5 + type: cop + startbit: 24 + stopbit: 20 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R4 + type: Arithmetic floating point + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: rs3 + type: DFP-Reg + startbit: 31 + stopbit: 27 + suffix: "," + order: 4 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + - name: funct2 + type: cop + startbit: 26 + stopbit: 25 + + - name: R4-Double + type: Arithmetic floating point + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: rs3 + type: DFP-Reg + startbit: 31 + stopbit: 27 + suffix: "," + order: 4 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + - name: funct2 + type: cop + startbit: 26 + stopbit: 25 + + - name: S + type: Memory access + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rs2 + type: INT-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 1 + - name: imm + type: imm-signed + startbit: + - 31 + - 11 + stopbit: + - 25 + - 7 + order: 2 + space: false + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + prefix: ( + suffix: ) + order: 3 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: U + type: Arithmetic integer + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: imm-unsigned + startbit: 31 + stopbit: 12 + order: 2 + + - name: CSR + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + order: 3 + - name: csr + type: Ctrl-Reg + startbit: 31 + stopbit: 20 + suffix: "," + order: 2 + + - name: Custom + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + +instructions: + I: + - name: beq + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "000" + definition: | + if (registers[rs1] === registers[rs2]) + registers["PC"] = registers["PC"] + imm; + + help: Take the branch if registers rs1 and rs2 are equal. + - name: bge + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "101" + definition: | + if (CAPI.FP.uint2int(registers[rs1]) >= CAPI.FP.uint2int(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is greater than or equal to rs2, using signed comparison. + - name: bgeu + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "111" + definition: | + if (CAPI.FP.int2uint(registers[rs1]) > CAPI.FP.int2uint(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is greater than or equal to rs2, using unsigned comparison. + - name: blt + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "100" + definition: | + if (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is less than rs2, using signed comparison. + - name: bltu + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "110" + definition: | + if (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is less than rs2, using unsigned comparison. + - name: bne + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "001" + definition: | + if (registers[rs1] !== registers[rs2]) + registers["PC"] = registers["PC"] + imm; + + help: Take the branch if registers rs1 and rs2 are not equal. + - name: addi + extension: I + template: I + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers[rs1] + imm; + + help: Adds the sign-extended 12-bit immediate to register rs1. Arithmetic overflow is ignored and the result is simply the low XLEN bits of the result. + - name: andi + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "111" + definition: | + registers[rd] = registers[rs1] & CAPI.FP.int2uint(imm); + + help: Performs bitwise AND on register rs1 and the sign-extended 12-bit immediate and place the result in rd. + - name: jalr + extension: I + template: I-Offset + type: Unconditional bifurcation + fields: + - field: opcode + value: "1100111" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers["PC"] + 4n; + registers["PC"] = (registers[rs1] + imm) & ~1n; + CAPI.CHECK_STACK.end(); CAPI.DRAW_STACK.end(registers["PC"]); + help: Jump to address and place return address in rd. + - name: lb + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "000" + definition: | + registers[rd] = CAPI.MEM.read(imm + registers[rs1], 1, rd); + + help: Loads a 8-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: lbu + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "100" + definition: | + let addr = CAPI.FP.int2uint(registers[rs1]) + imm; + registers[rd] = CAPI.MEM.read(addr, 1, rd); + registers[rd] = CAPI.FP.int2uint(registers[rd]); + help: Loads a 8-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. + - name: lh + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "001" + definition: | + registers[rd] = CAPI.MEM.read(imm + registers[rs1], 2, rd); + + help: Loads a 16-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: lhu + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "101" + definition: | + let addr = CAPI.FP.int2uint(registers[rs1], 32) + imm; + registers[rd] = CAPI.MEM.read(addr, 2, rd); + registers[rd] = CAPI.FP.int2uint(registers[rd]); + help: Loads a 16-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. + - name: lw + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "010" + definition: | + let addr = CAPI.FP.int2uint(registers[rs1], 32) + imm; + registers[rd] = CAPI.MEM.read(addr, 4, rd); + help: Loads a 32-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: ori + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "110" + definition: | + registers[rd] = registers[rs1] | imm; + + help: Performs bitwise OR on register rs1 and the sign-extended 12-bit immediate and place the result in rd. + - name: slli + extension: I + template: I-Shift + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "001" + - field: funct7 + value: "0000000" + definition: | + if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] << shamt); + + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. + - name: slti + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "010" + definition: | + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(imm)) ? 1 : 0; + + help: Place the value 1 in register rd if register rs1 is less than the signextended immediate when both are treated as signed numbers, else 0 is written to rd. + - name: sltiu + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "011" + definition: | + registers[rd] = (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(imm)) ? 1: 0; + help: Place the value 1 in register rd if register rs1 is less than the immediate when both are treated as unsigned numbers, else 0 is written to rd. + - name: srai + extension: I + template: I-Shift + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "101" + - field: funct7 + value: "0100000" + definition: | + if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] >> shamt); + + help: Performs arithmetic right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. + - name: srli + extension: I + template: I-Shift + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "101" + - field: funct7 + value: "0000000" + definition: | + if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] >> shamt); + + help: Performs logical right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. + - name: xori + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "100" + definition: | + registers[rd] = registers[rs1] ^ imm; + + help: Performs bitwise XOR on register rs1 and the sign-extended 12-bit immediate and place the result in rd. Note, 'XORI rd, rs1, -1' performs a bitwise logical inversion of register rs1(assembler pseudo-instruction NOT rd, rs). + - name: jal + extension: I + template: J + fields: + - field: opcode + value: "1101111" + definition: | + registers[rd] = registers["PC"] + 4n; + registers["PC"] = registers["PC"] + imm; + CAPI.CHECK_STACK.begin(registers["PC"] + imm); + CAPI.DRAW_STACK.begin(registers["PC"] + imm); // This is not an accident. We only see the virtual PC here, and the virtual/physical PC sync happens after the instruction execution. + help: Jump to address and place return address in rd. + - name: add + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers[rs2] + registers[rs1]; + + help: Adds the registers rs1 and rs2 and stores the result in rd. Arithmetic overflow is ignored and the result is simply the low XLEN bits of the result. + - name: and + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "111" + definition: | + registers[rd] = registers[rs1] & registers[rs2]; + + help: Performs bitwise AND on registers rs1 and rs2 and place the result in rd. + - name: or + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "110" + definition: | + registers[rd] = registers[rs1] | registers[rs2]; + + help: Performs bitwise OR on registers rs1 and rs2 and place the result in rd. + - name: sll + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "001" + definition: | + const shiftAmount = registers[rs2] & 0x1Fn; + registers[rd] = (registers[rs1] << shiftAmount) & 0xFFFFFFFFn; + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. + - name: slt + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "010" + definition: | + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) ? 1 : 0; + + help: Place the value 1 in register rd if register rs1 is less than register rs2 when both are treated as signed numbers, else 0 is written to rd. + - name: sltu + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "011" + definition: | + registers[rd] = ((registers[rs1] & 0xFFFFFFFFn) < (registers[rs2] & 0xFFFFFFFFn)) ? 1n : 0n; + + help: Place the value 1 in register rd if register rs1 is less than register rs2 when both are treated as unsigned numbers, else 0 is written to rd. + - name: sra + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0100000" + - field: funct3 + value: "101" + definition: | + const temp = BigInt.asIntN(32, BigInt(registers[rs1])) >> BigInt(registers[rs2]); + registers[rd] = CAPI.FP.int2uint(temp); + help: Performs arithmetic right shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. + - name: srl + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "101" + definition: | + const shiftAmount = registers[rs2] & 0x1Fn; + registers[rd] = (registers[rs1] >> shiftAmount) & 0xFFFFFFFFn; + help: Logical right shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. + - name: sub + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0100000" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers[rs1] - registers[rs2]; + + help: Subs the register rs2 from rs1 and stores the result in rd. Arithmetic overflow is ignored and the result is simply the low XLEN bits of the result. + - name: xor + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "100" + definition: | + registers[rd] = (registers[rs1] ^ registers[rs2]); + + help: Performs bitwise XOR on registers rs1 and rs2 and place the result in rd. + - name: sb + extension: I + template: S + fields: + - field: opcode + value: "0100011" + - field: funct3 + value: "000" + definition: | + CAPI.MEM.write(registers[rs1] + imm, 1, BigInt.asUintN(8, registers[rs2]), rs2, 'byte'); + + help: Store 8-bit, values from the low bits of register rs2 to memory. + - name: sh + extension: I + template: S + fields: + - field: opcode + value: "0100011" + - field: funct3 + value: "001" + definition: | + CAPI.MEM.write(imm + registers[rs1], 2, BigInt.asUintN(16, registers[rs2]), rs2, 'half'); + + help: Store 16-bit, values from the low bits of register rs2 to memory. + - name: sw + extension: I + template: S + fields: + - field: opcode + value: "0100011" + - field: funct3 + value: "010" + definition: | + CAPI.MEM.write(imm + registers[rs1], 4, BigInt.asUintN(32, registers[rs2]), rs2, 'word'); + + help: Store 32-bit, values from the low bits of register rs2 to memory. + - name: auipc + extension: I + template: U + fields: + - field: opcode + value: "0010111" + - field: imm + type: offset_bytes + definition: | + registers[rd] = registers["PC"] + (imm << 12n); + + help: Build pc-relative addresses and uses the U-type format. AUIPC forms a 32-bit offset from the 20-bit U-immediate, filling in the lowest 12 bits with zeros, adds this offset to the pc, then places the result in register rd. + - name: lui + extension: I + template: U + fields: + - field: opcode + value: "0110111" + - field: imm + type: imm-unsigned + definition: | + registers[rd] = imm << 12n; + + help: Build 32-bit constants and uses the U-type format. LUI places the U-immediate value in the top 20 bits of the destination register rd, filling in the lowest 12 bits with zeros. + - name: ecall + extension: I + template: Custom + type: Syscall + fields: + - field: opcode + value: "1110011" + - field: zeros + type: cop + startbit: 31 + stopbit: 7 + value: "0000000000000000000000000" + preoperation: 'let [fa0Value, fa0Type] = CAPI.ARCH.toJSNumberD(registers["fa0"]);' + definition: | + switch (registers["a7"]) { + case 1n: + CAPI.SYSCALL.print(registers["a0"], 'int32'); + break; + case 2n: + case 3n: + CAPI.SYSCALL.print(fa0Value, 'float'); + break; + case 4n: + CAPI.SYSCALL.print(registers["a0"], 'string'); + break; + case 5n: + CAPI.SYSCALL.read('a0', 'int'); + break; + case 6n: + CAPI.SYSCALL.read('fa0', 'float'); + break; + case 7n: + CAPI.SYSCALL.read('fa0', 'double'); + break; + case 8n: + CAPI.SYSCALL.read('a0', 'string', 'a1'); + break; + case 9n: + CAPI.SYSCALL.sbrk('a0', 'a0'); + break; + case 10n: + CAPI.SYSCALL.exit(); + break; + case 11n: + CAPI.SYSCALL.print(registers["a0"], 'char'); + break; + case 12n: + CAPI.SYSCALL.read('a0', 'char'); + break; + } + help: Make a request to the supporting execution environment. When executed in U-mode, S-mode, or M-mode, it generates an environment-call-from-U-mode exception, environment-call-from-S-mode exception, or environment-call-from-M-mode exception, respectively, and performs no other operation. + - name: ebreak + extension: I + template: Custom + type: Syscall + fields: + - field: opcode + value: "1110011" + - field: funct12 + type: cop + startbit: 31 + stopbit: 20 + value: "000000000001" + - field: zeros + type: cop + startbit: 19 + stopbit: 7 + value: "0000000000000" + definition: | + console.log('Not implemented: ebreak'); + CAPI.VALIDATION.raise('ebreak not implemented'); + help: Used by debuggers to cause control to be transferred back to a debugging environment. It generates a breakpoint exception and performs no other operation. + M: + - name: div + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "100" + definition: | + if (registers[rs2] != 0) { + registers[rd] = BigInt.asIntN( + 32, + (BigInt.asIntN(32, BigInt(registers[rs1])) / BigInt.asIntN(32, BigInt(registers[rs2]))) + ); + } + else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); + help: Perform an XLEN bits by XLEN bits signed integer division of rs1 by rs2, rounding towards zero. + - name: divu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "101" + definition: | + if (registers[rs2] != 0) { + registers[rd] = BigInt.asIntN( + 32, + (BigInt.asUintN(32, BigInt(registers[rs1])) / BigInt.asUintN(32, BigInt(registers[rs2]))) + ); + } + else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); + help: Perform an XLEN-bit by XLEN-bit unsigned integer division of rs1 by rs2, rounding towards zero. + - name: mul + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "000" + definition: | + registers[rd] = CAPI.FP.uint2int(registers[rs1]) * CAPI.FP.uint2int(registers[rs2]); + + help: Performs an XLEN-bit by XLEN-bit multiplication of signed rs1 by signed rs2 and places the lower XLEN bits in the destination register. + - name: mulh + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "001" + definition: | + registers[rd] = BigInt.asIntN( + 32, + BigInt.asIntN( + 64, + BigInt.asIntN(32, BigInt(registers[rs1])) * BigInt.asIntN(32, BigInt(registers[rs2])), + ) >> 32n, + ); + help: Performs an XLEN-bit by XLEN-bit multiplication of signed rs1 by signed rs2 and places the lower XLEN bits in the destination register. + - name: mulhsu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "010" + definition: | + registers[rd] = BigInt.asIntN( + 32, + BigInt.asIntN( + 64, + BigInt.asIntN(32, BigInt(registers[rs1])) * BigInt.asUintN(32, BigInt(registers[rs2])), + ) >> 32n, + ); + help: Performs an XLEN-bit by XLEN-bit multiplication of signed rs1 by unsigned rs2 and places the upper XLEN bits in the destination register. + - name: mulhu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "011" + definition: | + registers[rd] = BigInt.asIntN( + 32, + BigInt.asUintN( + 64, + BigInt.asUintN(32, BigInt(registers[rs1])) * BigInt.asUintN(32, BigInt(registers[rs2])), + ) >> 32n, + ); + help: Performs an XLEN-bit by XLEN-bit multiplication of unsigned rs1 by unsigned rs2 and places the upper XLEN bits in the destination register. + - name: rem + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "110" + definition: | + registers[rd] = registers[rs1] % registers[rs2]; + + help: Perform an XLEN-bit by XLEN-bit signed integer reminder of rs1 by rs2. + - name: remu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "111" + definition: | + registers[rd] = registers[rs1] % registers[rs2]; + + help: Perform an XLEN-bit by XLEN-bit unsigned integer reminder of rs1 by rs2. + F: + - name: flw + extension: F + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000111" + - field: funct3 + value: "010" + - field: rd + type: DFP-Reg + definition: | + registers[rd] = CAPI.MEM.read(registers[rs1] + imm, 4, rd); + + postoperation: | + registers[rd] = CAPI.ARCH.NaNBox(registers[rd]); + + help: Load a single-precision floating-point value from memory into floating-point register rd. + - name: fadd.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number + rs2Number; + + help: Perform single-precision floating-point addition. + - name: fclass.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1110000" + - field: funct3 + value: "001" + - field: rs1 + suffix: null + - field: rs2 + type: cop + value: "00000" + order: null + - field: rd + type: INT-Reg + preoperation: | + let rs1Value, rs2Value, type_rs1, type_rs2; + [rs1Value, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Value, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(registers[rd])) { + registers[rd] = CAPI.ARCH.toBigInt(registers[rd], "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(registers[rd], "NaNBfloat32_64"); + } + registers[rs1] = CAPI.ARCH.toBigInt(rs1Value, type_rs1); + registers[rs2] = CAPI.ARCH.toBigInt(rs2Value, type_rs2); + definition: | + let a = CAPI.FP.float2bin(registers[rs1]); + registers[rd] = CAPI.FP.check_ieee( + parseInt(a[0]), + parseInt(a.slice(1, 9), 2), + parseInt(a.slice(10), 2), + ); + help: Examines the value in floating-point register rs1 and writes to integer register rd a 10-bit mask that indicates the class of the floating-point number. The corresponding bit in rd will be set if the property is true and clear otherwise. All other bits in rd are cleared. Note that exactly one bit in rd will be set. + - name: fcvt.s.w + extension: F + template: R-IntToFloat + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101000" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + postoperation: | + registers[rd] = CAPI.ARCH.toBigInt(registers[rd],'NaNBfloat32_64'); + definition: | + registers[rd] = CAPI.FP.uint2int(registers[rs1]) + + help: Converts a 32-bit signed integer, in integer register rs1 into a floating-point number in floating-point register rd. + - name: fcvt.s.wu + extension: F + template: R-IntToFloat + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101000" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + definition: | + registers[rd] = CAPI.FP.int2uint(registers[rs1]) + + help: Converts a 32-bit unsigned integer, in integer register rs1 into a floating-point number in floating-point register rd. + - name: fcvt.w.s + extension: F + template: R-FloatToInt + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100000" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = parseInt(registers[rs1]); + + help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in integer register rd. + - name: fcvt.wu.s + extension: F + template: R-FloatToInt + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100000" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + registers[rd] = CAPI.FP.int2uint(parseInt(rs1Number)); + + help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in unsigned integer register rd. + - name: fdiv.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001100" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + if (rs2Number != 0) { result = rs1Number / rs2Number; } + else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); + + help: Perform single-precision floating-point division. + - name: feq.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010000" + - field: funct3 + value: "010" + - field: rd + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = (rs1Number === rs2Number) ? 1 : 0; + + help: Performs a quiet equal comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fle.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010000" + - field: funct3 + value: "000" + - field: rd + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = (rs1Number <= rs2Number) ? 1 : 0; + + help: Performs a quiet less or equal comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: flt.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010000" + - field: funct3 + value: "001" + - field: rd + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = (rs1Number < rs2Number) ? 1 : 0; + + help: Performs a quiet less comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fmax.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010100" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = Math.max(rs1Number, rs2Number); + + help: Write the larger of single precision data in rs1 and rs2 to rd. + - name: fmin.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010100" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = Math.min(rs1Number, rs2Number); + + help: Write the smaller of single precision data in rs1 and rs2 to rd. + - name: fmul.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = rs2Number * rs1Number; + + help: Perform single-precision floating-point multiplication. + - name: fmv.w.x + extension: F + template: R-IntToFloat + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1111000" + - field: funct5 + value: "00000" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = CAPI.FP.uint2float32(rs1Number); + + help: Move the single-precision value encoded in IEEE 754-2008 standard encoding from the lower 32 bits of integer register rs1 to the floating-point register rd. + - name: fmv.x.w + extension: F + template: R-FloatToInt + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1110000" + - field: funct5 + value: "00000" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, type_rs1; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + registers[rs1] = CAPI.ARCH.toBigInt(rs1Number, type_rs1); + definition: | + result = CAPI.FP.float322uint(rs1Number); + + help: Move the single-precision value in floating-point register rs1 represented in IEEE 754-2008 encoding to the lower 32 bits of integer register rd. + - name: fsgnj.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010000" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = (rs2Number >= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); + + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. + - name: fsgnjn.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010000" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = (rs2Number <= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. + - name: fsgnjx.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010000" + - field: funct3 + value: "010" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + let a = rs1Number < 0; + let b = rs2Number < 0; + result = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is XOR of sign bit of rs1 and rs2. + - name: fsqrt.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0101100" + - field: rs2 + type: cop + value: "00000" + order: null + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + if (rs1Number >= 0) { + result = Math.sqrt(rs1Number); + } else { + CAPI.VALIDATION.raise( + 'Square root of a negative number is not allowed.' + ); + } + help: Perform single-precision square root. + - name: fsub.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000100" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number - rs2Number; + + help: Perform single-precision floating-point subtraction. + - name: fmadd.s + extension: F + template: R4 + fields: + - field: opcode + value: "1000011" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number * rs2Number + rs3Number; + + help: Perform single-precision fused multiply addition. + - name: fmsub.s + extension: F + template: R4 + fields: + - field: opcode + value: "1000111" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number * rs2Number - rs3Number; + + help: Perform single-precision fused multiply addition. + - name: fnmadd.s + extension: F + template: R4 + fields: + - field: opcode + value: "1001111" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = -rs1Number * rs2Number - rs3Number; + + help: Perform negated single-precision fused multiply addition. + - name: fnmsub.s + extension: F + template: R4 + fields: + - field: opcode + value: "1001011" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = -rs1Number * rs2Number + rs3Number; + + help: Perform negated single-precision fused multiply addition. + - name: fsw + extension: F + template: S + fields: + - field: opcode + value: "0100111" + - field: funct3 + value: "010" + - field: rs2 + type: DFP-Reg + definition: | + let value = registers[rs2] & 0xFFFFFFFFn; + CAPI.MEM.write(registers[rs1] + imm, 4, value, rs2, 'float32'); + help: Store a single-precision value from floating-point register rs2 to memory. + D: + - name: fld + extension: D + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000111" + - field: funct3 + value: "011" + - field: rd + type: DFP-Reg + definition: | + if (CAPI.VALIDATION.isMisaligned(registers[rs1] + imm, 'd')) { + CAPI.VALIDATION.raise('The memory must be aligned'); + } + registers[rd] = CAPI.MEM.read(registers[rs1] + imm, 8, rd); + help: Load a double-precision floating-point value from memory into floating-point register rd. + - name: fadd.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = rs1Number + rs2Number; + + help: Perform double-precision floating-point addition. + - name: fclass.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1110001" + - field: funct3 + value: "001" + - field: rs1 + suffix: null + - field: rs2 + type: cop + value: "00000" + order: null + - field: rd + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + let a = CAPI.FP.float2bin(rs1Number); + registers[rd] = CAPI.FP.check_ieee( + parseInt(a[0]), + parseInt(a.slice(1, 12), 2), + parseInt(a.slice(13), 2), + ); + help: Examines the value in double-precision floating-point register rs1 and writes to integer register rd a 10-bit mask that indicates the class of the floating-point number. The corresponding bit in rd will be set if the property is true and clear otherwise. All other bits in rd are cleared. Note that exactly one bit in rd will be set. + - name: fcvt.d.s + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: rd + type: DFP-Reg + - field: rs1 + type: DFP-Reg + - field: funct7 + value: "0100001" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: null + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual + + help: Converts double floating-point register in rs1 into a double floating-point number in floating-point register rd. + - name: fcvt.d.w + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101001" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: null + - field: rd + type: DFP-Reg + - field: rs1 + type: INT-Reg + preoperation: | + let result, rs1Number, type_rs1; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + postoperation: | + registers[rd] = CAPI.ARCH.toBigInt(result, 'float64'); + definition: | + result = CAPI.FP.uint2int(rs1Number); + + help: Converts a 32-bit signed integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. + - name: fcvt.d.wu + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101001" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: null + - field: rd + type: DFP-Reg + - field: rs1 + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = CAPI.FP.int2uint(parseFloat(rs1Number)); + + help: Converts a 32-bit unsigned integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. + - name: fcvt.s.d + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0100000" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + - field: rd + type: DFP-Reg + - field: rs1 + type: DFP-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual + + help: Converts double floating-point register in rs1 into a floating-point number in floating-point register rd. + - name: fcvt.w.d + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100001" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + - field: rd + type: INT-Reg + - field: rs1 + type: DFP-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = CAPI.FP.int2uint(parseInt(rs1Number)); + + help: Converts a double-precision floating-point number in floating-point register rs1 to a signed 32-bit integer, in integer register rd. + - name: fcvt.wu.d + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100001" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + - field: rd + type: INT-Reg + - field: rs1 + type: DFP-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = CAPI.FP.int2uint(parseInt(rs1Number)); + + help: Converts a double-precision floating-point number in floating-point register rs1 to a unsigned 32-bit integer, in integer register rd. + - name: fdiv.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001101" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = rs1Number / rs2Number; + help: Perform double-precision floating-point division. + - name: feq.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010001" + - field: funct3 + value: "010" + - field: rd + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + + definition: | + registers[rd] = (rs1Number == rs2Number) ? 1 : 0; + + help: Performs a quiet equal comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fle.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010001" + - field: funct3 + value: "000" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + + definition: | + registers[rd] = (rs1Number <= rs2Number) ? 1 : 0; + + help: Performs a quiet less or equal comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: flt.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010001" + - field: funct3 + value: "001" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + + definition: | + registers[rd] = (rs1Number < rs2Number) ? 1 : 0; + + help: Performs a quiet less comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fmax.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010101" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = Math.max(rs1Number, rs2Number); + + help: Write the larger of double precision data in rs1 and rs2 to rd. + - name: fmin.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010101" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = Math.min(rs1Number, rs2Number); + + help: Write the smaller of double precision data in rs1 and rs2 to rd. + - name: fmul.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = rs1Number * rs2Number; + + help: Perform double-precision floating-point addition. + - name: fsgnj.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010001" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + registers[rd] = (rs2Number > 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); + help: Perform double-precision floating-point multiplication. + - name: fsgnjn.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010001" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + registers[rd] = (rs2Number > 0) ? -Math.abs(rs1Number) : +Math.abs(rs1Number); + + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is opposite of rs2's sign bit. + - name: fsgnjx.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010001" + - field: funct3 + value: "010" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + let a = rs1Number < 0; + let b = rs2Number < 0; + registers[rd] = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is XOR of sign bit of rs1 and rs2. + - name: fsqrt.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0101101" + - field: rs2 + type: cop + value: "00000" + order: null + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + if (rs1Number >= 0) { + registers[rd] = Math.sqrt(rs1Number); + } else { + CAPI.VALIDATION.raise( + "Square root of a negative number is not allowed." + ); + } + help: Perform double-precision square root. + - name: fsub.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000101" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = rs1Number - rs2Number; + + help: Perform double-precision floating-point addition. + - name: fmadd.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1000011" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = rs1Number * rs2Number + rs3Number; + + help: Perform double-precision fused multiply addition. + - name: fmsub.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1000111" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = rs1Number * rs2Number - rs3Number; + + help: Perform double-precision fused multiply subtraction. + - name: fnmadd.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1001111" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = -rs1Number * rs2Number - rs3Number; + + help: Perform negated double-precision fused multiply addition. + - name: fnmsub.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1001011" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = -rs1Number * rs2Number + rs3Number; + + help: Perform negated double-precision fused multiply subtraction. + - name: fsd + extension: D + template: S + fields: + - field: opcode + value: "0100111" + - field: funct3 + value: "011" + - field: rs2 + type: DFP-Reg + definition: | + let val = BigInt("0x" + CAPI.FP.split_double(registers[rs2], 0)); + CAPI.MEM.write(registers[rs1] + imm, 4, val, rs2); + val = BigInt("0x" + CAPI.FP.split_double(registers[rs2], 1)); + CAPI.MEM.write(registers[rs1] + imm + 4n, 4, val, rs2); + CAPI.MEM.addHint(registers[rs1] + imm, "float64", 64); + help: Store a double-precision value from the floating-point registers to memory. + Zifencei: + - name: fence.i + extension: D + template: Custom + type: Syscall + fields: + - field: opcode + value: "0001111" + - field: funct3 + type: cop + startbit: 14 + stopbit: 12 + value: "001" + - field: zeros + type: cop + startbit: 31 + stopbit: 15 + value: "00000000000000000" + - field: zeros2 + type: cop + startbit: 11 + stopbit: 7 + value: "00000" + definition: | + console.log('Not implemented: fence.i'); + CAPI.VALIDATION.raise('fence.i not implemented'); + help: Provides explicit synchronization between writes to instruction memory and instruction fetches on the same hart. + +pseudoinstructions: + # Make sure the definitions correspond with those in the RISC-V ASM manual (TODO: Check these!) + + # RV32I Pseudoinstructions + I: + - name: beqz + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + beq rs1, x0, off; + + - name: bgez + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bge reg1, x0, off; + help: Take the branch if the value in register rs1 is zero. + + - name: bgt + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + blt rs2, rs1, off; + + - name: bgtu + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bltu rs2, rs1, off; + + - name: bgtz + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bgt rs1, x0, off; + + - name: ble + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bge rs2, rs1, off; + + - name: bleu + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bgeu rs2, rs1, off; + + - name: blez + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + ble x0, rs1, off; + + - name: bltz + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + blt rs1, x0, off; + + - name: bnez + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bne rs1, x0, off; + + - name: j + extension: I + fields: + - field: off + type: offset_bytes + definition: | + beq zero, zero, off; + + - name: jalr + extension: I + fields: + - field: rs + type: INT-Reg + definition: | + jalr x1, 0(rs); + + - name: jr + extension: I + fields: + - field: rs + type: INT-Reg + definition: | + jalr x0, 0(rs); + + - name: la + extension: I + fields: + - field: rd + type: INT-Reg + suffix: "," + - field: addr + type: imm-unsigned + definition: | + no_ret_op{ + tmp = Field.2.(31,0).int - (reg.pc - 4); + tmp_low = tmp & 0x00000FFF; + tmp_low = tmp_low>0x7FF? tmp_low - 0x1000 : tmp_low; + tmp_hi = (tmp - tmp_low) >> 12; + }; + auipc rd, op{tmp_hi}; + addi rd, rd, op{tmp_low}; + + - name: li + extension: I + fields: + - field: rd + type: INT-Reg + suffix: "," + - field: val + type: imm-signed + definition: | + no_ret_op{ + tmp = Field.2.(31,0).int; + tmp_low = tmp & 0x00000FFF; + tmp_low -= tmp_low > 0x7FF ? 0x1000 : 0; + tmp_hi = (tmp - tmp_low) >>> 12; + }; + if (tmp_hi === 0) { + addi rd, x0, op{tmp_low}; + } + else { + lui rd, op{tmp_hi}; + addi rd, rd, op{tmp_low}; + }; + help: Load the sign-extended 6-bit immediate, imm, into register rd. + + - name: mv + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + addi reg1, reg2, 0; + help: Copy the value in register rs2 into register rd. + + - name: neg + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + sub reg1, x0, reg2; + + - name: nop + extension: I + definition: | + addi x0, x0, 0; + help: Does not change any user-visible state, except for advancing the pc. + + - name: not + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + xori reg1, reg2, -1; + + - name: ret + extension: I + definition: | + jalr x0, 0(x1); # TODO: check this! + + - name: seqz + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + sltiu reg1, reg2, 1; + + - name: sgtz + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + slt reg1, x0, reg2; + + - name: sltz + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + slt reg1, reg2, x0; + + - name: snez + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + sltu reg1, x0, reg2; + F: + # RV32F Pseudoinstructions + - name: fabs.s + extension: F + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjx.s rs1, rs2, rs2; + + - name: fmv.s + extension: F + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnj.s rs1, rs2, rs2; + + - name: fneg.s + extension: F + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjn.s rs1, rs2, rs2; + D: + # RV32D Pseudoinstructions + - name: fabs.d + extension: D + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjx.d rs1, rs2, rs2; + + - name: fmv.d + extension: D + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnj.d rs1, rs2, rs2; + + - name: fneg.d + extension: D + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjn.d rs1, rs2, rs2; + +enums: + rounding_mode: + rne: 0 + rtz: 1 + rdn: 2 + rup: 3 + rmm: 4 + dyn: 7 + DEFAULT: dyn diff --git a/architecture/available_arch.json b/architecture/available_arch.json index bbc9a7400..babddbe29 100644 --- a/architecture/available_arch.json +++ b/architecture/available_arch.json @@ -15,11 +15,11 @@ "alt": "RISC-V", "id": "select_confRISV", "examples": ["default"], - "description": "RISC-V is an instruction set architecture (ISA) based on the RISC type and its hardware is free. This architecture was created in 2010 at the University of California, Berkeley.", + "description": "RISC-V is a free and open-standard instruction set architecture (ISA) based on RISC principles. This architecture was developed in 2010 at the University of California, Berkeley.

This ISA includes the 32-bit I (integer), M (multiplication and division), F (single-precision floating-point), and D (double-precision floating-point) RISC-V extensions.", "guide": "guides/riscv.pdf", "available": true }, - { + { "name": "RISC-V (RV64IMFD)", "alias": [ "RISC-V (RV64IMFD)", @@ -35,7 +35,39 @@ "alt": "RISC-V", "id": "select_confRISV", "examples": ["default"], - "description": "RISC-V is an instruction set architecture (ISA) based on the RISC type and its hardware is free. This architecture was created in 2010 at the University of California, Berkeley.", + "description": "RISC-V is a free and open-standard instruction set architecture (ISA) based on RISC principles. This architecture was developed in 2010 at the University of California, Berkeley.

This ISA includes the 64-bit I (integer), M (multiplication and division), F (single-precision floating-point), and D (double-precision floating-point) RISC-V extensions.", + "guide": "/guides/riscv.pdf", + "available": true + }, + { + "name": "RISC-V Sail 32 - Full Specification", + "alias": [ + "RISC-V (SRV32)", + "SRV32", + "srv32" + ], + "file": "RISCV/SRV32", + "img": "riscv.png", + "alt": "RISC-V", + "id": "select_confRISV", + "examples": ["default"], + "description": "RISC-V is a free and open-standard instruction set architecture (ISA) based on RISC principles. This architecture was developed in 2010 at the University of California, Berkeley.

This ISA includes the full 32-bit specification of RISC-V based on Sail.", + "guide": "/guides/riscv.pdf", + "available": true + }, + { + "name": "RISC-V Sail 64 - Full Specification", + "alias": [ + "RISC-V (SRV64)", + "SRV64", + "srv64" + ], + "file": "RISCV/SRV64", + "img": "riscv.png", + "alt": "RISC-V", + "id": "select_confRISV", + "examples": ["default"], + "description": "RISC-V is a free and open-standard instruction set architecture (ISA) based on RISC principles. This architecture was developed in 2010 at the University of California, Berkeley.

This ISA includes the full 64-bit specification of RISC-V based on Sail.", "guide": "/guides/riscv.pdf", "available": true }, diff --git a/bun.lock b/bun.lock index 1daee7947..e915327c5 100644 --- a/bun.lock +++ b/bun.lock @@ -1,6 +1,6 @@ { "lockfileVersion": 1, - "configVersion": 1, + "configVersion": 0, "workspaces": { "": { "name": "creator", @@ -27,7 +27,7 @@ "colors": "^1.4.0", "deno": "^2.5.4", "humanize-duration": "^3.33.0", - "js-yaml": "^4.1.0", + "js-yaml": "^4.1.1", "mitt": "^3.0.1", "monaco-editor": "^0.54.0", "monaco-vim": "^0.4.2", @@ -59,12 +59,12 @@ "globals": "^16.5.0", "jiti": "^2.6.1", "npm-run-all2": "^8.0.4", - "prettier": "^3.7.3", + "prettier": "^3.7.4", "prettier-plugin-vue": "^1.1.6", "sass-embedded": "^1.93.3", "sharp": "^0.34.5", "svgo": "^4.0.0", - "typescript": "~5.9.3", + "typescript": "^5.8.3", "unplugin-vue-components": "^30.0.0", "vite": "^7.2.4", "vite-multiple-assets": "^2.2.6", @@ -79,165 +79,163 @@ "trustedDependencies": [ "sharp", "deno", - "esbuild", "wasm-pack", "vue-demi", + "esbuild", "@parcel/watcher", ], "packages": { - "@ampproject/remapping": ["@ampproject/remapping@2.3.0", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="], + "@babel/code-frame": ["@babel/code-frame@7.29.0", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.28.5", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw=="], - "@babel/code-frame": ["@babel/code-frame@7.27.1", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.27.1", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg=="], + "@babel/compat-data": ["@babel/compat-data@7.29.0", "", {}, "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg=="], - "@babel/compat-data": ["@babel/compat-data@7.28.0", "", {}, "sha512-60X7qkglvrap8mn1lh2ebxXdZYtUcpd7gsmy9kLaBJ4i/WdY8PqTSdxyA8qraikqKQK5C1KRBKXqznrVapyNaw=="], + "@babel/core": ["@babel/core@7.29.0", "", { "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", "@babel/helper-compilation-targets": "^7.28.6", "@babel/helper-module-transforms": "^7.28.6", "@babel/helpers": "^7.28.6", "@babel/parser": "^7.29.0", "@babel/template": "^7.28.6", "@babel/traverse": "^7.29.0", "@babel/types": "^7.29.0", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA=="], - "@babel/core": ["@babel/core@7.28.0", "", { "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.0", "@babel/helper-compilation-targets": "^7.27.2", "@babel/helper-module-transforms": "^7.27.3", "@babel/helpers": "^7.27.6", "@babel/parser": "^7.28.0", "@babel/template": "^7.27.2", "@babel/traverse": "^7.28.0", "@babel/types": "^7.28.0", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-UlLAnTPrFdNGoFtbSXwcGFQBtQZJCNjaN6hQNP3UPvuNXT1i82N26KL3dZeIpNalWywr9IuQuncaAfUaS1g6sQ=="], - - "@babel/generator": ["@babel/generator@7.28.0", "", { "dependencies": { "@babel/parser": "^7.28.0", "@babel/types": "^7.28.0", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-lJjzvrbEeWrhB4P3QBsH7tey117PjLZnDbLiQEKjQ/fNJTjuq4HSqgFA+UNSwZT8D7dxxbnuSBMsa1lrWzKlQg=="], + "@babel/generator": ["@babel/generator@7.29.1", "", { "dependencies": { "@babel/parser": "^7.29.0", "@babel/types": "^7.29.0", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw=="], "@babel/helper-annotate-as-pure": ["@babel/helper-annotate-as-pure@7.27.3", "", { "dependencies": { "@babel/types": "^7.27.3" } }, "sha512-fXSwMQqitTGeHLBC08Eq5yXz2m37E4pJX1qAU1+2cNedz/ifv/bVXft90VeSav5nFO61EcNgwr0aJxbyPaWBPg=="], - "@babel/helper-compilation-targets": ["@babel/helper-compilation-targets@7.27.2", "", { "dependencies": { "@babel/compat-data": "^7.27.2", "@babel/helper-validator-option": "^7.27.1", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" } }, "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ=="], + "@babel/helper-compilation-targets": ["@babel/helper-compilation-targets@7.28.6", "", { "dependencies": { "@babel/compat-data": "^7.28.6", "@babel/helper-validator-option": "^7.27.1", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" } }, "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA=="], - "@babel/helper-create-class-features-plugin": ["@babel/helper-create-class-features-plugin@7.27.1", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.27.1", "@babel/helper-member-expression-to-functions": "^7.27.1", "@babel/helper-optimise-call-expression": "^7.27.1", "@babel/helper-replace-supers": "^7.27.1", "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", "@babel/traverse": "^7.27.1", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-QwGAmuvM17btKU5VqXfb+Giw4JcN0hjuufz3DYnpeVDvZLAObloM77bhMXiqry3Iio+Ai4phVRDwl6WU10+r5A=="], + "@babel/helper-create-class-features-plugin": ["@babel/helper-create-class-features-plugin@7.28.6", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.27.3", "@babel/helper-member-expression-to-functions": "^7.28.5", "@babel/helper-optimise-call-expression": "^7.27.1", "@babel/helper-replace-supers": "^7.28.6", "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", "@babel/traverse": "^7.28.6", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-dTOdvsjnG3xNT9Y0AUg1wAl38y+4Rl4sf9caSQZOXdNqVn+H+HbbJ4IyyHaIqNR6SW9oJpA/RuRjsjCw2IdIow=="], "@babel/helper-globals": ["@babel/helper-globals@7.28.0", "", {}, "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw=="], - "@babel/helper-member-expression-to-functions": ["@babel/helper-member-expression-to-functions@7.27.1", "", { "dependencies": { "@babel/traverse": "^7.27.1", "@babel/types": "^7.27.1" } }, "sha512-E5chM8eWjTp/aNoVpcbfM7mLxu9XGLWYise2eBKGQomAk/Mb4XoxyqXTZbuTohbsl8EKqdlMhnDI2CCLfcs9wA=="], + "@babel/helper-member-expression-to-functions": ["@babel/helper-member-expression-to-functions@7.28.5", "", { "dependencies": { "@babel/traverse": "^7.28.5", "@babel/types": "^7.28.5" } }, "sha512-cwM7SBRZcPCLgl8a7cY0soT1SptSzAlMH39vwiRpOQkJlh53r5hdHwLSCZpQdVLT39sZt+CRpNwYG4Y2v77atg=="], - "@babel/helper-module-imports": ["@babel/helper-module-imports@7.27.1", "", { "dependencies": { "@babel/traverse": "^7.27.1", "@babel/types": "^7.27.1" } }, "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w=="], + "@babel/helper-module-imports": ["@babel/helper-module-imports@7.28.6", "", { "dependencies": { "@babel/traverse": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw=="], - "@babel/helper-module-transforms": ["@babel/helper-module-transforms@7.27.3", "", { "dependencies": { "@babel/helper-module-imports": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1", "@babel/traverse": "^7.27.3" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg=="], + "@babel/helper-module-transforms": ["@babel/helper-module-transforms@7.28.6", "", { "dependencies": { "@babel/helper-module-imports": "^7.28.6", "@babel/helper-validator-identifier": "^7.28.5", "@babel/traverse": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA=="], "@babel/helper-optimise-call-expression": ["@babel/helper-optimise-call-expression@7.27.1", "", { "dependencies": { "@babel/types": "^7.27.1" } }, "sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw=="], - "@babel/helper-plugin-utils": ["@babel/helper-plugin-utils@7.27.1", "", {}, "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw=="], + "@babel/helper-plugin-utils": ["@babel/helper-plugin-utils@7.28.6", "", {}, "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug=="], - "@babel/helper-replace-supers": ["@babel/helper-replace-supers@7.27.1", "", { "dependencies": { "@babel/helper-member-expression-to-functions": "^7.27.1", "@babel/helper-optimise-call-expression": "^7.27.1", "@babel/traverse": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-7EHz6qDZc8RYS5ElPoShMheWvEgERonFCs7IAonWLLUTXW59DP14bCZt89/GKyreYn8g3S83m21FelHKbeDCKA=="], + "@babel/helper-replace-supers": ["@babel/helper-replace-supers@7.28.6", "", { "dependencies": { "@babel/helper-member-expression-to-functions": "^7.28.5", "@babel/helper-optimise-call-expression": "^7.27.1", "@babel/traverse": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-mq8e+laIk94/yFec3DxSjCRD2Z0TAjhVbEJY3UQrlwVo15Lmt7C2wAUbK4bjnTs4APkwsYLTahXRraQXhb1WCg=="], "@babel/helper-skip-transparent-expression-wrappers": ["@babel/helper-skip-transparent-expression-wrappers@7.27.1", "", { "dependencies": { "@babel/traverse": "^7.27.1", "@babel/types": "^7.27.1" } }, "sha512-Tub4ZKEXqbPjXgWLl2+3JpQAYBJ8+ikpQ2Ocj/q/r0LwE3UhENh7EUabyHjz2kCEsrRY83ew2DQdHluuiDQFzg=="], "@babel/helper-string-parser": ["@babel/helper-string-parser@7.27.1", "", {}, "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA=="], - "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.27.1", "", {}, "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow=="], + "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], "@babel/helper-validator-option": ["@babel/helper-validator-option@7.27.1", "", {}, "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg=="], - "@babel/helpers": ["@babel/helpers@7.27.6", "", { "dependencies": { "@babel/template": "^7.27.2", "@babel/types": "^7.27.6" } }, "sha512-muE8Tt8M22638HU31A3CgfSUciwz1fhATfoVai05aPXGor//CdWDCbnlY1yvBPo07njuVOCNGCSp/GTt12lIug=="], + "@babel/helpers": ["@babel/helpers@7.28.6", "", { "dependencies": { "@babel/template": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw=="], - "@babel/parser": ["@babel/parser@7.28.4", "", { "dependencies": { "@babel/types": "^7.28.4" }, "bin": "./bin/babel-parser.js" }, "sha512-yZbBqeM6TkpP9du/I2pUZnJsRMGGvOuIrhjzC1AwHwW+6he4mni6Bp/m8ijn0iOuZuPI2BfkCoSRunpyjnrQKg=="], + "@babel/parser": ["@babel/parser@7.29.0", "", { "dependencies": { "@babel/types": "^7.29.0" }, "bin": "./bin/babel-parser.js" }, "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww=="], - "@babel/plugin-proposal-decorators": ["@babel/plugin-proposal-decorators@7.28.0", "", { "dependencies": { "@babel/helper-create-class-features-plugin": "^7.27.1", "@babel/helper-plugin-utils": "^7.27.1", "@babel/plugin-syntax-decorators": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-zOiZqvANjWDUaUS9xMxbMcK/Zccztbe/6ikvUXaG9nsPH3w6qh5UaPGAnirI/WhIbZ8m3OHU0ReyPrknG+ZKeg=="], + "@babel/plugin-proposal-decorators": ["@babel/plugin-proposal-decorators@7.29.0", "", { "dependencies": { "@babel/helper-create-class-features-plugin": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6", "@babel/plugin-syntax-decorators": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-CVBVv3VY/XRMxRYq5dwr2DS7/MvqPm23cOCjbwNnVrfOqcWlnefua1uUs0sjdKOGjvPUG633o07uWzJq4oI6dA=="], - "@babel/plugin-syntax-decorators": ["@babel/plugin-syntax-decorators@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-YMq8Z87Lhl8EGkmb0MwYkt36QnxC+fzCgrl66ereamPlYToRpIk5nUjKUY3QKLWq8mwUB1BgbeXcTJhZOCDg5A=="], + "@babel/plugin-syntax-decorators": ["@babel/plugin-syntax-decorators@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-71EYI0ONURHJBL4rSFXnITXqXrrY8q4P0q006DPfN+Rk+ASM+++IBXem/ruokgBZR8YNEWZ8R6B+rCb8VcUTqA=="], - "@babel/plugin-syntax-import-attributes": ["@babel/plugin-syntax-import-attributes@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-oFT0FrKHgF53f4vOsZGi2Hh3I35PfSmVs4IBFLFj4dnafP+hIWDLg3VyKmUHfLoLHlyxY4C7DGtmHuJgn+IGww=="], + "@babel/plugin-syntax-import-attributes": ["@babel/plugin-syntax-import-attributes@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-jiLC0ma9XkQT3TKJ9uYvlakm66Pamywo+qwL+oL8HJOvc6TWdZXVfhqJr8CCzbSGUAbDOzlGHJC1U+vRfLQDvw=="], "@babel/plugin-syntax-import-meta": ["@babel/plugin-syntax-import-meta@7.10.4", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g=="], - "@babel/plugin-syntax-jsx": ["@babel/plugin-syntax-jsx@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-y8YTNIeKoyhGd9O0Jiyzyyqk8gdjnumGTQPsz0xOZOQ2RmkVJeZ1vmmfIvFEKqucBG6axJGBZDE/7iI5suUI/w=="], + "@babel/plugin-syntax-jsx": ["@babel/plugin-syntax-jsx@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w=="], - "@babel/plugin-syntax-typescript": ["@babel/plugin-syntax-typescript@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-xfYCBMxveHrRMnAWl1ZlPXOZjzkN82THFvLhQhFXFt81Z5HnN+EtUkZhv/zcKpmT3fzmWZB0ywiBrbC3vogbwQ=="], + "@babel/plugin-syntax-typescript": ["@babel/plugin-syntax-typescript@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-+nDNmQye7nlnuuHDboPbGm00Vqg3oO8niRRL27/4LYHUsHYh0zJ1xWOz0uRwNFmM1Avzk8wZbc6rdiYhomzv/A=="], - "@babel/plugin-transform-typescript": ["@babel/plugin-transform-typescript@7.28.0", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.27.3", "@babel/helper-create-class-features-plugin": "^7.27.1", "@babel/helper-plugin-utils": "^7.27.1", "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", "@babel/plugin-syntax-typescript": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-4AEiDEBPIZvLQaWlc9liCavE0xRM0dNca41WtBeM3jgFptfUOSG9z0uteLhq6+3rq+WB6jIvUwKDTpXEHPJ2Vg=="], + "@babel/plugin-transform-typescript": ["@babel/plugin-transform-typescript@7.28.6", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.27.3", "@babel/helper-create-class-features-plugin": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6", "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", "@babel/plugin-syntax-typescript": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-0YWL2RFxOqEm9Efk5PvreamxPME8OyY0wM5wh5lHjF+VtVhdneCWGzZeSqzOfiobVqQaNCd2z0tQvnI9DaPWPw=="], - "@babel/template": ["@babel/template@7.27.2", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/parser": "^7.27.2", "@babel/types": "^7.27.1" } }, "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw=="], + "@babel/template": ["@babel/template@7.28.6", "", { "dependencies": { "@babel/code-frame": "^7.28.6", "@babel/parser": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ=="], - "@babel/traverse": ["@babel/traverse@7.28.0", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.0", "@babel/helper-globals": "^7.28.0", "@babel/parser": "^7.28.0", "@babel/template": "^7.27.2", "@babel/types": "^7.28.0", "debug": "^4.3.1" } }, "sha512-mGe7UK5wWyh0bKRfupsUchrQGqvDbZDbKJw+kcRGSmdHVYrv+ltd0pnpDTVpiTqnaBru9iEvA8pz8W46v0Amwg=="], + "@babel/traverse": ["@babel/traverse@7.29.0", "", { "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", "@babel/helper-globals": "^7.28.0", "@babel/parser": "^7.29.0", "@babel/template": "^7.28.6", "@babel/types": "^7.29.0", "debug": "^4.3.1" } }, "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA=="], - "@babel/types": ["@babel/types@7.28.4", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-bkFqkLhh3pMBUQQkpVgWDWq/lqzc2678eUyDlTBhRqhCHFguYYGM0Efga7tYk4TogG/3x0EEl66/OQ+WGbWB/Q=="], + "@babel/types": ["@babel/types@7.29.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="], - "@bufbuild/protobuf": ["@bufbuild/protobuf@2.6.0", "", {}, "sha512-6cuonJVNOIL7lTj5zgo/Rc2bKAo4/GvN+rKCrUj7GdEHRzCk8zKOfFwUsL9nAVk5rSIsRmlgcpLzTRysopEeeg=="], + "@bufbuild/protobuf": ["@bufbuild/protobuf@2.11.0", "", {}, "sha512-sBXGT13cpmPR5BMgHE6UEEfEaShh5Ror6rfN3yEK5si7QVrtZg8LEPQb0VVhiLRUslD2yLnXtnRzG035J/mZXQ=="], - "@codemirror/autocomplete": ["@codemirror/autocomplete@6.18.6", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0" } }, "sha512-PHHBXFomUs5DF+9tCOM/UoW6XQ4R44lLNNhRaW9PKPTU0D7lIjRg3ElxaJnTwsl/oHiR93WSXDBrekhoUGCPtg=="], + "@codemirror/autocomplete": ["@codemirror/autocomplete@6.20.1", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0" } }, "sha512-1cvg3Vz1dSSToCNlJfRA2WSI4ht3K+WplO0UMOgmUYPivCyy2oueZY6Lx7M9wThm7SDUBViRmuT+OG/i8+ON9A=="], - "@codemirror/commands": ["@codemirror/commands@6.8.1", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.4.0", "@codemirror/view": "^6.27.0", "@lezer/common": "^1.1.0" } }, "sha512-KlGVYufHMQzxbdQONiLyGQDUW0itrLZwq3CcY7xpv9ZLRHqzkBSoteocBHtMCoY7/Ci4xhzSrToIeLg7FxHuaw=="], + "@codemirror/commands": ["@codemirror/commands@6.10.2", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.4.0", "@codemirror/view": "^6.27.0", "@lezer/common": "^1.1.0" } }, "sha512-vvX1fsih9HledO1c9zdotZYUZnE4xV0m6i3m25s5DIfXofuprk6cRcLUZvSk3CASUbwjQX21tOGbkY2BH8TpnQ=="], "@codemirror/lang-json": ["@codemirror/lang-json@6.0.2", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@lezer/json": "^1.0.0" } }, "sha512-x2OtO+AvwEHrEwR0FyyPtfDUiloG3rnVTSZV1W8UteaLL8/MajQd8DpvUb2YVzC+/T18aSDv0H9mu+xw0EStoQ=="], "@codemirror/lang-yaml": ["@codemirror/lang-yaml@6.1.2", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.2.0", "@lezer/lr": "^1.0.0", "@lezer/yaml": "^1.0.0" } }, "sha512-dxrfG8w5Ce/QbT7YID7mWZFKhdhsaTNOYjOkSIMt1qmC4VQnXSDSYVHHHn8k6kJUfIhtLo8t1JJgltlxWdsITw=="], - "@codemirror/language": ["@codemirror/language@6.11.3", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.1.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-9HBM2XnwDj7fnu0551HkGdrUrrqmYq/WC5iv6nbY2WdicXdGbhR/gfbZOH73Aqj4351alY1+aoG9rCNfiwS1RA=="], + "@codemirror/language": ["@codemirror/language@6.12.2", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.5.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-jEPmz2nGGDxhRTg3lTpzmIyGKxz3Gp3SJES4b0nAuE5SWQoKdT5GoQ69cwMmFd+wvFUhYirtDTr0/DRHpQAyWg=="], "@codemirror/legacy-modes": ["@codemirror/legacy-modes@6.5.2", "", { "dependencies": { "@codemirror/language": "^6.0.0" } }, "sha512-/jJbwSTazlQEDOQw2FJ8LEEKVS72pU0lx6oM54kGpL8t/NJ2Jda3CZ4pcltiKTdqYSRk3ug1B3pil1gsjA6+8Q=="], - "@codemirror/lint": ["@codemirror/lint@6.8.5", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.35.0", "crelt": "^1.0.5" } }, "sha512-s3n3KisH7dx3vsoeGMxsbRAgKe4O1vbrnKBClm99PU0fWxmxsx5rR2PfqQgIt+2MMJBHbiJ5rfIdLYfB9NNvsA=="], + "@codemirror/lint": ["@codemirror/lint@6.9.5", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.35.0", "crelt": "^1.0.5" } }, "sha512-GElsbU9G7QT9xXhpUg1zWGmftA/7jamh+7+ydKRuT0ORpWS3wOSP0yT1FOlIZa7mIJjpVPipErsyvVqB9cfTFA=="], - "@codemirror/search": ["@codemirror/search@6.5.11", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", "crelt": "^1.0.5" } }, "sha512-KmWepDE6jUdL6n8cAAqIpRmLPBZ5ZKnicE8oGU/s3QrAVID+0VhLFrzUucVKHG5035/BSykhExDL/Xm7dHthiA=="], + "@codemirror/search": ["@codemirror/search@6.6.0", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.37.0", "crelt": "^1.0.5" } }, "sha512-koFuNXcDvyyotWcgOnZGmY7LZqEOXZaaxD/j6n18TCLx2/9HieZJ5H6hs1g8FiRxBD0DNfs0nXn17g872RmYdw=="], - "@codemirror/state": ["@codemirror/state@6.5.2", "", { "dependencies": { "@marijn/find-cluster-break": "^1.0.0" } }, "sha512-FVqsPqtPWKVVL3dPSxy8wEF/ymIEuVzF1PK3VbUgrxXpJUSHQWWZz4JMToquRxnkw+36LTamCZG2iua2Ptq0fA=="], + "@codemirror/state": ["@codemirror/state@6.5.4", "", { "dependencies": { "@marijn/find-cluster-break": "^1.0.0" } }, "sha512-8y7xqG/hpB53l25CIoit9/ngxdfoG+fx+V3SHBrinnhOtLvKHRyAJJuHzkWrR4YXXLX8eXBsejgAAxHUOdW1yw=="], - "@codemirror/view": ["@codemirror/view@6.38.0", "", { "dependencies": { "@codemirror/state": "^6.5.0", "crelt": "^1.0.6", "style-mod": "^4.1.0", "w3c-keyname": "^2.2.4" } }, "sha512-yvSchUwHOdupXkd7xJ0ob36jdsSR/I+/C+VbY0ffBiL5NiSTEBDfB1ZGWbbIlDd5xgdUkody+lukAdOxYrOBeg=="], + "@codemirror/view": ["@codemirror/view@6.39.16", "", { "dependencies": { "@codemirror/state": "^6.5.0", "crelt": "^1.0.6", "style-mod": "^4.1.0", "w3c-keyname": "^2.2.4" } }, "sha512-m6S22fFpKtOWhq8HuhzsI1WzUP/hB9THbDj0Tl5KX4gbO6Y91hwBl7Yky33NdvB6IffuRFiBxf1R8kJMyXmA4Q=="], - "@deno/darwin-arm64": ["@deno/darwin-arm64@2.5.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-aQoAQSQdA8PVhS9ibx/vl1xtP0ngiZCD2tW/PqUd13fmwM12m3O2V8/oyMTzqXZtT/PnoiOtcqtujbF/yRUyVg=="], + "@deno/darwin-arm64": ["@deno/darwin-arm64@2.7.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-MPuhlIvUsM98ljVRD2wszRQzhd0Eizoj02hgDTNLTBS8lcuNs9Buig0dlnNMNxaUN8JdZ9Y0+22XJNhVNoi8WQ=="], - "@deno/darwin-x64": ["@deno/darwin-x64@2.5.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-9GrCi8ga5mgYB1b/8Pj9vRF4VVNLTuzyVd6bL0vEKFBZ/w27cQj0oY2o60t8AUTpW8iXpJfXMDoY7j4yiK1Xug=="], + "@deno/darwin-x64": ["@deno/darwin-x64@2.7.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-PPVC+BKAhlM3dvXqmKhzUyxA4D/IzNZWCc0dn9vEPAgIgWH8aVKwfIWf7yQS50FECKJz0C/QmANQOqVYYFxUqQ=="], - "@deno/linux-arm64-glibc": ["@deno/linux-arm64-glibc@2.5.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-HiAHeFBmNRsJFulNMQ2LX3k+IvAIhGAo9JcW/0PwrNa3WbMql9wq37pOPp8DkW2VUTvghh3FZm6GUcryUml4bQ=="], + "@deno/linux-arm64-glibc": ["@deno/linux-arm64-glibc@2.7.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-6l6bZdYqoUUdvLJqSkmXU3wSgSznaKIkoKfkyRjt/BLPmLxSeGvQ2cmX1Y5RE7GItO7DMwVksA9mce6RDm8GNg=="], - "@deno/linux-x64-glibc": ["@deno/linux-x64-glibc@2.5.6", "", { "os": "linux", "cpu": "x64" }, "sha512-aYct9Vp1RgKR2yW9hyWGTIL0EN0MgqaBuD0fbnQHygd4ftSfd/aWcBB3+n7OTUX/YNWSxYkOMLV1N8RWUCj4jw=="], + "@deno/linux-x64-glibc": ["@deno/linux-x64-glibc@2.7.1", "", { "os": "linux", "cpu": "x64" }, "sha512-st/6AKBOW9bA6FwCUi9zWnsOpTpw5o4CRt3eEQ4NYddcBTqegcfCOwyQuz23U2xTQfervPmpYrcFDqUM4YgTEw=="], - "@deno/win32-arm64": ["@deno/win32-arm64@2.5.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-HZq7gShjAehx1d2qg2cHRJJbxpbBk8kVmoPiZpILnN66XRwbNlWtrAUwsXNyHuBHcaT+7LgPTRUzX3KuDYXbwg=="], + "@deno/win32-arm64": ["@deno/win32-arm64@2.7.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-lc5LANMjnybwzcToDer1arEB4+gb6sYJgWLfD2pBhlkbdTOz3BPiESOKxUA0aR0eEy9tKH1c0Kq3EqVDVDp4kQ=="], - "@deno/win32-x64": ["@deno/win32-x64@2.5.6", "", { "os": "win32", "cpu": "x64" }, "sha512-GRBl8+CQbNeTp9CrxbCuAuqxi592NZfac1AvDgFEPt8O9aZe/2k+y7AQwESJGxEvyJl1vw6UV24qdf9N7pCM9Q=="], + "@deno/win32-x64": ["@deno/win32-x64@2.7.1", "", { "os": "win32", "cpu": "x64" }, "sha512-59nytY3Zez2Ur0f0YBY0Tv27Y6jZl76+5+k4XhSans7KaBqxB9/aA79GdSOeuW/7WOOFSZmlE+O07HMTkLY9Zg=="], - "@emnapi/runtime": ["@emnapi/runtime@1.7.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-PVtJr5CmLwYAU9PZDMITZoR5iAOShYREoR45EyyLrbntV50mdePTgUn4AmOw90Ifcj+x2kRjdzr1HP3RrNiHGA=="], + "@emnapi/runtime": ["@emnapi/runtime@1.8.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg=="], - "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.10", "", { "os": "aix", "cpu": "ppc64" }, "sha512-0NFWnA+7l41irNuaSVlLfgNT12caWJVLzp5eAVhZ0z1qpxbockccEt3s+149rE64VUI3Ml2zt8Nv5JVc4QXTsw=="], + "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.27.3", "", { "os": "aix", "cpu": "ppc64" }, "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg=="], - "@esbuild/android-arm": ["@esbuild/android-arm@0.25.10", "", { "os": "android", "cpu": "arm" }, "sha512-dQAxF1dW1C3zpeCDc5KqIYuZ1tgAdRXNoZP7vkBIRtKZPYe2xVr/d3SkirklCHudW1B45tGiUlz2pUWDfbDD4w=="], + "@esbuild/android-arm": ["@esbuild/android-arm@0.27.3", "", { "os": "android", "cpu": "arm" }, "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA=="], - "@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.10", "", { "os": "android", "cpu": "arm64" }, "sha512-LSQa7eDahypv/VO6WKohZGPSJDq5OVOo3UoFR1E4t4Gj1W7zEQMUhI+lo81H+DtB+kP+tDgBp+M4oNCwp6kffg=="], + "@esbuild/android-arm64": ["@esbuild/android-arm64@0.27.3", "", { "os": "android", "cpu": "arm64" }, "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg=="], - "@esbuild/android-x64": ["@esbuild/android-x64@0.25.10", "", { "os": "android", "cpu": "x64" }, "sha512-MiC9CWdPrfhibcXwr39p9ha1x0lZJ9KaVfvzA0Wxwz9ETX4v5CHfF09bx935nHlhi+MxhA63dKRRQLiVgSUtEg=="], + "@esbuild/android-x64": ["@esbuild/android-x64@0.27.3", "", { "os": "android", "cpu": "x64" }, "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ=="], - "@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.10", "", { "os": "darwin", "cpu": "arm64" }, "sha512-JC74bdXcQEpW9KkV326WpZZjLguSZ3DfS8wrrvPMHgQOIEIG/sPXEN/V8IssoJhbefLRcRqw6RQH2NnpdprtMA=="], + "@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.27.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg=="], - "@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.10", "", { "os": "darwin", "cpu": "x64" }, "sha512-tguWg1olF6DGqzws97pKZ8G2L7Ig1vjDmGTwcTuYHbuU6TTjJe5FXbgs5C1BBzHbJ2bo1m3WkQDbWO2PvamRcg=="], + "@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.27.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg=="], - "@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.10", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-3ZioSQSg1HT2N05YxeJWYR+Libe3bREVSdWhEEgExWaDtyFbbXWb49QgPvFH8u03vUPX10JhJPcz7s9t9+boWg=="], + "@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.27.3", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w=="], - "@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.10", "", { "os": "freebsd", "cpu": "x64" }, "sha512-LLgJfHJk014Aa4anGDbh8bmI5Lk+QidDmGzuC2D+vP7mv/GeSN+H39zOf7pN5N8p059FcOfs2bVlrRr4SK9WxA=="], + "@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.27.3", "", { "os": "freebsd", "cpu": "x64" }, "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA=="], - "@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.10", "", { "os": "linux", "cpu": "arm" }, "sha512-oR31GtBTFYCqEBALI9r6WxoU/ZofZl962pouZRTEYECvNF/dtXKku8YXcJkhgK/beU+zedXfIzHijSRapJY3vg=="], + "@esbuild/linux-arm": ["@esbuild/linux-arm@0.27.3", "", { "os": "linux", "cpu": "arm" }, "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw=="], - "@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-5luJWN6YKBsawd5f9i4+c+geYiVEw20FVW5x0v1kEMWNq8UctFjDiMATBxLvmmHA4bf7F6hTRaJgtghFr9iziQ=="], + "@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.27.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg=="], - "@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.10", "", { "os": "linux", "cpu": "ia32" }, "sha512-NrSCx2Kim3EnnWgS4Txn0QGt0Xipoumb6z6sUtl5bOEZIVKhzfyp/Lyw4C1DIYvzeW/5mWYPBFJU3a/8Yr75DQ=="], + "@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.27.3", "", { "os": "linux", "cpu": "ia32" }, "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg=="], - "@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-xoSphrd4AZda8+rUDDfD9J6FUMjrkTz8itpTITM4/xgerAZZcFW7Dv+sun7333IfKxGG8gAq+3NbfEMJfiY+Eg=="], + "@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.27.3", "", { "os": "linux", "cpu": "none" }, "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA=="], - "@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-ab6eiuCwoMmYDyTnyptoKkVS3k8fy/1Uvq7Dj5czXI6DF2GqD2ToInBI0SHOp5/X1BdZ26RKc5+qjQNGRBelRA=="], + "@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.27.3", "", { "os": "linux", "cpu": "none" }, "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw=="], - "@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.10", "", { "os": "linux", "cpu": "ppc64" }, "sha512-NLinzzOgZQsGpsTkEbdJTCanwA5/wozN9dSgEl12haXJBzMTpssebuXR42bthOF3z7zXFWH1AmvWunUCkBE4EA=="], + "@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.27.3", "", { "os": "linux", "cpu": "ppc64" }, "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA=="], - "@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-FE557XdZDrtX8NMIeA8LBJX3dC2M8VGXwfrQWU7LB5SLOajfJIxmSdyL/gU1m64Zs9CBKvm4UAuBp5aJ8OgnrA=="], + "@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.27.3", "", { "os": "linux", "cpu": "none" }, "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ=="], - "@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.10", "", { "os": "linux", "cpu": "s390x" }, "sha512-3BBSbgzuB9ajLoVZk0mGu+EHlBwkusRmeNYdqmznmMc9zGASFjSsxgkNsqmXugpPk00gJ0JNKh/97nxmjctdew=="], + "@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.27.3", "", { "os": "linux", "cpu": "s390x" }, "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw=="], - "@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.10", "", { "os": "linux", "cpu": "x64" }, "sha512-QSX81KhFoZGwenVyPoberggdW1nrQZSvfVDAIUXr3WqLRZGZqWk/P4T8p2SP+de2Sr5HPcvjhcJzEiulKgnxtA=="], + "@esbuild/linux-x64": ["@esbuild/linux-x64@0.27.3", "", { "os": "linux", "cpu": "x64" }, "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA=="], - "@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.10", "", { "os": "none", "cpu": "arm64" }, "sha512-AKQM3gfYfSW8XRk8DdMCzaLUFB15dTrZfnX8WXQoOUpUBQ+NaAFCP1kPS/ykbbGYz7rxn0WS48/81l9hFl3u4A=="], + "@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.27.3", "", { "os": "none", "cpu": "arm64" }, "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA=="], - "@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.10", "", { "os": "none", "cpu": "x64" }, "sha512-7RTytDPGU6fek/hWuN9qQpeGPBZFfB4zZgcz2VK2Z5VpdUxEI8JKYsg3JfO0n/Z1E/6l05n0unDCNc4HnhQGig=="], + "@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.27.3", "", { "os": "none", "cpu": "x64" }, "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA=="], - "@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.10", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-5Se0VM9Wtq797YFn+dLimf2Zx6McttsH2olUBsDml+lm0GOCRVebRWUvDtkY4BWYv/3NgzS8b/UM3jQNh5hYyw=="], + "@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.27.3", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw=="], - "@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.10", "", { "os": "openbsd", "cpu": "x64" }, "sha512-XkA4frq1TLj4bEMB+2HnI0+4RnjbuGZfet2gs/LNs5Hc7D89ZQBHQ0gL2ND6Lzu1+QVkjp3x1gIcPKzRNP8bXw=="], + "@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.27.3", "", { "os": "openbsd", "cpu": "x64" }, "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ=="], - "@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.25.10", "", { "os": "none", "cpu": "arm64" }, "sha512-AVTSBhTX8Y/Fz6OmIVBip9tJzZEUcY8WLh7I59+upa5/GPhh2/aM6bvOMQySspnCCHvFi79kMtdJS1w0DXAeag=="], + "@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.27.3", "", { "os": "none", "cpu": "arm64" }, "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g=="], - "@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.10", "", { "os": "sunos", "cpu": "x64" }, "sha512-fswk3XT0Uf2pGJmOpDB7yknqhVkJQkAQOcW/ccVOtfx05LkbWOaRAtn5SaqXypeKQra1QaEa841PgrSL9ubSPQ=="], + "@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.27.3", "", { "os": "sunos", "cpu": "x64" }, "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA=="], - "@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.10", "", { "os": "win32", "cpu": "arm64" }, "sha512-ah+9b59KDTSfpaCg6VdJoOQvKjI33nTaQr4UluQwW7aEwZQsbMCfTmfEO4VyewOxx4RaDT/xCy9ra2GPWmO7Kw=="], + "@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.27.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA=="], - "@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.10", "", { "os": "win32", "cpu": "ia32" }, "sha512-QHPDbKkrGO8/cz9LKVnJU22HOi4pxZnZhhA2HYHez5Pz4JeffhDjf85E57Oyco163GnzNCVkZK0b/n4Y0UHcSw=="], + "@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.27.3", "", { "os": "win32", "cpu": "ia32" }, "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q=="], - "@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.10", "", { "os": "win32", "cpu": "x64" }, "sha512-9KpxSVFCu0iK1owoez6aC/s/EdUQLDN3adTxGCqxMVhrPDj6bt5dbrHDXUuq+Bs2vATFBBrQS5vdQ/Ed2P+nbw=="], + "@esbuild/win32-x64": ["@esbuild/win32-x64@0.27.3", "", { "os": "win32", "cpu": "x64" }, "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA=="], - "@eslint-community/eslint-utils": ["@eslint-community/eslint-utils@4.9.0", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g=="], + "@eslint-community/eslint-utils": ["@eslint-community/eslint-utils@4.9.1", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ=="], - "@eslint-community/regexpp": ["@eslint-community/regexpp@4.12.1", "", {}, "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ=="], + "@eslint-community/regexpp": ["@eslint-community/regexpp@4.12.2", "", {}, "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew=="], "@eslint/config-array": ["@eslint/config-array@0.21.1", "", { "dependencies": { "@eslint/object-schema": "^2.1.7", "debug": "^4.3.1", "minimatch": "^3.1.2" } }, "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA=="], @@ -245,43 +243,43 @@ "@eslint/core": ["@eslint/core@0.17.0", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ=="], - "@eslint/eslintrc": ["@eslint/eslintrc@3.3.1", "", { "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", "espree": "^10.0.1", "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", "minimatch": "^3.1.2", "strip-json-comments": "^3.1.1" } }, "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ=="], + "@eslint/eslintrc": ["@eslint/eslintrc@3.3.4", "", { "dependencies": { "ajv": "^6.14.0", "debug": "^4.3.2", "espree": "^10.0.1", "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.1", "minimatch": "^3.1.3", "strip-json-comments": "^3.1.1" } }, "sha512-4h4MVF8pmBsncB60r0wSJiIeUKTSD4m7FmTFThG8RHlsg9ajqckLm9OraguFGZE4vVdpiI1Q4+hFnisopmG6gQ=="], - "@eslint/js": ["@eslint/js@9.39.1", "", {}, "sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw=="], + "@eslint/js": ["@eslint/js@9.39.3", "", {}, "sha512-1B1VkCq6FuUNlQvlBYb+1jDu/gV297TIs/OeiaSR9l1H27SVW55ONE1e1Vp16NqP683+xEGzxYtv4XCiDPaQiw=="], "@eslint/object-schema": ["@eslint/object-schema@2.1.7", "", {}, "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA=="], "@eslint/plugin-kit": ["@eslint/plugin-kit@0.4.1", "", { "dependencies": { "@eslint/core": "^0.17.0", "levn": "^0.4.1" } }, "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA=="], - "@floating-ui/core": ["@floating-ui/core@1.7.3", "", { "dependencies": { "@floating-ui/utils": "^0.2.10" } }, "sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w=="], + "@floating-ui/core": ["@floating-ui/core@1.7.5", "", { "dependencies": { "@floating-ui/utils": "^0.2.11" } }, "sha512-1Ih4WTWyw0+lKyFMcBHGbb5U5FtuHJuujoyyr5zTaWS5EYMeT6Jb2AuDeftsCsEuchO+mM2ij5+q9crhydzLhQ=="], - "@floating-ui/dom": ["@floating-ui/dom@1.7.4", "", { "dependencies": { "@floating-ui/core": "^1.7.3", "@floating-ui/utils": "^0.2.10" } }, "sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA=="], + "@floating-ui/dom": ["@floating-ui/dom@1.7.6", "", { "dependencies": { "@floating-ui/core": "^1.7.5", "@floating-ui/utils": "^0.2.11" } }, "sha512-9gZSAI5XM36880PPMm//9dfiEngYoC6Am2izES1FF406YFsjvyBMmeJ2g4SAju3xWwtuynNRFL2s9hgxpLI5SQ=="], - "@floating-ui/utils": ["@floating-ui/utils@0.2.10", "", {}, "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ=="], + "@floating-ui/utils": ["@floating-ui/utils@0.2.11", "", {}, "sha512-RiB/yIh78pcIxl6lLMG0CgBXAZ2Y0eVHqMPYugu+9U0AeT6YBeiJpf7lbdJNIugFP5SIjwNRgo4DhR1Qxi26Gg=="], - "@floating-ui/vue": ["@floating-ui/vue@1.1.9", "", { "dependencies": { "@floating-ui/dom": "^1.7.4", "@floating-ui/utils": "^0.2.10", "vue-demi": ">=0.13.0" } }, "sha512-BfNqNW6KA83Nexspgb9DZuz578R7HT8MZw1CfK9I6Ah4QReNWEJsXWHN+SdmOVLNGmTPDi+fDT535Df5PzMLbQ=="], + "@floating-ui/vue": ["@floating-ui/vue@1.1.11", "", { "dependencies": { "@floating-ui/dom": "^1.7.6", "@floating-ui/utils": "^0.2.11", "vue-demi": ">=0.13.0" } }, "sha512-HzHKCNVxnGS35r9fCHBc3+uCnjw9IWIlCPL683cGgM9Kgj2BiAl8x1mS7vtvP6F9S/e/q4O6MApwSHj8hNLGfw=="], - "@fortawesome/fontawesome-common-types": ["@fortawesome/fontawesome-common-types@7.1.0", "", {}, "sha512-l/BQM7fYntsCI//du+6sEnHOP6a74UixFyOYUyz2DLMXKx+6DEhfR3F2NYGE45XH1JJuIamacb4IZs9S0ZOWLA=="], + "@fortawesome/fontawesome-common-types": ["@fortawesome/fontawesome-common-types@7.2.0", "", {}, "sha512-IpR0bER9FY25p+e7BmFH25MZKEwFHTfRAfhOyJubgiDnoJNsSvJ7nigLraHtp4VOG/cy8D7uiV0dLkHOne5Fhw=="], - "@fortawesome/fontawesome-svg-core": ["@fortawesome/fontawesome-svg-core@7.1.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.1.0" } }, "sha512-fNxRUk1KhjSbnbuBxlWSnBLKLBNun52ZBTcs22H/xEEzM6Ap81ZFTQ4bZBxVQGQgVY0xugKGoRcCbaKjLQ3XZA=="], + "@fortawesome/fontawesome-svg-core": ["@fortawesome/fontawesome-svg-core@7.2.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.2.0" } }, "sha512-6639htZMjEkwskf3J+e6/iar+4cTNM9qhoWuRfj9F3eJD6r7iCzV1SWnQr2Mdv0QT0suuqU8BoJCZUyCtP9R4Q=="], - "@fortawesome/free-brands-svg-icons": ["@fortawesome/free-brands-svg-icons@7.1.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.1.0" } }, "sha512-9byUd9bgNfthsZAjBl6GxOu1VPHgBuRUP9juI7ZoM98h8xNPTCTagfwUFyYscdZq4Hr7gD1azMfM9s5tIWKZZA=="], + "@fortawesome/free-brands-svg-icons": ["@fortawesome/free-brands-svg-icons@7.2.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.2.0" } }, "sha512-VNG8xqOip1JuJcC3zsVsKRQ60oXG9+oYNDCosjoU/H9pgYmLTEwWw8pE0jhPz/JWdHeUuK6+NQ3qsM4gIbdbYQ=="], - "@fortawesome/free-regular-svg-icons": ["@fortawesome/free-regular-svg-icons@7.1.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.1.0" } }, "sha512-0e2fdEyB4AR+e6kU4yxwA/MonnYcw/CsMEP9lH82ORFi9svA6/RhDyhxIv5mlJaldmaHLLYVTb+3iEr+PDSZuQ=="], + "@fortawesome/free-regular-svg-icons": ["@fortawesome/free-regular-svg-icons@7.2.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.2.0" } }, "sha512-iycmlN51EULlQ4D/UU9WZnHiN0CvjJ2TuuCrAh+1MVdzD+4ViKYH2deNAll4XAAYlZa8WAefHR5taSK8hYmSMw=="], - "@fortawesome/free-solid-svg-icons": ["@fortawesome/free-solid-svg-icons@7.1.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.1.0" } }, "sha512-Udu3K7SzAo9N013qt7qmm22/wo2hADdheXtBfxFTecp+ogsc0caQNRKEb7pkvvagUGOpG9wJC1ViH6WXs8oXIA=="], + "@fortawesome/free-solid-svg-icons": ["@fortawesome/free-solid-svg-icons@7.2.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.2.0" } }, "sha512-YTVITFGN0/24PxzXrwqCgnyd7njDuzp5ZvaCx5nq/jg55kUYd94Nj8UTchBdBofi/L0nwRfjGOg0E41d2u9T1w=="], - "@fortawesome/vue-fontawesome": ["@fortawesome/vue-fontawesome@3.1.2", "", { "peerDependencies": { "@fortawesome/fontawesome-svg-core": "~1 || ~6 || ~7", "vue": ">= 3.0.0 < 4" } }, "sha512-mhYnBIuuW8OIMHf31kOjaBmyE7BMrwBorhrOHVud6vTTu+7IPQNWB+DWaHoE75v10dRF5s/dFtcrgE7vKSEWwQ=="], + "@fortawesome/vue-fontawesome": ["@fortawesome/vue-fontawesome@3.1.3", "", { "peerDependencies": { "@fortawesome/fontawesome-svg-core": "~1 || ~6 || ~7", "vue": ">= 3.0.0 < 4" } }, "sha512-OHHUTLPEzdwP8kcYIzhioUdUOjZ4zzmi+midwa4bqscza4OJCOvTKJEHkXNz8PgZ23kWci1HkKVX0bm8f9t9gQ=="], "@humanfs/core": ["@humanfs/core@0.19.1", "", {}, "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA=="], - "@humanfs/node": ["@humanfs/node@0.16.6", "", { "dependencies": { "@humanfs/core": "^0.19.1", "@humanwhocodes/retry": "^0.3.0" } }, "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw=="], + "@humanfs/node": ["@humanfs/node@0.16.7", "", { "dependencies": { "@humanfs/core": "^0.19.1", "@humanwhocodes/retry": "^0.4.0" } }, "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ=="], "@humanwhocodes/module-importer": ["@humanwhocodes/module-importer@1.0.1", "", {}, "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA=="], "@humanwhocodes/retry": ["@humanwhocodes/retry@0.4.3", "", {}, "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ=="], - "@img/colour": ["@img/colour@1.0.0", "", {}, "sha512-A5P/LfWGFSl6nsckYtjw9da+19jB8hkJ6ACTGcDfEJ0aE+l2n2El7dsVM7UVHZQ9s2lmYMWlrS21YLy2IR1LUw=="], + "@img/colour": ["@img/colour@1.1.0", "", {}, "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ=="], "@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.2.4" }, "os": "darwin", "cpu": "arm64" }, "sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w=="], @@ -331,27 +329,25 @@ "@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.34.5", "", { "os": "win32", "cpu": "x64" }, "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw=="], - "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.12", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg=="], + "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="], "@jridgewell/remapping": ["@jridgewell/remapping@2.3.5", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ=="], "@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="], - "@jridgewell/source-map": ["@jridgewell/source-map@0.3.10", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25" } }, "sha512-0pPkgz9dY+bijgistcTTJ5mR+ocqRXLuhXHYdzoMmmoJ2C9S46RCm2GMUbatPEUK9Yjy26IrAy8D/M00lLkv+Q=="], - "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], - "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.29", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ=="], + "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], - "@lezer/common": ["@lezer/common@1.2.3", "", {}, "sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA=="], + "@lezer/common": ["@lezer/common@1.5.1", "", {}, "sha512-6YRVG9vBkaY7p1IVxL4s44n5nUnaNnGM2/AckNgYOnxTG2kWh1vR8BMxPseWPjRNpb5VtXnMpeYAEAADoRV1Iw=="], - "@lezer/highlight": ["@lezer/highlight@1.2.1", "", { "dependencies": { "@lezer/common": "^1.0.0" } }, "sha512-Z5duk4RN/3zuVO7Jq0pGLJ3qynpxUVsh7IbUbGj88+uV2ApSAn6kWg2au3iJb+0Zi7kKtqffIESgNcRXWZWmSA=="], + "@lezer/highlight": ["@lezer/highlight@1.2.3", "", { "dependencies": { "@lezer/common": "^1.3.0" } }, "sha512-qXdH7UqTvGfdVBINrgKhDsVTJTxactNNxLk7+UMwZhU13lMHaOBlJe9Vqp907ya56Y3+ed2tlqzys7jDkTmW0g=="], "@lezer/json": ["@lezer/json@1.0.3", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0" } }, "sha512-BP9KzdF9Y35PDpv04r0VeSTKDeox5vVr3efE7eBbx3r4s3oNLfunchejZhjArmeieBH+nVOpgIiBJpEAv8ilqQ=="], - "@lezer/lr": ["@lezer/lr@1.4.2", "", { "dependencies": { "@lezer/common": "^1.0.0" } }, "sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA=="], + "@lezer/lr": ["@lezer/lr@1.4.8", "", { "dependencies": { "@lezer/common": "^1.0.0" } }, "sha512-bPWa0Pgx69ylNlMlPvBPryqeLYQjyJjqPx+Aupm5zydLIF3NE+6MMLT8Yi23Bd9cif9VS00aUebn+6fDIGBcDA=="], - "@lezer/yaml": ["@lezer/yaml@1.0.3", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.4.0" } }, "sha512-GuBLekbw9jDBDhGur82nuwkxKQ+a3W5H0GfaAthDXcAu+XdpS43VlnxA9E9hllkpSP5ellRDKjLLj7Lu9Wr6xA=="], + "@lezer/yaml": ["@lezer/yaml@1.0.4", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.4.0" } }, "sha512-2lrrHqxalACEbxIbsjhqGpSW8kWpUKuY6RHgnSAFZa6qK62wvnPxA8hGOwOoDbwHcOFs5M4o27mjGu+P7TvBmw=="], "@marijn/find-cluster-break": ["@marijn/find-cluster-break@1.0.2", "", {}, "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g=="], @@ -361,35 +357,35 @@ "@nodelib/fs.walk": ["@nodelib/fs.walk@1.2.8", "", { "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg=="], - "@parcel/watcher": ["@parcel/watcher@2.5.1", "", { "dependencies": { "detect-libc": "^1.0.3", "is-glob": "^4.0.3", "micromatch": "^4.0.5", "node-addon-api": "^7.0.0" }, "optionalDependencies": { "@parcel/watcher-android-arm64": "2.5.1", "@parcel/watcher-darwin-arm64": "2.5.1", "@parcel/watcher-darwin-x64": "2.5.1", "@parcel/watcher-freebsd-x64": "2.5.1", "@parcel/watcher-linux-arm-glibc": "2.5.1", "@parcel/watcher-linux-arm-musl": "2.5.1", "@parcel/watcher-linux-arm64-glibc": "2.5.1", "@parcel/watcher-linux-arm64-musl": "2.5.1", "@parcel/watcher-linux-x64-glibc": "2.5.1", "@parcel/watcher-linux-x64-musl": "2.5.1", "@parcel/watcher-win32-arm64": "2.5.1", "@parcel/watcher-win32-ia32": "2.5.1", "@parcel/watcher-win32-x64": "2.5.1" } }, "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg=="], + "@parcel/watcher": ["@parcel/watcher@2.5.6", "", { "dependencies": { "detect-libc": "^2.0.3", "is-glob": "^4.0.3", "node-addon-api": "^7.0.0", "picomatch": "^4.0.3" }, "optionalDependencies": { "@parcel/watcher-android-arm64": "2.5.6", "@parcel/watcher-darwin-arm64": "2.5.6", "@parcel/watcher-darwin-x64": "2.5.6", "@parcel/watcher-freebsd-x64": "2.5.6", "@parcel/watcher-linux-arm-glibc": "2.5.6", "@parcel/watcher-linux-arm-musl": "2.5.6", "@parcel/watcher-linux-arm64-glibc": "2.5.6", "@parcel/watcher-linux-arm64-musl": "2.5.6", "@parcel/watcher-linux-x64-glibc": "2.5.6", "@parcel/watcher-linux-x64-musl": "2.5.6", "@parcel/watcher-win32-arm64": "2.5.6", "@parcel/watcher-win32-ia32": "2.5.6", "@parcel/watcher-win32-x64": "2.5.6" } }, "sha512-tmmZ3lQxAe/k/+rNnXQRawJ4NjxO2hqiOLTHvWchtGZULp4RyFeh6aU4XdOYBFe2KE1oShQTv4AblOs2iOrNnQ=="], - "@parcel/watcher-android-arm64": ["@parcel/watcher-android-arm64@2.5.1", "", { "os": "android", "cpu": "arm64" }, "sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA=="], + "@parcel/watcher-android-arm64": ["@parcel/watcher-android-arm64@2.5.6", "", { "os": "android", "cpu": "arm64" }, "sha512-YQxSS34tPF/6ZG7r/Ih9xy+kP/WwediEUsqmtf0cuCV5TPPKw/PQHRhueUo6JdeFJaqV3pyjm0GdYjZotbRt/A=="], - "@parcel/watcher-darwin-arm64": ["@parcel/watcher-darwin-arm64@2.5.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw=="], + "@parcel/watcher-darwin-arm64": ["@parcel/watcher-darwin-arm64@2.5.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Z2ZdrnwyXvvvdtRHLmM4knydIdU9adO3D4n/0cVipF3rRiwP+3/sfzpAwA/qKFL6i1ModaabkU7IbpeMBgiVEA=="], - "@parcel/watcher-darwin-x64": ["@parcel/watcher-darwin-x64@2.5.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-1ZXDthrnNmwv10A0/3AJNZ9JGlzrF82i3gNQcWOzd7nJ8aj+ILyW1MTxVk35Db0u91oD5Nlk9MBiujMlwmeXZg=="], + "@parcel/watcher-darwin-x64": ["@parcel/watcher-darwin-x64@2.5.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-HgvOf3W9dhithcwOWX9uDZyn1lW9R+7tPZ4sug+NGrGIo4Rk1hAXLEbcH1TQSqxts0NYXXlOWqVpvS1SFS4fRg=="], - "@parcel/watcher-freebsd-x64": ["@parcel/watcher-freebsd-x64@2.5.1", "", { "os": "freebsd", "cpu": "x64" }, "sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ=="], + "@parcel/watcher-freebsd-x64": ["@parcel/watcher-freebsd-x64@2.5.6", "", { "os": "freebsd", "cpu": "x64" }, "sha512-vJVi8yd/qzJxEKHkeemh7w3YAn6RJCtYlE4HPMoVnCpIXEzSrxErBW5SJBgKLbXU3WdIpkjBTeUNtyBVn8TRng=="], - "@parcel/watcher-linux-arm-glibc": ["@parcel/watcher-linux-arm-glibc@2.5.1", "", { "os": "linux", "cpu": "arm" }, "sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA=="], + "@parcel/watcher-linux-arm-glibc": ["@parcel/watcher-linux-arm-glibc@2.5.6", "", { "os": "linux", "cpu": "arm" }, "sha512-9JiYfB6h6BgV50CCfasfLf/uvOcJskMSwcdH1PHH9rvS1IrNy8zad6IUVPVUfmXr+u+Km9IxcfMLzgdOudz9EQ=="], - "@parcel/watcher-linux-arm-musl": ["@parcel/watcher-linux-arm-musl@2.5.1", "", { "os": "linux", "cpu": "arm" }, "sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q=="], + "@parcel/watcher-linux-arm-musl": ["@parcel/watcher-linux-arm-musl@2.5.6", "", { "os": "linux", "cpu": "arm" }, "sha512-Ve3gUCG57nuUUSyjBq/MAM0CzArtuIOxsBdQ+ftz6ho8n7s1i9E1Nmk/xmP323r2YL0SONs1EuwqBp2u1k5fxg=="], - "@parcel/watcher-linux-arm64-glibc": ["@parcel/watcher-linux-arm64-glibc@2.5.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w=="], + "@parcel/watcher-linux-arm64-glibc": ["@parcel/watcher-linux-arm64-glibc@2.5.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-f2g/DT3NhGPdBmMWYoxixqYr3v/UXcmLOYy16Bx0TM20Tchduwr4EaCbmxh1321TABqPGDpS8D/ggOTaljijOA=="], - "@parcel/watcher-linux-arm64-musl": ["@parcel/watcher-linux-arm64-musl@2.5.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg=="], + "@parcel/watcher-linux-arm64-musl": ["@parcel/watcher-linux-arm64-musl@2.5.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-qb6naMDGlbCwdhLj6hgoVKJl2odL34z2sqkC7Z6kzir8b5W65WYDpLB6R06KabvZdgoHI/zxke4b3zR0wAbDTA=="], - "@parcel/watcher-linux-x64-glibc": ["@parcel/watcher-linux-x64-glibc@2.5.1", "", { "os": "linux", "cpu": "x64" }, "sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A=="], + "@parcel/watcher-linux-x64-glibc": ["@parcel/watcher-linux-x64-glibc@2.5.6", "", { "os": "linux", "cpu": "x64" }, "sha512-kbT5wvNQlx7NaGjzPFu8nVIW1rWqV780O7ZtkjuWaPUgpv2NMFpjYERVi0UYj1msZNyCzGlaCWEtzc+exjMGbQ=="], - "@parcel/watcher-linux-x64-musl": ["@parcel/watcher-linux-x64-musl@2.5.1", "", { "os": "linux", "cpu": "x64" }, "sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg=="], + "@parcel/watcher-linux-x64-musl": ["@parcel/watcher-linux-x64-musl@2.5.6", "", { "os": "linux", "cpu": "x64" }, "sha512-1JRFeC+h7RdXwldHzTsmdtYR/Ku8SylLgTU/reMuqdVD7CtLwf0VR1FqeprZ0eHQkO0vqsbvFLXUmYm/uNKJBg=="], - "@parcel/watcher-win32-arm64": ["@parcel/watcher-win32-arm64@2.5.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw=="], + "@parcel/watcher-win32-arm64": ["@parcel/watcher-win32-arm64@2.5.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-3ukyebjc6eGlw9yRt678DxVF7rjXatWiHvTXqphZLvo7aC5NdEgFufVwjFfY51ijYEWpXbqF5jtrK275z52D4Q=="], - "@parcel/watcher-win32-ia32": ["@parcel/watcher-win32-ia32@2.5.1", "", { "os": "win32", "cpu": "ia32" }, "sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ=="], + "@parcel/watcher-win32-ia32": ["@parcel/watcher-win32-ia32@2.5.6", "", { "os": "win32", "cpu": "ia32" }, "sha512-k35yLp1ZMwwee3Ez/pxBi5cf4AoBKYXj00CZ80jUz5h8prpiaQsiRPKQMxoLstNuqe2vR4RNPEAEcjEFzhEz/g=="], - "@parcel/watcher-win32-x64": ["@parcel/watcher-win32-x64@2.5.1", "", { "os": "win32", "cpu": "x64" }, "sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA=="], + "@parcel/watcher-win32-x64": ["@parcel/watcher-win32-x64@2.5.6", "", { "os": "win32", "cpu": "x64" }, "sha512-hbQlYcCq5dlAX9Qx+kFb0FHue6vbjlf0FrNzSKdYK2APUf7tGfGxQCk2ihEREmbR6ZMc0MVAD5RIX/41gpUzTw=="], - "@pkgr/core": ["@pkgr/core@0.2.7", "", {}, "sha512-YLT9Zo3oNPJoBjBc4q8G2mjU4tqIbf5CEOORbUUr48dCD9q3umJ3IPlVqOqDakPfd2HuwccBaqlGhN4Gmr5OWg=="], + "@pkgr/core": ["@pkgr/core@0.2.9", "", {}, "sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA=="], "@polka/url": ["@polka/url@1.0.0-next.29", "", {}, "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww=="], @@ -399,47 +395,57 @@ "@replit/codemirror-vim": ["@replit/codemirror-vim@6.3.0", "", { "peerDependencies": { "@codemirror/commands": "6.x.x", "@codemirror/language": "6.x.x", "@codemirror/search": "6.x.x", "@codemirror/state": "6.x.x", "@codemirror/view": "6.x.x" } }, "sha512-aTx931ULAMuJx6xLf7KQDOL7CxD+Sa05FktTDrtLaSy53uj01ll3Zf17JdKsriER248oS55GBzg0CfCTjEneAQ=="], - "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-beta.50", "", {}, "sha512-5e76wQiQVeL1ICOZVUg4LSOVYg9jyhGCin+icYozhsUzM+fHE7kddi1bdiE0jwVqTfkjba3jUFbEkoC9WkdvyA=="], + "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-rc.2", "", {}, "sha512-izyXV/v+cHiRfozX62W9htOAvwMo4/bXKDrQ+vom1L1qRuexPock/7VZDAhnpHCLNejd3NJ6hiab+tO0D44Rgw=="], + + "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.59.0", "", { "os": "android", "cpu": "arm" }, "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg=="], + + "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.59.0", "", { "os": "android", "cpu": "arm64" }, "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q=="], + + "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.59.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg=="], + + "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.59.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w=="], - "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.44.2", "", { "os": "android", "cpu": "arm" }, "sha512-g0dF8P1e2QYPOj1gu7s/3LVP6kze9A7m6x0BZ9iTdXK8N5c2V7cpBKHV3/9A4Zd8xxavdhK0t4PnqjkqVmUc9Q=="], + "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.59.0", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA=="], - "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.44.2", "", { "os": "android", "cpu": "arm64" }, "sha512-Yt5MKrOosSbSaAK5Y4J+vSiID57sOvpBNBR6K7xAaQvk3MkcNVV0f9fE20T+41WYN8hDn6SGFlFrKudtx4EoxA=="], + "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.59.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg=="], - "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.44.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-EsnFot9ZieM35YNA26nhbLTJBHD0jTwWpPwmRVDzjylQT6gkar+zenfb8mHxWpRrbn+WytRRjE0WKsfaxBkVUA=="], + "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.59.0", "", { "os": "linux", "cpu": "arm" }, "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw=="], - "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.44.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-dv/t1t1RkCvJdWWxQ2lWOO+b7cMsVw5YFaS04oHpZRWehI1h0fV1gF4wgGCTyQHHjJDfbNpwOi6PXEafRBBezw=="], + "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.59.0", "", { "os": "linux", "cpu": "arm" }, "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA=="], - "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.44.2", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-W4tt4BLorKND4qeHElxDoim0+BsprFTwb+vriVQnFFtT/P6v/xO5I99xvYnVzKWrK6j7Hb0yp3x7V5LUbaeOMg=="], + "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.59.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA=="], - "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.44.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-tdT1PHopokkuBVyHjvYehnIe20fxibxFCEhQP/96MDSOcyjM/shlTkZZLOufV3qO6/FQOSiJTBebhVc12JyPTA=="], + "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.59.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA=="], - "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.44.2", "", { "os": "linux", "cpu": "arm" }, "sha512-+xmiDGGaSfIIOXMzkhJ++Oa0Gwvl9oXUeIiwarsdRXSe27HUIvjbSIpPxvnNsRebsNdUo7uAiQVgBD1hVriwSQ=="], + "@rollup/rollup-linux-loong64-gnu": ["@rollup/rollup-linux-loong64-gnu@4.59.0", "", { "os": "linux", "cpu": "none" }, "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg=="], - "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.44.2", "", { "os": "linux", "cpu": "arm" }, "sha512-bDHvhzOfORk3wt8yxIra8N4k/N0MnKInCW5OGZaeDYa/hMrdPaJzo7CSkjKZqX4JFUWjUGm88lI6QJLCM7lDrA=="], + "@rollup/rollup-linux-loong64-musl": ["@rollup/rollup-linux-loong64-musl@4.59.0", "", { "os": "linux", "cpu": "none" }, "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q=="], - "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.44.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-NMsDEsDiYghTbeZWEGnNi4F0hSbGnsuOG+VnNvxkKg0IGDvFh7UVpM/14mnMwxRxUf9AdAVJgHPvKXf6FpMB7A=="], + "@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.59.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA=="], - "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.44.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-lb5bxXnxXglVq+7imxykIp5xMq+idehfl+wOgiiix0191av84OqbjUED+PRC5OA8eFJYj5xAGcpAZ0pF2MnW+A=="], + "@rollup/rollup-linux-ppc64-musl": ["@rollup/rollup-linux-ppc64-musl@4.59.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA=="], - "@rollup/rollup-linux-loongarch64-gnu": ["@rollup/rollup-linux-loongarch64-gnu@4.44.2", "", { "os": "linux", "cpu": "none" }, "sha512-Yl5Rdpf9pIc4GW1PmkUGHdMtbx0fBLE1//SxDmuf3X0dUC57+zMepow2LK0V21661cjXdTn8hO2tXDdAWAqE5g=="], + "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.59.0", "", { "os": "linux", "cpu": "none" }, "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg=="], - "@rollup/rollup-linux-powerpc64le-gnu": ["@rollup/rollup-linux-powerpc64le-gnu@4.44.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-03vUDH+w55s680YYryyr78jsO1RWU9ocRMaeV2vMniJJW/6HhoTBwyyiiTPVHNWLnhsnwcQ0oH3S9JSBEKuyqw=="], + "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.59.0", "", { "os": "linux", "cpu": "none" }, "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg=="], - "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.44.2", "", { "os": "linux", "cpu": "none" }, "sha512-iYtAqBg5eEMG4dEfVlkqo05xMOk6y/JXIToRca2bAWuqjrJYJlx/I7+Z+4hSrsWU8GdJDFPL4ktV3dy4yBSrzg=="], + "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.59.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w=="], - "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.44.2", "", { "os": "linux", "cpu": "none" }, "sha512-e6vEbgaaqz2yEHqtkPXa28fFuBGmUJ0N2dOJK8YUfijejInt9gfCSA7YDdJ4nYlv67JfP3+PSWFX4IVw/xRIPg=="], + "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.59.0", "", { "os": "linux", "cpu": "x64" }, "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg=="], - "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.44.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-evFOtkmVdY3udE+0QKrV5wBx7bKI0iHz5yEVx5WqDJkxp9YQefy4Mpx3RajIVcM6o7jxTvVd/qpC1IXUhGc1Mw=="], + "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.59.0", "", { "os": "linux", "cpu": "x64" }, "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg=="], - "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.44.2", "", { "os": "linux", "cpu": "x64" }, "sha512-/bXb0bEsWMyEkIsUL2Yt5nFB5naLAwyOWMEviQfQY1x3l5WsLKgvZf66TM7UTfED6erckUVUJQ/jJ1FSpm3pRQ=="], + "@rollup/rollup-openbsd-x64": ["@rollup/rollup-openbsd-x64@4.59.0", "", { "os": "openbsd", "cpu": "x64" }, "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ=="], - "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.44.2", "", { "os": "linux", "cpu": "x64" }, "sha512-3D3OB1vSSBXmkGEZR27uiMRNiwN08/RVAcBKwhUYPaiZ8bcvdeEwWPvbnXvvXHY+A/7xluzcN+kaiOFNiOZwWg=="], + "@rollup/rollup-openharmony-arm64": ["@rollup/rollup-openharmony-arm64@4.59.0", "", { "os": "none", "cpu": "arm64" }, "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA=="], - "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.44.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-VfU0fsMK+rwdK8mwODqYeM2hDrF2WiHaSmCBrS7gColkQft95/8tphyzv2EupVxn3iE0FI78wzffoULH1G+dkw=="], + "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.59.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A=="], - "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.44.2", "", { "os": "win32", "cpu": "ia32" }, "sha512-+qMUrkbUurpE6DVRjiJCNGZBGo9xM4Y0FXU5cjgudWqIBWbcLkjE3XprJUsOFgC6xjBClwVa9k6O3A7K3vxb5Q=="], + "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.59.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA=="], - "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.44.2", "", { "os": "win32", "cpu": "x64" }, "sha512-3+QZROYfJ25PDcxFF66UEk8jGWigHJeecZILvkPkyQN7oc5BvFo4YEXFkOs154j3FTMp9mn9Ky8RCOwastduEA=="], + "@rollup/rollup-win32-x64-gnu": ["@rollup/rollup-win32-x64-gnu@4.59.0", "", { "os": "win32", "cpu": "x64" }, "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA=="], + + "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.59.0", "", { "os": "win32", "cpu": "x64" }, "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA=="], "@sagold/json-pointer": ["@sagold/json-pointer@5.1.2", "", {}, "sha512-+wAhJZBXa6MNxRScg6tkqEbChEHMgVZAhTHVJ60Y7sbtXtu9XA49KfUkdWlS2x78D6H9nryiKePiYozumauPfA=="], @@ -477,7 +483,7 @@ "@types/mdast": ["@types/mdast@4.0.4", "", { "dependencies": { "@types/unist": "*" } }, "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA=="], - "@types/node": ["@types/node@24.10.1", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ=="], + "@types/node": ["@types/node@24.11.0", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-fPxQqz4VTgPI/IQ+lj9r0h+fDR66bzoeMGHp8ASee+32OSGIkeASsoZuJixsQoVef1QJbeubcPBxKk22QVoWdw=="], "@types/unist": ["@types/unist@3.0.3", "", {}, "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="], @@ -487,83 +493,83 @@ "@types/yargs-parser": ["@types/yargs-parser@21.0.3", "", {}, "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ=="], - "@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.36.0", "", { "dependencies": { "@eslint-community/regexpp": "^4.10.0", "@typescript-eslint/scope-manager": "8.36.0", "@typescript-eslint/type-utils": "8.36.0", "@typescript-eslint/utils": "8.36.0", "@typescript-eslint/visitor-keys": "8.36.0", "graphemer": "^1.4.0", "ignore": "^7.0.0", "natural-compare": "^1.4.0", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.36.0", "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-lZNihHUVB6ZZiPBNgOQGSxUASI7UJWhT8nHyUGCnaQ28XFCw98IfrMCG3rUl1uwUWoAvodJQby2KTs79UTcrAg=="], + "@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.56.1", "", { "dependencies": { "@eslint-community/regexpp": "^4.12.2", "@typescript-eslint/scope-manager": "8.56.1", "@typescript-eslint/type-utils": "8.56.1", "@typescript-eslint/utils": "8.56.1", "@typescript-eslint/visitor-keys": "8.56.1", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.56.1", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-Jz9ZztpB37dNC+HU2HI28Bs9QXpzCz+y/twHOwhyrIRdbuVDxSytJNDl6z/aAKlaRIwC7y8wJdkBv7FxYGgi0A=="], - "@typescript-eslint/parser": ["@typescript-eslint/parser@8.36.0", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.36.0", "@typescript-eslint/types": "8.36.0", "@typescript-eslint/typescript-estree": "8.36.0", "@typescript-eslint/visitor-keys": "8.36.0", "debug": "^4.3.4" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-FuYgkHwZLuPbZjQHzJXrtXreJdFMKl16BFYyRrLxDhWr6Qr7Kbcu2s1Yhu8tsiMXw1S0W1pjfFfYEt+R604s+Q=="], + "@typescript-eslint/parser": ["@typescript-eslint/parser@8.56.1", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.56.1", "@typescript-eslint/types": "8.56.1", "@typescript-eslint/typescript-estree": "8.56.1", "@typescript-eslint/visitor-keys": "8.56.1", "debug": "^4.4.3" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg=="], - "@typescript-eslint/project-service": ["@typescript-eslint/project-service@8.36.0", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.36.0", "@typescript-eslint/types": "^8.36.0", "debug": "^4.3.4" }, "peerDependencies": { "typescript": ">=4.8.4 <5.9.0" } }, "sha512-JAhQFIABkWccQYeLMrHadu/fhpzmSQ1F1KXkpzqiVxA/iYI6UnRt2trqXHt1sYEcw1mxLnB9rKMsOxXPxowN/g=="], + "@typescript-eslint/project-service": ["@typescript-eslint/project-service@8.56.1", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.56.1", "@typescript-eslint/types": "^8.56.1", "debug": "^4.4.3" }, "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-TAdqQTzHNNvlVFfR+hu2PDJrURiwKsUvxFn1M0h95BB8ah5jejas08jUWG4dBA68jDMI988IvtfdAI53JzEHOQ=="], - "@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.36.0", "", { "dependencies": { "@typescript-eslint/types": "8.36.0", "@typescript-eslint/visitor-keys": "8.36.0" } }, "sha512-wCnapIKnDkN62fYtTGv2+RY8FlnBYA3tNm0fm91kc2BjPhV2vIjwwozJ7LToaLAyb1ca8BxrS7vT+Pvvf7RvqA=="], + "@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.56.1", "", { "dependencies": { "@typescript-eslint/types": "8.56.1", "@typescript-eslint/visitor-keys": "8.56.1" } }, "sha512-YAi4VDKcIZp0O4tz/haYKhmIDZFEUPOreKbfdAN3SzUDMcPhJ8QI99xQXqX+HoUVq8cs85eRKnD+rne2UAnj2w=="], - "@typescript-eslint/tsconfig-utils": ["@typescript-eslint/tsconfig-utils@8.36.0", "", { "peerDependencies": { "typescript": ">=4.8.4 <5.9.0" } }, "sha512-Nhh3TIEgN18mNbdXpd5Q8mSCBnrZQeY9V7Ca3dqYvNDStNIGRmJA6dmrIPMJ0kow3C7gcQbpsG2rPzy1Ks/AnA=="], + "@typescript-eslint/tsconfig-utils": ["@typescript-eslint/tsconfig-utils@8.56.1", "", { "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-qOtCYzKEeyr3aR9f28mPJqBty7+DBqsdd63eO0yyDwc6vgThj2UjWfJIcsFeSucYydqcuudMOprZ+x1SpF3ZuQ=="], - "@typescript-eslint/type-utils": ["@typescript-eslint/type-utils@8.36.0", "", { "dependencies": { "@typescript-eslint/typescript-estree": "8.36.0", "@typescript-eslint/utils": "8.36.0", "debug": "^4.3.4", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-5aaGYG8cVDd6cxfk/ynpYzxBRZJk7w/ymto6uiyUFtdCozQIsQWh7M28/6r57Fwkbweng8qAzoMCPwSJfWlmsg=="], + "@typescript-eslint/type-utils": ["@typescript-eslint/type-utils@8.56.1", "", { "dependencies": { "@typescript-eslint/types": "8.56.1", "@typescript-eslint/typescript-estree": "8.56.1", "@typescript-eslint/utils": "8.56.1", "debug": "^4.4.3", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-yB/7dxi7MgTtGhZdaHCemf7PuwrHMenHjmzgUW1aJpO+bBU43OycnM3Wn+DdvDO/8zzA9HlhaJ0AUGuvri4oGg=="], - "@typescript-eslint/types": ["@typescript-eslint/types@8.36.0", "", {}, "sha512-xGms6l5cTJKQPZOKM75Dl9yBfNdGeLRsIyufewnxT4vZTrjC0ImQT4fj8QmtJK84F58uSh5HVBSANwcfiXxABQ=="], + "@typescript-eslint/types": ["@typescript-eslint/types@8.56.1", "", {}, "sha512-dbMkdIUkIkchgGDIv7KLUpa0Mda4IYjo4IAMJUZ+3xNoUXxMsk9YtKpTHSChRS85o+H9ftm51gsK1dZReY9CVw=="], - "@typescript-eslint/typescript-estree": ["@typescript-eslint/typescript-estree@8.36.0", "", { "dependencies": { "@typescript-eslint/project-service": "8.36.0", "@typescript-eslint/tsconfig-utils": "8.36.0", "@typescript-eslint/types": "8.36.0", "@typescript-eslint/visitor-keys": "8.36.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "typescript": ">=4.8.4 <5.9.0" } }, "sha512-JaS8bDVrfVJX4av0jLpe4ye0BpAaUW7+tnS4Y4ETa3q7NoZgzYbN9zDQTJ8kPb5fQ4n0hliAt9tA4Pfs2zA2Hg=="], + "@typescript-eslint/typescript-estree": ["@typescript-eslint/typescript-estree@8.56.1", "", { "dependencies": { "@typescript-eslint/project-service": "8.56.1", "@typescript-eslint/tsconfig-utils": "8.56.1", "@typescript-eslint/types": "8.56.1", "@typescript-eslint/visitor-keys": "8.56.1", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", "tinyglobby": "^0.2.15", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-qzUL1qgalIvKWAf9C1HpvBjif+Vm6rcT5wZd4VoMb9+Km3iS3Cv9DY6dMRMDtPnwRAFyAi7YXJpTIEXLvdfPxg=="], - "@typescript-eslint/utils": ["@typescript-eslint/utils@8.36.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.7.0", "@typescript-eslint/scope-manager": "8.36.0", "@typescript-eslint/types": "8.36.0", "@typescript-eslint/typescript-estree": "8.36.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-VOqmHu42aEMT+P2qYjylw6zP/3E/HvptRwdn/PZxyV27KhZg2IOszXod4NcXisWzPAGSS4trE/g4moNj6XmH2g=="], + "@typescript-eslint/utils": ["@typescript-eslint/utils@8.56.1", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", "@typescript-eslint/scope-manager": "8.56.1", "@typescript-eslint/types": "8.56.1", "@typescript-eslint/typescript-estree": "8.56.1" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-HPAVNIME3tABJ61siYlHzSWCGtOoeP2RTIaHXFMPqjrQKCGB9OgUVdiNgH7TJS2JNIQ5qQ4RsAUDuGaGme/KOA=="], - "@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.36.0", "", { "dependencies": { "@typescript-eslint/types": "8.36.0", "eslint-visitor-keys": "^4.2.1" } }, "sha512-vZrhV2lRPWDuGoxcmrzRZyxAggPL+qp3WzUrlZD+slFueDiYHxeBa34dUXPuC0RmGKzl4lS5kFJYvKCq9cnNDA=="], + "@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.56.1", "", { "dependencies": { "@typescript-eslint/types": "8.56.1", "eslint-visitor-keys": "^5.0.0" } }, "sha512-KiROIzYdEV85YygXw6BI/Dx4fnBlFQu6Mq4QE4MOH9fFnhohw6wX/OAvDY2/C+ut0I3RSPKenvZJIVYqJNkhEw=="], - "@uiw/codemirror-themes": ["@uiw/codemirror-themes@4.25.3", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0" } }, "sha512-k7/B7Vf4jU/WcdewgJWP9tMFxbjB6UpUymZ3fx/TsbGwt2JXAouw0uyqCn1RlYBfr7YQnvEs3Ju9ECkd2sKzdg=="], + "@uiw/codemirror-themes": ["@uiw/codemirror-themes@4.25.7", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0" } }, "sha512-Rcx1XiQiMOJzk/efVuZioCv3VuswUb2CPmiM1NIXY5N4vEMmWLY3N8T4/WkPzJ8ZZuk7o3OH2VI5bj7729fDYg=="], "@ungap/structured-clone": ["@ungap/structured-clone@1.3.0", "", {}, "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g=="], - "@vitejs/plugin-vue": ["@vitejs/plugin-vue@6.0.2", "", { "dependencies": { "@rolldown/pluginutils": "1.0.0-beta.50" }, "peerDependencies": { "vite": "^5.0.0 || ^6.0.0 || ^7.0.0", "vue": "^3.2.25" } }, "sha512-iHmwV3QcVGGvSC1BG5bZ4z6iwa1SOpAPWmnjOErd4Ske+lZua5K9TtAVdx0gMBClJ28DViCbSmZitjWZsWO3LA=="], + "@vitejs/plugin-vue": ["@vitejs/plugin-vue@6.0.4", "", { "dependencies": { "@rolldown/pluginutils": "1.0.0-rc.2" }, "peerDependencies": { "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0", "vue": "^3.2.25" } }, "sha512-uM5iXipgYIn13UUQCZNdWkYk+sysBeA97d5mHsAoAt1u/wpN3+zxOmsVJWosuzX+IMGRzeYUNytztrYznboIkQ=="], - "@volar/language-core": ["@volar/language-core@2.4.23", "", { "dependencies": { "@volar/source-map": "2.4.23" } }, "sha512-hEEd5ET/oSmBC6pi1j6NaNYRWoAiDhINbT8rmwtINugR39loROSlufGdYMF9TaKGfz+ViGs1Idi3mAhnuPcoGQ=="], + "@volar/language-core": ["@volar/language-core@2.4.28", "", { "dependencies": { "@volar/source-map": "2.4.28" } }, "sha512-w4qhIJ8ZSitgLAkVay6AbcnC7gP3glYM3fYwKV3srj8m494E3xtrCv6E+bWviiK/8hs6e6t1ij1s2Endql7vzQ=="], - "@volar/source-map": ["@volar/source-map@2.4.23", "", {}, "sha512-Z1Uc8IB57Lm6k7q6KIDu/p+JWtf3xsXJqAX/5r18hYOTpJyBn0KXUR8oTJ4WFYOcDzWC9n3IflGgHowx6U6z9Q=="], + "@volar/source-map": ["@volar/source-map@2.4.28", "", {}, "sha512-yX2BDBqJkRXfKw8my8VarTyjv48QwxdJtvRgUpNE5erCsgEUdI2DsLbpa+rOQVAJYshY99szEcRDmyHbF10ggQ=="], - "@volar/typescript": ["@volar/typescript@2.4.23", "", { "dependencies": { "@volar/language-core": "2.4.23", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" } }, "sha512-lAB5zJghWxVPqfcStmAP1ZqQacMpe90UrP5RJ3arDyrhy4aCUQqmxPPLB2PWDKugvylmO41ljK7vZ+t6INMTag=="], + "@volar/typescript": ["@volar/typescript@2.4.28", "", { "dependencies": { "@volar/language-core": "2.4.28", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" } }, "sha512-Ja6yvWrbis2QtN4ClAKreeUZPVYMARDYZl9LMEv1iQ1QdepB6wn0jTRxA9MftYmYa4DQ4k/DaSZpFPUfxl8giw=="], - "@vue/babel-helper-vue-transform-on": ["@vue/babel-helper-vue-transform-on@1.4.0", "", {}, "sha512-mCokbouEQ/ocRce/FpKCRItGo+013tHg7tixg3DUNS+6bmIchPt66012kBMm476vyEIJPafrvOf4E5OYj3shSw=="], + "@vue/babel-helper-vue-transform-on": ["@vue/babel-helper-vue-transform-on@1.5.0", "", {}, "sha512-0dAYkerNhhHutHZ34JtTl2czVQHUNWv6xEbkdF5W+Yrv5pCWsqjeORdOgbtW2I9gWlt+wBmVn+ttqN9ZxR5tzA=="], - "@vue/babel-plugin-jsx": ["@vue/babel-plugin-jsx@1.4.0", "", { "dependencies": { "@babel/helper-module-imports": "^7.25.9", "@babel/helper-plugin-utils": "^7.26.5", "@babel/plugin-syntax-jsx": "^7.25.9", "@babel/template": "^7.26.9", "@babel/traverse": "^7.26.9", "@babel/types": "^7.26.9", "@vue/babel-helper-vue-transform-on": "1.4.0", "@vue/babel-plugin-resolve-type": "1.4.0", "@vue/shared": "^3.5.13" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "optionalPeers": ["@babel/core"] }, "sha512-9zAHmwgMWlaN6qRKdrg1uKsBKHvnUU+Py+MOCTuYZBoZsopa90Di10QRjB+YPnVss0BZbG/H5XFwJY1fTxJWhA=="], + "@vue/babel-plugin-jsx": ["@vue/babel-plugin-jsx@1.5.0", "", { "dependencies": { "@babel/helper-module-imports": "^7.27.1", "@babel/helper-plugin-utils": "^7.27.1", "@babel/plugin-syntax-jsx": "^7.27.1", "@babel/template": "^7.27.2", "@babel/traverse": "^7.28.0", "@babel/types": "^7.28.2", "@vue/babel-helper-vue-transform-on": "1.5.0", "@vue/babel-plugin-resolve-type": "1.5.0", "@vue/shared": "^3.5.18" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "optionalPeers": ["@babel/core"] }, "sha512-mneBhw1oOqCd2247O0Yw/mRwC9jIGACAJUlawkmMBiNmL4dGA2eMzuNZVNqOUfYTa6vqmND4CtOPzmEEEqLKFw=="], - "@vue/babel-plugin-resolve-type": ["@vue/babel-plugin-resolve-type@1.4.0", "", { "dependencies": { "@babel/code-frame": "^7.26.2", "@babel/helper-module-imports": "^7.25.9", "@babel/helper-plugin-utils": "^7.26.5", "@babel/parser": "^7.26.9", "@vue/compiler-sfc": "^3.5.13" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-4xqDRRbQQEWHQyjlYSgZsWj44KfiF6D+ktCuXyZ8EnVDYV3pztmXJDf1HveAjUAXxAnR8daCQT51RneWWxtTyQ=="], + "@vue/babel-plugin-resolve-type": ["@vue/babel-plugin-resolve-type@1.5.0", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/helper-module-imports": "^7.27.1", "@babel/helper-plugin-utils": "^7.27.1", "@babel/parser": "^7.28.0", "@vue/compiler-sfc": "^3.5.18" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-Wm/60o+53JwJODm4Knz47dxJnLDJ9FnKnGZJbUUf8nQRAtt6P+undLUAVU3Ha33LxOJe6IPoifRQ6F/0RrU31w=="], - "@vue/compiler-core": ["@vue/compiler-core@3.5.25", "", { "dependencies": { "@babel/parser": "^7.28.5", "@vue/shared": "3.5.25", "entities": "^4.5.0", "estree-walker": "^2.0.2", "source-map-js": "^1.2.1" } }, "sha512-vay5/oQJdsNHmliWoZfHPoVZZRmnSWhug0BYT34njkYTPqClh3DNWLkZNJBVSjsNMrg0CCrBfoKkjZQPM/QVUw=="], + "@vue/compiler-core": ["@vue/compiler-core@3.5.29", "", { "dependencies": { "@babel/parser": "^7.29.0", "@vue/shared": "3.5.29", "entities": "^7.0.1", "estree-walker": "^2.0.2", "source-map-js": "^1.2.1" } }, "sha512-cuzPhD8fwRHk8IGfmYaR4eEe4cAyJEL66Ove/WZL7yWNL134nqLddSLwNRIsFlnnW1kK+p8Ck3viFnC0chXCXw=="], - "@vue/compiler-dom": ["@vue/compiler-dom@3.5.25", "", { "dependencies": { "@vue/compiler-core": "3.5.25", "@vue/shared": "3.5.25" } }, "sha512-4We0OAcMZsKgYoGlMjzYvaoErltdFI2/25wqanuTu+S4gismOTRTBPi4IASOjxWdzIwrYSjnqONfKvuqkXzE2Q=="], + "@vue/compiler-dom": ["@vue/compiler-dom@3.5.29", "", { "dependencies": { "@vue/compiler-core": "3.5.29", "@vue/shared": "3.5.29" } }, "sha512-n0G5o7R3uBVmVxjTIYcz7ovr8sy7QObFG8OQJ3xGCDNhbG60biP/P5KnyY8NLd81OuT1WJflG7N4KWYHaeeaIg=="], - "@vue/compiler-sfc": ["@vue/compiler-sfc@3.5.25", "", { "dependencies": { "@babel/parser": "^7.28.5", "@vue/compiler-core": "3.5.25", "@vue/compiler-dom": "3.5.25", "@vue/compiler-ssr": "3.5.25", "@vue/shared": "3.5.25", "estree-walker": "^2.0.2", "magic-string": "^0.30.21", "postcss": "^8.5.6", "source-map-js": "^1.2.1" } }, "sha512-PUgKp2rn8fFsI++lF2sO7gwO2d9Yj57Utr5yEsDf3GNaQcowCLKL7sf+LvVFvtJDXUp/03+dC6f2+LCv5aK1ag=="], + "@vue/compiler-sfc": ["@vue/compiler-sfc@3.5.29", "", { "dependencies": { "@babel/parser": "^7.29.0", "@vue/compiler-core": "3.5.29", "@vue/compiler-dom": "3.5.29", "@vue/compiler-ssr": "3.5.29", "@vue/shared": "3.5.29", "estree-walker": "^2.0.2", "magic-string": "^0.30.21", "postcss": "^8.5.6", "source-map-js": "^1.2.1" } }, "sha512-oJZhN5XJs35Gzr50E82jg2cYdZQ78wEwvRO6Y63TvLVTc+6xICzJHP1UIecdSPPYIbkautNBanDiWYa64QSFIA=="], - "@vue/compiler-ssr": ["@vue/compiler-ssr@3.5.25", "", { "dependencies": { "@vue/compiler-dom": "3.5.25", "@vue/shared": "3.5.25" } }, "sha512-ritPSKLBcParnsKYi+GNtbdbrIE1mtuFEJ4U1sWeuOMlIziK5GtOL85t5RhsNy4uWIXPgk+OUdpnXiTdzn8o3A=="], + "@vue/compiler-ssr": ["@vue/compiler-ssr@3.5.29", "", { "dependencies": { "@vue/compiler-dom": "3.5.29", "@vue/shared": "3.5.29" } }, "sha512-Y/ARJZE6fpjzL5GH/phJmsFwx3g6t2KmHKHx5q+MLl2kencADKIrhH5MLF6HHpRMmlRAYBRSvv347Mepf1zVNw=="], "@vue/devtools-api": ["@vue/devtools-api@6.6.4", "", {}, "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g=="], - "@vue/devtools-core": ["@vue/devtools-core@8.0.5", "", { "dependencies": { "@vue/devtools-kit": "^8.0.5", "@vue/devtools-shared": "^8.0.5", "mitt": "^3.0.1", "nanoid": "^5.1.5", "pathe": "^2.0.3", "vite-hot-client": "^2.1.0" }, "peerDependencies": { "vue": "^3.0.0" } }, "sha512-dpCw8nl0GDBuiL9SaY0mtDxoGIEmU38w+TQiYEPOLhW03VDC0lfNMYXS/qhl4I0YlysGp04NLY4UNn6xgD0VIQ=="], + "@vue/devtools-core": ["@vue/devtools-core@8.0.7", "", { "dependencies": { "@vue/devtools-kit": "^8.0.7", "@vue/devtools-shared": "^8.0.7" }, "peerDependencies": { "vue": "^3.0.0" } }, "sha512-PmpiPxvg3Of80ODHVvyckxwEW1Z02VIAvARIZS1xegINn3VuNQLm9iHUmKD+o6cLkMNWV8OG8x7zo0kgydZgdg=="], - "@vue/devtools-kit": ["@vue/devtools-kit@8.0.5", "", { "dependencies": { "@vue/devtools-shared": "^8.0.5", "birpc": "^2.6.1", "hookable": "^5.5.3", "mitt": "^3.0.1", "perfect-debounce": "^2.0.0", "speakingurl": "^14.0.1", "superjson": "^2.2.2" } }, "sha512-q2VV6x1U3KJMTQPUlRMyWEKVbcHuxhqJdSr6Jtjz5uAThAIrfJ6WVZdGZm5cuO63ZnSUz0RCsVwiUUb0mDV0Yg=="], + "@vue/devtools-kit": ["@vue/devtools-kit@8.0.7", "", { "dependencies": { "@vue/devtools-shared": "^8.0.7", "birpc": "^2.6.1", "hookable": "^5.5.3", "perfect-debounce": "^2.0.0" } }, "sha512-H6esJGHGl5q0E9iV3m2EoBQHJ+V83WMW83A0/+Fn95eZ2iIvdsq4+UCS6yT/Fdd4cGZSchx/MdWDreM3WqMsDw=="], - "@vue/devtools-shared": ["@vue/devtools-shared@8.0.5", "", { "dependencies": { "rfdc": "^1.4.1" } }, "sha512-bRLn6/spxpmgLk+iwOrR29KrYnJjG9DGpHGkDFG82UM21ZpJ39ztUT9OXX3g+usW7/b2z+h46I9ZiYyB07XMXg=="], + "@vue/devtools-shared": ["@vue/devtools-shared@8.0.7", "", {}, "sha512-CgAb9oJH5NUmbQRdYDj/1zMiaICYSLtm+B1kxcP72LBrifGAjUmt8bx52dDH1gWRPlQgxGPqpAMKavzVirAEhA=="], "@vue/eslint-config-prettier": ["@vue/eslint-config-prettier@10.2.0", "", { "dependencies": { "eslint-config-prettier": "^10.0.1", "eslint-plugin-prettier": "^5.2.2" }, "peerDependencies": { "eslint": ">= 8.21.0", "prettier": ">= 3.0.0" } }, "sha512-GL3YBLwv/+b86yHcNNfPJxOTtVFJ4Mbc9UU3zR+KVoG7SwGTjPT+32fXamscNumElhcpXW3mT0DgzS9w32S7Bw=="], - "@vue/eslint-config-typescript": ["@vue/eslint-config-typescript@14.6.0", "", { "dependencies": { "@typescript-eslint/utils": "^8.35.1", "fast-glob": "^3.3.3", "typescript-eslint": "^8.35.1", "vue-eslint-parser": "^10.2.0" }, "peerDependencies": { "eslint": "^9.10.0", "eslint-plugin-vue": "^9.28.0 || ^10.0.0", "typescript": ">=4.8.4" }, "optionalPeers": ["typescript"] }, "sha512-UpiRY/7go4Yps4mYCjkvlIbVWmn9YvPGQDxTAlcKLphyaD77LjIu3plH4Y9zNT0GB4f3K5tMmhhtRhPOgrQ/bQ=="], + "@vue/eslint-config-typescript": ["@vue/eslint-config-typescript@14.7.0", "", { "dependencies": { "@typescript-eslint/utils": "^8.56.0", "fast-glob": "^3.3.3", "typescript-eslint": "^8.56.0", "vue-eslint-parser": "^10.4.0" }, "peerDependencies": { "eslint": "^9.10.0 || ^10.0.0", "eslint-plugin-vue": "^9.28.0 || ^10.0.0", "typescript": ">=4.8.4" }, "optionalPeers": ["typescript"] }, "sha512-iegbMINVc+seZ/QxtzWiOBozctrHiF2WvGedruu2EbLujg9VuU0FQiNcN2z1ycuaoKKpF4m2qzB5HDEMKbxtIg=="], - "@vue/language-core": ["@vue/language-core@3.1.5", "", { "dependencies": { "@volar/language-core": "2.4.23", "@vue/compiler-dom": "^3.5.0", "@vue/shared": "^3.5.0", "alien-signals": "^3.0.0", "muggle-string": "^0.4.1", "path-browserify": "^1.0.1", "picomatch": "^4.0.2" }, "peerDependencies": { "typescript": "*" }, "optionalPeers": ["typescript"] }, "sha512-FMcqyzWN+sYBeqRMWPGT2QY0mUasZMVIuHvmb5NT3eeqPrbHBYtCP8JWEUCDCgM+Zr62uuWY/qoeBrPrzfa78w=="], + "@vue/language-core": ["@vue/language-core@3.2.5", "", { "dependencies": { "@volar/language-core": "2.4.28", "@vue/compiler-dom": "^3.5.0", "@vue/shared": "^3.5.0", "alien-signals": "^3.0.0", "muggle-string": "^0.4.1", "path-browserify": "^1.0.1", "picomatch": "^4.0.2" } }, "sha512-d3OIxN/+KRedeM5wQ6H6NIpwS3P5gC9nmyaHgBk+rO6dIsjY+tOh4UlPpiZbAh3YtLdCGEX4M16RmsBqPmJV+g=="], - "@vue/reactivity": ["@vue/reactivity@3.5.25", "", { "dependencies": { "@vue/shared": "3.5.25" } }, "sha512-5xfAypCQepv4Jog1U4zn8cZIcbKKFka3AgWHEFQeK65OW+Ys4XybP6z2kKgws4YB43KGpqp5D/K3go2UPPunLA=="], + "@vue/reactivity": ["@vue/reactivity@3.5.29", "", { "dependencies": { "@vue/shared": "3.5.29" } }, "sha512-zcrANcrRdcLtmGZETBxWqIkoQei8HaFpZWx/GHKxx79JZsiZ8j1du0VUJtu4eJjgFvU/iKL5lRXFXksVmI+5DA=="], - "@vue/runtime-core": ["@vue/runtime-core@3.5.25", "", { "dependencies": { "@vue/reactivity": "3.5.25", "@vue/shared": "3.5.25" } }, "sha512-Z751v203YWwYzy460bzsYQISDfPjHTl+6Zzwo/a3CsAf+0ccEjQ8c+0CdX1WsumRTHeywvyUFtW6KvNukT/smA=="], + "@vue/runtime-core": ["@vue/runtime-core@3.5.29", "", { "dependencies": { "@vue/reactivity": "3.5.29", "@vue/shared": "3.5.29" } }, "sha512-8DpW2QfdwIWOLqtsNcds4s+QgwSaHSJY/SUe04LptianUQ/0xi6KVsu/pYVh+HO3NTVvVJjIPL2t6GdeKbS4Lg=="], - "@vue/runtime-dom": ["@vue/runtime-dom@3.5.25", "", { "dependencies": { "@vue/reactivity": "3.5.25", "@vue/runtime-core": "3.5.25", "@vue/shared": "3.5.25", "csstype": "^3.1.3" } }, "sha512-a4WrkYFbb19i9pjkz38zJBg8wa/rboNERq3+hRRb0dHiJh13c+6kAbgqCPfMaJ2gg4weWD3APZswASOfmKwamA=="], + "@vue/runtime-dom": ["@vue/runtime-dom@3.5.29", "", { "dependencies": { "@vue/reactivity": "3.5.29", "@vue/runtime-core": "3.5.29", "@vue/shared": "3.5.29", "csstype": "^3.2.3" } }, "sha512-AHvvJEtcY9tw/uk+s/YRLSlxxQnqnAkjqvK25ZiM4CllCZWzElRAoQnCM42m9AHRLNJ6oe2kC5DCgD4AUdlvXg=="], - "@vue/server-renderer": ["@vue/server-renderer@3.5.25", "", { "dependencies": { "@vue/compiler-ssr": "3.5.25", "@vue/shared": "3.5.25" }, "peerDependencies": { "vue": "3.5.25" } }, "sha512-UJaXR54vMG61i8XNIzTSf2Q7MOqZHpp8+x3XLGtE3+fL+nQd+k7O5+X3D/uWrnQXOdMw5VPih+Uremcw+u1woQ=="], + "@vue/server-renderer": ["@vue/server-renderer@3.5.29", "", { "dependencies": { "@vue/compiler-ssr": "3.5.29", "@vue/shared": "3.5.29" }, "peerDependencies": { "vue": "3.5.29" } }, "sha512-G/1k6WK5MusLlbxSE2YTcqAAezS+VuwHhOvLx2KnQU7G2zCH6KIb+5Wyt6UjMq7a3qPzNEjJXs1hvAxDclQH+g=="], - "@vue/shared": ["@vue/shared@3.5.25", "", {}, "sha512-AbOPdQQnAnzs58H2FrrDxYj/TJfmeS2jdfEEhgiKINy+bnOANmVizIEgq1r+C5zsbs6l1CCQxtcj71rwNQ4jWg=="], + "@vue/shared": ["@vue/shared@3.5.29", "", {}, "sha512-w7SR0A5zyRByL9XUkCfdLs7t9XOHUyJ67qPGQjOou3p6GvBeBW+AVjUUmlxtZ4PIYaRvE+1LmK44O4uajlZwcg=="], "@vue/tsconfig": ["@vue/tsconfig@0.8.1", "", { "peerDependencies": { "typescript": "5.x", "vue": "^3.4.0" }, "optionalPeers": ["typescript", "vue"] }, "sha512-aK7feIWPXFSUhsCP9PFqPyFOcz4ENkb8hZ2pneL6m2UjCkccvaOhC/5KCKluuBufvp2KzkbdA2W2pk20vLzu3g=="], - "@vueuse/core": ["@vueuse/core@14.1.0", "", { "dependencies": { "@types/web-bluetooth": "^0.0.21", "@vueuse/metadata": "14.1.0", "@vueuse/shared": "14.1.0" }, "peerDependencies": { "vue": "^3.5.0" } }, "sha512-rgBinKs07hAYyPF834mDTigH7BtPqvZ3Pryuzt1SD/lg5wEcWqvwzXXYGEDb2/cP0Sj5zSvHl3WkmMELr5kfWw=="], + "@vueuse/core": ["@vueuse/core@14.2.1", "", { "dependencies": { "@types/web-bluetooth": "^0.0.21", "@vueuse/metadata": "14.2.1", "@vueuse/shared": "14.2.1" }, "peerDependencies": { "vue": "^3.5.0" } }, "sha512-3vwDzV+GDUNpdegRY6kzpLm4Igptq+GA0QkJ3W61Iv27YWwW/ufSlOfgQIpN6FZRMG0mkaz4gglJRtq5SeJyIQ=="], - "@vueuse/metadata": ["@vueuse/metadata@14.1.0", "", {}, "sha512-7hK4g015rWn2PhKcZ99NyT+ZD9sbwm7SGvp7k+k+rKGWnLjS/oQozoIZzWfCewSUeBmnJkIb+CNr7Zc/EyRnnA=="], + "@vueuse/metadata": ["@vueuse/metadata@14.2.1", "", {}, "sha512-1ButlVtj5Sb/HDtIy1HFr1VqCP4G6Ypqt5MAo0lCgjokrk2mvQKsK2uuy0vqu/Ks+sHfuHo0B9Y9jn9xKdjZsw=="], - "@vueuse/shared": ["@vueuse/shared@14.1.0", "", { "peerDependencies": { "vue": "^3.5.0" } }, "sha512-EcKxtYvn6gx1F8z9J5/rsg3+lTQnvOruQd8fUecW99DCK04BkWD7z5KQ/wTAx+DazyoEE9dJt/zV8OIEQbM6kw=="], + "@vueuse/shared": ["@vueuse/shared@14.2.1", "", { "peerDependencies": { "vue": "^3.5.0" } }, "sha512-shTJncjV9JTI4oVNyF1FQonetYAiTBd+Qj7cY89SWbXSkx7gyhrgtEdF2ZAVWS1S3SHlaROO6F2IesJxQEkZBw=="], "@xterm/addon-fit": ["@xterm/addon-fit@0.10.0", "", { "peerDependencies": { "@xterm/xterm": "^5.0.0" } }, "sha512-UFYkDm4HUahf2lnEyHvio51TNGiLK66mqP2JoATy7hRZeXaGMRDr00JiSF7m63vR5WKATF605yEggJKsw0JpMQ=="], @@ -571,23 +577,23 @@ "@xterm/xterm": ["@xterm/xterm@5.5.0", "", {}, "sha512-hqJHYaQb5OptNunnyAnkHyM8aCjZ1MEIDTQu1iIbbTD/xops91NB5yq1ZK/dC2JDbVWtF23zUtl9JE2NqwT87A=="], - "acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="], + "acorn": ["acorn@8.16.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw=="], "acorn-jsx": ["acorn-jsx@5.3.2", "", { "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ=="], - "ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="], + "ajv": ["ajv@8.18.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A=="], - "alien-signals": ["alien-signals@3.0.0", "", {}, "sha512-JHoRJf18Y6HN4/KZALr3iU+0vW9LKG+8FMThQlbn4+gv8utsLIkwpomjElGPccGeNwh0FI2HN6BLnyFLo6OyLQ=="], + "alien-signals": ["alien-signals@3.1.2", "", {}, "sha512-d9dYqZTS90WLiU0I5c6DHj/HcKkF8ZyGN3G5x8wSbslulz70KOxaqCT0hQCo9KOyhVqzqGojvNdJXoTumZOtcw=="], "ansi-colors": ["ansi-colors@4.1.3", "", {}, "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw=="], - "ansi-regex": ["ansi-regex@6.1.0", "", {}, "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA=="], + "ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="], - "ansi-styles": ["ansi-styles@6.2.1", "", {}, "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug=="], + "ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="], "ansicolor": ["ansicolor@2.0.3", "", {}, "sha512-pzusTqk9VHrjgMCcTPDTTvfJfx6Q3+L5tQ6yKC8Diexmoit4YROTFIkxFvRTNL9y5s0Q8HrSrgerCD5bIC+Kiw=="], - "ansis": ["ansis@4.1.0", "", {}, "sha512-BGcItUBWSMRgOCe+SVZJ+S7yTRG0eGt9cXAHev72yuGcY23hnLA7Bky5L/xLyPINoSN95geovfBkqoTlNZYa7w=="], + "ansis": ["ansis@4.2.0", "", {}, "sha512-HqZ5rWlFjGiV0tDm3UxxgNRqsOTniqoKZu0pIAfh7TZQMGuZK+hH0drySty0si0QXj1ieop4+SkSfPZBPPkHig=="], "argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], @@ -595,11 +601,13 @@ "balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], + "baseline-browser-mapping": ["baseline-browser-mapping@2.10.0", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-lIyg0szRfYbiy67j9KN8IyeD7q7hcmqnJ1ddWmNt19ItGpNN64mnllmxUNFIOdOm6by97jlL6wfpTTJrmnjWAA=="], + "best-effort-json-parser": ["best-effort-json-parser@1.2.1", "", {}, "sha512-UICSLibQdzS1f+PBsi3u2YE3SsdXcWicHUg3IMvfuaePS2AYnZJdJeKhGv5OM8/mqJwPt79aDrEJ1oa84tELvw=="], "binary-install": ["binary-install@1.1.2", "", { "dependencies": { "axios": "^0.26.1", "rimraf": "^3.0.2", "tar": "^6.1.11" } }, "sha512-ZS2cqFHPZOy4wLxvzqfQvDjCOifn+7uCPqNmYRIBM/03+yllON+4fNnsD0VJdW0p97y+E+dTRNPStWNqMBq+9g=="], - "birpc": ["birpc@2.6.1", "", {}, "sha512-LPnFhlDpdSH6FJhJyn4M0kFO7vtQ5iPw24FnG0y21q09xC7e8+1LeR31S1MAIrDAHp4m7aas4bEkTDTvMAtebQ=="], + "birpc": ["birpc@2.9.0", "", {}, "sha512-KrayHS5pBi69Xi9JmvoqrIgYGDkD6mcSe/i6YKi3w5kekCLzrX4+nawcXqrj2tIp50Kw/mT/s3p+GVK0A0sKxw=="], "boolbase": ["boolbase@1.0.0", "", {}, "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww=="], @@ -611,11 +619,7 @@ "braces": ["braces@3.0.3", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="], - "browserslist": ["browserslist@4.25.1", "", { "dependencies": { "caniuse-lite": "^1.0.30001726", "electron-to-chromium": "^1.5.173", "node-releases": "^2.0.19", "update-browserslist-db": "^1.1.3" }, "bin": { "browserslist": "cli.js" } }, "sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw=="], - - "buffer-builder": ["buffer-builder@0.2.0", "", {}, "sha512-7VPMEPuYznPSoR21NE1zvd2Xna6c/CloiZCfcMXR1Jny6PjX0N4Nsa38zcBFo/FMK+BlA+FLKbJCQ0i2yxp+Xg=="], - - "buffer-from": ["buffer-from@1.1.2", "", {}, "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="], + "browserslist": ["browserslist@4.28.1", "", { "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", "electron-to-chromium": "^1.5.263", "node-releases": "^2.0.27", "update-browserslist-db": "^1.2.0" }, "bin": { "browserslist": "cli.js" } }, "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA=="], "bundle-name": ["bundle-name@4.1.0", "", { "dependencies": { "run-applescript": "^7.0.0" } }, "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q=="], @@ -627,7 +631,7 @@ "callsites": ["callsites@3.1.0", "", {}, "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="], - "caniuse-lite": ["caniuse-lite@1.0.30001727", "", {}, "sha512-pB68nIHmbN6L/4C6MH1DokyR3bYqFwjaSs/sWDHGj4CTcFtQUQMuJftVwWkXq7mNWOybD3KhUv3oWHoGxgP14Q=="], + "caniuse-lite": ["caniuse-lite@1.0.30001776", "", {}, "sha512-sg01JDPzZ9jGshqKSckOQthXnYwOEP50jeVFhaSFbZcOy05TiuuaffDOfcwtCisJ9kNQuLBFibYywv2Bgm9osw=="], "ccount": ["ccount@2.0.1", "", {}, "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg=="], @@ -665,12 +669,10 @@ "concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="], - "confbox": ["confbox@0.2.2", "", {}, "sha512-1NB+BKqhtNipMsov4xI/NnhCKp9XG9NamYp5PVm9klAT0fsrNPjaFICsCFhNhwZJKNh7zB/3q8qXz0E9oaMNtQ=="], + "confbox": ["confbox@0.2.4", "", {}, "sha512-ysOGlgTFbN2/Y6Cg3Iye8YKulHw+R2fNXHrgSmXISQdMnomY6eNDprVdW9R5xBguEqI954+S6709UyiO7B+6OQ=="], "convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="], - "copy-anything": ["copy-anything@3.0.5", "", { "dependencies": { "is-what": "^4.1.8" } }, "sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w=="], - "crelt": ["crelt@1.0.6", "", {}, "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g=="], "cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="], @@ -685,7 +687,7 @@ "csso": ["csso@5.0.5", "", { "dependencies": { "css-tree": "~2.2.0" } }, "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ=="], - "csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="], + "csstype": ["csstype@3.2.3", "", {}, "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ=="], "debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], @@ -693,13 +695,13 @@ "deepmerge": ["deepmerge@4.3.1", "", {}, "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A=="], - "default-browser": ["default-browser@5.2.1", "", { "dependencies": { "bundle-name": "^4.1.0", "default-browser-id": "^5.0.0" } }, "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg=="], + "default-browser": ["default-browser@5.5.0", "", { "dependencies": { "bundle-name": "^4.1.0", "default-browser-id": "^5.0.0" } }, "sha512-H9LMLr5zwIbSxrmvikGuI/5KGhZ8E2zH3stkMgM5LpOWDutGM2JZaj460Udnf1a+946zc7YBgrqEWwbk7zHvGw=="], - "default-browser-id": ["default-browser-id@5.0.0", "", {}, "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA=="], + "default-browser-id": ["default-browser-id@5.0.1", "", {}, "sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q=="], "define-lazy-prop": ["define-lazy-prop@3.0.0", "", {}, "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg=="], - "deno": ["deno@2.5.6", "", { "optionalDependencies": { "@deno/darwin-arm64": "2.5.6", "@deno/darwin-x64": "2.5.6", "@deno/linux-arm64-glibc": "2.5.6", "@deno/linux-x64-glibc": "2.5.6", "@deno/win32-arm64": "2.5.6", "@deno/win32-x64": "2.5.6" }, "bin": { "deno": "bin.cjs" } }, "sha512-SSe2gCf41A/uln54H7xdKZFtiDt+reBxYM4IaJLRH/NpEIE5T3VOcLSLHPaJzyiTvZe2xMz1QFcpg4cco5rNsA=="], + "deno": ["deno@2.7.1", "", { "optionalDependencies": { "@deno/darwin-arm64": "2.7.1", "@deno/darwin-x64": "2.7.1", "@deno/linux-arm64-glibc": "2.7.1", "@deno/linux-x64-glibc": "2.7.1", "@deno/win32-arm64": "2.7.1", "@deno/win32-x64": "2.7.1" }, "bin": { "deno": "bin.cjs" } }, "sha512-cqYEHu3vHIMvGLg8HSJJPHJZi3Mr94a743asH65n6gBw9I0wtPMZgXB84qhaWiWkL1G8E0kN7v67EY2wNApZ6Q=="], "dequal": ["dequal@2.0.3", "", {}, "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA=="], @@ -723,9 +725,9 @@ "ebnf": ["ebnf@1.9.1", "", { "bin": { "ebnf": "dist/bin.js" } }, "sha512-uW2UKSsuty9ANJ3YByIQE4ANkD8nqUPO7r6Fwcc1ADKPe9FRdcPpMl3VEput4JSvKBJ4J86npIC2MLP0pYkCuw=="], - "electron-to-chromium": ["electron-to-chromium@1.5.180", "", {}, "sha512-ED+GEyEh3kYMwt2faNmgMB0b8O5qtATGgR4RmRsIp4T6p7B8vdMbIedYndnvZfsaXvSzegtpfqRMDNCjjiSduA=="], + "electron-to-chromium": ["electron-to-chromium@1.5.307", "", {}, "sha512-5z3uFKBWjiNR44nFcYdkcXjKMbg5KXNdciu7mhTPo9tB7NbqSNP2sSnGR+fqknZSCwKkBN+oxiiajWs4dT6ORg=="], - "emoji-regex": ["emoji-regex@10.4.0", "", {}, "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw=="], + "emoji-regex": ["emoji-regex@10.6.0", "", {}, "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="], "emoji-regex-xs": ["emoji-regex-xs@1.0.0", "", {}, "sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg=="], @@ -741,19 +743,19 @@ "es-object-atoms": ["es-object-atoms@1.1.1", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA=="], - "esbuild": ["esbuild@0.25.10", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.10", "@esbuild/android-arm": "0.25.10", "@esbuild/android-arm64": "0.25.10", "@esbuild/android-x64": "0.25.10", "@esbuild/darwin-arm64": "0.25.10", "@esbuild/darwin-x64": "0.25.10", "@esbuild/freebsd-arm64": "0.25.10", "@esbuild/freebsd-x64": "0.25.10", "@esbuild/linux-arm": "0.25.10", "@esbuild/linux-arm64": "0.25.10", "@esbuild/linux-ia32": "0.25.10", "@esbuild/linux-loong64": "0.25.10", "@esbuild/linux-mips64el": "0.25.10", "@esbuild/linux-ppc64": "0.25.10", "@esbuild/linux-riscv64": "0.25.10", "@esbuild/linux-s390x": "0.25.10", "@esbuild/linux-x64": "0.25.10", "@esbuild/netbsd-arm64": "0.25.10", "@esbuild/netbsd-x64": "0.25.10", "@esbuild/openbsd-arm64": "0.25.10", "@esbuild/openbsd-x64": "0.25.10", "@esbuild/openharmony-arm64": "0.25.10", "@esbuild/sunos-x64": "0.25.10", "@esbuild/win32-arm64": "0.25.10", "@esbuild/win32-ia32": "0.25.10", "@esbuild/win32-x64": "0.25.10" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ=="], + "esbuild": ["esbuild@0.27.3", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.27.3", "@esbuild/android-arm": "0.27.3", "@esbuild/android-arm64": "0.27.3", "@esbuild/android-x64": "0.27.3", "@esbuild/darwin-arm64": "0.27.3", "@esbuild/darwin-x64": "0.27.3", "@esbuild/freebsd-arm64": "0.27.3", "@esbuild/freebsd-x64": "0.27.3", "@esbuild/linux-arm": "0.27.3", "@esbuild/linux-arm64": "0.27.3", "@esbuild/linux-ia32": "0.27.3", "@esbuild/linux-loong64": "0.27.3", "@esbuild/linux-mips64el": "0.27.3", "@esbuild/linux-ppc64": "0.27.3", "@esbuild/linux-riscv64": "0.27.3", "@esbuild/linux-s390x": "0.27.3", "@esbuild/linux-x64": "0.27.3", "@esbuild/netbsd-arm64": "0.27.3", "@esbuild/netbsd-x64": "0.27.3", "@esbuild/openbsd-arm64": "0.27.3", "@esbuild/openbsd-x64": "0.27.3", "@esbuild/openharmony-arm64": "0.27.3", "@esbuild/sunos-x64": "0.27.3", "@esbuild/win32-arm64": "0.27.3", "@esbuild/win32-ia32": "0.27.3", "@esbuild/win32-x64": "0.27.3" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg=="], "escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="], "escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="], - "eslint": ["eslint@9.39.1", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", "@eslint/config-helpers": "^0.4.2", "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.39.1", "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g=="], + "eslint": ["eslint@9.39.3", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", "@eslint/config-helpers": "^0.4.2", "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.39.3", "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-VmQ+sifHUbI/IcSopBCF/HO3YiHQx/AVd3UVyYL6weuwW+HvON9VYn5l6Zl1WZzPWXPNZrSQpxwkkZ/VuvJZzg=="], - "eslint-config-prettier": ["eslint-config-prettier@10.1.5", "", { "peerDependencies": { "eslint": ">=7.0.0" }, "bin": { "eslint-config-prettier": "bin/cli.js" } }, "sha512-zc1UmCpNltmVY34vuLRV61r1K27sWuX39E+uyUnY8xS2Bex88VV9cugG+UZbRSRGtGyFboj+D8JODyme1plMpw=="], + "eslint-config-prettier": ["eslint-config-prettier@10.1.8", "", { "peerDependencies": { "eslint": ">=7.0.0" }, "bin": { "eslint-config-prettier": "bin/cli.js" } }, "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w=="], - "eslint-plugin-prettier": ["eslint-plugin-prettier@5.5.1", "", { "dependencies": { "prettier-linter-helpers": "^1.0.0", "synckit": "^0.11.7" }, "peerDependencies": { "@types/eslint": ">=8.0.0", "eslint": ">=8.0.0", "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0", "prettier": ">=3.0.0" }, "optionalPeers": ["@types/eslint", "eslint-config-prettier"] }, "sha512-dobTkHT6XaEVOo8IO90Q4DOSxnm3Y151QxPJlM/vKC0bVy+d6cVWQZLlFiuZPP0wS6vZwSKeJgKkcS+KfMBlRw=="], + "eslint-plugin-prettier": ["eslint-plugin-prettier@5.5.5", "", { "dependencies": { "prettier-linter-helpers": "^1.0.1", "synckit": "^0.11.12" }, "peerDependencies": { "@types/eslint": ">=8.0.0", "eslint": ">=8.0.0", "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0", "prettier": ">=3.0.0" }, "optionalPeers": ["@types/eslint", "eslint-config-prettier"] }, "sha512-hscXkbqUZ2sPithAuLm5MXL+Wph+U7wHngPBv9OMWwlP8iaflyxpjTYZkmdgB4/vPIhemRlBEoLrH7UC1n7aUw=="], - "eslint-plugin-vue": ["eslint-plugin-vue@10.6.2", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "natural-compare": "^1.4.0", "nth-check": "^2.1.1", "postcss-selector-parser": "^7.1.0", "semver": "^7.6.3", "xml-name-validator": "^4.0.0" }, "peerDependencies": { "@stylistic/eslint-plugin": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0", "@typescript-eslint/parser": "^7.0.0 || ^8.0.0", "eslint": "^8.57.0 || ^9.0.0", "vue-eslint-parser": "^10.0.0" }, "optionalPeers": ["@stylistic/eslint-plugin", "@typescript-eslint/parser"] }, "sha512-nA5yUs/B1KmKzvC42fyD0+l9Yd+LtEpVhWRbXuDj0e+ZURcTtyRbMDWUeJmTAh2wC6jC83raS63anNM2YT3NPw=="], + "eslint-plugin-vue": ["eslint-plugin-vue@10.8.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "natural-compare": "^1.4.0", "nth-check": "^2.1.1", "postcss-selector-parser": "^7.1.0", "semver": "^7.6.3", "xml-name-validator": "^4.0.0" }, "peerDependencies": { "@stylistic/eslint-plugin": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0", "@typescript-eslint/parser": "^7.0.0 || ^8.0.0", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "vue-eslint-parser": "^10.0.0" }, "optionalPeers": ["@stylistic/eslint-plugin", "@typescript-eslint/parser"] }, "sha512-f1J/tcbnrpgC8suPN5AtdJ5MQjuXbSU9pGRSSYAuF3SHoiYCOdEX6O22pLaRyLHXvDcOe+O5ENgc1owQ587agA=="], "eslint-scope": ["eslint-scope@8.4.0", "", { "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg=="], @@ -761,7 +763,7 @@ "espree": ["espree@10.4.0", "", { "dependencies": { "acorn": "^8.15.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^4.2.1" } }, "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ=="], - "esquery": ["esquery@1.6.0", "", { "dependencies": { "estraverse": "^5.1.0" } }, "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg=="], + "esquery": ["esquery@1.7.0", "", { "dependencies": { "estraverse": "^5.1.0" } }, "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g=="], "esrecurse": ["esrecurse@4.3.0", "", { "dependencies": { "estraverse": "^5.2.0" } }, "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag=="], @@ -771,7 +773,7 @@ "esutils": ["esutils@2.0.3", "", {}, "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="], - "exsolve": ["exsolve@1.0.7", "", {}, "sha512-VO5fQUzZtI6C+vx4w/4BWJpg3s/5l+6pRQEHzFRM8WFi4XffSP1Z+4qi7GbjWbvRQEbdIco5mIMq+zX4rPuLrw=="], + "exsolve": ["exsolve@1.0.8", "", {}, "sha512-LmDxfWXwcTArk8fUEnOfSZpHOJ6zOMUJKOtFLFqJLoKJetuQG874Uc7/Kki7zFLzYybmZhp1M7+98pfMqeX8yA=="], "fast-copy": ["fast-copy@3.0.2", "", {}, "sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ=="], @@ -787,7 +789,7 @@ "fast-uri": ["fast-uri@3.1.0", "", {}, "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA=="], - "fastq": ["fastq@1.19.1", "", { "dependencies": { "reusify": "^1.0.4" } }, "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ=="], + "fastq": ["fastq@1.20.1", "", { "dependencies": { "reusify": "^1.0.4" } }, "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw=="], "fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="], @@ -799,7 +801,7 @@ "flat-cache": ["flat-cache@4.0.1", "", { "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.4" } }, "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw=="], - "flatted": ["flatted@3.3.3", "", {}, "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg=="], + "flatted": ["flatted@3.3.4", "", {}, "sha512-3+mMldrTAPdta5kjX2G2J7iX4zxtnwpdA8Tr2ZSjkyPSanvbZAcy6flmtnXbEybHrDcU9641lxrMfFuUxVz9vA=="], "follow-redirects": ["follow-redirects@1.15.11", "", {}, "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ=="], @@ -815,7 +817,7 @@ "get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="], - "get-east-asian-width": ["get-east-asian-width@1.3.0", "", {}, "sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ=="], + "get-east-asian-width": ["get-east-asian-width@1.5.0", "", {}, "sha512-CQ+bEO+Tva/qlmw24dCejulK5pMzVnUOFOijVogd3KQs07HnRIgp8TGipvCCRT06xeYEbpbgwaCxglFyiuIcmA=="], "get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="], @@ -833,8 +835,6 @@ "graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="], - "graphemer": ["graphemer@1.4.0", "", {}, "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag=="], - "has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], "has-symbols": ["has-symbols@1.1.0", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="], @@ -851,11 +851,11 @@ "html-void-elements": ["html-void-elements@3.0.0", "", {}, "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg=="], - "humanize-duration": ["humanize-duration@3.33.1", "", {}, "sha512-hwzSCymnRdFx9YdRkQQ0OYequXiVAV6ZGQA2uzocwB0F4309Ke6pO8dg0P8LHhRQJyVjGteRTAA/zNfEcpXn8A=="], + "humanize-duration": ["humanize-duration@3.33.2", "", {}, "sha512-K7Ny/ULO1hDm2nnhvAY+SJV1skxFb61fd073SG1IWJl+D44ULrruCuTyjHKjBVVcSuTlnY99DKtgEG39CM5QOQ=="], "ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="], - "immutable": ["immutable@5.1.3", "", {}, "sha512-+chQdDfvscSF1SJqv2gn4SRO2ZyS3xL3r7IW/wWEEzrzLisnOlKiQu5ytC/BVNcS15C39WT2Hg/bjKjDMcu+zg=="], + "immutable": ["immutable@5.1.5", "", {}, "sha512-t7xcm2siw+hlUM68I+UEOK+z84RzmN59as9DZ7P1l0994DKUWV7UXBMQZVxaoMSRQ+PBZbHCOoBt7a2wxOMt+A=="], "import-fresh": ["import-fresh@3.3.1", "", { "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" } }, "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ=="], @@ -879,11 +879,9 @@ "is-regex": ["is-regex@1.2.1", "", { "dependencies": { "call-bound": "^1.0.2", "gopd": "^1.2.0", "has-tostringtag": "^1.0.2", "hasown": "^2.0.2" } }, "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g=="], - "is-what": ["is-what@4.1.16", "", {}, "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A=="], + "is-wsl": ["is-wsl@3.1.1", "", { "dependencies": { "is-inside-container": "^1.0.0" } }, "sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw=="], - "is-wsl": ["is-wsl@3.1.0", "", { "dependencies": { "is-inside-container": "^1.0.0" } }, "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw=="], - - "isexe": ["isexe@3.1.1", "", {}, "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ=="], + "isexe": ["isexe@3.1.5", "", {}, "sha512-6B3tLtFqtQS4ekarvLVMZ+X+VlvQekbe4taUkf/rhVO3d/h0M2rfARm/pXLcPEsjjMsFgrFgSrhQIxcSVrBz8w=="], "jiti": ["jiti@2.6.1", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ=="], @@ -929,15 +927,15 @@ "lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="], - "magic-string": ["magic-string@0.30.19", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-2N21sPY9Ws53PZvsEpVtNuSW+ScYbQdp4b9qUaL+9QkHUrGFKo56Lg9Emg5s9V/qrtNBmiR01sYhUOwu3H+VOw=="], + "magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="], - "markdown-it": ["markdown-it@14.1.0", "", { "dependencies": { "argparse": "^2.0.1", "entities": "^4.4.0", "linkify-it": "^5.0.0", "mdurl": "^2.0.0", "punycode.js": "^2.3.1", "uc.micro": "^2.1.0" }, "bin": { "markdown-it": "bin/markdown-it.mjs" } }, "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg=="], + "markdown-it": ["markdown-it@14.1.1", "", { "dependencies": { "argparse": "^2.0.1", "entities": "^4.4.0", "linkify-it": "^5.0.0", "mdurl": "^2.0.0", "punycode.js": "^2.3.1", "uc.micro": "^2.1.0" }, "bin": { "markdown-it": "bin/markdown-it.mjs" } }, "sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA=="], "marked": ["marked@14.0.0", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ=="], "math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="], - "mdast-util-to-hast": ["mdast-util-to-hast@13.2.0", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "@ungap/structured-clone": "^1.0.0", "devlop": "^1.0.0", "micromark-util-sanitize-uri": "^2.0.0", "trim-lines": "^3.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA=="], + "mdast-util-to-hast": ["mdast-util-to-hast@13.2.1", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "@ungap/structured-clone": "^1.0.0", "devlop": "^1.0.0", "micromark-util-sanitize-uri": "^2.0.0", "trim-lines": "^3.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA=="], "mdn-data": ["mdn-data@2.12.2", "", {}, "sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA=="], @@ -963,7 +961,7 @@ "mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="], - "minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], + "minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="], "minipass": ["minipass@5.0.0", "", {}, "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ=="], @@ -979,17 +977,17 @@ "monaco-languageserver-types": ["monaco-languageserver-types@0.4.0", "", { "dependencies": { "monaco-types": "^0.1.0", "vscode-languageserver-protocol": "^3.0.0", "vscode-uri": "^3.0.0" } }, "sha512-QQ3BZiU5LYkJElGncSNb5AKoJ/LCs6YBMCJMAz9EA7v+JaOdn3kx2cXpPTcZfKA5AEsR0vc97sAw+5mdNhVBmw=="], - "monaco-marker-data-provider": ["monaco-marker-data-provider@1.2.4", "", { "dependencies": { "monaco-types": "^0.1.0" } }, "sha512-4DsPgsAqpTyUDs3humXRBPUJoihTv+L6v9aupQWD80X2YXaCXUd11mWYeSCYHuPgdUmjFaNWCEOjQ6ewf/QA1Q=="], + "monaco-marker-data-provider": ["monaco-marker-data-provider@1.2.5", "", { "dependencies": { "monaco-types": "^0.1.0" } }, "sha512-5ZdcYukhPwgYMCvlZ9H5uWs5jc23BQ8fFF5AhSIdrz5mvYLsqGZ58ZLxTv8rCX6+AxdJ8+vxg1HVSk+F2bLosg=="], - "monaco-types": ["monaco-types@0.1.0", "", {}, "sha512-aWK7SN9hAqNYi0WosPoMjenMeXJjwCxDibOqWffyQ/qXdzB/86xshGQobRferfmNz7BSNQ8GB0MD0oby9/5fTQ=="], + "monaco-types": ["monaco-types@0.1.2", "", {}, "sha512-8LwfrlWXsedHwAL41xhXyqzPibS8IqPuIXr9NdORhonS495c2/wky+sI1PRLvMCuiI0nqC2NH1six9hdiRY4Xg=="], "monaco-vim": ["monaco-vim@0.4.4", "", { "peerDependencies": { "monaco-editor": "*" } }, "sha512-LNChAb//WEm/W+eyeHG/0+pdVEHotk2hLTN+M3sQZx5E8cAlSWSgqcxpcRuQnxDybSln7pfHF9i63HmbIQvrWw=="], "monaco-worker-manager": ["monaco-worker-manager@2.0.1", "", { "peerDependencies": { "monaco-editor": ">=0.30.0" } }, "sha512-kdPL0yvg5qjhKPNVjJoym331PY/5JC11aPJXtCZNwWRvBr6jhkIamvYAyiY5P1AWFmNOy0aRDRoMdZfa71h8kg=="], - "monaco-yaml": ["monaco-yaml@5.4.0", "", { "dependencies": { "jsonc-parser": "^3.0.0", "monaco-languageserver-types": "^0.4.0", "monaco-marker-data-provider": "^1.0.0", "monaco-types": "^0.1.0", "monaco-worker-manager": "^2.0.0", "path-browserify": "^1.0.0", "prettier": "^3.0.0", "vscode-languageserver-textdocument": "^1.0.0", "vscode-languageserver-types": "^3.0.0", "vscode-uri": "^3.0.0", "yaml": "^2.0.0" }, "peerDependencies": { "monaco-editor": ">=0.36" } }, "sha512-tuBVDy1KAPrgO905GHTItu8AaA5bIzF5S4X0JVRAE/D66FpRhkDUk7tKi5bwKMVTTugtpMLsXN4ewh4CgE/FtQ=="], + "monaco-yaml": ["monaco-yaml@5.4.1", "", { "dependencies": { "jsonc-parser": "^3.0.0", "monaco-languageserver-types": "^0.4.0", "monaco-marker-data-provider": "^1.0.0", "monaco-types": "^0.1.0", "monaco-worker-manager": "^2.0.0", "path-browserify": "^1.0.0", "prettier": "^3.0.0", "vscode-languageserver-textdocument": "^1.0.0", "vscode-languageserver-types": "^3.0.0", "vscode-uri": "^3.0.0", "yaml": "^2.0.0" }, "peerDependencies": { "monaco-editor": ">=0.36" } }, "sha512-YQ6d/Ei98Uk073SJLFbwuSi95qhnl8F8NNmIUqN2XhDt9psZN2LqQ1T7pPQ866NJb2wFj44IrjnANgpa2jTfag=="], - "moo": ["moo@0.5.2", "", {}, "sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q=="], + "moo": ["moo@0.5.3", "", {}, "sha512-m2fmM2dDm7GZQsY7KK2cme8agi+AAljILjQnof7p1ZMDe6dQ4bdnSMx0cPppudoeNv5hEFQirN6u+O4fDE0IWA=="], "mrmime": ["mrmime@2.0.1", "", {}, "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ=="], @@ -1005,7 +1003,7 @@ "node-addon-api": ["node-addon-api@7.1.1", "", {}, "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ=="], - "node-releases": ["node-releases@2.0.19", "", {}, "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw=="], + "node-releases": ["node-releases@2.0.36", "", {}, "sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA=="], "npm-normalize-package-bin": ["npm-normalize-package-bin@4.0.0", "", {}, "sha512-TZKxPvItzai9kN9H/TkmCtx/ZN/hvr3vUycjlfmH0ootY9yFBzNOpiXAdIn1Iteqsvk4lQn6B5PTrt+n6h8k/w=="], @@ -1041,25 +1039,25 @@ "pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="], - "perfect-debounce": ["perfect-debounce@2.0.0", "", {}, "sha512-fkEH/OBiKrqqI/yIgjR92lMfs2K8105zt/VT6+7eTjNwisrsh47CeIED9z58zI7DfKdH3uHAn25ziRZn3kgAow=="], + "perfect-debounce": ["perfect-debounce@2.1.0", "", {}, "sha512-LjgdTytVFXeUgtHZr9WYViYSM/g8MkcTPYDlPa3cDqMirHjKiSZPYd6DoL7pK8AJQr+uWkQvCjHNdiMqsrJs+g=="], "picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="], - "picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="], + "picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], "pidtree": ["pidtree@0.6.0", "", { "bin": { "pidtree": "bin/pidtree.js" } }, "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g=="], "pkg-types": ["pkg-types@2.3.0", "", { "dependencies": { "confbox": "^0.2.2", "exsolve": "^1.0.7", "pathe": "^2.0.3" } }, "sha512-SIqCzDRg0s9npO5XQ3tNZioRY1uK06lA41ynBC1YmFTmnY6FjUjVt6s4LoADmwoig1qqD0oK8h1p/8mlMx8Oig=="], - "postcss": ["postcss@8.5.6", "", { "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg=="], + "postcss": ["postcss@8.5.8", "", { "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg=="], "postcss-selector-parser": ["postcss-selector-parser@7.1.1", "", { "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" } }, "sha512-orRsuYpJVw8LdAwqqLykBj9ecS5/cRHlI5+nvTo8LcCKmzDmqVORXtOIYEEQuL9D4BxtA1lm5isAqzQZCoQ6Eg=="], "prelude-ls": ["prelude-ls@1.2.1", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="], - "prettier": ["prettier@3.7.3", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-QgODejq9K3OzoBbuyobZlUhznP5SKwPqp+6Q6xw6o8gnhr4O85L2U915iM2IDcfF2NPXVaM9zlo9tdwipnYwzg=="], + "prettier": ["prettier@3.8.1", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg=="], - "prettier-linter-helpers": ["prettier-linter-helpers@1.0.0", "", { "dependencies": { "fast-diff": "^1.1.2" } }, "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w=="], + "prettier-linter-helpers": ["prettier-linter-helpers@1.0.1", "", { "dependencies": { "fast-diff": "^1.1.2" } }, "sha512-SxToR7P8Y2lWmv/kTzVLC1t/GDI2WGjMwNhLLE9qtH8Q13C+aEmuRlzDst4Up4s0Wc8sF2M+J57iB3cMLqftfg=="], "prettier-plugin-vue": ["prettier-plugin-vue@1.1.6", "", { "dependencies": { "prettier": "^2.8.1" } }, "sha512-trQ/oY+6hSsGe2zPIFThXMIM0TbxMEbk2VOrKjwHWuSz7OEo0rnumbz9a47OxVPCaAnGY9vZG8qDTiTmk9bq0A=="], @@ -1073,7 +1071,7 @@ "punycode.js": ["punycode.js@2.3.1", "", {}, "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA=="], - "qrcode.vue": ["qrcode.vue@3.6.0", "", { "peerDependencies": { "vue": "^3.0.0" } }, "sha512-vQcl2fyHYHMjDO1GguCldJxepq2izQjBkDEEu9NENgfVKP6mv/e2SU62WbqYHGwTgWXLhxZ1NCD1dAZKHQq1fg=="], + "qrcode.vue": ["qrcode.vue@3.8.0", "", { "peerDependencies": { "vue": "^3.0.0" } }, "sha512-+XKbSKvQu158zlHsJm+HObGUQM3Q+9Oq6yb2op/6lMM2gwOiiG9uIhujvrSV5UoTjrzR0BcNxCdW2kk7KE4NEg=="], "quansync": ["quansync@0.2.11", "", {}, "sha512-AifT7QEbW9Nri4tAwR5M/uzpBuqfZf+zwaEM/QkzEjj7NBuFD2rBuy0K3dE+8wltbezDV7JMA0WfnCPYRSYbXA=="], @@ -1103,61 +1101,59 @@ "reusify": ["reusify@1.1.0", "", {}, "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw=="], - "rfdc": ["rfdc@1.4.1", "", {}, "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA=="], - "rimraf": ["rimraf@3.0.2", "", { "dependencies": { "glob": "^7.1.3" }, "bin": { "rimraf": "bin.js" } }, "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA=="], - "rollup": ["rollup@4.44.2", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.44.2", "@rollup/rollup-android-arm64": "4.44.2", "@rollup/rollup-darwin-arm64": "4.44.2", "@rollup/rollup-darwin-x64": "4.44.2", "@rollup/rollup-freebsd-arm64": "4.44.2", "@rollup/rollup-freebsd-x64": "4.44.2", "@rollup/rollup-linux-arm-gnueabihf": "4.44.2", "@rollup/rollup-linux-arm-musleabihf": "4.44.2", "@rollup/rollup-linux-arm64-gnu": "4.44.2", "@rollup/rollup-linux-arm64-musl": "4.44.2", "@rollup/rollup-linux-loongarch64-gnu": "4.44.2", "@rollup/rollup-linux-powerpc64le-gnu": "4.44.2", "@rollup/rollup-linux-riscv64-gnu": "4.44.2", "@rollup/rollup-linux-riscv64-musl": "4.44.2", "@rollup/rollup-linux-s390x-gnu": "4.44.2", "@rollup/rollup-linux-x64-gnu": "4.44.2", "@rollup/rollup-linux-x64-musl": "4.44.2", "@rollup/rollup-win32-arm64-msvc": "4.44.2", "@rollup/rollup-win32-ia32-msvc": "4.44.2", "@rollup/rollup-win32-x64-msvc": "4.44.2", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-PVoapzTwSEcelaWGth3uR66u7ZRo6qhPHc0f2uRO9fX6XDVNrIiGYS0Pj9+R8yIIYSD/mCx2b16Ws9itljKSPg=="], + "rollup": ["rollup@4.59.0", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.59.0", "@rollup/rollup-android-arm64": "4.59.0", "@rollup/rollup-darwin-arm64": "4.59.0", "@rollup/rollup-darwin-x64": "4.59.0", "@rollup/rollup-freebsd-arm64": "4.59.0", "@rollup/rollup-freebsd-x64": "4.59.0", "@rollup/rollup-linux-arm-gnueabihf": "4.59.0", "@rollup/rollup-linux-arm-musleabihf": "4.59.0", "@rollup/rollup-linux-arm64-gnu": "4.59.0", "@rollup/rollup-linux-arm64-musl": "4.59.0", "@rollup/rollup-linux-loong64-gnu": "4.59.0", "@rollup/rollup-linux-loong64-musl": "4.59.0", "@rollup/rollup-linux-ppc64-gnu": "4.59.0", "@rollup/rollup-linux-ppc64-musl": "4.59.0", "@rollup/rollup-linux-riscv64-gnu": "4.59.0", "@rollup/rollup-linux-riscv64-musl": "4.59.0", "@rollup/rollup-linux-s390x-gnu": "4.59.0", "@rollup/rollup-linux-x64-gnu": "4.59.0", "@rollup/rollup-linux-x64-musl": "4.59.0", "@rollup/rollup-openbsd-x64": "4.59.0", "@rollup/rollup-openharmony-arm64": "4.59.0", "@rollup/rollup-win32-arm64-msvc": "4.59.0", "@rollup/rollup-win32-ia32-msvc": "4.59.0", "@rollup/rollup-win32-x64-gnu": "4.59.0", "@rollup/rollup-win32-x64-msvc": "4.59.0", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg=="], - "run-applescript": ["run-applescript@7.0.0", "", {}, "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A=="], + "run-applescript": ["run-applescript@7.1.0", "", {}, "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q=="], "run-parallel": ["run-parallel@1.2.0", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="], "rxjs": ["rxjs@7.8.2", "", { "dependencies": { "tslib": "^2.1.0" } }, "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA=="], - "sass": ["sass@1.93.3", "", { "dependencies": { "chokidar": "^4.0.0", "immutable": "^5.0.2", "source-map-js": ">=0.6.2 <2.0.0" }, "optionalDependencies": { "@parcel/watcher": "^2.4.1" }, "bin": { "sass": "sass.js" } }, "sha512-elOcIZRTM76dvxNAjqYrucTSI0teAF/L2Lv0s6f6b7FOwcwIuA357bIE871580AjHJuSvLIRUosgV+lIWx6Rgg=="], + "sass": ["sass@1.97.3", "", { "dependencies": { "chokidar": "^4.0.0", "immutable": "^5.0.2", "source-map-js": ">=0.6.2 <2.0.0" }, "optionalDependencies": { "@parcel/watcher": "^2.4.1" }, "bin": { "sass": "sass.js" } }, "sha512-fDz1zJpd5GycprAbu4Q2PV/RprsRtKC/0z82z0JLgdytmcq0+ujJbJ/09bPGDxCLkKY3Np5cRAOcWiVkLXJURg=="], - "sass-embedded": ["sass-embedded@1.93.3", "", { "dependencies": { "@bufbuild/protobuf": "^2.5.0", "buffer-builder": "^0.2.0", "colorjs.io": "^0.5.0", "immutable": "^5.0.2", "rxjs": "^7.4.0", "supports-color": "^8.1.1", "sync-child-process": "^1.0.2", "varint": "^6.0.0" }, "optionalDependencies": { "sass-embedded-all-unknown": "1.93.3", "sass-embedded-android-arm": "1.93.3", "sass-embedded-android-arm64": "1.93.3", "sass-embedded-android-riscv64": "1.93.3", "sass-embedded-android-x64": "1.93.3", "sass-embedded-darwin-arm64": "1.93.3", "sass-embedded-darwin-x64": "1.93.3", "sass-embedded-linux-arm": "1.93.3", "sass-embedded-linux-arm64": "1.93.3", "sass-embedded-linux-musl-arm": "1.93.3", "sass-embedded-linux-musl-arm64": "1.93.3", "sass-embedded-linux-musl-riscv64": "1.93.3", "sass-embedded-linux-musl-x64": "1.93.3", "sass-embedded-linux-riscv64": "1.93.3", "sass-embedded-linux-x64": "1.93.3", "sass-embedded-unknown-all": "1.93.3", "sass-embedded-win32-arm64": "1.93.3", "sass-embedded-win32-x64": "1.93.3" }, "bin": { "sass": "dist/bin/sass.js" } }, "sha512-+VUy01yfDqNmIVMd/LLKl2TTtY0ovZN0rTonh+FhKr65mFwIYgU9WzgIZKS7U9/SPCQvWTsTGx9jyt+qRm/XFw=="], + "sass-embedded": ["sass-embedded@1.97.3", "", { "dependencies": { "@bufbuild/protobuf": "^2.5.0", "colorjs.io": "^0.5.0", "immutable": "^5.0.2", "rxjs": "^7.4.0", "supports-color": "^8.1.1", "sync-child-process": "^1.0.2", "varint": "^6.0.0" }, "optionalDependencies": { "sass-embedded-all-unknown": "1.97.3", "sass-embedded-android-arm": "1.97.3", "sass-embedded-android-arm64": "1.97.3", "sass-embedded-android-riscv64": "1.97.3", "sass-embedded-android-x64": "1.97.3", "sass-embedded-darwin-arm64": "1.97.3", "sass-embedded-darwin-x64": "1.97.3", "sass-embedded-linux-arm": "1.97.3", "sass-embedded-linux-arm64": "1.97.3", "sass-embedded-linux-musl-arm": "1.97.3", "sass-embedded-linux-musl-arm64": "1.97.3", "sass-embedded-linux-musl-riscv64": "1.97.3", "sass-embedded-linux-musl-x64": "1.97.3", "sass-embedded-linux-riscv64": "1.97.3", "sass-embedded-linux-x64": "1.97.3", "sass-embedded-unknown-all": "1.97.3", "sass-embedded-win32-arm64": "1.97.3", "sass-embedded-win32-x64": "1.97.3" }, "bin": { "sass": "dist/bin/sass.js" } }, "sha512-eKzFy13Nk+IRHhlAwP3sfuv+PzOrvzUkwJK2hdoCKYcWGSdmwFpeGpWmyewdw8EgBnsKaSBtgf/0b2K635ecSA=="], - "sass-embedded-all-unknown": ["sass-embedded-all-unknown@1.93.3", "", { "dependencies": { "sass": "1.93.3" }, "cpu": [ "!arm", "!x64", "!arm64", ] }, "sha512-3okGgnE41eg+CPLtAPletu6nQ4N0ij7AeW+Sl5Km4j29XcmqZQeFwYjHe1AlKTEgLi/UAONk1O8i8/lupeKMbw=="], + "sass-embedded-all-unknown": ["sass-embedded-all-unknown@1.97.3", "", { "dependencies": { "sass": "1.97.3" }, "cpu": [ "!arm", "!x64", "!arm64", ] }, "sha512-t6N46NlPuXiY3rlmG6/+1nwebOBOaLFOOVqNQOC2cJhghOD4hh2kHNQQTorCsbY9S1Kir2la1/XLBwOJfui0xg=="], - "sass-embedded-android-arm": ["sass-embedded-android-arm@1.93.3", "", { "os": "android", "cpu": "arm" }, "sha512-8xOw9bywfOD6Wv24BgCmgjkk6tMrsOTTHcb28KDxeJtFtoxiUyMbxo0vChpPAfp2Hyg2tFFKS60s0s4JYk+Raw=="], + "sass-embedded-android-arm": ["sass-embedded-android-arm@1.97.3", "", { "os": "android", "cpu": "arm" }, "sha512-cRTtf/KV/q0nzGZoUzVkeIVVFv3L/tS1w4WnlHapphsjTXF/duTxI8JOU1c/9GhRPiMdfeXH7vYNcMmtjwX7jg=="], - "sass-embedded-android-arm64": ["sass-embedded-android-arm64@1.93.3", "", { "os": "android", "cpu": "arm64" }, "sha512-uqUl3Kt1IqdGVAcAdbmC+NwuUJy8tM+2ZnB7/zrt6WxWVShVCRdFnWR9LT8HJr7eJN7AU8kSXxaVX/gedanPsg=="], + "sass-embedded-android-arm64": ["sass-embedded-android-arm64@1.97.3", "", { "os": "android", "cpu": "arm64" }, "sha512-aiZ6iqiHsUsaDx0EFbbmmA0QgxicSxVVN3lnJJ0f1RStY0DthUkquGT5RJ4TPdaZ6ebeJWkboV4bra+CP766eA=="], - "sass-embedded-android-riscv64": ["sass-embedded-android-riscv64@1.93.3", "", { "os": "android", "cpu": "none" }, "sha512-2jNJDmo+3qLocjWqYbXiBDnfgwrUeZgZFHJIwAefU7Fn66Ot7rsXl+XPwlokaCbTpj7eMFIqsRAZ/uDueXNCJg=="], + "sass-embedded-android-riscv64": ["sass-embedded-android-riscv64@1.97.3", "", { "os": "android", "cpu": "none" }, "sha512-zVEDgl9JJodofGHobaM/q6pNETG69uuBIGQHRo789jloESxxZe82lI3AWJQuPmYCOG5ElfRthqgv89h3gTeLYA=="], - "sass-embedded-android-x64": ["sass-embedded-android-x64@1.93.3", "", { "os": "android", "cpu": "x64" }, "sha512-y0RoAU6ZenQFcjM9PjQd3cRqRTjqwSbtWLL/p68y2oFyh0QGN0+LQ826fc0ZvU/AbqCsAizkqjzOn6cRZJxTTQ=="], + "sass-embedded-android-x64": ["sass-embedded-android-x64@1.97.3", "", { "os": "android", "cpu": "x64" }, "sha512-3ke0le7ZKepyXn/dKKspYkpBC0zUk/BMciyP5ajQUDy4qJwobd8zXdAq6kOkdiMB+d9UFJOmEkvgFJHl3lqwcw=="], - "sass-embedded-darwin-arm64": ["sass-embedded-darwin-arm64@1.93.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-7zb/hpdMOdKteK17BOyyypemglVURd1Hdz6QGsggy60aUFfptTLQftLRg8r/xh1RbQAUKWFbYTNaM47J9yPxYg=="], + "sass-embedded-darwin-arm64": ["sass-embedded-darwin-arm64@1.97.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-fuqMTqO4gbOmA/kC5b9y9xxNYw6zDEyfOtMgabS7Mz93wimSk2M1quQaTJnL98Mkcsl2j+7shNHxIS/qpcIDDA=="], - "sass-embedded-darwin-x64": ["sass-embedded-darwin-x64@1.93.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-Ek1Vp8ZDQEe327Lz0b7h3hjvWH3u9XjJiQzveq74RPpJQ2q6d9LfWpjiRRohM4qK6o4XOHw1X10OMWPXJtdtWg=="], + "sass-embedded-darwin-x64": ["sass-embedded-darwin-x64@1.97.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-b/2RBs/2bZpP8lMkyZ0Px0vkVkT8uBd0YXpOwK7iOwYkAT8SsO4+WdVwErsqC65vI5e1e5p1bb20tuwsoQBMVA=="], - "sass-embedded-linux-arm": ["sass-embedded-linux-arm@1.93.3", "", { "os": "linux", "cpu": "arm" }, "sha512-yeiv2y+dp8B4wNpd3+JsHYD0mvpXSfov7IGyQ1tMIR40qv+ROkRqYiqQvAOXf76Qwh4Y9OaYZtLpnsPjfeq6mA=="], + "sass-embedded-linux-arm": ["sass-embedded-linux-arm@1.97.3", "", { "os": "linux", "cpu": "arm" }, "sha512-2lPQ7HQQg4CKsH18FTsj2hbw5GJa6sBQgDsls+cV7buXlHjqF8iTKhAQViT6nrpLK/e8nFCoaRgSqEC8xMnXuA=="], - "sass-embedded-linux-arm64": ["sass-embedded-linux-arm64@1.93.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-RBrHWgfd8Dd8w4fbmdRVXRrhh8oBAPyeWDTKAWw8ZEmuXfVl4ytjDuyxaVilh6rR1xTRTNpbaA/YWApBlLrrNw=="], + "sass-embedded-linux-arm64": ["sass-embedded-linux-arm64@1.97.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-IP1+2otCT3DuV46ooxPaOKV1oL5rLjteRzf8ldZtfIEcwhSgSsHgA71CbjYgLEwMY9h4jeal8Jfv3QnedPvSjg=="], - "sass-embedded-linux-musl-arm": ["sass-embedded-linux-musl-arm@1.93.3", "", { "os": "linux", "cpu": "arm" }, "sha512-fU0fwAwbp7sBE3h5DVU5UPzvaLg7a4yONfFWkkcCp6ZrOiPuGRHXXYriWQ0TUnWy4wE+svsVuWhwWgvlb/tkKg=="], + "sass-embedded-linux-musl-arm": ["sass-embedded-linux-musl-arm@1.97.3", "", { "os": "linux", "cpu": "arm" }, "sha512-cBTMU68X2opBpoYsSZnI321gnoaiMBEtc+60CKCclN6PCL3W3uXm8g4TLoil1hDD6mqU9YYNlVG6sJ+ZNef6Lg=="], - "sass-embedded-linux-musl-arm64": ["sass-embedded-linux-musl-arm64@1.93.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-PS829l+eUng+9W4PFclXGb4uA2+965NHV3/Sa5U7qTywjeeUUYTZg70dJHSqvhrBEfCc2XJABeW3adLJbyQYkw=="], + "sass-embedded-linux-musl-arm64": ["sass-embedded-linux-musl-arm64@1.97.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-Lij0SdZCsr+mNRSyDZ7XtJpXEITrYsaGbOTz5e6uFLJ9bmzUbV7M8BXz2/cA7bhfpRPT7/lwRKPdV4+aR9Ozcw=="], - "sass-embedded-linux-musl-riscv64": ["sass-embedded-linux-musl-riscv64@1.93.3", "", { "os": "linux", "cpu": "none" }, "sha512-cK1oBY+FWQquaIGEeQ5H74KTO8cWsSWwXb/WaildOO9U6wmUypTgUYKQ0o5o/29nZbWWlM1PHuwVYTSnT23Jjg=="], + "sass-embedded-linux-musl-riscv64": ["sass-embedded-linux-musl-riscv64@1.97.3", "", { "os": "linux", "cpu": "none" }, "sha512-sBeLFIzMGshR4WmHAD4oIM7WJVkSoCIEwutzptFtGlSlwfNiijULp+J5hA2KteGvI6Gji35apR5aWj66wEn/iA=="], - "sass-embedded-linux-musl-x64": ["sass-embedded-linux-musl-x64@1.93.3", "", { "os": "linux", "cpu": "x64" }, "sha512-A7wkrsHu2/I4Zpa0NMuPGkWDVV7QGGytxGyUq3opSXgAexHo/vBPlGoDXoRlSdex0cV+aTMRPjoGIfdmNlHwyg=="], + "sass-embedded-linux-musl-x64": ["sass-embedded-linux-musl-x64@1.97.3", "", { "os": "linux", "cpu": "x64" }, "sha512-/oWJ+OVrDg7ADDQxRLC/4g1+Nsz1g4mkYS2t6XmyMJKFTFK50FVI2t5sOdFH+zmMp+nXHKM036W94y9m4jjEcw=="], - "sass-embedded-linux-riscv64": ["sass-embedded-linux-riscv64@1.93.3", "", { "os": "linux", "cpu": "none" }, "sha512-vWkW1+HTF5qcaHa6hO80gx/QfB6GGjJUP0xLbnAoY4pwEnw5ulGv6RM8qYr8IDhWfVt/KH+lhJ2ZFxnJareisQ=="], + "sass-embedded-linux-riscv64": ["sass-embedded-linux-riscv64@1.97.3", "", { "os": "linux", "cpu": "none" }, "sha512-l3IfySApLVYdNx0Kjm7Zehte1CDPZVcldma3dZt+TfzvlAEerM6YDgsk5XEj3L8eHBCgHgF4A0MJspHEo2WNfA=="], - "sass-embedded-linux-x64": ["sass-embedded-linux-x64@1.93.3", "", { "os": "linux", "cpu": "x64" }, "sha512-k6uFxs+e5jSuk1Y0niCwuq42F9ZC5UEP7P+RIOurIm8w/5QFa0+YqeW+BPWEW5M1FqVOsNZH3qGn4ahqvAEjPA=="], + "sass-embedded-linux-x64": ["sass-embedded-linux-x64@1.97.3", "", { "os": "linux", "cpu": "x64" }, "sha512-Kwqwc/jSSlcpRjULAOVbndqEy2GBzo6OBmmuBVINWUaJLJ8Kczz3vIsDUWLfWz/kTEw9FHBSiL0WCtYLVAXSLg=="], - "sass-embedded-unknown-all": ["sass-embedded-unknown-all@1.93.3", "", { "dependencies": { "sass": "1.93.3" }, "os": [ "!linux", "!win32", "!darwin", "!android", ] }, "sha512-o5wj2rLpXH0C+GJKt/VpWp6AnMsCCbfFmnMAttcrsa+U3yrs/guhZ3x55KAqqUsE8F47e3frbsDL+1OuQM5DAA=="], + "sass-embedded-unknown-all": ["sass-embedded-unknown-all@1.97.3", "", { "dependencies": { "sass": "1.97.3" }, "os": [ "!linux", "!win32", "!darwin", "!android", ] }, "sha512-/GHajyYJmvb0IABUQHbVHf1nuHPtIDo/ClMZ81IDr59wT5CNcMe7/dMNujXwWugtQVGI5UGmqXWZQCeoGnct8Q=="], - "sass-embedded-win32-arm64": ["sass-embedded-win32-arm64@1.93.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-0dOfT9moy9YmBolodwYYXtLwNr4jL4HQC9rBfv6mVrD7ud8ue2kDbn+GVzj1hEJxvEexVSmDCf7MHUTLcGs9xQ=="], + "sass-embedded-win32-arm64": ["sass-embedded-win32-arm64@1.97.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-RDGtRS1GVvQfMGAmVXNxYiUOvPzn9oO1zYB/XUM9fudDRnieYTcUytpNTQZLs6Y1KfJxgt5Y+giRceC92fT8Uw=="], - "sass-embedded-win32-x64": ["sass-embedded-win32-x64@1.93.3", "", { "os": "win32", "cpu": "x64" }, "sha512-wHFVfxiS9hU/sNk7KReD+lJWRp3R0SLQEX4zfOnRP2zlvI2X4IQR5aZr9GNcuMP6TmNpX0nQPZTegS8+h9RrEg=="], + "sass-embedded-win32-x64": ["sass-embedded-win32-x64@1.97.3", "", { "os": "win32", "cpu": "x64" }, "sha512-SFRa2lED9UEwV6vIGeBXeBOLKF+rowF3WmNfb/BzhxmdAsKofCXrJ8ePW7OcDVrvNEbTOGwhsReIsF5sH8fVaw=="], - "sax": ["sax@1.4.1", "", {}, "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg=="], + "sax": ["sax@1.5.0", "", {}, "sha512-21IYA3Q5cQf089Z6tgaUTr7lDAyzoTPx5HRtbhsME8Udispad8dC/+sziTNugOEx54ilvatQ9YCzl4KQLPcRHA=="], - "semver": ["semver@7.7.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q=="], + "semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], "sharp": ["sharp@0.34.5", "", { "dependencies": { "@img/colour": "^1.0.0", "detect-libc": "^2.1.2", "semver": "^7.7.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.34.5", "@img/sharp-darwin-x64": "0.34.5", "@img/sharp-libvips-darwin-arm64": "1.2.4", "@img/sharp-libvips-darwin-x64": "1.2.4", "@img/sharp-libvips-linux-arm": "1.2.4", "@img/sharp-libvips-linux-arm64": "1.2.4", "@img/sharp-libvips-linux-ppc64": "1.2.4", "@img/sharp-libvips-linux-riscv64": "1.2.4", "@img/sharp-libvips-linux-s390x": "1.2.4", "@img/sharp-libvips-linux-x64": "1.2.4", "@img/sharp-libvips-linuxmusl-arm64": "1.2.4", "@img/sharp-libvips-linuxmusl-x64": "1.2.4", "@img/sharp-linux-arm": "0.34.5", "@img/sharp-linux-arm64": "0.34.5", "@img/sharp-linux-ppc64": "0.34.5", "@img/sharp-linux-riscv64": "0.34.5", "@img/sharp-linux-s390x": "0.34.5", "@img/sharp-linux-x64": "0.34.5", "@img/sharp-linuxmusl-arm64": "0.34.5", "@img/sharp-linuxmusl-x64": "0.34.5", "@img/sharp-wasm32": "0.34.5", "@img/sharp-win32-arm64": "0.34.5", "@img/sharp-win32-ia32": "0.34.5", "@img/sharp-win32-x64": "0.34.5" } }, "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg=="], @@ -1173,27 +1169,19 @@ "smtp-address-parser": ["smtp-address-parser@1.0.10", "", { "dependencies": { "nearley": "^2.20.1" } }, "sha512-Osg9LmvGeAG/hyao4mldbflLOkkr3a+h4m1lwKCK5U8M6ZAr7tdXEz/+/vr752TSGE4MNUlUl9cIK2cB8cgzXg=="], - "source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], - "source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="], - "source-map-support": ["source-map-support@0.5.21", "", { "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w=="], - "space-separated-tokens": ["space-separated-tokens@2.0.2", "", {}, "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q=="], - "speakingurl": ["speakingurl@14.0.1", "", {}, "sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ=="], - "string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="], "stringify-entities": ["stringify-entities@4.0.4", "", { "dependencies": { "character-entities-html4": "^2.0.0", "character-entities-legacy": "^3.0.0" } }, "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg=="], - "strip-ansi": ["strip-ansi@7.1.0", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ=="], + "strip-ansi": ["strip-ansi@7.2.0", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="], "strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], - "style-mod": ["style-mod@4.1.2", "", {}, "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw=="], - - "superjson": ["superjson@2.2.2", "", { "dependencies": { "copy-anything": "^3.0.2" } }, "sha512-5JRxVqC8I8NuOUjzBbvVJAKNM8qoVuH0O77h4WInc/qC2q5IreqKxYwgkga3PfA22OayK2ikceb/B26dztPl+Q=="], + "style-mod": ["style-mod@4.1.3", "", {}, "sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ=="], "supports-color": ["supports-color@8.1.1", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="], @@ -1201,14 +1189,12 @@ "sync-child-process": ["sync-child-process@1.0.2", "", { "dependencies": { "sync-message-port": "^1.0.0" } }, "sha512-8lD+t2KrrScJ/7KXCSyfhT3/hRq78rC0wBFqNJXv3mZyn6hW2ypM05JmlSvtqRbeq6jqA94oHbxAr2vYsJ8vDA=="], - "sync-message-port": ["sync-message-port@1.1.3", "", {}, "sha512-GTt8rSKje5FilG+wEdfCkOcLL7LWqpMlr2c3LRuKt/YXxcJ52aGSbGBAdI4L3aaqfrBt6y711El53ItyH1NWzg=="], + "sync-message-port": ["sync-message-port@1.2.0", "", {}, "sha512-gAQ9qrUN/UCypHtGFbbe7Rc/f9bzO88IwrG8TDo/aMKAApKyD6E3W4Cm0EfhfBb6Z6SKt59tTCTfD+n1xmAvMg=="], - "synckit": ["synckit@0.11.8", "", { "dependencies": { "@pkgr/core": "^0.2.4" } }, "sha512-+XZ+r1XGIJGeQk3VvXhT6xx/VpbHsRzsTkGgF6E5RX9TTXD0118l87puaEBZ566FhqblC6U0d4XnubznJDm30A=="], + "synckit": ["synckit@0.11.12", "", { "dependencies": { "@pkgr/core": "^0.2.9" } }, "sha512-Bh7QjT8/SuKUIfObSXNHNSK6WHo6J1tHCqJsuaFDP7gP0fkzSfTxI8y85JrppZ0h8l0maIgc2tfuZQ6/t3GtnQ=="], "tar": ["tar@6.2.1", "", { "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" } }, "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A=="], - "terser": ["terser@5.44.0", "", { "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.15.0", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, "bin": { "terser": "bin/terser" } }, "sha512-nIVck8DK+GM/0Frwd+nIhZ84pR/BX7rmXMfYwyg+Sri5oGVE99/E3KvXqpC2xHFxyqXyGHTKBSioxxplrO4I4w=="], - "tinyglobby": ["tinyglobby@0.2.15", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.3" } }, "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ=="], "to-regex-range": ["to-regex-range@5.0.1", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="], @@ -1217,7 +1203,7 @@ "trim-lines": ["trim-lines@3.0.1", "", {}, "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg=="], - "ts-api-utils": ["ts-api-utils@2.1.0", "", { "peerDependencies": { "typescript": ">=4.8.4" } }, "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ=="], + "ts-api-utils": ["ts-api-utils@2.4.0", "", { "peerDependencies": { "typescript": ">=4.8.4" } }, "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA=="], "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], @@ -1225,11 +1211,11 @@ "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], - "typescript-eslint": ["typescript-eslint@8.36.0", "", { "dependencies": { "@typescript-eslint/eslint-plugin": "8.36.0", "@typescript-eslint/parser": "8.36.0", "@typescript-eslint/utils": "8.36.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-fTCqxthY+h9QbEgSIBfL9iV6CvKDFuoxg6bHPNpJ9HIUzS+jy2lCEyCmGyZRWEBSaykqcDPf1SJ+BfCI8DRopA=="], + "typescript-eslint": ["typescript-eslint@8.56.1", "", { "dependencies": { "@typescript-eslint/eslint-plugin": "8.56.1", "@typescript-eslint/parser": "8.56.1", "@typescript-eslint/typescript-estree": "8.56.1", "@typescript-eslint/utils": "8.56.1" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-U4lM6pjmBX7J5wk4szltF7I1cGBHXZopnAXCMXb3+fZ3B/0Z3hq3wS/CCUB2NZBNAExK92mCU2tEohWuwVMsDQ=="], "uc.micro": ["uc.micro@2.1.0", "", {}, "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A=="], - "ufo": ["ufo@1.6.1", "", {}, "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA=="], + "ufo": ["ufo@1.6.3", "", {}, "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q=="], "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="], @@ -1239,17 +1225,17 @@ "unist-util-stringify-position": ["unist-util-stringify-position@4.0.0", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ=="], - "unist-util-visit": ["unist-util-visit@5.0.0", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg=="], + "unist-util-visit": ["unist-util-visit@5.1.0", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg=="], "unist-util-visit-parents": ["unist-util-visit-parents@6.0.2", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0" } }, "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ=="], - "unplugin": ["unplugin@2.3.10", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "acorn": "^8.15.0", "picomatch": "^4.0.3", "webpack-virtual-modules": "^0.6.2" } }, "sha512-6NCPkv1ClwH+/BGE9QeoTIl09nuiAt0gS28nn1PvYXsGKRwM2TCbFA2QiilmehPDTXIe684k4rZI1yl3A1PCUw=="], + "unplugin": ["unplugin@2.3.11", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "acorn": "^8.15.0", "picomatch": "^4.0.3", "webpack-virtual-modules": "^0.6.2" } }, "sha512-5uKD0nqiYVzlmCRs01Fhs2BdkEgBS3SAVP6ndrBsuK42iC2+JHyxM05Rm9G8+5mkmRtzMZGY8Ct5+mliZxU/Ww=="], "unplugin-utils": ["unplugin-utils@0.3.1", "", { "dependencies": { "pathe": "^2.0.3", "picomatch": "^4.0.3" } }, "sha512-5lWVjgi6vuHhJ526bI4nlCOmkCIF3nnfXkCMDeMJrtdvxTs6ZFCM8oNufGTsDbKv/tJ/xj8RpvXjRuPBZJuJog=="], "unplugin-vue-components": ["unplugin-vue-components@30.0.0", "", { "dependencies": { "chokidar": "^4.0.3", "debug": "^4.4.3", "local-pkg": "^1.1.2", "magic-string": "^0.30.19", "mlly": "^1.8.0", "tinyglobby": "^0.2.15", "unplugin": "^2.3.10", "unplugin-utils": "^0.3.1" }, "peerDependencies": { "@babel/parser": "^7.15.8", "@nuxt/kit": "^3.2.2 || ^4.0.0", "vue": "2 || 3" }, "optionalPeers": ["@babel/parser", "@nuxt/kit"] }, "sha512-4qVE/lwCgmdPTp6h0qsRN2u642tt4boBQtcpn4wQcWZAsr8TQwq+SPT3NDu/6kBFxzo/sSEK4ioXhOOBrXc3iw=="], - "update-browserslist-db": ["update-browserslist-db@1.1.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw=="], + "update-browserslist-db": ["update-browserslist-db@1.2.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w=="], "uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="], @@ -1263,7 +1249,7 @@ "vfile-message": ["vfile-message@4.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw=="], - "vite": ["vite@7.2.6", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-tI2l/nFHC5rLh7+5+o7QjKjSR04ivXDF4jcgV0f/bTQ+OJiITy5S6gaynVsEM+7RqzufMnVbIon6Sr5x1SDYaQ=="], + "vite": ["vite@7.3.1", "", { "dependencies": { "esbuild": "^0.27.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA=="], "vite-dev-rpc": ["vite-dev-rpc@1.1.0", "", { "dependencies": { "birpc": "^2.4.0", "vite-hot-client": "^2.1.0" }, "peerDependencies": { "vite": "^2.9.0 || ^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0 || ^6.0.1 || ^7.0.0-0" } }, "sha512-pKXZlgoXGoE8sEKiKJSng4hI1sQ4wi5YT24FCrwrLt6opmkjlqPPVmiPWWJn8M8byMxRGzp1CrFuqQs4M/Z39A=="], @@ -1277,7 +1263,7 @@ "vite-plugin-inspect": ["vite-plugin-inspect@11.3.3", "", { "dependencies": { "ansis": "^4.1.0", "debug": "^4.4.1", "error-stack-parser-es": "^1.0.5", "ohash": "^2.0.11", "open": "^10.2.0", "perfect-debounce": "^2.0.0", "sirv": "^3.0.1", "unplugin-utils": "^0.3.0", "vite-dev-rpc": "^1.1.0" }, "peerDependencies": { "vite": "^6.0.0 || ^7.0.0-0" } }, "sha512-u2eV5La99oHoYPHE6UvbwgEqKKOQGz86wMg40CCosP6q8BkB6e5xPneZfYagK4ojPJSj5anHCrnvC20DpwVdRA=="], - "vite-plugin-vue-devtools": ["vite-plugin-vue-devtools@8.0.5", "", { "dependencies": { "@vue/devtools-core": "^8.0.5", "@vue/devtools-kit": "^8.0.5", "@vue/devtools-shared": "^8.0.5", "sirv": "^3.0.2", "vite-plugin-inspect": "^11.3.3", "vite-plugin-vue-inspector": "^5.3.2" }, "peerDependencies": { "vite": "^6.0.0 || ^7.0.0-0" } }, "sha512-p619BlKFOqQXJ6uDWS1vUPQzuJOD6xJTfftj57JXBGoBD/yeQCowR7pnWcr/FEX4/HVkFbreI6w2uuGBmQOh6A=="], + "vite-plugin-vue-devtools": ["vite-plugin-vue-devtools@8.0.7", "", { "dependencies": { "@vue/devtools-core": "^8.0.7", "@vue/devtools-kit": "^8.0.7", "@vue/devtools-shared": "^8.0.7", "sirv": "^3.0.2", "vite-plugin-inspect": "^11.3.3", "vite-plugin-vue-inspector": "^5.3.2" }, "peerDependencies": { "vite": "^6.0.0 || ^7.0.0-0 || ^8.0.0-0" } }, "sha512-BWj/ykGpqVAJVdPyHmSTUm44buz3jPv+6jnvuFdQSRH0kAgP1cEIE4doHiFyqHXOmuB5EQVR/nh2g9YRiRNs9g=="], "vite-plugin-vue-inspector": ["vite-plugin-vue-inspector@5.3.2", "", { "dependencies": { "@babel/core": "^7.23.0", "@babel/plugin-proposal-decorators": "^7.23.0", "@babel/plugin-syntax-import-attributes": "^7.22.5", "@babel/plugin-syntax-import-meta": "^7.10.4", "@babel/plugin-transform-typescript": "^7.22.15", "@vue/babel-plugin-jsx": "^1.1.5", "@vue/compiler-dom": "^3.3.4", "kolorist": "^1.8.0", "magic-string": "^0.30.4" }, "peerDependencies": { "vite": "^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0 || ^6.0.0-0 || ^7.0.0-0" } }, "sha512-YvEKooQcSiBTAs0DoYLfefNja9bLgkFM7NI2b07bE2SruuvX0MEa9cMaxjKVMkeCp5Nz9FRIdcN1rOdFVBeL6Q=="], @@ -1293,23 +1279,23 @@ "vscode-uri": ["vscode-uri@3.1.0", "", {}, "sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ=="], - "vue": ["vue@3.5.25", "", { "dependencies": { "@vue/compiler-dom": "3.5.25", "@vue/compiler-sfc": "3.5.25", "@vue/runtime-dom": "3.5.25", "@vue/server-renderer": "3.5.25", "@vue/shared": "3.5.25" }, "peerDependencies": { "typescript": "*" }, "optionalPeers": ["typescript"] }, "sha512-YLVdgv2K13WJ6n+kD5owehKtEXwdwXuj2TTyJMsO7pSeKw2bfRNZGjhB7YzrpbMYj5b5QsUebHpOqR3R3ziy/g=="], + "vue": ["vue@3.5.29", "", { "dependencies": { "@vue/compiler-dom": "3.5.29", "@vue/compiler-sfc": "3.5.29", "@vue/runtime-dom": "3.5.29", "@vue/server-renderer": "3.5.29", "@vue/shared": "3.5.29" }, "peerDependencies": { "typescript": "*" }, "optionalPeers": ["typescript"] }, "sha512-BZqN4Ze6mDQVNAni0IHeMJ5mwr8VAJ3MQC9FmprRhcBYENw+wOAAjRj8jfmN6FLl0j96OXbR+CjWhmAmM+QGnA=="], - "vue-codemirror6": ["vue-codemirror6@1.4.1", "", { "dependencies": { "vue-demi": "latest" }, "peerDependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/commands": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/lint": "^6.0.0", "@codemirror/search": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", "codemirror": "^6.0.0", "style-mod": "^4.0.0", "vue": "^2.7.14 || ^3.3.4" } }, "sha512-mokK4q89TvxtGXzdEv3YyvfX3RJJs7VxyNjBNpdNbP+jpum/ttLvWB+TEh/ziVZq5mFrQazVPCfUV8TVI/Ji2A=="], + "vue-codemirror6": ["vue-codemirror6@1.4.2", "", { "dependencies": { "vue-demi": "latest" }, "peerDependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/commands": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/lint": "^6.0.0", "@codemirror/search": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", "codemirror": "^6.0.0", "style-mod": "^4.0.0", "vue": "^2.7.14 || ^3.3.4" } }, "sha512-dD8PhKnZ8FiiorQk405oxN3DX4B0IMCyqHRtBpMNjrNmcvJYAqhj0IoJxR+Nx9Xgmt6UQKDn+1OJW3MDV5sbMA=="], "vue-demi": ["vue-demi@0.14.10", "", { "peerDependencies": { "@vue/composition-api": "^1.0.0-rc.1", "vue": "^3.0.0-0 || ^2.6.0" }, "optionalPeers": ["@vue/composition-api"], "bin": { "vue-demi-fix": "bin/vue-demi-fix.js", "vue-demi-switch": "bin/vue-demi-switch.js" } }, "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg=="], - "vue-eslint-parser": ["vue-eslint-parser@10.2.0", "", { "dependencies": { "debug": "^4.4.0", "eslint-scope": "^8.2.0", "eslint-visitor-keys": "^4.2.0", "espree": "^10.3.0", "esquery": "^1.6.0", "semver": "^7.6.3" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0" } }, "sha512-CydUvFOQKD928UzZhTp4pr2vWz1L+H99t7Pkln2QSPdvmURT0MoC4wUccfCnuEaihNsu9aYYyk+bep8rlfkUXw=="], + "vue-eslint-parser": ["vue-eslint-parser@10.4.0", "", { "dependencies": { "debug": "^4.4.0", "eslint-scope": "^8.2.0 || ^9.0.0", "eslint-visitor-keys": "^4.2.0 || ^5.0.0", "espree": "^10.3.0 || ^11.0.0", "esquery": "^1.6.0", "semver": "^7.6.3" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0" } }, "sha512-Vxi9pJdbN3ZnVGLODVtZ7y4Y2kzAAE2Cm0CZ3ZDRvydVYxZ6VrnBhLikBsRS+dpwj4Jv4UCv21PTEwF5rQ9WXg=="], - "vue-router": ["vue-router@4.6.3", "", { "dependencies": { "@vue/devtools-api": "^6.6.4" }, "peerDependencies": { "vue": "^3.5.0" } }, "sha512-ARBedLm9YlbvQomnmq91Os7ck6efydTSpRP3nuOKCvgJOHNrhRoJDSKtee8kcL1Vf7nz6U+PMBL+hTvR3bTVQg=="], + "vue-router": ["vue-router@4.6.4", "", { "dependencies": { "@vue/devtools-api": "^6.6.4" }, "peerDependencies": { "vue": "^3.5.0" } }, "sha512-Hz9q5sa33Yhduglwz6g9skT8OBPii+4bFn88w6J+J4MfEo4KRRpmiNG/hHHkdbRFlLBOqxN8y8gf2Fb0MTUgVg=="], - "vue-tsc": ["vue-tsc@3.1.5", "", { "dependencies": { "@volar/typescript": "2.4.23", "@vue/language-core": "3.1.5" }, "peerDependencies": { "typescript": ">=5.0.0" }, "bin": { "vue-tsc": "./bin/vue-tsc.js" } }, "sha512-L/G9IUjOWhBU0yun89rv8fKqmKC+T0HfhrFjlIml71WpfBv9eb4E9Bev8FMbyueBIU9vxQqbd+oOsVcDa5amGw=="], + "vue-tsc": ["vue-tsc@3.2.5", "", { "dependencies": { "@volar/typescript": "2.4.28", "@vue/language-core": "3.2.5" }, "peerDependencies": { "typescript": ">=5.0.0" }, "bin": { "vue-tsc": "bin/vue-tsc.js" } }, "sha512-/htfTCMluQ+P2FISGAooul8kO4JMheOTCbCy4M6dYnYYjqLe3BExZudAua6MSIKSFYQtFOYAll7XobYwcpokGA=="], "w3c-keyname": ["w3c-keyname@2.2.8", "", {}, "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ=="], "wasm-pack": ["wasm-pack@0.13.1", "", { "dependencies": { "binary-install": "^1.0.1" }, "bin": { "wasm-pack": "run.js" } }, "sha512-P9exD4YkjpDbw68xUhF3MDm/CC/3eTmmthyG5bHJ56kalxOTewOunxTke4SyF8MTXV6jUtNjXggPgrGmMtczGg=="], - "watchpack": ["watchpack@2.4.4", "", { "dependencies": { "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.1.2" } }, "sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA=="], + "watchpack": ["watchpack@2.5.1", "", { "dependencies": { "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.1.2" } }, "sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg=="], "webpack-virtual-modules": ["webpack-virtual-modules@0.6.2", "", {}, "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ=="], @@ -1317,7 +1303,7 @@ "word-wrap": ["word-wrap@1.2.5", "", {}, "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA=="], - "wrap-ansi": ["wrap-ansi@9.0.0", "", { "dependencies": { "ansi-styles": "^6.2.1", "string-width": "^7.0.0", "strip-ansi": "^7.1.0" } }, "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q=="], + "wrap-ansi": ["wrap-ansi@9.0.2", "", { "dependencies": { "ansi-styles": "^6.2.1", "string-width": "^7.0.0", "strip-ansi": "^7.1.0" } }, "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww=="], "wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="], @@ -1331,7 +1317,7 @@ "yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="], - "yaml": ["yaml@2.8.1", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw=="], + "yaml": ["yaml@2.8.2", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A=="], "yargs": ["yargs@18.0.0", "", { "dependencies": { "cliui": "^9.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "string-width": "^7.2.0", "y18n": "^5.0.5", "yargs-parser": "^22.0.0" } }, "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg=="], @@ -1341,113 +1327,35 @@ "zwitch": ["zwitch@2.0.4", "", {}, "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A=="], - "@babel/core/@babel/parser": ["@babel/parser@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.0" }, "bin": "./bin/babel-parser.js" }, "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g=="], - - "@babel/core/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/core/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], - "@babel/core/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], - "@babel/generator/@babel/parser": ["@babel/parser@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.0" }, "bin": "./bin/babel-parser.js" }, "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g=="], - - "@babel/generator/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/helper-annotate-as-pure/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - "@babel/helper-compilation-targets/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], "@babel/helper-create-class-features-plugin/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], - "@babel/helper-member-expression-to-functions/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/helper-module-imports/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/helper-optimise-call-expression/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/helper-skip-transparent-expression-wrappers/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/helpers/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/template/@babel/parser": ["@babel/parser@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.0" }, "bin": "./bin/babel-parser.js" }, "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g=="], - - "@babel/template/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/traverse/@babel/parser": ["@babel/parser@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.0" }, "bin": "./bin/babel-parser.js" }, "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g=="], - - "@babel/traverse/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/traverse/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], - - "@codemirror/autocomplete/@codemirror/language": ["@codemirror/language@6.11.2", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.1.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-p44TsNArL4IVXDTbapUmEkAlvWs2CFQbcfc0ymDsis1kH2wh0gcY96AS29c/vp2d0y2Tquk1EDSaawpzilUiAw=="], - - "@codemirror/commands/@codemirror/language": ["@codemirror/language@6.11.2", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.1.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-p44TsNArL4IVXDTbapUmEkAlvWs2CFQbcfc0ymDsis1kH2wh0gcY96AS29c/vp2d0y2Tquk1EDSaawpzilUiAw=="], - - "@codemirror/lang-yaml/@codemirror/language": ["@codemirror/language@6.11.2", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.1.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-p44TsNArL4IVXDTbapUmEkAlvWs2CFQbcfc0ymDsis1kH2wh0gcY96AS29c/vp2d0y2Tquk1EDSaawpzilUiAw=="], - "@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], - "@eslint/eslintrc/ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="], - - "@eslint/eslintrc/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], + "@eslint/eslintrc/ajv": ["ajv@6.14.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw=="], "@eslint/eslintrc/globals": ["globals@14.0.0", "", {}, "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ=="], - "@eslint/eslintrc/js-yaml": ["js-yaml@4.1.0", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA=="], - - "@humanfs/node/@humanwhocodes/retry": ["@humanwhocodes/retry@0.3.1", "", {}, "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA=="], - - "@jridgewell/gen-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.4", "", {}, "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw=="], - - "@jridgewell/trace-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.4", "", {}, "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw=="], - - "@parcel/watcher/detect-libc": ["detect-libc@1.0.3", "", { "bin": { "detect-libc": "./bin/detect-libc.js" } }, "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg=="], - "@typescript-eslint/eslint-plugin/ignore": ["ignore@7.0.5", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="], - "@typescript-eslint/parser/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], - - "@typescript-eslint/project-service/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], + "@typescript-eslint/typescript-estree/minimatch": ["minimatch@10.2.4", "", { "dependencies": { "brace-expansion": "^5.0.2" } }, "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg=="], - "@typescript-eslint/type-utils/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], + "@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@5.0.1", "", {}, "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA=="], - "@typescript-eslint/typescript-estree/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], - - "@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="], - - "@typescript-eslint/typescript-estree/semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], - - "@typescript-eslint/utils/@eslint-community/eslint-utils": ["@eslint-community/eslint-utils@4.7.0", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw=="], - - "@vue/babel-plugin-jsx/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@vue/babel-plugin-jsx/@vue/shared": ["@vue/shared@3.5.17", "", {}, "sha512-CabR+UN630VnsJO/jHWYBC1YVXyMq94KKp6iF5MQgZJs5I8cmjw6oVMO1oDbtBkENSHSSn/UadWlW/OAgdmKrg=="], - - "@vue/babel-plugin-resolve-type/@babel/parser": ["@babel/parser@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.0" }, "bin": "./bin/babel-parser.js" }, "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g=="], - - "@vue/babel-plugin-resolve-type/@vue/compiler-sfc": ["@vue/compiler-sfc@3.5.17", "", { "dependencies": { "@babel/parser": "^7.27.5", "@vue/compiler-core": "3.5.17", "@vue/compiler-dom": "3.5.17", "@vue/compiler-ssr": "3.5.17", "@vue/shared": "3.5.17", "estree-walker": "^2.0.2", "magic-string": "^0.30.17", "postcss": "^8.5.6", "source-map-js": "^1.2.1" } }, "sha512-rQQxbRJMgTqwRugtjw0cnyQv9cP4/4BxWfTdRBkqsTfLOHWykLzbOc3C4GGzAmdMDxhzU/1Ija5bTjMVrddqww=="], - - "@vue/compiler-core/@babel/parser": ["@babel/parser@7.28.5", "", { "dependencies": { "@babel/types": "^7.28.5" }, "bin": "./bin/babel-parser.js" }, "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ=="], - - "@vue/compiler-sfc/@babel/parser": ["@babel/parser@7.28.5", "", { "dependencies": { "@babel/types": "^7.28.5" }, "bin": "./bin/babel-parser.js" }, "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ=="], - - "@vue/compiler-sfc/magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="], - - "@vue/devtools-core/nanoid": ["nanoid@5.1.5", "", { "bin": { "nanoid": "bin/nanoid.js" } }, "sha512-Ir/+ZpE9fDsNH0hQ3C68uyThDXzYcim2EqcZ8zn8Chtt1iylPT9xXJB0kPCnqzgcEGikO9RxSrh63MsmVCU7Fw=="], - - "@vue/language-core/picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], + "@vue/compiler-core/entities": ["entities@7.0.1", "", {}, "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA=="], "chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], "chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], - "codemirror/@codemirror/language": ["@codemirror/language@6.11.2", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.1.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-p44TsNArL4IVXDTbapUmEkAlvWs2CFQbcfc0ymDsis1kH2wh0gcY96AS29c/vp2d0y2Tquk1EDSaawpzilUiAw=="], - "cross-spawn/which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], "csso/css-tree": ["css-tree@2.2.1", "", { "dependencies": { "mdn-data": "2.0.28", "source-map-js": "^1.0.1" } }, "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA=="], - "eslint/ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="], + "eslint/ajv": ["ajv@6.14.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw=="], "fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], @@ -1463,63 +1371,13 @@ "mlly/pkg-types": ["pkg-types@1.3.1", "", { "dependencies": { "confbox": "^0.1.8", "mlly": "^1.7.4", "pathe": "^2.0.1" } }, "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ=="], - "monaco-yaml/prettier": ["prettier@3.6.2", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ=="], - "nearley/commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="], "prettier-plugin-vue/prettier": ["prettier@2.8.8", "", { "bin": { "prettier": "bin-prettier.js" } }, "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q=="], - "terser/commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="], - - "tinyglobby/picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], - - "unplugin/picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], - - "unplugin-utils/picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], - - "vite/picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], - - "vite-dev-rpc/birpc": ["birpc@2.5.0", "", {}, "sha512-VSWO/W6nNQdyP520F1mhf+Lc2f8pjGQOtoHHm7Ze8Go1kX7akpVIrtTa0fn+HB0QJEDVacl6aO08YE0PgXfdnQ=="], - - "vite-node/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], - - "vite-node/vite": ["vite@7.0.3", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.6", "picomatch": "^4.0.2", "postcss": "^8.5.6", "rollup": "^4.40.0", "tinyglobby": "^0.2.14" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-y2L5oJZF7bj4c0jgGYgBNSdIu+5HF+m68rn2cQXFbGoShdhV1phX9rbnxy9YXj82aS8MMsCLAAFkRxZeWdldrQ=="], - - "vite-plugin-inspect/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], - - "vite-plugin-inspect/sirv": ["sirv@3.0.1", "", { "dependencies": { "@polka/url": "^1.0.0-next.24", "mrmime": "^2.0.0", "totalist": "^3.0.0" } }, "sha512-FoqMu0NCGBLCcAkS1qA+XJIQTR6/JHfQXl+uGteNCQ76T91DMUjPa9xfmeqMY3z80nLSg9yQmNjK0Px6RWsH/A=="], - - "vite-plugin-inspect/unplugin-utils": ["unplugin-utils@0.3.0", "", { "dependencies": { "pathe": "^2.0.3", "picomatch": "^4.0.3" } }, "sha512-JLoggz+PvLVMJo+jZt97hdIIIZ2yTzGgft9e9q8iMrC4ewufl62ekeW7mixBghonn2gVb/ICjyvlmOCUBnJLQg=="], - - "vite-plugin-vue-inspector/@vue/compiler-dom": ["@vue/compiler-dom@3.5.17", "", { "dependencies": { "@vue/compiler-core": "3.5.17", "@vue/shared": "3.5.17" } }, "sha512-+2UgfLKoaNLhgfhV5Ihnk6wB4ljyW1/7wUIog2puUqajiC29Lp5R/IKDdkebh9jTbTogTbsgB+OY9cEWzG95JQ=="], - - "vite-plugin-vue-inspector/magic-string": ["magic-string@0.30.17", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0" } }, "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA=="], - - "vue-eslint-parser/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], - - "vue-eslint-parser/semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], - "@eslint/eslintrc/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], - "@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@2.0.2", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="], - - "@typescript-eslint/utils/@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], - - "@vue/babel-plugin-resolve-type/@babel/parser/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@vue/babel-plugin-resolve-type/@vue/compiler-sfc/@vue/compiler-core": ["@vue/compiler-core@3.5.17", "", { "dependencies": { "@babel/parser": "^7.27.5", "@vue/shared": "3.5.17", "entities": "^4.5.0", "estree-walker": "^2.0.2", "source-map-js": "^1.2.1" } }, "sha512-Xe+AittLbAyV0pabcN7cP7/BenRBNcteM4aSDCtRvGw0d9OL+HG1u/XHLY/kt1q4fyMeZYXyIYrsHuPSiDPosA=="], - - "@vue/babel-plugin-resolve-type/@vue/compiler-sfc/@vue/compiler-dom": ["@vue/compiler-dom@3.5.17", "", { "dependencies": { "@vue/compiler-core": "3.5.17", "@vue/shared": "3.5.17" } }, "sha512-+2UgfLKoaNLhgfhV5Ihnk6wB4ljyW1/7wUIog2puUqajiC29Lp5R/IKDdkebh9jTbTogTbsgB+OY9cEWzG95JQ=="], - - "@vue/babel-plugin-resolve-type/@vue/compiler-sfc/@vue/compiler-ssr": ["@vue/compiler-ssr@3.5.17", "", { "dependencies": { "@vue/compiler-dom": "3.5.17", "@vue/shared": "3.5.17" } }, "sha512-hkDbA0Q20ZzGgpj5uZjb9rBzQtIHLS78mMilwrlpWk2Ep37DYntUz0PonQ6kr113vfOEdM+zTBuJDaceNIW0tQ=="], - - "@vue/babel-plugin-resolve-type/@vue/compiler-sfc/@vue/shared": ["@vue/shared@3.5.17", "", {}, "sha512-CabR+UN630VnsJO/jHWYBC1YVXyMq94KKp6iF5MQgZJs5I8cmjw6oVMO1oDbtBkENSHSSn/UadWlW/OAgdmKrg=="], - - "@vue/babel-plugin-resolve-type/@vue/compiler-sfc/magic-string": ["magic-string@0.30.17", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0" } }, "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA=="], - - "@vue/compiler-core/@babel/parser/@babel/types": ["@babel/types@7.28.5", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="], - - "@vue/compiler-sfc/@babel/parser/@babel/types": ["@babel/types@7.28.5", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="], + "@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@5.0.4", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg=="], "cross-spawn/which/isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="], @@ -1529,82 +1387,6 @@ "mlly/pkg-types/confbox": ["confbox@0.1.8", "", {}, "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w=="], - "mlly/pkg-types/mlly": ["mlly@1.7.4", "", { "dependencies": { "acorn": "^8.14.0", "pathe": "^2.0.1", "pkg-types": "^1.3.0", "ufo": "^1.5.4" } }, "sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw=="], - - "vite-node/vite/esbuild": ["esbuild@0.25.6", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.6", "@esbuild/android-arm": "0.25.6", "@esbuild/android-arm64": "0.25.6", "@esbuild/android-x64": "0.25.6", "@esbuild/darwin-arm64": "0.25.6", "@esbuild/darwin-x64": "0.25.6", "@esbuild/freebsd-arm64": "0.25.6", "@esbuild/freebsd-x64": "0.25.6", "@esbuild/linux-arm": "0.25.6", "@esbuild/linux-arm64": "0.25.6", "@esbuild/linux-ia32": "0.25.6", "@esbuild/linux-loong64": "0.25.6", "@esbuild/linux-mips64el": "0.25.6", "@esbuild/linux-ppc64": "0.25.6", "@esbuild/linux-riscv64": "0.25.6", "@esbuild/linux-s390x": "0.25.6", "@esbuild/linux-x64": "0.25.6", "@esbuild/netbsd-arm64": "0.25.6", "@esbuild/netbsd-x64": "0.25.6", "@esbuild/openbsd-arm64": "0.25.6", "@esbuild/openbsd-x64": "0.25.6", "@esbuild/openharmony-arm64": "0.25.6", "@esbuild/sunos-x64": "0.25.6", "@esbuild/win32-arm64": "0.25.6", "@esbuild/win32-ia32": "0.25.6", "@esbuild/win32-x64": "0.25.6" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-GVuzuUwtdsghE3ocJ9Bs8PNoF13HNQ5TXbEi2AhvVb8xU1Iwt9Fos9FEamfoee+u/TOsn7GUWc04lz46n2bbTg=="], - - "vite-node/vite/fdir": ["fdir@6.4.6", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w=="], - - "vite-node/vite/tinyglobby": ["tinyglobby@0.2.14", "", { "dependencies": { "fdir": "^6.4.4", "picomatch": "^4.0.2" } }, "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ=="], - - "vite-plugin-inspect/unplugin-utils/picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], - - "vite-plugin-vue-inspector/@vue/compiler-dom/@vue/compiler-core": ["@vue/compiler-core@3.5.17", "", { "dependencies": { "@babel/parser": "^7.27.5", "@vue/shared": "3.5.17", "entities": "^4.5.0", "estree-walker": "^2.0.2", "source-map-js": "^1.2.1" } }, "sha512-Xe+AittLbAyV0pabcN7cP7/BenRBNcteM4aSDCtRvGw0d9OL+HG1u/XHLY/kt1q4fyMeZYXyIYrsHuPSiDPosA=="], - - "vite-plugin-vue-inspector/@vue/compiler-dom/@vue/shared": ["@vue/shared@3.5.17", "", {}, "sha512-CabR+UN630VnsJO/jHWYBC1YVXyMq94KKp6iF5MQgZJs5I8cmjw6oVMO1oDbtBkENSHSSn/UadWlW/OAgdmKrg=="], - - "vite-plugin-vue-inspector/magic-string/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.4", "", {}, "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw=="], - - "@vue/babel-plugin-resolve-type/@vue/compiler-sfc/magic-string/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.4", "", {}, "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw=="], - - "@vue/compiler-core/@babel/parser/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], - - "@vue/compiler-sfc/@babel/parser/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], - - "vite-node/vite/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.6", "", { "os": "aix", "cpu": "ppc64" }, "sha512-ShbM/3XxwuxjFiuVBHA+d3j5dyac0aEVVq1oluIDf71hUw0aRF59dV/efUsIwFnR6m8JNM2FjZOzmaZ8yG61kw=="], - - "vite-node/vite/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.25.6", "", { "os": "android", "cpu": "arm" }, "sha512-S8ToEOVfg++AU/bHwdksHNnyLyVM+eMVAOf6yRKFitnwnbwwPNqKr3srzFRe7nzV69RQKb5DgchIX5pt3L53xg=="], - - "vite-node/vite/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.6", "", { "os": "android", "cpu": "arm64" }, "sha512-hd5zdUarsK6strW+3Wxi5qWws+rJhCCbMiC9QZyzoxfk5uHRIE8T287giQxzVpEvCwuJ9Qjg6bEjcRJcgfLqoA=="], - - "vite-node/vite/esbuild/@esbuild/android-x64": ["@esbuild/android-x64@0.25.6", "", { "os": "android", "cpu": "x64" }, "sha512-0Z7KpHSr3VBIO9A/1wcT3NTy7EB4oNC4upJ5ye3R7taCc2GUdeynSLArnon5G8scPwaU866d3H4BCrE5xLW25A=="], - - "vite-node/vite/esbuild/@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-FFCssz3XBavjxcFxKsGy2DYK5VSvJqa6y5HXljKzhRZ87LvEi13brPrf/wdyl/BbpbMKJNOr1Sd0jtW4Ge1pAA=="], - - "vite-node/vite/esbuild/@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-GfXs5kry/TkGM2vKqK2oyiLFygJRqKVhawu3+DOCk7OxLy/6jYkWXhlHwOoTb0WqGnWGAS7sooxbZowy+pK9Yg=="], - - "vite-node/vite/esbuild/@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.6", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-aoLF2c3OvDn2XDTRvn8hN6DRzVVpDlj2B/F66clWd/FHLiHaG3aVZjxQX2DYphA5y/evbdGvC6Us13tvyt4pWg=="], - - "vite-node/vite/esbuild/@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.6", "", { "os": "freebsd", "cpu": "x64" }, "sha512-2SkqTjTSo2dYi/jzFbU9Plt1vk0+nNg8YC8rOXXea+iA3hfNJWebKYPs3xnOUf9+ZWhKAaxnQNUf2X9LOpeiMQ=="], - - "vite-node/vite/esbuild/@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.6", "", { "os": "linux", "cpu": "arm" }, "sha512-SZHQlzvqv4Du5PrKE2faN0qlbsaW/3QQfUUc6yO2EjFcA83xnwm91UbEEVx4ApZ9Z5oG8Bxz4qPE+HFwtVcfyw=="], - - "vite-node/vite/esbuild/@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-b967hU0gqKd9Drsh/UuAm21Khpoh6mPBSgz8mKRq4P5mVK8bpA+hQzmm/ZwGVULSNBzKdZPQBRT3+WuVavcWsQ=="], - - "vite-node/vite/esbuild/@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.6", "", { "os": "linux", "cpu": "ia32" }, "sha512-aHWdQ2AAltRkLPOsKdi3xv0mZ8fUGPdlKEjIEhxCPm5yKEThcUjHpWB1idN74lfXGnZ5SULQSgtr5Qos5B0bPw=="], - - "vite-node/vite/esbuild/@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.6", "", { "os": "linux", "cpu": "none" }, "sha512-VgKCsHdXRSQ7E1+QXGdRPlQ/e08bN6WMQb27/TMfV+vPjjTImuT9PmLXupRlC90S1JeNNW5lzkAEO/McKeJ2yg=="], - - "vite-node/vite/esbuild/@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.6", "", { "os": "linux", "cpu": "none" }, "sha512-WViNlpivRKT9/py3kCmkHnn44GkGXVdXfdc4drNmRl15zVQ2+D2uFwdlGh6IuK5AAnGTo2qPB1Djppj+t78rzw=="], - - "vite-node/vite/esbuild/@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.6", "", { "os": "linux", "cpu": "ppc64" }, "sha512-wyYKZ9NTdmAMb5730I38lBqVu6cKl4ZfYXIs31Baf8aoOtB4xSGi3THmDYt4BTFHk7/EcVixkOV2uZfwU3Q2Jw=="], - - "vite-node/vite/esbuild/@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.6", "", { "os": "linux", "cpu": "none" }, "sha512-KZh7bAGGcrinEj4qzilJ4hqTY3Dg2U82c8bv+e1xqNqZCrCyc+TL9AUEn5WGKDzm3CfC5RODE/qc96OcbIe33w=="], - - "vite-node/vite/esbuild/@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.6", "", { "os": "linux", "cpu": "s390x" }, "sha512-9N1LsTwAuE9oj6lHMyyAM+ucxGiVnEqUdp4v7IaMmrwb06ZTEVCIs3oPPplVsnjPfyjmxwHxHMF8b6vzUVAUGw=="], - - "vite-node/vite/esbuild/@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.6", "", { "os": "linux", "cpu": "x64" }, "sha512-A6bJB41b4lKFWRKNrWoP2LHsjVzNiaurf7wyj/XtFNTsnPuxwEBWHLty+ZE0dWBKuSK1fvKgrKaNjBS7qbFKig=="], - - "vite-node/vite/esbuild/@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.6", "", { "os": "none", "cpu": "arm64" }, "sha512-IjA+DcwoVpjEvyxZddDqBY+uJ2Snc6duLpjmkXm/v4xuS3H+3FkLZlDm9ZsAbF9rsfP3zeA0/ArNDORZgrxR/Q=="], - - "vite-node/vite/esbuild/@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.6", "", { "os": "none", "cpu": "x64" }, "sha512-dUXuZr5WenIDlMHdMkvDc1FAu4xdWixTCRgP7RQLBOkkGgwuuzaGSYcOpW4jFxzpzL1ejb8yF620UxAqnBrR9g=="], - - "vite-node/vite/esbuild/@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.6", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-l8ZCvXP0tbTJ3iaqdNf3pjaOSd5ex/e6/omLIQCVBLmHTlfXW3zAxQ4fnDmPLOB1x9xrcSi/xtCWFwCZRIaEwg=="], - - "vite-node/vite/esbuild/@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.6", "", { "os": "openbsd", "cpu": "x64" }, "sha512-hKrmDa0aOFOr71KQ/19JC7az1P0GWtCN1t2ahYAf4O007DHZt/dW8ym5+CUdJhQ/qkZmI1HAF8KkJbEFtCL7gw=="], - - "vite-node/vite/esbuild/@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.25.6", "", { "os": "none", "cpu": "arm64" }, "sha512-+SqBcAWoB1fYKmpWoQP4pGtx+pUUC//RNYhFdbcSA16617cchuryuhOCRpPsjCblKukAckWsV+aQ3UKT/RMPcA=="], - - "vite-node/vite/esbuild/@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.6", "", { "os": "sunos", "cpu": "x64" }, "sha512-dyCGxv1/Br7MiSC42qinGL8KkG4kX0pEsdb0+TKhmJZgCUDBGmyo1/ArCjNGiOLiIAgdbWgmWgib4HoCi5t7kA=="], - - "vite-node/vite/esbuild/@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-42QOgcZeZOvXfsCBJF5Afw73t4veOId//XD3i+/9gSkhSV6Gk3VPlWncctI+JcOyERv85FUo7RxuxGy+z8A43Q=="], - - "vite-node/vite/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.6", "", { "os": "win32", "cpu": "ia32" }, "sha512-4AWhgXmDuYN7rJI6ORB+uU9DHLq/erBbuMoAuB4VWJTu5KtCgcKYPynF0YI1VkBNuEfjNlLrFr9KZPJzrtLkrQ=="], - - "vite-node/vite/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.6", "", { "os": "win32", "cpu": "x64" }, "sha512-NgJPHHbEpLQgDH2MjQu90pzW/5vvXIZ7KOnPyNBm92A6WgZ/7b6fJyUBjoumLqeOQQGqY2QjQxRo97ah4Sj0cA=="], - - "vite-plugin-vue-inspector/@vue/compiler-dom/@vue/compiler-core/@babel/parser": ["@babel/parser@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.0" }, "bin": "./bin/babel-parser.js" }, "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g=="], - - "vite-plugin-vue-inspector/@vue/compiler-dom/@vue/compiler-core/@babel/parser/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], + "@typescript-eslint/typescript-estree/minimatch/brace-expansion/balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], } } diff --git a/creator-assembler b/creator-assembler index 02d5dc4a9..567859473 160000 --- a/creator-assembler +++ b/creator-assembler @@ -1 +1 @@ -Subproject commit 02d5dc4a944a66c618c9816884f6f00448586529 +Subproject commit 5678594737724c2fcc8b2d25f324ecd6d4aa3599 diff --git a/deno.lock b/deno.lock index 0300d0dcb..36ad7990d 100644 --- a/deno.lock +++ b/deno.lock @@ -1,421 +1,4078 @@ { "version": "5", "specifiers": { - "npm:readline-sync@^1.4.10": "1.4.10" + "npm:@codemirror/lang-yaml@^6.1.2": "6.1.2", + "npm:@codemirror/language@^6.11.3": "6.12.1", + "npm:@codemirror/legacy-modes@^6.5.1": "6.5.2", + "npm:@floating-ui/vue@^1.1.9": "1.1.9_vue@3.5.27__typescript@5.9.3_typescript@5.9.3", + "npm:@fortawesome/fontawesome-svg-core@^7.1.0": "7.1.0", + "npm:@fortawesome/free-brands-svg-icons@^7.0.1": "7.1.0", + "npm:@fortawesome/free-regular-svg-icons@^7.0.1": "7.1.0", + "npm:@fortawesome/free-solid-svg-icons@^7.1.0": "7.1.0", + "npm:@fortawesome/vue-fontawesome@^3.1.3": "3.1.3_@fortawesome+fontawesome-svg-core@7.1.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3", + "npm:@lezer/highlight@^1.2.3": "1.2.3", + "npm:@prettier/plugin-pug@^3.4.2": "3.4.2_prettier@3.8.0", + "npm:@replit/codemirror-vim@^6.3.0": "6.3.0_@codemirror+commands@6.10.1_@codemirror+language@6.12.1_@codemirror+search@6.6.0_@codemirror+state@6.5.4_@codemirror+view@6.39.11", + "npm:@tsconfig/node22@^22.0.5": "22.0.5", + "npm:@types/colors@^1.2.4": "1.2.4", + "npm:@types/humanize-duration@^3.27.4": "3.27.4", + "npm:@types/js-yaml@^4.0.9": "4.0.9", + "npm:@types/node@^24.10.1": "24.10.9", + "npm:@types/yargs@^17.0.35": "17.0.35", + "npm:@uiw/codemirror-themes@^4.25.1": "4.25.4_@codemirror+language@6.12.1_@codemirror+state@6.5.4_@codemirror+view@6.39.11", + "npm:@vitejs/plugin-vue@^6.0.2": "6.0.3_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_vue@3.5.27__typescript@5.9.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2_typescript@5.9.3", + "npm:@vue/eslint-config-prettier@^10.2.0": "10.2.0_eslint@9.39.2__jiti@2.6.1_prettier@3.8.0_jiti@2.6.1_eslint-config-prettier@10.1.8__eslint@9.39.2___jiti@2.6.1__jiti@2.6.1", + "npm:@vue/eslint-config-typescript@^14.6.0": "14.6.0_eslint@9.39.2__jiti@2.6.1_eslint-plugin-vue@10.7.0__eslint@9.39.2___jiti@2.6.1__vue-eslint-parser@10.2.0___eslint@9.39.2____jiti@2.6.1___jiti@2.6.1__jiti@2.6.1_typescript@5.9.3_jiti@2.6.1_vue-eslint-parser@10.2.0__eslint@9.39.2___jiti@2.6.1__jiti@2.6.1", + "npm:@vue/tsconfig@~0.8.1": "0.8.1_typescript@5.9.3_vue@3.5.27__typescript@5.9.3", + "npm:@vueuse/core@14": "14.1.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3", + "npm:@xterm/addon-fit@0.10": "0.10.0_@xterm+xterm@5.5.0", + "npm:@xterm/addon-web-links@0.11": "0.11.0_@xterm+xterm@5.5.0", + "npm:ajv@^8.17.1": "8.17.1", + "npm:ansicolor@^2.0.3": "2.0.3", + "npm:bootstrap-vue-next@~0.40.6": "0.40.9_@floating-ui+vue@1.1.9__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_@vueuse+core@14.1.0__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_vue@3.5.27__typescript@5.9.3_vue-router@4.6.4__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_typescript@5.9.3", + "npm:bootstrap@^5.3.8": "5.3.8_@popperjs+core@2.11.8", + "npm:codemirror-json-schema@~0.8.1": "0.8.1_@codemirror+language@6.12.1_@codemirror+lint@6.9.2_@codemirror+state@6.5.4_@codemirror+view@6.39.11_@lezer+common@1.5.0", + "npm:codemirror@^6.0.2": "6.0.2", + "npm:colors@^1.4.0": "1.4.0", + "npm:deno@^2.5.4": "2.6.5", + "npm:eslint-plugin-vue@^10.5.1": "10.7.0_eslint@9.39.2__jiti@2.6.1_vue-eslint-parser@10.2.0__eslint@9.39.2___jiti@2.6.1__jiti@2.6.1_jiti@2.6.1", + "npm:eslint@^9.39.1": "9.39.2_jiti@2.6.1", + "npm:globals@^16.5.0": "16.5.0", + "npm:humanize-duration@^3.33.0": "3.33.2", + "npm:jiti@^2.6.1": "2.6.1", + "npm:js-yaml@^4.1.1": "4.1.1", + "npm:mitt@^3.0.1": "3.0.1", + "npm:monaco-editor@0.54": "0.54.0", + "npm:monaco-vim@~0.4.2": "0.4.4_monaco-editor@0.54.0", + "npm:monaco-yaml@^5.4.0": "5.4.0_monaco-editor@0.54.0", + "npm:npm-run-all2@^8.0.4": "8.0.4", + "npm:prettier-plugin-vue@^1.1.6": "1.1.6", + "npm:prettier@^3.7.4": "3.8.0", + "npm:qrcode.vue@^3.6.0": "3.6.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3", + "npm:readline-sync@^1.4.10": "1.4.10", + "npm:sass-embedded@^1.93.3": "1.97.2", + "npm:sharp@~0.34.5": "0.34.5", + "npm:svgo@4": "4.0.0", + "npm:typescript@^5.8.3": "5.9.3", + "npm:unplugin-vue-components@30": "30.0.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3", + "npm:vite-multiple-assets@^2.2.6": "2.2.6_mime-types@2.1.35_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2", + "npm:vite-node@^3.2.4": "3.2.4_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2", + "npm:vite-plugin-image-optimizer@^2.0.3": "2.0.3_sharp@0.34.5_svgo@4.0.0_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2", + "npm:vite-plugin-vue-devtools@^8.0.5": "8.0.5_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_vue@3.5.27__typescript@5.9.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2_typescript@5.9.3", + "npm:vite-plugin-wasm@^3.5.0": "3.5.0_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2", + "npm:vite@^7.2.4": "7.3.1_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2_picomatch@4.0.3", + "npm:vue-codemirror6@^1.4.1": "1.4.1_@codemirror+autocomplete@6.20.0_@codemirror+commands@6.10.1_@codemirror+language@6.12.1_@codemirror+lint@6.9.2_@codemirror+search@6.6.0_@codemirror+state@6.5.4_@codemirror+view@6.39.11_codemirror@6.0.2_style-mod@4.1.3_vue@3.5.27__typescript@5.9.3_typescript@5.9.3", + "npm:vue-router@^4.6.3": "4.6.4_vue@3.5.27__typescript@5.9.3_typescript@5.9.3", + "npm:vue-tsc@^3.1.4": "3.2.2_typescript@5.9.3", + "npm:vue@^3.5.21": "3.5.27_typescript@5.9.3", + "npm:wasm-pack@~0.13.1": "0.13.1", + "npm:xterm@^5.3.0": "5.3.0", + "npm:yargs@18": "18.0.0" }, "npm": { - "@esbuild/aix-ppc64@0.25.5": { - "integrity": "sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA==", + "@aesoper/normal-utils@0.1.5": { + "integrity": "sha512-LFF/6y6h5mfwhnJaWqqxuC8zzDaHCG62kMRkd8xhDtq62TQj9dM17A9DhE87W7DhiARJsHLgcina/9P4eNCN1w==" + }, + "@babel/code-frame@7.28.6": { + "integrity": "sha512-JYgintcMjRiCvS8mMECzaEn+m3PfoQiyqukOMCCVQtoJGYJw8j/8LBJEiqkHLkfwCcs74E3pbAUFNg7d9VNJ+Q==", + "dependencies": [ + "@babel/helper-validator-identifier", + "js-tokens", + "picocolors" + ] + }, + "@babel/compat-data@7.28.6": { + "integrity": "sha512-2lfu57JtzctfIrcGMz992hyLlByuzgIk58+hhGCxjKZ3rWI82NnVLjXcaTqkI2NvlcvOskZaiZ5kjUALo3Lpxg==" + }, + "@babel/core@7.28.6": { + "integrity": "sha512-H3mcG6ZDLTlYfaSNi0iOKkigqMFvkTKlGUYlD8GW7nNOYRrevuA46iTypPyv+06V3fEmvvazfntkBU34L0azAw==", + "dependencies": [ + "@babel/code-frame", + "@babel/generator", + "@babel/helper-compilation-targets", + "@babel/helper-module-transforms", + "@babel/helpers", + "@babel/parser", + "@babel/template", + "@babel/traverse", + "@babel/types", + "@jridgewell/remapping", + "convert-source-map", + "debug", + "gensync", + "json5", + "semver@6.3.1" + ] + }, + "@babel/generator@7.28.6": { + "integrity": "sha512-lOoVRwADj8hjf7al89tvQ2a1lf53Z+7tiXMgpZJL3maQPDxh0DgLMN62B2MKUOFcoodBHLMbDM6WAbKgNy5Suw==", + "dependencies": [ + "@babel/parser", + "@babel/types", + "@jridgewell/gen-mapping", + "@jridgewell/trace-mapping", + "jsesc" + ] + }, + "@babel/helper-annotate-as-pure@7.27.3": { + "integrity": "sha512-fXSwMQqitTGeHLBC08Eq5yXz2m37E4pJX1qAU1+2cNedz/ifv/bVXft90VeSav5nFO61EcNgwr0aJxbyPaWBPg==", + "dependencies": [ + "@babel/types" + ] + }, + "@babel/helper-compilation-targets@7.28.6": { + "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", + "dependencies": [ + "@babel/compat-data", + "@babel/helper-validator-option", + "browserslist", + "lru-cache", + "semver@6.3.1" + ] + }, + "@babel/helper-create-class-features-plugin@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-dTOdvsjnG3xNT9Y0AUg1wAl38y+4Rl4sf9caSQZOXdNqVn+H+HbbJ4IyyHaIqNR6SW9oJpA/RuRjsjCw2IdIow==", + "dependencies": [ + "@babel/core", + "@babel/helper-annotate-as-pure", + "@babel/helper-member-expression-to-functions", + "@babel/helper-optimise-call-expression", + "@babel/helper-replace-supers", + "@babel/helper-skip-transparent-expression-wrappers", + "@babel/traverse", + "semver@6.3.1" + ] + }, + "@babel/helper-globals@7.28.0": { + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==" + }, + "@babel/helper-member-expression-to-functions@7.28.5": { + "integrity": "sha512-cwM7SBRZcPCLgl8a7cY0soT1SptSzAlMH39vwiRpOQkJlh53r5hdHwLSCZpQdVLT39sZt+CRpNwYG4Y2v77atg==", + "dependencies": [ + "@babel/traverse", + "@babel/types" + ] + }, + "@babel/helper-module-imports@7.28.6": { + "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==", + "dependencies": [ + "@babel/traverse", + "@babel/types" + ] + }, + "@babel/helper-module-transforms@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==", + "dependencies": [ + "@babel/core", + "@babel/helper-module-imports", + "@babel/helper-validator-identifier", + "@babel/traverse" + ] + }, + "@babel/helper-optimise-call-expression@7.27.1": { + "integrity": "sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw==", + "dependencies": [ + "@babel/types" + ] + }, + "@babel/helper-plugin-utils@7.28.6": { + "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==" + }, + "@babel/helper-replace-supers@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-mq8e+laIk94/yFec3DxSjCRD2Z0TAjhVbEJY3UQrlwVo15Lmt7C2wAUbK4bjnTs4APkwsYLTahXRraQXhb1WCg==", + "dependencies": [ + "@babel/core", + "@babel/helper-member-expression-to-functions", + "@babel/helper-optimise-call-expression", + "@babel/traverse" + ] + }, + "@babel/helper-skip-transparent-expression-wrappers@7.27.1": { + "integrity": "sha512-Tub4ZKEXqbPjXgWLl2+3JpQAYBJ8+ikpQ2Ocj/q/r0LwE3UhENh7EUabyHjz2kCEsrRY83ew2DQdHluuiDQFzg==", + "dependencies": [ + "@babel/traverse", + "@babel/types" + ] + }, + "@babel/helper-string-parser@7.27.1": { + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==" + }, + "@babel/helper-validator-identifier@7.28.5": { + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==" + }, + "@babel/helper-validator-option@7.27.1": { + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==" + }, + "@babel/helpers@7.28.6": { + "integrity": "sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw==", + "dependencies": [ + "@babel/template", + "@babel/types" + ] + }, + "@babel/parser@7.28.6": { + "integrity": "sha512-TeR9zWR18BvbfPmGbLampPMW+uW1NZnJlRuuHso8i87QZNq2JRF9i6RgxRqtEq+wQGsS19NNTWr2duhnE49mfQ==", + "dependencies": [ + "@babel/types" + ], + "bin": true + }, + "@babel/plugin-proposal-decorators@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-RVdFPPyY9fCRAX68haPmOk2iyKW8PKJFthmm8NeSI3paNxKWGZIn99+VbIf0FrtCpFnPgnpF/L48tadi617ULg==", + "dependencies": [ + "@babel/core", + "@babel/helper-create-class-features-plugin", + "@babel/helper-plugin-utils", + "@babel/plugin-syntax-decorators" + ] + }, + "@babel/plugin-syntax-decorators@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-71EYI0ONURHJBL4rSFXnITXqXrrY8q4P0q006DPfN+Rk+ASM+++IBXem/ruokgBZR8YNEWZ8R6B+rCb8VcUTqA==", + "dependencies": [ + "@babel/core", + "@babel/helper-plugin-utils" + ] + }, + "@babel/plugin-syntax-import-attributes@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-jiLC0ma9XkQT3TKJ9uYvlakm66Pamywo+qwL+oL8HJOvc6TWdZXVfhqJr8CCzbSGUAbDOzlGHJC1U+vRfLQDvw==", + "dependencies": [ + "@babel/core", + "@babel/helper-plugin-utils" + ] + }, + "@babel/plugin-syntax-import-meta@7.10.4_@babel+core@7.28.6": { + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dependencies": [ + "@babel/core", + "@babel/helper-plugin-utils" + ] + }, + "@babel/plugin-syntax-jsx@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w==", + "dependencies": [ + "@babel/core", + "@babel/helper-plugin-utils" + ] + }, + "@babel/plugin-syntax-typescript@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-+nDNmQye7nlnuuHDboPbGm00Vqg3oO8niRRL27/4LYHUsHYh0zJ1xWOz0uRwNFmM1Avzk8wZbc6rdiYhomzv/A==", + "dependencies": [ + "@babel/core", + "@babel/helper-plugin-utils" + ] + }, + "@babel/plugin-transform-typescript@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-0YWL2RFxOqEm9Efk5PvreamxPME8OyY0wM5wh5lHjF+VtVhdneCWGzZeSqzOfiobVqQaNCd2z0tQvnI9DaPWPw==", + "dependencies": [ + "@babel/core", + "@babel/helper-annotate-as-pure", + "@babel/helper-create-class-features-plugin", + "@babel/helper-plugin-utils", + "@babel/helper-skip-transparent-expression-wrappers", + "@babel/plugin-syntax-typescript" + ] + }, + "@babel/template@7.28.6": { + "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==", + "dependencies": [ + "@babel/code-frame", + "@babel/parser", + "@babel/types" + ] + }, + "@babel/traverse@7.28.6": { + "integrity": "sha512-fgWX62k02qtjqdSNTAGxmKYY/7FSL9WAS1o2Hu5+I5m9T0yxZzr4cnrfXQ/MX0rIifthCSs6FKTlzYbJcPtMNg==", + "dependencies": [ + "@babel/code-frame", + "@babel/generator", + "@babel/helper-globals", + "@babel/parser", + "@babel/template", + "@babel/types", + "debug" + ] + }, + "@babel/types@7.28.6": { + "integrity": "sha512-0ZrskXVEHSWIqZM/sQZ4EV3jZJXRkio/WCxaqKZP1g//CEWEPSfeZFcms4XeKBCHU0ZKnIkdJeU/kF+eRp5lBg==", + "dependencies": [ + "@babel/helper-string-parser", + "@babel/helper-validator-identifier" + ] + }, + "@bufbuild/protobuf@2.10.2": { + "integrity": "sha512-uFsRXwIGyu+r6AMdz+XijIIZJYpoWeYzILt5yZ2d3mCjQrWUTVpVD9WL/jZAbvp+Ed04rOhrsk7FiTcEDseB5A==" + }, + "@codemirror/autocomplete@6.20.0": { + "integrity": "sha512-bOwvTOIJcG5FVo5gUUupiwYh8MioPLQ4UcqbcRf7UQ98X90tCa9E1kZ3Z7tqwpZxYyOvh1YTYbmZE9RTfTp5hg==", + "dependencies": [ + "@codemirror/language", + "@codemirror/state", + "@codemirror/view", + "@lezer/common" + ] + }, + "@codemirror/commands@6.10.1": { + "integrity": "sha512-uWDWFypNdQmz2y1LaNJzK7fL7TYKLeUAU0npEC685OKTF3KcQ2Vu3klIM78D7I6wGhktme0lh3CuQLv0ZCrD9Q==", + "dependencies": [ + "@codemirror/language", + "@codemirror/state", + "@codemirror/view", + "@lezer/common" + ] + }, + "@codemirror/lang-json@6.0.2": { + "integrity": "sha512-x2OtO+AvwEHrEwR0FyyPtfDUiloG3rnVTSZV1W8UteaLL8/MajQd8DpvUb2YVzC+/T18aSDv0H9mu+xw0EStoQ==", + "dependencies": [ + "@codemirror/language", + "@lezer/json" + ] + }, + "@codemirror/lang-yaml@6.1.2": { + "integrity": "sha512-dxrfG8w5Ce/QbT7YID7mWZFKhdhsaTNOYjOkSIMt1qmC4VQnXSDSYVHHHn8k6kJUfIhtLo8t1JJgltlxWdsITw==", + "dependencies": [ + "@codemirror/autocomplete", + "@codemirror/language", + "@codemirror/state", + "@lezer/common", + "@lezer/highlight", + "@lezer/lr", + "@lezer/yaml" + ] + }, + "@codemirror/language@6.12.1": { + "integrity": "sha512-Fa6xkSiuGKc8XC8Cn96T+TQHYj4ZZ7RdFmXA3i9xe/3hLHfwPZdM+dqfX0Cp0zQklBKhVD8Yzc8LS45rkqcwpQ==", + "dependencies": [ + "@codemirror/state", + "@codemirror/view", + "@lezer/common", + "@lezer/highlight", + "@lezer/lr", + "style-mod" + ] + }, + "@codemirror/legacy-modes@6.5.2": { + "integrity": "sha512-/jJbwSTazlQEDOQw2FJ8LEEKVS72pU0lx6oM54kGpL8t/NJ2Jda3CZ4pcltiKTdqYSRk3ug1B3pil1gsjA6+8Q==", + "dependencies": [ + "@codemirror/language" + ] + }, + "@codemirror/lint@6.9.2": { + "integrity": "sha512-sv3DylBiIyi+xKwRCJAAsBZZZWo82shJ/RTMymLabAdtbkV5cSKwWDeCgtUq3v8flTaXS2y1kKkICuRYtUswyQ==", + "dependencies": [ + "@codemirror/state", + "@codemirror/view", + "crelt" + ] + }, + "@codemirror/search@6.6.0": { + "integrity": "sha512-koFuNXcDvyyotWcgOnZGmY7LZqEOXZaaxD/j6n18TCLx2/9HieZJ5H6hs1g8FiRxBD0DNfs0nXn17g872RmYdw==", + "dependencies": [ + "@codemirror/state", + "@codemirror/view", + "crelt" + ] + }, + "@codemirror/state@6.5.4": { + "integrity": "sha512-8y7xqG/hpB53l25CIoit9/ngxdfoG+fx+V3SHBrinnhOtLvKHRyAJJuHzkWrR4YXXLX8eXBsejgAAxHUOdW1yw==", + "dependencies": [ + "@marijn/find-cluster-break" + ] + }, + "@codemirror/view@6.39.11": { + "integrity": "sha512-bWdeR8gWM87l4DB/kYSF9A+dVackzDb/V56Tq7QVrQ7rn86W0rgZFtlL3g3pem6AeGcb9NQNoy3ao4WpW4h5tQ==", + "dependencies": [ + "@codemirror/state", + "crelt", + "style-mod", + "w3c-keyname" + ] + }, + "@deno/darwin-arm64@2.6.5": { + "integrity": "sha512-jHO9d9XsB2YzVUsJr7U9DEj7QEw69yMYbyaLbK1bpHJ6IjYRJFU/Wi7I1b9jSXurezQQulKf75+9QbU27XkL2g==", + "os": ["darwin"], + "cpu": ["arm64"] + }, + "@deno/darwin-x64@2.6.5": { + "integrity": "sha512-piyZbW02p4zlviz14UVvoUGhh2mu0OYQBBahdLIbnHaPC14Rj+fHu0vgG8+PTJNCIRkxA1zrm5/GBbjqU3GeZQ==", + "os": ["darwin"], + "cpu": ["x64"] + }, + "@deno/linux-arm64-glibc@2.6.5": { + "integrity": "sha512-9VjtjIepMgSc6aHNOvjHAlHkG/Lmatoeb6k5vpCtVLpwJWJcteIrNX+Rc2u7HcfJctfPs6HwDYsCGI/jnwwzGw==", + "os": ["linux"], + "cpu": ["arm64"] + }, + "@deno/linux-x64-glibc@2.6.5": { + "integrity": "sha512-TZV2Ez3T1qaA7snLKvevwq2LyTGI+1lCQrULZgrytmcaa0Q/9aErA3c135CSscv5LDKSWUXtBCWOHHI6rGm9MA==", + "os": ["linux"], + "cpu": ["x64"] + }, + "@deno/win32-arm64@2.6.5": { + "integrity": "sha512-5zPTnSv0R72GwVxxP20cLN/K5VJd6mF5yaLd/4tnwpv4jExiiQWaoXrae/M8O16Ruz8R+AIpIJfs3oZ+2gwuzA==", + "os": ["win32"], + "cpu": ["arm64"] + }, + "@deno/win32-x64@2.6.5": { + "integrity": "sha512-vSr5ZjBvv5n80Bwa9P0WVLpUNLqnDtXMFIuR7H4mdo5zXU9Ay8ggPQ83yPMjmgqRZOBJNXQDFUA3ZWW+UmMjYQ==", + "os": ["win32"], + "cpu": ["x64"] + }, + "@emnapi/runtime@1.8.1": { + "integrity": "sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg==", + "dependencies": [ + "tslib" + ] + }, + "@esbuild/aix-ppc64@0.27.2": { + "integrity": "sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==", "os": ["aix"], "cpu": ["ppc64"] }, - "@esbuild/android-arm64@0.25.5": { - "integrity": "sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg==", + "@esbuild/android-arm64@0.27.2": { + "integrity": "sha512-pvz8ZZ7ot/RBphf8fv60ljmaoydPU12VuXHImtAs0XhLLw+EXBi2BLe3OYSBslR4rryHvweW5gmkKFwTiFy6KA==", "os": ["android"], "cpu": ["arm64"] }, - "@esbuild/android-arm@0.25.5": { - "integrity": "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA==", + "@esbuild/android-arm@0.27.2": { + "integrity": "sha512-DVNI8jlPa7Ujbr1yjU2PfUSRtAUZPG9I1RwW4F4xFB1Imiu2on0ADiI/c3td+KmDtVKNbi+nffGDQMfcIMkwIA==", "os": ["android"], "cpu": ["arm"] }, - "@esbuild/android-x64@0.25.5": { - "integrity": "sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw==", + "@esbuild/android-x64@0.27.2": { + "integrity": "sha512-z8Ank4Byh4TJJOh4wpz8g2vDy75zFL0TlZlkUkEwYXuPSgX8yzep596n6mT7905kA9uHZsf/o2OJZubl2l3M7A==", "os": ["android"], "cpu": ["x64"] }, - "@esbuild/darwin-arm64@0.25.5": { - "integrity": "sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ==", + "@esbuild/darwin-arm64@0.27.2": { + "integrity": "sha512-davCD2Zc80nzDVRwXTcQP/28fiJbcOwvdolL0sOiOsbwBa72kegmVU0Wrh1MYrbuCL98Omp5dVhQFWRKR2ZAlg==", "os": ["darwin"], "cpu": ["arm64"] }, - "@esbuild/darwin-x64@0.25.5": { - "integrity": "sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ==", + "@esbuild/darwin-x64@0.27.2": { + "integrity": "sha512-ZxtijOmlQCBWGwbVmwOF/UCzuGIbUkqB1faQRf5akQmxRJ1ujusWsb3CVfk/9iZKr2L5SMU5wPBi1UWbvL+VQA==", "os": ["darwin"], "cpu": ["x64"] }, - "@esbuild/freebsd-arm64@0.25.5": { - "integrity": "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==", + "@esbuild/freebsd-arm64@0.27.2": { + "integrity": "sha512-lS/9CN+rgqQ9czogxlMcBMGd+l8Q3Nj1MFQwBZJyoEKI50XGxwuzznYdwcav6lpOGv5BqaZXqvBSiB/kJ5op+g==", "os": ["freebsd"], "cpu": ["arm64"] }, - "@esbuild/freebsd-x64@0.25.5": { - "integrity": "sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw==", + "@esbuild/freebsd-x64@0.27.2": { + "integrity": "sha512-tAfqtNYb4YgPnJlEFu4c212HYjQWSO/w/h/lQaBK7RbwGIkBOuNKQI9tqWzx7Wtp7bTPaGC6MJvWI608P3wXYA==", "os": ["freebsd"], "cpu": ["x64"] }, - "@esbuild/linux-arm64@0.25.5": { - "integrity": "sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg==", + "@esbuild/linux-arm64@0.27.2": { + "integrity": "sha512-hYxN8pr66NsCCiRFkHUAsxylNOcAQaxSSkHMMjcpx0si13t1LHFphxJZUiGwojB1a/Hd5OiPIqDdXONia6bhTw==", "os": ["linux"], "cpu": ["arm64"] }, - "@esbuild/linux-arm@0.25.5": { - "integrity": "sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw==", + "@esbuild/linux-arm@0.27.2": { + "integrity": "sha512-vWfq4GaIMP9AIe4yj1ZUW18RDhx6EPQKjwe7n8BbIecFtCQG4CfHGaHuh7fdfq+y3LIA2vGS/o9ZBGVxIDi9hw==", "os": ["linux"], "cpu": ["arm"] }, - "@esbuild/linux-ia32@0.25.5": { - "integrity": "sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA==", + "@esbuild/linux-ia32@0.27.2": { + "integrity": "sha512-MJt5BRRSScPDwG2hLelYhAAKh9imjHK5+NE/tvnRLbIqUWa+0E9N4WNMjmp/kXXPHZGqPLxggwVhz7QP8CTR8w==", "os": ["linux"], "cpu": ["ia32"] }, - "@esbuild/linux-loong64@0.25.5": { - "integrity": "sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg==", + "@esbuild/linux-loong64@0.27.2": { + "integrity": "sha512-lugyF1atnAT463aO6KPshVCJK5NgRnU4yb3FUumyVz+cGvZbontBgzeGFO1nF+dPueHD367a2ZXe1NtUkAjOtg==", "os": ["linux"], "cpu": ["loong64"] }, - "@esbuild/linux-mips64el@0.25.5": { - "integrity": "sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg==", + "@esbuild/linux-mips64el@0.27.2": { + "integrity": "sha512-nlP2I6ArEBewvJ2gjrrkESEZkB5mIoaTswuqNFRv/WYd+ATtUpe9Y09RnJvgvdag7he0OWgEZWhviS1OTOKixw==", "os": ["linux"], "cpu": ["mips64el"] }, - "@esbuild/linux-ppc64@0.25.5": { - "integrity": "sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ==", + "@esbuild/linux-ppc64@0.27.2": { + "integrity": "sha512-C92gnpey7tUQONqg1n6dKVbx3vphKtTHJaNG2Ok9lGwbZil6DrfyecMsp9CrmXGQJmZ7iiVXvvZH6Ml5hL6XdQ==", "os": ["linux"], "cpu": ["ppc64"] }, - "@esbuild/linux-riscv64@0.25.5": { - "integrity": "sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA==", + "@esbuild/linux-riscv64@0.27.2": { + "integrity": "sha512-B5BOmojNtUyN8AXlK0QJyvjEZkWwy/FKvakkTDCziX95AowLZKR6aCDhG7LeF7uMCXEJqwa8Bejz5LTPYm8AvA==", "os": ["linux"], "cpu": ["riscv64"] }, - "@esbuild/linux-s390x@0.25.5": { - "integrity": "sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ==", + "@esbuild/linux-s390x@0.27.2": { + "integrity": "sha512-p4bm9+wsPwup5Z8f4EpfN63qNagQ47Ua2znaqGH6bqLlmJ4bx97Y9JdqxgGZ6Y8xVTixUnEkoKSHcpRlDnNr5w==", "os": ["linux"], "cpu": ["s390x"] }, - "@esbuild/linux-x64@0.25.5": { - "integrity": "sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw==", + "@esbuild/linux-x64@0.27.2": { + "integrity": "sha512-uwp2Tip5aPmH+NRUwTcfLb+W32WXjpFejTIOWZFw/v7/KnpCDKG66u4DLcurQpiYTiYwQ9B7KOeMJvLCu/OvbA==", "os": ["linux"], "cpu": ["x64"] }, - "@esbuild/netbsd-arm64@0.25.5": { - "integrity": "sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw==", + "@esbuild/netbsd-arm64@0.27.2": { + "integrity": "sha512-Kj6DiBlwXrPsCRDeRvGAUb/LNrBASrfqAIok+xB0LxK8CHqxZ037viF13ugfsIpePH93mX7xfJp97cyDuTZ3cw==", "os": ["netbsd"], "cpu": ["arm64"] }, - "@esbuild/netbsd-x64@0.25.5": { - "integrity": "sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ==", + "@esbuild/netbsd-x64@0.27.2": { + "integrity": "sha512-HwGDZ0VLVBY3Y+Nw0JexZy9o/nUAWq9MlV7cahpaXKW6TOzfVno3y3/M8Ga8u8Yr7GldLOov27xiCnqRZf0tCA==", "os": ["netbsd"], "cpu": ["x64"] }, - "@esbuild/openbsd-arm64@0.25.5": { - "integrity": "sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw==", + "@esbuild/openbsd-arm64@0.27.2": { + "integrity": "sha512-DNIHH2BPQ5551A7oSHD0CKbwIA/Ox7+78/AWkbS5QoRzaqlev2uFayfSxq68EkonB+IKjiuxBFoV8ESJy8bOHA==", "os": ["openbsd"], "cpu": ["arm64"] }, - "@esbuild/openbsd-x64@0.25.5": { - "integrity": "sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg==", + "@esbuild/openbsd-x64@0.27.2": { + "integrity": "sha512-/it7w9Nb7+0KFIzjalNJVR5bOzA9Vay+yIPLVHfIQYG/j+j9VTH84aNB8ExGKPU4AzfaEvN9/V4HV+F+vo8OEg==", "os": ["openbsd"], "cpu": ["x64"] }, - "@esbuild/sunos-x64@0.25.5": { - "integrity": "sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA==", + "@esbuild/openharmony-arm64@0.27.2": { + "integrity": "sha512-LRBbCmiU51IXfeXk59csuX/aSaToeG7w48nMwA6049Y4J4+VbWALAuXcs+qcD04rHDuSCSRKdmY63sruDS5qag==", + "os": ["openharmony"], + "cpu": ["arm64"] + }, + "@esbuild/sunos-x64@0.27.2": { + "integrity": "sha512-kMtx1yqJHTmqaqHPAzKCAkDaKsffmXkPHThSfRwZGyuqyIeBvf08KSsYXl+abf5HDAPMJIPnbBfXvP2ZC2TfHg==", "os": ["sunos"], "cpu": ["x64"] }, - "@esbuild/win32-arm64@0.25.5": { - "integrity": "sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw==", + "@esbuild/win32-arm64@0.27.2": { + "integrity": "sha512-Yaf78O/B3Kkh+nKABUF++bvJv5Ijoy9AN1ww904rOXZFLWVc5OLOfL56W+C8F9xn5JQZa3UX6m+IktJnIb1Jjg==", "os": ["win32"], "cpu": ["arm64"] }, - "@esbuild/win32-ia32@0.25.5": { - "integrity": "sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ==", + "@esbuild/win32-ia32@0.27.2": { + "integrity": "sha512-Iuws0kxo4yusk7sw70Xa2E2imZU5HoixzxfGCdxwBdhiDgt9vX9VUCBhqcwY7/uh//78A1hMkkROMJq9l27oLQ==", "os": ["win32"], "cpu": ["ia32"] }, - "@esbuild/win32-x64@0.25.5": { - "integrity": "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==", + "@esbuild/win32-x64@0.27.2": { + "integrity": "sha512-sRdU18mcKf7F+YgheI/zGf5alZatMUTKj/jNS6l744f9u3WFu4v7twcUI9vu4mknF4Y9aDlblIie0IM+5xxaqQ==", "os": ["win32"], "cpu": ["x64"] }, - "@parcel/watcher-android-arm64@2.5.1": { - "integrity": "sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA==", - "os": ["android"], - "cpu": ["arm64"] + "@eslint-community/eslint-utils@4.9.1_eslint@9.39.2__jiti@2.6.1_jiti@2.6.1": { + "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==", + "dependencies": [ + "eslint", + "eslint-visitor-keys@3.4.3" + ] }, - "@parcel/watcher-darwin-arm64@2.5.1": { - "integrity": "sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw==", - "os": ["darwin"], - "cpu": ["arm64"] + "@eslint-community/regexpp@4.12.2": { + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==" }, - "@parcel/watcher-darwin-x64@2.5.1": { - "integrity": "sha512-1ZXDthrnNmwv10A0/3AJNZ9JGlzrF82i3gNQcWOzd7nJ8aj+ILyW1MTxVk35Db0u91oD5Nlk9MBiujMlwmeXZg==", - "os": ["darwin"], - "cpu": ["x64"] + "@eslint/config-array@0.21.1": { + "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", + "dependencies": [ + "@eslint/object-schema", + "debug", + "minimatch@3.1.2" + ] }, - "@parcel/watcher-freebsd-x64@2.5.1": { - "integrity": "sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ==", - "os": ["freebsd"], - "cpu": ["x64"] + "@eslint/config-helpers@0.4.2": { + "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", + "dependencies": [ + "@eslint/core" + ] }, - "@parcel/watcher-linux-arm-glibc@2.5.1": { - "integrity": "sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA==", - "os": ["linux"], - "cpu": ["arm"] + "@eslint/core@0.17.0": { + "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", + "dependencies": [ + "@types/json-schema" + ] }, - "@parcel/watcher-linux-arm-musl@2.5.1": { - "integrity": "sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==", - "os": ["linux"], - "cpu": ["arm"] + "@eslint/eslintrc@3.3.3": { + "integrity": "sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==", + "dependencies": [ + "ajv@6.12.6", + "debug", + "espree", + "globals@14.0.0", + "ignore@5.3.2", + "import-fresh", + "js-yaml", + "minimatch@3.1.2", + "strip-json-comments" + ] }, - "@parcel/watcher-linux-arm64-glibc@2.5.1": { - "integrity": "sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==", - "os": ["linux"], - "cpu": ["arm64"] + "@eslint/js@9.39.2": { + "integrity": "sha512-q1mjIoW1VX4IvSocvM/vbTiveKC4k9eLrajNEuSsmjymSDEbpGddtpfOoN7YGAqBK3NG+uqo8ia4PDTt8buCYA==" }, - "@parcel/watcher-linux-arm64-musl@2.5.1": { - "integrity": "sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==", - "os": ["linux"], - "cpu": ["arm64"] + "@eslint/object-schema@2.1.7": { + "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==" }, - "@parcel/watcher-linux-x64-glibc@2.5.1": { - "integrity": "sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==", - "os": ["linux"], - "cpu": ["x64"] + "@eslint/plugin-kit@0.4.1": { + "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", + "dependencies": [ + "@eslint/core", + "levn" + ] }, - "@parcel/watcher-linux-x64-musl@2.5.1": { - "integrity": "sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==", - "os": ["linux"], - "cpu": ["x64"] + "@floating-ui/core@1.7.3": { + "integrity": "sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w==", + "dependencies": [ + "@floating-ui/utils" + ] }, - "@parcel/watcher-win32-arm64@2.5.1": { - "integrity": "sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==", - "os": ["win32"], - "cpu": ["arm64"] + "@floating-ui/dom@1.7.4": { + "integrity": "sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA==", + "dependencies": [ + "@floating-ui/core", + "@floating-ui/utils" + ] }, - "@parcel/watcher-win32-ia32@2.5.1": { - "integrity": "sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ==", - "os": ["win32"], - "cpu": ["ia32"] + "@floating-ui/utils@0.2.10": { + "integrity": "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==" }, - "@parcel/watcher-win32-x64@2.5.1": { - "integrity": "sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA==", - "os": ["win32"], - "cpu": ["x64"] + "@floating-ui/vue@1.1.9_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-BfNqNW6KA83Nexspgb9DZuz578R7HT8MZw1CfK9I6Ah4QReNWEJsXWHN+SdmOVLNGmTPDi+fDT535Df5PzMLbQ==", + "dependencies": [ + "@floating-ui/dom", + "@floating-ui/utils", + "vue-demi" + ] }, - "@parcel/watcher@2.5.1": { - "integrity": "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==", + "@fortawesome/fontawesome-common-types@7.1.0": { + "integrity": "sha512-l/BQM7fYntsCI//du+6sEnHOP6a74UixFyOYUyz2DLMXKx+6DEhfR3F2NYGE45XH1JJuIamacb4IZs9S0ZOWLA==" + }, + "@fortawesome/fontawesome-svg-core@7.1.0": { + "integrity": "sha512-fNxRUk1KhjSbnbuBxlWSnBLKLBNun52ZBTcs22H/xEEzM6Ap81ZFTQ4bZBxVQGQgVY0xugKGoRcCbaKjLQ3XZA==", "dependencies": [ - "detect-libc", - "is-glob@4.0.3", - "micromatch@4.0.8", - "node-addon-api" - ], - "optionalDependencies": [ - "@parcel/watcher-android-arm64", - "@parcel/watcher-darwin-arm64", - "@parcel/watcher-darwin-x64", - "@parcel/watcher-freebsd-x64", - "@parcel/watcher-linux-arm-glibc", - "@parcel/watcher-linux-arm-musl", - "@parcel/watcher-linux-arm64-glibc", - "@parcel/watcher-linux-arm64-musl", - "@parcel/watcher-linux-x64-glibc", - "@parcel/watcher-linux-x64-musl", - "@parcel/watcher-win32-arm64", - "@parcel/watcher-win32-ia32", - "@parcel/watcher-win32-x64" - ], - "scripts": true + "@fortawesome/fontawesome-common-types" + ] }, - "@pkgjs/parseargs@0.11.0": { - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==" + "@fortawesome/free-brands-svg-icons@7.1.0": { + "integrity": "sha512-9byUd9bgNfthsZAjBl6GxOu1VPHgBuRUP9juI7ZoM98h8xNPTCTagfwUFyYscdZq4Hr7gD1azMfM9s5tIWKZZA==", + "dependencies": [ + "@fortawesome/fontawesome-common-types" + ] }, - "@rollup/rollup-android-arm-eabi@4.42.0": { - "integrity": "sha512-gldmAyS9hpj+H6LpRNlcjQWbuKUtb94lodB9uCz71Jm+7BxK1VIOo7y62tZZwxhA7j1ylv/yQz080L5WkS+LoQ==", - "os": ["android"], - "cpu": ["arm"] + "@fortawesome/free-regular-svg-icons@7.1.0": { + "integrity": "sha512-0e2fdEyB4AR+e6kU4yxwA/MonnYcw/CsMEP9lH82ORFi9svA6/RhDyhxIv5mlJaldmaHLLYVTb+3iEr+PDSZuQ==", + "dependencies": [ + "@fortawesome/fontawesome-common-types" + ] }, - "@rollup/rollup-android-arm64@4.42.0": { - "integrity": "sha512-bpRipfTgmGFdCZDFLRvIkSNO1/3RGS74aWkJJTFJBH7h3MRV4UijkaEUeOMbi9wxtxYmtAbVcnMtHTPBhLEkaw==", - "os": ["android"], - "cpu": ["arm64"] + "@fortawesome/free-solid-svg-icons@7.1.0": { + "integrity": "sha512-Udu3K7SzAo9N013qt7qmm22/wo2hADdheXtBfxFTecp+ogsc0caQNRKEb7pkvvagUGOpG9wJC1ViH6WXs8oXIA==", + "dependencies": [ + "@fortawesome/fontawesome-common-types" + ] }, - "@rollup/rollup-darwin-arm64@4.42.0": { - "integrity": "sha512-JxHtA081izPBVCHLKnl6GEA0w3920mlJPLh89NojpU2GsBSB6ypu4erFg/Wx1qbpUbepn0jY4dVWMGZM8gplgA==", + "@fortawesome/vue-fontawesome@3.1.3_@fortawesome+fontawesome-svg-core@7.1.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-OHHUTLPEzdwP8kcYIzhioUdUOjZ4zzmi+midwa4bqscza4OJCOvTKJEHkXNz8PgZ23kWci1HkKVX0bm8f9t9gQ==", + "dependencies": [ + "@fortawesome/fontawesome-svg-core", + "vue" + ] + }, + "@humanfs/core@0.19.1": { + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==" + }, + "@humanfs/node@0.16.7": { + "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", + "dependencies": [ + "@humanfs/core", + "@humanwhocodes/retry" + ] + }, + "@humanwhocodes/module-importer@1.0.1": { + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==" + }, + "@humanwhocodes/retry@0.4.3": { + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==" + }, + "@img/colour@1.0.0": { + "integrity": "sha512-A5P/LfWGFSl6nsckYtjw9da+19jB8hkJ6ACTGcDfEJ0aE+l2n2El7dsVM7UVHZQ9s2lmYMWlrS21YLy2IR1LUw==" + }, + "@img/sharp-darwin-arm64@0.34.5": { + "integrity": "sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w==", + "optionalDependencies": [ + "@img/sharp-libvips-darwin-arm64" + ], "os": ["darwin"], "cpu": ["arm64"] }, - "@rollup/rollup-darwin-x64@4.42.0": { - "integrity": "sha512-rv5UZaWVIJTDMyQ3dCEK+m0SAn6G7H3PRc2AZmExvbDvtaDc+qXkei0knQWcI3+c9tEs7iL/4I4pTQoPbNL2SA==", + "@img/sharp-darwin-x64@0.34.5": { + "integrity": "sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw==", + "optionalDependencies": [ + "@img/sharp-libvips-darwin-x64" + ], "os": ["darwin"], "cpu": ["x64"] }, - "@rollup/rollup-freebsd-arm64@4.42.0": { - "integrity": "sha512-fJcN4uSGPWdpVmvLuMtALUFwCHgb2XiQjuECkHT3lWLZhSQ3MBQ9pq+WoWeJq2PrNxr9rPM1Qx+IjyGj8/c6zQ==", - "os": ["freebsd"], + "@img/sharp-libvips-darwin-arm64@1.2.4": { + "integrity": "sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g==", + "os": ["darwin"], "cpu": ["arm64"] }, - "@rollup/rollup-freebsd-x64@4.42.0": { - "integrity": "sha512-CziHfyzpp8hJpCVE/ZdTizw58gr+m7Y2Xq5VOuCSrZR++th2xWAz4Nqk52MoIIrV3JHtVBhbBsJcAxs6NammOQ==", - "os": ["freebsd"], + "@img/sharp-libvips-darwin-x64@1.2.4": { + "integrity": "sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg==", + "os": ["darwin"], "cpu": ["x64"] }, - "@rollup/rollup-linux-arm-gnueabihf@4.42.0": { - "integrity": "sha512-UsQD5fyLWm2Fe5CDM7VPYAo+UC7+2Px4Y+N3AcPh/LdZu23YcuGPegQly++XEVaC8XUTFVPscl5y5Cl1twEI4A==", - "os": ["linux"], - "cpu": ["arm"] - }, - "@rollup/rollup-linux-arm-musleabihf@4.42.0": { - "integrity": "sha512-/i8NIrlgc/+4n1lnoWl1zgH7Uo0XK5xK3EDqVTf38KvyYgCU/Rm04+o1VvvzJZnVS5/cWSd07owkzcVasgfIkQ==", - "os": ["linux"], - "cpu": ["arm"] - }, - "@rollup/rollup-linux-arm64-gnu@4.42.0": { - "integrity": "sha512-eoujJFOvoIBjZEi9hJnXAbWg+Vo1Ov8n/0IKZZcPZ7JhBzxh2A+2NFyeMZIRkY9iwBvSjloKgcvnjTbGKHE44Q==", + "@img/sharp-libvips-linux-arm64@1.2.4": { + "integrity": "sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==", "os": ["linux"], "cpu": ["arm64"] }, - "@rollup/rollup-linux-arm64-musl@4.42.0": { - "integrity": "sha512-/3NrcOWFSR7RQUQIuZQChLND36aTU9IYE4j+TB40VU78S+RA0IiqHR30oSh6P1S9f9/wVOenHQnacs/Byb824g==", + "@img/sharp-libvips-linux-arm@1.2.4": { + "integrity": "sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==", "os": ["linux"], - "cpu": ["arm64"] - }, - "@rollup/rollup-linux-loongarch64-gnu@4.42.0": { - "integrity": "sha512-O8AplvIeavK5ABmZlKBq9/STdZlnQo7Sle0LLhVA7QT+CiGpNVe197/t8Aph9bhJqbDVGCHpY2i7QyfEDDStDg==", - "os": ["linux"], - "cpu": ["loong64"] + "cpu": ["arm"] }, - "@rollup/rollup-linux-powerpc64le-gnu@4.42.0": { - "integrity": "sha512-6Qb66tbKVN7VyQrekhEzbHRxXXFFD8QKiFAwX5v9Xt6FiJ3BnCVBuyBxa2fkFGqxOCSGGYNejxd8ht+q5SnmtA==", + "@img/sharp-libvips-linux-ppc64@1.2.4": { + "integrity": "sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==", "os": ["linux"], "cpu": ["ppc64"] }, - "@rollup/rollup-linux-riscv64-gnu@4.42.0": { - "integrity": "sha512-KQETDSEBamQFvg/d8jajtRwLNBlGc3aKpaGiP/LvEbnmVUKlFta1vqJqTrvPtsYsfbE/DLg5CC9zyXRX3fnBiA==", - "os": ["linux"], - "cpu": ["riscv64"] - }, - "@rollup/rollup-linux-riscv64-musl@4.42.0": { - "integrity": "sha512-qMvnyjcU37sCo/tuC+JqeDKSuukGAd+pVlRl/oyDbkvPJ3awk6G6ua7tyum02O3lI+fio+eM5wsVd66X0jQtxw==", + "@img/sharp-libvips-linux-riscv64@1.2.4": { + "integrity": "sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==", "os": ["linux"], "cpu": ["riscv64"] }, - "@rollup/rollup-linux-s390x-gnu@4.42.0": { - "integrity": "sha512-I2Y1ZUgTgU2RLddUHXTIgyrdOwljjkmcZ/VilvaEumtS3Fkuhbw4p4hgHc39Ypwvo2o7sBFNl2MquNvGCa55Iw==", + "@img/sharp-libvips-linux-s390x@1.2.4": { + "integrity": "sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==", "os": ["linux"], "cpu": ["s390x"] }, - "@rollup/rollup-linux-x64-gnu@4.42.0": { - "integrity": "sha512-Gfm6cV6mj3hCUY8TqWa63DB8Mx3NADoFwiJrMpoZ1uESbK8FQV3LXkhfry+8bOniq9pqY1OdsjFWNsSbfjPugw==", + "@img/sharp-libvips-linux-x64@1.2.4": { + "integrity": "sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==", "os": ["linux"], "cpu": ["x64"] }, - "@rollup/rollup-linux-x64-musl@4.42.0": { - "integrity": "sha512-g86PF8YZ9GRqkdi0VoGlcDUb4rYtQKyTD1IVtxxN4Hpe7YqLBShA7oHMKU6oKTCi3uxwW4VkIGnOaH/El8de3w==", + "@img/sharp-libvips-linuxmusl-arm64@1.2.4": { + "integrity": "sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==", "os": ["linux"], - "cpu": ["x64"] - }, - "@rollup/rollup-win32-arm64-msvc@4.42.0": { - "integrity": "sha512-+axkdyDGSp6hjyzQ5m1pgcvQScfHnMCcsXkx8pTgy/6qBmWVhtRVlgxjWwDp67wEXXUr0x+vD6tp5W4x6V7u1A==", - "os": ["win32"], "cpu": ["arm64"] }, - "@rollup/rollup-win32-ia32-msvc@4.42.0": { - "integrity": "sha512-F+5J9pelstXKwRSDq92J0TEBXn2nfUrQGg+HK1+Tk7VOL09e0gBqUHugZv7SW4MGrYj41oNCUe3IKCDGVlis2g==", - "os": ["win32"], - "cpu": ["ia32"] - }, - "@rollup/rollup-win32-x64-msvc@4.42.0": { - "integrity": "sha512-LpHiJRwkaVz/LqjHjK8LCi8osq7elmpwujwbXKNW88bM8eeGxavJIKKjkjpMHAh/2xfnrt1ZSnhTv41WYUHYmA==", - "os": ["win32"], + "@img/sharp-libvips-linuxmusl-x64@1.2.4": { + "integrity": "sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==", + "os": ["linux"], "cpu": ["x64"] }, - "detect-libc@1.0.3": { - "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", - "bin": true + "@img/sharp-linux-arm64@0.34.5": { + "integrity": "sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==", + "optionalDependencies": [ + "@img/sharp-libvips-linux-arm64" + ], + "os": ["linux"], + "cpu": ["arm64"] }, - "fsevents@2.3.3": { - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "os": ["darwin"], + "@img/sharp-linux-arm@0.34.5": { + "integrity": "sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==", + "optionalDependencies": [ + "@img/sharp-libvips-linux-arm" + ], + "os": ["linux"], + "cpu": ["arm"] + }, + "@img/sharp-linux-ppc64@0.34.5": { + "integrity": "sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==", + "optionalDependencies": [ + "@img/sharp-libvips-linux-ppc64" + ], + "os": ["linux"], + "cpu": ["ppc64"] + }, + "@img/sharp-linux-riscv64@0.34.5": { + "integrity": "sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==", + "optionalDependencies": [ + "@img/sharp-libvips-linux-riscv64" + ], + "os": ["linux"], + "cpu": ["riscv64"] + }, + "@img/sharp-linux-s390x@0.34.5": { + "integrity": "sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==", + "optionalDependencies": [ + "@img/sharp-libvips-linux-s390x" + ], + "os": ["linux"], + "cpu": ["s390x"] + }, + "@img/sharp-linux-x64@0.34.5": { + "integrity": "sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==", + "optionalDependencies": [ + "@img/sharp-libvips-linux-x64" + ], + "os": ["linux"], + "cpu": ["x64"] + }, + "@img/sharp-linuxmusl-arm64@0.34.5": { + "integrity": "sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==", + "optionalDependencies": [ + "@img/sharp-libvips-linuxmusl-arm64" + ], + "os": ["linux"], + "cpu": ["arm64"] + }, + "@img/sharp-linuxmusl-x64@0.34.5": { + "integrity": "sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==", + "optionalDependencies": [ + "@img/sharp-libvips-linuxmusl-x64" + ], + "os": ["linux"], + "cpu": ["x64"] + }, + "@img/sharp-wasm32@0.34.5": { + "integrity": "sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==", + "dependencies": [ + "@emnapi/runtime" + ], + "cpu": ["wasm32"] + }, + "@img/sharp-win32-arm64@0.34.5": { + "integrity": "sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g==", + "os": ["win32"], + "cpu": ["arm64"] + }, + "@img/sharp-win32-ia32@0.34.5": { + "integrity": "sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg==", + "os": ["win32"], + "cpu": ["ia32"] + }, + "@img/sharp-win32-x64@0.34.5": { + "integrity": "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw==", + "os": ["win32"], + "cpu": ["x64"] + }, + "@jridgewell/gen-mapping@0.3.13": { + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dependencies": [ + "@jridgewell/sourcemap-codec", + "@jridgewell/trace-mapping" + ] + }, + "@jridgewell/remapping@2.3.5": { + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dependencies": [ + "@jridgewell/gen-mapping", + "@jridgewell/trace-mapping" + ] + }, + "@jridgewell/resolve-uri@3.1.2": { + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==" + }, + "@jridgewell/sourcemap-codec@1.5.5": { + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==" + }, + "@jridgewell/trace-mapping@0.3.31": { + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dependencies": [ + "@jridgewell/resolve-uri", + "@jridgewell/sourcemap-codec" + ] + }, + "@lezer/common@1.5.0": { + "integrity": "sha512-PNGcolp9hr4PJdXR4ix7XtixDrClScvtSCYW3rQG106oVMOOI+jFb+0+J3mbeL/53g1Zd6s0kJzaw6Ri68GmAA==" + }, + "@lezer/highlight@1.2.3": { + "integrity": "sha512-qXdH7UqTvGfdVBINrgKhDsVTJTxactNNxLk7+UMwZhU13lMHaOBlJe9Vqp907ya56Y3+ed2tlqzys7jDkTmW0g==", + "dependencies": [ + "@lezer/common" + ] + }, + "@lezer/json@1.0.3": { + "integrity": "sha512-BP9KzdF9Y35PDpv04r0VeSTKDeox5vVr3efE7eBbx3r4s3oNLfunchejZhjArmeieBH+nVOpgIiBJpEAv8ilqQ==", + "dependencies": [ + "@lezer/common", + "@lezer/highlight", + "@lezer/lr" + ] + }, + "@lezer/lr@1.4.7": { + "integrity": "sha512-wNIFWdSUfX9Jc6ePMzxSPVgTVB4EOfDIwLQLWASyiUdHKaMsiilj9bYiGkGQCKVodd0x6bgQCV207PILGFCF9Q==", + "dependencies": [ + "@lezer/common" + ] + }, + "@lezer/yaml@1.0.3": { + "integrity": "sha512-GuBLekbw9jDBDhGur82nuwkxKQ+a3W5H0GfaAthDXcAu+XdpS43VlnxA9E9hllkpSP5ellRDKjLLj7Lu9Wr6xA==", + "dependencies": [ + "@lezer/common", + "@lezer/highlight", + "@lezer/lr" + ] + }, + "@lit-labs/ssr-dom-shim@1.5.1": { + "integrity": "sha512-Aou5UdlSpr5whQe8AA/bZG0jMj96CoJIWbGfZ91qieWu5AWUMKw8VR/pAkQkJYvBNhmCcWnZlyyk5oze8JIqYA==" + }, + "@lit/reactive-element@2.1.2": { + "integrity": "sha512-pbCDiVMnne1lYUIaYNN5wrwQXDtHaYtg7YEFPeW+hws6U47WeFvISGUWekPGKWOP1ygrs0ef0o1VJMk1exos5A==", + "dependencies": [ + "@lit-labs/ssr-dom-shim" + ] + }, + "@marijn/find-cluster-break@1.0.2": { + "integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==" + }, + "@nodelib/fs.scandir@2.1.5": { + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dependencies": [ + "@nodelib/fs.stat", + "run-parallel" + ] + }, + "@nodelib/fs.stat@2.0.5": { + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==" + }, + "@nodelib/fs.walk@1.2.8": { + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dependencies": [ + "@nodelib/fs.scandir", + "fastq" + ] + }, + "@parcel/watcher-android-arm64@2.5.4": { + "integrity": "sha512-hoh0vx4v+b3BNI7Cjoy2/B0ARqcwVNrzN/n7DLq9ZB4I3lrsvhrkCViJyfTj/Qi5xM9YFiH4AmHGK6pgH1ss7g==", + "os": ["android"], + "cpu": ["arm64"] + }, + "@parcel/watcher-darwin-arm64@2.5.4": { + "integrity": "sha512-kphKy377pZiWpAOyTgQYPE5/XEKVMaj6VUjKT5VkNyUJlr2qZAn8gIc7CPzx+kbhvqHDT9d7EqdOqRXT6vk0zw==", + "os": ["darwin"], + "cpu": ["arm64"] + }, + "@parcel/watcher-darwin-x64@2.5.4": { + "integrity": "sha512-UKaQFhCtNJW1A9YyVz3Ju7ydf6QgrpNQfRZ35wNKUhTQ3dxJ/3MULXN5JN/0Z80V/KUBDGa3RZaKq1EQT2a2gg==", + "os": ["darwin"], + "cpu": ["x64"] + }, + "@parcel/watcher-freebsd-x64@2.5.4": { + "integrity": "sha512-Dib0Wv3Ow/m2/ttvLdeI2DBXloO7t3Z0oCp4bAb2aqyqOjKPPGrg10pMJJAQ7tt8P4V2rwYwywkDhUia/FgS+Q==", + "os": ["freebsd"], + "cpu": ["x64"] + }, + "@parcel/watcher-linux-arm-glibc@2.5.4": { + "integrity": "sha512-I5Vb769pdf7Q7Sf4KNy8Pogl/URRCKu9ImMmnVKYayhynuyGYMzuI4UOWnegQNa2sGpsPSbzDsqbHNMyeyPCgw==", + "os": ["linux"], + "cpu": ["arm"] + }, + "@parcel/watcher-linux-arm-musl@2.5.4": { + "integrity": "sha512-kGO8RPvVrcAotV4QcWh8kZuHr9bXi9a3bSZw7kFarYR0+fGliU7hd/zevhjw8fnvIKG3J9EO5G6sXNGCSNMYPQ==", + "os": ["linux"], + "cpu": ["arm"] + }, + "@parcel/watcher-linux-arm64-glibc@2.5.4": { + "integrity": "sha512-KU75aooXhqGFY2W5/p8DYYHt4hrjHZod8AhcGAmhzPn/etTa+lYCDB2b1sJy3sWJ8ahFVTdy+EbqSBvMx3iFlw==", + "os": ["linux"], + "cpu": ["arm64"] + }, + "@parcel/watcher-linux-arm64-musl@2.5.4": { + "integrity": "sha512-Qx8uNiIekVutnzbVdrgSanM+cbpDD3boB1f8vMtnuG5Zau4/bdDbXyKwIn0ToqFhIuob73bcxV9NwRm04/hzHQ==", + "os": ["linux"], + "cpu": ["arm64"] + }, + "@parcel/watcher-linux-x64-glibc@2.5.4": { + "integrity": "sha512-UYBQvhYmgAv61LNUn24qGQdjtycFBKSK3EXr72DbJqX9aaLbtCOO8+1SkKhD/GNiJ97ExgcHBrukcYhVjrnogA==", + "os": ["linux"], + "cpu": ["x64"] + }, + "@parcel/watcher-linux-x64-musl@2.5.4": { + "integrity": "sha512-YoRWCVgxv8akZrMhdyVi6/TyoeeMkQ0PGGOf2E4omODrvd1wxniXP+DBynKoHryStks7l+fDAMUBRzqNHrVOpg==", + "os": ["linux"], + "cpu": ["x64"] + }, + "@parcel/watcher-win32-arm64@2.5.4": { + "integrity": "sha512-iby+D/YNXWkiQNYcIhg8P5hSjzXEHaQrk2SLrWOUD7VeC4Ohu0WQvmV+HDJokZVJ2UjJ4AGXW3bx7Lls9Ln4TQ==", + "os": ["win32"], + "cpu": ["arm64"] + }, + "@parcel/watcher-win32-ia32@2.5.4": { + "integrity": "sha512-vQN+KIReG0a2ZDpVv8cgddlf67J8hk1WfZMMP7sMeZmJRSmEax5xNDNWKdgqSe2brOKTQQAs3aCCUal2qBHAyg==", + "os": ["win32"], + "cpu": ["ia32"] + }, + "@parcel/watcher-win32-x64@2.5.4": { + "integrity": "sha512-3A6efb6BOKwyw7yk9ro2vus2YTt2nvcd56AuzxdMiVOxL9umDyN5PKkKfZ/gZ9row41SjVmTVQNWQhaRRGpOKw==", + "os": ["win32"], + "cpu": ["x64"] + }, + "@parcel/watcher@2.5.4": { + "integrity": "sha512-WYa2tUVV5HiArWPB3ydlOc4R2ivq0IDrlqhMi3l7mVsFEXNcTfxYFPIHXHXIh/ca/y/V5N4E1zecyxdIBjYnkQ==", + "dependencies": [ + "detect-libc", + "is-glob", + "node-addon-api", + "picomatch@4.0.3" + ], + "optionalDependencies": [ + "@parcel/watcher-android-arm64", + "@parcel/watcher-darwin-arm64", + "@parcel/watcher-darwin-x64", + "@parcel/watcher-freebsd-x64", + "@parcel/watcher-linux-arm-glibc", + "@parcel/watcher-linux-arm-musl", + "@parcel/watcher-linux-arm64-glibc", + "@parcel/watcher-linux-arm64-musl", + "@parcel/watcher-linux-x64-glibc", + "@parcel/watcher-linux-x64-musl", + "@parcel/watcher-win32-arm64", + "@parcel/watcher-win32-ia32", + "@parcel/watcher-win32-x64" + ], + "scripts": true + }, + "@pkgr/core@0.2.9": { + "integrity": "sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==" + }, + "@polka/url@1.0.0-next.29": { + "integrity": "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==" + }, + "@popperjs/core@2.11.8": { + "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==" + }, + "@prettier/plugin-pug@3.4.2_prettier@3.8.0": { + "integrity": "sha512-/VOVeIscKYlPpsZrjrRV+44ZftCEIJq9Z/zR8PtAz/EDv82TKscw3z+fhTVqRz68G1TqQ/5COMFUVfPwPBH90w==", + "dependencies": [ + "prettier@3.8.0", + "pug-lexer" + ] + }, + "@replit/codemirror-vim@6.3.0_@codemirror+commands@6.10.1_@codemirror+language@6.12.1_@codemirror+search@6.6.0_@codemirror+state@6.5.4_@codemirror+view@6.39.11": { + "integrity": "sha512-aTx931ULAMuJx6xLf7KQDOL7CxD+Sa05FktTDrtLaSy53uj01ll3Zf17JdKsriER248oS55GBzg0CfCTjEneAQ==", + "dependencies": [ + "@codemirror/commands", + "@codemirror/language", + "@codemirror/search", + "@codemirror/state", + "@codemirror/view" + ] + }, + "@rolldown/pluginutils@1.0.0-beta.53": { + "integrity": "sha512-vENRlFU4YbrwVqNDZ7fLvy+JR1CRkyr01jhSiDpE1u6py3OMzQfztQU2jxykW3ALNxO4kSlqIDeYyD0Y9RcQeQ==" + }, + "@rollup/rollup-android-arm-eabi@4.55.2": { + "integrity": "sha512-21J6xzayjy3O6NdnlO6aXi/urvSRjm6nCI6+nF6ra2YofKruGixN9kfT+dt55HVNwfDmpDHJcaS3JuP/boNnlA==", + "os": ["android"], + "cpu": ["arm"] + }, + "@rollup/rollup-android-arm64@4.55.2": { + "integrity": "sha512-eXBg7ibkNUZ+sTwbFiDKou0BAckeV6kIigK7y5Ko4mB/5A1KLhuzEKovsmfvsL8mQorkoincMFGnQuIT92SKqA==", + "os": ["android"], + "cpu": ["arm64"] + }, + "@rollup/rollup-darwin-arm64@4.55.2": { + "integrity": "sha512-UCbaTklREjrc5U47ypLulAgg4njaqfOVLU18VrCrI+6E5MQjuG0lSWaqLlAJwsD7NpFV249XgB0Bi37Zh5Sz4g==", + "os": ["darwin"], + "cpu": ["arm64"] + }, + "@rollup/rollup-darwin-x64@4.55.2": { + "integrity": "sha512-dP67MA0cCMHFT2g5XyjtpVOtp7y4UyUxN3dhLdt11at5cPKnSm4lY+EhwNvDXIMzAMIo2KU+mc9wxaAQJTn7sQ==", + "os": ["darwin"], + "cpu": ["x64"] + }, + "@rollup/rollup-freebsd-arm64@4.55.2": { + "integrity": "sha512-WDUPLUwfYV9G1yxNRJdXcvISW15mpvod1Wv3ok+Ws93w1HjIVmCIFxsG2DquO+3usMNCpJQ0wqO+3GhFdl6Fow==", + "os": ["freebsd"], + "cpu": ["arm64"] + }, + "@rollup/rollup-freebsd-x64@4.55.2": { + "integrity": "sha512-Ng95wtHVEulRwn7R0tMrlUuiLVL/HXA8Lt/MYVpy88+s5ikpntzZba1qEulTuPnPIZuOPcW9wNEiqvZxZmgmqQ==", + "os": ["freebsd"], + "cpu": ["x64"] + }, + "@rollup/rollup-linux-arm-gnueabihf@4.55.2": { + "integrity": "sha512-AEXMESUDWWGqD6LwO/HkqCZgUE1VCJ1OhbvYGsfqX2Y6w5quSXuyoy/Fg3nRqiwro+cJYFxiw5v4kB2ZDLhxrw==", + "os": ["linux"], + "cpu": ["arm"] + }, + "@rollup/rollup-linux-arm-musleabihf@4.55.2": { + "integrity": "sha512-ZV7EljjBDwBBBSv570VWj0hiNTdHt9uGznDtznBB4Caj3ch5rgD4I2K1GQrtbvJ/QiB+663lLgOdcADMNVC29Q==", + "os": ["linux"], + "cpu": ["arm"] + }, + "@rollup/rollup-linux-arm64-gnu@4.55.2": { + "integrity": "sha512-uvjwc8NtQVPAJtq4Tt7Q49FOodjfbf6NpqXyW/rjXoV+iZ3EJAHLNAnKT5UJBc6ffQVgmXTUL2ifYiLABlGFqA==", + "os": ["linux"], + "cpu": ["arm64"] + }, + "@rollup/rollup-linux-arm64-musl@4.55.2": { + "integrity": "sha512-s3KoWVNnye9mm/2WpOZ3JeUiediUVw6AvY/H7jNA6qgKA2V2aM25lMkVarTDfiicn/DLq3O0a81jncXszoyCFA==", + "os": ["linux"], + "cpu": ["arm64"] + }, + "@rollup/rollup-linux-loong64-gnu@4.55.2": { + "integrity": "sha512-gi21faacK+J8aVSyAUptML9VQN26JRxe484IbF+h3hpG+sNVoMXPduhREz2CcYr5my0NE3MjVvQ5bMKX71pfVA==", + "os": ["linux"], + "cpu": ["loong64"] + }, + "@rollup/rollup-linux-loong64-musl@4.55.2": { + "integrity": "sha512-qSlWiXnVaS/ceqXNfnoFZh4IiCA0EwvCivivTGbEu1qv2o+WTHpn1zNmCTAoOG5QaVr2/yhCoLScQtc/7RxshA==", + "os": ["linux"], + "cpu": ["loong64"] + }, + "@rollup/rollup-linux-ppc64-gnu@4.55.2": { + "integrity": "sha512-rPyuLFNoF1B0+wolH277E780NUKf+KoEDb3OyoLbAO18BbeKi++YN6gC/zuJoPPDlQRL3fIxHxCxVEWiem2yXw==", + "os": ["linux"], + "cpu": ["ppc64"] + }, + "@rollup/rollup-linux-ppc64-musl@4.55.2": { + "integrity": "sha512-g+0ZLMook31iWV4PvqKU0i9E78gaZgYpSrYPed/4Bu+nGTgfOPtfs1h11tSSRPXSjC5EzLTjV/1A7L2Vr8pJoQ==", + "os": ["linux"], + "cpu": ["ppc64"] + }, + "@rollup/rollup-linux-riscv64-gnu@4.55.2": { + "integrity": "sha512-i+sGeRGsjKZcQRh3BRfpLsM3LX3bi4AoEVqmGDyc50L6KfYsN45wVCSz70iQMwPWr3E5opSiLOwsC9WB4/1pqg==", + "os": ["linux"], + "cpu": ["riscv64"] + }, + "@rollup/rollup-linux-riscv64-musl@4.55.2": { + "integrity": "sha512-C1vLcKc4MfFV6I0aWsC7B2Y9QcsiEcvKkfxprwkPfLaN8hQf0/fKHwSF2lcYzA9g4imqnhic729VB9Fo70HO3Q==", + "os": ["linux"], + "cpu": ["riscv64"] + }, + "@rollup/rollup-linux-s390x-gnu@4.55.2": { + "integrity": "sha512-68gHUK/howpQjh7g7hlD9DvTTt4sNLp1Bb+Yzw2Ki0xvscm2cOdCLZNJNhd2jW8lsTPrHAHuF751BygifW4bkQ==", + "os": ["linux"], + "cpu": ["s390x"] + }, + "@rollup/rollup-linux-x64-gnu@4.55.2": { + "integrity": "sha512-1e30XAuaBP1MAizaOBApsgeGZge2/Byd6wV4a8oa6jPdHELbRHBiw7wvo4dp7Ie2PE8TZT4pj9RLGZv9N4qwlw==", + "os": ["linux"], + "cpu": ["x64"] + }, + "@rollup/rollup-linux-x64-musl@4.55.2": { + "integrity": "sha512-4BJucJBGbuGnH6q7kpPqGJGzZnYrpAzRd60HQSt3OpX/6/YVgSsJnNzR8Ot74io50SeVT4CtCWe/RYIAymFPwA==", + "os": ["linux"], + "cpu": ["x64"] + }, + "@rollup/rollup-openbsd-x64@4.55.2": { + "integrity": "sha512-cT2MmXySMo58ENv8p6/O6wI/h/gLnD3D6JoajwXFZH6X9jz4hARqUhWpGuQhOgLNXscfZYRQMJvZDtWNzMAIDw==", + "os": ["openbsd"], + "cpu": ["x64"] + }, + "@rollup/rollup-openharmony-arm64@4.55.2": { + "integrity": "sha512-sZnyUgGkuzIXaK3jNMPmUIyJrxu/PjmATQrocpGA1WbCPX8H5tfGgRSuYtqBYAvLuIGp8SPRb1O4d1Fkb5fXaQ==", + "os": ["openharmony"], + "cpu": ["arm64"] + }, + "@rollup/rollup-win32-arm64-msvc@4.55.2": { + "integrity": "sha512-sDpFbenhmWjNcEbBcoTV0PWvW5rPJFvu+P7XoTY0YLGRupgLbFY0XPfwIbJOObzO7QgkRDANh65RjhPmgSaAjQ==", + "os": ["win32"], + "cpu": ["arm64"] + }, + "@rollup/rollup-win32-ia32-msvc@4.55.2": { + "integrity": "sha512-GvJ03TqqaweWCigtKQVBErw2bEhu1tyfNQbarwr94wCGnczA9HF8wqEe3U/Lfu6EdeNP0p6R+APeHVwEqVxpUQ==", + "os": ["win32"], + "cpu": ["ia32"] + }, + "@rollup/rollup-win32-x64-gnu@4.55.2": { + "integrity": "sha512-KvXsBvp13oZz9JGe5NYS7FNizLe99Ny+W8ETsuCyjXiKdiGrcz2/J/N8qxZ/RSwivqjQguug07NLHqrIHrqfYw==", + "os": ["win32"], + "cpu": ["x64"] + }, + "@rollup/rollup-win32-x64-msvc@4.55.2": { + "integrity": "sha512-xNO+fksQhsAckRtDSPWaMeT1uIM+JrDRXlerpnWNXhn1TdB3YZ6uKBMBTKP0eX9XtYEP978hHk1f8332i2AW8Q==", + "os": ["win32"], + "cpu": ["x64"] + }, + "@sagold/json-pointer@5.1.2": { + "integrity": "sha512-+wAhJZBXa6MNxRScg6tkqEbChEHMgVZAhTHVJ60Y7sbtXtu9XA49KfUkdWlS2x78D6H9nryiKePiYozumauPfA==" + }, + "@sagold/json-query@6.2.0": { + "integrity": "sha512-7bOIdUE6eHeoWtFm8TvHQHfTVSZuCs+3RpOKmZCDBIOrxpvF/rNFTeuvIyjHva/RR0yVS3kQtr+9TW72LQEZjA==", + "dependencies": [ + "@sagold/json-pointer", + "ebnf" + ] + }, + "@shikijs/core@1.29.2": { + "integrity": "sha512-vju0lY9r27jJfOY4Z7+Rt/nIOjzJpZ3y+nYpqtUZInVoXQ/TJZcfGnNOGnKjFdVZb8qexiCuSlZRKcGfhhTTZQ==", + "dependencies": [ + "@shikijs/engine-javascript", + "@shikijs/engine-oniguruma", + "@shikijs/types", + "@shikijs/vscode-textmate", + "@types/hast", + "hast-util-to-html" + ] + }, + "@shikijs/engine-javascript@1.29.2": { + "integrity": "sha512-iNEZv4IrLYPv64Q6k7EPpOCE/nuvGiKl7zxdq0WFuRPF5PAE9PRo2JGq/d8crLusM59BRemJ4eOqrFrC4wiQ+A==", + "dependencies": [ + "@shikijs/types", + "@shikijs/vscode-textmate", + "oniguruma-to-es" + ] + }, + "@shikijs/engine-oniguruma@1.29.2": { + "integrity": "sha512-7iiOx3SG8+g1MnlzZVDYiaeHe7Ez2Kf2HrJzdmGwkRisT7r4rak0e655AcM/tF9JG/kg5fMNYlLLKglbN7gBqA==", + "dependencies": [ + "@shikijs/types", + "@shikijs/vscode-textmate" + ] + }, + "@shikijs/langs@1.29.2": { + "integrity": "sha512-FIBA7N3LZ+223U7cJDUYd5shmciFQlYkFXlkKVaHsCPgfVLiO+e12FmQE6Tf9vuyEsFe3dIl8qGWKXgEHL9wmQ==", + "dependencies": [ + "@shikijs/types" + ] + }, + "@shikijs/markdown-it@1.29.2": { + "integrity": "sha512-RPHqGU8RGQZ2TGMnEqLnSyM9CjPSjb0f8bwSLnJgBmWPWguoygoaFyYkXG0kwMtBtChNYsqQz1C0fLcbo6dY8g==", + "dependencies": [ + "markdown-it", + "shiki" + ] + }, + "@shikijs/themes@1.29.2": { + "integrity": "sha512-i9TNZlsq4uoyqSbluIcZkmPL9Bfi3djVxRnofUHwvx/h6SRW3cwgBC5SML7vsDcWyukY0eCzVN980rqP6qNl9g==", + "dependencies": [ + "@shikijs/types" + ] + }, + "@shikijs/types@1.29.2": { + "integrity": "sha512-VJjK0eIijTZf0QSTODEXCqinjBn0joAHQ+aPSBzrv4O2d/QSbsMw+ZeSRx03kV34Hy7NzUvV/7NqfYGRLrASmw==", + "dependencies": [ + "@shikijs/vscode-textmate", + "@types/hast" + ] + }, + "@shikijs/vscode-textmate@10.0.2": { + "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==" + }, + "@tsconfig/node22@22.0.5": { + "integrity": "sha512-hLf2ld+sYN/BtOJjHUWOk568dvjFQkHnLNa6zce25GIH+vxKfvTgm3qpaH6ToF5tu/NN0IH66s+Bb5wElHrLcw==" + }, + "@types/colors@1.2.4": { + "integrity": "sha512-oSQxEVIDcYisAzWLa+wr50GSIPu8ml4PsKNJzgrDX3SmEHVBBqbaUurqsUceFauNlCRxNtENKkQm3yOe3m3nfg==", + "dependencies": [ + "colors" + ], + "deprecated": true + }, + "@types/estree@1.0.8": { + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==" + }, + "@types/hast@3.0.4": { + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "dependencies": [ + "@types/unist" + ] + }, + "@types/humanize-duration@3.27.4": { + "integrity": "sha512-yaf7kan2Sq0goxpbcwTQ+8E9RP6HutFBPv74T/IA/ojcHKhuKVlk2YFYyHhWZeLvZPzzLE3aatuQB4h0iqyyUA==" + }, + "@types/js-yaml@4.0.9": { + "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==" + }, + "@types/json-schema@7.0.15": { + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" + }, + "@types/mdast@4.0.4": { + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "dependencies": [ + "@types/unist" + ] + }, + "@types/node@24.10.9": { + "integrity": "sha512-ne4A0IpG3+2ETuREInjPNhUGis1SFjv1d5asp8MzEAGtOZeTeHVDOYqOgqfhvseqg/iXty2hjBf1zAOb7RNiNw==", + "dependencies": [ + "undici-types" + ] + }, + "@types/react@19.2.8": { + "integrity": "sha512-3MbSL37jEchWZz2p2mjntRZtPt837ij10ApxKfgmXCTuHWagYg7iA5bqPw6C8BMPfwidlvfPI/fxOc42HLhcyg==", + "dependencies": [ + "csstype" + ] + }, + "@types/trusted-types@2.0.7": { + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==" + }, + "@types/unist@3.0.3": { + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==" + }, + "@types/web-bluetooth@0.0.21": { + "integrity": "sha512-oIQLCGWtcFZy2JW77j9k8nHzAOpqMHLQejDA48XXMWH6tjCQHz5RCFz1bzsmROyL6PUm+LLnUiI4BCn221inxA==" + }, + "@types/yargs-parser@21.0.3": { + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==" + }, + "@types/yargs@17.0.35": { + "integrity": "sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg==", + "dependencies": [ + "@types/yargs-parser" + ] + }, + "@typescript-eslint/eslint-plugin@8.53.1_@typescript-eslint+parser@8.53.1__eslint@9.39.2___jiti@2.6.1__typescript@5.9.3__jiti@2.6.1_eslint@9.39.2__jiti@2.6.1_typescript@5.9.3_jiti@2.6.1": { + "integrity": "sha512-cFYYFZ+oQFi6hUnBTbLRXfTJiaQtYE3t4O692agbBl+2Zy+eqSKWtPjhPXJu1G7j4RLjKgeJPDdq3EqOwmX5Ag==", + "dependencies": [ + "@eslint-community/regexpp", + "@typescript-eslint/parser", + "@typescript-eslint/scope-manager", + "@typescript-eslint/type-utils", + "@typescript-eslint/utils", + "@typescript-eslint/visitor-keys", + "eslint", + "ignore@7.0.5", + "natural-compare", + "ts-api-utils", + "typescript" + ] + }, + "@typescript-eslint/parser@8.53.1_eslint@9.39.2__jiti@2.6.1_typescript@5.9.3_jiti@2.6.1": { + "integrity": "sha512-nm3cvFN9SqZGXjmw5bZ6cGmvJSyJPn0wU9gHAZZHDnZl2wF9PhHv78Xf06E0MaNk4zLVHL8hb2/c32XvyJOLQg==", + "dependencies": [ + "@typescript-eslint/scope-manager", + "@typescript-eslint/types", + "@typescript-eslint/typescript-estree", + "@typescript-eslint/visitor-keys", + "debug", + "eslint", + "typescript" + ] + }, + "@typescript-eslint/project-service@8.53.1_typescript@5.9.3": { + "integrity": "sha512-WYC4FB5Ra0xidsmlPb+1SsnaSKPmS3gsjIARwbEkHkoWloQmuzcfypljaJcR78uyLA1h8sHdWWPHSLDI+MtNog==", + "dependencies": [ + "@typescript-eslint/tsconfig-utils", + "@typescript-eslint/types", + "debug", + "typescript" + ] + }, + "@typescript-eslint/scope-manager@8.53.1": { + "integrity": "sha512-Lu23yw1uJMFY8cUeq7JlrizAgeQvWugNQzJp8C3x8Eo5Jw5Q2ykMdiiTB9vBVOOUBysMzmRRmUfwFrZuI2C4SQ==", + "dependencies": [ + "@typescript-eslint/types", + "@typescript-eslint/visitor-keys" + ] + }, + "@typescript-eslint/tsconfig-utils@8.53.1_typescript@5.9.3": { + "integrity": "sha512-qfvLXS6F6b1y43pnf0pPbXJ+YoXIC7HKg0UGZ27uMIemKMKA6XH2DTxsEDdpdN29D+vHV07x/pnlPNVLhdhWiA==", + "dependencies": [ + "typescript" + ] + }, + "@typescript-eslint/type-utils@8.53.1_eslint@9.39.2__jiti@2.6.1_typescript@5.9.3_jiti@2.6.1": { + "integrity": "sha512-MOrdtNvyhy0rHyv0ENzub1d4wQYKb2NmIqG7qEqPWFW7Mpy2jzFC3pQ2yKDvirZB7jypm5uGjF2Qqs6OIqu47w==", + "dependencies": [ + "@typescript-eslint/types", + "@typescript-eslint/typescript-estree", + "@typescript-eslint/utils", + "debug", + "eslint", + "ts-api-utils", + "typescript" + ] + }, + "@typescript-eslint/types@8.53.1": { + "integrity": "sha512-jr/swrr2aRmUAUjW5/zQHbMaui//vQlsZcJKijZf3M26bnmLj8LyZUpj8/Rd6uzaek06OWsqdofN/Thenm5O8A==" + }, + "@typescript-eslint/typescript-estree@8.53.1_typescript@5.9.3": { + "integrity": "sha512-RGlVipGhQAG4GxV1s34O91cxQ/vWiHJTDHbXRr0li2q/BGg3RR/7NM8QDWgkEgrwQYCvmJV9ichIwyoKCQ+DTg==", + "dependencies": [ + "@typescript-eslint/project-service", + "@typescript-eslint/tsconfig-utils", + "@typescript-eslint/types", + "@typescript-eslint/visitor-keys", + "debug", + "minimatch@9.0.5", + "semver@7.7.3", + "tinyglobby", + "ts-api-utils", + "typescript" + ] + }, + "@typescript-eslint/utils@8.53.1_eslint@9.39.2__jiti@2.6.1_typescript@5.9.3_jiti@2.6.1": { + "integrity": "sha512-c4bMvGVWW4hv6JmDUEG7fSYlWOl3II2I4ylt0NM+seinYQlZMQIaKaXIIVJWt9Ofh6whrpM+EdDQXKXjNovvrg==", + "dependencies": [ + "@eslint-community/eslint-utils", + "@typescript-eslint/scope-manager", + "@typescript-eslint/types", + "@typescript-eslint/typescript-estree", + "eslint", + "typescript" + ] + }, + "@typescript-eslint/visitor-keys@8.53.1": { + "integrity": "sha512-oy+wV7xDKFPRyNggmXuZQSBzvoLnpmJs+GhzRhPjrxl2b/jIlyjVokzm47CZCDUdXKr2zd7ZLodPfOBpOPyPlg==", + "dependencies": [ + "@typescript-eslint/types", + "eslint-visitor-keys@4.2.1" + ] + }, + "@uiw/codemirror-themes@4.25.4_@codemirror+language@6.12.1_@codemirror+state@6.5.4_@codemirror+view@6.39.11": { + "integrity": "sha512-2SLktItgcZC4p0+PfFusEbAHwbuAWe3bOOntCevVgHtrWGtGZX3IPv2k8IKZMgOXtAHyGKpJvT9/nspPn/uCQg==", + "dependencies": [ + "@codemirror/language", + "@codemirror/state", + "@codemirror/view" + ] + }, + "@ungap/structured-clone@1.3.0": { + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==" + }, + "@vitejs/plugin-vue@6.0.3_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_vue@3.5.27__typescript@5.9.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2_typescript@5.9.3": { + "integrity": "sha512-TlGPkLFLVOY3T7fZrwdvKpjprR3s4fxRln0ORDo1VQ7HHyxJwTlrjKU3kpVWTlaAjIEuCTokmjkZnr8Tpc925w==", + "dependencies": [ + "@rolldown/pluginutils", + "vite", + "vue" + ] + }, + "@volar/language-core@2.4.27": { + "integrity": "sha512-DjmjBWZ4tJKxfNC1F6HyYERNHPYS7L7OPFyCrestykNdUZMFYzI9WTyvwPcaNaHlrEUwESHYsfEw3isInncZxQ==", + "dependencies": [ + "@volar/source-map" + ] + }, + "@volar/source-map@2.4.27": { + "integrity": "sha512-ynlcBReMgOZj2i6po+qVswtDUeeBRCTgDurjMGShbm8WYZgJ0PA4RmtebBJ0BCYol1qPv3GQF6jK7C9qoVc7lg==" + }, + "@volar/typescript@2.4.27": { + "integrity": "sha512-eWaYCcl/uAPInSK2Lze6IqVWaBu/itVqR5InXcHXFyles4zO++Mglt3oxdgj75BDcv1Knr9Y93nowS8U3wqhxg==", + "dependencies": [ + "@volar/language-core", + "path-browserify", + "vscode-uri" + ] + }, + "@vue/babel-helper-vue-transform-on@1.5.0": { + "integrity": "sha512-0dAYkerNhhHutHZ34JtTl2czVQHUNWv6xEbkdF5W+Yrv5pCWsqjeORdOgbtW2I9gWlt+wBmVn+ttqN9ZxR5tzA==" + }, + "@vue/babel-plugin-jsx@1.5.0_@babel+core@7.28.6": { + "integrity": "sha512-mneBhw1oOqCd2247O0Yw/mRwC9jIGACAJUlawkmMBiNmL4dGA2eMzuNZVNqOUfYTa6vqmND4CtOPzmEEEqLKFw==", + "dependencies": [ + "@babel/core", + "@babel/helper-module-imports", + "@babel/helper-plugin-utils", + "@babel/plugin-syntax-jsx", + "@babel/template", + "@babel/traverse", + "@babel/types", + "@vue/babel-helper-vue-transform-on", + "@vue/babel-plugin-resolve-type", + "@vue/shared" + ], + "optionalPeers": [ + "@babel/core" + ] + }, + "@vue/babel-plugin-resolve-type@1.5.0_@babel+core@7.28.6": { + "integrity": "sha512-Wm/60o+53JwJODm4Knz47dxJnLDJ9FnKnGZJbUUf8nQRAtt6P+undLUAVU3Ha33LxOJe6IPoifRQ6F/0RrU31w==", + "dependencies": [ + "@babel/code-frame", + "@babel/core", + "@babel/helper-module-imports", + "@babel/helper-plugin-utils", + "@babel/parser", + "@vue/compiler-sfc" + ] + }, + "@vue/compiler-core@3.5.27": { + "integrity": "sha512-gnSBQjZA+//qDZen+6a2EdHqJ68Z7uybrMf3SPjEGgG4dicklwDVmMC1AeIHxtLVPT7sn6sH1KOO+tS6gwOUeQ==", + "dependencies": [ + "@babel/parser", + "@vue/shared", + "entities@7.0.0", + "estree-walker", + "source-map-js" + ] + }, + "@vue/compiler-dom@3.5.27": { + "integrity": "sha512-oAFea8dZgCtVVVTEC7fv3T5CbZW9BxpFzGGxC79xakTr6ooeEqmRuvQydIiDAkglZEAd09LgVf1RoDnL54fu5w==", + "dependencies": [ + "@vue/compiler-core", + "@vue/shared" + ] + }, + "@vue/compiler-sfc@3.5.27": { + "integrity": "sha512-sHZu9QyDPeDmN/MRoshhggVOWE5WlGFStKFwu8G52swATgSny27hJRWteKDSUUzUH+wp+bmeNbhJnEAel/auUQ==", + "dependencies": [ + "@babel/parser", + "@vue/compiler-core", + "@vue/compiler-dom", + "@vue/compiler-ssr", + "@vue/shared", + "estree-walker", + "magic-string", + "postcss", + "source-map-js" + ] + }, + "@vue/compiler-ssr@3.5.27": { + "integrity": "sha512-Sj7h+JHt512fV1cTxKlYhg7qxBvack+BGncSpH+8vnN+KN95iPIcqB5rsbblX40XorP+ilO7VIKlkuu3Xq2vjw==", + "dependencies": [ + "@vue/compiler-dom", + "@vue/shared" + ] + }, + "@vue/devtools-api@6.6.4": { + "integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==" + }, + "@vue/devtools-core@8.0.5_vue@3.5.27__typescript@5.9.3_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_typescript@5.9.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-dpCw8nl0GDBuiL9SaY0mtDxoGIEmU38w+TQiYEPOLhW03VDC0lfNMYXS/qhl4I0YlysGp04NLY4UNn6xgD0VIQ==", + "dependencies": [ + "@vue/devtools-kit", + "@vue/devtools-shared", + "mitt", + "nanoid@5.1.6", + "pathe", + "vite-hot-client", + "vue" + ] + }, + "@vue/devtools-kit@8.0.5": { + "integrity": "sha512-q2VV6x1U3KJMTQPUlRMyWEKVbcHuxhqJdSr6Jtjz5uAThAIrfJ6WVZdGZm5cuO63ZnSUz0RCsVwiUUb0mDV0Yg==", + "dependencies": [ + "@vue/devtools-shared", + "birpc", + "hookable", + "mitt", + "perfect-debounce", + "speakingurl", + "superjson" + ] + }, + "@vue/devtools-shared@8.0.5": { + "integrity": "sha512-bRLn6/spxpmgLk+iwOrR29KrYnJjG9DGpHGkDFG82UM21ZpJ39ztUT9OXX3g+usW7/b2z+h46I9ZiYyB07XMXg==", + "dependencies": [ + "rfdc" + ] + }, + "@vue/eslint-config-prettier@10.2.0_eslint@9.39.2__jiti@2.6.1_prettier@3.8.0_jiti@2.6.1_eslint-config-prettier@10.1.8__eslint@9.39.2___jiti@2.6.1__jiti@2.6.1": { + "integrity": "sha512-GL3YBLwv/+b86yHcNNfPJxOTtVFJ4Mbc9UU3zR+KVoG7SwGTjPT+32fXamscNumElhcpXW3mT0DgzS9w32S7Bw==", + "dependencies": [ + "eslint", + "eslint-config-prettier", + "eslint-plugin-prettier", + "prettier@3.8.0" + ] + }, + "@vue/eslint-config-typescript@14.6.0_eslint@9.39.2__jiti@2.6.1_eslint-plugin-vue@10.7.0__eslint@9.39.2___jiti@2.6.1__vue-eslint-parser@10.2.0___eslint@9.39.2____jiti@2.6.1___jiti@2.6.1__jiti@2.6.1_typescript@5.9.3_jiti@2.6.1_vue-eslint-parser@10.2.0__eslint@9.39.2___jiti@2.6.1__jiti@2.6.1": { + "integrity": "sha512-UpiRY/7go4Yps4mYCjkvlIbVWmn9YvPGQDxTAlcKLphyaD77LjIu3plH4Y9zNT0GB4f3K5tMmhhtRhPOgrQ/bQ==", + "dependencies": [ + "@typescript-eslint/utils", + "eslint", + "eslint-plugin-vue", + "fast-glob", + "typescript", + "typescript-eslint", + "vue-eslint-parser" + ], + "optionalPeers": [ + "typescript" + ] + }, + "@vue/language-core@3.2.2": { + "integrity": "sha512-5DAuhxsxBN9kbriklh3Q5AMaJhyOCNiQJvCskN9/30XOpdLiqZU9Q+WvjArP17ubdGEyZtBzlIeG5nIjEbNOrQ==", + "dependencies": [ + "@volar/language-core", + "@vue/compiler-dom", + "@vue/shared", + "alien-signals", + "muggle-string", + "path-browserify", + "picomatch@4.0.3" + ] + }, + "@vue/reactivity@3.5.27": { + "integrity": "sha512-vvorxn2KXfJ0nBEnj4GYshSgsyMNFnIQah/wczXlsNXt+ijhugmW+PpJ2cNPe4V6jpnBcs0MhCODKllWG+nvoQ==", + "dependencies": [ + "@vue/shared" + ] + }, + "@vue/runtime-core@3.5.27": { + "integrity": "sha512-fxVuX/fzgzeMPn/CLQecWeDIFNt3gQVhxM0rW02Tvp/YmZfXQgcTXlakq7IMutuZ/+Ogbn+K0oct9J3JZfyk3A==", + "dependencies": [ + "@vue/reactivity", + "@vue/shared" + ] + }, + "@vue/runtime-dom@3.5.27": { + "integrity": "sha512-/QnLslQgYqSJ5aUmb5F0z0caZPGHRB8LEAQ1s81vHFM5CBfnun63rxhvE/scVb/j3TbBuoZwkJyiLCkBluMpeg==", + "dependencies": [ + "@vue/reactivity", + "@vue/runtime-core", + "@vue/shared", + "csstype" + ] + }, + "@vue/server-renderer@3.5.27_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-qOz/5thjeP1vAFc4+BY3Nr6wxyLhpeQgAE/8dDtKo6a6xdk+L4W46HDZgNmLOBUDEkFXV3G7pRiUqxjX0/2zWA==", + "dependencies": [ + "@vue/compiler-ssr", + "@vue/shared", + "vue" + ] + }, + "@vue/shared@3.5.27": { + "integrity": "sha512-dXr/3CgqXsJkZ0n9F3I4elY8wM9jMJpP3pvRG52r6m0tu/MsAFIe6JpXVGeNMd/D9F4hQynWT8Rfuj0bdm9kFQ==" + }, + "@vue/tsconfig@0.8.1_typescript@5.9.3_vue@3.5.27__typescript@5.9.3": { + "integrity": "sha512-aK7feIWPXFSUhsCP9PFqPyFOcz4ENkb8hZ2pneL6m2UjCkccvaOhC/5KCKluuBufvp2KzkbdA2W2pk20vLzu3g==", + "dependencies": [ + "typescript", + "vue" + ], + "optionalPeers": [ + "typescript", + "vue" + ] + }, + "@vueuse/core@14.1.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-rgBinKs07hAYyPF834mDTigH7BtPqvZ3Pryuzt1SD/lg5wEcWqvwzXXYGEDb2/cP0Sj5zSvHl3WkmMELr5kfWw==", + "dependencies": [ + "@types/web-bluetooth", + "@vueuse/metadata", + "@vueuse/shared", + "vue" + ] + }, + "@vueuse/metadata@14.1.0": { + "integrity": "sha512-7hK4g015rWn2PhKcZ99NyT+ZD9sbwm7SGvp7k+k+rKGWnLjS/oQozoIZzWfCewSUeBmnJkIb+CNr7Zc/EyRnnA==" + }, + "@vueuse/shared@14.1.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-EcKxtYvn6gx1F8z9J5/rsg3+lTQnvOruQd8fUecW99DCK04BkWD7z5KQ/wTAx+DazyoEE9dJt/zV8OIEQbM6kw==", + "dependencies": [ + "vue" + ] + }, + "@wokwi/elements@1.9.1": { + "integrity": "sha512-YAEv35q4Ufo3d3MjlRxs2Y7nwEgn0gLFFE7rkYHmjRpUZCgpj6CYeTGVTRwvWewrBHVsTWriKEDKxD7lHmg0VQ==", + "dependencies": [ + "@types/react", + "lit" + ] + }, + "@xterm/addon-fit@0.10.0_@xterm+xterm@5.5.0": { + "integrity": "sha512-UFYkDm4HUahf2lnEyHvio51TNGiLK66mqP2JoATy7hRZeXaGMRDr00JiSF7m63vR5WKATF605yEggJKsw0JpMQ==", + "dependencies": [ + "@xterm/xterm" + ] + }, + "@xterm/addon-web-links@0.11.0_@xterm+xterm@5.5.0": { + "integrity": "sha512-nIHQ38pQI+a5kXnRaTgwqSHnX7KE6+4SVoceompgHL26unAxdfP6IPqUTSYPQgSwM56hsElfoNrrW5V7BUED/Q==", + "dependencies": [ + "@xterm/xterm" + ] + }, + "@xterm/xterm@5.5.0": { + "integrity": "sha512-hqJHYaQb5OptNunnyAnkHyM8aCjZ1MEIDTQu1iIbbTD/xops91NB5yq1ZK/dC2JDbVWtF23zUtl9JE2NqwT87A==" + }, + "acorn-jsx@5.3.2_acorn@8.15.0": { + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dependencies": [ + "acorn@8.15.0" + ] + }, + "acorn@7.4.1": { + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "bin": true + }, + "acorn@8.15.0": { + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "bin": true + }, + "ajv@6.12.6": { + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dependencies": [ + "fast-deep-equal", + "fast-json-stable-stringify", + "json-schema-traverse@0.4.1", + "uri-js" + ] + }, + "ajv@8.17.1": { + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dependencies": [ + "fast-deep-equal", + "fast-uri", + "json-schema-traverse@1.0.0", + "require-from-string" + ] + }, + "alien-signals@3.1.2": { + "integrity": "sha512-d9dYqZTS90WLiU0I5c6DHj/HcKkF8ZyGN3G5x8wSbslulz70KOxaqCT0hQCo9KOyhVqzqGojvNdJXoTumZOtcw==" + }, + "ansi-colors@4.1.3": { + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==" + }, + "ansi-regex@6.2.2": { + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==" + }, + "ansi-styles@4.3.0": { + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": [ + "color-convert" + ] + }, + "ansi-styles@6.2.3": { + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==" + }, + "ansicolor@2.0.3": { + "integrity": "sha512-pzusTqk9VHrjgMCcTPDTTvfJfx6Q3+L5tQ6yKC8Diexmoit4YROTFIkxFvRTNL9y5s0Q8HrSrgerCD5bIC+Kiw==" + }, + "ansis@4.2.0": { + "integrity": "sha512-HqZ5rWlFjGiV0tDm3UxxgNRqsOTniqoKZu0pIAfh7TZQMGuZK+hH0drySty0si0QXj1ieop4+SkSfPZBPPkHig==" + }, + "argparse@2.0.1": { + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "axios@0.26.1": { + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "dependencies": [ + "follow-redirects" + ] + }, + "balanced-match@1.0.2": { + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "baseline-browser-mapping@2.9.15": { + "integrity": "sha512-kX8h7K2srmDyYnXRIppo4AH/wYgzWVCs+eKr3RusRSQ5PvRYoEFmR/I0PbdTjKFAoKqp5+kbxnNTFO9jOfSVJg==", + "bin": true + }, + "best-effort-json-parser@1.2.1": { + "integrity": "sha512-UICSLibQdzS1f+PBsi3u2YE3SsdXcWicHUg3IMvfuaePS2AYnZJdJeKhGv5OM8/mqJwPt79aDrEJ1oa84tELvw==" + }, + "binary-install@1.1.2": { + "integrity": "sha512-ZS2cqFHPZOy4wLxvzqfQvDjCOifn+7uCPqNmYRIBM/03+yllON+4fNnsD0VJdW0p97y+E+dTRNPStWNqMBq+9g==", + "dependencies": [ + "axios", + "rimraf", + "tar" + ], + "deprecated": true + }, + "birpc@2.9.0": { + "integrity": "sha512-KrayHS5pBi69Xi9JmvoqrIgYGDkD6mcSe/i6YKi3w5kekCLzrX4+nawcXqrj2tIp50Kw/mT/s3p+GVK0A0sKxw==" + }, + "boolbase@1.0.0": { + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==" + }, + "bootstrap-vue-next@0.40.9_@floating-ui+vue@1.1.9__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_@vueuse+core@14.1.0__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_vue@3.5.27__typescript@5.9.3_vue-router@4.6.4__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-m4EODlKWIkCFiQzICmKpOTjl3mxqKIpIbsBX0liFsMUip7huZkHDmaZUm6PrqJM2PHrZ7n8l6YRUgBPzFKUcYg==", + "dependencies": [ + "@floating-ui/vue", + "@vueuse/core", + "vue", + "vue-router" + ], + "optionalPeers": [ + "@floating-ui/vue", + "@vueuse/core", + "vue-router" + ] + }, + "bootstrap@5.3.8_@popperjs+core@2.11.8": { + "integrity": "sha512-HP1SZDqaLDPwsNiqRqi5NcP0SSXciX2s9E+RyqJIIqGo+vJeN5AJVM98CXmW/Wux0nQ5L7jeWUdplCEf0Ee+tg==", + "dependencies": [ + "@popperjs/core" + ] + }, + "brace-expansion@1.1.12": { + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dependencies": [ + "balanced-match", + "concat-map" + ] + }, + "brace-expansion@2.0.2": { + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dependencies": [ + "balanced-match" + ] + }, + "braces@3.0.3": { + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dependencies": [ + "fill-range" + ] + }, + "browserslist@4.28.1": { + "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==", + "dependencies": [ + "baseline-browser-mapping", + "caniuse-lite", + "electron-to-chromium", + "node-releases", + "update-browserslist-db" + ], + "bin": true + }, + "buffer-builder@0.2.0": { + "integrity": "sha512-7VPMEPuYznPSoR21NE1zvd2Xna6c/CloiZCfcMXR1Jny6PjX0N4Nsa38zcBFo/FMK+BlA+FLKbJCQ0i2yxp+Xg==" + }, + "bundle-name@4.1.0": { + "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", + "dependencies": [ + "run-applescript" + ] + }, + "cac@6.7.14": { + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==" + }, + "call-bind-apply-helpers@1.0.2": { + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dependencies": [ + "es-errors", + "function-bind" + ] + }, + "call-bound@1.0.4": { + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dependencies": [ + "call-bind-apply-helpers", + "get-intrinsic" + ] + }, + "callsites@3.1.0": { + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" + }, + "caniuse-lite@1.0.30001765": { + "integrity": "sha512-LWcNtSyZrakjECqmpP4qdg0MMGdN368D7X8XvvAqOcqMv0RxnlqVKZl2V6/mBR68oYMxOZPLw/gO7DuisMHUvQ==" + }, + "ccount@2.0.1": { + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==" + }, + "chalk@4.1.2": { + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": [ + "ansi-styles@4.3.0", + "supports-color@7.2.0" + ] + }, + "character-entities-html4@2.1.0": { + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==" + }, + "character-entities-legacy@3.0.0": { + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==" + }, + "character-parser@2.2.0": { + "integrity": "sha512-+UqJQjFEFaTAs3bNsF2j2kEN1baG/zghZbdqoYEDxGZtJo9LBzl1A+m0D4n3qKx8N2FNv8/Xp6yV9mQmBuptaw==", + "dependencies": [ + "is-regex" + ] + }, + "chokidar@4.0.3": { + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dependencies": [ + "readdirp" + ] + }, + "chownr@2.0.0": { + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==" + }, + "cliui@9.0.1": { + "integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==", + "dependencies": [ + "string-width", + "strip-ansi", + "wrap-ansi" + ] + }, + "codemirror-json-schema@0.8.1_@codemirror+language@6.12.1_@codemirror+lint@6.9.2_@codemirror+state@6.5.4_@codemirror+view@6.39.11_@lezer+common@1.5.0": { + "integrity": "sha512-4lKPjW+nugNAmM5MsggJyn6TUxYdCCwAJIr9T4cZeTFPdkbBvPteCOGtDedrTOIeTC2ZFJtVg7VHIXnYU32t8w==", + "dependencies": [ + "@codemirror/language", + "@codemirror/lint", + "@codemirror/state", + "@codemirror/view", + "@lezer/common", + "@sagold/json-pointer", + "@shikijs/markdown-it", + "best-effort-json-parser", + "json-schema", + "json-schema-library", + "loglevel", + "markdown-it", + "shiki", + "yaml" + ], + "optionalDependencies": [ + "@codemirror/autocomplete", + "@codemirror/lang-json", + "@codemirror/lang-yaml", + "codemirror-json5", + "json5" + ] + }, + "codemirror-json5@1.0.3": { + "integrity": "sha512-HmmoYO2huQxoaoG5ARKjqQc9mz7/qmNPvMbISVfIE2Gk1+4vZQg9X3G6g49MYM5IK00Ol3aijd7OKrySuOkA7Q==", + "dependencies": [ + "@codemirror/language", + "@codemirror/state", + "@codemirror/view", + "@lezer/common", + "@lezer/highlight", + "json5", + "lezer-json5" + ] + }, + "codemirror@6.0.2": { + "integrity": "sha512-VhydHotNW5w1UGK0Qj96BwSk/Zqbp9WbnyK2W/eVMv4QyF41INRGpjUhFJY7/uDNuudSc33a/PKr4iDqRduvHw==", + "dependencies": [ + "@codemirror/autocomplete", + "@codemirror/commands", + "@codemirror/language", + "@codemirror/lint", + "@codemirror/search", + "@codemirror/state", + "@codemirror/view" + ] + }, + "color-convert@2.0.1": { + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": [ + "color-name" + ] + }, + "color-name@1.1.4": { + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "colorjs.io@0.5.2": { + "integrity": "sha512-twmVoizEW7ylZSN32OgKdXRmo1qg+wT5/6C3xu5b9QsWzSFAhHLn2xd8ro0diCsKfCj1RdaTP/nrcW+vAoQPIw==" + }, + "colors@1.4.0": { + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" + }, + "comma-separated-tokens@2.0.3": { + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==" + }, + "commander@11.1.0": { + "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==" + }, + "commander@2.20.3": { + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "concat-map@0.0.1": { + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "confbox@0.1.8": { + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==" + }, + "confbox@0.2.2": { + "integrity": "sha512-1NB+BKqhtNipMsov4xI/NnhCKp9XG9NamYp5PVm9klAT0fsrNPjaFICsCFhNhwZJKNh7zB/3q8qXz0E9oaMNtQ==" + }, + "convert-source-map@2.0.0": { + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" + }, + "copy-anything@4.0.5": { + "integrity": "sha512-7Vv6asjS4gMOuILabD3l739tsaxFQmC+a7pLZm02zyvs8p977bL3zEgq3yDk5rn9B0PbYgIv++jmHcuUab4RhA==", + "dependencies": [ + "is-what" + ] + }, + "crelt@1.0.6": { + "integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==" + }, + "cross-spawn@7.0.6": { + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dependencies": [ + "path-key", + "shebang-command", + "which@2.0.2" + ] + }, + "css-select@5.2.2": { + "integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==", + "dependencies": [ + "boolbase", + "css-what", + "domhandler", + "domutils", + "nth-check" + ] + }, + "css-tree@2.2.1": { + "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==", + "dependencies": [ + "mdn-data@2.0.28", + "source-map-js" + ] + }, + "css-tree@3.1.0": { + "integrity": "sha512-0eW44TGN5SQXU1mWSkKwFstI/22X2bG1nYzZTYMAWjylYURhse752YgbE4Cx46AC+bAvI+/dYTPRk1LqSUnu6w==", + "dependencies": [ + "mdn-data@2.12.2", + "source-map-js" + ] + }, + "css-what@6.2.2": { + "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==" + }, + "cssesc@3.0.0": { + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "bin": true + }, + "csso@5.0.5": { + "integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==", + "dependencies": [ + "css-tree@2.2.1" + ] + }, + "csstype@3.2.3": { + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==" + }, + "debug@4.4.3": { + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dependencies": [ + "ms" + ] + }, + "deep-is@0.1.4": { + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + }, + "deepmerge@4.3.1": { + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==" + }, + "default-browser-id@5.0.1": { + "integrity": "sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==" + }, + "default-browser@5.4.0": { + "integrity": "sha512-XDuvSq38Hr1MdN47EDvYtx3U0MTqpCEn+F6ft8z2vYDzMrvQhVp0ui9oQdqW3MvK3vqUETglt1tVGgjLuJ5izg==", + "dependencies": [ + "bundle-name", + "default-browser-id" + ] + }, + "define-lazy-prop@3.0.0": { + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==" + }, + "deno@2.6.5": { + "integrity": "sha512-zAEGhAKPyKTA7HwtSVPAmdpj+WQfvw0tPemgkaRsqGLe7oi85iqUPCoCEkItiYp3ZellfQIbDHqQmKUY6fgxig==", + "optionalDependencies": [ + "@deno/darwin-arm64", + "@deno/darwin-x64", + "@deno/linux-arm64-glibc", + "@deno/linux-x64-glibc", + "@deno/win32-arm64", + "@deno/win32-x64" + ], + "scripts": true, + "bin": true + }, + "dequal@2.0.3": { + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==" + }, + "detect-libc@2.1.2": { + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==" + }, + "devlop@1.1.0": { + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "dependencies": [ + "dequal" + ] + }, + "discontinuous-range@1.0.0": { + "integrity": "sha512-c68LpLbO+7kP/b1Hr1qs8/BJ09F5khZGTxqxZuhzxpmwJKOgRFHJWIb9/KmqnqHhLdO55aOxFH/EGBvUQbL/RQ==" + }, + "dom-serializer@2.0.0": { + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dependencies": [ + "domelementtype", + "domhandler", + "entities@4.5.0" + ] + }, + "domelementtype@2.3.0": { + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==" + }, + "domhandler@5.0.3": { + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dependencies": [ + "domelementtype" + ] + }, + "dompurify@3.1.7": { + "integrity": "sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==" + }, + "domutils@3.2.2": { + "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==", + "dependencies": [ + "dom-serializer", + "domelementtype", + "domhandler" + ] + }, + "dunder-proto@1.0.1": { + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dependencies": [ + "call-bind-apply-helpers", + "es-errors", + "gopd" + ] + }, + "ebnf@1.9.1": { + "integrity": "sha512-uW2UKSsuty9ANJ3YByIQE4ANkD8nqUPO7r6Fwcc1ADKPe9FRdcPpMl3VEput4JSvKBJ4J86npIC2MLP0pYkCuw==", + "bin": true + }, + "electron-to-chromium@1.5.267": { + "integrity": "sha512-0Drusm6MVRXSOJpGbaSVgcQsuB4hEkMpHXaVstcPmhu5LIedxs1xNK/nIxmQIU/RPC0+1/o0AVZfBTkTNJOdUw==" + }, + "emoji-regex-xs@1.0.0": { + "integrity": "sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==" + }, + "emoji-regex@10.6.0": { + "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==" + }, + "entities@4.5.0": { + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==" + }, + "entities@7.0.0": { + "integrity": "sha512-FDWG5cmEYf2Z00IkYRhbFrwIwvdFKH07uV8dvNy0omp/Qb1xcyCWp2UDtcwJF4QZZvk0sLudP6/hAu42TaqVhQ==" + }, + "error-stack-parser-es@1.0.5": { + "integrity": "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==" + }, + "es-define-property@1.0.1": { + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==" + }, + "es-errors@1.3.0": { + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==" + }, + "es-module-lexer@1.7.0": { + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==" + }, + "es-object-atoms@1.1.1": { + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dependencies": [ + "es-errors" + ] + }, + "esbuild@0.27.2": { + "integrity": "sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==", + "optionalDependencies": [ + "@esbuild/aix-ppc64", + "@esbuild/android-arm", + "@esbuild/android-arm64", + "@esbuild/android-x64", + "@esbuild/darwin-arm64", + "@esbuild/darwin-x64", + "@esbuild/freebsd-arm64", + "@esbuild/freebsd-x64", + "@esbuild/linux-arm", + "@esbuild/linux-arm64", + "@esbuild/linux-ia32", + "@esbuild/linux-loong64", + "@esbuild/linux-mips64el", + "@esbuild/linux-ppc64", + "@esbuild/linux-riscv64", + "@esbuild/linux-s390x", + "@esbuild/linux-x64", + "@esbuild/netbsd-arm64", + "@esbuild/netbsd-x64", + "@esbuild/openbsd-arm64", + "@esbuild/openbsd-x64", + "@esbuild/openharmony-arm64", + "@esbuild/sunos-x64", + "@esbuild/win32-arm64", + "@esbuild/win32-ia32", + "@esbuild/win32-x64" + ], + "scripts": true, + "bin": true + }, + "escalade@3.2.0": { + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==" + }, + "escape-string-regexp@4.0.0": { + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" + }, + "eslint-config-prettier@10.1.8_eslint@9.39.2__jiti@2.6.1_jiti@2.6.1": { + "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", + "dependencies": [ + "eslint" + ], + "bin": true + }, + "eslint-plugin-prettier@5.5.5_eslint@9.39.2__jiti@2.6.1_eslint-config-prettier@10.1.8__eslint@9.39.2___jiti@2.6.1__jiti@2.6.1_prettier@3.8.0_jiti@2.6.1": { + "integrity": "sha512-hscXkbqUZ2sPithAuLm5MXL+Wph+U7wHngPBv9OMWwlP8iaflyxpjTYZkmdgB4/vPIhemRlBEoLrH7UC1n7aUw==", + "dependencies": [ + "eslint", + "eslint-config-prettier", + "prettier@3.8.0", + "prettier-linter-helpers", + "synckit" + ], + "optionalPeers": [ + "eslint-config-prettier" + ] + }, + "eslint-plugin-vue@10.7.0_eslint@9.39.2__jiti@2.6.1_vue-eslint-parser@10.2.0__eslint@9.39.2___jiti@2.6.1__jiti@2.6.1_jiti@2.6.1": { + "integrity": "sha512-r2XFCK4qlo1sxEoAMIoTTX0PZAdla0JJDt1fmYiworZUX67WeEGqm+JbyAg3M+pGiJ5U6Mp5WQbontXWtIW7TA==", + "dependencies": [ + "@eslint-community/eslint-utils", + "eslint", + "natural-compare", + "nth-check", + "postcss-selector-parser", + "semver@7.7.3", + "vue-eslint-parser", + "xml-name-validator" + ] + }, + "eslint-scope@8.4.0": { + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", + "dependencies": [ + "esrecurse", + "estraverse" + ] + }, + "eslint-visitor-keys@3.4.3": { + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==" + }, + "eslint-visitor-keys@4.2.1": { + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==" + }, + "eslint@9.39.2_jiti@2.6.1": { + "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", + "dependencies": [ + "@eslint-community/eslint-utils", + "@eslint-community/regexpp", + "@eslint/config-array", + "@eslint/config-helpers", + "@eslint/core", + "@eslint/eslintrc", + "@eslint/js", + "@eslint/plugin-kit", + "@humanfs/node", + "@humanwhocodes/module-importer", + "@humanwhocodes/retry", + "@types/estree", + "ajv@6.12.6", + "chalk", + "cross-spawn", + "debug", + "escape-string-regexp", + "eslint-scope", + "eslint-visitor-keys@4.2.1", + "espree", + "esquery", + "esutils", + "fast-deep-equal", + "file-entry-cache", + "find-up", + "glob-parent@6.0.2", + "ignore@5.3.2", + "imurmurhash", + "is-glob", + "jiti", + "json-stable-stringify-without-jsonify", + "lodash.merge", + "minimatch@3.1.2", + "natural-compare", + "optionator" + ], + "optionalPeers": [ + "jiti" + ], + "bin": true + }, + "espree@10.4.0_acorn@8.15.0": { + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", + "dependencies": [ + "acorn@8.15.0", + "acorn-jsx", + "eslint-visitor-keys@4.2.1" + ] + }, + "esquery@1.7.0": { + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dependencies": [ + "estraverse" + ] + }, + "esrecurse@4.3.0": { + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dependencies": [ + "estraverse" + ] + }, + "estraverse@5.3.0": { + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" + }, + "estree-walker@2.0.2": { + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" + }, + "esutils@2.0.3": { + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" + }, + "exsolve@1.0.8": { + "integrity": "sha512-LmDxfWXwcTArk8fUEnOfSZpHOJ6zOMUJKOtFLFqJLoKJetuQG874Uc7/Kki7zFLzYybmZhp1M7+98pfMqeX8yA==" + }, + "fast-copy@3.0.2": { + "integrity": "sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ==" + }, + "fast-deep-equal@3.1.3": { + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "fast-diff@1.3.0": { + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==" + }, + "fast-glob@3.3.3": { + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dependencies": [ + "@nodelib/fs.stat", + "@nodelib/fs.walk", + "glob-parent@5.1.2", + "merge2", + "micromatch" + ] + }, + "fast-json-stable-stringify@2.1.0": { + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fast-levenshtein@2.0.6": { + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" + }, + "fast-uri@3.1.0": { + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==" + }, + "fastq@1.20.1": { + "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", + "dependencies": [ + "reusify" + ] + }, + "fdir@6.5.0_picomatch@4.0.3": { + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dependencies": [ + "picomatch@4.0.3" + ], + "optionalPeers": [ + "picomatch@4.0.3" + ] + }, + "file-entry-cache@8.0.0": { + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dependencies": [ + "flat-cache" + ] + }, + "fill-range@7.1.1": { + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dependencies": [ + "to-regex-range" + ] + }, + "find-up@5.0.0": { + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dependencies": [ + "locate-path", + "path-exists" + ] + }, + "flat-cache@4.0.1": { + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dependencies": [ + "flatted", + "keyv" + ] + }, + "flatted@3.3.3": { + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==" + }, + "follow-redirects@1.15.11": { + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==" + }, + "fs-minipass@2.1.0": { + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dependencies": [ + "minipass@3.3.6" + ] + }, + "fs.realpath@1.0.0": { + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "fsevents@2.3.3": { + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "os": ["darwin"], "scripts": true }, + "function-bind@1.1.2": { + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==" + }, + "gensync@1.0.0-beta.2": { + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==" + }, + "get-caller-file@2.0.5": { + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "get-east-asian-width@1.4.0": { + "integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==" + }, + "get-intrinsic@1.3.0": { + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dependencies": [ + "call-bind-apply-helpers", + "es-define-property", + "es-errors", + "es-object-atoms", + "function-bind", + "get-proto", + "gopd", + "has-symbols", + "hasown", + "math-intrinsics" + ] + }, + "get-proto@1.0.1": { + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dependencies": [ + "dunder-proto", + "es-object-atoms" + ] + }, + "glob-parent@5.1.2": { + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": [ + "is-glob" + ] + }, + "glob-parent@6.0.2": { + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dependencies": [ + "is-glob" + ] + }, + "glob-to-regexp@0.4.1": { + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" + }, + "glob@7.2.3": { + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dependencies": [ + "fs.realpath", + "inflight", + "inherits", + "minimatch@3.1.2", + "once", + "path-is-absolute" + ], + "deprecated": true + }, + "globals@14.0.0": { + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==" + }, + "globals@16.5.0": { + "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==" + }, + "gopd@1.2.0": { + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==" + }, + "graceful-fs@4.2.11": { + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "gradient-parser@1.1.1": { + "integrity": "sha512-Hu0YfNU+38EsTmnUfLXUKFMXq9yz7htGYpF4x+dlbBhUCvIvzLt0yVLT/gJRmvLKFJdqNFrz4eKkIUjIXSr7Tw==" + }, + "has-flag@4.0.0": { + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "has-symbols@1.1.0": { + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==" + }, + "has-tostringtag@1.0.2": { + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dependencies": [ + "has-symbols" + ] + }, + "hasown@2.0.2": { + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": [ + "function-bind" + ] + }, + "hast-util-to-html@9.0.5": { + "integrity": "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==", + "dependencies": [ + "@types/hast", + "@types/unist", + "ccount", + "comma-separated-tokens", + "hast-util-whitespace", + "html-void-elements", + "mdast-util-to-hast", + "property-information", + "space-separated-tokens", + "stringify-entities", + "zwitch" + ] + }, + "hast-util-whitespace@3.0.0": { + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "dependencies": [ + "@types/hast" + ] + }, + "hookable@5.5.3": { + "integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==" + }, + "html-void-elements@3.0.0": { + "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==" + }, + "humanize-duration@3.33.2": { + "integrity": "sha512-K7Ny/ULO1hDm2nnhvAY+SJV1skxFb61fd073SG1IWJl+D44ULrruCuTyjHKjBVVcSuTlnY99DKtgEG39CM5QOQ==" + }, + "ignore@5.3.2": { + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==" + }, + "ignore@7.0.5": { + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==" + }, + "immutable@5.1.4": { + "integrity": "sha512-p6u1bG3YSnINT5RQmx/yRZBpenIl30kVxkTLDyHLIMk0gict704Q9n+thfDI7lTRm9vXdDYutVzXhzcThxTnXA==" + }, + "import-fresh@3.3.1": { + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dependencies": [ + "parent-module", + "resolve-from" + ] + }, + "imurmurhash@0.1.4": { + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==" + }, + "inflight@1.0.6": { + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": [ + "once", + "wrappy" + ], + "deprecated": true + }, + "inherits@2.0.4": { + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "is-docker@3.0.0": { + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "bin": true + }, + "is-expression@4.0.0": { + "integrity": "sha512-zMIXX63sxzG3XrkHkrAPvm/OVZVSCPNkwMHU8oTX7/U3AL78I0QXCEICXUM13BIa8TYGZ68PiTKfQz3yaTNr4A==", + "dependencies": [ + "acorn@7.4.1", + "object-assign" + ] + }, + "is-extglob@2.1.1": { + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==" + }, + "is-glob@4.0.3": { + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": [ + "is-extglob" + ] + }, + "is-inside-container@1.0.0": { + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "dependencies": [ + "is-docker" + ], + "bin": true + }, + "is-number@7.0.0": { + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-plain-object@5.0.0": { + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" + }, + "is-regex@1.2.1": { + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dependencies": [ + "call-bound", + "gopd", + "has-tostringtag", + "hasown" + ] + }, + "is-what@5.5.0": { + "integrity": "sha512-oG7cgbmg5kLYae2N5IVd3jm2s+vldjxJzK1pcu9LfpGuQ93MQSzo0okvRna+7y5ifrD+20FE8FvjusyGaz14fw==" + }, + "is-wsl@3.1.0": { + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "dependencies": [ + "is-inside-container" + ] + }, + "isexe@2.0.0": { + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "isexe@3.1.1": { + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==" + }, + "jiti@2.6.1": { + "integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==", + "bin": true + }, + "js-tokens@4.0.0": { + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "js-yaml@4.1.1": { + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "dependencies": [ + "argparse" + ], + "bin": true + }, + "jsesc@3.1.0": { + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "bin": true + }, + "json-buffer@3.0.1": { + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + }, + "json-parse-even-better-errors@4.0.0": { + "integrity": "sha512-lR4MXjGNgkJc7tkQ97kb2nuEMnNCyU//XYVH0MKTGcXEiSudQ5MKGKen3C5QubYy0vmq+JGitUg92uuywGEwIA==" + }, + "json-schema-library@9.3.5": { + "integrity": "sha512-5eBDx7cbfs+RjylsVO+N36b0GOPtv78rfqgf2uON+uaHUIC62h63Y8pkV2ovKbaL4ZpQcHp21968x5nx/dFwqQ==", + "dependencies": [ + "@sagold/json-pointer", + "@sagold/json-query", + "deepmerge", + "fast-copy", + "fast-deep-equal", + "smtp-address-parser", + "valid-url" + ] + }, + "json-schema-traverse@0.4.1": { + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-schema-traverse@1.0.0": { + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "json-schema@0.4.0": { + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" + }, + "json-stable-stringify-without-jsonify@1.0.1": { + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==" + }, + "json5@2.2.3": { + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "bin": true + }, + "jsonc-parser@3.3.1": { + "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==" + }, + "keyv@4.5.4": { + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dependencies": [ + "json-buffer" + ] + }, + "kolorist@1.8.0": { + "integrity": "sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==" + }, + "levn@0.4.1": { + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dependencies": [ + "prelude-ls", + "type-check" + ] + }, + "lezer-json5@2.0.2": { + "integrity": "sha512-NRmtBlKW/f8mA7xatKq8IUOq045t8GVHI4kZXrUtYYUdiVeGiO6zKGAV7/nUAnf5q+rYTY+SWX/gvQdFXMjNxQ==", + "dependencies": [ + "@lezer/lr" + ] + }, + "linkify-it@5.0.0": { + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "dependencies": [ + "uc.micro" + ] + }, + "lit-element@4.2.2": { + "integrity": "sha512-aFKhNToWxoyhkNDmWZwEva2SlQia+jfG0fjIWV//YeTaWrVnOxD89dPKfigCUspXFmjzOEUQpOkejH5Ly6sG0w==", + "dependencies": [ + "@lit-labs/ssr-dom-shim", + "@lit/reactive-element", + "lit-html" + ] + }, + "lit-html@3.3.2": { + "integrity": "sha512-Qy9hU88zcmaxBXcc10ZpdK7cOLXvXpRoBxERdtqV9QOrfpMZZ6pSYP91LhpPtap3sFMUiL7Tw2RImbe0Al2/kw==", + "dependencies": [ + "@types/trusted-types" + ] + }, + "lit@3.3.2": { + "integrity": "sha512-NF9zbsP79l4ao2SNrH3NkfmFgN/hBYSQo90saIVI1o5GpjAdCPVstVzO1MrLOakHoEhYkrtRjPK6Ob521aoYWQ==", + "dependencies": [ + "@lit/reactive-element", + "lit-element", + "lit-html" + ] + }, + "local-pkg@1.1.2": { + "integrity": "sha512-arhlxbFRmoQHl33a0Zkle/YWlmNwoyt6QNZEIJcqNbdrsix5Lvc4HyyI3EnwxTYlZYc32EbYrQ8SzEZ7dqgg9A==", + "dependencies": [ + "mlly", + "pkg-types@2.3.0", + "quansync" + ] + }, + "locate-path@6.0.0": { + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dependencies": [ + "p-locate" + ] + }, + "lodash-es@4.17.22": { + "integrity": "sha512-XEawp1t0gxSi9x01glktRZ5HDy0HXqrM0x5pXQM98EaI0NxO6jVM7omDOxsuEo5UIASAnm2bRp1Jt/e0a2XU8Q==" + }, + "lodash.merge@4.6.2": { + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, + "loglevel@1.9.2": { + "integrity": "sha512-HgMmCqIJSAKqo68l0rS2AanEWfkxaZ5wNiEFb5ggm08lDs9Xl2KxBlX3PTcaD2chBM1gXAYf491/M2Rv8Jwayg==" + }, + "lru-cache@5.1.1": { + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dependencies": [ + "yallist@3.1.1" + ] + }, + "magic-string@0.30.21": { + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dependencies": [ + "@jridgewell/sourcemap-codec" + ] + }, + "markdown-it@14.1.0": { + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", + "dependencies": [ + "argparse", + "entities@4.5.0", + "linkify-it", + "mdurl", + "punycode.js", + "uc.micro" + ], + "bin": true + }, + "marked@14.0.0": { + "integrity": "sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ==", + "bin": true + }, + "math-intrinsics@1.1.0": { + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==" + }, + "mdast-util-to-hast@13.2.1": { + "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==", + "dependencies": [ + "@types/hast", + "@types/mdast", + "@ungap/structured-clone", + "devlop", + "micromark-util-sanitize-uri", + "trim-lines", + "unist-util-position", + "unist-util-visit", + "vfile" + ] + }, + "mdn-data@2.0.28": { + "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==" + }, + "mdn-data@2.12.2": { + "integrity": "sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==" + }, + "mdurl@2.0.0": { + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==" + }, + "memorystream@0.3.1": { + "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==" + }, + "merge2@1.4.1": { + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" + }, + "micromark-util-character@2.1.1": { + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "dependencies": [ + "micromark-util-symbol", + "micromark-util-types" + ] + }, + "micromark-util-encode@2.0.1": { + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==" + }, + "micromark-util-sanitize-uri@2.0.1": { + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "dependencies": [ + "micromark-util-character", + "micromark-util-encode", + "micromark-util-symbol" + ] + }, + "micromark-util-symbol@2.0.1": { + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==" + }, + "micromark-util-types@2.0.2": { + "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==" + }, + "micromatch@4.0.8": { + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dependencies": [ + "braces", + "picomatch@2.3.1" + ] + }, + "mime-db@1.52.0": { + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types@2.1.35": { + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": [ + "mime-db" + ] + }, + "minimatch@3.1.2": { + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": [ + "brace-expansion@1.1.12" + ] + }, + "minimatch@9.0.5": { + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dependencies": [ + "brace-expansion@2.0.2" + ] + }, + "minipass@3.3.6": { + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": [ + "yallist@4.0.0" + ] + }, + "minipass@5.0.0": { + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==" + }, + "minizlib@2.1.2": { + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dependencies": [ + "minipass@3.3.6", + "yallist@4.0.0" + ] + }, + "mitt@3.0.1": { + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" + }, + "mkdirp@1.0.4": { + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "bin": true + }, + "mlly@1.8.0": { + "integrity": "sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g==", + "dependencies": [ + "acorn@8.15.0", + "pathe", + "pkg-types@1.3.1", + "ufo" + ] + }, + "monaco-editor@0.54.0": { + "integrity": "sha512-hx45SEUoLatgWxHKCmlLJH81xBo0uXP4sRkESUpmDQevfi+e7K1VuiSprK6UpQ8u4zOcKNiH0pMvHvlMWA/4cw==", + "dependencies": [ + "dompurify", + "marked" + ] + }, + "monaco-languageserver-types@0.4.0": { + "integrity": "sha512-QQ3BZiU5LYkJElGncSNb5AKoJ/LCs6YBMCJMAz9EA7v+JaOdn3kx2cXpPTcZfKA5AEsR0vc97sAw+5mdNhVBmw==", + "dependencies": [ + "monaco-types", + "vscode-languageserver-protocol", + "vscode-uri" + ] + }, + "monaco-marker-data-provider@1.2.5": { + "integrity": "sha512-5ZdcYukhPwgYMCvlZ9H5uWs5jc23BQ8fFF5AhSIdrz5mvYLsqGZ58ZLxTv8rCX6+AxdJ8+vxg1HVSk+F2bLosg==", + "dependencies": [ + "monaco-types" + ] + }, + "monaco-types@0.1.1": { + "integrity": "sha512-cxYEIVVKQ46FsH96b91pn+9jdl/Bz8rJ08oNeUgK2DNMGQUMuZh77USqt+L0ns9Y+/aFItWyPBgj6bkZvtWCsQ==" + }, + "monaco-vim@0.4.4_monaco-editor@0.54.0": { + "integrity": "sha512-LNChAb//WEm/W+eyeHG/0+pdVEHotk2hLTN+M3sQZx5E8cAlSWSgqcxpcRuQnxDybSln7pfHF9i63HmbIQvrWw==", + "dependencies": [ + "monaco-editor" + ] + }, + "monaco-worker-manager@2.0.1_monaco-editor@0.54.0": { + "integrity": "sha512-kdPL0yvg5qjhKPNVjJoym331PY/5JC11aPJXtCZNwWRvBr6jhkIamvYAyiY5P1AWFmNOy0aRDRoMdZfa71h8kg==", + "dependencies": [ + "monaco-editor" + ] + }, + "monaco-yaml@5.4.0_monaco-editor@0.54.0": { + "integrity": "sha512-tuBVDy1KAPrgO905GHTItu8AaA5bIzF5S4X0JVRAE/D66FpRhkDUk7tKi5bwKMVTTugtpMLsXN4ewh4CgE/FtQ==", + "dependencies": [ + "jsonc-parser", + "monaco-editor", + "monaco-languageserver-types", + "monaco-marker-data-provider", + "monaco-types", + "monaco-worker-manager", + "path-browserify", + "prettier@3.8.0", + "vscode-languageserver-textdocument", + "vscode-languageserver-types", + "vscode-uri", + "yaml" + ] + }, + "moo@0.5.2": { + "integrity": "sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==" + }, + "mrmime@2.0.1": { + "integrity": "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==" + }, + "ms@2.1.3": { + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "muggle-string@0.4.1": { + "integrity": "sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==" + }, + "nanoid@3.3.11": { + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "bin": true + }, + "nanoid@5.1.6": { + "integrity": "sha512-c7+7RQ+dMB5dPwwCp4ee1/iV/q2P6aK1mTZcfr1BTuVlyW9hJYiMPybJCcnBlQtuSmTIWNeazm/zqNoZSSElBg==", + "bin": true + }, + "natural-compare@1.4.0": { + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" + }, + "nearley@2.20.1": { + "integrity": "sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==", + "dependencies": [ + "commander@2.20.3", + "moo", + "railroad-diagrams", + "randexp" + ], + "bin": true + }, "node-addon-api@7.1.1": { "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==" }, - "readline-sync@1.4.10": { - "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==" + "node-releases@2.0.27": { + "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==" + }, + "npm-normalize-package-bin@4.0.0": { + "integrity": "sha512-TZKxPvItzai9kN9H/TkmCtx/ZN/hvr3vUycjlfmH0ootY9yFBzNOpiXAdIn1Iteqsvk4lQn6B5PTrt+n6h8k/w==" + }, + "npm-run-all2@8.0.4": { + "integrity": "sha512-wdbB5My48XKp2ZfJUlhnLVihzeuA1hgBnqB2J9ahV77wLS+/YAJAlN8I+X3DIFIPZ3m5L7nplmlbhNiFDmXRDA==", + "dependencies": [ + "ansi-styles@6.2.3", + "cross-spawn", + "memorystream", + "picomatch@4.0.3", + "pidtree", + "read-package-json-fast", + "shell-quote", + "which@5.0.0" + ], + "bin": true + }, + "nth-check@2.1.1": { + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dependencies": [ + "boolbase" + ] + }, + "object-assign@4.1.1": { + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" + }, + "ohash@2.0.11": { + "integrity": "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==" + }, + "once@1.4.0": { + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": [ + "wrappy" + ] + }, + "oniguruma-to-es@2.3.0": { + "integrity": "sha512-bwALDxriqfKGfUufKGGepCzu9x7nJQuoRoAFp4AnwehhC2crqrDIAP/uN2qdlsAvSMpeRC3+Yzhqc7hLmle5+g==", + "dependencies": [ + "emoji-regex-xs", + "regex", + "regex-recursion" + ] + }, + "open@10.2.0": { + "integrity": "sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==", + "dependencies": [ + "default-browser", + "define-lazy-prop", + "is-inside-container", + "wsl-utils" + ] + }, + "optionator@0.9.4": { + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dependencies": [ + "deep-is", + "fast-levenshtein", + "levn", + "prelude-ls", + "type-check", + "word-wrap" + ] + }, + "p-limit@3.1.0": { + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dependencies": [ + "yocto-queue" + ] + }, + "p-locate@5.0.0": { + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dependencies": [ + "p-limit" + ] + }, + "parent-module@1.0.1": { + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dependencies": [ + "callsites" + ] + }, + "path-browserify@1.0.1": { + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" + }, + "path-exists@4.0.0": { + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "path-is-absolute@1.0.1": { + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, + "path-key@3.1.1": { + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "pathe@2.0.3": { + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==" + }, + "perfect-debounce@2.0.0": { + "integrity": "sha512-fkEH/OBiKrqqI/yIgjR92lMfs2K8105zt/VT6+7eTjNwisrsh47CeIED9z58zI7DfKdH3uHAn25ziRZn3kgAow==" + }, + "picocolors@1.1.1": { + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==" + }, + "picomatch@2.3.1": { + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, + "picomatch@4.0.3": { + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==" + }, + "pidtree@0.6.0": { + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "bin": true + }, + "pkg-types@1.3.1": { + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", + "dependencies": [ + "confbox@0.1.8", + "mlly", + "pathe" + ] + }, + "pkg-types@2.3.0": { + "integrity": "sha512-SIqCzDRg0s9npO5XQ3tNZioRY1uK06lA41ynBC1YmFTmnY6FjUjVt6s4LoADmwoig1qqD0oK8h1p/8mlMx8Oig==", + "dependencies": [ + "confbox@0.2.2", + "exsolve", + "pathe" + ] + }, + "postcss-selector-parser@7.1.1": { + "integrity": "sha512-orRsuYpJVw8LdAwqqLykBj9ecS5/cRHlI5+nvTo8LcCKmzDmqVORXtOIYEEQuL9D4BxtA1lm5isAqzQZCoQ6Eg==", + "dependencies": [ + "cssesc", + "util-deprecate" + ] + }, + "postcss@8.5.6": { + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "dependencies": [ + "nanoid@3.3.11", + "picocolors", + "source-map-js" + ] + }, + "prelude-ls@1.2.1": { + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==" + }, + "prettier-linter-helpers@1.0.1": { + "integrity": "sha512-SxToR7P8Y2lWmv/kTzVLC1t/GDI2WGjMwNhLLE9qtH8Q13C+aEmuRlzDst4Up4s0Wc8sF2M+J57iB3cMLqftfg==", + "dependencies": [ + "fast-diff" + ] + }, + "prettier-plugin-vue@1.1.6": { + "integrity": "sha512-trQ/oY+6hSsGe2zPIFThXMIM0TbxMEbk2VOrKjwHWuSz7OEo0rnumbz9a47OxVPCaAnGY9vZG8qDTiTmk9bq0A==", + "dependencies": [ + "prettier@2.8.8" + ] + }, + "prettier@2.8.8": { + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "bin": true + }, + "prettier@3.8.0": { + "integrity": "sha512-yEPsovQfpxYfgWNhCfECjG5AQaO+K3dp6XERmOepyPDVqcJm+bjyCVO3pmU+nAPe0N5dDvekfGezt/EIiRe1TA==", + "bin": true + }, + "property-information@7.1.0": { + "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==" + }, + "pug-error@2.1.0": { + "integrity": "sha512-lv7sU9e5Jk8IeUheHata6/UThZ7RK2jnaaNztxfPYUY+VxZyk/ePVaNZ/vwmH8WqGvDz3LrNYt/+gA55NDg6Pg==" + }, + "pug-lexer@5.0.1": { + "integrity": "sha512-0I6C62+keXlZPZkOJeVam9aBLVP2EnbeDw3An+k0/QlqdwH6rv8284nko14Na7c0TtqtogfWXcRoFE4O4Ff20w==", + "dependencies": [ + "character-parser", + "is-expression", + "pug-error" + ] + }, + "punycode.js@2.3.1": { + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==" + }, + "punycode@2.3.1": { + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==" + }, + "qrcode.vue@3.6.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-vQcl2fyHYHMjDO1GguCldJxepq2izQjBkDEEu9NENgfVKP6mv/e2SU62WbqYHGwTgWXLhxZ1NCD1dAZKHQq1fg==", + "dependencies": [ + "vue" + ] + }, + "quansync@0.2.11": { + "integrity": "sha512-AifT7QEbW9Nri4tAwR5M/uzpBuqfZf+zwaEM/QkzEjj7NBuFD2rBuy0K3dE+8wltbezDV7JMA0WfnCPYRSYbXA==" + }, + "queue-microtask@1.2.3": { + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, + "railroad-diagrams@1.0.0": { + "integrity": "sha512-cz93DjNeLY0idrCNOH6PviZGRN9GJhsdm9hpn1YCS879fj4W+x5IFJhhkRZcwVgMmFF7R82UA/7Oh+R8lLZg6A==" + }, + "randexp@0.4.6": { + "integrity": "sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==", + "dependencies": [ + "discontinuous-range", + "ret" + ] + }, + "read-package-json-fast@4.0.0": { + "integrity": "sha512-qpt8EwugBWDw2cgE2W+/3oxC+KTez2uSVR8JU9Q36TXPAGCaozfQUs59v4j4GFpWTaw0i6hAZSvOmu1J0uOEUg==", + "dependencies": [ + "json-parse-even-better-errors", + "npm-normalize-package-bin" + ] + }, + "readdirp@4.1.2": { + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==" + }, + "readline-sync@1.4.10": { + "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==" + }, + "regex-recursion@5.1.1": { + "integrity": "sha512-ae7SBCbzVNrIjgSbh7wMznPcQel1DNlDtzensnFxpiNpXt1U2ju/bHugH422r+4LAVS1FpW1YCwilmnNsjum9w==", + "dependencies": [ + "regex", + "regex-utilities" + ] + }, + "regex-utilities@2.3.0": { + "integrity": "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==" + }, + "regex@5.1.1": { + "integrity": "sha512-dN5I359AVGPnwzJm2jN1k0W9LPZ+ePvoOeVMMfqIMFz53sSwXkxaJoxr50ptnsC771lK95BnTrVSZxq0b9yCGw==", + "dependencies": [ + "regex-utilities" + ] + }, + "require-from-string@2.0.2": { + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" + }, + "resolve-from@4.0.0": { + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" + }, + "ret@0.1.15": { + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" + }, + "reusify@1.1.0": { + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==" + }, + "rfdc@1.4.1": { + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==" + }, + "rimraf@3.0.2": { + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dependencies": [ + "glob" + ], + "deprecated": true, + "bin": true + }, + "rollup@4.55.2": { + "integrity": "sha512-PggGy4dhwx5qaW+CKBilA/98Ql9keyfnb7lh4SR6shQ91QQQi1ORJ1v4UinkdP2i87OBs9AQFooQylcrrRfIcg==", + "dependencies": [ + "@types/estree" + ], + "optionalDependencies": [ + "@rollup/rollup-android-arm-eabi", + "@rollup/rollup-android-arm64", + "@rollup/rollup-darwin-arm64", + "@rollup/rollup-darwin-x64", + "@rollup/rollup-freebsd-arm64", + "@rollup/rollup-freebsd-x64", + "@rollup/rollup-linux-arm-gnueabihf", + "@rollup/rollup-linux-arm-musleabihf", + "@rollup/rollup-linux-arm64-gnu", + "@rollup/rollup-linux-arm64-musl", + "@rollup/rollup-linux-loong64-gnu", + "@rollup/rollup-linux-loong64-musl", + "@rollup/rollup-linux-ppc64-gnu", + "@rollup/rollup-linux-ppc64-musl", + "@rollup/rollup-linux-riscv64-gnu", + "@rollup/rollup-linux-riscv64-musl", + "@rollup/rollup-linux-s390x-gnu", + "@rollup/rollup-linux-x64-gnu", + "@rollup/rollup-linux-x64-musl", + "@rollup/rollup-openbsd-x64", + "@rollup/rollup-openharmony-arm64", + "@rollup/rollup-win32-arm64-msvc", + "@rollup/rollup-win32-ia32-msvc", + "@rollup/rollup-win32-x64-gnu", + "@rollup/rollup-win32-x64-msvc", + "fsevents" + ], + "bin": true + }, + "run-applescript@7.1.0": { + "integrity": "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==" + }, + "run-parallel@1.2.0": { + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dependencies": [ + "queue-microtask" + ] + }, + "rxjs@7.8.2": { + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dependencies": [ + "tslib" + ] + }, + "sass-embedded-all-unknown@1.97.2": { + "integrity": "sha512-Fj75+vOIDv1T/dGDwEpQ5hgjXxa2SmMeShPa8yrh2sUz1U44bbmY4YSWPCdg8wb7LnwiY21B2KRFM+HF42yO4g==", + "dependencies": [ + "sass" + ], + "cpu": ["!arm", "!arm64", "!riscv64", "!x64"] }, - "sass-embedded-android-arm64@1.89.2": { - "integrity": "sha512-+pq7a7AUpItNyPu61sRlP6G2A8pSPpyazASb+8AK2pVlFayCSPAEgpwpCE9A2/Xj86xJZeMizzKUHxM2CBCUxA==", + "sass-embedded-android-arm64@1.97.2": { + "integrity": "sha512-pF6I+R5uThrscd3lo9B3DyNTPyGFsopycdx0tDAESN6s+dBbiRgNgE4Zlpv50GsLocj/lDLCZaabeTpL3ubhYA==", "os": ["android"], "cpu": ["arm64"] }, - "sass-embedded-android-arm@1.89.2": { - "integrity": "sha512-oHAPTboBHRZlDBhyRB6dvDKh4KvFs+DZibDHXbkSI6dBZxMTT+Yb2ivocHnctVGucKTLQeT7+OM5DjWHyynL/A==", + "sass-embedded-android-arm@1.97.2": { + "integrity": "sha512-BPT9m19ttY0QVHYYXRa6bmqmS3Fa2EHByNUEtSVcbm5PkIk1ntmYkG9fn5SJpIMbNmFDGwHx+pfcZMmkldhnRg==", "os": ["android"], "cpu": ["arm"] }, - "sass-embedded-android-riscv64@1.89.2": { - "integrity": "sha512-HfJJWp/S6XSYvlGAqNdakeEMPOdhBkj2s2lN6SHnON54rahKem+z9pUbCriUJfM65Z90lakdGuOfidY61R9TYg==", + "sass-embedded-android-riscv64@1.97.2": { + "integrity": "sha512-fprI8ZTJdz+STgARhg8zReI2QhhGIT9G8nS7H21kc3IkqPRzhfaemSxEtCqZyvDbXPcgYiDLV7AGIReHCuATog==", "os": ["android"], "cpu": ["riscv64"] }, - "sass-embedded-android-x64@1.89.2": { - "integrity": "sha512-BGPzq53VH5z5HN8de6jfMqJjnRe1E6sfnCWFd4pK+CAiuM7iw5Fx6BQZu3ikfI1l2GY0y6pRXzsVLdp/j4EKEA==", + "sass-embedded-android-x64@1.97.2": { + "integrity": "sha512-RswwSjURZxupsukEmNt2t6RGvuvIw3IAD5sDq1Pc65JFvWFY3eHqCmH0lG0oXqMg6KJcF0eOxHOp2RfmIm2+4w==", "os": ["android"], "cpu": ["x64"] }, - "sass-embedded-darwin-arm64@1.89.2": { - "integrity": "sha512-UCm3RL/tzMpG7DsubARsvGUNXC5pgfQvP+RRFJo9XPIi6elopY5B6H4m9dRYDpHA+scjVthdiDwkPYr9+S/KGw==", + "sass-embedded-darwin-arm64@1.97.2": { + "integrity": "sha512-xcsZNnU1XZh21RE/71OOwNqPVcGBU0qT9A4k4QirdA34+ts9cDIaR6W6lgHOBR/Bnnu6w6hXJR4Xth7oFrefPA==", "os": ["darwin"], "cpu": ["arm64"] }, - "sass-embedded-darwin-x64@1.89.2": { - "integrity": "sha512-D9WxtDY5VYtMApXRuhQK9VkPHB8R79NIIR6xxVlN2MIdEid/TZWi1MHNweieETXhWGrKhRKglwnHxxyKdJYMnA==", + "sass-embedded-darwin-x64@1.97.2": { + "integrity": "sha512-T/9DTMpychm6+H4slHCAsYJRJ6eM+9H9idKlBPliPrP4T8JdC2Cs+ZOsYqrObj6eOtAD0fGf+KgyNhnW3xVafA==", "os": ["darwin"], "cpu": ["x64"] }, - "sass-embedded-linux-arm64@1.89.2": { - "integrity": "sha512-2N4WW5LLsbtrWUJ7iTpjvhajGIbmDR18ZzYRywHdMLpfdPApuHPMDF5CYzHbS+LLx2UAx7CFKBnj5LLjY6eFgQ==", + "sass-embedded-linux-arm64@1.97.2": { + "integrity": "sha512-Wh+nQaFer9tyE5xBPv5murSUZE/+kIcg8MyL5uqww6be9Iq+UmZpcJM7LUk+q8klQ9LfTmoDSNFA74uBqxD6IA==", "os": ["linux"], "cpu": ["arm64"] }, - "sass-embedded-linux-arm@1.89.2": { - "integrity": "sha512-leP0t5U4r95dc90o8TCWfxNXwMAsQhpWxTkdtySDpngoqtTy3miMd7EYNYd1znI0FN1CBaUvbdCMbnbPwygDlA==", + "sass-embedded-linux-arm@1.97.2": { + "integrity": "sha512-yDRe1yifGHl6kibkDlRIJ2ZzAU03KJ1AIvsAh4dsIDgK5jx83bxZLV1ZDUv7a8KK/iV/80LZnxnu/92zp99cXQ==", "os": ["linux"], "cpu": ["arm"] }, - "sass-embedded-linux-musl-arm64@1.89.2": { - "integrity": "sha512-nTyuaBX6U1A/cG7WJh0pKD1gY8hbg1m2SnzsyoFG+exQ0lBX/lwTLHq3nyhF+0atv7YYhYKbmfz+sjPP8CZ9lw==", + "sass-embedded-linux-musl-arm64@1.97.2": { + "integrity": "sha512-NfUqZSjHwnHvpSa7nyNxbWfL5obDjNBqhHUYmqbHUcmqBpFfHIQsUPgXME9DKn1yBlBc3mWnzMxRoucdYTzd2Q==", "os": ["linux"], "cpu": ["arm64"] }, - "sass-embedded-linux-musl-arm@1.89.2": { - "integrity": "sha512-Z6gG2FiVEEdxYHRi2sS5VIYBmp17351bWtOCUZ/thBM66+e70yiN6Eyqjz80DjL8haRUegNQgy9ZJqsLAAmr9g==", + "sass-embedded-linux-musl-arm@1.97.2": { + "integrity": "sha512-GIO6xfAtahJAWItvsXZ3MD1HM6s8cKtV1/HL088aUpKJaw/2XjTCveiOO2AdgMpLNztmq9DZ1lx5X5JjqhS45g==", "os": ["linux"], "cpu": ["arm"] }, - "sass-embedded-linux-musl-riscv64@1.89.2": { - "integrity": "sha512-N6oul+qALO0SwGY8JW7H/Vs0oZIMrRMBM4GqX3AjM/6y8JsJRxkAwnfd0fDyK+aICMFarDqQonQNIx99gdTZqw==", + "sass-embedded-linux-musl-riscv64@1.97.2": { + "integrity": "sha512-qtM4dJ5gLfvyTZ3QencfNbsTEShIWImSEpkThz+Y2nsCMbcMP7/jYOA03UWgPfEOKSehQQ7EIau7ncbFNoDNPQ==", "os": ["linux"], "cpu": ["riscv64"] }, - "sass-embedded-linux-musl-x64@1.89.2": { - "integrity": "sha512-K+FmWcdj/uyP8GiG9foxOCPfb5OAZG0uSVq80DKgVSC0U44AdGjvAvVZkrgFEcZ6cCqlNC2JfYmslB5iqdL7tg==", + "sass-embedded-linux-musl-x64@1.97.2": { + "integrity": "sha512-ZAxYOdmexcnxGnzdsDjYmNe3jGj+XW3/pF/n7e7r8y+5c6D2CQRrCUdapLgaqPt1edOPQIlQEZF8q5j6ng21yw==", "os": ["linux"], "cpu": ["x64"] }, - "sass-embedded-linux-riscv64@1.89.2": { - "integrity": "sha512-g9nTbnD/3yhOaskeqeBQETbtfDQWRgsjHok6bn7DdAuwBsyrR3JlSFyqKc46pn9Xxd9SQQZU8AzM4IR+sY0A0w==", + "sass-embedded-linux-riscv64@1.97.2": { + "integrity": "sha512-reVwa9ZFEAOChXpDyNB3nNHHyAkPMD+FTctQKECqKiVJnIzv2EaFF6/t0wzyvPgBKeatA8jszAIeOkkOzbYVkQ==", "os": ["linux"], "cpu": ["riscv64"] }, - "sass-embedded-linux-x64@1.89.2": { - "integrity": "sha512-Ax7dKvzncyQzIl4r7012KCMBvJzOz4uwSNoyoM5IV6y5I1f5hEwI25+U4WfuTqdkv42taCMgpjZbh9ERr6JVMQ==", + "sass-embedded-linux-x64@1.97.2": { + "integrity": "sha512-bvAdZQsX3jDBv6m4emaU2OMTpN0KndzTAMgJZZrKUgiC0qxBmBqbJG06Oj/lOCoXGCxAvUOheVYpezRTF+Feog==", "os": ["linux"], "cpu": ["x64"] }, - "sass-embedded-win32-arm64@1.89.2": { - "integrity": "sha512-j96iJni50ZUsfD6tRxDQE2QSYQ2WrfHxeiyAXf41Kw0V4w5KYR/Sf6rCZQLMTUOHnD16qTMVpQi20LQSqf4WGg==", + "sass-embedded-unknown-all@1.97.2": { + "integrity": "sha512-86tcYwohjPgSZtgeU9K4LikrKBJNf8ZW/vfsFbdzsRlvc73IykiqanufwQi5qIul0YHuu9lZtDWyWxM2dH/Rsg==", + "dependencies": [ + "sass" + ], + "os": ["!android", "!darwin", "!linux", "!win32"] + }, + "sass-embedded-win32-arm64@1.97.2": { + "integrity": "sha512-Cv28q8qNjAjZfqfzTrQvKf4JjsZ6EOQ5FxyHUQQeNzm73R86nd/8ozDa1Vmn79Hq0kwM15OCM9epanDuTG1ksA==", "os": ["win32"], "cpu": ["arm64"] }, - "sass-embedded-win32-x64@1.89.2": { - "integrity": "sha512-cS2j5ljdkQsb4PaORiClaVYynE9OAPZG/XjbOMxpQmjRIf7UroY4PEIH+Waf+y47PfXFX9SyxhYuw2NIKGbEng==", + "sass-embedded-win32-x64@1.97.2": { + "integrity": "sha512-DVxLxkeDCGIYeyHLAvWW3yy9sy5Ruk5p472QWiyfyyG1G1ASAR8fgfIY5pT0vE6Rv+VAKVLwF3WTspUYu7S1/Q==", "os": ["win32"], "cpu": ["x64"] + }, + "sass-embedded@1.97.2": { + "integrity": "sha512-lKJcskySwAtJ4QRirKrikrWMFa2niAuaGenY2ElHjd55IwHUiur5IdKu6R1hEmGYMs4Qm+6rlRW0RvuAkmcryg==", + "dependencies": [ + "@bufbuild/protobuf", + "buffer-builder", + "colorjs.io", + "immutable", + "rxjs", + "supports-color@8.1.1", + "sync-child-process", + "varint" + ], + "optionalDependencies": [ + "sass-embedded-all-unknown", + "sass-embedded-android-arm", + "sass-embedded-android-arm64", + "sass-embedded-android-riscv64", + "sass-embedded-android-x64", + "sass-embedded-darwin-arm64", + "sass-embedded-darwin-x64", + "sass-embedded-linux-arm", + "sass-embedded-linux-arm64", + "sass-embedded-linux-musl-arm", + "sass-embedded-linux-musl-arm64", + "sass-embedded-linux-musl-riscv64", + "sass-embedded-linux-musl-x64", + "sass-embedded-linux-riscv64", + "sass-embedded-linux-x64", + "sass-embedded-unknown-all", + "sass-embedded-win32-arm64", + "sass-embedded-win32-x64" + ], + "bin": true + }, + "sass@1.97.2": { + "integrity": "sha512-y5LWb0IlbO4e97Zr7c3mlpabcbBtS+ieiZ9iwDooShpFKWXf62zz5pEPdwrLYm+Bxn1fnbwFGzHuCLSA9tBmrw==", + "dependencies": [ + "chokidar", + "immutable", + "source-map-js" + ], + "optionalDependencies": [ + "@parcel/watcher" + ], + "bin": true + }, + "sax@1.4.4": { + "integrity": "sha512-1n3r/tGXO6b6VXMdFT54SHzT9ytu9yr7TaELowdYpMqY/Ao7EnlQGmAQ1+RatX7Tkkdm6hONI2owqNx2aZj5Sw==" + }, + "semver@6.3.1": { + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "bin": true + }, + "semver@7.7.3": { + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "bin": true + }, + "sharp@0.34.5": { + "integrity": "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==", + "dependencies": [ + "@img/colour", + "detect-libc", + "semver@7.7.3" + ], + "optionalDependencies": [ + "@img/sharp-darwin-arm64", + "@img/sharp-darwin-x64", + "@img/sharp-libvips-darwin-arm64", + "@img/sharp-libvips-darwin-x64", + "@img/sharp-libvips-linux-arm", + "@img/sharp-libvips-linux-arm64", + "@img/sharp-libvips-linux-ppc64", + "@img/sharp-libvips-linux-riscv64", + "@img/sharp-libvips-linux-s390x", + "@img/sharp-libvips-linux-x64", + "@img/sharp-libvips-linuxmusl-arm64", + "@img/sharp-libvips-linuxmusl-x64", + "@img/sharp-linux-arm", + "@img/sharp-linux-arm64", + "@img/sharp-linux-ppc64", + "@img/sharp-linux-riscv64", + "@img/sharp-linux-s390x", + "@img/sharp-linux-x64", + "@img/sharp-linuxmusl-arm64", + "@img/sharp-linuxmusl-x64", + "@img/sharp-wasm32", + "@img/sharp-win32-arm64", + "@img/sharp-win32-ia32", + "@img/sharp-win32-x64" + ], + "scripts": true + }, + "shebang-command@2.0.0": { + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": [ + "shebang-regex" + ] + }, + "shebang-regex@3.0.0": { + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "shell-quote@1.8.3": { + "integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==" + }, + "shiki@1.29.2": { + "integrity": "sha512-njXuliz/cP+67jU2hukkxCNuH1yUi4QfdZZY+sMr5PPrIyXSu5iTb/qYC4BiWWB0vZ+7TbdvYUCeL23zpwCfbg==", + "dependencies": [ + "@shikijs/core", + "@shikijs/engine-javascript", + "@shikijs/engine-oniguruma", + "@shikijs/langs", + "@shikijs/themes", + "@shikijs/types", + "@shikijs/vscode-textmate", + "@types/hast" + ] + }, + "sirv@3.0.2": { + "integrity": "sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==", + "dependencies": [ + "@polka/url", + "mrmime", + "totalist" + ] + }, + "smtp-address-parser@1.0.10": { + "integrity": "sha512-Osg9LmvGeAG/hyao4mldbflLOkkr3a+h4m1lwKCK5U8M6ZAr7tdXEz/+/vr752TSGE4MNUlUl9cIK2cB8cgzXg==", + "dependencies": [ + "nearley" + ] + }, + "source-map-js@1.2.1": { + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==" + }, + "space-separated-tokens@2.0.2": { + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==" + }, + "speakingurl@14.0.1": { + "integrity": "sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==" + }, + "string-width@7.2.0": { + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dependencies": [ + "emoji-regex", + "get-east-asian-width", + "strip-ansi" + ] + }, + "stringify-entities@4.0.4": { + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "dependencies": [ + "character-entities-html4", + "character-entities-legacy" + ] + }, + "strip-ansi@7.1.2": { + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "dependencies": [ + "ansi-regex" + ] + }, + "strip-json-comments@3.1.1": { + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==" + }, + "style-mod@4.1.3": { + "integrity": "sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ==" + }, + "superjson@2.2.6": { + "integrity": "sha512-H+ue8Zo4vJmV2nRjpx86P35lzwDT3nItnIsocgumgr0hHMQ+ZGq5vrERg9kJBo5AWGmxZDhzDo+WVIJqkB0cGA==", + "dependencies": [ + "copy-anything" + ] + }, + "supports-color@7.2.0": { + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": [ + "has-flag" + ] + }, + "supports-color@8.1.1": { + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dependencies": [ + "has-flag" + ] + }, + "svgo@4.0.0": { + "integrity": "sha512-VvrHQ+9uniE+Mvx3+C9IEe/lWasXCU0nXMY2kZeLrHNICuRiC8uMPyM14UEaMOFA5mhyQqEkB02VoQ16n3DLaw==", + "dependencies": [ + "commander@11.1.0", + "css-select", + "css-tree@3.1.0", + "css-what", + "csso", + "picocolors", + "sax" + ], + "bin": true + }, + "sync-child-process@1.0.2": { + "integrity": "sha512-8lD+t2KrrScJ/7KXCSyfhT3/hRq78rC0wBFqNJXv3mZyn6hW2ypM05JmlSvtqRbeq6jqA94oHbxAr2vYsJ8vDA==", + "dependencies": [ + "sync-message-port" + ] + }, + "sync-message-port@1.1.3": { + "integrity": "sha512-GTt8rSKje5FilG+wEdfCkOcLL7LWqpMlr2c3LRuKt/YXxcJ52aGSbGBAdI4L3aaqfrBt6y711El53ItyH1NWzg==" + }, + "synckit@0.11.12": { + "integrity": "sha512-Bh7QjT8/SuKUIfObSXNHNSK6WHo6J1tHCqJsuaFDP7gP0fkzSfTxI8y85JrppZ0h8l0maIgc2tfuZQ6/t3GtnQ==", + "dependencies": [ + "@pkgr/core" + ] + }, + "tar@6.2.1": { + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "dependencies": [ + "chownr", + "fs-minipass", + "minipass@5.0.0", + "minizlib", + "mkdirp", + "yallist@4.0.0" + ], + "deprecated": true + }, + "tinycolor2@1.6.0": { + "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==" + }, + "tinyglobby@0.2.15_picomatch@4.0.3": { + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dependencies": [ + "fdir", + "picomatch@4.0.3" + ] + }, + "to-regex-range@5.0.1": { + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": [ + "is-number" + ] + }, + "totalist@3.0.1": { + "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==" + }, + "trim-lines@3.0.1": { + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==" + }, + "ts-api-utils@2.4.0_typescript@5.9.3": { + "integrity": "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA==", + "dependencies": [ + "typescript" + ] + }, + "tslib@2.8.1": { + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + }, + "type-check@0.4.0": { + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dependencies": [ + "prelude-ls" + ] + }, + "typescript-eslint@8.53.1_eslint@9.39.2__jiti@2.6.1_typescript@5.9.3_@typescript-eslint+parser@8.53.1__eslint@9.39.2___jiti@2.6.1__typescript@5.9.3__jiti@2.6.1_jiti@2.6.1": { + "integrity": "sha512-gB+EVQfP5RDElh9ittfXlhZJdjSU4jUSTyE2+ia8CYyNvet4ElfaLlAIqDvQV9JPknKx0jQH1racTYe/4LaLSg==", + "dependencies": [ + "@typescript-eslint/eslint-plugin", + "@typescript-eslint/parser", + "@typescript-eslint/typescript-estree", + "@typescript-eslint/utils", + "eslint", + "typescript" + ] + }, + "typescript@5.9.3": { + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "bin": true + }, + "uc.micro@2.1.0": { + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==" + }, + "ufo@1.6.3": { + "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==" + }, + "undici-types@7.16.0": { + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==" + }, + "unist-util-is@6.0.1": { + "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==", + "dependencies": [ + "@types/unist" + ] + }, + "unist-util-position@5.0.0": { + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "dependencies": [ + "@types/unist" + ] + }, + "unist-util-stringify-position@4.0.0": { + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "dependencies": [ + "@types/unist" + ] + }, + "unist-util-visit-parents@6.0.2": { + "integrity": "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==", + "dependencies": [ + "@types/unist", + "unist-util-is" + ] + }, + "unist-util-visit@5.0.0": { + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "dependencies": [ + "@types/unist", + "unist-util-is", + "unist-util-visit-parents" + ] + }, + "unplugin-utils@0.3.1": { + "integrity": "sha512-5lWVjgi6vuHhJ526bI4nlCOmkCIF3nnfXkCMDeMJrtdvxTs6ZFCM8oNufGTsDbKv/tJ/xj8RpvXjRuPBZJuJog==", + "dependencies": [ + "pathe", + "picomatch@4.0.3" + ] + }, + "unplugin-vue-components@30.0.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-4qVE/lwCgmdPTp6h0qsRN2u642tt4boBQtcpn4wQcWZAsr8TQwq+SPT3NDu/6kBFxzo/sSEK4ioXhOOBrXc3iw==", + "dependencies": [ + "chokidar", + "debug", + "local-pkg", + "magic-string", + "mlly", + "tinyglobby", + "unplugin", + "unplugin-utils", + "vue" + ] + }, + "unplugin@2.3.11": { + "integrity": "sha512-5uKD0nqiYVzlmCRs01Fhs2BdkEgBS3SAVP6ndrBsuK42iC2+JHyxM05Rm9G8+5mkmRtzMZGY8Ct5+mliZxU/Ww==", + "dependencies": [ + "@jridgewell/remapping", + "acorn@8.15.0", + "picomatch@4.0.3", + "webpack-virtual-modules" + ] + }, + "update-browserslist-db@1.2.3_browserslist@4.28.1": { + "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", + "dependencies": [ + "browserslist", + "escalade", + "picocolors" + ], + "bin": true + }, + "uri-js@4.4.1": { + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": [ + "punycode" + ] + }, + "util-deprecate@1.0.2": { + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "valid-url@1.0.9": { + "integrity": "sha512-QQDsV8OnSf5Uc30CKSwG9lnhMPe6exHtTXLRYX8uMwKENy640pU+2BgBL0LRbDh/eYRahNCS7aewCx0wf3NYVA==" + }, + "varint@6.0.0": { + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==" + }, + "vfile-message@4.0.3": { + "integrity": "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==", + "dependencies": [ + "@types/unist", + "unist-util-stringify-position" + ] + }, + "vfile@6.0.3": { + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "dependencies": [ + "@types/unist", + "vfile-message" + ] + }, + "vite-dev-rpc@1.1.0_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-pKXZlgoXGoE8sEKiKJSng4hI1sQ4wi5YT24FCrwrLt6opmkjlqPPVmiPWWJn8M8byMxRGzp1CrFuqQs4M/Z39A==", + "dependencies": [ + "birpc", + "vite", + "vite-hot-client" + ] + }, + "vite-hot-client@2.1.0_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-7SpgZmU7R+dDnSmvXE1mfDtnHLHQSisdySVR7lO8ceAXvM0otZeuQQ6C8LrS5d/aYyP/QZ0hI0L+dIPrm4YlFQ==", + "dependencies": [ + "vite" + ] + }, + "vite-multiple-assets@2.2.6_mime-types@2.1.35_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-biJ+c7mXGXlr0nLYgkiRzQC+pfuNoNfe2XaCzv149FgulCrR1oKE2psk6RXnJ+phUOuw+tCmE2TrlL09zyzHrg==", + "dependencies": [ + "fast-glob", + "micromatch", + "mime-types", + "rollup", + "vite", + "watchpack" + ] + }, + "vite-node@3.2.4_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==", + "dependencies": [ + "cac", + "debug", + "es-module-lexer", + "pathe", + "vite" + ], + "bin": true + }, + "vite-plugin-image-optimizer@2.0.3_sharp@0.34.5_svgo@4.0.0_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-1vrFOTcpSvv6DCY7h8UXab4wqMAjTJB/ndOzG/Kmj1oDOuPF6mbjkNQoGzzCEYeWGe7qU93jc8oQqvoJ57al3A==", + "dependencies": [ + "ansi-colors", + "pathe", + "sharp", + "svgo", + "vite" + ], + "optionalPeers": [ + "sharp", + "svgo" + ] + }, + "vite-plugin-inspect@11.3.3_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-u2eV5La99oHoYPHE6UvbwgEqKKOQGz86wMg40CCosP6q8BkB6e5xPneZfYagK4ojPJSj5anHCrnvC20DpwVdRA==", + "dependencies": [ + "ansis", + "debug", + "error-stack-parser-es", + "ohash", + "open", + "perfect-debounce", + "sirv", + "unplugin-utils", + "vite", + "vite-dev-rpc" + ] + }, + "vite-plugin-vue-devtools@8.0.5_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_vue@3.5.27__typescript@5.9.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2_typescript@5.9.3": { + "integrity": "sha512-p619BlKFOqQXJ6uDWS1vUPQzuJOD6xJTfftj57JXBGoBD/yeQCowR7pnWcr/FEX4/HVkFbreI6w2uuGBmQOh6A==", + "dependencies": [ + "@vue/devtools-core", + "@vue/devtools-kit", + "@vue/devtools-shared", + "sirv", + "vite", + "vite-plugin-inspect", + "vite-plugin-vue-inspector" + ] + }, + "vite-plugin-vue-inspector@5.3.2_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@babel+core@7.28.6_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-YvEKooQcSiBTAs0DoYLfefNja9bLgkFM7NI2b07bE2SruuvX0MEa9cMaxjKVMkeCp5Nz9FRIdcN1rOdFVBeL6Q==", + "dependencies": [ + "@babel/core", + "@babel/plugin-proposal-decorators", + "@babel/plugin-syntax-import-attributes", + "@babel/plugin-syntax-import-meta", + "@babel/plugin-transform-typescript", + "@vue/babel-plugin-jsx", + "@vue/compiler-dom", + "kolorist", + "magic-string", + "vite" + ] + }, + "vite-plugin-wasm@3.5.0_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-X5VWgCnqiQEGb+omhlBVsvTfxikKtoOgAzQ95+BZ8gQ+VfMHIjSHr0wyvXFQCa0eKQ0fKyaL0kWcEnYqBac4lQ==", + "dependencies": [ + "vite" + ] + }, + "vite@7.3.1_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2_picomatch@4.0.3": { + "integrity": "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==", + "dependencies": [ + "@types/node", + "esbuild", + "fdir", + "jiti", + "picomatch@4.0.3", + "postcss", + "rollup", + "sass-embedded", + "tinyglobby" + ], + "optionalDependencies": [ + "fsevents" + ], + "optionalPeers": [ + "@types/node", + "jiti", + "sass-embedded" + ], + "bin": true + }, + "vscode-jsonrpc@8.2.0": { + "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==" + }, + "vscode-languageserver-protocol@3.17.5": { + "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==", + "dependencies": [ + "vscode-jsonrpc", + "vscode-languageserver-types" + ] + }, + "vscode-languageserver-textdocument@1.0.12": { + "integrity": "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==" + }, + "vscode-languageserver-types@3.17.5": { + "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==" + }, + "vscode-uri@3.1.0": { + "integrity": "sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==" + }, + "vue-codemirror6@1.4.1_@codemirror+autocomplete@6.20.0_@codemirror+commands@6.10.1_@codemirror+language@6.12.1_@codemirror+lint@6.9.2_@codemirror+search@6.6.0_@codemirror+state@6.5.4_@codemirror+view@6.39.11_codemirror@6.0.2_style-mod@4.1.3_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-mokK4q89TvxtGXzdEv3YyvfX3RJJs7VxyNjBNpdNbP+jpum/ttLvWB+TEh/ziVZq5mFrQazVPCfUV8TVI/Ji2A==", + "dependencies": [ + "@codemirror/autocomplete", + "@codemirror/commands", + "@codemirror/language", + "@codemirror/lint", + "@codemirror/search", + "@codemirror/state", + "@codemirror/view", + "codemirror", + "style-mod", + "vue", + "vue-demi" + ] + }, + "vue-demi@0.14.10_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==", + "dependencies": [ + "vue" + ], + "scripts": true, + "bin": true + }, + "vue-eslint-parser@10.2.0_eslint@9.39.2__jiti@2.6.1_jiti@2.6.1": { + "integrity": "sha512-CydUvFOQKD928UzZhTp4pr2vWz1L+H99t7Pkln2QSPdvmURT0MoC4wUccfCnuEaihNsu9aYYyk+bep8rlfkUXw==", + "dependencies": [ + "debug", + "eslint", + "eslint-scope", + "eslint-visitor-keys@4.2.1", + "espree", + "esquery", + "semver@7.7.3" + ] + }, + "vue-router@4.6.4_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-Hz9q5sa33Yhduglwz6g9skT8OBPii+4bFn88w6J+J4MfEo4KRRpmiNG/hHHkdbRFlLBOqxN8y8gf2Fb0MTUgVg==", + "dependencies": [ + "@vue/devtools-api", + "vue" + ] + }, + "vue-tsc@3.2.2_typescript@5.9.3": { + "integrity": "sha512-r9YSia/VgGwmbbfC06hDdAatH634XJ9nVl6Zrnz1iK4ucp8Wu78kawplXnIDa3MSu1XdQQePTHLXYwPDWn+nyQ==", + "dependencies": [ + "@volar/typescript", + "@vue/language-core", + "typescript" + ], + "bin": true + }, + "vue-types@4.2.1_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-DNQZmJuOvovLUIp0BENRkdnZHbI0V4e2mNvjAZOAXKD56YGvRchtUYOXA/XqTxdv7Ng5SJLZqRKRpAhm5NLaPQ==", + "dependencies": [ + "is-plain-object", + "vue" + ] + }, + "vue3-colorpicker@2.3.0_@aesoper+normal-utils@0.1.5_@popperjs+core@2.11.8_@vueuse+core@14.1.0__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_gradient-parser@1.1.1_lodash-es@4.17.22_tinycolor2@1.6.0_vue@3.5.27__typescript@5.9.3_vue-types@4.2.1__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-e3lLmBcy7mkRrNQVeUny1DjOd6E11L8H5ok5Bx4MdXmrG+RzyacRF7KkhrEWmRYPhKAsaoUrWsFkmpPAaYnE5A==", + "dependencies": [ + "@aesoper/normal-utils", + "@popperjs/core", + "@vueuse/core", + "gradient-parser", + "lodash-es", + "tinycolor2", + "vue", + "vue-types" + ] + }, + "vue@3.5.27_typescript@5.9.3": { + "integrity": "sha512-aJ/UtoEyFySPBGarREmN4z6qNKpbEguYHMmXSiOGk69czc+zhs0NF6tEFrY8TZKAl8N/LYAkd4JHVd5E/AsSmw==", + "dependencies": [ + "@vue/compiler-dom", + "@vue/compiler-sfc", + "@vue/runtime-dom", + "@vue/server-renderer", + "@vue/shared", + "typescript" + ], + "optionalPeers": [ + "typescript" + ] + }, + "w3c-keyname@2.2.8": { + "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==" + }, + "wasm-pack@0.13.1": { + "integrity": "sha512-P9exD4YkjpDbw68xUhF3MDm/CC/3eTmmthyG5bHJ56kalxOTewOunxTke4SyF8MTXV6jUtNjXggPgrGmMtczGg==", + "dependencies": [ + "binary-install" + ], + "scripts": true, + "bin": true + }, + "watchpack@2.5.1": { + "integrity": "sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg==", + "dependencies": [ + "glob-to-regexp", + "graceful-fs" + ] + }, + "webpack-virtual-modules@0.6.2": { + "integrity": "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==" + }, + "which@2.0.2": { + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": [ + "isexe@2.0.0" + ], + "bin": true + }, + "which@5.0.0": { + "integrity": "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ==", + "dependencies": [ + "isexe@3.1.1" + ], + "bin": true + }, + "word-wrap@1.2.5": { + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==" + }, + "wrap-ansi@9.0.2": { + "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", + "dependencies": [ + "ansi-styles@6.2.3", + "string-width", + "strip-ansi" + ] + }, + "wrappy@1.0.2": { + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "wsl-utils@0.1.0": { + "integrity": "sha512-h3Fbisa2nKGPxCpm89Hk33lBLsnaGBvctQopaBSOW/uIs6FTe1ATyAnKFJrzVs9vpGdsTe73WF3V4lIsk4Gacw==", + "dependencies": [ + "is-wsl" + ] + }, + "xml-name-validator@4.0.0": { + "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==" + }, + "xterm@5.3.0": { + "integrity": "sha512-8QqjlekLUFTrU6x7xck1MsPzPA571K5zNqWm0M0oroYEWVOptZ0+ubQSkQ3uxIEhcIHRujJy6emDWX4A7qyFzg==", + "deprecated": true + }, + "y18n@5.0.8": { + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" + }, + "yallist@3.1.1": { + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + }, + "yallist@4.0.0": { + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "yaml@2.8.2": { + "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", + "bin": true + }, + "yargs-parser@22.0.0": { + "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==" + }, + "yargs@18.0.0": { + "integrity": "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==", + "dependencies": [ + "cliui", + "escalade", + "get-caller-file", + "string-width", + "y18n", + "yargs-parser" + ] + }, + "yocto-queue@0.1.0": { + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" + }, + "zwitch@2.0.4": { + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==" } }, "redirects": { @@ -451,39 +4108,10 @@ "https://deno.land/std@0.224.0/assert/mod.ts": "48b8cb8a619ea0b7958ad7ee9376500fe902284bb36f0e32c598c3dc34cbd6f3", "https://deno.land/std@0.224.0/assert/unimplemented.ts": "8c55a5793e9147b4f1ef68cd66496b7d5ba7a9e7ca30c6da070c1a58da723d73", "https://deno.land/std@0.224.0/assert/unreachable.ts": "5ae3dbf63ef988615b93eb08d395dda771c96546565f9e521ed86f6510c29e19", - "https://deno.land/std@0.224.0/bytes/concat.ts": "86161274b5546a02bdb3154652418efe7af8c9310e8d54107a68aaa148e0f5ed", - "https://deno.land/std@0.224.0/bytes/copy.ts": "08d85062240a7223e6ec4e2af193ad1a50c59a43f0d86ac3a7b16f3e0d77c028", "https://deno.land/std@0.224.0/fmt/colors.ts": "508563c0659dd7198ba4bbf87e97f654af3c34eb56ba790260f252ad8012e1c5", "https://deno.land/std@0.224.0/internal/diff.ts": "6234a4b493ebe65dc67a18a0eb97ef683626a1166a1906232ce186ae9f65f4e6", "https://deno.land/std@0.224.0/internal/format.ts": "0a98ee226fd3d43450245b1844b47003419d34d210fa989900861c79820d21c2", - "https://deno.land/std@0.224.0/internal/mod.ts": "534125398c8e7426183e12dc255bb635d94e06d0f93c60a297723abe69d3b22e", - "https://deno.land/std@0.224.0/io/_common.ts": "36705cdb4dfcd338d6131bca1b16e48a4d5bf0d1dada6ce397268e88c17a5835", - "https://deno.land/std@0.224.0/io/_constants.ts": "3c7ad4695832e6e4a32e35f218c70376b62bc78621ef069a4a0a3d55739f8856", - "https://deno.land/std@0.224.0/io/buf_reader.ts": "aa6d589e567c964c8ba1f582648f3feac45e88ab2e3d2cc2c9f84fd73c05d051", - "https://deno.land/std@0.224.0/io/buf_writer.ts": "3fab3fbeae7a6ed1672207b640b6781a2369890878f8a7bb35f95d364dd6dae6", - "https://deno.land/std@0.224.0/io/buffer.ts": "4d1f805f350433e418002accec798bc6c33ce18f614afa65f987c202d7b2234e", - "https://deno.land/std@0.224.0/io/copy.ts": "63c6a4acf71fb1e89f5e47a7b3b2972f9d2c56dd645560975ead72db7eb23f61", - "https://deno.land/std@0.224.0/io/copy_n.ts": "1bad1525b1f78737cb4c11084e2f7cf22359210fea89e2f0e784bd9a4b221fca", - "https://deno.land/std@0.224.0/io/iterate_reader.ts": "1e5e4fea22d8965afb7df4ee9ab9adda0a0fc581adbea31bc2f2d25453f8a6e9", - "https://deno.land/std@0.224.0/io/limited_reader.ts": "bbe3f7dafe9dd076d0c92d88b1b94e91ecad4825997064f44c2a767737ad2526", - "https://deno.land/std@0.224.0/io/mod.ts": "f0a3f9d419394cec27099ba15ab0c8100da1e70928f95ebe646caaf667c6870c", - "https://deno.land/std@0.224.0/io/multi_reader.ts": "dd8f06d50adec0e1befb92a1d354fcf28733a4b1669b23bf534ace161ce61b1c", - "https://deno.land/std@0.224.0/io/read_all.ts": "876c1cb20adea15349c72afc86cecd3573335845ae778967aefb5e55fe5a8a4a", - "https://deno.land/std@0.224.0/io/read_delim.ts": "d26cfed53b0c2c127ec3453ccd65f474ecc36a331209e246448885434afffc4e", - "https://deno.land/std@0.224.0/io/read_int.ts": "2412f106103a271f5d770b2a61c97b13eebcd18de414a0a092ed82dfcb875903", - "https://deno.land/std@0.224.0/io/read_lines.ts": "17b96f87dbebc5edb976b3d83dc7713bddb994e9c8cb688012d6c6c26803fb9e", - "https://deno.land/std@0.224.0/io/read_long.ts": "d7cd367ab5c1263014c32a76afa0f0584c3bf3a3d860963c7368a6825094df46", - "https://deno.land/std@0.224.0/io/read_range.ts": "2ddfedbfff44e4ea8d60c0463cddb2b1860293d932d6a72a0fb78bdf412538fc", - "https://deno.land/std@0.224.0/io/read_short.ts": "f6dff570e685ade917dcb5188e8ecf0b701d6581b0cd186f08e6efe7f5ce33f7", - "https://deno.land/std@0.224.0/io/read_string_delim.ts": "f6beafa8969e6d9d6d7d679f846cd6595d8b6e99091a20a0aecbd50eb30a391e", - "https://deno.land/std@0.224.0/io/reader_from_stream_reader.ts": "a75bbc93f39df8b0e372cc1fbdc416a7cbf2a39fc4c09ddb057f1241100191c5", - "https://deno.land/std@0.224.0/io/slice_long_to_bytes.ts": "bc59a7aaac64845371dbd44debf3e864ae7b7e453127751d96e30adb29fb633b", - "https://deno.land/std@0.224.0/io/string_reader.ts": "279e9ea72e0ed7af6a9cb6da84f4148af93df849d308c31f124ca21f16d09cf2", - "https://deno.land/std@0.224.0/io/string_writer.ts": "923954c2038a622b84c294b94a3a322565fa0d67e8b4c62942b154fc1ad3bb9b", - "https://deno.land/std@0.224.0/io/to_readable_stream.ts": "ed03a44a1ec1cc55a85a857acf6cac472035298f6f3b6207ea209f93b4aefb39", - "https://deno.land/std@0.224.0/io/to_writable_stream.ts": "ef422e0425963c8a1e0481674e66c3023da50f0acbe5ef51ec9789efc3c1e2ed", - "https://deno.land/std@0.224.0/io/types.ts": "acecb3074c730b5ff487ba4fe9ce51e67bd982aa07c95e5f5679b7b2f24ad129", - "https://deno.land/std@0.224.0/io/write_all.ts": "24aac2312bb21096ae3ae0b102b22c26164d3249dff96dbac130958aa736f038" + "https://deno.land/std@0.224.0/internal/mod.ts": "534125398c8e7426183e12dc255bb635d94e06d0f93c60a297723abe69d3b22e" }, "workspace": { "packageJson": { @@ -526,20 +4154,20 @@ "npm:globals@^16.5.0", "npm:humanize-duration@^3.33.0", "npm:jiti@^2.6.1", - "npm:js-yaml@^4.1.0", + "npm:js-yaml@^4.1.1", "npm:mitt@^3.0.1", "npm:monaco-editor@0.54", "npm:monaco-vim@~0.4.2", "npm:monaco-yaml@^5.4.0", "npm:npm-run-all2@^8.0.4", "npm:prettier-plugin-vue@^1.1.6", - "npm:prettier@^3.7.3", + "npm:prettier@^3.7.4", "npm:qrcode.vue@^3.6.0", "npm:readline-sync@^1.4.10", "npm:sass-embedded@^1.93.3", "npm:sharp@~0.34.5", "npm:svgo@4", - "npm:typescript@~5.9.3", + "npm:typescript@^5.8.3", "npm:unplugin-vue-components@30", "npm:vite-multiple-assets@^2.2.6", "npm:vite-node@^3.2.4", diff --git a/docs/interrupts.md b/docs/interrupts.md index 44645fc74..d420c525b 100644 --- a/docs/interrupts.md +++ b/docs/interrupts.md @@ -1,55 +1,35 @@ # Managing interrupts in CREATOR -Interrupts are handled in the `execute_instruction()` function, after -fetching the instruction. -Interrupts are marked as enabled through the `interruptsEnabled` -flag in status, and checked through the `checkinterrupt()` function (which -uses the architecture-defined `check`). +Interrupts are handled in the `execute_instruction()` function, after fetching the instruction. +Interrupts are marked as enabled through the `interruptsEnabled` flag in status, and checked through the `checkinterrupt()` function (which uses the architecture-defined `check`). -When an interrupt is detected, and interrupts are enabled, the -`handleInterrupt()` function is executed. This function changes the -execution mode to `ExecutionMode.Kernel`, stores the `program_counter` -register in the `exception_program_counter` register, and jumps to the -interruption handler address obtained through the architecture-defined -`get_handler_addr`. Finally, it clears the interruption through the -architechitecture-defined `clear`. +When an interrupt is detected, and interrupts are enabled, the `handleInterrupt()` function is executed. +This function changes the execution mode to `ExecutionMode.Kernel`, stores the `program_counter` register in the `exception_program_counter` register, and jumps to the interruption handler address obtained through the architecture-defined `get_handler_addr`. +Finally, it clears the interruption through the architechitecture-defined `clear`. -The execution mode change is required for the execution of privileged -instructions (see [Privileged instructions in CREATOR](privileged.md)). +The execution mode change is required for the execution of privileged instructions (see [Privileged instructions in CREATOR](privileged.md)). ## Architecture definition -For interrupts to be managed correctly, the architecture definition file -must include the following properties: -- `interrupts.enabled: boolean`: Controls whether interrupts are enabled -by default. -- `interrupts.check: string`: JS code to be executed in order -to check whether an interrupt happened. It must return a +For interrupts to be managed correctly, the architecture definition file must include the following properties: +- `interrupts.enabled: boolean`: Controls whether interrupts are enabled by default. +- `interrupts.check: string`: JS code to be executed in order to check whether an interrupt happened. It must return a `InterruptType` (if an interrupt happened) or `null` (if it didn't). -- `interrupts.is_enabled: string`: JS code to be executed in order to -check whether interrupts are enabled. -- `interrupts.enable: string`: JS code to be executed in order -to enable interrupts. -- `interrupts.disable: string`: JS code to be executed in order -to disable interrupts. -- `interrupts.get_handler_addr: string`: JS code to be executed in order -to obtain the interrupt handler address. -- `interrupts.clear: string`: JS code to be executed in order -to clear an interrupt. -- `interrupts.create: (InterruptType) => null`: JS arrow -(lambda) function to be executed in order to set an interrupt given an -interrupt type. +- `interrupts.is_enabled: string`: JS code to be executed in order to check whether interrupts are enabled. +- `interrupts.enable: string`: JS code to be executed in order to enable interrupts. +- `interrupts.disable: string`: JS code to be executed in order to disable interrupts. +- `interrupts.get_handler_addr: string`: JS code to be executed in order to obtain the interrupt handler address. +- `interrupts.clear: string`: JS code to be executed in order to clear an interrupt. +- `interrupts.create: (InterruptType) => null`: JS arrow (lambda) function to be executed in order to set an interrupt given an interrupt type. ## API ### Functions The following functions, belonging to -[`core/executor/interrupts.mts`](../src/core/executor/interrupts.mts), were implemented: -- `enableInterrupts(null) -> null`: Enables interrupts by calling -`architecture.interrupts.enable`. -- `disableInterrupts(null) -> null`: Disables interrupts by calling -`architecture.interrupts.disable`. +[`core/executor/interrupts.mts`](../src/core/executor/InterruptManager.mts), were implemented: +- `enableInterrupts(null) -> null`: Enables interrupts by calling `architecture.interrupts.enable`. +- `disableInterrupts(null) -> null`: Disables interrupts by calling `architecture.interrupts.disable`. - `checkInterrupt(null) -> null`: Checks whether interrupts are enabled - `handleInterrupt(null) -> null`: Handles an interrupt. @@ -72,71 +52,53 @@ The variables that control the interrupts are stored in `core:status`: ## Example: Interrupts in RISC-V An example of RISC-V with interruptions can be found in the -[`RISC_V_RV32IMFD_Interrupts.json`](../architecture/RISC_V_RV32IMFD_Interrupts.json) -file. +[`RISC_V_RV32IMFD_Interrupts.json`](../architecture/RISCV/RV32IMFD.yml) + ### Interrupt mechanism -In RISC-V, when an interrupt happens, a bit is set in the `MIP` (_Machine -Interrupt Pending_) control register. -Depending on the type of interrupt, it sets a different bit. For example: +In RISC-V, when an interrupt happens, a bit is set in the `MIP` (_Machine Interrupt Pending_) control register. +Depending on the type of interrupt, it sets a different bit. +For example: - Bit `3` (`MSIP`) is set to indicate a _software_ interrupt - Bit `11` (`MEIP`) is set to indicate an _external_ interrupt -Therefore, `check` must read these values in order to determine the -type of the interrupt. +Therefore, `check` must read these values in order to determine the type of the interrupt. -Then, the value of the current instruction is stored in the `MEPC` control -register (tagged as `exception_program_counter`). The value for the interrupt -handler is stored in the `MTVEC` control register, where bits `1` and `0` (MODE) -determine the vector mode, and the rest of the register encodes the base address -(BASE). +Then, the value of the current instruction is stored in the `MEPC` control register (tagged as `exception_program_counter`). +The value for the interrupt handler is stored in the `MTVEC` control register, where bits `1` and `0` (MODE) determine the vector mode, and the rest of the register encodes the base address (BASE). The different modes are: - `0` (direct): All traps set `pc` to the base address - `1` (vectored): Asynchronous interrupts set `pc` to $BASE+4\times cause$ -Here we implemented the _direct_ mode, meaning that `MTVEC` holds `0x00000000`, -the address of the handler. +Here we implemented the _direct_ mode, meaning that `MTVEC` holds `0x00000000`, the address of the handler. > [!NOTE] > As we'll see in [Interrupt handling](#interrupt-handling), this requires the > handling routine to be at the start of the text (`.text`) segment. + Also, the cause of the interrupt is stored in the `MCAUSE` (_Machine Cause_). -This control register is divided into bit `31`, which holds the interrupt type, -and the rest of the bits, each bit corresponding to a specific exception code. +This control register is divided into bit `31`, which holds the interrupt type, and the rest of the bits, each bit corresponding to a specific exception code. Some of the most used are: - `0`-`3` (`0x00000008`): Machine software interrupt -- `0`-`8` (`0x00000100`): Machine external interrupt - `1`-`11` (`0x80000800`): -Environment call from U-mode +- `0`-`8` (`0x00000100`): Machine external interrupt - `1`-`11` (`0x80000800`): Environment call from U-mode -Therefore, in the case of the `ecall` instruction, bit `3` of `MIP` and bit 8 of -`MCAUSE` are set. +Therefore, in the case of the `ecall` instruction, bit `3` of `MIP` and bit 8 of `MCAUSE` are set. ### Interrupt enabling -The `MIE` control register is in charge, together with `MSTATUS`, of -enabling/disabling interrupt types. The types use the same bits as in the `MIP` -register. +The `MIE` control register is in charge, together with `MSTATUS`, of enabling/disabling interrupt types. The types use the same bits as in the `MIP` register. ### Interrupt handling A full example of handling an environment call is provided in -[`examples/riscv-interrupts/ex0.s`](../examples/riscv-interrupts/ex0.s). +[`examples/riscv-interrupts/ex0.s`](../examples/RISCV-32-interrupts/example1.s). First, we need to talk about some new privileged instructions: -- `mret`: This instruction is used to return from an interrupt, which saves the -`MEPC` to the `PC`, clears the interrupt by clearing bits `3` and `11` in `MIP`, -and resetting `MCAUSE` to `0`. It also changes the execution mode back to -`ExecutionMode.User` (U-mode) -- `csrrw`: This instruction switches the values of a control register and a user -register. It's mainly used to store the values of user registers while handling -the interrupt, as we can't operate with control registers. The `MSCRATCH` -control register is provided in order to add an extra register. - -Reference: [The RISC-V Instruction Set Manual Volume II: Privileged -Architecture](https://github.com/riscv/riscv-isa-manual/), chapters 3.1, 3.3.1 -and 3.3.2. - +- `mret`: This instruction is used to return from an interrupt, which saves the `MEPC` to the `PC`, clears the interrupt by clearing bits `3` and `11` in `MIP`, and resetting `MCAUSE` to `0`. It also changes the execution mode back to `ExecutionMode.User` (U-mode) +- `csrrw`: This instruction switches the values of a control register and a user register. It's mainly used to store the values of user registers while handling the interrupt, as we can't operate with control registers. +The `MSCRATCH` control register is provided in order to add an extra register. +Reference: [The RISC-V Instruction Set Manual Volume II: Privileged Architecture](https://github.com/riscv/riscv-isa-manual/), chapters 3.1, 3.3.1 and 3.3.2. ### Implemented features @@ -147,11 +109,11 @@ Here is the table of implemented RISC-V features: | I.7.1 | CSR Instructions | :white_check_mark: | Only `csrrw`, and without checking for register `x0` | | II.3.1.1 - II.3.1.5 | Processor and ISA information (`misa`, `mvendorid`, etc.) | :x: | | | II.3.1.6 | `mstatus`/`mstatush` | :white_check_mark: | Only _Privilege and Global Interrupt-Enable_ (chapter II.3.1.6.1). Only `mstatus`, as only the 32-bit version is implemented | -| II.3.1.7, II.3.1.9, II.3.1.13 - II.3.1.16 | Interrupts (`mtvec`, `mip`, `mie`, `mscratch`, `mepc`, `mcause`) | :white_check_mark: | No `mtval` | +| II.3.1.7, II.3.1.9, II.3.1.13 - II.3.1.16 | Interrupts (`mtvec`, `mip`, `mie`, `mscratch`, `mepc`, `mcause`) | :white_check_mark: | No `mtval` | | II.3.1.8 | Trap Delegation | :x: | | | II.3.1.10 | Hardware performance Monitor | :x: | | | II.3.1.11 - II.3.1.12 | Counters | :x: | | | II.3.2.1 - II.3.3.2 | Environmen Calls and Trap-return | :white_check_mark: | Not breakpoints | | II.3.1.17 - II.3.2, II.3.6 - II.3.7 | Environment, Security and Memory | :x: | | | II.10 | Supervisor-Level ISA | :x: | | -| II.4 - II.9, II.11 - II.18 | Volume II Extensions | :x: | | \ No newline at end of file +| II.4 - II.9, II.11 - II.18 | Volume II Extensions | :x: | | diff --git a/docs/schema/architecture.json b/docs/schema/architecture.json index 7a9649a5d..0c4a102b0 100644 --- a/docs/schema/architecture.json +++ b/docs/schema/architecture.json @@ -201,6 +201,16 @@ "description": "Floating point registers", "type": "string", "enum": ["fp_registers"] + }, + { + "description": "Vector registers", + "type": "string", + "enum": ["v_registers"] + }, + { + "description": "Control state registers", + "type": "string", + "enum": ["csr_registers"] } ] }, @@ -307,6 +317,11 @@ "properties": { "name": { "oneOf": [ + { + "description": "Architecture compiled with Sail specification", + "type": "string", + "enum": ["Sail"] + }, { "description": "Default architecture-agnostic CREATOR assembler", "type": "string", @@ -501,6 +516,10 @@ "description": "Name of the instruction", "type": "string" }, + "extension": { + "description": "Extension of the instruction", + "type": "string" + }, "nwords": { "description": "Size of the instruction", "type": "integer", @@ -1145,6 +1164,7 @@ "Function call", "Transfer between registers", "Memory access", + "Vector Set Length Instruction with an inmediate", "Other" ] }, @@ -1355,10 +1375,14 @@ "required": ["end", "start"], "properties": { "end": { - "type": "integer" + "type": "integer", + "minimum": 0, + "maximum": 18446744073709551615 }, "start": { - "type": "integer" + "type": "integer", + "minimum": 0, + "maximum": 18446744073709551615 } } }, diff --git a/examples/MIPS-32/list.json b/examples/MIPS-32/list.json index a76b10e50..817c2bf88 100644 --- a/examples/MIPS-32/list.json +++ b/examples/MIPS-32/list.json @@ -9,7 +9,7 @@ "name": "Example 2", "id": "e2", "url": "examples/MIPS-32/example2.s", - "description": "ALU operations" + "description": "ALU Operations" }, { "name": "Example 3", @@ -21,7 +21,7 @@ "name": "Example 4", "id": "e4", "url": "examples/MIPS-32/example4.s", - "description": "FPU operations" + "description": "FPU Operations" }, { "name": "Example 5", @@ -45,7 +45,7 @@ "name": "Example 8", "id": "e8", "url": "examples/MIPS-32/example8.s", - "description": "Copy of matrices" + "description": "Copy of Matrices" }, { "name": "Example 9", diff --git a/examples/RISCV-32-arduino/example12.s b/examples/RISCV-32-arduino/example12.s new file mode 100644 index 000000000..cc7e0a446 --- /dev/null +++ b/examples/RISCV-32-arduino/example12.s @@ -0,0 +1,55 @@ + +#Creatino example: parse +.data + msg: .string "Enter a integer number:\n" + sol: .string "You entered %d" + lookahead: .string "SKIP_NONE" + +.text + +number: + mv a1, a0 + la a0, sol + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_printf + lw ra, 0(sp) + addi sp, sp, 4 + jal ra, loop + +setup: + li a0, 115200 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_begin + lw ra, 0(sp) + addi sp, sp, 4 + + jr ra + +loop: + la a0, msg + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_printf + lw ra, 0(sp) + addi sp, sp, 4 + + la a0, lookahead + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_parseInt + lw ra, 0(sp) + addi sp, sp, 4 + bnez a0, number + jal ra, loop + + +main: + jal ra, initArduino + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, setup + lw ra, 0(sp) + addi sp, sp, 4 + j loop \ No newline at end of file diff --git a/examples/RISCV-32-arduino/example13.s b/examples/RISCV-32-arduino/example13.s new file mode 100644 index 000000000..763be1eae --- /dev/null +++ b/examples/RISCV-32-arduino/example13.s @@ -0,0 +1,40 @@ +#Template for Arduino proyects +.data +space: .zero 100 + +.text +setup: + li a0, 11520 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_begin + lw ra, 0(sp) + addi sp, sp, 4 + jr ra +loop: + + addi sp, sp, -4 + sw ra, 0(sp) + la a0, space + li a1, 5 + jal ra, serial_readBytes + lw ra, 0(sp) + addi sp, sp, 4 + + + addi sp, sp, -4 + sw ra, 0(sp) + la a0, space + jal ra, serial_printf + lw ra, 0(sp) + addi sp, sp, 4 + + j loop +main: + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, initArduino + jal ra, setup + lw ra, 12(sp) + addi sp, sp, 16 + j loop \ No newline at end of file diff --git a/examples/RISCV-32-arduino/example14.s b/examples/RISCV-32-arduino/example14.s new file mode 100644 index 000000000..af9de2c9e --- /dev/null +++ b/examples/RISCV-32-arduino/example14.s @@ -0,0 +1,47 @@ +# Creatino example:readBytes +.data + space: .zero 100 #Buffer to place the string + print: .string "%s\n" + char: .byte 65 #A + +.text +setup: + li a0, 11520 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_begin + lw ra, 0(sp) + addi sp, sp, 4 + jr ra +loop: + + # read int + la a0, char + lb a0, 0(a0) + la a1, space + la a2, 5 # number of letters it will have + + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_readBytesUntil + lw ra, 0(sp) + addi sp, sp, 4 + + # print: + la a0, space + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_printf + lw ra, 0(sp) + addi sp, sp, 4 + + # return + j loop +main: + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, initArduino + jal ra, setup + lw ra, 12(sp) + addi sp, sp, 16 + j loop \ No newline at end of file diff --git a/examples/RISCV-32-arduino/example15.s b/examples/RISCV-32-arduino/example15.s new file mode 100644 index 000000000..96972db52 --- /dev/null +++ b/examples/RISCV-32-arduino/example15.s @@ -0,0 +1,96 @@ +# Creatino example: GPIO Interrupts +.data + ledPin: .byte 4 + interruptpin: .byte 6 + state: .byte 0 #LOW + change: .byte 0x04 +.text +blink: + la t1, ledPin + lb a0, 0(t1) + li a1, 1 + addi sp, sp, -4 + sw ra,0(sp) + jal ra, digitalWrite# digitalWrite(ledPin, state) + lw ra,0(sp) + addi sp, sp, 4 + jr ra + + +loop: + la t1, ledPin + lb a0, 0(t1) + li a1,0 + addi sp, sp, -4 + sw ra,0(sp) + jal ra, digitalWrite# digitalWrite(ledPin, state) + lw ra,0(sp) + addi sp, sp, 4 + + li a0, 100 + addi sp, sp, -4 + sw ra,0(sp) + jal ra, delay # delay(1000) + lw ra,0(sp) + addi sp, sp, 4 + j loop + +setup: + #Start pins + la t1, ledPin + lb a0, 0(t1) + li a1, 0x03 #OUTPUT + addi sp, sp, -4 + sw ra,0(sp) + jal ra, pinMode #pinMode(ledPin, OUTPUT); + lw ra,0(sp) + addi sp, sp, 4 + la t1, interruptpin + lb a0, 0(t1) + li a1, 0x05 #INPUT_PULLUP + addi sp, sp, -4 + sw ra,0(sp) + jal ra, pinMode# pinMode(ledPin, INPUT_PULLUP); + lw ra,0(sp) + addi sp, sp, 4 + + la t1, interruptpin + lb a0, 0(t1) + addi sp, sp, -4 + sw ra,0(sp) + jal ra, digitalPinToInterrupt #digitalPinToInterrupt(interruptpin); + lw ra,0(sp) + addi sp, sp, 4 + + la a1, blink + + la t1, change + lb a2, 0(t1) + + addi sp, sp, -4 + sw ra,0(sp) + jal ra, attachInterrupt #attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE); + lw ra,0(sp) + addi sp, sp, 4 + jr ra + +main: + # Llamar a cr_initArduino() + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, initArduino + lw ra, 0(sp) + addi sp, sp, 4 + + # Llamar a setup() + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, setup + lw ra, 0(sp) + addi sp, sp, 4 + + # Bucle infinito + j loop + + + \ No newline at end of file diff --git a/examples/RISCV-32-arduino/example1_b.s b/examples/RISCV-32-arduino/example1_b.s new file mode 100644 index 000000000..5c64afe4e --- /dev/null +++ b/examples/RISCV-32-arduino/example1_b.s @@ -0,0 +1,52 @@ +# Creatino Example: Blink for BUILTIN RGB Led boards (ESP32-C6) +.data + time: + .word 1000 +.text + +main: + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, initArduino + jal ra, setup + lw ra, 0(sp) + addi sp, sp, 4 + j loop + +setup: + nop +loop: + #digitalWrite(LED_BUILTIN, HIGH); + li a0,8 + li a1, 0x1 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, digitalWrite + lw ra, 0(sp) + addi sp, sp, 4 + #delay(1000); + la a0, time + lw a0, 0(a0) + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, delay + lw ra, 0(sp) + addi sp, sp, 4 + #digitalWrite(LED_BUILTIN, LOW); + li a0,8 + li a1, 0x0 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, digitalWrite + lw ra, 0(sp) + addi sp, sp, 4 + #delay(1000); + la a0, time + lw a0, 0(a0) + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, delay + lw ra, 0(sp) + addi sp, sp, 4 + j loop + \ No newline at end of file diff --git a/examples/RISCV-32-arduino/example_semmaphore.s b/examples/RISCV-32-arduino/example_semmaphore.s new file mode 100644 index 000000000..7c7ad3e05 --- /dev/null +++ b/examples/RISCV-32-arduino/example_semmaphore.s @@ -0,0 +1,114 @@ +#Creatino example: Semaphore with 3 LEDs + +.data + time: + .word 1000 +.text +setup: + li a0, 4 #RED PIN GPIO + li a1, 0x03 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, pinMode + lw ra, 0(sp) + addi sp, sp, 4 + + li a0, 5 #YELLOW PIN GPIO + li a1, 0x03 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, pinMode + lw ra, 0(sp) + addi sp, sp, 4 + + li a0, 6 #GREEN PIN GPIO + li a1, 0x03 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, pinMode + lw ra, 0(sp) + addi sp, sp, 4 + + jr ra +loop: + ## ---------------------RED PIN--------------------- + li a0,4 + li a1, 0x1 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, digitalWrite + lw ra, 0(sp) + addi sp, sp, 4 + la a0, time + lw a0, 0(a0) + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, delay + lw ra, 12(sp) + addi sp, sp, 16 + li a0,4 + li a1, 0x0 + jal ra, digitalWrite + la a0, time + lw a0, 0(a0) + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, delay + lw ra, 12(sp) + addi sp, sp, 16 + + ## ---------------------Yellow PIN--------------------- + li a0,5 + li a1, 0x1 + jal ra, digitalWrite + la a0, time + lw a0, 0(a0) + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, delay + lw ra, 12(sp) + addi sp, sp, 16 + li a0,5 + li a1, 0x0 + jal ra, digitalWrite + la a0, time + lw a0, 0(a0) + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, delay + lw ra, 12(sp) + addi sp, sp, 16 + + ## ---------------------Green PIN--------------------- + li a0,6 + li a1, 0x1 + jal ra, digitalWrite + la a0, time + lw a0, 0(a0) + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, delay + lw ra, 12(sp) + addi sp, sp, 16 + li a0,6 + li a1, 0x0 + jal ra, digitalWrite + la a0, time + lw a0, 0(a0) + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, delay + lw ra, 12(sp) + addi sp, sp, 16 + + j loop + +main: + #Initialize Arduino + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, initArduino + jal ra, setup + lw ra, 12(sp) + addi sp, sp, 16 + j loop \ No newline at end of file diff --git a/examples/RISCV-32-arduino/list.json b/examples/RISCV-32-arduino/list.json index ac6538332..e93c09329 100644 --- a/examples/RISCV-32-arduino/list.json +++ b/examples/RISCV-32-arduino/list.json @@ -7,68 +7,99 @@ }, { "name": "Example 1", - "id": "example1", + "id": "e1", "url": "examples/RISCV-32-arduino/example1.s", "description": "ESP32-C3 Blink LED example" + }, + { + "name": "Example 1_b", + "id": "e1_b", + "url": "examples/RISCV-32-arduino/example1_b.s", + "description": "ESP32-C6 Blink LED example" }, { "name": "Example 2", - "id": "example2", + "id": "e2", "url": "examples/RISCV-32-arduino/example2.s", "description": "Button + LED example" }, { "name": "Example 3", - "id": "example3", + "id": "e3", "url": "examples/RISCV-32-arduino/example3.s", "description": "Serial communication example" }, { "name": "Example 4", - "id": "example4", + "id": "e4", "url": "examples/RISCV-32-arduino/example4.s", "description": "LDR example" }, { "name": "Example 5", - "id": "example5", + "id": "e5", "url": "examples/RISCV-32-arduino/example5.s", "description": "Piano using interruptions example" }, { "name": "Example 6", - "id": "example6", + "id": "e6", "url": "examples/RISCV-32-arduino/example6.s", "description": "Math functions (min.max, map, constrain) example" }, { "name": "Example 7", - "id": "example7", + "id": "e7", "url": "examples/RISCV-32-arduino/example7.s", "description": "Check if a char is a number example" }, { "name": "Example 8", - "id": "example8", + "id": "e8", "url": "examples/RISCV-32-arduino/example8.s", "description": "Random function example" }, { "name": "Example 9", - "id": "example9", + "id": "e9", "url": "examples/RISCV-32-arduino/example9.s", "description": "Serial Find example" }, { "name": "Example 10", - "id": "example10", + "id": "e10", "url": "examples/RISCV-32-arduino/example10.s", "description": "Serial FindUntil example" }, { "name": "Example 11", - "id": "example11", + "id": "e11", "url": "examples/RISCV-32-arduino/example11.s", "description": "Serial Flush example" + }, + { + "name": "Example 12", + "id": "e12", + "url": "examples/RISCV-32-arduino/example12.s", + "description": "Serial parseInt example" + }, + { + "name": "Example 13", + "id": "e13", + "url": "examples/RISCV-32-arduino/example13.s", + "description": "Serial readBytes example" + }, + { + "name": "Example 14", + "id": "e14", + "url": "examples/RISCV-32-arduino/example14.s", + "description": "Serial readBytesUntil example" + }, + { + "name": "Example 15", + "id": "e15", + "url": "examples/RISCV-32-arduino/example15.s", + "description": "High level interrupts example" } + ] diff --git a/examples/RISCV-32-devices/example1.s b/examples/RISCV-32-devices/example1.s index 7623d67b1..20544c478 100644 --- a/examples/RISCV-32-devices/example1.s +++ b/examples/RISCV-32-devices/example1.s @@ -1,13 +1,9 @@ .data - console_ctrl_addr: .word 0xF0000000 - console_data_addr: .word 0xF0000008 - string1: .string "Insert the string length (no more than 100 characters) " - string2: .string "Insert the string " - space: .zero 100 - + console_ctrl_addr: .word 0xF0000000 + console_data_addr: .word 0xF0000008 + string: .string "This is a string" .text - main: # load console data addr to t0 la t0, console_data_addr @@ -17,37 +13,28 @@ la t1, console_ctrl_addr lw t1, 0(t1) - - # print "Insert string length..." - la t2, string1 + # write 69 + li t2, 69 sw t2, 0(t0) # store value in console data - li t2, 4 - sw t2, 0(t1) # signal device to write a string - # read int - li t2, 5 - sw t2, 0(t1) - lw t3, 0(t0) # t3: lenght + li t2, 1 + sw t2, 0(t1) # signal device to write an integer - # print "Insert string..." - la t2, string2 - sw t2, 0(t0) - li t2, 4 - sw t2, 0(t1) # signal device + li t2, 2 + sw t2, 0(t1) # signal device to write a float - # read string - la t2, space - sw t2, 0(t0) # store addr - sw t3, 4(t0) # store lenght - li t2, 8 - sw t2, 0(t1) # signal device + li t2, 3 + sw t2, 0(t1) # signal device to write a double + li t2, 11 + sw t2, 0(t1) # signal device to write a char - # print string - la t2, space + # write string addr + la t2, string sw t2, 0(t0) # store value in console data li t2, 4 sw t2, 0(t1) # signal device to write a string # return - jr ra + li a7, 10 + ecall \ No newline at end of file diff --git a/examples/RISCV-32-devices/example2.s b/examples/RISCV-32-devices/example2.s new file mode 100644 index 000000000..016e545be --- /dev/null +++ b/examples/RISCV-32-devices/example2.s @@ -0,0 +1,54 @@ +.data + console_ctrl_addr: .word 0xF0000000 + console_data_addr: .word 0xF0000008 + string1: .string "Insert the string length (no more than 100 characters) " + string2: .string "Insert the string " + space: .zero 100 + + +.text + + main: + # load console data addr to t0 + la t0, console_data_addr + lw t0, 0(t0) + + # load console ctrl addr to t1 + la t1, console_ctrl_addr + lw t1, 0(t1) + + + # print "Insert string length..." + la t2, string1 + sw t2, 0(t0) # store value in console data + li t2, 4 + sw t2, 0(t1) # signal device to write a string + + # read int + li t2, 5 + sw t2, 0(t1) + lw t3, 0(t0) # t3: lenght + + # print "Insert string..." + la t2, string2 + sw t2, 0(t0) + li t2, 4 + sw t2, 0(t1) # signal device + + # read string + la t2, space + sw t2, 0(t0) # store addr + sw t3, 4(t0) # store lenght + li t2, 8 + sw t2, 0(t1) # signal device + + + # print string + la t2, space + sw t2, 0(t0) # store value in console data + li t2, 4 + sw t2, 0(t1) # signal device to write a string + + # return + li a7, 10 + ecall diff --git a/examples/RISCV-32-devices/list.json b/examples/RISCV-32-devices/list.json index ebdab73a8..c624a0088 100644 --- a/examples/RISCV-32-devices/list.json +++ b/examples/RISCV-32-devices/list.json @@ -1,14 +1,14 @@ [ { - "name": "Example 0", - "id": "example0", - "url": "examples/RISCV-32-devices/example0.s", - "description": "Writting to console" + "name": "Example 1", + "id": "e1", + "url": "examples/RISCV-32-devices/example1.s", + "description": "Writting to Console" }, { - "name": "Example 1", - "id": "example1", - "url": "examples/RISCV-32-devices/example0.s", + "name": "Example 2", + "id": "e2", + "url": "examples/RISCV-32-devices/example2.s", "description": "Echo" } ] diff --git a/examples/RISCV-32-interrupts/example1.s b/examples/RISCV-32-interrupts/example1.s new file mode 100644 index 000000000..acfd0e895 --- /dev/null +++ b/examples/RISCV-32-interrupts/example1.s @@ -0,0 +1,32 @@ +# +# Creator (https://creatorsim.github.io/creator/) +# + +.data + +.text + rti: + # ... + + # return from interrupt + mret + + main: + # enable interrupts (MIE=1) + csrrw zero, mstatus, t0 + ori t0, t0, 8 + csrrw zero, mstatus, t0 + + # enable software interrupts (MSIE=1) + csrrw zero, mie, t0 + ori t0, t0, 8 + csrrw zero, mie, t0 + + # load rti addr to mtvec + la t0, rti + csrrw zero, mtvec, t0 + + # generate interrupt + ecall + + li t0, 0 diff --git a/examples/RISCV-32-interrupts/ex0.s b/examples/RISCV-32-interrupts/example2.s similarity index 100% rename from examples/RISCV-32-interrupts/ex0.s rename to examples/RISCV-32-interrupts/example2.s diff --git a/examples/RISCV-32-interrupts/list.json b/examples/RISCV-32-interrupts/list.json index 31b7e0ab8..561a12dc4 100644 --- a/examples/RISCV-32-interrupts/list.json +++ b/examples/RISCV-32-interrupts/list.json @@ -1,8 +1,8 @@ [ { - "name": "Example 0", - "id": "e0", - "url": "examples/RISCV-32-interrupts/ex0.s", - "description": "" + "name": "Example 1", + "id": "e1", + "url": "examples/RISCV-32-interrupts/example1.s", + "description": "Interrupt Handler" } ] diff --git a/examples/RISCV-32/list.json b/examples/RISCV-32/list.json index 29c83c810..dacdc9f62 100644 --- a/examples/RISCV-32/list.json +++ b/examples/RISCV-32/list.json @@ -9,7 +9,7 @@ "name": "Example 2", "id": "e2", "url": "examples/RISCV-32/example2.s", - "description": "ALU operations" + "description": "ALU Operations" }, { "name": "Example 3", @@ -21,7 +21,7 @@ "name": "Example 4", "id": "e4", "url": "examples/RISCV-32/example4.s", - "description": "FPU operations" + "description": "FPU Operations" }, { "name": "Example 5", @@ -45,7 +45,7 @@ "name": "Example 8", "id": "e8", "url": "examples/RISCV-32/example8.s", - "description": "Copy of matrices" + "description": "Copy of Matrices" }, { "name": "Example 9", diff --git a/examples/RISCV-32-devices/example0.s b/examples/RISCV-64-devices/example0.s similarity index 100% rename from examples/RISCV-32-devices/example0.s rename to examples/RISCV-64-devices/example0.s diff --git a/examples/RISCV-64-devices/example1.s b/examples/RISCV-64-devices/example1.s new file mode 100644 index 000000000..7623d67b1 --- /dev/null +++ b/examples/RISCV-64-devices/example1.s @@ -0,0 +1,53 @@ +.data + console_ctrl_addr: .word 0xF0000000 + console_data_addr: .word 0xF0000008 + string1: .string "Insert the string length (no more than 100 characters) " + string2: .string "Insert the string " + space: .zero 100 + + +.text + + main: + # load console data addr to t0 + la t0, console_data_addr + lw t0, 0(t0) + + # load console ctrl addr to t1 + la t1, console_ctrl_addr + lw t1, 0(t1) + + + # print "Insert string length..." + la t2, string1 + sw t2, 0(t0) # store value in console data + li t2, 4 + sw t2, 0(t1) # signal device to write a string + + # read int + li t2, 5 + sw t2, 0(t1) + lw t3, 0(t0) # t3: lenght + + # print "Insert string..." + la t2, string2 + sw t2, 0(t0) + li t2, 4 + sw t2, 0(t1) # signal device + + # read string + la t2, space + sw t2, 0(t0) # store addr + sw t3, 4(t0) # store lenght + li t2, 8 + sw t2, 0(t1) # signal device + + + # print string + la t2, space + sw t2, 0(t0) # store value in console data + li t2, 4 + sw t2, 0(t1) # signal device to write a string + + # return + jr ra diff --git a/examples/RISCV-64-devices/list.json b/examples/RISCV-64-devices/list.json new file mode 100644 index 000000000..88a90c071 --- /dev/null +++ b/examples/RISCV-64-devices/list.json @@ -0,0 +1,14 @@ +[ + { + "name": "Example 1", + "id": "e1", + "url": "examples/RISCV-64-devices/example1.s", + "description": "Writting to Console" + }, + { + "name": "Example 2", + "id": "e2", + "url": "examples/RISCV-64-devices/example2.s", + "description": "Echo" + } +] diff --git a/examples/RISCV-64-interrupts/example1.s b/examples/RISCV-64-interrupts/example1.s new file mode 100644 index 000000000..acfd0e895 --- /dev/null +++ b/examples/RISCV-64-interrupts/example1.s @@ -0,0 +1,32 @@ +# +# Creator (https://creatorsim.github.io/creator/) +# + +.data + +.text + rti: + # ... + + # return from interrupt + mret + + main: + # enable interrupts (MIE=1) + csrrw zero, mstatus, t0 + ori t0, t0, 8 + csrrw zero, mstatus, t0 + + # enable software interrupts (MSIE=1) + csrrw zero, mie, t0 + ori t0, t0, 8 + csrrw zero, mie, t0 + + # load rti addr to mtvec + la t0, rti + csrrw zero, mtvec, t0 + + # generate interrupt + ecall + + li t0, 0 diff --git a/examples/RISCV-64-interrupts/example2.s b/examples/RISCV-64-interrupts/example2.s new file mode 100644 index 000000000..bb9e1774b --- /dev/null +++ b/examples/RISCV-64-interrupts/example2.s @@ -0,0 +1,29 @@ +.data + +.text + +rti: # load mcause to t0 + csrrw t0, MCAUSE, t0 + csrrw t1, MSCRATCH, t1 # swap t1 w/ mscratch + + # treat interruption + + # if ecall + li t1, 256 + beq t0, t1, rti_ecall + +rti_ecall: li t1, 1 + beq a7, t1, rti_print_int + +rti_print_int: print_int + j rti_end + +rti_end: csrrw t0, MCAUSE, t0 # restore t0 + csrrw t1, MSCRATCH, t1 # restore t1 + mret + + +main: li a7, 1 + li a0, 69 + ecall + jr ra # TODO: Implement proper exit \ No newline at end of file diff --git a/examples/RISCV-64-interrupts/list.json b/examples/RISCV-64-interrupts/list.json new file mode 100644 index 000000000..b481b96d6 --- /dev/null +++ b/examples/RISCV-64-interrupts/list.json @@ -0,0 +1,8 @@ +[ + { + "name": "Example 1", + "id": "e1", + "url": "examples/RISCV-64-interrupts/example1.s", + "description": "Interrupt Handler" + } +] diff --git a/examples/RISCV-64/list.json b/examples/RISCV-64/list.json index fd2e5998f..b7f7ae41a 100644 --- a/examples/RISCV-64/list.json +++ b/examples/RISCV-64/list.json @@ -9,7 +9,7 @@ "name": "Example 2", "id": "e2", "url": "examples/RISCV-64/example2.s", - "description": "ALU operations" + "description": "ALU Operations" }, { "name": "Example 3", @@ -21,7 +21,7 @@ "name": "Example 4", "id": "e4", "url": "examples/RISCV-64/example4.s", - "description": "FPU operations" + "description": "FPU Operations" }, { "name": "Example 5", @@ -45,7 +45,7 @@ "name": "Example 8", "id": "e8", "url": "examples/RISCV-64/example8.s", - "description": "Copy of matrices" + "description": "Copy of Matrices" }, { "name": "Example 9", diff --git a/examples/RISCV-Sail/example1.s b/examples/RISCV-Sail/example1.s new file mode 100755 index 000000000..e3db566a0 --- /dev/null +++ b/examples/RISCV-Sail/example1.s @@ -0,0 +1,44 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# +.section .data + + byte: .byte 12 + + .align 1 + half: .half 34 + + .align 2 + word: .word -5678 + float: .float 456.322 + double: .double 9741.34 + stringz: .asciz "This is a string" + string: .ascii "This is another string" + space: .zero 32 + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main + + _main: + + # print byte value + la a0, byte + lb a0, 0(a0) + li a7, 1 + ecall + + # print half value + la a0, half + lh a0, 0(a0) + li a7, 1 + ecall + + #return + # li a7, 10 + # ecall + jr ra diff --git a/examples/RISCV-Sail/example10.s b/examples/RISCV-Sail/example10.s new file mode 100755 index 000000000..3b97e7e9f --- /dev/null +++ b/examples/RISCV-Sail/example10.s @@ -0,0 +1,49 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .data + string1: .asciz "Insert the string length (no more than 100 characters) " + string2: .asciz "Insert the string " + space: .zero 100 + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main +_main: + # print "Insert string length..." + la a0, string1 + li a7, 4 + ecall + + # read int + li a7, 5 + ecall + + add t0, a0, zero + + # print "Insert string..." + la a0, string2 + li a7, 4 + ecall + + # read string + la a0, space + add a1, t0, zero + li a7, 8 + ecall + + # print string + la a0, space + li a7, 4 + ecall + + # return + # li a7, 10 + # ecall + jr ra + diff --git a/examples/RISCV-Sail/example11.s b/examples/RISCV-Sail/example11.s new file mode 100755 index 000000000..b482e39c1 --- /dev/null +++ b/examples/RISCV-Sail/example11.s @@ -0,0 +1,40 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main + +_main: + addi sp, sp, -4 + sw ra, 0(sp) + + li a0, 23 + li a1, -77 + li a2, 45 + jal x1, sum + jal x1, sub + li a7, 1 + ecall + + lw ra, 0(sp) + addi sp, sp, 4 + # li a7, 10 + # ecall + jr ra + +sum: + add t1, a0, a1 + add t2, a2, a2 + add a0, t1, zero + add a1, t2, zero + jr ra + +sub: + sub a0, a0, a1 + jr ra diff --git a/examples/RISCV-Sail/example12.s b/examples/RISCV-Sail/example12.s new file mode 100755 index 000000000..ab222c246 --- /dev/null +++ b/examples/RISCV-Sail/example12.s @@ -0,0 +1,63 @@ + +# +# ARCOS.INF.UC3M.ES +# BY-NC-SA (https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es) +# + +.section .bss +.align 8 +tohost: .dword 0 + + +.section .text.init +.globl _main + + _main: + addi sp, sp, -4 + sw ra, 0(sp) + + # t1 = factorial(5) + li a0, 5 + jal x1, factorial + + # print_int(t1) + li a7, 1 + ecall + + # return + lw ra, 0(sp) + addi sp, sp, 4 + # li a7, 10 + # ecall + jr ra + + +factorial: + # crear "stack frame" para $ra, $fp y una variable local + addi sp, sp, -12 + sw ra, 8(sp) + sw fp, 4(sp) + addi fp, sp, 4 + + # if (a0 < 2): + # return 1 + li x5, 2 + bge a0, t0, b_else + li a0, 1 + beq x0, x0, b_efs + # else: + # return a0 * factorial(a0 - 1) + b_else: sw a0, -4(fp) + addi a0, a0, -1 + jal x1, factorial + lw t1, -4(fp) + mul a0, a0, t1 + + # finalizar "stack frame" + b_efs: lw ra, 8(sp) + lw fp, 4(sp) + addi sp, sp, 12 + + # return t0 + + jr ra diff --git a/examples/RISCV-Sail/example13a.s b/examples/RISCV-Sail/example13a.s new file mode 100644 index 000000000..b54859d16 --- /dev/null +++ b/examples/RISCV-Sail/example13a.s @@ -0,0 +1,142 @@ +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .bss +.align 8 +tohost: + .dword 0 + +.section .text.init +.globl _main + +kernel: + j reset_vector + + syscall: + li t0, 13 + bgeu a7, t0, fail + addi t0, t0, -3 + beq t0, a7, exit + + csrr t0, mepc + addi t0, t0, 4 + csrw mepc, t0 + mret + + exit: + fence + li gp, 1 + li a0, 0 + li a7, 10 + j exception+4 + + fail: + fence + beqz gp, fail+0x4 + slli gp, gp, 1 + ori gp, gp, 1 + li a7, 10 + mv a0, gp + j syscall + + trap_vec: + csrr t5, mcause + li t6, 8 + beq t5, t6, syscall + li t6, 9 + beq t5, t6, syscall + li t6, 11 + beq t5, t6, syscall + j exception + + exception: + ori gp, gp, 1337 + la t5, tohost + sw gp, 0(t5) + sw zero, 4(t5) + + j exception + + reset_vector: + li ra, 0 + li sp, 0x80006FFC + li gp, 0 + li tp, 0 + li t0, 0 + li t1, 0 + li t2, 0 + li fp, 0 + li s1, 0 + li a0, 0 + li a1, 0 + li a2, 0 + li a3, 0 + li a4, 0 + li a5, 0 + li a6, 0 + li a7, 0 + li s2, 0 + li s3, 0 + li s4, 0 + li s5, 0 + li s6, 0 + li s7, 0 + li s8, 0 + li s9, 0 + li s10, 0 + li s11, 0 + li t3, 0 + li t4, 0 + li t5, 0 + li t6, 0 + + initial: + csrr a0, mhartid + bnez a0, initial + auipc t0, 0 + addi t0, t0, 16 + csrw mtvec, t0 + csrwi mstatus, 8 + auipc t0, 0 + addi t0, t0, 16 + csrw mtvec, t0 + csrwi satp, 0 + + auipc t0, 0 + addi t0, t0, 36 + csrw mtvec, t0 + addi t0, zero, 1 + slli t0, t0, 0x1f + csrw pmpaddr0, t0 + li t0, 31 + csrwi mie, 0 + auipc t0, 0 + addi t0, t0, 20 + + csrwi medeleg, 0 + csrwi mideleg, 0 + la t0, trap_vec + csrw mtvec, t0 + csrw mepc, t0 + lui t0, 0x2 + addi t0, t0, -2048 + csrrc zero, mstatus, t0 + + csrr t0, mstatus + lui t1, 0xffffe + addi t1, t1, 2047 + and t0, t0, t1 + li t1, 0 + slli t1, t1, 11 + or t0, t0, t1 + csrw mstatus, t0 + + la t0, _main + csrw mepc, t0 + mret + +_main: + + li a7, 10 + ecall diff --git a/examples/RISCV-Sail/example13b.s b/examples/RISCV-Sail/example13b.s new file mode 100644 index 000000000..308d501f1 --- /dev/null +++ b/examples/RISCV-Sail/example13b.s @@ -0,0 +1,142 @@ +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .bss +.align 8 +tohost: + .dword 0 + +.section .text.init +.globl _main + +kernel: + j reset_vector + + syscall: + li t0, 13 + bgeu a7, t0, fail + addi t0, t0, -3 + beq t0, a7, exit + + csrr t0, mepc + addi t0, t0, 4 + csrw mepc, t0 + mret + + exit: + fence + li gp, 1 + li a0, 0 + li a7, 10 + j exception+4 + + fail: + fence + beqz gp, fail+0x4 + slli gp, gp, 1 + ori gp, gp, 1 + li a7, 10 + mv a0, gp + j syscall + + trap_vec: + csrr t5, mcause + li t6, 8 + beq t5, t6, syscall + li t6, 9 + beq t5, t6, syscall + li t6, 11 + beq t5, t6, syscall + j exception + + exception: + ori gp, gp, 1337 + la t5, tohost + sw gp, 0(t5) + sw zero, 4(t5) + + j exception + + reset_vector: + li ra, 0 + li sp, 0x3FFFFFFC + li gp, 0 + li tp, 0 + li t0, 0 + li t1, 0 + li t2, 0 + li fp, 0 + li s1, 0 + li a0, 0 + li a1, 0 + li a2, 0 + li a3, 0 + li a4, 0 + li a5, 0 + li a6, 0 + li a7, 0 + li s2, 0 + li s3, 0 + li s4, 0 + li s5, 0 + li s6, 0 + li s7, 0 + li s8, 0 + li s9, 0 + li s10, 0 + li s11, 0 + li t3, 0 + li t4, 0 + li t5, 0 + li t6, 0 + + initial: + csrr a0, mhartid + bnez a0, initial + auipc t0, 0 + addi t0, t0, 16 + csrw mtvec, t0 + csrwi mstatus, 8 + auipc t0, 0 + addi t0, t0, 16 + csrw mtvec, t0 + csrwi satp, 0 + + auipc t0, 0 + addi t0, t0, 36 + csrw mtvec, t0 + addi t0, zero, 1 + slli t0, t0, 0x1f + csrw pmpaddr0, t0 + li t0, 31 + csrwi mie, 0 + auipc t0, 0 + addi t0, t0, 20 + + csrwi medeleg, 0 + csrwi mideleg, 0 + la t0, trap_vec + csrw mtvec, t0 + csrw mepc, t0 + lui t0, 0x2 + addi t0, t0, -2048 + csrrc zero, mstatus, t0 + + csrr t0, mstatus + lui t1, 0xffffe + addi t1, t1, 2047 + and t0, t0, t1 + li t1, 0 + slli t1, t1, 11 + or t0, t0, t1 + csrw mstatus, t0 + + la t0, _main + csrw mepc, t0 + mret + +_main: + + li a7, 10 + ecall diff --git a/examples/RISCV-Sail/example14.s b/examples/RISCV-Sail/example14.s new file mode 100644 index 000000000..e500f09c6 --- /dev/null +++ b/examples/RISCV-Sail/example14.s @@ -0,0 +1,19 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# +.section .bss + .align 8 +tohost: .dword 0 + +.section .text.init +.globl _main + +# Entry point of the program +_main: + li t0, 10 + li t1, 2 + myadd t0, t1 + + jr ra + diff --git a/examples/RISCV-Sail/example2.s b/examples/RISCV-Sail/example2.s new file mode 100755 index 000000000..f4a83dd94 --- /dev/null +++ b/examples/RISCV-Sail/example2.s @@ -0,0 +1,33 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main +_main: + + li t0, 10 + li t1, 13 + li t2, 45 + li t3, 33 + + add t4, t0, t1 # 10+13 + sub t4, t2, t3 # 45-33 + mul t4, t3, t3 # 33*33 + div t4, t2, t0 # 45/10 + + # print last t4 + mv a0, t4 + li a7, 1 + ecall + + # return + # li a7, 10 + # ecall + jr ra + diff --git a/examples/RISCV-Sail/example3.s b/examples/RISCV-Sail/example3.s new file mode 100755 index 000000000..488346911 --- /dev/null +++ b/examples/RISCV-Sail/example3.s @@ -0,0 +1,47 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# +.section .data + w1: .word 14 + b1: .byte 120 + + .align 1 + h1: .half 22 + w2: .zero 4 + b2: .zero 1 + + .align 1 + h2: .zero 2 + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main +_main: + + la t0, w1 # w1 address -> t0 + la t1, b1 # b1 address -> t1 + la t2, h1 # h1 address -> t2 + + lw t3, 0(t0) # Memory[t0] -> t3 + + lb t4, 0(t1) # Memory[t1] -> t4 + + lh t5, 0 (t2) # Memory[t2] -> t5 + + la t0, w2 # w2 address -> t0 + sw t3, 0(t0) # t3 -> Memory[w2] + + la t0, b2 # b2 address -> t0 + sb t4, 0(t0) # t4 -> Memory[b2] + + la t0, h2 # h2 address -> t0 + sh t5, 0(t0) # t5 -> Memory[h2] + + # return + # li a7, 10 + # ecall + jr ra diff --git a/examples/RISCV-Sail/example4.s b/examples/RISCV-Sail/example4.s new file mode 100755 index 000000000..a2e76fb69 --- /dev/null +++ b/examples/RISCV-Sail/example4.s @@ -0,0 +1,44 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .data + a: .double 34.544 + b: .double 11.443 + c: .double 665.4 + + d: .zero 24 + +.section .bss + .align 8 + tohost: .dword 0 + +.section .text.init +.globl _main + +_main: + + la x5, a + la x6, b + la x7, c + la x28, d + + fld f0, 0(x5) + fld f2, 0(x6) + fld f10, 0(x7) + fadd.d f0, f0, f0 + fsub.d f4, f10, f0 + fdiv.d f12, f10, f2 + + fsd f0, 0(x28) + addi x28, x28, 8 + fsd f4, 0(x28) + addi x28, x28, 8 + fsd f12, 0(x28) + + #return + # li a7, 10 + # ecall + jr ra + diff --git a/examples/RISCV-Sail/example5.s b/examples/RISCV-Sail/example5.s new file mode 100755 index 000000000..0d0f3e610 --- /dev/null +++ b/examples/RISCV-Sail/example5.s @@ -0,0 +1,34 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +# Sum of the first 10 numbers from 0 to 9 + +.section .data + max: .byte 10 + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main + _main: + la t0, max + lb t0, 0 (t0) + li t1, 0 + li a0, 0 + + while: bge t1, t0, end_while + add a0, a0, t1 + addi t1, t1, 1 + beq zero, zero, while + + end_while: li a7, 1 + ecall # print_int + + #return + # li a7, 10 + # ecall + jr ra diff --git a/examples/RISCV-Sail/example6.s b/examples/RISCV-Sail/example6.s new file mode 100755 index 000000000..e40cdb783 --- /dev/null +++ b/examples/RISCV-Sail/example6.s @@ -0,0 +1,33 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main + _main: + + li t0, 4 + li t1, 2 + li t3, 5 + bge t3, t0, jump1 + + jump2: + li t3, 34 + li a7, 10 + ecall + + jump1: + li t4, 11 + li t5, 555 + beq x0, x0, jump2 + + #return + # li a7, 10 + # ecall + jr ra + diff --git a/examples/RISCV-Sail/example7.s b/examples/RISCV-Sail/example7.s new file mode 100755 index 000000000..90c765fdc --- /dev/null +++ b/examples/RISCV-Sail/example7.s @@ -0,0 +1,45 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# +.section .data + w3: .word 1, 2, 3, 4, 5 + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main +_main: + + li t3, 1 + li t4, 4 + la t5, w3 + li s7, 0 + + # loop initialization + li t1, 0 + li t2, 5 + + # loop header +loop1: beq t1, t2, end1 # if(t1 == t2) --> jump to fin1 + + # loop body + mul t6, t1, t4 # t1 * t4 -> t6 + lw t6, 0(t5) # Memory[t5] -> t6 + add s7, s7, t6 # t6 + s7 -> s7 + + # loop next... + add t1, t1, t3 # t1 + t3 -> t1 + addi t5, t5, 4 + beq x0, x0, loop1 + + # loop end +end1: + #return + # li a7, 10 + # ecall + jr ra + + diff --git a/examples/RISCV-Sail/example8.s b/examples/RISCV-Sail/example8.s new file mode 100644 index 000000000..273097b07 --- /dev/null +++ b/examples/RISCV-Sail/example8.s @@ -0,0 +1,33 @@ +.section .data +.align 3 +v_1: + .double 7.7 ,8.8 ,9.9 ,-13.13 +.align 3 +v_2: + .double 62.62 , 54.54, -684.684, 379.379 +.align 3 +v_mem: + .space 64 + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main + +_main: + + li t0, 4 + vsetvli t1, t0, e64 + la t2, v_1 + la t3, v_2 + vle64.v v1, 0(t2) + vle64.v v2, 0(t3) + vfadd.vv v3, v1, v2 + la t1, v_mem + vse64.v v3, 0(t1) + + li a7, 10 + ecall + \ No newline at end of file diff --git a/examples/RISCV-Sail/example81.s b/examples/RISCV-Sail/example81.s new file mode 100755 index 000000000..a9f1be276 --- /dev/null +++ b/examples/RISCV-Sail/example81.s @@ -0,0 +1,48 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .data + +matrixA: .word 0x34000000, 0x34000000, 0x34000000, 0x34000000 + .word 0x23450000, 0x00432210, 0x77512120, 0x14141414 + .word 0x00000214, 0x44551122, 0xAABFF012, 0x77D00000 + .word 0x0000FF23, 0x12345678, 0x87654321, 0x33441124 + +matrixB: .float 0.0, 0.0, 0.0, 0.0 + .float 0.0, 0.0, 0.0, 0.0 + .float 0.0, 0.0, 0.0, 0.0 + .float 0.0, 0.0, 0.0, 0.0 + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main +_main: + la t0, matrixA + la t1, matrixB + li t2, 4 + li t3, 4 + add t4, zero, zero + add t5, zero, zero + +loop1: beq t2, t4, end1 +loop2: beq t3, t5, end2 + flw f0, 0(t0) + fsw f0, 0(t1) + addi t0, t0, 4 + addi t1, t1, 4 + addi t5, t5, 1 + beq x0, x0, loop2 +end2: addi t4, t4, 1 + add t5, zero, zero + beq x0, x0, loop1 +end1: + # return + # li a7, 10 + # ecall + jr ra + diff --git a/examples/RISCV-Sail/example9.s b/examples/RISCV-Sail/example9.s new file mode 100755 index 000000000..f18146761 --- /dev/null +++ b/examples/RISCV-Sail/example9.s @@ -0,0 +1,54 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# +.section .data + msg: .asciz "Please, insert the first number: " + msg2: .asciz "Please, insert the second number: " + msg3: .asciz "The result is: " + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main +_main: + # print "insert first..." + la a0, msg + li a7, 4 + ecall + + # read int + li a7, 5 + ecall + + add t0, a0, zero + + # print "insert second..." + la a0, msg2 + li a7, 4 + ecall + + # read int + li a7, 5 + ecall + + add t1, a0, zero + add t2, t0, t1 + + # print "result..." + la a0, msg3 + li a7, 4 + ecall + + # print t2 + add a0, t2, zero + li a7, 1 + ecall + + # return + # li a7, 10 + # ecall + jr ra + diff --git a/examples/RISCV-Sail/list32.json b/examples/RISCV-Sail/list32.json new file mode 100755 index 000000000..689de64d8 --- /dev/null +++ b/examples/RISCV-Sail/list32.json @@ -0,0 +1,86 @@ +[ + { + "name": "Example 1", + "id": "e1", + "url":"examples/RISCV-Sail/example1.s", + "description": "Data Storage" + }, + { + "name": "Example 2", + "id": "e2", + "url":"examples/RISCV-Sail/example2.s", + "description": "ALU Operations" + }, + { + "name": "Example 3", + "id": "e3", + "url":"examples/RISCV-Sail/example3.s", + "description": "Store/Load Data in Memory" + }, + { + "name": "Example 4", + "id": "e4", + "url":"examples/RISCV-Sail/example4.s", + "description": "FPU Operations" + }, + { + "name": "Example 5", + "id": "e5", + "url":"examples/RISCV-Sail/example5.s", + "description": "Loop" + }, + { + "name": "Example 6", + "id": "e6", + "url":"examples/RISCV-Sail/example6.s", + "description": "Branch" + }, + { + "name": "Example 7", + "id": "e7", + "url":"examples/RISCV-Sail/example7.s", + "description": "Loop + Memory" + }, + { + "name": "Example 8", + "id": "e8", + "url":"examples/RISCV-Sail/example8.s", + "description": "Vector Instructions" + }, + { + "name": "Example 9", + "id": "e9", + "url":"examples/RISCV-Sail/example9.s", + "description": "I/O Syscalls" + }, + { + "name": "Example 10", + "id": "e10", + "url":"examples/RISCV-Sail/example10.s", + "description": "I/O Syscalls + Strings" + }, + { + "name": "Example 11", + "id": "e11", + "url":"examples/RISCV-Sail/example11.s", + "description": "Subrutines" + }, + { + "name": "Example 12", + "id": "e12", + "url":"examples/RISCV-Sail/example12.s", + "description": "Factorial" + }, + { + "name": "Example 13", + "id": "e13", + "url":"examples/RISCV-Sail/example13a.s", + "description": "Custom Kernel" + }, + { + "name": "Example 14", + "id": "e14", + "url":"examples/RISCV-Sail/example14.s", + "description": "Use Custom Instruction" + } +] diff --git a/examples/RISCV-Sail/list64.json b/examples/RISCV-Sail/list64.json new file mode 100755 index 000000000..b4cda0d21 --- /dev/null +++ b/examples/RISCV-Sail/list64.json @@ -0,0 +1,86 @@ +[ + { + "name": "Example 1", + "id": "e1", + "url":"examples/RISCV-Sail/example1.s", + "description": "Data Storage" + }, + { + "name": "Example 2", + "id": "e2", + "url":"examples/RISCV-Sail/example2.s", + "description": "ALU Operations" + }, + { + "name": "Example 3", + "id": "e3", + "url":"examples/RISCV-Sail/example3.s", + "description": "Store/Load Data in Memory" + }, + { + "name": "Example 4", + "id": "e4", + "url":"examples/RISCV-Sail/example4.s", + "description": "FPU Operations" + }, + { + "name": "Example 5", + "id": "e5", + "url":"examples/RISCV-Sail/example5.s", + "description": "Loop" + }, + { + "name": "Example 6", + "id": "e6", + "url":"examples/RISCV-Sail/example6.s", + "description": "Branch" + }, + { + "name": "Example 7", + "id": "e7", + "url":"examples/RISCV-Sail/example7.s", + "description": "Loop + Memory" + }, + { + "name": "Example 8", + "id": "e8", + "url":"examples/RISCV-Sail/example8.s", + "description": "Vector Instructions" + }, + { + "name": "Example 9", + "id": "e9", + "url":"examples/RISCV-Sail/example9.s", + "description": "I/O Syscalls" + }, + { + "name": "Example 10", + "id": "e10", + "url":"examples/RISCV-Sail/example10.s", + "description": "I/O Syscalls + Strings" + }, + { + "name": "Example 11", + "id": "e11", + "url":"examples/RISCV-Sail/example11.s", + "description": "Subrutines" + }, + { + "name": "Example 12", + "id": "e12", + "url":"examples/RISCV-Sail/example12.s", + "description": "Factorial" + }, + { + "name": "Example 13", + "id": "e13", + "url":"examples/RISCV-Sail/example13b.s", + "description": "Custom Kernel" + }, + { + "name": "Example 14", + "id": "e14", + "url":"examples/RISCV-Sail/example14.s", + "description": "Use Custom Instruction" + } +] diff --git a/examples/RISCV-simple/list.json b/examples/RISCV-simple/list.json index 2d5e7cf5b..ec338c160 100644 --- a/examples/RISCV-simple/list.json +++ b/examples/RISCV-simple/list.json @@ -3,19 +3,19 @@ "name": "Example 1", "id": "e1", "url": "examples/RISCV/example1.s", - "description": "ALU operations" + "description": "ALU Operations" }, { "name": "Example 2", "id": "e2", "url": "examples/RISCV/example2.s", - "description": "ALU operations" + "description": "ALU Operations" }, { "name": "Example 3", "id": "e3", "url": "examples/RISCV/example3.s", - "description": "Memory access" + "description": "Memory Access" }, { "name": "Example 4", diff --git a/examples/example_set.json b/examples/example_set.json index 7063bf635..c85f437bd 100644 --- a/examples/example_set.json +++ b/examples/example_set.json @@ -7,33 +7,51 @@ "description": "RISC-V (RV32IMFD) Examples" }, { - "name": "RISC-V (RV64IMFD) Examples", - "id": "default", - "architecture": "RISC-V (RV64IMFD)", - "url": "examples/RISCV-64/list.json", - "description": "RISC-V (RV64IMFD) Examples" + "name": "RISC-V (RV32IM) Arduino Examples", + "id": "arduino", + "architecture": "RISC-V (RV32IMFD)", + "url": "examples/RISCV-32-arduino/list.json", + "description": "RISC-V (RV32IM, Interrupts) Arduino Examples" }, { "name": "RISC-V (RV32IMFD, Interrupts) Examples", - "id": "default", - "architecture": "RISC-V (RV32IMFD, Interrupts)", + "id": "interrupts", + "architecture": "RISC-V (RV32IMFD)", "url": "examples/RISCV-32-interrupts/list.json", "description": "RISC-V (RV32IMFD, Interrupts) Examples" }, { - "name": "RISC-V (RV32IM) Arduino Examples", + "name": "RISC-V (RV32IMFD, Interrupts) Devices Examples", "id": "devices", "architecture": "RISC-V (RV32IMFD)", - "url": "examples/RISCV-32-arduino/list.json", - "description": "RISC-V (RV32IM, Interrupts) Arduino Examples" + "url": "examples/RISCV-32-devices/list.json", + "description": "RISC-V (RV32IMFD, Interrupts) Devices Examples" }, + + { - "name": "RISC-V (RV32IMFD, Interrupts) Devices Examples", + "name": "RISC-V (RV64IMFD) Examples", + "id": "default", + "architecture": "RISC-V (RV64IMFD)", + "url": "examples/RISCV-64/list.json", + "description": "RISC-V (RV64IMFD) Examples" + }, + { + "name": "RISC-V (RV64IMFD, Interrupts) Examples", + "id": "interrupts", + "architecture": "RISC-V (RV64IMFD)", + "url": "examples/RISCV-64-interrupts/list.json", + "description": "RISC-V (RV64IMFD, Interrupts) Examples" + }, + { + "name": "RISC-V (RV64IMFD, Interrupts) Devices Examples", "id": "devices", - "architecture": "RISC-V (RV32IMFD, Interrupts)", - "url": "examples/RISCV-32-devices/list.json", - "description": "RISC-V (RV32IMFD, Interrupts) Devices Examples" + "architecture": "RISC-V (RV64IMFD)", + "url": "examples/RISCV-64-devices/list.json", + "description": "RISC-V (RV64IMFD, Interrupts) Devices Examples" }, + + { "name": "MIPS-32 Examples", "id": "default", @@ -41,18 +59,22 @@ "url": "examples/MIPS-32/list.json", "description": "MIPS-32 Examples" }, + + { - "name": "MIPS-32 from UC3M-OCW", - "id": "uc3m-ec", - "architecture": "MIPS-32", - "url": "examples/ocw-uc3m-ec/list.json", - "description": "MIPS-32 examples from UC3M course" + "name": "RISC-V Sail 32 Examples", + "id": "default", + "architecture": "RISC-V Sail 32 - Full Specification", + "url": "examples/RISCV-Sail/list32.json", + "description": "RISC-V Sail 32 examples" }, + + { - "name": "RISC-V (RV32IMFD) from UC3M-AG", - "id": "uc3m-ec-ag", - "architecture": "RISC-V (RV32IMFD)", - "url": "examples/ag-uc3m-ec/list.json", - "description": "RISC-V (RV32IMFD) examples for Aula Global at UC3M" + "name": "RISC-V Sail 64 Examples", + "id": "default", + "architecture": "RISC-V Sail 64 - Full Specification", + "url": "examples/RISCV-Sail/list64.json", + "description": "RISC-V Sail 64 examples" } ] diff --git a/index.html b/index.html index 1460d9956..9e26390d7 100644 --- a/index.html +++ b/index.html @@ -48,7 +48,7 @@ } - CREATOR - didaCtic and geneRic assEmbly progrAmming simulaTOR + CREATOR diff --git a/package.json b/package.json index 9dd194aa3..11d754988 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "creator", - "version": "6.0.0", + "version": "6.1.0", "private": true, "type": "module", "scripts": { @@ -44,7 +44,7 @@ "colors": "^1.4.0", "deno": "^2.5.4", "humanize-duration": "^3.33.0", - "js-yaml": "^4.1.0", + "js-yaml": "^4.1.1", "mitt": "^3.0.1", "monaco-editor": "^0.54.0", "monaco-vim": "^0.4.2", @@ -76,12 +76,12 @@ "globals": "^16.5.0", "jiti": "^2.6.1", "npm-run-all2": "^8.0.4", - "prettier": "^3.7.3", + "prettier": "^3.7.4", "prettier-plugin-vue": "^1.1.6", "sass-embedded": "^1.93.3", "sharp": "^0.34.5", "svgo": "^4.0.0", - "typescript": "~5.9.3", + "typescript": "^5.8.3", "unplugin-vue-components": "^30.0.0", "vite": "^7.2.4", "vite-multiple-assets": "^2.2.6", diff --git a/public/img/logos/mips.png b/public/img/logos/mips.png index db9e4abac..eef9bffcc 100644 Binary files a/public/img/logos/mips.png and b/public/img/logos/mips.png differ diff --git a/public/img/logos/uc3m.png b/public/img/logos/uc3m.png new file mode 100644 index 000000000..15e50b2ed Binary files /dev/null and b/public/img/logos/uc3m.png differ diff --git a/public/libraries/creatino.o b/public/libraries/creatino.o new file mode 100644 index 000000000..722c079d5 --- /dev/null +++ b/public/libraries/creatino.o @@ -0,0 +1,159 @@ +{ + "instructions_binary": [ + { "Address": "0x0", "Label": "initArduino", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x4", "Label": "digitalRead", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x8", "Label": "pinMode", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xc", "Label": "digitalWrite", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x10", "Label": "analogRead", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x14", "Label": "analogReadResolution", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x18", "Label": "analogWrite", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x1c", "Label": "map", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x20", "Label": "constrain", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x24", "Label": "abs", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x28", "Label": "max", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x2c", "Label": "min", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x30", "Label": "pow", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x34", "Label": "bit", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x38", "Label": "bitClear", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x3c", "Label": "bitRead", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x40", "Label": "bitSet", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x44", "Label": "bitWrite", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x48", "Label": "highByte", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x4c", "Label": "lowByte", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x50", "Label": "sqrt", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x54", "Label": "sq", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x58", "Label": "cos", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x5c", "Label": "sin", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x60", "Label": "tan", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x64", "Label": "attachInterrupt", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x68", "Label": "detachInterrupt", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x6c", "Label": "digitalPinToInterrupt", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x70", "Label": "pulseIn", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x74", "Label": "pulseInLong", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x78", "Label": "shiftIn", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x7c", "Label": "shiftOut", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x80", "Label": "interrupts", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x84", "Label": "nointerrupts", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x88", "Label": "isDigit", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x8c", "Label": "isAlpha", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x90", "Label": "isAlphaNumeric", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x94", "Label": "isAscii", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x98", "Label": "isControl", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x9c", "Label": "isPunct", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xa0", "Label": "isHexadecimalDigit", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xa4", "Label": "isUpperCase", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xa8", "Label": "isLowerCase", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xac", "Label": "isPrintable", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xb0", "Label": "isGraph", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xb4", "Label": "isSpace", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xb8", "Label": "isWhiteSpace", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xbc", "Label": "delay", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xc0", "Label": "delayMicroseconds", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xc4", "Label": "randomSeed", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xc8", "Label": "random", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xcc", "Label": "serial_available", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xd0", "Label": "serial_availableForWrite", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xd4", "Label": "serial_begin", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xd8", "Label": "serial_end", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xdc", "Label": "serial_find", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xe0", "Label": "serial_findUntil", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xe4", "Label": "serial_flush", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xe8", "Label": "serial_parseFloat", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xec", "Label": "serial_parseInt", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xf0", "Label": "serial_read", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xf4", "Label": "serial_readBytes", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xf8", "Label": "serial_readBytesUntil", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xfc", "Label": "serial_write", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x100", "Label": "serial_printf", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x104", "Label": "fabs", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x108", "Label": "fmax", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x10c", "Label": "fmin", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x110", "Label": "sqrtf", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x114", "Label": "sqf", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x118", "Label": "tone", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x11c", "Label": "noTone", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x120", "Label": "pulseIn", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x124", "Label": "pulseInLong", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x128", "Label": "shiftIn", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x12c", "Label": "shiftOut", "loaded": "00000000100000001000001000000000", "globl": true } + ], + "instructions_tag": [ + { "tag": "initArduino", "addr": 0, "globl": true }, + { "tag": "digitalRead", "addr": 4, "globl": true }, + { "tag": "pinMode", "addr": 8, "globl": true }, + { "tag": "digitalWrite", "addr": 12, "globl": true }, + { "tag": "analogRead", "addr": 16, "globl": true }, + { "tag": "analogReadResolution", "addr": 20, "globl": true }, + { "tag": "analogWrite", "addr": 24, "globl": true }, + { "tag": "map", "addr": 28, "globl": true }, + { "tag": "constrain", "addr": 32, "globl": true }, + { "tag": "abs", "addr": 36, "globl": true }, + { "tag": "max", "addr": 40, "globl": true }, + { "tag": "min", "addr": 44, "globl": true }, + { "tag": "pow", "addr": 48, "globl": true }, + { "tag": "bit", "addr": 52, "globl": true }, + { "tag": "bitClear", "addr": 56, "globl": true }, + { "tag": "bitRead", "addr": 60, "globl": true }, + { "tag": "bitSet", "addr": 64, "globl": true }, + { "tag": "bitWrite", "addr": 68, "globl": true }, + { "tag": "highByte", "addr": 72, "globl": true }, + { "tag": "lowByte", "addr": 76, "globl": true }, + { "tag": "sqrt", "addr": 80, "globl": true }, + { "tag": "sq", "addr": 84, "globl": true }, + { "tag": "cos", "addr": 88, "globl": true }, + { "tag": "sin", "addr": 92, "globl": true }, + { "tag": "tan", "addr": 96, "globl": true }, + { "tag": "attachInterrupt", "addr": 100, "globl": true }, + { "tag": "detachInterrupt", "addr": 104, "globl": true }, + { "tag": "digitalPinToInterrupt", "addr": 108, "globl": true }, + { "tag": "pulseIn", "addr": 112, "globl": true }, + { "tag": "pulseInLong", "addr": 116, "globl": true }, + { "tag": "shiftIn", "addr": 120, "globl": true }, + { "tag": "shiftOut", "addr": 124, "globl": true }, + { "tag": "interrupts", "addr": 128, "globl": true }, + { "tag": "nointerrupts", "addr": 132, "globl": true }, + { "tag": "isDigit", "addr": 136, "globl": true }, + { "tag": "isAlpha", "addr": 140, "globl": true }, + { "tag": "isAlphaNumeric", "addr": 144, "globl": true }, + { "tag": "isAscii", "addr": 148, "globl": true }, + { "tag": "isControl", "addr": 152, "globl": true }, + { "tag": "isPunct", "addr": 156, "globl": true }, + { "tag": "isHexadecimalDigit", "addr": 160, "globl": true }, + { "tag": "isUpperCase", "addr": 164, "globl": true }, + { "tag": "isLowerCase", "addr": 168, "globl": true }, + { "tag": "isPrintable", "addr": 172, "globl": true }, + { "tag": "isGraph", "addr": 176, "globl": true }, + { "tag": "isSpace", "addr": 180, "globl": true }, + { "tag": "isWhiteSpace", "addr": 184, "globl": true }, + { "tag": "delay", "addr": 188, "globl": true }, + { "tag": "delayMicroseconds", "addr": 192, "globl": true }, + { "tag": "randomSeed", "addr": 196, "globl": true }, + { "tag": "random", "addr": 200, "globl": true }, + { "tag": "serial_available", "addr": 204, "globl": true }, + { "tag": "serial_availableForWrite", "addr": 208, "globl": true }, + { "tag": "serial_begin", "addr": 212, "globl": true }, + { "tag": "serial_end", "addr": 216, "globl": true }, + { "tag": "serial_find", "addr": 220, "globl": true }, + { "tag": "serial_findUntil", "addr": 224, "globl": true }, + { "tag": "serial_flush", "addr": 228, "globl": true }, + { "tag": "serial_parseFloat", "addr": 232, "globl": true }, + { "tag": "serial_parseInt", "addr": 236, "globl": true }, + { "tag": "serial_read", "addr": 240, "globl": true }, + { "tag": "serial_readBytes", "addr": 244, "globl": true }, + { "tag": "serial_readBytesUntil", "addr": 248, "globl": true }, + { "tag": "serial_write", "addr": 252, "globl": true }, + { "tag": "serial_printf", "addr": 256, "globl": true }, + { "tag": "fabs", "addr": 260, "globl": true }, + { "tag": "fmax", "addr": 264, "globl": true }, + { "tag": "fmin", "addr": 268, "globl": true }, + { "tag": "sqrtf", "addr": 272, "globl": true }, + { "tag": "sqf", "addr": 276, "globl": true }, + { "tag": "tone", "addr": 280, "globl": true }, + { "tag": "noTone", "addr": 284, "globl": true }, + { "tag": "pulseIn", "addr": 288, "globl": true }, + { "tag": "pulseInLong", "addr": 292, "globl": true }, + { "tag": "shiftIn", "addr": 296, "globl": true }, + { "tag": "shiftOut", "addr": 300, "globl": true } + + ] +} \ No newline at end of file diff --git a/public/libraries/creatino.yml b/public/libraries/creatino.yml index cb36186ce..583d48de0 100644 --- a/public/libraries/creatino.yml +++ b/public/libraries/creatino.yml @@ -1,5 +1,7 @@ version: '1.0' -binary: 00000001 00000002 00000003 00000004 00000005 00000006 00000007 00000008 + +binary: + 00000001 00000002 00000003 00000004 00000005 00000006 00000007 00000008 00000009 0000000a 0000000b 0000000c 0000000d 0000000e 0000000f 00000010 00000011 00000012 00000013 00000014 00000015 00000016 00000017 00000018 00000019 0000001a 0000001b 0000001c 0000001d 0000001e 0000001f 00000020 @@ -12,658 +14,187 @@ binary: 00000001 00000002 00000003 00000004 00000005 00000006 00000007 0000000 symbols: initArduino: addr: 0 - help: - description: Initializes Arduino system - parameters: {} - returns: {} - + help: {description: "Initializes Arduino system", parameters: {}, returns: {}} digitalRead: addr: 4 - help: - description: Reads digital value from a pin - parameters: - pin: Pin number - returns: - value: Digital value (HIGH or LOW) - + help: {description: "Reads digital value from a pin", parameters: {pin: "Pin number"}, returns: {value: "Digital value"}} pinMode: addr: 8 - help: - description: Configures a pin as input or output - parameters: - pin: Pin number - mode: INPUT/OUTPUT/INPUT_PULLUP - returns: {} - + help: {description: "Configures a pin", parameters: {pin: "Pin number", mode: "INPUT/OUTPUT"}, returns: {}} digitalWrite: addr: 12 - help: - description: Writes digital value to a pin - parameters: - pin: Pin number - value: HIGH or LOW - returns: {} - - analogRead: + help: {description: "Writes digital value", parameters: {pin: "Pin number", value: "HIGH/LOW"}, returns: {}} + rgbLedWrite: addr: 16 - help: - description: Reads analog value from a pin - parameters: - pin: Pin number - returns: - value: Analog value (0-1023 or resolution) - - analogReadResolution: + help: {description: "Writes digital value in a RGB WS2812 LED (ex. BUILTIN LED in ESP32-C6 and ESP32-H2 Devkit)", parameters: {pin: "Pin number", value1: "Red value", value2: "Green value", value3: "Blue value"}, returns: {}} + analogRead: addr: 20 - help: - description: Sets resolution for analogRead - parameters: - bits: Resolution in bits - returns: {} - - analogWrite: + help: {description: "Reads analog value", parameters: {pin: "Pin number"}, returns: {value: "0-1023"}} + analogReadResolution: addr: 24 - help: - description: Writes analog value to a pin (PWM) - parameters: - pin: Pin number - value: PWM value - returns: {} - - map: + help: {description: "Sets resolution for analogRead", parameters: {bits: "Resolution"}, returns: {}} + analogWrite: addr: 28 - help: - description: Maps a number from one range to another - parameters: - value: Number to map - fromLow: Source range low - fromHigh: Source range high - toLow: Target range low - toHigh: Target range high - returns: - mappedValue: Mapped number - - constrain: + help: {description: "Writes PWM value", parameters: {pin: "Pin number", value: "PWM value"}, returns: {}} + map: addr: 32 - help: - description: Constrains a number to be within a range - parameters: - value: Number to constrain - low: Minimum value - high: Maximum value - returns: - constrainedValue: Number within [low, high] - - abs: + help: {description: "Maps a number range", parameters: {value: "Number", fromLow: "Source low", fromHigh: "Source high", toLow: "Target low", toHigh: "Target high"}, returns: {mappedValue: "Mapped number"}} + constrain: addr: 36 - help: - description: Returns the absolute value - parameters: - x: Number - returns: - absValue: Absolute value of x - - max: + help: {description: "Constrains a number", parameters: {value: "Number", low: "Min", high: "Max"}, returns: {constrainedValue: "Number in range"}} + abs: addr: 40 - help: - description: Returns the maximum of two integers - parameters: - a0: First Integer - a1: Second Integer - returns: - a0: Maximum - - min: + help: {description: "Absolute value", parameters: {x: "Number"}, returns: {absValue: "Absolute value"}} + max: addr: 44 - help: - description: Returns the minimum of two integers - parameters: - a0: First Integer - a1: Second Integer - returns: - a0: Minimum - - pow: + help: {description: "Maximum of two integers", parameters: {a0: "First", a1: "Second"}, returns: {a0: "Max"}} + min: addr: 48 - help: - description: Calculates power of a number - parameters: - base: Base number - exponent: Exponent - returns: - result: base^exponent - - bit: + help: {description: "Minimum of two integers", parameters: {a0: "First", a1: "Second"}, returns: {a0: "Min"}} + pow: addr: 52 - help: - description: Returns the value of the bit at given position - parameters: - bitNumber: Bit position - returns: - bitValue: 2^bitNumber - - bitClear: + help: {description: "Calculates power", parameters: {base: "Base", exponent: "Exponent"}, returns: {result: "base^exponent"}} + bit: addr: 56 - help: - description: Clears a bit in a number - parameters: - value: Number - bitNumber: Bit position - returns: - result: Number with bit cleared - - bitRead: + help: {description: "Value of bit at position", parameters: {bitNumber: "Position"}, returns: {bitValue: "2^bitNumber"}} + bitClear: addr: 60 - help: - description: Reads a bit from a number - parameters: - value: Number - bitNumber: Bit position - returns: - bit: 0 or 1 - - bitSet: + help: {description: "Clears a bit", parameters: {value: "Number", bitNumber: "Position"}, returns: {result: "Number cleared"}} + bitRead: addr: 64 - help: - description: Sets a bit in a number - parameters: - value: Number - bitNumber: Bit position - returns: - result: Number with bit set - - bitWrite: + help: {description: "Reads a bit", parameters: {value: "Number", bitNumber: "Position"}, returns: {bit: "0 or 1"}} + bitSet: addr: 68 - help: - description: Writes a bit in a number - parameters: - value: Number - bitNumber: Bit position - bitValue: 0 or 1 - returns: - result: Number with bit written - - highByte: + help: {description: "Sets a bit", parameters: {value: "Number", bitNumber: "Position"}, returns: {result: "Number set"}} + bitWrite: addr: 72 - help: - description: Extracts high byte of a word - parameters: - word: Number - returns: - highByte: High byte - - lowByte: + help: {description: "Writes a bit", parameters: {value: "Number", bitNumber: "Position", bitValue: "0 or 1"}, returns: {result: "Number written"}} + highByte: addr: 76 - help: - description: Extracts low byte of a word - parameters: - word: Number - returns: - lowByte: Low byte - - sqrt: + help: {description: "Extracts high byte", parameters: {word: "Number"}, returns: {highByte: "High byte"}} + lowByte: addr: 80 - help: - description: Calculates square root - parameters: - x: Number - returns: - result: Square root of x - - sq: + help: {description: "Extracts low byte", parameters: {word: "Number"}, returns: {lowByte: "Low byte"}} + attachInterrupt: addr: 84 - help: - description: Squares a number - parameters: - x: Number - returns: - result: x squared - - cos: + help: {description: "Attaches interrupt", parameters: {pin: "Pin", function: "Handler", mode: "Mode"}, returns: {}} + detachInterrupt: addr: 88 - help: - description: Calculates cosine - parameters: - angle: Angle in radians - returns: - result: Cosine of angle - - sin: + help: {description: "Detaches interrupt", parameters: {pin: "Pin"}, returns: {}} + digitalPinToInterrupt: addr: 92 - help: - description: Calculates sine - parameters: - angle: Angle in radians - returns: - result: Sine of angle - - tan: + help: {description: "Pin to interrupt number", parameters: {pin: "Pin"}, returns: {interruptNumber: "Number"}} + pulseIn: addr: 96 - help: - description: Calculates tangent - parameters: - angle: Angle in radians - returns: - result: Tangent of angle - - attachInterrupt: + help: {description: "Reads pulse duration", parameters: {pin: "Pin", value: "HIGH/LOW", timeout: "us"}, returns: {duration: "Pulse duration"}} + pulseInLong: addr: 100 - help: - description: Attaches an interrupt to a pin - parameters: - pin: Pin number - function: Interrupt handler - mode: Interrupt mode - returns: {} - - detachInterrupt: + help: {description: "Reads long pulse duration", parameters: {pin: "Pin", value: "HIGH/LOW", timeout: "us"}, returns: {duration: "Pulse duration"}} + shiftIn: addr: 104 - help: - description: Detaches an interrupt from a pin - parameters: - pin: Pin number - returns: {} - - digitalPinToInterrupt: + help: {description: "Shifts in a byte", parameters: {dataPin: "Pin", clockPin: "Pin", bitOrder: "Order"}, returns: {value: "Byte"}} + shiftOut: addr: 108 - help: - description: Converts digital pin to interrupt number - parameters: - pin: Pin number - returns: - interruptNumber: Interrupt number - - pulseIn: + help: {description: "Shifts out a byte", parameters: {dataPin: "Pin", clockPin: "Pin", bitOrder: "Order", value: "Byte"}, returns: {}} + tone: addr: 112 - help: - description: Reads pulse duration on a pin (microseconds) - parameters: - pin: Pin number - value: HIGH or LOW - timeout: Timeout in microseconds - returns: - duration: Pulse duration - - pulseInLong: + help: {description: "Generates tone", parameters: {pin: "Pin", frequency: "Hz", duration: "ms"}, returns: {}} + noTone: addr: 116 - help: - description: Reads long pulse duration on a pin (microseconds) - parameters: - pin: Pin number - value: HIGH or LOW - timeout: Timeout in microseconds - returns: - duration: Pulse duration - - shiftIn: - addr: 120 - help: - description: Shifts in a byte of data one bit at a time - parameters: - dataPin: Data pin number - clockPin: Clock pin number - bitOrder: MSBFIRST or LSBFIRST - returns: - value: Shifted in byte - - shiftOut: - addr: 124 - help: - description: Shifts out a byte of data one bit at a time - parameters: - dataPin: Data pin number - clockPin: Clock pin number - bitOrder: MSBFIRST or LSBFIRST - value: Byte to shift out - returns: {} - + help: {description: "Stops tone", parameters: {pin: "Pin"}, returns: {}} interrupts: - addr: 128 - help: - description: Enables interrupts - parameters: {} - returns: {} - + addr: 120 + help: {description: "Enables interrupts", parameters: {}, returns: {}} nointerrupts: - addr: 132 - help: - description: Disables interrupts - parameters: {} - returns: {} - + addr: 124 + help: {description: "Disables interrupts", parameters: {}, returns: {}} isDigit: - addr: 136 - help: - description: Checks if character is digit - parameters: - c: Character - returns: - result: true or false - + addr: 128 + help: {description: "Checks if digit", parameters: {c: "Char"}, returns: {result: "bool"}} isAlpha: - addr: 140 - help: - description: Checks if character is alphabetic - parameters: - c: Character - returns: - result: true or false - + addr: 132 + help: {description: "Checks if alpha", parameters: {c: "Char"}, returns: {result: "bool"}} isAlphaNumeric: - addr: 144 - help: - description: Checks if character is alphanumeric - parameters: - c: Character - returns: - result: true or false - + addr: 136 + help: {description: "Checks if alphanumeric", parameters: {c: "Char"}, returns: {result: "bool"}} isAscii: - addr: 148 - help: - description: Checks if character is ASCII - parameters: - c: Character - returns: - result: true or false - + addr: 140 + help: {description: "Checks if ASCII", parameters: {c: "Char"}, returns: {result: "bool"}} isControl: - addr: 152 - help: - description: Checks if character is control character - parameters: - c: Character - returns: - result: true or false - + addr: 144 + help: {description: "Checks if control char", parameters: {c: "Char"}, returns: {result: "bool"}} isPunct: - addr: 156 - help: - description: Checks if character is punctuation - parameters: - c: Character - returns: - result: true or false - + addr: 148 + help: {description: "Checks if punctuation", parameters: {c: "Char"}, returns: {result: "bool"}} isHexadecimalDigit: - addr: 160 - help: - description: Checks if character is a hexadecimal digit - parameters: - c: Character - returns: - result: true or false - + addr: 152 + help: {description: "Checks if hex digit", parameters: {c: "Char"}, returns: {result: "bool"}} isUpperCase: - addr: 164 - help: - description: Checks if character is uppercase - parameters: - c: Character - returns: - result: true or false - + addr: 156 + help: {description: "Checks if uppercase", parameters: {c: "Char"}, returns: {result: "bool"}} isLowerCase: - addr: 168 - help: - description: Checks if character is lowercase - parameters: - c: Character - returns: - result: true or false - + addr: 160 + help: {description: "Checks if lowercase", parameters: {c: "Char"}, returns: {result: "bool"}} isPrintable: - addr: 172 - help: - description: Checks if character is printable - parameters: - c: Character - returns: - result: true or false - + addr: 164 + help: {description: "Checks if printable", parameters: {c: "Char"}, returns: {result: "bool"}} isGraph: - addr: 176 - help: - description: Checks if character has graphical representation - parameters: - c: Character - returns: - result: true or false - + addr: 168 + help: {description: "Checks if graphical", parameters: {c: "Char"}, returns: {result: "bool"}} isSpace: - addr: 180 - help: - description: Checks if character is a space - parameters: - c: Character - returns: - result: true or false - + addr: 172 + help: {description: "Checks if space", parameters: {c: "Char"}, returns: {result: "bool"}} isWhiteSpace: - addr: 184 - help: - description: Checks if character is whitespace - parameters: - c: Character - returns: - result: true or false - + addr: 176 + help: {description: "Checks if whitespace", parameters: {c: "Char"}, returns: {result: "bool"}} delay: - addr: 188 - help: - description: Delays execution for milliseconds - parameters: - ms: Milliseconds - returns: {} - + addr: 180 + help: {description: "Delays ms", parameters: {ms: "ms"}, returns: {}} delayMicroseconds: - addr: 192 - help: - description: Delays execution for microseconds - parameters: - us: Microseconds - returns: {} - + addr: 184 + help: {description: "Delays us", parameters: {us: "us"}, returns: {}} randomSeed: - addr: 196 - help: - description: Sets seed for random number generator - parameters: - seed: Seed value - returns: {} - + addr: 188 + help: {description: "Sets random seed", parameters: {seed: "Value"}, returns: {}} random: - addr: 200 - help: - description: Generates a random number - parameters: - min: Minimum value - max: Maximum value - returns: - value: Random number in range - + addr: 192 + help: {description: "Generates random number", parameters: {min: "Min", max: "Max"}, returns: {value: "Random"}} serial_available: - addr: 204 - help: - description: Returns number of bytes available for reading on serial - parameters: {} - returns: - bytes: Number of bytes available - + addr: 196 + help: {description: "Bytes available to read", parameters: {}, returns: {bytes: "Count"}} serial_availableForWrite: - addr: 208 - help: - description: Returns number of bytes available for writing on serial - parameters: {} - returns: - bytes: Number of bytes available - + addr: 200 + help: {description: "Bytes available to write", parameters: {}, returns: {bytes: "Count"}} serial_begin: - addr: 212 - help: - description: Initializes serial communication - parameters: - baudRate: Baud rate - returns: {} - + addr: 204 + help: {description: "Starts serial", parameters: {baudRate: "Baud"}, returns: {}} serial_end: - addr: 216 - help: - description: Ends serial communication - parameters: {} - returns: {} - + addr: 208 + help: {description: "Ends serial", parameters: {}, returns: {}} serial_find: - addr: 220 - help: - description: Finds data on serial buffer - parameters: - target: Data to find - returns: - found: true or false - + addr: 212 + help: {description: "Finds data", parameters: {target: "Data"}, returns: {found: "bool"}} serial_findUntil: - addr: 224 - help: - description: Finds data on serial buffer until a terminator - parameters: - target: Data to find - terminator: Terminator character - returns: - found: true or false - + addr: 216 + help: {description: "Finds until terminator", parameters: {target: "Data", terminator: "Char"}, returns: {found: "bool"}} serial_flush: - addr: 228 - help: - description: Flushes serial buffer - parameters: {} - returns: {} - - serial_parseFloat: - addr: 232 - help: - description: Parses float from serial - parameters: {} - returns: - value: Parsed float - + addr: 220 + help: {description: "Flushes buffer", parameters: {}, returns: {}} serial_parseInt: - addr: 236 - help: - description: Parses integer from serial - parameters: {} - returns: - value: Parsed integer - + addr: 224 + help: {description: "Parses integer", parameters: {}, returns: {value: "int"}} serial_read: - addr: 240 - help: - description: Reads a byte from serial - parameters: {} - returns: - byte: Read byte - + addr: 228 + help: {description: "Reads byte", parameters: {}, returns: {byte: "Read"}} serial_readBytes: - addr: 244 - help: - description: Reads multiple bytes from serial - parameters: - length: Number of bytes to read - returns: - bytes: Array of bytes read - + addr: 232 + help: {description: "Reads bytes", parameters: {length: "Count"}, returns: {bytes: "Array"}} serial_readBytesUntil: - addr: 248 - help: - description: Reads bytes from serial until a terminator - parameters: - terminator: Terminator character - length: Maximum number of bytes - returns: - bytes: Array of bytes read - + addr: 236 + help: {description: "Reads until terminator", parameters: {terminator: "Char", length: "Max"}, returns: {bytes: "Array"}} serial_write: - addr: 252 - help: - description: Writes byte(s) to serial - parameters: - data: Byte or array of bytes - returns: - written: Number of bytes written - + addr: 240 + help: {description: "Writes data", parameters: {data: "Data"}, returns: {written: "Count"}} serial_printf: - addr: 256 - help: - description: Writes formatted string to serial - parameters: - format: Format string - args: Arguments - returns: - written: Number of bytes written - - fabs: - addr: 260 - help: - description: Returns absolute value of float - parameters: - x: Float number - returns: - absValue: Absolute value - - fmax: - addr: 264 - help: - description: Returns maximum of two floats - parameters: - a: Float 1 - b: Float 2 - returns: - maxValue: Maximum - - fmin: - addr: 268 - help: - description: Returns minimum of two floats - parameters: - a: Float 1 - b: Float 2 - returns: - minValue: Minimum - - sqrtf: - addr: 272 - help: - description: Calculates square root of float - parameters: - x: Float number - returns: - result: Square root - - sqf: - addr: 276 - help: - description: Squares a float number - parameters: - x: Float number - returns: - result: Squared value - - tone: - addr: 280 - help: - description: Generates tone on a pin - parameters: - pin: Pin number - frequency: Frequency in Hz - duration: Duration in milliseconds (optional) - returns: {} - - noTone: - addr: 284 - help: - description: Stops tone on a pin - parameters: - pin: Pin number - returns: {} - - + addr: 244 + help: {description: "Formatted print", parameters: {format: "String", args: "Args"}, returns: {written: "Count"}} \ No newline at end of file diff --git a/public/maker/boards/esp32c3devkit2.svg b/public/maker/boards/esp32c3devkit2.svg new file mode 100644 index 000000000..5321e03ad --- /dev/null +++ b/public/maker/boards/esp32c3devkit2.svg @@ -0,0 +1,918 @@ + +GPIO7ESP32-C3GND3v3RSTGPIO4GPIO5GPIO6GPIO8RSTBOOTCP21023v3GNDGPIO895v55v5GNDGPIO1GND1819GNDGNDGNDGPIO0GPIO2GPIO3GNDGND201021 diff --git a/public/maker/boards/esp32c6devkit1.svg b/public/maker/boards/esp32c6devkit1.svg new file mode 100644 index 000000000..e9992bdc5 --- /dev/null +++ b/public/maker/boards/esp32c6devkit1.svg @@ -0,0 +1,1329 @@ + + + +ESP32-C63v3RST457081011235VG16GTXRX15222119189G1312G2023 + diff --git a/src/cli/commands/info.mts b/src/cli/commands/info.mts index b23b95343..3facdd65d 100644 --- a/src/cli/commands/info.mts +++ b/src/cli/commands/info.mts @@ -56,7 +56,7 @@ export function handleAboutCommand(): void { "║" + colorText(" 🚀 CREATOR Core Version:", "33") + ` ${creatorVersion}`.padEnd( - 35 - creatorVersion.length + " 6.0.0".length, + 35 - creatorVersion.length + " 6.1.0".length, ) + "║", ); @@ -108,7 +108,7 @@ export function handleAboutCommand(): void { console.log("\n"); } else { console.log( - "CREATOR - didaCtic and geneRic assEmbly progrAmming simulaTOR", + "CREATOR", ); console.log("\nCREATOR Information"); console.log("CREATOR CLI Version: " + CLI_VERSION); diff --git a/src/cli/display.mts b/src/cli/display.mts index 5be470828..1bd66ee8f 100644 --- a/src/cli/display.mts +++ b/src/cli/display.mts @@ -28,7 +28,6 @@ export const CREATOR_ASCII = ` ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██║ ██║██╔══██╗ ╚██████╗██║ ██║███████╗██║ ██║ ██║ ╚██████╔╝██║ ██║ ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ - didaCtic and geneRic assEmbly progrAmming simulaTOR `; /** diff --git a/src/cli/tutorial.mts b/src/cli/tutorial.mts index 0bc8d3a2e..634c5d15c 100644 --- a/src/cli/tutorial.mts +++ b/src/cli/tutorial.mts @@ -156,7 +156,7 @@ const TUTORIAL_ASSEMBLY = ` // Tutorial steps - each one has a title, explanation text, and an optional command to execute const tutorialSteps: TutorialStep[] = [ { - title: "Welcome to CREATOR - didaCtic and geneRic assEmbly progrAmming simulaTOR", + title: "Welcome to CREATOR", text: "This tutorial will guide you through understanding the CREATOR simulator with a simple RISC-V program.\n\nCREATOR is a simulator that allows you to run and debug multiple architectures. You'll learn how to examine registers, memory, and control program execution.", waitForCommand: false, }, @@ -513,7 +513,6 @@ export function startTutorial(): void { ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██║ ██║██╔══██╗ ╚██████╗██║ ██║███████╗██║ ██║ ██║ ╚██████╔╝██║ ██║ ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ - didaCtic and geneRic assEmbly progrAmming simulaTOR `; // Display welcome message diff --git a/src/core/assembler/creatorAssembler/creatorAssemblerBase.mjs b/src/core/assembler/creatorAssembler/creatorAssemblerBase.mjs index 5b133417f..479a06e3a 100644 --- a/src/core/assembler/creatorAssembler/creatorAssemblerBase.mjs +++ b/src/core/assembler/creatorAssembler/creatorAssemblerBase.mjs @@ -36,18 +36,52 @@ import { setAddress, setInstructions, setLibraryInstructions, - formatErrorWithColors, getCleanErrorMessage, parseErrorForLinter, } from "../assembler.mjs"; import { logger } from "../../utils/creator_logger.mjs"; +// NOTE: the types are the same in the web and deno versions, so we can use +// either. However, tests download only the deno binaries, so it's better to use +// that + +/** + * Assembler's WASM modules + * @typedef {import("./deno/wasm/creator_assembler.d.ts")} WasmModules + */ + +/** + * @typedef {import("./deno/wasm/creator_assembler.d.ts").ArchitectureJS} ArchitectureJS + */ + +/** + * @typedef {import("./deno/wasm/creator_assembler.d.ts").DataJS} DataJS + */ + let libraryInstructions = []; +/** + * Handle compilation error + * @param {String} error - Error message returned by the assembler + * @returns {Object} Structured error data + */ +function handleError(error) { + const cleanErrorText = error.replace(/<.+?>/g, ""); + const linterInfo = parseErrorForLinter(cleanErrorText); + return { + errorcode: "101", + type: "error", + bgcolor: "danger", + status: "error", + msg: error, + linter: linterInfo, + }; +} + /** * Initialize architecture and prepare for compilation - * @param {Object} wasmModules - WASM modules containing ArchitectureJS - * @returns {Object|null} Architecture instance or null if error occurred + * @param {WasmModules} wasmModules - Assembler's WASM modules + * @returns {ArchitectureJS} Architecture instance. If an error occurs, an exception is raised */ function initializeArchitecture(wasmModules) { const { ArchitectureJS } = wasmModules; @@ -107,7 +141,7 @@ function loadLibraryIfPresent(instructions) { // Convert hex string to binary string let binaryString = ""; for (let i = 0; i < loadedLibrary.binary.length; i += 2) { - const hexByte = loadedLibrary.binary.substr(i, 2); + const hexByte = loadedLibrary.binary.slice(i, i+2); const byte = parseInt(hexByte, 16); binaryString += byte.toString(2).padStart(8, "0"); } @@ -126,7 +160,7 @@ function loadLibraryIfPresent(instructions) { // Process each instruction let currentAddr = 0; for (let i = 0; i < binaryString.length; i += instructionSizeBits) { - const instructionBinary = binaryString.substr(i, instructionSizeBits); + const instructionBinary = binaryString.slice(i, i + instructionSizeBits); const symbolName = symbolsByAddr.get(currentAddr); const hasSymbol = symbolName !== undefined; @@ -153,17 +187,23 @@ function loadLibraryIfPresent(instructions) { /** * Load data elements from compilation into memory - * @param {Array} data_mem - Array of data elements from compiler - * @param {Object} DataCategoryJS - WASM DataCategory module + * @param {DataJS[]} data_mem - Array of data elements from compiler + * @param {WasmModules} wasmModules - Assembler's WASM modules */ // eslint-disable-next-line max-lines-per-function -function loadDataIntoMemory(data_mem, DataCategoryJS) { +function loadDataIntoMemory(data_mem, wasmModules) { + const { DataCategoryJS } = wasmModules; + const wordSizeBytes = + newArchitecture.config.word_size / + newArchitecture.config.byte_size; for (let i = 0; i < data_mem.length; i++) { const data = data_mem[i]; - const addr = BigInt(data.address()); + const addr = data.address(); + const size = data.size(); const labels = data.labels(); + const category = data.data_category(); - switch (data.data_category()) { + switch (category) { case DataCategoryJS.Number: switch (data.type()) { case "float": { @@ -172,10 +212,6 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { const view = new DataView(buffer); view.setFloat32(0, floatValue, false); - const wordSizeBytes = - newArchitecture.config.word_size / - newArchitecture.config.byte_size; - const floatBytes = new Uint8Array(4); for (let i = 0; i < 4; i++) { floatBytes[i] = view.getUint8(i); @@ -187,9 +223,8 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { wordSizeBytes, ); - const floatTag = labels[0] ?? ""; const floatType = "float32"; - main_memory.addHint(addr, floatTag, floatType, 32); + main_memory.addHint(addr, labels, floatType, 32); break; } case "double": { @@ -198,10 +233,6 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { const view = new DataView(buffer); view.setFloat64(0, doubleValue, false); - const wordSizeBytes = - newArchitecture.config.word_size / - newArchitecture.config.byte_size; - const doubleBytes = new Uint8Array(8); for (let i = 0; i < 8; i++) { doubleBytes[i] = view.getUint8(i); @@ -213,26 +244,21 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { wordSizeBytes, ); - const doubleTag = labels[0] ?? ""; const doubleType = "float64"; - main_memory.addHint(addr, doubleTag, doubleType, 64); + main_memory.addHint(addr, labels, doubleType, 64); break; } case "byte": { const byteValue = Number("0x" + data.value(false)); main_memory.write(addr, byteValue); - const byteTag = labels[0] ?? ""; const byteType = "byte"; - main_memory.addHint(addr, byteTag, byteType, 8); + main_memory.addHint(addr, labels, byteType, 8); break; } case "word": { const wordValue = BigInt("0x" + data.value(false)); - const wordSizeBytes = - newArchitecture.config.word_size / - newArchitecture.config.byte_size; const wordBytes = new Uint8Array(wordSizeBytes); for (let i = 0; i < wordSizeBytes; i++) { @@ -253,11 +279,10 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { main_memory.writeWord(addr, wordBytes); - const wordTag = labels[0] ?? ""; const wordType = "word"; main_memory.addHint( addr, - wordTag, + labels, wordType, newArchitecture.config.word_size, ); @@ -266,9 +291,6 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { case "double_word": { const dwordValue = BigInt("0x" + data.value(false)); - const wordSizeBytes = - newArchitecture.config.word_size / - newArchitecture.config.byte_size; const highWord = dwordValue >> @@ -313,9 +335,8 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { lowWordBytes, ); - const dwordTag = labels[0] ?? ""; const dwordType = "dword"; - main_memory.addHint(addr, dwordTag, dwordType, 64); + main_memory.addHint(addr, labels, dwordType, 64); break; } @@ -340,9 +361,8 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { main_memory.write(addr, orderedBytes[0]); main_memory.write(addr + 1n, orderedBytes[1]); - const halfTag = labels[0] ?? ""; const halfType = "half"; - main_memory.addHint(addr, halfTag, halfType, 16); + main_memory.addHint(addr, labels, halfType, 16); break; } default: { @@ -356,7 +376,6 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { case DataCategoryJS.String: { const encoder = new TextEncoder(); let currentAddr = addr; - const startAddr = addr; for (const ch_h of data.value(false)) { const bytes = new Uint8Array(4); @@ -367,12 +386,11 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { } } - const stringLength = Number(currentAddr - startAddr); - const stringTag = labels[0] ?? ""; + const stringLength = Number(size); const stringType = "string"; main_memory.addHint( - startAddr, - stringTag, + addr, + labels, stringType, stringLength * 8, ); @@ -381,43 +399,55 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { case DataCategoryJS.Padding: case DataCategoryJS.Space: { - const space_size = BigInt(data.size()); - if (space_size < 0n) { - throw new Error( - "The space directive value should be positive and greater than zero", - ); - } - if (space_size > 50n * 1024n * 1024n) { - throw new Error( - ".space value out of range (greater than 50MiB)", - ); - } - for (let j = 0n; j < space_size; j++) { + for (let j = 0n; j < size; j++) { main_memory.write(addr + j, 0); } - const spaceTag = labels[0] ?? ""; const spaceType = - data.data_category() === DataCategoryJS.Padding - ? "padding" - : "space"; + category === DataCategoryJS.Padding ? "padding" : "space"; main_memory.addHint( addr, - spaceTag, + labels, spaceType, - Number(space_size) * 8, + Number(size) * 8, ); break; } default: - throw new Error( - `Unknown data category: ${data.data_category()}`, - ); + throw new Error(`Unknown data category: ${category}`); } } } +/** + * Write binary to memory + * @param {string} binary - Binary string to write + */ +function writeBinaryToMemory(binary, baseAddr) { + // Split into words, reverse order, and concatenate + const words = []; + for (let j = 0; j < binary.length; j += WORDSIZE) { + words.push(binary.slice(j, j+WORDSIZE)); + } + const reversedBinary = words.reverse().join(""); + + for (let j = 0; j < reversedBinary.length; j += WORDSIZE) { + const wordBinary = reversedBinary.slice(j, j+WORDSIZE); + const wordBytes = []; + + for (let k = 0; k < wordBinary.length; k += BYTESIZE) { + const byte = parseInt(wordBinary.slice(k, k+BYTESIZE), 2); + wordBytes.push(byte); + } + + main_memory.writeWord( + BigInt(baseAddr + j / BYTESIZE), + wordBytes, + ); + } +} + /** * Write library binary instructions to memory */ @@ -428,7 +458,7 @@ function writeLibraryToMemory() { let binaryString = ""; for (let i = 0; i < loadedLibrary.binary.length; i += 2) { - const hexByte = loadedLibrary.binary.substr(i, 2); + const hexByte = loadedLibrary.binary.slice(i, i+2); const byte = parseInt(hexByte, 16); binaryString += byte.toString(2).padStart(8, "0"); } @@ -438,30 +468,8 @@ function writeLibraryToMemory() { const instructionSizeBytes = instructionSizeBits / 8; for (let i = 0; i < binaryString.length; i += instructionSizeBits) { - const instructionBinary = binaryString.substr(i, instructionSizeBits); - - // Split into words, reverse order, and concatenate - const words = []; - for (let j = 0; j < instructionBinary.length; j += WORDSIZE) { - words.push(instructionBinary.substr(j, WORDSIZE)); - } - const reversedBinary = words.reverse().join(""); - - for (let j = 0; j < reversedBinary.length; j += WORDSIZE) { - const wordBinary = reversedBinary.substr(j, WORDSIZE); - const wordBytes = []; - - for (let k = 0; k < wordBinary.length; k += BYTESIZE) { - const byte = parseInt(wordBinary.substr(k, BYTESIZE), 2); - wordBytes.push(byte); - } - - main_memory.writeWord( - BigInt(currentAddr + j / BYTESIZE), - wordBytes, - ); - } - + const instructionBinary = binaryString.slice(i, i+instructionSizeBits); + writeBinaryToMemory(instructionBinary, currentAddr) currentAddr += instructionSizeBytes; } } @@ -474,41 +482,22 @@ function writeLibraryToMemory() { function writeInstructionsToMemory(instructions, library_instructions) { for (let i = library_instructions; i < instructions.length; i++) { const instruction = instructions[i]; - const baseAddr = parseInt(instruction.Address, 16); - - // Split into words, reverse order, and concatenate - const words = []; - for (let j = 0; j < instruction.binary.length; j += WORDSIZE) { - words.push(instruction.binary.substr(j, WORDSIZE)); - } - const reversedBinary = words.reverse().join(""); - - for (let j = 0; j < reversedBinary.length; j += WORDSIZE) { - const wordBinary = reversedBinary.substr(j, WORDSIZE); - const wordBytes = []; - - for (let k = 0; k < wordBinary.length; k += BYTESIZE) { - const byte = parseInt(wordBinary.substr(k, BYTESIZE), 2); - wordBytes.push(byte); - } - - main_memory.writeWord(BigInt(baseAddr + j / BYTESIZE), wordBytes); - } + const addr = parseInt(instruction.Address, 16); + writeBinaryToMemory(instruction.binary, addr) } } /** * Compile assembly code as a library * @param {string} code - Assembly code to compile - * @param {Object} wasmModules - WASM modules containing ArchitectureJS and DataCategoryJS + * @param {WasmModules} wasmModules - Assembler's WASM modules * @returns {Object} Compilation result */ export function assembleCreatorLibrary(code, wasmModules) { /* Google Analytics */ - creator_ga("compile", "compile.libraray"); - const color = 1; + creator_ga("compile", "compile.library"); - const { DataCategoryJS } = wasmModules; + const { Color } = wasmModules; let arch; try { @@ -527,13 +516,13 @@ export function assembleCreatorLibrary(code, wasmModules) { 0, // library_offset (not used for library compilation) "{}", // no library labels true, // library flag - color, + Color.Html, ); // Library compilation: only binary instructions libraryInstructions = compiled.instructions.map(x => ({ Address: x.address, - Label: x.labels[0] ?? "", + Label: x.labels, Break: null, loaded: "0x" + @@ -552,18 +541,9 @@ export function assembleCreatorLibrary(code, wasmModules) { // Extract data elements and load them on memory const data_mem = compiled.data; - loadDataIntoMemory(data_mem, DataCategoryJS); + loadDataIntoMemory(data_mem, wasmModules); } catch (error) { - const cleanErrorText = getCleanErrorMessage(error); - const linterInfo = parseErrorForLinter(cleanErrorText); - return { - errorcode: "101", - type: "error", - bgcolor: "danger", - status: "error", - msg: formatErrorWithColors(error), - linter: linterInfo, - }; + return handleError(error) } // Mark global labels on library instructions @@ -592,15 +572,14 @@ export function assembleCreatorLibrary(code, wasmModules) { /** * Compile assembly code as a normal program * @param {string} code - Assembly code to compile - * @param {Object} wasmModules - WASM modules containing ArchitectureJS and DataCategoryJS + * @param {WasmModules} wasmModules - Assembler's WASM modules * @returns {Object} Compilation result */ export function assembleCreatorProgram(code, wasmModules) { /* Google Analytics */ creator_ga("compile", "compile.assembly"); - const color = 1; - const { DataCategoryJS } = wasmModules; + const { Color } = wasmModules; let arch; try { @@ -625,14 +604,14 @@ export function assembleCreatorProgram(code, wasmModules) { library_offset, labels_json, false, // not a library - color, + Color.Html, ); // Normal compilation: populate instructions for execution/display instructions.push( ...compiled.instructions.map(x => ({ Address: x.address, - Label: x.labels[0] ?? "", + Label: x.labels, loaded: x.loaded, binary: x.binary, user: x.user, @@ -650,18 +629,9 @@ export function assembleCreatorProgram(code, wasmModules) { // Extract data elements and load them on memory const data_mem = compiled.data; - loadDataIntoMemory(data_mem, DataCategoryJS); + loadDataIntoMemory(data_mem, wasmModules); } catch (error) { - const cleanErrorText = getCleanErrorMessage(error); - const linterInfo = parseErrorForLinter(cleanErrorText); - return { - errorcode: "101", - type: "error", - bgcolor: "danger", - status: "error", - msg: formatErrorWithColors(error), - linter: linterInfo, - }; + return handleError(error) } // Write library binary to memory if present @@ -695,7 +665,7 @@ export function assembleCreatorProgram(code, wasmModules) { * Common assembly compiler implementation shared between web and deno versions * @param {string} code - Assembly code to compile * @param {boolean} library - Whether this is a library compilation - * @param {Object} wasmModules - WASM modules containing ArchitectureJS and DataCategoryJS + * @param {WasmModules} wasmModules - Assembler's WASM modules * @returns {Object} Compilation result */ export function assembleCreatorBase(code, library, wasmModules) { diff --git a/src/core/assembler/creatorAssembler/deno/creatorAssembler.mjs b/src/core/assembler/creatorAssembler/deno/creatorAssembler.mjs index de608113a..62d02d05c 100644 --- a/src/core/assembler/creatorAssembler/deno/creatorAssembler.mjs +++ b/src/core/assembler/creatorAssembler/deno/creatorAssembler.mjs @@ -19,7 +19,7 @@ import { assembleCreatorBase } from "../creatorAssemblerBase.mjs"; -import { ArchitectureJS, DataCategoryJS } from "./wasm/creator_assembler.js"; +import * as wasmModules from "./wasm/creator_assembler.js"; /** * Deno-specific assembly compiler that uses ANSI color configuration @@ -29,12 +29,6 @@ import { ArchitectureJS, DataCategoryJS } from "./wasm/creator_assembler.js"; * @returns {Object} Compilation result */ export function assembleCreator(code, library) { - // Prepare WASM modules for the base compiler - const wasmModules = { - ArchitectureJS, - DataCategoryJS, - }; - // Call the common base implementation return assembleCreatorBase(code, library, wasmModules); } diff --git a/src/core/assembler/creatorAssembler/web/creatorAssembler.mjs b/src/core/assembler/creatorAssembler/web/creatorAssembler.mjs index ddf576fd1..0eee173ef 100644 --- a/src/core/assembler/creatorAssembler/web/creatorAssembler.mjs +++ b/src/core/assembler/creatorAssembler/web/creatorAssembler.mjs @@ -19,10 +19,7 @@ import { assembleCreatorBase } from "../creatorAssemblerBase.mjs"; -import wasm_web_init, { - ArchitectureJS, - DataCategoryJS, -} from "./wasm/creator_assembler.js"; +import wasm_web_init, * as wasmModules from "./wasm/creator_assembler.js"; /** * Web-specific assembly compiler that initializes WASM @@ -34,12 +31,6 @@ export async function assembleCreator(code, library) { // In the web, we MUST call the default WASM initialization await wasm_web_init(); - // Prepare WASM modules for the base compiler - const wasmModules = { - ArchitectureJS, - DataCategoryJS, - }; - // Call the common base implementation return assembleCreatorBase(code, library, wasmModules); } diff --git a/src/core/assembler/sailAssembler/CREATORNAssembler.mjs b/src/core/assembler/sailAssembler/CREATORNAssembler.mjs new file mode 100644 index 000000000..9fb073fc5 --- /dev/null +++ b/src/core/assembler/sailAssembler/CREATORNAssembler.mjs @@ -0,0 +1,78 @@ +let linkerText = null; +export let vectorins = [ "vaadd.vv", "vaadd.vx", "vaaddu.vv", + "vaaddu.vx", "vadc.vim", "vadc.vvm", "vadc.vxm", "vadd.vi", "vadd.vv", + "vadd.vx", "vand.vi", "vand.vv", "vand.vx", "vasub.vv", "vasub.vx", + "vasubu.vv", "vasubu.vx", "vcompress.vm", "vcpop.m", "vdiv.vv", "vdiv.vx", + "vdivu.vv", "vdivu.vx", "vfadd.vf", "vfadd.vv", "vfclass.v", "vfcvt.f.x.v", + "vfcvt.f.xu.v", "vfcvt.rtz.x.f.v", "vfcvt.rtz.xu.f.v", "vfcvt.x.f.v", + "vfcvt.xu.f.v", "vfdiv.vf", "vfdiv.vv", "vfirst.m", "vfmacc.vf", "vfmacc.vv", + "vfmadd.vf", "vfmadd.vv", "vfmax.vf", "vfmax.vv", "vfmerge.vfm", "vfmin.vf", + "vfmin.vv", "vfmsac.vf", "vfmsac.vv", "vfmsub.vf", "vfmsub.vv", "vfmul.vf", "vfmul.vv", + "vfmv.f.s", "vfmv.s.f", "vfmv.v.f", "vfncvt.f.f.w", "vfncvt.f.x.w", "vfncvt.f.xu.w", + "vfncvt.rod.f.f.w", "vfncvt.rtz.x.f.w", "vfncvt.rtz.xu.f.w", "vfncvt.x.f.w", + "vfncvt.xu.f.w", "vfnmacc.vf", "vfnmacc.vv", "vfnmadd.vf", "vfnmadd.vv", "vfnmsac.vf", + "vfnmsac.vv", "vfnmsub.vf", "vfnmsub.vv", "vfrdiv.vf", "vfrec7.v", "vfredmax.vs", + "vfredmin.vs", "vfredosum.vs", "vfredusum.vs", "vfrsqrt7.v", "vfrsub.vf", "vfsgnj.vf", + "vfsgnj.vv", "vfsgnjn.vf", "vfsgnjn.vv", "vfsgnjx.vf", "vfsgnjx.vv", "vfslide1down.vf", + "vfslide1up.vf", "vfsqrt.v", "vfsub.vf", "vfsub.vv", "vfwadd.vf", "vfwadd.vv", + "vfwadd.wf", "vfwadd.wv", "vfwcvt.f.f.v", "vfwcvt.f.x.v", "vfwcvt.f.xu.v", + "vfwcvt.rtz.x.f.v", "vfwcvt.rtz.xu.f.v", "vfwcvt.x.f.v", "vfwcvt.xu.f.v", + "vfwmacc.vf", "vfwmacc.vv", "vfwmsac.vf", "vfwmsac.vv", "vfwmul.vf", "vfwmul.vv", + "vfwnmacc.vf", "vfwnmacc.vv", "vfwnmsac.vf", "vfwnmsac.vv", "vfwredosum.vs", + "vfwredusum.vs", "vfwsub.vf", "vfwsub.vv", "vfwsub.wf", "vfwsub.wv", "vid.v", + "viota.m", "vl1re16.v", "vl1re32.v", "vl1re64.v", "vl1re8.v", "vl2re16.v", + "vl2re32.v", "vl2re64.v", "vl2re8.v", "vl4re16.v", "vl4re32.v", "vl4re64.v", + "vl4re8.v", "vl8re16.v", "vl8re32.v", "vl8re64.v", "vl8re8.v", "vle16.v", + "vle16ff.v", "vle32.v", "vle32ff.v", "vle64.v", "vle64ff.v", "vle8.v", + "vle8ff.v", "vlm.v", "vloxei16.v", "vloxei32.v", "vloxei64.v", "vloxei8.v", + "vlse16.v", "vlse32.v", "vlse64.v", "vlse8.v", "vluxei16.v", "vluxei32.v", + "vluxei64.v", "vluxei8.v", "vmacc.vv", "vmacc.vx", "vmadc.vi", "vmadc.vim", + "vmadc.vv", "vmadc.vvm", "vmadc.vx", "vmadc.vxm", "vmadd.vv", "vmadd.vx", + "vmand.mm", "vmandn.mm", "vmax.vv", "vmax.vx", "vmaxu.vv", "vmaxu.vx", "vmerge.vim", + "vmerge.vvm", "vmerge.vxm", "vmfeq.vf", "vmfeq.vv", "vmfge.vf", "vmfgt.vf", + "vmfle.vf", "vmfle.vv", "vmflt.vf", "vmflt.vv", "vmfne.vf", "vmfne.vv", "vmin.vv", + "vmin.vx", "vminu.vv", "vminu.vx", "vmnand.mm", "vmnor.mm", "vmor.mm", "vmorn.mm", + "vmsbc.vv", "vmsbc.vvm", "vmsbc.vx", "vmsbc.vxm", "vmsbf.m", "vmseq.vi", "vmseq.vv", + "vmseq.vx", "vmsgt.vi", "vmsgt.vx", "vmsgtu.vi", "vmsgtu.vx", "vmsif.m", "vmsle.vi", + "vmsle.vv", "vmsle.vx", "vmsleu.vi", "vmsleu.vv", "vmsleu.vx", "vmslt.vv", "vmslt.vx", + "vmsltu.vv", "vmsltu.vx", "vmsne.vi", "vmsne.vv", "vmsne.vx", "vmsof.m", "vmul.vv", + "vmul.vx", "vmulh.vv", "vmulh.vx", "vmulhsu.vv", "vmulhsu.vx", "vmulhu.vv", "vmulhu.vx", + "vmv.s.x", "vmv.v.i", "vmv.v.v", "vmv.v.x", "vmv.x.s", "vmv1r.v", "vmv2r.v", "vmv4r.v", + "vmv8r.v", "vmxnor.mm", "vmxor.mm", "vnclip.wi", "vnclip.wv", "vnclip.wx", "vnclipu.wi", + "vnclipu.wv", "vnclipu.wx", "vnmsac.vv", "vnmsac.vx", "vnmsub.vv", "vnmsub.vx", + "vnsra.wi", "vnsra.wv", "vnsra.wx", "vnsrl.wi", "vnsrl.wv", "vnsrl.wx", "vor.vi", + "vor.vv", "vor.vx", "vredand.vs", "vredmax.vs", "vredmaxu.vs", "vredmin.vs", + "vredminu.vs", "vredor.vs", "vredsum.vs", "vredxor.vs", "vrem.vv", "vrem.vx", + "vremu.vv", "vremu.vx", "vrgather.vi", "vrgather.vv", "vrgather.vx", "vrgatherei16.vv", + "vrsub.vi", "vrsub.vx", "vs1r.v", "vs2r.v", "vs4r.v", "vs8r.v", "vsadd.vi", "vsadd.vv", + "vsadd.vx", "vsaddu.vi", "vsaddu.vv", "vsaddu.vx", "vsbc.vvm", "vsbc.vxm", "vse16.v", + "vse32.v", "vse64.v", "vse8.v", "vsetivli", "vsetvl", "vsetvli", "vsext.vf2", + "vsext.vf4", "vsext.vf8", "vslide1down.vx", "vslide1up.vx", "vslidedown.vi", + "vslidedown.vx", "vslideup.vi", "vslideup.vx", "vsll.vi", "vsll.vv", "vsll.vx", + "vsm.v", "vsmul.vv", "vsmul.vx", "vsoxei16.v", "vsoxei32.v", "vsoxei64.v", + "vsoxei8.v", "vsra.vi", "vsra.vv", "vsra.vx", "vsrl.vi", "vsrl.vv", "vsrl.vx", + "vsse16.v", "vsse32.v", "vsse64.v", "vsse8.v", "vssra.vi", "vssra.vv", + "vssra.vx", "vssrl.vi", "vssrl.vv", "vssrl.vx", "vssub.vv", "vssub.vx", + "vssubu.vv", "vssubu.vx", "vsub.vv", "vsub.vx", "vsuxei16.v", "vsuxei32.v", + "vsuxei64.v", "vsuxei8.v", "vwadd.vv", "vwadd.vx", "vwadd.wv", "vwadd.wx", + "vwaddu.vv", "vwaddu.vx", "vwaddu.wv", "vwaddu.wx", "vwmacc.vv", "vwmacc.vx", + "vwmaccsu.vv", "vwmaccsu.vx", "vwmaccu.vv", "vwmaccu.vx", "vwmaccus.vx", + "vwmul.vv", "vwmul.vx", "vwmulsu.vv", "vwmulsu.vx", "vwmulu.vv", "vwmulu.vx", + "vwredsum.vs", "vwredsumu.vs", "vwsub.vv", "vwsub.vx", "vwsub.wv", "vwsub.wx", + "vwsubu.vv", "vwsubu.vx", "vwsubu.wv", "vwsubu.wx", "vxor.vi", "vxor.vv", + "vxor.vx", "vzext.vf2", "vzext.vf4", "vzext.vf8"]; + +export let privins = ["csrrw", "csrrs", "csrrc", "csrrwi", "csrrsi", "csrrci"]; + +export async function loadlinker(is32b) { + const file = is32b ? 'linker32.ld' : 'linker64.ld'; + const url = new URL(`./linkers/${file}`, import.meta.url); + const res = await fetch(url); + if (!res.ok) { + throw new Error(`No se pudo cargar ${file}: ${res.status} ${res.statusText}`); + } + + linkerText = await res.text(); + + return linkerText; +} \ No newline at end of file diff --git a/src/core/assembler/sailAssembler/README.md b/src/core/assembler/sailAssembler/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/src/core/assembler/sailAssembler/linkers/linker32.ld b/src/core/assembler/sailAssembler/linkers/linker32.ld new file mode 100644 index 000000000..908399216 --- /dev/null +++ b/src/core/assembler/sailAssembler/linkers/linker32.ld @@ -0,0 +1,61 @@ +ENTRY(_main) + +MEMORY +{ + /* Definir la región de memoria para el código */ + text_mem (rx) : ORIGIN = 0x80000000, LENGTH = 0x4000 + data_mem (rw) : ORIGIN = 0x80004000, LENGTH = 0x2000 + bss_mem (rw) : ORIGIN = 0x80006000, LENGTH = 0x3000 + heap_mem (rw) : ORIGIN = 0x80009000, LENGTH = 0x1000 + stack_mem (rw) : ORIGIN = 0x8000A000, LENGTH = 0x1000 +} + + + +SECTIONS +{ + /* Sección de código de inicialización */ + .text.init : { *(.text.init) } > text_mem + + /* Alineación de la siguiente sección */ + . = ALIGN(0x1000); + + /* Sección .text desde 0x80000000 */ + .text : { + *(.text) + } > text_mem + + /* Sección .data desde 0x80001000 */ + .data : { + *(.data) + } > data_mem + + /* Sección .bss desde 0x80002000 */ + .bss : { + *(.bss) + + /* tohost y fromhost ubicados dentro de la sección .bss */ + . = ALIGN(0x1000); /* Alinear a 4 KB */ + PROVIDE(tohost = .); /* Marca la dirección de tohost */ + . += 8; /* Reserva 8 bytes para tohost */ + PROVIDE(fromhost = .); /* Marca la dirección de fromhost */ + . += 8; /* Reserva 8 bytes para fromhost */ + } > bss_mem + + /* Sección .heap desde 0x80005000 */ + .heap : { + *(.heap) + } > heap_mem + + /* Seccion .stack desde 0x80006000 */ + .stack : { + . = ALIGN(16); + _stack_top = .; + . += LENGTH(stack_mem); + _stack_bottom = .; + } > stack_mem + + + /* Marca el final del programa */ + _end = .; +} diff --git a/src/core/assembler/sailAssembler/linkers/linker64.ld b/src/core/assembler/sailAssembler/linkers/linker64.ld new file mode 100644 index 000000000..bdfc7e1e5 --- /dev/null +++ b/src/core/assembler/sailAssembler/linkers/linker64.ld @@ -0,0 +1,58 @@ +ENTRY(_main) + +MEMORY +{ + /* Definir la región de memoria para el código */ + + /* + text_mem (rx) : ORIGIN = 0x0000000000000000, LENGTH = 0x0000000000020000 + data_mem (rw) : ORIGIN = 0x0000000000020000, LENGTH = 0x00001FFFFFFE0000 + bss_mem (rw) : ORIGIN = 0x0000400000000000, LENGTH = 0x0000200000000000 + heap_mem (rw) : ORIGIN = 0x0000600000000000, LENGTH = 0x0000200000000000 + */ + + + text_mem (rx) : ORIGIN = 0x0000000000000000, LENGTH = 0x0000000000020000 /* 0x00020000 */ + data_mem (rw) : ORIGIN = 0x0000000000020000, LENGTH = 0x000000000FFE0000 /* 0x */ + bss_mem (rw) : ORIGIN = 0x0000000010000000, LENGTH = 0x0000000010000000 /* 0x */ + heap_mem (rw) : ORIGIN = 0x0000000020000000, LENGTH = 0x0000000010000000 /* 0x */ +} + +SECTIONS +{ + /* Sección de código de inicialización */ + .text.init : { *(.text.init) } > text_mem + + /* Alineación de la siguiente sección */ + . = ALIGN(0x1000); + + /* Sección .text desde 0x00000000 */ + .text : { + *(.text) + } > text_mem + + /* Sección .data desde 0x0000200000000000 */ + .data : { + *(.data) + } > data_mem + + /* Sección .bss desde 0x0000400000000000 */ + .bss : { + *(.bss) + + /* tohost y fromhost ubicados dentro de la sección .bss */ + . = ALIGN(0x1000); /* Alinear a 4 KB */ + PROVIDE(tohost = .); /* Marca la dirección de tohost */ + . += 8; /* Reserva 8 bytes para tohost */ + PROVIDE(fromhost = .); /* Marca la dirección de fromhost */ + . += 8; /* Reserva 8 bytes para fromhost */ + } > bss_mem + + /* Sección .heap desde 0x0000600000000000 */ + .heap : { + *(.heap) + } > heap_mem + + /* Marca el final del programa */ + _end = .; +} diff --git a/src/core/assembler/sailAssembler/web/CNAssambler.mjs b/src/core/assembler/sailAssembler/web/CNAssambler.mjs new file mode 100644 index 000000000..81c969991 --- /dev/null +++ b/src/core/assembler/sailAssembler/web/CNAssambler.mjs @@ -0,0 +1,1234 @@ + +/* For 32 bits architecture */ +import as32Module from "./wasm/as-new.js" +//import wasmUrl from "./wasm/as-new.wasm?url"; +import ld32Module from "./wasm/ld-new.js" +import dump32Module, { islib32 } from "./wasm/objdump.js" +import { /*entry_elf,*/ dumpdatainstructions32, dumptextinstructions32, dumplabels32, sectionasm32, inside_label32 } from "./wasm/objdump.js" +import { /*entry_elf,*/ dumpdatainstructions64, dumptextinstructions64, dumplabels64, sectionasm64, inside_label64, islib64 } from "./wasm/objdump64.js" +import { writeMultiByteValueAsWords, instructions, setInstructions, setAddress } from "../../assembler.mjs"; +import as64Module from "./wasm/as-new64.js" +import ld64Module from "./wasm/ld-new64.js" +import dump64Module from "./wasm/objdump64.js" +import { vectorins, loadlinker, privins} from "../CREATORNAssembler.mjs" +import { architecture, loadedLibrary, setPC, status, updateMainMemoryBackup, main_memory, WORDSIZE, BYTESIZE, backup_stack_address, backup_data_address } from "@/core/core.mjs"; +import { show_notification } from "@/core/utils/notifications.mts"; +import { assembly_files } from "@/web/components/assembly/MultifileEditor.mjs"; + +let sailas, sailld, saildump = null; +export const statecode = { codeerror: false }; +export var libs_to_load = []; +var list_data_instructions = []; +var list_user_instructions = []; +var align = 1; +var stack_address = 0; +var ins_filter; +var extensions = []; +var filesToCompile = []; +export var outfile = null; +export var vectoren = false; +export var doubleen = false; +export var priven = false; + +const locateFile = (path) => { + // Cuando Emscripten pida el .wasm, dale la URL real + // if (path.endsWith('.wasm')) return wasmUrl; + // Para cualquier otro asset (data, worker…), resuélvelo relativo a este JS + return new URL(path, import.meta.url).href; +}; + +function identify_pseudo(instruction_assembly){ + const extensionid = ins_filter.findIndex(insn => instruction_assembly.includes(insn.opcode)); + if (extensionid !== -1) { + if(extensions.findIndex(ext => (ins_filter[extensionid].type).includes(ext)) === -1) + extensions.push(ins_filter[extensionid].type); + } + if(instruction_assembly.search("li") != -1 && instruction_assembly.search("slli") === -1 && instruction_assembly.search("vsetvli") === -1 && !(instruction_assembly.includes(".section") || instruction_assembly.includes(".globl") || instruction_assembly.includes(".include") || instruction_assembly.includes(".init"))){ + list_user_instructions.push(instruction_assembly); + let parts = instruction_assembly.split(','); + if (!(-2048 >= parseInt(parts[1]?.trim(), 16)) && !(parseInt(parts[1]?.trim(), 16) <= 2047)){ + if (architecture.config.word_size !== 32) { + list_user_instructions.push(""); + } + list_user_instructions.push(""); + }else if(!(-2048 >= parseInt(parts[1]?.trim(), 10)) && !(parseInt(parts[1]?.trim(), 10) <= 2047)){ + if (architecture.config.word_size !== 32) + list_user_instructions.push(""); + list_user_instructions.push(""); + } + } + else if (instruction_assembly.search("la") != -1 && !(instruction_assembly.includes(".section") || instruction_assembly.includes(".globl") || instruction_assembly.includes(".include") || instruction_assembly.includes(".init"))) + { + list_user_instructions.push(instruction_assembly); + list_user_instructions.push(""); + } + else if (instruction_assembly.search("ecall") != -1 && !(instruction_assembly.includes(".section") || instruction_assembly.includes(".globl") || instruction_assembly.includes(".include") || instruction_assembly.includes(".init"))) + list_user_instructions.push(instruction_assembly); + else if (instruction_assembly.search("call") != -1 && (/^call\t/.test(instruction_assembly)) && !(instruction_assembly.search("ecall") != -1) && !(instruction_assembly.includes(".section") || instruction_assembly.includes(".globl") || instruction_assembly.includes(".include") || instruction_assembly.includes(".init"))) + { + list_user_instructions.push(instruction_assembly); + if (architecture.config.word_size == 32) + list_user_instructions.push(""); + } + else if (instruction_assembly.search("lw") != -1 && !(instruction_assembly.includes(".section") || instruction_assembly.includes(".globl") || instruction_assembly.includes(".include") || instruction_assembly.includes(".init"))) + { + list_user_instructions.push(instruction_assembly); + let parts = instruction_assembly.split(','); + if( isNaN(parts[1]?.trim()) && !(parts[1]?.trim()).includes("(") ){ + + list_user_instructions.push(""); + return; + } + } + else if(!(instruction_assembly.includes(".section") || instruction_assembly.includes(".globl") || instruction_assembly.includes(".include") || instruction_assembly.includes(".init"))) + list_user_instructions.push(instruction_assembly); + +} + +function process_data_to_store_memory32(){ + for (let i = 0; i < list_data_instructions.length; i++) { + const dump_ins = dumpdatainstructions32.findIndex(insn => insn[4] === list_data_instructions[i].label) + if (dumpdatainstructions32[dump_ins] !== undefined){ + dumpdatainstructions32[dump_ins].push(list_data_instructions[i].align); + dumpdatainstructions32[dump_ins].push(list_data_instructions[i].type); + + if(list_data_instructions[i].type === "asciz" || list_data_instructions[i].type === "ascii"){ + if (dumpdatainstructions32[dump_ins][1].length % 2 !== 0) { + console.warn("String missaligned in memory."); + } + + let bytes = dumpdatainstructions32[dump_ins][1].match(/.{1,2}/g); + + let reversedBytes = bytes.reverse().join(''); + + + if (reversedBytes.endsWith("00") && list_data_instructions[i].type === "ascii") + reversedBytes = reversedBytes.slice(0, -2); + + dumpdatainstructions32[dump_ins][1] = reversedBytes.match(/.{1,2}/g) + .map(byte => String.fromCharCode(parseInt(byte, 16))) + .join(''); + } + else if (list_data_instructions[i].type === "space" || list_data_instructions[i].type === "zero"){ + dumpdatainstructions32[dump_ins][1] = parseInt(list_data_instructions[i].value,10); + } + } + } +} + +function process_data_to_store_memory64(){ + for (let i = 0; i < list_data_instructions.length; i++) { + const dump_ins = dumpdatainstructions64.findIndex(insn => insn[4] === list_data_instructions[i].label) + if (dumpdatainstructions64[dump_ins] !== undefined){ + dumpdatainstructions64[dump_ins].push(list_data_instructions[i].align); + dumpdatainstructions64[dump_ins].push(list_data_instructions[i].type); + + if(list_data_instructions[i].type === "asciz" || list_data_instructions[i].type === "ascii"){ + if (dumpdatainstructions64[dump_ins][1].length % 2 !== 0) { + console.warn("String missaligned in memory."); + } + + let bytes = dumpdatainstructions64[dump_ins][1].match(/.{1,2}/g); + + let reversedBytes = bytes.reverse().join(''); + + + if (reversedBytes.endsWith("00") && list_data_instructions[i].type === "ascii") + reversedBytes = reversedBytes.slice(0, -2); + + dumpdatainstructions64[dump_ins][1] = reversedBytes.match(/.{1,2}/g) + .map(byte => String.fromCharCode(parseInt(byte, 16))) + .join(''); + } + else if (list_data_instructions[i].type === "space" || list_data_instructions[i].type === "zero"){ + dumpdatainstructions64[dump_ins][1] = parseInt(list_data_instructions[i].value,10); + } + } + } +} + +export function writeDataDumpMemory32(){ + for (let i = 0; i < dumpdatainstructions32.length; i++){ + + switch(dumpdatainstructions32[i][6]){ + case "half": + + if(dumpdatainstructions32[i][1].length > 4){ + var init_add = parseInt(dumpdatainstructions32[i][0], 16); + var elements = Math.floor(dumpdatainstructions32[i][1].length / 4); + if(dumpdatainstructions32[i][1].length % 4 !== 0){ + elements = elements + 1; + dumpdatainstructions32[i][1] = dumpdatainstructions32[i][1].padStart(elements*4,"0"); + } + for (var j = 0; j < elements; j++){ + var element_to_insert = dumpdatainstructions32[i][1].slice(dumpdatainstructions32[i][1].length - (j * 2 + 2) * 2, dumpdatainstructions32[i][1].length - (4 * j)); + if (j === 0 ) + main_memory.write(BigInt(init_add), Number("0x" + element_to_insert)); + else + main_memory.write(BigInt(init_add + j * 2), Number("0x" + element_to_insert)); + + } + }else { + main_memory.write(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), Number("0x" + dumpdatainstructions32[i][1])); + } + + const halfTag = dumpdatainstructions32[i][4] ?? ""; + const halfType = "half"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), halfTag, halfType, 16); + break; + case "byte": + main_memory.write(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), Number("0x"+dumpdatainstructions32[i][1].substring(2))); + const byteTag = dumpdatainstructions32[i][4] ?? ""; + const byteType = "byte"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), byteTag, byteType, 8); + break; + case "word": + case "integer": + if(dumpdatainstructions32[i][1].length > 8){ + var init_add = parseInt(dumpdatainstructions32[i][0], 16); + var elements = Math.floor(dumpdatainstructions32[i][1].length / 8); + if(dumpdatainstructions32[i][1].length % 8 !== 0){ + elements = elements + 1; + dumpdatainstructions32[i][1] = dumpdatainstructions32[i][1].padStart(elements*8,"0"); + } + for (var j = 0; j < elements; j++){ + + var element_to_insert = dumpdatainstructions32[i][1].slice(dumpdatainstructions32[i][1].length - (j + 1) * 8, dumpdatainstructions32[i][1].length - (8 * j)); + main_memory.write(BigInt(init_add + j * 4), Number(element_to_insert)); + } + }else { + const wordValue = BigInt("0x" + dumpdatainstructions32[i][1]); + const wordBytes = new Uint8Array(4); + for (let j = 0; j < 4; j++) { + const shiftAmount = BigInt((4 - 1 - j) * 8); + wordBytes[j] = Number((wordValue >> shiftAmount) & BigInt( + ( (1 << 8) - 1) + )); + } + main_memory.writeWord(BigInt("0x"+dumpdatainstructions32[i][0]), wordBytes); + } + const wordTag = dumpdatainstructions32[i][4] ?? ""; + const wordType = "word"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), wordTag, wordType, 32); + break; + case "dword": + if(dumpdatainstructions32[i][1].length > 16){ + var init_add = parseInt(dumpdatainstructions32[i][0], 16); + var elements = Math.floor(dumpdatainstructions32[i][1].length / 16); + if(dumpdatainstructions32[i][1].length % 16 !== 0){ + elements = elements + 1; + dumpdatainstructions32[i][1] = dumpdatainstructions32[i][1].padStart(elements*16,"0"); + } + for (var j = 0; j < elements; j++){ + var element_to_insert = dumpdatainstructions32[i][1].slice(dumpdatainstructions32[i][1].length - (j + 1) * 16, dumpdatainstructions32[i][1].length - (16 * j)); + main_memory.write(BigInt(init_add + j * 8), Number(element_to_insert)); + } + }else { + const dwordValue = BigInt("0x" + dumpdatainstructions32[i][1]); + const wordBytes = new Uint8Array(4); + const highWord = dwordValue >> BigInt(32); + + const lowWord = dwordValue & BigInt( (1n << BigInt(32)) - 1n); + + const highWordBytes = new Uint8Array(4); + const lowWordBytes = new Uint8Array(4); + + for (let j = 0; j < 4; j++){ + const shiftAmount = BigInt( + (4 - 1 - j) * 8); + highWordBytes[j] = Number((highWord >> shiftAmount) & BigInt((1 << 8) - 1)); + lowWordBytes[j] = Number((lowWord >> shiftAmount) & BigInt((1 << 8) - 1)); + } + main_memory.writeWord(BigInt("0x" + dumpdatainstructions32[i][0]), highWordBytes); + main_memory.writeWord(BigInt("0x" + dumpdatainstructions32[i][0]) + BigInt(4), lowWordBytes); + } + const dwordTag = dumpdatainstructions32[i][4] ?? ""; + const dwordType = "dword"; + main_memory.addHint(BigInt("0x" + dumpdatainstructions32[i][0]), dwordTag, dwordType, 64); + break; + + case "float": + align = 2; + + if(dumpdatainstructions32[i][1].length > 8){ // Vector Float Case + var init_add = parseInt(dumpdatainstructions32[i][0], 16); + var elements = Math.floor(dumpdatainstructions32[i][1].length / 8); + if(dumpdatainstructions32[i][1].length % 8 !== 0){ + elements = elements + 1; + dumpdatainstructions32[i][1] = dumpdatainstructions32[i][1].padStart(elements*8,"0"); + } + for (var j = 0; j < elements; j++){ + + var element_to_insert = dumpdatainstructions32[i][1].slice(dumpdatainstructions32[i][1].length - (j + 1) * 8, dumpdatainstructions32[i][1].length - (8 * j)); + const floatValue = Number("0x" + element_to_insert); + const buffer = new ArrayBuffer(4); + const view = new DataView(buffer); + + view.setFloat32(0, floatValue, false); + const floatBytes = new Uint8Array(4); + for (let k = 0; k < 4; k++) { + floatBytes[k]= view.getUint8(k); + } + writeMultiByteValueAsWords(BigInt(init_add + (j *4)), floatBytes, 4); + } + const floatTag = dumpdatainstructions32[i][4] ?? ""; + const floatType = "float"; + main_memory.addHint(BigInt(init_add), floatTag, floatType, (elements * 32)); + + }else { + const floatValue = Number("0x" + dumpdatainstructions32[i][1]); + const buffer = new ArrayBuffer(4); + const view = new DataView(buffer); + + view.setFloat32(0, floatValue, false); + const floatBytes = new Uint8Array(4); + for(let j = 0; j < 4; j++) { + floatBytes[j] = view.getUint8(j); + } + writeMultiByteValueAsWords(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), floatBytes, 4); + const floatTag = dumpdatainstructions32[i][4] ?? ""; + const floatType = "float"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), floatTag, floatType, 32); + } + break; + case "double": + if (dumpdatainstructions32[i][5] === 0){ + align = 2; + } else { + align = dumpdatainstructions32[i][5]; + } + if(dumpdatainstructions32[i][1].length > 16){ // Vector double case + var init_add = parseInt(dumpdatainstructions32[i][0], 16); + var elements = Math.floor(dumpdatainstructions32[i][1].length / 16); + if(dumpdatainstructions32[i][1].length % 16 !== 0){ + elements = elements + 1; + dumpdatainstructions32[i][1] = dumpdatainstructions32[i][1].padStart(elements*16,"0"); + } + for (var j = 0; j < elements; j++){ + + const doubleValue = dumpdatainstructions32[i][1].slice(dumpdatainstructions32[i][1].length - (j + 1) * 16, dumpdatainstructions32[i][1].length - (16 * j)); + + let bufferd = new ArrayBuffer(8); + let viewd = new DataView(bufferd); + for (let j = 0; j < 8; j++){ + viewd.setUint8(7 - j, parseInt(doubleValue.slice(j * 2, j * 2 + 2), 16)); + + } + const doubleBytes = new Uint8Array(8); + for (let j = 0; j < 8; j++) { + doubleBytes[j] = viewd.getUint8(7 - j); + } + + + writeMultiByteValueAsWords(BigInt(init_add + j *8), doubleBytes, 4); + + } + + const doubleTag = dumpdatainstructions32[i][4] ?? ""; + const doubleType = "float64"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), doubleTag, doubleType, 64 * elements); + }else { + const doubleValue = dumpdatainstructions32[i][1]; + let bufferd = new ArrayBuffer(8); + let viewd = new DataView(bufferd); + for (let j = 0; j < 8; j++){ + viewd.setUint8(7 - j, parseInt(doubleValue.slice(j * 2, j * 2 + 2), 16)); + + } + const doubleBytes = new Uint8Array(8); + for (let j = 0; j < 8; j++) { + doubleBytes[j] = viewd.getUint8(7 - j); + } + + + writeMultiByteValueAsWords(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), doubleBytes, 4); + + const doubleTag = dumpdatainstructions32[i][4] ?? ""; + const doubleType = "float64"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), doubleTag, doubleType, 64); + } + align = 1; + break; + + case "asciz": + case "ascii": + const encoder = new TextEncoder(); + let curraddr = BigInt(parseInt(dumpdatainstructions32[i][0], 16)); + const startAddr = BigInt(parseInt(dumpdatainstructions32[i][0], 16)); + for (const ch_h of dumpdatainstructions32[i][1]) { + const bytes = new Uint8Array(4); + const n = encoder.encodeInto(ch_h, bytes).written; + for (let j = 0; j < n; j++) { + main_memory.write(curraddr, bytes[j]); + curraddr++; + } + } + const stringLength = Number(curraddr - startAddr); + const stringTag = dumpdatainstructions32[i][4] ?? ""; + const stringType = "string"; + main_memory.addHint(startAddr, stringTag, stringType, stringLength * 8); + break; + case "space": + case "zero": + let space_addr = BigInt(parseInt(dumpdatainstructions32[i][0], 16)); + const size = BigInt(dumpdatainstructions32[i][1]); + if (size < 0n) { + throw new Error("The space directives value should be positive and greater than zero"); + } + for (let j = 0n; j < size; j++) { + main_memory.write(space_addr + j, 0); + } + + const spaceTag = dumpdatainstructions32[i][4] ?? ""; + const spaceType = "space"; + main_memory.addHint(space_addr, spaceTag, spaceType, Number(size) * 8); + break; + } + } + + // Initialize stack + stack_address = parseInt(architecture.memory_layout.stack.start); + + main_memory.writeWord(BigInt(stack_address), [0x0, 0x0, 0x0, 0x0]); // writeMemory("00", parseInt(stack_address), "word") ; + if (architecture.config.word_size == 32) { + architecture.components[1].elements[2].value = + BigInt(parseInt(stack_address) >>> 0, 10); + architecture.components[1].elements[2].default_value = + BigInt(parseInt(stack_address) >>> 0, 10); + }else { + architecture.components[1].elements[2].value = stack_address; + architecture.components[1].elements[2].default_value = stack_address; + } +} + +export function writeDataDumpMemory64(){ + for (let i = 0; i < dumpdatainstructions64.length; i++){ + + switch(dumpdatainstructions64[i][6]){ + case "half": + + if(dumpdatainstructions64[i][1].length > 4){ + var init_add = parseInt(dumpdatainstructions64[i][0], 16); + var elements = Math.floor(dumpdatainstructions64[i][1].length / 4); + if(dumpdatainstructions64[i][1].length % 4 !== 0){ + elements = elements + 1; + dumpdatainstructions64[i][1] = dumpdatainstructions64[i][1].padStart(elements*4,"0"); + } + for (var j = 0; j < elements; j++){ + var element_to_insert = dumpdatainstructions64[i][1].slice(dumpdatainstructions64[i][1].length - (j * 2 + 2) * 2, dumpdatainstructions64[i][1].length - (4 * j)); + if (j === 0 ) + main_memory.write(BigInt(init_add), Number("0x" + element_to_insert)); + else + main_memory.write(BigInt(init_add + j * 2), Number("0x" + element_to_insert)); + } + }else { + main_memory.write(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), Number("0x" + dumpdatainstructions64[i][1])); + } + + const halfTag = dumpdatainstructions64[i][4] ?? ""; + const halfType = "half"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), halfTag, halfType, 16); + break; + case "byte": + main_memory.write(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), Number("0x"+dumpdatainstructions64[i][1].substring(2))); + const byteTag = dumpdatainstructions64[i][4] ?? ""; + const byteType = "byte"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), byteTag, byteType, 8); + + break; + case "word": + case "integer": + if(dumpdatainstructions64[i][1].length > 8){ + var init_add = parseInt(dumpdatainstructions64[i][0], 16); + var elements = Math.floor(dumpdatainstructions64[i][1].length / 8); + if(dumpdatainstructions64[i][1].length % 8 !== 0){ + elements = elements + 1; + dumpdatainstructions64[i][1] = dumpdatainstructions64[i][1].padStart(elements*8,"0"); + } + for (var j = 0; j < elements; j++) { + var element_to_insert = dumpdatainstructions64[i][1].slice(dumpdatainstructions64[i][1].length - (j + 1) * 8, dumpdatainstructions64[i][1].length - (8 * j)); + main_memory.write(BigInt(init_add + j * 4), Number(element_to_insert)); + } + }else { + const wordValue = BigInt("0x" + dumpdatainstructions64[i][1]); + const wordBytes = new Uint8Array(4); + for (let j = 0; j < 4; j++) { + const shiftAmount = BigInt((4 - 1 - j) * 8); + wordBytes[j] = Number((wordValue >> shiftAmount) & BigInt( + ( (1 << 8) - 1) + )); + } + main_memory.writeWord(BigInt("0x"+dumpdatainstructions64[i][0]), wordBytes); + } + const wordTag = dumpdatainstructions64[i][4] ?? ""; + const wordType = "word"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), wordTag, wordType, 32); + break; + case "dword": + if(dumpdatainstructions64[i][1].length > 16){ + var init_add = parseInt(dumpdatainstructions64[i][0], 16); + var elements = Math.floor(dumpdatainstructions64[i][1].length / 16); + if(dumpdatainstructions64[i][1].length % 16 !== 0){ + elements = elements + 1; + dumpdatainstructions64[i][1] = dumpdatainstructions64[i][1].padStart(elements*16,"0"); + } + for (var j = 0; j < elements; j++){ + var element_to_insert = dumpdatainstructions64[i][1].slice(dumpdatainstructions64[i][1].length - (j + 1) * 16, dumpdatainstructions64[i][1].length - (16 * j)); + main_memory.write(BigInt(init_add + j * 8), Number(element_to_insert)); + } + }else { + const dwordValue = BigInt("0x" + dumpdatainstructions64[i][1]); + const wordBytes = new Uint8Array(4); + const highWord = dwordValue >> BigInt(32); + + const lowWord = dwordValue & BigInt( (1n << BigInt(32)) - 1n); + + const highWordBytes = new Uint8Array(4); + const lowWordBytes = new Uint8Array(4); + + for (let j = 0; j < 4; j++){ + const shiftAmount = BigInt( + (4 - 1 - j) * 8); + highWordBytes[j] = Number((highWord >> shiftAmount) & BigInt((1 << 8) - 1)); + lowWordBytes[j] = Number((lowWord >> shiftAmount) & BigInt((1 << 8) - 1)); + } + main_memory.writeWord(BigInt("0x" + dumpdatainstructions64[i][0]), highWordBytes); + main_memory.writeWord(BigInt("0x" + dumpdatainstructions64[i][0]) + BigInt(4), lowWordBytes); + } + const dwordTag = dumpdatainstructions64[i][4] ?? ""; + const dwordType = "dword"; + main_memory.addHint(BigInt("0x" + dumpdatainstructions64[i][0]), dwordTag, dwordType, 64); + break; + + case "float": + align = 2; + + if(dumpdatainstructions64[i][1].length > 8){ // Vector float case + var init_add = parseInt(dumpdatainstructions64[i][0], 16); + var elements = Math.floor(dumpdatainstructions64[i][1].length / 8); + if(dumpdatainstructions64[i][1].length % 8 !== 0){ + elements = elements + 1; + dumpdatainstructions64[i][1] = dumpdatainstructions64[i][1].padStart(elements*8,"0"); + } + for (var j = 0; j < elements; j++){ + var element_to_insert = dumpdatainstructions64[i][1].slice(dumpdatainstructions64[i][1].length - (j + 1) * 8, dumpdatainstructions64[i][1].length - (8 * j)); + const floatValue = Number("0x" + element_to_insert); + const buffer = new ArrayBuffer(4); + const view = new DataView(buffer); + + view.setFloat32(0, floatValue, false); + const floatBytes = new Uint8Array(4); + for (let k = 0; k < 4; k++) { + floatBytes[k]= view.getUint8(k); + } + writeMultiByteValueAsWords(BigInt(init_add + (j *4)), floatBytes, 4); + } + const floatTag = dumpdatainstructions64[i][4] ?? ""; + const floatType = "float"; + main_memory.addHint(BigInt(init_add), floatTag, floatType, (elements * 32)); + } else { + const floatValue = Number("0x" + dumpdatainstructions64[i][1]); + const buffer = new ArrayBuffer(4); // 4 bytes para float + const view = new DataView(buffer); + + view.setFloat32(0, floatValue, false); + const floatBytes = new Uint8Array(4); + for(let j = 0; j < 4; j++) { + floatBytes[j] = view.getUint8(j); + } + writeMultiByteValueAsWords(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), floatBytes, 4); + const floatTag = dumpdatainstructions64[i][4] ?? ""; + const floatType = "float"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), floatTag, floatType, 32); + } + + break; + case "double": + if (dumpdatainstructions64[i][5] === 0) + align = 2; + else + align = dumpdatainstructions64[i][5]; + + if(dumpdatainstructions64[i][1].length > 16){ + var init_add = parseInt(dumpdatainstructions64[i][0], 16); + var elements = Math.floor(dumpdatainstructions64[i][1].length / 16); + if(dumpdatainstructions64[i][1].length % 16 !== 0){ + elements = elements + 1; + dumpdatainstructions64[i][1] = dumpdatainstructions64[i][1].padStart(elements*16,"0"); + } + for (var j = 0; j < elements; j++){ + const doubleValue = dumpdatainstructions64[i][1].slice(dumpdatainstructions64[i][1].length - (j + 1) * 16, dumpdatainstructions64[i][1].length - (16 * j)); + // console.log(doubleValue); + let bufferd = new ArrayBuffer(8); // 8 bytes para double + let viewd = new DataView(bufferd); + for (let j = 0; j < 8; j++){ + viewd.setUint8(7 - j, parseInt(doubleValue.slice(j * 2, j * 2 + 2), 16)); + + } + const doubleBytes = new Uint8Array(8); + for (let j = 0; j < 8; j++) { + doubleBytes[j] = viewd.getUint8(7 - j); + } + writeMultiByteValueAsWords(BigInt(init_add + j *8), doubleBytes, 4); + + } + const doubleTag = dumpdatainstructions64[i][4] ?? ""; + const doubleType = "float64"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), doubleTag, doubleType, 64 * elements); + + }else { + const doubleValue = dumpdatainstructions64[i][1]; + let bufferd = new ArrayBuffer(8); + let viewd = new DataView(bufferd); + for (let j = 0; j < 8; j++){ + viewd.setUint8(7 - j, parseInt(doubleValue.slice(j * 2, j * 2 + 2), 16)); + + } + const doubleBytes = new Uint8Array(8); + for (let j = 0; j < 8; j++) { + doubleBytes[j] = viewd.getUint8(7 - j); + } + writeMultiByteValueAsWords(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), doubleBytes, 4); + + const doubleTag = dumpdatainstructions64[i][4] ?? ""; + const doubleType = "float64"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), doubleTag, doubleType, 64) + } + align = 1; + break; + + case "asciz": + case "ascii": + const encoder = new TextEncoder(); + let curraddr = BigInt(parseInt(dumpdatainstructions64[i][0], 16)); + const startAddr = BigInt(parseInt(dumpdatainstructions64[i][0], 16)); + for (const ch_h of dumpdatainstructions64[i][1]) { + const bytes = new Uint8Array(4); + const n = encoder.encodeInto(ch_h, bytes).written; + for (let j = 0; j < n; j++) { + main_memory.write(curraddr, bytes[j]); + curraddr++; + } + } + const stringLength = Number(curraddr - startAddr); + const stringTag = dumpdatainstructions64[i][4] ?? ""; + const stringType = "string"; + main_memory.addHint(startAddr, stringTag, stringType, stringLength * 8); + break; + + case "space": + case "zero": + let space_addr = BigInt(parseInt(dumpdatainstructions64[i][0], 16)); + const size = BigInt(dumpdatainstructions64[i][1]); + if (size < 0n) { + throw new Error("The space directives value should be positive and greater than zero"); + } + for (let j = 0n; j < size; j++) { + main_memory.write(space_addr + j, 0); + } + + const spaceTag = dumpdatainstructions64[i][4] ?? ""; + const spaceType = "space"; + main_memory.addHint(space_addr, spaceTag, spaceType, Number(size) * 8); + break; + } + } + // Initialize stack + stack_address = parseInt(architecture.memory_layout.stack.start); + + main_memory.writeWord(BigInt(stack_address), [0x0, 0x0, 0x0, 0x0]); // writeMemory("00", parseInt(stack_address), "word") ; + if (architecture.config.word_size == 32) { + architecture.components[1].elements[2].value = + BigInt(parseInt(stack_address) >>> 0, 10); + + architecture.components[1].elements[2].default_value = + BigInt(parseInt(stack_address) >>> 0, 10); + }else { + architecture.components[1].elements[2].value = stack_address; + architecture.components[1].elements[2].default_value = stack_address; + } +} +export async function as(files){ + /* Initialize the assembler compiler */ + let depsLeft = Infinity; + if (architecture.config.name === "SRV32") { + sailas = await as32Module({ + // locateFile, + // locateFile, + noInitialRun: true, + print: (t) => console.log('[as32]', t), + printErr: (t) => console.error('[as32:err]', t), + onAbort: (r) => console.error('[as32:abort]', r), + monitorRunDependencies(left) { + depsLeft = left; + console.log('[as32] deps pendientes:', left); + }, + }); + } else { + sailas = await as64Module({ + noInitialRun: true, + print: (t) => console.log('[as64]', t), + printErr: (t) => console.error('[as64:err]', t), + onAbort: (r) => console.error('[as64:abort]', r), + monitorRunDependencies(left) { + depsLeft = left; + console.log('[as64] deps pendientes:', left); + }, + }); + } + + await new Promise((resolve) => { + const check = () => { + if (depsLeft === 0) resolve(); + else setTimeout(check, 10); // check every 10ms + }; + check(); + }); + /* Now we have to check which extensions are enabled during the process */ + var march = "-march=rv"; + var mabi = "-mabi=ilp"; + if (architecture.config.name === "SRV32") { + march = march + "32i"; + mabi = mabi + "32"; + for(const ext of extensions ?? []){ + switch(ext){ + case "M": + march = march + "m"; + break; + case "I": + march = march + ""; + break; + case "F": + march = march + "f"; + if(!mabi.includes("d")) + mabi = "-mabi=ilp32f"; + break; + case "D": + march = march + "d"; + mabi = "-mabi=ilp32d"; + doubleen = true; + break; + case "V": + march = march + "v"; + mabi = "-mabi=ilp32d"; + vectoren = true; + break; + } + } + for (const vext of vectorins ?? []) { + for (let j = 0; j < files.length; j++){ + var code = files[j].code; + if (code.includes(vext) && !vectoren){ + march = march + "v"; + mabi = "-mabi=ilp32d"; + vectoren = !vectoren; + } + } + } + for (const priv of privins ?? []) { + for (let j = 0; j < files.length; j++){ + var code = files[j].code; + if (code.includes(priv) && !priven){ + march = march + "_zicsr"; + priven = !priven; + document.app.$data.c_kernel = false; + + } + } + } + + + } else { + march = march + "64i"; + mabi = "-mabi=lp64"; + for(const ext of extensions ?? []){ + switch(ext){ + case "M": + march = march + "m"; + break; + case "I": + march = march + ""; + break; + case "F": + march = march + "f"; + if(!mabi.includes("d")) + mabi = "-mabi=lp64f"; + break; + case "D": + march = march + "d"; + mabi = "-mabi=lp64d"; + break; + case "V": + march = march + "v"; + mabi = "-mabi=lp64d"; + break; + } + } + for (const vext of vectorins ?? []) { + for (let j = 0; j < files.length; j++){ + var code = files[j].code; + if (code.includes(vext) && !vectoren){ + march = march + "v"; + mabi = "-mabi=lp64d"; + vectoren = !vectoren; + } + } + } + for (const priv of privins ?? []) { + for (let j = 0; j < files.length; j++){ + var code = files[j].code; + if (code.includes(priv) && !priven){ + march = march + "_zicsr"; + priven = !priven; + document.app.$data.c_kernel = false; + } + } + } + + } + + let asargs = [march, mabi, files]; + console.log(asargs); + let outfile = null; + outfile = await sailas.run(asargs); + return outfile/* REturn objfile to next step*/; +} + +export async function ld(objfile, libs) { + let depsLeft = Infinity; + if (architecture.config.name === "SRV32") { + sailld = await ld32Module({ + noInitialRun: true, + print: (t) => console.log('[ld32]', t), + printErr: (t) => console.error('[ld32:err]', t), + onAbort: (r) => console.error('[ld32:abort]', r), + monitorRunDependencies(left) { + depsLeft = left; + console.log('[ld32] deps pendientes:', left); + }, + }); + + } else { + sailld = await ld64Module({ + noInitialRun: true, + print: (t) => console.log('[ld64]', t), + printErr: (t) => console.error('[ld64:err]', t), + onAbort: (r) => console.error('[ld64:abort]', r), + monitorRunDependencies(left) { + depsLeft = left; + console.log('[ld64] deps pendientes:', left); + }, + }); + + } + + await new Promise((resolve) => { + const check = () => { + if (depsLeft === 0) resolve(); + else setTimeout(check, 10); // check every 10ms + }; + check(); + }); + + var linker; + + + /* Load linker script to generate elffile */ + if (architecture.config.name === "SRV32") { + linker = await loadlinker(true); + } + else { + linker = await loadlinker(false); + } + var elf; + if (libs){ + libs_to_load.push({name: loadedLibrary.name, file: loadedLibrary.library_file}); + elf = sailld.run([linker, objfile, "-T", "linker.ld", "-o", "output.elf", "input.o", loadedLibrary.name]); + } else { + elf = sailld.run([linker, objfile, "-T", "linker.ld", "-o", "output.elf", "input.o"]); + + } + + return elf/* Return elfile to dump it*/; +} + +export async function dump(file){ + let depsLeft = Infinity; + + if (architecture.config.name === "SRV32") { + + saildump = await dump32Module({ + noInitialRun: true, + monitorRunDependencies(left) { + depsLeft = left; + console.log('[dump32] deps pendientes:', left); + }, + }); + } + else { + saildump = await dump64Module({ + noInitialRun: true, + // print: (t) => console.log('[dump32]', t), + // printErr: (t) => console.error('[dump32:err]', t), + // onAbort: (r) => console.error('[dump32:abort]', r), + + // Ver qué dependencia está pendiente (wasm, data, worker…) + monitorRunDependencies(left) { + depsLeft = left; + console.log('[dump64] deps pendientes:', left); + }, + }); + } + await new Promise((resolve) => { + const check = () => { + if (depsLeft === 0) resolve(); + else setTimeout(check, 10); // check every 10ms + }; + check(); + }); + /* Load file into environment and executes dump*/ + saildump.run([file, "-D", "input.elf"]); + if (architecture.config.name === "SRV32") { + // console.log("Instructions:", dumptextinstructions32); + // console.log("Data:", dumpdatainstructions32); + + align = 1; + for (let i = 0; i < dumptextinstructions32.length; i++){ + instructions.push({ + Break: null, + Address: "0x" + dumptextinstructions32[i][0], + Label: dumptextinstructions32[i][4], + loaded: dumptextinstructions32[i][2], + user : list_user_instructions[i], + L1_I: 0, + L1_D: 0, + L2_I: 0, + L2_D: 0, + hex: dumptextinstructions32[i][1].replace(/^0x/i, "") + .split("") + .map(c => parseInt(c, 16) + .toString(2) + .padStart(4, "0") + ) + .join(""), + _rowVariant: "", + visible: true, + hide: false, + }); + if(architecture.config.word_size == 32){ + if (dumptextinstructions32[i][0] === document.app.$data.entry_elf || ("0x"+dumptextinstructions32[i][0]) === document.app.$data.entry_elf ) + instructions[i]._rowVariant = 'success'; + } else { + if ((dumptextinstructions32[i][0]) === document.app.$data.entry_elf || ("0x"+dumptextinstructions32[i][0]) === document.app.$data.entry_elf) + instructions[i]._rowVariant = 'success'; + } + } + // Split binary into words and write to memory + for (const instruction of instructions ?? []){ + const auxAddr = parseInt(instruction.Address,16); + for (let j = 0; j < instruction.hex.length; j += 32) { + const wordBinary = instruction.hex.substr(j, 32); + const wordBytes = []; + + // Split word into bytes + for (let k = 0; k < wordBinary.length; k += 8) { + const byte = parseInt(wordBinary.substr(k, 8), 2); + wordBytes.push(byte); + } + + main_memory.writeWord(BigInt(auxAddr + j / 8), wordBytes); + } + } + + + + + process_data_to_store_memory32(); + + writeDataDumpMemory32(); + updateMainMemoryBackup(main_memory.dump()); + + + } else { + + console.log("Instructions:", dumptextinstructions64); + console.log("Data:", dumpdatainstructions64); + + align = 1; + for (let i = 0; i < dumptextinstructions64.length; i++){ + instructions.push({ + Break: null, + Address: "0x" + dumptextinstructions64[i][0], + Label: dumptextinstructions64[i][4], + loaded: dumptextinstructions64[i][2], + user : list_user_instructions[i], + L1_I: 0, + L1_D: 0, + L2_I: 0, + L2_D: 0, + hex: dumptextinstructions64[i][1].replace(/^0x/i, "") + .split("") + .map(c => parseInt(c, 16) + .toString(2) + .padStart(4, "0") + ) + .join(""), + _rowVariant: "", + visible: true, + hide: false, + }); + if(architecture.config.word_size == 32){ + if (dumptextinstructions64[i][0] === document.app.$data.entry_elf || ("0x"+dumptextinstructions64[i][0]) === document.app.$data.entry_elf ) + instructions[i]._rowVariant = 'success'; + } else { + if ((dumptextinstructions64[i][0]) === document.app.$data.entry_elf || ("0x"+dumptextinstructions64[i][0]) === document.app.$data.entry_elf) + instructions[i]._rowVariant = 'success'; + } + } + // Split binary into words and write to memory + for (const instruction of instructions ?? []){ + const auxAddr = parseInt(instruction.Address,16); + for (let j = 0; j < instruction.hex.length; j += 32) { + const wordBinary = instruction.hex.substr(j, 32); + const wordBytes = []; + + // Split word into bytes + for (let k = 0; k < wordBinary.length; k += 8) { + const byte = parseInt(wordBinary.substr(k, 8), 2); + wordBytes.push(byte); + } + + main_memory.writeWord(BigInt(auxAddr + j / 8), wordBytes); + } + } + + + + + process_data_to_store_memory64(); + + writeDataDumpMemory64(); + updateMainMemoryBackup(main_memory.dump()); + + } + + setInstructions(instructions); + if (document.app.$data.entry_elf !== undefined) + setPC(BigInt(parseInt(document.app.$data.entry_elf, 16))); + else { // Set first function to entry elf + let ind = instructions.findIndex(insn => (insn.Label !== undefined && insn.Label !== "")); + if (ind !== -1) { + document.app.$data.entry_elf = instructions[ind].Address; + setPC(BigInt(parseInt(document.app.$data.entry_elf, 16))); + } + } + setAddress(parseInt(document.app.$data.entry_elf, 16)); + status.execution_index = instructions.findIndex(insn => insn.Address === document.app.$data.entry_elf); + + return {status: "ok", msg: ""}/* Return list of instructions and data to display in simulator view */; +} + +export async function SailCompile(files, libs){ + + // update the last state of code + let a = assembly_files.findIndex(file => file.editing_now); + if (a !== -1) + assembly_files[a].code = files; + + statecode.codeerror = false; + vectoren = false; + doubleen = false; + priven = false; + extensions.length = 0; + ins_filter = (ins_filter === undefined) ? architecture.instructions.map(insn => ({opcode: insn.name, type: insn.extension})) : ins_filter; + libs_to_load.length = 0; + + dumptextinstructions64.length = 0; + dumpdatainstructions64.length = 0; + dumptextinstructions32.length = 0; + dumpdatainstructions32.length = 0; + list_data_instructions.length = 0; + list_user_instructions.length = 0; + filesToCompile.length = 0; + document.app.$data.c_kernel = true; + // files now create a struct to store files to compile + for (var j = 0; j < assembly_files.length; j++){ + if (assembly_files[j].to_compile){ + filesToCompile.push({name: assembly_files[j].filename, code: assembly_files[j].code}); + } + } + main_memory.zeroOut(); + main_memory.clearHints(); + instructions.length = 0; + var explabel = /^(\w+):/; + var expvalue = /\.(\w+)\s+(.+)/; + var expalign = /^\.align\s+(\d+)/; + var data_alignment = 0; + var is_text = false; + var is_data = false; + var labeltext = ""; + var data_to_store = { + align: 0, + value: 0, + label: "", + type: "" + } + var ret = { + errorcode: "", + token: "", + type: "", + update: "", + status: "ok" + }; + + if (filesToCompile.length === 0){ + ret.status = "error"; + ret.msg = "There is no assembly files selected to compile. Check if it is any file selected to compile."; + return ret; + } + for (let k = 0; k < filesToCompile.length; k++) { + var code_assembly_array = filesToCompile[k].code.split('\n').map(line => line.split('#')[0].trim()).filter(line => line !== ''); + + for (let i = 0; i < code_assembly_array.length; i++){ + if (code_assembly_array[i].search(".text") != -1){ + is_data = false; + is_text = true; + } + else if(code_assembly_array[i].search(".data") != -1){ + is_data = true; + is_text = false; + } + + if (is_data){ + let matchlabel = code_assembly_array[i].match(explabel); + let matchalign = code_assembly_array[i].match(expalign); + let matchvalue = code_assembly_array[i].match(expvalue); + if (matchlabel){ + + data_to_store.label = matchlabel[1]; + } + if (matchalign){ + + data_to_store.align = parseInt(matchalign[1], 10); + } + if (matchvalue && !(code_assembly_array[i].includes(".align") || code_assembly_array[i].includes("section") || code_assembly_array[i].includes("data") )){ + data_to_store.type = matchvalue[1]; + switch(data_to_store.type){ + case "half": + if(matchvalue[2].includes(",")) + data_to_store.value = matchvalue[2].trim().split(","); + else + data_to_store.value = matchvalue[2]; + break; + case "byte": + if (matchvalue[2].includes(",")) + data_to_store.value = matchvalue[2].trim().split(","); + else + data_to_store.value = parseInt(matchvalue[2]).toString(16); + break; + case "word": + case "dword": + case "integer": + if (matchvalue[2].includes(",")) + data_to_store.value = matchvalue[2].trim().split(","); + else + data_to_store.value = parseInt(matchvalue[2]).toString(16); + break; + + case "float": + if (matchvalue[2].includes(",")) + data_to_store.value = matchvalue[2].trim().split(","); + else + data_to_store.value = parseFloat(matchvalue[2]); + if (extensions.findIndex(ext => "F".includes(ext)) === -1) + extensions.push("F"); + break; + case "double": + if (matchvalue[2].includes(",")) + data_to_store.value = matchvalue[2].trim().split(","); + else + data_to_store.value = parseFloat(matchvalue[2]).toString(16); + if (extensions.findIndex(ext => "D".includes(ext)) === -1) + extensions.push("D"); + break; + + case "asciz": + data_to_store.value = matchvalue[2]; + break; + + case "ascii": + data_to_store.value = matchvalue[2]; + break; + + case "space": + case "zero": + data_to_store.value = matchvalue[2]; + break; + } + list_data_instructions.push(data_to_store); + data_to_store = Object.assign({}, { + align: 0, + value: 0, + label: "", + type: "" + }); + } + } + + if (is_text && code_assembly_array[i].endsWith(':')) + labeltext = code_assembly_array[i].slice(0, -1); + else if (is_text && labeltext !== ""){ + identify_pseudo(code_assembly_array[i]); + } + } + is_data = false; + is_text = false; + + } + + + + + if (sailas !== null || sailld !== null || saildump !== null) + { + sailas = null; + sailld = null; + saildump = null; + outfile = null; + } + + outfile = await as(filesToCompile); + if (statecode.codeerror) { + return outfile; + } + let elffile = await ld(outfile, libs); + let outdump = await dump(elffile); + // document.app.$data.v_length = 64; + // document.app.$data.L1_I_num_lines = 32; + // document.app.$data.L1_D_num_lines = 32; + // document.app.$data.L1_num_lines = 32; + // document.app.$data.L2_num_lines = 32; + // document.app.$data.L2_I_num_lines = 32; + // document.app.$data.L2_D_num_lines = 32; + // document.app.$data.L1_size = 32; + // document.app.$data.L1_I_size = 32; + // document.app.$data.L1_D_size = 32; + // document.app.$data.L1_size_block = 32; + // document.app.$data.L1_I_size_block = 32; + // document.app.$data.L1_D_size_block = 32; + // document.app.$data.L2_size = 32; + // document.app.$data.L2_I_size = 32; + // document.app.$data.L2_D_size = 32; + // document.app.$data.L2_size_block = 32; + // document.app.$data.L2_I_size_block = 32; + // document.app.$data.L2_D_size_block = 32; + // document.app.$data.cache_type = 0; + // document.app.$data.isDirect = 0; + // document.app.$data.cache_location = "Associative"; + // document.app.$data.cache_policy = "FIFO"; + document.app.$data.execution_mode_run = -1; + document.app.$data.is_breakpoint = 0; + document.app.$data.binary = elffile; + document.app.$data.instructions = instructions; + return outdump; +} diff --git a/src/core/assembler/sailAssembler/web/wasm/as-new.js b/src/core/assembler/sailAssembler/web/wasm/as-new.js new file mode 100644 index 000000000..bf8cc22eb --- /dev/null +++ b/src/core/assembler/sailAssembler/web/wasm/as-new.js @@ -0,0 +1,5868 @@ +import { statecode } from "../CNAssambler.mjs"; +let ofile = null; +var Module = (() => { + var _scriptDir = import.meta.url; + + return ( +function(Module) { + Module = Module || {}; + +var Module = typeof Module != "undefined" ? Module : {}; + +var readyPromiseResolve, readyPromiseReject; + +Module["ready"] = new Promise(function(resolve, reject) { + readyPromiseResolve = resolve; + readyPromiseReject = reject; +}); + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "_main")) { + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + get: function() { + abort("You are getting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + set: function() { + abort("You are setting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "___stdio_exit")) { + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + get: function() { + abort("You are getting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + set: function() { + abort("You are setting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "onRuntimeInitialized")) { + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + get: function() { + abort("You are getting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + set: function() { + abort("You are setting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +var moduleOverrides = Object.assign({}, Module); + +var arguments_ = []; + +var thisProgram = "./this.program"; + +var quit_ = (status, toThrow) => { + throw toThrow; +}; + +var ENVIRONMENT_IS_WEB = typeof window == "object"; + +var ENVIRONMENT_IS_WORKER = typeof importScripts == "function"; + +var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string"; + +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +if (Module["ENVIRONMENT"]) { + throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)"); +} + +var scriptDirectory = ""; + +function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; +} + +var read_, readAsync, readBinary, setWindowTitle; + +function logExceptionOnExit(e) { + if (e instanceof ExitStatus) return; + let toLog = e; + if (e && typeof e == "object" && e.stack) { + toLog = [ e, e.stack ]; + } + err("exiting due to exception: " + toLog); +} + +var fs; + +var nodePath; + +var requireNodeFS; + +if (ENVIRONMENT_IS_NODE) { + if (!(typeof process == "object" && typeof require == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = require("path").dirname(scriptDirectory) + "/"; + } else { + scriptDirectory = __dirname + "/"; + } + requireNodeFS = (() => { + if (!nodePath) { + fs = require("fs"); + nodePath = require("path"); + } + }); + read_ = function shell_read(filename, binary) { + requireNodeFS(); + filename = nodePath["normalize"](filename); + return fs.readFileSync(filename, binary ? undefined : "utf8"); + }; + readBinary = (filename => { + var ret = read_(filename, true); + if (!ret.buffer) { + ret = new Uint8Array(ret); + } + assert(ret.buffer); + return ret; + }); + readAsync = ((filename, onload, onerror) => { + requireNodeFS(); + filename = nodePath["normalize"](filename); + fs.readFile(filename, function(err, data) { + if (err) onerror(err); else onload(data.buffer); + }); + }); + if (process["argv"].length > 1) { + thisProgram = process["argv"][1].replace(/\\/g, "/"); + } + arguments_ = process["argv"].slice(2); + process["on"]("uncaughtException", function(ex) { + if (!(ex instanceof ExitStatus)) { + throw ex; + } + }); + process["on"]("unhandledRejection", function(reason) { + throw reason; + }); + quit_ = ((status, toThrow) => { + if (keepRuntimeAlive()) { + process["exitCode"] = status; + throw toThrow; + } + logExceptionOnExit(toThrow); + process["exit"](status); + }); + Module["inspect"] = function() { + return "[Emscripten Module object]"; + }; +} else if (ENVIRONMENT_IS_SHELL) { + if (typeof process == "object" && typeof require === "function" || typeof window == "object" || typeof importScripts == "function") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + if (typeof read != "undefined") { + read_ = function shell_read(f) { + return read(f); + }; + } + readBinary = function readBinary(f) { + let data; + if (typeof readbuffer == "function") { + return new Uint8Array(readbuffer(f)); + } + data = read(f, "binary"); + assert(typeof data == "object"); + return data; + }; + readAsync = function readAsync(f, onload, onerror) { + setTimeout(() => onload(readBinary(f)), 0); + }; + if (typeof scriptArgs != "undefined") { + arguments_ = scriptArgs; + } else if (typeof arguments != "undefined") { + arguments_ = arguments; + } + if (typeof quit == "function") { + quit_ = ((status, toThrow) => { + logExceptionOnExit(toThrow); + quit(status); + }); + } + if (typeof print != "undefined") { + if (typeof console == "undefined") console = {}; + console.log = print; + console.warn = console.error = typeof printErr != "undefined" ? printErr : print; + } +} else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + if (_scriptDir) { + scriptDirectory = _scriptDir; + } + if (scriptDirectory.indexOf("blob:") !== 0) { + scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1); + } else { + scriptDirectory = ""; + } + if (!(typeof window == "object" || typeof importScripts == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + { + read_ = (url => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.send(null); + return xhr.responseText; + }); + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(xhr.response); + }); + } + readAsync = ((url, onload, onerror) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = (() => { + if (xhr.status == 200 || xhr.status == 0 && xhr.response) { + onload(xhr.response); + return; + } + onerror(); + }); + xhr.onerror = onerror; + xhr.send(null); + }); + } + setWindowTitle = (title => document.title = title); +} else { + throw new Error("environment detection error"); +} + +var out = Module["print"] || console.log.bind(console); + +var instErrExp = /^\.\/([^:]+):(\d+):\s*Error:\s*(.+)$/; +var errstatus; + +Module["printErr"] = function (message) { + console.error(message); + let asmerror = message.match(instErrExp); + + if (asmerror && !statecode.codeerror){ + console.error(asmerror); + errstatus = {status: "error", msg: asmerror[1] + " at line " + asmerror[2] + ": " + asmerror[3]}; + statecode.codeerror = true; + } + +}; + +var err = Module["printErr"] || console.warn.bind(console); + +Object.assign(Module, moduleOverrides); + +moduleOverrides = null; + +if (Module["arguments"]) arguments_ = Module["arguments"]; + +if (!Object.getOwnPropertyDescriptor(Module, "arguments")) { + Object.defineProperty(Module, "arguments", { + configurable: true, + get: function() { + abort("Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + +if (!Object.getOwnPropertyDescriptor(Module, "thisProgram")) { + Object.defineProperty(Module, "thisProgram", { + configurable: true, + get: function() { + abort("Module.thisProgram has been replaced with plain thisProgram (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (Module["quit"]) quit_ = Module["quit"]; + +if (!Object.getOwnPropertyDescriptor(Module, "quit")) { + Object.defineProperty(Module, "quit", { + configurable: true, + get: function() { + abort("Module.quit has been replaced with plain quit_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["cdInitializerPrefixURL"] == "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["filePackagePrefixURL"] == "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["read"] == "undefined", "Module.read option was removed (modify read_ in JS)"); + +assert(typeof Module["readAsync"] == "undefined", "Module.readAsync option was removed (modify readAsync in JS)"); + +assert(typeof Module["readBinary"] == "undefined", "Module.readBinary option was removed (modify readBinary in JS)"); + +assert(typeof Module["setWindowTitle"] == "undefined", "Module.setWindowTitle option was removed (modify setWindowTitle in JS)"); + +assert(typeof Module["TOTAL_MEMORY"] == "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"); + +if (!Object.getOwnPropertyDescriptor(Module, "read")) { + Object.defineProperty(Module, "read", { + configurable: true, + get: function() { + abort("Module.read has been replaced with plain read_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "readAsync")) { + Object.defineProperty(Module, "readAsync", { + configurable: true, + get: function() { + abort("Module.readAsync has been replaced with plain readAsync (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "readBinary")) { + Object.defineProperty(Module, "readBinary", { + configurable: true, + get: function() { + abort("Module.readBinary has been replaced with plain readBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "setWindowTitle")) { + Object.defineProperty(Module, "setWindowTitle", { + configurable: true, + get: function() { + abort("Module.setWindowTitle has been replaced with plain setWindowTitle (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js"; + +var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js"; + +var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js"; + +var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js"; + +assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add 'shell' to `-s ENVIRONMENT` to enable."); + +var STACK_ALIGN = 16; + +var POINTER_SIZE = 4; + +function getNativeTypeSize(type) { + switch (type) { + case "i1": + case "i8": + return 1; + + case "i16": + return 2; + + case "i32": + return 4; + + case "i64": + return 8; + + case "float": + return 4; + + case "double": + return 8; + + default: + { + if (type[type.length - 1] === "*") { + return POINTER_SIZE; + } else if (type[0] === "i") { + const bits = Number(type.substr(1)); + assert(bits % 8 === 0, "getNativeTypeSize invalid bits " + bits + ", type " + type); + return bits / 8; + } else { + return 0; + } + } + } +} + +function warnOnce(text) { + if (!warnOnce.shown) warnOnce.shown = {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + err(text); + } +} + +function convertJsFunctionToWasm(func, sig) { + if (typeof WebAssembly.Function == "function") { + var typeNames = { + "i": "i32", + "j": "i64", + "f": "f32", + "d": "f64" + }; + var type = { + parameters: [], + results: sig[0] == "v" ? [] : [ typeNames[sig[0]] ] + }; + for (var i = 1; i < sig.length; ++i) { + type.parameters.push(typeNames[sig[i]]); + } + return new WebAssembly.Function(type, func); + } + var typeSection = [ 1, 0, 1, 96 ]; + var sigRet = sig.slice(0, 1); + var sigParam = sig.slice(1); + var typeCodes = { + "i": 127, + "j": 126, + "f": 125, + "d": 124 + }; + typeSection.push(sigParam.length); + for (var i = 0; i < sigParam.length; ++i) { + typeSection.push(typeCodes[sigParam[i]]); + } + if (sigRet == "v") { + typeSection.push(0); + } else { + typeSection = typeSection.concat([ 1, typeCodes[sigRet] ]); + } + typeSection[1] = typeSection.length - 2; + var bytes = new Uint8Array([ 0, 97, 115, 109, 1, 0, 0, 0 ].concat(typeSection, [ 2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0 ])); + var module = new WebAssembly.Module(bytes); + var instance = new WebAssembly.Instance(module, { + "e": { + "f": func + } + }); + var wrappedFunc = instance.exports["f"]; + return wrappedFunc; +} + +var freeTableIndexes = []; + +var functionsInTableMap; + +function getEmptyTableSlot() { + if (freeTableIndexes.length) { + return freeTableIndexes.pop(); + } + try { + wasmTable.grow(1); + } catch (err) { + if (!(err instanceof RangeError)) { + throw err; + } + throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."; + } + return wasmTable.length - 1; +} + +function updateTableMap(offset, count) { + for (var i = offset; i < offset + count; i++) { + var item = getWasmTableEntry(i); + if (item) { + functionsInTableMap.set(item, i); + } + } +} + +function addFunction(func, sig) { + assert(typeof func != "undefined"); + if (!functionsInTableMap) { + functionsInTableMap = new WeakMap(); + updateTableMap(0, wasmTable.length); + } + if (functionsInTableMap.has(func)) { + return functionsInTableMap.get(func); + } + var ret = getEmptyTableSlot(); + try { + setWasmTableEntry(ret, func); + } catch (err) { + if (!(err instanceof TypeError)) { + throw err; + } + assert(typeof sig != "undefined", "Missing signature argument to addFunction: " + func); + var wrapped = convertJsFunctionToWasm(func, sig); + setWasmTableEntry(ret, wrapped); + } + functionsInTableMap.set(func, ret); + return ret; +} + +function removeFunction(index) { + functionsInTableMap.delete(getWasmTableEntry(index)); + freeTableIndexes.push(index); +} + +var tempRet0 = 0; + +var setTempRet0 = value => { + tempRet0 = value; +}; + +var getTempRet0 = () => tempRet0; + +var wasmBinary; + +if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"]; + +if (!Object.getOwnPropertyDescriptor(Module, "wasmBinary")) { + Object.defineProperty(Module, "wasmBinary", { + configurable: true, + get: function() { + abort("Module.wasmBinary has been replaced with plain wasmBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +var noExitRuntime = Module["noExitRuntime"] || false; + +if (!Object.getOwnPropertyDescriptor(Module, "noExitRuntime")) { + Object.defineProperty(Module, "noExitRuntime", { + configurable: true, + get: function() { + abort("Module.noExitRuntime has been replaced with plain noExitRuntime (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (typeof WebAssembly != "object") { + abort("no native wasm support detected"); +} + +function setValue(ptr, value, type = "i8", noSafe) { + if (type.charAt(type.length - 1) === "*") type = "i32"; + if (noSafe) { + switch (type) { + case "i1": + HEAP8[ptr >> 0] = value; + break; + + case "i8": + HEAP8[ptr >> 0] = value; + break; + + case "i16": + HEAP16[ptr >> 1] = value; + break; + + case "i32": + HEAP32[ptr >> 2] = value; + break; + + case "i64": + tempI64 = [ value >>> 0, (tempDouble = value, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + HEAP32[ptr >> 2] = tempI64[0], HEAP32[ptr + 4 >> 2] = tempI64[1]; + break; + + case "float": + HEAPF32[ptr >> 2] = value; + break; + + case "double": + HEAPF64[ptr >> 3] = value; + break; + + default: + abort("invalid type for setValue: " + type); + } + } else { + switch (type) { + case "i1": + SAFE_HEAP_STORE(ptr | 0, value | 0, 1); + break; + + case "i8": + SAFE_HEAP_STORE(ptr | 0, value | 0, 1); + break; + + case "i16": + SAFE_HEAP_STORE(ptr | 0, value | 0, 2); + break; + + case "i32": + SAFE_HEAP_STORE(ptr | 0, value | 0, 4); + break; + + case "i64": + tempI64 = [ value >>> 0, (tempDouble = value, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(ptr | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(ptr + 4 | 0, tempI64[1] | 0, 4); + break; + + case "float": + SAFE_HEAP_STORE_D(ptr | 0, Math.fround(value), 4); + break; + + case "double": + SAFE_HEAP_STORE_D(ptr | 0, +value, 8); + break; + + default: + abort("invalid type for setValue: " + type); + } + } +} + +function getValue(ptr, type = "i8", noSafe) { + if (type.charAt(type.length - 1) === "*") type = "i32"; + if (noSafe) { + switch (type) { + case "i1": + return HEAP8[ptr >> 0]; + + case "i8": + return HEAP8[ptr >> 0]; + + case "i16": + return HEAP16[ptr >> 1]; + + case "i32": + return HEAP32[ptr >> 2]; + + case "i64": + return HEAP32[ptr >> 2]; + + case "float": + return HEAPF32[ptr >> 2]; + + case "double": + return Number(HEAPF64[ptr >> 3]); + + default: + abort("invalid type for getValue: " + type); + } + } else { + switch (type) { + case "i1": + return SAFE_HEAP_LOAD(ptr | 0, 1, 0) | 0; + + case "i8": + return SAFE_HEAP_LOAD(ptr | 0, 1, 0) | 0; + + case "i16": + return SAFE_HEAP_LOAD(ptr | 0, 2, 0) | 0; + + case "i32": + return SAFE_HEAP_LOAD(ptr | 0, 4, 0) | 0; + + case "i64": + return SAFE_HEAP_LOAD(ptr | 0, 8, 0) | 0; + + case "float": + return Math.fround(SAFE_HEAP_LOAD_D(ptr | 0, 4, 0)); + + case "double": + return +SAFE_HEAP_LOAD_D(ptr | 0, 8, 0); + + default: + abort("invalid type for getValue: " + type); + } + } + return null; +} + +function getSafeHeapType(bytes, isFloat) { + switch (bytes) { + case 1: + return "i8"; + + case 2: + return "i16"; + + case 4: + return isFloat ? "float" : "i32"; + + case 8: + return isFloat ? "double" : "i64"; + + default: + assert(0); + } +} + +function SAFE_HEAP_STORE(dest, value, bytes, isFloat) { + if (dest <= 0) abort("segmentation fault storing " + bytes + " bytes to address " + dest); + if (dest % bytes !== 0) abort("alignment error storing to address " + dest + ", which was expected to be aligned to a multiple of " + bytes); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk() >>> 0; + if (dest + bytes > brk) abort("segmentation fault, exceeded the top of the available dynamic heap when storing " + bytes + " bytes to address " + dest + ". DYNAMICTOP=" + brk); + assert(brk >= _emscripten_stack_get_base()); + assert(brk <= HEAP8.length); + } + setValue(dest, value, getSafeHeapType(bytes, isFloat), 1); + return value; +} + +function SAFE_HEAP_STORE_D(dest, value, bytes) { + return SAFE_HEAP_STORE(dest, value, bytes, true); +} + +function SAFE_HEAP_LOAD(dest, bytes, unsigned, isFloat) { + if (dest <= 0) abort("segmentation fault loading " + bytes + " bytes from address " + dest); + if (dest % bytes !== 0) abort("alignment error loading from address " + dest + ", which was expected to be aligned to a multiple of " + bytes); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk() >>> 0; + if (dest + bytes > brk) abort("segmentation fault, exceeded the top of the available dynamic heap when loading " + bytes + " bytes from address " + dest + ". DYNAMICTOP=" + brk); + assert(brk >= _emscripten_stack_get_base()); + assert(brk <= HEAP8.length); + } + var type = getSafeHeapType(bytes, isFloat); + var ret = getValue(dest, type, 1); + if (unsigned) ret = unSign(ret, parseInt(type.substr(1), 10)); + return ret; +} + +function SAFE_HEAP_LOAD_D(dest, bytes, unsigned) { + return SAFE_HEAP_LOAD(dest, bytes, unsigned, true); +} + +function SAFE_FT_MASK(value, mask) { + var ret = value & mask; + if (ret !== value) { + abort("Function table mask error: function pointer is " + value + " which is masked by " + mask + ", the likely cause of this is that the function pointer is being called by the wrong type."); + } + return ret; +} + +function segfault() { + abort("segmentation fault"); +} + +function alignfault() { + abort("alignment fault"); +} + +var wasmMemory; + +var ABORT = false; + +var EXITSTATUS; + +function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } +} + +function getCFunc(ident) { + var func = Module["_" + ident]; + assert(func, "Cannot call unknown function " + ident + ", make sure it is exported"); + return func; +} + +function ccall(ident, returnType, argTypes, args, opts) { + var toC = { + "string": function(str) { + var ret = 0; + if (str !== null && str !== undefined && str !== 0) { + var len = (str.length << 2) + 1; + ret = stackAlloc(len); + stringToUTF8(str, ret, len); + } + return ret; + }, + "array": function(arr) { + var ret = stackAlloc(arr.length); + writeArrayToMemory(arr, ret); + return ret; + } + }; + function convertReturnValue(ret) { + if (returnType === "string") return UTF8ToString(ret); + if (returnType === "boolean") return Boolean(ret); + return ret; + } + var func = getCFunc(ident); + var cArgs = []; + var stack = 0; + assert(returnType !== "array", 'Return type should not be "array".'); + if (args) { + for (var i = 0; i < args.length; i++) { + var converter = toC[argTypes[i]]; + if (converter) { + if (stack === 0) stack = stackSave(); + cArgs[i] = converter(args[i]); + } else { + cArgs[i] = args[i]; + } + } + } + var ret = func.apply(null, cArgs); + function onDone(ret) { + if (stack !== 0) stackRestore(stack); + return convertReturnValue(ret); + } + ret = onDone(ret); + return ret; +} + +function cwrap(ident, returnType, argTypes, opts) { + return function() { + return ccall(ident, returnType, argTypes, arguments, opts); + }; +} + +var ALLOC_NORMAL = 0; + +var ALLOC_STACK = 1; + +function allocate(slab, allocator) { + var ret; + assert(typeof allocator == "number", "allocate no longer takes a type argument"); + assert(typeof slab != "number", "allocate no longer takes a number as arg0"); + if (allocator == ALLOC_STACK) { + ret = stackAlloc(slab.length); + } else { + ret = _malloc(slab.length); + } + if (!slab.subarray && !slab.slice) { + slab = new Uint8Array(slab); + } + HEAPU8.set(slab, ret); + return ret; +} + +var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : undefined; + +function UTF8ArrayToString(heap, idx, maxBytesToRead) { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + while (heap[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heap.subarray && UTF8Decoder) { + return UTF8Decoder.decode(heap.subarray(idx, endPtr)); + } else { + var str = ""; + while (idx < endPtr) { + var u0 = heap[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heap[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode((u0 & 31) << 6 | u1); + continue; + } + var u2 = heap[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = (u0 & 15) << 12 | u1 << 6 | u2; + } else { + if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte 0x" + u0.toString(16) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"); + u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heap[idx++] & 63; + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); + } + } + } + return str; +} + +function UTF8ToString(ptr, maxBytesToRead) { + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; +} + +function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) { + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = 65536 + ((u & 1023) << 10) | u1 & 1023; + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | u >> 6; + heap[outIdx++] = 128 | u & 63; + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | u >> 12; + heap[outIdx++] = 128 | u >> 6 & 63; + heap[outIdx++] = 128 | u & 63; + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) warnOnce("Invalid Unicode code point 0x" + u.toString(16) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."); + heap[outIdx++] = 240 | u >> 18; + heap[outIdx++] = 128 | u >> 12 & 63; + heap[outIdx++] = 128 | u >> 6 & 63; + heap[outIdx++] = 128 | u & 63; + } + } + heap[outIdx] = 0; + return outIdx - startIdx; +} + +function stringToUTF8(str, outPtr, maxBytesToWrite) { + assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); +} + +function lengthBytesUTF8(str) { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) u = 65536 + ((u & 1023) << 10) | str.charCodeAt(++i) & 1023; + if (u <= 127) ++len; else if (u <= 2047) len += 2; else if (u <= 65535) len += 3; else len += 4; + } + return len; +} + +function AsciiToString(ptr) { + var str = ""; + while (1) { + var ch = SAFE_HEAP_LOAD(ptr++ | 0, 1, 1) >>> 0; + if (!ch) return str; + str += String.fromCharCode(ch); + } +} + +function stringToAscii(str, outPtr) { + return writeAsciiToMemory(str, outPtr, false); +} + +var UTF16Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf-16le") : undefined; + +function UTF16ToString(ptr, maxBytesToRead) { + assert(ptr % 2 == 0, "Pointer passed to UTF16ToString must be aligned to two bytes!"); + var endPtr = ptr; + var idx = endPtr >> 1; + var maxIdx = idx + maxBytesToRead / 2; + while (!(idx >= maxIdx) && SAFE_HEAP_LOAD(idx * 2, 2, 1)) ++idx; + endPtr = idx << 1; + if (endPtr - ptr > 32 && UTF16Decoder) { + return UTF16Decoder.decode(HEAPU8.subarray(ptr, endPtr)); + } else { + var str = ""; + for (var i = 0; !(i >= maxBytesToRead / 2); ++i) { + var codeUnit = SAFE_HEAP_LOAD(ptr + i * 2 | 0, 2, 0) | 0; + if (codeUnit == 0) break; + str += String.fromCharCode(codeUnit); + } + return str; + } +} + +function stringToUTF16(str, outPtr, maxBytesToWrite) { + assert(outPtr % 2 == 0, "Pointer passed to stringToUTF16 must be aligned to two bytes!"); + assert(typeof maxBytesToWrite == "number", "stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 2) return 0; + maxBytesToWrite -= 2; + var startPtr = outPtr; + var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length; + for (var i = 0; i < numCharsToWrite; ++i) { + var codeUnit = str.charCodeAt(i); + SAFE_HEAP_STORE(outPtr | 0, codeUnit | 0, 2); + outPtr += 2; + } + SAFE_HEAP_STORE(outPtr | 0, 0 | 0, 2); + return outPtr - startPtr; +} + +function lengthBytesUTF16(str) { + return str.length * 2; +} + +function UTF32ToString(ptr, maxBytesToRead) { + assert(ptr % 4 == 0, "Pointer passed to UTF32ToString must be aligned to four bytes!"); + var i = 0; + var str = ""; + while (!(i >= maxBytesToRead / 4)) { + var utf32 = SAFE_HEAP_LOAD(ptr + i * 4 | 0, 4, 0) | 0; + if (utf32 == 0) break; + ++i; + if (utf32 >= 65536) { + var ch = utf32 - 65536; + str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); + } else { + str += String.fromCharCode(utf32); + } + } + return str; +} + +function stringToUTF32(str, outPtr, maxBytesToWrite) { + assert(outPtr % 4 == 0, "Pointer passed to stringToUTF32 must be aligned to four bytes!"); + assert(typeof maxBytesToWrite == "number", "stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 4) return 0; + var startPtr = outPtr; + var endPtr = startPtr + maxBytesToWrite - 4; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) { + var trailSurrogate = str.charCodeAt(++i); + codeUnit = 65536 + ((codeUnit & 1023) << 10) | trailSurrogate & 1023; + } + SAFE_HEAP_STORE(outPtr | 0, codeUnit | 0, 4); + outPtr += 4; + if (outPtr + 4 > endPtr) break; + } + SAFE_HEAP_STORE(outPtr | 0, 0 | 0, 4); + return outPtr - startPtr; +} + +function lengthBytesUTF32(str) { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) ++i; + len += 4; + } + return len; +} + +function allocateUTF8(str) { + var size = lengthBytesUTF8(str) + 1; + var ret = _malloc(size); + if (ret) stringToUTF8Array(str, HEAP8, ret, size); + return ret; +} + +function allocateUTF8OnStack(str) { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8Array(str, HEAP8, ret, size); + return ret; +} + +function writeStringToMemory(string, buffer, dontAddNull) { + warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!"); + var lastChar, end; + if (dontAddNull) { + end = buffer + lengthBytesUTF8(string); + lastChar = SAFE_HEAP_LOAD(end, 1, 0); + } + stringToUTF8(string, buffer, Infinity); + if (dontAddNull) SAFE_HEAP_STORE(end, lastChar, 1); +} + +function writeArrayToMemory(array, buffer) { + assert(array.length >= 0, "writeArrayToMemory array must have a length (should be an array or typed array)"); + HEAP8.set(array, buffer); +} + +function writeAsciiToMemory(str, buffer, dontAddNull) { + for (var i = 0; i < str.length; ++i) { + assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255)); + SAFE_HEAP_STORE(buffer++ | 0, str.charCodeAt(i) | 0, 1); + } + if (!dontAddNull) SAFE_HEAP_STORE(buffer | 0, 0 | 0, 1); +} + +function alignUp(x, multiple) { + if (x % multiple > 0) { + x += multiple - x % multiple; + } + return x; +} + +var HEAP, buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; + +function updateGlobalBufferAndViews(buf) { + buffer = buf; + Module["HEAP8"] = HEAP8 = new Int8Array(buf); + Module["HEAP16"] = HEAP16 = new Int16Array(buf); + Module["HEAP32"] = HEAP32 = new Int32Array(buf); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf); + Module["HEAPF32"] = HEAPF32 = new Float32Array(buf); + Module["HEAPF64"] = HEAPF64 = new Float64Array(buf); +} + +var TOTAL_STACK = 5242880; + +if (Module["TOTAL_STACK"]) assert(TOTAL_STACK === Module["TOTAL_STACK"], "the stack size can no longer be determined at runtime"); + +var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216; + +if (!Object.getOwnPropertyDescriptor(Module, "INITIAL_MEMORY")) { + Object.defineProperty(Module, "INITIAL_MEMORY", { + configurable: true, + get: function() { + abort("Module.INITIAL_MEMORY has been replaced with plain INITIAL_MEMORY (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +assert(INITIAL_MEMORY >= TOTAL_STACK, "INITIAL_MEMORY should be larger than TOTAL_STACK, was " + INITIAL_MEMORY + "! (TOTAL_STACK=" + TOTAL_STACK + ")"); + +assert(typeof Int32Array != "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, "JS engine does not provide full typed array support"); + +assert(!Module["wasmMemory"], "Use of `wasmMemory` detected. Use -s IMPORTED_MEMORY to define wasmMemory externally"); + +assert(INITIAL_MEMORY == 16777216, "Detected runtime INITIAL_MEMORY setting. Use -s IMPORTED_MEMORY to define wasmMemory dynamically"); + +var wasmTable; + +function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + SAFE_HEAP_STORE(max + 4 | 0, 34821223 | 0, 4); + SAFE_HEAP_STORE(max + 8 | 0, 2310721022 | 0, 4); +} + +function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + var cookie1 = SAFE_HEAP_LOAD(max + 4 | 0, 4, 1) >>> 0; + var cookie2 = SAFE_HEAP_LOAD(max + 8 | 0, 4, 1) >>> 0; + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x" + cookie2.toString(16) + " 0x" + cookie1.toString(16)); + } +} + +(function() { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -s SUPPORT_BIG_ENDIAN=1 to bypass)"; +})(); + +var __ATPRERUN__ = []; + +var __ATINIT__ = []; + +var __ATMAIN__ = []; + +var __ATEXIT__ = []; + +var __ATPOSTRUN__ = []; + +var runtimeInitialized = false; + +var runtimeExited = false; + +var runtimeKeepaliveCounter = 0; + +function keepRuntimeAlive() { + return noExitRuntime || runtimeKeepaliveCounter > 0; +} + +function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); +} + +function initRuntime() { + checkStackCookie(); + assert(!runtimeInitialized); + runtimeInitialized = true; + if (!Module["noFSInit"] && !FS.init.initialized) FS.init(); + FS.ignorePermissions = false; + TTY.init(); + callRuntimeCallbacks(__ATINIT__); +} + +function preMain() { + checkStackCookie(); + callRuntimeCallbacks(__ATMAIN__); +} + +function exitRuntime() { + checkStackCookie(); + ___funcs_on_exit(); + callRuntimeCallbacks(__ATEXIT__); + FS.quit(); + TTY.shutdown(); + runtimeExited = true; +} + +function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(__ATPOSTRUN__); +} + +function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); +} + +function addOnInit(cb) { + __ATINIT__.unshift(cb); +} + +function addOnPreMain(cb) { + __ATMAIN__.unshift(cb); +} + +function addOnExit(cb) { + __ATEXIT__.unshift(cb); +} + +function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); +} + +assert(Math.imul, "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.fround, "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.clz32, "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.trunc, "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +var runDependencies = 0; + +var runDependencyWatcher = null; + +var dependenciesFulfilled = null; + +var runDependencyTracking = {}; + +function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } +} + +function addRunDependency(id) { + runDependencies++; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if (runDependencyWatcher === null && typeof setInterval != "undefined") { + runDependencyWatcher = setInterval(function() { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err("dependency: " + dep); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } +} + +function removeRunDependency(id) { + runDependencies--; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } +} + +Module["preloadedImages"] = {}; + +Module["preloadedAudios"] = {}; + +function abort(what) { + { + if (Module["onAbort"]) { + Module["onAbort"](what); + } + } + what = "Aborted(" + what + ")"; + err(what); + ABORT = true; + EXITSTATUS = 1; + var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + throw e; +} + +var dataURIPrefix = "data:application/octet-stream;base64,"; + +function isDataURI(filename) { + return filename.startsWith(dataURIPrefix); +} + +function isFileURI(filename) { + return filename.startsWith("file://"); +} + +function createExportWrapper(name, fixedasm) { + return function() { + var displayName = name; + var asm = fixedasm; + if (!fixedasm) { + asm = Module["asm"]; + } + assert(runtimeInitialized, "native function `" + displayName + "` called before runtime initialization"); + assert(!runtimeExited, "native function `" + displayName + "` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)"); + if (!asm[name]) { + assert(asm[name], "exported native function `" + displayName + "` not found"); + } + return asm[name].apply(null, arguments); + }; +} + +var wasmBinaryFile; + +if (Module["locateFile"]) { + wasmBinaryFile = "as-new.wasm"; + if (!isDataURI(wasmBinaryFile)) { + wasmBinaryFile = locateFile(wasmBinaryFile); + } +} else { + wasmBinaryFile = new URL("as-new.wasm", import.meta.url).toString(); +} + +function getBinary(file) { + try { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } else { + throw "both async and sync fetching of the wasm failed"; + } + } catch (err) { + abort(err); + } +} + +function getBinaryPromise() { + if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) { + if (typeof fetch == "function" && !isFileURI(wasmBinaryFile)) { + return fetch(wasmBinaryFile, { + credentials: "same-origin" + }).then(function(response) { + if (!response["ok"]) { + throw "failed to load wasm binary file at '" + wasmBinaryFile + "'"; + } + return response["arrayBuffer"](); + }).catch(function() { + return getBinary(wasmBinaryFile); + }); + } else { + if (readAsync) { + return new Promise(function(resolve, reject) { + readAsync(wasmBinaryFile, function(response) { + resolve(new Uint8Array(response)); + }, reject); + }); + } + } + } + return Promise.resolve().then(function() { + return getBinary(wasmBinaryFile); + }); +} + +function createWasm() { + var info = { + "env": asmLibraryArg, + "wasi_snapshot_preview1": asmLibraryArg + }; + function receiveInstance(instance, module) { + var exports = instance.exports; + Module["asm"] = exports; + wasmMemory = Module["asm"]["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateGlobalBufferAndViews(wasmMemory.buffer); + wasmTable = Module["asm"]["__indirect_function_table"]; + assert(wasmTable, "table not found in wasm exports"); + addOnInit(Module["asm"]["__wasm_call_ctors"]); + removeRunDependency("wasm-instantiate"); + } + addRunDependency("wasm-instantiate"); + var trueModule = Module; + function receiveInstantiationResult(result) { + assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"); + trueModule = null; + receiveInstance(result["instance"]); + } + function instantiateArrayBuffer(receiver) { + return getBinaryPromise().then(function(binary) { + return WebAssembly.instantiate(binary, info); + }).then(function(instance) { + return instance; + }).then(receiver, function(reason) { + err("failed to asynchronously prepare wasm: " + reason); + if (isFileURI(wasmBinaryFile)) { + err("warning: Loading from a file URI (" + wasmBinaryFile + ") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing"); + } + abort(reason); + }); + } + function instantiateAsync() { + if (!wasmBinary && typeof WebAssembly.instantiateStreaming == "function" && !isDataURI(wasmBinaryFile) && !isFileURI(wasmBinaryFile) && typeof fetch == "function") { + return fetch(wasmBinaryFile, { + credentials: "same-origin" + }).then(function(response) { + var result = WebAssembly.instantiateStreaming(response, info); + return result.then(receiveInstantiationResult, function(reason) { + err("wasm streaming compile failed: " + reason); + err("falling back to ArrayBuffer instantiation"); + return instantiateArrayBuffer(receiveInstantiationResult); + }); + }); + } else { + return instantiateArrayBuffer(receiveInstantiationResult); + } + } + if (Module["instantiateWasm"]) { + try { + var exports = Module["instantiateWasm"](info, receiveInstance); + return exports; + } catch (e) { + err("Module.instantiateWasm callback failed with error: " + e); + return false; + } + } + instantiateAsync().catch(readyPromiseReject); + return {}; +} + +var tempDouble; + +var tempI64; + +var ASM_CONSTS = {}; + +function callRuntimeCallbacks(callbacks) { + while (callbacks.length > 0) { + var callback = callbacks.shift(); + if (typeof callback == "function") { + callback(Module); + continue; + } + var func = callback.func; + if (typeof func == "number") { + if (callback.arg === undefined) { + getWasmTableEntry(func)(); + } else { + getWasmTableEntry(func)(callback.arg); + } + } else { + func(callback.arg === undefined ? null : callback.arg); + } + } +} + +function withStackSave(f) { + var stack = stackSave(); + var ret = f(); + stackRestore(stack); + return ret; +} + +function demangle(func) { + warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"); + return func; +} + +function demangleAll(text) { + var regex = /\b_Z[\w\d_]+/g; + return text.replace(regex, function(x) { + var y = demangle(x); + return x === y ? x : y + " [" + x + "]"; + }); +} + +var wasmTableMirror = []; + +function getWasmTableEntry(funcPtr) { + var func = wasmTableMirror[funcPtr]; + if (!func) { + if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1; + wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr); + } + assert(wasmTable.get(funcPtr) == func, "JavaScript-side Wasm function table mirror is out of date!"); + return func; +} + +function handleException(e) { + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + quit_(1, e); +} + +function jsStackTrace() { + var error = new Error(); + if (!error.stack) { + try { + throw new Error(); + } catch (e) { + error = e; + } + if (!error.stack) { + return "(no stack trace available)"; + } + } + return error.stack.toString(); +} + +function setWasmTableEntry(idx, func) { + wasmTable.set(idx, func); + wasmTableMirror[idx] = func; +} + +function stackTrace() { + var js = jsStackTrace(); + if (Module["extraStackTrace"]) js += "\n" + Module["extraStackTrace"](); + return demangleAll(js); +} + +function unSign(value, bits) { + if (value >= 0) { + return value; + } + return bits <= 32 ? 2 * Math.abs(1 << bits - 1) + value : Math.pow(2, bits) + value; +} + +function ___assert_fail(condition, filename, line, func) { + abort("Assertion failed: " + UTF8ToString(condition) + ", at: " + [ filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function" ]); +} + +var PATH = { + splitPath: function(filename) { + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: function(parts, allowAboveRoot) { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (;up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: function(path) { + var isAbsolute = path.charAt(0) === "/", trailingSlash = path.substr(-1) === "/"; + path = PATH.normalizeArray(path.split("/").filter(function(p) { + return !!p; + }), !isAbsolute).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: function(path) { + var result = PATH.splitPath(path), root = result[0], dir = result[1]; + if (!root && !dir) { + return "."; + } + if (dir) { + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename: function(path) { + if (path === "/") return "/"; + path = PATH.normalize(path); + path = path.replace(/\/$/, ""); + var lastSlash = path.lastIndexOf("/"); + if (lastSlash === -1) return path; + return path.substr(lastSlash + 1); + }, + extname: function(path) { + return PATH.splitPath(path)[3]; + }, + join: function() { + var paths = Array.prototype.slice.call(arguments, 0); + return PATH.normalize(paths.join("/")); + }, + join2: function(l, r) { + return PATH.normalize(l + "/" + r); + } +}; + +function getRandomDevice() { + if (typeof crypto == "object" && typeof crypto["getRandomValues"] == "function") { + var randomBuffer = new Uint8Array(1); + return function() { + crypto.getRandomValues(randomBuffer); + return randomBuffer[0]; + }; + } else if (ENVIRONMENT_IS_NODE) { + try { + var crypto_module = require("crypto"); + return function() { + return crypto_module["randomBytes"](1)[0]; + }; + } catch (e) {} + } + return function() { + abort("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };"); + }; +} + +var PATH_FS = { + resolve: function() { + var resolvedPath = "", resolvedAbsolute = false; + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? arguments[i] : FS.cwd(); + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = path.charAt(0) === "/"; + } + resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter(function(p) { + return !!p; + }), !resolvedAbsolute).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; + }, + relative: function(from, to) { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (;start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (;end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + } +}; + +var TTY = { + ttys: [], + init: function() {}, + shutdown: function() {}, + register: function(dev, ops) { + TTY.ttys[dev] = { + input: [], + output: [], + ops: ops + }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open: function(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close: function(stream) { + stream.tty.ops.flush(stream.tty); + }, + flush: function(stream) { + stream.tty.ops.flush(stream.tty); + }, + read: function(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: function(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + } + }, + default_tty_ops: { + get_char: function(tty) { + if (!tty.input.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + try { + bytesRead = fs.readSync(process.stdin.fd, buf, 0, BUFSIZE, -1); + } catch (e) { + if (e.toString().includes("EOF")) bytesRead = 0; else throw e; + } + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString("utf-8"); + } else { + result = null; + } + } else if (typeof window != "undefined" && typeof window.prompt == "function") { + result = window.prompt("Input: "); + if (result !== null) { + result += "\n"; + } + } else if (typeof readline == "function") { + result = readline(); + if (result !== null) { + result += "\n"; + } + } + if (!result) { + return null; + } + tty.input = intArrayFromString(result, true); + } + return tty.input.shift(); + }, + put_char: function(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function(tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + } + }, + default_tty1_ops: { + put_char: function(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function(tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + } + } +}; + +function zeroMemory(address, size) { + HEAPU8.fill(0, address, address + size); +} + +function alignMemory(size, alignment) { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; +} + +function mmapAlloc(size) { + abort("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported"); +} + +var MEMFS = { + ops_table: null, + mount: function(mount) { + return MEMFS.createNode(null, "/", 16384 | 511, 0); + }, + createNode: function(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + if (!MEMFS.ops_table) { + MEMFS.ops_table = { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink + }, + stream: { + llseek: MEMFS.stream_ops.llseek + } + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync + } + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink + }, + stream: {} + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: FS.chrdev_stream_ops + } + }; + } + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray: function(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage: function(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max(newCapacity, prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125) >>> 0); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage: function(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes))); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr: function(node) { + var attr = {}; + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr: function(node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup: function(parent, name) { + throw FS.genericErrors[44]; + }, + mknod: function(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename: function(old_node, new_dir, new_name) { + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now(); + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + old_node.parent = new_dir; + }, + unlink: function(parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir: function(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir: function(node) { + var entries = [ ".", ".." ]; + for (var key in node.contents) { + if (!node.contents.hasOwnProperty(key)) { + continue; + } + entries.push(key); + } + return entries; + }, + symlink: function(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink: function(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + } + }, + stream_ops: { + read: function(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i]; + } + return size; + }, + write: function(stream, buffer, offset, length, position, canOwn) { + assert(!(buffer instanceof ArrayBuffer)); + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + assert(position === 0, "canOwn must imply no weird position inside the file"); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set(buffer.subarray(offset, offset + length), position); + return length; + } + } + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set(buffer.subarray(offset, offset + length), position); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek: function(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate: function(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length); + }, + mmap: function(stream, address, length, position, prot, flags) { + if (address !== 0) { + throw new FS.ErrnoError(28); + } + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + if (!(flags & 2) && contents.buffer === buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call(contents, position, position + length); + } + } + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + HEAP8.set(contents, ptr); + } + return { + ptr: ptr, + allocated: allocated + }; + }, + msync: function(stream, buffer, offset, length, mmapFlags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (mmapFlags & 2) { + return 0; + } + var bytesWritten = MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + return 0; + } + } +}; + +function asyncLoad(url, onload, onerror, noRunDep) { + var dep = !noRunDep ? getUniqueRunDependency("al " + url) : ""; + readAsync(url, function(arrayBuffer) { + assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).'); + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, function(event) { + if (onerror) { + onerror(); + } else { + throw 'Loading data file "' + url + '" failed.'; + } + }); + if (dep) addRunDependency(dep); +} + +var ERRNO_MESSAGES = { + 0: "Success", + 1: "Arg list too long", + 2: "Permission denied", + 3: "Address already in use", + 4: "Address not available", + 5: "Address family not supported by protocol family", + 6: "No more processes", + 7: "Socket already connected", + 8: "Bad file number", + 9: "Trying to read unreadable message", + 10: "Mount device busy", + 11: "Operation canceled", + 12: "No children", + 13: "Connection aborted", + 14: "Connection refused", + 15: "Connection reset by peer", + 16: "File locking deadlock error", + 17: "Destination address required", + 18: "Math arg out of domain of func", + 19: "Quota exceeded", + 20: "File exists", + 21: "Bad address", + 22: "File too large", + 23: "Host is unreachable", + 24: "Identifier removed", + 25: "Illegal byte sequence", + 26: "Connection already in progress", + 27: "Interrupted system call", + 28: "Invalid argument", + 29: "I/O error", + 30: "Socket is already connected", + 31: "Is a directory", + 32: "Too many symbolic links", + 33: "Too many open files", + 34: "Too many links", + 35: "Message too long", + 36: "Multihop attempted", + 37: "File or path name too long", + 38: "Network interface is not configured", + 39: "Connection reset by network", + 40: "Network is unreachable", + 41: "Too many open files in system", + 42: "No buffer space available", + 43: "No such device", + 44: "No such file or directory", + 45: "Exec format error", + 46: "No record locks available", + 47: "The link has been severed", + 48: "Not enough core", + 49: "No message of desired type", + 50: "Protocol not available", + 51: "No space left on device", + 52: "Function not implemented", + 53: "Socket is not connected", + 54: "Not a directory", + 55: "Directory not empty", + 56: "State not recoverable", + 57: "Socket operation on non-socket", + 59: "Not a typewriter", + 60: "No such device or address", + 61: "Value too large for defined data type", + 62: "Previous owner died", + 63: "Not super-user", + 64: "Broken pipe", + 65: "Protocol error", + 66: "Unknown protocol", + 67: "Protocol wrong type for socket", + 68: "Math result not representable", + 69: "Read only file system", + 70: "Illegal seek", + 71: "No such process", + 72: "Stale file handle", + 73: "Connection timed out", + 74: "Text file busy", + 75: "Cross-device link", + 100: "Device not a stream", + 101: "Bad font file fmt", + 102: "Invalid slot", + 103: "Invalid request code", + 104: "No anode", + 105: "Block device required", + 106: "Channel number out of range", + 107: "Level 3 halted", + 108: "Level 3 reset", + 109: "Link number out of range", + 110: "Protocol driver not attached", + 111: "No CSI structure available", + 112: "Level 2 halted", + 113: "Invalid exchange", + 114: "Invalid request descriptor", + 115: "Exchange full", + 116: "No data (for no delay io)", + 117: "Timer expired", + 118: "Out of streams resources", + 119: "Machine is not on the network", + 120: "Package not installed", + 121: "The object is remote", + 122: "Advertise error", + 123: "Srmount error", + 124: "Communication error on send", + 125: "Cross mount point (not really error)", + 126: "Given log. name not unique", + 127: "f.d. invalid for this operation", + 128: "Remote address changed", + 129: "Can access a needed shared lib", + 130: "Accessing a corrupted shared lib", + 131: ".lib section in a.out corrupted", + 132: "Attempting to link in too many libs", + 133: "Attempting to exec a shared library", + 135: "Streams pipe error", + 136: "Too many users", + 137: "Socket type not supported", + 138: "Not supported", + 139: "Protocol family not supported", + 140: "Can't send after socket shutdown", + 141: "Too many references", + 142: "Host is down", + 148: "No medium (in tape drive)", + 156: "Level 2 not synchronized" +}; + +var ERRNO_CODES = {}; + +var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: null, + genericErrors: {}, + filesystems: null, + syncFSRequests: 0, + lookupPath: (path, opts = {}) => { + path = PATH_FS.resolve(FS.cwd(), path); + if (!path) return { + path: "", + node: null + }; + var defaults = { + follow_mount: true, + recurse_count: 0 + }; + for (var key in defaults) { + if (opts[key] === undefined) { + opts[key] = defaults[key]; + } + } + if (opts.recurse_count > 8) { + throw new FS.ErrnoError(32); + } + var parts = PATH.normalizeArray(path.split("/").filter(p => !!p), false); + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + if (FS.isMountpoint(current)) { + if (!islast || islast && opts.follow_mount) { + current = current.mounted.root; + } + } + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve(PATH.dirname(current_path), link); + var lookup = FS.lookupPath(current_path, { + recurse_count: opts.recurse_count + }); + current = lookup.node; + if (count++ > 40) { + throw new FS.ErrnoError(32); + } + } + } + } + return { + path: current_path, + node: current + }; + }, + getPath: node => { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" ? mount + "/" + path : mount + path; + } + path = path ? node.name + "/" + path : node.name; + node = node.parent; + } + }, + hashName: (parentid, name) => { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = (hash << 5) - hash + name.charCodeAt(i) | 0; + } + return (parentid + hash >>> 0) % FS.nameTable.length; + }, + hashAddNode: node => { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode: node => { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode: (parent, name) => { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode, parent); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + return FS.lookup(parent, name); + }, + createNode: (parent, name, mode, rdev) => { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode: node => { + FS.hashRemoveNode(node); + }, + isRoot: node => { + return node === node.parent; + }, + isMountpoint: node => { + return !!node.mounted; + }, + isFile: mode => { + return (mode & 61440) === 32768; + }, + isDir: mode => { + return (mode & 61440) === 16384; + }, + isLink: mode => { + return (mode & 61440) === 40960; + }, + isChrdev: mode => { + return (mode & 61440) === 8192; + }, + isBlkdev: mode => { + return (mode & 61440) === 24576; + }, + isFIFO: mode => { + return (mode & 61440) === 4096; + }, + isSocket: mode => { + return (mode & 49152) === 49152; + }, + flagModes: { + "r": 0, + "r+": 2, + "w": 577, + "w+": 578, + "a": 1089, + "a+": 1090 + }, + modeStringToFlags: str => { + var flags = FS.flagModes[str]; + if (typeof flags == "undefined") { + throw new Error("Unknown file open mode: " + str); + } + return flags; + }, + flagsToPermissionString: flag => { + var perms = [ "r", "w", "rw" ][flag & 3]; + if (flag & 512) { + perms += "w"; + } + return perms; + }, + nodePermissions: (node, perms) => { + if (FS.ignorePermissions) { + return 0; + } + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup: dir => { + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate: (dir, name) => { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete: (dir, name, isdir) => { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen: (node, flags) => { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || flags & 512) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS: 4096, + nextfd: (fd_start = 0, fd_end = FS.MAX_OPEN_FDS) => { + for (var fd = fd_start; fd <= fd_end; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStream: fd => FS.streams[fd], + createStream: (stream, fd_start, fd_end) => { + if (!FS.FSStream) { + FS.FSStream = function() {}; + FS.FSStream.prototype = { + object: { + get: function() { + return this.node; + }, + set: function(val) { + this.node = val; + } + }, + isRead: { + get: function() { + return (this.flags & 2097155) !== 1; + } + }, + isWrite: { + get: function() { + return (this.flags & 2097155) !== 0; + } + }, + isAppend: { + get: function() { + return this.flags & 1024; + } + } + }; + } + stream = Object.assign(new FS.FSStream(), stream); + var fd = FS.nextfd(fd_start, fd_end); + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream: fd => { + FS.streams[fd] = null; + }, + chrdev_stream_ops: { + open: stream => { + var device = FS.getDevice(stream.node.rdev); + stream.stream_ops = device.stream_ops; + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + }, + llseek: () => { + throw new FS.ErrnoError(70); + } + }, + major: dev => dev >> 8, + minor: dev => dev & 255, + makedev: (ma, mi) => ma << 8 | mi, + registerDevice: (dev, ops) => { + FS.devices[dev] = { + stream_ops: ops + }; + }, + getDevice: dev => FS.devices[dev], + getMounts: mount => { + var mounts = []; + var check = [ mount ]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push.apply(check, m.mounts); + } + return mounts; + }, + syncfs: (populate, callback) => { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err("warning: " + FS.syncFSRequests + " FS.syncfs operations in flight at once, probably just doing extra work"); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + mounts.forEach(mount => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount: (type, opts, mountpoint) => { + if (typeof type == "string") { + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + mountpoint = lookup.path; + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type: type, + opts: opts, + mountpoint: mountpoint, + mounts: [] + }; + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount: mountpoint => { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach(hash => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + node.mounted = null; + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup: (parent, name) => { + return parent.node_ops.lookup(parent, name); + }, + mknod: (path, mode, dev) => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === "." || name === "..") { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create: (path, mode) => { + mode = mode !== undefined ? mode : 438; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir: (path, mode) => { + mode = mode !== undefined ? mode : 511; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree: (path, mode) => { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev: (path, mode, dev) => { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink: (oldpath, newpath) => { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename: (old_path, new_path) => { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + var lookup, old_dir, new_dir; + lookup = FS.lookupPath(old_path, { + parent: true + }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { + parent: true + }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + var old_node = FS.lookupNode(old_dir, old_name); + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (old_node === new_node) { + return; + } + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(old_node) || new_node && FS.isMountpoint(new_node)) { + throw new FS.ErrnoError(10); + } + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + FS.hashRemoveNode(old_node); + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir: path => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir: path => { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink: path => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink: path => { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve(FS.getPath(link.parent), link.node_ops.readlink(link)); + }, + stat: (path, dontFollow) => { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat: path => { + return FS.stat(path, true); + }, + chmod: (path, mode, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: mode & 4095 | node.mode & ~4095, + timestamp: Date.now() + }); + }, + lchmod: (path, mode) => { + FS.chmod(path, mode, true); + }, + fchmod: (fd, mode) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chmod(stream.node, mode); + }, + chown: (path, uid, gid, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + timestamp: Date.now() + }); + }, + lchown: (path, uid, gid) => { + FS.chown(path, uid, gid, true); + }, + fchown: (fd, uid, gid) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chown(stream.node, uid, gid); + }, + truncate: (path, len) => { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: true + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { + size: len, + timestamp: Date.now() + }); + }, + ftruncate: (fd, len) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime: (path, atime, mtime) => { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + node.node_ops.setattr(node, { + timestamp: Math.max(atime, mtime) + }); + }, + open: (path, flags, mode, fd_start, fd_end) => { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS.modeStringToFlags(flags) : flags; + mode = typeof mode == "undefined" ? 438 : mode; + if (flags & 64) { + mode = mode & 4095 | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == "object") { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072) + }); + node = lookup.node; + } catch (e) {} + } + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else { + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + if (flags & 512) { + FS.truncate(node, 0); + } + flags &= ~(128 | 512 | 131072); + var stream = FS.createStream({ + node: node, + path: FS.getPath(node), + flags: flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + ungotten: [], + error: false + }, fd_start, fd_end); + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!FS.readFiles) FS.readFiles = {}; + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close: stream => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed: stream => { + return stream.fd === null; + }, + llseek: (stream, offset, whence) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read: (stream, buffer, offset, length, position) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write: (stream, buffer, offset, length, position, canOwn) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate: (stream, offset, length) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap: (stream, address, length, position, prot, flags) => { + if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + return stream.stream_ops.mmap(stream, address, length, position, prot, flags); + }, + msync: (stream, buffer, offset, length, mmapFlags) => { + if (!stream || !stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags); + }, + munmap: stream => 0, + ioctl: (stream, cmd, arg) => { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile: (path, opts = {}) => { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error('Invalid encoding type "' + opts.encoding + '"'); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf, 0); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile: (path, data, opts = {}) => { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir: path => { + var lookup = FS.lookupPath(path, { + follow: true + }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories: () => { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices: () => { + FS.mkdir("/dev"); + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + var random_device = getRandomDevice(); + FS.createDevice("/dev", "random", random_device); + FS.createDevice("/dev", "urandom", random_device); + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories: () => { + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount({ + mount: () => { + var node = FS.createNode(proc_self, "fd", 16384 | 511, 73); + node.node_ops = { + lookup: (parent, name) => { + var fd = +name; + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + var ret = { + parent: null, + mount: { + mountpoint: "fake" + }, + node_ops: { + readlink: () => stream.path + } + }; + ret.parent = ret; + return ret; + } + }; + return node; + } + }, {}, "/proc/self/fd"); + }, + createStandardStreams: () => { + if (Module["stdin"]) { + FS.createDevice("/dev", "stdin", Module["stdin"]); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (Module["stdout"]) { + FS.createDevice("/dev", "stdout", null, Module["stdout"]); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (Module["stderr"]) { + FS.createDevice("/dev", "stderr", null, Module["stderr"]); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, "invalid handle for stdin (" + stdin.fd + ")"); + assert(stdout.fd === 1, "invalid handle for stdout (" + stdout.fd + ")"); + assert(stderr.fd === 2, "invalid handle for stderr (" + stderr.fd + ")"); + }, + ensureErrnoError: () => { + if (FS.ErrnoError) return; + FS.ErrnoError = function ErrnoError(errno, node) { + this.node = node; + this.setErrno = function(errno) { + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + }; + this.setErrno(errno); + this.message = ERRNO_MESSAGES[errno]; + if (this.stack) { + Object.defineProperty(this, "stack", { + value: new Error().stack, + writable: true + }); + this.stack = demangleAll(this.stack); + } + }; + FS.ErrnoError.prototype = new Error(); + FS.ErrnoError.prototype.constructor = FS.ErrnoError; + [ 44 ].forEach(code => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ""; + }); + }, + staticInit: () => { + FS.ensureErrnoError(); + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { + "MEMFS": MEMFS + }; + }, + init: (input, output, error) => { + assert(!FS.init.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"); + FS.init.initialized = true; + FS.ensureErrnoError(); + Module["stdin"] = input || Module["stdin"]; + Module["stdout"] = output || Module["stdout"]; + Module["stderr"] = error || Module["stderr"]; + FS.createStandardStreams(); + }, + quit: () => { + FS.init.initialized = false; + ___stdio_exit(); + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + getMode: (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }, + findObject: (path, dontResolveLastLink) => { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (ret.exists) { + return ret.object; + } else { + return null; + } + }, + analyzePath: (path, dontResolveLastLink) => { + try { + var lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null + }; + try { + var lookup = FS.lookupPath(path, { + parent: true + }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath: (parent, path, canRead, canWrite) => { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile: (parent, name, properties, canRead, canWrite) => { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS.getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile: (parent, name, data, canRead, canWrite, canOwn) => { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS.getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i); + data = arr; + } + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + return node; + }, + createDevice: (parent, name, input, output) => { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS.getMode(!!input, !!output); + if (!FS.createDevice.major) FS.createDevice.major = 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + FS.registerDevice(dev, { + open: stream => { + stream.seekable = false; + }, + close: stream => { + if (output && output.buffer && output.buffer.length) { + output(10); + } + }, + read: (stream, buffer, offset, length, pos) => { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: (stream, buffer, offset, length, pos) => { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + } + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile: obj => { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."); + } else if (read_) { + try { + obj.contents = intArrayFromString(read_(obj.url), true); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } else { + throw new Error("Cannot load without read() or XMLHttpRequest."); + } + }, + createLazyFile: (parent, name, url, canRead, canWrite) => { + function LazyUint8Array() { + this.lengthKnown = false; + this.chunks = []; + } + LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = idx / this.chunkSize | 0; + return this.getter(chunkNum)[chunkOffset]; + }; + LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) { + this.getter = getter; + }; + LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open("HEAD", url, false); + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; + var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip"; + var chunkSize = 1024 * 1024; + if (!hasByteServing) chunkSize = datalength; + var doXHR = (from, to) => { + if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); + if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!"); + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } else { + return intArrayFromString(xhr.responseText || "", true); + } + }; + var lazyArray = this; + lazyArray.setDataGetter(chunkNum => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out("LazyFiles on gzip forces download of the whole file when length is accessed"); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + }; + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array(); + Object.defineProperties(lazyArray, { + length: { + get: function() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + }, + chunkSize: { + get: function() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + }); + var properties = { + isDevice: false, + contents: lazyArray + }; + } else { + var properties = { + isDevice: false, + url: url + }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + Object.defineProperties(node, { + usedBytes: { + get: function() { + return this.contents.length; + } + } + }); + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach(key => { + var fn = node.stream_ops[key]; + stream_ops[key] = function forceLoadLazyFile() { + FS.forceLoadFile(node); + return fn.apply(null, arguments); + }; + }); + stream_ops.read = ((stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + }); + node.stream_ops = stream_ops; + return node; + }, + createPreloadedFile: (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency("cp " + fullname); + function processData(byteArray) { + function finish(byteArray) { + if (preFinish) preFinish(); + if (!dontCreateFile) { + FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn); + } + if (onload) onload(); + removeRunDependency(dep); + } + if (Browser.handledByPreloadPlugin(byteArray, fullname, finish, () => { + if (onerror) onerror(); + removeRunDependency(dep); + })) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url, byteArray => processData(byteArray), onerror); + } else { + processData(url); + } + }, + indexedDB: () => { + return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; + }, + DB_NAME: () => { + return "EM_FS_" + window.location.pathname; + }, + DB_VERSION: 20, + DB_STORE_NAME: "FILE_DATA", + saveFilesToDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = (() => { + out("creating db"); + var db = openRequest.result; + db.createObjectStore(FS.DB_STORE_NAME); + }); + openRequest.onsuccess = (() => { + var db = openRequest.result; + var transaction = db.transaction([ FS.DB_STORE_NAME ], "readwrite"); + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, fail = 0, total = paths.length; + function finish() { + if (fail == 0) onload(); else onerror(); + } + paths.forEach(path => { + var putRequest = files.put(FS.analyzePath(path).object.contents, path); + putRequest.onsuccess = (() => { + ok++; + if (ok + fail == total) finish(); + }); + putRequest.onerror = (() => { + fail++; + if (ok + fail == total) finish(); + }); + }); + transaction.onerror = onerror; + }); + openRequest.onerror = onerror; + }, + loadFilesFromDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = onerror; + openRequest.onsuccess = (() => { + var db = openRequest.result; + try { + var transaction = db.transaction([ FS.DB_STORE_NAME ], "readonly"); + } catch (e) { + onerror(e); + return; + } + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, fail = 0, total = paths.length; + function finish() { + if (fail == 0) onload(); else onerror(); + } + paths.forEach(path => { + var getRequest = files.get(path); + getRequest.onsuccess = (() => { + if (FS.analyzePath(path).exists) { + FS.unlink(path); + } + FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true); + ok++; + if (ok + fail == total) finish(); + }); + getRequest.onerror = (() => { + fail++; + if (ok + fail == total) finish(); + }); + }); + transaction.onerror = onerror; + }); + openRequest.onerror = onerror; + }, + absolutePath: () => { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder: () => { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink: () => { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath: () => { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc: () => { + abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc"); + }, + standardizePath: () => { + abort("FS.standardizePath has been removed; use PATH.normalize instead"); + } +}; + +var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt: function(dirfd, path, allowEmpty) { + if (path[0] === "/") { + return path; + } + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = FS.getStream(dirfd); + if (!dirstream) throw new FS.ErrnoError(8); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat: function(func, path, buf) { + try { + var stat = func(path); + } catch (e) { + if (e && e.node && PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node))) { + return -54; + } + throw e; + } + SAFE_HEAP_STORE(buf | 0, stat.dev | 0, 4); + SAFE_HEAP_STORE(buf + 4 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 8 | 0, stat.ino | 0, 4); + SAFE_HEAP_STORE(buf + 12 | 0, stat.mode | 0, 4); + SAFE_HEAP_STORE(buf + 16 | 0, stat.nlink | 0, 4); + SAFE_HEAP_STORE(buf + 20 | 0, stat.uid | 0, 4); + SAFE_HEAP_STORE(buf + 24 | 0, stat.gid | 0, 4); + SAFE_HEAP_STORE(buf + 28 | 0, stat.rdev | 0, 4); + SAFE_HEAP_STORE(buf + 32 | 0, 0 | 0, 4); + tempI64 = [ stat.size >>> 0, (tempDouble = stat.size, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(buf + 40 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(buf + 44 | 0, tempI64[1] | 0, 4); + SAFE_HEAP_STORE(buf + 48 | 0, 4096 | 0, 4); + SAFE_HEAP_STORE(buf + 52 | 0, stat.blocks | 0, 4); + SAFE_HEAP_STORE(buf + 56 | 0, stat.atime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 60 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 64 | 0, stat.mtime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 68 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 72 | 0, stat.ctime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 76 | 0, 0 | 0, 4); + tempI64 = [ stat.ino >>> 0, (tempDouble = stat.ino, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(buf + 80 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(buf + 84 | 0, tempI64[1] | 0, 4); + return 0; + }, + doMsync: function(addr, stream, len, flags, offset) { + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + doMkdir: function(path, mode) { + path = PATH.normalize(path); + if (path[path.length - 1] === "/") path = path.substr(0, path.length - 1); + FS.mkdir(path, mode, 0); + return 0; + }, + doMknod: function(path, mode, dev) { + switch (mode & 61440) { + case 32768: + case 8192: + case 24576: + case 4096: + case 49152: + break; + + default: + return -28; + } + FS.mknod(path, mode, dev); + return 0; + }, + doReadlink: function(path, buf, bufsize) { + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = SAFE_HEAP_LOAD(buf + len, 1, 0); + stringToUTF8(ret, buf, bufsize + 1); + SAFE_HEAP_STORE(buf + len, endChar, 1); + return len; + }, + doAccess: function(path, amode) { + if (amode & ~7) { + return -28; + } + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ""; + if (amode & 4) perms += "r"; + if (amode & 2) perms += "w"; + if (amode & 1) perms += "x"; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + }, + doDup: function(path, flags, suggestFD) { + var suggest = FS.getStream(suggestFD); + if (suggest) FS.close(suggest); + return FS.open(path, flags, 0, suggestFD, suggestFD).fd; + }, + doReadv: function(stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = SAFE_HEAP_LOAD(iov + i * 8 | 0, 4, 0) | 0; + var len = SAFE_HEAP_LOAD(iov + (i * 8 + 4) | 0, 4, 0) | 0; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + } + return ret; + }, + doWritev: function(stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = SAFE_HEAP_LOAD(iov + i * 8 | 0, 4, 0) | 0; + var len = SAFE_HEAP_LOAD(iov + (i * 8 + 4) | 0, 4, 0) | 0; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + } + return ret; + }, + varargs: undefined, + get: function() { + assert(SYSCALLS.varargs != undefined); + SYSCALLS.varargs += 4; + var ret = SAFE_HEAP_LOAD(SYSCALLS.varargs - 4 | 0, 4, 0) | 0; + return ret; + }, + getStr: function(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + getStreamFromFD: function(fd) { + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + return stream; + }, + get64: function(low, high) { + if (low >= 0) assert(high === 0); else assert(high === -1); + return low; + } +}; + +function ___syscall_chmod(path, mode) { + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function setErrNo(value) { + SAFE_HEAP_STORE(___errno_location() | 0, value | 0, 4); + return value; +} + +function ___syscall_fcntl64(fd, cmd, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: + { + var arg = SYSCALLS.get(); + if (arg < 0) { + return -28; + } + var newStream; + newStream = FS.open(stream.path, stream.flags, 0, arg); + return newStream.fd; + } + + case 1: + case 2: + return 0; + + case 3: + return stream.flags; + + case 4: + { + var arg = SYSCALLS.get(); + stream.flags |= arg; + return 0; + } + + case 5: + { + var arg = SYSCALLS.get(); + var offset = 0; + SAFE_HEAP_STORE(arg + offset | 0, 2 | 0, 2); + return 0; + } + + case 6: + case 7: + return 0; + + case 16: + case 8: + return -28; + + case 9: + setErrNo(28); + return -1; + + default: + { + return -28; + } + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fstat64(fd, buf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fstatat64(dirfd, path, buf, flags) { + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & ~4352; + assert(!flags, flags); + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_getcwd(buf, size) { + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd); + if (size < cwdLengthInBytes + 1) return -68; + stringToUTF8(cwd, buf, size); + return buf; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_getegid32() { + return 0; +} + +function ___syscall_getgid32() { + return ___syscall_getegid32(); +} + +function ___syscall_getuid32() { + return ___syscall_getegid32(); +} + +function ___syscall_ioctl(fd, op, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: + case 21505: + { + if (!stream.tty) return -59; + return 0; + } + + case 21510: + case 21511: + case 21512: + case 21506: + case 21507: + case 21508: + { + if (!stream.tty) return -59; + return 0; + } + + case 21519: + { + if (!stream.tty) return -59; + var argp = SYSCALLS.get(); + SAFE_HEAP_STORE(argp | 0, 0 | 0, 4); + return 0; + } + + case 21520: + { + if (!stream.tty) return -59; + return -28; + } + + case 21531: + { + var argp = SYSCALLS.get(); + return FS.ioctl(stream, op, argp); + } + + case 21523: + { + if (!stream.tty) return -59; + return 0; + } + + case 21524: + { + if (!stream.tty) return -59; + return 0; + } + + default: + abort("bad ioctl syscall " + op); + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_lstat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.lstat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_open(path, flags, varargs) { + SYSCALLS.varargs = varargs; + try { + var pathname = SYSCALLS.getStr(path); + var mode = varargs ? SYSCALLS.get() : 0; + var stream = FS.open(pathname, flags, mode); + return stream.fd; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_readlink(path, buf, bufsize) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doReadlink(path, buf, bufsize); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_stat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_unlink(path) { + try { + path = SYSCALLS.getStr(path); + FS.unlink(path); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function __localtime_js(time, tmPtr) { + var date = new Date((SAFE_HEAP_LOAD(time | 0, 4, 0) | 0) * 1e3); + SAFE_HEAP_STORE(tmPtr | 0, date.getSeconds() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 4 | 0, date.getMinutes() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 8 | 0, date.getHours() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 12 | 0, date.getDate() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 16 | 0, date.getMonth() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 20 | 0, date.getFullYear() - 1900 | 0, 4); + SAFE_HEAP_STORE(tmPtr + 24 | 0, date.getDay() | 0, 4); + var start = new Date(date.getFullYear(), 0, 1); + var yday = (date.getTime() - start.getTime()) / (1e3 * 60 * 60 * 24) | 0; + SAFE_HEAP_STORE(tmPtr + 28 | 0, yday | 0, 4); + SAFE_HEAP_STORE(tmPtr + 36 | 0, -(date.getTimezoneOffset() * 60) | 0, 4); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + SAFE_HEAP_STORE(tmPtr + 32 | 0, dst | 0, 4); +} + +function _tzset_impl(timezone, daylight, tzname) { + var currentYear = new Date().getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + SAFE_HEAP_STORE(timezone | 0, stdTimezoneOffset * 60 | 0, 4); + SAFE_HEAP_STORE(daylight | 0, Number(winterOffset != summerOffset) | 0, 4); + function extractZone(date) { + var match = date.toTimeString().match(/\(([A-Za-z ]+)\)$/); + return match ? match[1] : "GMT"; + } + var winterName = extractZone(winter); + var summerName = extractZone(summer); + var winterNamePtr = allocateUTF8(winterName); + var summerNamePtr = allocateUTF8(summerName); + if (summerOffset < winterOffset) { + SAFE_HEAP_STORE(tzname | 0, winterNamePtr | 0, 4); + SAFE_HEAP_STORE(tzname + 4 | 0, summerNamePtr | 0, 4); + } else { + SAFE_HEAP_STORE(tzname | 0, summerNamePtr | 0, 4); + SAFE_HEAP_STORE(tzname + 4 | 0, winterNamePtr | 0, 4); + } +} + +function __tzset_js(timezone, daylight, tzname) { + if (__tzset_js.called) return; + __tzset_js.called = true; + _tzset_impl(timezone, daylight, tzname); +} + +function _abort() { + abort("native code called abort()"); +} + +function _emscripten_console_error(str) { + assert(typeof str == "number"); + console.error(UTF8ToString(str)); +} + +function _emscripten_memcpy_big(dest, src, num) { + HEAPU8.copyWithin(dest, src, src + num); +} + +function _emscripten_get_heap_max() { + return 2147483648; +} + +function emscripten_realloc_buffer(size) { + try { + wasmMemory.grow(size - buffer.byteLength + 65535 >>> 16); + updateGlobalBufferAndViews(wasmMemory.buffer); + return 1; + } catch (e) { + err("emscripten_realloc_buffer: Attempted to grow heap from " + buffer.byteLength + " bytes to " + size + " bytes, but got error: " + e); + } +} + +function _emscripten_resize_heap(requestedSize) { + var oldSize = HEAPU8.length; + requestedSize = requestedSize >>> 0; + assert(requestedSize > oldSize); + var maxHeapSize = _emscripten_get_heap_max(); + if (requestedSize > maxHeapSize) { + err("Cannot enlarge memory, asked to go up to " + requestedSize + " bytes, but the limit is " + maxHeapSize + " bytes!"); + return false; + } + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + .2 / cutDown); + overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); + var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536)); + var replacement = emscripten_realloc_buffer(newSize); + if (replacement) { + return true; + } + } + err("Failed to grow the heap from " + oldSize + " bytes to " + newSize + " bytes, not enough memory!"); + return false; +} + +var ENV = {}; + +function getExecutableName() { + return thisProgram || "./this.program"; +} + +function getEnvStrings() { + if (!getEnvStrings.strings) { + var lang = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8"; + var env = { + "USER": "web_user", + "LOGNAME": "web_user", + "PATH": "/", + "PWD": "/", + "HOME": "/home/web_user", + "LANG": lang, + "_": getExecutableName() + }; + for (var x in ENV) { + if (ENV[x] === undefined) delete env[x]; else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(x + "=" + env[x]); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; +} + +function _environ_get(__environ, environ_buf) { + var bufSize = 0; + getEnvStrings().forEach(function(string, i) { + var ptr = environ_buf + bufSize; + SAFE_HEAP_STORE(__environ + i * 4 | 0, ptr | 0, 4); + writeAsciiToMemory(string, ptr); + bufSize += string.length + 1; + }); + return 0; +} + +function _environ_sizes_get(penviron_count, penviron_buf_size) { + var strings = getEnvStrings(); + SAFE_HEAP_STORE(penviron_count | 0, strings.length | 0, 4); + var bufSize = 0; + strings.forEach(function(string) { + bufSize += string.length + 1; + }); + SAFE_HEAP_STORE(penviron_buf_size | 0, bufSize | 0, 4); + return 0; +} + +function _exit(status) { + exit(status); +} + +function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_read(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doReadv(stream, iov, iovcnt); + SAFE_HEAP_STORE(pnum | 0, num | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_seek(fd, offset_low, offset_high, whence, newOffset) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var HIGH_OFFSET = 4294967296; + var offset = offset_high * HIGH_OFFSET + (offset_low >>> 0); + var DOUBLE_LIMIT = 9007199254740992; + if (offset <= -DOUBLE_LIMIT || offset >= DOUBLE_LIMIT) { + return -61; + } + FS.llseek(stream, offset, whence); + tempI64 = [ stream.position >>> 0, (tempDouble = stream.position, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(newOffset | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(newOffset + 4 | 0, tempI64[1] | 0, 4); + if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_write(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doWritev(stream, iov, iovcnt); + SAFE_HEAP_STORE(pnum | 0, num | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _proc_exit(code) { + procExit(code); +} + +function _setTempRet0(val) { + setTempRet0(val); +} + +function __isLeapYear(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); +} + +function __arraySum(array, index) { + var sum = 0; + for (var i = 0; i <= index; sum += array[i++]) {} + return sum; +} + +var __MONTH_DAYS_LEAP = [ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]; + +var __MONTH_DAYS_REGULAR = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]; + +function __addDays(date, days) { + var newDate = new Date(date.getTime()); + while (days > 0) { + var leap = __isLeapYear(newDate.getFullYear()); + var currentMonth = newDate.getMonth(); + var daysInCurrentMonth = (leap ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR)[currentMonth]; + if (days > daysInCurrentMonth - newDate.getDate()) { + days -= daysInCurrentMonth - newDate.getDate() + 1; + newDate.setDate(1); + if (currentMonth < 11) { + newDate.setMonth(currentMonth + 1); + } else { + newDate.setMonth(0); + newDate.setFullYear(newDate.getFullYear() + 1); + } + } else { + newDate.setDate(newDate.getDate() + days); + return newDate; + } + } + return newDate; +} + +function _strftime(s, maxsize, format, tm) { + var tm_zone = SAFE_HEAP_LOAD(tm + 40 | 0, 4, 0) | 0; + var date = { + tm_sec: SAFE_HEAP_LOAD(tm | 0, 4, 0) | 0, + tm_min: SAFE_HEAP_LOAD(tm + 4 | 0, 4, 0) | 0, + tm_hour: SAFE_HEAP_LOAD(tm + 8 | 0, 4, 0) | 0, + tm_mday: SAFE_HEAP_LOAD(tm + 12 | 0, 4, 0) | 0, + tm_mon: SAFE_HEAP_LOAD(tm + 16 | 0, 4, 0) | 0, + tm_year: SAFE_HEAP_LOAD(tm + 20 | 0, 4, 0) | 0, + tm_wday: SAFE_HEAP_LOAD(tm + 24 | 0, 4, 0) | 0, + tm_yday: SAFE_HEAP_LOAD(tm + 28 | 0, 4, 0) | 0, + tm_isdst: SAFE_HEAP_LOAD(tm + 32 | 0, 4, 0) | 0, + tm_gmtoff: SAFE_HEAP_LOAD(tm + 36 | 0, 4, 0) | 0, + tm_zone: tm_zone ? UTF8ToString(tm_zone) : "" + }; + var pattern = UTF8ToString(format); + var EXPANSION_RULES_1 = { + "%c": "%a %b %d %H:%M:%S %Y", + "%D": "%m/%d/%y", + "%F": "%Y-%m-%d", + "%h": "%b", + "%r": "%I:%M:%S %p", + "%R": "%H:%M", + "%T": "%H:%M:%S", + "%x": "%m/%d/%y", + "%X": "%H:%M:%S", + "%Ec": "%c", + "%EC": "%C", + "%Ex": "%m/%d/%y", + "%EX": "%H:%M:%S", + "%Ey": "%y", + "%EY": "%Y", + "%Od": "%d", + "%Oe": "%e", + "%OH": "%H", + "%OI": "%I", + "%Om": "%m", + "%OM": "%M", + "%OS": "%S", + "%Ou": "%u", + "%OU": "%U", + "%OV": "%V", + "%Ow": "%w", + "%OW": "%W", + "%Oy": "%y" + }; + for (var rule in EXPANSION_RULES_1) { + pattern = pattern.replace(new RegExp(rule, "g"), EXPANSION_RULES_1[rule]); + } + var WEEKDAYS = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ]; + var MONTHS = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; + function leadingSomething(value, digits, character) { + var str = typeof value == "number" ? value.toString() : value || ""; + while (str.length < digits) { + str = character[0] + str; + } + return str; + } + function leadingNulls(value, digits) { + return leadingSomething(value, digits, "0"); + } + function compareByDay(date1, date2) { + function sgn(value) { + return value < 0 ? -1 : value > 0 ? 1 : 0; + } + var compare; + if ((compare = sgn(date1.getFullYear() - date2.getFullYear())) === 0) { + if ((compare = sgn(date1.getMonth() - date2.getMonth())) === 0) { + compare = sgn(date1.getDate() - date2.getDate()); + } + } + return compare; + } + function getFirstWeekStartDate(janFourth) { + switch (janFourth.getDay()) { + case 0: + return new Date(janFourth.getFullYear() - 1, 11, 29); + + case 1: + return janFourth; + + case 2: + return new Date(janFourth.getFullYear(), 0, 3); + + case 3: + return new Date(janFourth.getFullYear(), 0, 2); + + case 4: + return new Date(janFourth.getFullYear(), 0, 1); + + case 5: + return new Date(janFourth.getFullYear() - 1, 11, 31); + + case 6: + return new Date(janFourth.getFullYear() - 1, 11, 30); + } + } + function getWeekBasedYear(date) { + var thisDate = __addDays(new Date(date.tm_year + 1900, 0, 1), date.tm_yday); + var janFourthThisYear = new Date(thisDate.getFullYear(), 0, 4); + var janFourthNextYear = new Date(thisDate.getFullYear() + 1, 0, 4); + var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear); + var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear); + if (compareByDay(firstWeekStartThisYear, thisDate) <= 0) { + if (compareByDay(firstWeekStartNextYear, thisDate) <= 0) { + return thisDate.getFullYear() + 1; + } else { + return thisDate.getFullYear(); + } + } else { + return thisDate.getFullYear() - 1; + } + } + var EXPANSION_RULES_2 = { + "%a": function(date) { + return WEEKDAYS[date.tm_wday].substring(0, 3); + }, + "%A": function(date) { + return WEEKDAYS[date.tm_wday]; + }, + "%b": function(date) { + return MONTHS[date.tm_mon].substring(0, 3); + }, + "%B": function(date) { + return MONTHS[date.tm_mon]; + }, + "%C": function(date) { + var year = date.tm_year + 1900; + return leadingNulls(year / 100 | 0, 2); + }, + "%d": function(date) { + return leadingNulls(date.tm_mday, 2); + }, + "%e": function(date) { + return leadingSomething(date.tm_mday, 2, " "); + }, + "%g": function(date) { + return getWeekBasedYear(date).toString().substring(2); + }, + "%G": function(date) { + return getWeekBasedYear(date); + }, + "%H": function(date) { + return leadingNulls(date.tm_hour, 2); + }, + "%I": function(date) { + var twelveHour = date.tm_hour; + if (twelveHour == 0) twelveHour = 12; else if (twelveHour > 12) twelveHour -= 12; + return leadingNulls(twelveHour, 2); + }, + "%j": function(date) { + return leadingNulls(date.tm_mday + __arraySum(__isLeapYear(date.tm_year + 1900) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, date.tm_mon - 1), 3); + }, + "%m": function(date) { + return leadingNulls(date.tm_mon + 1, 2); + }, + "%M": function(date) { + return leadingNulls(date.tm_min, 2); + }, + "%n": function() { + return "\n"; + }, + "%p": function(date) { + if (date.tm_hour >= 0 && date.tm_hour < 12) { + return "AM"; + } else { + return "PM"; + } + }, + "%S": function(date) { + return leadingNulls(date.tm_sec, 2); + }, + "%t": function() { + return "\t"; + }, + "%u": function(date) { + return date.tm_wday || 7; + }, + "%U": function(date) { + var janFirst = new Date(date.tm_year + 1900, 0, 1); + var firstSunday = janFirst.getDay() === 0 ? janFirst : __addDays(janFirst, 7 - janFirst.getDay()); + var endDate = new Date(date.tm_year + 1900, date.tm_mon, date.tm_mday); + if (compareByDay(firstSunday, endDate) < 0) { + var februaryFirstUntilEndMonth = __arraySum(__isLeapYear(endDate.getFullYear()) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, endDate.getMonth() - 1) - 31; + var firstSundayUntilEndJanuary = 31 - firstSunday.getDate(); + var days = firstSundayUntilEndJanuary + februaryFirstUntilEndMonth + endDate.getDate(); + return leadingNulls(Math.ceil(days / 7), 2); + } + return compareByDay(firstSunday, janFirst) === 0 ? "01" : "00"; + }, + "%V": function(date) { + var janFourthThisYear = new Date(date.tm_year + 1900, 0, 4); + var janFourthNextYear = new Date(date.tm_year + 1901, 0, 4); + var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear); + var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear); + var endDate = __addDays(new Date(date.tm_year + 1900, 0, 1), date.tm_yday); + if (compareByDay(endDate, firstWeekStartThisYear) < 0) { + return "53"; + } + if (compareByDay(firstWeekStartNextYear, endDate) <= 0) { + return "01"; + } + var daysDifference; + if (firstWeekStartThisYear.getFullYear() < date.tm_year + 1900) { + daysDifference = date.tm_yday + 32 - firstWeekStartThisYear.getDate(); + } else { + daysDifference = date.tm_yday + 1 - firstWeekStartThisYear.getDate(); + } + return leadingNulls(Math.ceil(daysDifference / 7), 2); + }, + "%w": function(date) { + return date.tm_wday; + }, + "%W": function(date) { + var janFirst = new Date(date.tm_year, 0, 1); + var firstMonday = janFirst.getDay() === 1 ? janFirst : __addDays(janFirst, janFirst.getDay() === 0 ? 1 : 7 - janFirst.getDay() + 1); + var endDate = new Date(date.tm_year + 1900, date.tm_mon, date.tm_mday); + if (compareByDay(firstMonday, endDate) < 0) { + var februaryFirstUntilEndMonth = __arraySum(__isLeapYear(endDate.getFullYear()) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, endDate.getMonth() - 1) - 31; + var firstMondayUntilEndJanuary = 31 - firstMonday.getDate(); + var days = firstMondayUntilEndJanuary + februaryFirstUntilEndMonth + endDate.getDate(); + return leadingNulls(Math.ceil(days / 7), 2); + } + return compareByDay(firstMonday, janFirst) === 0 ? "01" : "00"; + }, + "%y": function(date) { + return (date.tm_year + 1900).toString().substring(2); + }, + "%Y": function(date) { + return date.tm_year + 1900; + }, + "%z": function(date) { + var off = date.tm_gmtoff; + var ahead = off >= 0; + off = Math.abs(off) / 60; + off = off / 60 * 100 + off % 60; + return (ahead ? "+" : "-") + String("0000" + off).slice(-4); + }, + "%Z": function(date) { + return date.tm_zone; + }, + "%%": function() { + return "%"; + } + }; + pattern = pattern.replace(/%%/g, "\0\0"); + for (var rule in EXPANSION_RULES_2) { + if (pattern.includes(rule)) { + pattern = pattern.replace(new RegExp(rule, "g"), EXPANSION_RULES_2[rule](date)); + } + } + pattern = pattern.replace(/\0\0/g, "%"); + var bytes = intArrayFromString(pattern, false); + if (bytes.length > maxsize) { + return 0; + } + writeArrayToMemory(bytes, s); + return bytes.length - 1; +} + +function _time(ptr) { + var ret = Date.now() / 1e3 | 0; + if (ptr) { + SAFE_HEAP_STORE(ptr | 0, ret | 0, 4); + } + return ret; +} + +var FSNode = function(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; +}; + +var readMode = 292 | 73; + +var writeMode = 146; + +Object.defineProperties(FSNode.prototype, { + read: { + get: function() { + return (this.mode & readMode) === readMode; + }, + set: function(val) { + val ? this.mode |= readMode : this.mode &= ~readMode; + } + }, + write: { + get: function() { + return (this.mode & writeMode) === writeMode; + }, + set: function(val) { + val ? this.mode |= writeMode : this.mode &= ~writeMode; + } + }, + isFolder: { + get: function() { + return FS.isDir(this.mode); + } + }, + isDevice: { + get: function() { + return FS.isChrdev(this.mode); + } + } +}); + +FS.FSNode = FSNode; + +FS.staticInit(); + +Module["FS_createPath"] = FS.createPath; + +Module["FS_createDataFile"] = FS.createDataFile; + +Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + +Module["FS_createLazyFile"] = FS.createLazyFile; + +Module["FS_createDevice"] = FS.createDevice; + +Module["FS_unlink"] = FS.unlink; + +ERRNO_CODES = { + "EPERM": 63, + "ENOENT": 44, + "ESRCH": 71, + "EINTR": 27, + "EIO": 29, + "ENXIO": 60, + "E2BIG": 1, + "ENOEXEC": 45, + "EBADF": 8, + "ECHILD": 12, + "EAGAIN": 6, + "EWOULDBLOCK": 6, + "ENOMEM": 48, + "EACCES": 2, + "EFAULT": 21, + "ENOTBLK": 105, + "EBUSY": 10, + "EEXIST": 20, + "EXDEV": 75, + "ENODEV": 43, + "ENOTDIR": 54, + "EISDIR": 31, + "EINVAL": 28, + "ENFILE": 41, + "EMFILE": 33, + "ENOTTY": 59, + "ETXTBSY": 74, + "EFBIG": 22, + "ENOSPC": 51, + "ESPIPE": 70, + "EROFS": 69, + "EMLINK": 34, + "EPIPE": 64, + "EDOM": 18, + "ERANGE": 68, + "ENOMSG": 49, + "EIDRM": 24, + "ECHRNG": 106, + "EL2NSYNC": 156, + "EL3HLT": 107, + "EL3RST": 108, + "ELNRNG": 109, + "EUNATCH": 110, + "ENOCSI": 111, + "EL2HLT": 112, + "EDEADLK": 16, + "ENOLCK": 46, + "EBADE": 113, + "EBADR": 114, + "EXFULL": 115, + "ENOANO": 104, + "EBADRQC": 103, + "EBADSLT": 102, + "EDEADLOCK": 16, + "EBFONT": 101, + "ENOSTR": 100, + "ENODATA": 116, + "ETIME": 117, + "ENOSR": 118, + "ENONET": 119, + "ENOPKG": 120, + "EREMOTE": 121, + "ENOLINK": 47, + "EADV": 122, + "ESRMNT": 123, + "ECOMM": 124, + "EPROTO": 65, + "EMULTIHOP": 36, + "EDOTDOT": 125, + "EBADMSG": 9, + "ENOTUNIQ": 126, + "EBADFD": 127, + "EREMCHG": 128, + "ELIBACC": 129, + "ELIBBAD": 130, + "ELIBSCN": 131, + "ELIBMAX": 132, + "ELIBEXEC": 133, + "ENOSYS": 52, + "ENOTEMPTY": 55, + "ENAMETOOLONG": 37, + "ELOOP": 32, + "EOPNOTSUPP": 138, + "EPFNOSUPPORT": 139, + "ECONNRESET": 15, + "ENOBUFS": 42, + "EAFNOSUPPORT": 5, + "EPROTOTYPE": 67, + "ENOTSOCK": 57, + "ENOPROTOOPT": 50, + "ESHUTDOWN": 140, + "ECONNREFUSED": 14, + "EADDRINUSE": 3, + "ECONNABORTED": 13, + "ENETUNREACH": 40, + "ENETDOWN": 38, + "ETIMEDOUT": 73, + "EHOSTDOWN": 142, + "EHOSTUNREACH": 23, + "EINPROGRESS": 26, + "EALREADY": 7, + "EDESTADDRREQ": 17, + "EMSGSIZE": 35, + "EPROTONOSUPPORT": 66, + "ESOCKTNOSUPPORT": 137, + "EADDRNOTAVAIL": 4, + "ENETRESET": 39, + "EISCONN": 30, + "ENOTCONN": 53, + "ETOOMANYREFS": 141, + "EUSERS": 136, + "EDQUOT": 19, + "ESTALE": 72, + "ENOTSUP": 138, + "ENOMEDIUM": 148, + "EILSEQ": 25, + "EOVERFLOW": 61, + "ECANCELED": 11, + "ENOTRECOVERABLE": 56, + "EOWNERDEAD": 62, + "ESTRPIPE": 135 +}; + +var ASSERTIONS = true; + +function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; +} + +function intArrayToString(array) { + var ret = []; + for (var i = 0; i < array.length; i++) { + var chr = array[i]; + if (chr > 255) { + if (ASSERTIONS) { + assert(false, "Character code " + chr + " (" + String.fromCharCode(chr) + ") at offset " + i + " not in 0x00-0xFF."); + } + chr &= 255; + } + ret.push(String.fromCharCode(chr)); + } + return ret.join(""); +} + +var decodeBase64 = typeof atob == "function" ? atob : function(input) { + var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + do { + enc1 = keyStr.indexOf(input.charAt(i++)); + enc2 = keyStr.indexOf(input.charAt(i++)); + enc3 = keyStr.indexOf(input.charAt(i++)); + enc4 = keyStr.indexOf(input.charAt(i++)); + chr1 = enc1 << 2 | enc2 >> 4; + chr2 = (enc2 & 15) << 4 | enc3 >> 2; + chr3 = (enc3 & 3) << 6 | enc4; + output = output + String.fromCharCode(chr1); + if (enc3 !== 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 !== 64) { + output = output + String.fromCharCode(chr3); + } + } while (i < input.length); + return output; +}; + +function intArrayFromBase64(s) { + if (typeof ENVIRONMENT_IS_NODE == "boolean" && ENVIRONMENT_IS_NODE) { + var buf = Buffer.from(s, "base64"); + return new Uint8Array(buf["buffer"], buf["byteOffset"], buf["byteLength"]); + } + try { + var decoded = decodeBase64(s); + var bytes = new Uint8Array(decoded.length); + for (var i = 0; i < decoded.length; ++i) { + bytes[i] = decoded.charCodeAt(i); + } + return bytes; + } catch (_) { + throw new Error("Converting base64 string to bytes failed."); + } +} + +function tryParseAsDataURI(filename) { + if (!isDataURI(filename)) { + return; + } + return intArrayFromBase64(filename.slice(dataURIPrefix.length)); +} + +var asmLibraryArg = { + "__assert_fail": ___assert_fail, + "__syscall_chmod": ___syscall_chmod, + "__syscall_fcntl64": ___syscall_fcntl64, + "__syscall_fstat64": ___syscall_fstat64, + "__syscall_fstatat64": ___syscall_fstatat64, + "__syscall_getcwd": ___syscall_getcwd, + "__syscall_getgid32": ___syscall_getgid32, + "__syscall_getuid32": ___syscall_getuid32, + "__syscall_ioctl": ___syscall_ioctl, + "__syscall_lstat64": ___syscall_lstat64, + "__syscall_open": ___syscall_open, + "__syscall_readlink": ___syscall_readlink, + "__syscall_stat64": ___syscall_stat64, + "__syscall_unlink": ___syscall_unlink, + "_localtime_js": __localtime_js, + "_tzset_js": __tzset_js, + "abort": _abort, + "alignfault": alignfault, + "emscripten_console_error": _emscripten_console_error, + "emscripten_memcpy_big": _emscripten_memcpy_big, + "emscripten_resize_heap": _emscripten_resize_heap, + "environ_get": _environ_get, + "environ_sizes_get": _environ_sizes_get, + "exit": _exit, + "fd_close": _fd_close, + "fd_read": _fd_read, + "fd_seek": _fd_seek, + "fd_write": _fd_write, + "proc_exit": _proc_exit, + "segfault": segfault, + "setTempRet0": _setTempRet0, + "strftime": _strftime, + "time": _time +}; + +var asm = createWasm(); + +var ___wasm_call_ctors = Module["___wasm_call_ctors"] = createExportWrapper("__wasm_call_ctors"); + +var _free = Module["_free"] = createExportWrapper("free"); + +var _main = Module["_main"] = createExportWrapper("main"); + +var ___errno_location = Module["___errno_location"] = createExportWrapper("__errno_location"); + +var _malloc = Module["_malloc"] = createExportWrapper("malloc"); + +var _sbrk = Module["_sbrk"] = createExportWrapper("sbrk"); + +var ___stdio_exit = Module["___stdio_exit"] = createExportWrapper("__stdio_exit"); + +var ___funcs_on_exit = Module["___funcs_on_exit"] = createExportWrapper("__funcs_on_exit"); + +var ___dl_seterr = Module["___dl_seterr"] = createExportWrapper("__dl_seterr"); + +var _emscripten_get_sbrk_ptr = Module["_emscripten_get_sbrk_ptr"] = createExportWrapper("emscripten_get_sbrk_ptr"); + +var _emscripten_stack_init = Module["_emscripten_stack_init"] = function() { + return (_emscripten_stack_init = Module["_emscripten_stack_init"] = Module["asm"]["emscripten_stack_init"]).apply(null, arguments); +}; + +var _emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = function() { + return (_emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = Module["asm"]["emscripten_stack_get_free"]).apply(null, arguments); +}; + +var _emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = function() { + return (_emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = Module["asm"]["emscripten_stack_get_base"]).apply(null, arguments); +}; + +var _emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = function() { + return (_emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = Module["asm"]["emscripten_stack_get_end"]).apply(null, arguments); +}; + +var stackSave = Module["stackSave"] = createExportWrapper("stackSave"); + +var stackRestore = Module["stackRestore"] = createExportWrapper("stackRestore"); + +var stackAlloc = Module["stackAlloc"] = createExportWrapper("stackAlloc"); + +var dynCall_iiij = Module["dynCall_iiij"] = createExportWrapper("dynCall_iiij"); + +var dynCall_jiji = Module["dynCall_jiji"] = createExportWrapper("dynCall_jiji"); + +var dynCall_ji = Module["dynCall_ji"] = createExportWrapper("dynCall_ji"); + +var dynCall_iiiiiijjjiii = Module["dynCall_iiiiiijjjiii"] = createExportWrapper("dynCall_iiiiiijjjiii"); + +var dynCall_iiijiiii = Module["dynCall_iiijiiii"] = createExportWrapper("dynCall_iiijiiii"); + +var dynCall_jj = Module["dynCall_jj"] = createExportWrapper("dynCall_jj"); + +var dynCall_jjj = Module["dynCall_jjj"] = createExportWrapper("dynCall_jjj"); + +var dynCall_viiiiij = Module["dynCall_viiiiij"] = createExportWrapper("dynCall_viiiiij"); + +var dynCall_viiiiji = Module["dynCall_viiiiji"] = createExportWrapper("dynCall_viiiiji"); + +var dynCall_viiiijiij = Module["dynCall_viiiijiij"] = createExportWrapper("dynCall_viiiijiij"); + +var dynCall_viiiij = Module["dynCall_viiiij"] = createExportWrapper("dynCall_viiiij"); + +var dynCall_iij = Module["dynCall_iij"] = createExportWrapper("dynCall_iij"); + +var dynCall_jiij = Module["dynCall_jiij"] = createExportWrapper("dynCall_jiij"); + +var dynCall_iiji = Module["dynCall_iiji"] = createExportWrapper("dynCall_iiji"); + +var dynCall_iiijiijii = Module["dynCall_iiijiijii"] = createExportWrapper("dynCall_iiijiijii"); + +var dynCall_vji = Module["dynCall_vji"] = createExportWrapper("dynCall_vji"); + +var dynCall_iiiijj = Module["dynCall_iiiijj"] = createExportWrapper("dynCall_iiiijj"); + +var dynCall_iiiijiiii = Module["dynCall_iiiijiiii"] = createExportWrapper("dynCall_iiiijiiii"); + +var dynCall_iiiiijiiii = Module["dynCall_iiiiijiiii"] = createExportWrapper("dynCall_iiiiijiiii"); + +var dynCall_ijii = Module["dynCall_ijii"] = createExportWrapper("dynCall_ijii"); + +var dynCall_iiiijiji = Module["dynCall_iiiijiji"] = createExportWrapper("dynCall_iiiijiji"); + +var dynCall_iijjii = Module["dynCall_iijjii"] = createExportWrapper("dynCall_iijjii"); + +var dynCall_jjii = Module["dynCall_jjii"] = createExportWrapper("dynCall_jjii"); + +var dynCall_jiii = Module["dynCall_jiii"] = createExportWrapper("dynCall_jiii"); + +var dynCall_jiiiii = Module["dynCall_jiiiii"] = createExportWrapper("dynCall_jiiiii"); + +var dynCall_iiiiiijiiii = Module["dynCall_iiiiiijiiii"] = createExportWrapper("dynCall_iiiiiijiiii"); + +if (!Object.getOwnPropertyDescriptor(Module, "intArrayFromString")) Module["intArrayFromString"] = (() => abort("'intArrayFromString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "intArrayToString")) Module["intArrayToString"] = (() => abort("'intArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ccall")) Module["ccall"] = (() => abort("'ccall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "cwrap")) Module["cwrap"] = (() => abort("'cwrap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setValue")) Module["setValue"] = (() => abort("'setValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getValue")) Module["getValue"] = (() => abort("'getValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocate")) Module["allocate"] = (() => abort("'allocate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF8ArrayToString")) Module["UTF8ArrayToString"] = (() => abort("'UTF8ArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF8ToString")) Module["UTF8ToString"] = (() => abort("'UTF8ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8Array")) Module["stringToUTF8Array"] = (() => abort("'stringToUTF8Array' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8")) Module["stringToUTF8"] = (() => abort("'stringToUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF8")) Module["lengthBytesUTF8"] = (() => abort("'lengthBytesUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = (() => abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPreRun")) Module["addOnPreRun"] = (() => abort("'addOnPreRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnInit")) Module["addOnInit"] = (() => abort("'addOnInit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPreMain")) Module["addOnPreMain"] = (() => abort("'addOnPreMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnExit")) Module["addOnExit"] = (() => abort("'addOnExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPostRun")) Module["addOnPostRun"] = (() => abort("'addOnPostRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeStringToMemory")) Module["writeStringToMemory"] = (() => abort("'writeStringToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeArrayToMemory")) Module["writeArrayToMemory"] = (() => abort("'writeArrayToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeAsciiToMemory")) Module["writeAsciiToMemory"] = (() => abort("'writeAsciiToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["addRunDependency"] = addRunDependency; + +Module["removeRunDependency"] = removeRunDependency; + +if (!Object.getOwnPropertyDescriptor(Module, "FS_createFolder")) Module["FS_createFolder"] = (() => abort("'FS_createFolder' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS_createPath"] = FS.createPath; + +Module["FS_createDataFile"] = FS.createDataFile; + +Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + +Module["FS_createLazyFile"] = FS.createLazyFile; + +if (!Object.getOwnPropertyDescriptor(Module, "FS_createLink")) Module["FS_createLink"] = (() => abort("'FS_createLink' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS_createDevice"] = FS.createDevice; + +Module["FS_unlink"] = FS.unlink; + +if (!Object.getOwnPropertyDescriptor(Module, "getLEB")) Module["getLEB"] = (() => abort("'getLEB' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFunctionTables")) Module["getFunctionTables"] = (() => abort("'getFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "alignFunctionTables")) Module["alignFunctionTables"] = (() => abort("'alignFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFunctions")) Module["registerFunctions"] = (() => abort("'registerFunctions' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addFunction")) Module["addFunction"] = (() => abort("'addFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "removeFunction")) Module["removeFunction"] = (() => abort("'removeFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = (() => abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "prettyPrint")) Module["prettyPrint"] = (() => abort("'prettyPrint' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = (() => abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getCompilerSetting")) Module["getCompilerSetting"] = (() => abort("'getCompilerSetting' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "print")) Module["print"] = (() => abort("'print' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "printErr")) Module["printErr"] = (() => abort("'printErr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getTempRet0")) Module["getTempRet0"] = (() => abort("'getTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setTempRet0")) Module["setTempRet0"] = (() => abort("'setTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callMain")) Module["callMain"] = (() => abort("'callMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "abort")) Module["abort"] = (() => abort("'abort' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "keepRuntimeAlive")) Module["keepRuntimeAlive"] = (() => abort("'keepRuntimeAlive' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "zeroMemory")) Module["zeroMemory"] = (() => abort("'zeroMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToNewUTF8")) Module["stringToNewUTF8"] = (() => abort("'stringToNewUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscripten_realloc_buffer")) Module["emscripten_realloc_buffer"] = (() => abort("'emscripten_realloc_buffer' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ENV")) Module["ENV"] = (() => abort("'ENV' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "withStackSave")) Module["withStackSave"] = (() => abort("'withStackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_CODES")) Module["ERRNO_CODES"] = (() => abort("'ERRNO_CODES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_MESSAGES")) Module["ERRNO_MESSAGES"] = (() => abort("'ERRNO_MESSAGES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setErrNo")) Module["setErrNo"] = (() => abort("'setErrNo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetPton4")) Module["inetPton4"] = (() => abort("'inetPton4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetNtop4")) Module["inetNtop4"] = (() => abort("'inetNtop4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetPton6")) Module["inetPton6"] = (() => abort("'inetPton6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetNtop6")) Module["inetNtop6"] = (() => abort("'inetNtop6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readSockaddr")) Module["readSockaddr"] = (() => abort("'readSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeSockaddr")) Module["writeSockaddr"] = (() => abort("'writeSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "DNS")) Module["DNS"] = (() => abort("'DNS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getHostByName")) Module["getHostByName"] = (() => abort("'getHostByName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Protocols")) Module["Protocols"] = (() => abort("'Protocols' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Sockets")) Module["Sockets"] = (() => abort("'Sockets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getRandomDevice")) Module["getRandomDevice"] = (() => abort("'getRandomDevice' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "traverseStack")) Module["traverseStack"] = (() => abort("'traverseStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertFrameToPC")) Module["convertFrameToPC"] = (() => abort("'convertFrameToPC' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UNWIND_CACHE")) Module["UNWIND_CACHE"] = (() => abort("'UNWIND_CACHE' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "saveInUnwindCache")) Module["saveInUnwindCache"] = (() => abort("'saveInUnwindCache' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertPCtoSourceLocation")) Module["convertPCtoSourceLocation"] = (() => abort("'convertPCtoSourceLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgsArray")) Module["readAsmConstArgsArray"] = (() => abort("'readAsmConstArgsArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgs")) Module["readAsmConstArgs"] = (() => abort("'readAsmConstArgs' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "mainThreadEM_ASM")) Module["mainThreadEM_ASM"] = (() => abort("'mainThreadEM_ASM' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jstoi_q")) Module["jstoi_q"] = (() => abort("'jstoi_q' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jstoi_s")) Module["jstoi_s"] = (() => abort("'jstoi_s' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getExecutableName")) Module["getExecutableName"] = (() => abort("'getExecutableName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "listenOnce")) Module["listenOnce"] = (() => abort("'listenOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "autoResumeAudioContext")) Module["autoResumeAudioContext"] = (() => abort("'autoResumeAudioContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCallLegacy")) Module["dynCallLegacy"] = (() => abort("'dynCallLegacy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getDynCaller")) Module["getDynCaller"] = (() => abort("'getDynCaller' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = (() => abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callRuntimeCallbacks")) Module["callRuntimeCallbacks"] = (() => abort("'callRuntimeCallbacks' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "wasmTableMirror")) Module["wasmTableMirror"] = (() => abort("'wasmTableMirror' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setWasmTableEntry")) Module["setWasmTableEntry"] = (() => abort("'setWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getWasmTableEntry")) Module["getWasmTableEntry"] = (() => abort("'getWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "handleException")) Module["handleException"] = (() => abort("'handleException' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePush")) Module["runtimeKeepalivePush"] = (() => abort("'runtimeKeepalivePush' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePop")) Module["runtimeKeepalivePop"] = (() => abort("'runtimeKeepalivePop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callUserCallback")) Module["callUserCallback"] = (() => abort("'callUserCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "maybeExit")) Module["maybeExit"] = (() => abort("'maybeExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "safeSetTimeout")) Module["safeSetTimeout"] = (() => abort("'safeSetTimeout' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "asmjsMangle")) Module["asmjsMangle"] = (() => abort("'asmjsMangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "asyncLoad")) Module["asyncLoad"] = (() => abort("'asyncLoad' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "alignMemory")) Module["alignMemory"] = (() => abort("'alignMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "mmapAlloc")) Module["mmapAlloc"] = (() => abort("'mmapAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "reallyNegative")) Module["reallyNegative"] = (() => abort("'reallyNegative' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "unSign")) Module["unSign"] = (() => abort("'unSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "reSign")) Module["reSign"] = (() => abort("'reSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "formatString")) Module["formatString"] = (() => abort("'formatString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PATH")) Module["PATH"] = (() => abort("'PATH' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PATH_FS")) Module["PATH_FS"] = (() => abort("'PATH_FS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SYSCALLS")) Module["SYSCALLS"] = (() => abort("'SYSCALLS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getSocketFromFD")) Module["getSocketFromFD"] = (() => abort("'getSocketFromFD' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getSocketAddress")) Module["getSocketAddress"] = (() => abort("'getSocketAddress' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "JSEvents")) Module["JSEvents"] = (() => abort("'JSEvents' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerKeyEventCallback")) Module["registerKeyEventCallback"] = (() => abort("'registerKeyEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "specialHTMLTargets")) Module["specialHTMLTargets"] = (() => abort("'specialHTMLTargets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "maybeCStringToJsString")) Module["maybeCStringToJsString"] = (() => abort("'maybeCStringToJsString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "findEventTarget")) Module["findEventTarget"] = (() => abort("'findEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "findCanvasEventTarget")) Module["findCanvasEventTarget"] = (() => abort("'findCanvasEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getBoundingClientRect")) Module["getBoundingClientRect"] = (() => abort("'getBoundingClientRect' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillMouseEventData")) Module["fillMouseEventData"] = (() => abort("'fillMouseEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerMouseEventCallback")) Module["registerMouseEventCallback"] = (() => abort("'registerMouseEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerWheelEventCallback")) Module["registerWheelEventCallback"] = (() => abort("'registerWheelEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerUiEventCallback")) Module["registerUiEventCallback"] = (() => abort("'registerUiEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFocusEventCallback")) Module["registerFocusEventCallback"] = (() => abort("'registerFocusEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceOrientationEventData")) Module["fillDeviceOrientationEventData"] = (() => abort("'fillDeviceOrientationEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceOrientationEventCallback")) Module["registerDeviceOrientationEventCallback"] = (() => abort("'registerDeviceOrientationEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceMotionEventData")) Module["fillDeviceMotionEventData"] = (() => abort("'fillDeviceMotionEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceMotionEventCallback")) Module["registerDeviceMotionEventCallback"] = (() => abort("'registerDeviceMotionEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "screenOrientation")) Module["screenOrientation"] = (() => abort("'screenOrientation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillOrientationChangeEventData")) Module["fillOrientationChangeEventData"] = (() => abort("'fillOrientationChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerOrientationChangeEventCallback")) Module["registerOrientationChangeEventCallback"] = (() => abort("'registerOrientationChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillFullscreenChangeEventData")) Module["fillFullscreenChangeEventData"] = (() => abort("'fillFullscreenChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFullscreenChangeEventCallback")) Module["registerFullscreenChangeEventCallback"] = (() => abort("'registerFullscreenChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerRestoreOldStyle")) Module["registerRestoreOldStyle"] = (() => abort("'registerRestoreOldStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "hideEverythingExceptGivenElement")) Module["hideEverythingExceptGivenElement"] = (() => abort("'hideEverythingExceptGivenElement' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "restoreHiddenElements")) Module["restoreHiddenElements"] = (() => abort("'restoreHiddenElements' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setLetterbox")) Module["setLetterbox"] = (() => abort("'setLetterbox' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "currentFullscreenStrategy")) Module["currentFullscreenStrategy"] = (() => abort("'currentFullscreenStrategy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "restoreOldWindowedStyle")) Module["restoreOldWindowedStyle"] = (() => abort("'restoreOldWindowedStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "softFullscreenResizeWebGLRenderTarget")) Module["softFullscreenResizeWebGLRenderTarget"] = (() => abort("'softFullscreenResizeWebGLRenderTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "doRequestFullscreen")) Module["doRequestFullscreen"] = (() => abort("'doRequestFullscreen' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillPointerlockChangeEventData")) Module["fillPointerlockChangeEventData"] = (() => abort("'fillPointerlockChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockChangeEventCallback")) Module["registerPointerlockChangeEventCallback"] = (() => abort("'registerPointerlockChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockErrorEventCallback")) Module["registerPointerlockErrorEventCallback"] = (() => abort("'registerPointerlockErrorEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "requestPointerLock")) Module["requestPointerLock"] = (() => abort("'requestPointerLock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillVisibilityChangeEventData")) Module["fillVisibilityChangeEventData"] = (() => abort("'fillVisibilityChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerVisibilityChangeEventCallback")) Module["registerVisibilityChangeEventCallback"] = (() => abort("'registerVisibilityChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerTouchEventCallback")) Module["registerTouchEventCallback"] = (() => abort("'registerTouchEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillGamepadEventData")) Module["fillGamepadEventData"] = (() => abort("'fillGamepadEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerGamepadEventCallback")) Module["registerGamepadEventCallback"] = (() => abort("'registerGamepadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerBeforeUnloadEventCallback")) Module["registerBeforeUnloadEventCallback"] = (() => abort("'registerBeforeUnloadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillBatteryEventData")) Module["fillBatteryEventData"] = (() => abort("'fillBatteryEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "battery")) Module["battery"] = (() => abort("'battery' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerBatteryEventCallback")) Module["registerBatteryEventCallback"] = (() => abort("'registerBatteryEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setCanvasElementSize")) Module["setCanvasElementSize"] = (() => abort("'setCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getCanvasElementSize")) Module["getCanvasElementSize"] = (() => abort("'getCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "demangle")) Module["demangle"] = (() => abort("'demangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "demangleAll")) Module["demangleAll"] = (() => abort("'demangleAll' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jsStackTrace")) Module["jsStackTrace"] = (() => abort("'jsStackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = (() => abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getEnvStrings")) Module["getEnvStrings"] = (() => abort("'getEnvStrings' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "checkWasiClock")) Module["checkWasiClock"] = (() => abort("'checkWasiClock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64")) Module["writeI53ToI64"] = (() => abort("'writeI53ToI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Clamped")) Module["writeI53ToI64Clamped"] = (() => abort("'writeI53ToI64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Signaling")) Module["writeI53ToI64Signaling"] = (() => abort("'writeI53ToI64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Clamped")) Module["writeI53ToU64Clamped"] = (() => abort("'writeI53ToU64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Signaling")) Module["writeI53ToU64Signaling"] = (() => abort("'writeI53ToU64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readI53FromI64")) Module["readI53FromI64"] = (() => abort("'readI53FromI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readI53FromU64")) Module["readI53FromU64"] = (() => abort("'readI53FromU64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertI32PairToI53")) Module["convertI32PairToI53"] = (() => abort("'convertI32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertU32PairToI53")) Module["convertU32PairToI53"] = (() => abort("'convertU32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setImmediateWrapped")) Module["setImmediateWrapped"] = (() => abort("'setImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "clearImmediateWrapped")) Module["clearImmediateWrapped"] = (() => abort("'clearImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "polyfillSetImmediate")) Module["polyfillSetImmediate"] = (() => abort("'polyfillSetImmediate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "uncaughtExceptionCount")) Module["uncaughtExceptionCount"] = (() => abort("'uncaughtExceptionCount' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exceptionLast")) Module["exceptionLast"] = (() => abort("'exceptionLast' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exceptionCaught")) Module["exceptionCaught"] = (() => abort("'exceptionCaught' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ExceptionInfo")) Module["ExceptionInfo"] = (() => abort("'ExceptionInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "CatchInfo")) Module["CatchInfo"] = (() => abort("'CatchInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exception_addRef")) Module["exception_addRef"] = (() => abort("'exception_addRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exception_decRef")) Module["exception_decRef"] = (() => abort("'exception_decRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Browser")) Module["Browser"] = (() => abort("'Browser' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "funcWrappers")) Module["funcWrappers"] = (() => abort("'funcWrappers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = (() => abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setMainLoop")) Module["setMainLoop"] = (() => abort("'setMainLoop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "wget")) Module["wget"] = (() => abort("'wget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS"] = FS; + +if (!Object.getOwnPropertyDescriptor(Module, "MEMFS")) Module["MEMFS"] = (() => abort("'MEMFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "TTY")) Module["TTY"] = (() => abort("'TTY' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PIPEFS")) Module["PIPEFS"] = (() => abort("'PIPEFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SOCKFS")) Module["SOCKFS"] = (() => abort("'SOCKFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "_setNetworkCallback")) Module["_setNetworkCallback"] = (() => abort("'_setNetworkCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "tempFixedLengthArray")) Module["tempFixedLengthArray"] = (() => abort("'tempFixedLengthArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "miniTempWebGLFloatBuffers")) Module["miniTempWebGLFloatBuffers"] = (() => abort("'miniTempWebGLFloatBuffers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "heapObjectForWebGLType")) Module["heapObjectForWebGLType"] = (() => abort("'heapObjectForWebGLType' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "heapAccessShiftForWebGLHeap")) Module["heapAccessShiftForWebGLHeap"] = (() => abort("'heapAccessShiftForWebGLHeap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GL")) Module["GL"] = (() => abort("'GL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGet")) Module["emscriptenWebGLGet"] = (() => abort("'emscriptenWebGLGet' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "computeUnpackAlignedImageSize")) Module["computeUnpackAlignedImageSize"] = (() => abort("'computeUnpackAlignedImageSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetTexPixelData")) Module["emscriptenWebGLGetTexPixelData"] = (() => abort("'emscriptenWebGLGetTexPixelData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetUniform")) Module["emscriptenWebGLGetUniform"] = (() => abort("'emscriptenWebGLGetUniform' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglGetUniformLocation")) Module["webglGetUniformLocation"] = (() => abort("'webglGetUniformLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglPrepareUniformLocationsBeforeFirstUse")) Module["webglPrepareUniformLocationsBeforeFirstUse"] = (() => abort("'webglPrepareUniformLocationsBeforeFirstUse' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglGetLeftBracePos")) Module["webglGetLeftBracePos"] = (() => abort("'webglGetLeftBracePos' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetVertexAttrib")) Module["emscriptenWebGLGetVertexAttrib"] = (() => abort("'emscriptenWebGLGetVertexAttrib' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeGLArray")) Module["writeGLArray"] = (() => abort("'writeGLArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "AL")) Module["AL"] = (() => abort("'AL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_unicode")) Module["SDL_unicode"] = (() => abort("'SDL_unicode' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_ttfContext")) Module["SDL_ttfContext"] = (() => abort("'SDL_ttfContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_audio")) Module["SDL_audio"] = (() => abort("'SDL_audio' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL")) Module["SDL"] = (() => abort("'SDL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_gfx")) Module["SDL_gfx"] = (() => abort("'SDL_gfx' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLUT")) Module["GLUT"] = (() => abort("'GLUT' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "EGL")) Module["EGL"] = (() => abort("'EGL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLFW_Window")) Module["GLFW_Window"] = (() => abort("'GLFW_Window' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLFW")) Module["GLFW"] = (() => abort("'GLFW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLEW")) Module["GLEW"] = (() => abort("'GLEW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "IDBStore")) Module["IDBStore"] = (() => abort("'IDBStore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runAndAbortIfError")) Module["runAndAbortIfError"] = (() => abort("'runAndAbortIfError' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "warnOnce")) Module["warnOnce"] = (() => abort("'warnOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackSave")) Module["stackSave"] = (() => abort("'stackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackRestore")) Module["stackRestore"] = (() => abort("'stackRestore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackAlloc")) Module["stackAlloc"] = (() => abort("'stackAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "AsciiToString")) Module["AsciiToString"] = (() => abort("'AsciiToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToAscii")) Module["stringToAscii"] = (() => abort("'stringToAscii' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF16ToString")) Module["UTF16ToString"] = (() => abort("'UTF16ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF16")) Module["stringToUTF16"] = (() => abort("'stringToUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF16")) Module["lengthBytesUTF16"] = (() => abort("'lengthBytesUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF32ToString")) Module["UTF32ToString"] = (() => abort("'UTF32ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF32")) Module["stringToUTF32"] = (() => abort("'stringToUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF32")) Module["lengthBytesUTF32"] = (() => abort("'lengthBytesUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8")) Module["allocateUTF8"] = (() => abort("'allocateUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8OnStack")) Module["allocateUTF8OnStack"] = (() => abort("'allocateUTF8OnStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["writeStackCookie"] = writeStackCookie; + +Module["checkStackCookie"] = checkStackCookie; + +if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_NORMAL")) Object.defineProperty(Module, "ALLOC_NORMAL", { + configurable: true, + get: function() { + abort("'ALLOC_NORMAL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)"); + } +}); + +if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_STACK")) Object.defineProperty(Module, "ALLOC_STACK", { + configurable: true, + get: function() { + abort("'ALLOC_STACK' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)"); + } +}); + +var calledRun; + +function ExitStatus(status) { + this.name = "ExitStatus"; + this.message = "Program terminated with exit(" + status + ")"; + this.status = status; +} + +var calledMain = false; + +// dependenciesFulfilled = function runCaller() { +// if (!calledRun) run(); +// if (!calledRun) dependenciesFulfilled = runCaller; +// }; + +function callMain(args) { + assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'); + assert(__ATPRERUN__.length == 0, "cannot call main when preRun functions remain to be called"); + var entryFunction = Module["_main"]; + args = args || []; + var argc = args.length + 1; + var argv = stackAlloc((argc + 1) * 4); + SAFE_HEAP_STORE((argv >> 2) * 4, allocateUTF8OnStack(thisProgram), 4); + for (var i = 1; i < argc; i++) { + SAFE_HEAP_STORE(((argv >> 2) + i) * 4, allocateUTF8OnStack(args[i - 1]), 4); + } + SAFE_HEAP_STORE(((argv >> 2) + argc) * 4, 0, 4); + try { + var ret = entryFunction(argc, argv); + + // console.log(FS.readFile("./out.o")); + exit(ret, true); + return ret; + } catch (e) { + return handleException(e); + } finally { + calledMain = true; + } +} + +function stackCheckInit() { + _emscripten_stack_init(); + writeStackCookie(); +} + +function run(args) { + shouldRunNow = true; +// if (args === undefined) { +// readyPromiseResolve(Module); +// return; +// } + + args = args || arguments_; + if (runDependencies > 0) { + return; + } + stackCheckInit(); + preRun(); + if (runDependencies > 0) { + return run(args); + } + function doRun() { + if (calledRun) return; + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + // at args[2], we have a list of assembly programs to compile + var asm_files = args.pop(); + for (let i = 0; i < asm_files.length; i ++ ){ + FS.writeFile('./'+asm_files[i].name, asm_files[i].code); + args.push('./'+asm_files[i].name); + } + // for(var i = 2; i < args.length; i++) { + // FS.writeFile('./code' + (i - 2) + '.s', args[i]); + // args[i] = 'code' + (i - 2) + '.s'; + // } + // console.log(FS.readdir("./")); + args = ["-o","out.o", ...args /*"-march=rv32imfdv", "-mabi=ilp32d", "code.s"*/]; + preMain(); + // readyPromiseResolve(Module); + if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"](); + if (shouldRunNow) callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(function() { + setTimeout(function() { + Module["setStatus"](""); + }, 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); + +// readyPromiseResolve(Module); +// return Module.ready; + if (!statecode.codeerror) + return ofile; + else + return errstatus; +} + +Module["run"] = run; + +function exit(status, implicit) { + + if (!statecode.codeerror){ + ofile = FS.readFile("./out.o"); + console.log(ofile); + } + EXITSTATUS = status; + if (keepRuntimeAlive()) { + if (!implicit) { + var msg = "program exited (with status: " + status + "), but keepRuntimeAlive() is set (counter=" + runtimeKeepaliveCounter + ") due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)"; + readyPromiseReject(msg); + err(msg); + } + } else { + exitRuntime(); + } + procExit(status); +} + +function procExit(code) { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + if (Module["onExit"]) Module["onExit"](code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); +} + +if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } +} + +var shouldRunNow = false; + +if (Module["noInitialRun"]) shouldRunNow = false; + +// run(); + + + readyPromiseResolve(Module); + + + return Module.ready +} +); +})(); +export default Module; \ No newline at end of file diff --git a/src/core/assembler/sailAssembler/web/wasm/as-new.wasm b/src/core/assembler/sailAssembler/web/wasm/as-new.wasm new file mode 100755 index 000000000..8968d3122 Binary files /dev/null and b/src/core/assembler/sailAssembler/web/wasm/as-new.wasm differ diff --git a/src/core/assembler/sailAssembler/web/wasm/as-new64.js b/src/core/assembler/sailAssembler/web/wasm/as-new64.js new file mode 100644 index 000000000..952000151 --- /dev/null +++ b/src/core/assembler/sailAssembler/web/wasm/as-new64.js @@ -0,0 +1,4918 @@ +import { statecode } from "../CNAssambler.mjs"; +let ofile = null; +var Module = (() => { + var _scriptName = import.meta.url; + + return ( +async function(moduleArg = {}) { + var moduleRtn; + +// include: shell.js +// The Module object: Our interface to the outside world. We import +// and export values on it. There are various ways Module can be used: +// 1. Not defined. We create it here +// 2. A function parameter, function(moduleArg) => Promise +// 3. pre-run appended it, var Module = {}; ..generated code.. +// 4. External script tag defines var Module. +// We need to check if Module already exists (e.g. case 3 above). +// Substitution will be replaced with actual code on later stage of the build, +// this way Closure Compiler will not mangle it (e.g. case 4. above). +// Note that if you want to run closure, and also to use Module +// after the generated code, you will need to define var Module = {}; +// before the code. Then that object will be used in the code, and you +// can continue to use Module afterwards as well. +var Module = moduleArg; + +// Set up the promise that indicates the Module is initialized +var readyPromiseResolve, readyPromiseReject; + +var readyPromise = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; +}); + +// Determine the runtime environment we are in. You can customize this by +// setting the ENVIRONMENT setting at compile time (see settings.js). +// Attempt to auto-detect the environment +var ENVIRONMENT_IS_WEB = typeof window == "object"; + +var ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope != "undefined"; + +// N.b. Electron.js environment is simultaneously a NODE-environment, but +// also a web environment. +var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string" && process.type != "renderer"; + +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +if (ENVIRONMENT_IS_NODE) { + // When building an ES module `require` is not normally available. + // We need to use `createRequire()` to construct the require()` function. + const {createRequire} = await import("module"); + /** @suppress{duplicate} */ var require = createRequire(import.meta.url); +} + +// --pre-jses are emitted after the Module integration code, so that they can +// refer to Module (if they choose; they can also define Module) +// Sometimes an existing Module object exists with properties +// meant to overwrite the default module functionality. Here +// we collect those properties and reapply _after_ we configure +// the current environment's defaults to avoid having to be so +// defensive during initialization. +var moduleOverrides = Object.assign({}, Module); + +var arguments_ = []; + +var thisProgram = "./this.program"; + +var quit_ = (status, toThrow) => { + throw toThrow; +}; + +// `/` should be present at the end if `scriptDirectory` is not empty +var scriptDirectory = ""; + +function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; +} + +// Hooks that are implemented differently in different runtime environments. +var readAsync, readBinary; + +if (ENVIRONMENT_IS_NODE) { + if (typeof process == "undefined" || !process.release || process.release.name !== "node") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + var nodeVersion = process.versions.node; + var numericVersion = nodeVersion.split(".").slice(0, 3); + numericVersion = (numericVersion[0] * 1e4) + (numericVersion[1] * 100) + (numericVersion[2].split("-")[0] * 1); + var minVersion = 23e4; + if (numericVersion < 23e4) { + throw new Error("This emscripten-generated code requires node v23.0.0 (detected v" + nodeVersion + ")"); + } + // These modules will usually be used on Node.js. Load them eagerly to avoid + // the complexity of lazy-loading. + var fs = require("fs"); + var nodePath = require("path"); + // EXPORT_ES6 + ENVIRONMENT_IS_NODE always requires use of import.meta.url, + // since there's no way getting the current absolute path of the module when + // support for that is not available. + if (!import.meta.url.startsWith("data:")) { + scriptDirectory = nodePath.dirname(require("url").fileURLToPath(import.meta.url)) + "/"; + } + // include: node_shell_read.js + readBinary = filename => { + // We need to re-wrap `file://` strings to URLs. + filename = isFileURI(filename) ? new URL(filename) : filename; + var ret = fs.readFileSync(filename); + assert(Buffer.isBuffer(ret)); + return ret; + }; + readAsync = async (filename, binary = true) => { + // See the comment in the `readBinary` function. + filename = isFileURI(filename) ? new URL(filename) : filename; + var ret = fs.readFileSync(filename, binary ? undefined : "utf8"); + assert(binary ? Buffer.isBuffer(ret) : typeof ret == "string"); + return ret; + }; + // end include: node_shell_read.js + if (!Module["thisProgram"] && process.argv.length > 1) { + thisProgram = process.argv[1].replace(/\\/g, "/"); + } + arguments_ = process.argv.slice(2); + // MODULARIZE will export the module in the proper place outside, we don't need to export here + quit_ = (status, toThrow) => { + process.exitCode = status; + throw toThrow; + }; +} else if (ENVIRONMENT_IS_SHELL) { + if ((typeof process == "object" && typeof require === "function") || typeof window == "object" || typeof WorkerGlobalScope != "undefined") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); +} else // Note that this includes Node.js workers when relevant (pthreads is enabled). +// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and +// ENVIRONMENT_IS_NODE. +if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + // Check worker, not web, since window could be polyfilled + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + // web + scriptDirectory = document.currentScript.src; + } + // When MODULARIZE, this JS may be executed later, after document.currentScript + // is gone, so we saved it, and we use it here instead of any other info. + if (_scriptName) { + scriptDirectory = _scriptName; + } + // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them. + // otherwise, slice off the final part of the url to find the script directory. + // if scriptDirectory does not contain a slash, lastIndexOf will return -1, + // and scriptDirectory will correctly be replaced with an empty string. + // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #), + // they are removed because they could contain a slash. + if (scriptDirectory.startsWith("blob:")) { + scriptDirectory = ""; + } else { + scriptDirectory = scriptDirectory.slice(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1); + } + if (!(typeof window == "object" || typeof WorkerGlobalScope != "undefined")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + { + // include: web_or_worker_shell_read.js + if (ENVIRONMENT_IS_WORKER) { + readBinary = url => { + var xhr = new XMLHttpRequest; + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(/** @type{!ArrayBuffer} */ (xhr.response)); + }; + } + readAsync = async url => { + // Fetch has some additional restrictions over XHR, like it can't be used on a file:// url. + // See https://github.com/github/fetch/pull/92#issuecomment-140665932 + // Cordova or Electron apps are typically loaded from a file:// url. + // So use XHR on webview if URL is a file URL. + if (isFileURI(url)) { + return new Promise((resolve, reject) => { + var xhr = new XMLHttpRequest; + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = () => { + if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { + // file URLs can return 0 + resolve(xhr.response); + return; + } + reject(xhr.status); + }; + xhr.onerror = reject; + xhr.send(null); + }); + } + var response = await fetch(url, { + credentials: "same-origin" + }); + if (response.ok) { + return response.arrayBuffer(); + } + throw new Error(response.status + " : " + response.url); + }; + } +} else { + throw new Error("environment detection error"); +} + +var out = Module["print"] || console.log.bind(console); + +var instErrExp = /^\.\/([^:]+):(\d+):\s*Error:\s*(.+)$/; +var errstatus; + +Module["printErr"] = function (message) { + + let asmerror = message.match(instErrExp); + + if (asmerror && !statecode.codeerror){ + console.error(asmerror); + errstatus = {status: "error", msg: asmerror[1] + " at line " + asmerror[2] + ": " + asmerror[3]}; + statecode.codeerror = true; + } else + console.error(message); + +}; + +var err = Module["printErr"] || console.error.bind(console); + +// Merge back in the overrides +Object.assign(Module, moduleOverrides); + +// Free the object hierarchy contained in the overrides, this lets the GC +// reclaim data used. +moduleOverrides = null; + +checkIncomingModuleAPI(); + +// Emit code to handle expected values on the Module object. This applies Module.x +// to the proper local x. This has two benefits: first, we only emit it if it is +// expected to arrive, and second, by using a local everywhere else that can be +// minified. +if (Module["arguments"]) arguments_ = Module["arguments"]; + +legacyModuleProp("arguments", "arguments_"); + +if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + +legacyModuleProp("thisProgram", "thisProgram"); + +// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message +// Assertions on removed incoming Module JS APIs. +assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["cdInitializerPrefixURL"] == "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["filePackagePrefixURL"] == "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["read"] == "undefined", "Module.read option was removed"); + +assert(typeof Module["readAsync"] == "undefined", "Module.readAsync option was removed (modify readAsync in JS)"); + +assert(typeof Module["readBinary"] == "undefined", "Module.readBinary option was removed (modify readBinary in JS)"); + +assert(typeof Module["setWindowTitle"] == "undefined", "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"); + +assert(typeof Module["TOTAL_MEMORY"] == "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"); + +legacyModuleProp("asm", "wasmExports"); + +legacyModuleProp("readAsync", "readAsync"); + +legacyModuleProp("readBinary", "readBinary"); + +legacyModuleProp("setWindowTitle", "setWindowTitle"); + +var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js"; + +var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js"; + +var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js"; + +var FETCHFS = "FETCHFS is no longer included by default; build with -lfetchfs.js"; + +var ICASEFS = "ICASEFS is no longer included by default; build with -licasefs.js"; + +var JSFILEFS = "JSFILEFS is no longer included by default; build with -ljsfilefs.js"; + +var OPFS = "OPFS is no longer included by default; build with -lopfs.js"; + +var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js"; + +assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable."); + +// end include: shell.js +// include: preamble.js +// === Preamble library stuff === +// Documentation for the public APIs defined in this file must be updated in: +// site/source/docs/api_reference/preamble.js.rst +// A prebuilt local version of the documentation is available at: +// site/build/text/docs/api_reference/preamble.js.txt +// You can also build docs locally as HTML or other formats in site/ +// An online HTML version (which may be of a different version of Emscripten) +// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html +var wasmBinary = Module["wasmBinary"]; + +legacyModuleProp("wasmBinary", "wasmBinary"); + +if (typeof WebAssembly != "object") { + err("no native wasm support detected"); +} + +// Wasm globals +var wasmMemory; + +//======================================== +// Runtime essentials +//======================================== +// whether we are quitting the application. no code should run after this. +// set in exit() and abort() +var ABORT = false; + +// set by exit() and abort(). Passed to 'onExit' handler. +// NOTE: This is also used as the process return code code in shell environments +// but only when noExitRuntime is false. +var EXITSTATUS; + +// In STRICT mode, we only define assert() when ASSERTIONS is set. i.e. we +// don't define it at all in release modes. This matches the behaviour of +// MINIMAL_RUNTIME. +// TODO(sbc): Make this the default even without STRICT enabled. +/** @type {function(*, string=)} */ function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } +} + +// We used to include malloc/free by default in the past. Show a helpful error in +// builds with assertions. +function _malloc() { + abort("malloc() called but not included in the build - add `_malloc` to EXPORTED_FUNCTIONS"); +} + +function _free() { + // Show a helpful error since we used to include free by default in the past. + abort("free() called but not included in the build - add `_free` to EXPORTED_FUNCTIONS"); +} + +// Memory management +var HEAP, /** @type {!Int8Array} */ HEAP8, /** @type {!Uint8Array} */ HEAPU8, /** @type {!Int16Array} */ HEAP16, /** @type {!Uint16Array} */ HEAPU16, /** @type {!Int32Array} */ HEAP32, /** @type {!Uint32Array} */ HEAPU32, /** @type {!Float32Array} */ HEAPF32, /* BigInt64Array type is not correctly defined in closure +/** not-@type {!BigInt64Array} */ HEAP64, /* BigUint64Array type is not correctly defined in closure +/** not-t@type {!BigUint64Array} */ HEAPU64, /** @type {!Float64Array} */ HEAPF64; + +var runtimeInitialized = false; + +var runtimeExited = false; + +/** + * Indicates whether filename is delivered via file protocol (as opposed to http/https) + * @noinline + */ var isFileURI = filename => filename.startsWith("file://"); + +// include: runtime_shared.js +// include: runtime_stack_check.js +// Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode. +function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + // If the stack ends at address zero we write our cookies 4 bytes into the + // stack. This prevents interference with SAFE_HEAP and ASAN which also + // monitor writes to address zero. + if (max == 0) { + max += 4; + } + // The stack grow downwards towards _emscripten_stack_get_end. + // We write cookies to the final two words in the stack and detect if they are + // ever overwritten. + SAFE_HEAP_STORE(((max) / 4) * 4, 34821223, 4); + SAFE_HEAP_STORE((((max) + (4)) / 4) * 4, 2310721022, 4); +} + +function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + // See writeStackCookie(). + if (max == 0) { + max += 4; + } + var cookie1 = SAFE_HEAP_LOAD(((max) / 4) * 4, 4, 1); + var cookie2 = SAFE_HEAP_LOAD((((max) + (4)) / 4) * 4, 4, 1); + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`); + } +} + +// end include: runtime_stack_check.js +// include: runtime_exceptions.js +// end include: runtime_exceptions.js +// include: runtime_debug.js +// Endianness check +(() => { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"; +})(); + +if (Module["ENVIRONMENT"]) { + throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)"); +} + +function legacyModuleProp(prop, newName, incoming = true) { + if (!Object.getOwnPropertyDescriptor(Module, prop)) { + Object.defineProperty(Module, prop, { + configurable: true, + get() { + let extra = incoming ? " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)" : ""; + abort(`\`Module.${prop}\` has been replaced by \`${newName}\`` + extra); + } + }); + } +} + +function ignoredModuleProp(prop) { + if (Object.getOwnPropertyDescriptor(Module, prop)) { + abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`); + } +} + +// forcing the filesystem exports a few things by default +function isExportedByForceFilesystem(name) { + return name === "FS_createPath" || name === "FS_createDataFile" || name === "FS_createPreloadedFile" || name === "FS_unlink" || name === "addRunDependency" || // The old FS has some functionality that WasmFS lacks. + name === "FS_createLazyFile" || name === "FS_createDevice" || name === "removeRunDependency"; +} + +/** + * Intercept access to a global symbol. This enables us to give informative + * warnings/errors when folks attempt to use symbols they did not include in + * their build, or no symbols that no longer exist. + */ function hookGlobalSymbolAccess(sym, func) { + if (typeof globalThis != "undefined" && !Object.getOwnPropertyDescriptor(globalThis, sym)) { + Object.defineProperty(globalThis, sym, { + configurable: true, + get() { + func(); + return undefined; + } + }); + } +} + +function missingGlobal(sym, msg) { + hookGlobalSymbolAccess(sym, () => { + warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`); + }); +} + +missingGlobal("buffer", "Please use HEAP8.buffer or wasmMemory.buffer"); + +missingGlobal("asm", "Please use wasmExports instead"); + +function missingLibrarySymbol(sym) { + hookGlobalSymbolAccess(sym, () => { + // Can't `abort()` here because it would break code that does runtime + // checks. e.g. `if (typeof SDL === 'undefined')`. + var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`; + // DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in + // library.js, which means $name for a JS name with no prefix, or name + // for a JS name like _name. + var librarySymbol = sym; + if (!librarySymbol.startsWith("_")) { + librarySymbol = "$" + sym; + } + msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`; + if (isExportedByForceFilesystem(sym)) { + msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + warnOnce(msg); + }); + // Any symbol that is not included from the JS library is also (by definition) + // not exported on the Module object. + unexportedRuntimeSymbol(sym); +} + +function unexportedRuntimeSymbol(sym) { + if (!Object.getOwnPropertyDescriptor(Module, sym)) { + Object.defineProperty(Module, sym, { + configurable: true, + get() { + var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`; + if (isExportedByForceFilesystem(sym)) { + msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + abort(msg); + } + }); + } +} + +// Used by XXXXX_DEBUG settings to output debug messages. +function dbg(...args) { + // TODO(sbc): Make this configurable somehow. Its not always convenient for + // logging to show up as warnings. + console.warn(...args); +} + +// end include: runtime_debug.js +// include: memoryprofiler.js +// end include: memoryprofiler.js +// include: runtime_safe_heap.js +/** @param {number|boolean=} isFloat */ function getSafeHeapType(bytes, isFloat) { + switch (bytes) { + case 1: + return "i8"; + + case 2: + return "i16"; + + case 4: + return isFloat ? "float" : "i32"; + + case 8: + return isFloat ? "double" : "i64"; + + default: + abort(`getSafeHeapType() invalid bytes=${bytes}`); + } +} + +/** @param {number|boolean=} isFloat */ function SAFE_HEAP_STORE(dest, value, bytes, isFloat) { + if (dest <= 0) abort(`segmentation fault storing ${bytes} bytes to address ${dest}`); + if (dest % bytes !== 0) abort(`alignment error storing to address ${dest}, which was expected to be aligned to a multiple of ${bytes}`); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk(0); + if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when storing ${bytes} bytes to address ${dest}. DYNAMICTOP=${brk}`); + if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`); + // sbrk-managed memory must be above the stack + if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`); + } + setValue_safe(dest, value, getSafeHeapType(bytes, isFloat)); + return value; +} + +function SAFE_HEAP_STORE_D(dest, value, bytes) { + return SAFE_HEAP_STORE(dest, value, bytes, true); +} + +/** @param {number|boolean=} isFloat */ function SAFE_HEAP_LOAD(dest, bytes, unsigned, isFloat) { + if (dest <= 0) abort(`segmentation fault loading ${bytes} bytes from address ${dest}`); + if (dest % bytes !== 0) abort(`alignment error loading from address ${dest}, which was expected to be aligned to a multiple of ${bytes}`); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk(0); + if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when loading ${bytes} bytes from address ${dest}. DYNAMICTOP=${brk}`); + if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`); + // sbrk-managed memory must be above the stack + if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`); + } + var type = getSafeHeapType(bytes, isFloat); + var ret = getValue_safe(dest, type); + if (unsigned) ret = unSign(ret, parseInt(type.slice(1), 10)); + return ret; +} + +function SAFE_HEAP_LOAD_D(dest, bytes, unsigned) { + return SAFE_HEAP_LOAD(dest, bytes, unsigned, true); +} + +function SAFE_FT_MASK(value, mask) { + var ret = value & mask; + if (ret !== value) { + abort(`Function table mask error: function pointer is ${value} which is masked by ${mask}, the likely cause of this is that the function pointer is being called by the wrong type.`); + } + return ret; +} + +function segfault() { + abort("segmentation fault"); +} + +function alignfault() { + abort("alignment fault"); +} + +// end include: runtime_safe_heap.js +function updateMemoryViews() { + var b = wasmMemory.buffer; + Module["HEAP8"] = HEAP8 = new Int8Array(b); + Module["HEAP16"] = HEAP16 = new Int16Array(b); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(b); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(b); + Module["HEAP32"] = HEAP32 = new Int32Array(b); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(b); + Module["HEAPF32"] = HEAPF32 = new Float32Array(b); + Module["HEAPF64"] = HEAPF64 = new Float64Array(b); + Module["HEAP64"] = HEAP64 = new BigInt64Array(b); + Module["HEAPU64"] = HEAPU64 = new BigUint64Array(b); +} + +// end include: runtime_shared.js +assert(!Module["STACK_SIZE"], "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"); + +assert(typeof Int32Array != "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, "JS engine does not provide full typed array support"); + +// If memory is defined in wasm, the user can't provide it, or set INITIAL_MEMORY +assert(!Module["wasmMemory"], "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"); + +assert(!Module["INITIAL_MEMORY"], "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically"); + +function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(onPreRuns); +} + +function initRuntime() { + assert(!runtimeInitialized); + runtimeInitialized = true; + checkStackCookie(); + if (!Module["noFSInit"] && !FS.initialized) FS.init(); + TTY.init(); + wasmExports["__wasm_call_ctors"](); + FS.ignorePermissions = false; +} + +function preMain() { + checkStackCookie(); +} + +function exitRuntime() { + assert(!runtimeExited); + checkStackCookie(); + ___funcs_on_exit(); + // Native atexit() functions + FS.quit(); + TTY.shutdown(); + runtimeExited = true; +} + +function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(onPostRuns); +} + +// A counter of dependencies for calling run(). If we need to +// do asynchronous work before running, increment this and +// decrement it. Incrementing must happen in a place like +// Module.preRun (used by emcc to add file preloading). +// Note that you can add dependencies in preRun, even though +// it happens right before run - run will be postponed until +// the dependencies are met. +var runDependencies = 0; + +var dependenciesFulfilled = null; + +// overridden to take different actions when all run dependencies are fulfilled +var runDependencyTracking = {}; + +var runDependencyWatcher = null; + +function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } +} + +function addRunDependency(id) { + runDependencies++; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if (runDependencyWatcher === null && typeof setInterval != "undefined") { + // Check for missing dependencies every few seconds + runDependencyWatcher = setInterval(() => { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err(`dependency: ${dep}`); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } +} + +function removeRunDependency(id) { + runDependencies--; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } +} + +/** @param {string|number=} what */ function abort(what) { + Module["onAbort"]?.(what); + what = "Aborted(" + what + ")"; + // TODO(sbc): Should we remove printing and leave it up to whoever + // catches the exception? + err(what); + ABORT = true; + // Use a wasm runtime error, because a JS error might be seen as a foreign + // exception, which means we'd run destructors on it. We need the error to + // simply make the program stop. + // FIXME This approach does not work in Wasm EH because it currently does not assume + // all RuntimeErrors are from traps; it decides whether a RuntimeError is from + // a trap or not based on a hidden field within the object. So at the moment + // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that + // allows this in the wasm spec. + // Suppress closure compiler warning here. Closure compiler's builtin extern + // definition for WebAssembly.RuntimeError claims it takes no arguments even + // though it can. + // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed. + /** @suppress {checkTypes} */ var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + // Throw the error whether or not MODULARIZE is set because abort is used + // in code paths apart from instantiation where an exception is expected + // to be thrown when abort is called. + throw e; +} + +function createExportWrapper(name, nargs) { + return (...args) => { + assert(runtimeInitialized, `native function \`${name}\` called before runtime initialization`); + assert(!runtimeExited, `native function \`${name}\` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)`); + var f = wasmExports[name]; + assert(f, `exported native function \`${name}\` not found`); + // Only assert for too many arguments. Too few can be valid since the missing arguments will be zero filled. + assert(args.length <= nargs, `native function \`${name}\` called with ${args.length} args but expects ${nargs}`); + return f(...args); + }; +} + +var wasmBinaryFile; + +function findWasmBinary() { + if (Module["locateFile"]) { + return locateFile("as-new64.wasm"); + } + // Use bundler-friendly `new URL(..., import.meta.url)` pattern; works in browsers too. + return new URL("as-new64.wasm", import.meta.url).href; +} + +function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw "both async and sync fetching of the wasm failed"; +} + +async function getWasmBinary(binaryFile) { + // If we don't have the binary yet, load it asynchronously using readAsync. + if (!wasmBinary) { + // Fetch the binary using readAsync + try { + var response = await readAsync(binaryFile); + return new Uint8Array(response); + } catch {} + } + // Otherwise, getBinarySync should be able to get it synchronously + return getBinarySync(binaryFile); +} + +async function instantiateArrayBuffer(binaryFile, imports) { + try { + var binary = await getWasmBinary(binaryFile); + var instance = await WebAssembly.instantiate(binary, imports); + return instance; + } catch (reason) { + err(`failed to asynchronously prepare wasm: ${reason}`); + // Warn on some common problems. + if (isFileURI(wasmBinaryFile)) { + err(`warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`); + } + abort(reason); + } +} + +async function instantiateAsync(binary, binaryFile, imports) { + if (!binary && typeof WebAssembly.instantiateStreaming == "function" && !isFileURI(binaryFile) && !ENVIRONMENT_IS_NODE) { + try { + var response = fetch(binaryFile, { + credentials: "same-origin" + }); + var instantiationResult = await WebAssembly.instantiateStreaming(response, imports); + return instantiationResult; + } catch (reason) { + // We expect the most common failure cause to be a bad MIME type for the binary, + // in which case falling back to ArrayBuffer instantiation should work. + err(`wasm streaming compile failed: ${reason}`); + err("falling back to ArrayBuffer instantiation"); + } + } + return instantiateArrayBuffer(binaryFile, imports); +} + +function getWasmImports() { + // prepare imports + return { + "env": wasmImports, + "wasi_snapshot_preview1": wasmImports + }; +} + +// Create the wasm instance. +// Receives the wasm imports, returns the exports. +async function createWasm() { + // Load the wasm module and create an instance of using native support in the JS engine. + // handle a generated wasm instance, receiving its exports and + // performing other necessary setup + /** @param {WebAssembly.Module=} module*/ function receiveInstance(instance, module) { + wasmExports = instance.exports; + wasmExports = applySignatureConversions(wasmExports); + wasmMemory = wasmExports["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateMemoryViews(); + wasmTable = wasmExports["__indirect_function_table"]; + assert(wasmTable, "table not found in wasm exports"); + removeRunDependency("wasm-instantiate"); + return wasmExports; + } + // wait for the pthread pool (if any) + addRunDependency("wasm-instantiate"); + // Prefer streaming instantiation if available. + // Async compilation can be confusing when an error on the page overwrites Module + // (for example, if the order of elements is wrong, and the one defining Module is + // later), so we save Module and check it later. + var trueModule = Module; + function receiveInstantiationResult(result) { + // 'result' is a ResultObject object which has both the module and instance. + // receiveInstance() will swap in the exports (to Module.asm) so they can be called + assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"); + trueModule = null; + // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line. + // When the regression is fixed, can restore the above PTHREADS-enabled path. + return receiveInstance(result["instance"]); + } + var info = getWasmImports(); + // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback + // to manually instantiate the Wasm module themselves. This allows pages to + // run the instantiation parallel to any other async startup actions they are + // performing. + // Also pthreads and wasm workers initialize the wasm instance through this + // path. + if (Module["instantiateWasm"]) { + return new Promise((resolve, reject) => { + try { + Module["instantiateWasm"](info, (mod, inst) => { + receiveInstance(mod, inst); + resolve(mod.exports); + }); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + reject(e); + } + }); + } + wasmBinaryFile ??= findWasmBinary(); + try { + var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info); + var exports = receiveInstantiationResult(result); + return exports; + } catch (e) { + // If instantiation fails, reject the module ready promise. + readyPromiseReject(e); + return Promise.reject(e); + } +} + +// === Body === +// end include: preamble.js +class ExitStatus { + name="ExitStatus"; + constructor(status) { + this.message = `Program terminated with exit(${status})`; + this.status = status; + } +} + +var callRuntimeCallbacks = callbacks => { + while (callbacks.length > 0) { + // Pass the module as the first argument. + callbacks.shift()(Module); + } +}; + +var onPostRuns = []; + +var addOnPostRun = cb => onPostRuns.unshift(cb); + +var onPreRuns = []; + +var addOnPreRun = cb => onPreRuns.unshift(cb); + +/** + * @param {number} ptr + * @param {string} type + */ function getValue(ptr, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + return SAFE_HEAP_LOAD(ptr, 1, 0); + + case "i8": + return SAFE_HEAP_LOAD(ptr, 1, 0); + + case "i16": + return SAFE_HEAP_LOAD(((ptr) / 2) * 2, 2, 0); + + case "i32": + return SAFE_HEAP_LOAD(((ptr) / 4) * 4, 4, 0); + + case "i64": + return HEAP64[((ptr) / 8)]; + + case "float": + return SAFE_HEAP_LOAD_D(((ptr) / 4) * 4, 4, 0); + + case "double": + return SAFE_HEAP_LOAD_D(((ptr) / 8) * 8, 8, 0); + + case "*": + return Number(HEAPU64[((ptr) / 8)]); + + default: + abort(`invalid type for getValue: ${type}`); + } +} + +function getValue_safe(ptr, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + return HEAP8[ptr]; + + case "i8": + return HEAP8[ptr]; + + case "i16": + return HEAP16[((ptr) / 2)]; + + case "i32": + return HEAP32[((ptr) / 4)]; + + case "i64": + return HEAP64[((ptr) / 8)]; + + case "float": + return HEAPF32[((ptr) / 4)]; + + case "double": + return HEAPF64[((ptr) / 8)]; + + case "*": + return Number(HEAPU64[((ptr) / 8)]); + + default: + abort(`invalid type for getValue: ${type}`); + } +} + +var noExitRuntime = Module["noExitRuntime"] || false; + +var ptrToString = ptr => { + assert(typeof ptr === "number"); + return "0x" + ptr.toString(16).padStart(8, "0"); +}; + +/** + * @param {number} ptr + * @param {number} value + * @param {string} type + */ function setValue(ptr, value, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + SAFE_HEAP_STORE(ptr, value, 1); + break; + + case "i8": + SAFE_HEAP_STORE(ptr, value, 1); + break; + + case "i16": + SAFE_HEAP_STORE(((ptr) / 2) * 2, value, 2); + break; + + case "i32": + SAFE_HEAP_STORE(((ptr) / 4) * 4, value, 4); + break; + + case "i64": + HEAP64[((ptr) / 8)] = BigInt(value); + break; + + case "float": + SAFE_HEAP_STORE_D(((ptr) / 4) * 4, value, 4); + break; + + case "double": + SAFE_HEAP_STORE_D(((ptr) / 8) * 8, value, 8); + break; + + case "*": + HEAPU64[((ptr) / 8)] = BigInt(value); + break; + + default: + abort(`invalid type for setValue: ${type}`); + } +} + +function setValue_safe(ptr, value, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + HEAP8[ptr] = value; + break; + + case "i8": + HEAP8[ptr] = value; + break; + + case "i16": + HEAP16[((ptr) / 2)] = value; + break; + + case "i32": + HEAP32[((ptr) / 4)] = value; + break; + + case "i64": + HEAP64[((ptr) / 8)] = BigInt(value); + break; + + case "float": + HEAPF32[((ptr) / 4)] = value; + break; + + case "double": + HEAPF64[((ptr) / 8)] = value; + break; + + case "*": + HEAPU64[((ptr) / 8)] = BigInt(value); + break; + + default: + abort(`invalid type for setValue: ${type}`); + } +} + +var stackRestore = val => __emscripten_stack_restore(val); + +var stackSave = () => _emscripten_stack_get_current(); + +var unSign = (value, bits) => { + if (value >= 0) { + return value; + } + // Need some trickery, since if bits == 32, we are right at the limit of the + // bits JS uses in bitshifts + return bits <= 32 ? 2 * Math.abs(1 << (bits - 1)) + value : Math.pow(2, bits) + value; +}; + +var warnOnce = text => { + warnOnce.shown ||= {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + if (ENVIRONMENT_IS_NODE) text = "warning: " + text; + err(text); + } +}; + +var INT53_MAX = 9007199254740992; + +var INT53_MIN = -9007199254740992; + +var bigintToI53Checked = num => (num < INT53_MIN || num > INT53_MAX) ? NaN : Number(num); + +var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder : undefined; + +/** + * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given + * array that contains uint8 values, returns a copy of that string as a + * Javascript String object. + * heapOrArray is either a regular array, or a JavaScript typed array view. + * @param {number=} idx + * @param {number=} maxBytesToRead + * @return {string} + */ var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + // TextDecoder needs to know the byte length in advance, it doesn't stop on + // null terminator by itself. Also, use the length info to avoid running tiny + // strings through TextDecoder, since .subarray() allocates garbage. + // (As a tiny code save trick, compare endPtr against endIdx using a negation, + // so that undefined/NaN means Infinity) + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ""; + // If building with TextDecoder, we have already computed the string length + // above, so test loop end condition against that + while (idx < endPtr) { + // For UTF8 byte structure, see: + // http://en.wikipedia.org/wiki/UTF-8#Description + // https://www.ietf.org/rfc/rfc2279.txt + // https://tools.ietf.org/html/rfc3629 + var u0 = heapOrArray[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte " + ptrToString(u0) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"); + u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63); + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } + } + return str; +}; + +/** + * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the + * emscripten HEAP, returns a copy of that string as a Javascript String object. + * + * @param {number} ptr + * @param {number=} maxBytesToRead - An optional length that specifies the + * maximum number of bytes to read. You can omit this parameter to scan the + * string until the first 0 byte. If maxBytesToRead is passed, and the string + * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the + * string will cut short at that byte index (i.e. maxBytesToRead will not + * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing + * frequent uses of UTF8ToString() with and without maxBytesToRead may throw + * JS JIT optimizations off, so it is worth to consider consistently using one + * @return {string} + */ var UTF8ToString = (ptr, maxBytesToRead) => { + assert(typeof ptr == "number", `UTF8ToString expects a number (got ${typeof ptr})`); + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; +}; + +function ___assert_fail(condition, filename, line, func) { + condition = bigintToI53Checked(condition); + filename = bigintToI53Checked(filename); + func = bigintToI53Checked(func); + return abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [ filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function" ]); +} + +var wasmTableMirror = []; + +/** @type {WebAssembly.Table} */ var wasmTable; + +var getWasmTableEntry = funcPtr => { + // Function pointers should show up as numbers, even under wasm64, but + // we still have some places where bigint values can flow here. + // https://github.com/emscripten-core/emscripten/issues/18200 + funcPtr = Number(funcPtr); + var func = wasmTableMirror[funcPtr]; + if (!func) { + if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1; + /** @suppress {checkTypes} */ wasmTableMirror[funcPtr] = func = wasmTable.get(BigInt(funcPtr)); + } + /** @suppress {checkTypes} */ assert(wasmTable.get(BigInt(funcPtr)) == func, "JavaScript-side Wasm function table mirror is out of date!"); + return func; +}; + +function ___call_sighandler(fp, sig) { + fp = bigintToI53Checked(fp); + return getWasmTableEntry(fp)(sig); +} + +var PATH = { + isAbs: path => path.charAt(0) === "/", + splitPath: filename => { + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (;up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: path => { + var isAbsolute = PATH.isAbs(path), trailingSlash = path.slice(-1) === "/"; + // Normalize the path + path = PATH.normalizeArray(path.split("/").filter(p => !!p), !isAbsolute).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: path => { + var result = PATH.splitPath(path), root = result[0], dir = result[1]; + if (!root && !dir) { + // No dirname whatsoever + return "."; + } + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.slice(0, -1); + } + return root + dir; + }, + basename: path => path && path.match(/([^\/]+|\/)\/*$/)[1], + join: (...paths) => PATH.normalize(paths.join("/")), + join2: (l, r) => PATH.normalize(l + "/" + r) +}; + +var initRandomFill = () => view => crypto.getRandomValues(view); + +var randomFill = view => { + // Lazily init on the first invocation. + (randomFill = initRandomFill())(view); +}; + +var PATH_FS = { + resolve: (...args) => { + var resolvedPath = "", resolvedAbsolute = false; + for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? args[i] : FS.cwd(); + // Skip empty and invalid entries + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter(p => !!p), !resolvedAbsolute).join("/"); + return ((resolvedAbsolute ? "/" : "") + resolvedPath) || "."; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).slice(1); + to = PATH_FS.resolve(to).slice(1); + function trim(arr) { + var start = 0; + for (;start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (;end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + } +}; + +var FS_stdin_getChar_buffer = []; + +var lengthBytesUTF8 = str => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + var c = str.charCodeAt(i); + // possibly a lead surrogate + if (c <= 127) { + len++; + } else if (c <= 2047) { + len += 2; + } else if (c >= 55296 && c <= 57343) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; +}; + +var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + assert(typeof str === "string", `stringToUTF8Array expects a string (got ${typeof str})`); + // Parameter maxBytesToWrite is not optional. Negative values, 0, null, + // undefined and false each don't write out any bytes. + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + // -1 for string null terminator. + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description + // and https://www.ietf.org/rfc/rfc2279.txt + // and https://tools.ietf.org/html/rfc3629 + var u = str.charCodeAt(i); + // possibly a lead surrogate + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = 65536 + ((u & 1023) << 10) | (u1 & 1023); + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | (u >> 6); + heap[outIdx++] = 128 | (u & 63); + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | (u >> 12); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) warnOnce("Invalid Unicode code point " + ptrToString(u) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."); + heap[outIdx++] = 240 | (u >> 18); + heap[outIdx++] = 128 | ((u >> 12) & 63); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } + } + // Null-terminate the pointer to the buffer. + heap[outIdx] = 0; + return outIdx - startIdx; +}; + +/** @type {function(string, boolean=, number=)} */ var intArrayFromString = (stringy, dontAddNull, length) => { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; +}; + +var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + // we will read data by chunks of BUFSIZE + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + // For some reason we must suppress a closure warning here, even though + // fd definitely exists on process.stdin, and is even the proper way to + // get the fd of stdin, + // https://github.com/nodejs/help/issues/2136#issuecomment-523649904 + // This started to happen after moving this logic out of library_tty.js, + // so it is related to the surrounding code in some unclear manner. + /** @suppress {missingProperties} */ var fd = process.stdin.fd; + try { + bytesRead = fs.readSync(fd, buf, 0, BUFSIZE); + } catch (e) { + // Cross-platform differences: on Windows, reading EOF throws an + // exception, but on other OSes, reading EOF returns 0. Uniformize + // behavior by treating the EOF exception to return 0. + if (e.toString().includes("EOF")) bytesRead = 0; else throw e; + } + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString("utf-8"); + } + } else if (typeof window != "undefined" && typeof window.prompt == "function") { + // Browser. + result = window.prompt("Input: "); + // returns null on cancel + if (result !== null) { + result += "\n"; + } + } else {} + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); +}; + +var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { + input: [], + output: [], + ops + }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + // flush any pending line data + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + } + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + // typical setting + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ 3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + // currently just ignore + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [ 24, 80 ]; + } + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } + } + } +}; + +var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); +}; + +var alignMemory = (size, alignment) => { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; +}; + +var mmapAlloc = size => { + abort("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported"); +}; + +var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, "/", 16895, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + // no supported + throw new FS.ErrnoError(63); + } + MEMFS.ops_table ||= { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink + }, + stream: { + llseek: MEMFS.stream_ops.llseek + } + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync + } + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink + }, + stream: {} + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: FS.chrdev_stream_ops + } + }; + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + // The actual number of bytes used in the typed array, as opposed to contents.length which gives the whole capacity. + // When the byte data of the file is populated, this will point to either a typed array, or a normal JS array. Typed arrays are preferred + // for performance, and used by default. However, typed arrays are not resizable like normal JS arrays are, so there is a small disk size + // penalty involved for appending file writes that continuously grow a file similar to std::vector capacity vs used -scheme. + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.atime = node.mtime = node.ctime = Date.now(); + // add the new node to the parent + if (parent) { + parent.contents[name] = node; + parent.atime = parent.mtime = parent.ctime = node.atime; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes); + // Make sure to not return excess unused bytes. + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + // No need to expand, the storage was already large enough. + // Don't expand strictly to the given requested limit if it's only a very small increase, but instead geometrically grow capacity. + // For small filesizes (<1MB), perform size*2 geometric increase, but for large sizes, do a much more conservative size*1.125 increase to + // avoid overshooting the allocation cap by a very large margin. + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max(newCapacity, (prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125)) >>> 0); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + // At minimum allocate 256b for each file when expanding. + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + // Allocate new storage. + if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + // Fully decommit when requesting a resize to zero. + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + // Allocate new storage. + if (oldContents) { + node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes))); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + // device numbers reuse inode numbers. + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.atime); + attr.mtime = new Date(node.mtime); + attr.ctime = new Date(node.ctime); + // NOTE: In our implementation, st_blocks = Math.ceil(st_size/st_blksize), + // but this is not required by the standard. + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + for (const key of [ "mode", "atime", "mtime", "ctime" ]) { + if (attr[key] != null) { + node[key] = attr[key]; + } + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw new FS.ErrnoError(44); + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + if (FS.isDir(old_node.mode)) { + // if we're overwriting a directory at new_name, make sure it's empty. + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + FS.hashRemoveNode(new_node); + } + // do the internal rewiring + delete old_node.parent.contents[old_node.name]; + new_dir.contents[new_name] = old_node; + old_node.name = new_name; + new_dir.ctime = new_dir.mtime = old_node.parent.ctime = old_node.parent.mtime = Date.now(); + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + readdir(node) { + return [ ".", "..", ...Object.keys(node.contents) ]; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + } + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + // non-trivial, and typed array + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + // The data buffer should be a typed array view + assert(!(buffer instanceof ArrayBuffer)); + // If the buffer is located in main memory (HEAP), and if + // memory can grow, we can't hold on to references of the + // memory buffer, as they may get invalidated. That means we + // need to do copy its contents. + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.mtime = node.ctime = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + // This write is from a typed array to a typed array? + if (canOwn) { + assert(position === 0, "canOwn must imply no weird position inside the file"); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data. + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + // Writing to an already allocated and used subrange of the file? + node.contents.set(buffer.subarray(offset, offset + length), position); + return length; + } + } + // Appending to an existing file and we need to reallocate, or source data did not come as a typed array. + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + // Use typed array write which is available. + node.contents.set(buffer.subarray(offset, offset + length), position); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + // Only make a new copy when MAP_PRIVATE is specified. + if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) { + // We can't emulate MAP_SHARED when the file is not backed by the + // buffer we're mapping to (e.g. the HEAP buffer). + allocated = false; + ptr = contents.byteOffset; + } else { + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + if (contents) { + // Try to avoid unnecessary slices. + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call(contents, position, position + length); + } + } + HEAP8.set(contents, ptr); + } + } + return { + ptr, + allocated + }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + // should we check if bytesWritten and length are the same? + return 0; + } + } +}; + +var asyncLoad = async url => { + var arrayBuffer = await readAsync(url); + assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`); + return new Uint8Array(arrayBuffer); +}; + +var FS_createDataFile = (parent, name, fileData, canRead, canWrite, canOwn) => { + FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); +}; + +var preloadPlugins = Module["preloadPlugins"] || []; + +var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + // Ensure plugins are ready. + if (typeof Browser != "undefined") Browser.init(); + var handled = false; + preloadPlugins.forEach(plugin => { + if (handled) return; + if (plugin["canHandle"](fullname)) { + plugin["handle"](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; +}; + +var FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => { + // TODO we should allow people to just pass in a complete filename instead + // of parent and name being that we just join them anyways + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + // might have several active requests for the same fullname + function processData(byteArray) { + function finish(byteArray) { + preFinish?.(); + if (!dontCreateFile) { + FS_createDataFile(parent, name, byteArray, canRead, canWrite, canOwn); + } + onload?.(); + removeRunDependency(dep); + } + if (FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + onerror?.(); + removeRunDependency(dep); + })) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url).then(processData, onerror); + } else { + processData(url); + } +}; + +var FS_modeStringToFlags = str => { + var flagModes = { + "r": 0, + "r+": 2, + "w": 512 | 64 | 1, + "w+": 512 | 64 | 2, + "a": 1024 | 64 | 1, + "a+": 1024 | 64 | 2 + }; + var flags = flagModes[str]; + if (typeof flags == "undefined") { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; +}; + +var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; +}; + +var strError = errno => UTF8ToString(_strerror(errno)); + +var ERRNO_CODES = { + "EPERM": 63, + "ENOENT": 44, + "ESRCH": 71, + "EINTR": 27, + "EIO": 29, + "ENXIO": 60, + "E2BIG": 1, + "ENOEXEC": 45, + "EBADF": 8, + "ECHILD": 12, + "EAGAIN": 6, + "EWOULDBLOCK": 6, + "ENOMEM": 48, + "EACCES": 2, + "EFAULT": 21, + "ENOTBLK": 105, + "EBUSY": 10, + "EEXIST": 20, + "EXDEV": 75, + "ENODEV": 43, + "ENOTDIR": 54, + "EISDIR": 31, + "EINVAL": 28, + "ENFILE": 41, + "EMFILE": 33, + "ENOTTY": 59, + "ETXTBSY": 74, + "EFBIG": 22, + "ENOSPC": 51, + "ESPIPE": 70, + "EROFS": 69, + "EMLINK": 34, + "EPIPE": 64, + "EDOM": 18, + "ERANGE": 68, + "ENOMSG": 49, + "EIDRM": 24, + "ECHRNG": 106, + "EL2NSYNC": 156, + "EL3HLT": 107, + "EL3RST": 108, + "ELNRNG": 109, + "EUNATCH": 110, + "ENOCSI": 111, + "EL2HLT": 112, + "EDEADLK": 16, + "ENOLCK": 46, + "EBADE": 113, + "EBADR": 114, + "EXFULL": 115, + "ENOANO": 104, + "EBADRQC": 103, + "EBADSLT": 102, + "EDEADLOCK": 16, + "EBFONT": 101, + "ENOSTR": 100, + "ENODATA": 116, + "ETIME": 117, + "ENOSR": 118, + "ENONET": 119, + "ENOPKG": 120, + "EREMOTE": 121, + "ENOLINK": 47, + "EADV": 122, + "ESRMNT": 123, + "ECOMM": 124, + "EPROTO": 65, + "EMULTIHOP": 36, + "EDOTDOT": 125, + "EBADMSG": 9, + "ENOTUNIQ": 126, + "EBADFD": 127, + "EREMCHG": 128, + "ELIBACC": 129, + "ELIBBAD": 130, + "ELIBSCN": 131, + "ELIBMAX": 132, + "ELIBEXEC": 133, + "ENOSYS": 52, + "ENOTEMPTY": 55, + "ENAMETOOLONG": 37, + "ELOOP": 32, + "EOPNOTSUPP": 138, + "EPFNOSUPPORT": 139, + "ECONNRESET": 15, + "ENOBUFS": 42, + "EAFNOSUPPORT": 5, + "EPROTOTYPE": 67, + "ENOTSOCK": 57, + "ENOPROTOOPT": 50, + "ESHUTDOWN": 140, + "ECONNREFUSED": 14, + "EADDRINUSE": 3, + "ECONNABORTED": 13, + "ENETUNREACH": 40, + "ENETDOWN": 38, + "ETIMEDOUT": 73, + "EHOSTDOWN": 142, + "EHOSTUNREACH": 23, + "EINPROGRESS": 26, + "EALREADY": 7, + "EDESTADDRREQ": 17, + "EMSGSIZE": 35, + "EPROTONOSUPPORT": 66, + "ESOCKTNOSUPPORT": 137, + "EADDRNOTAVAIL": 4, + "ENETRESET": 39, + "EISCONN": 30, + "ENOTCONN": 53, + "ETOOMANYREFS": 141, + "EUSERS": 136, + "EDQUOT": 19, + "ESTALE": 72, + "ENOTSUP": 138, + "ENOMEDIUM": 148, + "EILSEQ": 25, + "EOVERFLOW": 61, + "ECANCELED": 11, + "ENOTRECOVERABLE": 56, + "EOWNERDEAD": 62, + "ESTRPIPE": 135 +}; + +var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: class extends Error { + name="ErrnoError"; + // We set the `name` property to be able to identify `FS.ErrnoError` + // - the `name` is a standard ECMA-262 property of error objects. Kind of good to have it anyway. + // - when using PROXYFS, an error can come from an underlying FS + // as different FS objects have their own FS.ErrnoError each, + // the test `err instanceof FS.ErrnoError` won't detect an error coming from another filesystem, causing bugs. + // we'll use the reliable test `err.name == "ErrnoError"` instead + constructor(errno) { + super(runtimeInitialized ? strError(errno) : ""); + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + } + }, + filesystems: null, + syncFSRequests: 0, + readFiles: {}, + FSStream: class { + shared={}; + get object() { + return this.node; + } + set object(val) { + this.node = val; + } + get isRead() { + return (this.flags & 2097155) !== 1; + } + get isWrite() { + return (this.flags & 2097155) !== 0; + } + get isAppend() { + return (this.flags & 1024); + } + get flags() { + return this.shared.flags; + } + set flags(val) { + this.shared.flags = val; + } + get position() { + return this.shared.position; + } + set position(val) { + this.shared.position = val; + } + }, + FSNode: class { + node_ops={}; + stream_ops={}; + readMode=292 | 73; + writeMode=146; + mounted=null; + constructor(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.rdev = rdev; + this.atime = this.mtime = this.ctime = Date.now(); + } + get read() { + return (this.mode & this.readMode) === this.readMode; + } + set read(val) { + val ? this.mode |= this.readMode : this.mode &= ~this.readMode; + } + get write() { + return (this.mode & this.writeMode) === this.writeMode; + } + set write(val) { + val ? this.mode |= this.writeMode : this.mode &= ~this.writeMode; + } + get isFolder() { + return FS.isDir(this.mode); + } + get isDevice() { + return FS.isChrdev(this.mode); + } + }, + lookupPath(path, opts = {}) { + if (!path) { + throw new FS.ErrnoError(44); + } + opts.follow_mount ??= true; + if (!PATH.isAbs(path)) { + path = FS.cwd() + "/" + path; + } + // limit max consecutive symlinks to 40 (SYMLOOP_MAX). + linkloop: for (var nlinks = 0; nlinks < 40; nlinks++) { + // split the absolute path + var parts = path.split("/").filter(p => !!p); + // start at the root + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = (i === parts.length - 1); + if (islast && opts.parent) { + // stop resolving + break; + } + if (parts[i] === ".") { + continue; + } + if (parts[i] === "..") { + current_path = PATH.dirname(current_path); + current = current.parent; + continue; + } + current_path = PATH.join2(current_path, parts[i]); + try { + current = FS.lookupNode(current, parts[i]); + } catch (e) { + // if noent_okay is true, suppress a ENOENT in the last component + // and return an object with an undefined node. This is needed for + // resolving symlinks in the path when creating a file. + if ((e?.errno === 44) && islast && opts.noent_okay) { + return { + path: current_path + }; + } + throw e; + } + // jump to the mount's root node if this is a mountpoint + if (FS.isMountpoint(current) && (!islast || opts.follow_mount)) { + current = current.mounted.root; + } + // by default, lookupPath will not follow a symlink if it is the final path component. + // setting opts.follow = true will override this behavior. + if (FS.isLink(current.mode) && (!islast || opts.follow)) { + if (!current.node_ops.readlink) { + throw new FS.ErrnoError(52); + } + var link = current.node_ops.readlink(current); + if (!PATH.isAbs(link)) { + link = PATH.dirname(current_path) + "/" + link; + } + path = link + "/" + parts.slice(i + 1).join("/"); + continue linkloop; + } + } + return { + path: current_path, + node: current + }; + } + throw new FS.ErrnoError(32); + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" ? `${mount}/${path}` : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + // if we failed to find it in the cache, call into the VFS + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = [ "r", "w", "rw" ][flag & 3]; + if ((flag & 512)) { + perms += "w"; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + // return 0 if any user, group or owner bits are set. + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + if (!FS.isDir(dir.mode)) return 54; + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + if (!FS.isDir(dir.mode)) { + return 54; + } + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || (flags & (512 | 64))) { + // TODO: check for O_SEARCH? (== search for dir only) + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + checkOpExists(op, err) { + if (!op) { + throw new FS.ErrnoError(err); + } + return op; + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: fd => FS.streams[fd], + createStream(stream, fd = -1) { + assert(fd >= -1); + // clone it, so we can return an instance of FSStream + stream = Object.assign(new FS.FSStream, stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + dupStream(origStream, fd = -1) { + var stream = FS.createStream(origStream, fd); + stream.stream_ops?.dup?.(stream); + return stream; + }, + doSetAttr(stream, node, attr) { + var setattr = stream?.stream_ops.setattr; + var arg = setattr ? stream : node; + setattr ??= node.node_ops.setattr; + FS.checkOpExists(setattr, 63); + setattr(arg, attr); + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + // override node's stream ops with the device's + stream.stream_ops = device.stream_ops; + // forward the open call + stream.stream_ops.open?.(stream); + }, + llseek() { + throw new FS.ErrnoError(70); + } + }, + major: dev => ((dev) >> 8), + minor: dev => ((dev) & 255), + makedev: (ma, mi) => ((ma) << 8 | (mi)), + registerDevice(dev, ops) { + FS.devices[dev] = { + stream_ops: ops + }; + }, + getDevice: dev => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [ mount ]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push(...m.mounts); + } + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + // sync all mounts + mounts.forEach(mount => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + if (typeof type == "string") { + // The filesystem was not included, and instead we have an error + // message stored in the variable. + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + mountpoint = lookup.path; + // use the absolute path + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type, + opts, + mountpoint, + mounts: [] + }; + // create a root node for the fs + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + // set as a mountpoint + node.mounted = mount; + // add the new mount to the current mount's children + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + // destroy the nodes for this mount, and all its child mounts + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach(hash => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + // no longer a mountpoint + node.mounted = null; + // remove this mount from the child mounts + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name) { + throw new FS.ErrnoError(28); + } + if (name === "." || name === "..") { + throw new FS.ErrnoError(20); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + statfs(path) { + return FS.statfsNode(FS.lookupPath(path, { + follow: true + }).node); + }, + statfsStream(stream) { + // We keep a separate statfsStream function because noderawfs overrides + // it. In noderawfs, stream.node is sometimes null. Instead, we need to + // look at stream.path. + return FS.statfsNode(stream.node); + }, + statfsNode(node) { + // NOTE: None of the defaults here are true. We're just returning safe and + // sane values. Currently nodefs and rawfs replace these defaults, + // other file systems leave them alone. + var rtn = { + bsize: 4096, + frsize: 4096, + blocks: 1e6, + bfree: 5e5, + bavail: 5e5, + files: FS.nextInode, + ffree: FS.nextInode - 1, + fsid: 42, + flags: 2, + namelen: 255 + }; + if (node.node_ops.statfs) { + Object.assign(rtn, node.node_ops.statfs(node.mount.opts.root)); + } + return rtn; + }, + create(path, mode = 438) { + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode = 511) { + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + // parents must exist + var lookup, old_dir, new_dir; + // let the errors from non existent directories percolate up + lookup = FS.lookupPath(old_path, { + parent: true + }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { + parent: true + }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + // need to be part of the same mount + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + // source must exist + var old_node = FS.lookupNode(old_dir, old_name); + // old path should not be an ancestor of the new path + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + // new path should not be an ancestor of the old path + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + // see if the new path already exists + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + // early out if nothing needs to change + if (old_node === new_node) { + return; + } + // we'll need to delete the old entry + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + // need delete permissions if we'll be overwriting. + // need create permissions if new doesn't already exist. + errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(old_node) || (new_node && FS.isMountpoint(new_node))) { + throw new FS.ErrnoError(10); + } + // if we are going to change the parent, check write permissions + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + // remove the node from the lookup hash + FS.hashRemoveNode(old_node); + // do the underlying fs rename + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + // update old node (we do this here to avoid each backend + // needing to) + old_node.parent = new_dir; + } catch (e) { + throw e; + } finally { + // add the node back to the hash (in case node_ops.rename + // changed its name) + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + var readdir = FS.checkOpExists(node.node_ops.readdir, 54); + return readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + // According to POSIX, we should map EISDIR to EPERM, but + // we instead do what Linux does (and we must, as we use + // the musl linux libc). + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return link.node_ops.readlink(link); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + var node = lookup.node; + var getattr = FS.checkOpExists(node.node_ops.getattr, 63); + return getattr(node); + }, + fstat(fd) { + var stream = FS.getStreamChecked(fd); + var node = stream.node; + var getattr = stream.stream_ops.getattr; + var arg = getattr ? stream : node; + getattr ??= node.node_ops.getattr; + FS.checkOpExists(getattr, 63); + return getattr(arg); + }, + lstat(path) { + return FS.stat(path, true); + }, + doChmod(stream, node, mode, dontFollow) { + FS.doSetAttr(stream, node, { + mode: (mode & 4095) | (node.mode & ~4095), + ctime: Date.now(), + dontFollow + }); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + FS.doChmod(null, node, mode, dontFollow); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.doChmod(stream, stream.node, mode, false); + }, + doChown(stream, node, dontFollow) { + FS.doSetAttr(stream, node, { + timestamp: Date.now(), + dontFollow + }); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + FS.doChown(null, node, dontFollow); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.doChown(stream, stream.node, false); + }, + doTruncate(stream, node, len) { + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.doSetAttr(stream, node, { + size: len, + timestamp: Date.now() + }); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: true + }); + node = lookup.node; + } else { + node = path; + } + FS.doTruncate(null, node, len); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if (len < 0 || (stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.doTruncate(stream, stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + var setattr = FS.checkOpExists(node.node_ops.setattr, 63); + setattr(node, { + atime, + mtime + }); + }, + open(path, flags, mode = 438) { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags; + if ((flags & 64)) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + var isDirPath; + if (typeof path == "object") { + node = path; + } else { + isDirPath = path.endsWith("/"); + // noent_okay makes it so that if the final component of the path + // doesn't exist, lookupPath returns `node: undefined`. `path` will be + // updated to point to the target of all symlinks. + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072), + noent_okay: true + }); + node = lookup.node; + path = lookup.path; + } + // perhaps we need to create the node + var created = false; + if ((flags & 64)) { + if (node) { + // if O_CREAT and O_EXCL are set, error out if the node already exists + if ((flags & 128)) { + throw new FS.ErrnoError(20); + } + } else if (isDirPath) { + throw new FS.ErrnoError(31); + } else { + // node doesn't exist, try to create it + // Ignore the permission bits here to ensure we can `open` this new + // file below. We use chmod below the apply the permissions once the + // file is open. + node = FS.mknod(path, mode | 511, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + // can't truncate a device + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + // if asked only for a directory, then this must be one + if ((flags & 65536) && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + // check permissions, if this is not a file we just created now (it is ok to + // create and write to a file with read-only permissions; it is read-only + // for later use) + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + // do truncation if necessary + if ((flags & 512) && !created) { + FS.truncate(node, 0); + } + // we've already handled these, don't pass down to the underlying vfs + flags &= ~(128 | 512 | 131072); + // register the stream with the filesystem + var stream = FS.createStream({ + node, + path: FS.getPath(node), + // we want the absolute path to the node + flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + // used by the file family libc calls (fopen, fwrite, ferror, etc.) + ungotten: [], + error: false + }); + // call the new stream's open function + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (created) { + FS.chmod(node, mode & 511); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + // free readdir state + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + // seek to the end before writing in append mode + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + // User requests writing to file (prot & PROT_WRITE != 0). + // Checking if we have permissions to write to the file unless + // MAP_PRIVATE flag is set. According to POSIX spec it is possible + // to write to file opened in read-only mode with MAP_PRIVATE flag, + // as all modifications will be visible only in the memory of + // the current process. + if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + if (!length) { + throw new FS.ErrnoError(28); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + assert(offset >= 0); + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags); + }, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { + follow: true + }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices() { + // create /dev + FS.mkdir("/dev"); + // setup /dev/null + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + llseek: () => 0 + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + // setup /dev/tty and /dev/tty1 + // stderr needs to print output using err() rather than out() + // so we register a second tty just for it. + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + // setup /dev/[u]random + // use a buffer to avoid overhead of individual crypto calls per byte + var randomBuffer = new Uint8Array(1024), randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomFill(randomBuffer); + randomLeft = randomBuffer.byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice("/dev", "random", randomByte); + FS.createDevice("/dev", "urandom", randomByte); + // we're not going to emulate the actual shm device, + // just create the tmp dirs that reside in it commonly + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories() { + // create /proc/self/fd which allows /proc/self/fd/6 => readlink gives the + // name of the stream for fd 6 (see test_unistd_ttyname) + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount({ + mount() { + var node = FS.createNode(proc_self, "fd", 16895, 73); + node.stream_ops = { + llseek: MEMFS.stream_ops.llseek + }; + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { + mountpoint: "fake" + }, + node_ops: { + readlink: () => stream.path + }, + id: fd + 1 + }; + ret.parent = ret; + // make it look like a simple root node + return ret; + }, + readdir() { + return Array.from(FS.streams.entries()).filter(([k, v]) => v).map(([k, v]) => k.toString()); + } + }; + return node; + } + }, {}, "/proc/self/fd"); + }, + createStandardStreams(input, output, error) { + // TODO deprecate the old functionality of a single + // input / output callback and that utilizes FS.createDevice + // and instead require a unique set of stream ops + // by default, we symlink the standard streams to the + // default tty devices. however, if the standard streams + // have been overwritten we create a unique device for + // them instead. + if (input) { + FS.createDevice("/dev", "stdin", input); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (output) { + FS.createDevice("/dev", "stdout", null, output); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (error) { + FS.createDevice("/dev", "stderr", null, error); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + // open default streams for the stdin, stdout and stderr devices + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, `invalid handle for stdin (${stdin.fd})`); + assert(stdout.fd === 1, `invalid handle for stdout (${stdout.fd})`); + assert(stderr.fd === 2, `invalid handle for stderr (${stderr.fd})`); + }, + staticInit() { + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { + "MEMFS": MEMFS + }; + }, + init(input, output, error) { + assert(!FS.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"); + FS.initialized = true; + // Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here + input ??= Module["stdin"]; + output ??= Module["stdout"]; + error ??= Module["stderr"]; + FS.createStandardStreams(input, output, error); + }, + quit() { + FS.initialized = false; + // force-flush all streams, so we get musl std streams printed out + _fflush(0); + // close all of our streams + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + // operate from within the context of the symlink's target + try { + var lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null + }; + try { + var lookup = FS.lookupPath(path, { + parent: true + }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i); + data = arr; + } + // make sure we can write to the file + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + }, + createDevice(parent, name, input, output) { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS_getMode(!!input, !!output); + FS.createDevice.major ??= 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + // Create a fake device that a set of stream ops to emulate + // the old behavior. + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + // flush any pending line data + if (output?.buffer?.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + } + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."); + } else { + // Command-line. + try { + obj.contents = readBinary(obj.url); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + // Lazy chunked Uint8Array (implements get and length from Uint8Array). + // Actual getting is abstracted away for eventual reuse. + class LazyUint8Array { + lengthKnown=false; + chunks=[]; + // Loaded chunks. Index is the chunk number + get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + } + setDataGetter(getter) { + this.getter = getter; + } + cacheLength() { + // Find length + var xhr = new XMLHttpRequest; + xhr.open("HEAD", url, false); + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; + var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip"; + var chunkSize = 1024 * 1024; + // Chunk size in bytes + if (!hasByteServing) chunkSize = datalength; + // Function to get a range from the remote URL. + var doXHR = (from, to) => { + if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); + if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!"); + // TODO: Use mozResponseArrayBuffer, responseStream, etc. if available. + var xhr = new XMLHttpRequest; + xhr.open("GET", url, false); + if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + // Some hints to the browser that we want binary data. + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + if (xhr.response !== undefined) { + return new Uint8Array(/** @type{Array} */ (xhr.response || [])); + } + return intArrayFromString(xhr.responseText || "", true); + }; + var lazyArray = this; + lazyArray.setDataGetter(chunkNum => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + // including this byte + end = Math.min(end, datalength - 1); + // if datalength-1 is selected, this is the last block + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + // if the server uses gzip or doesn't supply the length, we have to download the whole file to get the (uncompressed) length + chunkSize = datalength = 1; + // this will force getter(0)/doXHR do download the whole file + datalength = this.getter(0).length; + chunkSize = datalength; + out("LazyFiles on gzip forces download of the whole file when length is accessed"); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + get length() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + get chunkSize() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array; + var properties = { + isDevice: false, + contents: lazyArray + }; + } else { + var properties = { + isDevice: false, + url + }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + // This is a total hack, but I want to get this lazy file code out of the + // core of MEMFS. If we want to keep this lazy file concept I feel it should + // be its own thin LAZYFS proxying calls to MEMFS. + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + // Add a function that defers querying the file size until it is asked the first time. + Object.defineProperties(node, { + usedBytes: { + get: function() { + return this.contents.length; + } + } + }); + // override each stream op with one that tries to force load the lazy file first + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach(key => { + var fn = node.stream_ops[key]; + stream_ops[key] = (...args) => { + FS.forceLoadFile(node); + return fn(...args); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + // normal array + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + // LazyUint8Array from sync binary XHR + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + // use a custom read function + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + // use a custom mmap function + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { + ptr, + allocated: true + }; + }; + node.stream_ops = stream_ops; + return node; + }, + absolutePath() { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder() { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink() { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath() { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc() { + abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc"); + }, + standardizePath() { + abort("FS.standardizePath has been removed; use PATH.normalize instead"); + } +}; + +var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + // relative path + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return dir + "/" + path; + }, + writeStat(buf, stat) { + SAFE_HEAP_STORE(((buf) / 4) * 4, stat.dev, 4); + SAFE_HEAP_STORE((((buf) + (4)) / 4) * 4, stat.mode, 4); + HEAPU64[(((buf) + (8)) / 8)] = BigInt(stat.nlink); + SAFE_HEAP_STORE((((buf) + (16)) / 4) * 4, stat.uid, 4); + SAFE_HEAP_STORE((((buf) + (20)) / 4) * 4, stat.gid, 4); + SAFE_HEAP_STORE((((buf) + (24)) / 4) * 4, stat.rdev, 4); + HEAP64[(((buf) + (32)) / 8)] = BigInt(stat.size); + SAFE_HEAP_STORE((((buf) + (40)) / 4) * 4, 4096, 4); + SAFE_HEAP_STORE((((buf) + (44)) / 4) * 4, stat.blocks, 4); + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + HEAP64[(((buf) + (48)) / 8)] = BigInt(Math.floor(atime / 1e3)); + HEAPU64[(((buf) + (56)) / 8)] = BigInt((atime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (64)) / 8)] = BigInt(Math.floor(mtime / 1e3)); + HEAPU64[(((buf) + (72)) / 8)] = BigInt((mtime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (80)) / 8)] = BigInt(Math.floor(ctime / 1e3)); + HEAPU64[(((buf) + (88)) / 8)] = BigInt((ctime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (96)) / 8)] = BigInt(stat.ino); + return 0; + }, + writeStatFs(buf, stats) { + SAFE_HEAP_STORE((((buf) + (8)) / 4) * 4, stats.bsize, 4); + SAFE_HEAP_STORE((((buf) + (56)) / 4) * 4, stats.bsize, 4); + SAFE_HEAP_STORE((((buf) + (16)) / 4) * 4, stats.blocks, 4); + SAFE_HEAP_STORE((((buf) + (20)) / 4) * 4, stats.bfree, 4); + SAFE_HEAP_STORE((((buf) + (24)) / 4) * 4, stats.bavail, 4); + SAFE_HEAP_STORE((((buf) + (28)) / 4) * 4, stats.files, 4); + SAFE_HEAP_STORE((((buf) + (32)) / 4) * 4, stats.ffree, 4); + SAFE_HEAP_STORE((((buf) + (36)) / 4) * 4, stats.fsid, 4); + SAFE_HEAP_STORE((((buf) + (64)) / 4) * 4, stats.flags, 4); + // ST_NOSUID + SAFE_HEAP_STORE((((buf) + (48)) / 4) * 4, stats.namelen, 4); + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + // MAP_PRIVATE calls need not to be synced back to underlying fs + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + varargs: undefined, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + } +}; + +function ___syscall_chmod(path, mode) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var syscallGetVarargP = () => { + assert(SYSCALLS.varargs != undefined); + var ret = Number(HEAPU64[((SYSCALLS.varargs) / 8)]); + SYSCALLS.varargs += 8; + return ret; +}; + +var syscallGetVarargI = () => { + assert(SYSCALLS.varargs != undefined); + // the `+` prepended here is necessary to convince the JSCompiler that varargs is indeed a number. + var ret = SAFE_HEAP_LOAD(((+SYSCALLS.varargs) / 4) * 4, 4, 0); + SYSCALLS.varargs += 4; + return ret; +}; + +function ___syscall_fcntl64(fd, cmd, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: + { + var arg = syscallGetVarargI(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.dupStream(stream, arg); + return newStream.fd; + } + + case 1: + case 2: + return 0; + + // FD_CLOEXEC makes no sense for a single process. + case 3: + return stream.flags; + + case 4: + { + var arg = syscallGetVarargI(); + stream.flags |= arg; + return 0; + } + + case 5: + { + var arg = syscallGetVarargP(); + var offset = 0; + // We're always unlocked. + SAFE_HEAP_STORE((((arg) + (offset)) / 2) * 2, 2, 2); + return 0; + } + + case 6: + case 7: + return 0; + } + return -28; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_fstat64(fd, buf) { + buf = bigintToI53Checked(buf); + try { + return SYSCALLS.writeStat(buf, FS.fstat(fd)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); +}; + +function ___syscall_getcwd(buf, size) { + buf = bigintToI53Checked(buf); + size = bigintToI53Checked(size); + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1; + if (size < cwdLengthInBytes) return -68; + stringToUTF8(cwd, buf, size); + return cwdLengthInBytes; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_ioctl(fd, op, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: + { + if (!stream.tty) return -59; + return 0; + } + + case 21505: + { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 4) * 4, termios.c_iflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (4)) / 4) * 4, termios.c_oflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (8)) / 4) * 4, termios.c_cflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (12)) / 4) * 4, termios.c_lflag || 0, 4); + for (var i = 0; i < 32; i++) { + SAFE_HEAP_STORE((argp + i) + (17), termios.c_cc[i] || 0, 1); + } + return 0; + } + return 0; + } + + case 21510: + case 21511: + case 21512: + { + if (!stream.tty) return -59; + return 0; + } + + case 21506: + case 21507: + case 21508: + { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = syscallGetVarargP(); + var c_iflag = SAFE_HEAP_LOAD(((argp) / 4) * 4, 4, 0); + var c_oflag = SAFE_HEAP_LOAD((((argp) + (4)) / 4) * 4, 4, 0); + var c_cflag = SAFE_HEAP_LOAD((((argp) + (8)) / 4) * 4, 4, 0); + var c_lflag = SAFE_HEAP_LOAD((((argp) + (12)) / 4) * 4, 4, 0); + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(SAFE_HEAP_LOAD((argp + i) + (17), 1, 0)); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag, + c_oflag, + c_cflag, + c_lflag, + c_cc + }); + } + return 0; + } + + case 21519: + { + if (!stream.tty) return -59; + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 4) * 4, 0, 4); + return 0; + } + + case 21520: + { + if (!stream.tty) return -59; + return -28; + } + + case 21531: + { + var argp = syscallGetVarargP(); + return FS.ioctl(stream, op, argp); + } + + case 21523: + { + // TODO: in theory we should write to the winsize struct that gets + // passed in, but for now musl doesn't read anything on it + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 2) * 2, winsize[0], 2); + SAFE_HEAP_STORE((((argp) + (2)) / 2) * 2, winsize[1], 2); + } + return 0; + } + + case 21524: + { + // TODO: technically, this ioctl call should change the window size. + // but, since emscripten doesn't have any concept of a terminal window + // yet, we'll just silently throw it away as we do TIOCGWINSZ + if (!stream.tty) return -59; + return 0; + } + + case 21515: + { + if (!stream.tty) return -59; + return 0; + } + + default: + return -28; + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_lstat64(path, buf) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.writeStat(buf, FS.lstat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_newfstatat(dirfd, path, buf, flags) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & (~6400); + assert(!flags, `unknown flags in __syscall_newfstatat: ${flags}`); + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.writeStat(buf, nofollow ? FS.lstat(path) : FS.stat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_openat(dirfd, path, flags, varargs) { + path = bigintToI53Checked(path); + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? syscallGetVarargI() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_readlinkat(dirfd, path, buf, bufsize) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + bufsize = bigintToI53Checked(bufsize); + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = SAFE_HEAP_LOAD(buf + len, 1, 0); + stringToUTF8(ret, buf, bufsize + 1); + // readlink is one of the rare functions that write out a C string, but does never append a null to the output buffer(!) + // stringToUTF8() always appends a null byte, so restore the character under the null byte after the write. + SAFE_HEAP_STORE(buf + len, endChar, 1); + return len; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_stat64(path, buf) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.writeStat(buf, FS.stat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_unlinkat(dirfd, path, flags) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (flags === 0) { + FS.unlink(path); + } else if (flags === 512) { + FS.rmdir(path); + } else { + abort("Invalid flags passed to unlinkat"); + } + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var __abort_js = () => abort("native code called abort()"); + +var runtimeKeepaliveCounter = 0; + +var __emscripten_runtime_keepalive_clear = () => { + noExitRuntime = false; + runtimeKeepaliveCounter = 0; +}; + +var isLeapYear = year => year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + +var MONTH_DAYS_LEAP_CUMULATIVE = [ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 ]; + +var MONTH_DAYS_REGULAR_CUMULATIVE = [ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 ]; + +var ydayFromDate = date => { + var leap = isLeapYear(date.getFullYear()); + var monthDaysCumulative = (leap ? MONTH_DAYS_LEAP_CUMULATIVE : MONTH_DAYS_REGULAR_CUMULATIVE); + var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; + // -1 since it's days since Jan 1 + return yday; +}; + +function __localtime_js(time, tmPtr) { + time = bigintToI53Checked(time); + tmPtr = bigintToI53Checked(tmPtr); + var date = new Date(time * 1e3); + SAFE_HEAP_STORE(((tmPtr) / 4) * 4, date.getSeconds(), 4); + SAFE_HEAP_STORE((((tmPtr) + (4)) / 4) * 4, date.getMinutes(), 4); + SAFE_HEAP_STORE((((tmPtr) + (8)) / 4) * 4, date.getHours(), 4); + SAFE_HEAP_STORE((((tmPtr) + (12)) / 4) * 4, date.getDate(), 4); + SAFE_HEAP_STORE((((tmPtr) + (16)) / 4) * 4, date.getMonth(), 4); + SAFE_HEAP_STORE((((tmPtr) + (20)) / 4) * 4, date.getFullYear() - 1900, 4); + SAFE_HEAP_STORE((((tmPtr) + (24)) / 4) * 4, date.getDay(), 4); + var yday = ydayFromDate(date) | 0; + SAFE_HEAP_STORE((((tmPtr) + (28)) / 4) * 4, yday, 4); + HEAP64[(((tmPtr) + (40)) / 8)] = BigInt(-(date.getTimezoneOffset() * 60)); + // Attention: DST is in December in South, and some regions don't have DST at all. + var start = new Date(date.getFullYear(), 0, 1); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + SAFE_HEAP_STORE((((tmPtr) + (32)) / 4) * 4, dst, 4); +} + +var timers = {}; + +var handleException = e => { + // Certain exception types we do not treat as errors since they are used for + // internal control flow. + // 1. ExitStatus, which is thrown by exit() + // 2. "unwind", which is thrown by emscripten_unwind_to_js_event_loop() and others + // that wish to return to JS event loop. + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + checkStackCookie(); + if (e instanceof WebAssembly.RuntimeError) { + if (_emscripten_stack_get_current() <= 0) { + err("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)"); + } + } + quit_(1, e); +}; + +var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0; + +var _proc_exit = code => { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + Module["onExit"]?.(code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); +}; + +/** @suppress {duplicate } */ /** @param {boolean|number=} implicit */ var exitJS = (status, implicit) => { + ofile = FS.readFile("./out.o"); + console.log(ofile); + EXITSTATUS = status; + if (!keepRuntimeAlive()) { + exitRuntime(); + } + // if exit() was called explicitly, warn the user if the runtime isn't actually being shut down + if (keepRuntimeAlive() && !implicit) { + var msg = `program exited (with status: ${status}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`; + readyPromiseReject(msg); + err(msg); + } + _proc_exit(status); +}; + +var _exit = exitJS; + +var maybeExit = () => { + if (runtimeExited) { + return; + } + if (!keepRuntimeAlive()) { + try { + _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } +}; + +var callUserCallback = func => { + if (runtimeExited || ABORT) { + err("user callback triggered after runtime exited or application aborted. Ignoring."); + return; + } + try { + func(); + maybeExit(); + } catch (e) { + handleException(e); + } +}; + +var _emscripten_get_now = () => performance.now(); + +var __setitimer_js = (which, timeout_ms) => { + // First, clear any existing timer. + if (timers[which]) { + clearTimeout(timers[which].id); + delete timers[which]; + } + // A timeout of zero simply cancels the current timeout so we have nothing + // more to do. + if (!timeout_ms) return 0; + var id = setTimeout(() => { + assert(which in timers); + delete timers[which]; + callUserCallback(() => __emscripten_timeout(which, _emscripten_get_now())); + }, timeout_ms); + timers[which] = { + id, + timeout_ms + }; + return 0; +}; + +var __tzset_js = function(timezone, daylight, std_name, dst_name) { + timezone = bigintToI53Checked(timezone); + daylight = bigintToI53Checked(daylight); + std_name = bigintToI53Checked(std_name); + dst_name = bigintToI53Checked(dst_name); + // TODO: Use (malleable) environment variables instead of system settings. + var currentYear = (new Date).getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + // Local standard timezone offset. Local standard time is not adjusted for + // daylight savings. This code uses the fact that getTimezoneOffset returns + // a greater value during Standard Time versus Daylight Saving Time (DST). + // Thus it determines the expected output during Standard Time, and it + // compares whether the output of the given date the same (Standard) or less + // (DST). + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + // timezone is specified as seconds west of UTC ("The external variable + // `timezone` shall be set to the difference, in seconds, between + // Coordinated Universal Time (UTC) and local standard time."), the same + // as returned by stdTimezoneOffset. + // See http://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html + HEAPU64[((timezone) / 8)] = BigInt(stdTimezoneOffset * 60); + SAFE_HEAP_STORE(((daylight) / 4) * 4, Number(winterOffset != summerOffset), 4); + var extractZone = timezoneOffset => { + // Why inverse sign? + // Read here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset + var sign = timezoneOffset >= 0 ? "-" : "+"; + var absOffset = Math.abs(timezoneOffset); + var hours = String(Math.floor(absOffset / 60)).padStart(2, "0"); + var minutes = String(absOffset % 60).padStart(2, "0"); + return `UTC${sign}${hours}${minutes}`; + }; + var winterName = extractZone(winterOffset); + var summerName = extractZone(summerOffset); + assert(winterName); + assert(summerName); + assert(lengthBytesUTF8(winterName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${winterName})`); + assert(lengthBytesUTF8(summerName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${summerName})`); + if (summerOffset < winterOffset) { + // Northern hemisphere + stringToUTF8(winterName, std_name, 17); + stringToUTF8(summerName, dst_name, 17); + } else { + stringToUTF8(winterName, dst_name, 17); + stringToUTF8(summerName, std_name, 17); + } +}; + +var _emscripten_date_now = () => Date.now(); + +function _emscripten_err(str) { + str = bigintToI53Checked(str); + return err(UTF8ToString(str)); +} + +var getHeapMax = () => 2147483648; + +var growMemory = size => { + var b = wasmMemory.buffer; + var pages = ((size - b.byteLength + 65535) / 65536) | 0; + try { + // round size grow request up to wasm page size (fixed 64KB per spec) + wasmMemory.grow(BigInt(pages)); + // .grow() takes a delta compared to the previous size + updateMemoryViews(); + return 1; + } catch (e) { + err(`growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`); + } +}; + +function _emscripten_resize_heap(requestedSize) { + requestedSize = bigintToI53Checked(requestedSize); + var oldSize = HEAPU8.length; + // With multithreaded builds, races can happen (another thread might increase the size + // in between), so return a failure, and let the caller retry. + assert(requestedSize > oldSize); + // Memory resize rules: + // 1. Always increase heap size to at least the requested size, rounded up + // to next page multiple. + // 2a. If MEMORY_GROWTH_LINEAR_STEP == -1, excessively resize the heap + // geometrically: increase the heap size according to + // MEMORY_GROWTH_GEOMETRIC_STEP factor (default +20%), At most + // overreserve by MEMORY_GROWTH_GEOMETRIC_CAP bytes (default 96MB). + // 2b. If MEMORY_GROWTH_LINEAR_STEP != -1, excessively resize the heap + // linearly: increase the heap size by at least + // MEMORY_GROWTH_LINEAR_STEP bytes. + // 3. Max size for the heap is capped at 2048MB-WASM_PAGE_SIZE, or by + // MAXIMUM_MEMORY, or by ASAN limit, depending on which is smallest + // 4. If we were unable to allocate as much memory, it may be due to + // over-eager decision to excessively reserve due to (3) above. + // Hence if an allocation fails, cut down on the amount of excess + // growth, in an attempt to succeed to perform a smaller allocation. + // A limit is set for how much we can grow. We should not exceed that + // (the wasm binary specifies it, so if we tried, we'd fail anyhow). + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + err(`Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`); + return false; + } + // Loop through potential heap size increases. If we attempt a too eager + // reservation that fails, cut down on the attempted size and reserve a + // smaller bump instead. (max 3 times, chosen somewhat arbitrarily) + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + .2 / cutDown); + // ensure geometric growth + // but limit overreserving (default to capping at +96MB overgrowth at most) + overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); + var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536)); + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + err(`Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`); + return false; +} + +var ENV = {}; + +var getExecutableName = () => thisProgram || "./this.program"; + +var getEnvStrings = () => { + if (!getEnvStrings.strings) { + // Default values. + // Browser language detection #8751 + var lang = ((typeof navigator == "object" && navigator.languages && navigator.languages[0]) || "C").replace("-", "_") + ".UTF-8"; + var env = { + "USER": "web_user", + "LOGNAME": "web_user", + "PATH": "/", + "PWD": "/", + "HOME": "/home/web_user", + "LANG": lang, + "_": getExecutableName() + }; + // Apply the user-provided values, if any. + for (var x in ENV) { + // x is a key in ENV; if ENV[x] is undefined, that means it was + // explicitly set to be so. We allow user code to do that to + // force variables with default values to remain unset. + if (ENV[x] === undefined) delete env[x]; else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(`${x}=${env[x]}`); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; +}; + +var stringToAscii = (str, buffer) => { + for (var i = 0; i < str.length; ++i) { + assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255)); + SAFE_HEAP_STORE(buffer++, str.charCodeAt(i), 1); + } + // Null-terminate the string + SAFE_HEAP_STORE(buffer, 0, 1); +}; + +var _environ_get = function(__environ, environ_buf) { + __environ = bigintToI53Checked(__environ); + environ_buf = bigintToI53Checked(environ_buf); + var bufSize = 0; + getEnvStrings().forEach((string, i) => { + var ptr = environ_buf + bufSize; + HEAPU64[(((__environ) + (i * 8)) / 8)] = BigInt(ptr); + stringToAscii(string, ptr); + bufSize += string.length + 1; + }); + return 0; +}; + +var _environ_sizes_get = function(penviron_count, penviron_buf_size) { + penviron_count = bigintToI53Checked(penviron_count); + penviron_buf_size = bigintToI53Checked(penviron_buf_size); + var strings = getEnvStrings(); + HEAPU64[((penviron_count) / 8)] = BigInt(strings.length); + var bufSize = 0; + strings.forEach(string => bufSize += string.length + 1); + HEAPU64[((penviron_buf_size) / 8)] = BigInt(bufSize); + return 0; +}; + +function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +/** @param {number=} offset */ var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[((iov) / 8)]); + var len = Number(HEAPU64[(((iov) + (8)) / 8)]); + iov += 16; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + // nothing more to read + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; +}; + +function _fd_read(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU64[((pnum) / 8)] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +function _fd_seek(fd, offset, whence, newOffset) { + offset = bigintToI53Checked(offset); + newOffset = bigintToI53Checked(newOffset); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + HEAP64[((newOffset) / 8)] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; + // reset readdir state + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +/** @param {number=} offset */ var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[((iov) / 8)]); + var len = Number(HEAPU64[(((iov) + (8)) / 8)]); + iov += 16; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) { + // No more space to write. + break; + } + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; +}; + +function _fd_write(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU64[((pnum) / 8)] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +var stackAlloc = sz => __emscripten_stack_alloc(sz); + +var stringToUTF8OnStack = str => { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8(str, ret, size); + return ret; +}; + +FS.createPreloadedFile = FS_createPreloadedFile; + +FS.staticInit(); + +function checkIncomingModuleAPI() { + ignoredModuleProp("fetchSettings"); +} + +var wasmImports = { + /** @export */ __assert_fail: ___assert_fail, + /** @export */ __call_sighandler: ___call_sighandler, + /** @export */ __syscall_chmod: ___syscall_chmod, + /** @export */ __syscall_fcntl64: ___syscall_fcntl64, + /** @export */ __syscall_fstat64: ___syscall_fstat64, + /** @export */ __syscall_getcwd: ___syscall_getcwd, + /** @export */ __syscall_ioctl: ___syscall_ioctl, + /** @export */ __syscall_lstat64: ___syscall_lstat64, + /** @export */ __syscall_newfstatat: ___syscall_newfstatat, + /** @export */ __syscall_openat: ___syscall_openat, + /** @export */ __syscall_readlinkat: ___syscall_readlinkat, + /** @export */ __syscall_stat64: ___syscall_stat64, + /** @export */ __syscall_unlinkat: ___syscall_unlinkat, + /** @export */ _abort_js: __abort_js, + /** @export */ _emscripten_runtime_keepalive_clear: __emscripten_runtime_keepalive_clear, + /** @export */ _localtime_js: __localtime_js, + /** @export */ _setitimer_js: __setitimer_js, + /** @export */ _tzset_js: __tzset_js, + /** @export */ alignfault, + /** @export */ emscripten_date_now: _emscripten_date_now, + /** @export */ emscripten_err: _emscripten_err, + /** @export */ emscripten_resize_heap: _emscripten_resize_heap, + /** @export */ environ_get: _environ_get, + /** @export */ environ_sizes_get: _environ_sizes_get, + /** @export */ exit: _exit, + /** @export */ fd_close: _fd_close, + /** @export */ fd_read: _fd_read, + /** @export */ fd_seek: _fd_seek, + /** @export */ fd_write: _fd_write, + /** @export */ proc_exit: _proc_exit, + /** @export */ segfault +}; + +var wasmExports = await createWasm(); + +var ___wasm_call_ctors = createExportWrapper("__wasm_call_ctors", 0); + +var _main = Module["_main"] = createExportWrapper("__main_argc_argv", 2); + +var _fflush = createExportWrapper("fflush", 1); + +var _sbrk = createExportWrapper("sbrk", 1); + +var _strerror = createExportWrapper("strerror", 1); + +var ___funcs_on_exit = createExportWrapper("__funcs_on_exit", 0); + +var __emscripten_timeout = createExportWrapper("_emscripten_timeout", 2); + +var _emscripten_get_sbrk_ptr = createExportWrapper("emscripten_get_sbrk_ptr", 0); + +var _emscripten_stack_init = wasmExports["emscripten_stack_init"]; + +var _emscripten_stack_get_free = wasmExports["emscripten_stack_get_free"]; + +var _emscripten_stack_get_base = wasmExports["emscripten_stack_get_base"]; + +var _emscripten_stack_get_end = wasmExports["emscripten_stack_get_end"]; + +var __emscripten_stack_restore = wasmExports["_emscripten_stack_restore"]; + +var __emscripten_stack_alloc = wasmExports["_emscripten_stack_alloc"]; + +var _emscripten_stack_get_current = wasmExports["emscripten_stack_get_current"]; + +var ___cxa_increment_exception_refcount = createExportWrapper("__cxa_increment_exception_refcount", 1); + +// Argument name here must shadow the `wasmExports` global so +// that it is recognised by metadce and minify-import-export-names +// passes. +function applySignatureConversions(wasmExports) { + // First, make a copy of the incoming exports object + wasmExports = Object.assign({}, wasmExports); + var makeWrapper___PP = f => (a0, a1, a2) => f(a0, BigInt(a1 ? a1 : 0), BigInt(a2 ? a2 : 0)); + var makeWrapper__p = f => a0 => f(BigInt(a0)); + var makeWrapper_pP = f => a0 => Number(f(BigInt(a0 ? a0 : 0))); + var makeWrapper_p_ = f => a0 => Number(f(a0)); + var makeWrapper_p = f => () => Number(f()); + var makeWrapper_pp = f => a0 => Number(f(BigInt(a0))); + wasmExports["__main_argc_argv"] = makeWrapper___PP(wasmExports["__main_argc_argv"]); + wasmExports["fflush"] = makeWrapper__p(wasmExports["fflush"]); + wasmExports["sbrk"] = makeWrapper_pP(wasmExports["sbrk"]); + wasmExports["strerror"] = makeWrapper_p_(wasmExports["strerror"]); + wasmExports["emscripten_stack_get_base"] = makeWrapper_p(wasmExports["emscripten_stack_get_base"]); + wasmExports["emscripten_stack_get_end"] = makeWrapper_p(wasmExports["emscripten_stack_get_end"]); + wasmExports["_emscripten_stack_restore"] = makeWrapper__p(wasmExports["_emscripten_stack_restore"]); + wasmExports["_emscripten_stack_alloc"] = makeWrapper_pp(wasmExports["_emscripten_stack_alloc"]); + wasmExports["emscripten_stack_get_current"] = makeWrapper_p(wasmExports["emscripten_stack_get_current"]); + wasmExports["__cxa_increment_exception_refcount"] = makeWrapper__p(wasmExports["__cxa_increment_exception_refcount"]); + return wasmExports; +} + +// include: postamble.js +// === Auto-generated postamble setup entry stuff === +Module["run"] = run; + +Module["FS"] = FS; + + +var missingLibrarySymbols = [ "writeI53ToI64", "writeI53ToI64Clamped", "writeI53ToI64Signaling", "writeI53ToU64Clamped", "writeI53ToU64Signaling", "readI53FromI64", "readI53FromU64", "convertI32PairToI53", "convertI32PairToI53Checked", "convertU32PairToI53", "getTempRet0", "setTempRet0", "inetPton4", "inetNtop4", "inetPton6", "inetNtop6", "readSockaddr", "writeSockaddr", "emscriptenLog", "readEmAsmArgs", "jstoi_q", "listenOnce", "autoResumeAudioContext", "getDynCaller", "dynCall", "runtimeKeepalivePush", "runtimeKeepalivePop", "asmjsMangle", "HandleAllocator", "getNativeTypeSize", "addOnInit", "addOnPostCtor", "addOnPreMain", "addOnExit", "STACK_SIZE", "STACK_ALIGN", "POINTER_SIZE", "ASSERTIONS", "getCFunc", "ccall", "cwrap", "uleb128Encode", "sigToWasmTypes", "generateFuncType", "convertJsFunctionToWasm", "getEmptyTableSlot", "updateTableMap", "getFunctionAddress", "addFunction", "removeFunction", "reallyNegative", "strLen", "reSign", "formatString", "intArrayToString", "AsciiToString", "UTF16ToString", "stringToUTF16", "lengthBytesUTF16", "UTF32ToString", "stringToUTF32", "lengthBytesUTF32", "stringToNewUTF8", "writeArrayToMemory", "registerKeyEventCallback", "maybeCStringToJsString", "findEventTarget", "getBoundingClientRect", "fillMouseEventData", "registerMouseEventCallback", "registerWheelEventCallback", "registerUiEventCallback", "registerFocusEventCallback", "fillDeviceOrientationEventData", "registerDeviceOrientationEventCallback", "fillDeviceMotionEventData", "registerDeviceMotionEventCallback", "screenOrientation", "fillOrientationChangeEventData", "registerOrientationChangeEventCallback", "fillFullscreenChangeEventData", "registerFullscreenChangeEventCallback", "JSEvents_requestFullscreen", "JSEvents_resizeCanvasForFullscreen", "registerRestoreOldStyle", "hideEverythingExceptGivenElement", "restoreHiddenElements", "setLetterbox", "softFullscreenResizeWebGLRenderTarget", "doRequestFullscreen", "fillPointerlockChangeEventData", "registerPointerlockChangeEventCallback", "registerPointerlockErrorEventCallback", "requestPointerLock", "fillVisibilityChangeEventData", "registerVisibilityChangeEventCallback", "registerTouchEventCallback", "fillGamepadEventData", "registerGamepadEventCallback", "registerBeforeUnloadEventCallback", "fillBatteryEventData", "battery", "registerBatteryEventCallback", "setCanvasElementSize", "getCanvasElementSize", "jsStackTrace", "getCallstack", "convertPCtoSourceLocation", "checkWasiClock", "wasiRightsToMuslOFlags", "wasiOFlagsToMuslOFlags", "safeSetTimeout", "setImmediateWrapped", "safeRequestAnimationFrame", "clearImmediateWrapped", "registerPostMainLoop", "registerPreMainLoop", "getPromise", "makePromise", "idsToPromises", "makePromiseCallback", "ExceptionInfo", "findMatchingCatch", "Browser_asyncPrepareDataCounter", "arraySum", "addDays", "getSocketFromFD", "getSocketAddress", "FS_unlink", "FS_mkdirTree", "_setNetworkCallback", "heapObjectForWebGLType", "toTypedArrayIndex", "webgl_enable_ANGLE_instanced_arrays", "webgl_enable_OES_vertex_array_object", "webgl_enable_WEBGL_draw_buffers", "webgl_enable_WEBGL_multi_draw", "webgl_enable_EXT_polygon_offset_clamp", "webgl_enable_EXT_clip_control", "webgl_enable_WEBGL_polygon_mode", "emscriptenWebGLGet", "computeUnpackAlignedImageSize", "colorChannelsInGlTextureFormat", "emscriptenWebGLGetTexPixelData", "emscriptenWebGLGetUniform", "webglGetUniformLocation", "webglPrepareUniformLocationsBeforeFirstUse", "webglGetLeftBracePos", "emscriptenWebGLGetVertexAttrib", "__glGetActiveAttribOrUniform", "writeGLArray", "registerWebGlEventCallback", "runAndAbortIfError", "ALLOC_NORMAL", "ALLOC_STACK", "allocate", "writeStringToMemory", "writeAsciiToMemory", "setErrNo", "demangle", "stackTrace" ]; + +missingLibrarySymbols.forEach(missingLibrarySymbol); + +var unexportedSymbols = [ "addRunDependency", "removeRunDependency", "out", "err", "callMain", "abort", "wasmMemory", "wasmExports", "writeStackCookie", "checkStackCookie", "INT53_MAX", "INT53_MIN", "bigintToI53Checked", "stackSave", "stackRestore", "stackAlloc", "ptrToString", "zeroMemory", "exitJS", "getHeapMax", "growMemory", "ENV", "ERRNO_CODES", "strError", "DNS", "Protocols", "Sockets", "timers", "warnOnce", "readEmAsmArgsArray", "jstoi_s", "getExecutableName", "handleException", "keepRuntimeAlive", "callUserCallback", "maybeExit", "asyncLoad", "alignMemory", "mmapAlloc", "wasmTable", "noExitRuntime", "addOnPreRun", "addOnPostRun", "freeTableIndexes", "functionsInTableMap", "unSign", "setValue", "getValue", "PATH", "PATH_FS", "UTF8Decoder", "UTF8ArrayToString", "UTF8ToString", "stringToUTF8Array", "stringToUTF8", "lengthBytesUTF8", "intArrayFromString", "stringToAscii", "UTF16Decoder", "stringToUTF8OnStack", "JSEvents", "specialHTMLTargets", "findCanvasEventTarget", "currentFullscreenStrategy", "restoreOldWindowedStyle", "UNWIND_CACHE", "ExitStatus", "getEnvStrings", "doReadv", "doWritev", "initRandomFill", "randomFill", "emSetImmediate", "emClearImmediate_deps", "emClearImmediate", "promiseMap", "uncaughtExceptionCount", "exceptionLast", "exceptionCaught", "Browser", "getPreloadedImageData__data", "wget", "MONTH_DAYS_REGULAR", "MONTH_DAYS_LEAP", "MONTH_DAYS_REGULAR_CUMULATIVE", "MONTH_DAYS_LEAP_CUMULATIVE", "isLeapYear", "ydayFromDate", "SYSCALLS", "preloadPlugins", "FS_createPreloadedFile", "FS_modeStringToFlags", "FS_getMode", "FS_stdin_getChar_buffer", "FS_stdin_getChar", "FS_createPath", "FS_createDevice", "FS_readFile", "FS_createDataFile", "FS_createLazyFile", "MEMFS", "TTY", "PIPEFS", "SOCKFS", "tempFixedLengthArray", "miniTempWebGLFloatBuffers", "miniTempWebGLIntBuffers", "GL", "AL", "GLUT", "EGL", "GLEW", "IDBStore", "SDL", "SDL_gfx", "allocateUTF8", "allocateUTF8OnStack", "print", "printErr" ]; + +unexportedSymbols.forEach(unexportedRuntimeSymbol); + +var calledRun; + +function callMain(args = []) { + assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'); + assert(typeof onPreRuns === "undefined" || onPreRuns.length == 0, "cannot call main when preRun functions remain to be called"); + var entryFunction = _main; + args.unshift(thisProgram); + var argc = args.length; + var argv = stackAlloc((argc + 1) * 8); + var argv_ptr = argv; + args.forEach(arg => { + HEAPU64[((argv_ptr) / 8)] = BigInt(stringToUTF8OnStack(arg)); + argv_ptr += 8; + }); + HEAPU64[((argv_ptr) / 8)] = BigInt(0); + try { + var ret = entryFunction(argc, BigInt(argv)); + ofile = FS.readFile("./out.o"); + console.log(ofile); + // if we're not running an evented main loop, it's time to exit + exitJS(ret, /* implicit = */ true); + return ret; + } catch (e) { + ofile = FS.readFile("./out.o"); + console.log(ofile); + return handleException(e); + } +} + +function stackCheckInit() { + // This is normally called automatically during __wasm_call_ctors but need to + // get these values before even running any of the ctors so we call it redundantly + // here. + _emscripten_stack_init(); + // TODO(sbc): Move writeStackCookie to native to to avoid this. + writeStackCookie(); +} + +function run(args = arguments_) { + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + stackCheckInit(); + preRun(); + // a preRun added a dependency, run will be called later + if (runDependencies > 0) { + dependenciesFulfilled = run; + return; + } + function doRun() { + // run may have just been called through dependencies being fulfilled just in this very frame, + // or while the async setStatus time below was happening + assert(!calledRun); + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + var asm_files = args.pop(); + for (let i = 0; i < asm_files.length; i ++ ){ + FS.writeFile('./'+asm_files[i].name, asm_files[i].code); + args.push('./'+asm_files[i].name); + } + // for(var i = 2; i < args.length; i++) { + // FS.writeFile('./code' + (i - 2) + '.s', args[i]); + // args[i] = 'code' + (i - 2) + '.s'; + // } + args = ["-o","out.o", ...args, /*"-march=rv64imfdv", "-mabi=lp64d", "code.s"*/]; + preMain(); + Module["onRuntimeInitialized"]?.(); + var noInitialRun = Module["noInitialRun"] || true; + legacyModuleProp("noInitialRun", "noInitialRun"); + callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(() => { + setTimeout(() => Module["setStatus"](""), 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); + return ofile; +} + +if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } +} + +// run(); + +// end include: postamble.js +// include: postamble_modularize.js +// In MODULARIZE mode we wrap the generated code in a factory function +// and return either the Module itself, or a promise of the module. +// We assign to the `moduleRtn` global here and configure closure to see +// this as and extern so it won't get minified. +moduleRtn = readyPromise; + +// Assertion for attempting to access module properties on the incoming +// moduleArg. In the past we used this object as the prototype of the module +// and assigned properties to it, but now we return a distinct object. This +// keeps the instance private until it is ready (i.e the promise has been +// resolved). +for (const prop of Object.keys(Module)) { + if (!(prop in moduleArg)) { + Object.defineProperty(moduleArg, prop, { + configurable: true, + get() { + abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`); + } + }); + } +} + + readyPromiseResolve(Module); + return moduleRtn; +} +); +})(); +// (() => { +// // Create a small, never-async wrapper around Module which +// // checks for callers incorrectly using it with `new`. +// var real_Module = Module; +// Module = function(arg) { +// if (new.target) throw new Error("Module() should not be called with `new Module()`"); +// return real_Module(arg); +// } +// })(); +export default Module; diff --git a/src/core/assembler/sailAssembler/web/wasm/as-new64.wasm b/src/core/assembler/sailAssembler/web/wasm/as-new64.wasm new file mode 100755 index 000000000..dcfeb4efa Binary files /dev/null and b/src/core/assembler/sailAssembler/web/wasm/as-new64.wasm differ diff --git a/src/core/assembler/sailAssembler/web/wasm/ld-new.js b/src/core/assembler/sailAssembler/web/wasm/ld-new.js new file mode 100644 index 000000000..46fffe15b --- /dev/null +++ b/src/core/assembler/sailAssembler/web/wasm/ld-new.js @@ -0,0 +1,5899 @@ +let elfile = null; +import { libs_to_load } from "../CNAssambler.mjs"; +var Module = (() => { + var _scriptDir = import.meta.url; + + return ( +function(Module) { + Module = Module || {}; + +var Module = typeof Module != "undefined" ? Module : {}; + +var readyPromiseResolve, readyPromiseReject; + +Module["ready"] = new Promise(function(resolve, reject) { + readyPromiseResolve = resolve; + readyPromiseReject = reject; +}); + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "_main")) { + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + get: function() { + abort("You are getting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + set: function() { + abort("You are setting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "___stdio_exit")) { + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + get: function() { + abort("You are getting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + set: function() { + abort("You are setting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "onRuntimeInitialized")) { + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + get: function() { + abort("You are getting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + set: function() { + abort("You are setting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +var moduleOverrides = Object.assign({}, Module); + +var arguments_ = []; + +var thisProgram = "./this.program"; + +var quit_ = (status, toThrow) => { + throw toThrow; +}; + +var ENVIRONMENT_IS_WEB = typeof window == "object"; + +var ENVIRONMENT_IS_WORKER = typeof importScripts == "function"; + +var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string"; + +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +if (Module["ENVIRONMENT"]) { + throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)"); +} + +var scriptDirectory = ""; + +function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; +} + +var read_, readAsync, readBinary, setWindowTitle; + +function logExceptionOnExit(e) { + if (e instanceof ExitStatus) return; + let toLog = e; + if (e && typeof e == "object" && e.stack) { + toLog = [ e, e.stack ]; + } + err("exiting due to exception: " + toLog); +} + +var fs; + +var nodePath; + +var requireNodeFS; + +if (ENVIRONMENT_IS_NODE) { + if (!(typeof process == "object" && typeof require == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = require("path").dirname(scriptDirectory) + "/"; + } else { + scriptDirectory = __dirname + "/"; + } + requireNodeFS = (() => { + if (!nodePath) { + fs = require("fs"); + nodePath = require("path"); + } + }); + read_ = function shell_read(filename, binary) { + requireNodeFS(); + filename = nodePath["normalize"](filename); + return fs.readFileSync(filename, binary ? undefined : "utf8"); + }; + readBinary = (filename => { + var ret = read_(filename, true); + if (!ret.buffer) { + ret = new Uint8Array(ret); + } + assert(ret.buffer); + return ret; + }); + readAsync = ((filename, onload, onerror) => { + requireNodeFS(); + filename = nodePath["normalize"](filename); + fs.readFile(filename, function(err, data) { + if (err) onerror(err); else onload(data.buffer); + }); + }); + if (process["argv"].length > 1) { + thisProgram = process["argv"][1].replace(/\\/g, "/"); + } + arguments_ = process["argv"].slice(2); + process["on"]("uncaughtException", function(ex) { + if (!(ex instanceof ExitStatus)) { + throw ex; + } + }); + process["on"]("unhandledRejection", function(reason) { + throw reason; + }); + quit_ = ((status, toThrow) => { + if (keepRuntimeAlive()) { + process["exitCode"] = status; + throw toThrow; + } + logExceptionOnExit(toThrow); + process["exit"](status); + }); + Module["inspect"] = function() { + return "[Emscripten Module object]"; + }; +} else if (ENVIRONMENT_IS_SHELL) { + if (typeof process == "object" && typeof require === "function" || typeof window == "object" || typeof importScripts == "function") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + if (typeof read != "undefined") { + read_ = function shell_read(f) { + return read(f); + }; + } + readBinary = function readBinary(f) { + let data; + if (typeof readbuffer == "function") { + return new Uint8Array(readbuffer(f)); + } + data = read(f, "binary"); + assert(typeof data == "object"); + return data; + }; + readAsync = function readAsync(f, onload, onerror) { + setTimeout(() => onload(readBinary(f)), 0); + }; + if (typeof scriptArgs != "undefined") { + arguments_ = scriptArgs; + } else if (typeof arguments != "undefined") { + arguments_ = arguments; + } + if (typeof quit == "function") { + quit_ = ((status, toThrow) => { + logExceptionOnExit(toThrow); + quit(status); + }); + } + if (typeof print != "undefined") { + if (typeof console == "undefined") console = {}; + console.log = print; + console.warn = console.error = typeof printErr != "undefined" ? printErr : print; + } +} else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + if (_scriptDir) { + scriptDirectory = _scriptDir; + } + if (scriptDirectory.indexOf("blob:") !== 0) { + scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1); + } else { + scriptDirectory = ""; + } + if (!(typeof window == "object" || typeof importScripts == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + { + read_ = (url => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.send(null); + return xhr.responseText; + }); + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(xhr.response); + }); + } + readAsync = ((url, onload, onerror) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = (() => { + if (xhr.status == 200 || xhr.status == 0 && xhr.response) { + onload(xhr.response); + return; + } + onerror(); + }); + xhr.onerror = onerror; + xhr.send(null); + }); + } + setWindowTitle = (title => document.title = title); +} else { + throw new Error("environment detection error"); +} + +var out = Module["print"] || console.log.bind(console); + +var err = Module["printErr"] || console.warn.bind(console); + +Object.assign(Module, moduleOverrides); + +moduleOverrides = null; + +if (Module["arguments"]) arguments_ = Module["arguments"]; + +if (!Object.getOwnPropertyDescriptor(Module, "arguments")) { + Object.defineProperty(Module, "arguments", { + configurable: true, + get: function() { + abort("Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + +if (!Object.getOwnPropertyDescriptor(Module, "thisProgram")) { + Object.defineProperty(Module, "thisProgram", { + configurable: true, + get: function() { + abort("Module.thisProgram has been replaced with plain thisProgram (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (Module["quit"]) quit_ = Module["quit"]; + +if (!Object.getOwnPropertyDescriptor(Module, "quit")) { + Object.defineProperty(Module, "quit", { + configurable: true, + get: function() { + abort("Module.quit has been replaced with plain quit_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["cdInitializerPrefixURL"] == "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["filePackagePrefixURL"] == "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["read"] == "undefined", "Module.read option was removed (modify read_ in JS)"); + +assert(typeof Module["readAsync"] == "undefined", "Module.readAsync option was removed (modify readAsync in JS)"); + +assert(typeof Module["readBinary"] == "undefined", "Module.readBinary option was removed (modify readBinary in JS)"); + +assert(typeof Module["setWindowTitle"] == "undefined", "Module.setWindowTitle option was removed (modify setWindowTitle in JS)"); + +assert(typeof Module["TOTAL_MEMORY"] == "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"); + +if (!Object.getOwnPropertyDescriptor(Module, "read")) { + Object.defineProperty(Module, "read", { + configurable: true, + get: function() { + abort("Module.read has been replaced with plain read_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "readAsync")) { + Object.defineProperty(Module, "readAsync", { + configurable: true, + get: function() { + abort("Module.readAsync has been replaced with plain readAsync (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "readBinary")) { + Object.defineProperty(Module, "readBinary", { + configurable: true, + get: function() { + abort("Module.readBinary has been replaced with plain readBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "setWindowTitle")) { + Object.defineProperty(Module, "setWindowTitle", { + configurable: true, + get: function() { + abort("Module.setWindowTitle has been replaced with plain setWindowTitle (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js"; + +var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js"; + +var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js"; + +var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js"; + +assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add 'shell' to `-s ENVIRONMENT` to enable."); + +var STACK_ALIGN = 16; + +var POINTER_SIZE = 4; + +function getNativeTypeSize(type) { + switch (type) { + case "i1": + case "i8": + return 1; + + case "i16": + return 2; + + case "i32": + return 4; + + case "i64": + return 8; + + case "float": + return 4; + + case "double": + return 8; + + default: + { + if (type[type.length - 1] === "*") { + return POINTER_SIZE; + } else if (type[0] === "i") { + const bits = Number(type.substr(1)); + assert(bits % 8 === 0, "getNativeTypeSize invalid bits " + bits + ", type " + type); + return bits / 8; + } else { + return 0; + } + } + } +} + +function warnOnce(text) { + if (!warnOnce.shown) warnOnce.shown = {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + err(text); + } +} + +function convertJsFunctionToWasm(func, sig) { + if (typeof WebAssembly.Function == "function") { + var typeNames = { + "i": "i32", + "j": "i64", + "f": "f32", + "d": "f64" + }; + var type = { + parameters: [], + results: sig[0] == "v" ? [] : [ typeNames[sig[0]] ] + }; + for (var i = 1; i < sig.length; ++i) { + type.parameters.push(typeNames[sig[i]]); + } + return new WebAssembly.Function(type, func); + } + var typeSection = [ 1, 0, 1, 96 ]; + var sigRet = sig.slice(0, 1); + var sigParam = sig.slice(1); + var typeCodes = { + "i": 127, + "j": 126, + "f": 125, + "d": 124 + }; + typeSection.push(sigParam.length); + for (var i = 0; i < sigParam.length; ++i) { + typeSection.push(typeCodes[sigParam[i]]); + } + if (sigRet == "v") { + typeSection.push(0); + } else { + typeSection = typeSection.concat([ 1, typeCodes[sigRet] ]); + } + typeSection[1] = typeSection.length - 2; + var bytes = new Uint8Array([ 0, 97, 115, 109, 1, 0, 0, 0 ].concat(typeSection, [ 2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0 ])); + var module = new WebAssembly.Module(bytes); + var instance = new WebAssembly.Instance(module, { + "e": { + "f": func + } + }); + var wrappedFunc = instance.exports["f"]; + return wrappedFunc; +} + +var freeTableIndexes = []; + +var functionsInTableMap; + +function getEmptyTableSlot() { + if (freeTableIndexes.length) { + return freeTableIndexes.pop(); + } + try { + wasmTable.grow(1); + } catch (err) { + if (!(err instanceof RangeError)) { + throw err; + } + throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."; + } + return wasmTable.length - 1; +} + +function updateTableMap(offset, count) { + for (var i = offset; i < offset + count; i++) { + var item = getWasmTableEntry(i); + if (item) { + functionsInTableMap.set(item, i); + } + } +} + +function addFunction(func, sig) { + assert(typeof func != "undefined"); + if (!functionsInTableMap) { + functionsInTableMap = new WeakMap(); + updateTableMap(0, wasmTable.length); + } + if (functionsInTableMap.has(func)) { + return functionsInTableMap.get(func); + } + var ret = getEmptyTableSlot(); + try { + setWasmTableEntry(ret, func); + } catch (err) { + if (!(err instanceof TypeError)) { + throw err; + } + assert(typeof sig != "undefined", "Missing signature argument to addFunction: " + func); + var wrapped = convertJsFunctionToWasm(func, sig); + setWasmTableEntry(ret, wrapped); + } + functionsInTableMap.set(func, ret); + return ret; +} + +function removeFunction(index) { + functionsInTableMap.delete(getWasmTableEntry(index)); + freeTableIndexes.push(index); +} + +var tempRet0 = 0; + +var setTempRet0 = value => { + tempRet0 = value; +}; + +var getTempRet0 = () => tempRet0; + +var wasmBinary; + +if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"]; + +if (!Object.getOwnPropertyDescriptor(Module, "wasmBinary")) { + Object.defineProperty(Module, "wasmBinary", { + configurable: true, + get: function() { + abort("Module.wasmBinary has been replaced with plain wasmBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +var noExitRuntime = Module["noExitRuntime"] || false; + +if (!Object.getOwnPropertyDescriptor(Module, "noExitRuntime")) { + Object.defineProperty(Module, "noExitRuntime", { + configurable: true, + get: function() { + abort("Module.noExitRuntime has been replaced with plain noExitRuntime (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (typeof WebAssembly != "object") { + abort("no native wasm support detected"); +} + +function setValue(ptr, value, type = "i8", noSafe) { + if (type.charAt(type.length - 1) === "*") type = "i32"; + if (noSafe) { + switch (type) { + case "i1": + HEAP8[ptr >> 0] = value; + break; + + case "i8": + HEAP8[ptr >> 0] = value; + break; + + case "i16": + HEAP16[ptr >> 1] = value; + break; + + case "i32": + HEAP32[ptr >> 2] = value; + break; + + case "i64": + tempI64 = [ value >>> 0, (tempDouble = value, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + HEAP32[ptr >> 2] = tempI64[0], HEAP32[ptr + 4 >> 2] = tempI64[1]; + break; + + case "float": + HEAPF32[ptr >> 2] = value; + break; + + case "double": + HEAPF64[ptr >> 3] = value; + break; + + default: + abort("invalid type for setValue: " + type); + } + } else { + switch (type) { + case "i1": + SAFE_HEAP_STORE(ptr | 0, value | 0, 1); + break; + + case "i8": + SAFE_HEAP_STORE(ptr | 0, value | 0, 1); + break; + + case "i16": + SAFE_HEAP_STORE(ptr | 0, value | 0, 2); + break; + + case "i32": + SAFE_HEAP_STORE(ptr | 0, value | 0, 4); + break; + + case "i64": + tempI64 = [ value >>> 0, (tempDouble = value, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(ptr | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(ptr + 4 | 0, tempI64[1] | 0, 4); + break; + + case "float": + SAFE_HEAP_STORE_D(ptr | 0, Math.fround(value), 4); + break; + + case "double": + SAFE_HEAP_STORE_D(ptr | 0, +value, 8); + break; + + default: + abort("invalid type for setValue: " + type); + } + } +} + +function getValue(ptr, type = "i8", noSafe) { + if (type.charAt(type.length - 1) === "*") type = "i32"; + if (noSafe) { + switch (type) { + case "i1": + return HEAP8[ptr >> 0]; + + case "i8": + return HEAP8[ptr >> 0]; + + case "i16": + return HEAP16[ptr >> 1]; + + case "i32": + return HEAP32[ptr >> 2]; + + case "i64": + return HEAP32[ptr >> 2]; + + case "float": + return HEAPF32[ptr >> 2]; + + case "double": + return Number(HEAPF64[ptr >> 3]); + + default: + abort("invalid type for getValue: " + type); + } + } else { + switch (type) { + case "i1": + return SAFE_HEAP_LOAD(ptr | 0, 1, 0) | 0; + + case "i8": + return SAFE_HEAP_LOAD(ptr | 0, 1, 0) | 0; + + case "i16": + return SAFE_HEAP_LOAD(ptr | 0, 2, 0) | 0; + + case "i32": + return SAFE_HEAP_LOAD(ptr | 0, 4, 0) | 0; + + case "i64": + return SAFE_HEAP_LOAD(ptr | 0, 8, 0) | 0; + + case "float": + return Math.fround(SAFE_HEAP_LOAD_D(ptr | 0, 4, 0)); + + case "double": + return +SAFE_HEAP_LOAD_D(ptr | 0, 8, 0); + + default: + abort("invalid type for getValue: " + type); + } + } + return null; +} + +function getSafeHeapType(bytes, isFloat) { + switch (bytes) { + case 1: + return "i8"; + + case 2: + return "i16"; + + case 4: + return isFloat ? "float" : "i32"; + + case 8: + return isFloat ? "double" : "i64"; + + default: + assert(0); + } +} + +function SAFE_HEAP_STORE(dest, value, bytes, isFloat) { + if (dest <= 0) abort("segmentation fault storing " + bytes + " bytes to address " + dest); + if (dest % bytes !== 0) abort("alignment error storing to address " + dest + ", which was expected to be aligned to a multiple of " + bytes); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk() >>> 0; + if (dest + bytes > brk) abort("segmentation fault, exceeded the top of the available dynamic heap when storing " + bytes + " bytes to address " + dest + ". DYNAMICTOP=" + brk); + assert(brk >= _emscripten_stack_get_base()); + assert(brk <= HEAP8.length); + } + setValue(dest, value, getSafeHeapType(bytes, isFloat), 1); + return value; +} + +function SAFE_HEAP_STORE_D(dest, value, bytes) { + return SAFE_HEAP_STORE(dest, value, bytes, true); +} + +function SAFE_HEAP_LOAD(dest, bytes, unsigned, isFloat) { + if (dest <= 0) abort("segmentation fault loading " + bytes + " bytes from address " + dest); + if (dest % bytes !== 0) abort("alignment error loading from address " + dest + ", which was expected to be aligned to a multiple of " + bytes); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk() >>> 0; + if (dest + bytes > brk) abort("segmentation fault, exceeded the top of the available dynamic heap when loading " + bytes + " bytes from address " + dest + ". DYNAMICTOP=" + brk); + assert(brk >= _emscripten_stack_get_base()); + assert(brk <= HEAP8.length); + } + var type = getSafeHeapType(bytes, isFloat); + var ret = getValue(dest, type, 1); + if (unsigned) ret = unSign(ret, parseInt(type.substr(1), 10)); + return ret; +} + +function SAFE_HEAP_LOAD_D(dest, bytes, unsigned) { + return SAFE_HEAP_LOAD(dest, bytes, unsigned, true); +} + +function SAFE_FT_MASK(value, mask) { + var ret = value & mask; + if (ret !== value) { + abort("Function table mask error: function pointer is " + value + " which is masked by " + mask + ", the likely cause of this is that the function pointer is being called by the wrong type."); + } + return ret; +} + +function segfault() { + abort("segmentation fault"); +} + +function alignfault() { + abort("alignment fault"); +} + +var wasmMemory; + +var ABORT = false; + +var EXITSTATUS; + +function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } +} + +function getCFunc(ident) { + var func = Module["_" + ident]; + assert(func, "Cannot call unknown function " + ident + ", make sure it is exported"); + return func; +} + +function ccall(ident, returnType, argTypes, args, opts) { + var toC = { + "string": function(str) { + var ret = 0; + if (str !== null && str !== undefined && str !== 0) { + var len = (str.length << 2) + 1; + ret = stackAlloc(len); + stringToUTF8(str, ret, len); + } + return ret; + }, + "array": function(arr) { + var ret = stackAlloc(arr.length); + writeArrayToMemory(arr, ret); + return ret; + } + }; + function convertReturnValue(ret) { + if (returnType === "string") return UTF8ToString(ret); + if (returnType === "boolean") return Boolean(ret); + return ret; + } + var func = getCFunc(ident); + var cArgs = []; + var stack = 0; + assert(returnType !== "array", 'Return type should not be "array".'); + if (args) { + for (var i = 0; i < args.length; i++) { + var converter = toC[argTypes[i]]; + if (converter) { + if (stack === 0) stack = stackSave(); + cArgs[i] = converter(args[i]); + } else { + cArgs[i] = args[i]; + } + } + } + var ret = func.apply(null, cArgs); + function onDone(ret) { + if (stack !== 0) stackRestore(stack); + return convertReturnValue(ret); + } + ret = onDone(ret); + return ret; +} + +function cwrap(ident, returnType, argTypes, opts) { + return function() { + return ccall(ident, returnType, argTypes, arguments, opts); + }; +} + +var ALLOC_NORMAL = 0; + +var ALLOC_STACK = 1; + +function allocate(slab, allocator) { + var ret; + assert(typeof allocator == "number", "allocate no longer takes a type argument"); + assert(typeof slab != "number", "allocate no longer takes a number as arg0"); + if (allocator == ALLOC_STACK) { + ret = stackAlloc(slab.length); + } else { + ret = _malloc(slab.length); + } + if (!slab.subarray && !slab.slice) { + slab = new Uint8Array(slab); + } + HEAPU8.set(slab, ret); + return ret; +} + +var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : undefined; + +function UTF8ArrayToString(heap, idx, maxBytesToRead) { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + while (heap[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heap.subarray && UTF8Decoder) { + return UTF8Decoder.decode(heap.subarray(idx, endPtr)); + } else { + var str = ""; + while (idx < endPtr) { + var u0 = heap[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heap[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode((u0 & 31) << 6 | u1); + continue; + } + var u2 = heap[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = (u0 & 15) << 12 | u1 << 6 | u2; + } else { + if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte 0x" + u0.toString(16) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"); + u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heap[idx++] & 63; + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); + } + } + } + return str; +} + +function UTF8ToString(ptr, maxBytesToRead) { + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; +} + +function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) { + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = 65536 + ((u & 1023) << 10) | u1 & 1023; + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | u >> 6; + heap[outIdx++] = 128 | u & 63; + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | u >> 12; + heap[outIdx++] = 128 | u >> 6 & 63; + heap[outIdx++] = 128 | u & 63; + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) warnOnce("Invalid Unicode code point 0x" + u.toString(16) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."); + heap[outIdx++] = 240 | u >> 18; + heap[outIdx++] = 128 | u >> 12 & 63; + heap[outIdx++] = 128 | u >> 6 & 63; + heap[outIdx++] = 128 | u & 63; + } + } + heap[outIdx] = 0; + return outIdx - startIdx; +} + +function stringToUTF8(str, outPtr, maxBytesToWrite) { + assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); +} + +function lengthBytesUTF8(str) { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) u = 65536 + ((u & 1023) << 10) | str.charCodeAt(++i) & 1023; + if (u <= 127) ++len; else if (u <= 2047) len += 2; else if (u <= 65535) len += 3; else len += 4; + } + return len; +} + +function AsciiToString(ptr) { + var str = ""; + while (1) { + var ch = SAFE_HEAP_LOAD(ptr++ | 0, 1, 1) >>> 0; + if (!ch) return str; + str += String.fromCharCode(ch); + } +} + +function stringToAscii(str, outPtr) { + return writeAsciiToMemory(str, outPtr, false); +} + +var UTF16Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf-16le") : undefined; + +function UTF16ToString(ptr, maxBytesToRead) { + assert(ptr % 2 == 0, "Pointer passed to UTF16ToString must be aligned to two bytes!"); + var endPtr = ptr; + var idx = endPtr >> 1; + var maxIdx = idx + maxBytesToRead / 2; + while (!(idx >= maxIdx) && SAFE_HEAP_LOAD(idx * 2, 2, 1)) ++idx; + endPtr = idx << 1; + if (endPtr - ptr > 32 && UTF16Decoder) { + return UTF16Decoder.decode(HEAPU8.subarray(ptr, endPtr)); + } else { + var str = ""; + for (var i = 0; !(i >= maxBytesToRead / 2); ++i) { + var codeUnit = SAFE_HEAP_LOAD(ptr + i * 2 | 0, 2, 0) | 0; + if (codeUnit == 0) break; + str += String.fromCharCode(codeUnit); + } + return str; + } +} + +function stringToUTF16(str, outPtr, maxBytesToWrite) { + assert(outPtr % 2 == 0, "Pointer passed to stringToUTF16 must be aligned to two bytes!"); + assert(typeof maxBytesToWrite == "number", "stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 2) return 0; + maxBytesToWrite -= 2; + var startPtr = outPtr; + var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length; + for (var i = 0; i < numCharsToWrite; ++i) { + var codeUnit = str.charCodeAt(i); + SAFE_HEAP_STORE(outPtr | 0, codeUnit | 0, 2); + outPtr += 2; + } + SAFE_HEAP_STORE(outPtr | 0, 0 | 0, 2); + return outPtr - startPtr; +} + +function lengthBytesUTF16(str) { + return str.length * 2; +} + +function UTF32ToString(ptr, maxBytesToRead) { + assert(ptr % 4 == 0, "Pointer passed to UTF32ToString must be aligned to four bytes!"); + var i = 0; + var str = ""; + while (!(i >= maxBytesToRead / 4)) { + var utf32 = SAFE_HEAP_LOAD(ptr + i * 4 | 0, 4, 0) | 0; + if (utf32 == 0) break; + ++i; + if (utf32 >= 65536) { + var ch = utf32 - 65536; + str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); + } else { + str += String.fromCharCode(utf32); + } + } + return str; +} + +function stringToUTF32(str, outPtr, maxBytesToWrite) { + assert(outPtr % 4 == 0, "Pointer passed to stringToUTF32 must be aligned to four bytes!"); + assert(typeof maxBytesToWrite == "number", "stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 4) return 0; + var startPtr = outPtr; + var endPtr = startPtr + maxBytesToWrite - 4; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) { + var trailSurrogate = str.charCodeAt(++i); + codeUnit = 65536 + ((codeUnit & 1023) << 10) | trailSurrogate & 1023; + } + SAFE_HEAP_STORE(outPtr | 0, codeUnit | 0, 4); + outPtr += 4; + if (outPtr + 4 > endPtr) break; + } + SAFE_HEAP_STORE(outPtr | 0, 0 | 0, 4); + return outPtr - startPtr; +} + +function lengthBytesUTF32(str) { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) ++i; + len += 4; + } + return len; +} + +function allocateUTF8(str) { + var size = lengthBytesUTF8(str) + 1; + var ret = _malloc(size); + if (ret) stringToUTF8Array(str, HEAP8, ret, size); + return ret; +} + +function allocateUTF8OnStack(str) { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8Array(str, HEAP8, ret, size); + return ret; +} + +function writeStringToMemory(string, buffer, dontAddNull) { + warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!"); + var lastChar, end; + if (dontAddNull) { + end = buffer + lengthBytesUTF8(string); + lastChar = SAFE_HEAP_LOAD(end, 1, 0); + } + stringToUTF8(string, buffer, Infinity); + if (dontAddNull) SAFE_HEAP_STORE(end, lastChar, 1); +} + +function writeArrayToMemory(array, buffer) { + assert(array.length >= 0, "writeArrayToMemory array must have a length (should be an array or typed array)"); + HEAP8.set(array, buffer); +} + +function writeAsciiToMemory(str, buffer, dontAddNull) { + for (var i = 0; i < str.length; ++i) { + assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255)); + SAFE_HEAP_STORE(buffer++ | 0, str.charCodeAt(i) | 0, 1); + } + if (!dontAddNull) SAFE_HEAP_STORE(buffer | 0, 0 | 0, 1); +} + +function alignUp(x, multiple) { + if (x % multiple > 0) { + x += multiple - x % multiple; + } + return x; +} + +var HEAP, buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; + +function updateGlobalBufferAndViews(buf) { + buffer = buf; + Module["HEAP8"] = HEAP8 = new Int8Array(buf); + Module["HEAP16"] = HEAP16 = new Int16Array(buf); + Module["HEAP32"] = HEAP32 = new Int32Array(buf); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf); + Module["HEAPF32"] = HEAPF32 = new Float32Array(buf); + Module["HEAPF64"] = HEAPF64 = new Float64Array(buf); +} + +var TOTAL_STACK = 5242880; + +if (Module["TOTAL_STACK"]) assert(TOTAL_STACK === Module["TOTAL_STACK"], "the stack size can no longer be determined at runtime"); + +var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216; + +if (!Object.getOwnPropertyDescriptor(Module, "INITIAL_MEMORY")) { + Object.defineProperty(Module, "INITIAL_MEMORY", { + configurable: true, + get: function() { + abort("Module.INITIAL_MEMORY has been replaced with plain INITIAL_MEMORY (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +assert(INITIAL_MEMORY >= TOTAL_STACK, "INITIAL_MEMORY should be larger than TOTAL_STACK, was " + INITIAL_MEMORY + "! (TOTAL_STACK=" + TOTAL_STACK + ")"); + +assert(typeof Int32Array != "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, "JS engine does not provide full typed array support"); + +assert(!Module["wasmMemory"], "Use of `wasmMemory` detected. Use -s IMPORTED_MEMORY to define wasmMemory externally"); + +assert(INITIAL_MEMORY == 16777216, "Detected runtime INITIAL_MEMORY setting. Use -s IMPORTED_MEMORY to define wasmMemory dynamically"); + +var wasmTable; + +function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + SAFE_HEAP_STORE(max + 4 | 0, 34821223 | 0, 4); + SAFE_HEAP_STORE(max + 8 | 0, 2310721022 | 0, 4); +} + +function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + var cookie1 = SAFE_HEAP_LOAD(max + 4 | 0, 4, 1) >>> 0; + var cookie2 = SAFE_HEAP_LOAD(max + 8 | 0, 4, 1) >>> 0; + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x" + cookie2.toString(16) + " 0x" + cookie1.toString(16)); + } +} + +(function() { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -s SUPPORT_BIG_ENDIAN=1 to bypass)"; +})(); + +var __ATPRERUN__ = []; + +var __ATINIT__ = []; + +var __ATMAIN__ = []; + +var __ATEXIT__ = []; + +var __ATPOSTRUN__ = []; + +var runtimeInitialized = false; + +var runtimeExited = false; + +var runtimeKeepaliveCounter = 0; + +function keepRuntimeAlive() { + return noExitRuntime || runtimeKeepaliveCounter > 0; +} + +function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); +} + +function initRuntime() { + checkStackCookie(); + assert(!runtimeInitialized); + runtimeInitialized = true; + if (!Module["noFSInit"] && !FS.init.initialized) FS.init(); + FS.ignorePermissions = false; + TTY.init(); + PIPEFS.root = FS.mount(PIPEFS, {}, null); + callRuntimeCallbacks(__ATINIT__); +} + +function preMain() { + checkStackCookie(); + callRuntimeCallbacks(__ATMAIN__); +} + +function exitRuntime() { + checkStackCookie(); + ___funcs_on_exit(); + callRuntimeCallbacks(__ATEXIT__); + FS.quit(); + TTY.shutdown(); + runtimeExited = true; +} + +function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(__ATPOSTRUN__); +} + +function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); +} + +function addOnInit(cb) { + __ATINIT__.unshift(cb); +} + +function addOnPreMain(cb) { + __ATMAIN__.unshift(cb); +} + +function addOnExit(cb) { + __ATEXIT__.unshift(cb); +} + +function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); +} + +assert(Math.imul, "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.fround, "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.clz32, "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.trunc, "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +var runDependencies = 0; + +var runDependencyWatcher = null; + +var dependenciesFulfilled = null; + +var runDependencyTracking = {}; + +function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } +} + +function addRunDependency(id) { + runDependencies++; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if (runDependencyWatcher === null && typeof setInterval != "undefined") { + runDependencyWatcher = setInterval(function() { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err("dependency: " + dep); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } +} + +function removeRunDependency(id) { + runDependencies--; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } +} + +Module["preloadedImages"] = {}; + +Module["preloadedAudios"] = {}; + +function abort(what) { + { + if (Module["onAbort"]) { + Module["onAbort"](what); + } + } + what = "Aborted(" + what + ")"; + err(what); + ABORT = true; + EXITSTATUS = 1; + var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + throw e; +} + +var dataURIPrefix = "data:application/octet-stream;base64,"; + +function isDataURI(filename) { + return filename.startsWith(dataURIPrefix); +} + +function isFileURI(filename) { + return filename.startsWith("file://"); +} + +function createExportWrapper(name, fixedasm) { + return function() { + var displayName = name; + var asm = fixedasm; + if (!fixedasm) { + asm = Module["asm"]; + } + assert(runtimeInitialized, "native function `" + displayName + "` called before runtime initialization"); + assert(!runtimeExited, "native function `" + displayName + "` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)"); + if (!asm[name]) { + assert(asm[name], "exported native function `" + displayName + "` not found"); + } + return asm[name].apply(null, arguments); + }; +} + +var wasmBinaryFile; + +if (Module["locateFile"]) { + wasmBinaryFile = "ld-new.wasm"; + if (!isDataURI(wasmBinaryFile)) { + wasmBinaryFile = locateFile(wasmBinaryFile); + } +} else { + wasmBinaryFile = new URL("ld-new.wasm", import.meta.url).toString(); +} + +function getBinary(file) { + try { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } else { + throw "both async and sync fetching of the wasm failed"; + } + } catch (err) { + abort(err); + } +} + +function getBinaryPromise() { + if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) { + if (typeof fetch == "function" && !isFileURI(wasmBinaryFile)) { + return fetch(wasmBinaryFile, { + credentials: "same-origin" + }).then(function(response) { + if (!response["ok"]) { + throw "failed to load wasm binary file at '" + wasmBinaryFile + "'"; + } + return response["arrayBuffer"](); + }).catch(function() { + return getBinary(wasmBinaryFile); + }); + } else { + if (readAsync) { + return new Promise(function(resolve, reject) { + readAsync(wasmBinaryFile, function(response) { + resolve(new Uint8Array(response)); + }, reject); + }); + } + } + } + return Promise.resolve().then(function() { + return getBinary(wasmBinaryFile); + }); +} + +function createWasm() { + var info = { + "env": asmLibraryArg, + "wasi_snapshot_preview1": asmLibraryArg + }; + function receiveInstance(instance, module) { + var exports = instance.exports; + Module["asm"] = exports; + wasmMemory = Module["asm"]["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateGlobalBufferAndViews(wasmMemory.buffer); + wasmTable = Module["asm"]["__indirect_function_table"]; + assert(wasmTable, "table not found in wasm exports"); + addOnInit(Module["asm"]["__wasm_call_ctors"]); + removeRunDependency("wasm-instantiate"); + } + addRunDependency("wasm-instantiate"); + var trueModule = Module; + function receiveInstantiationResult(result) { + assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"); + trueModule = null; + receiveInstance(result["instance"]); + } + function instantiateArrayBuffer(receiver) { + return getBinaryPromise().then(function(binary) { + return WebAssembly.instantiate(binary, info); + }).then(function(instance) { + return instance; + }).then(receiver, function(reason) { + err("failed to asynchronously prepare wasm: " + reason); + if (isFileURI(wasmBinaryFile)) { + err("warning: Loading from a file URI (" + wasmBinaryFile + ") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing"); + } + abort(reason); + }); + } + function instantiateAsync() { + if (!wasmBinary && typeof WebAssembly.instantiateStreaming == "function" && !isDataURI(wasmBinaryFile) && !isFileURI(wasmBinaryFile) && typeof fetch == "function") { + return fetch(wasmBinaryFile, { + credentials: "same-origin" + }).then(function(response) { + var result = WebAssembly.instantiateStreaming(response, info); + return result.then(receiveInstantiationResult, function(reason) { + err("wasm streaming compile failed: " + reason); + err("falling back to ArrayBuffer instantiation"); + return instantiateArrayBuffer(receiveInstantiationResult); + }); + }); + } else { + return instantiateArrayBuffer(receiveInstantiationResult); + } + } + if (Module["instantiateWasm"]) { + try { + var exports = Module["instantiateWasm"](info, receiveInstance); + return exports; + } catch (e) { + err("Module.instantiateWasm callback failed with error: " + e); + return false; + } + } + instantiateAsync().catch(readyPromiseReject); + return {}; +} + +var tempDouble; + +var tempI64; + +var ASM_CONSTS = {}; + +function callRuntimeCallbacks(callbacks) { + while (callbacks.length > 0) { + var callback = callbacks.shift(); + if (typeof callback == "function") { + callback(Module); + continue; + } + var func = callback.func; + if (typeof func == "number") { + if (callback.arg === undefined) { + getWasmTableEntry(func)(); + } else { + getWasmTableEntry(func)(callback.arg); + } + } else { + func(callback.arg === undefined ? null : callback.arg); + } + } +} + +function withStackSave(f) { + var stack = stackSave(); + var ret = f(); + stackRestore(stack); + return ret; +} + +function demangle(func) { + warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"); + return func; +} + +function demangleAll(text) { + var regex = /\b_Z[\w\d_]+/g; + return text.replace(regex, function(x) { + var y = demangle(x); + return x === y ? x : y + " [" + x + "]"; + }); +} + +var wasmTableMirror = []; + +function getWasmTableEntry(funcPtr) { + var func = wasmTableMirror[funcPtr]; + if (!func) { + if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1; + wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr); + } + assert(wasmTable.get(funcPtr) == func, "JavaScript-side Wasm function table mirror is out of date!"); + return func; +} + +function handleException(e) { + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + quit_(1, e); +} + +function jsStackTrace() { + var error = new Error(); + if (!error.stack) { + try { + throw new Error(); + } catch (e) { + error = e; + } + if (!error.stack) { + return "(no stack trace available)"; + } + } + return error.stack.toString(); +} + +function setWasmTableEntry(idx, func) { + wasmTable.set(idx, func); + wasmTableMirror[idx] = func; +} + +function stackTrace() { + var js = jsStackTrace(); + if (Module["extraStackTrace"]) js += "\n" + Module["extraStackTrace"](); + return demangleAll(js); +} + +function unSign(value, bits) { + if (value >= 0) { + return value; + } + return bits <= 32 ? 2 * Math.abs(1 << bits - 1) + value : Math.pow(2, bits) + value; +} + +function ___assert_fail(condition, filename, line, func) { + abort("Assertion failed: " + UTF8ToString(condition) + ", at: " + [ filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function" ]); +} + +var _emscripten_get_now; + +if (ENVIRONMENT_IS_NODE) { + _emscripten_get_now = (() => { + var t = process["hrtime"](); + return t[0] * 1e3 + t[1] / 1e6; + }); +} else _emscripten_get_now = (() => performance.now()); + +var _emscripten_get_now_is_monotonic = true; + +function setErrNo(value) { + SAFE_HEAP_STORE(___errno_location() | 0, value | 0, 4); + return value; +} + +function _clock_gettime(clk_id, tp) { + var now; + if (clk_id === 0) { + now = Date.now(); + } else if ((clk_id === 1 || clk_id === 4) && _emscripten_get_now_is_monotonic) { + now = _emscripten_get_now(); + } else { + setErrNo(28); + return -1; + } + SAFE_HEAP_STORE(tp | 0, now / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(tp + 4 | 0, now % 1e3 * 1e3 * 1e3 | 0 | 0, 4); + return 0; +} + +function ___clock_gettime(a0, a1) { + return _clock_gettime(a0, a1); +} + +var PATH = { + splitPath: function(filename) { + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: function(parts, allowAboveRoot) { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (;up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: function(path) { + var isAbsolute = path.charAt(0) === "/", trailingSlash = path.substr(-1) === "/"; + path = PATH.normalizeArray(path.split("/").filter(function(p) { + return !!p; + }), !isAbsolute).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: function(path) { + var result = PATH.splitPath(path), root = result[0], dir = result[1]; + if (!root && !dir) { + return "."; + } + if (dir) { + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename: function(path) { + if (path === "/") return "/"; + path = PATH.normalize(path); + path = path.replace(/\/$/, ""); + var lastSlash = path.lastIndexOf("/"); + if (lastSlash === -1) return path; + return path.substr(lastSlash + 1); + }, + extname: function(path) { + return PATH.splitPath(path)[3]; + }, + join: function() { + var paths = Array.prototype.slice.call(arguments, 0); + return PATH.normalize(paths.join("/")); + }, + join2: function(l, r) { + return PATH.normalize(l + "/" + r); + } +}; + +function getRandomDevice() { + if (typeof crypto == "object" && typeof crypto["getRandomValues"] == "function") { + var randomBuffer = new Uint8Array(1); + return function() { + crypto.getRandomValues(randomBuffer); + return randomBuffer[0]; + }; + } else if (ENVIRONMENT_IS_NODE) { + try { + var crypto_module = require("crypto"); + return function() { + return crypto_module["randomBytes"](1)[0]; + }; + } catch (e) {} + } + return function() { + abort("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };"); + }; +} + +var PATH_FS = { + resolve: function() { + var resolvedPath = "", resolvedAbsolute = false; + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? arguments[i] : FS.cwd(); + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = path.charAt(0) === "/"; + } + resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter(function(p) { + return !!p; + }), !resolvedAbsolute).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; + }, + relative: function(from, to) { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (;start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (;end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + } +}; + +var TTY = { + ttys: [], + init: function() {}, + shutdown: function() {}, + register: function(dev, ops) { + TTY.ttys[dev] = { + input: [], + output: [], + ops: ops + }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open: function(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close: function(stream) { + stream.tty.ops.flush(stream.tty); + }, + flush: function(stream) { + stream.tty.ops.flush(stream.tty); + }, + read: function(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: function(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + } + }, + default_tty_ops: { + get_char: function(tty) { + if (!tty.input.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + try { + bytesRead = fs.readSync(process.stdin.fd, buf, 0, BUFSIZE, -1); + } catch (e) { + if (e.toString().includes("EOF")) bytesRead = 0; else throw e; + } + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString("utf-8"); + } else { + result = null; + } + } else if (typeof window != "undefined" && typeof window.prompt == "function") { + result = window.prompt("Input: "); + if (result !== null) { + result += "\n"; + } + } else if (typeof readline == "function") { + result = readline(); + if (result !== null) { + result += "\n"; + } + } + if (!result) { + return null; + } + tty.input = intArrayFromString(result, true); + } + return tty.input.shift(); + }, + put_char: function(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function(tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + } + }, + default_tty1_ops: { + put_char: function(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function(tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + } + } +}; + +function zeroMemory(address, size) { + HEAPU8.fill(0, address, address + size); +} + +function alignMemory(size, alignment) { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; +} + +function mmapAlloc(size) { + abort("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported"); +} + +var MEMFS = { + ops_table: null, + mount: function(mount) { + return MEMFS.createNode(null, "/", 16384 | 511, 0); + }, + createNode: function(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + if (!MEMFS.ops_table) { + MEMFS.ops_table = { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink + }, + stream: { + llseek: MEMFS.stream_ops.llseek + } + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync + } + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink + }, + stream: {} + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: FS.chrdev_stream_ops + } + }; + } + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray: function(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage: function(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max(newCapacity, prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125) >>> 0); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage: function(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes))); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr: function(node) { + var attr = {}; + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr: function(node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup: function(parent, name) { + throw FS.genericErrors[44]; + }, + mknod: function(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename: function(old_node, new_dir, new_name) { + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now(); + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + old_node.parent = new_dir; + }, + unlink: function(parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir: function(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir: function(node) { + var entries = [ ".", ".." ]; + for (var key in node.contents) { + if (!node.contents.hasOwnProperty(key)) { + continue; + } + entries.push(key); + } + return entries; + }, + symlink: function(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink: function(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + } + }, + stream_ops: { + read: function(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i]; + } + return size; + }, + write: function(stream, buffer, offset, length, position, canOwn) { + assert(!(buffer instanceof ArrayBuffer)); + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + assert(position === 0, "canOwn must imply no weird position inside the file"); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set(buffer.subarray(offset, offset + length), position); + return length; + } + } + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set(buffer.subarray(offset, offset + length), position); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek: function(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate: function(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length); + }, + mmap: function(stream, address, length, position, prot, flags) { + if (address !== 0) { + throw new FS.ErrnoError(28); + } + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + if (!(flags & 2) && contents.buffer === buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call(contents, position, position + length); + } + } + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + HEAP8.set(contents, ptr); + } + return { + ptr: ptr, + allocated: allocated + }; + }, + msync: function(stream, buffer, offset, length, mmapFlags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (mmapFlags & 2) { + return 0; + } + var bytesWritten = MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + return 0; + } + } +}; + +function asyncLoad(url, onload, onerror, noRunDep) { + var dep = !noRunDep ? getUniqueRunDependency("al " + url) : ""; + readAsync(url, function(arrayBuffer) { + assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).'); + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, function(event) { + if (onerror) { + onerror(); + } else { + throw 'Loading data file "' + url + '" failed.'; + } + }); + if (dep) addRunDependency(dep); +} + +var ERRNO_MESSAGES = { + 0: "Success", + 1: "Arg list too long", + 2: "Permission denied", + 3: "Address already in use", + 4: "Address not available", + 5: "Address family not supported by protocol family", + 6: "No more processes", + 7: "Socket already connected", + 8: "Bad file number", + 9: "Trying to read unreadable message", + 10: "Mount device busy", + 11: "Operation canceled", + 12: "No children", + 13: "Connection aborted", + 14: "Connection refused", + 15: "Connection reset by peer", + 16: "File locking deadlock error", + 17: "Destination address required", + 18: "Math arg out of domain of func", + 19: "Quota exceeded", + 20: "File exists", + 21: "Bad address", + 22: "File too large", + 23: "Host is unreachable", + 24: "Identifier removed", + 25: "Illegal byte sequence", + 26: "Connection already in progress", + 27: "Interrupted system call", + 28: "Invalid argument", + 29: "I/O error", + 30: "Socket is already connected", + 31: "Is a directory", + 32: "Too many symbolic links", + 33: "Too many open files", + 34: "Too many links", + 35: "Message too long", + 36: "Multihop attempted", + 37: "File or path name too long", + 38: "Network interface is not configured", + 39: "Connection reset by network", + 40: "Network is unreachable", + 41: "Too many open files in system", + 42: "No buffer space available", + 43: "No such device", + 44: "No such file or directory", + 45: "Exec format error", + 46: "No record locks available", + 47: "The link has been severed", + 48: "Not enough core", + 49: "No message of desired type", + 50: "Protocol not available", + 51: "No space left on device", + 52: "Function not implemented", + 53: "Socket is not connected", + 54: "Not a directory", + 55: "Directory not empty", + 56: "State not recoverable", + 57: "Socket operation on non-socket", + 59: "Not a typewriter", + 60: "No such device or address", + 61: "Value too large for defined data type", + 62: "Previous owner died", + 63: "Not super-user", + 64: "Broken pipe", + 65: "Protocol error", + 66: "Unknown protocol", + 67: "Protocol wrong type for socket", + 68: "Math result not representable", + 69: "Read only file system", + 70: "Illegal seek", + 71: "No such process", + 72: "Stale file handle", + 73: "Connection timed out", + 74: "Text file busy", + 75: "Cross-device link", + 100: "Device not a stream", + 101: "Bad font file fmt", + 102: "Invalid slot", + 103: "Invalid request code", + 104: "No anode", + 105: "Block device required", + 106: "Channel number out of range", + 107: "Level 3 halted", + 108: "Level 3 reset", + 109: "Link number out of range", + 110: "Protocol driver not attached", + 111: "No CSI structure available", + 112: "Level 2 halted", + 113: "Invalid exchange", + 114: "Invalid request descriptor", + 115: "Exchange full", + 116: "No data (for no delay io)", + 117: "Timer expired", + 118: "Out of streams resources", + 119: "Machine is not on the network", + 120: "Package not installed", + 121: "The object is remote", + 122: "Advertise error", + 123: "Srmount error", + 124: "Communication error on send", + 125: "Cross mount point (not really error)", + 126: "Given log. name not unique", + 127: "f.d. invalid for this operation", + 128: "Remote address changed", + 129: "Can access a needed shared lib", + 130: "Accessing a corrupted shared lib", + 131: ".lib section in a.out corrupted", + 132: "Attempting to link in too many libs", + 133: "Attempting to exec a shared library", + 135: "Streams pipe error", + 136: "Too many users", + 137: "Socket type not supported", + 138: "Not supported", + 139: "Protocol family not supported", + 140: "Can't send after socket shutdown", + 141: "Too many references", + 142: "Host is down", + 148: "No medium (in tape drive)", + 156: "Level 2 not synchronized" +}; + +var ERRNO_CODES = {}; + +var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: null, + genericErrors: {}, + filesystems: null, + syncFSRequests: 0, + lookupPath: (path, opts = {}) => { + path = PATH_FS.resolve(FS.cwd(), path); + if (!path) return { + path: "", + node: null + }; + var defaults = { + follow_mount: true, + recurse_count: 0 + }; + for (var key in defaults) { + if (opts[key] === undefined) { + opts[key] = defaults[key]; + } + } + if (opts.recurse_count > 8) { + throw new FS.ErrnoError(32); + } + var parts = PATH.normalizeArray(path.split("/").filter(p => !!p), false); + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + if (FS.isMountpoint(current)) { + if (!islast || islast && opts.follow_mount) { + current = current.mounted.root; + } + } + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve(PATH.dirname(current_path), link); + var lookup = FS.lookupPath(current_path, { + recurse_count: opts.recurse_count + }); + current = lookup.node; + if (count++ > 40) { + throw new FS.ErrnoError(32); + } + } + } + } + return { + path: current_path, + node: current + }; + }, + getPath: node => { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" ? mount + "/" + path : mount + path; + } + path = path ? node.name + "/" + path : node.name; + node = node.parent; + } + }, + hashName: (parentid, name) => { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = (hash << 5) - hash + name.charCodeAt(i) | 0; + } + return (parentid + hash >>> 0) % FS.nameTable.length; + }, + hashAddNode: node => { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode: node => { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode: (parent, name) => { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode, parent); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + return FS.lookup(parent, name); + }, + createNode: (parent, name, mode, rdev) => { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode: node => { + FS.hashRemoveNode(node); + }, + isRoot: node => { + return node === node.parent; + }, + isMountpoint: node => { + return !!node.mounted; + }, + isFile: mode => { + return (mode & 61440) === 32768; + }, + isDir: mode => { + return (mode & 61440) === 16384; + }, + isLink: mode => { + return (mode & 61440) === 40960; + }, + isChrdev: mode => { + return (mode & 61440) === 8192; + }, + isBlkdev: mode => { + return (mode & 61440) === 24576; + }, + isFIFO: mode => { + return (mode & 61440) === 4096; + }, + isSocket: mode => { + return (mode & 49152) === 49152; + }, + flagModes: { + "r": 0, + "r+": 2, + "w": 577, + "w+": 578, + "a": 1089, + "a+": 1090 + }, + modeStringToFlags: str => { + var flags = FS.flagModes[str]; + if (typeof flags == "undefined") { + throw new Error("Unknown file open mode: " + str); + } + return flags; + }, + flagsToPermissionString: flag => { + var perms = [ "r", "w", "rw" ][flag & 3]; + if (flag & 512) { + perms += "w"; + } + return perms; + }, + nodePermissions: (node, perms) => { + if (FS.ignorePermissions) { + return 0; + } + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup: dir => { + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate: (dir, name) => { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete: (dir, name, isdir) => { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen: (node, flags) => { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || flags & 512) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS: 4096, + nextfd: (fd_start = 0, fd_end = FS.MAX_OPEN_FDS) => { + for (var fd = fd_start; fd <= fd_end; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStream: fd => FS.streams[fd], + createStream: (stream, fd_start, fd_end) => { + if (!FS.FSStream) { + FS.FSStream = function() {}; + FS.FSStream.prototype = { + object: { + get: function() { + return this.node; + }, + set: function(val) { + this.node = val; + } + }, + isRead: { + get: function() { + return (this.flags & 2097155) !== 1; + } + }, + isWrite: { + get: function() { + return (this.flags & 2097155) !== 0; + } + }, + isAppend: { + get: function() { + return this.flags & 1024; + } + } + }; + } + stream = Object.assign(new FS.FSStream(), stream); + var fd = FS.nextfd(fd_start, fd_end); + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream: fd => { + FS.streams[fd] = null; + }, + chrdev_stream_ops: { + open: stream => { + var device = FS.getDevice(stream.node.rdev); + stream.stream_ops = device.stream_ops; + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + }, + llseek: () => { + throw new FS.ErrnoError(70); + } + }, + major: dev => dev >> 8, + minor: dev => dev & 255, + makedev: (ma, mi) => ma << 8 | mi, + registerDevice: (dev, ops) => { + FS.devices[dev] = { + stream_ops: ops + }; + }, + getDevice: dev => FS.devices[dev], + getMounts: mount => { + var mounts = []; + var check = [ mount ]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push.apply(check, m.mounts); + } + return mounts; + }, + syncfs: (populate, callback) => { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err("warning: " + FS.syncFSRequests + " FS.syncfs operations in flight at once, probably just doing extra work"); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + mounts.forEach(mount => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount: (type, opts, mountpoint) => { + if (typeof type == "string") { + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + mountpoint = lookup.path; + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type: type, + opts: opts, + mountpoint: mountpoint, + mounts: [] + }; + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount: mountpoint => { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach(hash => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + node.mounted = null; + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup: (parent, name) => { + return parent.node_ops.lookup(parent, name); + }, + mknod: (path, mode, dev) => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === "." || name === "..") { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create: (path, mode) => { + mode = mode !== undefined ? mode : 438; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir: (path, mode) => { + mode = mode !== undefined ? mode : 511; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree: (path, mode) => { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev: (path, mode, dev) => { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink: (oldpath, newpath) => { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename: (old_path, new_path) => { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + var lookup, old_dir, new_dir; + lookup = FS.lookupPath(old_path, { + parent: true + }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { + parent: true + }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + var old_node = FS.lookupNode(old_dir, old_name); + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (old_node === new_node) { + return; + } + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(old_node) || new_node && FS.isMountpoint(new_node)) { + throw new FS.ErrnoError(10); + } + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + FS.hashRemoveNode(old_node); + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir: path => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir: path => { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink: path => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink: path => { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve(FS.getPath(link.parent), link.node_ops.readlink(link)); + }, + stat: (path, dontFollow) => { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat: path => { + return FS.stat(path, true); + }, + chmod: (path, mode, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: mode & 4095 | node.mode & ~4095, + timestamp: Date.now() + }); + }, + lchmod: (path, mode) => { + FS.chmod(path, mode, true); + }, + fchmod: (fd, mode) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chmod(stream.node, mode); + }, + chown: (path, uid, gid, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + timestamp: Date.now() + }); + }, + lchown: (path, uid, gid) => { + FS.chown(path, uid, gid, true); + }, + fchown: (fd, uid, gid) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chown(stream.node, uid, gid); + }, + truncate: (path, len) => { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: true + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { + size: len, + timestamp: Date.now() + }); + }, + ftruncate: (fd, len) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime: (path, atime, mtime) => { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + node.node_ops.setattr(node, { + timestamp: Math.max(atime, mtime) + }); + }, + open: (path, flags, mode, fd_start, fd_end) => { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS.modeStringToFlags(flags) : flags; + mode = typeof mode == "undefined" ? 438 : mode; + if (flags & 64) { + mode = mode & 4095 | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == "object") { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072) + }); + node = lookup.node; + } catch (e) {} + } + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else { + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + if (flags & 512) { + FS.truncate(node, 0); + } + flags &= ~(128 | 512 | 131072); + var stream = FS.createStream({ + node: node, + path: FS.getPath(node), + flags: flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + ungotten: [], + error: false + }, fd_start, fd_end); + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!FS.readFiles) FS.readFiles = {}; + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close: stream => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed: stream => { + return stream.fd === null; + }, + llseek: (stream, offset, whence) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read: (stream, buffer, offset, length, position) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write: (stream, buffer, offset, length, position, canOwn) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate: (stream, offset, length) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap: (stream, address, length, position, prot, flags) => { + if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + return stream.stream_ops.mmap(stream, address, length, position, prot, flags); + }, + msync: (stream, buffer, offset, length, mmapFlags) => { + if (!stream || !stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags); + }, + munmap: stream => 0, + ioctl: (stream, cmd, arg) => { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile: (path, opts = {}) => { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error('Invalid encoding type "' + opts.encoding + '"'); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf, 0); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile: (path, data, opts = {}) => { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir: path => { + var lookup = FS.lookupPath(path, { + follow: true + }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories: () => { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices: () => { + FS.mkdir("/dev"); + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + var random_device = getRandomDevice(); + FS.createDevice("/dev", "random", random_device); + FS.createDevice("/dev", "urandom", random_device); + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories: () => { + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount({ + mount: () => { + var node = FS.createNode(proc_self, "fd", 16384 | 511, 73); + node.node_ops = { + lookup: (parent, name) => { + var fd = +name; + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + var ret = { + parent: null, + mount: { + mountpoint: "fake" + }, + node_ops: { + readlink: () => stream.path + } + }; + ret.parent = ret; + return ret; + } + }; + return node; + } + }, {}, "/proc/self/fd"); + }, + createStandardStreams: () => { + if (Module["stdin"]) { + FS.createDevice("/dev", "stdin", Module["stdin"]); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (Module["stdout"]) { + FS.createDevice("/dev", "stdout", null, Module["stdout"]); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (Module["stderr"]) { + FS.createDevice("/dev", "stderr", null, Module["stderr"]); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, "invalid handle for stdin (" + stdin.fd + ")"); + assert(stdout.fd === 1, "invalid handle for stdout (" + stdout.fd + ")"); + assert(stderr.fd === 2, "invalid handle for stderr (" + stderr.fd + ")"); + }, + ensureErrnoError: () => { + if (FS.ErrnoError) return; + FS.ErrnoError = function ErrnoError(errno, node) { + this.node = node; + this.setErrno = function(errno) { + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + }; + this.setErrno(errno); + this.message = ERRNO_MESSAGES[errno]; + if (this.stack) { + Object.defineProperty(this, "stack", { + value: new Error().stack, + writable: true + }); + this.stack = demangleAll(this.stack); + } + }; + FS.ErrnoError.prototype = new Error(); + FS.ErrnoError.prototype.constructor = FS.ErrnoError; + [ 44 ].forEach(code => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ""; + }); + }, + staticInit: () => { + FS.ensureErrnoError(); + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { + "MEMFS": MEMFS + }; + }, + init: (input, output, error) => { + assert(!FS.init.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"); + FS.init.initialized = true; + FS.ensureErrnoError(); + Module["stdin"] = input || Module["stdin"]; + Module["stdout"] = output || Module["stdout"]; + Module["stderr"] = error || Module["stderr"]; + FS.createStandardStreams(); + }, + quit: () => { + FS.init.initialized = false; + ___stdio_exit(); + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + getMode: (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }, + findObject: (path, dontResolveLastLink) => { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (ret.exists) { + return ret.object; + } else { + return null; + } + }, + analyzePath: (path, dontResolveLastLink) => { + try { + var lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null + }; + try { + var lookup = FS.lookupPath(path, { + parent: true + }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath: (parent, path, canRead, canWrite) => { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile: (parent, name, properties, canRead, canWrite) => { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS.getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile: (parent, name, data, canRead, canWrite, canOwn) => { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS.getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i); + data = arr; + } + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + return node; + }, + createDevice: (parent, name, input, output) => { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS.getMode(!!input, !!output); + if (!FS.createDevice.major) FS.createDevice.major = 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + FS.registerDevice(dev, { + open: stream => { + stream.seekable = false; + }, + close: stream => { + if (output && output.buffer && output.buffer.length) { + output(10); + } + }, + read: (stream, buffer, offset, length, pos) => { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: (stream, buffer, offset, length, pos) => { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + } + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile: obj => { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."); + } else if (read_) { + try { + obj.contents = intArrayFromString(read_(obj.url), true); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } else { + throw new Error("Cannot load without read() or XMLHttpRequest."); + } + }, + createLazyFile: (parent, name, url, canRead, canWrite) => { + function LazyUint8Array() { + this.lengthKnown = false; + this.chunks = []; + } + LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = idx / this.chunkSize | 0; + return this.getter(chunkNum)[chunkOffset]; + }; + LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) { + this.getter = getter; + }; + LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open("HEAD", url, false); + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; + var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip"; + var chunkSize = 1024 * 1024; + if (!hasByteServing) chunkSize = datalength; + var doXHR = (from, to) => { + if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); + if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!"); + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } else { + return intArrayFromString(xhr.responseText || "", true); + } + }; + var lazyArray = this; + lazyArray.setDataGetter(chunkNum => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out("LazyFiles on gzip forces download of the whole file when length is accessed"); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + }; + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array(); + Object.defineProperties(lazyArray, { + length: { + get: function() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + }, + chunkSize: { + get: function() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + }); + var properties = { + isDevice: false, + contents: lazyArray + }; + } else { + var properties = { + isDevice: false, + url: url + }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + Object.defineProperties(node, { + usedBytes: { + get: function() { + return this.contents.length; + } + } + }); + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach(key => { + var fn = node.stream_ops[key]; + stream_ops[key] = function forceLoadLazyFile() { + FS.forceLoadFile(node); + return fn.apply(null, arguments); + }; + }); + stream_ops.read = ((stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + }); + node.stream_ops = stream_ops; + return node; + }, + createPreloadedFile: (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency("cp " + fullname); + function processData(byteArray) { + function finish(byteArray) { + if (preFinish) preFinish(); + if (!dontCreateFile) { + FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn); + } + if (onload) onload(); + removeRunDependency(dep); + } + if (Browser.handledByPreloadPlugin(byteArray, fullname, finish, () => { + if (onerror) onerror(); + removeRunDependency(dep); + })) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url, byteArray => processData(byteArray), onerror); + } else { + processData(url); + } + }, + indexedDB: () => { + return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; + }, + DB_NAME: () => { + return "EM_FS_" + window.location.pathname; + }, + DB_VERSION: 20, + DB_STORE_NAME: "FILE_DATA", + saveFilesToDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = (() => { + out("creating db"); + var db = openRequest.result; + db.createObjectStore(FS.DB_STORE_NAME); + }); + openRequest.onsuccess = (() => { + var db = openRequest.result; + var transaction = db.transaction([ FS.DB_STORE_NAME ], "readwrite"); + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, fail = 0, total = paths.length; + function finish() { + if (fail == 0) onload(); else onerror(); + } + paths.forEach(path => { + var putRequest = files.put(FS.analyzePath(path).object.contents, path); + putRequest.onsuccess = (() => { + ok++; + if (ok + fail == total) finish(); + }); + putRequest.onerror = (() => { + fail++; + if (ok + fail == total) finish(); + }); + }); + transaction.onerror = onerror; + }); + openRequest.onerror = onerror; + }, + loadFilesFromDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = onerror; + openRequest.onsuccess = (() => { + var db = openRequest.result; + try { + var transaction = db.transaction([ FS.DB_STORE_NAME ], "readonly"); + } catch (e) { + onerror(e); + return; + } + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, fail = 0, total = paths.length; + function finish() { + if (fail == 0) onload(); else onerror(); + } + paths.forEach(path => { + var getRequest = files.get(path); + getRequest.onsuccess = (() => { + if (FS.analyzePath(path).exists) { + FS.unlink(path); + } + FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true); + ok++; + if (ok + fail == total) finish(); + }); + getRequest.onerror = (() => { + fail++; + if (ok + fail == total) finish(); + }); + }); + transaction.onerror = onerror; + }); + openRequest.onerror = onerror; + }, + absolutePath: () => { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder: () => { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink: () => { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath: () => { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc: () => { + abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc"); + }, + standardizePath: () => { + abort("FS.standardizePath has been removed; use PATH.normalize instead"); + } +}; + +var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt: function(dirfd, path, allowEmpty) { + if (path[0] === "/") { + return path; + } + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = FS.getStream(dirfd); + if (!dirstream) throw new FS.ErrnoError(8); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat: function(func, path, buf) { + try { + var stat = func(path); + } catch (e) { + if (e && e.node && PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node))) { + return -54; + } + throw e; + } + SAFE_HEAP_STORE(buf | 0, stat.dev | 0, 4); + SAFE_HEAP_STORE(buf + 4 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 8 | 0, stat.ino | 0, 4); + SAFE_HEAP_STORE(buf + 12 | 0, stat.mode | 0, 4); + SAFE_HEAP_STORE(buf + 16 | 0, stat.nlink | 0, 4); + SAFE_HEAP_STORE(buf + 20 | 0, stat.uid | 0, 4); + SAFE_HEAP_STORE(buf + 24 | 0, stat.gid | 0, 4); + SAFE_HEAP_STORE(buf + 28 | 0, stat.rdev | 0, 4); + SAFE_HEAP_STORE(buf + 32 | 0, 0 | 0, 4); + tempI64 = [ stat.size >>> 0, (tempDouble = stat.size, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(buf + 40 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(buf + 44 | 0, tempI64[1] | 0, 4); + SAFE_HEAP_STORE(buf + 48 | 0, 4096 | 0, 4); + SAFE_HEAP_STORE(buf + 52 | 0, stat.blocks | 0, 4); + SAFE_HEAP_STORE(buf + 56 | 0, stat.atime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 60 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 64 | 0, stat.mtime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 68 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 72 | 0, stat.ctime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 76 | 0, 0 | 0, 4); + tempI64 = [ stat.ino >>> 0, (tempDouble = stat.ino, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(buf + 80 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(buf + 84 | 0, tempI64[1] | 0, 4); + return 0; + }, + doMsync: function(addr, stream, len, flags, offset) { + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + doMkdir: function(path, mode) { + path = PATH.normalize(path); + if (path[path.length - 1] === "/") path = path.substr(0, path.length - 1); + FS.mkdir(path, mode, 0); + return 0; + }, + doMknod: function(path, mode, dev) { + switch (mode & 61440) { + case 32768: + case 8192: + case 24576: + case 4096: + case 49152: + break; + + default: + return -28; + } + FS.mknod(path, mode, dev); + return 0; + }, + doReadlink: function(path, buf, bufsize) { + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = SAFE_HEAP_LOAD(buf + len, 1, 0); + stringToUTF8(ret, buf, bufsize + 1); + SAFE_HEAP_STORE(buf + len, endChar, 1); + return len; + }, + doAccess: function(path, amode) { + if (amode & ~7) { + return -28; + } + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ""; + if (amode & 4) perms += "r"; + if (amode & 2) perms += "w"; + if (amode & 1) perms += "x"; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + }, + doDup: function(path, flags, suggestFD) { + var suggest = FS.getStream(suggestFD); + if (suggest) FS.close(suggest); + return FS.open(path, flags, 0, suggestFD, suggestFD).fd; + }, + doReadv: function(stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = SAFE_HEAP_LOAD(iov + i * 8 | 0, 4, 0) | 0; + var len = SAFE_HEAP_LOAD(iov + (i * 8 + 4) | 0, 4, 0) | 0; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + } + return ret; + }, + doWritev: function(stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = SAFE_HEAP_LOAD(iov + i * 8 | 0, 4, 0) | 0; + var len = SAFE_HEAP_LOAD(iov + (i * 8 + 4) | 0, 4, 0) | 0; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + } + return ret; + }, + varargs: undefined, + get: function() { + assert(SYSCALLS.varargs != undefined); + SYSCALLS.varargs += 4; + var ret = SAFE_HEAP_LOAD(SYSCALLS.varargs - 4 | 0, 4, 0) | 0; + return ret; + }, + getStr: function(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + getStreamFromFD: function(fd) { + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + return stream; + }, + get64: function(low, high) { + if (low >= 0) assert(high === 0); else assert(high === -1); + return low; + } +}; + +function ___syscall_chmod(path, mode) { + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_dup(fd) { + try { + var old = SYSCALLS.getStreamFromFD(fd); + return FS.open(old.path, old.flags, 0).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_dup3(fd, suggestFD, flags) { + try { + var old = SYSCALLS.getStreamFromFD(fd); + assert(!flags); + if (old.fd === suggestFD) return -28; + return SYSCALLS.doDup(old.path, old.flags, suggestFD); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_faccessat(dirfd, path, amode, flags) { + try { + path = SYSCALLS.getStr(path); + assert(flags === 0); + path = SYSCALLS.calculateAt(dirfd, path); + return SYSCALLS.doAccess(path, amode); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fcntl64(fd, cmd, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: + { + var arg = SYSCALLS.get(); + if (arg < 0) { + return -28; + } + var newStream; + newStream = FS.open(stream.path, stream.flags, 0, arg); + return newStream.fd; + } + + case 1: + case 2: + return 0; + + case 3: + return stream.flags; + + case 4: + { + var arg = SYSCALLS.get(); + stream.flags |= arg; + return 0; + } + + case 5: + { + var arg = SYSCALLS.get(); + var offset = 0; + SAFE_HEAP_STORE(arg + offset | 0, 2 | 0, 2); + return 0; + } + + case 6: + case 7: + return 0; + + case 16: + case 8: + return -28; + + case 9: + setErrNo(28); + return -1; + + default: + { + return -28; + } + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fstat64(fd, buf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fstatat64(dirfd, path, buf, flags) { + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & ~4352; + assert(!flags, flags); + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_getcwd(buf, size) { + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd); + if (size < cwdLengthInBytes + 1) return -68; + stringToUTF8(cwd, buf, size); + return buf; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_getdents64(fd, dirp, count) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (!stream.getdents) { + stream.getdents = FS.readdir(stream.path); + } + var struct_size = 280; + var pos = 0; + var off = FS.llseek(stream, 0, 1); + var idx = Math.floor(off / struct_size); + while (idx < stream.getdents.length && pos + struct_size <= count) { + var id; + var type; + var name = stream.getdents[idx]; + if (name === ".") { + id = stream.node.id; + type = 4; + } else if (name === "..") { + var lookup = FS.lookupPath(stream.path, { + parent: true + }); + id = lookup.node.id; + type = 4; + } else { + var child = FS.lookupNode(stream.node, name); + id = child.id; + type = FS.isChrdev(child.mode) ? 2 : FS.isDir(child.mode) ? 4 : FS.isLink(child.mode) ? 10 : 8; + } + assert(id); + tempI64 = [ id >>> 0, (tempDouble = id, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(dirp + pos | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(dirp + pos + 4 | 0, tempI64[1] | 0, 4); + tempI64 = [ (idx + 1) * struct_size >>> 0, (tempDouble = (idx + 1) * struct_size, + +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(dirp + pos + 8 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(dirp + pos + 12 | 0, tempI64[1] | 0, 4); + SAFE_HEAP_STORE(dirp + pos + 16 | 0, 280 | 0, 2); + SAFE_HEAP_STORE(dirp + pos + 18 | 0, type | 0, 1); + stringToUTF8(name, dirp + pos + 19, 256); + pos += struct_size; + idx += 1; + } + FS.llseek(stream, idx * struct_size, 0); + return pos; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_getegid32() { + return 0; +} + +function ___syscall_getgid32() { + return ___syscall_getegid32(); +} + +function ___syscall_getuid32() { + return ___syscall_getegid32(); +} + +function ___syscall_ioctl(fd, op, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: + case 21505: + { + if (!stream.tty) return -59; + return 0; + } + + case 21510: + case 21511: + case 21512: + case 21506: + case 21507: + case 21508: + { + if (!stream.tty) return -59; + return 0; + } + + case 21519: + { + if (!stream.tty) return -59; + var argp = SYSCALLS.get(); + SAFE_HEAP_STORE(argp | 0, 0 | 0, 4); + return 0; + } + + case 21520: + { + if (!stream.tty) return -59; + return -28; + } + + case 21531: + { + var argp = SYSCALLS.get(); + return FS.ioctl(stream, op, argp); + } + + case 21523: + { + if (!stream.tty) return -59; + return 0; + } + + case 21524: + { + if (!stream.tty) return -59; + return 0; + } + + default: + abort("bad ioctl syscall " + op); + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_lstat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.lstat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_open(path, flags, varargs) { + SYSCALLS.varargs = varargs; + try { + var pathname = SYSCALLS.getStr(path); + var mode = varargs ? SYSCALLS.get() : 0; + var stream = FS.open(pathname, flags, mode); + return stream.fd; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +var PIPEFS = { + BUCKET_BUFFER_SIZE: 8192, + mount: function(mount) { + return FS.createNode(null, "/", 16384 | 511, 0); + }, + createPipe: function() { + var pipe = { + buckets: [], + refcnt: 2 + }; + pipe.buckets.push({ + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: 0, + roffset: 0 + }); + var rName = PIPEFS.nextname(); + var wName = PIPEFS.nextname(); + var rNode = FS.createNode(PIPEFS.root, rName, 4096, 0); + var wNode = FS.createNode(PIPEFS.root, wName, 4096, 0); + rNode.pipe = pipe; + wNode.pipe = pipe; + var readableStream = FS.createStream({ + path: rName, + node: rNode, + flags: 0, + seekable: false, + stream_ops: PIPEFS.stream_ops + }); + rNode.stream = readableStream; + var writableStream = FS.createStream({ + path: wName, + node: wNode, + flags: 1, + seekable: false, + stream_ops: PIPEFS.stream_ops + }); + wNode.stream = writableStream; + return { + readable_fd: readableStream.fd, + writable_fd: writableStream.fd + }; + }, + stream_ops: { + poll: function(stream) { + var pipe = stream.node.pipe; + if ((stream.flags & 2097155) === 1) { + return 256 | 4; + } else { + if (pipe.buckets.length > 0) { + for (var i = 0; i < pipe.buckets.length; i++) { + var bucket = pipe.buckets[i]; + if (bucket.offset - bucket.roffset > 0) { + return 64 | 1; + } + } + } + } + return 0; + }, + ioctl: function(stream, request, varargs) { + return 28; + }, + fsync: function(stream) { + return 28; + }, + read: function(stream, buffer, offset, length, position) { + var pipe = stream.node.pipe; + var currentLength = 0; + for (var i = 0; i < pipe.buckets.length; i++) { + var bucket = pipe.buckets[i]; + currentLength += bucket.offset - bucket.roffset; + } + assert(buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer)); + var data = buffer.subarray(offset, offset + length); + if (length <= 0) { + return 0; + } + if (currentLength == 0) { + throw new FS.ErrnoError(6); + } + var toRead = Math.min(currentLength, length); + var totalRead = toRead; + var toRemove = 0; + for (var i = 0; i < pipe.buckets.length; i++) { + var currBucket = pipe.buckets[i]; + var bucketSize = currBucket.offset - currBucket.roffset; + if (toRead <= bucketSize) { + var tmpSlice = currBucket.buffer.subarray(currBucket.roffset, currBucket.offset); + if (toRead < bucketSize) { + tmpSlice = tmpSlice.subarray(0, toRead); + currBucket.roffset += toRead; + } else { + toRemove++; + } + data.set(tmpSlice); + break; + } else { + var tmpSlice = currBucket.buffer.subarray(currBucket.roffset, currBucket.offset); + data.set(tmpSlice); + data = data.subarray(tmpSlice.byteLength); + toRead -= tmpSlice.byteLength; + toRemove++; + } + } + if (toRemove && toRemove == pipe.buckets.length) { + toRemove--; + pipe.buckets[toRemove].offset = 0; + pipe.buckets[toRemove].roffset = 0; + } + pipe.buckets.splice(0, toRemove); + return totalRead; + }, + write: function(stream, buffer, offset, length, position) { + var pipe = stream.node.pipe; + assert(buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer)); + var data = buffer.subarray(offset, offset + length); + var dataLen = data.byteLength; + if (dataLen <= 0) { + return 0; + } + var currBucket = null; + if (pipe.buckets.length == 0) { + currBucket = { + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: 0, + roffset: 0 + }; + pipe.buckets.push(currBucket); + } else { + currBucket = pipe.buckets[pipe.buckets.length - 1]; + } + assert(currBucket.offset <= PIPEFS.BUCKET_BUFFER_SIZE); + var freeBytesInCurrBuffer = PIPEFS.BUCKET_BUFFER_SIZE - currBucket.offset; + if (freeBytesInCurrBuffer >= dataLen) { + currBucket.buffer.set(data, currBucket.offset); + currBucket.offset += dataLen; + return dataLen; + } else if (freeBytesInCurrBuffer > 0) { + currBucket.buffer.set(data.subarray(0, freeBytesInCurrBuffer), currBucket.offset); + currBucket.offset += freeBytesInCurrBuffer; + data = data.subarray(freeBytesInCurrBuffer, data.byteLength); + } + var numBuckets = data.byteLength / PIPEFS.BUCKET_BUFFER_SIZE | 0; + var remElements = data.byteLength % PIPEFS.BUCKET_BUFFER_SIZE; + for (var i = 0; i < numBuckets; i++) { + var newBucket = { + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: PIPEFS.BUCKET_BUFFER_SIZE, + roffset: 0 + }; + pipe.buckets.push(newBucket); + newBucket.buffer.set(data.subarray(0, PIPEFS.BUCKET_BUFFER_SIZE)); + data = data.subarray(PIPEFS.BUCKET_BUFFER_SIZE, data.byteLength); + } + if (remElements > 0) { + var newBucket = { + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: data.byteLength, + roffset: 0 + }; + pipe.buckets.push(newBucket); + newBucket.buffer.set(data); + } + return dataLen; + }, + close: function(stream) { + var pipe = stream.node.pipe; + pipe.refcnt--; + if (pipe.refcnt === 0) { + pipe.buckets = null; + } + } + }, + nextname: function() { + if (!PIPEFS.nextname.current) { + PIPEFS.nextname.current = 0; + } + return "pipe[" + PIPEFS.nextname.current++ + "]"; + } +}; + +function ___syscall_pipe(fdPtr) { + try { + if (fdPtr == 0) { + throw new FS.ErrnoError(21); + } + var res = PIPEFS.createPipe(); + SAFE_HEAP_STORE(fdPtr | 0, res.readable_fd | 0, 4); + SAFE_HEAP_STORE(fdPtr + 4 | 0, res.writable_fd | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_readlink(path, buf, bufsize) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doReadlink(path, buf, bufsize); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_rmdir(path) { + try { + path = SYSCALLS.getStr(path); + FS.rmdir(path); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_stat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_unlink(path) { + try { + path = SYSCALLS.getStr(path); + FS.unlink(path); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function __dlopen_js(filename, flag) { + abort("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking"); +} + +function __dlsym_js(handle, symbol) { + abort("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking"); +} + +function __localtime_js(time, tmPtr) { + var date = new Date((SAFE_HEAP_LOAD(time | 0, 4, 0) | 0) * 1e3); + SAFE_HEAP_STORE(tmPtr | 0, date.getSeconds() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 4 | 0, date.getMinutes() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 8 | 0, date.getHours() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 12 | 0, date.getDate() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 16 | 0, date.getMonth() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 20 | 0, date.getFullYear() - 1900 | 0, 4); + SAFE_HEAP_STORE(tmPtr + 24 | 0, date.getDay() | 0, 4); + var start = new Date(date.getFullYear(), 0, 1); + var yday = (date.getTime() - start.getTime()) / (1e3 * 60 * 60 * 24) | 0; + SAFE_HEAP_STORE(tmPtr + 28 | 0, yday | 0, 4); + SAFE_HEAP_STORE(tmPtr + 36 | 0, -(date.getTimezoneOffset() * 60) | 0, 4); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + SAFE_HEAP_STORE(tmPtr + 32 | 0, dst | 0, 4); +} + +function _tzset_impl(timezone, daylight, tzname) { + var currentYear = new Date().getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + SAFE_HEAP_STORE(timezone | 0, stdTimezoneOffset * 60 | 0, 4); + SAFE_HEAP_STORE(daylight | 0, Number(winterOffset != summerOffset) | 0, 4); + function extractZone(date) { + var match = date.toTimeString().match(/\(([A-Za-z ]+)\)$/); + return match ? match[1] : "GMT"; + } + var winterName = extractZone(winter); + var summerName = extractZone(summer); + var winterNamePtr = allocateUTF8(winterName); + var summerNamePtr = allocateUTF8(summerName); + if (summerOffset < winterOffset) { + SAFE_HEAP_STORE(tzname | 0, winterNamePtr | 0, 4); + SAFE_HEAP_STORE(tzname + 4 | 0, summerNamePtr | 0, 4); + } else { + SAFE_HEAP_STORE(tzname | 0, summerNamePtr | 0, 4); + SAFE_HEAP_STORE(tzname + 4 | 0, winterNamePtr | 0, 4); + } +} + +function __tzset_js(timezone, daylight, tzname) { + if (__tzset_js.called) return; + __tzset_js.called = true; + _tzset_impl(timezone, daylight, tzname); +} + +function _abort() { + abort("native code called abort()"); +} + +function _emscripten_console_error(str) { + assert(typeof str == "number"); + console.error(UTF8ToString(str)); +} + +function _emscripten_memcpy_big(dest, src, num) { + HEAPU8.copyWithin(dest, src, src + num); +} + +function _emscripten_get_heap_max() { + return 2147483648; +} + +function emscripten_realloc_buffer(size) { + try { + wasmMemory.grow(size - buffer.byteLength + 65535 >>> 16); + updateGlobalBufferAndViews(wasmMemory.buffer); + return 1; + } catch (e) { + err("emscripten_realloc_buffer: Attempted to grow heap from " + buffer.byteLength + " bytes to " + size + " bytes, but got error: " + e); + } +} + +function _emscripten_resize_heap(requestedSize) { + var oldSize = HEAPU8.length; + requestedSize = requestedSize >>> 0; + assert(requestedSize > oldSize); + var maxHeapSize = _emscripten_get_heap_max(); + if (requestedSize > maxHeapSize) { + err("Cannot enlarge memory, asked to go up to " + requestedSize + " bytes, but the limit is " + maxHeapSize + " bytes!"); + return false; + } + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + .2 / cutDown); + overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); + var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536)); + var replacement = emscripten_realloc_buffer(newSize); + if (replacement) { + return true; + } + } + err("Failed to grow the heap from " + oldSize + " bytes to " + newSize + " bytes, not enough memory!"); + return false; +} + +var ENV = {}; + +function getExecutableName() { + return thisProgram || "./this.program"; +} + +function getEnvStrings() { + if (!getEnvStrings.strings) { + var lang = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8"; + var env = { + "USER": "web_user", + "LOGNAME": "web_user", + "PATH": "/", + "PWD": "/", + "HOME": "/home/web_user", + "LANG": lang, + "_": getExecutableName() + }; + for (var x in ENV) { + if (ENV[x] === undefined) delete env[x]; else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(x + "=" + env[x]); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; +} + +function _environ_get(__environ, environ_buf) { + var bufSize = 0; + getEnvStrings().forEach(function(string, i) { + var ptr = environ_buf + bufSize; + SAFE_HEAP_STORE(__environ + i * 4 | 0, ptr | 0, 4); + writeAsciiToMemory(string, ptr); + bufSize += string.length + 1; + }); + return 0; +} + +function _environ_sizes_get(penviron_count, penviron_buf_size) { + var strings = getEnvStrings(); + SAFE_HEAP_STORE(penviron_count | 0, strings.length | 0, 4); + var bufSize = 0; + strings.forEach(function(string) { + bufSize += string.length + 1; + }); + SAFE_HEAP_STORE(penviron_buf_size | 0, bufSize | 0, 4); + return 0; +} + +function _exit(status) { + exit(status); +} + +function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_fdstat_get(fd, pbuf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var type = stream.tty ? 2 : FS.isDir(stream.mode) ? 3 : FS.isLink(stream.mode) ? 7 : 4; + SAFE_HEAP_STORE(pbuf | 0, type | 0, 1); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_pread(fd, iov, iovcnt, offset_low, offset_high, pnum) { + try { + assert(!offset_high, "offsets over 2^32 not yet supported"); + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doReadv(stream, iov, iovcnt, offset_low); + SAFE_HEAP_STORE(pnum | 0, num | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_read(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doReadv(stream, iov, iovcnt); + SAFE_HEAP_STORE(pnum | 0, num | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_seek(fd, offset_low, offset_high, whence, newOffset) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var HIGH_OFFSET = 4294967296; + var offset = offset_high * HIGH_OFFSET + (offset_low >>> 0); + var DOUBLE_LIMIT = 9007199254740992; + if (offset <= -DOUBLE_LIMIT || offset >= DOUBLE_LIMIT) { + return -61; + } + FS.llseek(stream, offset, whence); + tempI64 = [ stream.position >>> 0, (tempDouble = stream.position, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(newOffset | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(newOffset + 4 | 0, tempI64[1] | 0, 4); + if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_write(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doWritev(stream, iov, iovcnt); + SAFE_HEAP_STORE(pnum | 0, num | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _proc_exit(code) { + procExit(code); +} + +function _setTempRet0(val) { + setTempRet0(val); +} + +function _time(ptr) { + var ret = Date.now() / 1e3 | 0; + if (ptr) { + SAFE_HEAP_STORE(ptr | 0, ret | 0, 4); + } + return ret; +} + +var FSNode = function(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; +}; + +var readMode = 292 | 73; + +var writeMode = 146; + +Object.defineProperties(FSNode.prototype, { + read: { + get: function() { + return (this.mode & readMode) === readMode; + }, + set: function(val) { + val ? this.mode |= readMode : this.mode &= ~readMode; + } + }, + write: { + get: function() { + return (this.mode & writeMode) === writeMode; + }, + set: function(val) { + val ? this.mode |= writeMode : this.mode &= ~writeMode; + } + }, + isFolder: { + get: function() { + return FS.isDir(this.mode); + } + }, + isDevice: { + get: function() { + return FS.isChrdev(this.mode); + } + } +}); + +FS.FSNode = FSNode; + +FS.staticInit(); + +Module["FS_createPath"] = FS.createPath; + +Module["FS_createDataFile"] = FS.createDataFile; + +Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + +Module["FS_createLazyFile"] = FS.createLazyFile; + +Module["FS_createDevice"] = FS.createDevice; + +Module["FS_unlink"] = FS.unlink; + +ERRNO_CODES = { + "EPERM": 63, + "ENOENT": 44, + "ESRCH": 71, + "EINTR": 27, + "EIO": 29, + "ENXIO": 60, + "E2BIG": 1, + "ENOEXEC": 45, + "EBADF": 8, + "ECHILD": 12, + "EAGAIN": 6, + "EWOULDBLOCK": 6, + "ENOMEM": 48, + "EACCES": 2, + "EFAULT": 21, + "ENOTBLK": 105, + "EBUSY": 10, + "EEXIST": 20, + "EXDEV": 75, + "ENODEV": 43, + "ENOTDIR": 54, + "EISDIR": 31, + "EINVAL": 28, + "ENFILE": 41, + "EMFILE": 33, + "ENOTTY": 59, + "ETXTBSY": 74, + "EFBIG": 22, + "ENOSPC": 51, + "ESPIPE": 70, + "EROFS": 69, + "EMLINK": 34, + "EPIPE": 64, + "EDOM": 18, + "ERANGE": 68, + "ENOMSG": 49, + "EIDRM": 24, + "ECHRNG": 106, + "EL2NSYNC": 156, + "EL3HLT": 107, + "EL3RST": 108, + "ELNRNG": 109, + "EUNATCH": 110, + "ENOCSI": 111, + "EL2HLT": 112, + "EDEADLK": 16, + "ENOLCK": 46, + "EBADE": 113, + "EBADR": 114, + "EXFULL": 115, + "ENOANO": 104, + "EBADRQC": 103, + "EBADSLT": 102, + "EDEADLOCK": 16, + "EBFONT": 101, + "ENOSTR": 100, + "ENODATA": 116, + "ETIME": 117, + "ENOSR": 118, + "ENONET": 119, + "ENOPKG": 120, + "EREMOTE": 121, + "ENOLINK": 47, + "EADV": 122, + "ESRMNT": 123, + "ECOMM": 124, + "EPROTO": 65, + "EMULTIHOP": 36, + "EDOTDOT": 125, + "EBADMSG": 9, + "ENOTUNIQ": 126, + "EBADFD": 127, + "EREMCHG": 128, + "ELIBACC": 129, + "ELIBBAD": 130, + "ELIBSCN": 131, + "ELIBMAX": 132, + "ELIBEXEC": 133, + "ENOSYS": 52, + "ENOTEMPTY": 55, + "ENAMETOOLONG": 37, + "ELOOP": 32, + "EOPNOTSUPP": 138, + "EPFNOSUPPORT": 139, + "ECONNRESET": 15, + "ENOBUFS": 42, + "EAFNOSUPPORT": 5, + "EPROTOTYPE": 67, + "ENOTSOCK": 57, + "ENOPROTOOPT": 50, + "ESHUTDOWN": 140, + "ECONNREFUSED": 14, + "EADDRINUSE": 3, + "ECONNABORTED": 13, + "ENETUNREACH": 40, + "ENETDOWN": 38, + "ETIMEDOUT": 73, + "EHOSTDOWN": 142, + "EHOSTUNREACH": 23, + "EINPROGRESS": 26, + "EALREADY": 7, + "EDESTADDRREQ": 17, + "EMSGSIZE": 35, + "EPROTONOSUPPORT": 66, + "ESOCKTNOSUPPORT": 137, + "EADDRNOTAVAIL": 4, + "ENETRESET": 39, + "EISCONN": 30, + "ENOTCONN": 53, + "ETOOMANYREFS": 141, + "EUSERS": 136, + "EDQUOT": 19, + "ESTALE": 72, + "ENOTSUP": 138, + "ENOMEDIUM": 148, + "EILSEQ": 25, + "EOVERFLOW": 61, + "ECANCELED": 11, + "ENOTRECOVERABLE": 56, + "EOWNERDEAD": 62, + "ESTRPIPE": 135 +}; + +var ASSERTIONS = true; + +function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; +} + +function intArrayToString(array) { + var ret = []; + for (var i = 0; i < array.length; i++) { + var chr = array[i]; + if (chr > 255) { + if (ASSERTIONS) { + assert(false, "Character code " + chr + " (" + String.fromCharCode(chr) + ") at offset " + i + " not in 0x00-0xFF."); + } + chr &= 255; + } + ret.push(String.fromCharCode(chr)); + } + return ret.join(""); +} + +var decodeBase64 = typeof atob == "function" ? atob : function(input) { + var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + do { + enc1 = keyStr.indexOf(input.charAt(i++)); + enc2 = keyStr.indexOf(input.charAt(i++)); + enc3 = keyStr.indexOf(input.charAt(i++)); + enc4 = keyStr.indexOf(input.charAt(i++)); + chr1 = enc1 << 2 | enc2 >> 4; + chr2 = (enc2 & 15) << 4 | enc3 >> 2; + chr3 = (enc3 & 3) << 6 | enc4; + output = output + String.fromCharCode(chr1); + if (enc3 !== 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 !== 64) { + output = output + String.fromCharCode(chr3); + } + } while (i < input.length); + return output; +}; + +function intArrayFromBase64(s) { + if (typeof ENVIRONMENT_IS_NODE == "boolean" && ENVIRONMENT_IS_NODE) { + var buf = Buffer.from(s, "base64"); + return new Uint8Array(buf["buffer"], buf["byteOffset"], buf["byteLength"]); + } + try { + var decoded = decodeBase64(s); + var bytes = new Uint8Array(decoded.length); + for (var i = 0; i < decoded.length; ++i) { + bytes[i] = decoded.charCodeAt(i); + } + return bytes; + } catch (_) { + throw new Error("Converting base64 string to bytes failed."); + } +} + +function tryParseAsDataURI(filename) { + if (!isDataURI(filename)) { + return; + } + return intArrayFromBase64(filename.slice(dataURIPrefix.length)); +} + +var asmLibraryArg = { + "__assert_fail": ___assert_fail, + "__clock_gettime": ___clock_gettime, + "__syscall_chmod": ___syscall_chmod, + "__syscall_dup": ___syscall_dup, + "__syscall_dup3": ___syscall_dup3, + "__syscall_faccessat": ___syscall_faccessat, + "__syscall_fcntl64": ___syscall_fcntl64, + "__syscall_fstat64": ___syscall_fstat64, + "__syscall_fstatat64": ___syscall_fstatat64, + "__syscall_getcwd": ___syscall_getcwd, + "__syscall_getdents64": ___syscall_getdents64, + "__syscall_getgid32": ___syscall_getgid32, + "__syscall_getuid32": ___syscall_getuid32, + "__syscall_ioctl": ___syscall_ioctl, + "__syscall_lstat64": ___syscall_lstat64, + "__syscall_open": ___syscall_open, + "__syscall_pipe": ___syscall_pipe, + "__syscall_readlink": ___syscall_readlink, + "__syscall_rmdir": ___syscall_rmdir, + "__syscall_stat64": ___syscall_stat64, + "__syscall_unlink": ___syscall_unlink, + "_dlopen_js": __dlopen_js, + "_dlsym_js": __dlsym_js, + "_localtime_js": __localtime_js, + "_tzset_js": __tzset_js, + "abort": _abort, + "alignfault": alignfault, + "emscripten_console_error": _emscripten_console_error, + "emscripten_get_now": _emscripten_get_now, + "emscripten_memcpy_big": _emscripten_memcpy_big, + "emscripten_resize_heap": _emscripten_resize_heap, + "environ_get": _environ_get, + "environ_sizes_get": _environ_sizes_get, + "exit": _exit, + "fd_close": _fd_close, + "fd_fdstat_get": _fd_fdstat_get, + "fd_pread": _fd_pread, + "fd_read": _fd_read, + "fd_seek": _fd_seek, + "fd_write": _fd_write, + "proc_exit": _proc_exit, + "segfault": segfault, + "setTempRet0": _setTempRet0, + "time": _time +}; + +var asm = createWasm(); + +var ___wasm_call_ctors = Module["___wasm_call_ctors"] = createExportWrapper("__wasm_call_ctors"); + +var _malloc = Module["_malloc"] = createExportWrapper("malloc"); + +var _free = Module["_free"] = createExportWrapper("free"); + +var ___errno_location = Module["___errno_location"] = createExportWrapper("__errno_location"); + +var _main = Module["_main"] = createExportWrapper("main"); + +var _sbrk = Module["_sbrk"] = createExportWrapper("sbrk"); + +var ___stdio_exit = Module["___stdio_exit"] = createExportWrapper("__stdio_exit"); + +var ___funcs_on_exit = Module["___funcs_on_exit"] = createExportWrapper("__funcs_on_exit"); + +var ___dl_seterr = Module["___dl_seterr"] = createExportWrapper("__dl_seterr"); + +var _emscripten_get_sbrk_ptr = Module["_emscripten_get_sbrk_ptr"] = createExportWrapper("emscripten_get_sbrk_ptr"); + +var _emscripten_stack_init = Module["_emscripten_stack_init"] = function() { + return (_emscripten_stack_init = Module["_emscripten_stack_init"] = Module["asm"]["emscripten_stack_init"]).apply(null, arguments); +}; + +var _emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = function() { + return (_emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = Module["asm"]["emscripten_stack_get_free"]).apply(null, arguments); +}; + +var _emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = function() { + return (_emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = Module["asm"]["emscripten_stack_get_base"]).apply(null, arguments); +}; + +var _emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = function() { + return (_emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = Module["asm"]["emscripten_stack_get_end"]).apply(null, arguments); +}; + +var stackSave = Module["stackSave"] = createExportWrapper("stackSave"); + +var stackRestore = Module["stackRestore"] = createExportWrapper("stackRestore"); + +var stackAlloc = Module["stackAlloc"] = createExportWrapper("stackAlloc"); + +var dynCall_iiiiiiji = Module["dynCall_iiiiiiji"] = createExportWrapper("dynCall_iiiiiiji"); + +var dynCall_ji = Module["dynCall_ji"] = createExportWrapper("dynCall_ji"); + +var dynCall_jiji = Module["dynCall_jiji"] = createExportWrapper("dynCall_jiji"); + +var dynCall_iiiiiijjjiii = Module["dynCall_iiiiiijjjiii"] = createExportWrapper("dynCall_iiiiiijjjiii"); + +var dynCall_iiijiiii = Module["dynCall_iiijiiii"] = createExportWrapper("dynCall_iiijiiii"); + +var dynCall_iji = Module["dynCall_iji"] = createExportWrapper("dynCall_iji"); + +var dynCall_jj = Module["dynCall_jj"] = createExportWrapper("dynCall_jj"); + +var dynCall_jjj = Module["dynCall_jjj"] = createExportWrapper("dynCall_jjj"); + +var dynCall_viiiiij = Module["dynCall_viiiiij"] = createExportWrapper("dynCall_viiiiij"); + +var dynCall_viiiiji = Module["dynCall_viiiiji"] = createExportWrapper("dynCall_viiiiji"); + +var dynCall_viiiijiij = Module["dynCall_viiiijiij"] = createExportWrapper("dynCall_viiiijiij"); + +var dynCall_viiiij = Module["dynCall_viiiij"] = createExportWrapper("dynCall_viiiij"); + +var dynCall_jiij = Module["dynCall_jiij"] = createExportWrapper("dynCall_jiij"); + +var dynCall_iiji = Module["dynCall_iiji"] = createExportWrapper("dynCall_iiji"); + +var dynCall_iiijiijii = Module["dynCall_iiijiijii"] = createExportWrapper("dynCall_iiijiijii"); + +var dynCall_vji = Module["dynCall_vji"] = createExportWrapper("dynCall_vji"); + +var dynCall_iiiijj = Module["dynCall_iiiijj"] = createExportWrapper("dynCall_iiiijj"); + +var dynCall_iiiijiiii = Module["dynCall_iiiijiiii"] = createExportWrapper("dynCall_iiiijiiii"); + +var dynCall_iiiiijiiii = Module["dynCall_iiiiijiiii"] = createExportWrapper("dynCall_iiiiijiiii"); + +var dynCall_ijii = Module["dynCall_ijii"] = createExportWrapper("dynCall_ijii"); + +var dynCall_iiiijiji = Module["dynCall_iiiijiji"] = createExportWrapper("dynCall_iiiijiji"); + +var dynCall_iijjii = Module["dynCall_iijjii"] = createExportWrapper("dynCall_iijjii"); + +var dynCall_iij = Module["dynCall_iij"] = createExportWrapper("dynCall_iij"); + +var dynCall_jjii = Module["dynCall_jjii"] = createExportWrapper("dynCall_jjii"); + +var dynCall_jiii = Module["dynCall_jiii"] = createExportWrapper("dynCall_jiii"); + +var dynCall_jiiiii = Module["dynCall_jiiiii"] = createExportWrapper("dynCall_jiiiii"); + +var dynCall_iiiiiijiiii = Module["dynCall_iiiiiijiiii"] = createExportWrapper("dynCall_iiiiiijiiii"); + +if (!Object.getOwnPropertyDescriptor(Module, "intArrayFromString")) Module["intArrayFromString"] = (() => abort("'intArrayFromString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "intArrayToString")) Module["intArrayToString"] = (() => abort("'intArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ccall")) Module["ccall"] = (() => abort("'ccall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "cwrap")) Module["cwrap"] = (() => abort("'cwrap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setValue")) Module["setValue"] = (() => abort("'setValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getValue")) Module["getValue"] = (() => abort("'getValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocate")) Module["allocate"] = (() => abort("'allocate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF8ArrayToString")) Module["UTF8ArrayToString"] = (() => abort("'UTF8ArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF8ToString")) Module["UTF8ToString"] = (() => abort("'UTF8ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8Array")) Module["stringToUTF8Array"] = (() => abort("'stringToUTF8Array' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8")) Module["stringToUTF8"] = (() => abort("'stringToUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF8")) Module["lengthBytesUTF8"] = (() => abort("'lengthBytesUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = (() => abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPreRun")) Module["addOnPreRun"] = (() => abort("'addOnPreRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnInit")) Module["addOnInit"] = (() => abort("'addOnInit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPreMain")) Module["addOnPreMain"] = (() => abort("'addOnPreMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnExit")) Module["addOnExit"] = (() => abort("'addOnExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPostRun")) Module["addOnPostRun"] = (() => abort("'addOnPostRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeStringToMemory")) Module["writeStringToMemory"] = (() => abort("'writeStringToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeArrayToMemory")) Module["writeArrayToMemory"] = (() => abort("'writeArrayToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeAsciiToMemory")) Module["writeAsciiToMemory"] = (() => abort("'writeAsciiToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["addRunDependency"] = addRunDependency; + +Module["removeRunDependency"] = removeRunDependency; + +if (!Object.getOwnPropertyDescriptor(Module, "FS_createFolder")) Module["FS_createFolder"] = (() => abort("'FS_createFolder' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS_createPath"] = FS.createPath; + +Module["FS_createDataFile"] = FS.createDataFile; + +Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + +Module["FS_createLazyFile"] = FS.createLazyFile; + +if (!Object.getOwnPropertyDescriptor(Module, "FS_createLink")) Module["FS_createLink"] = (() => abort("'FS_createLink' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS_createDevice"] = FS.createDevice; + +Module["FS_unlink"] = FS.unlink; + +if (!Object.getOwnPropertyDescriptor(Module, "getLEB")) Module["getLEB"] = (() => abort("'getLEB' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFunctionTables")) Module["getFunctionTables"] = (() => abort("'getFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "alignFunctionTables")) Module["alignFunctionTables"] = (() => abort("'alignFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFunctions")) Module["registerFunctions"] = (() => abort("'registerFunctions' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addFunction")) Module["addFunction"] = (() => abort("'addFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "removeFunction")) Module["removeFunction"] = (() => abort("'removeFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = (() => abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "prettyPrint")) Module["prettyPrint"] = (() => abort("'prettyPrint' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = (() => abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getCompilerSetting")) Module["getCompilerSetting"] = (() => abort("'getCompilerSetting' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "print")) Module["print"] = (() => abort("'print' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "printErr")) Module["printErr"] = (() => abort("'printErr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getTempRet0")) Module["getTempRet0"] = (() => abort("'getTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setTempRet0")) Module["setTempRet0"] = (() => abort("'setTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callMain")) Module["callMain"] = (() => abort("'callMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "abort")) Module["abort"] = (() => abort("'abort' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "keepRuntimeAlive")) Module["keepRuntimeAlive"] = (() => abort("'keepRuntimeAlive' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "zeroMemory")) Module["zeroMemory"] = (() => abort("'zeroMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToNewUTF8")) Module["stringToNewUTF8"] = (() => abort("'stringToNewUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscripten_realloc_buffer")) Module["emscripten_realloc_buffer"] = (() => abort("'emscripten_realloc_buffer' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ENV")) Module["ENV"] = (() => abort("'ENV' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "withStackSave")) Module["withStackSave"] = (() => abort("'withStackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_CODES")) Module["ERRNO_CODES"] = (() => abort("'ERRNO_CODES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_MESSAGES")) Module["ERRNO_MESSAGES"] = (() => abort("'ERRNO_MESSAGES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setErrNo")) Module["setErrNo"] = (() => abort("'setErrNo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetPton4")) Module["inetPton4"] = (() => abort("'inetPton4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetNtop4")) Module["inetNtop4"] = (() => abort("'inetNtop4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetPton6")) Module["inetPton6"] = (() => abort("'inetPton6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetNtop6")) Module["inetNtop6"] = (() => abort("'inetNtop6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readSockaddr")) Module["readSockaddr"] = (() => abort("'readSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeSockaddr")) Module["writeSockaddr"] = (() => abort("'writeSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "DNS")) Module["DNS"] = (() => abort("'DNS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getHostByName")) Module["getHostByName"] = (() => abort("'getHostByName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Protocols")) Module["Protocols"] = (() => abort("'Protocols' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Sockets")) Module["Sockets"] = (() => abort("'Sockets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getRandomDevice")) Module["getRandomDevice"] = (() => abort("'getRandomDevice' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "traverseStack")) Module["traverseStack"] = (() => abort("'traverseStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertFrameToPC")) Module["convertFrameToPC"] = (() => abort("'convertFrameToPC' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UNWIND_CACHE")) Module["UNWIND_CACHE"] = (() => abort("'UNWIND_CACHE' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "saveInUnwindCache")) Module["saveInUnwindCache"] = (() => abort("'saveInUnwindCache' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertPCtoSourceLocation")) Module["convertPCtoSourceLocation"] = (() => abort("'convertPCtoSourceLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgsArray")) Module["readAsmConstArgsArray"] = (() => abort("'readAsmConstArgsArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgs")) Module["readAsmConstArgs"] = (() => abort("'readAsmConstArgs' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "mainThreadEM_ASM")) Module["mainThreadEM_ASM"] = (() => abort("'mainThreadEM_ASM' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jstoi_q")) Module["jstoi_q"] = (() => abort("'jstoi_q' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jstoi_s")) Module["jstoi_s"] = (() => abort("'jstoi_s' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getExecutableName")) Module["getExecutableName"] = (() => abort("'getExecutableName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "listenOnce")) Module["listenOnce"] = (() => abort("'listenOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "autoResumeAudioContext")) Module["autoResumeAudioContext"] = (() => abort("'autoResumeAudioContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCallLegacy")) Module["dynCallLegacy"] = (() => abort("'dynCallLegacy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getDynCaller")) Module["getDynCaller"] = (() => abort("'getDynCaller' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = (() => abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callRuntimeCallbacks")) Module["callRuntimeCallbacks"] = (() => abort("'callRuntimeCallbacks' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "wasmTableMirror")) Module["wasmTableMirror"] = (() => abort("'wasmTableMirror' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setWasmTableEntry")) Module["setWasmTableEntry"] = (() => abort("'setWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getWasmTableEntry")) Module["getWasmTableEntry"] = (() => abort("'getWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "handleException")) Module["handleException"] = (() => abort("'handleException' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePush")) Module["runtimeKeepalivePush"] = (() => abort("'runtimeKeepalivePush' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePop")) Module["runtimeKeepalivePop"] = (() => abort("'runtimeKeepalivePop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callUserCallback")) Module["callUserCallback"] = (() => abort("'callUserCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "maybeExit")) Module["maybeExit"] = (() => abort("'maybeExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "safeSetTimeout")) Module["safeSetTimeout"] = (() => abort("'safeSetTimeout' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "asmjsMangle")) Module["asmjsMangle"] = (() => abort("'asmjsMangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "asyncLoad")) Module["asyncLoad"] = (() => abort("'asyncLoad' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "alignMemory")) Module["alignMemory"] = (() => abort("'alignMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "mmapAlloc")) Module["mmapAlloc"] = (() => abort("'mmapAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "reallyNegative")) Module["reallyNegative"] = (() => abort("'reallyNegative' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "unSign")) Module["unSign"] = (() => abort("'unSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "reSign")) Module["reSign"] = (() => abort("'reSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "formatString")) Module["formatString"] = (() => abort("'formatString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PATH")) Module["PATH"] = (() => abort("'PATH' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PATH_FS")) Module["PATH_FS"] = (() => abort("'PATH_FS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SYSCALLS")) Module["SYSCALLS"] = (() => abort("'SYSCALLS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getSocketFromFD")) Module["getSocketFromFD"] = (() => abort("'getSocketFromFD' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getSocketAddress")) Module["getSocketAddress"] = (() => abort("'getSocketAddress' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "JSEvents")) Module["JSEvents"] = (() => abort("'JSEvents' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerKeyEventCallback")) Module["registerKeyEventCallback"] = (() => abort("'registerKeyEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "specialHTMLTargets")) Module["specialHTMLTargets"] = (() => abort("'specialHTMLTargets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "maybeCStringToJsString")) Module["maybeCStringToJsString"] = (() => abort("'maybeCStringToJsString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "findEventTarget")) Module["findEventTarget"] = (() => abort("'findEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "findCanvasEventTarget")) Module["findCanvasEventTarget"] = (() => abort("'findCanvasEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getBoundingClientRect")) Module["getBoundingClientRect"] = (() => abort("'getBoundingClientRect' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillMouseEventData")) Module["fillMouseEventData"] = (() => abort("'fillMouseEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerMouseEventCallback")) Module["registerMouseEventCallback"] = (() => abort("'registerMouseEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerWheelEventCallback")) Module["registerWheelEventCallback"] = (() => abort("'registerWheelEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerUiEventCallback")) Module["registerUiEventCallback"] = (() => abort("'registerUiEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFocusEventCallback")) Module["registerFocusEventCallback"] = (() => abort("'registerFocusEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceOrientationEventData")) Module["fillDeviceOrientationEventData"] = (() => abort("'fillDeviceOrientationEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceOrientationEventCallback")) Module["registerDeviceOrientationEventCallback"] = (() => abort("'registerDeviceOrientationEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceMotionEventData")) Module["fillDeviceMotionEventData"] = (() => abort("'fillDeviceMotionEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceMotionEventCallback")) Module["registerDeviceMotionEventCallback"] = (() => abort("'registerDeviceMotionEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "screenOrientation")) Module["screenOrientation"] = (() => abort("'screenOrientation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillOrientationChangeEventData")) Module["fillOrientationChangeEventData"] = (() => abort("'fillOrientationChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerOrientationChangeEventCallback")) Module["registerOrientationChangeEventCallback"] = (() => abort("'registerOrientationChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillFullscreenChangeEventData")) Module["fillFullscreenChangeEventData"] = (() => abort("'fillFullscreenChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFullscreenChangeEventCallback")) Module["registerFullscreenChangeEventCallback"] = (() => abort("'registerFullscreenChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerRestoreOldStyle")) Module["registerRestoreOldStyle"] = (() => abort("'registerRestoreOldStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "hideEverythingExceptGivenElement")) Module["hideEverythingExceptGivenElement"] = (() => abort("'hideEverythingExceptGivenElement' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "restoreHiddenElements")) Module["restoreHiddenElements"] = (() => abort("'restoreHiddenElements' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setLetterbox")) Module["setLetterbox"] = (() => abort("'setLetterbox' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "currentFullscreenStrategy")) Module["currentFullscreenStrategy"] = (() => abort("'currentFullscreenStrategy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "restoreOldWindowedStyle")) Module["restoreOldWindowedStyle"] = (() => abort("'restoreOldWindowedStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "softFullscreenResizeWebGLRenderTarget")) Module["softFullscreenResizeWebGLRenderTarget"] = (() => abort("'softFullscreenResizeWebGLRenderTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "doRequestFullscreen")) Module["doRequestFullscreen"] = (() => abort("'doRequestFullscreen' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillPointerlockChangeEventData")) Module["fillPointerlockChangeEventData"] = (() => abort("'fillPointerlockChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockChangeEventCallback")) Module["registerPointerlockChangeEventCallback"] = (() => abort("'registerPointerlockChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockErrorEventCallback")) Module["registerPointerlockErrorEventCallback"] = (() => abort("'registerPointerlockErrorEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "requestPointerLock")) Module["requestPointerLock"] = (() => abort("'requestPointerLock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillVisibilityChangeEventData")) Module["fillVisibilityChangeEventData"] = (() => abort("'fillVisibilityChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerVisibilityChangeEventCallback")) Module["registerVisibilityChangeEventCallback"] = (() => abort("'registerVisibilityChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerTouchEventCallback")) Module["registerTouchEventCallback"] = (() => abort("'registerTouchEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillGamepadEventData")) Module["fillGamepadEventData"] = (() => abort("'fillGamepadEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerGamepadEventCallback")) Module["registerGamepadEventCallback"] = (() => abort("'registerGamepadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerBeforeUnloadEventCallback")) Module["registerBeforeUnloadEventCallback"] = (() => abort("'registerBeforeUnloadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillBatteryEventData")) Module["fillBatteryEventData"] = (() => abort("'fillBatteryEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "battery")) Module["battery"] = (() => abort("'battery' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerBatteryEventCallback")) Module["registerBatteryEventCallback"] = (() => abort("'registerBatteryEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setCanvasElementSize")) Module["setCanvasElementSize"] = (() => abort("'setCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getCanvasElementSize")) Module["getCanvasElementSize"] = (() => abort("'getCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "demangle")) Module["demangle"] = (() => abort("'demangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "demangleAll")) Module["demangleAll"] = (() => abort("'demangleAll' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jsStackTrace")) Module["jsStackTrace"] = (() => abort("'jsStackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = (() => abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getEnvStrings")) Module["getEnvStrings"] = (() => abort("'getEnvStrings' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "checkWasiClock")) Module["checkWasiClock"] = (() => abort("'checkWasiClock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64")) Module["writeI53ToI64"] = (() => abort("'writeI53ToI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Clamped")) Module["writeI53ToI64Clamped"] = (() => abort("'writeI53ToI64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Signaling")) Module["writeI53ToI64Signaling"] = (() => abort("'writeI53ToI64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Clamped")) Module["writeI53ToU64Clamped"] = (() => abort("'writeI53ToU64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Signaling")) Module["writeI53ToU64Signaling"] = (() => abort("'writeI53ToU64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readI53FromI64")) Module["readI53FromI64"] = (() => abort("'readI53FromI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readI53FromU64")) Module["readI53FromU64"] = (() => abort("'readI53FromU64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertI32PairToI53")) Module["convertI32PairToI53"] = (() => abort("'convertI32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertU32PairToI53")) Module["convertU32PairToI53"] = (() => abort("'convertU32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setImmediateWrapped")) Module["setImmediateWrapped"] = (() => abort("'setImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "clearImmediateWrapped")) Module["clearImmediateWrapped"] = (() => abort("'clearImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "polyfillSetImmediate")) Module["polyfillSetImmediate"] = (() => abort("'polyfillSetImmediate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "uncaughtExceptionCount")) Module["uncaughtExceptionCount"] = (() => abort("'uncaughtExceptionCount' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exceptionLast")) Module["exceptionLast"] = (() => abort("'exceptionLast' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exceptionCaught")) Module["exceptionCaught"] = (() => abort("'exceptionCaught' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ExceptionInfo")) Module["ExceptionInfo"] = (() => abort("'ExceptionInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "CatchInfo")) Module["CatchInfo"] = (() => abort("'CatchInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exception_addRef")) Module["exception_addRef"] = (() => abort("'exception_addRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exception_decRef")) Module["exception_decRef"] = (() => abort("'exception_decRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Browser")) Module["Browser"] = (() => abort("'Browser' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "funcWrappers")) Module["funcWrappers"] = (() => abort("'funcWrappers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = (() => abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setMainLoop")) Module["setMainLoop"] = (() => abort("'setMainLoop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "wget")) Module["wget"] = (() => abort("'wget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS"] = FS; + +if (!Object.getOwnPropertyDescriptor(Module, "MEMFS")) Module["MEMFS"] = (() => abort("'MEMFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "TTY")) Module["TTY"] = (() => abort("'TTY' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PIPEFS")) Module["PIPEFS"] = (() => abort("'PIPEFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SOCKFS")) Module["SOCKFS"] = (() => abort("'SOCKFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "_setNetworkCallback")) Module["_setNetworkCallback"] = (() => abort("'_setNetworkCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "tempFixedLengthArray")) Module["tempFixedLengthArray"] = (() => abort("'tempFixedLengthArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "miniTempWebGLFloatBuffers")) Module["miniTempWebGLFloatBuffers"] = (() => abort("'miniTempWebGLFloatBuffers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "heapObjectForWebGLType")) Module["heapObjectForWebGLType"] = (() => abort("'heapObjectForWebGLType' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "heapAccessShiftForWebGLHeap")) Module["heapAccessShiftForWebGLHeap"] = (() => abort("'heapAccessShiftForWebGLHeap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GL")) Module["GL"] = (() => abort("'GL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGet")) Module["emscriptenWebGLGet"] = (() => abort("'emscriptenWebGLGet' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "computeUnpackAlignedImageSize")) Module["computeUnpackAlignedImageSize"] = (() => abort("'computeUnpackAlignedImageSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetTexPixelData")) Module["emscriptenWebGLGetTexPixelData"] = (() => abort("'emscriptenWebGLGetTexPixelData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetUniform")) Module["emscriptenWebGLGetUniform"] = (() => abort("'emscriptenWebGLGetUniform' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglGetUniformLocation")) Module["webglGetUniformLocation"] = (() => abort("'webglGetUniformLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglPrepareUniformLocationsBeforeFirstUse")) Module["webglPrepareUniformLocationsBeforeFirstUse"] = (() => abort("'webglPrepareUniformLocationsBeforeFirstUse' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglGetLeftBracePos")) Module["webglGetLeftBracePos"] = (() => abort("'webglGetLeftBracePos' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetVertexAttrib")) Module["emscriptenWebGLGetVertexAttrib"] = (() => abort("'emscriptenWebGLGetVertexAttrib' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeGLArray")) Module["writeGLArray"] = (() => abort("'writeGLArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "AL")) Module["AL"] = (() => abort("'AL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_unicode")) Module["SDL_unicode"] = (() => abort("'SDL_unicode' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_ttfContext")) Module["SDL_ttfContext"] = (() => abort("'SDL_ttfContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_audio")) Module["SDL_audio"] = (() => abort("'SDL_audio' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL")) Module["SDL"] = (() => abort("'SDL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_gfx")) Module["SDL_gfx"] = (() => abort("'SDL_gfx' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLUT")) Module["GLUT"] = (() => abort("'GLUT' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "EGL")) Module["EGL"] = (() => abort("'EGL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLFW_Window")) Module["GLFW_Window"] = (() => abort("'GLFW_Window' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLFW")) Module["GLFW"] = (() => abort("'GLFW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLEW")) Module["GLEW"] = (() => abort("'GLEW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "IDBStore")) Module["IDBStore"] = (() => abort("'IDBStore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runAndAbortIfError")) Module["runAndAbortIfError"] = (() => abort("'runAndAbortIfError' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "warnOnce")) Module["warnOnce"] = (() => abort("'warnOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackSave")) Module["stackSave"] = (() => abort("'stackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackRestore")) Module["stackRestore"] = (() => abort("'stackRestore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackAlloc")) Module["stackAlloc"] = (() => abort("'stackAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "AsciiToString")) Module["AsciiToString"] = (() => abort("'AsciiToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToAscii")) Module["stringToAscii"] = (() => abort("'stringToAscii' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF16ToString")) Module["UTF16ToString"] = (() => abort("'UTF16ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF16")) Module["stringToUTF16"] = (() => abort("'stringToUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF16")) Module["lengthBytesUTF16"] = (() => abort("'lengthBytesUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF32ToString")) Module["UTF32ToString"] = (() => abort("'UTF32ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF32")) Module["stringToUTF32"] = (() => abort("'stringToUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF32")) Module["lengthBytesUTF32"] = (() => abort("'lengthBytesUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8")) Module["allocateUTF8"] = (() => abort("'allocateUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8OnStack")) Module["allocateUTF8OnStack"] = (() => abort("'allocateUTF8OnStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["writeStackCookie"] = writeStackCookie; + +Module["checkStackCookie"] = checkStackCookie; + +if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_NORMAL")) Object.defineProperty(Module, "ALLOC_NORMAL", { + configurable: true, + get: function() { + abort("'ALLOC_NORMAL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)"); + } +}); + +if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_STACK")) Object.defineProperty(Module, "ALLOC_STACK", { + configurable: true, + get: function() { + abort("'ALLOC_STACK' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)"); + } +}); + +var calledRun; + +function ExitStatus(status) { + this.name = "ExitStatus"; + this.message = "Program terminated with exit(" + status + ")"; + this.status = status; +} + +var calledMain = false; + +// dependenciesFulfilled = function runCaller() { +// if (!calledRun) run(); +// if (!calledRun) dependenciesFulfilled = runCaller; +// }; + +function callMain(args) { + assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'); + assert(__ATPRERUN__.length == 0, "cannot call main when preRun functions remain to be called"); + var entryFunction = Module["_main"]; + args = args || []; + var argc = args.length + 1; + var argv = stackAlloc((argc + 1) * 4); + SAFE_HEAP_STORE((argv >> 2) * 4, allocateUTF8OnStack(thisProgram), 4); + for (var i = 1; i < argc; i++) { + SAFE_HEAP_STORE(((argv >> 2) + i) * 4, allocateUTF8OnStack(args[i - 1]), 4); + } + SAFE_HEAP_STORE(((argv >> 2) + argc) * 4, 0, 4); + try { + var ret = entryFunction(argc, argv); + exit(ret, true); + return ret; + } catch (e) { + return handleException(e); + } finally { + calledMain = true; + } +} + +function stackCheckInit() { + _emscripten_stack_init(); + writeStackCookie(); +} + +function run(args) { + shouldRunNow = true; + args = args || arguments_; + if (runDependencies > 0) { + return; + } + stackCheckInit(); + preRun(); + if (runDependencies > 0) { + return; + } + function doRun() { + if (calledRun) return; + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + FS.writeFile("./linker.ld", args[0]); + args.shift(); + FS.writeFile("./input.o", args[0]); + args.shift(); + for (let i = 0; i < libs_to_load.length; i++){ + FS.writeFile("./" + libs_to_load[i].name, libs_to_load[i].file); + } + preMain(); + readyPromiseResolve(Module); + if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"](); + if (shouldRunNow) callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(function() { + setTimeout(function() { + Module["setStatus"](""); + }, 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); +// FS.readFile("./output.elf"); +return elfile; +} + +Module["run"] = run; + +function exit(status, implicit) { + elfile = FS.readFile("./output.elf"); + console.log(elfile); + EXITSTATUS = status; + if (keepRuntimeAlive()) { + if (!implicit) { + var msg = "program exited (with status: " + status + "), but keepRuntimeAlive() is set (counter=" + runtimeKeepaliveCounter + ") due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)"; + readyPromiseReject(msg); + err(msg); + } + } else { + exitRuntime(); + } + procExit(status); +} + +function procExit(code) { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + if (Module["onExit"]) Module["onExit"](code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); +} + +if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } +} + +var shouldRunNow = false; + +if (Module["noInitialRun"]) shouldRunNow = false; + +// run(); + readyPromiseResolve(Module); + + return Module.ready +} +); +})(); +export default Module; \ No newline at end of file diff --git a/src/core/assembler/sailAssembler/web/wasm/ld-new.wasm b/src/core/assembler/sailAssembler/web/wasm/ld-new.wasm new file mode 100755 index 000000000..1270fd39a Binary files /dev/null and b/src/core/assembler/sailAssembler/web/wasm/ld-new.wasm differ diff --git a/src/core/assembler/sailAssembler/web/wasm/ld-new64.js b/src/core/assembler/sailAssembler/web/wasm/ld-new64.js new file mode 100644 index 000000000..963e1aa96 --- /dev/null +++ b/src/core/assembler/sailAssembler/web/wasm/ld-new64.js @@ -0,0 +1,5299 @@ +let elfile = null; +import { libs_to_load } from "../CNAssambler.mjs"; +var Module = (() => { + var _scriptName = import.meta.url; + + return ( +async function(moduleArg = {}) { + var moduleRtn; + +// include: shell.js +// The Module object: Our interface to the outside world. We import +// and export values on it. There are various ways Module can be used: +// 1. Not defined. We create it here +// 2. A function parameter, function(moduleArg) => Promise +// 3. pre-run appended it, var Module = {}; ..generated code.. +// 4. External script tag defines var Module. +// We need to check if Module already exists (e.g. case 3 above). +// Substitution will be replaced with actual code on later stage of the build, +// this way Closure Compiler will not mangle it (e.g. case 4. above). +// Note that if you want to run closure, and also to use Module +// after the generated code, you will need to define var Module = {}; +// before the code. Then that object will be used in the code, and you +// can continue to use Module afterwards as well. +var Module = moduleArg; + +// Set up the promise that indicates the Module is initialized +var readyPromiseResolve, readyPromiseReject; + +var readyPromise = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; +}); + +// Determine the runtime environment we are in. You can customize this by +// setting the ENVIRONMENT setting at compile time (see settings.js). +// Attempt to auto-detect the environment +var ENVIRONMENT_IS_WEB = typeof window == "object"; + +var ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope != "undefined"; + +// N.b. Electron.js environment is simultaneously a NODE-environment, but +// also a web environment. +var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string" && process.type != "renderer"; + +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +if (ENVIRONMENT_IS_NODE) { + // When building an ES module `require` is not normally available. + // We need to use `createRequire()` to construct the require()` function. + const {createRequire} = await import("module"); + /** @suppress{duplicate} */ var require = createRequire(import.meta.url); +} + +// --pre-jses are emitted after the Module integration code, so that they can +// refer to Module (if they choose; they can also define Module) +// Sometimes an existing Module object exists with properties +// meant to overwrite the default module functionality. Here +// we collect those properties and reapply _after_ we configure +// the current environment's defaults to avoid having to be so +// defensive during initialization. +var moduleOverrides = Object.assign({}, Module); + +var arguments_ = []; + +var thisProgram = "./this.program"; + +var quit_ = (status, toThrow) => { + throw toThrow; +}; + +// `/` should be present at the end if `scriptDirectory` is not empty +var scriptDirectory = ""; + +function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; +} + +// Hooks that are implemented differently in different runtime environments. +var readAsync, readBinary; + +if (ENVIRONMENT_IS_NODE) { + if (typeof process == "undefined" || !process.release || process.release.name !== "node") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + var nodeVersion = process.versions.node; + var numericVersion = nodeVersion.split(".").slice(0, 3); + numericVersion = (numericVersion[0] * 1e4) + (numericVersion[1] * 100) + (numericVersion[2].split("-")[0] * 1); + var minVersion = 23e4; + if (numericVersion < 23e4) { + throw new Error("This emscripten-generated code requires node v23.0.0 (detected v" + nodeVersion + ")"); + } + // These modules will usually be used on Node.js. Load them eagerly to avoid + // the complexity of lazy-loading. + var fs = require("fs"); + var nodePath = require("path"); + // EXPORT_ES6 + ENVIRONMENT_IS_NODE always requires use of import.meta.url, + // since there's no way getting the current absolute path of the module when + // support for that is not available. + if (!import.meta.url.startsWith("data:")) { + scriptDirectory = nodePath.dirname(require("url").fileURLToPath(import.meta.url)) + "/"; + } + // include: node_shell_read.js + readBinary = filename => { + // We need to re-wrap `file://` strings to URLs. + filename = isFileURI(filename) ? new URL(filename) : filename; + var ret = fs.readFileSync(filename); + assert(Buffer.isBuffer(ret)); + return ret; + }; + readAsync = async (filename, binary = true) => { + // See the comment in the `readBinary` function. + filename = isFileURI(filename) ? new URL(filename) : filename; + var ret = fs.readFileSync(filename, binary ? undefined : "utf8"); + assert(binary ? Buffer.isBuffer(ret) : typeof ret == "string"); + return ret; + }; + // end include: node_shell_read.js + if (!Module["thisProgram"] && process.argv.length > 1) { + thisProgram = process.argv[1].replace(/\\/g, "/"); + } + arguments_ = process.argv.slice(2); + // MODULARIZE will export the module in the proper place outside, we don't need to export here + quit_ = (status, toThrow) => { + process.exitCode = status; + throw toThrow; + }; +} else if (ENVIRONMENT_IS_SHELL) { + if ((typeof process == "object" && typeof require === "function") || typeof window == "object" || typeof WorkerGlobalScope != "undefined") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); +} else // Note that this includes Node.js workers when relevant (pthreads is enabled). +// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and +// ENVIRONMENT_IS_NODE. +if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + // Check worker, not web, since window could be polyfilled + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + // web + scriptDirectory = document.currentScript.src; + } + // When MODULARIZE, this JS may be executed later, after document.currentScript + // is gone, so we saved it, and we use it here instead of any other info. + if (_scriptName) { + scriptDirectory = _scriptName; + } + // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them. + // otherwise, slice off the final part of the url to find the script directory. + // if scriptDirectory does not contain a slash, lastIndexOf will return -1, + // and scriptDirectory will correctly be replaced with an empty string. + // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #), + // they are removed because they could contain a slash. + if (scriptDirectory.startsWith("blob:")) { + scriptDirectory = ""; + } else { + scriptDirectory = scriptDirectory.slice(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1); + } + if (!(typeof window == "object" || typeof WorkerGlobalScope != "undefined")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + { + // include: web_or_worker_shell_read.js + if (ENVIRONMENT_IS_WORKER) { + readBinary = url => { + var xhr = new XMLHttpRequest; + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(/** @type{!ArrayBuffer} */ (xhr.response)); + }; + } + readAsync = async url => { + // Fetch has some additional restrictions over XHR, like it can't be used on a file:// url. + // See https://github.com/github/fetch/pull/92#issuecomment-140665932 + // Cordova or Electron apps are typically loaded from a file:// url. + // So use XHR on webview if URL is a file URL. + if (isFileURI(url)) { + return new Promise((resolve, reject) => { + var xhr = new XMLHttpRequest; + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = () => { + if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { + // file URLs can return 0 + resolve(xhr.response); + return; + } + reject(xhr.status); + }; + xhr.onerror = reject; + xhr.send(null); + }); + } + var response = await fetch(url, { + credentials: "same-origin" + }); + if (response.ok) { + return response.arrayBuffer(); + } + throw new Error(response.status + " : " + response.url); + }; + } +} else { + throw new Error("environment detection error"); +} + +var out = Module["print"] || console.log.bind(console); + +var err = Module["printErr"] || console.error.bind(console); + +// Merge back in the overrides +Object.assign(Module, moduleOverrides); + +// Free the object hierarchy contained in the overrides, this lets the GC +// reclaim data used. +moduleOverrides = null; + +checkIncomingModuleAPI(); + +// Emit code to handle expected values on the Module object. This applies Module.x +// to the proper local x. This has two benefits: first, we only emit it if it is +// expected to arrive, and second, by using a local everywhere else that can be +// minified. +if (Module["arguments"]) arguments_ = Module["arguments"]; + +legacyModuleProp("arguments", "arguments_"); + +if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + +legacyModuleProp("thisProgram", "thisProgram"); + +// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message +// Assertions on removed incoming Module JS APIs. +assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["cdInitializerPrefixURL"] == "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["filePackagePrefixURL"] == "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["read"] == "undefined", "Module.read option was removed"); + +assert(typeof Module["readAsync"] == "undefined", "Module.readAsync option was removed (modify readAsync in JS)"); + +assert(typeof Module["readBinary"] == "undefined", "Module.readBinary option was removed (modify readBinary in JS)"); + +assert(typeof Module["setWindowTitle"] == "undefined", "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"); + +assert(typeof Module["TOTAL_MEMORY"] == "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"); + +legacyModuleProp("asm", "wasmExports"); + +legacyModuleProp("readAsync", "readAsync"); + +legacyModuleProp("readBinary", "readBinary"); + +legacyModuleProp("setWindowTitle", "setWindowTitle"); + +var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js"; + +var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js"; + +var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js"; + +var FETCHFS = "FETCHFS is no longer included by default; build with -lfetchfs.js"; + +var ICASEFS = "ICASEFS is no longer included by default; build with -licasefs.js"; + +var JSFILEFS = "JSFILEFS is no longer included by default; build with -ljsfilefs.js"; + +var OPFS = "OPFS is no longer included by default; build with -lopfs.js"; + +var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js"; + +assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable."); + +// end include: shell.js +// include: preamble.js +// === Preamble library stuff === +// Documentation for the public APIs defined in this file must be updated in: +// site/source/docs/api_reference/preamble.js.rst +// A prebuilt local version of the documentation is available at: +// site/build/text/docs/api_reference/preamble.js.txt +// You can also build docs locally as HTML or other formats in site/ +// An online HTML version (which may be of a different version of Emscripten) +// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html +var wasmBinary = Module["wasmBinary"]; + +legacyModuleProp("wasmBinary", "wasmBinary"); + +if (typeof WebAssembly != "object") { + err("no native wasm support detected"); +} + +// Wasm globals +var wasmMemory; + +//======================================== +// Runtime essentials +//======================================== +// whether we are quitting the application. no code should run after this. +// set in exit() and abort() +var ABORT = false; + +// set by exit() and abort(). Passed to 'onExit' handler. +// NOTE: This is also used as the process return code code in shell environments +// but only when noExitRuntime is false. +var EXITSTATUS; + +// In STRICT mode, we only define assert() when ASSERTIONS is set. i.e. we +// don't define it at all in release modes. This matches the behaviour of +// MINIMAL_RUNTIME. +// TODO(sbc): Make this the default even without STRICT enabled. +/** @type {function(*, string=)} */ function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } +} + +// We used to include malloc/free by default in the past. Show a helpful error in +// builds with assertions. +function _malloc() { + abort("malloc() called but not included in the build - add `_malloc` to EXPORTED_FUNCTIONS"); +} + +function _free() { + // Show a helpful error since we used to include free by default in the past. + abort("free() called but not included in the build - add `_free` to EXPORTED_FUNCTIONS"); +} + +// Memory management +var HEAP, /** @type {!Int8Array} */ HEAP8, /** @type {!Uint8Array} */ HEAPU8, /** @type {!Int16Array} */ HEAP16, /** @type {!Uint16Array} */ HEAPU16, /** @type {!Int32Array} */ HEAP32, /** @type {!Uint32Array} */ HEAPU32, /** @type {!Float32Array} */ HEAPF32, /* BigInt64Array type is not correctly defined in closure +/** not-@type {!BigInt64Array} */ HEAP64, /* BigUint64Array type is not correctly defined in closure +/** not-t@type {!BigUint64Array} */ HEAPU64, /** @type {!Float64Array} */ HEAPF64; + +var runtimeInitialized = false; + +var runtimeExited = false; + +/** + * Indicates whether filename is delivered via file protocol (as opposed to http/https) + * @noinline + */ var isFileURI = filename => filename.startsWith("file://"); + +// include: runtime_shared.js +// include: runtime_stack_check.js +// Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode. +function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + // If the stack ends at address zero we write our cookies 4 bytes into the + // stack. This prevents interference with SAFE_HEAP and ASAN which also + // monitor writes to address zero. + if (max == 0) { + max += 4; + } + // The stack grow downwards towards _emscripten_stack_get_end. + // We write cookies to the final two words in the stack and detect if they are + // ever overwritten. + SAFE_HEAP_STORE(((max) / 4) * 4, 34821223, 4); + SAFE_HEAP_STORE((((max) + (4)) / 4) * 4, 2310721022, 4); +} + +function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + // See writeStackCookie(). + if (max == 0) { + max += 4; + } + var cookie1 = SAFE_HEAP_LOAD(((max) / 4) * 4, 4, 1); + var cookie2 = SAFE_HEAP_LOAD((((max) + (4)) / 4) * 4, 4, 1); + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`); + } +} + +// end include: runtime_stack_check.js +// include: runtime_exceptions.js +// end include: runtime_exceptions.js +// include: runtime_debug.js +// Endianness check +(() => { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"; +})(); + +if (Module["ENVIRONMENT"]) { + throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)"); +} + +function legacyModuleProp(prop, newName, incoming = true) { + if (!Object.getOwnPropertyDescriptor(Module, prop)) { + Object.defineProperty(Module, prop, { + configurable: true, + get() { + let extra = incoming ? " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)" : ""; + abort(`\`Module.${prop}\` has been replaced by \`${newName}\`` + extra); + } + }); + } +} + +function ignoredModuleProp(prop) { + if (Object.getOwnPropertyDescriptor(Module, prop)) { + abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`); + } +} + +// forcing the filesystem exports a few things by default +function isExportedByForceFilesystem(name) { + return name === "FS_createPath" || name === "FS_createDataFile" || name === "FS_createPreloadedFile" || name === "FS_unlink" || name === "addRunDependency" || // The old FS has some functionality that WasmFS lacks. + name === "FS_createLazyFile" || name === "FS_createDevice" || name === "removeRunDependency"; +} + +/** + * Intercept access to a global symbol. This enables us to give informative + * warnings/errors when folks attempt to use symbols they did not include in + * their build, or no symbols that no longer exist. + */ function hookGlobalSymbolAccess(sym, func) { + if (typeof globalThis != "undefined" && !Object.getOwnPropertyDescriptor(globalThis, sym)) { + Object.defineProperty(globalThis, sym, { + configurable: true, + get() { + func(); + return undefined; + } + }); + } +} + +function missingGlobal(sym, msg) { + hookGlobalSymbolAccess(sym, () => { + warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`); + }); +} + +missingGlobal("buffer", "Please use HEAP8.buffer or wasmMemory.buffer"); + +missingGlobal("asm", "Please use wasmExports instead"); + +function missingLibrarySymbol(sym) { + hookGlobalSymbolAccess(sym, () => { + // Can't `abort()` here because it would break code that does runtime + // checks. e.g. `if (typeof SDL === 'undefined')`. + var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`; + // DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in + // library.js, which means $name for a JS name with no prefix, or name + // for a JS name like _name. + var librarySymbol = sym; + if (!librarySymbol.startsWith("_")) { + librarySymbol = "$" + sym; + } + msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`; + if (isExportedByForceFilesystem(sym)) { + msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + warnOnce(msg); + }); + // Any symbol that is not included from the JS library is also (by definition) + // not exported on the Module object. + unexportedRuntimeSymbol(sym); +} + +function unexportedRuntimeSymbol(sym) { + if (!Object.getOwnPropertyDescriptor(Module, sym)) { + Object.defineProperty(Module, sym, { + configurable: true, + get() { + var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`; + if (isExportedByForceFilesystem(sym)) { + msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + abort(msg); + } + }); + } +} + +// Used by XXXXX_DEBUG settings to output debug messages. +function dbg(...args) { + // TODO(sbc): Make this configurable somehow. Its not always convenient for + // logging to show up as warnings. + console.warn(...args); +} + +// end include: runtime_debug.js +// include: memoryprofiler.js +// end include: memoryprofiler.js +// include: runtime_safe_heap.js +/** @param {number|boolean=} isFloat */ function getSafeHeapType(bytes, isFloat) { + switch (bytes) { + case 1: + return "i8"; + + case 2: + return "i16"; + + case 4: + return isFloat ? "float" : "i32"; + + case 8: + return isFloat ? "double" : "i64"; + + default: + abort(`getSafeHeapType() invalid bytes=${bytes}`); + } +} + +/** @param {number|boolean=} isFloat */ function SAFE_HEAP_STORE(dest, value, bytes, isFloat) { + if (dest <= 0) abort(`segmentation fault storing ${bytes} bytes to address ${dest}`); + if (dest % bytes !== 0) abort(`alignment error storing to address ${dest}, which was expected to be aligned to a multiple of ${bytes}`); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk(0); + if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when storing ${bytes} bytes to address ${dest}. DYNAMICTOP=${brk}`); + if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`); + // sbrk-managed memory must be above the stack + if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`); + } + setValue_safe(dest, value, getSafeHeapType(bytes, isFloat)); + return value; +} + +function SAFE_HEAP_STORE_D(dest, value, bytes) { + return SAFE_HEAP_STORE(dest, value, bytes, true); +} + +/** @param {number|boolean=} isFloat */ function SAFE_HEAP_LOAD(dest, bytes, unsigned, isFloat) { + if (dest <= 0) abort(`segmentation fault loading ${bytes} bytes from address ${dest}`); + if (dest % bytes !== 0) abort(`alignment error loading from address ${dest}, which was expected to be aligned to a multiple of ${bytes}`); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk(0); + if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when loading ${bytes} bytes from address ${dest}. DYNAMICTOP=${brk}`); + if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`); + // sbrk-managed memory must be above the stack + if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`); + } + var type = getSafeHeapType(bytes, isFloat); + var ret = getValue_safe(dest, type); + if (unsigned) ret = unSign(ret, parseInt(type.slice(1), 10)); + return ret; +} + +function SAFE_HEAP_LOAD_D(dest, bytes, unsigned) { + return SAFE_HEAP_LOAD(dest, bytes, unsigned, true); +} + +function SAFE_FT_MASK(value, mask) { + var ret = value & mask; + if (ret !== value) { + abort(`Function table mask error: function pointer is ${value} which is masked by ${mask}, the likely cause of this is that the function pointer is being called by the wrong type.`); + } + return ret; +} + +function segfault() { + abort("segmentation fault"); +} + +function alignfault() { + abort("alignment fault"); +} + +// end include: runtime_safe_heap.js +function updateMemoryViews() { + var b = wasmMemory.buffer; + Module["HEAP8"] = HEAP8 = new Int8Array(b); + Module["HEAP16"] = HEAP16 = new Int16Array(b); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(b); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(b); + Module["HEAP32"] = HEAP32 = new Int32Array(b); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(b); + Module["HEAPF32"] = HEAPF32 = new Float32Array(b); + Module["HEAPF64"] = HEAPF64 = new Float64Array(b); + Module["HEAP64"] = HEAP64 = new BigInt64Array(b); + Module["HEAPU64"] = HEAPU64 = new BigUint64Array(b); +} + +// end include: runtime_shared.js +assert(!Module["STACK_SIZE"], "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"); + +assert(typeof Int32Array != "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, "JS engine does not provide full typed array support"); + +// If memory is defined in wasm, the user can't provide it, or set INITIAL_MEMORY +assert(!Module["wasmMemory"], "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"); + +assert(!Module["INITIAL_MEMORY"], "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically"); + +function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(onPreRuns); +} + +function initRuntime() { + assert(!runtimeInitialized); + runtimeInitialized = true; + checkStackCookie(); + if (!Module["noFSInit"] && !FS.initialized) FS.init(); + TTY.init(); + PIPEFS.root = FS.mount(PIPEFS, {}, null); + wasmExports["__wasm_call_ctors"](); + FS.ignorePermissions = false; +} + +function preMain() { + checkStackCookie(); +} + +function exitRuntime() { + assert(!runtimeExited); + checkStackCookie(); + ___funcs_on_exit(); + // Native atexit() functions + FS.quit(); + TTY.shutdown(); + runtimeExited = true; +} + +function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(onPostRuns); +} + +// A counter of dependencies for calling run(). If we need to +// do asynchronous work before running, increment this and +// decrement it. Incrementing must happen in a place like +// Module.preRun (used by emcc to add file preloading). +// Note that you can add dependencies in preRun, even though +// it happens right before run - run will be postponed until +// the dependencies are met. +var runDependencies = 0; + +var dependenciesFulfilled = null; + +// overridden to take different actions when all run dependencies are fulfilled +var runDependencyTracking = {}; + +var runDependencyWatcher = null; + +function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } +} + +function addRunDependency(id) { + runDependencies++; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if (runDependencyWatcher === null && typeof setInterval != "undefined") { + // Check for missing dependencies every few seconds + runDependencyWatcher = setInterval(() => { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err(`dependency: ${dep}`); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } +} + +function removeRunDependency(id) { + runDependencies--; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } +} + +/** @param {string|number=} what */ function abort(what) { + Module["onAbort"]?.(what); + what = "Aborted(" + what + ")"; + // TODO(sbc): Should we remove printing and leave it up to whoever + // catches the exception? + err(what); + ABORT = true; + // Use a wasm runtime error, because a JS error might be seen as a foreign + // exception, which means we'd run destructors on it. We need the error to + // simply make the program stop. + // FIXME This approach does not work in Wasm EH because it currently does not assume + // all RuntimeErrors are from traps; it decides whether a RuntimeError is from + // a trap or not based on a hidden field within the object. So at the moment + // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that + // allows this in the wasm spec. + // Suppress closure compiler warning here. Closure compiler's builtin extern + // definition for WebAssembly.RuntimeError claims it takes no arguments even + // though it can. + // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed. + /** @suppress {checkTypes} */ var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + // Throw the error whether or not MODULARIZE is set because abort is used + // in code paths apart from instantiation where an exception is expected + // to be thrown when abort is called. + throw e; +} + +function createExportWrapper(name, nargs) { + return (...args) => { + assert(runtimeInitialized, `native function \`${name}\` called before runtime initialization`); + assert(!runtimeExited, `native function \`${name}\` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)`); + var f = wasmExports[name]; + assert(f, `exported native function \`${name}\` not found`); + // Only assert for too many arguments. Too few can be valid since the missing arguments will be zero filled. + assert(args.length <= nargs, `native function \`${name}\` called with ${args.length} args but expects ${nargs}`); + return f(...args); + }; +} + +var wasmBinaryFile; + +function findWasmBinary() { + if (Module["locateFile"]) { + return locateFile("ld-new64.wasm"); + } + // Use bundler-friendly `new URL(..., import.meta.url)` pattern; works in browsers too. + return new URL("ld-new64.wasm", import.meta.url).href; +} + +function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw "both async and sync fetching of the wasm failed"; +} + +async function getWasmBinary(binaryFile) { + // If we don't have the binary yet, load it asynchronously using readAsync. + if (!wasmBinary) { + // Fetch the binary using readAsync + try { + var response = await readAsync(binaryFile); + return new Uint8Array(response); + } catch {} + } + // Otherwise, getBinarySync should be able to get it synchronously + return getBinarySync(binaryFile); +} + +async function instantiateArrayBuffer(binaryFile, imports) { + try { + var binary = await getWasmBinary(binaryFile); + var instance = await WebAssembly.instantiate(binary, imports); + return instance; + } catch (reason) { + err(`failed to asynchronously prepare wasm: ${reason}`); + // Warn on some common problems. + if (isFileURI(wasmBinaryFile)) { + err(`warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`); + } + abort(reason); + } +} + +async function instantiateAsync(binary, binaryFile, imports) { + if (!binary && typeof WebAssembly.instantiateStreaming == "function" && !isFileURI(binaryFile) && !ENVIRONMENT_IS_NODE) { + try { + var response = fetch(binaryFile, { + credentials: "same-origin" + }); + var instantiationResult = await WebAssembly.instantiateStreaming(response, imports); + return instantiationResult; + } catch (reason) { + // We expect the most common failure cause to be a bad MIME type for the binary, + // in which case falling back to ArrayBuffer instantiation should work. + err(`wasm streaming compile failed: ${reason}`); + err("falling back to ArrayBuffer instantiation"); + } + } + return instantiateArrayBuffer(binaryFile, imports); +} + +function getWasmImports() { + // prepare imports + return { + "env": wasmImports, + "wasi_snapshot_preview1": wasmImports + }; +} + +// Create the wasm instance. +// Receives the wasm imports, returns the exports. +async function createWasm() { + // Load the wasm module and create an instance of using native support in the JS engine. + // handle a generated wasm instance, receiving its exports and + // performing other necessary setup + /** @param {WebAssembly.Module=} module*/ function receiveInstance(instance, module) { + wasmExports = instance.exports; + wasmExports = applySignatureConversions(wasmExports); + wasmMemory = wasmExports["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateMemoryViews(); + removeRunDependency("wasm-instantiate"); + return wasmExports; + } + // wait for the pthread pool (if any) + addRunDependency("wasm-instantiate"); + // Prefer streaming instantiation if available. + // Async compilation can be confusing when an error on the page overwrites Module + // (for example, if the order of elements is wrong, and the one defining Module is + // later), so we save Module and check it later. + var trueModule = Module; + function receiveInstantiationResult(result) { + // 'result' is a ResultObject object which has both the module and instance. + // receiveInstance() will swap in the exports (to Module.asm) so they can be called + assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"); + trueModule = null; + // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line. + // When the regression is fixed, can restore the above PTHREADS-enabled path. + return receiveInstance(result["instance"]); + } + var info = getWasmImports(); + // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback + // to manually instantiate the Wasm module themselves. This allows pages to + // run the instantiation parallel to any other async startup actions they are + // performing. + // Also pthreads and wasm workers initialize the wasm instance through this + // path. + if (Module["instantiateWasm"]) { + return new Promise((resolve, reject) => { + try { + Module["instantiateWasm"](info, (mod, inst) => { + receiveInstance(mod, inst); + resolve(mod.exports); + }); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + reject(e); + } + }); + } + wasmBinaryFile ??= findWasmBinary(); + try { + var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info); + var exports = receiveInstantiationResult(result); + return exports; + } catch (e) { + // If instantiation fails, reject the module ready promise. + readyPromiseReject(e); + return Promise.reject(e); + } +} + +// === Body === +// end include: preamble.js +class ExitStatus { + name="ExitStatus"; + constructor(status) { + this.message = `Program terminated with exit(${status})`; + this.status = status; + } +} + +var callRuntimeCallbacks = callbacks => { + while (callbacks.length > 0) { + // Pass the module as the first argument. + callbacks.shift()(Module); + } +}; + +var onPostRuns = []; + +var addOnPostRun = cb => onPostRuns.unshift(cb); + +var onPreRuns = []; + +var addOnPreRun = cb => onPreRuns.unshift(cb); + +/** + * @param {number} ptr + * @param {string} type + */ function getValue(ptr, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + return SAFE_HEAP_LOAD(ptr, 1, 0); + + case "i8": + return SAFE_HEAP_LOAD(ptr, 1, 0); + + case "i16": + return SAFE_HEAP_LOAD(((ptr) / 2) * 2, 2, 0); + + case "i32": + return SAFE_HEAP_LOAD(((ptr) / 4) * 4, 4, 0); + + case "i64": + return HEAP64[((ptr) / 8)]; + + case "float": + return SAFE_HEAP_LOAD_D(((ptr) / 4) * 4, 4, 0); + + case "double": + return SAFE_HEAP_LOAD_D(((ptr) / 8) * 8, 8, 0); + + case "*": + return Number(HEAPU64[((ptr) / 8)]); + + default: + abort(`invalid type for getValue: ${type}`); + } +} + +function getValue_safe(ptr, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + return HEAP8[ptr]; + + case "i8": + return HEAP8[ptr]; + + case "i16": + return HEAP16[((ptr) / 2)]; + + case "i32": + return HEAP32[((ptr) / 4)]; + + case "i64": + return HEAP64[((ptr) / 8)]; + + case "float": + return HEAPF32[((ptr) / 4)]; + + case "double": + return HEAPF64[((ptr) / 8)]; + + case "*": + return Number(HEAPU64[((ptr) / 8)]); + + default: + abort(`invalid type for getValue: ${type}`); + } +} + +var noExitRuntime = Module["noExitRuntime"] || false; + +var ptrToString = ptr => { + assert(typeof ptr === "number"); + return "0x" + ptr.toString(16).padStart(8, "0"); +}; + +/** + * @param {number} ptr + * @param {number} value + * @param {string} type + */ function setValue(ptr, value, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + SAFE_HEAP_STORE(ptr, value, 1); + break; + + case "i8": + SAFE_HEAP_STORE(ptr, value, 1); + break; + + case "i16": + SAFE_HEAP_STORE(((ptr) / 2) * 2, value, 2); + break; + + case "i32": + SAFE_HEAP_STORE(((ptr) / 4) * 4, value, 4); + break; + + case "i64": + HEAP64[((ptr) / 8)] = BigInt(value); + break; + + case "float": + SAFE_HEAP_STORE_D(((ptr) / 4) * 4, value, 4); + break; + + case "double": + SAFE_HEAP_STORE_D(((ptr) / 8) * 8, value, 8); + break; + + case "*": + HEAPU64[((ptr) / 8)] = BigInt(value); + break; + + default: + abort(`invalid type for setValue: ${type}`); + } +} + +function setValue_safe(ptr, value, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + HEAP8[ptr] = value; + break; + + case "i8": + HEAP8[ptr] = value; + break; + + case "i16": + HEAP16[((ptr) / 2)] = value; + break; + + case "i32": + HEAP32[((ptr) / 4)] = value; + break; + + case "i64": + HEAP64[((ptr) / 8)] = BigInt(value); + break; + + case "float": + HEAPF32[((ptr) / 4)] = value; + break; + + case "double": + HEAPF64[((ptr) / 8)] = value; + break; + + case "*": + HEAPU64[((ptr) / 8)] = BigInt(value); + break; + + default: + abort(`invalid type for setValue: ${type}`); + } +} + +var stackRestore = val => __emscripten_stack_restore(val); + +var stackSave = () => _emscripten_stack_get_current(); + +var unSign = (value, bits) => { + if (value >= 0) { + return value; + } + // Need some trickery, since if bits == 32, we are right at the limit of the + // bits JS uses in bitshifts + return bits <= 32 ? 2 * Math.abs(1 << (bits - 1)) + value : Math.pow(2, bits) + value; +}; + +var warnOnce = text => { + warnOnce.shown ||= {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + if (ENVIRONMENT_IS_NODE) text = "warning: " + text; + err(text); + } +}; + +var INT53_MAX = 9007199254740992; + +var INT53_MIN = -9007199254740992; + +var bigintToI53Checked = num => (num < INT53_MIN || num > INT53_MAX) ? NaN : Number(num); + +var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder : undefined; + +/** + * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given + * array that contains uint8 values, returns a copy of that string as a + * Javascript String object. + * heapOrArray is either a regular array, or a JavaScript typed array view. + * @param {number=} idx + * @param {number=} maxBytesToRead + * @return {string} + */ var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + // TextDecoder needs to know the byte length in advance, it doesn't stop on + // null terminator by itself. Also, use the length info to avoid running tiny + // strings through TextDecoder, since .subarray() allocates garbage. + // (As a tiny code save trick, compare endPtr against endIdx using a negation, + // so that undefined/NaN means Infinity) + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ""; + // If building with TextDecoder, we have already computed the string length + // above, so test loop end condition against that + while (idx < endPtr) { + // For UTF8 byte structure, see: + // http://en.wikipedia.org/wiki/UTF-8#Description + // https://www.ietf.org/rfc/rfc2279.txt + // https://tools.ietf.org/html/rfc3629 + var u0 = heapOrArray[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte " + ptrToString(u0) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"); + u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63); + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } + } + return str; +}; + +/** + * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the + * emscripten HEAP, returns a copy of that string as a Javascript String object. + * + * @param {number} ptr + * @param {number=} maxBytesToRead - An optional length that specifies the + * maximum number of bytes to read. You can omit this parameter to scan the + * string until the first 0 byte. If maxBytesToRead is passed, and the string + * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the + * string will cut short at that byte index (i.e. maxBytesToRead will not + * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing + * frequent uses of UTF8ToString() with and without maxBytesToRead may throw + * JS JIT optimizations off, so it is worth to consider consistently using one + * @return {string} + */ var UTF8ToString = (ptr, maxBytesToRead) => { + assert(typeof ptr == "number", `UTF8ToString expects a number (got ${typeof ptr})`); + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; +}; + +function ___assert_fail(condition, filename, line, func) { + condition = bigintToI53Checked(condition); + filename = bigintToI53Checked(filename); + func = bigintToI53Checked(func); + return abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [ filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function" ]); +} + +var PATH = { + isAbs: path => path.charAt(0) === "/", + splitPath: filename => { + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (;up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: path => { + var isAbsolute = PATH.isAbs(path), trailingSlash = path.slice(-1) === "/"; + // Normalize the path + path = PATH.normalizeArray(path.split("/").filter(p => !!p), !isAbsolute).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: path => { + var result = PATH.splitPath(path), root = result[0], dir = result[1]; + if (!root && !dir) { + // No dirname whatsoever + return "."; + } + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.slice(0, -1); + } + return root + dir; + }, + basename: path => path && path.match(/([^\/]+|\/)\/*$/)[1], + join: (...paths) => PATH.normalize(paths.join("/")), + join2: (l, r) => PATH.normalize(l + "/" + r) +}; + +var initRandomFill = () => view => crypto.getRandomValues(view); + +var randomFill = view => { + // Lazily init on the first invocation. + (randomFill = initRandomFill())(view); +}; + +var PATH_FS = { + resolve: (...args) => { + var resolvedPath = "", resolvedAbsolute = false; + for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? args[i] : FS.cwd(); + // Skip empty and invalid entries + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter(p => !!p), !resolvedAbsolute).join("/"); + return ((resolvedAbsolute ? "/" : "") + resolvedPath) || "."; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).slice(1); + to = PATH_FS.resolve(to).slice(1); + function trim(arr) { + var start = 0; + for (;start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (;end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + } +}; + +var FS_stdin_getChar_buffer = []; + +var lengthBytesUTF8 = str => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + var c = str.charCodeAt(i); + // possibly a lead surrogate + if (c <= 127) { + len++; + } else if (c <= 2047) { + len += 2; + } else if (c >= 55296 && c <= 57343) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; +}; + +var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + assert(typeof str === "string", `stringToUTF8Array expects a string (got ${typeof str})`); + // Parameter maxBytesToWrite is not optional. Negative values, 0, null, + // undefined and false each don't write out any bytes. + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + // -1 for string null terminator. + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description + // and https://www.ietf.org/rfc/rfc2279.txt + // and https://tools.ietf.org/html/rfc3629 + var u = str.charCodeAt(i); + // possibly a lead surrogate + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = 65536 + ((u & 1023) << 10) | (u1 & 1023); + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | (u >> 6); + heap[outIdx++] = 128 | (u & 63); + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | (u >> 12); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) warnOnce("Invalid Unicode code point " + ptrToString(u) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."); + heap[outIdx++] = 240 | (u >> 18); + heap[outIdx++] = 128 | ((u >> 12) & 63); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } + } + // Null-terminate the pointer to the buffer. + heap[outIdx] = 0; + return outIdx - startIdx; +}; + +/** @type {function(string, boolean=, number=)} */ var intArrayFromString = (stringy, dontAddNull, length) => { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; +}; + +var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + // we will read data by chunks of BUFSIZE + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + // For some reason we must suppress a closure warning here, even though + // fd definitely exists on process.stdin, and is even the proper way to + // get the fd of stdin, + // https://github.com/nodejs/help/issues/2136#issuecomment-523649904 + // This started to happen after moving this logic out of library_tty.js, + // so it is related to the surrounding code in some unclear manner. + /** @suppress {missingProperties} */ var fd = process.stdin.fd; + try { + bytesRead = fs.readSync(fd, buf, 0, BUFSIZE); + } catch (e) { + // Cross-platform differences: on Windows, reading EOF throws an + // exception, but on other OSes, reading EOF returns 0. Uniformize + // behavior by treating the EOF exception to return 0. + if (e.toString().includes("EOF")) bytesRead = 0; else throw e; + } + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString("utf-8"); + } + } else if (typeof window != "undefined" && typeof window.prompt == "function") { + // Browser. + result = window.prompt("Input: "); + // returns null on cancel + if (result !== null) { + result += "\n"; + } + } else {} + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); +}; + +var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { + input: [], + output: [], + ops + }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + // flush any pending line data + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + } + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + // typical setting + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ 3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + // currently just ignore + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [ 24, 80 ]; + } + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } + } + } +}; + +var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); +}; + +var alignMemory = (size, alignment) => { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; +}; + +var mmapAlloc = size => { + abort("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported"); +}; + +var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, "/", 16895, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + // no supported + throw new FS.ErrnoError(63); + } + MEMFS.ops_table ||= { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink + }, + stream: { + llseek: MEMFS.stream_ops.llseek + } + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync + } + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink + }, + stream: {} + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: FS.chrdev_stream_ops + } + }; + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + // The actual number of bytes used in the typed array, as opposed to contents.length which gives the whole capacity. + // When the byte data of the file is populated, this will point to either a typed array, or a normal JS array. Typed arrays are preferred + // for performance, and used by default. However, typed arrays are not resizable like normal JS arrays are, so there is a small disk size + // penalty involved for appending file writes that continuously grow a file similar to std::vector capacity vs used -scheme. + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.atime = node.mtime = node.ctime = Date.now(); + // add the new node to the parent + if (parent) { + parent.contents[name] = node; + parent.atime = parent.mtime = parent.ctime = node.atime; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes); + // Make sure to not return excess unused bytes. + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + // No need to expand, the storage was already large enough. + // Don't expand strictly to the given requested limit if it's only a very small increase, but instead geometrically grow capacity. + // For small filesizes (<1MB), perform size*2 geometric increase, but for large sizes, do a much more conservative size*1.125 increase to + // avoid overshooting the allocation cap by a very large margin. + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max(newCapacity, (prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125)) >>> 0); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + // At minimum allocate 256b for each file when expanding. + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + // Allocate new storage. + if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + // Fully decommit when requesting a resize to zero. + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + // Allocate new storage. + if (oldContents) { + node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes))); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + // device numbers reuse inode numbers. + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.atime); + attr.mtime = new Date(node.mtime); + attr.ctime = new Date(node.ctime); + // NOTE: In our implementation, st_blocks = Math.ceil(st_size/st_blksize), + // but this is not required by the standard. + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + for (const key of [ "mode", "atime", "mtime", "ctime" ]) { + if (attr[key] != null) { + node[key] = attr[key]; + } + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw new FS.ErrnoError(44); + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + if (FS.isDir(old_node.mode)) { + // if we're overwriting a directory at new_name, make sure it's empty. + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + FS.hashRemoveNode(new_node); + } + // do the internal rewiring + delete old_node.parent.contents[old_node.name]; + new_dir.contents[new_name] = old_node; + old_node.name = new_name; + new_dir.ctime = new_dir.mtime = old_node.parent.ctime = old_node.parent.mtime = Date.now(); + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + readdir(node) { + return [ ".", "..", ...Object.keys(node.contents) ]; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + } + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + // non-trivial, and typed array + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + // The data buffer should be a typed array view + assert(!(buffer instanceof ArrayBuffer)); + // If the buffer is located in main memory (HEAP), and if + // memory can grow, we can't hold on to references of the + // memory buffer, as they may get invalidated. That means we + // need to do copy its contents. + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.mtime = node.ctime = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + // This write is from a typed array to a typed array? + if (canOwn) { + assert(position === 0, "canOwn must imply no weird position inside the file"); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data. + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + // Writing to an already allocated and used subrange of the file? + node.contents.set(buffer.subarray(offset, offset + length), position); + return length; + } + } + // Appending to an existing file and we need to reallocate, or source data did not come as a typed array. + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + // Use typed array write which is available. + node.contents.set(buffer.subarray(offset, offset + length), position); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + // Only make a new copy when MAP_PRIVATE is specified. + if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) { + // We can't emulate MAP_SHARED when the file is not backed by the + // buffer we're mapping to (e.g. the HEAP buffer). + allocated = false; + ptr = contents.byteOffset; + } else { + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + if (contents) { + // Try to avoid unnecessary slices. + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call(contents, position, position + length); + } + } + HEAP8.set(contents, ptr); + } + } + return { + ptr, + allocated + }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + // should we check if bytesWritten and length are the same? + return 0; + } + } +}; + +var asyncLoad = async url => { + var arrayBuffer = await readAsync(url); + assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`); + return new Uint8Array(arrayBuffer); +}; + +var FS_createDataFile = (parent, name, fileData, canRead, canWrite, canOwn) => { + FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); +}; + +var preloadPlugins = Module["preloadPlugins"] || []; + +var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + // Ensure plugins are ready. + if (typeof Browser != "undefined") Browser.init(); + var handled = false; + preloadPlugins.forEach(plugin => { + if (handled) return; + if (plugin["canHandle"](fullname)) { + plugin["handle"](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; +}; + +var FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => { + // TODO we should allow people to just pass in a complete filename instead + // of parent and name being that we just join them anyways + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + // might have several active requests for the same fullname + function processData(byteArray) { + function finish(byteArray) { + preFinish?.(); + if (!dontCreateFile) { + FS_createDataFile(parent, name, byteArray, canRead, canWrite, canOwn); + } + onload?.(); + removeRunDependency(dep); + } + if (FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + onerror?.(); + removeRunDependency(dep); + })) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url).then(processData, onerror); + } else { + processData(url); + } +}; + +var FS_modeStringToFlags = str => { + var flagModes = { + "r": 0, + "r+": 2, + "w": 512 | 64 | 1, + "w+": 512 | 64 | 2, + "a": 1024 | 64 | 1, + "a+": 1024 | 64 | 2 + }; + var flags = flagModes[str]; + if (typeof flags == "undefined") { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; +}; + +var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; +}; + +var strError = errno => UTF8ToString(_strerror(errno)); + +var ERRNO_CODES = { + "EPERM": 63, + "ENOENT": 44, + "ESRCH": 71, + "EINTR": 27, + "EIO": 29, + "ENXIO": 60, + "E2BIG": 1, + "ENOEXEC": 45, + "EBADF": 8, + "ECHILD": 12, + "EAGAIN": 6, + "EWOULDBLOCK": 6, + "ENOMEM": 48, + "EACCES": 2, + "EFAULT": 21, + "ENOTBLK": 105, + "EBUSY": 10, + "EEXIST": 20, + "EXDEV": 75, + "ENODEV": 43, + "ENOTDIR": 54, + "EISDIR": 31, + "EINVAL": 28, + "ENFILE": 41, + "EMFILE": 33, + "ENOTTY": 59, + "ETXTBSY": 74, + "EFBIG": 22, + "ENOSPC": 51, + "ESPIPE": 70, + "EROFS": 69, + "EMLINK": 34, + "EPIPE": 64, + "EDOM": 18, + "ERANGE": 68, + "ENOMSG": 49, + "EIDRM": 24, + "ECHRNG": 106, + "EL2NSYNC": 156, + "EL3HLT": 107, + "EL3RST": 108, + "ELNRNG": 109, + "EUNATCH": 110, + "ENOCSI": 111, + "EL2HLT": 112, + "EDEADLK": 16, + "ENOLCK": 46, + "EBADE": 113, + "EBADR": 114, + "EXFULL": 115, + "ENOANO": 104, + "EBADRQC": 103, + "EBADSLT": 102, + "EDEADLOCK": 16, + "EBFONT": 101, + "ENOSTR": 100, + "ENODATA": 116, + "ETIME": 117, + "ENOSR": 118, + "ENONET": 119, + "ENOPKG": 120, + "EREMOTE": 121, + "ENOLINK": 47, + "EADV": 122, + "ESRMNT": 123, + "ECOMM": 124, + "EPROTO": 65, + "EMULTIHOP": 36, + "EDOTDOT": 125, + "EBADMSG": 9, + "ENOTUNIQ": 126, + "EBADFD": 127, + "EREMCHG": 128, + "ELIBACC": 129, + "ELIBBAD": 130, + "ELIBSCN": 131, + "ELIBMAX": 132, + "ELIBEXEC": 133, + "ENOSYS": 52, + "ENOTEMPTY": 55, + "ENAMETOOLONG": 37, + "ELOOP": 32, + "EOPNOTSUPP": 138, + "EPFNOSUPPORT": 139, + "ECONNRESET": 15, + "ENOBUFS": 42, + "EAFNOSUPPORT": 5, + "EPROTOTYPE": 67, + "ENOTSOCK": 57, + "ENOPROTOOPT": 50, + "ESHUTDOWN": 140, + "ECONNREFUSED": 14, + "EADDRINUSE": 3, + "ECONNABORTED": 13, + "ENETUNREACH": 40, + "ENETDOWN": 38, + "ETIMEDOUT": 73, + "EHOSTDOWN": 142, + "EHOSTUNREACH": 23, + "EINPROGRESS": 26, + "EALREADY": 7, + "EDESTADDRREQ": 17, + "EMSGSIZE": 35, + "EPROTONOSUPPORT": 66, + "ESOCKTNOSUPPORT": 137, + "EADDRNOTAVAIL": 4, + "ENETRESET": 39, + "EISCONN": 30, + "ENOTCONN": 53, + "ETOOMANYREFS": 141, + "EUSERS": 136, + "EDQUOT": 19, + "ESTALE": 72, + "ENOTSUP": 138, + "ENOMEDIUM": 148, + "EILSEQ": 25, + "EOVERFLOW": 61, + "ECANCELED": 11, + "ENOTRECOVERABLE": 56, + "EOWNERDEAD": 62, + "ESTRPIPE": 135 +}; + +var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: class extends Error { + name="ErrnoError"; + // We set the `name` property to be able to identify `FS.ErrnoError` + // - the `name` is a standard ECMA-262 property of error objects. Kind of good to have it anyway. + // - when using PROXYFS, an error can come from an underlying FS + // as different FS objects have their own FS.ErrnoError each, + // the test `err instanceof FS.ErrnoError` won't detect an error coming from another filesystem, causing bugs. + // we'll use the reliable test `err.name == "ErrnoError"` instead + constructor(errno) { + super(runtimeInitialized ? strError(errno) : ""); + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + } + }, + filesystems: null, + syncFSRequests: 0, + readFiles: {}, + FSStream: class { + shared={}; + get object() { + return this.node; + } + set object(val) { + this.node = val; + } + get isRead() { + return (this.flags & 2097155) !== 1; + } + get isWrite() { + return (this.flags & 2097155) !== 0; + } + get isAppend() { + return (this.flags & 1024); + } + get flags() { + return this.shared.flags; + } + set flags(val) { + this.shared.flags = val; + } + get position() { + return this.shared.position; + } + set position(val) { + this.shared.position = val; + } + }, + FSNode: class { + node_ops={}; + stream_ops={}; + readMode=292 | 73; + writeMode=146; + mounted=null; + constructor(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.rdev = rdev; + this.atime = this.mtime = this.ctime = Date.now(); + } + get read() { + return (this.mode & this.readMode) === this.readMode; + } + set read(val) { + val ? this.mode |= this.readMode : this.mode &= ~this.readMode; + } + get write() { + return (this.mode & this.writeMode) === this.writeMode; + } + set write(val) { + val ? this.mode |= this.writeMode : this.mode &= ~this.writeMode; + } + get isFolder() { + return FS.isDir(this.mode); + } + get isDevice() { + return FS.isChrdev(this.mode); + } + }, + lookupPath(path, opts = {}) { + if (!path) { + throw new FS.ErrnoError(44); + } + opts.follow_mount ??= true; + if (!PATH.isAbs(path)) { + path = FS.cwd() + "/" + path; + } + // limit max consecutive symlinks to 40 (SYMLOOP_MAX). + linkloop: for (var nlinks = 0; nlinks < 40; nlinks++) { + // split the absolute path + var parts = path.split("/").filter(p => !!p); + // start at the root + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = (i === parts.length - 1); + if (islast && opts.parent) { + // stop resolving + break; + } + if (parts[i] === ".") { + continue; + } + if (parts[i] === "..") { + current_path = PATH.dirname(current_path); + current = current.parent; + continue; + } + current_path = PATH.join2(current_path, parts[i]); + try { + current = FS.lookupNode(current, parts[i]); + } catch (e) { + // if noent_okay is true, suppress a ENOENT in the last component + // and return an object with an undefined node. This is needed for + // resolving symlinks in the path when creating a file. + if ((e?.errno === 44) && islast && opts.noent_okay) { + return { + path: current_path + }; + } + throw e; + } + // jump to the mount's root node if this is a mountpoint + if (FS.isMountpoint(current) && (!islast || opts.follow_mount)) { + current = current.mounted.root; + } + // by default, lookupPath will not follow a symlink if it is the final path component. + // setting opts.follow = true will override this behavior. + if (FS.isLink(current.mode) && (!islast || opts.follow)) { + if (!current.node_ops.readlink) { + throw new FS.ErrnoError(52); + } + var link = current.node_ops.readlink(current); + if (!PATH.isAbs(link)) { + link = PATH.dirname(current_path) + "/" + link; + } + path = link + "/" + parts.slice(i + 1).join("/"); + continue linkloop; + } + } + return { + path: current_path, + node: current + }; + } + throw new FS.ErrnoError(32); + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" ? `${mount}/${path}` : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + // if we failed to find it in the cache, call into the VFS + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = [ "r", "w", "rw" ][flag & 3]; + if ((flag & 512)) { + perms += "w"; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + // return 0 if any user, group or owner bits are set. + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + if (!FS.isDir(dir.mode)) return 54; + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + if (!FS.isDir(dir.mode)) { + return 54; + } + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || (flags & (512 | 64))) { + // TODO: check for O_SEARCH? (== search for dir only) + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + checkOpExists(op, err) { + if (!op) { + throw new FS.ErrnoError(err); + } + return op; + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: fd => FS.streams[fd], + createStream(stream, fd = -1) { + assert(fd >= -1); + // clone it, so we can return an instance of FSStream + stream = Object.assign(new FS.FSStream, stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + dupStream(origStream, fd = -1) { + var stream = FS.createStream(origStream, fd); + stream.stream_ops?.dup?.(stream); + return stream; + }, + doSetAttr(stream, node, attr) { + var setattr = stream?.stream_ops.setattr; + var arg = setattr ? stream : node; + setattr ??= node.node_ops.setattr; + FS.checkOpExists(setattr, 63); + setattr(arg, attr); + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + // override node's stream ops with the device's + stream.stream_ops = device.stream_ops; + // forward the open call + stream.stream_ops.open?.(stream); + }, + llseek() { + throw new FS.ErrnoError(70); + } + }, + major: dev => ((dev) >> 8), + minor: dev => ((dev) & 255), + makedev: (ma, mi) => ((ma) << 8 | (mi)), + registerDevice(dev, ops) { + FS.devices[dev] = { + stream_ops: ops + }; + }, + getDevice: dev => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [ mount ]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push(...m.mounts); + } + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + // sync all mounts + mounts.forEach(mount => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + if (typeof type == "string") { + // The filesystem was not included, and instead we have an error + // message stored in the variable. + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + mountpoint = lookup.path; + // use the absolute path + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type, + opts, + mountpoint, + mounts: [] + }; + // create a root node for the fs + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + // set as a mountpoint + node.mounted = mount; + // add the new mount to the current mount's children + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + // destroy the nodes for this mount, and all its child mounts + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach(hash => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + // no longer a mountpoint + node.mounted = null; + // remove this mount from the child mounts + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name) { + throw new FS.ErrnoError(28); + } + if (name === "." || name === "..") { + throw new FS.ErrnoError(20); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + statfs(path) { + return FS.statfsNode(FS.lookupPath(path, { + follow: true + }).node); + }, + statfsStream(stream) { + // We keep a separate statfsStream function because noderawfs overrides + // it. In noderawfs, stream.node is sometimes null. Instead, we need to + // look at stream.path. + return FS.statfsNode(stream.node); + }, + statfsNode(node) { + // NOTE: None of the defaults here are true. We're just returning safe and + // sane values. Currently nodefs and rawfs replace these defaults, + // other file systems leave them alone. + var rtn = { + bsize: 4096, + frsize: 4096, + blocks: 1e6, + bfree: 5e5, + bavail: 5e5, + files: FS.nextInode, + ffree: FS.nextInode - 1, + fsid: 42, + flags: 2, + namelen: 255 + }; + if (node.node_ops.statfs) { + Object.assign(rtn, node.node_ops.statfs(node.mount.opts.root)); + } + return rtn; + }, + create(path, mode = 438) { + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode = 511) { + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + // parents must exist + var lookup, old_dir, new_dir; + // let the errors from non existent directories percolate up + lookup = FS.lookupPath(old_path, { + parent: true + }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { + parent: true + }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + // need to be part of the same mount + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + // source must exist + var old_node = FS.lookupNode(old_dir, old_name); + // old path should not be an ancestor of the new path + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + // new path should not be an ancestor of the old path + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + // see if the new path already exists + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + // early out if nothing needs to change + if (old_node === new_node) { + return; + } + // we'll need to delete the old entry + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + // need delete permissions if we'll be overwriting. + // need create permissions if new doesn't already exist. + errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(old_node) || (new_node && FS.isMountpoint(new_node))) { + throw new FS.ErrnoError(10); + } + // if we are going to change the parent, check write permissions + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + // remove the node from the lookup hash + FS.hashRemoveNode(old_node); + // do the underlying fs rename + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + // update old node (we do this here to avoid each backend + // needing to) + old_node.parent = new_dir; + } catch (e) { + throw e; + } finally { + // add the node back to the hash (in case node_ops.rename + // changed its name) + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + var readdir = FS.checkOpExists(node.node_ops.readdir, 54); + return readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + // According to POSIX, we should map EISDIR to EPERM, but + // we instead do what Linux does (and we must, as we use + // the musl linux libc). + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return link.node_ops.readlink(link); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + var node = lookup.node; + var getattr = FS.checkOpExists(node.node_ops.getattr, 63); + return getattr(node); + }, + fstat(fd) { + var stream = FS.getStreamChecked(fd); + var node = stream.node; + var getattr = stream.stream_ops.getattr; + var arg = getattr ? stream : node; + getattr ??= node.node_ops.getattr; + FS.checkOpExists(getattr, 63); + return getattr(arg); + }, + lstat(path) { + return FS.stat(path, true); + }, + doChmod(stream, node, mode, dontFollow) { + FS.doSetAttr(stream, node, { + mode: (mode & 4095) | (node.mode & ~4095), + ctime: Date.now(), + dontFollow + }); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + FS.doChmod(null, node, mode, dontFollow); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.doChmod(stream, stream.node, mode, false); + }, + doChown(stream, node, dontFollow) { + FS.doSetAttr(stream, node, { + timestamp: Date.now(), + dontFollow + }); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + FS.doChown(null, node, dontFollow); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.doChown(stream, stream.node, false); + }, + doTruncate(stream, node, len) { + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.doSetAttr(stream, node, { + size: len, + timestamp: Date.now() + }); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: true + }); + node = lookup.node; + } else { + node = path; + } + FS.doTruncate(null, node, len); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if (len < 0 || (stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.doTruncate(stream, stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + var setattr = FS.checkOpExists(node.node_ops.setattr, 63); + setattr(node, { + atime, + mtime + }); + }, + open(path, flags, mode = 438) { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags; + if ((flags & 64)) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + var isDirPath; + if (typeof path == "object") { + node = path; + } else { + isDirPath = path.endsWith("/"); + // noent_okay makes it so that if the final component of the path + // doesn't exist, lookupPath returns `node: undefined`. `path` will be + // updated to point to the target of all symlinks. + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072), + noent_okay: true + }); + node = lookup.node; + path = lookup.path; + } + // perhaps we need to create the node + var created = false; + if ((flags & 64)) { + if (node) { + // if O_CREAT and O_EXCL are set, error out if the node already exists + if ((flags & 128)) { + throw new FS.ErrnoError(20); + } + } else if (isDirPath) { + throw new FS.ErrnoError(31); + } else { + // node doesn't exist, try to create it + // Ignore the permission bits here to ensure we can `open` this new + // file below. We use chmod below the apply the permissions once the + // file is open. + node = FS.mknod(path, mode | 511, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + // can't truncate a device + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + // if asked only for a directory, then this must be one + if ((flags & 65536) && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + // check permissions, if this is not a file we just created now (it is ok to + // create and write to a file with read-only permissions; it is read-only + // for later use) + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + // do truncation if necessary + if ((flags & 512) && !created) { + FS.truncate(node, 0); + } + // we've already handled these, don't pass down to the underlying vfs + flags &= ~(128 | 512 | 131072); + // register the stream with the filesystem + var stream = FS.createStream({ + node, + path: FS.getPath(node), + // we want the absolute path to the node + flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + // used by the file family libc calls (fopen, fwrite, ferror, etc.) + ungotten: [], + error: false + }); + // call the new stream's open function + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (created) { + FS.chmod(node, mode & 511); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + // free readdir state + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + // seek to the end before writing in append mode + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + // User requests writing to file (prot & PROT_WRITE != 0). + // Checking if we have permissions to write to the file unless + // MAP_PRIVATE flag is set. According to POSIX spec it is possible + // to write to file opened in read-only mode with MAP_PRIVATE flag, + // as all modifications will be visible only in the memory of + // the current process. + if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + if (!length) { + throw new FS.ErrnoError(28); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + assert(offset >= 0); + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags); + }, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { + follow: true + }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices() { + // create /dev + FS.mkdir("/dev"); + // setup /dev/null + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + llseek: () => 0 + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + // setup /dev/tty and /dev/tty1 + // stderr needs to print output using err() rather than out() + // so we register a second tty just for it. + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + // setup /dev/[u]random + // use a buffer to avoid overhead of individual crypto calls per byte + var randomBuffer = new Uint8Array(1024), randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomFill(randomBuffer); + randomLeft = randomBuffer.byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice("/dev", "random", randomByte); + FS.createDevice("/dev", "urandom", randomByte); + // we're not going to emulate the actual shm device, + // just create the tmp dirs that reside in it commonly + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories() { + // create /proc/self/fd which allows /proc/self/fd/6 => readlink gives the + // name of the stream for fd 6 (see test_unistd_ttyname) + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount({ + mount() { + var node = FS.createNode(proc_self, "fd", 16895, 73); + node.stream_ops = { + llseek: MEMFS.stream_ops.llseek + }; + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { + mountpoint: "fake" + }, + node_ops: { + readlink: () => stream.path + }, + id: fd + 1 + }; + ret.parent = ret; + // make it look like a simple root node + return ret; + }, + readdir() { + return Array.from(FS.streams.entries()).filter(([k, v]) => v).map(([k, v]) => k.toString()); + } + }; + return node; + } + }, {}, "/proc/self/fd"); + }, + createStandardStreams(input, output, error) { + // TODO deprecate the old functionality of a single + // input / output callback and that utilizes FS.createDevice + // and instead require a unique set of stream ops + // by default, we symlink the standard streams to the + // default tty devices. however, if the standard streams + // have been overwritten we create a unique device for + // them instead. + if (input) { + FS.createDevice("/dev", "stdin", input); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (output) { + FS.createDevice("/dev", "stdout", null, output); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (error) { + FS.createDevice("/dev", "stderr", null, error); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + // open default streams for the stdin, stdout and stderr devices + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, `invalid handle for stdin (${stdin.fd})`); + assert(stdout.fd === 1, `invalid handle for stdout (${stdout.fd})`); + assert(stderr.fd === 2, `invalid handle for stderr (${stderr.fd})`); + }, + staticInit() { + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { + "MEMFS": MEMFS + }; + }, + init(input, output, error) { + assert(!FS.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"); + FS.initialized = true; + // Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here + input ??= Module["stdin"]; + output ??= Module["stdout"]; + error ??= Module["stderr"]; + FS.createStandardStreams(input, output, error); + }, + quit() { + FS.initialized = false; + // force-flush all streams, so we get musl std streams printed out + _fflush(0); + // close all of our streams + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + // operate from within the context of the symlink's target + try { + var lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null + }; + try { + var lookup = FS.lookupPath(path, { + parent: true + }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i); + data = arr; + } + // make sure we can write to the file + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + }, + createDevice(parent, name, input, output) { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS_getMode(!!input, !!output); + FS.createDevice.major ??= 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + // Create a fake device that a set of stream ops to emulate + // the old behavior. + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + // flush any pending line data + if (output?.buffer?.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + } + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."); + } else { + // Command-line. + try { + obj.contents = readBinary(obj.url); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + // Lazy chunked Uint8Array (implements get and length from Uint8Array). + // Actual getting is abstracted away for eventual reuse. + class LazyUint8Array { + lengthKnown=false; + chunks=[]; + // Loaded chunks. Index is the chunk number + get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + } + setDataGetter(getter) { + this.getter = getter; + } + cacheLength() { + // Find length + var xhr = new XMLHttpRequest; + xhr.open("HEAD", url, false); + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; + var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip"; + var chunkSize = 1024 * 1024; + // Chunk size in bytes + if (!hasByteServing) chunkSize = datalength; + // Function to get a range from the remote URL. + var doXHR = (from, to) => { + if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); + if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!"); + // TODO: Use mozResponseArrayBuffer, responseStream, etc. if available. + var xhr = new XMLHttpRequest; + xhr.open("GET", url, false); + if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + // Some hints to the browser that we want binary data. + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + if (xhr.response !== undefined) { + return new Uint8Array(/** @type{Array} */ (xhr.response || [])); + } + return intArrayFromString(xhr.responseText || "", true); + }; + var lazyArray = this; + lazyArray.setDataGetter(chunkNum => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + // including this byte + end = Math.min(end, datalength - 1); + // if datalength-1 is selected, this is the last block + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + // if the server uses gzip or doesn't supply the length, we have to download the whole file to get the (uncompressed) length + chunkSize = datalength = 1; + // this will force getter(0)/doXHR do download the whole file + datalength = this.getter(0).length; + chunkSize = datalength; + out("LazyFiles on gzip forces download of the whole file when length is accessed"); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + get length() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + get chunkSize() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array; + var properties = { + isDevice: false, + contents: lazyArray + }; + } else { + var properties = { + isDevice: false, + url + }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + // This is a total hack, but I want to get this lazy file code out of the + // core of MEMFS. If we want to keep this lazy file concept I feel it should + // be its own thin LAZYFS proxying calls to MEMFS. + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + // Add a function that defers querying the file size until it is asked the first time. + Object.defineProperties(node, { + usedBytes: { + get: function() { + return this.contents.length; + } + } + }); + // override each stream op with one that tries to force load the lazy file first + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach(key => { + var fn = node.stream_ops[key]; + stream_ops[key] = (...args) => { + FS.forceLoadFile(node); + return fn(...args); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + // normal array + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + // LazyUint8Array from sync binary XHR + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + // use a custom read function + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + // use a custom mmap function + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { + ptr, + allocated: true + }; + }; + node.stream_ops = stream_ops; + return node; + }, + absolutePath() { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder() { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink() { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath() { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc() { + abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc"); + }, + standardizePath() { + abort("FS.standardizePath has been removed; use PATH.normalize instead"); + } +}; + +var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + // relative path + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return dir + "/" + path; + }, + writeStat(buf, stat) { + SAFE_HEAP_STORE(((buf) / 4) * 4, stat.dev, 4); + SAFE_HEAP_STORE((((buf) + (4)) / 4) * 4, stat.mode, 4); + HEAPU64[(((buf) + (8)) / 8)] = BigInt(stat.nlink); + SAFE_HEAP_STORE((((buf) + (16)) / 4) * 4, stat.uid, 4); + SAFE_HEAP_STORE((((buf) + (20)) / 4) * 4, stat.gid, 4); + SAFE_HEAP_STORE((((buf) + (24)) / 4) * 4, stat.rdev, 4); + HEAP64[(((buf) + (32)) / 8)] = BigInt(stat.size); + SAFE_HEAP_STORE((((buf) + (40)) / 4) * 4, 4096, 4); + SAFE_HEAP_STORE((((buf) + (44)) / 4) * 4, stat.blocks, 4); + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + HEAP64[(((buf) + (48)) / 8)] = BigInt(Math.floor(atime / 1e3)); + HEAPU64[(((buf) + (56)) / 8)] = BigInt((atime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (64)) / 8)] = BigInt(Math.floor(mtime / 1e3)); + HEAPU64[(((buf) + (72)) / 8)] = BigInt((mtime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (80)) / 8)] = BigInt(Math.floor(ctime / 1e3)); + HEAPU64[(((buf) + (88)) / 8)] = BigInt((ctime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (96)) / 8)] = BigInt(stat.ino); + return 0; + }, + writeStatFs(buf, stats) { + SAFE_HEAP_STORE((((buf) + (8)) / 4) * 4, stats.bsize, 4); + SAFE_HEAP_STORE((((buf) + (56)) / 4) * 4, stats.bsize, 4); + SAFE_HEAP_STORE((((buf) + (16)) / 4) * 4, stats.blocks, 4); + SAFE_HEAP_STORE((((buf) + (20)) / 4) * 4, stats.bfree, 4); + SAFE_HEAP_STORE((((buf) + (24)) / 4) * 4, stats.bavail, 4); + SAFE_HEAP_STORE((((buf) + (28)) / 4) * 4, stats.files, 4); + SAFE_HEAP_STORE((((buf) + (32)) / 4) * 4, stats.ffree, 4); + SAFE_HEAP_STORE((((buf) + (36)) / 4) * 4, stats.fsid, 4); + SAFE_HEAP_STORE((((buf) + (64)) / 4) * 4, stats.flags, 4); + // ST_NOSUID + SAFE_HEAP_STORE((((buf) + (48)) / 4) * 4, stats.namelen, 4); + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + // MAP_PRIVATE calls need not to be synced back to underlying fs + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + varargs: undefined, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + } +}; + +function ___syscall_chmod(path, mode) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_dup(fd) { + try { + var old = SYSCALLS.getStreamFromFD(fd); + return FS.dupStream(old).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_dup3(fd, newfd, flags) { + try { + var old = SYSCALLS.getStreamFromFD(fd); + assert(!flags); + if (old.fd === newfd) return -28; + // Check newfd is within range of valid open file descriptors. + if (newfd < 0 || newfd >= FS.MAX_OPEN_FDS) return -8; + var existing = FS.getStream(newfd); + if (existing) FS.close(existing); + return FS.dupStream(old, newfd).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_faccessat(dirfd, path, amode, flags) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + assert(flags === 0 || flags == 512); + path = SYSCALLS.calculateAt(dirfd, path); + if (amode & ~7) { + // need a valid mode + return -28; + } + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ""; + if (amode & 4) perms += "r"; + if (amode & 2) perms += "w"; + if (amode & 1) perms += "x"; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var syscallGetVarargP = () => { + assert(SYSCALLS.varargs != undefined); + var ret = Number(HEAPU64[((SYSCALLS.varargs) / 8)]); + SYSCALLS.varargs += 8; + return ret; +}; + +var syscallGetVarargI = () => { + assert(SYSCALLS.varargs != undefined); + // the `+` prepended here is necessary to convince the JSCompiler that varargs is indeed a number. + var ret = SAFE_HEAP_LOAD(((+SYSCALLS.varargs) / 4) * 4, 4, 0); + SYSCALLS.varargs += 4; + return ret; +}; + +function ___syscall_fcntl64(fd, cmd, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: + { + var arg = syscallGetVarargI(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.dupStream(stream, arg); + return newStream.fd; + } + + case 1: + case 2: + return 0; + + // FD_CLOEXEC makes no sense for a single process. + case 3: + return stream.flags; + + case 4: + { + var arg = syscallGetVarargI(); + stream.flags |= arg; + return 0; + } + + case 5: + { + var arg = syscallGetVarargP(); + var offset = 0; + // We're always unlocked. + SAFE_HEAP_STORE((((arg) + (offset)) / 2) * 2, 2, 2); + return 0; + } + + case 6: + case 7: + return 0; + } + return -28; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_fstat64(fd, buf) { + buf = bigintToI53Checked(buf); + try { + return SYSCALLS.writeStat(buf, FS.fstat(fd)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); +}; + +function ___syscall_getcwd(buf, size) { + buf = bigintToI53Checked(buf); + size = bigintToI53Checked(size); + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1; + if (size < cwdLengthInBytes) return -68; + stringToUTF8(cwd, buf, size); + return cwdLengthInBytes; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_getdents64(fd, dirp, count) { + dirp = bigintToI53Checked(dirp); + count = bigintToI53Checked(count); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + stream.getdents ||= FS.readdir(stream.path); + var struct_size = 280; + var pos = 0; + var off = FS.llseek(stream, 0, 1); + var startIdx = Math.floor(off / struct_size); + var endIdx = Math.min(stream.getdents.length, startIdx + Math.floor(count / struct_size)); + for (var idx = startIdx; idx < endIdx; idx++) { + var id; + var type; + var name = stream.getdents[idx]; + if (name === ".") { + id = stream.node.id; + type = 4; + } else if (name === "..") { + var lookup = FS.lookupPath(stream.path, { + parent: true + }); + id = lookup.node.id; + type = 4; + } else { + var child; + try { + child = FS.lookupNode(stream.node, name); + } catch (e) { + // If the entry is not a directory, file, or symlink, nodefs + // lookupNode will raise EINVAL. Skip these and continue. + if (e?.errno === 28) { + continue; + } + throw e; + } + id = child.id; + type = FS.isChrdev(child.mode) ? 2 : // DT_CHR, character device. + FS.isDir(child.mode) ? 4 : // DT_DIR, directory. + FS.isLink(child.mode) ? 10 : // DT_LNK, symbolic link. + 8; + } + assert(id); + HEAP64[((dirp + pos) / 8)] = BigInt(id); + HEAP64[(((dirp + pos) + (8)) / 8)] = BigInt((idx + 1) * struct_size); + SAFE_HEAP_STORE((((dirp + pos) + (16)) / 2) * 2, 280, 2); + SAFE_HEAP_STORE((dirp + pos) + (18), type, 1); + stringToUTF8(name, dirp + pos + 19, 256); + pos += struct_size; + } + FS.llseek(stream, idx * struct_size, 0); + return pos; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_ioctl(fd, op, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: + { + if (!stream.tty) return -59; + return 0; + } + + case 21505: + { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 4) * 4, termios.c_iflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (4)) / 4) * 4, termios.c_oflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (8)) / 4) * 4, termios.c_cflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (12)) / 4) * 4, termios.c_lflag || 0, 4); + for (var i = 0; i < 32; i++) { + SAFE_HEAP_STORE((argp + i) + (17), termios.c_cc[i] || 0, 1); + } + return 0; + } + return 0; + } + + case 21510: + case 21511: + case 21512: + { + if (!stream.tty) return -59; + return 0; + } + + case 21506: + case 21507: + case 21508: + { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = syscallGetVarargP(); + var c_iflag = SAFE_HEAP_LOAD(((argp) / 4) * 4, 4, 0); + var c_oflag = SAFE_HEAP_LOAD((((argp) + (4)) / 4) * 4, 4, 0); + var c_cflag = SAFE_HEAP_LOAD((((argp) + (8)) / 4) * 4, 4, 0); + var c_lflag = SAFE_HEAP_LOAD((((argp) + (12)) / 4) * 4, 4, 0); + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(SAFE_HEAP_LOAD((argp + i) + (17), 1, 0)); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag, + c_oflag, + c_cflag, + c_lflag, + c_cc + }); + } + return 0; + } + + case 21519: + { + if (!stream.tty) return -59; + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 4) * 4, 0, 4); + return 0; + } + + case 21520: + { + if (!stream.tty) return -59; + return -28; + } + + case 21531: + { + var argp = syscallGetVarargP(); + return FS.ioctl(stream, op, argp); + } + + case 21523: + { + // TODO: in theory we should write to the winsize struct that gets + // passed in, but for now musl doesn't read anything on it + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 2) * 2, winsize[0], 2); + SAFE_HEAP_STORE((((argp) + (2)) / 2) * 2, winsize[1], 2); + } + return 0; + } + + case 21524: + { + // TODO: technically, this ioctl call should change the window size. + // but, since emscripten doesn't have any concept of a terminal window + // yet, we'll just silently throw it away as we do TIOCGWINSZ + if (!stream.tty) return -59; + return 0; + } + + case 21515: + { + if (!stream.tty) return -59; + return 0; + } + + default: + return -28; + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_lstat64(path, buf) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.writeStat(buf, FS.lstat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_newfstatat(dirfd, path, buf, flags) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & (~6400); + assert(!flags, `unknown flags in __syscall_newfstatat: ${flags}`); + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.writeStat(buf, nofollow ? FS.lstat(path) : FS.stat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_openat(dirfd, path, flags, varargs) { + path = bigintToI53Checked(path); + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? syscallGetVarargI() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var PIPEFS = { + BUCKET_BUFFER_SIZE: 8192, + mount(mount) { + // Do not pollute the real root directory or its child nodes with pipes + // Looks like it is OK to create another pseudo-root node not linked to the FS.root hierarchy this way + return FS.createNode(null, "/", 16384 | 511, 0); + }, + createPipe() { + var pipe = { + buckets: [], + // refcnt 2 because pipe has a read end and a write end. We need to be + // able to read from the read end after write end is closed. + refcnt: 2, + timestamp: new Date + }; + pipe.buckets.push({ + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: 0, + roffset: 0 + }); + var rName = PIPEFS.nextname(); + var wName = PIPEFS.nextname(); + var rNode = FS.createNode(PIPEFS.root, rName, 4096, 0); + var wNode = FS.createNode(PIPEFS.root, wName, 4096, 0); + rNode.pipe = pipe; + wNode.pipe = pipe; + var readableStream = FS.createStream({ + path: rName, + node: rNode, + flags: 0, + seekable: false, + stream_ops: PIPEFS.stream_ops + }); + rNode.stream = readableStream; + var writableStream = FS.createStream({ + path: wName, + node: wNode, + flags: 1, + seekable: false, + stream_ops: PIPEFS.stream_ops + }); + wNode.stream = writableStream; + return { + readable_fd: readableStream.fd, + writable_fd: writableStream.fd + }; + }, + stream_ops: { + getattr(stream) { + var node = stream.node; + var timestamp = node.pipe.timestamp; + return { + dev: 14, + ino: node.id, + mode: 4480, + nlink: 1, + uid: 0, + gid: 0, + rdev: 0, + size: 0, + atime: timestamp, + mtime: timestamp, + ctime: timestamp, + blksize: 4096, + blocks: 0 + }; + }, + poll(stream) { + var pipe = stream.node.pipe; + if ((stream.flags & 2097155) === 1) { + return (256 | 4); + } + if (pipe.buckets.length > 0) { + for (var i = 0; i < pipe.buckets.length; i++) { + var bucket = pipe.buckets[i]; + if (bucket.offset - bucket.roffset > 0) { + return (64 | 1); + } + } + } + return 0; + }, + dup(stream) { + stream.node.pipe.refcnt++; + }, + ioctl(stream, request, varargs) { + return 28; + }, + fsync(stream) { + return 28; + }, + read(stream, buffer, offset, length, position) { + var pipe = stream.node.pipe; + var currentLength = 0; + for (var i = 0; i < pipe.buckets.length; i++) { + var bucket = pipe.buckets[i]; + currentLength += bucket.offset - bucket.roffset; + } + assert(buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer)); + var data = buffer.subarray(offset, offset + length); + if (length <= 0) { + return 0; + } + if (currentLength == 0) { + // Behave as if the read end is always non-blocking + throw new FS.ErrnoError(6); + } + var toRead = Math.min(currentLength, length); + var totalRead = toRead; + var toRemove = 0; + for (var i = 0; i < pipe.buckets.length; i++) { + var currBucket = pipe.buckets[i]; + var bucketSize = currBucket.offset - currBucket.roffset; + if (toRead <= bucketSize) { + var tmpSlice = currBucket.buffer.subarray(currBucket.roffset, currBucket.offset); + if (toRead < bucketSize) { + tmpSlice = tmpSlice.subarray(0, toRead); + currBucket.roffset += toRead; + } else { + toRemove++; + } + data.set(tmpSlice); + break; + } else { + var tmpSlice = currBucket.buffer.subarray(currBucket.roffset, currBucket.offset); + data.set(tmpSlice); + data = data.subarray(tmpSlice.byteLength); + toRead -= tmpSlice.byteLength; + toRemove++; + } + } + if (toRemove && toRemove == pipe.buckets.length) { + // Do not generate excessive garbage in use cases such as + // write several bytes, read everything, write several bytes, read everything... + toRemove--; + pipe.buckets[toRemove].offset = 0; + pipe.buckets[toRemove].roffset = 0; + } + pipe.buckets.splice(0, toRemove); + return totalRead; + }, + write(stream, buffer, offset, length, position) { + var pipe = stream.node.pipe; + assert(buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer)); + var data = buffer.subarray(offset, offset + length); + var dataLen = data.byteLength; + if (dataLen <= 0) { + return 0; + } + var currBucket = null; + if (pipe.buckets.length == 0) { + currBucket = { + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: 0, + roffset: 0 + }; + pipe.buckets.push(currBucket); + } else { + currBucket = pipe.buckets[pipe.buckets.length - 1]; + } + assert(currBucket.offset <= PIPEFS.BUCKET_BUFFER_SIZE); + var freeBytesInCurrBuffer = PIPEFS.BUCKET_BUFFER_SIZE - currBucket.offset; + if (freeBytesInCurrBuffer >= dataLen) { + currBucket.buffer.set(data, currBucket.offset); + currBucket.offset += dataLen; + return dataLen; + } else if (freeBytesInCurrBuffer > 0) { + currBucket.buffer.set(data.subarray(0, freeBytesInCurrBuffer), currBucket.offset); + currBucket.offset += freeBytesInCurrBuffer; + data = data.subarray(freeBytesInCurrBuffer, data.byteLength); + } + var numBuckets = (data.byteLength / PIPEFS.BUCKET_BUFFER_SIZE) | 0; + var remElements = data.byteLength % PIPEFS.BUCKET_BUFFER_SIZE; + for (var i = 0; i < numBuckets; i++) { + var newBucket = { + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: PIPEFS.BUCKET_BUFFER_SIZE, + roffset: 0 + }; + pipe.buckets.push(newBucket); + newBucket.buffer.set(data.subarray(0, PIPEFS.BUCKET_BUFFER_SIZE)); + data = data.subarray(PIPEFS.BUCKET_BUFFER_SIZE, data.byteLength); + } + if (remElements > 0) { + var newBucket = { + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: data.byteLength, + roffset: 0 + }; + pipe.buckets.push(newBucket); + newBucket.buffer.set(data); + } + return dataLen; + }, + close(stream) { + var pipe = stream.node.pipe; + pipe.refcnt--; + if (pipe.refcnt === 0) { + pipe.buckets = null; + } + } + }, + nextname() { + if (!PIPEFS.nextname.current) { + PIPEFS.nextname.current = 0; + } + return "pipe[" + (PIPEFS.nextname.current++) + "]"; + } +}; + +function ___syscall_pipe(fdPtr) { + fdPtr = bigintToI53Checked(fdPtr); + try { + if (fdPtr == 0) { + throw new FS.ErrnoError(21); + } + var res = PIPEFS.createPipe(); + SAFE_HEAP_STORE(((fdPtr) / 4) * 4, res.readable_fd, 4); + SAFE_HEAP_STORE((((fdPtr) + (4)) / 4) * 4, res.writable_fd, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_readlinkat(dirfd, path, buf, bufsize) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + bufsize = bigintToI53Checked(bufsize); + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = SAFE_HEAP_LOAD(buf + len, 1, 0); + stringToUTF8(ret, buf, bufsize + 1); + // readlink is one of the rare functions that write out a C string, but does never append a null to the output buffer(!) + // stringToUTF8() always appends a null byte, so restore the character under the null byte after the write. + SAFE_HEAP_STORE(buf + len, endChar, 1); + return len; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_rmdir(path) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + FS.rmdir(path); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_stat64(path, buf) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.writeStat(buf, FS.stat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_unlinkat(dirfd, path, flags) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (flags === 0) { + FS.unlink(path); + } else if (flags === 512) { + FS.rmdir(path); + } else { + abort("Invalid flags passed to unlinkat"); + } + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var __abort_js = () => abort("native code called abort()"); + +var runtimeKeepaliveCounter = 0; + +var __emscripten_runtime_keepalive_clear = () => { + noExitRuntime = false; + runtimeKeepaliveCounter = 0; +}; + +var isLeapYear = year => year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + +var MONTH_DAYS_LEAP_CUMULATIVE = [ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 ]; + +var MONTH_DAYS_REGULAR_CUMULATIVE = [ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 ]; + +var ydayFromDate = date => { + var leap = isLeapYear(date.getFullYear()); + var monthDaysCumulative = (leap ? MONTH_DAYS_LEAP_CUMULATIVE : MONTH_DAYS_REGULAR_CUMULATIVE); + var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; + // -1 since it's days since Jan 1 + return yday; +}; + +function __localtime_js(time, tmPtr) { + time = bigintToI53Checked(time); + tmPtr = bigintToI53Checked(tmPtr); + var date = new Date(time * 1e3); + SAFE_HEAP_STORE(((tmPtr) / 4) * 4, date.getSeconds(), 4); + SAFE_HEAP_STORE((((tmPtr) + (4)) / 4) * 4, date.getMinutes(), 4); + SAFE_HEAP_STORE((((tmPtr) + (8)) / 4) * 4, date.getHours(), 4); + SAFE_HEAP_STORE((((tmPtr) + (12)) / 4) * 4, date.getDate(), 4); + SAFE_HEAP_STORE((((tmPtr) + (16)) / 4) * 4, date.getMonth(), 4); + SAFE_HEAP_STORE((((tmPtr) + (20)) / 4) * 4, date.getFullYear() - 1900, 4); + SAFE_HEAP_STORE((((tmPtr) + (24)) / 4) * 4, date.getDay(), 4); + var yday = ydayFromDate(date) | 0; + SAFE_HEAP_STORE((((tmPtr) + (28)) / 4) * 4, yday, 4); + HEAP64[(((tmPtr) + (40)) / 8)] = BigInt(-(date.getTimezoneOffset() * 60)); + // Attention: DST is in December in South, and some regions don't have DST at all. + var start = new Date(date.getFullYear(), 0, 1); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + SAFE_HEAP_STORE((((tmPtr) + (32)) / 4) * 4, dst, 4); +} + +var timers = {}; + +var handleException = e => { + // Certain exception types we do not treat as errors since they are used for + // internal control flow. + // 1. ExitStatus, which is thrown by exit() + // 2. "unwind", which is thrown by emscripten_unwind_to_js_event_loop() and others + // that wish to return to JS event loop. + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + checkStackCookie(); + if (e instanceof WebAssembly.RuntimeError) { + if (_emscripten_stack_get_current() <= 0) { + err("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)"); + } + } + quit_(1, e); +}; + +var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0; + +var _proc_exit = code => { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + Module["onExit"]?.(code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); +}; + +/** @suppress {duplicate } */ /** @param {boolean|number=} implicit */ var exitJS = (status, implicit) => { + elfile = FS.readFile("./output.elf"); + console.log(elfile); + EXITSTATUS = status; + if (!keepRuntimeAlive()) { + exitRuntime(); + } + // if exit() was called explicitly, warn the user if the runtime isn't actually being shut down + if (keepRuntimeAlive() && !implicit) { + var msg = `program exited (with status: ${status}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`; + readyPromiseReject(msg); + err(msg); + } + _proc_exit(status); +}; + +var _exit = exitJS; + +var maybeExit = () => { + if (runtimeExited) { + return; + } + if (!keepRuntimeAlive()) { + try { + _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } +}; + +var callUserCallback = func => { + if (runtimeExited || ABORT) { + err("user callback triggered after runtime exited or application aborted. Ignoring."); + return; + } + try { + func(); + maybeExit(); + } catch (e) { + handleException(e); + } +}; + +var _emscripten_get_now = () => performance.now(); + +var __setitimer_js = (which, timeout_ms) => { + // First, clear any existing timer. + if (timers[which]) { + clearTimeout(timers[which].id); + delete timers[which]; + } + // A timeout of zero simply cancels the current timeout so we have nothing + // more to do. + if (!timeout_ms) return 0; + var id = setTimeout(() => { + assert(which in timers); + delete timers[which]; + callUserCallback(() => __emscripten_timeout(which, _emscripten_get_now())); + }, timeout_ms); + timers[which] = { + id, + timeout_ms + }; + return 0; +}; + +var __tzset_js = function(timezone, daylight, std_name, dst_name) { + timezone = bigintToI53Checked(timezone); + daylight = bigintToI53Checked(daylight); + std_name = bigintToI53Checked(std_name); + dst_name = bigintToI53Checked(dst_name); + // TODO: Use (malleable) environment variables instead of system settings. + var currentYear = (new Date).getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + // Local standard timezone offset. Local standard time is not adjusted for + // daylight savings. This code uses the fact that getTimezoneOffset returns + // a greater value during Standard Time versus Daylight Saving Time (DST). + // Thus it determines the expected output during Standard Time, and it + // compares whether the output of the given date the same (Standard) or less + // (DST). + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + // timezone is specified as seconds west of UTC ("The external variable + // `timezone` shall be set to the difference, in seconds, between + // Coordinated Universal Time (UTC) and local standard time."), the same + // as returned by stdTimezoneOffset. + // See http://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html + HEAPU64[((timezone) / 8)] = BigInt(stdTimezoneOffset * 60); + SAFE_HEAP_STORE(((daylight) / 4) * 4, Number(winterOffset != summerOffset), 4); + var extractZone = timezoneOffset => { + // Why inverse sign? + // Read here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset + var sign = timezoneOffset >= 0 ? "-" : "+"; + var absOffset = Math.abs(timezoneOffset); + var hours = String(Math.floor(absOffset / 60)).padStart(2, "0"); + var minutes = String(absOffset % 60).padStart(2, "0"); + return `UTC${sign}${hours}${minutes}`; + }; + var winterName = extractZone(winterOffset); + var summerName = extractZone(summerOffset); + assert(winterName); + assert(summerName); + assert(lengthBytesUTF8(winterName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${winterName})`); + assert(lengthBytesUTF8(summerName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${summerName})`); + if (summerOffset < winterOffset) { + // Northern hemisphere + stringToUTF8(winterName, std_name, 17); + stringToUTF8(summerName, dst_name, 17); + } else { + stringToUTF8(winterName, dst_name, 17); + stringToUTF8(summerName, std_name, 17); + } +}; + +var _emscripten_date_now = () => Date.now(); + +var nowIsMonotonic = 1; + +var checkWasiClock = clock_id => clock_id >= 0 && clock_id <= 3; + +function _clock_time_get(clk_id, ignored_precision, ptime) { + ignored_precision = bigintToI53Checked(ignored_precision); + ptime = bigintToI53Checked(ptime); + if (!checkWasiClock(clk_id)) { + return 28; + } + var now; + // all wasi clocks but realtime are monotonic + if (clk_id === 0) { + now = _emscripten_date_now(); + } else if (nowIsMonotonic) { + now = _emscripten_get_now(); + } else { + return 52; + } + // "now" is in ms, and wasi times are in ns. + var nsec = Math.round(now * 1e3 * 1e3); + HEAP64[((ptime) / 8)] = BigInt(nsec); + return 0; +} + +function _emscripten_err(str) { + str = bigintToI53Checked(str); + return err(UTF8ToString(str)); +} + +var getHeapMax = () => 2147483648; + +var growMemory = size => { + var b = wasmMemory.buffer; + var pages = ((size - b.byteLength + 65535) / 65536) | 0; + try { + // round size grow request up to wasm page size (fixed 64KB per spec) + wasmMemory.grow(BigInt(pages)); + // .grow() takes a delta compared to the previous size + updateMemoryViews(); + return 1; + } catch (e) { + err(`growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`); + } +}; + +function _emscripten_resize_heap(requestedSize) { + requestedSize = bigintToI53Checked(requestedSize); + var oldSize = HEAPU8.length; + // With multithreaded builds, races can happen (another thread might increase the size + // in between), so return a failure, and let the caller retry. + assert(requestedSize > oldSize); + // Memory resize rules: + // 1. Always increase heap size to at least the requested size, rounded up + // to next page multiple. + // 2a. If MEMORY_GROWTH_LINEAR_STEP == -1, excessively resize the heap + // geometrically: increase the heap size according to + // MEMORY_GROWTH_GEOMETRIC_STEP factor (default +20%), At most + // overreserve by MEMORY_GROWTH_GEOMETRIC_CAP bytes (default 96MB). + // 2b. If MEMORY_GROWTH_LINEAR_STEP != -1, excessively resize the heap + // linearly: increase the heap size by at least + // MEMORY_GROWTH_LINEAR_STEP bytes. + // 3. Max size for the heap is capped at 2048MB-WASM_PAGE_SIZE, or by + // MAXIMUM_MEMORY, or by ASAN limit, depending on which is smallest + // 4. If we were unable to allocate as much memory, it may be due to + // over-eager decision to excessively reserve due to (3) above. + // Hence if an allocation fails, cut down on the amount of excess + // growth, in an attempt to succeed to perform a smaller allocation. + // A limit is set for how much we can grow. We should not exceed that + // (the wasm binary specifies it, so if we tried, we'd fail anyhow). + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + err(`Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`); + return false; + } + // Loop through potential heap size increases. If we attempt a too eager + // reservation that fails, cut down on the attempted size and reserve a + // smaller bump instead. (max 3 times, chosen somewhat arbitrarily) + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + .2 / cutDown); + // ensure geometric growth + // but limit overreserving (default to capping at +96MB overgrowth at most) + overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); + var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536)); + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + err(`Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`); + return false; +} + +var ENV = {}; + +var getExecutableName = () => thisProgram || "./this.program"; + +var getEnvStrings = () => { + if (!getEnvStrings.strings) { + // Default values. + // Browser language detection #8751 + var lang = ((typeof navigator == "object" && navigator.languages && navigator.languages[0]) || "C").replace("-", "_") + ".UTF-8"; + var env = { + "USER": "web_user", + "LOGNAME": "web_user", + "PATH": "/", + "PWD": "/", + "HOME": "/home/web_user", + "LANG": lang, + "_": getExecutableName() + }; + // Apply the user-provided values, if any. + for (var x in ENV) { + // x is a key in ENV; if ENV[x] is undefined, that means it was + // explicitly set to be so. We allow user code to do that to + // force variables with default values to remain unset. + if (ENV[x] === undefined) delete env[x]; else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(`${x}=${env[x]}`); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; +}; + +var stringToAscii = (str, buffer) => { + for (var i = 0; i < str.length; ++i) { + assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255)); + SAFE_HEAP_STORE(buffer++, str.charCodeAt(i), 1); + } + // Null-terminate the string + SAFE_HEAP_STORE(buffer, 0, 1); +}; + +var _environ_get = function(__environ, environ_buf) { + __environ = bigintToI53Checked(__environ); + environ_buf = bigintToI53Checked(environ_buf); + var bufSize = 0; + getEnvStrings().forEach((string, i) => { + var ptr = environ_buf + bufSize; + HEAPU64[(((__environ) + (i * 8)) / 8)] = BigInt(ptr); + stringToAscii(string, ptr); + bufSize += string.length + 1; + }); + return 0; +}; + +var _environ_sizes_get = function(penviron_count, penviron_buf_size) { + penviron_count = bigintToI53Checked(penviron_count); + penviron_buf_size = bigintToI53Checked(penviron_buf_size); + var strings = getEnvStrings(); + HEAPU64[((penviron_count) / 8)] = BigInt(strings.length); + var bufSize = 0; + strings.forEach(string => bufSize += string.length + 1); + HEAPU64[((penviron_buf_size) / 8)] = BigInt(bufSize); + return 0; +}; + +function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +function _fd_fdstat_get(fd, pbuf) { + pbuf = bigintToI53Checked(pbuf); + try { + var rightsBase = 0; + var rightsInheriting = 0; + var flags = 0; + { + var stream = SYSCALLS.getStreamFromFD(fd); + // All character devices are terminals (other things a Linux system would + // assume is a character device, like the mouse, we have special APIs for). + var type = stream.tty ? 2 : FS.isDir(stream.mode) ? 3 : FS.isLink(stream.mode) ? 7 : 4; + } + SAFE_HEAP_STORE(pbuf, type, 1); + SAFE_HEAP_STORE((((pbuf) + (2)) / 2) * 2, flags, 2); + HEAP64[(((pbuf) + (8)) / 8)] = BigInt(rightsBase); + HEAP64[(((pbuf) + (16)) / 8)] = BigInt(rightsInheriting); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +/** @param {number=} offset */ var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[((iov) / 8)]); + var len = Number(HEAPU64[(((iov) + (8)) / 8)]); + iov += 16; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + // nothing more to read + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; +}; + +function _fd_pread(fd, iov, iovcnt, offset, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + offset = bigintToI53Checked(offset); + pnum = bigintToI53Checked(pnum); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt, offset); + HEAPU64[((pnum) / 8)] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +function _fd_read(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU64[((pnum) / 8)] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +function _fd_seek(fd, offset, whence, newOffset) { + offset = bigintToI53Checked(offset); + newOffset = bigintToI53Checked(newOffset); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + HEAP64[((newOffset) / 8)] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; + // reset readdir state + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +/** @param {number=} offset */ var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[((iov) / 8)]); + var len = Number(HEAPU64[(((iov) + (8)) / 8)]); + iov += 16; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) { + // No more space to write. + break; + } + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; +}; + +function _fd_write(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU64[((pnum) / 8)] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +var stackAlloc = sz => __emscripten_stack_alloc(sz); + +var stringToUTF8OnStack = str => { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8(str, ret, size); + return ret; +}; + +FS.createPreloadedFile = FS_createPreloadedFile; + +FS.staticInit(); + +function checkIncomingModuleAPI() { + ignoredModuleProp("fetchSettings"); +} + +var wasmImports = { + /** @export */ __assert_fail: ___assert_fail, + /** @export */ __syscall_chmod: ___syscall_chmod, + /** @export */ __syscall_dup: ___syscall_dup, + /** @export */ __syscall_dup3: ___syscall_dup3, + /** @export */ __syscall_faccessat: ___syscall_faccessat, + /** @export */ __syscall_fcntl64: ___syscall_fcntl64, + /** @export */ __syscall_fstat64: ___syscall_fstat64, + /** @export */ __syscall_getcwd: ___syscall_getcwd, + /** @export */ __syscall_getdents64: ___syscall_getdents64, + /** @export */ __syscall_ioctl: ___syscall_ioctl, + /** @export */ __syscall_lstat64: ___syscall_lstat64, + /** @export */ __syscall_newfstatat: ___syscall_newfstatat, + /** @export */ __syscall_openat: ___syscall_openat, + /** @export */ __syscall_pipe: ___syscall_pipe, + /** @export */ __syscall_readlinkat: ___syscall_readlinkat, + /** @export */ __syscall_rmdir: ___syscall_rmdir, + /** @export */ __syscall_stat64: ___syscall_stat64, + /** @export */ __syscall_unlinkat: ___syscall_unlinkat, + /** @export */ _abort_js: __abort_js, + /** @export */ _emscripten_runtime_keepalive_clear: __emscripten_runtime_keepalive_clear, + /** @export */ _localtime_js: __localtime_js, + /** @export */ _setitimer_js: __setitimer_js, + /** @export */ _tzset_js: __tzset_js, + /** @export */ alignfault, + /** @export */ clock_time_get: _clock_time_get, + /** @export */ emscripten_date_now: _emscripten_date_now, + /** @export */ emscripten_err: _emscripten_err, + /** @export */ emscripten_get_now: _emscripten_get_now, + /** @export */ emscripten_resize_heap: _emscripten_resize_heap, + /** @export */ environ_get: _environ_get, + /** @export */ environ_sizes_get: _environ_sizes_get, + /** @export */ exit: _exit, + /** @export */ fd_close: _fd_close, + /** @export */ fd_fdstat_get: _fd_fdstat_get, + /** @export */ fd_pread: _fd_pread, + /** @export */ fd_read: _fd_read, + /** @export */ fd_seek: _fd_seek, + /** @export */ fd_write: _fd_write, + /** @export */ proc_exit: _proc_exit, + /** @export */ segfault +}; + +var wasmExports = await createWasm(); + +var ___wasm_call_ctors = createExportWrapper("__wasm_call_ctors", 0); + +var _main = Module["_main"] = createExportWrapper("__main_argc_argv", 2); + +var _fflush = createExportWrapper("fflush", 1); + +var _strerror = createExportWrapper("strerror", 1); + +var _sbrk = createExportWrapper("sbrk", 1); + +var ___funcs_on_exit = createExportWrapper("__funcs_on_exit", 0); + +var __emscripten_timeout = createExportWrapper("_emscripten_timeout", 2); + +var _emscripten_get_sbrk_ptr = createExportWrapper("emscripten_get_sbrk_ptr", 0); + +var _emscripten_stack_init = wasmExports["emscripten_stack_init"]; + +var _emscripten_stack_get_free = wasmExports["emscripten_stack_get_free"]; + +var _emscripten_stack_get_base = wasmExports["emscripten_stack_get_base"]; + +var _emscripten_stack_get_end = wasmExports["emscripten_stack_get_end"]; + +var __emscripten_stack_restore = wasmExports["_emscripten_stack_restore"]; + +var __emscripten_stack_alloc = wasmExports["_emscripten_stack_alloc"]; + +var _emscripten_stack_get_current = wasmExports["emscripten_stack_get_current"]; + +var ___cxa_increment_exception_refcount = createExportWrapper("__cxa_increment_exception_refcount", 1); + +// Argument name here must shadow the `wasmExports` global so +// that it is recognised by metadce and minify-import-export-names +// passes. +function applySignatureConversions(wasmExports) { + // First, make a copy of the incoming exports object + wasmExports = Object.assign({}, wasmExports); + var makeWrapper___PP = f => (a0, a1, a2) => f(a0, BigInt(a1 ? a1 : 0), BigInt(a2 ? a2 : 0)); + var makeWrapper__p = f => a0 => f(BigInt(a0)); + var makeWrapper_p_ = f => a0 => Number(f(a0)); + var makeWrapper_pP = f => a0 => Number(f(BigInt(a0 ? a0 : 0))); + var makeWrapper_p = f => () => Number(f()); + var makeWrapper_pp = f => a0 => Number(f(BigInt(a0))); + wasmExports["__main_argc_argv"] = makeWrapper___PP(wasmExports["__main_argc_argv"]); + wasmExports["fflush"] = makeWrapper__p(wasmExports["fflush"]); + wasmExports["strerror"] = makeWrapper_p_(wasmExports["strerror"]); + wasmExports["sbrk"] = makeWrapper_pP(wasmExports["sbrk"]); + wasmExports["emscripten_stack_get_base"] = makeWrapper_p(wasmExports["emscripten_stack_get_base"]); + wasmExports["emscripten_stack_get_end"] = makeWrapper_p(wasmExports["emscripten_stack_get_end"]); + wasmExports["_emscripten_stack_restore"] = makeWrapper__p(wasmExports["_emscripten_stack_restore"]); + wasmExports["_emscripten_stack_alloc"] = makeWrapper_pp(wasmExports["_emscripten_stack_alloc"]); + wasmExports["emscripten_stack_get_current"] = makeWrapper_p(wasmExports["emscripten_stack_get_current"]); + wasmExports["__cxa_increment_exception_refcount"] = makeWrapper__p(wasmExports["__cxa_increment_exception_refcount"]); + return wasmExports; +} + +// include: postamble.js +// === Auto-generated postamble setup entry stuff === +Module["run"] = run; + +Module["FS"] = FS; + +var missingLibrarySymbols = [ "writeI53ToI64", "writeI53ToI64Clamped", "writeI53ToI64Signaling", "writeI53ToU64Clamped", "writeI53ToU64Signaling", "readI53FromI64", "readI53FromU64", "convertI32PairToI53", "convertI32PairToI53Checked", "convertU32PairToI53", "getTempRet0", "setTempRet0", "inetPton4", "inetNtop4", "inetPton6", "inetNtop6", "readSockaddr", "writeSockaddr", "emscriptenLog", "readEmAsmArgs", "jstoi_q", "listenOnce", "autoResumeAudioContext", "getDynCaller", "dynCall", "runtimeKeepalivePush", "runtimeKeepalivePop", "asmjsMangle", "HandleAllocator", "getNativeTypeSize", "addOnInit", "addOnPostCtor", "addOnPreMain", "addOnExit", "STACK_SIZE", "STACK_ALIGN", "POINTER_SIZE", "ASSERTIONS", "getCFunc", "ccall", "cwrap", "uleb128Encode", "sigToWasmTypes", "generateFuncType", "convertJsFunctionToWasm", "getEmptyTableSlot", "updateTableMap", "getFunctionAddress", "addFunction", "removeFunction", "reallyNegative", "strLen", "reSign", "formatString", "intArrayToString", "AsciiToString", "UTF16ToString", "stringToUTF16", "lengthBytesUTF16", "UTF32ToString", "stringToUTF32", "lengthBytesUTF32", "stringToNewUTF8", "writeArrayToMemory", "registerKeyEventCallback", "maybeCStringToJsString", "findEventTarget", "getBoundingClientRect", "fillMouseEventData", "registerMouseEventCallback", "registerWheelEventCallback", "registerUiEventCallback", "registerFocusEventCallback", "fillDeviceOrientationEventData", "registerDeviceOrientationEventCallback", "fillDeviceMotionEventData", "registerDeviceMotionEventCallback", "screenOrientation", "fillOrientationChangeEventData", "registerOrientationChangeEventCallback", "fillFullscreenChangeEventData", "registerFullscreenChangeEventCallback", "JSEvents_requestFullscreen", "JSEvents_resizeCanvasForFullscreen", "registerRestoreOldStyle", "hideEverythingExceptGivenElement", "restoreHiddenElements", "setLetterbox", "softFullscreenResizeWebGLRenderTarget", "doRequestFullscreen", "fillPointerlockChangeEventData", "registerPointerlockChangeEventCallback", "registerPointerlockErrorEventCallback", "requestPointerLock", "fillVisibilityChangeEventData", "registerVisibilityChangeEventCallback", "registerTouchEventCallback", "fillGamepadEventData", "registerGamepadEventCallback", "registerBeforeUnloadEventCallback", "fillBatteryEventData", "battery", "registerBatteryEventCallback", "setCanvasElementSize", "getCanvasElementSize", "jsStackTrace", "getCallstack", "convertPCtoSourceLocation", "wasiRightsToMuslOFlags", "wasiOFlagsToMuslOFlags", "safeSetTimeout", "setImmediateWrapped", "safeRequestAnimationFrame", "clearImmediateWrapped", "registerPostMainLoop", "registerPreMainLoop", "getPromise", "makePromise", "idsToPromises", "makePromiseCallback", "ExceptionInfo", "findMatchingCatch", "Browser_asyncPrepareDataCounter", "arraySum", "addDays", "getSocketFromFD", "getSocketAddress", "FS_unlink", "FS_mkdirTree", "_setNetworkCallback", "heapObjectForWebGLType", "toTypedArrayIndex", "webgl_enable_ANGLE_instanced_arrays", "webgl_enable_OES_vertex_array_object", "webgl_enable_WEBGL_draw_buffers", "webgl_enable_WEBGL_multi_draw", "webgl_enable_EXT_polygon_offset_clamp", "webgl_enable_EXT_clip_control", "webgl_enable_WEBGL_polygon_mode", "emscriptenWebGLGet", "computeUnpackAlignedImageSize", "colorChannelsInGlTextureFormat", "emscriptenWebGLGetTexPixelData", "emscriptenWebGLGetUniform", "webglGetUniformLocation", "webglPrepareUniformLocationsBeforeFirstUse", "webglGetLeftBracePos", "emscriptenWebGLGetVertexAttrib", "__glGetActiveAttribOrUniform", "writeGLArray", "registerWebGlEventCallback", "runAndAbortIfError", "ALLOC_NORMAL", "ALLOC_STACK", "allocate", "writeStringToMemory", "writeAsciiToMemory", "setErrNo", "demangle", "stackTrace" ]; + +missingLibrarySymbols.forEach(missingLibrarySymbol); + +var unexportedSymbols = [ "addRunDependency", "removeRunDependency", "out", "err", "callMain", "abort", "wasmMemory", "wasmExports", "writeStackCookie", "checkStackCookie", "INT53_MAX", "INT53_MIN", "bigintToI53Checked", "stackSave", "stackRestore", "stackAlloc", "ptrToString", "zeroMemory", "exitJS", "getHeapMax", "growMemory", "ENV", "ERRNO_CODES", "strError", "DNS", "Protocols", "Sockets", "timers", "warnOnce", "readEmAsmArgsArray", "jstoi_s", "getExecutableName", "handleException", "keepRuntimeAlive", "callUserCallback", "maybeExit", "asyncLoad", "alignMemory", "mmapAlloc", "wasmTable", "noExitRuntime", "addOnPreRun", "addOnPostRun", "freeTableIndexes", "functionsInTableMap", "unSign", "setValue", "getValue", "PATH", "PATH_FS", "UTF8Decoder", "UTF8ArrayToString", "UTF8ToString", "stringToUTF8Array", "stringToUTF8", "lengthBytesUTF8", "intArrayFromString", "stringToAscii", "UTF16Decoder", "stringToUTF8OnStack", "JSEvents", "specialHTMLTargets", "findCanvasEventTarget", "currentFullscreenStrategy", "restoreOldWindowedStyle", "UNWIND_CACHE", "ExitStatus", "getEnvStrings", "checkWasiClock", "doReadv", "doWritev", "initRandomFill", "randomFill", "emSetImmediate", "emClearImmediate_deps", "emClearImmediate", "promiseMap", "uncaughtExceptionCount", "exceptionLast", "exceptionCaught", "Browser", "getPreloadedImageData__data", "wget", "MONTH_DAYS_REGULAR", "MONTH_DAYS_LEAP", "MONTH_DAYS_REGULAR_CUMULATIVE", "MONTH_DAYS_LEAP_CUMULATIVE", "isLeapYear", "ydayFromDate", "SYSCALLS", "preloadPlugins", "FS_createPreloadedFile", "FS_modeStringToFlags", "FS_getMode", "FS_stdin_getChar_buffer", "FS_stdin_getChar", "FS_createPath", "FS_createDevice", "FS_readFile", "FS_createDataFile", "FS_createLazyFile", "MEMFS", "TTY", "PIPEFS", "SOCKFS", "tempFixedLengthArray", "miniTempWebGLFloatBuffers", "miniTempWebGLIntBuffers", "GL", "AL", "GLUT", "EGL", "GLEW", "IDBStore", "SDL", "SDL_gfx", "allocateUTF8", "allocateUTF8OnStack", "print", "printErr" ]; + +unexportedSymbols.forEach(unexportedRuntimeSymbol); + +var calledRun; + +function callMain(args = []) { + assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'); + assert(typeof onPreRuns === "undefined" || onPreRuns.length == 0, "cannot call main when preRun functions remain to be called"); + var entryFunction = _main; + args.unshift(thisProgram); + var argc = args.length; + var argv = stackAlloc((argc + 1) * 8); + var argv_ptr = argv; + args.forEach(arg => { + HEAPU64[((argv_ptr) / 8)] = BigInt(stringToUTF8OnStack(arg)); + argv_ptr += 8; + }); + HEAPU64[((argv_ptr) / 8)] = BigInt(0); + try { + var ret = entryFunction(argc, BigInt(argv)); + // if we're not running an evented main loop, it's time to exit + exitJS(ret, /* implicit = */ true); + return ret; + } catch (e) { + return handleException(e); + } +} + +function stackCheckInit() { + // This is normally called automatically during __wasm_call_ctors but need to + // get these values before even running any of the ctors so we call it redundantly + // here. + _emscripten_stack_init(); + // TODO(sbc): Move writeStackCookie to native to to avoid this. + writeStackCookie(); +} + +function run(args = arguments_) { + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + stackCheckInit(); + preRun(); + // a preRun added a dependency, run will be called later + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + function doRun() { + console.log(args); + // run may have just been called through dependencies being fulfilled just in this very frame, + // or while the async setStatus time below was happening + assert(!calledRun); + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + FS.writeFile("./linker.ld", args[0]); + args.shift(); + FS.writeFile("./input.o", args[0]); + args.shift(); + for (let i = 0; i < libs_to_load.length; i++){ + FS.writeFile("./" + libs_to_load[i].name, libs_to_load[i].file); + } + preMain(); + // readyPromiseResolve(Module); + Module["onRuntimeInitialized"]?.(); + var noInitialRun = Module["noInitialRun"] || true; + legacyModuleProp("noInitialRun", "noInitialRun"); + callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(() => { + setTimeout(() => Module["setStatus"](""), 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); + return elfile; +} + +if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } +} + +// run(); + +// end include: postamble.js +// include: postamble_modularize.js +// In MODULARIZE mode we wrap the generated code in a factory function +// and return either the Module itself, or a promise of the module. +// We assign to the `moduleRtn` global here and configure closure to see +// this as and extern so it won't get minified. +moduleRtn = readyPromise; + +// Assertion for attempting to access module properties on the incoming +// moduleArg. In the past we used this object as the prototype of the module +// and assigned properties to it, but now we return a distinct object. This +// keeps the instance private until it is ready (i.e the promise has been +// resolved). +for (const prop of Object.keys(Module)) { + if (!(prop in moduleArg)) { + Object.defineProperty(moduleArg, prop, { + configurable: true, + get() { + abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`); + } + }); + } +} + + readyPromiseResolve(Module); + return moduleRtn; +} +); +})(); +(() => { + // Create a small, never-async wrapper around Module which + // checks for callers incorrectly using it with `new`. + var real_Module = Module; + Module = function(arg) { + if (new.target) throw new Error("Module() should not be called with `new Module()`"); + return real_Module(arg); + } +})(); +export default Module; diff --git a/src/core/assembler/sailAssembler/web/wasm/ld-new64.wasm b/src/core/assembler/sailAssembler/web/wasm/ld-new64.wasm new file mode 100755 index 000000000..68a56cd8c Binary files /dev/null and b/src/core/assembler/sailAssembler/web/wasm/ld-new64.wasm differ diff --git a/src/core/assembler/sailAssembler/web/wasm/objdump.js b/src/core/assembler/sailAssembler/web/wasm/objdump.js new file mode 100644 index 000000000..cb016561c --- /dev/null +++ b/src/core/assembler/sailAssembler/web/wasm/objdump.js @@ -0,0 +1,5776 @@ + + +export var dumptextinstructions32 = []; +export var dumpdatainstructions32 = []; +export var dumplabels32 = []; +export var sectionasm32 = 0; +export var inside_label32 = 0; +export var islib32 = 0; +export var libtags32 = []; +// export var entry_elf = 0; +var Module = (() => { + var _scriptDir = import.meta.url; + + return ( +function(Module) { + Module = Module || {}; + +var Module = typeof Module != "undefined" ? Module : {}; + +var readyPromiseResolve, readyPromiseReject; + +Module["ready"] = new Promise(function(resolve, reject) { + readyPromiseResolve = resolve; + readyPromiseReject = reject; +}); + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "_main")) { + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + get: function() { + abort("You are getting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + set: function() { + abort("You are setting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "___stdio_exit")) { + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + get: function() { + abort("You are getting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + set: function() { + abort("You are setting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "onRuntimeInitialized")) { + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + get: function() { + abort("You are getting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + set: function() { + abort("You are setting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +var moduleOverrides = Object.assign({}, Module); + +var arguments_ = []; + +var thisProgram = "./this.program"; + +var quit_ = (status, toThrow) => { + throw toThrow; +}; + +var ENVIRONMENT_IS_WEB = typeof window == "object"; + +var ENVIRONMENT_IS_WORKER = typeof importScripts == "function"; + +var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string"; + +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +if (Module["ENVIRONMENT"]) { + throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)"); +} + +var scriptDirectory = ""; + +function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; +} + +var read_, readAsync, readBinary, setWindowTitle; + +function logExceptionOnExit(e) { + if (e instanceof ExitStatus) return; + let toLog = e; + if (e && typeof e == "object" && e.stack) { + toLog = [ e, e.stack ]; + } + err("exiting due to exception: " + toLog); +} + +var fs; + +var nodePath; + +var requireNodeFS; + +if (ENVIRONMENT_IS_NODE) { + if (!(typeof process == "object" && typeof require == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = require("path").dirname(scriptDirectory) + "/"; + } else { + scriptDirectory = __dirname + "/"; + } + requireNodeFS = (() => { + if (!nodePath) { + fs = require("fs"); + nodePath = require("path"); + } + }); + read_ = function shell_read(filename, binary) { + requireNodeFS(); + filename = nodePath["normalize"](filename); + return fs.readFileSync(filename, binary ? undefined : "utf8"); + }; + readBinary = (filename => { + var ret = read_(filename, true); + if (!ret.buffer) { + ret = new Uint8Array(ret); + } + assert(ret.buffer); + return ret; + }); + readAsync = ((filename, onload, onerror) => { + requireNodeFS(); + filename = nodePath["normalize"](filename); + fs.readFile(filename, function(err, data) { + if (err) onerror(err); else onload(data.buffer); + }); + }); + if (process["argv"].length > 1) { + thisProgram = process["argv"][1].replace(/\\/g, "/"); + } + arguments_ = process["argv"].slice(2); + process["on"]("uncaughtException", function(ex) { + if (!(ex instanceof ExitStatus)) { + throw ex; + } + }); + process["on"]("unhandledRejection", function(reason) { + throw reason; + }); + quit_ = ((status, toThrow) => { + if (keepRuntimeAlive()) { + process["exitCode"] = status; + throw toThrow; + } + logExceptionOnExit(toThrow); + process["exit"](status); + }); + Module["inspect"] = function() { + return "[Emscripten Module object]"; + }; +} else if (ENVIRONMENT_IS_SHELL) { + if (typeof process == "object" && typeof require === "function" || typeof window == "object" || typeof importScripts == "function") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + if (typeof read != "undefined") { + read_ = function shell_read(f) { + return read(f); + }; + } + readBinary = function readBinary(f) { + let data; + if (typeof readbuffer == "function") { + return new Uint8Array(readbuffer(f)); + } + data = read(f, "binary"); + assert(typeof data == "object"); + return data; + }; + readAsync = function readAsync(f, onload, onerror) { + setTimeout(() => onload(readBinary(f)), 0); + }; + if (typeof scriptArgs != "undefined") { + arguments_ = scriptArgs; + } else if (typeof arguments != "undefined") { + arguments_ = arguments; + } + if (typeof quit == "function") { + quit_ = ((status, toThrow) => { + logExceptionOnExit(toThrow); + quit(status); + }); + } + if (typeof print != "undefined") { + if (typeof console == "undefined") console = {}; + console.log = print; + console.warn = console.error = typeof printErr != "undefined" ? printErr : print; + } +} else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + if (_scriptDir) { + scriptDirectory = _scriptDir; + } + if (scriptDirectory.indexOf("blob:") !== 0) { + scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1); + } else { + scriptDirectory = ""; + } + if (!(typeof window == "object" || typeof importScripts == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + { + read_ = (url => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.send(null); + return xhr.responseText; + }); + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(xhr.response); + }); + } + readAsync = ((url, onload, onerror) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = (() => { + if (xhr.status == 200 || xhr.status == 0 && xhr.response) { + onload(xhr.response); + return; + } + onerror(); + }); + xhr.onerror = onerror; + xhr.send(null); + }); + } + setWindowTitle = (title => document.title = title); +} else { + throw new Error("environment detection error"); +} + + + Module['print'] = function (message) { + if (islib32) { + + + // Regex to get name function + if (sectionasm32 === 1){ + const name_function = message.match(/^([0-9a-f]{8})\s+<(.+?)>:$/); + if (name_function && !libtags32.includes(name_function[2])) + libtags32.push(name_function[2]); + } + + // Check which section + if (message.search(".text") != -1) + sectionasm32 = 1; + if (message.search(".data") != -1) + sectionasm32 = 2; + if (message.search(".riscv.attributes") != -1) + sectionasm32 = 0; + + + + console.log(message); + + } else { + + // console.log(typeof message); + + // console.log("En que seccion estoy: ", sectionasm32); + var auxinsn = []; + const auxiliar = message.trim(); + const datamatch = auxiliar.match(/^([0-9a-fA-F]+):\s+((?:[0-9a-fA-F]{2,8}(?:\s+[0-9a-fA-F]{2,8})*))(?:.*?0x([0-9a-fA-F]+))?/); // /^([0-9a-fA-F]+):.*?0x([0-9a-fA-F]+)/ + const insnmatch = auxiliar.match(/^(\w+):\s+((?:fnmadd\.s|\w+|\.\w+))\s+([^\#]*)(?:#(.*))?$/); // /^(\w+):\s+(\w+)\s+([^\#]*)(?:#(.*))?$/ + const labelmatch = auxiliar.match(/^([0-9a-f]{8})\s+<(.+?)>:$/); + if (insnmatch !== null && sectionasm32 === 1) { + const address = insnmatch[1].trim(); // Parte 1: dirección + const hexInstruction = insnmatch[2].trim(); // Parte 2: instrucción hexadecimal + const asmInstruction = (insnmatch[3].trim()).replace(/\\t/g, ' '); // Parte 3: instrucción ensamblador (sin el comentario) + // const comment = match[4] ? insnmatchmatch[4].trim() : null; // Parte 4: comentario (opcional) + let axx = dumptextinstructions32.findIndex(sublist => sublist.includes(address)); + if (axx != -1 && sectionasm32 === 1) { + dumptextinstructions32[axx][1] = hexInstruction; + dumptextinstructions32[axx][2] = asmInstruction.replace(/\\t/g, ' '); + } + else if (sectionasm32 === 1){ + auxinsn.push(address); + auxinsn.push(hexInstruction); + auxinsn.push(asmInstruction.replace(/\\t/g, ' ')); + auxinsn.push(0); + auxinsn.push(""); + dumptextinstructions32.push(auxinsn); + } + } + else if (datamatch !== null && sectionasm32 === 2){ + let axx = dumpdatainstructions32.findIndex(sublist => sublist.includes(datamatch[1])); + if (axx !== -1 && sectionasm32 === 2) { + dumpdatainstructions32[axx][1] = datamatch[2]; + dumpdatainstructions32[axx][2] = ""; // asmInstruction.replace(/\\t/g, ' '); + } + else if (sectionasm32 === 2) { + auxinsn.push(datamatch[1]); + auxinsn.push(datamatch[2]); + auxinsn.push(""/*asmInstruction.replace(/\\t/g, ' ')*/); + auxinsn.push(0); + auxinsn.push(""); + if(auxinsn[3] === 0){ + // console.log("Exaa que se va a insertar en un dumpdata anterior: ", auxinsn); + // console.log("Que es esto: ", /[^0-9a-fA-F]/.test(auxinsn[1])); + if(/[^0-9a-fA-F]/.test(auxinsn[1])/* auxinsn[1].includes("madd.s")*/){ + //buscamos la palabra completa almacenada por el list_data_instructions + var auxda = list_data_instructions.findIndex(data => data.label === dumpdatainstructions32[dumpdatainstructions32.length -1][4]); + var list_data_elem; + var aux_index_value = list_data_instructions[auxda].value.length; + if (typeof list_data_instructions[auxda].value === "object"){ + if (list_data_instructions[auxda].value[aux_index_value - 1].includes("-")){ + // caso de ser el valor negativo + let buff, buff_view; + switch (list_data_instructions[auxda].type){ + case "half": + list_data_elem = (parseInt(list_data_instructions[auxda].value[aux_index_value - 1]) & 0xFFFF).toString(16).padStart(4, "0"); + break; + case "word": + list_data_elem = (parseInt(list_data_instructions[auxda].value[aux_index_value - 1]) >>> 0).toString(16).padStart(8, "0"); + break; + case "byte": + list_data_elem = (parseInt(list_data_instructions[auxda].value[aux_index_value - 1]) & 0xFF).toString(16).padStart(2, "0"); + break; + case "float": + buff = new ArrayBuffer(4); + buff_view = new DataView(buff); + buff_view.setFloat32(0, parseFloat(list_data_instructions[auxda].value[aux_index_value - 1]), true); + list_data_elem = buff_view.getUint32(0, true).toString(16).padStart(8, '0'); + + // list_data_elem = (parseFloat(list_data_instructions[auxda].value[aux_index_value - 1])).toString(16); + break; + case "double": + buff = new ArrayBuffer(8); + buff_view = new DataView(buff); + buff_view.setFloat64(0, parseFloat(list_data_instructions[auxda].value[aux_index_value - 1]), true); + let lo = buff_view.getUint32(0, true).toString(16).padStart(8, '0'); + let hi = buff_view.getUint32(4, true).toString(16).padStart(8, '0'); + + list_data_elem = lo + hi; + break; + } + dumpdatainstructions32[dumpdatainstructions32.length - 1][1] = list_data_elem + dumpdatainstructions32[dumpdatainstructions32.length -1][1]; + }else { // Caso de ser el valor positivo o sin signo + dumpdatainstructions32[dumpdatainstructions32.length -1][1] = list_data_instructions[auxda].value[aux_index_value - 1].toString(16) + dumpdatainstructions32[dumpdatainstructions32.length -1][1]; + } + } + } + else dumpdatainstructions32[dumpdatainstructions32.length -1][1] = auxinsn[1] + dumpdatainstructions32[dumpdatainstructions32.length -1][1]; + inside_label32 += 1; + }else + dumpdatainstructions32.push(auxinsn); + } + } + else if(labelmatch && sectionasm32 != 0){ + // console.log("Identificado:", labelmatch); + auxinsn.push(labelmatch[1].trim()); + auxinsn.push(""); + auxinsn.push(""); + auxinsn.push(1); + auxinsn.push(labelmatch[2].trim()); + console.log("labelmatch: ", labelmatch); + if (!document.app.$data.c_kernel && labelmatch[2].trim().includes("kernel")) + document.app.$data.entry_elf = labelmatch[1].trim(); + else if(labelmatch[2].trim() === "_main" && document.app.$data.c_kernel){ + document.app.$data.entry_elf = labelmatch[1].trim(); + } + + if (document.app.$data.entry_elf !== undefined && !document.app.$data.entry_elf.startsWith("0x")) + document.app.$data.entry_elf = "0x" + document.app.$data.entry_elf; + + if (sectionasm32 === 1){ + dumptextinstructions32.push(auxinsn); + }else if (sectionasm32 === 2){ + dumpdatainstructions32.push(auxinsn); + inside_label32 = 0; + } + + } + + // else { + // // console.log("objdump: 1", message); + // } + + // identificacion de que seccion de codigo entramos. + if (message.search(".text") != -1) + sectionasm32 = 1; + if (message.search(".data") != -1) + sectionasm32 = 2; + if (message.search(".riscv.attributes") != -1) + sectionasm32 = 0; + + console.log(message); + // console.log(dumpdatainstructions32); + } + } + + var out = Module["print"] || console.log.bind(console); + + var err = Module["printErr"] || console.warn.bind(console); + +Object.assign(Module, moduleOverrides); + +moduleOverrides = null; + +if (Module["arguments"]) arguments_ = Module["arguments"]; + +if (!Object.getOwnPropertyDescriptor(Module, "arguments")) { + Object.defineProperty(Module, "arguments", { + configurable: true, + get: function() { + abort("Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + +if (!Object.getOwnPropertyDescriptor(Module, "thisProgram")) { + Object.defineProperty(Module, "thisProgram", { + configurable: true, + get: function() { + abort("Module.thisProgram has been replaced with plain thisProgram (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (Module["quit"]) quit_ = Module["quit"]; + +if (!Object.getOwnPropertyDescriptor(Module, "quit")) { + Object.defineProperty(Module, "quit", { + configurable: true, + get: function() { + abort("Module.quit has been replaced with plain quit_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["cdInitializerPrefixURL"] == "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["filePackagePrefixURL"] == "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["read"] == "undefined", "Module.read option was removed (modify read_ in JS)"); + +assert(typeof Module["readAsync"] == "undefined", "Module.readAsync option was removed (modify readAsync in JS)"); + +assert(typeof Module["readBinary"] == "undefined", "Module.readBinary option was removed (modify readBinary in JS)"); + +assert(typeof Module["setWindowTitle"] == "undefined", "Module.setWindowTitle option was removed (modify setWindowTitle in JS)"); + +assert(typeof Module["TOTAL_MEMORY"] == "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"); + +if (!Object.getOwnPropertyDescriptor(Module, "read")) { + Object.defineProperty(Module, "read", { + configurable: true, + get: function() { + abort("Module.read has been replaced with plain read_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "readAsync")) { + Object.defineProperty(Module, "readAsync", { + configurable: true, + get: function() { + abort("Module.readAsync has been replaced with plain readAsync (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "readBinary")) { + Object.defineProperty(Module, "readBinary", { + configurable: true, + get: function() { + abort("Module.readBinary has been replaced with plain readBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "setWindowTitle")) { + Object.defineProperty(Module, "setWindowTitle", { + configurable: true, + get: function() { + abort("Module.setWindowTitle has been replaced with plain setWindowTitle (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js"; + +var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js"; + +var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js"; + +var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js"; + +assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add 'shell' to `-s ENVIRONMENT` to enable."); + +var STACK_ALIGN = 16; + +var POINTER_SIZE = 4; + +function getNativeTypeSize(type) { + switch (type) { + case "i1": + case "i8": + return 1; + + case "i16": + return 2; + + case "i32": + return 4; + + case "i64": + return 8; + + case "float": + return 4; + + case "double": + return 8; + + default: + { + if (type[type.length - 1] === "*") { + return POINTER_SIZE; + } else if (type[0] === "i") { + const bits = Number(type.substr(1)); + assert(bits % 8 === 0, "getNativeTypeSize invalid bits " + bits + ", type " + type); + return bits / 8; + } else { + return 0; + } + } + } +} + +function warnOnce(text) { + if (!warnOnce.shown) warnOnce.shown = {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + err(text); + } +} + +function convertJsFunctionToWasm(func, sig) { + if (typeof WebAssembly.Function == "function") { + var typeNames = { + "i": "i32", + "j": "i64", + "f": "f32", + "d": "f64" + }; + var type = { + parameters: [], + results: sig[0] == "v" ? [] : [ typeNames[sig[0]] ] + }; + for (var i = 1; i < sig.length; ++i) { + type.parameters.push(typeNames[sig[i]]); + } + return new WebAssembly.Function(type, func); + } + var typeSection = [ 1, 0, 1, 96 ]; + var sigRet = sig.slice(0, 1); + var sigParam = sig.slice(1); + var typeCodes = { + "i": 127, + "j": 126, + "f": 125, + "d": 124 + }; + typeSection.push(sigParam.length); + for (var i = 0; i < sigParam.length; ++i) { + typeSection.push(typeCodes[sigParam[i]]); + } + if (sigRet == "v") { + typeSection.push(0); + } else { + typeSection = typeSection.concat([ 1, typeCodes[sigRet] ]); + } + typeSection[1] = typeSection.length - 2; + var bytes = new Uint8Array([ 0, 97, 115, 109, 1, 0, 0, 0 ].concat(typeSection, [ 2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0 ])); + var module = new WebAssembly.Module(bytes); + var instance = new WebAssembly.Instance(module, { + "e": { + "f": func + } + }); + var wrappedFunc = instance.exports["f"]; + return wrappedFunc; +} + +var freeTableIndexes = []; + +var functionsInTableMap; + +function getEmptyTableSlot() { + if (freeTableIndexes.length) { + return freeTableIndexes.pop(); + } + try { + wasmTable.grow(1); + } catch (err) { + if (!(err instanceof RangeError)) { + throw err; + } + throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."; + } + return wasmTable.length - 1; +} + +function updateTableMap(offset, count) { + for (var i = offset; i < offset + count; i++) { + var item = getWasmTableEntry(i); + if (item) { + functionsInTableMap.set(item, i); + } + } +} + +function addFunction(func, sig) { + assert(typeof func != "undefined"); + if (!functionsInTableMap) { + functionsInTableMap = new WeakMap(); + updateTableMap(0, wasmTable.length); + } + if (functionsInTableMap.has(func)) { + return functionsInTableMap.get(func); + } + var ret = getEmptyTableSlot(); + try { + setWasmTableEntry(ret, func); + } catch (err) { + if (!(err instanceof TypeError)) { + throw err; + } + assert(typeof sig != "undefined", "Missing signature argument to addFunction: " + func); + var wrapped = convertJsFunctionToWasm(func, sig); + setWasmTableEntry(ret, wrapped); + } + functionsInTableMap.set(func, ret); + return ret; +} + +function removeFunction(index) { + functionsInTableMap.delete(getWasmTableEntry(index)); + freeTableIndexes.push(index); +} + +var tempRet0 = 0; + +var setTempRet0 = value => { + tempRet0 = value; +}; + +var getTempRet0 = () => tempRet0; + +var wasmBinary; + +if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"]; + +if (!Object.getOwnPropertyDescriptor(Module, "wasmBinary")) { + Object.defineProperty(Module, "wasmBinary", { + configurable: true, + get: function() { + abort("Module.wasmBinary has been replaced with plain wasmBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +var noExitRuntime = Module["noExitRuntime"] || false; + +if (!Object.getOwnPropertyDescriptor(Module, "noExitRuntime")) { + Object.defineProperty(Module, "noExitRuntime", { + configurable: true, + get: function() { + abort("Module.noExitRuntime has been replaced with plain noExitRuntime (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (typeof WebAssembly != "object") { + abort("no native wasm support detected"); +} + +function setValue(ptr, value, type = "i8", noSafe) { + if (type.charAt(type.length - 1) === "*") type = "i32"; + if (noSafe) { + switch (type) { + case "i1": + HEAP8[ptr >> 0] = value; + break; + + case "i8": + HEAP8[ptr >> 0] = value; + break; + + case "i16": + HEAP16[ptr >> 1] = value; + break; + + case "i32": + HEAP32[ptr >> 2] = value; + break; + + case "i64": + tempI64 = [ value >>> 0, (tempDouble = value, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + HEAP32[ptr >> 2] = tempI64[0], HEAP32[ptr + 4 >> 2] = tempI64[1]; + break; + + case "float": + HEAPF32[ptr >> 2] = value; + break; + + case "double": + HEAPF64[ptr >> 3] = value; + break; + + default: + abort("invalid type for setValue: " + type); + } + } else { + switch (type) { + case "i1": + SAFE_HEAP_STORE(ptr | 0, value | 0, 1); + break; + + case "i8": + SAFE_HEAP_STORE(ptr | 0, value | 0, 1); + break; + + case "i16": + SAFE_HEAP_STORE(ptr | 0, value | 0, 2); + break; + + case "i32": + SAFE_HEAP_STORE(ptr | 0, value | 0, 4); + break; + + case "i64": + tempI64 = [ value >>> 0, (tempDouble = value, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(ptr | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(ptr + 4 | 0, tempI64[1] | 0, 4); + break; + + case "float": + SAFE_HEAP_STORE_D(ptr | 0, Math.fround(value), 4); + break; + + case "double": + SAFE_HEAP_STORE_D(ptr | 0, +value, 8); + break; + + default: + abort("invalid type for setValue: " + type); + } + } +} + +function getValue(ptr, type = "i8", noSafe) { + if (type.charAt(type.length - 1) === "*") type = "i32"; + if (noSafe) { + switch (type) { + case "i1": + return HEAP8[ptr >> 0]; + + case "i8": + return HEAP8[ptr >> 0]; + + case "i16": + return HEAP16[ptr >> 1]; + + case "i32": + return HEAP32[ptr >> 2]; + + case "i64": + return HEAP32[ptr >> 2]; + + case "float": + return HEAPF32[ptr >> 2]; + + case "double": + return Number(HEAPF64[ptr >> 3]); + + default: + abort("invalid type for getValue: " + type); + } + } else { + switch (type) { + case "i1": + return SAFE_HEAP_LOAD(ptr | 0, 1, 0) | 0; + + case "i8": + return SAFE_HEAP_LOAD(ptr | 0, 1, 0) | 0; + + case "i16": + return SAFE_HEAP_LOAD(ptr | 0, 2, 0) | 0; + + case "i32": + return SAFE_HEAP_LOAD(ptr | 0, 4, 0) | 0; + + case "i64": + return SAFE_HEAP_LOAD(ptr | 0, 8, 0) | 0; + + case "float": + return Math.fround(SAFE_HEAP_LOAD_D(ptr | 0, 4, 0)); + + case "double": + return +SAFE_HEAP_LOAD_D(ptr | 0, 8, 0); + + default: + abort("invalid type for getValue: " + type); + } + } + return null; +} + +function getSafeHeapType(bytes, isFloat) { + switch (bytes) { + case 1: + return "i8"; + + case 2: + return "i16"; + + case 4: + return isFloat ? "float" : "i32"; + + case 8: + return isFloat ? "double" : "i64"; + + default: + assert(0); + } +} + +function SAFE_HEAP_STORE(dest, value, bytes, isFloat) { + if (dest <= 0) abort("segmentation fault storing " + bytes + " bytes to address " + dest); + if (dest % bytes !== 0) abort("alignment error storing to address " + dest + ", which was expected to be aligned to a multiple of " + bytes); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk() >>> 0; + if (dest + bytes > brk) abort("segmentation fault, exceeded the top of the available dynamic heap when storing " + bytes + " bytes to address " + dest + ". DYNAMICTOP=" + brk); + assert(brk >= _emscripten_stack_get_base()); + assert(brk <= HEAP8.length); + } + setValue(dest, value, getSafeHeapType(bytes, isFloat), 1); + return value; +} + +function SAFE_HEAP_STORE_D(dest, value, bytes) { + return SAFE_HEAP_STORE(dest, value, bytes, true); +} + +function SAFE_HEAP_LOAD(dest, bytes, unsigned, isFloat) { + if (dest <= 0) abort("segmentation fault loading " + bytes + " bytes from address " + dest); + if (dest % bytes !== 0) abort("alignment error loading from address " + dest + ", which was expected to be aligned to a multiple of " + bytes); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk() >>> 0; + if (dest + bytes > brk) abort("segmentation fault, exceeded the top of the available dynamic heap when loading " + bytes + " bytes from address " + dest + ". DYNAMICTOP=" + brk); + assert(brk >= _emscripten_stack_get_base()); + assert(brk <= HEAP8.length); + } + var type = getSafeHeapType(bytes, isFloat); + var ret = getValue(dest, type, 1); + if (unsigned) ret = unSign(ret, parseInt(type.substr(1), 10)); + return ret; +} + +function SAFE_HEAP_LOAD_D(dest, bytes, unsigned) { + return SAFE_HEAP_LOAD(dest, bytes, unsigned, true); +} + +function SAFE_FT_MASK(value, mask) { + var ret = value & mask; + if (ret !== value) { + abort("Function table mask error: function pointer is " + value + " which is masked by " + mask + ", the likely cause of this is that the function pointer is being called by the wrong type."); + } + return ret; +} + +function segfault() { + abort("segmentation fault"); +} + +function alignfault() { + abort("alignment fault"); +} + +var wasmMemory; + +var ABORT = false; + +var EXITSTATUS; + +function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } +} + +function getCFunc(ident) { + var func = Module["_" + ident]; + assert(func, "Cannot call unknown function " + ident + ", make sure it is exported"); + return func; +} + +function ccall(ident, returnType, argTypes, args, opts) { + var toC = { + "string": function(str) { + var ret = 0; + if (str !== null && str !== undefined && str !== 0) { + var len = (str.length << 2) + 1; + ret = stackAlloc(len); + stringToUTF8(str, ret, len); + } + return ret; + }, + "array": function(arr) { + var ret = stackAlloc(arr.length); + writeArrayToMemory(arr, ret); + return ret; + } + }; + function convertReturnValue(ret) { + if (returnType === "string") return UTF8ToString(ret); + if (returnType === "boolean") return Boolean(ret); + return ret; + } + var func = getCFunc(ident); + var cArgs = []; + var stack = 0; + assert(returnType !== "array", 'Return type should not be "array".'); + if (args) { + for (var i = 0; i < args.length; i++) { + var converter = toC[argTypes[i]]; + if (converter) { + if (stack === 0) stack = stackSave(); + cArgs[i] = converter(args[i]); + } else { + cArgs[i] = args[i]; + } + } + } + var ret = func.apply(null, cArgs); + function onDone(ret) { + if (stack !== 0) stackRestore(stack); + return convertReturnValue(ret); + } + ret = onDone(ret); + return ret; +} + +function cwrap(ident, returnType, argTypes, opts) { + return function() { + return ccall(ident, returnType, argTypes, arguments, opts); + }; +} + +var ALLOC_NORMAL = 0; + +var ALLOC_STACK = 1; + +function allocate(slab, allocator) { + var ret; + assert(typeof allocator == "number", "allocate no longer takes a type argument"); + assert(typeof slab != "number", "allocate no longer takes a number as arg0"); + if (allocator == ALLOC_STACK) { + ret = stackAlloc(slab.length); + } else { + ret = _malloc(slab.length); + } + if (!slab.subarray && !slab.slice) { + slab = new Uint8Array(slab); + } + HEAPU8.set(slab, ret); + return ret; +} + +var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : undefined; + +function UTF8ArrayToString(heap, idx, maxBytesToRead) { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + while (heap[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heap.subarray && UTF8Decoder) { + return UTF8Decoder.decode(heap.subarray(idx, endPtr)); + } else { + var str = ""; + while (idx < endPtr) { + var u0 = heap[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heap[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode((u0 & 31) << 6 | u1); + continue; + } + var u2 = heap[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = (u0 & 15) << 12 | u1 << 6 | u2; + } else { + if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte 0x" + u0.toString(16) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"); + u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heap[idx++] & 63; + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); + } + } + } + return str; +} + +function UTF8ToString(ptr, maxBytesToRead) { + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; +} + +function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) { + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = 65536 + ((u & 1023) << 10) | u1 & 1023; + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | u >> 6; + heap[outIdx++] = 128 | u & 63; + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | u >> 12; + heap[outIdx++] = 128 | u >> 6 & 63; + heap[outIdx++] = 128 | u & 63; + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) warnOnce("Invalid Unicode code point 0x" + u.toString(16) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."); + heap[outIdx++] = 240 | u >> 18; + heap[outIdx++] = 128 | u >> 12 & 63; + heap[outIdx++] = 128 | u >> 6 & 63; + heap[outIdx++] = 128 | u & 63; + } + } + heap[outIdx] = 0; + return outIdx - startIdx; +} + +function stringToUTF8(str, outPtr, maxBytesToWrite) { + assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); +} + +function lengthBytesUTF8(str) { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) u = 65536 + ((u & 1023) << 10) | str.charCodeAt(++i) & 1023; + if (u <= 127) ++len; else if (u <= 2047) len += 2; else if (u <= 65535) len += 3; else len += 4; + } + return len; +} + +function AsciiToString(ptr) { + var str = ""; + while (1) { + var ch = SAFE_HEAP_LOAD(ptr++ | 0, 1, 1) >>> 0; + if (!ch) return str; + str += String.fromCharCode(ch); + } +} + +function stringToAscii(str, outPtr) { + return writeAsciiToMemory(str, outPtr, false); +} + +var UTF16Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf-16le") : undefined; + +function UTF16ToString(ptr, maxBytesToRead) { + assert(ptr % 2 == 0, "Pointer passed to UTF16ToString must be aligned to two bytes!"); + var endPtr = ptr; + var idx = endPtr >> 1; + var maxIdx = idx + maxBytesToRead / 2; + while (!(idx >= maxIdx) && SAFE_HEAP_LOAD(idx * 2, 2, 1)) ++idx; + endPtr = idx << 1; + if (endPtr - ptr > 32 && UTF16Decoder) { + return UTF16Decoder.decode(HEAPU8.subarray(ptr, endPtr)); + } else { + var str = ""; + for (var i = 0; !(i >= maxBytesToRead / 2); ++i) { + var codeUnit = SAFE_HEAP_LOAD(ptr + i * 2 | 0, 2, 0) | 0; + if (codeUnit == 0) break; + str += String.fromCharCode(codeUnit); + } + return str; + } +} + +function stringToUTF16(str, outPtr, maxBytesToWrite) { + assert(outPtr % 2 == 0, "Pointer passed to stringToUTF16 must be aligned to two bytes!"); + assert(typeof maxBytesToWrite == "number", "stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 2) return 0; + maxBytesToWrite -= 2; + var startPtr = outPtr; + var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length; + for (var i = 0; i < numCharsToWrite; ++i) { + var codeUnit = str.charCodeAt(i); + SAFE_HEAP_STORE(outPtr | 0, codeUnit | 0, 2); + outPtr += 2; + } + SAFE_HEAP_STORE(outPtr | 0, 0 | 0, 2); + return outPtr - startPtr; +} + +function lengthBytesUTF16(str) { + return str.length * 2; +} + +function UTF32ToString(ptr, maxBytesToRead) { + assert(ptr % 4 == 0, "Pointer passed to UTF32ToString must be aligned to four bytes!"); + var i = 0; + var str = ""; + while (!(i >= maxBytesToRead / 4)) { + var utf32 = SAFE_HEAP_LOAD(ptr + i * 4 | 0, 4, 0) | 0; + if (utf32 == 0) break; + ++i; + if (utf32 >= 65536) { + var ch = utf32 - 65536; + str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); + } else { + str += String.fromCharCode(utf32); + } + } + return str; +} + +function stringToUTF32(str, outPtr, maxBytesToWrite) { + assert(outPtr % 4 == 0, "Pointer passed to stringToUTF32 must be aligned to four bytes!"); + assert(typeof maxBytesToWrite == "number", "stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 4) return 0; + var startPtr = outPtr; + var endPtr = startPtr + maxBytesToWrite - 4; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) { + var trailSurrogate = str.charCodeAt(++i); + codeUnit = 65536 + ((codeUnit & 1023) << 10) | trailSurrogate & 1023; + } + SAFE_HEAP_STORE(outPtr | 0, codeUnit | 0, 4); + outPtr += 4; + if (outPtr + 4 > endPtr) break; + } + SAFE_HEAP_STORE(outPtr | 0, 0 | 0, 4); + return outPtr - startPtr; +} + +function lengthBytesUTF32(str) { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) ++i; + len += 4; + } + return len; +} + +function allocateUTF8(str) { + var size = lengthBytesUTF8(str) + 1; + var ret = _malloc(size); + if (ret) stringToUTF8Array(str, HEAP8, ret, size); + return ret; +} + +function allocateUTF8OnStack(str) { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8Array(str, HEAP8, ret, size); + return ret; +} + +function writeStringToMemory(string, buffer, dontAddNull) { + warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!"); + var lastChar, end; + if (dontAddNull) { + end = buffer + lengthBytesUTF8(string); + lastChar = SAFE_HEAP_LOAD(end, 1, 0); + } + stringToUTF8(string, buffer, Infinity); + if (dontAddNull) SAFE_HEAP_STORE(end, lastChar, 1); +} + +function writeArrayToMemory(array, buffer) { + assert(array.length >= 0, "writeArrayToMemory array must have a length (should be an array or typed array)"); + HEAP8.set(array, buffer); +} + +function writeAsciiToMemory(str, buffer, dontAddNull) { + for (var i = 0; i < str.length; ++i) { + assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255)); + SAFE_HEAP_STORE(buffer++ | 0, str.charCodeAt(i) | 0, 1); + } + if (!dontAddNull) SAFE_HEAP_STORE(buffer | 0, 0 | 0, 1); +} + +function alignUp(x, multiple) { + if (x % multiple > 0) { + x += multiple - x % multiple; + } + return x; +} + +var HEAP, buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; + +function updateGlobalBufferAndViews(buf) { + buffer = buf; + Module["HEAP8"] = HEAP8 = new Int8Array(buf); + Module["HEAP16"] = HEAP16 = new Int16Array(buf); + Module["HEAP32"] = HEAP32 = new Int32Array(buf); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf); + Module["HEAPF32"] = HEAPF32 = new Float32Array(buf); + Module["HEAPF64"] = HEAPF64 = new Float64Array(buf); +} + +var TOTAL_STACK = 5242880; + +if (Module["TOTAL_STACK"]) assert(TOTAL_STACK === Module["TOTAL_STACK"], "the stack size can no longer be determined at runtime"); + +var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216; + +if (!Object.getOwnPropertyDescriptor(Module, "INITIAL_MEMORY")) { + Object.defineProperty(Module, "INITIAL_MEMORY", { + configurable: true, + get: function() { + abort("Module.INITIAL_MEMORY has been replaced with plain INITIAL_MEMORY (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +assert(INITIAL_MEMORY >= TOTAL_STACK, "INITIAL_MEMORY should be larger than TOTAL_STACK, was " + INITIAL_MEMORY + "! (TOTAL_STACK=" + TOTAL_STACK + ")"); + +assert(typeof Int32Array != "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, "JS engine does not provide full typed array support"); + +assert(!Module["wasmMemory"], "Use of `wasmMemory` detected. Use -s IMPORTED_MEMORY to define wasmMemory externally"); + +assert(INITIAL_MEMORY == 16777216, "Detected runtime INITIAL_MEMORY setting. Use -s IMPORTED_MEMORY to define wasmMemory dynamically"); + +var wasmTable; + +function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + SAFE_HEAP_STORE(max + 4 | 0, 34821223 | 0, 4); + SAFE_HEAP_STORE(max + 8 | 0, 2310721022 | 0, 4); +} + +function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + var cookie1 = SAFE_HEAP_LOAD(max + 4 | 0, 4, 1) >>> 0; + var cookie2 = SAFE_HEAP_LOAD(max + 8 | 0, 4, 1) >>> 0; + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x" + cookie2.toString(16) + " 0x" + cookie1.toString(16)); + } +} + +(function() { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -s SUPPORT_BIG_ENDIAN=1 to bypass)"; +})(); + +var __ATPRERUN__ = []; + +var __ATINIT__ = []; + +var __ATMAIN__ = []; + +var __ATEXIT__ = []; + +var __ATPOSTRUN__ = []; + +var runtimeInitialized = false; + +var runtimeExited = false; + +var runtimeKeepaliveCounter = 0; + +function keepRuntimeAlive() { + return noExitRuntime || runtimeKeepaliveCounter > 0; +} + +function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); +} + +function initRuntime() { + checkStackCookie(); + assert(!runtimeInitialized); + runtimeInitialized = true; + if (!Module["noFSInit"] && !FS.init.initialized) FS.init(); + FS.ignorePermissions = false; + TTY.init(); + callRuntimeCallbacks(__ATINIT__); +} + +function preMain() { + checkStackCookie(); + callRuntimeCallbacks(__ATMAIN__); +} + +function exitRuntime() { + checkStackCookie(); + ___funcs_on_exit(); + callRuntimeCallbacks(__ATEXIT__); + FS.quit(); + TTY.shutdown(); + runtimeExited = true; +} + +function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(__ATPOSTRUN__); +} + +function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); +} + +function addOnInit(cb) { + __ATINIT__.unshift(cb); +} + +function addOnPreMain(cb) { + __ATMAIN__.unshift(cb); +} + +function addOnExit(cb) { + __ATEXIT__.unshift(cb); +} + +function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); +} + +assert(Math.imul, "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.fround, "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.clz32, "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.trunc, "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +var runDependencies = 0; + +var runDependencyWatcher = null; + +var dependenciesFulfilled = null; + +var runDependencyTracking = {}; + +function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } +} + +function addRunDependency(id) { + runDependencies++; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if (runDependencyWatcher === null && typeof setInterval != "undefined") { + runDependencyWatcher = setInterval(function() { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err("dependency: " + dep); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } +} + +function removeRunDependency(id) { + runDependencies--; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } +} + +Module["preloadedImages"] = {}; + +Module["preloadedAudios"] = {}; + +function abort(what) { + { + if (Module["onAbort"]) { + Module["onAbort"](what); + } + } + what = "Aborted(" + what + ")"; + err(what); + ABORT = true; + EXITSTATUS = 1; + var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + throw e; +} + +var dataURIPrefix = "data:application/octet-stream;base64,"; + +function isDataURI(filename) { + return filename.startsWith(dataURIPrefix); +} + +function isFileURI(filename) { + return filename.startsWith("file://"); +} + +function createExportWrapper(name, fixedasm) { + return function() { + var displayName = name; + var asm = fixedasm; + if (!fixedasm) { + asm = Module["asm"]; + } + assert(runtimeInitialized, "native function `" + displayName + "` called before runtime initialization"); + assert(!runtimeExited, "native function `" + displayName + "` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)"); + if (!asm[name]) { + assert(asm[name], "exported native function `" + displayName + "` not found"); + } + return asm[name].apply(null, arguments); + }; +} + +var wasmBinaryFile; + +if (Module["locateFile"]) { + wasmBinaryFile = "objdump.wasm"; + if (!isDataURI(wasmBinaryFile)) { + wasmBinaryFile = locateFile(wasmBinaryFile); + } +} else { + wasmBinaryFile = new URL("objdump.wasm", import.meta.url).toString(); +} + +function getBinary(file) { + try { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } else { + throw "both async and sync fetching of the wasm failed"; + } + } catch (err) { + abort(err); + } +} + +function getBinaryPromise() { + if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) { + if (typeof fetch == "function" && !isFileURI(wasmBinaryFile)) { + return fetch(wasmBinaryFile, { + credentials: "same-origin" + }).then(function(response) { + if (!response["ok"]) { + throw "failed to load wasm binary file at '" + wasmBinaryFile + "'"; + } + return response["arrayBuffer"](); + }).catch(function() { + return getBinary(wasmBinaryFile); + }); + } else { + if (readAsync) { + return new Promise(function(resolve, reject) { + readAsync(wasmBinaryFile, function(response) { + resolve(new Uint8Array(response)); + }, reject); + }); + } + } + } + return Promise.resolve().then(function() { + return getBinary(wasmBinaryFile); + }); +} + +function createWasm() { + var info = { + "env": asmLibraryArg, + "wasi_snapshot_preview1": asmLibraryArg + }; + function receiveInstance(instance, module) { + var exports = instance.exports; + Module["asm"] = exports; + wasmMemory = Module["asm"]["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateGlobalBufferAndViews(wasmMemory.buffer); + wasmTable = Module["asm"]["__indirect_function_table"]; + assert(wasmTable, "table not found in wasm exports"); + addOnInit(Module["asm"]["__wasm_call_ctors"]); + removeRunDependency("wasm-instantiate"); + } + addRunDependency("wasm-instantiate"); + var trueModule = Module; + function receiveInstantiationResult(result) { + assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"); + trueModule = null; + receiveInstance(result["instance"]); + } + function instantiateArrayBuffer(receiver) { + return getBinaryPromise().then(function(binary) { + return WebAssembly.instantiate(binary, info); + }).then(function(instance) { + return instance; + }).then(receiver, function(reason) { + err("failed to asynchronously prepare wasm: " + reason); + if (isFileURI(wasmBinaryFile)) { + err("warning: Loading from a file URI (" + wasmBinaryFile + ") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing"); + } + abort(reason); + }); + } + function instantiateAsync() { + if (!wasmBinary && typeof WebAssembly.instantiateStreaming == "function" && !isDataURI(wasmBinaryFile) && !isFileURI(wasmBinaryFile) && typeof fetch == "function") { + return fetch(wasmBinaryFile, { + credentials: "same-origin" + }).then(function(response) { + var result = WebAssembly.instantiateStreaming(response, info); + return result.then(receiveInstantiationResult, function(reason) { + err("wasm streaming compile failed: " + reason); + err("falling back to ArrayBuffer instantiation"); + return instantiateArrayBuffer(receiveInstantiationResult); + }); + }); + } else { + return instantiateArrayBuffer(receiveInstantiationResult); + } + } + if (Module["instantiateWasm"]) { + try { + var exports = Module["instantiateWasm"](info, receiveInstance); + return exports; + } catch (e) { + err("Module.instantiateWasm callback failed with error: " + e); + return false; + } + } + instantiateAsync().catch(readyPromiseReject); + return {}; +} + +var tempDouble; + +var tempI64; + +var ASM_CONSTS = {}; + +function callRuntimeCallbacks(callbacks) { + while (callbacks.length > 0) { + var callback = callbacks.shift(); + if (typeof callback == "function") { + callback(Module); + continue; + } + var func = callback.func; + if (typeof func == "number") { + if (callback.arg === undefined) { + getWasmTableEntry(func)(); + } else { + getWasmTableEntry(func)(callback.arg); + } + } else { + func(callback.arg === undefined ? null : callback.arg); + } + } +} + +function withStackSave(f) { + var stack = stackSave(); + var ret = f(); + stackRestore(stack); + return ret; +} + +function demangle(func) { + warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"); + return func; +} + +function demangleAll(text) { + var regex = /\b_Z[\w\d_]+/g; + return text.replace(regex, function(x) { + var y = demangle(x); + return x === y ? x : y + " [" + x + "]"; + }); +} + +var wasmTableMirror = []; + +function getWasmTableEntry(funcPtr) { + var func = wasmTableMirror[funcPtr]; + if (!func) { + if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1; + wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr); + } + assert(wasmTable.get(funcPtr) == func, "JavaScript-side Wasm function table mirror is out of date!"); + return func; +} + +function handleException(e) { + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + quit_(1, e); +} + +function jsStackTrace() { + var error = new Error(); + if (!error.stack) { + try { + throw new Error(); + } catch (e) { + error = e; + } + if (!error.stack) { + return "(no stack trace available)"; + } + } + return error.stack.toString(); +} + +function setWasmTableEntry(idx, func) { + wasmTable.set(idx, func); + wasmTableMirror[idx] = func; +} + +function stackTrace() { + var js = jsStackTrace(); + if (Module["extraStackTrace"]) js += "\n" + Module["extraStackTrace"](); + return demangleAll(js); +} + +function unSign(value, bits) { + if (value >= 0) { + return value; + } + return bits <= 32 ? 2 * Math.abs(1 << bits - 1) + value : Math.pow(2, bits) + value; +} + +function ___assert_fail(condition, filename, line, func) { + abort("Assertion failed: " + UTF8ToString(condition) + ", at: " + [ filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function" ]); +} + +var _emscripten_get_now; + +if (ENVIRONMENT_IS_NODE) { + _emscripten_get_now = (() => { + var t = process["hrtime"](); + return t[0] * 1e3 + t[1] / 1e6; + }); +} else _emscripten_get_now = (() => performance.now()); + +var _emscripten_get_now_is_monotonic = true; + +function setErrNo(value) { + SAFE_HEAP_STORE(___errno_location() | 0, value | 0, 4); + return value; +} + +function _clock_gettime(clk_id, tp) { + var now; + if (clk_id === 0) { + now = Date.now(); + } else if ((clk_id === 1 || clk_id === 4) && _emscripten_get_now_is_monotonic) { + now = _emscripten_get_now(); + } else { + setErrNo(28); + return -1; + } + SAFE_HEAP_STORE(tp | 0, now / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(tp + 4 | 0, now % 1e3 * 1e3 * 1e3 | 0 | 0, 4); + return 0; +} + +function ___clock_gettime(a0, a1) { + return _clock_gettime(a0, a1); +} + +var PATH = { + splitPath: function(filename) { + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: function(parts, allowAboveRoot) { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (;up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: function(path) { + var isAbsolute = path.charAt(0) === "/", trailingSlash = path.substr(-1) === "/"; + path = PATH.normalizeArray(path.split("/").filter(function(p) { + return !!p; + }), !isAbsolute).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: function(path) { + var result = PATH.splitPath(path), root = result[0], dir = result[1]; + if (!root && !dir) { + return "."; + } + if (dir) { + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename: function(path) { + if (path === "/") return "/"; + path = PATH.normalize(path); + path = path.replace(/\/$/, ""); + var lastSlash = path.lastIndexOf("/"); + if (lastSlash === -1) return path; + return path.substr(lastSlash + 1); + }, + extname: function(path) { + return PATH.splitPath(path)[3]; + }, + join: function() { + var paths = Array.prototype.slice.call(arguments, 0); + return PATH.normalize(paths.join("/")); + }, + join2: function(l, r) { + return PATH.normalize(l + "/" + r); + } +}; + +function getRandomDevice() { + if (typeof crypto == "object" && typeof crypto["getRandomValues"] == "function") { + var randomBuffer = new Uint8Array(1); + return function() { + crypto.getRandomValues(randomBuffer); + return randomBuffer[0]; + }; + } else if (ENVIRONMENT_IS_NODE) { + try { + var crypto_module = require("crypto"); + return function() { + return crypto_module["randomBytes"](1)[0]; + }; + } catch (e) {} + } + return function() { + abort("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };"); + }; +} + +var PATH_FS = { + resolve: function() { + var resolvedPath = "", resolvedAbsolute = false; + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? arguments[i] : FS.cwd(); + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = path.charAt(0) === "/"; + } + resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter(function(p) { + return !!p; + }), !resolvedAbsolute).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; + }, + relative: function(from, to) { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (;start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (;end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + } +}; + +var TTY = { + ttys: [], + init: function() {}, + shutdown: function() {}, + register: function(dev, ops) { + TTY.ttys[dev] = { + input: [], + output: [], + ops: ops + }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open: function(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close: function(stream) { + stream.tty.ops.flush(stream.tty); + }, + flush: function(stream) { + stream.tty.ops.flush(stream.tty); + }, + read: function(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: function(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + } + }, + default_tty_ops: { + get_char: function(tty) { + if (!tty.input.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + try { + bytesRead = fs.readSync(process.stdin.fd, buf, 0, BUFSIZE, -1); + } catch (e) { + if (e.toString().includes("EOF")) bytesRead = 0; else throw e; + } + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString("utf-8"); + } else { + result = null; + } + } else if (typeof window != "undefined" && typeof window.prompt == "function") { + result = window.prompt("Input: "); + if (result !== null) { + result += "\n"; + } + } else if (typeof readline == "function") { + result = readline(); + if (result !== null) { + result += "\n"; + } + } + if (!result) { + return null; + } + tty.input = intArrayFromString(result, true); + } + return tty.input.shift(); + }, + put_char: function(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function(tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + } + }, + default_tty1_ops: { + put_char: function(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function(tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + } + } +}; + +function zeroMemory(address, size) { + HEAPU8.fill(0, address, address + size); +} + +function alignMemory(size, alignment) { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; +} + +function mmapAlloc(size) { + abort("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported"); +} + +var MEMFS = { + ops_table: null, + mount: function(mount) { + return MEMFS.createNode(null, "/", 16384 | 511, 0); + }, + createNode: function(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + if (!MEMFS.ops_table) { + MEMFS.ops_table = { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink + }, + stream: { + llseek: MEMFS.stream_ops.llseek + } + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync + } + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink + }, + stream: {} + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: FS.chrdev_stream_ops + } + }; + } + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray: function(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage: function(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max(newCapacity, prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125) >>> 0); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage: function(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes))); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr: function(node) { + var attr = {}; + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr: function(node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup: function(parent, name) { + throw FS.genericErrors[44]; + }, + mknod: function(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename: function(old_node, new_dir, new_name) { + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now(); + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + old_node.parent = new_dir; + }, + unlink: function(parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir: function(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir: function(node) { + var entries = [ ".", ".." ]; + for (var key in node.contents) { + if (!node.contents.hasOwnProperty(key)) { + continue; + } + entries.push(key); + } + return entries; + }, + symlink: function(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink: function(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + } + }, + stream_ops: { + read: function(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i]; + } + return size; + }, + write: function(stream, buffer, offset, length, position, canOwn) { + assert(!(buffer instanceof ArrayBuffer)); + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + assert(position === 0, "canOwn must imply no weird position inside the file"); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set(buffer.subarray(offset, offset + length), position); + return length; + } + } + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set(buffer.subarray(offset, offset + length), position); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek: function(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate: function(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length); + }, + mmap: function(stream, address, length, position, prot, flags) { + if (address !== 0) { + throw new FS.ErrnoError(28); + } + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + if (!(flags & 2) && contents.buffer === buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call(contents, position, position + length); + } + } + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + HEAP8.set(contents, ptr); + } + return { + ptr: ptr, + allocated: allocated + }; + }, + msync: function(stream, buffer, offset, length, mmapFlags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (mmapFlags & 2) { + return 0; + } + var bytesWritten = MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + return 0; + } + } +}; + +function asyncLoad(url, onload, onerror, noRunDep) { + var dep = !noRunDep ? getUniqueRunDependency("al " + url) : ""; + readAsync(url, function(arrayBuffer) { + assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).'); + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, function(event) { + if (onerror) { + onerror(); + } else { + throw 'Loading data file "' + url + '" failed.'; + } + }); + if (dep) addRunDependency(dep); +} + +var ERRNO_MESSAGES = { + 0: "Success", + 1: "Arg list too long", + 2: "Permission denied", + 3: "Address already in use", + 4: "Address not available", + 5: "Address family not supported by protocol family", + 6: "No more processes", + 7: "Socket already connected", + 8: "Bad file number", + 9: "Trying to read unreadable message", + 10: "Mount device busy", + 11: "Operation canceled", + 12: "No children", + 13: "Connection aborted", + 14: "Connection refused", + 15: "Connection reset by peer", + 16: "File locking deadlock error", + 17: "Destination address required", + 18: "Math arg out of domain of func", + 19: "Quota exceeded", + 20: "File exists", + 21: "Bad address", + 22: "File too large", + 23: "Host is unreachable", + 24: "Identifier removed", + 25: "Illegal byte sequence", + 26: "Connection already in progress", + 27: "Interrupted system call", + 28: "Invalid argument", + 29: "I/O error", + 30: "Socket is already connected", + 31: "Is a directory", + 32: "Too many symbolic links", + 33: "Too many open files", + 34: "Too many links", + 35: "Message too long", + 36: "Multihop attempted", + 37: "File or path name too long", + 38: "Network interface is not configured", + 39: "Connection reset by network", + 40: "Network is unreachable", + 41: "Too many open files in system", + 42: "No buffer space available", + 43: "No such device", + 44: "No such file or directory", + 45: "Exec format error", + 46: "No record locks available", + 47: "The link has been severed", + 48: "Not enough core", + 49: "No message of desired type", + 50: "Protocol not available", + 51: "No space left on device", + 52: "Function not implemented", + 53: "Socket is not connected", + 54: "Not a directory", + 55: "Directory not empty", + 56: "State not recoverable", + 57: "Socket operation on non-socket", + 59: "Not a typewriter", + 60: "No such device or address", + 61: "Value too large for defined data type", + 62: "Previous owner died", + 63: "Not super-user", + 64: "Broken pipe", + 65: "Protocol error", + 66: "Unknown protocol", + 67: "Protocol wrong type for socket", + 68: "Math result not representable", + 69: "Read only file system", + 70: "Illegal seek", + 71: "No such process", + 72: "Stale file handle", + 73: "Connection timed out", + 74: "Text file busy", + 75: "Cross-device link", + 100: "Device not a stream", + 101: "Bad font file fmt", + 102: "Invalid slot", + 103: "Invalid request code", + 104: "No anode", + 105: "Block device required", + 106: "Channel number out of range", + 107: "Level 3 halted", + 108: "Level 3 reset", + 109: "Link number out of range", + 110: "Protocol driver not attached", + 111: "No CSI structure available", + 112: "Level 2 halted", + 113: "Invalid exchange", + 114: "Invalid request descriptor", + 115: "Exchange full", + 116: "No data (for no delay io)", + 117: "Timer expired", + 118: "Out of streams resources", + 119: "Machine is not on the network", + 120: "Package not installed", + 121: "The object is remote", + 122: "Advertise error", + 123: "Srmount error", + 124: "Communication error on send", + 125: "Cross mount point (not really error)", + 126: "Given log. name not unique", + 127: "f.d. invalid for this operation", + 128: "Remote address changed", + 129: "Can access a needed shared lib", + 130: "Accessing a corrupted shared lib", + 131: ".lib section in a.out corrupted", + 132: "Attempting to link in too many libs", + 133: "Attempting to exec a shared library", + 135: "Streams pipe error", + 136: "Too many users", + 137: "Socket type not supported", + 138: "Not supported", + 139: "Protocol family not supported", + 140: "Can't send after socket shutdown", + 141: "Too many references", + 142: "Host is down", + 148: "No medium (in tape drive)", + 156: "Level 2 not synchronized" +}; + +var ERRNO_CODES = {}; + +var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: null, + genericErrors: {}, + filesystems: null, + syncFSRequests: 0, + lookupPath: (path, opts = {}) => { + path = PATH_FS.resolve(FS.cwd(), path); + if (!path) return { + path: "", + node: null + }; + var defaults = { + follow_mount: true, + recurse_count: 0 + }; + for (var key in defaults) { + if (opts[key] === undefined) { + opts[key] = defaults[key]; + } + } + if (opts.recurse_count > 8) { + throw new FS.ErrnoError(32); + } + var parts = PATH.normalizeArray(path.split("/").filter(p => !!p), false); + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + if (FS.isMountpoint(current)) { + if (!islast || islast && opts.follow_mount) { + current = current.mounted.root; + } + } + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve(PATH.dirname(current_path), link); + var lookup = FS.lookupPath(current_path, { + recurse_count: opts.recurse_count + }); + current = lookup.node; + if (count++ > 40) { + throw new FS.ErrnoError(32); + } + } + } + } + return { + path: current_path, + node: current + }; + }, + getPath: node => { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" ? mount + "/" + path : mount + path; + } + path = path ? node.name + "/" + path : node.name; + node = node.parent; + } + }, + hashName: (parentid, name) => { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = (hash << 5) - hash + name.charCodeAt(i) | 0; + } + return (parentid + hash >>> 0) % FS.nameTable.length; + }, + hashAddNode: node => { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode: node => { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode: (parent, name) => { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode, parent); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + return FS.lookup(parent, name); + }, + createNode: (parent, name, mode, rdev) => { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode: node => { + FS.hashRemoveNode(node); + }, + isRoot: node => { + return node === node.parent; + }, + isMountpoint: node => { + return !!node.mounted; + }, + isFile: mode => { + return (mode & 61440) === 32768; + }, + isDir: mode => { + return (mode & 61440) === 16384; + }, + isLink: mode => { + return (mode & 61440) === 40960; + }, + isChrdev: mode => { + return (mode & 61440) === 8192; + }, + isBlkdev: mode => { + return (mode & 61440) === 24576; + }, + isFIFO: mode => { + return (mode & 61440) === 4096; + }, + isSocket: mode => { + return (mode & 49152) === 49152; + }, + flagModes: { + "r": 0, + "r+": 2, + "w": 577, + "w+": 578, + "a": 1089, + "a+": 1090 + }, + modeStringToFlags: str => { + var flags = FS.flagModes[str]; + if (typeof flags == "undefined") { + throw new Error("Unknown file open mode: " + str); + } + return flags; + }, + flagsToPermissionString: flag => { + var perms = [ "r", "w", "rw" ][flag & 3]; + if (flag & 512) { + perms += "w"; + } + return perms; + }, + nodePermissions: (node, perms) => { + if (FS.ignorePermissions) { + return 0; + } + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup: dir => { + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate: (dir, name) => { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete: (dir, name, isdir) => { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen: (node, flags) => { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || flags & 512) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS: 4096, + nextfd: (fd_start = 0, fd_end = FS.MAX_OPEN_FDS) => { + for (var fd = fd_start; fd <= fd_end; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStream: fd => FS.streams[fd], + createStream: (stream, fd_start, fd_end) => { + if (!FS.FSStream) { + FS.FSStream = function() {}; + FS.FSStream.prototype = { + object: { + get: function() { + return this.node; + }, + set: function(val) { + this.node = val; + } + }, + isRead: { + get: function() { + return (this.flags & 2097155) !== 1; + } + }, + isWrite: { + get: function() { + return (this.flags & 2097155) !== 0; + } + }, + isAppend: { + get: function() { + return this.flags & 1024; + } + } + }; + } + stream = Object.assign(new FS.FSStream(), stream); + var fd = FS.nextfd(fd_start, fd_end); + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream: fd => { + FS.streams[fd] = null; + }, + chrdev_stream_ops: { + open: stream => { + var device = FS.getDevice(stream.node.rdev); + stream.stream_ops = device.stream_ops; + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + }, + llseek: () => { + throw new FS.ErrnoError(70); + } + }, + major: dev => dev >> 8, + minor: dev => dev & 255, + makedev: (ma, mi) => ma << 8 | mi, + registerDevice: (dev, ops) => { + FS.devices[dev] = { + stream_ops: ops + }; + }, + getDevice: dev => FS.devices[dev], + getMounts: mount => { + var mounts = []; + var check = [ mount ]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push.apply(check, m.mounts); + } + return mounts; + }, + syncfs: (populate, callback) => { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err("warning: " + FS.syncFSRequests + " FS.syncfs operations in flight at once, probably just doing extra work"); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + mounts.forEach(mount => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount: (type, opts, mountpoint) => { + if (typeof type == "string") { + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + mountpoint = lookup.path; + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type: type, + opts: opts, + mountpoint: mountpoint, + mounts: [] + }; + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount: mountpoint => { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach(hash => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + node.mounted = null; + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup: (parent, name) => { + return parent.node_ops.lookup(parent, name); + }, + mknod: (path, mode, dev) => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === "." || name === "..") { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create: (path, mode) => { + mode = mode !== undefined ? mode : 438; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir: (path, mode) => { + mode = mode !== undefined ? mode : 511; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree: (path, mode) => { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev: (path, mode, dev) => { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink: (oldpath, newpath) => { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename: (old_path, new_path) => { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + var lookup, old_dir, new_dir; + lookup = FS.lookupPath(old_path, { + parent: true + }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { + parent: true + }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + var old_node = FS.lookupNode(old_dir, old_name); + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (old_node === new_node) { + return; + } + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(old_node) || new_node && FS.isMountpoint(new_node)) { + throw new FS.ErrnoError(10); + } + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + FS.hashRemoveNode(old_node); + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir: path => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir: path => { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink: path => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink: path => { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve(FS.getPath(link.parent), link.node_ops.readlink(link)); + }, + stat: (path, dontFollow) => { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat: path => { + return FS.stat(path, true); + }, + chmod: (path, mode, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: mode & 4095 | node.mode & ~4095, + timestamp: Date.now() + }); + }, + lchmod: (path, mode) => { + FS.chmod(path, mode, true); + }, + fchmod: (fd, mode) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chmod(stream.node, mode); + }, + chown: (path, uid, gid, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + timestamp: Date.now() + }); + }, + lchown: (path, uid, gid) => { + FS.chown(path, uid, gid, true); + }, + fchown: (fd, uid, gid) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chown(stream.node, uid, gid); + }, + truncate: (path, len) => { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: true + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { + size: len, + timestamp: Date.now() + }); + }, + ftruncate: (fd, len) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime: (path, atime, mtime) => { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + node.node_ops.setattr(node, { + timestamp: Math.max(atime, mtime) + }); + }, + open: (path, flags, mode, fd_start, fd_end) => { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS.modeStringToFlags(flags) : flags; + mode = typeof mode == "undefined" ? 438 : mode; + if (flags & 64) { + mode = mode & 4095 | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == "object") { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072) + }); + node = lookup.node; + } catch (e) {} + } + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else { + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + if (flags & 512) { + FS.truncate(node, 0); + } + flags &= ~(128 | 512 | 131072); + var stream = FS.createStream({ + node: node, + path: FS.getPath(node), + flags: flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + ungotten: [], + error: false + }, fd_start, fd_end); + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!FS.readFiles) FS.readFiles = {}; + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close: stream => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed: stream => { + return stream.fd === null; + }, + llseek: (stream, offset, whence) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read: (stream, buffer, offset, length, position) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write: (stream, buffer, offset, length, position, canOwn) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate: (stream, offset, length) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap: (stream, address, length, position, prot, flags) => { + if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + return stream.stream_ops.mmap(stream, address, length, position, prot, flags); + }, + msync: (stream, buffer, offset, length, mmapFlags) => { + if (!stream || !stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags); + }, + munmap: stream => 0, + ioctl: (stream, cmd, arg) => { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile: (path, opts = {}) => { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error('Invalid encoding type "' + opts.encoding + '"'); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf, 0); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile: (path, data, opts = {}) => { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir: path => { + var lookup = FS.lookupPath(path, { + follow: true + }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories: () => { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices: () => { + FS.mkdir("/dev"); + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + var random_device = getRandomDevice(); + FS.createDevice("/dev", "random", random_device); + FS.createDevice("/dev", "urandom", random_device); + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories: () => { + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount({ + mount: () => { + var node = FS.createNode(proc_self, "fd", 16384 | 511, 73); + node.node_ops = { + lookup: (parent, name) => { + var fd = +name; + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + var ret = { + parent: null, + mount: { + mountpoint: "fake" + }, + node_ops: { + readlink: () => stream.path + } + }; + ret.parent = ret; + return ret; + } + }; + return node; + } + }, {}, "/proc/self/fd"); + }, + createStandardStreams: () => { + if (Module["stdin"]) { + FS.createDevice("/dev", "stdin", Module["stdin"]); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (Module["stdout"]) { + FS.createDevice("/dev", "stdout", null, Module["stdout"]); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (Module["stderr"]) { + FS.createDevice("/dev", "stderr", null, Module["stderr"]); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, "invalid handle for stdin (" + stdin.fd + ")"); + assert(stdout.fd === 1, "invalid handle for stdout (" + stdout.fd + ")"); + assert(stderr.fd === 2, "invalid handle for stderr (" + stderr.fd + ")"); + }, + ensureErrnoError: () => { + if (FS.ErrnoError) return; + FS.ErrnoError = function ErrnoError(errno, node) { + this.node = node; + this.setErrno = function(errno) { + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + }; + this.setErrno(errno); + this.message = ERRNO_MESSAGES[errno]; + if (this.stack) { + Object.defineProperty(this, "stack", { + value: new Error().stack, + writable: true + }); + this.stack = demangleAll(this.stack); + } + }; + FS.ErrnoError.prototype = new Error(); + FS.ErrnoError.prototype.constructor = FS.ErrnoError; + [ 44 ].forEach(code => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ""; + }); + }, + staticInit: () => { + FS.ensureErrnoError(); + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { + "MEMFS": MEMFS + }; + }, + init: (input, output, error) => { + assert(!FS.init.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"); + FS.init.initialized = true; + FS.ensureErrnoError(); + Module["stdin"] = input || Module["stdin"]; + Module["stdout"] = output || Module["stdout"]; + Module["stderr"] = error || Module["stderr"]; + FS.createStandardStreams(); + }, + quit: () => { + FS.init.initialized = false; + ___stdio_exit(); + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + getMode: (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }, + findObject: (path, dontResolveLastLink) => { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (ret.exists) { + return ret.object; + } else { + return null; + } + }, + analyzePath: (path, dontResolveLastLink) => { + try { + var lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null + }; + try { + var lookup = FS.lookupPath(path, { + parent: true + }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath: (parent, path, canRead, canWrite) => { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile: (parent, name, properties, canRead, canWrite) => { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS.getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile: (parent, name, data, canRead, canWrite, canOwn) => { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS.getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i); + data = arr; + } + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + return node; + }, + createDevice: (parent, name, input, output) => { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS.getMode(!!input, !!output); + if (!FS.createDevice.major) FS.createDevice.major = 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + FS.registerDevice(dev, { + open: stream => { + stream.seekable = false; + }, + close: stream => { + if (output && output.buffer && output.buffer.length) { + output(10); + } + }, + read: (stream, buffer, offset, length, pos) => { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: (stream, buffer, offset, length, pos) => { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + } + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile: obj => { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."); + } else if (read_) { + try { + obj.contents = intArrayFromString(read_(obj.url), true); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } else { + throw new Error("Cannot load without read() or XMLHttpRequest."); + } + }, + createLazyFile: (parent, name, url, canRead, canWrite) => { + function LazyUint8Array() { + this.lengthKnown = false; + this.chunks = []; + } + LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = idx / this.chunkSize | 0; + return this.getter(chunkNum)[chunkOffset]; + }; + LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) { + this.getter = getter; + }; + LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open("HEAD", url, false); + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; + var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip"; + var chunkSize = 1024 * 1024; + if (!hasByteServing) chunkSize = datalength; + var doXHR = (from, to) => { + if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); + if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!"); + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } else { + return intArrayFromString(xhr.responseText || "", true); + } + }; + var lazyArray = this; + lazyArray.setDataGetter(chunkNum => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out("LazyFiles on gzip forces download of the whole file when length is accessed"); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + }; + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array(); + Object.defineProperties(lazyArray, { + length: { + get: function() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + }, + chunkSize: { + get: function() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + }); + var properties = { + isDevice: false, + contents: lazyArray + }; + } else { + var properties = { + isDevice: false, + url: url + }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + Object.defineProperties(node, { + usedBytes: { + get: function() { + return this.contents.length; + } + } + }); + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach(key => { + var fn = node.stream_ops[key]; + stream_ops[key] = function forceLoadLazyFile() { + FS.forceLoadFile(node); + return fn.apply(null, arguments); + }; + }); + stream_ops.read = ((stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + }); + node.stream_ops = stream_ops; + return node; + }, + createPreloadedFile: (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency("cp " + fullname); + function processData(byteArray) { + function finish(byteArray) { + if (preFinish) preFinish(); + if (!dontCreateFile) { + FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn); + } + if (onload) onload(); + removeRunDependency(dep); + } + if (Browser.handledByPreloadPlugin(byteArray, fullname, finish, () => { + if (onerror) onerror(); + removeRunDependency(dep); + })) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url, byteArray => processData(byteArray), onerror); + } else { + processData(url); + } + }, + indexedDB: () => { + return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; + }, + DB_NAME: () => { + return "EM_FS_" + window.location.pathname; + }, + DB_VERSION: 20, + DB_STORE_NAME: "FILE_DATA", + saveFilesToDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = (() => { + out("creating db"); + var db = openRequest.result; + db.createObjectStore(FS.DB_STORE_NAME); + }); + openRequest.onsuccess = (() => { + var db = openRequest.result; + var transaction = db.transaction([ FS.DB_STORE_NAME ], "readwrite"); + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, fail = 0, total = paths.length; + function finish() { + if (fail == 0) onload(); else onerror(); + } + paths.forEach(path => { + var putRequest = files.put(FS.analyzePath(path).object.contents, path); + putRequest.onsuccess = (() => { + ok++; + if (ok + fail == total) finish(); + }); + putRequest.onerror = (() => { + fail++; + if (ok + fail == total) finish(); + }); + }); + transaction.onerror = onerror; + }); + openRequest.onerror = onerror; + }, + loadFilesFromDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = onerror; + openRequest.onsuccess = (() => { + var db = openRequest.result; + try { + var transaction = db.transaction([ FS.DB_STORE_NAME ], "readonly"); + } catch (e) { + onerror(e); + return; + } + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, fail = 0, total = paths.length; + function finish() { + if (fail == 0) onload(); else onerror(); + } + paths.forEach(path => { + var getRequest = files.get(path); + getRequest.onsuccess = (() => { + if (FS.analyzePath(path).exists) { + FS.unlink(path); + } + FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true); + ok++; + if (ok + fail == total) finish(); + }); + getRequest.onerror = (() => { + fail++; + if (ok + fail == total) finish(); + }); + }); + transaction.onerror = onerror; + }); + openRequest.onerror = onerror; + }, + absolutePath: () => { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder: () => { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink: () => { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath: () => { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc: () => { + abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc"); + }, + standardizePath: () => { + abort("FS.standardizePath has been removed; use PATH.normalize instead"); + } +}; + +var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt: function(dirfd, path, allowEmpty) { + if (path[0] === "/") { + return path; + } + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = FS.getStream(dirfd); + if (!dirstream) throw new FS.ErrnoError(8); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat: function(func, path, buf) { + try { + var stat = func(path); + } catch (e) { + if (e && e.node && PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node))) { + return -54; + } + throw e; + } + SAFE_HEAP_STORE(buf | 0, stat.dev | 0, 4); + SAFE_HEAP_STORE(buf + 4 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 8 | 0, stat.ino | 0, 4); + SAFE_HEAP_STORE(buf + 12 | 0, stat.mode | 0, 4); + SAFE_HEAP_STORE(buf + 16 | 0, stat.nlink | 0, 4); + SAFE_HEAP_STORE(buf + 20 | 0, stat.uid | 0, 4); + SAFE_HEAP_STORE(buf + 24 | 0, stat.gid | 0, 4); + SAFE_HEAP_STORE(buf + 28 | 0, stat.rdev | 0, 4); + SAFE_HEAP_STORE(buf + 32 | 0, 0 | 0, 4); + tempI64 = [ stat.size >>> 0, (tempDouble = stat.size, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(buf + 40 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(buf + 44 | 0, tempI64[1] | 0, 4); + SAFE_HEAP_STORE(buf + 48 | 0, 4096 | 0, 4); + SAFE_HEAP_STORE(buf + 52 | 0, stat.blocks | 0, 4); + SAFE_HEAP_STORE(buf + 56 | 0, stat.atime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 60 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 64 | 0, stat.mtime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 68 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 72 | 0, stat.ctime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 76 | 0, 0 | 0, 4); + tempI64 = [ stat.ino >>> 0, (tempDouble = stat.ino, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(buf + 80 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(buf + 84 | 0, tempI64[1] | 0, 4); + return 0; + }, + doMsync: function(addr, stream, len, flags, offset) { + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + doMkdir: function(path, mode) { + path = PATH.normalize(path); + if (path[path.length - 1] === "/") path = path.substr(0, path.length - 1); + FS.mkdir(path, mode, 0); + return 0; + }, + doMknod: function(path, mode, dev) { + switch (mode & 61440) { + case 32768: + case 8192: + case 24576: + case 4096: + case 49152: + break; + + default: + return -28; + } + FS.mknod(path, mode, dev); + return 0; + }, + doReadlink: function(path, buf, bufsize) { + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = SAFE_HEAP_LOAD(buf + len, 1, 0); + stringToUTF8(ret, buf, bufsize + 1); + SAFE_HEAP_STORE(buf + len, endChar, 1); + return len; + }, + doAccess: function(path, amode) { + if (amode & ~7) { + return -28; + } + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ""; + if (amode & 4) perms += "r"; + if (amode & 2) perms += "w"; + if (amode & 1) perms += "x"; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + }, + doDup: function(path, flags, suggestFD) { + var suggest = FS.getStream(suggestFD); + if (suggest) FS.close(suggest); + return FS.open(path, flags, 0, suggestFD, suggestFD).fd; + }, + doReadv: function(stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = SAFE_HEAP_LOAD(iov + i * 8 | 0, 4, 0) | 0; + var len = SAFE_HEAP_LOAD(iov + (i * 8 + 4) | 0, 4, 0) | 0; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + } + return ret; + }, + doWritev: function(stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = SAFE_HEAP_LOAD(iov + i * 8 | 0, 4, 0) | 0; + var len = SAFE_HEAP_LOAD(iov + (i * 8 + 4) | 0, 4, 0) | 0; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + } + return ret; + }, + varargs: undefined, + get: function() { + assert(SYSCALLS.varargs != undefined); + SYSCALLS.varargs += 4; + var ret = SAFE_HEAP_LOAD(SYSCALLS.varargs - 4 | 0, 4, 0) | 0; + return ret; + }, + getStr: function(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + getStreamFromFD: function(fd) { + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + return stream; + }, + get64: function(low, high) { + if (low >= 0) assert(high === 0); else assert(high === -1); + return low; + } +}; + +function ___syscall_chmod(path, mode) { + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_faccessat(dirfd, path, amode, flags) { + try { + path = SYSCALLS.getStr(path); + assert(flags === 0); + path = SYSCALLS.calculateAt(dirfd, path); + return SYSCALLS.doAccess(path, amode); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fcntl64(fd, cmd, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: + { + var arg = SYSCALLS.get(); + if (arg < 0) { + return -28; + } + var newStream; + newStream = FS.open(stream.path, stream.flags, 0, arg); + return newStream.fd; + } + + case 1: + case 2: + return 0; + + case 3: + return stream.flags; + + case 4: + { + var arg = SYSCALLS.get(); + stream.flags |= arg; + return 0; + } + + case 5: + { + var arg = SYSCALLS.get(); + var offset = 0; + SAFE_HEAP_STORE(arg + offset | 0, 2 | 0, 2); + return 0; + } + + case 6: + case 7: + return 0; + + case 16: + case 8: + return -28; + + case 9: + setErrNo(28); + return -1; + + default: + { + return -28; + } + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fstat64(fd, buf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fstatat64(dirfd, path, buf, flags) { + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & ~4352; + assert(!flags, flags); + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_getcwd(buf, size) { + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd); + if (size < cwdLengthInBytes + 1) return -68; + stringToUTF8(cwd, buf, size); + return buf; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_getegid32() { + return 0; +} + +function ___syscall_getgid32() { + return ___syscall_getegid32(); +} + +function ___syscall_getuid32() { + return ___syscall_getegid32(); +} + +function ___syscall_ioctl(fd, op, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: + case 21505: + { + if (!stream.tty) return -59; + return 0; + } + + case 21510: + case 21511: + case 21512: + case 21506: + case 21507: + case 21508: + { + if (!stream.tty) return -59; + return 0; + } + + case 21519: + { + if (!stream.tty) return -59; + var argp = SYSCALLS.get(); + SAFE_HEAP_STORE(argp | 0, 0 | 0, 4); + return 0; + } + + case 21520: + { + if (!stream.tty) return -59; + return -28; + } + + case 21531: + { + var argp = SYSCALLS.get(); + return FS.ioctl(stream, op, argp); + } + + case 21523: + { + if (!stream.tty) return -59; + return 0; + } + + case 21524: + { + if (!stream.tty) return -59; + return 0; + } + + default: + abort("bad ioctl syscall " + op); + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_lstat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.lstat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_open(path, flags, varargs) { + SYSCALLS.varargs = varargs; + try { + var pathname = SYSCALLS.getStr(path); + var mode = varargs ? SYSCALLS.get() : 0; + var stream = FS.open(pathname, flags, mode); + return stream.fd; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_readlink(path, buf, bufsize) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doReadlink(path, buf, bufsize); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_stat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_unlink(path) { + try { + path = SYSCALLS.getStr(path); + FS.unlink(path); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function __localtime_js(time, tmPtr) { + var date = new Date((SAFE_HEAP_LOAD(time | 0, 4, 0) | 0) * 1e3); + SAFE_HEAP_STORE(tmPtr | 0, date.getSeconds() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 4 | 0, date.getMinutes() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 8 | 0, date.getHours() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 12 | 0, date.getDate() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 16 | 0, date.getMonth() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 20 | 0, date.getFullYear() - 1900 | 0, 4); + SAFE_HEAP_STORE(tmPtr + 24 | 0, date.getDay() | 0, 4); + var start = new Date(date.getFullYear(), 0, 1); + var yday = (date.getTime() - start.getTime()) / (1e3 * 60 * 60 * 24) | 0; + SAFE_HEAP_STORE(tmPtr + 28 | 0, yday | 0, 4); + SAFE_HEAP_STORE(tmPtr + 36 | 0, -(date.getTimezoneOffset() * 60) | 0, 4); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + SAFE_HEAP_STORE(tmPtr + 32 | 0, dst | 0, 4); +} + +function _tzset_impl(timezone, daylight, tzname) { + var currentYear = new Date().getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + SAFE_HEAP_STORE(timezone | 0, stdTimezoneOffset * 60 | 0, 4); + SAFE_HEAP_STORE(daylight | 0, Number(winterOffset != summerOffset) | 0, 4); + function extractZone(date) { + var match = date.toTimeString().match(/\(([A-Za-z ]+)\)$/); + return match ? match[1] : "GMT"; + } + var winterName = extractZone(winter); + var summerName = extractZone(summer); + var winterNamePtr = allocateUTF8(winterName); + var summerNamePtr = allocateUTF8(summerName); + if (summerOffset < winterOffset) { + SAFE_HEAP_STORE(tzname | 0, winterNamePtr | 0, 4); + SAFE_HEAP_STORE(tzname + 4 | 0, summerNamePtr | 0, 4); + } else { + SAFE_HEAP_STORE(tzname | 0, summerNamePtr | 0, 4); + SAFE_HEAP_STORE(tzname + 4 | 0, winterNamePtr | 0, 4); + } +} + +function __tzset_js(timezone, daylight, tzname) { + if (__tzset_js.called) return; + __tzset_js.called = true; + _tzset_impl(timezone, daylight, tzname); +} + +function _abort() { + abort("native code called abort()"); +} + +function _emscripten_console_error(str) { + assert(typeof str == "number"); + console.error(UTF8ToString(str)); +} + +function _emscripten_memcpy_big(dest, src, num) { + HEAPU8.copyWithin(dest, src, src + num); +} + +function _emscripten_get_heap_max() { + return 2147483648; +} + +function emscripten_realloc_buffer(size) { + try { + wasmMemory.grow(size - buffer.byteLength + 65535 >>> 16); + updateGlobalBufferAndViews(wasmMemory.buffer); + return 1; + } catch (e) { + err("emscripten_realloc_buffer: Attempted to grow heap from " + buffer.byteLength + " bytes to " + size + " bytes, but got error: " + e); + } +} + +function _emscripten_resize_heap(requestedSize) { + var oldSize = HEAPU8.length; + requestedSize = requestedSize >>> 0; + assert(requestedSize > oldSize); + var maxHeapSize = _emscripten_get_heap_max(); + if (requestedSize > maxHeapSize) { + err("Cannot enlarge memory, asked to go up to " + requestedSize + " bytes, but the limit is " + maxHeapSize + " bytes!"); + return false; + } + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + .2 / cutDown); + overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); + var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536)); + var replacement = emscripten_realloc_buffer(newSize); + if (replacement) { + return true; + } + } + err("Failed to grow the heap from " + oldSize + " bytes to " + newSize + " bytes, not enough memory!"); + return false; +} + +var ENV = {}; + +function getExecutableName() { + return thisProgram || "./this.program"; +} + +function getEnvStrings() { + if (!getEnvStrings.strings) { + var lang = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8"; + var env = { + "USER": "web_user", + "LOGNAME": "web_user", + "PATH": "/", + "PWD": "/", + "HOME": "/home/web_user", + "LANG": lang, + "_": getExecutableName() + }; + for (var x in ENV) { + if (ENV[x] === undefined) delete env[x]; else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(x + "=" + env[x]); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; +} + +function _environ_get(__environ, environ_buf) { + var bufSize = 0; + getEnvStrings().forEach(function(string, i) { + var ptr = environ_buf + bufSize; + SAFE_HEAP_STORE(__environ + i * 4 | 0, ptr | 0, 4); + writeAsciiToMemory(string, ptr); + bufSize += string.length + 1; + }); + return 0; +} + +function _environ_sizes_get(penviron_count, penviron_buf_size) { + var strings = getEnvStrings(); + SAFE_HEAP_STORE(penviron_count | 0, strings.length | 0, 4); + var bufSize = 0; + strings.forEach(function(string) { + bufSize += string.length + 1; + }); + SAFE_HEAP_STORE(penviron_buf_size | 0, bufSize | 0, 4); + return 0; +} + +function _exit(status) { + exit(status); +} + +function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_fdstat_get(fd, pbuf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var type = stream.tty ? 2 : FS.isDir(stream.mode) ? 3 : FS.isLink(stream.mode) ? 7 : 4; + SAFE_HEAP_STORE(pbuf | 0, type | 0, 1); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_read(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doReadv(stream, iov, iovcnt); + SAFE_HEAP_STORE(pnum | 0, num | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_seek(fd, offset_low, offset_high, whence, newOffset) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var HIGH_OFFSET = 4294967296; + var offset = offset_high * HIGH_OFFSET + (offset_low >>> 0); + var DOUBLE_LIMIT = 9007199254740992; + if (offset <= -DOUBLE_LIMIT || offset >= DOUBLE_LIMIT) { + return -61; + } + FS.llseek(stream, offset, whence); + tempI64 = [ stream.position >>> 0, (tempDouble = stream.position, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(newOffset | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(newOffset + 4 | 0, tempI64[1] | 0, 4); + if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_write(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doWritev(stream, iov, iovcnt); + SAFE_HEAP_STORE(pnum | 0, num | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _proc_exit(code) { + procExit(code); +} + +function _setTempRet0(val) { + setTempRet0(val); +} + +function _time(ptr) { + var ret = Date.now() / 1e3 | 0; + if (ptr) { + SAFE_HEAP_STORE(ptr | 0, ret | 0, 4); + } + return ret; +} + +var FSNode = function(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; +}; + +var readMode = 292 | 73; + +var writeMode = 146; + +Object.defineProperties(FSNode.prototype, { + read: { + get: function() { + return (this.mode & readMode) === readMode; + }, + set: function(val) { + val ? this.mode |= readMode : this.mode &= ~readMode; + } + }, + write: { + get: function() { + return (this.mode & writeMode) === writeMode; + }, + set: function(val) { + val ? this.mode |= writeMode : this.mode &= ~writeMode; + } + }, + isFolder: { + get: function() { + return FS.isDir(this.mode); + } + }, + isDevice: { + get: function() { + return FS.isChrdev(this.mode); + } + } +}); + +FS.FSNode = FSNode; + +FS.staticInit(); + +Module["FS_createPath"] = FS.createPath; + +Module["FS_createDataFile"] = FS.createDataFile; + +Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + +Module["FS_createLazyFile"] = FS.createLazyFile; + +Module["FS_createDevice"] = FS.createDevice; + +Module["FS_unlink"] = FS.unlink; + +ERRNO_CODES = { + "EPERM": 63, + "ENOENT": 44, + "ESRCH": 71, + "EINTR": 27, + "EIO": 29, + "ENXIO": 60, + "E2BIG": 1, + "ENOEXEC": 45, + "EBADF": 8, + "ECHILD": 12, + "EAGAIN": 6, + "EWOULDBLOCK": 6, + "ENOMEM": 48, + "EACCES": 2, + "EFAULT": 21, + "ENOTBLK": 105, + "EBUSY": 10, + "EEXIST": 20, + "EXDEV": 75, + "ENODEV": 43, + "ENOTDIR": 54, + "EISDIR": 31, + "EINVAL": 28, + "ENFILE": 41, + "EMFILE": 33, + "ENOTTY": 59, + "ETXTBSY": 74, + "EFBIG": 22, + "ENOSPC": 51, + "ESPIPE": 70, + "EROFS": 69, + "EMLINK": 34, + "EPIPE": 64, + "EDOM": 18, + "ERANGE": 68, + "ENOMSG": 49, + "EIDRM": 24, + "ECHRNG": 106, + "EL2NSYNC": 156, + "EL3HLT": 107, + "EL3RST": 108, + "ELNRNG": 109, + "EUNATCH": 110, + "ENOCSI": 111, + "EL2HLT": 112, + "EDEADLK": 16, + "ENOLCK": 46, + "EBADE": 113, + "EBADR": 114, + "EXFULL": 115, + "ENOANO": 104, + "EBADRQC": 103, + "EBADSLT": 102, + "EDEADLOCK": 16, + "EBFONT": 101, + "ENOSTR": 100, + "ENODATA": 116, + "ETIME": 117, + "ENOSR": 118, + "ENONET": 119, + "ENOPKG": 120, + "EREMOTE": 121, + "ENOLINK": 47, + "EADV": 122, + "ESRMNT": 123, + "ECOMM": 124, + "EPROTO": 65, + "EMULTIHOP": 36, + "EDOTDOT": 125, + "EBADMSG": 9, + "ENOTUNIQ": 126, + "EBADFD": 127, + "EREMCHG": 128, + "ELIBACC": 129, + "ELIBBAD": 130, + "ELIBSCN": 131, + "ELIBMAX": 132, + "ELIBEXEC": 133, + "ENOSYS": 52, + "ENOTEMPTY": 55, + "ENAMETOOLONG": 37, + "ELOOP": 32, + "EOPNOTSUPP": 138, + "EPFNOSUPPORT": 139, + "ECONNRESET": 15, + "ENOBUFS": 42, + "EAFNOSUPPORT": 5, + "EPROTOTYPE": 67, + "ENOTSOCK": 57, + "ENOPROTOOPT": 50, + "ESHUTDOWN": 140, + "ECONNREFUSED": 14, + "EADDRINUSE": 3, + "ECONNABORTED": 13, + "ENETUNREACH": 40, + "ENETDOWN": 38, + "ETIMEDOUT": 73, + "EHOSTDOWN": 142, + "EHOSTUNREACH": 23, + "EINPROGRESS": 26, + "EALREADY": 7, + "EDESTADDRREQ": 17, + "EMSGSIZE": 35, + "EPROTONOSUPPORT": 66, + "ESOCKTNOSUPPORT": 137, + "EADDRNOTAVAIL": 4, + "ENETRESET": 39, + "EISCONN": 30, + "ENOTCONN": 53, + "ETOOMANYREFS": 141, + "EUSERS": 136, + "EDQUOT": 19, + "ESTALE": 72, + "ENOTSUP": 138, + "ENOMEDIUM": 148, + "EILSEQ": 25, + "EOVERFLOW": 61, + "ECANCELED": 11, + "ENOTRECOVERABLE": 56, + "EOWNERDEAD": 62, + "ESTRPIPE": 135 +}; + +var ASSERTIONS = true; + +function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; +} + +function intArrayToString(array) { + var ret = []; + for (var i = 0; i < array.length; i++) { + var chr = array[i]; + if (chr > 255) { + if (ASSERTIONS) { + assert(false, "Character code " + chr + " (" + String.fromCharCode(chr) + ") at offset " + i + " not in 0x00-0xFF."); + } + chr &= 255; + } + ret.push(String.fromCharCode(chr)); + } + return ret.join(""); +} + +var decodeBase64 = typeof atob == "function" ? atob : function(input) { + var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + do { + enc1 = keyStr.indexOf(input.charAt(i++)); + enc2 = keyStr.indexOf(input.charAt(i++)); + enc3 = keyStr.indexOf(input.charAt(i++)); + enc4 = keyStr.indexOf(input.charAt(i++)); + chr1 = enc1 << 2 | enc2 >> 4; + chr2 = (enc2 & 15) << 4 | enc3 >> 2; + chr3 = (enc3 & 3) << 6 | enc4; + output = output + String.fromCharCode(chr1); + if (enc3 !== 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 !== 64) { + output = output + String.fromCharCode(chr3); + } + } while (i < input.length); + return output; +}; + +function intArrayFromBase64(s) { + if (typeof ENVIRONMENT_IS_NODE == "boolean" && ENVIRONMENT_IS_NODE) { + var buf = Buffer.from(s, "base64"); + return new Uint8Array(buf["buffer"], buf["byteOffset"], buf["byteLength"]); + } + try { + var decoded = decodeBase64(s); + var bytes = new Uint8Array(decoded.length); + for (var i = 0; i < decoded.length; ++i) { + bytes[i] = decoded.charCodeAt(i); + } + return bytes; + } catch (_) { + throw new Error("Converting base64 string to bytes failed."); + } +} + +function tryParseAsDataURI(filename) { + if (!isDataURI(filename)) { + return; + } + return intArrayFromBase64(filename.slice(dataURIPrefix.length)); +} + +var asmLibraryArg = { + "__assert_fail": ___assert_fail, + "__clock_gettime": ___clock_gettime, + "__syscall_chmod": ___syscall_chmod, + "__syscall_faccessat": ___syscall_faccessat, + "__syscall_fcntl64": ___syscall_fcntl64, + "__syscall_fstat64": ___syscall_fstat64, + "__syscall_fstatat64": ___syscall_fstatat64, + "__syscall_getcwd": ___syscall_getcwd, + "__syscall_getgid32": ___syscall_getgid32, + "__syscall_getuid32": ___syscall_getuid32, + "__syscall_ioctl": ___syscall_ioctl, + "__syscall_lstat64": ___syscall_lstat64, + "__syscall_open": ___syscall_open, + "__syscall_readlink": ___syscall_readlink, + "__syscall_stat64": ___syscall_stat64, + "__syscall_unlink": ___syscall_unlink, + "_localtime_js": __localtime_js, + "_tzset_js": __tzset_js, + "abort": _abort, + "alignfault": alignfault, + "emscripten_console_error": _emscripten_console_error, + "emscripten_memcpy_big": _emscripten_memcpy_big, + "emscripten_resize_heap": _emscripten_resize_heap, + "environ_get": _environ_get, + "environ_sizes_get": _environ_sizes_get, + "exit": _exit, + "fd_close": _fd_close, + "fd_fdstat_get": _fd_fdstat_get, + "fd_read": _fd_read, + "fd_seek": _fd_seek, + "fd_write": _fd_write, + "proc_exit": _proc_exit, + "segfault": segfault, + "setTempRet0": _setTempRet0, + "time": _time +}; + +var asm = createWasm(); + +var ___wasm_call_ctors = Module["___wasm_call_ctors"] = createExportWrapper("__wasm_call_ctors"); + +var _free = Module["_free"] = createExportWrapper("free"); + +var _main = Module["_main"] = createExportWrapper("main"); + +var _malloc = Module["_malloc"] = createExportWrapper("malloc"); + +var ___errno_location = Module["___errno_location"] = createExportWrapper("__errno_location"); + +var _sbrk = Module["_sbrk"] = createExportWrapper("sbrk"); + +var ___stdio_exit = Module["___stdio_exit"] = createExportWrapper("__stdio_exit"); + +var ___funcs_on_exit = Module["___funcs_on_exit"] = createExportWrapper("__funcs_on_exit"); + +var ___dl_seterr = Module["___dl_seterr"] = createExportWrapper("__dl_seterr"); + +var _emscripten_get_sbrk_ptr = Module["_emscripten_get_sbrk_ptr"] = createExportWrapper("emscripten_get_sbrk_ptr"); + +var _emscripten_stack_init = Module["_emscripten_stack_init"] = function() { + return (_emscripten_stack_init = Module["_emscripten_stack_init"] = Module["asm"]["emscripten_stack_init"]).apply(null, arguments); +}; + +var _emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = function() { + return (_emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = Module["asm"]["emscripten_stack_get_free"]).apply(null, arguments); +}; + +var _emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = function() { + return (_emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = Module["asm"]["emscripten_stack_get_base"]).apply(null, arguments); +}; + +var _emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = function() { + return (_emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = Module["asm"]["emscripten_stack_get_end"]).apply(null, arguments); +}; + +var stackSave = Module["stackSave"] = createExportWrapper("stackSave"); + +var stackRestore = Module["stackRestore"] = createExportWrapper("stackRestore"); + +var stackAlloc = Module["stackAlloc"] = createExportWrapper("stackAlloc"); + +var dynCall_viiiiij = Module["dynCall_viiiiij"] = createExportWrapper("dynCall_viiiiij"); + +var dynCall_viiiiji = Module["dynCall_viiiiji"] = createExportWrapper("dynCall_viiiiji"); + +var dynCall_viiiijiij = Module["dynCall_viiiijiij"] = createExportWrapper("dynCall_viiiijiij"); + +var dynCall_viiiij = Module["dynCall_viiiij"] = createExportWrapper("dynCall_viiiij"); + +var dynCall_jii = Module["dynCall_jii"] = createExportWrapper("dynCall_jii"); + +var dynCall_vji = Module["dynCall_vji"] = createExportWrapper("dynCall_vji"); + +var dynCall_iji = Module["dynCall_iji"] = createExportWrapper("dynCall_iji"); + +var dynCall_ijiii = Module["dynCall_ijiii"] = createExportWrapper("dynCall_ijiii"); + +var dynCall_viji = Module["dynCall_viji"] = createExportWrapper("dynCall_viji"); + +var dynCall_ijjii = Module["dynCall_ijjii"] = createExportWrapper("dynCall_ijjii"); + +var dynCall_ji = Module["dynCall_ji"] = createExportWrapper("dynCall_ji"); + +var dynCall_jiji = Module["dynCall_jiji"] = createExportWrapper("dynCall_jiji"); + +var dynCall_iiiiiijjjiii = Module["dynCall_iiiiiijjjiii"] = createExportWrapper("dynCall_iiiiiijjjiii"); + +var dynCall_iiijiiii = Module["dynCall_iiijiiii"] = createExportWrapper("dynCall_iiijiiii"); + +var dynCall_jj = Module["dynCall_jj"] = createExportWrapper("dynCall_jj"); + +var dynCall_jjj = Module["dynCall_jjj"] = createExportWrapper("dynCall_jjj"); + +var dynCall_iijj = Module["dynCall_iijj"] = createExportWrapper("dynCall_iijj"); + +var dynCall_iijji = Module["dynCall_iijji"] = createExportWrapper("dynCall_iijji"); + +var dynCall_iiijji = Module["dynCall_iiijji"] = createExportWrapper("dynCall_iiijji"); + +var dynCall_iijii = Module["dynCall_iijii"] = createExportWrapper("dynCall_iijii"); + +var dynCall_iiiiiiji = Module["dynCall_iiiiiiji"] = createExportWrapper("dynCall_iiiiiiji"); + +var dynCall_iiij = Module["dynCall_iiij"] = createExportWrapper("dynCall_iiij"); + +var dynCall_iiiij = Module["dynCall_iiiij"] = createExportWrapper("dynCall_iiiij"); + +var dynCall_iij = Module["dynCall_iij"] = createExportWrapper("dynCall_iij"); + +var dynCall_jiij = Module["dynCall_jiij"] = createExportWrapper("dynCall_jiij"); + +var dynCall_iiji = Module["dynCall_iiji"] = createExportWrapper("dynCall_iiji"); + +var dynCall_iiijiijii = Module["dynCall_iiijiijii"] = createExportWrapper("dynCall_iiijiijii"); + +var dynCall_iiiijj = Module["dynCall_iiiijj"] = createExportWrapper("dynCall_iiiijj"); + +var dynCall_iiiijiiii = Module["dynCall_iiiijiiii"] = createExportWrapper("dynCall_iiiijiiii"); + +var dynCall_iiiiijiiii = Module["dynCall_iiiiijiiii"] = createExportWrapper("dynCall_iiiiijiiii"); + +var dynCall_ijii = Module["dynCall_ijii"] = createExportWrapper("dynCall_ijii"); + +var dynCall_iiiijiji = Module["dynCall_iiiijiji"] = createExportWrapper("dynCall_iiiijiji"); + +var dynCall_iijjii = Module["dynCall_iijjii"] = createExportWrapper("dynCall_iijjii"); + +var dynCall_jjii = Module["dynCall_jjii"] = createExportWrapper("dynCall_jjii"); + +var dynCall_jiii = Module["dynCall_jiii"] = createExportWrapper("dynCall_jiii"); + +var dynCall_jiiiii = Module["dynCall_jiiiii"] = createExportWrapper("dynCall_jiiiii"); + +var dynCall_iiiiiijiiii = Module["dynCall_iiiiiijiiii"] = createExportWrapper("dynCall_iiiiiijiiii"); + +if (!Object.getOwnPropertyDescriptor(Module, "intArrayFromString")) Module["intArrayFromString"] = (() => abort("'intArrayFromString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "intArrayToString")) Module["intArrayToString"] = (() => abort("'intArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ccall")) Module["ccall"] = (() => abort("'ccall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "cwrap")) Module["cwrap"] = (() => abort("'cwrap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setValue")) Module["setValue"] = (() => abort("'setValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getValue")) Module["getValue"] = (() => abort("'getValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocate")) Module["allocate"] = (() => abort("'allocate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF8ArrayToString")) Module["UTF8ArrayToString"] = (() => abort("'UTF8ArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF8ToString")) Module["UTF8ToString"] = (() => abort("'UTF8ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8Array")) Module["stringToUTF8Array"] = (() => abort("'stringToUTF8Array' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8")) Module["stringToUTF8"] = (() => abort("'stringToUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF8")) Module["lengthBytesUTF8"] = (() => abort("'lengthBytesUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = (() => abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPreRun")) Module["addOnPreRun"] = (() => abort("'addOnPreRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnInit")) Module["addOnInit"] = (() => abort("'addOnInit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPreMain")) Module["addOnPreMain"] = (() => abort("'addOnPreMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnExit")) Module["addOnExit"] = (() => abort("'addOnExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPostRun")) Module["addOnPostRun"] = (() => abort("'addOnPostRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeStringToMemory")) Module["writeStringToMemory"] = (() => abort("'writeStringToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeArrayToMemory")) Module["writeArrayToMemory"] = (() => abort("'writeArrayToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeAsciiToMemory")) Module["writeAsciiToMemory"] = (() => abort("'writeAsciiToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["addRunDependency"] = addRunDependency; + +Module["removeRunDependency"] = removeRunDependency; + +if (!Object.getOwnPropertyDescriptor(Module, "FS_createFolder")) Module["FS_createFolder"] = (() => abort("'FS_createFolder' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS_createPath"] = FS.createPath; + +Module["FS_createDataFile"] = FS.createDataFile; + +Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + +Module["FS_createLazyFile"] = FS.createLazyFile; + +if (!Object.getOwnPropertyDescriptor(Module, "FS_createLink")) Module["FS_createLink"] = (() => abort("'FS_createLink' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS_createDevice"] = FS.createDevice; + +Module["FS_unlink"] = FS.unlink; + +if (!Object.getOwnPropertyDescriptor(Module, "getLEB")) Module["getLEB"] = (() => abort("'getLEB' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFunctionTables")) Module["getFunctionTables"] = (() => abort("'getFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "alignFunctionTables")) Module["alignFunctionTables"] = (() => abort("'alignFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFunctions")) Module["registerFunctions"] = (() => abort("'registerFunctions' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addFunction")) Module["addFunction"] = (() => abort("'addFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "removeFunction")) Module["removeFunction"] = (() => abort("'removeFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = (() => abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "prettyPrint")) Module["prettyPrint"] = (() => abort("'prettyPrint' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = (() => abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getCompilerSetting")) Module["getCompilerSetting"] = (() => abort("'getCompilerSetting' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "print")) Module["print"] = (() => abort("'print' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "printErr")) Module["printErr"] = (() => abort("'printErr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getTempRet0")) Module["getTempRet0"] = (() => abort("'getTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setTempRet0")) Module["setTempRet0"] = (() => abort("'setTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callMain")) Module["callMain"] = (() => abort("'callMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "abort")) Module["abort"] = (() => abort("'abort' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "keepRuntimeAlive")) Module["keepRuntimeAlive"] = (() => abort("'keepRuntimeAlive' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "zeroMemory")) Module["zeroMemory"] = (() => abort("'zeroMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToNewUTF8")) Module["stringToNewUTF8"] = (() => abort("'stringToNewUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscripten_realloc_buffer")) Module["emscripten_realloc_buffer"] = (() => abort("'emscripten_realloc_buffer' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ENV")) Module["ENV"] = (() => abort("'ENV' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "withStackSave")) Module["withStackSave"] = (() => abort("'withStackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_CODES")) Module["ERRNO_CODES"] = (() => abort("'ERRNO_CODES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_MESSAGES")) Module["ERRNO_MESSAGES"] = (() => abort("'ERRNO_MESSAGES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setErrNo")) Module["setErrNo"] = (() => abort("'setErrNo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetPton4")) Module["inetPton4"] = (() => abort("'inetPton4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetNtop4")) Module["inetNtop4"] = (() => abort("'inetNtop4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetPton6")) Module["inetPton6"] = (() => abort("'inetPton6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetNtop6")) Module["inetNtop6"] = (() => abort("'inetNtop6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readSockaddr")) Module["readSockaddr"] = (() => abort("'readSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeSockaddr")) Module["writeSockaddr"] = (() => abort("'writeSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "DNS")) Module["DNS"] = (() => abort("'DNS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getHostByName")) Module["getHostByName"] = (() => abort("'getHostByName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Protocols")) Module["Protocols"] = (() => abort("'Protocols' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Sockets")) Module["Sockets"] = (() => abort("'Sockets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getRandomDevice")) Module["getRandomDevice"] = (() => abort("'getRandomDevice' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "traverseStack")) Module["traverseStack"] = (() => abort("'traverseStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertFrameToPC")) Module["convertFrameToPC"] = (() => abort("'convertFrameToPC' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UNWIND_CACHE")) Module["UNWIND_CACHE"] = (() => abort("'UNWIND_CACHE' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "saveInUnwindCache")) Module["saveInUnwindCache"] = (() => abort("'saveInUnwindCache' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertPCtoSourceLocation")) Module["convertPCtoSourceLocation"] = (() => abort("'convertPCtoSourceLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgsArray")) Module["readAsmConstArgsArray"] = (() => abort("'readAsmConstArgsArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgs")) Module["readAsmConstArgs"] = (() => abort("'readAsmConstArgs' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "mainThreadEM_ASM")) Module["mainThreadEM_ASM"] = (() => abort("'mainThreadEM_ASM' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jstoi_q")) Module["jstoi_q"] = (() => abort("'jstoi_q' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jstoi_s")) Module["jstoi_s"] = (() => abort("'jstoi_s' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getExecutableName")) Module["getExecutableName"] = (() => abort("'getExecutableName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "listenOnce")) Module["listenOnce"] = (() => abort("'listenOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "autoResumeAudioContext")) Module["autoResumeAudioContext"] = (() => abort("'autoResumeAudioContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCallLegacy")) Module["dynCallLegacy"] = (() => abort("'dynCallLegacy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getDynCaller")) Module["getDynCaller"] = (() => abort("'getDynCaller' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = (() => abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callRuntimeCallbacks")) Module["callRuntimeCallbacks"] = (() => abort("'callRuntimeCallbacks' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "wasmTableMirror")) Module["wasmTableMirror"] = (() => abort("'wasmTableMirror' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setWasmTableEntry")) Module["setWasmTableEntry"] = (() => abort("'setWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getWasmTableEntry")) Module["getWasmTableEntry"] = (() => abort("'getWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "handleException")) Module["handleException"] = (() => abort("'handleException' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePush")) Module["runtimeKeepalivePush"] = (() => abort("'runtimeKeepalivePush' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePop")) Module["runtimeKeepalivePop"] = (() => abort("'runtimeKeepalivePop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callUserCallback")) Module["callUserCallback"] = (() => abort("'callUserCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "maybeExit")) Module["maybeExit"] = (() => abort("'maybeExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "safeSetTimeout")) Module["safeSetTimeout"] = (() => abort("'safeSetTimeout' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "asmjsMangle")) Module["asmjsMangle"] = (() => abort("'asmjsMangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "asyncLoad")) Module["asyncLoad"] = (() => abort("'asyncLoad' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "alignMemory")) Module["alignMemory"] = (() => abort("'alignMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "mmapAlloc")) Module["mmapAlloc"] = (() => abort("'mmapAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "reallyNegative")) Module["reallyNegative"] = (() => abort("'reallyNegative' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "unSign")) Module["unSign"] = (() => abort("'unSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "reSign")) Module["reSign"] = (() => abort("'reSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "formatString")) Module["formatString"] = (() => abort("'formatString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PATH")) Module["PATH"] = (() => abort("'PATH' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PATH_FS")) Module["PATH_FS"] = (() => abort("'PATH_FS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SYSCALLS")) Module["SYSCALLS"] = (() => abort("'SYSCALLS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getSocketFromFD")) Module["getSocketFromFD"] = (() => abort("'getSocketFromFD' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getSocketAddress")) Module["getSocketAddress"] = (() => abort("'getSocketAddress' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "JSEvents")) Module["JSEvents"] = (() => abort("'JSEvents' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerKeyEventCallback")) Module["registerKeyEventCallback"] = (() => abort("'registerKeyEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "specialHTMLTargets")) Module["specialHTMLTargets"] = (() => abort("'specialHTMLTargets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "maybeCStringToJsString")) Module["maybeCStringToJsString"] = (() => abort("'maybeCStringToJsString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "findEventTarget")) Module["findEventTarget"] = (() => abort("'findEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "findCanvasEventTarget")) Module["findCanvasEventTarget"] = (() => abort("'findCanvasEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getBoundingClientRect")) Module["getBoundingClientRect"] = (() => abort("'getBoundingClientRect' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillMouseEventData")) Module["fillMouseEventData"] = (() => abort("'fillMouseEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerMouseEventCallback")) Module["registerMouseEventCallback"] = (() => abort("'registerMouseEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerWheelEventCallback")) Module["registerWheelEventCallback"] = (() => abort("'registerWheelEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerUiEventCallback")) Module["registerUiEventCallback"] = (() => abort("'registerUiEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFocusEventCallback")) Module["registerFocusEventCallback"] = (() => abort("'registerFocusEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceOrientationEventData")) Module["fillDeviceOrientationEventData"] = (() => abort("'fillDeviceOrientationEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceOrientationEventCallback")) Module["registerDeviceOrientationEventCallback"] = (() => abort("'registerDeviceOrientationEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceMotionEventData")) Module["fillDeviceMotionEventData"] = (() => abort("'fillDeviceMotionEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceMotionEventCallback")) Module["registerDeviceMotionEventCallback"] = (() => abort("'registerDeviceMotionEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "screenOrientation")) Module["screenOrientation"] = (() => abort("'screenOrientation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillOrientationChangeEventData")) Module["fillOrientationChangeEventData"] = (() => abort("'fillOrientationChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerOrientationChangeEventCallback")) Module["registerOrientationChangeEventCallback"] = (() => abort("'registerOrientationChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillFullscreenChangeEventData")) Module["fillFullscreenChangeEventData"] = (() => abort("'fillFullscreenChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFullscreenChangeEventCallback")) Module["registerFullscreenChangeEventCallback"] = (() => abort("'registerFullscreenChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerRestoreOldStyle")) Module["registerRestoreOldStyle"] = (() => abort("'registerRestoreOldStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "hideEverythingExceptGivenElement")) Module["hideEverythingExceptGivenElement"] = (() => abort("'hideEverythingExceptGivenElement' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "restoreHiddenElements")) Module["restoreHiddenElements"] = (() => abort("'restoreHiddenElements' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setLetterbox")) Module["setLetterbox"] = (() => abort("'setLetterbox' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "currentFullscreenStrategy")) Module["currentFullscreenStrategy"] = (() => abort("'currentFullscreenStrategy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "restoreOldWindowedStyle")) Module["restoreOldWindowedStyle"] = (() => abort("'restoreOldWindowedStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "softFullscreenResizeWebGLRenderTarget")) Module["softFullscreenResizeWebGLRenderTarget"] = (() => abort("'softFullscreenResizeWebGLRenderTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "doRequestFullscreen")) Module["doRequestFullscreen"] = (() => abort("'doRequestFullscreen' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillPointerlockChangeEventData")) Module["fillPointerlockChangeEventData"] = (() => abort("'fillPointerlockChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockChangeEventCallback")) Module["registerPointerlockChangeEventCallback"] = (() => abort("'registerPointerlockChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockErrorEventCallback")) Module["registerPointerlockErrorEventCallback"] = (() => abort("'registerPointerlockErrorEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "requestPointerLock")) Module["requestPointerLock"] = (() => abort("'requestPointerLock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillVisibilityChangeEventData")) Module["fillVisibilityChangeEventData"] = (() => abort("'fillVisibilityChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerVisibilityChangeEventCallback")) Module["registerVisibilityChangeEventCallback"] = (() => abort("'registerVisibilityChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerTouchEventCallback")) Module["registerTouchEventCallback"] = (() => abort("'registerTouchEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillGamepadEventData")) Module["fillGamepadEventData"] = (() => abort("'fillGamepadEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerGamepadEventCallback")) Module["registerGamepadEventCallback"] = (() => abort("'registerGamepadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerBeforeUnloadEventCallback")) Module["registerBeforeUnloadEventCallback"] = (() => abort("'registerBeforeUnloadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillBatteryEventData")) Module["fillBatteryEventData"] = (() => abort("'fillBatteryEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "battery")) Module["battery"] = (() => abort("'battery' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerBatteryEventCallback")) Module["registerBatteryEventCallback"] = (() => abort("'registerBatteryEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setCanvasElementSize")) Module["setCanvasElementSize"] = (() => abort("'setCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getCanvasElementSize")) Module["getCanvasElementSize"] = (() => abort("'getCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "demangle")) Module["demangle"] = (() => abort("'demangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "demangleAll")) Module["demangleAll"] = (() => abort("'demangleAll' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jsStackTrace")) Module["jsStackTrace"] = (() => abort("'jsStackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = (() => abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getEnvStrings")) Module["getEnvStrings"] = (() => abort("'getEnvStrings' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "checkWasiClock")) Module["checkWasiClock"] = (() => abort("'checkWasiClock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64")) Module["writeI53ToI64"] = (() => abort("'writeI53ToI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Clamped")) Module["writeI53ToI64Clamped"] = (() => abort("'writeI53ToI64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Signaling")) Module["writeI53ToI64Signaling"] = (() => abort("'writeI53ToI64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Clamped")) Module["writeI53ToU64Clamped"] = (() => abort("'writeI53ToU64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Signaling")) Module["writeI53ToU64Signaling"] = (() => abort("'writeI53ToU64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readI53FromI64")) Module["readI53FromI64"] = (() => abort("'readI53FromI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readI53FromU64")) Module["readI53FromU64"] = (() => abort("'readI53FromU64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertI32PairToI53")) Module["convertI32PairToI53"] = (() => abort("'convertI32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertU32PairToI53")) Module["convertU32PairToI53"] = (() => abort("'convertU32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setImmediateWrapped")) Module["setImmediateWrapped"] = (() => abort("'setImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "clearImmediateWrapped")) Module["clearImmediateWrapped"] = (() => abort("'clearImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "polyfillSetImmediate")) Module["polyfillSetImmediate"] = (() => abort("'polyfillSetImmediate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "uncaughtExceptionCount")) Module["uncaughtExceptionCount"] = (() => abort("'uncaughtExceptionCount' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exceptionLast")) Module["exceptionLast"] = (() => abort("'exceptionLast' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exceptionCaught")) Module["exceptionCaught"] = (() => abort("'exceptionCaught' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ExceptionInfo")) Module["ExceptionInfo"] = (() => abort("'ExceptionInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "CatchInfo")) Module["CatchInfo"] = (() => abort("'CatchInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exception_addRef")) Module["exception_addRef"] = (() => abort("'exception_addRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exception_decRef")) Module["exception_decRef"] = (() => abort("'exception_decRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Browser")) Module["Browser"] = (() => abort("'Browser' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "funcWrappers")) Module["funcWrappers"] = (() => abort("'funcWrappers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = (() => abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setMainLoop")) Module["setMainLoop"] = (() => abort("'setMainLoop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "wget")) Module["wget"] = (() => abort("'wget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS"] = FS; + +if (!Object.getOwnPropertyDescriptor(Module, "MEMFS")) Module["MEMFS"] = (() => abort("'MEMFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "TTY")) Module["TTY"] = (() => abort("'TTY' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PIPEFS")) Module["PIPEFS"] = (() => abort("'PIPEFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SOCKFS")) Module["SOCKFS"] = (() => abort("'SOCKFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "_setNetworkCallback")) Module["_setNetworkCallback"] = (() => abort("'_setNetworkCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "tempFixedLengthArray")) Module["tempFixedLengthArray"] = (() => abort("'tempFixedLengthArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "miniTempWebGLFloatBuffers")) Module["miniTempWebGLFloatBuffers"] = (() => abort("'miniTempWebGLFloatBuffers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "heapObjectForWebGLType")) Module["heapObjectForWebGLType"] = (() => abort("'heapObjectForWebGLType' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "heapAccessShiftForWebGLHeap")) Module["heapAccessShiftForWebGLHeap"] = (() => abort("'heapAccessShiftForWebGLHeap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GL")) Module["GL"] = (() => abort("'GL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGet")) Module["emscriptenWebGLGet"] = (() => abort("'emscriptenWebGLGet' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "computeUnpackAlignedImageSize")) Module["computeUnpackAlignedImageSize"] = (() => abort("'computeUnpackAlignedImageSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetTexPixelData")) Module["emscriptenWebGLGetTexPixelData"] = (() => abort("'emscriptenWebGLGetTexPixelData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetUniform")) Module["emscriptenWebGLGetUniform"] = (() => abort("'emscriptenWebGLGetUniform' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglGetUniformLocation")) Module["webglGetUniformLocation"] = (() => abort("'webglGetUniformLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglPrepareUniformLocationsBeforeFirstUse")) Module["webglPrepareUniformLocationsBeforeFirstUse"] = (() => abort("'webglPrepareUniformLocationsBeforeFirstUse' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglGetLeftBracePos")) Module["webglGetLeftBracePos"] = (() => abort("'webglGetLeftBracePos' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetVertexAttrib")) Module["emscriptenWebGLGetVertexAttrib"] = (() => abort("'emscriptenWebGLGetVertexAttrib' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeGLArray")) Module["writeGLArray"] = (() => abort("'writeGLArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "AL")) Module["AL"] = (() => abort("'AL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_unicode")) Module["SDL_unicode"] = (() => abort("'SDL_unicode' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_ttfContext")) Module["SDL_ttfContext"] = (() => abort("'SDL_ttfContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_audio")) Module["SDL_audio"] = (() => abort("'SDL_audio' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL")) Module["SDL"] = (() => abort("'SDL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_gfx")) Module["SDL_gfx"] = (() => abort("'SDL_gfx' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLUT")) Module["GLUT"] = (() => abort("'GLUT' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "EGL")) Module["EGL"] = (() => abort("'EGL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLFW_Window")) Module["GLFW_Window"] = (() => abort("'GLFW_Window' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLFW")) Module["GLFW"] = (() => abort("'GLFW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLEW")) Module["GLEW"] = (() => abort("'GLEW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "IDBStore")) Module["IDBStore"] = (() => abort("'IDBStore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runAndAbortIfError")) Module["runAndAbortIfError"] = (() => abort("'runAndAbortIfError' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "warnOnce")) Module["warnOnce"] = (() => abort("'warnOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackSave")) Module["stackSave"] = (() => abort("'stackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackRestore")) Module["stackRestore"] = (() => abort("'stackRestore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackAlloc")) Module["stackAlloc"] = (() => abort("'stackAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "AsciiToString")) Module["AsciiToString"] = (() => abort("'AsciiToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToAscii")) Module["stringToAscii"] = (() => abort("'stringToAscii' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF16ToString")) Module["UTF16ToString"] = (() => abort("'UTF16ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF16")) Module["stringToUTF16"] = (() => abort("'stringToUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF16")) Module["lengthBytesUTF16"] = (() => abort("'lengthBytesUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF32ToString")) Module["UTF32ToString"] = (() => abort("'UTF32ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF32")) Module["stringToUTF32"] = (() => abort("'stringToUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF32")) Module["lengthBytesUTF32"] = (() => abort("'lengthBytesUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8")) Module["allocateUTF8"] = (() => abort("'allocateUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8OnStack")) Module["allocateUTF8OnStack"] = (() => abort("'allocateUTF8OnStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["writeStackCookie"] = writeStackCookie; + +Module["checkStackCookie"] = checkStackCookie; + +if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_NORMAL")) Object.defineProperty(Module, "ALLOC_NORMAL", { + configurable: true, + get: function() { + abort("'ALLOC_NORMAL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)"); + } +}); + +if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_STACK")) Object.defineProperty(Module, "ALLOC_STACK", { + configurable: true, + get: function() { + abort("'ALLOC_STACK' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)"); + } +}); + +var calledRun; + +function ExitStatus(status) { + this.name = "ExitStatus"; + this.message = "Program terminated with exit(" + status + ")"; + this.status = status; +} + +var calledMain = false; + +// dependenciesFulfilled = function runCaller() { +// if (!calledRun) run(); +// if (!calledRun) dependenciesFulfilled = runCaller; +// }; + +function callMain(args) { + assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'); + assert(__ATPRERUN__.length == 0, "cannot call main when preRun functions remain to be called"); + var entryFunction = Module["_main"]; + args = args || []; + var argc = args.length + 1; + var argv = stackAlloc((argc + 1) * 4); + SAFE_HEAP_STORE((argv >> 2) * 4, allocateUTF8OnStack(thisProgram), 4); + for (var i = 1; i < argc; i++) { + SAFE_HEAP_STORE(((argv >> 2) + i) * 4, allocateUTF8OnStack(args[i - 1]), 4); + } + SAFE_HEAP_STORE(((argv >> 2) + argc) * 4, 0, 4); + try { + var ret = entryFunction(argc, argv); + exit(ret, true); + return ret; + } catch (e) { + return handleException(e); + } finally { + calledMain = true; + } +} + +function stackCheckInit() { + _emscripten_stack_init(); + writeStackCookie(); +} + +function run(args) { + shouldRunNow = true; + args = args || arguments_; + if (runDependencies > 0) { + return; + } + stackCheckInit(); + preRun(); + if (runDependencies > 0) { + return; + } + function doRun() { + if (calledRun) return; + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + if (args[2].includes(".o")) { // Disassemble library + FS.writeFile("./" + args[2], args[0]); + islib32 = 1; + }else { + FS.writeFile("./input.elf", args[0]); + } + args.shift(); + preMain(); + // readyPromiseResolve(Module); + if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"](); + if (shouldRunNow) callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(function() { + setTimeout(function() { + Module["setStatus"](""); + }, 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); +} + +Module["run"] = run; + +function exit(status, implicit) { + EXITSTATUS = status; + if (keepRuntimeAlive()) { + if (!implicit) { + var msg = "program exited (with status: " + status + "), but keepRuntimeAlive() is set (counter=" + runtimeKeepaliveCounter + ") due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)"; + readyPromiseReject(msg); + err(msg); + } + } else { + exitRuntime(); + } + islib32 = 0; + procExit(status); +} + +function procExit(code) { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + if (Module["onExit"]) Module["onExit"](code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); +} + +if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } +} + +var shouldRunNow = false; + +if (Module["noInitialRun"]) shouldRunNow = false; + +// run(); + readyPromiseResolve(Module); + + return Module.ready +} +); +})(); +export default Module; \ No newline at end of file diff --git a/src/core/assembler/sailAssembler/web/wasm/objdump.wasm b/src/core/assembler/sailAssembler/web/wasm/objdump.wasm new file mode 100755 index 000000000..c4d5dcc3a Binary files /dev/null and b/src/core/assembler/sailAssembler/web/wasm/objdump.wasm differ diff --git a/src/core/assembler/sailAssembler/web/wasm/objdump64.js b/src/core/assembler/sailAssembler/web/wasm/objdump64.js new file mode 100644 index 000000000..8f3360ae6 --- /dev/null +++ b/src/core/assembler/sailAssembler/web/wasm/objdump64.js @@ -0,0 +1,5114 @@ + +export var dumptextinstructions64 = []; +export var dumpdatainstructions64 = []; +export var dumplabels64 = []; +export var sectionasm64 = 0; +export var inside_label64 = 0; +export var islib64 = 0; +export var libtags64 = []; +// export var entry_elf = 0; +var Module = (() => { + var _scriptName = import.meta.url; + + return ( +async function(moduleArg = {}) { + var moduleRtn; + +// include: shell.js +// The Module object: Our interface to the outside world. We import +// and export values on it. There are various ways Module can be used: +// 1. Not defined. We create it here +// 2. A function parameter, function(moduleArg) => Promise +// 3. pre-run appended it, var Module = {}; ..generated code.. +// 4. External script tag defines var Module. +// We need to check if Module already exists (e.g. case 3 above). +// Substitution will be replaced with actual code on later stage of the build, +// this way Closure Compiler will not mangle it (e.g. case 4. above). +// Note that if you want to run closure, and also to use Module +// after the generated code, you will need to define var Module = {}; +// before the code. Then that object will be used in the code, and you +// can continue to use Module afterwards as well. +var Module = moduleArg; + +// Set up the promise that indicates the Module is initialized +var readyPromiseResolve, readyPromiseReject; + +var readyPromise = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; +}); + +// Determine the runtime environment we are in. You can customize this by +// setting the ENVIRONMENT setting at compile time (see settings.js). +// Attempt to auto-detect the environment +var ENVIRONMENT_IS_WEB = typeof window == "object"; + +var ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope != "undefined"; + +// N.b. Electron.js environment is simultaneously a NODE-environment, but +// also a web environment. +var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string" && process.type != "renderer"; + +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +if (ENVIRONMENT_IS_NODE) { + // When building an ES module `require` is not normally available. + // We need to use `createRequire()` to construct the require()` function. + const {createRequire} = await import("module"); + /** @suppress{duplicate} */ var require = createRequire(import.meta.url); +} + +// --pre-jses are emitted after the Module integration code, so that they can +// refer to Module (if they choose; they can also define Module) +// Sometimes an existing Module object exists with properties +// meant to overwrite the default module functionality. Here +// we collect those properties and reapply _after_ we configure +// the current environment's defaults to avoid having to be so +// defensive during initialization. +var moduleOverrides = Object.assign({}, Module); + +var arguments_ = []; + +var thisProgram = "./this.program"; + +var quit_ = (status, toThrow) => { + throw toThrow; +}; + +// `/` should be present at the end if `scriptDirectory` is not empty +var scriptDirectory = ""; + +function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; +} + +// Hooks that are implemented differently in different runtime environments. +var readAsync, readBinary; + +if (ENVIRONMENT_IS_NODE) { + if (typeof process == "undefined" || !process.release || process.release.name !== "node") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + var nodeVersion = process.versions.node; + var numericVersion = nodeVersion.split(".").slice(0, 3); + numericVersion = (numericVersion[0] * 1e4) + (numericVersion[1] * 100) + (numericVersion[2].split("-")[0] * 1); + var minVersion = 23e4; + if (numericVersion < 23e4) { + throw new Error("This emscripten-generated code requires node v23.0.0 (detected v" + nodeVersion + ")"); + } + // These modules will usually be used on Node.js. Load them eagerly to avoid + // the complexity of lazy-loading. + var fs = require("fs"); + var nodePath = require("path"); + // EXPORT_ES6 + ENVIRONMENT_IS_NODE always requires use of import.meta.url, + // since there's no way getting the current absolute path of the module when + // support for that is not available. + if (!import.meta.url.startsWith("data:")) { + scriptDirectory = nodePath.dirname(require("url").fileURLToPath(import.meta.url)) + "/"; + } + // include: node_shell_read.js + readBinary = filename => { + // We need to re-wrap `file://` strings to URLs. + filename = isFileURI(filename) ? new URL(filename) : filename; + var ret = fs.readFileSync(filename); + assert(Buffer.isBuffer(ret)); + return ret; + }; + readAsync = async (filename, binary = true) => { + // See the comment in the `readBinary` function. + filename = isFileURI(filename) ? new URL(filename) : filename; + var ret = fs.readFileSync(filename, binary ? undefined : "utf8"); + assert(binary ? Buffer.isBuffer(ret) : typeof ret == "string"); + return ret; + }; + // end include: node_shell_read.js + if (!Module["thisProgram"] && process.argv.length > 1) { + thisProgram = process.argv[1].replace(/\\/g, "/"); + } + arguments_ = process.argv.slice(2); + // MODULARIZE will export the module in the proper place outside, we don't need to export here + quit_ = (status, toThrow) => { + process.exitCode = status; + throw toThrow; + }; +} else if (ENVIRONMENT_IS_SHELL) { + if ((typeof process == "object" && typeof require === "function") || typeof window == "object" || typeof WorkerGlobalScope != "undefined") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); +} else // Note that this includes Node.js workers when relevant (pthreads is enabled). +// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and +// ENVIRONMENT_IS_NODE. +if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + // Check worker, not web, since window could be polyfilled + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + // web + scriptDirectory = document.currentScript.src; + } + // When MODULARIZE, this JS may be executed later, after document.currentScript + // is gone, so we saved it, and we use it here instead of any other info. + if (_scriptName) { + scriptDirectory = _scriptName; + } + // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them. + // otherwise, slice off the final part of the url to find the script directory. + // if scriptDirectory does not contain a slash, lastIndexOf will return -1, + // and scriptDirectory will correctly be replaced with an empty string. + // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #), + // they are removed because they could contain a slash. + if (scriptDirectory.startsWith("blob:")) { + scriptDirectory = ""; + } else { + scriptDirectory = scriptDirectory.slice(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1); + } + if (!(typeof window == "object" || typeof WorkerGlobalScope != "undefined")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + { + // include: web_or_worker_shell_read.js + if (ENVIRONMENT_IS_WORKER) { + readBinary = url => { + var xhr = new XMLHttpRequest; + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(/** @type{!ArrayBuffer} */ (xhr.response)); + }; + } + readAsync = async url => { + // Fetch has some additional restrictions over XHR, like it can't be used on a file:// url. + // See https://github.com/github/fetch/pull/92#issuecomment-140665932 + // Cordova or Electron apps are typically loaded from a file:// url. + // So use XHR on webview if URL is a file URL. + if (isFileURI(url)) { + return new Promise((resolve, reject) => { + var xhr = new XMLHttpRequest; + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = () => { + if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { + // file URLs can return 0 + resolve(xhr.response); + return; + } + reject(xhr.status); + }; + xhr.onerror = reject; + xhr.send(null); + }); + } + var response = await fetch(url, { + credentials: "same-origin" + }); + if (response.ok) { + return response.arrayBuffer(); + } + throw new Error(response.status + " : " + response.url); + }; + } +} else { + throw new Error("environment detection error"); +} + + + Module['print'] = function (message) { + + if (islib64) { + // Regex to get name function + if (sectionasm64 === 1){ + const name_function = message.match(/^([0-9a-f]{16})\s+<(.+?)>:$/); + libtags64.push(name_function[2]); + } + + // Check which section + if (message.search(".text") != -1) + sectionasm64 = 1; + if (message.search(".data") != -1) + sectionasm64 = 2; + if (message.search(".riscv.attributes") != -1) + sectionasm64 = 0; + + + } else { + + // console.log(typeof message); + + // console.log("En que seccion estoy: ", sectionasm64); + var auxinsn = []; + const auxiliar = message.trim(); + const datamatch = auxiliar.match(/^([0-9a-fA-F]+):\s+((?:[0-9a-fA-F]{2,8}(?:\s+[0-9a-fA-F]{2,8})*))(?:.*?0x([0-9a-fA-F]+))?/); // /^([0-9a-fA-F]+):.*?0x([0-9a-fA-F]+)/ + const insnmatch = auxiliar.match(/^(\w+):\s+((?:fnmadd\.s|\w+|\.\w+))\s+([^\#]*)(?:#(.*))?$/); // /^(\w+):\s+(\w+)\s+([^\#]*)(?:#(.*))?$/ + const labelmatch = auxiliar.match(/^([0-9a-f]{16})\s+<(.+?)>:$/); + if (insnmatch !== null && sectionasm64 === 1) { + const address = parseInt(insnmatch[1].trim(), 16).toString(16)//(insnmatch[1].trim().replace(/0+/,"") === "") ? "0" : insnmatch[1].trim().replace(/0+/,""); // Parte 1: dirección + const hexInstruction = insnmatch[2].trim(); // Parte 2: instrucción hexadecimal + const asmInstruction = (insnmatch[3].trim()).replace(/\\t/g, ' '); // Parte 3: instrucción ensamblador (sin el comentario) + // const comment = match[4] ? insnmatchmatch[4].trim() : null; // Parte 4: comentario (opcional) + let axx = dumptextinstructions64.findIndex(sublist => sublist.includes(address)); + if (axx != -1 && sectionasm64 === 1) { + dumptextinstructions64[axx][1] = hexInstruction; + dumptextinstructions64[axx][2] = asmInstruction.replace(/\\t/g, ' '); + } + else if (sectionasm64 === 1){ + auxinsn.push(address); + auxinsn.push(hexInstruction); + auxinsn.push(asmInstruction.replace(/\\t/g, ' ')); + auxinsn.push(0); + auxinsn.push(""); + dumptextinstructions64.push(auxinsn); + } + } + else if (datamatch !== null && sectionasm64 === 2){ + let axx = dumpdatainstructions64.findIndex(sublist => sublist.includes(datamatch[1])); + if (axx !== -1 && sectionasm64 === 2) { + dumpdatainstructions64[axx][1] = datamatch[2]; + dumpdatainstructions64[axx][2] = ""; // asmInstruction.replace(/\\t/g, ' '); + } + else if (sectionasm64 === 2) { + auxinsn.push(datamatch[1]); + auxinsn.push(datamatch[2]); + auxinsn.push(""/*asmInstruction.replace(/\\t/g, ' ')*/); + auxinsn.push(0); + auxinsn.push(""); + if(auxinsn[3] === 0){ + // console.log("Exaa que se va a insertar en un dumpdata anterior: ", auxinsn); + // console.log("Que es esto: ", /[^0-9a-fA-F]/.test(auxinsn[1])); + if(/[^0-9a-fA-F]/.test(auxinsn[1])/* auxinsn[1].includes("madd.s")*/){ + //buscamos la palabra completa almacenada por el list_data_instructions + var auxda = list_data_instructions.findIndex(data => data.label === dumpdatainstructions64[dumpdatainstructions64.length -1][4]); + var list_data_elem; + var aux_index_value = list_data_instructions[auxda].value.length; + if (typeof list_data_instructions[auxda].value === "object"){ + if (list_data_instructions[auxda].value[aux_index_value - 1].includes("-")){ + // caso de ser el valor negativo + let buff, buff_view; + switch (list_data_instructions[auxda].type){ + case "half": + list_data_elem = (parseInt(list_data_instructions[auxda].value[aux_index_value - 1]) & 0xFFFF).toString(16).padStart(4, "0"); + break; + case "word": + list_data_elem = (parseInt(list_data_instructions[auxda].value[aux_index_value - 1]) >>> 0).toString(16).padStart(8, "0"); + break; + case "byte": + list_data_elem = (parseInt(list_data_instructions[auxda].value[aux_index_value - 1]) & 0xFF).toString(16).padStart(2, "0"); + break; + case "float": + buff = new ArrayBuffer(4); + buff_view = new DataView(buff); + buff_view.setFloat32(0, parseFloat(list_data_instructions[auxda].value[aux_index_value - 1]), true); + list_data_elem = buff_view.getUint32(0, true).toString(16).padStart(8, '0'); + + // list_data_elem = (parseFloat(list_data_instructions[auxda].value[aux_index_value - 1])).toString(16); + break; + case "double": + buff = new ArrayBuffer(8); + buff_view = new DataView(buff); + buff_view.setFloat64(0, parseFloat(list_data_instructions[auxda].value[aux_index_value - 1]), true); + let lo = buff_view.getUint32(0, true).toString(16).padStart(8, '0'); + let hi = buff_view.getUint32(4, true).toString(16).padStart(8, '0'); + + list_data_elem = lo + hi; + break; + } + dumpdatainstructions64[dumpdatainstructions64.length - 1][1] = list_data_elem + dumpdatainstructions64[dumpdatainstructions64.length -1][1]; + }else { // Caso de ser el valor positivo o sin signo + dumpdatainstructions64[dumpdatainstructions64.length -1][1] = list_data_instructions[auxda].value[aux_index_value - 1].toString(16) + dumpdatainstructions64[dumpdatainstructions64.length -1][1]; + } + } + } + else dumpdatainstructions64[dumpdatainstructions64.length -1][1] = auxinsn[1] + dumpdatainstructions64[dumpdatainstructions64.length -1][1]; + inside_label64 += 1; + }else + dumpdatainstructions64.push(auxinsn); + } + } + else if(labelmatch && sectionasm64 != 0){ + // console.log("Identificado:", labelmatch); + auxinsn.push((labelmatch[1].trim().replace(/0+/,"") === "") ? "0" : labelmatch[1].trim().replace(/0+/,"")); + auxinsn.push(""); + auxinsn.push(""); + auxinsn.push(1); + auxinsn.push(labelmatch[2].trim()); + console.log("labelmatch: ", labelmatch); + if (!document.app.$data.c_kernel && labelmatch[2].trim().includes("kernel")) + document.app.$data.entry_elf = parseInt(labelmatch[1].trim(), 16).toString(16); // (labelmatch[1].trim().replace(/0+/,"") === "") ? "0" : labelmatch[1].trim().replace(/0+/,""); + else if(labelmatch[2].trim() === "_main" && document.app.$data.c_kernel){ + document.app.$data.entry_elf = parseInt(labelmatch[1].trim(), 16).toString(16); // (labelmatch[1].trim().replace(/0+/,"") === "") ? "0" : labelmatch[1].trim().replace(/0+/,""); + } + + if (document.app.$data.entry_elf !== undefined && !document.app.$data.entry_elf.startsWith("0x")) + document.app.$data.entry_elf = "0x" + document.app.$data.entry_elf; + + if (sectionasm64 === 1){ + dumptextinstructions64.push(auxinsn); + }else if (sectionasm64 === 2){ + dumpdatainstructions64.push(auxinsn); + inside_label64 = 0; + } + + } + + // else { + // // console.log("objdump: 1", message); + // } + + // identificacion de que seccion de codigo entramos. + if (message.search(".text") != -1) + sectionasm64 = 1; + if (message.search(".data") != -1) + sectionasm64 = 2; + if (message.search(".riscv.attributes") != -1) + sectionasm64 = 0; + + console.log(message); + // console.log(dumpdatainstructions64); + } + + } + + var out = Module["print"] || console.log.bind(console); + + var err = Module["printErr"] || console.warn.bind(console); + +// Merge back in the overrides +Object.assign(Module, moduleOverrides); + +// Free the object hierarchy contained in the overrides, this lets the GC +// reclaim data used. +moduleOverrides = null; + +checkIncomingModuleAPI(); + +// Emit code to handle expected values on the Module object. This applies Module.x +// to the proper local x. This has two benefits: first, we only emit it if it is +// expected to arrive, and second, by using a local everywhere else that can be +// minified. +if (Module["arguments"]) arguments_ = Module["arguments"]; + +legacyModuleProp("arguments", "arguments_"); + +if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + +legacyModuleProp("thisProgram", "thisProgram"); + +// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message +// Assertions on removed incoming Module JS APIs. +assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["cdInitializerPrefixURL"] == "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["filePackagePrefixURL"] == "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["read"] == "undefined", "Module.read option was removed"); + +assert(typeof Module["readAsync"] == "undefined", "Module.readAsync option was removed (modify readAsync in JS)"); + +assert(typeof Module["readBinary"] == "undefined", "Module.readBinary option was removed (modify readBinary in JS)"); + +assert(typeof Module["setWindowTitle"] == "undefined", "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"); + +assert(typeof Module["TOTAL_MEMORY"] == "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"); + +legacyModuleProp("asm", "wasmExports"); + +legacyModuleProp("readAsync", "readAsync"); + +legacyModuleProp("readBinary", "readBinary"); + +legacyModuleProp("setWindowTitle", "setWindowTitle"); + +var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js"; + +var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js"; + +var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js"; + +var FETCHFS = "FETCHFS is no longer included by default; build with -lfetchfs.js"; + +var ICASEFS = "ICASEFS is no longer included by default; build with -licasefs.js"; + +var JSFILEFS = "JSFILEFS is no longer included by default; build with -ljsfilefs.js"; + +var OPFS = "OPFS is no longer included by default; build with -lopfs.js"; + +var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js"; + +assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable."); + +// end include: shell.js +// include: preamble.js +// === Preamble library stuff === +// Documentation for the public APIs defined in this file must be updated in: +// site/source/docs/api_reference/preamble.js.rst +// A prebuilt local version of the documentation is available at: +// site/build/text/docs/api_reference/preamble.js.txt +// You can also build docs locally as HTML or other formats in site/ +// An online HTML version (which may be of a different version of Emscripten) +// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html +var wasmBinary = Module["wasmBinary"]; + +legacyModuleProp("wasmBinary", "wasmBinary"); + +if (typeof WebAssembly != "object") { + err("no native wasm support detected"); +} + +// Wasm globals +var wasmMemory; + +//======================================== +// Runtime essentials +//======================================== +// whether we are quitting the application. no code should run after this. +// set in exit() and abort() +var ABORT = false; + +// set by exit() and abort(). Passed to 'onExit' handler. +// NOTE: This is also used as the process return code code in shell environments +// but only when noExitRuntime is false. +var EXITSTATUS; + +// In STRICT mode, we only define assert() when ASSERTIONS is set. i.e. we +// don't define it at all in release modes. This matches the behaviour of +// MINIMAL_RUNTIME. +// TODO(sbc): Make this the default even without STRICT enabled. +/** @type {function(*, string=)} */ function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } +} + +// We used to include malloc/free by default in the past. Show a helpful error in +// builds with assertions. +function _malloc() { + abort("malloc() called but not included in the build - add `_malloc` to EXPORTED_FUNCTIONS"); +} + +function _free() { + // Show a helpful error since we used to include free by default in the past. + abort("free() called but not included in the build - add `_free` to EXPORTED_FUNCTIONS"); +} + +// Memory management +var HEAP, /** @type {!Int8Array} */ HEAP8, /** @type {!Uint8Array} */ HEAPU8, /** @type {!Int16Array} */ HEAP16, /** @type {!Uint16Array} */ HEAPU16, /** @type {!Int32Array} */ HEAP32, /** @type {!Uint32Array} */ HEAPU32, /** @type {!Float32Array} */ HEAPF32, /* BigInt64Array type is not correctly defined in closure +/** not-@type {!BigInt64Array} */ HEAP64, /* BigUint64Array type is not correctly defined in closure +/** not-t@type {!BigUint64Array} */ HEAPU64, /** @type {!Float64Array} */ HEAPF64; + +var runtimeInitialized = false; + +var runtimeExited = false; + +/** + * Indicates whether filename is delivered via file protocol (as opposed to http/https) + * @noinline + */ var isFileURI = filename => filename.startsWith("file://"); + +// include: runtime_shared.js +// include: runtime_stack_check.js +// Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode. +function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + // If the stack ends at address zero we write our cookies 4 bytes into the + // stack. This prevents interference with SAFE_HEAP and ASAN which also + // monitor writes to address zero. + if (max == 0) { + max += 4; + } + // The stack grow downwards towards _emscripten_stack_get_end. + // We write cookies to the final two words in the stack and detect if they are + // ever overwritten. + SAFE_HEAP_STORE(((max) / 4) * 4, 34821223, 4); + SAFE_HEAP_STORE((((max) + (4)) / 4) * 4, 2310721022, 4); +} + +function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + // See writeStackCookie(). + if (max == 0) { + max += 4; + } + var cookie1 = SAFE_HEAP_LOAD(((max) / 4) * 4, 4, 1); + var cookie2 = SAFE_HEAP_LOAD((((max) + (4)) / 4) * 4, 4, 1); + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`); + } +} + +// end include: runtime_stack_check.js +// include: runtime_exceptions.js +// end include: runtime_exceptions.js +// include: runtime_debug.js +// Endianness check +(() => { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"; +})(); + +if (Module["ENVIRONMENT"]) { + throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)"); +} + +function legacyModuleProp(prop, newName, incoming = true) { + if (!Object.getOwnPropertyDescriptor(Module, prop)) { + Object.defineProperty(Module, prop, { + configurable: true, + get() { + let extra = incoming ? " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)" : ""; + abort(`\`Module.${prop}\` has been replaced by \`${newName}\`` + extra); + } + }); + } +} + +function ignoredModuleProp(prop) { + if (Object.getOwnPropertyDescriptor(Module, prop)) { + abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`); + } +} + +// forcing the filesystem exports a few things by default +function isExportedByForceFilesystem(name) { + return name === "FS_createPath" || name === "FS_createDataFile" || name === "FS_createPreloadedFile" || name === "FS_unlink" || name === "addRunDependency" || // The old FS has some functionality that WasmFS lacks. + name === "FS_createLazyFile" || name === "FS_createDevice" || name === "removeRunDependency"; +} + +/** + * Intercept access to a global symbol. This enables us to give informative + * warnings/errors when folks attempt to use symbols they did not include in + * their build, or no symbols that no longer exist. + */ function hookGlobalSymbolAccess(sym, func) { + if (typeof globalThis != "undefined" && !Object.getOwnPropertyDescriptor(globalThis, sym)) { + Object.defineProperty(globalThis, sym, { + configurable: true, + get() { + func(); + return undefined; + } + }); + } +} + +function missingGlobal(sym, msg) { + hookGlobalSymbolAccess(sym, () => { + warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`); + }); +} + +missingGlobal("buffer", "Please use HEAP8.buffer or wasmMemory.buffer"); + +missingGlobal("asm", "Please use wasmExports instead"); + +function missingLibrarySymbol(sym) { + hookGlobalSymbolAccess(sym, () => { + // Can't `abort()` here because it would break code that does runtime + // checks. e.g. `if (typeof SDL === 'undefined')`. + var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`; + // DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in + // library.js, which means $name for a JS name with no prefix, or name + // for a JS name like _name. + var librarySymbol = sym; + if (!librarySymbol.startsWith("_")) { + librarySymbol = "$" + sym; + } + msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`; + if (isExportedByForceFilesystem(sym)) { + msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + warnOnce(msg); + }); + // Any symbol that is not included from the JS library is also (by definition) + // not exported on the Module object. + unexportedRuntimeSymbol(sym); +} + +function unexportedRuntimeSymbol(sym) { + if (!Object.getOwnPropertyDescriptor(Module, sym)) { + Object.defineProperty(Module, sym, { + configurable: true, + get() { + var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`; + if (isExportedByForceFilesystem(sym)) { + msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + abort(msg); + } + }); + } +} + +// Used by XXXXX_DEBUG settings to output debug messages. +function dbg(...args) { + // TODO(sbc): Make this configurable somehow. Its not always convenient for + // logging to show up as warnings. + console.warn(...args); +} + +// end include: runtime_debug.js +// include: memoryprofiler.js +// end include: memoryprofiler.js +// include: runtime_safe_heap.js +/** @param {number|boolean=} isFloat */ function getSafeHeapType(bytes, isFloat) { + switch (bytes) { + case 1: + return "i8"; + + case 2: + return "i16"; + + case 4: + return isFloat ? "float" : "i32"; + + case 8: + return isFloat ? "double" : "i64"; + + default: + abort(`getSafeHeapType() invalid bytes=${bytes}`); + } +} + +/** @param {number|boolean=} isFloat */ function SAFE_HEAP_STORE(dest, value, bytes, isFloat) { + if (dest <= 0) abort(`segmentation fault storing ${bytes} bytes to address ${dest}`); + if (dest % bytes !== 0) abort(`alignment error storing to address ${dest}, which was expected to be aligned to a multiple of ${bytes}`); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk(0); + if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when storing ${bytes} bytes to address ${dest}. DYNAMICTOP=${brk}`); + if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`); + // sbrk-managed memory must be above the stack + if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`); + } + setValue_safe(dest, value, getSafeHeapType(bytes, isFloat)); + return value; +} + +function SAFE_HEAP_STORE_D(dest, value, bytes) { + return SAFE_HEAP_STORE(dest, value, bytes, true); +} + +/** @param {number|boolean=} isFloat */ function SAFE_HEAP_LOAD(dest, bytes, unsigned, isFloat) { + if (dest <= 0) abort(`segmentation fault loading ${bytes} bytes from address ${dest}`); + if (dest % bytes !== 0) abort(`alignment error loading from address ${dest}, which was expected to be aligned to a multiple of ${bytes}`); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk(0); + if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when loading ${bytes} bytes from address ${dest}. DYNAMICTOP=${brk}`); + if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`); + // sbrk-managed memory must be above the stack + if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`); + } + var type = getSafeHeapType(bytes, isFloat); + var ret = getValue_safe(dest, type); + if (unsigned) ret = unSign(ret, parseInt(type.slice(1), 10)); + return ret; +} + +function SAFE_HEAP_LOAD_D(dest, bytes, unsigned) { + return SAFE_HEAP_LOAD(dest, bytes, unsigned, true); +} + +function SAFE_FT_MASK(value, mask) { + var ret = value & mask; + if (ret !== value) { + abort(`Function table mask error: function pointer is ${value} which is masked by ${mask}, the likely cause of this is that the function pointer is being called by the wrong type.`); + } + return ret; +} + +function segfault() { + abort("segmentation fault"); +} + +function alignfault() { + abort("alignment fault"); +} + +// end include: runtime_safe_heap.js +function updateMemoryViews() { + var b = wasmMemory.buffer; + Module["HEAP8"] = HEAP8 = new Int8Array(b); + Module["HEAP16"] = HEAP16 = new Int16Array(b); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(b); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(b); + Module["HEAP32"] = HEAP32 = new Int32Array(b); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(b); + Module["HEAPF32"] = HEAPF32 = new Float32Array(b); + Module["HEAPF64"] = HEAPF64 = new Float64Array(b); + Module["HEAP64"] = HEAP64 = new BigInt64Array(b); + Module["HEAPU64"] = HEAPU64 = new BigUint64Array(b); +} + +// end include: runtime_shared.js +assert(!Module["STACK_SIZE"], "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"); + +assert(typeof Int32Array != "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, "JS engine does not provide full typed array support"); + +// If memory is defined in wasm, the user can't provide it, or set INITIAL_MEMORY +assert(!Module["wasmMemory"], "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"); + +assert(!Module["INITIAL_MEMORY"], "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically"); + +function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(onPreRuns); +} + +function initRuntime() { + assert(!runtimeInitialized); + runtimeInitialized = true; + checkStackCookie(); + if (!Module["noFSInit"] && !FS.initialized) FS.init(); + TTY.init(); + wasmExports["__wasm_call_ctors"](); + FS.ignorePermissions = false; +} + +function preMain() { + checkStackCookie(); +} + +function exitRuntime() { + assert(!runtimeExited); + checkStackCookie(); + ___funcs_on_exit(); + // Native atexit() functions + FS.quit(); + TTY.shutdown(); + runtimeExited = true; +} + +function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(onPostRuns); +} + +// A counter of dependencies for calling run(). If we need to +// do asynchronous work before running, increment this and +// decrement it. Incrementing must happen in a place like +// Module.preRun (used by emcc to add file preloading). +// Note that you can add dependencies in preRun, even though +// it happens right before run - run will be postponed until +// the dependencies are met. +var runDependencies = 0; + +var dependenciesFulfilled = null; + +// overridden to take different actions when all run dependencies are fulfilled +var runDependencyTracking = {}; + +var runDependencyWatcher = null; + +function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } +} + +function addRunDependency(id) { + runDependencies++; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if (runDependencyWatcher === null && typeof setInterval != "undefined") { + // Check for missing dependencies every few seconds + runDependencyWatcher = setInterval(() => { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err(`dependency: ${dep}`); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } +} + +function removeRunDependency(id) { + runDependencies--; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } +} + +/** @param {string|number=} what */ function abort(what) { + Module["onAbort"]?.(what); + what = "Aborted(" + what + ")"; + // TODO(sbc): Should we remove printing and leave it up to whoever + // catches the exception? + err(what); + ABORT = true; + // Use a wasm runtime error, because a JS error might be seen as a foreign + // exception, which means we'd run destructors on it. We need the error to + // simply make the program stop. + // FIXME This approach does not work in Wasm EH because it currently does not assume + // all RuntimeErrors are from traps; it decides whether a RuntimeError is from + // a trap or not based on a hidden field within the object. So at the moment + // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that + // allows this in the wasm spec. + // Suppress closure compiler warning here. Closure compiler's builtin extern + // definition for WebAssembly.RuntimeError claims it takes no arguments even + // though it can. + // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed. + /** @suppress {checkTypes} */ var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + // Throw the error whether or not MODULARIZE is set because abort is used + // in code paths apart from instantiation where an exception is expected + // to be thrown when abort is called. + throw e; +} + +function createExportWrapper(name, nargs) { + return (...args) => { + assert(runtimeInitialized, `native function \`${name}\` called before runtime initialization`); + assert(!runtimeExited, `native function \`${name}\` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)`); + var f = wasmExports[name]; + assert(f, `exported native function \`${name}\` not found`); + // Only assert for too many arguments. Too few can be valid since the missing arguments will be zero filled. + assert(args.length <= nargs, `native function \`${name}\` called with ${args.length} args but expects ${nargs}`); + return f(...args); + }; +} + +var wasmBinaryFile; + +function findWasmBinary() { + if (Module["locateFile"]) { + return locateFile("objdump64.wasm"); + } + // Use bundler-friendly `new URL(..., import.meta.url)` pattern; works in browsers too. + return new URL("objdump64.wasm", import.meta.url).href; +} + +function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw "both async and sync fetching of the wasm failed"; +} + +async function getWasmBinary(binaryFile) { + // If we don't have the binary yet, load it asynchronously using readAsync. + if (!wasmBinary) { + // Fetch the binary using readAsync + try { + var response = await readAsync(binaryFile); + return new Uint8Array(response); + } catch {} + } + // Otherwise, getBinarySync should be able to get it synchronously + return getBinarySync(binaryFile); +} + +async function instantiateArrayBuffer(binaryFile, imports) { + try { + var binary = await getWasmBinary(binaryFile); + var instance = await WebAssembly.instantiate(binary, imports); + return instance; + } catch (reason) { + err(`failed to asynchronously prepare wasm: ${reason}`); + // Warn on some common problems. + if (isFileURI(wasmBinaryFile)) { + err(`warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`); + } + abort(reason); + } +} + +async function instantiateAsync(binary, binaryFile, imports) { + if (!binary && typeof WebAssembly.instantiateStreaming == "function" && !isFileURI(binaryFile) && !ENVIRONMENT_IS_NODE) { + try { + var response = fetch(binaryFile, { + credentials: "same-origin" + }); + var instantiationResult = await WebAssembly.instantiateStreaming(response, imports); + return instantiationResult; + } catch (reason) { + // We expect the most common failure cause to be a bad MIME type for the binary, + // in which case falling back to ArrayBuffer instantiation should work. + err(`wasm streaming compile failed: ${reason}`); + err("falling back to ArrayBuffer instantiation"); + } + } + return instantiateArrayBuffer(binaryFile, imports); +} + +function getWasmImports() { + // prepare imports + return { + "env": wasmImports, + "wasi_snapshot_preview1": wasmImports + }; +} + +// Create the wasm instance. +// Receives the wasm imports, returns the exports. +async function createWasm() { + // Load the wasm module and create an instance of using native support in the JS engine. + // handle a generated wasm instance, receiving its exports and + // performing other necessary setup + /** @param {WebAssembly.Module=} module*/ function receiveInstance(instance, module) { + wasmExports = instance.exports; + wasmExports = applySignatureConversions(wasmExports); + wasmMemory = wasmExports["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateMemoryViews(); + removeRunDependency("wasm-instantiate"); + return wasmExports; + } + // wait for the pthread pool (if any) + addRunDependency("wasm-instantiate"); + // Prefer streaming instantiation if available. + // Async compilation can be confusing when an error on the page overwrites Module + // (for example, if the order of elements is wrong, and the one defining Module is + // later), so we save Module and check it later. + var trueModule = Module; + function receiveInstantiationResult(result) { + // 'result' is a ResultObject object which has both the module and instance. + // receiveInstance() will swap in the exports (to Module.asm) so they can be called + assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"); + trueModule = null; + // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line. + // When the regression is fixed, can restore the above PTHREADS-enabled path. + return receiveInstance(result["instance"]); + } + var info = getWasmImports(); + // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback + // to manually instantiate the Wasm module themselves. This allows pages to + // run the instantiation parallel to any other async startup actions they are + // performing. + // Also pthreads and wasm workers initialize the wasm instance through this + // path. + if (Module["instantiateWasm"]) { + return new Promise((resolve, reject) => { + try { + Module["instantiateWasm"](info, (mod, inst) => { + receiveInstance(mod, inst); + resolve(mod.exports); + }); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + reject(e); + } + }); + } + wasmBinaryFile ??= findWasmBinary(); + try { + var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info); + var exports = receiveInstantiationResult(result); + return exports; + } catch (e) { + // If instantiation fails, reject the module ready promise. + readyPromiseReject(e); + return Promise.reject(e); + } +} + +// === Body === +// end include: preamble.js +class ExitStatus { + name="ExitStatus"; + constructor(status) { + this.message = `Program terminated with exit(${status})`; + this.status = status; + } +} + +var callRuntimeCallbacks = callbacks => { + while (callbacks.length > 0) { + // Pass the module as the first argument. + callbacks.shift()(Module); + } +}; + +var onPostRuns = []; + +var addOnPostRun = cb => onPostRuns.unshift(cb); + +var onPreRuns = []; + +var addOnPreRun = cb => onPreRuns.unshift(cb); + +/** + * @param {number} ptr + * @param {string} type + */ function getValue(ptr, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + return SAFE_HEAP_LOAD(ptr, 1, 0); + + case "i8": + return SAFE_HEAP_LOAD(ptr, 1, 0); + + case "i16": + return SAFE_HEAP_LOAD(((ptr) / 2) * 2, 2, 0); + + case "i32": + return SAFE_HEAP_LOAD(((ptr) / 4) * 4, 4, 0); + + case "i64": + return HEAP64[((ptr) / 8)]; + + case "float": + return SAFE_HEAP_LOAD_D(((ptr) / 4) * 4, 4, 0); + + case "double": + return SAFE_HEAP_LOAD_D(((ptr) / 8) * 8, 8, 0); + + case "*": + return Number(HEAPU64[((ptr) / 8)]); + + default: + abort(`invalid type for getValue: ${type}`); + } +} + +function getValue_safe(ptr, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + return HEAP8[ptr]; + + case "i8": + return HEAP8[ptr]; + + case "i16": + return HEAP16[((ptr) / 2)]; + + case "i32": + return HEAP32[((ptr) / 4)]; + + case "i64": + return HEAP64[((ptr) / 8)]; + + case "float": + return HEAPF32[((ptr) / 4)]; + + case "double": + return HEAPF64[((ptr) / 8)]; + + case "*": + return Number(HEAPU64[((ptr) / 8)]); + + default: + abort(`invalid type for getValue: ${type}`); + } +} + +var noExitRuntime = Module["noExitRuntime"] || false; + +var ptrToString = ptr => { + assert(typeof ptr === "number"); + return "0x" + ptr.toString(16).padStart(8, "0"); +}; + +/** + * @param {number} ptr + * @param {number} value + * @param {string} type + */ function setValue(ptr, value, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + SAFE_HEAP_STORE(ptr, value, 1); + break; + + case "i8": + SAFE_HEAP_STORE(ptr, value, 1); + break; + + case "i16": + SAFE_HEAP_STORE(((ptr) / 2) * 2, value, 2); + break; + + case "i32": + SAFE_HEAP_STORE(((ptr) / 4) * 4, value, 4); + break; + + case "i64": + HEAP64[((ptr) / 8)] = BigInt(value); + break; + + case "float": + SAFE_HEAP_STORE_D(((ptr) / 4) * 4, value, 4); + break; + + case "double": + SAFE_HEAP_STORE_D(((ptr) / 8) * 8, value, 8); + break; + + case "*": + HEAPU64[((ptr) / 8)] = BigInt(value); + break; + + default: + abort(`invalid type for setValue: ${type}`); + } +} + +function setValue_safe(ptr, value, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + HEAP8[ptr] = value; + break; + + case "i8": + HEAP8[ptr] = value; + break; + + case "i16": + HEAP16[((ptr) / 2)] = value; + break; + + case "i32": + HEAP32[((ptr) / 4)] = value; + break; + + case "i64": + HEAP64[((ptr) / 8)] = BigInt(value); + break; + + case "float": + HEAPF32[((ptr) / 4)] = value; + break; + + case "double": + HEAPF64[((ptr) / 8)] = value; + break; + + case "*": + HEAPU64[((ptr) / 8)] = BigInt(value); + break; + + default: + abort(`invalid type for setValue: ${type}`); + } +} + +var stackRestore = val => __emscripten_stack_restore(val); + +var stackSave = () => _emscripten_stack_get_current(); + +var unSign = (value, bits) => { + if (value >= 0) { + return value; + } + // Need some trickery, since if bits == 32, we are right at the limit of the + // bits JS uses in bitshifts + return bits <= 32 ? 2 * Math.abs(1 << (bits - 1)) + value : Math.pow(2, bits) + value; +}; + +var warnOnce = text => { + warnOnce.shown ||= {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + if (ENVIRONMENT_IS_NODE) text = "warning: " + text; + err(text); + } +}; + +var INT53_MAX = 9007199254740992; + +var INT53_MIN = -9007199254740992; + +var bigintToI53Checked = num => (num < INT53_MIN || num > INT53_MAX) ? NaN : Number(num); + +var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder : undefined; + +/** + * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given + * array that contains uint8 values, returns a copy of that string as a + * Javascript String object. + * heapOrArray is either a regular array, or a JavaScript typed array view. + * @param {number=} idx + * @param {number=} maxBytesToRead + * @return {string} + */ var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + // TextDecoder needs to know the byte length in advance, it doesn't stop on + // null terminator by itself. Also, use the length info to avoid running tiny + // strings through TextDecoder, since .subarray() allocates garbage. + // (As a tiny code save trick, compare endPtr against endIdx using a negation, + // so that undefined/NaN means Infinity) + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ""; + // If building with TextDecoder, we have already computed the string length + // above, so test loop end condition against that + while (idx < endPtr) { + // For UTF8 byte structure, see: + // http://en.wikipedia.org/wiki/UTF-8#Description + // https://www.ietf.org/rfc/rfc2279.txt + // https://tools.ietf.org/html/rfc3629 + var u0 = heapOrArray[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte " + ptrToString(u0) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"); + u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63); + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } + } + return str; +}; + +/** + * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the + * emscripten HEAP, returns a copy of that string as a Javascript String object. + * + * @param {number} ptr + * @param {number=} maxBytesToRead - An optional length that specifies the + * maximum number of bytes to read. You can omit this parameter to scan the + * string until the first 0 byte. If maxBytesToRead is passed, and the string + * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the + * string will cut short at that byte index (i.e. maxBytesToRead will not + * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing + * frequent uses of UTF8ToString() with and without maxBytesToRead may throw + * JS JIT optimizations off, so it is worth to consider consistently using one + * @return {string} + */ var UTF8ToString = (ptr, maxBytesToRead) => { + assert(typeof ptr == "number", `UTF8ToString expects a number (got ${typeof ptr})`); + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; +}; + +function ___assert_fail(condition, filename, line, func) { + condition = bigintToI53Checked(condition); + filename = bigintToI53Checked(filename); + func = bigintToI53Checked(func); + return abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [ filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function" ]); +} + +var PATH = { + isAbs: path => path.charAt(0) === "/", + splitPath: filename => { + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (;up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: path => { + var isAbsolute = PATH.isAbs(path), trailingSlash = path.slice(-1) === "/"; + // Normalize the path + path = PATH.normalizeArray(path.split("/").filter(p => !!p), !isAbsolute).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: path => { + var result = PATH.splitPath(path), root = result[0], dir = result[1]; + if (!root && !dir) { + // No dirname whatsoever + return "."; + } + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.slice(0, -1); + } + return root + dir; + }, + basename: path => path && path.match(/([^\/]+|\/)\/*$/)[1], + join: (...paths) => PATH.normalize(paths.join("/")), + join2: (l, r) => PATH.normalize(l + "/" + r) +}; + +var initRandomFill = () => view => crypto.getRandomValues(view); + +var randomFill = view => { + // Lazily init on the first invocation. + (randomFill = initRandomFill())(view); +}; + +var PATH_FS = { + resolve: (...args) => { + var resolvedPath = "", resolvedAbsolute = false; + for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? args[i] : FS.cwd(); + // Skip empty and invalid entries + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter(p => !!p), !resolvedAbsolute).join("/"); + return ((resolvedAbsolute ? "/" : "") + resolvedPath) || "."; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).slice(1); + to = PATH_FS.resolve(to).slice(1); + function trim(arr) { + var start = 0; + for (;start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (;end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + } +}; + +var FS_stdin_getChar_buffer = []; + +var lengthBytesUTF8 = str => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + var c = str.charCodeAt(i); + // possibly a lead surrogate + if (c <= 127) { + len++; + } else if (c <= 2047) { + len += 2; + } else if (c >= 55296 && c <= 57343) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; +}; + +var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + assert(typeof str === "string", `stringToUTF8Array expects a string (got ${typeof str})`); + // Parameter maxBytesToWrite is not optional. Negative values, 0, null, + // undefined and false each don't write out any bytes. + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + // -1 for string null terminator. + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description + // and https://www.ietf.org/rfc/rfc2279.txt + // and https://tools.ietf.org/html/rfc3629 + var u = str.charCodeAt(i); + // possibly a lead surrogate + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = 65536 + ((u & 1023) << 10) | (u1 & 1023); + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | (u >> 6); + heap[outIdx++] = 128 | (u & 63); + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | (u >> 12); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) warnOnce("Invalid Unicode code point " + ptrToString(u) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."); + heap[outIdx++] = 240 | (u >> 18); + heap[outIdx++] = 128 | ((u >> 12) & 63); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } + } + // Null-terminate the pointer to the buffer. + heap[outIdx] = 0; + return outIdx - startIdx; +}; + +/** @type {function(string, boolean=, number=)} */ var intArrayFromString = (stringy, dontAddNull, length) => { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; +}; + +var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + // we will read data by chunks of BUFSIZE + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + // For some reason we must suppress a closure warning here, even though + // fd definitely exists on process.stdin, and is even the proper way to + // get the fd of stdin, + // https://github.com/nodejs/help/issues/2136#issuecomment-523649904 + // This started to happen after moving this logic out of library_tty.js, + // so it is related to the surrounding code in some unclear manner. + /** @suppress {missingProperties} */ var fd = process.stdin.fd; + try { + bytesRead = fs.readSync(fd, buf, 0, BUFSIZE); + } catch (e) { + // Cross-platform differences: on Windows, reading EOF throws an + // exception, but on other OSes, reading EOF returns 0. Uniformize + // behavior by treating the EOF exception to return 0. + if (e.toString().includes("EOF")) bytesRead = 0; else throw e; + } + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString("utf-8"); + } + } else if (typeof window != "undefined" && typeof window.prompt == "function") { + // Browser. + result = window.prompt("Input: "); + // returns null on cancel + if (result !== null) { + result += "\n"; + } + } else {} + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); +}; + +var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { + input: [], + output: [], + ops + }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + // flush any pending line data + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + } + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + // typical setting + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ 3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + // currently just ignore + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [ 24, 80 ]; + } + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } + } + } +}; + +var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); +}; + +var alignMemory = (size, alignment) => { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; +}; + +var mmapAlloc = size => { + abort("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported"); +}; + +var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, "/", 16895, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + // no supported + throw new FS.ErrnoError(63); + } + MEMFS.ops_table ||= { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink + }, + stream: { + llseek: MEMFS.stream_ops.llseek + } + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync + } + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink + }, + stream: {} + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: FS.chrdev_stream_ops + } + }; + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + // The actual number of bytes used in the typed array, as opposed to contents.length which gives the whole capacity. + // When the byte data of the file is populated, this will point to either a typed array, or a normal JS array. Typed arrays are preferred + // for performance, and used by default. However, typed arrays are not resizable like normal JS arrays are, so there is a small disk size + // penalty involved for appending file writes that continuously grow a file similar to std::vector capacity vs used -scheme. + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.atime = node.mtime = node.ctime = Date.now(); + // add the new node to the parent + if (parent) { + parent.contents[name] = node; + parent.atime = parent.mtime = parent.ctime = node.atime; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes); + // Make sure to not return excess unused bytes. + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + // No need to expand, the storage was already large enough. + // Don't expand strictly to the given requested limit if it's only a very small increase, but instead geometrically grow capacity. + // For small filesizes (<1MB), perform size*2 geometric increase, but for large sizes, do a much more conservative size*1.125 increase to + // avoid overshooting the allocation cap by a very large margin. + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max(newCapacity, (prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125)) >>> 0); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + // At minimum allocate 256b for each file when expanding. + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + // Allocate new storage. + if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + // Fully decommit when requesting a resize to zero. + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + // Allocate new storage. + if (oldContents) { + node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes))); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + // device numbers reuse inode numbers. + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.atime); + attr.mtime = new Date(node.mtime); + attr.ctime = new Date(node.ctime); + // NOTE: In our implementation, st_blocks = Math.ceil(st_size/st_blksize), + // but this is not required by the standard. + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + for (const key of [ "mode", "atime", "mtime", "ctime" ]) { + if (attr[key] != null) { + node[key] = attr[key]; + } + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw new FS.ErrnoError(44); + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + if (FS.isDir(old_node.mode)) { + // if we're overwriting a directory at new_name, make sure it's empty. + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + FS.hashRemoveNode(new_node); + } + // do the internal rewiring + delete old_node.parent.contents[old_node.name]; + new_dir.contents[new_name] = old_node; + old_node.name = new_name; + new_dir.ctime = new_dir.mtime = old_node.parent.ctime = old_node.parent.mtime = Date.now(); + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + readdir(node) { + return [ ".", "..", ...Object.keys(node.contents) ]; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + } + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + // non-trivial, and typed array + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + // The data buffer should be a typed array view + assert(!(buffer instanceof ArrayBuffer)); + // If the buffer is located in main memory (HEAP), and if + // memory can grow, we can't hold on to references of the + // memory buffer, as they may get invalidated. That means we + // need to do copy its contents. + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.mtime = node.ctime = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + // This write is from a typed array to a typed array? + if (canOwn) { + assert(position === 0, "canOwn must imply no weird position inside the file"); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data. + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + // Writing to an already allocated and used subrange of the file? + node.contents.set(buffer.subarray(offset, offset + length), position); + return length; + } + } + // Appending to an existing file and we need to reallocate, or source data did not come as a typed array. + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + // Use typed array write which is available. + node.contents.set(buffer.subarray(offset, offset + length), position); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + // Only make a new copy when MAP_PRIVATE is specified. + if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) { + // We can't emulate MAP_SHARED when the file is not backed by the + // buffer we're mapping to (e.g. the HEAP buffer). + allocated = false; + ptr = contents.byteOffset; + } else { + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + if (contents) { + // Try to avoid unnecessary slices. + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call(contents, position, position + length); + } + } + HEAP8.set(contents, ptr); + } + } + return { + ptr, + allocated + }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + // should we check if bytesWritten and length are the same? + return 0; + } + } +}; + +var asyncLoad = async url => { + var arrayBuffer = await readAsync(url); + assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`); + return new Uint8Array(arrayBuffer); +}; + +var FS_createDataFile = (parent, name, fileData, canRead, canWrite, canOwn) => { + FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); +}; + +var preloadPlugins = Module["preloadPlugins"] || []; + +var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + // Ensure plugins are ready. + if (typeof Browser != "undefined") Browser.init(); + var handled = false; + preloadPlugins.forEach(plugin => { + if (handled) return; + if (plugin["canHandle"](fullname)) { + plugin["handle"](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; +}; + +var FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => { + // TODO we should allow people to just pass in a complete filename instead + // of parent and name being that we just join them anyways + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + // might have several active requests for the same fullname + function processData(byteArray) { + function finish(byteArray) { + preFinish?.(); + if (!dontCreateFile) { + FS_createDataFile(parent, name, byteArray, canRead, canWrite, canOwn); + } + onload?.(); + removeRunDependency(dep); + } + if (FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + onerror?.(); + removeRunDependency(dep); + })) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url).then(processData, onerror); + } else { + processData(url); + } +}; + +var FS_modeStringToFlags = str => { + var flagModes = { + "r": 0, + "r+": 2, + "w": 512 | 64 | 1, + "w+": 512 | 64 | 2, + "a": 1024 | 64 | 1, + "a+": 1024 | 64 | 2 + }; + var flags = flagModes[str]; + if (typeof flags == "undefined") { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; +}; + +var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; +}; + +var strError = errno => UTF8ToString(_strerror(errno)); + +var ERRNO_CODES = { + "EPERM": 63, + "ENOENT": 44, + "ESRCH": 71, + "EINTR": 27, + "EIO": 29, + "ENXIO": 60, + "E2BIG": 1, + "ENOEXEC": 45, + "EBADF": 8, + "ECHILD": 12, + "EAGAIN": 6, + "EWOULDBLOCK": 6, + "ENOMEM": 48, + "EACCES": 2, + "EFAULT": 21, + "ENOTBLK": 105, + "EBUSY": 10, + "EEXIST": 20, + "EXDEV": 75, + "ENODEV": 43, + "ENOTDIR": 54, + "EISDIR": 31, + "EINVAL": 28, + "ENFILE": 41, + "EMFILE": 33, + "ENOTTY": 59, + "ETXTBSY": 74, + "EFBIG": 22, + "ENOSPC": 51, + "ESPIPE": 70, + "EROFS": 69, + "EMLINK": 34, + "EPIPE": 64, + "EDOM": 18, + "ERANGE": 68, + "ENOMSG": 49, + "EIDRM": 24, + "ECHRNG": 106, + "EL2NSYNC": 156, + "EL3HLT": 107, + "EL3RST": 108, + "ELNRNG": 109, + "EUNATCH": 110, + "ENOCSI": 111, + "EL2HLT": 112, + "EDEADLK": 16, + "ENOLCK": 46, + "EBADE": 113, + "EBADR": 114, + "EXFULL": 115, + "ENOANO": 104, + "EBADRQC": 103, + "EBADSLT": 102, + "EDEADLOCK": 16, + "EBFONT": 101, + "ENOSTR": 100, + "ENODATA": 116, + "ETIME": 117, + "ENOSR": 118, + "ENONET": 119, + "ENOPKG": 120, + "EREMOTE": 121, + "ENOLINK": 47, + "EADV": 122, + "ESRMNT": 123, + "ECOMM": 124, + "EPROTO": 65, + "EMULTIHOP": 36, + "EDOTDOT": 125, + "EBADMSG": 9, + "ENOTUNIQ": 126, + "EBADFD": 127, + "EREMCHG": 128, + "ELIBACC": 129, + "ELIBBAD": 130, + "ELIBSCN": 131, + "ELIBMAX": 132, + "ELIBEXEC": 133, + "ENOSYS": 52, + "ENOTEMPTY": 55, + "ENAMETOOLONG": 37, + "ELOOP": 32, + "EOPNOTSUPP": 138, + "EPFNOSUPPORT": 139, + "ECONNRESET": 15, + "ENOBUFS": 42, + "EAFNOSUPPORT": 5, + "EPROTOTYPE": 67, + "ENOTSOCK": 57, + "ENOPROTOOPT": 50, + "ESHUTDOWN": 140, + "ECONNREFUSED": 14, + "EADDRINUSE": 3, + "ECONNABORTED": 13, + "ENETUNREACH": 40, + "ENETDOWN": 38, + "ETIMEDOUT": 73, + "EHOSTDOWN": 142, + "EHOSTUNREACH": 23, + "EINPROGRESS": 26, + "EALREADY": 7, + "EDESTADDRREQ": 17, + "EMSGSIZE": 35, + "EPROTONOSUPPORT": 66, + "ESOCKTNOSUPPORT": 137, + "EADDRNOTAVAIL": 4, + "ENETRESET": 39, + "EISCONN": 30, + "ENOTCONN": 53, + "ETOOMANYREFS": 141, + "EUSERS": 136, + "EDQUOT": 19, + "ESTALE": 72, + "ENOTSUP": 138, + "ENOMEDIUM": 148, + "EILSEQ": 25, + "EOVERFLOW": 61, + "ECANCELED": 11, + "ENOTRECOVERABLE": 56, + "EOWNERDEAD": 62, + "ESTRPIPE": 135 +}; + +var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: class extends Error { + name="ErrnoError"; + // We set the `name` property to be able to identify `FS.ErrnoError` + // - the `name` is a standard ECMA-262 property of error objects. Kind of good to have it anyway. + // - when using PROXYFS, an error can come from an underlying FS + // as different FS objects have their own FS.ErrnoError each, + // the test `err instanceof FS.ErrnoError` won't detect an error coming from another filesystem, causing bugs. + // we'll use the reliable test `err.name == "ErrnoError"` instead + constructor(errno) { + super(runtimeInitialized ? strError(errno) : ""); + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + } + }, + filesystems: null, + syncFSRequests: 0, + readFiles: {}, + FSStream: class { + shared={}; + get object() { + return this.node; + } + set object(val) { + this.node = val; + } + get isRead() { + return (this.flags & 2097155) !== 1; + } + get isWrite() { + return (this.flags & 2097155) !== 0; + } + get isAppend() { + return (this.flags & 1024); + } + get flags() { + return this.shared.flags; + } + set flags(val) { + this.shared.flags = val; + } + get position() { + return this.shared.position; + } + set position(val) { + this.shared.position = val; + } + }, + FSNode: class { + node_ops={}; + stream_ops={}; + readMode=292 | 73; + writeMode=146; + mounted=null; + constructor(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.rdev = rdev; + this.atime = this.mtime = this.ctime = Date.now(); + } + get read() { + return (this.mode & this.readMode) === this.readMode; + } + set read(val) { + val ? this.mode |= this.readMode : this.mode &= ~this.readMode; + } + get write() { + return (this.mode & this.writeMode) === this.writeMode; + } + set write(val) { + val ? this.mode |= this.writeMode : this.mode &= ~this.writeMode; + } + get isFolder() { + return FS.isDir(this.mode); + } + get isDevice() { + return FS.isChrdev(this.mode); + } + }, + lookupPath(path, opts = {}) { + if (!path) { + throw new FS.ErrnoError(44); + } + opts.follow_mount ??= true; + if (!PATH.isAbs(path)) { + path = FS.cwd() + "/" + path; + } + // limit max consecutive symlinks to 40 (SYMLOOP_MAX). + linkloop: for (var nlinks = 0; nlinks < 40; nlinks++) { + // split the absolute path + var parts = path.split("/").filter(p => !!p); + // start at the root + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = (i === parts.length - 1); + if (islast && opts.parent) { + // stop resolving + break; + } + if (parts[i] === ".") { + continue; + } + if (parts[i] === "..") { + current_path = PATH.dirname(current_path); + current = current.parent; + continue; + } + current_path = PATH.join2(current_path, parts[i]); + try { + current = FS.lookupNode(current, parts[i]); + } catch (e) { + // if noent_okay is true, suppress a ENOENT in the last component + // and return an object with an undefined node. This is needed for + // resolving symlinks in the path when creating a file. + if ((e?.errno === 44) && islast && opts.noent_okay) { + return { + path: current_path + }; + } + throw e; + } + // jump to the mount's root node if this is a mountpoint + if (FS.isMountpoint(current) && (!islast || opts.follow_mount)) { + current = current.mounted.root; + } + // by default, lookupPath will not follow a symlink if it is the final path component. + // setting opts.follow = true will override this behavior. + if (FS.isLink(current.mode) && (!islast || opts.follow)) { + if (!current.node_ops.readlink) { + throw new FS.ErrnoError(52); + } + var link = current.node_ops.readlink(current); + if (!PATH.isAbs(link)) { + link = PATH.dirname(current_path) + "/" + link; + } + path = link + "/" + parts.slice(i + 1).join("/"); + continue linkloop; + } + } + return { + path: current_path, + node: current + }; + } + throw new FS.ErrnoError(32); + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" ? `${mount}/${path}` : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + // if we failed to find it in the cache, call into the VFS + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = [ "r", "w", "rw" ][flag & 3]; + if ((flag & 512)) { + perms += "w"; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + // return 0 if any user, group or owner bits are set. + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + if (!FS.isDir(dir.mode)) return 54; + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + if (!FS.isDir(dir.mode)) { + return 54; + } + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || (flags & (512 | 64))) { + // TODO: check for O_SEARCH? (== search for dir only) + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + checkOpExists(op, err) { + if (!op) { + throw new FS.ErrnoError(err); + } + return op; + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: fd => FS.streams[fd], + createStream(stream, fd = -1) { + assert(fd >= -1); + // clone it, so we can return an instance of FSStream + stream = Object.assign(new FS.FSStream, stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + dupStream(origStream, fd = -1) { + var stream = FS.createStream(origStream, fd); + stream.stream_ops?.dup?.(stream); + return stream; + }, + doSetAttr(stream, node, attr) { + var setattr = stream?.stream_ops.setattr; + var arg = setattr ? stream : node; + setattr ??= node.node_ops.setattr; + FS.checkOpExists(setattr, 63); + setattr(arg, attr); + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + // override node's stream ops with the device's + stream.stream_ops = device.stream_ops; + // forward the open call + stream.stream_ops.open?.(stream); + }, + llseek() { + throw new FS.ErrnoError(70); + } + }, + major: dev => ((dev) >> 8), + minor: dev => ((dev) & 255), + makedev: (ma, mi) => ((ma) << 8 | (mi)), + registerDevice(dev, ops) { + FS.devices[dev] = { + stream_ops: ops + }; + }, + getDevice: dev => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [ mount ]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push(...m.mounts); + } + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + // sync all mounts + mounts.forEach(mount => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + if (typeof type == "string") { + // The filesystem was not included, and instead we have an error + // message stored in the variable. + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + mountpoint = lookup.path; + // use the absolute path + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type, + opts, + mountpoint, + mounts: [] + }; + // create a root node for the fs + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + // set as a mountpoint + node.mounted = mount; + // add the new mount to the current mount's children + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + // destroy the nodes for this mount, and all its child mounts + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach(hash => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + // no longer a mountpoint + node.mounted = null; + // remove this mount from the child mounts + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name) { + throw new FS.ErrnoError(28); + } + if (name === "." || name === "..") { + throw new FS.ErrnoError(20); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + statfs(path) { + return FS.statfsNode(FS.lookupPath(path, { + follow: true + }).node); + }, + statfsStream(stream) { + // We keep a separate statfsStream function because noderawfs overrides + // it. In noderawfs, stream.node is sometimes null. Instead, we need to + // look at stream.path. + return FS.statfsNode(stream.node); + }, + statfsNode(node) { + // NOTE: None of the defaults here are true. We're just returning safe and + // sane values. Currently nodefs and rawfs replace these defaults, + // other file systems leave them alone. + var rtn = { + bsize: 4096, + frsize: 4096, + blocks: 1e6, + bfree: 5e5, + bavail: 5e5, + files: FS.nextInode, + ffree: FS.nextInode - 1, + fsid: 42, + flags: 2, + namelen: 255 + }; + if (node.node_ops.statfs) { + Object.assign(rtn, node.node_ops.statfs(node.mount.opts.root)); + } + return rtn; + }, + create(path, mode = 438) { + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode = 511) { + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + // parents must exist + var lookup, old_dir, new_dir; + // let the errors from non existent directories percolate up + lookup = FS.lookupPath(old_path, { + parent: true + }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { + parent: true + }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + // need to be part of the same mount + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + // source must exist + var old_node = FS.lookupNode(old_dir, old_name); + // old path should not be an ancestor of the new path + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + // new path should not be an ancestor of the old path + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + // see if the new path already exists + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + // early out if nothing needs to change + if (old_node === new_node) { + return; + } + // we'll need to delete the old entry + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + // need delete permissions if we'll be overwriting. + // need create permissions if new doesn't already exist. + errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(old_node) || (new_node && FS.isMountpoint(new_node))) { + throw new FS.ErrnoError(10); + } + // if we are going to change the parent, check write permissions + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + // remove the node from the lookup hash + FS.hashRemoveNode(old_node); + // do the underlying fs rename + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + // update old node (we do this here to avoid each backend + // needing to) + old_node.parent = new_dir; + } catch (e) { + throw e; + } finally { + // add the node back to the hash (in case node_ops.rename + // changed its name) + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + var readdir = FS.checkOpExists(node.node_ops.readdir, 54); + return readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + // According to POSIX, we should map EISDIR to EPERM, but + // we instead do what Linux does (and we must, as we use + // the musl linux libc). + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return link.node_ops.readlink(link); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + var node = lookup.node; + var getattr = FS.checkOpExists(node.node_ops.getattr, 63); + return getattr(node); + }, + fstat(fd) { + var stream = FS.getStreamChecked(fd); + var node = stream.node; + var getattr = stream.stream_ops.getattr; + var arg = getattr ? stream : node; + getattr ??= node.node_ops.getattr; + FS.checkOpExists(getattr, 63); + return getattr(arg); + }, + lstat(path) { + return FS.stat(path, true); + }, + doChmod(stream, node, mode, dontFollow) { + FS.doSetAttr(stream, node, { + mode: (mode & 4095) | (node.mode & ~4095), + ctime: Date.now(), + dontFollow + }); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + FS.doChmod(null, node, mode, dontFollow); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.doChmod(stream, stream.node, mode, false); + }, + doChown(stream, node, dontFollow) { + FS.doSetAttr(stream, node, { + timestamp: Date.now(), + dontFollow + }); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + FS.doChown(null, node, dontFollow); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.doChown(stream, stream.node, false); + }, + doTruncate(stream, node, len) { + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.doSetAttr(stream, node, { + size: len, + timestamp: Date.now() + }); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: true + }); + node = lookup.node; + } else { + node = path; + } + FS.doTruncate(null, node, len); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if (len < 0 || (stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.doTruncate(stream, stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + var setattr = FS.checkOpExists(node.node_ops.setattr, 63); + setattr(node, { + atime, + mtime + }); + }, + open(path, flags, mode = 438) { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags; + if ((flags & 64)) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + var isDirPath; + if (typeof path == "object") { + node = path; + } else { + isDirPath = path.endsWith("/"); + // noent_okay makes it so that if the final component of the path + // doesn't exist, lookupPath returns `node: undefined`. `path` will be + // updated to point to the target of all symlinks. + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072), + noent_okay: true + }); + node = lookup.node; + path = lookup.path; + } + // perhaps we need to create the node + var created = false; + if ((flags & 64)) { + if (node) { + // if O_CREAT and O_EXCL are set, error out if the node already exists + if ((flags & 128)) { + throw new FS.ErrnoError(20); + } + } else if (isDirPath) { + throw new FS.ErrnoError(31); + } else { + // node doesn't exist, try to create it + // Ignore the permission bits here to ensure we can `open` this new + // file below. We use chmod below the apply the permissions once the + // file is open. + node = FS.mknod(path, mode | 511, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + // can't truncate a device + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + // if asked only for a directory, then this must be one + if ((flags & 65536) && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + // check permissions, if this is not a file we just created now (it is ok to + // create and write to a file with read-only permissions; it is read-only + // for later use) + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + // do truncation if necessary + if ((flags & 512) && !created) { + FS.truncate(node, 0); + } + // we've already handled these, don't pass down to the underlying vfs + flags &= ~(128 | 512 | 131072); + // register the stream with the filesystem + var stream = FS.createStream({ + node, + path: FS.getPath(node), + // we want the absolute path to the node + flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + // used by the file family libc calls (fopen, fwrite, ferror, etc.) + ungotten: [], + error: false + }); + // call the new stream's open function + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (created) { + FS.chmod(node, mode & 511); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + // free readdir state + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + // seek to the end before writing in append mode + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + // User requests writing to file (prot & PROT_WRITE != 0). + // Checking if we have permissions to write to the file unless + // MAP_PRIVATE flag is set. According to POSIX spec it is possible + // to write to file opened in read-only mode with MAP_PRIVATE flag, + // as all modifications will be visible only in the memory of + // the current process. + if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + if (!length) { + throw new FS.ErrnoError(28); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + assert(offset >= 0); + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags); + }, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { + follow: true + }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices() { + // create /dev + FS.mkdir("/dev"); + // setup /dev/null + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + llseek: () => 0 + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + // setup /dev/tty and /dev/tty1 + // stderr needs to print output using err() rather than out() + // so we register a second tty just for it. + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + // setup /dev/[u]random + // use a buffer to avoid overhead of individual crypto calls per byte + var randomBuffer = new Uint8Array(1024), randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomFill(randomBuffer); + randomLeft = randomBuffer.byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice("/dev", "random", randomByte); + FS.createDevice("/dev", "urandom", randomByte); + // we're not going to emulate the actual shm device, + // just create the tmp dirs that reside in it commonly + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories() { + // create /proc/self/fd which allows /proc/self/fd/6 => readlink gives the + // name of the stream for fd 6 (see test_unistd_ttyname) + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount({ + mount() { + var node = FS.createNode(proc_self, "fd", 16895, 73); + node.stream_ops = { + llseek: MEMFS.stream_ops.llseek + }; + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { + mountpoint: "fake" + }, + node_ops: { + readlink: () => stream.path + }, + id: fd + 1 + }; + ret.parent = ret; + // make it look like a simple root node + return ret; + }, + readdir() { + return Array.from(FS.streams.entries()).filter(([k, v]) => v).map(([k, v]) => k.toString()); + } + }; + return node; + } + }, {}, "/proc/self/fd"); + }, + createStandardStreams(input, output, error) { + // TODO deprecate the old functionality of a single + // input / output callback and that utilizes FS.createDevice + // and instead require a unique set of stream ops + // by default, we symlink the standard streams to the + // default tty devices. however, if the standard streams + // have been overwritten we create a unique device for + // them instead. + if (input) { + FS.createDevice("/dev", "stdin", input); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (output) { + FS.createDevice("/dev", "stdout", null, output); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (error) { + FS.createDevice("/dev", "stderr", null, error); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + // open default streams for the stdin, stdout and stderr devices + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, `invalid handle for stdin (${stdin.fd})`); + assert(stdout.fd === 1, `invalid handle for stdout (${stdout.fd})`); + assert(stderr.fd === 2, `invalid handle for stderr (${stderr.fd})`); + }, + staticInit() { + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { + "MEMFS": MEMFS + }; + }, + init(input, output, error) { + assert(!FS.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"); + FS.initialized = true; + // Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here + input ??= Module["stdin"]; + output ??= Module["stdout"]; + error ??= Module["stderr"]; + FS.createStandardStreams(input, output, error); + }, + quit() { + FS.initialized = false; + // force-flush all streams, so we get musl std streams printed out + _fflush(0); + // close all of our streams + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + // operate from within the context of the symlink's target + try { + var lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null + }; + try { + var lookup = FS.lookupPath(path, { + parent: true + }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i); + data = arr; + } + // make sure we can write to the file + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + }, + createDevice(parent, name, input, output) { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS_getMode(!!input, !!output); + FS.createDevice.major ??= 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + // Create a fake device that a set of stream ops to emulate + // the old behavior. + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + // flush any pending line data + if (output?.buffer?.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + } + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."); + } else { + // Command-line. + try { + obj.contents = readBinary(obj.url); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + // Lazy chunked Uint8Array (implements get and length from Uint8Array). + // Actual getting is abstracted away for eventual reuse. + class LazyUint8Array { + lengthKnown=false; + chunks=[]; + // Loaded chunks. Index is the chunk number + get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + } + setDataGetter(getter) { + this.getter = getter; + } + cacheLength() { + // Find length + var xhr = new XMLHttpRequest; + xhr.open("HEAD", url, false); + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; + var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip"; + var chunkSize = 1024 * 1024; + // Chunk size in bytes + if (!hasByteServing) chunkSize = datalength; + // Function to get a range from the remote URL. + var doXHR = (from, to) => { + if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); + if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!"); + // TODO: Use mozResponseArrayBuffer, responseStream, etc. if available. + var xhr = new XMLHttpRequest; + xhr.open("GET", url, false); + if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + // Some hints to the browser that we want binary data. + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + if (xhr.response !== undefined) { + return new Uint8Array(/** @type{Array} */ (xhr.response || [])); + } + return intArrayFromString(xhr.responseText || "", true); + }; + var lazyArray = this; + lazyArray.setDataGetter(chunkNum => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + // including this byte + end = Math.min(end, datalength - 1); + // if datalength-1 is selected, this is the last block + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + // if the server uses gzip or doesn't supply the length, we have to download the whole file to get the (uncompressed) length + chunkSize = datalength = 1; + // this will force getter(0)/doXHR do download the whole file + datalength = this.getter(0).length; + chunkSize = datalength; + out("LazyFiles on gzip forces download of the whole file when length is accessed"); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + get length() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + get chunkSize() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array; + var properties = { + isDevice: false, + contents: lazyArray + }; + } else { + var properties = { + isDevice: false, + url + }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + // This is a total hack, but I want to get this lazy file code out of the + // core of MEMFS. If we want to keep this lazy file concept I feel it should + // be its own thin LAZYFS proxying calls to MEMFS. + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + // Add a function that defers querying the file size until it is asked the first time. + Object.defineProperties(node, { + usedBytes: { + get: function() { + return this.contents.length; + } + } + }); + // override each stream op with one that tries to force load the lazy file first + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach(key => { + var fn = node.stream_ops[key]; + stream_ops[key] = (...args) => { + FS.forceLoadFile(node); + return fn(...args); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + // normal array + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + // LazyUint8Array from sync binary XHR + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + // use a custom read function + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + // use a custom mmap function + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { + ptr, + allocated: true + }; + }; + node.stream_ops = stream_ops; + return node; + }, + absolutePath() { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder() { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink() { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath() { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc() { + abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc"); + }, + standardizePath() { + abort("FS.standardizePath has been removed; use PATH.normalize instead"); + } +}; + +var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + // relative path + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return dir + "/" + path; + }, + writeStat(buf, stat) { + SAFE_HEAP_STORE(((buf) / 4) * 4, stat.dev, 4); + SAFE_HEAP_STORE((((buf) + (4)) / 4) * 4, stat.mode, 4); + HEAPU64[(((buf) + (8)) / 8)] = BigInt(stat.nlink); + SAFE_HEAP_STORE((((buf) + (16)) / 4) * 4, stat.uid, 4); + SAFE_HEAP_STORE((((buf) + (20)) / 4) * 4, stat.gid, 4); + SAFE_HEAP_STORE((((buf) + (24)) / 4) * 4, stat.rdev, 4); + HEAP64[(((buf) + (32)) / 8)] = BigInt(stat.size); + SAFE_HEAP_STORE((((buf) + (40)) / 4) * 4, 4096, 4); + SAFE_HEAP_STORE((((buf) + (44)) / 4) * 4, stat.blocks, 4); + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + HEAP64[(((buf) + (48)) / 8)] = BigInt(Math.floor(atime / 1e3)); + HEAPU64[(((buf) + (56)) / 8)] = BigInt((atime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (64)) / 8)] = BigInt(Math.floor(mtime / 1e3)); + HEAPU64[(((buf) + (72)) / 8)] = BigInt((mtime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (80)) / 8)] = BigInt(Math.floor(ctime / 1e3)); + HEAPU64[(((buf) + (88)) / 8)] = BigInt((ctime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (96)) / 8)] = BigInt(stat.ino); + return 0; + }, + writeStatFs(buf, stats) { + SAFE_HEAP_STORE((((buf) + (8)) / 4) * 4, stats.bsize, 4); + SAFE_HEAP_STORE((((buf) + (56)) / 4) * 4, stats.bsize, 4); + SAFE_HEAP_STORE((((buf) + (16)) / 4) * 4, stats.blocks, 4); + SAFE_HEAP_STORE((((buf) + (20)) / 4) * 4, stats.bfree, 4); + SAFE_HEAP_STORE((((buf) + (24)) / 4) * 4, stats.bavail, 4); + SAFE_HEAP_STORE((((buf) + (28)) / 4) * 4, stats.files, 4); + SAFE_HEAP_STORE((((buf) + (32)) / 4) * 4, stats.ffree, 4); + SAFE_HEAP_STORE((((buf) + (36)) / 4) * 4, stats.fsid, 4); + SAFE_HEAP_STORE((((buf) + (64)) / 4) * 4, stats.flags, 4); + // ST_NOSUID + SAFE_HEAP_STORE((((buf) + (48)) / 4) * 4, stats.namelen, 4); + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + // MAP_PRIVATE calls need not to be synced back to underlying fs + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + varargs: undefined, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + } +}; + +function ___syscall_chmod(path, mode) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_faccessat(dirfd, path, amode, flags) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + assert(flags === 0 || flags == 512); + path = SYSCALLS.calculateAt(dirfd, path); + if (amode & ~7) { + // need a valid mode + return -28; + } + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ""; + if (amode & 4) perms += "r"; + if (amode & 2) perms += "w"; + if (amode & 1) perms += "x"; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var syscallGetVarargP = () => { + assert(SYSCALLS.varargs != undefined); + var ret = Number(HEAPU64[((SYSCALLS.varargs) / 8)]); + SYSCALLS.varargs += 8; + return ret; +}; + +var syscallGetVarargI = () => { + assert(SYSCALLS.varargs != undefined); + // the `+` prepended here is necessary to convince the JSCompiler that varargs is indeed a number. + var ret = SAFE_HEAP_LOAD(((+SYSCALLS.varargs) / 4) * 4, 4, 0); + SYSCALLS.varargs += 4; + return ret; +}; + +function ___syscall_fcntl64(fd, cmd, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: + { + var arg = syscallGetVarargI(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.dupStream(stream, arg); + return newStream.fd; + } + + case 1: + case 2: + return 0; + + // FD_CLOEXEC makes no sense for a single process. + case 3: + return stream.flags; + + case 4: + { + var arg = syscallGetVarargI(); + stream.flags |= arg; + return 0; + } + + case 5: + { + var arg = syscallGetVarargP(); + var offset = 0; + // We're always unlocked. + SAFE_HEAP_STORE((((arg) + (offset)) / 2) * 2, 2, 2); + return 0; + } + + case 6: + case 7: + return 0; + } + return -28; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_fstat64(fd, buf) { + buf = bigintToI53Checked(buf); + try { + return SYSCALLS.writeStat(buf, FS.fstat(fd)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); +}; + +function ___syscall_getcwd(buf, size) { + buf = bigintToI53Checked(buf); + size = bigintToI53Checked(size); + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1; + if (size < cwdLengthInBytes) return -68; + stringToUTF8(cwd, buf, size); + return cwdLengthInBytes; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_ioctl(fd, op, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: + { + if (!stream.tty) return -59; + return 0; + } + + case 21505: + { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 4) * 4, termios.c_iflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (4)) / 4) * 4, termios.c_oflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (8)) / 4) * 4, termios.c_cflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (12)) / 4) * 4, termios.c_lflag || 0, 4); + for (var i = 0; i < 32; i++) { + SAFE_HEAP_STORE((argp + i) + (17), termios.c_cc[i] || 0, 1); + } + return 0; + } + return 0; + } + + case 21510: + case 21511: + case 21512: + { + if (!stream.tty) return -59; + return 0; + } + + case 21506: + case 21507: + case 21508: + { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = syscallGetVarargP(); + var c_iflag = SAFE_HEAP_LOAD(((argp) / 4) * 4, 4, 0); + var c_oflag = SAFE_HEAP_LOAD((((argp) + (4)) / 4) * 4, 4, 0); + var c_cflag = SAFE_HEAP_LOAD((((argp) + (8)) / 4) * 4, 4, 0); + var c_lflag = SAFE_HEAP_LOAD((((argp) + (12)) / 4) * 4, 4, 0); + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(SAFE_HEAP_LOAD((argp + i) + (17), 1, 0)); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag, + c_oflag, + c_cflag, + c_lflag, + c_cc + }); + } + return 0; + } + + case 21519: + { + if (!stream.tty) return -59; + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 4) * 4, 0, 4); + return 0; + } + + case 21520: + { + if (!stream.tty) return -59; + return -28; + } + + case 21531: + { + var argp = syscallGetVarargP(); + return FS.ioctl(stream, op, argp); + } + + case 21523: + { + // TODO: in theory we should write to the winsize struct that gets + // passed in, but for now musl doesn't read anything on it + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 2) * 2, winsize[0], 2); + SAFE_HEAP_STORE((((argp) + (2)) / 2) * 2, winsize[1], 2); + } + return 0; + } + + case 21524: + { + // TODO: technically, this ioctl call should change the window size. + // but, since emscripten doesn't have any concept of a terminal window + // yet, we'll just silently throw it away as we do TIOCGWINSZ + if (!stream.tty) return -59; + return 0; + } + + case 21515: + { + if (!stream.tty) return -59; + return 0; + } + + default: + return -28; + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_lstat64(path, buf) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.writeStat(buf, FS.lstat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_newfstatat(dirfd, path, buf, flags) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & (~6400); + assert(!flags, `unknown flags in __syscall_newfstatat: ${flags}`); + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.writeStat(buf, nofollow ? FS.lstat(path) : FS.stat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_openat(dirfd, path, flags, varargs) { + path = bigintToI53Checked(path); + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? syscallGetVarargI() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_readlinkat(dirfd, path, buf, bufsize) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + bufsize = bigintToI53Checked(bufsize); + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = SAFE_HEAP_LOAD(buf + len, 1, 0); + stringToUTF8(ret, buf, bufsize + 1); + // readlink is one of the rare functions that write out a C string, but does never append a null to the output buffer(!) + // stringToUTF8() always appends a null byte, so restore the character under the null byte after the write. + SAFE_HEAP_STORE(buf + len, endChar, 1); + return len; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_stat64(path, buf) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.writeStat(buf, FS.stat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_unlinkat(dirfd, path, flags) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (flags === 0) { + FS.unlink(path); + } else if (flags === 512) { + FS.rmdir(path); + } else { + abort("Invalid flags passed to unlinkat"); + } + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var __abort_js = () => abort("native code called abort()"); + +var runtimeKeepaliveCounter = 0; + +var __emscripten_runtime_keepalive_clear = () => { + noExitRuntime = false; + runtimeKeepaliveCounter = 0; +}; + +var isLeapYear = year => year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + +var MONTH_DAYS_LEAP_CUMULATIVE = [ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 ]; + +var MONTH_DAYS_REGULAR_CUMULATIVE = [ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 ]; + +var ydayFromDate = date => { + var leap = isLeapYear(date.getFullYear()); + var monthDaysCumulative = (leap ? MONTH_DAYS_LEAP_CUMULATIVE : MONTH_DAYS_REGULAR_CUMULATIVE); + var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; + // -1 since it's days since Jan 1 + return yday; +}; + +function __localtime_js(time, tmPtr) { + time = bigintToI53Checked(time); + tmPtr = bigintToI53Checked(tmPtr); + var date = new Date(time * 1e3); + SAFE_HEAP_STORE(((tmPtr) / 4) * 4, date.getSeconds(), 4); + SAFE_HEAP_STORE((((tmPtr) + (4)) / 4) * 4, date.getMinutes(), 4); + SAFE_HEAP_STORE((((tmPtr) + (8)) / 4) * 4, date.getHours(), 4); + SAFE_HEAP_STORE((((tmPtr) + (12)) / 4) * 4, date.getDate(), 4); + SAFE_HEAP_STORE((((tmPtr) + (16)) / 4) * 4, date.getMonth(), 4); + SAFE_HEAP_STORE((((tmPtr) + (20)) / 4) * 4, date.getFullYear() - 1900, 4); + SAFE_HEAP_STORE((((tmPtr) + (24)) / 4) * 4, date.getDay(), 4); + var yday = ydayFromDate(date) | 0; + SAFE_HEAP_STORE((((tmPtr) + (28)) / 4) * 4, yday, 4); + HEAP64[(((tmPtr) + (40)) / 8)] = BigInt(-(date.getTimezoneOffset() * 60)); + // Attention: DST is in December in South, and some regions don't have DST at all. + var start = new Date(date.getFullYear(), 0, 1); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + SAFE_HEAP_STORE((((tmPtr) + (32)) / 4) * 4, dst, 4); +} + +var timers = {}; + +var handleException = e => { + // Certain exception types we do not treat as errors since they are used for + // internal control flow. + // 1. ExitStatus, which is thrown by exit() + // 2. "unwind", which is thrown by emscripten_unwind_to_js_event_loop() and others + // that wish to return to JS event loop. + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + checkStackCookie(); + if (e instanceof WebAssembly.RuntimeError) { + if (_emscripten_stack_get_current() <= 0) { + err("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)"); + } + } + quit_(1, e); +}; + +var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0; + +var _proc_exit = code => { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + Module["onExit"]?.(code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); +}; + +/** @suppress {duplicate } */ /** @param {boolean|number=} implicit */ var exitJS = (status, implicit) => { + EXITSTATUS = status; + if (!keepRuntimeAlive()) { + exitRuntime(); + } + // if exit() was called explicitly, warn the user if the runtime isn't actually being shut down + if (keepRuntimeAlive() && !implicit) { + var msg = `program exited (with status: ${status}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`; + readyPromiseReject(msg); + err(msg); + } + islib64 = 0; + _proc_exit(status); +}; + +var _exit = exitJS; + +var maybeExit = () => { + if (runtimeExited) { + return; + } + if (!keepRuntimeAlive()) { + try { + _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } +}; + +var callUserCallback = func => { + if (runtimeExited || ABORT) { + err("user callback triggered after runtime exited or application aborted. Ignoring."); + return; + } + try { + func(); + maybeExit(); + } catch (e) { + handleException(e); + } +}; + +var _emscripten_get_now = () => performance.now(); + +var __setitimer_js = (which, timeout_ms) => { + // First, clear any existing timer. + if (timers[which]) { + clearTimeout(timers[which].id); + delete timers[which]; + } + // A timeout of zero simply cancels the current timeout so we have nothing + // more to do. + if (!timeout_ms) return 0; + var id = setTimeout(() => { + assert(which in timers); + delete timers[which]; + callUserCallback(() => __emscripten_timeout(which, _emscripten_get_now())); + }, timeout_ms); + timers[which] = { + id, + timeout_ms + }; + return 0; +}; + +var __tzset_js = function(timezone, daylight, std_name, dst_name) { + timezone = bigintToI53Checked(timezone); + daylight = bigintToI53Checked(daylight); + std_name = bigintToI53Checked(std_name); + dst_name = bigintToI53Checked(dst_name); + // TODO: Use (malleable) environment variables instead of system settings. + var currentYear = (new Date).getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + // Local standard timezone offset. Local standard time is not adjusted for + // daylight savings. This code uses the fact that getTimezoneOffset returns + // a greater value during Standard Time versus Daylight Saving Time (DST). + // Thus it determines the expected output during Standard Time, and it + // compares whether the output of the given date the same (Standard) or less + // (DST). + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + // timezone is specified as seconds west of UTC ("The external variable + // `timezone` shall be set to the difference, in seconds, between + // Coordinated Universal Time (UTC) and local standard time."), the same + // as returned by stdTimezoneOffset. + // See http://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html + HEAPU64[((timezone) / 8)] = BigInt(stdTimezoneOffset * 60); + SAFE_HEAP_STORE(((daylight) / 4) * 4, Number(winterOffset != summerOffset), 4); + var extractZone = timezoneOffset => { + // Why inverse sign? + // Read here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset + var sign = timezoneOffset >= 0 ? "-" : "+"; + var absOffset = Math.abs(timezoneOffset); + var hours = String(Math.floor(absOffset / 60)).padStart(2, "0"); + var minutes = String(absOffset % 60).padStart(2, "0"); + return `UTC${sign}${hours}${minutes}`; + }; + var winterName = extractZone(winterOffset); + var summerName = extractZone(summerOffset); + assert(winterName); + assert(summerName); + assert(lengthBytesUTF8(winterName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${winterName})`); + assert(lengthBytesUTF8(summerName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${summerName})`); + if (summerOffset < winterOffset) { + // Northern hemisphere + stringToUTF8(winterName, std_name, 17); + stringToUTF8(summerName, dst_name, 17); + } else { + stringToUTF8(winterName, dst_name, 17); + stringToUTF8(summerName, std_name, 17); + } +}; + +var _emscripten_date_now = () => Date.now(); + +var nowIsMonotonic = 1; + +var checkWasiClock = clock_id => clock_id >= 0 && clock_id <= 3; + +function _clock_time_get(clk_id, ignored_precision, ptime) { + ignored_precision = bigintToI53Checked(ignored_precision); + ptime = bigintToI53Checked(ptime); + if (!checkWasiClock(clk_id)) { + return 28; + } + var now; + // all wasi clocks but realtime are monotonic + if (clk_id === 0) { + now = _emscripten_date_now(); + } else if (nowIsMonotonic) { + now = _emscripten_get_now(); + } else { + return 52; + } + // "now" is in ms, and wasi times are in ns. + var nsec = Math.round(now * 1e3 * 1e3); + HEAP64[((ptime) / 8)] = BigInt(nsec); + return 0; +} + +function _emscripten_err(str) { + str = bigintToI53Checked(str); + return err(UTF8ToString(str)); +} + +var getHeapMax = () => 2147483648; + +var growMemory = size => { + var b = wasmMemory.buffer; + var pages = ((size - b.byteLength + 65535) / 65536) | 0; + try { + // round size grow request up to wasm page size (fixed 64KB per spec) + wasmMemory.grow(BigInt(pages)); + // .grow() takes a delta compared to the previous size + updateMemoryViews(); + return 1; + } catch (e) { + err(`growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`); + } +}; + +function _emscripten_resize_heap(requestedSize) { + requestedSize = bigintToI53Checked(requestedSize); + var oldSize = HEAPU8.length; + // With multithreaded builds, races can happen (another thread might increase the size + // in between), so return a failure, and let the caller retry. + assert(requestedSize > oldSize); + // Memory resize rules: + // 1. Always increase heap size to at least the requested size, rounded up + // to next page multiple. + // 2a. If MEMORY_GROWTH_LINEAR_STEP == -1, excessively resize the heap + // geometrically: increase the heap size according to + // MEMORY_GROWTH_GEOMETRIC_STEP factor (default +20%), At most + // overreserve by MEMORY_GROWTH_GEOMETRIC_CAP bytes (default 96MB). + // 2b. If MEMORY_GROWTH_LINEAR_STEP != -1, excessively resize the heap + // linearly: increase the heap size by at least + // MEMORY_GROWTH_LINEAR_STEP bytes. + // 3. Max size for the heap is capped at 2048MB-WASM_PAGE_SIZE, or by + // MAXIMUM_MEMORY, or by ASAN limit, depending on which is smallest + // 4. If we were unable to allocate as much memory, it may be due to + // over-eager decision to excessively reserve due to (3) above. + // Hence if an allocation fails, cut down on the amount of excess + // growth, in an attempt to succeed to perform a smaller allocation. + // A limit is set for how much we can grow. We should not exceed that + // (the wasm binary specifies it, so if we tried, we'd fail anyhow). + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + err(`Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`); + return false; + } + // Loop through potential heap size increases. If we attempt a too eager + // reservation that fails, cut down on the attempted size and reserve a + // smaller bump instead. (max 3 times, chosen somewhat arbitrarily) + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + .2 / cutDown); + // ensure geometric growth + // but limit overreserving (default to capping at +96MB overgrowth at most) + overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); + var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536)); + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + err(`Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`); + return false; +} + +var ENV = {}; + +var getExecutableName = () => thisProgram || "./this.program"; + +var getEnvStrings = () => { + if (!getEnvStrings.strings) { + // Default values. + // Browser language detection #8751 + var lang = ((typeof navigator == "object" && navigator.languages && navigator.languages[0]) || "C").replace("-", "_") + ".UTF-8"; + var env = { + "USER": "web_user", + "LOGNAME": "web_user", + "PATH": "/", + "PWD": "/", + "HOME": "/home/web_user", + "LANG": lang, + "_": getExecutableName() + }; + // Apply the user-provided values, if any. + for (var x in ENV) { + // x is a key in ENV; if ENV[x] is undefined, that means it was + // explicitly set to be so. We allow user code to do that to + // force variables with default values to remain unset. + if (ENV[x] === undefined) delete env[x]; else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(`${x}=${env[x]}`); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; +}; + +var stringToAscii = (str, buffer) => { + for (var i = 0; i < str.length; ++i) { + assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255)); + SAFE_HEAP_STORE(buffer++, str.charCodeAt(i), 1); + } + // Null-terminate the string + SAFE_HEAP_STORE(buffer, 0, 1); +}; + +var _environ_get = function(__environ, environ_buf) { + __environ = bigintToI53Checked(__environ); + environ_buf = bigintToI53Checked(environ_buf); + var bufSize = 0; + getEnvStrings().forEach((string, i) => { + var ptr = environ_buf + bufSize; + HEAPU64[(((__environ) + (i * 8)) / 8)] = BigInt(ptr); + stringToAscii(string, ptr); + bufSize += string.length + 1; + }); + return 0; +}; + +var _environ_sizes_get = function(penviron_count, penviron_buf_size) { + penviron_count = bigintToI53Checked(penviron_count); + penviron_buf_size = bigintToI53Checked(penviron_buf_size); + var strings = getEnvStrings(); + HEAPU64[((penviron_count) / 8)] = BigInt(strings.length); + var bufSize = 0; + strings.forEach(string => bufSize += string.length + 1); + HEAPU64[((penviron_buf_size) / 8)] = BigInt(bufSize); + return 0; +}; + +function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +function _fd_fdstat_get(fd, pbuf) { + pbuf = bigintToI53Checked(pbuf); + try { + var rightsBase = 0; + var rightsInheriting = 0; + var flags = 0; + { + var stream = SYSCALLS.getStreamFromFD(fd); + // All character devices are terminals (other things a Linux system would + // assume is a character device, like the mouse, we have special APIs for). + var type = stream.tty ? 2 : FS.isDir(stream.mode) ? 3 : FS.isLink(stream.mode) ? 7 : 4; + } + SAFE_HEAP_STORE(pbuf, type, 1); + SAFE_HEAP_STORE((((pbuf) + (2)) / 2) * 2, flags, 2); + HEAP64[(((pbuf) + (8)) / 8)] = BigInt(rightsBase); + HEAP64[(((pbuf) + (16)) / 8)] = BigInt(rightsInheriting); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +/** @param {number=} offset */ var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[((iov) / 8)]); + var len = Number(HEAPU64[(((iov) + (8)) / 8)]); + iov += 16; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + // nothing more to read + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; +}; + +function _fd_read(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU64[((pnum) / 8)] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +function _fd_seek(fd, offset, whence, newOffset) { + offset = bigintToI53Checked(offset); + newOffset = bigintToI53Checked(newOffset); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + HEAP64[((newOffset) / 8)] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; + // reset readdir state + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +/** @param {number=} offset */ var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[((iov) / 8)]); + var len = Number(HEAPU64[(((iov) + (8)) / 8)]); + iov += 16; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) { + // No more space to write. + break; + } + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; +}; + +function _fd_write(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU64[((pnum) / 8)] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +var stackAlloc = sz => __emscripten_stack_alloc(sz); + +var stringToUTF8OnStack = str => { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8(str, ret, size); + return ret; +}; + +FS.createPreloadedFile = FS_createPreloadedFile; + +FS.staticInit(); + +function checkIncomingModuleAPI() { + ignoredModuleProp("fetchSettings"); +} + +var wasmImports = { + /** @export */ __assert_fail: ___assert_fail, + /** @export */ __syscall_chmod: ___syscall_chmod, + /** @export */ __syscall_faccessat: ___syscall_faccessat, + /** @export */ __syscall_fcntl64: ___syscall_fcntl64, + /** @export */ __syscall_fstat64: ___syscall_fstat64, + /** @export */ __syscall_getcwd: ___syscall_getcwd, + /** @export */ __syscall_ioctl: ___syscall_ioctl, + /** @export */ __syscall_lstat64: ___syscall_lstat64, + /** @export */ __syscall_newfstatat: ___syscall_newfstatat, + /** @export */ __syscall_openat: ___syscall_openat, + /** @export */ __syscall_readlinkat: ___syscall_readlinkat, + /** @export */ __syscall_stat64: ___syscall_stat64, + /** @export */ __syscall_unlinkat: ___syscall_unlinkat, + /** @export */ _abort_js: __abort_js, + /** @export */ _emscripten_runtime_keepalive_clear: __emscripten_runtime_keepalive_clear, + /** @export */ _localtime_js: __localtime_js, + /** @export */ _setitimer_js: __setitimer_js, + /** @export */ _tzset_js: __tzset_js, + /** @export */ alignfault, + /** @export */ clock_time_get: _clock_time_get, + /** @export */ emscripten_date_now: _emscripten_date_now, + /** @export */ emscripten_err: _emscripten_err, + /** @export */ emscripten_resize_heap: _emscripten_resize_heap, + /** @export */ environ_get: _environ_get, + /** @export */ environ_sizes_get: _environ_sizes_get, + /** @export */ exit: _exit, + /** @export */ fd_close: _fd_close, + /** @export */ fd_fdstat_get: _fd_fdstat_get, + /** @export */ fd_read: _fd_read, + /** @export */ fd_seek: _fd_seek, + /** @export */ fd_write: _fd_write, + /** @export */ proc_exit: _proc_exit, + /** @export */ segfault +}; + +var wasmExports = await createWasm(); + +var ___wasm_call_ctors = createExportWrapper("__wasm_call_ctors", 0); + +var _main = Module["_main"] = createExportWrapper("__main_argc_argv", 2); + +var _fflush = createExportWrapper("fflush", 1); + +var _strerror = createExportWrapper("strerror", 1); + +var _sbrk = createExportWrapper("sbrk", 1); + +var ___funcs_on_exit = createExportWrapper("__funcs_on_exit", 0); + +var __emscripten_timeout = createExportWrapper("_emscripten_timeout", 2); + +var _emscripten_get_sbrk_ptr = createExportWrapper("emscripten_get_sbrk_ptr", 0); + +var _emscripten_stack_init = wasmExports["emscripten_stack_init"]; + +var _emscripten_stack_get_free = wasmExports["emscripten_stack_get_free"]; + +var _emscripten_stack_get_base = wasmExports["emscripten_stack_get_base"]; + +var _emscripten_stack_get_end = wasmExports["emscripten_stack_get_end"]; + +var __emscripten_stack_restore = wasmExports["_emscripten_stack_restore"]; + +var __emscripten_stack_alloc = wasmExports["_emscripten_stack_alloc"]; + +var _emscripten_stack_get_current = wasmExports["emscripten_stack_get_current"]; + +var ___cxa_increment_exception_refcount = createExportWrapper("__cxa_increment_exception_refcount", 1); + +// Argument name here must shadow the `wasmExports` global so +// that it is recognised by metadce and minify-import-export-names +// passes. +function applySignatureConversions(wasmExports) { + // First, make a copy of the incoming exports object + wasmExports = Object.assign({}, wasmExports); + var makeWrapper___PP = f => (a0, a1, a2) => f(a0, BigInt(a1 ? a1 : 0), BigInt(a2 ? a2 : 0)); + var makeWrapper__p = f => a0 => f(BigInt(a0)); + var makeWrapper_p_ = f => a0 => Number(f(a0)); + var makeWrapper_pP = f => a0 => Number(f(BigInt(a0 ? a0 : 0))); + var makeWrapper_p = f => () => Number(f()); + var makeWrapper_pp = f => a0 => Number(f(BigInt(a0))); + wasmExports["__main_argc_argv"] = makeWrapper___PP(wasmExports["__main_argc_argv"]); + wasmExports["fflush"] = makeWrapper__p(wasmExports["fflush"]); + wasmExports["strerror"] = makeWrapper_p_(wasmExports["strerror"]); + wasmExports["sbrk"] = makeWrapper_pP(wasmExports["sbrk"]); + wasmExports["emscripten_stack_get_base"] = makeWrapper_p(wasmExports["emscripten_stack_get_base"]); + wasmExports["emscripten_stack_get_end"] = makeWrapper_p(wasmExports["emscripten_stack_get_end"]); + wasmExports["_emscripten_stack_restore"] = makeWrapper__p(wasmExports["_emscripten_stack_restore"]); + wasmExports["_emscripten_stack_alloc"] = makeWrapper_pp(wasmExports["_emscripten_stack_alloc"]); + wasmExports["emscripten_stack_get_current"] = makeWrapper_p(wasmExports["emscripten_stack_get_current"]); + wasmExports["__cxa_increment_exception_refcount"] = makeWrapper__p(wasmExports["__cxa_increment_exception_refcount"]); + return wasmExports; +} + +// include: postamble.js +// === Auto-generated postamble setup entry stuff === +Module["run"] = run; + +Module["FS"] = FS; + +var missingLibrarySymbols = [ "writeI53ToI64", "writeI53ToI64Clamped", "writeI53ToI64Signaling", "writeI53ToU64Clamped", "writeI53ToU64Signaling", "readI53FromI64", "readI53FromU64", "convertI32PairToI53", "convertI32PairToI53Checked", "convertU32PairToI53", "getTempRet0", "setTempRet0", "inetPton4", "inetNtop4", "inetPton6", "inetNtop6", "readSockaddr", "writeSockaddr", "emscriptenLog", "readEmAsmArgs", "jstoi_q", "listenOnce", "autoResumeAudioContext", "getDynCaller", "dynCall", "runtimeKeepalivePush", "runtimeKeepalivePop", "asmjsMangle", "HandleAllocator", "getNativeTypeSize", "addOnInit", "addOnPostCtor", "addOnPreMain", "addOnExit", "STACK_SIZE", "STACK_ALIGN", "POINTER_SIZE", "ASSERTIONS", "getCFunc", "ccall", "cwrap", "uleb128Encode", "sigToWasmTypes", "generateFuncType", "convertJsFunctionToWasm", "getEmptyTableSlot", "updateTableMap", "getFunctionAddress", "addFunction", "removeFunction", "reallyNegative", "strLen", "reSign", "formatString", "intArrayToString", "AsciiToString", "UTF16ToString", "stringToUTF16", "lengthBytesUTF16", "UTF32ToString", "stringToUTF32", "lengthBytesUTF32", "stringToNewUTF8", "writeArrayToMemory", "registerKeyEventCallback", "maybeCStringToJsString", "findEventTarget", "getBoundingClientRect", "fillMouseEventData", "registerMouseEventCallback", "registerWheelEventCallback", "registerUiEventCallback", "registerFocusEventCallback", "fillDeviceOrientationEventData", "registerDeviceOrientationEventCallback", "fillDeviceMotionEventData", "registerDeviceMotionEventCallback", "screenOrientation", "fillOrientationChangeEventData", "registerOrientationChangeEventCallback", "fillFullscreenChangeEventData", "registerFullscreenChangeEventCallback", "JSEvents_requestFullscreen", "JSEvents_resizeCanvasForFullscreen", "registerRestoreOldStyle", "hideEverythingExceptGivenElement", "restoreHiddenElements", "setLetterbox", "softFullscreenResizeWebGLRenderTarget", "doRequestFullscreen", "fillPointerlockChangeEventData", "registerPointerlockChangeEventCallback", "registerPointerlockErrorEventCallback", "requestPointerLock", "fillVisibilityChangeEventData", "registerVisibilityChangeEventCallback", "registerTouchEventCallback", "fillGamepadEventData", "registerGamepadEventCallback", "registerBeforeUnloadEventCallback", "fillBatteryEventData", "battery", "registerBatteryEventCallback", "setCanvasElementSize", "getCanvasElementSize", "jsStackTrace", "getCallstack", "convertPCtoSourceLocation", "wasiRightsToMuslOFlags", "wasiOFlagsToMuslOFlags", "safeSetTimeout", "setImmediateWrapped", "safeRequestAnimationFrame", "clearImmediateWrapped", "registerPostMainLoop", "registerPreMainLoop", "getPromise", "makePromise", "idsToPromises", "makePromiseCallback", "ExceptionInfo", "findMatchingCatch", "Browser_asyncPrepareDataCounter", "arraySum", "addDays", "getSocketFromFD", "getSocketAddress", "FS_unlink", "FS_mkdirTree", "_setNetworkCallback", "heapObjectForWebGLType", "toTypedArrayIndex", "webgl_enable_ANGLE_instanced_arrays", "webgl_enable_OES_vertex_array_object", "webgl_enable_WEBGL_draw_buffers", "webgl_enable_WEBGL_multi_draw", "webgl_enable_EXT_polygon_offset_clamp", "webgl_enable_EXT_clip_control", "webgl_enable_WEBGL_polygon_mode", "emscriptenWebGLGet", "computeUnpackAlignedImageSize", "colorChannelsInGlTextureFormat", "emscriptenWebGLGetTexPixelData", "emscriptenWebGLGetUniform", "webglGetUniformLocation", "webglPrepareUniformLocationsBeforeFirstUse", "webglGetLeftBracePos", "emscriptenWebGLGetVertexAttrib", "__glGetActiveAttribOrUniform", "writeGLArray", "registerWebGlEventCallback", "runAndAbortIfError", "ALLOC_NORMAL", "ALLOC_STACK", "allocate", "writeStringToMemory", "writeAsciiToMemory", "setErrNo", "demangle", "stackTrace" ]; + +missingLibrarySymbols.forEach(missingLibrarySymbol); + +var unexportedSymbols = [ "addRunDependency", "removeRunDependency", "out", "err", "callMain", "abort", "wasmMemory", "wasmExports", "writeStackCookie", "checkStackCookie", "INT53_MAX", "INT53_MIN", "bigintToI53Checked", "stackSave", "stackRestore", "stackAlloc", "ptrToString", "zeroMemory", "exitJS", "getHeapMax", "growMemory", "ENV", "ERRNO_CODES", "strError", "DNS", "Protocols", "Sockets", "timers", "warnOnce", "readEmAsmArgsArray", "jstoi_s", "getExecutableName", "handleException", "keepRuntimeAlive", "callUserCallback", "maybeExit", "asyncLoad", "alignMemory", "mmapAlloc", "wasmTable", "noExitRuntime", "addOnPreRun", "addOnPostRun", "freeTableIndexes", "functionsInTableMap", "unSign", "setValue", "getValue", "PATH", "PATH_FS", "UTF8Decoder", "UTF8ArrayToString", "UTF8ToString", "stringToUTF8Array", "stringToUTF8", "lengthBytesUTF8", "intArrayFromString", "stringToAscii", "UTF16Decoder", "stringToUTF8OnStack", "JSEvents", "specialHTMLTargets", "findCanvasEventTarget", "currentFullscreenStrategy", "restoreOldWindowedStyle", "UNWIND_CACHE", "ExitStatus", "getEnvStrings", "checkWasiClock", "doReadv", "doWritev", "initRandomFill", "randomFill", "emSetImmediate", "emClearImmediate_deps", "emClearImmediate", "promiseMap", "uncaughtExceptionCount", "exceptionLast", "exceptionCaught", "Browser", "getPreloadedImageData__data", "wget", "MONTH_DAYS_REGULAR", "MONTH_DAYS_LEAP", "MONTH_DAYS_REGULAR_CUMULATIVE", "MONTH_DAYS_LEAP_CUMULATIVE", "isLeapYear", "ydayFromDate", "SYSCALLS", "preloadPlugins", "FS_createPreloadedFile", "FS_modeStringToFlags", "FS_getMode", "FS_stdin_getChar_buffer", "FS_stdin_getChar", "FS_createPath", "FS_createDevice", "FS_readFile", "FS_createDataFile", "FS_createLazyFile", "MEMFS", "TTY", "PIPEFS", "SOCKFS", "tempFixedLengthArray", "miniTempWebGLFloatBuffers", "miniTempWebGLIntBuffers", "GL", "AL", "GLUT", "EGL", "GLEW", "IDBStore", "SDL", "SDL_gfx", "allocateUTF8", "allocateUTF8OnStack", "print", "printErr" ]; + +unexportedSymbols.forEach(unexportedRuntimeSymbol); + +var calledRun; + +function callMain(args = []) { + assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'); + assert(typeof onPreRuns === "undefined" || onPreRuns.length == 0, "cannot call main when preRun functions remain to be called"); + var entryFunction = _main; + args.unshift(thisProgram); + var argc = args.length; + var argv = stackAlloc((argc + 1) * 8); + var argv_ptr = argv; + args.forEach(arg => { + HEAPU64[((argv_ptr) / 8)] = BigInt(stringToUTF8OnStack(arg)); + argv_ptr += 8; + }); + HEAPU64[((argv_ptr) / 8)] = BigInt(0); + try { + var ret = entryFunction(argc, BigInt(argv)); + // if we're not running an evented main loop, it's time to exit + exitJS(ret, /* implicit = */ true); + return ret; + } catch (e) { + return handleException(e); + } +} + +function stackCheckInit() { + // This is normally called automatically during __wasm_call_ctors but need to + // get these values before even running any of the ctors so we call it redundantly + // here. + _emscripten_stack_init(); + // TODO(sbc): Move writeStackCookie to native to to avoid this. + writeStackCookie(); +} + +function run(args = arguments_) { + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + stackCheckInit(); + preRun(); + // a preRun added a dependency, run will be called later + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + function doRun() { + // run may have just been called through dependencies being fulfilled just in this very frame, + // or while the async setStatus time below was happening + assert(!calledRun); + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + + if (args[2].includes(".o")) { // Disassemble library + FS.writeFile("./" + args[2], args[0]); + islib64 = 1; + }else { + FS.writeFile("./input.elf", args[0]); + } + // FS.writeFile("./input.elf", args[0]); + args.shift(); + preMain(); + readyPromiseResolve(Module); + Module["onRuntimeInitialized"]?.(); + var noInitialRun = Module["noInitialRun"] || true; + legacyModuleProp("noInitialRun", "noInitialRun"); + callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(() => { + setTimeout(() => Module["setStatus"](""), 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); +} + +if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } +} + +// run(); + +// end include: postamble.js +// include: postamble_modularize.js +// In MODULARIZE mode we wrap the generated code in a factory function +// and return either the Module itself, or a promise of the module. +// We assign to the `moduleRtn` global here and configure closure to see +// this as and extern so it won't get minified. +moduleRtn = readyPromise; + +// Assertion for attempting to access module properties on the incoming +// moduleArg. In the past we used this object as the prototype of the module +// and assigned properties to it, but now we return a distinct object. This +// keeps the instance private until it is ready (i.e the promise has been +// resolved). +for (const prop of Object.keys(Module)) { + if (!(prop in moduleArg)) { + Object.defineProperty(moduleArg, prop, { + configurable: true, + get() { + abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`); + } + }); + } +} + readyPromiseResolve(Module); + + return moduleRtn; +} +); +})(); +(() => { + // Create a small, never-async wrapper around Module which + // checks for callers incorrectly using it with `new`. + var real_Module = Module; + Module = function(arg) { + if (new.target) throw new Error("Module() should not be called with `new Module()`"); + return real_Module(arg); + } +})(); +export default Module; diff --git a/src/core/assembler/sailAssembler/web/wasm/objdump64.wasm b/src/core/assembler/sailAssembler/web/wasm/objdump64.wasm new file mode 100755 index 000000000..7b21fedc1 Binary files /dev/null and b/src/core/assembler/sailAssembler/web/wasm/objdump64.wasm differ diff --git a/src/core/capi/arduino.mts b/src/core/capi/arduino.mts new file mode 100644 index 000000000..636934a9c --- /dev/null +++ b/src/core/capi/arduino.mts @@ -0,0 +1,80 @@ +/** + * Copyright 2018-2025 Felix Garcia Carballeira, Alejandro Calderon Mateos, + * Diego Camarmas Alonso + * + * This file is part of CREATOR. + * + * CREATOR is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * CREATOR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with CREATOR. If not, see . + * + */ +import * as hooks from "./arduino_functions.mts"; +import { loadedCreatino } from "../core.mjs"; + +/* + * CREATOR instruction description API: + * CREATino executor module + */ + +// -------Create hookmap from custom library file +const hookMap = new Map void>(); +export const ARDUINO = { + check_arduino: (funcName: number, pc_state: number): boolean => { + return check_arduino(funcName, pc_state); + }, +}; + +export function createHookMap() { + const hookOrder = hooks.hookOrder as string[]; // 👈 asegurar tipo + + for (let i = 0, addr = 0x0; i < hookOrder.length; i++, addr += 4) { + const funcName = hookOrder[i]; + + const func = hooks[funcName as keyof typeof hooks] as (() => void) | undefined; + + hookMap.set( + addr, + func ?? (() => console.log(`Function ${funcName} not found`)) + ); + } + + +} +// AUX +function getAddressOfHook(func: () => void): number | undefined { + for (const [addr, f] of hookMap.entries()) { + if (f === func) return addr; + } + return undefined; +} + + +// ------- Identify arduino functions----- +export function check_arduino(funcName: number, pc_state: number): boolean { + const key = Math.abs(Number(pc_state) + Number(funcName)); + if (hookMap.size === 0) { + //await createHookMap(); ERROR + createHookMap(); + } + if (loadedCreatino == false) { + return false; + } + + const func = hookMap.get(key); + if (func) { + func(); + return true; + } + + return false; +} diff --git a/src/core/capi/arduino_functions.mts b/src/core/capi/arduino_functions.mts new file mode 100644 index 000000000..7cfa63670 --- /dev/null +++ b/src/core/capi/arduino_functions.mts @@ -0,0 +1,1858 @@ +import { crex_findReg } from "../register/registerLookup.mjs"; +import { packExecute } from "../utils/utils.mjs"; +import { + readRegister, + writeRegister, +} from "../register/registerOperations.mjs"; +import { main_memory, status } from "../core.mjs"; +import { + display_print, + keyboard_read_find, + kbd_read_string, + keyboard_parseInt, + keyboard_read, + kbd_read_char, + keyboard_read_until, +} from "../executor/IO.mjs"; +// import { getPinState,setPinState } from "../../web/arduino/pinstates.mts"; +import { Memory } from "../memory/Memory.mts"; +import { coreEvents } from "@/core/events.mts"; + +/* + * CREATOR instruction description API: + * CREATino functions module + */ +//Variables +let serial_begin = 0; // TODO: Which baud rate can we accept? +let initArduino = 0; // Flag to check if initArduino has been called +let _seed = 1; +// let traces = new ArduinoTerminal(); + +//Functions +export function cr_initArduino() { + if (initArduino === 0) { + initArduino = 1; + } + coreEvents.emit("arduino-terminal-write", { text: "initArduino()" }); +} +export function cr_digitalRead() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + //Read from simulator + const pinName = `GPIO${pin}`; + let rawValue = 0; + coreEvents.emit("arduino-pin-read", { + pin: pinName, + callback: (val: number) => { + rawValue = val; + } + }); + const value = rawValue !== 0 ? 1 : 0; + writeRegister(BigInt(value), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `digitalRead(${pin}) = ${value}`, + }); +} +export function cr_pinMode() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var mode = BigInt.asIntN(32, readRegister(ret2.indexComp, ret2.indexElem)); + coreEvents.emit("arduino-terminal-write", { + text: `pinMode(${pin},${mode})`, + }); + coreEvents.emit("arduino-pin-mode", { + pin: Number(pin), + mode: Number(mode), + }); +} +export function cr_digitalWrite() { + // Indicate in terminal + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var rawValue = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + var value = rawValue !== 0n ? 1 : 0; + coreEvents.emit("arduino-terminal-write", { + text: `digitalWrite(${pin}, ${value})`, + }); + coreEvents.emit("arduino-pin-write", { + pin: Number(pin), + value: Number(value), + }); +} +export function cr_analogRead() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + //Read from simulator + const pinName = `GPIO${pin}`; + // const value = pinStates.value[pinName] ?? 0; + let value = 0; + coreEvents.emit("arduino-pin-read", { + pin: pinName, + callback: (val: number) => { + value = val; + } + }); + console.log(`Reading from pin ${pinName}: ${value}`); + writeRegister(BigInt(value), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `analogRead(${pin}) = ${value}`, + }); +} +export function cr_analogReadResolution() { + // TODO +} +export function cr_analogWrite() { + // Indicate in terminal + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN(32, readRegister(ret2.indexComp, ret2.indexElem)); + coreEvents.emit("arduino-terminal-write", { + text: `analogWrite(${pin}, ${value})`, + }); + coreEvents.emit("arduino-pin-write", { + pin: Number(pin), + value: Number(value), + }); +} +export function cr_map() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + //fromLow the lower bound of the value’s current range. + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var fromLow = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + //fromHigh the upper bound of the value’s current range. + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_arduino: register a2 not found", + "danger", + null, + ); + } + var fromHigh = BigInt.asIntN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + //toLow the lower bound of the value’s target range. + var ret4 = crex_findReg("a3"); + if (ret4.match === 0) { + throw packExecute( + true, + "capi_arduino: register a3 not found", + "danger", + null, + ); + } + var toLow = BigInt.asIntN(32, readRegister(ret4.indexComp, ret4.indexElem)); + //toHigh the upper bound of the value’s target range. + var ret5 = crex_findReg("a4"); + if (ret5.match === 0) { + throw packExecute( + true, + "capi_arduino: register a4 not found", + "danger", + null, + ); + } + var toHigh = BigInt.asIntN( + 32, + readRegister(ret5.indexComp, ret5.indexElem), + ); + const mappedValue = + ((value - fromLow) * (toHigh - toLow)) / (fromHigh - fromLow) + toLow; + writeRegister(mappedValue, ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `map(${value}, ${fromLow}, ${fromHigh}, ${toLow}, ${toHigh})`, + }); +} +export function cr_constrain() { + // Value to constrain + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + //lower end + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var lower = BigInt.asIntN(32, readRegister(ret2.indexComp, ret2.indexElem)); + //upper end + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_arduino: register a2 not found", + "danger", + null, + ); + } + var upper = BigInt.asIntN(32, readRegister(ret3.indexComp, ret3.indexElem)); + + // Always a int cause we use a0 + var constrained = Math.max( + Number(lower), + Math.min(Number(value), Number(upper)), + ); + writeRegister(BigInt(constrained), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `constrain(${value}, ${lower}, ${upper})`, + }); +} +export function cr_abs() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + // Calculate the absolute value + value = value > 0 ? value : -value; + writeRegister(BigInt(value), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `abs(${value})` }); +} +export function cr_max() { + //Var 1: Expected always an int32 + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + // Var2: Expected always an int32 + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value2 = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + // Find the maximum value + const max = value1 > value2 ? value1 : value2; + writeRegister(BigInt(max), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `max(${value1}, ${value2})`, + }); +} +export function cr_min() { + //Var 1: Expected always an int32 + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + //Var 2: Expected always an int32 + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value2 = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + // Find the minimun value + const min = value1 < value2 ? value1 : value2; + writeRegister(BigInt(min), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `min(${value1}, ${value2})`, + }); +} +export function cr_pow() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + //Var 2: Expected always an int32 + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value2 = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + const pow = Math.pow(Number(value1), Number(value2)); + writeRegister(BigInt(pow), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `pow(${value1}, ${value2})`, + }); +} +export function cr_bit() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); //bit functions in arduino work with uint8_t numbers + var res = 0n; + if (value1 < 0n || value1 > 31n) { + res = 0n; // Invalid bit position + } else { + res = 1n << value1; // Calculate the bit value + } + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `bit(${value1})` }); +} +export function cr_bitClear() { + //Numeric variable whose bit to clear + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); //bit functions in arduino work with uint8_t numbers + var res = 0n; + //Bit to clear, starting 0 for least-significant + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value2 = BigInt.asUintN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + if (value2 < 0n || value2 > 31n) { + res = value1; // Invalid bit position, return original value + } else { + res = value1 & ~(1n << value2); // Clear the specified bit + } + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `bitClear(${value1}, ${value2})`, + }); +} +export function cr_bitRead() { + //Numeric variable whose bit to read + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); //bit functions in arduino work with uint8_t numbers + var res = 0n; + //Bit to read, starting 0 for least-significant + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value2 = BigInt.asUintN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + if (value2 < 0n || value2 > 31n) { + res = 0n; // Invalid bit position, return 0 + } else { + res = (value1 & (1n << value2)) !== 0n ? 1n : 0n; // Read the specified bit + } + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `bitRead(${value1}, ${value2})`, + }); +} +export function cr_bitSet() { + //Numeric variable whose bit to set + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); //bit functions in arduino work with uint8_t numbers + var res = 0n; + //Bit to set, starting 0 for least-significant + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value2 = BigInt.asUintN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + if (value2 < 0n || value2 > 31n) { + res = 0n; // Invalid bit position, return 0 + } else { + res = value1 | (1n << value2); // Set the specified bit + } + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `bitSet(${value1}, ${value2})`, + }); +} +export function cr_bitWrite() { + //Numeric variable whose bit to write + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); //bit functions in arduino work with uint8_t numbers + var res = 0n; + //Bit to write, starting 0 for least-significant + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value2 = BigInt.asUintN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + // Value to write + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value3 = BigInt.asUintN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + + if (value2 < 0n || value2 > 31n) { + res = value1; // Invalid bit position, return original value + } else { + if (value3 == 0n) { + res = value1 & ~(1n << value2); // Clear the specified bit + } else if (value3 == 1n) { + res = value1 | (1n << value2); // Set the specified bit + } else { + throw packExecute( + true, + "capi_syscall: invalid value for bitWrite", + "danger", + null, + ); + } + } + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `bitWrite(${value1}, ${value2}, ${value3})`, + }); +} +export function cr_highByte() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); //bit functions in arduino work with uint8_t numbers + var res = 0n; + res = (value1 >> 8n) & 0xffn; // Get the high byte + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `highByte(${value1})` }); +} +export function cr_lowByte() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); //bit functions in arduino work with uint8_t numbers + let res = value1 & 0xffn; // Get the low byte + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `lowByte(${value1})` }); +} +export function cr_attachInterrupt() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var interr_pos = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a1 not found", + "danger", + null, + ); + } + var interr_isr = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + // esp32vect.value[Number(interr_pos)]![1] = interr_isr; + //TODO: Modes + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_syscall: register a2 not found", + "danger", + null, + ); + } + var mode = BigInt.asIntN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + // esp32vect.value[Number(interr_pos)]![2] = mode; + //TODO: Graphic retroalimentation + // const gpiopin = "GPIO" + esp32vect.value[Number(interr_pos)]![0]; + const gpiopin = "GPIO" + "6" + coreEvents.emit("arduino-terminal-write", { + text: `attachInterrupt(${interr_pos}, 0x${interr_isr.toString(16)}, ${mode}) `, + }); + coreEvents.emit("arduino-pin-interrupt", { pin: gpiopin }); +} +export function cr_detachInterrupt() { + //TODO: Revise + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var interr_pos = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + // esp32vect.value[Number(interr_pos)] = [esp32vect.value[Number(interr_pos)]![0], 0n, 0n]; + // const gpiopin = "GPIO" + esp32vect.value[Number(interr_pos)]![0]; + const gpiopin = "GPIO" + "6"; + coreEvents.emit("arduino-terminal-write", { + text: `detachInterrupt(${interr_pos})`, + }); + coreEvents.emit("arduino-pin-detach-interrupt", { pin: gpiopin }); +} +export function cr_digitalPinToInterrupt() { + // Returns the first interrupt place free + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asUintN(32, readRegister(ret1.indexComp, ret1.indexElem)); + //Find clean slot in the interrupt vector table + // const pos = esp32vect.value.findIndex( + // (slot: bigint[]) => slot[1] === 0n && slot[2] === 0n, + // ); + const pos: number = 0; // Simulamos que siempre se asigna a la posición 0 para simplificar + + // Si no encuentra ninguna posición libre, findIndex devuelve -1 + if (pos === -1) { + throw packExecute( + true, + "ESP32 Interrupt Table Full: No free slots available", + "warning", + null, + ); + } + // esp32vect.value[pos] = [BigInt(pin), 0n, 0n]; // Mark the slot as used with the position + writeRegister(BigInt(pos), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `digitalPinToInterrupt(${pin})`, + }); +} +export function cr_interrupts() { + //TODO +} +export function cr_nointerrupts() { + // TODO +} +export function cr_isDigit() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = value1 >= 48n && value1 <= 57n ? 1n : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `isDigit(${value1})` }); +} +export function cr_isAlpha() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = + (value1 >= 65n && value1 <= 90n) || (value1 >= 97n && value1 <= 122n) + ? 1n + : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `isAlpha(${value1})` }); +} +export function cr_isAlphaNumeric() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = + (value1 >= 65n && value1 <= 90n) || (value1 >= 97n && value1 <= 122n) + ? 1n + : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `isAlphaNumeric(${value1})`, + }); +} +export function cr_isAscii() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = value1 >= 0n && value1 <= 127n ? 1n : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `isAscii(${value1})` }); +} +export function cr_isControl() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = (value1 >= 0n && value1 <= 31n) || value1 === 127n ? 1n : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `isControl(${value1})` }); +} +export function cr_isPunct() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = + (value1 >= 33n && value1 <= 47n) || + (value1 >= 58n && value1 <= 64n) || + (value1 >= 91n && value1 <= 96n) || + (value1 >= 123n && value1 <= 126n) + ? 1n + : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `isPunct(${value1})` }); +} +export function cr_isHexadecimalDigit() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = + (value1 >= 48n && value1 <= 57n) || + (value1 >= 65n && value1 <= 70n) || + (value1 >= 97n && value1 <= 102n) + ? 1n + : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `isHexadecimalDigit(${value1})`, + }); +} +export function cr_isUpperCase() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = value1 >= 65n && value1 <= 90n ? 1n : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `isUpperCase(${value1})`, + }); +} +export function cr_isLowerCase() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = value1 >= 97n && value1 <= 122n ? 1n : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `isLowerCase(${value1})`, + }); +} +export function cr_isPrintable() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = value1 >= 32n && value1 <= 126n ? 1n : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `isPrintable(${value1})`, + }); +} +export function cr_isGraph() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = value1 >= 33n && value1 <= 126n ? 1n : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `isGraph(${value1})` }); +} +export function cr_isSpace() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = + value1 === 32n || + value1 === 9n || + value1 === 10n || + value1 === 13n || + value1 === 11n || + value1 === 12n + ? 1n + : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `isSpace(${value1})` }); +} +export function cr_isWhiteSpace() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = + value1 === 32n || + value1 === 9n || + value1 === 10n || + value1 === 13n || + value1 === 11n || + value1 === 12n + ? 1n + : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `isWhiteSpace(${value1})`, + }); +} +export function cr_delay() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + coreEvents.emit("arduino-terminal-write", { text: `delay(${value1})` }); + // Simulate delay by busy-waiting + const start = Date.now(); + while (Date.now() - start < Number(value1)) { + // Busy wait + } +} +export function cr_delayMicroseconds() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + // Simulate microsecond delay by busy-waiting + coreEvents.emit("arduino-terminal-write", { + text: `delayMicroseconds(${value1})`, + }); + const start = performance.now(); + while (performance.now() - start < Number(value1) / 1000) { + // Busy wait + } +} +export function cr_randomSeed() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + coreEvents.emit("arduino-terminal-write", { + text: `randomSeed(${value1})`, + }); + _seed = Number(value1) >>> 0; +} +export function cr_random() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a1 not found", + "danger", + null, + ); + } + var value2 = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + // Linear Congruential Generator (LCG) + // Constants from Numerical Recipes + _seed = (_seed * 1664525 + 1013904223) >>> 0; + var rand = _seed / 0xffffffff; + if (value2 === 0n) { + // Return a random number between 0 and value1-1 + var randomValue = Math.floor(rand * Number(value1)); + coreEvents.emit("arduino-terminal-write", { + text: `random(${value1})`, + }); + writeRegister(BigInt(randomValue), ret1.indexComp, ret1.indexElem); + } else { + // Random between value1 and value2 + if (value1 > value2) { + var temp = value1; + value1 = value2; + value2 = temp; + } + var randomValue = + Math.floor(rand * Number(value2 - value1)) + Number(value1); + coreEvents.emit("arduino-terminal-write", { + text: `random(${value1}, ${value2})`, + }); + writeRegister(BigInt(randomValue), ret1.indexComp, ret1.indexElem); + } +} +export function cr_serial_available() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + if (serial_begin != 0 && initArduino != 0) { + // Check how many bytes are available in the keyboard input buffer + var available = BigInt( + typeof status.keyboard === "string" ? status.keyboard.length : 0, + ); + coreEvents.emit("arduino-terminal-write", { + text: `serial_available()`, + }); + writeRegister(available, ret1.indexComp, ret1.indexElem); + } else { + //ERROR + coreEvents.emit("arduino-terminal-write", { + text: `serial_available() = -1`, + }); + writeRegister(BigInt.asIntN(32, -1n), ret1.indexComp, ret1.indexElem); + } +} +export function cr_serial_availableForWrite() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + if (serial_begin != 0 && initArduino != 0) { + // Ready but with nothing being sended TODO: simulate complex scenaries + writeRegister(64n, ret1.indexComp, ret1.indexElem); //simulates 64k buffer + coreEvents.emit("arduino-terminal-write", { + text: `serial_availableForWrite()`, + }); + //in real hw it will only show data if its receiving data + } else { + //ERROR + coreEvents.emit("arduino-terminal-write", { + text: `serial_availableForWrite()`, + }); + writeRegister(-1n, ret1.indexComp, ret1.indexElem); + } +} +export function cr_serial_begin() { + if (initArduino != 0) { + if (serial_begin === 0) { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + "a0" + " not found", + "danger", + null, + ); + } + + /* Print integer */ + var value = readRegister(ret1.indexComp, ret1.indexElem); + //TODO: put frequences accepted values check + var val_int = parseInt(value.toString()) >> 0; + coreEvents.emit("arduino-terminal-write", { + text: `serial_begin(${val_int})`, + }); + serial_begin = val_int; + } + } +} +export function cr_serial_end() { + if (serial_begin != 0 && initArduino != 0) { + coreEvents.emit("arduino-terminal-write", { text: `serial_end()` }); + serial_begin = 0; // Reset serial_begin + } +} +export function cr_serial_find() { + coreEvents.emit("arduino-terminal-write", { + text: `serial_find(a0, a1)`, + }); + if (serial_begin != 0 && initArduino != 0) { + keyboard_read_find(kbd_read_string, "a0", "a1"); + } +} +export function cr_serial_findUntil() { + coreEvents.emit("arduino-terminal-write", { + text: `serial_findUntil(a0, x0,a1)`, + }); + if (serial_begin != 0 && initArduino != 0) { + keyboard_read_find(kbd_read_string, "a0", "x0", "a1"); + } +} +export function cr_serial_flush() { + //Cleans the serial buffer. Not exaclty what the board does, imitates Arduino 1.0 + coreEvents.emit("arduino-terminal-write", { + text: `serial_flush()`, + }); + if (serial_begin != 0 && initArduino != 0) { + status.keyboard = ""; + status.display = ""; + const root = (document as any).app; + if (root) { + root.keyboard = ""; + root.display = ""; + root.enter = null; + } + } +} +export function cr_serial_parseInt() { + + coreEvents.emit("arduino-terminal-write", { + text: `serial_parseInt(a0)`, + }); + if (serial_begin != 0 && initArduino != 0) { + keyboard_parseInt(kbd_read_string, "a0"); + } +} +export function cr_serial_read() { + coreEvents.emit("arduino-terminal-write", { + text: `serial_read(a0)`, + }); + if (serial_begin != 0 && initArduino != 0) { + keyboard_read(kbd_read_char, "a0"); + } +} +export function cr_serial_readBytes() { + if (serial_begin != 0 && initArduino != 0) { + var register = crex_findReg("a0"); + if (register.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + "a0" + " not found", + "danger", + null, + ); + } + // Length + const auxreg = crex_findReg("a1"); + if (auxreg.match === 0) { + throw new Error("capi_syscall: register a1 not found"); + } + const size = readRegister(auxreg.indexComp, auxreg.indexElem); + + const funct_params = { + indexComp: register.indexComp, + indexElem: register.indexElem, + size, + }; + coreEvents.emit("arduino-terminal-write", { + text: `serial_readBytes(a0, a1)`, + }); + status.run_program = 3; + return keyboard_read(kbd_read_string, funct_params); + } +} +export function cr_serial_readBytesUntil() { + if (serial_begin != 0 && initArduino != 0) { + // Value 1 is the searched char + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + "a0" + " not found", + "danger", + null, + ); + } + // Check if value1 is a number and is a valid ASCII character + var value1 = readRegister(ret1.indexComp, ret1.indexElem); + if (typeof value1 !== "bigint" || value1 < 0 || value1 > 255) { + throw packExecute( + true, + "capi_syscall: invalid value for searched character", + "danger", + null, + ); + } + + // Value 2 is the buffer + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + "a1" + " not found", + "danger", + null, + ); + } + + // Value 3 is the length or end character + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + "a2" + " not found", + "danger", + null, + ); + } + // Check if value3 is a number and greater than 0 + var value3_check = readRegister(ret3.indexComp, ret3.indexElem); + if (typeof value3_check !== "bigint" || value3_check <= 0) { + throw packExecute( + true, + "capi_syscall: invalid value for length/end char", + "danger", + null, + ); + } + coreEvents.emit("arduino-terminal-write", { + text: `serial_readBytesUntil(a0, a1, a2)`, + }); + status.run_program = 3; + return keyboard_read_until(kbd_read_string, ret2, value1); + } +} +export function cr_serial_write() { + const valReg = crex_findReg("a0"); + if (valReg.match === 0) { + throw packExecute(true, "capi_arduino: register a0 not found", "danger", null); + } + //This version only transforms bytes to char, function overloading contradicts how it works + const fullValue = readRegister(valReg.indexComp, valReg.indexElem); + + // 3. Extraemos solo los 8 bits inferiores (máscara 0xFF) + const byte = Number(BigInt.asUintN(8, fullValue)); + + const char = String.fromCharCode(byte); + + coreEvents.emit("arduino-terminal-write", { + text: "serial_write(" + char + ")", + }); + display_print(char); +} +export function cr_serial_printf() { + // Get the address from register a0 + const valueReg = crex_findReg("a0"); + if (valueReg.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + // Read the address stored in the register (already BigInt) + let stringAddress = readRegister( + valueReg.indexComp, + valueReg.indexElem, + ) as bigint; + + // Normalize address to positive range + stringAddress = BigInt.asUintN(32, stringAddress); + + // Get the memory instance + const memory = main_memory as Memory; + + // Validate address is within memory bounds + if (stringAddress >= BigInt(memory.getSize())) { + throw packExecute( + true, + "capi_arduino: invalid string address", + "danger", + null, + ); + } + + // Read the format string from memory + let formatString = ""; + let memoryAddr = stringAddress; + while (memoryAddr < BigInt(memory.getSize())) { + const byte = memory.read(memoryAddr); + if (byte === 0) break; // Null terminator + formatString += String.fromCharCode(byte); + memoryAddr++; + } + + // Process format specifiers + let result = formatString; + const argRegisters = ["a1", "a2", "a3", "a4", "a5", "a6", "a7"]; + + for (const reg of argRegisters) { + const argReg = crex_findReg(reg); + if (argReg.match === 0) break; + + const argValue = readRegister(argReg.indexComp, argReg.indexElem); + + // Replacements + result = result.replace("%d", String(BigInt.asIntN(32, argValue))); + result = result.replace("%u", String(BigInt.asUintN(32, argValue))); + result = result.replace( + "%x", + BigInt.asUintN(32, argValue).toString(16), + ); + result = result.replace( + "%c", + String.fromCharCode(Number(BigInt.asUintN(8, argValue))), + ); + if (result.includes("%s")) { + let str = ""; + let addr = argValue; + + while (addr < BigInt(memory.getSize())) { + const byte = memory.read(addr); + if (byte === 0) break; // Null terminator + str += String.fromCharCode(byte); + addr++; + } + result = result.replace("%s", str); + } + } + + // Print the formatted string directly + coreEvents.emit("arduino-terminal-write", { + text: `serial_printf(a0, a1)`, + }); + display_print(result); +} +export function cr_tone() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN(32, readRegister(ret2.indexComp, ret2.indexElem)); + + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_arduino: register a2 not found", + "danger", + null, + ); + } + var duration = BigInt.asIntN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + coreEvents.emit("arduino-terminal-write", { + text: `tone(${pin}, ${value}, ${duration})`, + }); + coreEvents.emit("arduino-pin-write", { + pin: Number(pin), + value: Number(value), + }); +} +export function cr_noTone() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + coreEvents.emit("arduino-terminal-write", { text: `noTone(${pin})` }); + coreEvents.emit("arduino-pin-write", { pin: Number(pin), value: 0 }); +} +export function cr_pulseIn() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN(32, readRegister(ret2.indexComp, ret2.indexElem)); + + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_arduino: register a2 not found", + "danger", + null, + ); + } + var duration = BigInt.asIntN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + coreEvents.emit("arduino-terminal-write", { + text: `pulseIn(${pin}, ${value}, ${duration})`, + }); + coreEvents.emit("arduino-pin-write", { + pin: Number(pin), + value: Number(value), + }); +} +export function cr_pulseInLong() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN(32, readRegister(ret2.indexComp, ret2.indexElem)); + + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_arduino: register a2 not found", + "danger", + null, + ); + } + var duration = BigInt.asIntN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + coreEvents.emit("arduino-terminal-write", { + text: `pulseInLong(${pin}, ${value}, ${duration})`, + }); + coreEvents.emit("arduino-pin-write", { + pin: Number(pin), + value: Number(value), + }); +} +export function cr_shiftIn() { + let value = 0; + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var dataPin = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var clockPin = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_arduino: register a2 not found", + "danger", + null, + ); + } + var bitOrder = BigInt.asIntN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + coreEvents.emit("arduino-terminal-write", { + text: `shiftIn(${dataPin}, ${clockPin}, ${bitOrder})`, + }); + let bit = 0; + for (let i = 0; i < 8; i++) { + // let bit = pinStates.value[`GPIO${dataPin}`] !== 0 ? 1 : 0; + coreEvents.emit("arduino-pin-read", { + pin: `GPIO${dataPin}`, + callback: (val: number) => { + bit = val; + } + }); + if (bitOrder === 1n) { + // MSBFIRST + value |= bit << (7 - i); + } else { + // LSBFIRST + value |= bit << i; + } + } + writeRegister(BigInt(value), ret1.indexComp, ret1.indexElem); +} +export function cr_shiftOut() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var dataPin = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var clockPin = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_arduino: register a2 not found", + "danger", + null, + ); + } + var bitOrder = BigInt.asIntN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + var ret4 = crex_findReg("a3"); + if (ret4.match === 0) { + throw packExecute( + true, + "capi_arduino: register a3 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN( + 32, + readRegister(ret4.indexComp, ret4.indexElem), + ); + coreEvents.emit("arduino-terminal-write", { + text: `shiftOut(${dataPin}, ${clockPin}, ${bitOrder}, ${value})`, + }); +for (let i = 0; i < 8; i++) { + let bit; + // Importante: Usamos 1n para operaciones con BigInt + if (bitOrder === 1n) { + // MSBFIRST: del bit 7 al 0 + bit = (value & (1n << BigInt(7 - i))) ? 1n : 0n; + } else { + // LSBFIRST: del bit 0 al 7 + bit = (value & (1n << BigInt(i))) ? 1n : 0n; + } + // pinStates.value[`GPIO${dataPin}`] = Number(bit); + coreEvents.emit("arduino-pin-write", { + pin: Number(dataPin), + value: Number(value), + }); + } + + +} + +//Order +export const hookOrder = [ + "cr_initArduino", + "cr_digitalRead", + "cr_pinMode", + "cr_digitalWrite", + "cr_rgbLedWrite", + "cr_analogRead", + "cr_analogReadResolution", + "cr_analogWrite", + "cr_map", + "cr_constrain", + "cr_abs", + "cr_max", + "cr_min", + "cr_pow", + "cr_bit", + "cr_bitClear", + "cr_bitRead", + "cr_bitSet", + "cr_bitWrite", + "cr_highByte", + "cr_lowByte", + "cr_attachInterrupt", + "cr_detachInterrupt", + "cr_digitalPinToInterrupt", + "cr_pulseIn", + "cr_pulseInLong", + "cr_shiftIn", + "cr_shiftOut", + "cr_tone", + "cr_noTone", + "cr_interrupts", + "cr_nointerrupts", + "cr_isDigit", + "cr_isAlpha", + "cr_isAlphaNumeric", + "cr_isAscii", + "cr_isControl", + "cr_isPunct", + "cr_isHexadecimalDigit", + "cr_isUpperCase", + "cr_isLowerCase", + "cr_isPrintable", + "cr_isGraph", + "cr_isSpace", + "cr_isWhiteSpace", + "cr_delay", + "cr_delayMicroseconds", + "cr_randomSeed", + "cr_random", + "cr_serial_available", + "cr_serial_availableForWrite", + "cr_serial_begin", + "cr_serial_end", + "cr_serial_find", + "cr_serial_findUntil", + "cr_serial_flush", + "cr_serial_parseInt", + "cr_serial_read", + "cr_serial_readBytes", + "cr_serial_readBytesUntil", + "cr_serial_write", + "cr_serial_printf", +]; diff --git a/src/core/capi/initCAPI.mts b/src/core/capi/initCAPI.mts index 7a8731650..85545d5ea 100644 --- a/src/core/capi/initCAPI.mts +++ b/src/core/capi/initCAPI.mts @@ -27,6 +27,7 @@ import { ARCH as Z80 } from "./arch/z80.mjs"; import { ARCH as MIPS } from "./arch/mips.mjs"; import { REG } from "./registers.mts"; import { INTERRUPTS } from "./interrupts.mts"; +import { ARDUINO } from "./arduino.mts"; export interface CAPIType { MEM: typeof MEM; @@ -37,6 +38,7 @@ export interface CAPIType { ARCH: unknown; // The architecture plugin will be loaded here REG: typeof REG; INTERRUPTS: typeof INTERRUPTS; + ARDUINO: typeof ARDUINO; } declare global { @@ -70,6 +72,7 @@ export function initCAPI(pluginName?: string) { ARCH: ARCH_PLUGIN, REG, INTERRUPTS, + ARDUINO, }; globalThis.CAPI = CAPI; diff --git a/src/core/core.mjs b/src/core/core.mjs index ba293341e..b22d072c3 100644 --- a/src/core/core.mjs +++ b/src/core/core.mjs @@ -16,7 +16,6 @@ * You should have received a copy of the GNU Lesser General Public License * along with CREATOR. If not, see . */ - import { initCAPI } from "./capi/initCAPI.mts"; import { getHexTwosComplement } from "./utils/utils.mjs"; import { logger } from "./utils/creator_logger.mjs"; @@ -48,6 +47,8 @@ import { init, compileArchitectureFunctions } from "./executor/executor.mjs"; import { resetDevices } from "./executor/devices.mts"; import { compileTimerFunctions } from "./executor/timers.mts"; import * as archProcessor from "./utils/architectureProcessor.mjs"; +import { writeDataDumpMemory32, writeDataDumpMemory64 } from "./assembler/sailAssembler/web/CNAssambler.mjs"; +import { disassemble_lib } from "@/web/components/assembly/MultifileEditor.mjs"; /** @type {import("./core.d.ts").Library | import("./core.d.ts").LegacyLibrary} */ export let loadedLibrary = {}; @@ -80,6 +81,13 @@ export const guiVariables = { keep_highlighted: -1n, // Address to keep highlighted (used to highlight interrupted instructions) }; +export var L1_cache_memory = [/*{id:0, addr: "0", binary: "0x00"}*/]; +export var L1_I_cache_memory = []; +export var L1_D_cache_memory = []; +export var L2_cache_memory = []; +export var L2_I_cache_memory = []; +export var L2_D_cache_memory = []; +export var config_cache = []; /** @type {number} */ export let WORDSIZE; /** @type {number} */ @@ -119,6 +127,7 @@ export const instructions_packed = 100; export { initCAPI }; // Instead of calling it here, which causes circular dependencies, we re-export it so it can be called by the main application. let creator_debug = false; +let creator_kernel = true; BigInt.prototype.toJSON = function () { return JSON.rawJSON(this.toString()); @@ -133,6 +142,11 @@ export function set_debug(enable_debug) { logger.disable(); } } + +export function set_kernel(enable_kernel) { + creator_kernel = enable_kernel; +} + /** * Load architecture from YAML string and prepare for use * @param {string} architectureYaml - YAML string containing architecture definition @@ -250,6 +264,18 @@ export function load_library(lib_str) { throw new SyntaxError(`Invalid library format: ${error.message}`); }); } +/** + * Loads a library to Sail simulator. + * + * @param {string} lib_str + * + */ + +export async function load_library_sail(lib, lib_name) { + loadedLibrary = {name: lib_name, library_file: lib}; + await disassemble_lib(loadedLibrary); + coreEvents.emit("library-loaded"); +} /** * Removes a library. @@ -259,9 +285,6 @@ export function remove_library() { loadedCreatino = false; coreEvents.emit("library-removed"); } -/** - * Add CREATino library. - */ export async function load_CREATino() { //show_loading(); try { @@ -285,7 +308,18 @@ export async function load_CREATino() { // compilation export async function assembly_compile(code, compiler) { - const ret = await assembly_compiler(code, false, compiler); + var ret; + + if (architecture.config.name.includes("SRV")){ + if (Object.keys(loadedLibrary).length === 0) + ret = await assembly_compiler(code, false, compiler); + else + ret = await assembly_compiler(code, true, compiler); + } + else{ + ret = await assembly_compiler(code, false, compiler); + } + switch (ret.status) { case "error": break; @@ -300,7 +334,7 @@ export async function assembly_compile(code, compiler) { break; default: - ret.msg = "Unknow assembly compiler code :-/"; + ret.msg = "Unknown assembly compiler code :-/"; break; } @@ -363,6 +397,36 @@ export function reset() { main_memory.restore(main_memory_backup); } + if (architecture.config.name.includes("SRV")){ + for (const instruction of instructions ?? []){ + const auxAddr = parseInt(instruction.Address,16); + for (let j = 0; j < instruction.hex.length; j += 32) { + const wordBinary = instruction.hex.slice(j, j+32); + const wordBytes = []; + + // Split word into bytes + for (let k = 0; k < wordBinary.length; k += 8) { + const byte = parseInt(wordBinary.slice(k, k+8), 2); + wordBytes.push(byte); + } + + main_memory.writeWord(BigInt(auxAddr + j / 8), wordBytes); + } + } + instructions.forEach(insn => { + insn.L1 = 0; + insn.L1_I = 0; + insn.L1_D = 0; + insn.L2 = 0; + insn.L2_I = 0; + insn.L2_D = 0; + }); + if (architecture.config.name === "SRV32") + writeDataDumpMemory32(); + else + writeDataDumpMemory64(); + + } // Stack Reset stackTracker.reset(); sentinel.reset(); @@ -641,3 +705,80 @@ export function setPC(value) { return null; } + +export function updateCacheMem(index, type, addr, value) { + + // Identificamps primero a que cache afecta + // Despues comprobamos si ese bloque de cache ya existe + // Si existe se reemplaza, sino se hace un push de una nueva línea + switch(type) { + case "L1_I": + let L1_I_index = L1_I_cache_memory.findIndex(block => block.id === index); + if (L1_I_index === -1) { + let set_id = (document.app.$data.cache_location === "Associative_per_sets") ? Math.floor(index / document.app.$data.L1_I_num_lines) : -1; + L1_I_cache_memory.push({set_id: set_id, id: index, addr: addr, size: /*value.slice(2).length * 4*/ value/*value.slice(2)*/}); + } else { + + L1_I_cache_memory[L1_I_index].size = /*value.slice(2).length * 4*/ value; // Length in bits + L1_I_cache_memory[L1_I_index].addr = addr; + } + document.app.L1_I_cache_memory = L1_I_cache_memory; + break; + case "L1_D": + let L1_D_index = L1_D_cache_memory.findIndex(block => block.id === index); + if (L1_D_index === -1) { + let set_id = (document.app.$data.cache_location === "Associative_per_sets") ? Math.floor(index / document.app.$data.L1_D_num_lines) : -1; + L1_D_cache_memory.push({set_id: set_id, id: index, addr: addr, size: /*value.slice(2).length * 4*/ value/*value.slice(2)*/}); + } else { + + L1_D_cache_memory[L1_D_index].size = /*value.slice(2).length * 4*/ value; // Length in bits + L1_D_cache_memory[L1_D_index].addr = addr; + } + break; + case "L1": + let L1_index = L1_cache_memory.findIndex(block => block.id === index); + if (L1_index === -1) { + let set_id = (document.app.$data.cache_location === "Associative_per_sets") ? Math.floor(index / document.app.$data.L1_num_lines) : -1; + L1_cache_memory.push({set_id: set_id, id: index, addr: addr, size: /*value.slice(2).length * 4*/ value/*value.slice(2)*/}); + } else { + + L1_cache_memory[L1_index].size = /*value.slice(2).length * 4*/ value; // Length in bits + L1_cache_memory[L1_index].addr = addr; + } + break; + case "L2": + let L2_index = L2_cache_memory.findIndex(block => block.id === index); + if (L2_index === -1) { + let set_id = (document.app.$data.cache_location === "Associative_per_sets") ? Math.floor(index / document.app.$data.L2_num_lines) : -1; + L2_cache_memory.push({set_id: set_id, id: index, addr: addr, size: /*value.slice(2).length * 4*/ value/*value.slice(2)*/}); + } else { + + L2_cache_memory[L2_index].size = /*value.slice(2).length * 4*/ value; // Length in bits + L2_cache_memory[L2_index].addr = addr; + } + break; + case "L2_I": + let L2_I_index = L2_I_cache_memory.findIndex(block => block.id === index); + if (L2_I_index === -1) { + let set_id = (document.app.$data.cache_location === "Associative_per_sets") ? Math.floor(index / document.app.$data.L2_I_num_lines) : -1; + L2_I_cache_memory.push({set_id: set_id, id: index, addr: addr, size: /*value.slice(2).length * 4*/ value/*value.slice(2)*/}); + } else { + + L2_I_cache_memory[L2_I_index].size = /*value.slice(2).length * 4*/ value; // Length in bits + L2_I_cache_memory[L2_I_index].addr = addr; + } + document.app.L2_I_cache_memory = L2_I_cache_memory; + break; + case "L2_D": + let L2_D_index = L2_D_cache_memory.findIndex(block => block.id === index); + if (L2_D_index === -1) { + let set_id = (document.app.$data.cache_location === "Associative_per_sets") ? Math.floor(index / document.app.$data.L2_D_num_lines) : -1; + L2_D_cache_memory.push({set_id: set_id, id: index, addr: addr, size: /*value.slice(2).length * 4*/ value/*value.slice(2)*/}); + } else { + + L2_D_cache_memory[L2_D_index].size = /*value.slice(2).length * 4*/ value; // Length in bits + L2_D_cache_memory[L2_D_index].addr = addr; + } + break; + } +} diff --git a/src/core/events.mts b/src/core/events.mts index c0c03ef62..49fbcc022 100644 --- a/src/core/events.mts +++ b/src/core/events.mts @@ -18,6 +18,7 @@ */ import mitt, { type Emitter } from "mitt"; +import { ARDUINO } from "./capi/arduino.mts"; /** * Event types for CREATOR core events @@ -31,6 +32,13 @@ export const CoreEventTypes = { LIBRARY_LOADED: "library-loaded", LIBRARY_REMOVED: "library-removed", EXECUTOR_BUTTONS_UPDATE: "executor-buttons-update", + PAUSE_EXEC: "pause-execution", + EXECUTOR_INSTRUCTIONS_UPDATE: "sail-instruction-update", + ASSEMBLY_FILES_UPDATE: "assembly-files-update", + ARDUINO_TERMINAL_WRITE: "arduino-terminal-write", + ARDUINO_PIN_CHANGED: "arduino-pin-write", + ARDUINO_RESET: "arduino-reset", + ARDUINO_PIN_INTERRUPT: "arduino-pin-interrupt", } as const; /** @@ -75,6 +83,20 @@ export interface ExecutorButtonsUpdateEvent { errorMessage?: string; } +export interface AssemblyFile { + filename: string; + code: string; + to_compile: boolean; + editing_now: boolean; + id: number; +} + +export interface AssemblyFilesUpdatedEvent { + files: AssemblyFile[]; + currentTab: number; +} + + /** * Core event types mapping */ @@ -95,7 +117,76 @@ export type CoreEvents = { "library-removed": void; /** Emitted when executor button states should be updated */ "executor-buttons-update": ExecutorButtonsUpdateEvent; + /** Emitted when assembly_files state change on Creat, rename, delete and show */ + "assembly-files-update": AssemblyFilesUpdatedEvent; + /** Emitted when the simulator sends text to the Arduino Terminal */ + "arduino-terminal-write": ArduinoTerminalWriteEvent; + /** Emitted when a Pin changes its values */ + "arduino-pin-write": ArduinoPinChangedEvent; + /** Emitted when a GPIO pin is read */ + "arduino-pin-read": ArduinoPinRead; + /** Emitted when Arduino is reset */ + "arduino-reset": void; + /** Event is emmited when a pin in pinMode has been set to a mode */ + "arduino-pin-mode":ArduinoPinMode; + /** Event is emmited when a pin is set up in an interrupt */ + "arduino-pin-interrupt":ArduinoPinInterruptEvent; + /** Emitted when a pin is detached from an interrupt */ + "arduino-pin-detach-interrupt": ArduinoPinDetachInterruptEvent; }; +/** + * Emitted when the simulator sends text to the Arduino Terminal + */ +export interface ArduinoTerminalWriteEvent { + /** The text to be displayed in the terminal */ + text: string; +} +/** + * Emitted when a Pin changes its value + */ +export interface ArduinoPinChangedEvent { + /** The pin number */ + pin: number; + /** The new value of the pin */ + value: number; +} + +/** + * Emitted when a Pin changes its value + */ +export interface ArduinoPinMode{ + /** The pin number */ + pin: number; + /** The mode of the pin */ + mode: number; +} + +/** + * Event is emmited when a pin is set up in an interrupt + */ +export interface ArduinoPinInterruptEvent { + /** The pin number */ + pin: string; +} +/** + * Emitted when a pin is detached from an interrupt + */ +export interface ArduinoPinDetachInterruptEvent { + /** The pin number */ + pin: string; +} + +/** + * Event is emitted when a GPIO pin is read + */ +export interface ArduinoPinRead { + /** The pin number */ + pin: string; + + /** Callback to return the pin value */ + callback: (value: number) => void; +} + /** * Global event emitter for CREATOR core events diff --git a/src/core/executor/IO.mjs b/src/core/executor/IO.mjs index 0b32f06e7..1f545e932 100644 --- a/src/core/executor/IO.mjs +++ b/src/core/executor/IO.mjs @@ -17,7 +17,7 @@ * along with CREATOR. If not, see . */ -import { status, main_memory } from "../core.mjs"; +import { status, main_memory, architecture } from "../core.mjs"; import { readRegister, writeRegister, @@ -27,8 +27,12 @@ import { packExecute } from "../utils/utils.mjs"; import os from "node:os"; import { show_notification } from "../utils/notifications.mts"; import { instructions } from "../assembler/assembler.mjs"; +import { sailexec } from "./sailSimRV/sailExecutor.mjs"; import { coreEvents, CoreEventTypes } from "../events.mts"; +import { crex_findReg } from "../register/registerLookup.mjs"; +import { Memory } from "../memory/Memory.mts"; + export function display_print(info) { if (typeof document !== "undefined" && document.app) { document.app.$data.display += info; @@ -46,7 +50,13 @@ export function display_print(info) { export function kbd_read_char(keystroke, params) { const value = keystroke.charCodeAt(0); - writeRegister(value, params.indexComp, params.indexElem); + if (architecture.config.name.includes("SRV")) { + sailexec._send_char_to_C(value); + + document.app.$data.execution_mode_run = document.app.$data.last_execution_mode_run; + document.app.$data.last_execution_mode_run = -1; + } + writeRegister(BigInt(value), params.indexComp, params.indexElem); return value; } @@ -70,6 +80,12 @@ export function kbd_read_int(keystroke, params) { return null; } + if (architecture.config.name.includes("SRV")) { + sailexec._send_int_to_C(value); + + document.app.$data.execution_mode_run = document.app.$data.last_execution_mode_run; + document.app.$data.last_execution_mode_run = -1; + } value = BigInt(value); writeRegister(value, params.indexComp, params.indexElem); @@ -88,8 +104,19 @@ export function kbd_read_float(keystroke, params) { ); return null; } + if (architecture.config.name.includes("SRV")) { + sailexec._send_float_to_C(value); - writeRegister(value, params.indexComp, params.indexElem); + + document.app.$data.execution_mode_run = document.app.$data.last_execution_mode_run; + document.app.$data.last_execution_mode_run = -1; + } + + const buffer = new ArrayBuffer(4); + const view = new DataView(buffer); + view.setFloat32(0,value, false); + const bits = view.getUint32(0, false); + writeRegister(BigInt(("0x" + bits.toString(16).padStart(8, "0"))), params.indexComp, params.indexElem); return value; } @@ -106,6 +133,12 @@ export function kbd_read_double(keystroke, params) { return null; } + if (architecture.config.name.includes("SRV")) { + sailexec._send_double_to_C(value); + + document.app.$data.execution_mode_run = document.app.$data.last_execution_mode_run; + document.app.$data.last_execution_mode_run = -1; + } writeRegister(value, params.indexComp, params.indexElem, "DFP-Reg"); return value; @@ -120,6 +153,25 @@ export function kbd_read_string(keystroke, params) { main_memory.write(BigInt(addr + BigInt(i)), bytes[i]); } + if (architecture.config.name.includes("SRV")) { + var lengthBytes = sailexec.lengthBytesUTF8(keystroke) + 1; + + var buffer = sailexec._malloc(lengthBytes); + + sailexec.stringToUTF8(keystroke, buffer, lengthBytes); + + if (architecture.config.name === "SRV32"){ + sailexec._send_string_to_C(buffer); + sailexec._free(buffer); + } + else{ + sailexec._send_string_to_C(BigInt(buffer)); + sailexec._free(BigInt(buffer)); + } + + document.app.$data.execution_mode_run = document.app.$data.last_execution_mode_run; + document.app.$data.last_execution_mode_run = -1; + } return keystroke; } @@ -169,6 +221,156 @@ function rawPrompt() { return chunks.join(""); } + + +export function keyboard_parseInt(fn_post_read, fn_post_params) { + const draw = { + space: [], + info: [], + success: [], + warning: [], + danger: [], + flash: [], + }; + + //-------LOOKAHEAD (optional): mode used to look ahead in the stream for an integer + const ret1 = crex_findReg(fn_post_params); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + fn_post_params + " not found", + "danger", + null, + ); + } + + const addr = readRegister(ret1.indexComp, ret1.indexElem); + // Get the memory instance + const memory = main_memory; + + // Validate address is within memory bounds + if (addr >= BigInt(memory.getSize())) { + throw packExecute( + true, + "capi_arduino: invalid string address", + "danger", + null, + ); + } + + // Read the lookahead from memory + let target = ""; + let memoryAddr = addr; + while (memoryAddr < BigInt(memory.getSize())) { + const byte = memory.read(memoryAddr); + if (byte === 0) break; // Null terminator + target += String.fromCharCode(byte); + memoryAddr++; + } + //LOOKAHEAD values + if (target === "" || target =="SKIP_ALL") { + var regex = new RegExp("\\s*(-?\\d+)", "g"); //Search the first number (negative or not) + } + else if (target === "SKIP_NONE") { + var regex = new RegExp("^(-?\\d+)"); + } + else { // SKIP_WHITESPACE + var regex = new RegExp("^\\s*(-?\\d+)"); + + } + + + + // Deno / CLI mode + if (typeof Deno !== "undefined") { + let keystroke = rawPrompt(); + var match = regex.exec(keystroke); + if (match) { + keystroke = match[1]; //Extracted number as string + writeRegister(BigInt(keystroke), ret1.indexComp, ret1.indexElem); + } else { + keystroke = ""; //No number found + writeRegister(0n, ret1.indexComp, ret1.indexElem); + } + + status.run_program = 0; + return packExecute( + false, + "The result has been written to the register", + "info", + null, + ); + } + + // Web/UI mode + document.app.$data.enter = false; // wait for input + + if (status.run_program === 3) { + setTimeout(keyboard_parseInt, 1000, fn_post_read, fn_post_params); + return draw; + } + + let keystroke = document.app.$data.keyboard; + + if (!keystroke || keystroke.length === 0) { + status.run_program = 3; + return keyboard_parseInt(fn_post_read, fn_post_params); + } + var match = regex.exec(keystroke); + if (match) { + keystroke = match[1]; //Extracted number as string + if (keystroke.includes("-")) { + writeRegister(BigInt.asIntN(keystroke), ret1.indexComp, ret1.indexElem); + } + writeRegister(BigInt(keystroke), ret1.indexComp, ret1.indexElem); + } else { + keystroke = ""; //No number found + writeRegister(0n, ret1.indexComp, ret1.indexElem); + } + // if (keystroke.includes(target) && keystroke.length <= (length || keystroke.length) && !keystroke.includes(until)) { + // writeRegister(1n, ret1.indexComp, ret1.indexElem); + // } else { + // writeRegister(0n, ret1.indexComp, ret1.indexElem); + // } + + + document.app.$data.keyboard = ""; + document.app.$data.enter = null; + + draw.info.push("The result has been written to the register"); + + if (status.execution_index >= instructions.length) { + for (let i = 0; i < instructions.length; i++) { + draw.space.push(i); + } + status.execution_index = -2; + return packExecute( + true, + "The execution of the program has finished", + "success", + null, + ); + } + // If program was running before waiting for input, continue execution automatically + if (status.run_program === 1) { + const playButton = document.getElementById("playExecution"); + if (playButton) { + playButton.click(); + } + } + + // Re-enable buttons + if (typeof document !== "undefined" && document.app) { + coreEvents.emit(CoreEventTypes.EXECUTOR_BUTTONS_UPDATE, { + instruction_disable: false, + run_disable: false, + }); + } + + return draw; +} + + export function keyboard_read(fn_post_read, fn_post_params) { const draw = { space: [], @@ -198,6 +400,8 @@ export function keyboard_read(fn_post_read, fn_post_params) { } const val = fn_post_read(document.app.$data.keyboard, fn_post_params); + // Important: Final line char (/=) couns also as a char in lenght + writeRegister(BigInt(val.length), fn_post_params.indexComp, fn_post_params.indexElem); document.app.$data.keyboard = ""; // clear input @@ -209,6 +413,124 @@ export function keyboard_read(fn_post_read, fn_post_params) { document.app.$data.enter = null; // reset keyboard + if (status.execution_index >= instructions.length) { + for (let i = 0; i < instructions.length; i++) { + draw.space.push(i); + } + + status.execution_index = -2; + return packExecute( + true, + "The execution of the program has finished", + "success", + null, + ); + } + if (architecture.config.name.includes("SRV")) + return draw; + // If program was running before waiting for input, continue execution automatically + if (status.run_program === 1) { + // Trigger the play button to continue execution + const playButton = document.getElementById("playExecution"); + if (playButton) { + playButton.click(); + } + } + + // Re-enable buttons using event emitter for proper reactivity + if (typeof document !== "undefined" && document.app) { + coreEvents.emit(CoreEventTypes.EXECUTOR_BUTTONS_UPDATE, { + instruction_disable: false, + run_disable: false, + }); + } + + return draw; +} + +export function keyboard_read_until(fn_post_read, fn_post_params, fn_post_until) { + const draw = { + space: [], + info: [], + success: [], + warning: [], + danger: [], + flash: [], + }; + // if (typeof fn_post_until !== "string" || fn_post_until.length === 0) { + // throw packExecute( + // true, + // "capi_syscall: invalid 'until' parameter for keyboard_read_until", + // "danger", + // null, + // ); + // } + const until = String.fromCharCode(Number(fn_post_until)); + console.log( + "keyboard_read_until: waiting until", + `"${until}"`, + "type:", + typeof until, + "length:", + until?.length + ); + + + // Check for Deno environment + if (typeof Deno !== "undefined") { + let keystroke = rawPrompt(); + // Extract input until the 'until' character + if (typeof until === "string" && until.length > 0) { + const idx = keystroke.indexOf(until); + if (idx !== -1) { + keystroke = keystroke.slice(0, idx); + } + + } + // console.log("Extracted keystroke until 'until':", `"${keystroke}"`); + const value = fn_post_read(keystroke, fn_post_params); + status.keyboard = status.keyboard + " " + value; + status.run_program = 0; // Reset run_program status + + return null; + } + + // Web/UI mode + document.app.$data.enter = false; // signal UI to wait for keyboard read + + if (status.run_program === 3) { + setTimeout(keyboard_read_until, 1000, fn_post_read, fn_post_params, fn_post_until); + return draw; + } + + // Extract input until the 'until' character + let keystroke = document.app.$data.keyboard; + if (until.length > 0) { + const idx = keystroke.indexOf(until); + if (idx !== -1) { + keystroke = keystroke.slice(0, idx); + } + } + + const funct_params = { + indexComp: fn_post_params.indexComp, + indexElem: fn_post_params.indexElem, + size: keystroke.length, + }; + + const val = fn_post_read(keystroke, funct_params); + writeRegister(BigInt(val.length), fn_post_params.indexComp, fn_post_params.indexElem); + + document.app.$data.keyboard = ""; // clear input + + if (val === null) { + // error parsing input, retry + status.run_program = 3; + return keyboard_read_until(fn_post_read, fn_post_params,fn_post_until); + } + + document.app.$data.enter = null; // reset keyboard + if (status.execution_index >= instructions.length) { for (let i = 0; i < instructions.length; i++) { draw.space.push(i); @@ -242,3 +564,186 @@ export function keyboard_read(fn_post_read, fn_post_params) { return draw; } + + +export function keyboard_read_find(fn_post_read, fn_post_params,fn_post_length,fn_post_until) { + const draw = { + space: [], + info: [], + success: [], + warning: [], + danger: [], + flash: [], + }; + + // Resolve the target string from register + const ret1 = crex_findReg(fn_post_params); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + fn_post_params + " not found", + "danger", + null, + ); + } + + const addr = readRegister(ret1.indexComp, ret1.indexElem); + // Get the memory instance + const memory = main_memory; + + // Validate address is within memory bounds + if (addr >= BigInt(memory.getSize())) { + throw packExecute( + true, + "capi_arduino: invalid string address", + "danger", + null, + ); + } + + // Read the target from memory + let target = ""; + let memoryAddr = addr; + while (memoryAddr < BigInt(memory.getSize())) { + const byte = memory.read(memoryAddr); + if (byte === 0) break; // Null terminator + target += String.fromCharCode(byte); + memoryAddr++; + } + //Read length if provided + let length = null; + if (fn_post_length && fn_post_length.length > 0) { + const ret2 = crex_findReg(fn_post_length); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + fn_post_length + " not found", + "danger", + null, + ); + } + length = readRegister(ret2.indexComp, ret2.indexElem); + } + + + // Resolve the until string from register if provided (serial_findUntil) + let until = ""; + if (fn_post_until && fn_post_until.length > 0) { + const ret2 = crex_findReg(fn_post_until); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + fn_post_until + " not found", + "danger", + null, + ); + } + const addr_until = readRegister(ret2.indexComp, ret2.indexElem); + // until = readMemory(parseInt(addr_until), "string"); + // Validate address is within memory bounds + if (addr_until >= BigInt(memory.getSize())) { + throw packExecute( + true, + "capi_arduino: invalid string address", + "danger", + null, + ); + } + + // Read the target from memory + memoryAddr = addr_until; + while (memoryAddr < BigInt(memory.getSize())) { + const byte = memory.read(memoryAddr); + if (byte === 0) break; // Null terminator + until += String.fromCharCode(byte); + memoryAddr++; + } + + // console.log("Until string: ", until); + } + + // Deno / CLI mode + if (typeof Deno !== "undefined") { + let keystroke = rawPrompt(); + + if (until && typeof until === "string") { + const idx = keystroke.indexOf(until); + if (idx !== -1) { + keystroke = keystroke.substring(0, idx); + } + } + + if (keystroke.includes(target) && keystroke.length <= (length || keystroke.length) && !keystroke.includes(until)) { + writeRegister(1n, ret1.indexComp, ret1.indexElem); + } else { + writeRegister(0n, ret1.indexComp, ret1.indexElem); + } + + status.run_program = 0; + return packExecute( + false, + "The result has been written to the register", + "info", + null, + ); + } + + // Web/UI mode + document.app.$data.enter = false; // wait for input + + if (status.run_program === 3) { + setTimeout(keyboard_read_find, 1000, fn_post_read, fn_post_params, fn_post_length,fn_post_until); + return draw; + } + + let keystroke = document.app.$data.keyboard; + + if (!keystroke || keystroke.length === 0) { + status.run_program = 3; + return keyboard_read_find(fn_post_read, fn_post_params, fn_post_length,fn_post_until); + } + + // Find logic + // console.log("keystroke:", `"${keystroke}"`, keystroke.length); + // console.log("until:", `"${until}"`, until.length); + if (keystroke.includes(target) && keystroke.length <= (length || keystroke.length) && !keystroke.includes(until)) { + writeRegister(1n, ret1.indexComp, ret1.indexElem); + } else { + writeRegister(0n, ret1.indexComp, ret1.indexElem); + } + + document.app.$data.keyboard = ""; + document.app.$data.enter = null; + + draw.info.push("The result has been written to the register"); + + if (status.execution_index >= instructions.length) { + for (let i = 0; i < instructions.length; i++) { + draw.space.push(i); + } + status.execution_index = -2; + return packExecute( + true, + "The execution of the program has finished", + "success", + null, + ); + } + // If program was running before waiting for input, continue execution automatically + if (status.run_program === 1) { + const playButton = document.getElementById("playExecution"); + if (playButton) { + playButton.click(); + } + } + + // Re-enable buttons + if (typeof document !== "undefined" && document.app) { + coreEvents.emit(CoreEventTypes.EXECUTOR_BUTTONS_UPDATE, { + instruction_disable: false, + run_disable: false, + }); + } + + return draw; +} diff --git a/src/core/executor/devices.mts b/src/core/executor/devices.mts index b672659d4..ec0d285d0 100644 --- a/src/core/executor/devices.mts +++ b/src/core/executor/devices.mts @@ -94,10 +94,10 @@ export abstract class Device { * @throws Error if value is too big. * */ - protected writeValue(address: number, value: number, words: number = 1) { + protected writeValue(value: number, address: number, words: number = 1) { // transform value in bytes const bytes = this.memory.splitToBytes(BigInt(value)); - bytes.unshift(...new Array(4 * words).fill(0)); // fill the w/ 0 until we reach the word number of bytes + bytes.unshift(...new Array(4 * words - bytes.length).fill(0)); // fill the w/ 0 until we reach the word number of bytes for (let i = 0; i < words; i++) { this.memory.writeWord(BigInt(address), bytes); @@ -203,11 +203,6 @@ class ConsoleDevice extends Device { "execute.syscall.read_" + type, ); // google analytics - // scroll into keyboard input - if (document !== undefined) { - document.getElementById("enter_keyboard")!.scrollIntoView(); - } - // stop program to wait for read status.run_program = 3; @@ -387,35 +382,36 @@ class OSDriver extends Device { } } -// TODO: device handler class? +// TODO: device handler class // TODO: Enable/Disable devices +// TODO: configure devices from arch definition // { : Device, ...} export const devices = new Map([ - // [ - // "console", - // new ConsoleDevice({ - // ctrl_addr: 0xf0000000, - // status_addr: 0xf0000004, - // data: { - // start: 0xf0000008, - // end: 0xf000000f, - // }, - // enabled: true, - // }), - // ], - // [ - // "os", - // new OSDriver({ - // ctrl_addr: 0xf0000010, - // status_addr: 0xf0000014, - // data: { - // start: 0xf0000018, - // end: 0xf000001f, - // }, - // enabled: true, - // }), - // ], + [ + "console", + new ConsoleDevice({ + ctrl_addr: 0xf0000000, + status_addr: 0xf0000004, + data: { + start: 0xf0000008, + end: 0xf000000f, + }, + enabled: true, + }), + ], + [ + "os", + new OSDriver({ + ctrl_addr: 0xf0000010, + status_addr: 0xf0000014, + data: { + start: 0xf0000018, + end: 0xf000001f, + }, + enabled: true, + }), + ], ]); /* Memory */ diff --git a/src/core/executor/executor.mjs b/src/core/executor/executor.mjs index 63fd8b3e7..987fbabeb 100644 --- a/src/core/executor/executor.mjs +++ b/src/core/executor/executor.mjs @@ -48,6 +48,7 @@ import { handleTimer } from "./timers.mts"; import { compileInstruction } from "./instructionCompiler.mts"; import { coreEvents } from "../events.mts"; import { clearAllRegisterGlows } from "../register/registerGlowState.mjs"; +import { architecture } from "../core.mjs"; const instructionCache = new Map(); const compiledFunctions = new Map(); @@ -94,7 +95,7 @@ function performExecutionChecks() { function get_entrypoint() { // search main tag const entrypoint = instructions.find( - i => i.Label === newArchitecture.config.main_function, + i => i.Label.includes(newArchitecture.config.main_function), )?.Address; return entrypoint @@ -520,7 +521,10 @@ export function writeStackLimit(stackLimit) { // Update the stack segment in the memory layout if it exists if (stackSegment) { // Update the memory segment's start address to reflect the new stack pointer - stackSegment.start = Number(stackLimitBigInt); + if (architecture.config.name.includes("SRV64")) + stackSegment.start = stackLimitBigInt; + else + stackSegment.start = Number(stackLimitBigInt); // And update the size of the stack segment stackSegment.size = stackSegment.end - stackSegment.start; } diff --git a/src/core/executor/sailSimRV/sailExecutor.mjs b/src/core/executor/sailSimRV/sailExecutor.mjs new file mode 100644 index 000000000..ed6208cc5 --- /dev/null +++ b/src/core/executor/sailSimRV/sailExecutor.mjs @@ -0,0 +1,71 @@ +import { architecture } from "../../core.mjs"; +import sail32sim from "./wasm/riscv_sim_RV32.js" +import sail64sim from "./wasm/riscv_sim_RV64.js" +import sail32vdsim from "./wasm/riscv_sim_RV32vd.js" +import { vectoren, doubleen } from "../../assembler/sailAssembler/web/CNAssambler.mjs"; +export var sailexec; +export async function SailExecute(binary, flags){ + let depsLeft = Infinity; + if (architecture.config.name === "SRV32") { + if (vectoren && doubleen) { + sailexec = await sail32vdsim({ + noInitialRun: true, + // print: (t) => console.log('[sim32]', t), + // printErr: (t) => console.warn('[sim32:err]', t), + // onAbort: (t) => console.error("[sim32:abort]", t), + monitorRunDependencies(left) { + depsLeft = left; + console.log("[sim32] deps pending:", left); + }, + }); + } else { + sailexec = await sail32sim({ + noInitialRun: true, + // print: (t) => console.log('[sim32]', t), + // printErr: (t) => console.warn('[sim32:err]', t), + // onAbort: (t) => console.error("[sim32:abort]", t), + monitorRunDependencies(left) { + depsLeft = left; + console.log("[sim32] deps pending:", left); + }, + }); + } + + await new Promise((resolve) => { + const check = () => { + if (depsLeft === 0) resolve(); + else setTimeout(check, 10); + }; + check(); + }); + } else { + sailexec = await sail64sim({ + noInitialRun: true, + // print: (t) => console.log('[sim32]', t), + // printErr: (t) => console.warn('[sim32:err]', t), + // onAbort: (t) => console.error("[sim32:abort]", t), + monitorRunDependencies(left) { + depsLeft = left; + console.log("[sim64] deps pending:", left); + }, + }); + await new Promise((resolve) => { + const check = () => { + if (depsLeft === 0) resolve(); + else setTimeout(check, 10); + }; + check(); + }); + architecture.memory_layout.stack.start = 140737488355324n ; + architecture.memory_layout.stack.end = 140737488355327n; + } + + + // Once it is initialized, lets run the program + + // document.app.$data.execution_mode_run = 0; + console.log(flags); + + sailexec.run([binary, ...flags]); + +} \ No newline at end of file diff --git a/src/core/executor/sailSimRV/wasm/riscv_sim_RV32.js b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32.js new file mode 100644 index 000000000..47887970b --- /dev/null +++ b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32.js @@ -0,0 +1,7884 @@ +import { setInstructions, clear_instructions, instructions, tag_instructions } from "@/core/assembler/assembler.mjs"; +import { readRegister, writeRegister, notifyRegisterUpdate } from "@/core/register/registerOperations.mjs"; +import { crex_findReg_bytag, crex_findReg } from "@/core/register/registerLookup.mjs" +import { status, set_execution_mode, PC_REG_INDEX, REGISTERS, getPC, main_memory, config_cache, L1_cache_memory, L1_I_cache_memory, L1_D_cache_memory, L2_D_cache_memory, L2_I_cache_memory, L2_cache_memory, updateCacheMem } from "@/core/core.mjs"; +import { display_print } from "../../IO.mjs"; +import { SYSCALL } from "@/core/capi/syscall.mts"; +import { coreEvents } from "@/core/events.mts"; +import { show_notification } from "@/core/utils/notifications.mts"; +import { architecture } from "../../../core.mjs"; +import { clearAllRegisterGlows } from "@/core/register/registerGlowState.mjs"; + +export var userMode32 = false; + +var Module = (() => { + var _scriptDir = import.meta.url; + var insn_number; + + return function (Module) { + document.app.$data.is_breakpoint = instructions[0].Break; + var pc_sail = crex_findReg_bytag("program_counter"); + var pc_min = architecture.memory_layout.text.start; + var pc_max = architecture.memory_layout.text.end; + var hiden_executed, hiden_next_execute; + + var registers_before_function = [ + { name: "t0", can_operate : false}, + { name: "t1", can_operate : false}, + { name: "t2", can_operate : false}, + { name: "t3", can_operate : false}, + { name: "t4", can_operate : false}, + { name: "t5", can_operate : false}, + { name: "t6", can_operate : false}, + { name: "s0", can_operate : false}, + { name: "s1", can_operate : false}, + { name: "s2", can_operate : false}, + { name: "s3", can_operate : false}, + { name: "s4", can_operate : false}, + { name: "s5", can_operate : false}, + { name: "s6", can_operate : false}, + { name: "s7", can_operate : false}, + { name: "s8", can_operate : false}, + { name: "s9", can_operate : false}, + { name: "s10", can_operate : false}, + { name: "s11", can_operate : false} + ] + var callstack_convention = []; + var inside_function = false; + Module = Module || {}; + + var Module = typeof Module != "undefined" ? Module : {}; + var readyPromiseResolve, readyPromiseReject; + Module["ready"] = new Promise(function (resolve, reject) { + readyPromiseResolve = resolve; + readyPromiseReject = reject; + }); + if ( + !Object.getOwnPropertyDescriptor(Module["ready"], "_reanudar_ejecucion") + ) { + Object.defineProperty(Module["ready"], "_reanudar_ejecucion", { + configurable: true, + get: function () { + abort( + "You are getting _reanudar_ejecucion on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "_reanudar_ejecucion", { + configurable: true, + set: function () { + abort( + "You are setting _reanudar_ejecucion on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module["ready"], "_main")) { + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + get: function () { + abort( + "You are getting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + set: function () { + abort( + "You are setting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module["ready"], "_send_int_to_C")) { + Object.defineProperty(Module["ready"], "_send_int_to_C", { + configurable: true, + get: function () { + abort( + "You are getting _send_int_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "_send_int_to_C", { + configurable: true, + set: function () { + abort( + "You are setting _send_int_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module["ready"], "_send_float_to_C")) { + Object.defineProperty(Module["ready"], "_send_float_to_C", { + configurable: true, + get: function () { + abort( + "You are getting _send_float_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "_send_float_to_C", { + configurable: true, + set: function () { + abort( + "You are setting _send_float_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if ( + !Object.getOwnPropertyDescriptor(Module["ready"], "_send_double_to_C") + ) { + Object.defineProperty(Module["ready"], "_send_double_to_C", { + configurable: true, + get: function () { + abort( + "You are getting _send_double_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "_send_double_to_C", { + configurable: true, + set: function () { + abort( + "You are setting _send_double_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module["ready"], "_send_char_to_C")) { + Object.defineProperty(Module["ready"], "_send_char_to_C", { + configurable: true, + get: function () { + abort( + "You are getting _send_char_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "_send_char_to_C", { + configurable: true, + set: function () { + abort( + "You are setting _send_char_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if ( + !Object.getOwnPropertyDescriptor(Module["ready"], "_send_string_to_C") + ) { + Object.defineProperty(Module["ready"], "_send_string_to_C", { + configurable: true, + get: function () { + abort( + "You are getting _send_string_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "_send_string_to_C", { + configurable: true, + set: function () { + abort( + "You are setting _send_string_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module["ready"], "___stdio_exit")) { + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + get: function () { + abort( + "You are getting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + set: function () { + abort( + "You are setting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if ( + !Object.getOwnPropertyDescriptor(Module["ready"], "onRuntimeInitialized") + ) { + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + get: function () { + abort( + "You are getting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + set: function () { + abort( + "You are setting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + var moduleOverrides = Object.assign({}, Module); + var arguments_ = []; + var thisProgram = "./this.program"; + var quit_ = (status, toThrow) => { + throw toThrow; + }; + var ENVIRONMENT_IS_WEB = true; + var ENVIRONMENT_IS_WORKER = false; + var ENVIRONMENT_IS_NODE = false; + var ENVIRONMENT_IS_SHELL = false; + if (Module["ENVIRONMENT"]) { + throw new Error( + "Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)", + ); + } + var scriptDirectory = ""; + function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; + } + var read_, readAsync, readBinary, setWindowTitle; + function logExceptionOnExit(e) { + if (e instanceof ExitStatus) return; + let toLog = e; + if (e && typeof e == "object" && e.stack) { + toLog = [e, e.stack]; + } + err("exiting due to exception: " + toLog); + } + if (ENVIRONMENT_IS_SHELL) { + if ( + (typeof process == "object" && typeof require === "function") || + typeof window == "object" || + typeof importScripts == "function" + ) + throw new Error( + "not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)", + ); + if (typeof read != "undefined") { + read_ = function shell_read(f) { + return read(f); + }; + } + readBinary = function readBinary(f) { + let data; + if (typeof readbuffer == "function") { + return new Uint8Array(readbuffer(f)); + } + data = read(f, "binary"); + assert(typeof data == "object"); + return data; + }; + readAsync = function readAsync(f, onload, onerror) { + setTimeout(() => onload(readBinary(f)), 0); + }; + if (typeof scriptArgs != "undefined") { + arguments_ = scriptArgs; + } else if (typeof arguments != "undefined") { + arguments_ = arguments; + } + if (typeof quit == "function") { + quit_ = (status, toThrow) => { + logExceptionOnExit(toThrow); + quit(status); + }; + } + if (typeof print != "undefined") { + if (typeof console == "undefined") console = {}; + console.log = print; + console.warn = console.error = + typeof printErr != "undefined" ? printErr : print; + } + } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + if (_scriptDir) { + scriptDirectory = _scriptDir; + } + if (scriptDirectory.indexOf("blob:") !== 0) { + scriptDirectory = scriptDirectory.substr( + 0, + scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1, + ); + } else { + scriptDirectory = ""; + } + if (!(typeof window == "object" || typeof importScripts == "function")) + throw new Error( + "not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)", + ); + { + read_ = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.send(null); + return xhr.responseText; + }; + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(xhr.response); + }; + } + readAsync = (url, onload, onerror) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = () => { + if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { + onload(xhr.response); + return; + } + onerror(); + }; + xhr.onerror = onerror; + xhr.send(null); + }; + } + setWindowTitle = (title) => (document.title = title); + } else { + throw new Error("environment detection error"); + } + + + // const instructionExp = /\[(\d+)\] \[(\w+)\]: 0x([0-9A-Fa-f]+) \(0x([0-9A-Fa-f]+)\) (\w+) ([^,]+), ([^,]+)(?:, (.+))?/; + var instructionExp = /\[(\d+)\] \[(\w+)\]: 0x([0-9A-Fa-f]+) \(0x([0-9A-Fa-f]+)\) ([\w.]+)(?: ([^,]+), ([^,]+)(?:, (.+))?)?/; + var registerExp = /([xf]\d+) (<-) 0x([0-9A-Fa-f]+)/; // /(x\d+) (<-|->) 0x([0-9A-Fa-f]+)/; + var vectorExp = /(v\d+) (<-) 0x([0-9A-Fa-f]+)/; + var memoryExp = /mem\[0x([0-9A-Fa-f]+)\]\s*(<-|->)\s*0x([0-9A-Fa-f]+)/; + var CSRTypeExp = /(CSR\S*)\s+(\S+)\s+(\S+)\s+(0x)([\dA-Fa-f]{1,8})/; + var CSRExp = /^(CSR)\s+(\w+)\s+(<-|->)\s+0x([0-9a-fA-F]+)(?:\s+(.*))?$/; + var jumpExp = /Next_PC:\s*(0x[0-9a-fA-F]+)/; + var cacheExp = /^\[(\d+)\]\s+(L1_I|L1_D|L1|L2|L2_I|L2_D):\s*\((0x[0-9A-Fa-f]+)\)\s$/; + var configCacheExp = /^Configuration:\s*([A-Za-z_][A-Za-z0-9_]*)\s*<-\s*(\S+)\s*$/; + + // var displayExp = /^[A-Za-z\s]+:\s*(.*)$/; + // var displayExp = /^([\w\s]+):\s*(.*)$/; + var displayExp = /^ECALL\s+(SIGNED|UNSIGNED|STRING|CHAR|FLOAT|DOUBLE):\s*(.+)$/; + var instoper = ""; + var syscall_print_code = -1; + var prev_add_to_jump; + + function updateCacheStat(index, access, data="") { + switch(access) { + case "Cache L1 hit inst": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 1; + break; + case "Cache L1 miss inst": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + break; + case "Cache L1 miss": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + break; + case "Cache L1 hit data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 1; + break; + case "Cache L1 miss data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 1; + break; + case "Cache L1_I hit": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 1; + break; + case "Cache L1_I miss": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + break; + case "Cache L1_D hit": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 1; + break; + case "Cache L1_D miss": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 1; + break; + case "Cache L2 hit inst": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 1; + break; + case "Cache L2 miss inst": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 1; + break; + case "Cache L2_I hit": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 1; + break; + case "Cache L2_I miss": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 1; + break; + case "Cache L2 hit data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 1; + break; + case "Cache L2 miss data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 1; + break; + case "Cache L2_D hit": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 1; + break; + case "Cache L2_D miss": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 1; + break; + } + + } + + async function check_call_convention_temp_regs(instMatch) { + if(((instMatch[7] != undefined && (instMatch[7].includes("t") || (instMatch[7].includes("s") && !instMatch[7].includes("sp")) ) ) || (instMatch[8] != undefined && (instMatch[8].includes("t") || (instMatch[8].includes("s") && !instMatch[8].includes("sp")) ))) && instMatch[6] !== undefined && inside_function) { + if((instMatch[5] != "li" && instMatch[5] != "lui" && instMatch[5] != "la") ){ + for (var i = 0; i < callstack_convention[callstack_convention.length - 1].length; i++ ){ + (callstack_convention[callstack_convention.length - 1][i].name === instMatch[7] || callstack_convention[callstack_convention.length - 1][i].name === instMatch[8]) && + (callstack_convention[callstack_convention.length - 1][i].can_operate === false) ? show_notification("Possible failure in the parameter passing convention", "warning") : 0 ; + } + + // callstack_convention[callstack_convention.length - 1].name + + } + } + if (instMatch[6] !== undefined && (instMatch[6].includes("t") || (instMatch[6].includes("s") && !instMatch[6].includes("sp"))) && inside_function) { + for (var i = 0; i < callstack_convention[callstack_convention.length - 1].length; i++ ){ + callstack_convention[callstack_convention.length - 1][i].can_operate = (callstack_convention[callstack_convention.length - 1][i].name === instMatch[6]) ? true : callstack_convention[callstack_convention.length - 1][i].can_operate; + } + } + } + + // var to_measure = ""; + var start_m, start_m; + var cache_inst; + + function writeMemory(value, addr) { + // Primero pasar el valor al formato hexadecimal por pares + if (value.startsWith("0x")) + value = value.slice(2); + if (value.length % 2 !== 0) + value = "0" + value; + + // const bytes = new Uint8Array(value.length / 2); + for (let i = 0; i < value.length / 2; i ++) { + main_memory.write((addr + BigInt(i)), Number("0x" + value.substring(i*2, i * 2 + 2))); + } + + // if (memoMatch[2] === '<-'){ + // switch(op){ + // case 'sh': // Para almacenar un half + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + // break; + // case 'sb': // Para almacenar un byte + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'sw': // Para almacenar un int/word + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'fsw': // Para almacenar un float + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'float'); + // break; + // case 'fsd': // Para almacenar un double + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // case 'vse8.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'vse16.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + // break; + // case 'vse32.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'vse64.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // default: + // break; + // } + // } + } + + Module['print'] = function (message) { + if(message === "err call_convenction"){ + show_notification("Possible failure in the parameter passing convention", "warning"); + } + + var next_add_to_jump; + let instMatch = message.match(instructionExp); + let regiMatch = message.match(registerExp); + let memoMatch = message.match(memoryExp); + let printMatch = message.match(displayExp); + let CSRMatch = message.match(CSRTypeExp); + let CSREMatch = message.match(CSRExp); + let vectorMatch = message.match(vectorExp); + let jumpMatch = message.match(jumpExp); + let cacheMatch = message.match(cacheExp); + let configCacheMatch = message.match(configCacheExp); + + if (message.startsWith("Cache") || message.startsWith("Next_PC:")){ + if (message.includes("Cache prefetch")) { + let newpc = message.substring(15,message.length).toLowerCase(); + cache_inst = instructions.findIndex(insn => insn.Address === newpc); + } else if (message.includes("Next_PC:")) { + let newpc = message.substring(9, message.length).toLowerCase(); + cache_inst = instructions.findIndex(insn => insn.Address == newpc); + } + if (cache_inst != -1 && document.app.$data.execution_mode_run === 1) { + let hexmatch = message.match(/0x[0-9A-Fa-f]+$/); + if (hexmatch && !message.startsWith("Cache prefetch")) { + let hexa = hexmatch[0]; + message = message.replace(/on:\s*0x[0-9A-Fa-f]+$/, "").trim(); + updateCacheStat(cache_inst, message, hexa); + }else { + updateCacheStat(cache_inst, message); + } + + } + } + + if (message === "May your execution has an infinity loop."){ + document.app.$data.execution_mode_run = 1; + show_notification(message, "danger"); + instructions[hiden_executed]._rowVariant = "info"; + instructions[hiden_next_execute]._rowVariant = "success"; + } + + if (jumpMatch){ + const current_ins = instructions.findIndex(insn => insn.Address === (jumpMatch[1].toLowerCase())); + + for (var i = 0; i < instructions.length; i++){ + if(instructions[i]._rowVariant === "success" && document.app.$data.execution_mode_run !== 0) // ajustar lo del user mode + instructions[i]._rowVariant = ""; + } + if (current_ins !== -1) instructions[current_ins]._rowVariant = "success"; + } + + if (configCacheMatch) { + // console.log(configCacheMatch); + switch(configCacheMatch[1]) { + case "L1_I_SIZE": + config_cache.push({configuration: "Size L1_I", value: configCacheMatch[2] + " lines"}); + break; + case "L1_D_SIZE": + config_cache.push({configuration: "Size L1_D", value: configCacheMatch[2] + " lines"}); + break; + case "L1_SIZE": + config_cache.push({configuration: "Size L1", value: configCacheMatch[2] + " lines"}); + break; + case "L2_I_SIZE": + config_cache.push({configuration: "Size L2_I", value: configCacheMatch[2] + " lines"}); + break; + case "L2_D_SIZE": + config_cache.push({configuration: "Size L2_D", value: configCacheMatch[2] + " lines"}); + break; + case "L2_SIZE": + config_cache.push({configuration: "Size L2", value: configCacheMatch[2] + " lines"}); + break; + case "Rep_policy": + config_cache.push({configuration: "Replacement policy", value: configCacheMatch[2]}); + break; + case "L1_I_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1_I block", value: configCacheMatch[2] + " bits"}); + break; + case "L1_D_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1_D block", value: configCacheMatch[2] + " bits"}); + break; + case "L1_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1 block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_I_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2_I block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_D_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2_D block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2 block", value: configCacheMatch[2] + " bits"}); + break; + } + } + + if (cacheMatch) { + // console.log(cacheMatch); + switch(cacheMatch[2]) { + case "L1_I": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_I_size_block); + break; + case "L1_D": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_D_size_block); + + break; + case "L1": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_size_block); + + break; + case "L2_I": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_I_size_block); + + break; + case "L2_D": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_D_size_block); + + break; + case "L2": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_size_block); + + break; + + } + } + + if(CSREMatch){ + console.log(CSREMatch); + if (CSREMatch[2] !== "vtype" && CSREMatch[2] !== "vl"){ + let regtowrite = crex_findReg(CSREMatch[2]); + if(regtowrite.match !== 0) + writeRegister(CSREMatch[4], regtowrite.indexComp, regtowrite.indexElem); + } + } + if (CSRMatch){ + if (CSRMatch[2] === "vtype"){ + var size_elem = parseInt(CSRMatch[5], 16).toString(2).padStart(32, '0'); + size_elem = size_elem.slice(26, 29); + // console.log("Tamaño: ", size_elem); + if(size_elem === "000"){ + document.app.$data.v_length = 8; + // architecture.components[3].total_elements = 64; + } else if (size_elem === "001") { + document.app.$data.v_length = 16; + // architecture.components[3].total_elements = 32; + } else if (size_elem === "010"){ + document.app.$data.v_length = 32; + // architecture.components[3].total_elements = 16; + }else { + document.app.$data.v_length = 64; + // architecture.components[3].total_elements = 8; + } + // architecture.components[3].length_elem = length_vext; + } + else if (CSRMatch[2] === "vl"){ + // architecture.components[3].elems_op = parseInt(CSRMatch[5], 16); + } + } + if (vectorMatch){ + let regtowrite = crex_findReg(vectorMatch[1]); + writeRegister(vectorMatch[3], regtowrite.indexComp, regtowrite.indexElem); + } + + if (instMatch && (parseInt(instMatch[3], 16) >= pc_min && parseInt(instMatch[3], 16) <= pc_max )){ + userMode32 = true; + + clearAllRegisterGlows(); + coreEvents.emit("step-about-to-execute"); + if (inside_function) + check_call_convention_temp_regs(instMatch); + + //Actualizamos el pc + writeRegister(BigInt(parseInt(instMatch[3], 16)), pc_sail.indexComp, pc_sail.indexElem); + for (var i = 0; i < instructions.length; i++) { + if (instructions[i]._rowVariant === "info") + instructions[i]._rowVariant = ""; + } + instoper = ""; + // console.log("PC actual:",pc_sail); + + + console.log("Instruccion: ", instMatch); + const current_ins = instructions.findIndex(insn => insn.Address === ("0x"+instMatch[3].toLowerCase())); + if(prev_add_to_jump !== undefined){ + instructions[prev_add_to_jump]._rowVariant = ""; + prev_add_to_jump = undefined; + } + + if (instructions[current_ins].loaded.includes("jalr")){ + var next_add = instructions[current_ins].loaded.split("\t"); + const match = next_add[1].match(/(-?\d+)\((\w+)\)/); + var aux_reg = crex_findReg(match[2]); + var aux_val = readRegister(aux_reg.indexComp, aux_reg.indexElem); + + next_add_to_jump = (aux_val + BigInt(parseInt(match[1], 10))).toString(16); + next_add_to_jump = instructions.findIndex(insn => insn.Address === ("0x"+next_add_to_jump.toLowerCase())); + prev_add_to_jump = current_ins; + + // var stack_entry_func = instructions[next_add_to_jump].label; + // creator_callstack_enter(instructions[next_add_to_jump].Label); + // track_stack_enter(instructions[next_add_to_jump].Label); + // callstack_convention.push(structuredClone(registers_before_function)); + // inside_function = true; + } + if (instructions[current_ins].loaded.includes("jal") && !instructions[current_ins].loaded.includes("jalr")){ + var next_add = instructions[current_ins].loaded.split("\t"); + + } + if (instructions[current_ins].loaded.includes("ret") && !instructions[current_ins].loaded.includes("mret")){ + // Mirar el ra + var aux_reg = crex_findReg("ra"); + next_add_to_jump = readRegister(aux_reg.indexComp, aux_reg.indexElem).toString(16); + next_add_to_jump = instructions.findIndex(insn => insn.Address === ("0x"+next_add_to_jump.toLowerCase())); + if (next_add_to_jump !== -1){ + prev_add_to_jump = current_ins; + // track_stack_leave(); + // creator_callstack_leave(); + // callstack_convention.pop(); + // inside_function = (callstack_convention.length > 0); + }else + next_add_to_jump = undefined; + } + + + // Primero caso de paso a paso + if (document.app.$data.execution_mode_run === 1){ + instructions[current_ins]._rowVariant = 'info'; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined){ + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + document.app.$data.is_breakpoint = instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)].Break; + } + if (current_ins > 0 || prev_add_to_jump !== undefined) + instructions[(prev_add_to_jump !== undefined && prev_add_to_jump !== current_ins) ? prev_add_to_jump : ((current_ins > 0) ? current_ins -1 : 0)]._rowVariant = ''; + } + // Para el caso de run without stop y la siguiente instruccion es un breakpoint + else if (document.app.$data.execution_mode_run === 0){ + // se almacena el estado de la instruccion en caso de que haya una parada por infinity loop + hiden_executed = current_ins; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + hiden_next_execute = (next_add_to_jump !== undefined) ? next_add_to_jump : current_ins + 1; + } else + hiden_next_execute = current_ins + 1; + + + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + document.app.$data.is_breakpoint = instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)].Break; + } + if(document.app.$data.is_breakpoint){ + instructions[current_ins]._rowVariant = 'info'; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + } + coreEvents.emit("pause-execution"); + }else { + instructions[current_ins]._rowVariant = ''; + } + if (current_ins > 0 || prev_add_to_jump !== undefined) + instructions[(prev_add_to_jump !== undefined && prev_add_to_jump !== current_ins) ? prev_add_to_jump : ((current_ins > 0) ? current_ins -1 : 0)]._rowVariant = ''; + + } + else + instructions[current_ins]._rowVariant = ''; + + if (instMatch[5] === "ecall"){ + let argument_register = crex_findReg("a7"); // obtenemos el registro para ver que llamada al sistema es + let syscall_code = readRegister(argument_register.indexComp, argument_register.indexElem); // Lectura del registro para obtener el valor + + switch(syscall_code){ + case 5n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para enteros + // capi_read_int('a0'); + SYSCALL.read('a0', "int"); + break; + case 6n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para floats + // capi_read_float('fa0'); + SYSCALL.read("fa0", "float"); + break; + case 7n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // Manejo para double + // capi_read_double('fa0'); + SYSCALL.read("fa0", "double"); + break; + case 8n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // Manejo para strings + // capi_read_string('a0','a1'); + SYSCALL.read("a0", "string", "a1"); + break; + + case 12n: + if(document.app.$data.execution_mode_run === 0){ + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para char + // capi_read_char('a0'); + SYSCALL.read("a0", "char"); + break; + default: + // console.log("No hago nada."); + syscall_print_code = syscall_code; + break; + } + + next_add_to_jump = undefined; + } + + + + instoper = instMatch[5]; + coreEvents.emit("sail-instruction-update"); + setInstructions(instructions); + // window.updateUI({ error: false, msg: "" }); + + + + + + + } else if (instMatch && (parseInt(instMatch[3], 16) <= pc_min || parseInt(instMatch[3], 16) >= pc_max )) + userMode32 = false; + + if (regiMatch /*&& userMode === true*/) { + // En caso de ser escritura '<-' pintamos el valor en el registro que corresponde + if (regiMatch[2] === '<-'){ + let regtowrite = crex_findReg(regiMatch[1]); + // console.log("Registro identificado: ", regtowrite); + // if (regiMatch[1] !== 'x2') + if (regtowrite.indexComp === 2){ + if (regiMatch[3].startsWith("0x")) regiMatch[3] = regiMatch[3].slice(2).replace(/^0+/, ''); + else regiMatch[3] = regiMatch[3].replace(/^0+/, ''); + if (regiMatch[3].length <= 8){ + regiMatch[3] = regiMatch[3].padStart(8, "0"); + writeRegister(BigInt("0x" + regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem); + } + else{ + writeRegister(BigInt("0x" + regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem); + } + + } + else + writeRegister(BigInt(parseInt(regiMatch[3], 16)), regtowrite.indexComp, regtowrite.indexElem); + } + + } + + if (memoMatch /*&& userMode === true*/) { + if (memoMatch[2] === '<-'){ + // switch(instoper){ + // case 'sh': // Para almacenar un half + writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'sb': // Para almacenar un byte + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'sw': // Para almacenar un int/word + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'fsw': // Para almacenar un float + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'fsd': // Para almacenar un double + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse8.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse16.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse32.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse64.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // default: + // break; + // } + + // instoper = ""; + } + + } + + if(printMatch && syscall_print_code !== -1){ + + let value_2_print = printMatch[2].trim(); + // console.log("Estoy dentro de ecall a imprimir"); + // console.log(message); + // console.log("Valor a imprimir: ", value_2_print); + switch(syscall_print_code){ + + case 1n: // Print int + // SYSCALL.print(Number(parseInt(value_2_print)), "int32"); + + display_print(value_2_print); + // display_print(full_print(parseInt(value_2_print), null, false)); + syscall_print_code = -1; + break; + case 2n: // Print float + // SYSCALL.print(Number(parseFloat(value_2_print)), "float"); + display_print(value_2_print); + // display_print(full_print(parseFloat(value_2_print), 0, true)); + syscall_print_code = -1; + break; + + case 3n: // Print double + // SYSCALL.print(Number(parseFloat(value_2_print)), "double"); + display_print(value_2_print); + // display_print(full_print(parseFloat(value_2_print), 0, true)); + syscall_print_code = -1; + break; + + case 4n: // Print String + display_print(value_2_print); + syscall_print_code = -1; + break; + + case 11n: // Print char + // SYSCALL.print(BigInt(value_2_print.charCodeAt(0)), char); + display_print(value_2_print); + syscall_print_code = -1; + break; + + default: // Rest of syscall codes not able to print + syscall_print_code = -1; + break; + + } + + } + + console.log(message); + // clear_instructions(); + + setInstructions(instructions); + } + + Module['printErr'] = function (message) { + // if (message.includes("Execution:") || message.includes("Instructions:") || message.includes("Perf:")) + // show_notification(message, "success"); + // else + console.warn(message); + } + + var out = Module["print"] /*|| console.log.bind(console)*/; + // var out = console.log.bind(console); + var err = Module["printErr"] /*|| console.warn.bind(console)*/; + + Object.assign(Module, moduleOverrides); + moduleOverrides = null; + if (Module["arguments"]) arguments_ = Module["arguments"]; + if (!Object.getOwnPropertyDescriptor(Module, "arguments")) { + Object.defineProperty(Module, "arguments", { + configurable: true, + get: function () { + abort( + "Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + if (!Object.getOwnPropertyDescriptor(Module, "thisProgram")) { + Object.defineProperty(Module, "thisProgram", { + configurable: true, + get: function () { + abort( + "Module.thisProgram has been replaced with plain thisProgram (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + if (Module["quit"]) quit_ = Module["quit"]; + if (!Object.getOwnPropertyDescriptor(Module, "quit")) { + Object.defineProperty(Module, "quit", { + configurable: true, + get: function () { + abort( + "Module.quit has been replaced with plain quit_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + assert( + typeof Module["memoryInitializerPrefixURL"] == "undefined", + "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["pthreadMainPrefixURL"] == "undefined", + "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["cdInitializerPrefixURL"] == "undefined", + "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["filePackagePrefixURL"] == "undefined", + "Module.filePackagePrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["read"] == "undefined", + "Module.read option was removed (modify read_ in JS)", + ); + assert( + typeof Module["readAsync"] == "undefined", + "Module.readAsync option was removed (modify readAsync in JS)", + ); + assert( + typeof Module["readBinary"] == "undefined", + "Module.readBinary option was removed (modify readBinary in JS)", + ); + assert( + typeof Module["setWindowTitle"] == "undefined", + "Module.setWindowTitle option was removed (modify setWindowTitle in JS)", + ); + assert( + typeof Module["TOTAL_MEMORY"] == "undefined", + "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY", + ); + if (!Object.getOwnPropertyDescriptor(Module, "read")) { + Object.defineProperty(Module, "read", { + configurable: true, + get: function () { + abort( + "Module.read has been replaced with plain read_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module, "readAsync")) { + Object.defineProperty(Module, "readAsync", { + configurable: true, + get: function () { + abort( + "Module.readAsync has been replaced with plain readAsync (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module, "readBinary")) { + Object.defineProperty(Module, "readBinary", { + configurable: true, + get: function () { + abort( + "Module.readBinary has been replaced with plain readBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module, "setWindowTitle")) { + Object.defineProperty(Module, "setWindowTitle", { + configurable: true, + get: function () { + abort( + "Module.setWindowTitle has been replaced with plain setWindowTitle (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + assert( + !ENVIRONMENT_IS_WORKER, + "worker environment detected but not enabled at build time. Add 'worker' to `-s ENVIRONMENT` to enable.", + ); + assert( + !ENVIRONMENT_IS_NODE, + "node environment detected but not enabled at build time. Add 'node' to `-s ENVIRONMENT` to enable.", + ); + assert( + !ENVIRONMENT_IS_SHELL, + "shell environment detected but not enabled at build time. Add 'shell' to `-s ENVIRONMENT` to enable.", + ); + var POINTER_SIZE = 4; + function warnOnce(text) { + if (!warnOnce.shown) warnOnce.shown = {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + err(text); + } + } + function convertJsFunctionToWasm(func, sig) { + if (typeof WebAssembly.Function == "function") { + var typeNames = { i: "i32", j: "i64", f: "f32", d: "f64" }; + var type = { + parameters: [], + results: sig[0] == "v" ? [] : [typeNames[sig[0]]], + }; + for (var i = 1; i < sig.length; ++i) { + type.parameters.push(typeNames[sig[i]]); + } + return new WebAssembly.Function(type, func); + } + var typeSection = [1, 0, 1, 96]; + var sigRet = sig.slice(0, 1); + var sigParam = sig.slice(1); + var typeCodes = { i: 127, j: 126, f: 125, d: 124 }; + typeSection.push(sigParam.length); + for (var i = 0; i < sigParam.length; ++i) { + typeSection.push(typeCodes[sigParam[i]]); + } + if (sigRet == "v") { + typeSection.push(0); + } else { + typeSection = typeSection.concat([1, typeCodes[sigRet]]); + } + typeSection[1] = typeSection.length - 2; + var bytes = new Uint8Array( + [0, 97, 115, 109, 1, 0, 0, 0].concat( + typeSection, + [2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0], + ), + ); + var module = new WebAssembly.Module(bytes); + var instance = new WebAssembly.Instance(module, { e: { f: func } }); + var wrappedFunc = instance.exports["f"]; + return wrappedFunc; + } + var freeTableIndexes = []; + var functionsInTableMap; + function getEmptyTableSlot() { + if (freeTableIndexes.length) { + return freeTableIndexes.pop(); + } + try { + wasmTable.grow(1); + } catch (err) { + if (!(err instanceof RangeError)) { + throw err; + } + throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."; + } + return wasmTable.length - 1; + } + function updateTableMap(offset, count) { + for (var i = offset; i < offset + count; i++) { + var item = getWasmTableEntry(i); + if (item) { + functionsInTableMap.set(item, i); + } + } + } + var tempRet0 = 0; + var wasmBinary; + if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"]; + if (!Object.getOwnPropertyDescriptor(Module, "wasmBinary")) { + Object.defineProperty(Module, "wasmBinary", { + configurable: true, + get: function () { + abort( + "Module.wasmBinary has been replaced with plain wasmBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + var noExitRuntime = Module["noExitRuntime"] || true; + if (!Object.getOwnPropertyDescriptor(Module, "noExitRuntime")) { + Object.defineProperty(Module, "noExitRuntime", { + configurable: true, + get: function () { + abort( + "Module.noExitRuntime has been replaced with plain noExitRuntime (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + if (typeof WebAssembly != "object") { + abort("no native wasm support detected"); + } + var wasmMemory; + var ABORT = false; + var EXITSTATUS; + function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } + } + function getCFunc(ident) { + var func = Module["_" + ident]; + assert( + func, + "Cannot call unknown function " + ident + ", make sure it is exported", + ); + return func; + } + function ccall(ident, returnType, argTypes, args, opts) { + var toC = { + string: function (str) { + var ret = 0; + if (str !== null && str !== undefined && str !== 0) { + var len = (str.length << 2) + 1; + ret = stackAlloc(len); + stringToUTF8(str, ret, len); + } + return ret; + }, + array: function (arr) { + var ret = stackAlloc(arr.length); + writeArrayToMemory(arr, ret); + return ret; + }, + }; + function convertReturnValue(ret) { + if (returnType === "string") return UTF8ToString(ret); + if (returnType === "boolean") return Boolean(ret); + return ret; + } + var func = getCFunc(ident); + var cArgs = []; + var stack = 0; + assert(returnType !== "array", 'Return type should not be "array".'); + if (args) { + for (var i = 0; i < args.length; i++) { + var converter = toC[argTypes[i]]; + if (converter) { + if (stack === 0) stack = stackSave(); + cArgs[i] = converter(args[i]); + } else { + cArgs[i] = args[i]; + } + } + } + var ret = func.apply(null, cArgs); + function onDone(ret) { + runtimeKeepalivePop(); + if (stack !== 0) stackRestore(stack); + return convertReturnValue(ret); + } + runtimeKeepalivePush(); + var asyncMode = opts && opts.async; + if (Asyncify.currData) { + assert( + asyncMode, + "The call to " + + ident + + " is running asynchronously. If this was intended, add the async option to the ccall/cwrap call.", + ); + return Asyncify.whenDone().then(onDone); + } + ret = onDone(ret); + if (asyncMode) return Promise.resolve(ret); + return ret; + } + var ALLOC_STACK = 1; + var UTF8Decoder = + typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : undefined; + function UTF8ArrayToString(heap, idx, maxBytesToRead) { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + while (heap[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heap.subarray && UTF8Decoder) { + return UTF8Decoder.decode(heap.subarray(idx, endPtr)); + } else { + var str = ""; + while (idx < endPtr) { + var u0 = heap[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heap[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heap[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + if ((u0 & 248) != 240) + warnOnce( + "Invalid UTF-8 leading byte 0x" + + u0.toString(16) + + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!", + ); + u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heap[idx++] & 63); + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } + } + } + return str; + } + function UTF8ToString(ptr, maxBytesToRead) { + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; + } + function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) { + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = (65536 + ((u & 1023) << 10)) | (u1 & 1023); + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | (u >> 6); + heap[outIdx++] = 128 | (u & 63); + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | (u >> 12); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) + warnOnce( + "Invalid Unicode code point 0x" + + u.toString(16) + + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).", + ); + heap[outIdx++] = 240 | (u >> 18); + heap[outIdx++] = 128 | ((u >> 12) & 63); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } + } + heap[outIdx] = 0; + return outIdx - startIdx; + } + function stringToUTF8(str, outPtr, maxBytesToWrite) { + assert( + typeof maxBytesToWrite == "number", + "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!", + ); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); + } + function lengthBytesUTF8(str) { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) + u = (65536 + ((u & 1023) << 10)) | (str.charCodeAt(++i) & 1023); + if (u <= 127) ++len; + else if (u <= 2047) len += 2; + else if (u <= 65535) len += 3; + else len += 4; + } + return len; + } + var UTF16Decoder = + typeof TextDecoder != "undefined" + ? new TextDecoder("utf-16le") + : undefined; + function allocateUTF8OnStack(str) { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8Array(str, HEAP8, ret, size); + return ret; + } + function writeArrayToMemory(array, buffer) { + assert( + array.length >= 0, + "writeArrayToMemory array must have a length (should be an array or typed array)", + ); + HEAP8.set(array, buffer); + } + function writeAsciiToMemory(str, buffer, dontAddNull) { + for (var i = 0; i < str.length; ++i) { + assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255)); + HEAP8[buffer++ >> 0] = str.charCodeAt(i); + } + if (!dontAddNull) HEAP8[buffer >> 0] = 0; + } + function alignUp(x, multiple) { + if (x % multiple > 0) { + x += multiple - (x % multiple); + } + return x; + } + var buffer, + HEAP8, + HEAPU8, + HEAP16, + HEAPU16, + HEAP32, + HEAPU32, + HEAPF32, + HEAP64, + HEAPU64, + HEAPF64; + function updateGlobalBufferAndViews(buf) { + buffer = buf; + Module["HEAP8"] = HEAP8 = new Int8Array(buf); + Module["HEAP16"] = HEAP16 = new Int16Array(buf); + Module["HEAP32"] = HEAP32 = new Int32Array(buf); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf); + Module["HEAPF32"] = HEAPF32 = new Float32Array(buf); + Module["HEAPF64"] = HEAPF64 = new Float64Array(buf); + Module["HEAP64"] = HEAP64 = new BigInt64Array(buf); + Module["HEAPU64"] = HEAPU64 = new BigUint64Array(buf); + } + var TOTAL_STACK = 5242880; + if (Module["TOTAL_STACK"]) + assert( + TOTAL_STACK === Module["TOTAL_STACK"], + "the stack size can no longer be determined at runtime", + ); + var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 67108864; + if (!Object.getOwnPropertyDescriptor(Module, "INITIAL_MEMORY")) { + Object.defineProperty(Module, "INITIAL_MEMORY", { + configurable: true, + get: function () { + abort( + "Module.INITIAL_MEMORY has been replaced with plain INITIAL_MEMORY (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + assert( + INITIAL_MEMORY >= TOTAL_STACK, + "INITIAL_MEMORY should be larger than TOTAL_STACK, was " + + INITIAL_MEMORY + + "! (TOTAL_STACK=" + + TOTAL_STACK + + ")", + ); + assert( + typeof Int32Array != "undefined" && + typeof Float64Array !== "undefined" && + Int32Array.prototype.subarray != undefined && + Int32Array.prototype.set != undefined, + "JS engine does not provide full typed array support", + ); + assert( + !Module["wasmMemory"], + "Use of `wasmMemory` detected. Use -s IMPORTED_MEMORY to define wasmMemory externally", + ); + assert( + INITIAL_MEMORY == 67108864, + "Detected runtime INITIAL_MEMORY setting. Use -s IMPORTED_MEMORY to define wasmMemory dynamically", + ); + var wasmTable; + function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + HEAP32[(max + 4) >> 2] = 34821223; + HEAP32[(max + 8) >> 2] = 2310721022; + HEAP32[0] = 1668509029; + } + function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + var cookie1 = HEAPU32[(max + 4) >> 2]; + var cookie2 = HEAPU32[(max + 8) >> 2]; + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort( + "Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x" + + cookie2.toString(16) + + " 0x" + + cookie1.toString(16), + ); + } + if (HEAP32[0] !== 1668509029) + abort( + "Runtime error: The application has corrupted its heap memory area (address zero)!", + ); + } + (function () { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) + throw "Runtime error: expected the system to be little-endian! (Run with -s SUPPORT_BIG_ENDIAN=1 to bypass)"; + })(); + var __ATPRERUN__ = []; + var __ATINIT__ = []; + var __ATMAIN__ = []; + var __ATPOSTRUN__ = []; + var runtimeInitialized = false; + var runtimeExited = false; + var runtimeKeepaliveCounter = 0; + function keepRuntimeAlive() { + return noExitRuntime || runtimeKeepaliveCounter > 0; + } + function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") + Module["preRun"] = [Module["preRun"]]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); + } + function initRuntime() { + checkStackCookie(); + assert(!runtimeInitialized); + runtimeInitialized = true; + if (!Module["noFSInit"] && !FS.init.initialized) FS.init(); + FS.ignorePermissions = false; + TTY.init(); + callRuntimeCallbacks(__ATINIT__); + } + function preMain() { + checkStackCookie(); + callRuntimeCallbacks(__ATMAIN__); + } + function exitRuntime() { + Asyncify.state = Asyncify.State.Disabled; + checkStackCookie(); + runtimeExited = true; + } + function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") + Module["postRun"] = [Module["postRun"]]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(__ATPOSTRUN__); + } + function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); + } + function addOnInit(cb) { + __ATINIT__.unshift(cb); + } + function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); + } + assert( + Math.imul, + "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill", + ); + assert( + Math.fround, + "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill", + ); + assert( + Math.clz32, + "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill", + ); + assert( + Math.trunc, + "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill", + ); + var runDependencies = 0; + var runDependencyWatcher = null; + var dependenciesFulfilled = null; + var runDependencyTracking = {}; + function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } + } + function addRunDependency(id) { + runDependencies++; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if ( + runDependencyWatcher === null && + typeof setInterval != "undefined" + ) { + runDependencyWatcher = setInterval(function () { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err("dependency: " + dep); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } + } + function removeRunDependency(id) { + runDependencies--; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } + } + Module["preloadedImages"] = {}; + Module["preloadedAudios"] = {}; + function abort(what) { + { + if (Module["onAbort"]) { + Module["onAbort"](what); + } + } + what = "Aborted(" + what + ")"; + err(what); + ABORT = true; + EXITSTATUS = 1; + var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + throw e; + } + var dataURIPrefix = "data:application/octet-stream;base64,"; + function isDataURI(filename) { + return filename.startsWith(dataURIPrefix); + } + function isFileURI(filename) { + return filename.startsWith("file://"); + } + function createExportWrapper(name, fixedasm) { + return function () { + var displayName = name; + var asm = fixedasm; + if (!fixedasm) { + asm = Module["asm"]; + } + assert( + runtimeInitialized, + "native function `" + + displayName + + "` called before runtime initialization", + ); + assert( + !runtimeExited, + "native function `" + + displayName + + "` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)", + ); + if (!asm[name]) { + assert( + asm[name], + "exported native function `" + displayName + "` not found", + ); + } + return asm[name].apply(null, arguments); + }; + } + var wasmBinaryFile; + if (Module["locateFile"]) { + wasmBinaryFile = "riscv_sim_RV32.wasm"; + if (!isDataURI(wasmBinaryFile)) { + wasmBinaryFile = locateFile(wasmBinaryFile); + } + } else { + wasmBinaryFile = new URL( + "riscv_sim_RV32.wasm", + import.meta.url, + ).toString(); + } + function getBinary(file) { + try { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } else { + throw "both async and sync fetching of the wasm failed"; + } + } catch (err) { + abort(err); + } + } + function getBinaryPromise() { + if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) { + if (typeof fetch == "function") { + return fetch(wasmBinaryFile, { credentials: "same-origin" }) + .then(function (response) { + if (!response["ok"]) { + throw ( + "failed to load wasm binary file at '" + wasmBinaryFile + "'" + ); + } + return response["arrayBuffer"](); + }) + .catch(function () { + return getBinary(wasmBinaryFile); + }); + } + } + return Promise.resolve().then(function () { + return getBinary(wasmBinaryFile); + }); + } + function createWasm() { + var info = { env: asmLibraryArg, wasi_snapshot_preview1: asmLibraryArg }; + function receiveInstance(instance, module) { + var exports = instance.exports; + exports = Asyncify.instrumentWasmExports(exports); + Module["asm"] = exports; + wasmMemory = Module["asm"]["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateGlobalBufferAndViews(wasmMemory.buffer); + wasmTable = Module["asm"]["__indirect_function_table"]; + assert(wasmTable, "table not found in wasm exports"); + addOnInit(Module["asm"]["__wasm_call_ctors"]); + removeRunDependency("wasm-instantiate"); + } + addRunDependency("wasm-instantiate"); + var trueModule = Module; + function receiveInstantiationResult(result) { + assert( + Module === trueModule, + "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?", + ); + trueModule = null; + receiveInstance(result["instance"]); + } + function instantiateArrayBuffer(receiver) { + return getBinaryPromise() + .then(function (binary) { + return WebAssembly.instantiate(binary, info); + }) + .then(function (instance) { + return instance; + }) + .then(receiver, function (reason) { + err("failed to asynchronously prepare wasm: " + reason); + if (isFileURI(wasmBinaryFile)) { + err( + "warning: Loading from a file URI (" + + wasmBinaryFile + + ") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing", + ); + } + abort(reason); + }); + } + function instantiateAsync() { + if ( + !wasmBinary && + typeof WebAssembly.instantiateStreaming == "function" && + !isDataURI(wasmBinaryFile) && + typeof fetch == "function" + ) { + return fetch(wasmBinaryFile, { credentials: "same-origin" }).then( + function (response) { + var result = WebAssembly.instantiateStreaming(response, info); + return result.then(receiveInstantiationResult, function (reason) { + err("wasm streaming compile failed: " + reason); + err("falling back to ArrayBuffer instantiation"); + return instantiateArrayBuffer(receiveInstantiationResult); + }); + }, + ); + } else { + return instantiateArrayBuffer(receiveInstantiationResult); + } + } + if (Module["instantiateWasm"]) { + try { + var exports = Module["instantiateWasm"](info, receiveInstance); + exports = Asyncify.instrumentWasmExports(exports); + return exports; + } catch (e) { + err("Module.instantiateWasm callback failed with error: " + e); + return false; + } + } + instantiateAsync().catch(readyPromiseReject); + return {}; + } + function callRuntimeCallbacks(callbacks) { + while (callbacks.length > 0) { + var callback = callbacks.shift(); + if (typeof callback == "function") { + callback(Module); + continue; + } + var func = callback.func; + if (typeof func == "number") { + if (callback.arg === undefined) { + (function () { + dynCall_v.call(null, func); + })(); + } else { + (function (a1) { + dynCall_vi.apply(null, [func, a1]); + })(callback.arg); + } + } else { + func(callback.arg === undefined ? null : callback.arg); + } + } + } + function demangle(func) { + warnOnce( + "warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling", + ); + return func; + } + function demangleAll(text) { + var regex = /\b_Z[\w\d_]+/g; + return text.replace(regex, function (x) { + var y = demangle(x); + return x === y ? x : y + " [" + x + "]"; + }); + } + var wasmTableMirror = []; + function getWasmTableEntry(funcPtr) { + var func = wasmTableMirror[funcPtr]; + if (!func) { + if (funcPtr >= wasmTableMirror.length) + wasmTableMirror.length = funcPtr + 1; + wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr); + } + assert( + wasmTable.get(funcPtr) == func, + "JavaScript-side Wasm function table mirror is out of date!", + ); + return func; + } + function handleException(e) { + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + quit_(1, e); + } + function jsStackTrace() { + var error = new Error(); + if (!error.stack) { + try { + throw new Error(); + } catch (e) { + error = e; + } + if (!error.stack) { + return "(no stack trace available)"; + } + } + return error.stack.toString(); + } + function setWasmTableEntry(idx, func) { + wasmTable.set(idx, func); + wasmTableMirror[idx] = func; + } + function ___assert_fail(condition, filename, line, func) { + abort( + "Assertion failed: " + + UTF8ToString(condition) + + ", at: " + + [ + filename ? UTF8ToString(filename) : "unknown filename", + line, + func ? UTF8ToString(func) : "unknown function", + ], + ); + } + function setErrNo(value) { + HEAP32[___errno_location() >> 2] = value; + return value; + } + var PATH = { + splitPath: function (filename) { + var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: function (parts, allowAboveRoot) { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (; up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: function (path) { + var isAbsolute = path.charAt(0) === "/", + trailingSlash = path.substr(-1) === "/"; + path = PATH.normalizeArray( + path.split("/").filter(function (p) { + return !!p; + }), + !isAbsolute, + ).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: function (path) { + var result = PATH.splitPath(path), + root = result[0], + dir = result[1]; + if (!root && !dir) { + return "."; + } + if (dir) { + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename: function (path) { + if (path === "/") return "/"; + path = PATH.normalize(path); + path = path.replace(/\/$/, ""); + var lastSlash = path.lastIndexOf("/"); + if (lastSlash === -1) return path; + return path.substr(lastSlash + 1); + }, + extname: function (path) { + return PATH.splitPath(path)[3]; + }, + join: function () { + var paths = Array.prototype.slice.call(arguments, 0); + return PATH.normalize(paths.join("/")); + }, + join2: function (l, r) { + return PATH.normalize(l + "/" + r); + }, + }; + function getRandomDevice() { + if ( + typeof crypto == "object" && + typeof crypto["getRandomValues"] == "function" + ) { + var randomBuffer = new Uint8Array(1); + return function () { + crypto.getRandomValues(randomBuffer); + return randomBuffer[0]; + }; + } else + return function () { + abort( + "no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };", + ); + }; + } + var PATH_FS = { + resolve: function () { + var resolvedPath = "", + resolvedAbsolute = false; + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? arguments[i] : FS.cwd(); + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = path.charAt(0) === "/"; + } + resolvedPath = PATH.normalizeArray( + resolvedPath.split("/").filter(function (p) { + return !!p; + }), + !resolvedAbsolute, + ).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; + }, + relative: function (from, to) { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + }, + }; + var TTY = { + ttys: [], + init: function () {}, + shutdown: function () {}, + register: function (dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops: ops }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open: function (stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close: function (stream) { + stream.tty.ops.flush(stream.tty); + }, + flush: function (stream) { + stream.tty.ops.flush(stream.tty); + }, + read: function (stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: function (stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }, + default_tty_ops: { + get_char: function (tty) { + if (!tty.input.length) { + var result = null; + if ( + typeof window != "undefined" && + typeof window.prompt == "function" + ) { + result = window.prompt("Input: "); + if (result !== null) { + result += "\n"; + } + } else if (typeof readline == "function") { + result = readline(); + if (result !== null) { + result += "\n"; + } + } + if (!result) { + return null; + } + tty.input = intArrayFromString(result, true); + } + return tty.input.shift(); + }, + put_char: function (tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function (tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + }, + }, + default_tty1_ops: { + put_char: function (tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function (tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + }, + }, + }; + function zeroMemory(address, size) { + HEAPU8.fill(0, address, address + size); + } + function alignMemory(size, alignment) { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; + } + function mmapAlloc(size) { + size = alignMemory(size, 65536); + var ptr = _emscripten_builtin_memalign(65536, size); + if (!ptr) return 0; + zeroMemory(ptr, size); + return ptr; + } + var MEMFS = { + ops_table: null, + mount: function (mount) { + return MEMFS.createNode(null, "/", 16384 | 511, 0); + }, + createNode: function (parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + if (!MEMFS.ops_table) { + MEMFS.ops_table = { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink, + }, + stream: { llseek: MEMFS.stream_ops.llseek }, + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync, + }, + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink, + }, + stream: {}, + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: FS.chrdev_stream_ops, + }, + }; + } + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray: function (node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) + return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage: function (node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max( + newCapacity, + (prevCapacity * + (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125)) >>> + 0, + ); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) + node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage: function (node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set( + oldContents.subarray(0, Math.min(newSize, node.usedBytes)), + ); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr: function (node) { + var attr = {}; + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr: function (node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup: function (parent, name) { + throw FS.genericErrors[44]; + }, + mknod: function (parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename: function (old_node, new_dir, new_name) { + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now(); + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + old_node.parent = new_dir; + }, + unlink: function (parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir: function (parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir: function (node) { + var entries = [".", ".."]; + for (var key in node.contents) { + if (!node.contents.hasOwnProperty(key)) { + continue; + } + entries.push(key); + } + return entries; + }, + symlink: function (parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink: function (node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + }, + }, + stream_ops: { + read: function (stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) + buffer[offset + i] = contents[position + i]; + } + return size; + }, + write: function (stream, buffer, offset, length, position, canOwn) { + assert(!(buffer instanceof ArrayBuffer)); + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + assert( + position === 0, + "canOwn must imply no weird position inside the file", + ); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + return length; + } + } + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek: function (stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate: function (stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max( + stream.node.usedBytes, + offset + length, + ); + }, + mmap: function (stream, address, length, position, prot, flags) { + if (address !== 0) { + throw new FS.ErrnoError(28); + } + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + if (!(flags & 2) && contents.buffer === buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call( + contents, + position, + position + length, + ); + } + } + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + HEAP8.set(contents, ptr); + } + return { ptr: ptr, allocated: allocated }; + }, + msync: function (stream, buffer, offset, length, mmapFlags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (mmapFlags & 2) { + return 0; + } + var bytesWritten = MEMFS.stream_ops.write( + stream, + buffer, + 0, + length, + offset, + false, + ); + return 0; + }, + }, + }; + function asyncLoad(url, onload, onerror, noRunDep) { + var dep = !noRunDep ? getUniqueRunDependency("al " + url) : ""; + readAsync( + url, + function (arrayBuffer) { + assert( + arrayBuffer, + 'Loading data file "' + url + '" failed (no arrayBuffer).', + ); + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, + function (event) { + if (onerror) { + onerror(); + } else { + throw 'Loading data file "' + url + '" failed.'; + } + }, + ); + if (dep) addRunDependency(dep); + } + var ERRNO_MESSAGES = { + 0: "Success", + 1: "Arg list too long", + 2: "Permission denied", + 3: "Address already in use", + 4: "Address not available", + 5: "Address family not supported by protocol family", + 6: "No more processes", + 7: "Socket already connected", + 8: "Bad file number", + 9: "Trying to read unreadable message", + 10: "Mount device busy", + 11: "Operation canceled", + 12: "No children", + 13: "Connection aborted", + 14: "Connection refused", + 15: "Connection reset by peer", + 16: "File locking deadlock error", + 17: "Destination address required", + 18: "Math arg out of domain of func", + 19: "Quota exceeded", + 20: "File exists", + 21: "Bad address", + 22: "File too large", + 23: "Host is unreachable", + 24: "Identifier removed", + 25: "Illegal byte sequence", + 26: "Connection already in progress", + 27: "Interrupted system call", + 28: "Invalid argument", + 29: "I/O error", + 30: "Socket is already connected", + 31: "Is a directory", + 32: "Too many symbolic links", + 33: "Too many open files", + 34: "Too many links", + 35: "Message too long", + 36: "Multihop attempted", + 37: "File or path name too long", + 38: "Network interface is not configured", + 39: "Connection reset by network", + 40: "Network is unreachable", + 41: "Too many open files in system", + 42: "No buffer space available", + 43: "No such device", + 44: "No such file or directory", + 45: "Exec format error", + 46: "No record locks available", + 47: "The link has been severed", + 48: "Not enough core", + 49: "No message of desired type", + 50: "Protocol not available", + 51: "No space left on device", + 52: "Function not implemented", + 53: "Socket is not connected", + 54: "Not a directory", + 55: "Directory not empty", + 56: "State not recoverable", + 57: "Socket operation on non-socket", + 59: "Not a typewriter", + 60: "No such device or address", + 61: "Value too large for defined data type", + 62: "Previous owner died", + 63: "Not super-user", + 64: "Broken pipe", + 65: "Protocol error", + 66: "Unknown protocol", + 67: "Protocol wrong type for socket", + 68: "Math result not representable", + 69: "Read only file system", + 70: "Illegal seek", + 71: "No such process", + 72: "Stale file handle", + 73: "Connection timed out", + 74: "Text file busy", + 75: "Cross-device link", + 100: "Device not a stream", + 101: "Bad font file fmt", + 102: "Invalid slot", + 103: "Invalid request code", + 104: "No anode", + 105: "Block device required", + 106: "Channel number out of range", + 107: "Level 3 halted", + 108: "Level 3 reset", + 109: "Link number out of range", + 110: "Protocol driver not attached", + 111: "No CSI structure available", + 112: "Level 2 halted", + 113: "Invalid exchange", + 114: "Invalid request descriptor", + 115: "Exchange full", + 116: "No data (for no delay io)", + 117: "Timer expired", + 118: "Out of streams resources", + 119: "Machine is not on the network", + 120: "Package not installed", + 121: "The object is remote", + 122: "Advertise error", + 123: "Srmount error", + 124: "Communication error on send", + 125: "Cross mount point (not really error)", + 126: "Given log. name not unique", + 127: "f.d. invalid for this operation", + 128: "Remote address changed", + 129: "Can access a needed shared lib", + 130: "Accessing a corrupted shared lib", + 131: ".lib section in a.out corrupted", + 132: "Attempting to link in too many libs", + 133: "Attempting to exec a shared library", + 135: "Streams pipe error", + 136: "Too many users", + 137: "Socket type not supported", + 138: "Not supported", + 139: "Protocol family not supported", + 140: "Can't send after socket shutdown", + 141: "Too many references", + 142: "Host is down", + 148: "No medium (in tape drive)", + 156: "Level 2 not synchronized", + }; + var ERRNO_CODES = {}; + var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: null, + genericErrors: {}, + filesystems: null, + syncFSRequests: 0, + lookupPath: (path, opts = {}) => { + path = PATH_FS.resolve(FS.cwd(), path); + if (!path) return { path: "", node: null }; + var defaults = { follow_mount: true, recurse_count: 0 }; + for (var key in defaults) { + if (opts[key] === undefined) { + opts[key] = defaults[key]; + } + } + if (opts.recurse_count > 8) { + throw new FS.ErrnoError(32); + } + var parts = PATH.normalizeArray( + path.split("/").filter((p) => !!p), + false, + ); + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + if (FS.isMountpoint(current)) { + if (!islast || (islast && opts.follow_mount)) { + current = current.mounted.root; + } + } + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve(PATH.dirname(current_path), link); + var lookup = FS.lookupPath(current_path, { + recurse_count: opts.recurse_count, + }); + current = lookup.node; + if (count++ > 40) { + throw new FS.ErrnoError(32); + } + } + } + } + return { path: current_path, node: current }; + }, + getPath: (node) => { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" + ? mount + "/" + path + : mount + path; + } + path = path ? node.name + "/" + path : node.name; + node = node.parent; + } + }, + hashName: (parentid, name) => { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode: (node) => { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode: (node) => { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode: (parent, name) => { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode, parent); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + return FS.lookup(parent, name); + }, + createNode: (parent, name, mode, rdev) => { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode: (node) => { + FS.hashRemoveNode(node); + }, + isRoot: (node) => { + return node === node.parent; + }, + isMountpoint: (node) => { + return !!node.mounted; + }, + isFile: (mode) => { + return (mode & 61440) === 32768; + }, + isDir: (mode) => { + return (mode & 61440) === 16384; + }, + isLink: (mode) => { + return (mode & 61440) === 40960; + }, + isChrdev: (mode) => { + return (mode & 61440) === 8192; + }, + isBlkdev: (mode) => { + return (mode & 61440) === 24576; + }, + isFIFO: (mode) => { + return (mode & 61440) === 4096; + }, + isSocket: (mode) => { + return (mode & 49152) === 49152; + }, + flagModes: { r: 0, "r+": 2, w: 577, "w+": 578, a: 1089, "a+": 1090 }, + modeStringToFlags: (str) => { + var flags = FS.flagModes[str]; + if (typeof flags == "undefined") { + throw new Error("Unknown file open mode: " + str); + } + return flags; + }, + flagsToPermissionString: (flag) => { + var perms = ["r", "w", "rw"][flag & 3]; + if (flag & 512) { + perms += "w"; + } + return perms; + }, + nodePermissions: (node, perms) => { + if (FS.ignorePermissions) { + return 0; + } + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup: (dir) => { + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate: (dir, name) => { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete: (dir, name, isdir) => { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen: (node, flags) => { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || flags & 512) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS: 4096, + nextfd: (fd_start = 0, fd_end = FS.MAX_OPEN_FDS) => { + for (var fd = fd_start; fd <= fd_end; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStream: (fd) => FS.streams[fd], + createStream: (stream, fd_start, fd_end) => { + if (!FS.FSStream) { + FS.FSStream = function () {}; + FS.FSStream.prototype = { + object: { + get: function () { + return this.node; + }, + set: function (val) { + this.node = val; + }, + }, + isRead: { + get: function () { + return (this.flags & 2097155) !== 1; + }, + }, + isWrite: { + get: function () { + return (this.flags & 2097155) !== 0; + }, + }, + isAppend: { + get: function () { + return this.flags & 1024; + }, + }, + }; + } + stream = Object.assign(new FS.FSStream(), stream); + var fd = FS.nextfd(fd_start, fd_end); + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream: (fd) => { + FS.streams[fd] = null; + }, + chrdev_stream_ops: { + open: (stream) => { + var device = FS.getDevice(stream.node.rdev); + stream.stream_ops = device.stream_ops; + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + }, + llseek: () => { + throw new FS.ErrnoError(70); + }, + }, + major: (dev) => dev >> 8, + minor: (dev) => dev & 255, + makedev: (ma, mi) => (ma << 8) | mi, + registerDevice: (dev, ops) => { + FS.devices[dev] = { stream_ops: ops }; + }, + getDevice: (dev) => FS.devices[dev], + getMounts: (mount) => { + var mounts = []; + var check = [mount]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push.apply(check, m.mounts); + } + return mounts; + }, + syncfs: (populate, callback) => { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err( + "warning: " + + FS.syncFSRequests + + " FS.syncfs operations in flight at once, probably just doing extra work", + ); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + mounts.forEach((mount) => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount: (type, opts, mountpoint) => { + if (typeof type == "string") { + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + mountpoint = lookup.path; + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type: type, + opts: opts, + mountpoint: mountpoint, + mounts: [], + }; + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount: (mountpoint) => { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach((hash) => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + node.mounted = null; + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup: (parent, name) => { + return parent.node_ops.lookup(parent, name); + }, + mknod: (path, mode, dev) => { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === "." || name === "..") { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create: (path, mode) => { + mode = mode !== undefined ? mode : 438; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir: (path, mode) => { + mode = mode !== undefined ? mode : 511; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree: (path, mode) => { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev: (path, mode, dev) => { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink: (oldpath, newpath) => { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename: (old_path, new_path) => { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + var lookup, old_dir, new_dir; + lookup = FS.lookupPath(old_path, { parent: true }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { parent: true }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + var old_node = FS.lookupNode(old_dir, old_name); + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (old_node === new_node) { + return; + } + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + errCode = new_node + ? FS.mayDelete(new_dir, new_name, isdir) + : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if ( + FS.isMountpoint(old_node) || + (new_node && FS.isMountpoint(new_node)) + ) { + throw new FS.ErrnoError(10); + } + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + FS.hashRemoveNode(old_node); + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir: (path) => { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir: (path) => { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink: (path) => { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink: (path) => { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve( + FS.getPath(link.parent), + link.node_ops.readlink(link), + ); + }, + stat: (path, dontFollow) => { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat: (path) => { + return FS.stat(path, true); + }, + chmod: (path, mode, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: (mode & 4095) | (node.mode & ~4095), + timestamp: Date.now(), + }); + }, + lchmod: (path, mode) => { + FS.chmod(path, mode, true); + }, + fchmod: (fd, mode) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chmod(stream.node, mode); + }, + chown: (path, uid, gid, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { timestamp: Date.now() }); + }, + lchown: (path, uid, gid) => { + FS.chown(path, uid, gid, true); + }, + fchown: (fd, uid, gid) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chown(stream.node, uid, gid); + }, + truncate: (path, len) => { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: true }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { size: len, timestamp: Date.now() }); + }, + ftruncate: (fd, len) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime: (path, atime, mtime) => { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + node.node_ops.setattr(node, { timestamp: Math.max(atime, mtime) }); + }, + open: (path, flags, mode, fd_start, fd_end) => { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS.modeStringToFlags(flags) : flags; + mode = typeof mode == "undefined" ? 438 : mode; + if (flags & 64) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == "object") { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { follow: !(flags & 131072) }); + node = lookup.node; + } catch (e) {} + } + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else { + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + if (flags & 512) { + FS.truncate(node, 0); + } + flags &= ~(128 | 512 | 131072); + var stream = FS.createStream( + { + node: node, + path: FS.getPath(node), + flags: flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + ungotten: [], + error: false, + }, + fd_start, + fd_end, + ); + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!FS.readFiles) FS.readFiles = {}; + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close: (stream) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed: (stream) => { + return stream.fd === null; + }, + llseek: (stream, offset, whence) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read: (stream, buffer, offset, length, position) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read( + stream, + buffer, + offset, + length, + position, + ); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write: (stream, buffer, offset, length, position, canOwn) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write( + stream, + buffer, + offset, + length, + position, + canOwn, + ); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate: (stream, offset, length) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap: (stream, address, length, position, prot, flags) => { + if ( + (prot & 2) !== 0 && + (flags & 2) === 0 && + (stream.flags & 2097155) !== 2 + ) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + return stream.stream_ops.mmap( + stream, + address, + length, + position, + prot, + flags, + ); + }, + msync: (stream, buffer, offset, length, mmapFlags) => { + if (!stream || !stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync( + stream, + buffer, + offset, + length, + mmapFlags, + ); + }, + munmap: (stream) => 0, + ioctl: (stream, cmd, arg) => { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile: (path, opts = {}) => { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error('Invalid encoding type "' + opts.encoding + '"'); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf, 0); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile: (path, data, opts = {}) => { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir: (path) => { + var lookup = FS.lookupPath(path, { follow: true }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories: () => { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices: () => { + FS.mkdir("/dev"); + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + var random_device = getRandomDevice(); + FS.createDevice("/dev", "random", random_device); + FS.createDevice("/dev", "urandom", random_device); + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories: () => { + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount( + { + mount: () => { + var node = FS.createNode(proc_self, "fd", 16384 | 511, 73); + node.node_ops = { + lookup: (parent, name) => { + var fd = +name; + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + var ret = { + parent: null, + mount: { mountpoint: "fake" }, + node_ops: { readlink: () => stream.path }, + }; + ret.parent = ret; + return ret; + }, + }; + return node; + }, + }, + {}, + "/proc/self/fd", + ); + }, + createStandardStreams: () => { + if (Module["stdin"]) { + FS.createDevice("/dev", "stdin", Module["stdin"]); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (Module["stdout"]) { + FS.createDevice("/dev", "stdout", null, Module["stdout"]); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (Module["stderr"]) { + FS.createDevice("/dev", "stderr", null, Module["stderr"]); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, "invalid handle for stdin (" + stdin.fd + ")"); + assert( + stdout.fd === 1, + "invalid handle for stdout (" + stdout.fd + ")", + ); + assert( + stderr.fd === 2, + "invalid handle for stderr (" + stderr.fd + ")", + ); + }, + ensureErrnoError: () => { + if (FS.ErrnoError) return; + FS.ErrnoError = function ErrnoError(errno, node) { + this.node = node; + this.setErrno = function (errno) { + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + }; + this.setErrno(errno); + this.message = ERRNO_MESSAGES[errno]; + if (this.stack) { + Object.defineProperty(this, "stack", { + value: new Error().stack, + writable: true, + }); + this.stack = demangleAll(this.stack); + } + }; + FS.ErrnoError.prototype = new Error(); + FS.ErrnoError.prototype.constructor = FS.ErrnoError; + [44].forEach((code) => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ""; + }); + }, + staticInit: () => { + FS.ensureErrnoError(); + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { MEMFS: MEMFS }; + }, + init: (input, output, error) => { + assert( + !FS.init.initialized, + "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)", + ); + FS.init.initialized = true; + FS.ensureErrnoError(); + Module["stdin"] = input || Module["stdin"]; + Module["stdout"] = output || Module["stdout"]; + Module["stderr"] = error || Module["stderr"]; + FS.createStandardStreams(); + }, + quit: () => { + FS.init.initialized = false; + ___stdio_exit(); + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + getMode: (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }, + findObject: (path, dontResolveLastLink) => { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (ret.exists) { + return ret.object; + } else { + return null; + } + }, + analyzePath: (path, dontResolveLastLink) => { + try { + var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null, + }; + try { + var lookup = FS.lookupPath(path, { parent: true }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath: (parent, path, canRead, canWrite) => { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile: (parent, name, properties, canRead, canWrite) => { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS.getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile: (parent, name, data, canRead, canWrite, canOwn) => { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS.getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) + arr[i] = data.charCodeAt(i); + data = arr; + } + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + return node; + }, + createDevice: (parent, name, input, output) => { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS.getMode(!!input, !!output); + if (!FS.createDevice.major) FS.createDevice.major = 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + FS.registerDevice(dev, { + open: (stream) => { + stream.seekable = false; + }, + close: (stream) => { + if (output && output.buffer && output.buffer.length) { + output(10); + } + }, + read: (stream, buffer, offset, length, pos) => { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: (stream, buffer, offset, length, pos) => { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile: (obj) => { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) + return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error( + "Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.", + ); + } else if (read_) { + try { + obj.contents = intArrayFromString(read_(obj.url), true); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } else { + throw new Error("Cannot load without read() or XMLHttpRequest."); + } + }, + createLazyFile: (parent, name, url, canRead, canWrite) => { + function LazyUint8Array() { + this.lengthKnown = false; + this.chunks = []; + } + LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + }; + LazyUint8Array.prototype.setDataGetter = + function LazyUint8Array_setDataGetter(getter) { + this.getter = getter; + }; + LazyUint8Array.prototype.cacheLength = + function LazyUint8Array_cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open("HEAD", url, false); + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = + (header = xhr.getResponseHeader("Accept-Ranges")) && + header === "bytes"; + var usesGzip = + (header = xhr.getResponseHeader("Content-Encoding")) && + header === "gzip"; + var chunkSize = 1024 * 1024; + if (!hasByteServing) chunkSize = datalength; + var doXHR = (from, to) => { + if (from > to) + throw new Error( + "invalid range (" + + from + + ", " + + to + + ") or no bytes requested!", + ); + if (to > datalength - 1) + throw new Error( + "only " + datalength + " bytes available! programmer error!", + ); + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + if (datalength !== chunkSize) + xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } else { + return intArrayFromString(xhr.responseText || "", true); + } + }; + var lazyArray = this; + lazyArray.setDataGetter((chunkNum) => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") + throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out( + "LazyFiles on gzip forces download of the whole file when length is accessed", + ); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + }; + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) + throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array(); + Object.defineProperties(lazyArray, { + length: { + get: function () { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + }, + }, + chunkSize: { + get: function () { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + }, + }, + }); + var properties = { isDevice: false, contents: lazyArray }; + } else { + var properties = { isDevice: false, url: url }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + Object.defineProperties(node, { + usedBytes: { + get: function () { + return this.contents.length; + }, + }, + }); + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach((key) => { + var fn = node.stream_ops[key]; + stream_ops[key] = function forceLoadLazyFile() { + FS.forceLoadFile(node); + return fn.apply(null, arguments); + }; + }); + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + }; + node.stream_ops = stream_ops; + return node; + }, + createPreloadedFile: ( + parent, + name, + url, + canRead, + canWrite, + onload, + onerror, + dontCreateFile, + canOwn, + preFinish, + ) => { + var fullname = name + ? PATH_FS.resolve(PATH.join2(parent, name)) + : parent; + var dep = getUniqueRunDependency("cp " + fullname); + function processData(byteArray) { + function finish(byteArray) { + if (preFinish) preFinish(); + if (!dontCreateFile) { + FS.createDataFile( + parent, + name, + byteArray, + canRead, + canWrite, + canOwn, + ); + } + if (onload) onload(); + removeRunDependency(dep); + } + if ( + Browser.handledByPreloadPlugin(byteArray, fullname, finish, () => { + if (onerror) onerror(); + removeRunDependency(dep); + }) + ) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url, (byteArray) => processData(byteArray), onerror); + } else { + processData(url); + } + }, + indexedDB: () => { + return ( + window.indexedDB || + window.mozIndexedDB || + window.webkitIndexedDB || + window.msIndexedDB + ); + }, + DB_NAME: () => { + return "EM_FS_" + window.location.pathname; + }, + DB_VERSION: 20, + DB_STORE_NAME: "FILE_DATA", + saveFilesToDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = () => { + out("creating db"); + var db = openRequest.result; + db.createObjectStore(FS.DB_STORE_NAME); + }; + openRequest.onsuccess = () => { + var db = openRequest.result; + var transaction = db.transaction([FS.DB_STORE_NAME], "readwrite"); + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, + fail = 0, + total = paths.length; + function finish() { + if (fail == 0) onload(); + else onerror(); + } + paths.forEach((path) => { + var putRequest = files.put( + FS.analyzePath(path).object.contents, + path, + ); + putRequest.onsuccess = () => { + ok++; + if (ok + fail == total) finish(); + }; + putRequest.onerror = () => { + fail++; + if (ok + fail == total) finish(); + }; + }); + transaction.onerror = onerror; + }; + openRequest.onerror = onerror; + }, + loadFilesFromDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = onerror; + openRequest.onsuccess = () => { + var db = openRequest.result; + try { + var transaction = db.transaction([FS.DB_STORE_NAME], "readonly"); + } catch (e) { + onerror(e); + return; + } + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, + fail = 0, + total = paths.length; + function finish() { + if (fail == 0) onload(); + else onerror(); + } + paths.forEach((path) => { + var getRequest = files.get(path); + getRequest.onsuccess = () => { + if (FS.analyzePath(path).exists) { + FS.unlink(path); + } + FS.createDataFile( + PATH.dirname(path), + PATH.basename(path), + getRequest.result, + true, + true, + true, + ); + ok++; + if (ok + fail == total) finish(); + }; + getRequest.onerror = () => { + fail++; + if (ok + fail == total) finish(); + }; + }); + transaction.onerror = onerror; + }; + openRequest.onerror = onerror; + }, + absolutePath: () => { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder: () => { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink: () => { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath: () => { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc: () => { + abort( + "FS.mmapAlloc has been replaced by the top level function mmapAlloc", + ); + }, + standardizePath: () => { + abort( + "FS.standardizePath has been removed; use PATH.normalize instead", + ); + }, + }; + var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt: function (dirfd, path, allowEmpty) { + if (path[0] === "/") { + return path; + } + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = FS.getStream(dirfd); + if (!dirstream) throw new FS.ErrnoError(8); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat: function (func, path, buf) { + try { + var stat = func(path); + } catch (e) { + if ( + e && + e.node && + PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node)) + ) { + return -54; + } + throw e; + } + HEAP32[buf >> 2] = stat.dev; + HEAP32[(buf + 4) >> 2] = 0; + HEAP32[(buf + 8) >> 2] = stat.ino; + HEAP32[(buf + 12) >> 2] = stat.mode; + HEAP32[(buf + 16) >> 2] = stat.nlink; + HEAP32[(buf + 20) >> 2] = stat.uid; + HEAP32[(buf + 24) >> 2] = stat.gid; + HEAP32[(buf + 28) >> 2] = stat.rdev; + HEAP32[(buf + 32) >> 2] = 0; + HEAP64[(buf + 40) >> 3] = BigInt(stat.size); + HEAP32[(buf + 48) >> 2] = 4096; + HEAP32[(buf + 52) >> 2] = stat.blocks; + HEAP32[(buf + 56) >> 2] = (stat.atime.getTime() / 1e3) | 0; + HEAP32[(buf + 60) >> 2] = 0; + HEAP32[(buf + 64) >> 2] = (stat.mtime.getTime() / 1e3) | 0; + HEAP32[(buf + 68) >> 2] = 0; + HEAP32[(buf + 72) >> 2] = (stat.ctime.getTime() / 1e3) | 0; + HEAP32[(buf + 76) >> 2] = 0; + HEAP64[(buf + 80) >> 3] = BigInt(stat.ino); + return 0; + }, + doMsync: function (addr, stream, len, flags, offset) { + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + doMkdir: function (path, mode) { + path = PATH.normalize(path); + if (path[path.length - 1] === "/") + path = path.substr(0, path.length - 1); + FS.mkdir(path, mode, 0); + return 0; + }, + doMknod: function (path, mode, dev) { + switch (mode & 61440) { + case 32768: + case 8192: + case 24576: + case 4096: + case 49152: + break; + default: + return -28; + } + FS.mknod(path, mode, dev); + return 0; + }, + doReadlink: function (path, buf, bufsize) { + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = HEAP8[buf + len]; + stringToUTF8(ret, buf, bufsize + 1); + HEAP8[buf + len] = endChar; + return len; + }, + doAccess: function (path, amode) { + if (amode & ~7) { + return -28; + } + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ""; + if (amode & 4) perms += "r"; + if (amode & 2) perms += "w"; + if (amode & 1) perms += "x"; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + }, + doDup: function (path, flags, suggestFD) { + var suggest = FS.getStream(suggestFD); + if (suggest) FS.close(suggest); + return FS.open(path, flags, 0, suggestFD, suggestFD).fd; + }, + doReadv: function (stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAP32[(iov + i * 8) >> 2]; + var len = HEAP32[(iov + (i * 8 + 4)) >> 2]; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + } + return ret; + }, + doWritev: function (stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAP32[(iov + i * 8) >> 2]; + var len = HEAP32[(iov + (i * 8 + 4)) >> 2]; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + } + return ret; + }, + varargs: undefined, + get: function () { + assert(SYSCALLS.varargs != undefined); + SYSCALLS.varargs += 4; + var ret = HEAP32[(SYSCALLS.varargs - 4) >> 2]; + return ret; + }, + getStr: function (ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + getStreamFromFD: function (fd) { + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + return stream; + }, + get64: function (low, high) { + if (low >= 0) assert(high === 0); + else assert(high === -1); + return low; + }, + }; + function ___syscall_fcntl64(fd, cmd, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: { + var arg = SYSCALLS.get(); + if (arg < 0) { + return -28; + } + var newStream; + newStream = FS.open(stream.path, stream.flags, 0, arg); + return newStream.fd; + } + case 1: + case 2: + return 0; + case 3: + return stream.flags; + case 4: { + var arg = SYSCALLS.get(); + stream.flags |= arg; + return 0; + } + case 5: { + var arg = SYSCALLS.get(); + var offset = 0; + HEAP16[(arg + offset) >> 1] = 2; + return 0; + } + case 6: + case 7: + return 0; + case 16: + case 8: + return -28; + case 9: + setErrNo(28); + return -1; + default: { + return -28; + } + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } + } + function ___syscall_fstat64(fd, buf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } + } + function ___syscall_ioctl(fd, op, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: + case 21505: { + if (!stream.tty) return -59; + return 0; + } + case 21510: + case 21511: + case 21512: + case 21506: + case 21507: + case 21508: { + if (!stream.tty) return -59; + return 0; + } + case 21519: { + if (!stream.tty) return -59; + var argp = SYSCALLS.get(); + HEAP32[argp >> 2] = 0; + return 0; + } + case 21520: { + if (!stream.tty) return -59; + return -28; + } + case 21531: { + var argp = SYSCALLS.get(); + return FS.ioctl(stream, op, argp); + } + case 21523: { + if (!stream.tty) return -59; + return 0; + } + case 21524: { + if (!stream.tty) return -59; + return 0; + } + default: + abort("bad ioctl syscall " + op); + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } + } + function ___syscall_open(path, flags, varargs) { + SYSCALLS.varargs = varargs; + try { + var pathname = SYSCALLS.getStr(path); + var mode = varargs ? SYSCALLS.get() : 0; + var stream = FS.open(pathname, flags, mode); + return stream.fd; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } + } + function __mmap_js(addr, len, prot, flags, fd, off, allocated, builtin) { + try { + var info = FS.getStream(fd); + if (!info) return -8; + var res = FS.mmap(info, addr, len, off, prot, flags); + var ptr = res.ptr; + HEAP32[allocated >> 2] = res.allocated; + return ptr; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } + } + function __munmap_js(addr, len, prot, flags, fd, offset) { + try { + var stream = FS.getStream(fd); + if (stream) { + if (prot & 2) { + SYSCALLS.doMsync(addr, stream, len, flags, offset); + } + FS.munmap(stream); + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } + } + function _abort() { + abort("native code called abort()"); + } + function _emscripten_set_main_loop_timing(mode, value) { + Browser.mainLoop.timingMode = mode; + Browser.mainLoop.timingValue = value; + if (!Browser.mainLoop.func) { + err( + "emscripten_set_main_loop_timing: Cannot set timing mode for main loop since a main loop does not exist! Call emscripten_set_main_loop first to set one up.", + ); + return 1; + } + if (!Browser.mainLoop.running) { + Browser.mainLoop.running = true; + } + if (mode == 0) { + Browser.mainLoop.scheduler = + function Browser_mainLoop_scheduler_setTimeout() { + var timeUntilNextTick = + Math.max( + 0, + Browser.mainLoop.tickStartTime + value - _emscripten_get_now(), + ) | 0; + setTimeout(Browser.mainLoop.runner, timeUntilNextTick); + }; + Browser.mainLoop.method = "timeout"; + } else if (mode == 1) { + Browser.mainLoop.scheduler = function Browser_mainLoop_scheduler_rAF() { + Browser.requestAnimationFrame(Browser.mainLoop.runner); + }; + Browser.mainLoop.method = "rAF"; + } else if (mode == 2) { + if (typeof setImmediate == "undefined") { + var setImmediates = []; + var emscriptenMainLoopMessageId = "setimmediate"; + var Browser_setImmediate_messageHandler = function (event) { + if ( + event.data === emscriptenMainLoopMessageId || + event.data.target === emscriptenMainLoopMessageId + ) { + event.stopPropagation(); + setImmediates.shift()(); + } + }; + addEventListener( + "message", + Browser_setImmediate_messageHandler, + true, + ); + setImmediate = function Browser_emulated_setImmediate(func) { + setImmediates.push(func); + if (ENVIRONMENT_IS_WORKER) { + if (Module["setImmediates"] === undefined) + Module["setImmediates"] = []; + Module["setImmediates"].push(func); + postMessage({ target: emscriptenMainLoopMessageId }); + } else postMessage(emscriptenMainLoopMessageId, "*"); + }; + } + Browser.mainLoop.scheduler = + function Browser_mainLoop_scheduler_setImmediate() { + setImmediate(Browser.mainLoop.runner); + }; + Browser.mainLoop.method = "immediate"; + } + return 0; + } + var _emscripten_get_now; + _emscripten_get_now = () => performance.now(); + function runtimeKeepalivePush() { + runtimeKeepaliveCounter += 1; + } + function _exit(status) { + exit(status); + } + function maybeExit() { + if (!keepRuntimeAlive()) { + try { + _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } + } + function setMainLoop( + browserIterationFunc, + fps, + simulateInfiniteLoop, + arg, + noSetTiming, + ) { + assert( + !Browser.mainLoop.func, + "emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.", + ); + Browser.mainLoop.func = browserIterationFunc; + Browser.mainLoop.arg = arg; + var thisMainLoopId = Browser.mainLoop.currentlyRunningMainloop; + function checkIsRunning() { + if (thisMainLoopId < Browser.mainLoop.currentlyRunningMainloop) { + maybeExit(); + return false; + } + return true; + } + Browser.mainLoop.running = false; + Browser.mainLoop.runner = function Browser_mainLoop_runner() { + if (ABORT) return; + if (Browser.mainLoop.queue.length > 0) { + var start = Date.now(); + var blocker = Browser.mainLoop.queue.shift(); + blocker.func(blocker.arg); + if (Browser.mainLoop.remainingBlockers) { + var remaining = Browser.mainLoop.remainingBlockers; + var next = + remaining % 1 == 0 ? remaining - 1 : Math.floor(remaining); + if (blocker.counted) { + Browser.mainLoop.remainingBlockers = next; + } else { + next = next + 0.5; + Browser.mainLoop.remainingBlockers = (8 * remaining + next) / 9; + } + } + out( + 'main loop blocker "' + + blocker.name + + '" took ' + + (Date.now() - start) + + " ms", + ); + Browser.mainLoop.updateStatus(); + if (!checkIsRunning()) return; + setTimeout(Browser.mainLoop.runner, 0); + return; + } + if (!checkIsRunning()) return; + Browser.mainLoop.currentFrameNumber = + (Browser.mainLoop.currentFrameNumber + 1) | 0; + if ( + Browser.mainLoop.timingMode == 1 && + Browser.mainLoop.timingValue > 1 && + Browser.mainLoop.currentFrameNumber % Browser.mainLoop.timingValue != + 0 + ) { + Browser.mainLoop.scheduler(); + return; + } else if (Browser.mainLoop.timingMode == 0) { + Browser.mainLoop.tickStartTime = _emscripten_get_now(); + } + if (Browser.mainLoop.method === "timeout" && Module.ctx) { + warnOnce( + "Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!", + ); + Browser.mainLoop.method = ""; + } + Browser.mainLoop.runIter(browserIterationFunc); + checkStackCookie(); + if (!checkIsRunning()) return; + if (typeof SDL == "object" && SDL.audio && SDL.audio.queueNewAudioData) + SDL.audio.queueNewAudioData(); + Browser.mainLoop.scheduler(); + }; + if (!noSetTiming) { + if (fps && fps > 0) _emscripten_set_main_loop_timing(0, 1e3 / fps); + else _emscripten_set_main_loop_timing(1, 1); + Browser.mainLoop.scheduler(); + } + if (simulateInfiniteLoop) { + throw "unwind"; + } + } + function callUserCallback(func, synchronous) { + if (runtimeExited || ABORT) { + err( + "user callback triggered after runtime exited or application aborted. Ignoring.", + ); + return; + } + if (synchronous) { + func(); + return; + } + try { + func(); + } catch (e) { + handleException(e); + } + } + function runtimeKeepalivePop() { + assert(runtimeKeepaliveCounter > 0); + runtimeKeepaliveCounter -= 1; + } + function safeSetTimeout(func, timeout) { + return setTimeout(function () { + callUserCallback(func); + }, timeout); + } + var Browser = { + mainLoop: { + running: false, + scheduler: null, + method: "", + currentlyRunningMainloop: 0, + func: null, + arg: 0, + timingMode: 0, + timingValue: 0, + currentFrameNumber: 0, + queue: [], + pause: function () { + Browser.mainLoop.scheduler = null; + Browser.mainLoop.currentlyRunningMainloop++; + }, + resume: function () { + Browser.mainLoop.currentlyRunningMainloop++; + var timingMode = Browser.mainLoop.timingMode; + var timingValue = Browser.mainLoop.timingValue; + var func = Browser.mainLoop.func; + Browser.mainLoop.func = null; + setMainLoop(func, 0, false, Browser.mainLoop.arg, true); + _emscripten_set_main_loop_timing(timingMode, timingValue); + Browser.mainLoop.scheduler(); + }, + updateStatus: function () { + if (Module["setStatus"]) { + var message = Module["statusMessage"] || "Please wait..."; + var remaining = Browser.mainLoop.remainingBlockers; + var expected = Browser.mainLoop.expectedBlockers; + if (remaining) { + if (remaining < expected) { + Module["setStatus"]( + message + + " (" + + (expected - remaining) + + "/" + + expected + + ")", + ); + } else { + Module["setStatus"](message); + } + } else { + Module["setStatus"](""); + } + } + }, + runIter: function (func) { + if (ABORT) return; + if (Module["preMainLoop"]) { + var preRet = Module["preMainLoop"](); + if (preRet === false) { + return; + } + } + callUserCallback(func); + if (Module["postMainLoop"]) Module["postMainLoop"](); + }, + }, + isFullscreen: false, + pointerLock: false, + moduleContextCreatedCallbacks: [], + workers: [], + init: function () { + if (!Module["preloadPlugins"]) Module["preloadPlugins"] = []; + if (Browser.initted) return; + Browser.initted = true; + try { + new Blob(); + Browser.hasBlobConstructor = true; + } catch (e) { + Browser.hasBlobConstructor = false; + out( + "warning: no blob constructor, cannot create blobs with mimetypes", + ); + } + Browser.BlobBuilder = + typeof MozBlobBuilder != "undefined" + ? MozBlobBuilder + : typeof WebKitBlobBuilder != "undefined" + ? WebKitBlobBuilder + : !Browser.hasBlobConstructor + ? out("warning: no BlobBuilder") + : null; + Browser.URLObject = + typeof window != "undefined" + ? window.URL + ? window.URL + : window.webkitURL + : undefined; + if ( + !Module.noImageDecoding && + typeof Browser.URLObject == "undefined" + ) { + out( + "warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available.", + ); + Module.noImageDecoding = true; + } + var imagePlugin = {}; + imagePlugin["canHandle"] = function imagePlugin_canHandle(name) { + return !Module.noImageDecoding && /\.(jpg|jpeg|png|bmp)$/i.test(name); + }; + imagePlugin["handle"] = function imagePlugin_handle( + byteArray, + name, + onload, + onerror, + ) { + var b = null; + if (Browser.hasBlobConstructor) { + try { + b = new Blob([byteArray], { type: Browser.getMimetype(name) }); + if (b.size !== byteArray.length) { + b = new Blob([new Uint8Array(byteArray).buffer], { + type: Browser.getMimetype(name), + }); + } + } catch (e) { + warnOnce( + "Blob constructor present but fails: " + + e + + "; falling back to blob builder", + ); + } + } + if (!b) { + var bb = new Browser.BlobBuilder(); + bb.append(new Uint8Array(byteArray).buffer); + b = bb.getBlob(); + } + var url = Browser.URLObject.createObjectURL(b); + assert( + typeof url == "string", + "createObjectURL must return a url as a string", + ); + var img = new Image(); + img.onload = () => { + assert(img.complete, "Image " + name + " could not be decoded"); + var canvas = document.createElement("canvas"); + canvas.width = img.width; + canvas.height = img.height; + var ctx = canvas.getContext("2d"); + ctx.drawImage(img, 0, 0); + Module["preloadedImages"][name] = canvas; + Browser.URLObject.revokeObjectURL(url); + if (onload) onload(byteArray); + }; + img.onerror = (event) => { + out("Image " + url + " could not be decoded"); + if (onerror) onerror(); + }; + img.src = url; + }; + Module["preloadPlugins"].push(imagePlugin); + var audioPlugin = {}; + audioPlugin["canHandle"] = function audioPlugin_canHandle(name) { + return ( + !Module.noAudioDecoding && + name.substr(-4) in { ".ogg": 1, ".wav": 1, ".mp3": 1 } + ); + }; + audioPlugin["handle"] = function audioPlugin_handle( + byteArray, + name, + onload, + onerror, + ) { + var done = false; + function finish(audio) { + if (done) return; + done = true; + Module["preloadedAudios"][name] = audio; + if (onload) onload(byteArray); + } + function fail() { + if (done) return; + done = true; + Module["preloadedAudios"][name] = new Audio(); + if (onerror) onerror(); + } + if (Browser.hasBlobConstructor) { + try { + var b = new Blob([byteArray], { + type: Browser.getMimetype(name), + }); + } catch (e) { + return fail(); + } + var url = Browser.URLObject.createObjectURL(b); + assert( + typeof url == "string", + "createObjectURL must return a url as a string", + ); + var audio = new Audio(); + audio.addEventListener( + "canplaythrough", + function () { + finish(audio); + }, + false, + ); + audio.onerror = function audio_onerror(event) { + if (done) return; + out( + "warning: browser could not fully decode audio " + + name + + ", trying slower base64 approach", + ); + function encode64(data) { + var BASE = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var PAD = "="; + var ret = ""; + var leftchar = 0; + var leftbits = 0; + for (var i = 0; i < data.length; i++) { + leftchar = (leftchar << 8) | data[i]; + leftbits += 8; + while (leftbits >= 6) { + var curr = (leftchar >> (leftbits - 6)) & 63; + leftbits -= 6; + ret += BASE[curr]; + } + } + if (leftbits == 2) { + ret += BASE[(leftchar & 3) << 4]; + ret += PAD + PAD; + } else if (leftbits == 4) { + ret += BASE[(leftchar & 15) << 2]; + ret += PAD; + } + return ret; + } + audio.src = + "data:audio/x-" + + name.substr(-3) + + ";base64," + + encode64(byteArray); + finish(audio); + }; + audio.src = url; + safeSetTimeout(function () { + finish(audio); + }, 1e4); + } else { + return fail(); + } + }; + Module["preloadPlugins"].push(audioPlugin); + function pointerLockChange() { + Browser.pointerLock = + document["pointerLockElement"] === Module["canvas"] || + document["mozPointerLockElement"] === Module["canvas"] || + document["webkitPointerLockElement"] === Module["canvas"] || + document["msPointerLockElement"] === Module["canvas"]; + } + var canvas = Module["canvas"]; + if (canvas) { + canvas.requestPointerLock = + canvas["requestPointerLock"] || + canvas["mozRequestPointerLock"] || + canvas["webkitRequestPointerLock"] || + canvas["msRequestPointerLock"] || + function () {}; + canvas.exitPointerLock = + document["exitPointerLock"] || + document["mozExitPointerLock"] || + document["webkitExitPointerLock"] || + document["msExitPointerLock"] || + function () {}; + canvas.exitPointerLock = canvas.exitPointerLock.bind(document); + document.addEventListener( + "pointerlockchange", + pointerLockChange, + false, + ); + document.addEventListener( + "mozpointerlockchange", + pointerLockChange, + false, + ); + document.addEventListener( + "webkitpointerlockchange", + pointerLockChange, + false, + ); + document.addEventListener( + "mspointerlockchange", + pointerLockChange, + false, + ); + if (Module["elementPointerLock"]) { + canvas.addEventListener( + "click", + function (ev) { + if ( + !Browser.pointerLock && + Module["canvas"].requestPointerLock + ) { + Module["canvas"].requestPointerLock(); + ev.preventDefault(); + } + }, + false, + ); + } + } + }, + handledByPreloadPlugin: function (byteArray, fullname, finish, onerror) { + Browser.init(); + var handled = false; + Module["preloadPlugins"].forEach(function (plugin) { + if (handled) return; + if (plugin["canHandle"](fullname)) { + plugin["handle"](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; + }, + createContext: function ( + canvas, + useWebGL, + setInModule, + webGLContextAttributes, + ) { + if (useWebGL && Module.ctx && canvas == Module.canvas) + return Module.ctx; + var ctx; + var contextHandle; + if (useWebGL) { + var contextAttributes = { + antialias: false, + alpha: false, + majorVersion: 1, + }; + if (webGLContextAttributes) { + for (var attribute in webGLContextAttributes) { + contextAttributes[attribute] = webGLContextAttributes[attribute]; + } + } + if (typeof GL != "undefined") { + contextHandle = GL.createContext(canvas, contextAttributes); + if (contextHandle) { + ctx = GL.getContext(contextHandle).GLctx; + } + } + } else { + ctx = canvas.getContext("2d"); + } + if (!ctx) return null; + if (setInModule) { + if (!useWebGL) + assert( + typeof GLctx == "undefined", + "cannot set in module if GLctx is used, but we are a non-GL context that would replace it", + ); + Module.ctx = ctx; + if (useWebGL) GL.makeContextCurrent(contextHandle); + Module.useWebGL = useWebGL; + Browser.moduleContextCreatedCallbacks.forEach(function (callback) { + callback(); + }); + Browser.init(); + } + return ctx; + }, + destroyContext: function (canvas, useWebGL, setInModule) {}, + fullscreenHandlersInstalled: false, + lockPointer: undefined, + resizeCanvas: undefined, + requestFullscreen: function (lockPointer, resizeCanvas) { + Browser.lockPointer = lockPointer; + Browser.resizeCanvas = resizeCanvas; + if (typeof Browser.lockPointer == "undefined") + Browser.lockPointer = true; + if (typeof Browser.resizeCanvas == "undefined") + Browser.resizeCanvas = false; + var canvas = Module["canvas"]; + function fullscreenChange() { + Browser.isFullscreen = false; + var canvasContainer = canvas.parentNode; + if ( + (document["fullscreenElement"] || + document["mozFullScreenElement"] || + document["msFullscreenElement"] || + document["webkitFullscreenElement"] || + document["webkitCurrentFullScreenElement"]) === canvasContainer + ) { + canvas.exitFullscreen = Browser.exitFullscreen; + if (Browser.lockPointer) canvas.requestPointerLock(); + Browser.isFullscreen = true; + if (Browser.resizeCanvas) { + Browser.setFullscreenCanvasSize(); + } else { + Browser.updateCanvasDimensions(canvas); + } + } else { + canvasContainer.parentNode.insertBefore(canvas, canvasContainer); + canvasContainer.parentNode.removeChild(canvasContainer); + if (Browser.resizeCanvas) { + Browser.setWindowedCanvasSize(); + } else { + Browser.updateCanvasDimensions(canvas); + } + } + if (Module["onFullScreen"]) + Module["onFullScreen"](Browser.isFullscreen); + if (Module["onFullscreen"]) + Module["onFullscreen"](Browser.isFullscreen); + } + if (!Browser.fullscreenHandlersInstalled) { + Browser.fullscreenHandlersInstalled = true; + document.addEventListener( + "fullscreenchange", + fullscreenChange, + false, + ); + document.addEventListener( + "mozfullscreenchange", + fullscreenChange, + false, + ); + document.addEventListener( + "webkitfullscreenchange", + fullscreenChange, + false, + ); + document.addEventListener( + "MSFullscreenChange", + fullscreenChange, + false, + ); + } + var canvasContainer = document.createElement("div"); + canvas.parentNode.insertBefore(canvasContainer, canvas); + canvasContainer.appendChild(canvas); + canvasContainer.requestFullscreen = + canvasContainer["requestFullscreen"] || + canvasContainer["mozRequestFullScreen"] || + canvasContainer["msRequestFullscreen"] || + (canvasContainer["webkitRequestFullscreen"] + ? function () { + canvasContainer["webkitRequestFullscreen"]( + Element["ALLOW_KEYBOARD_INPUT"], + ); + } + : null) || + (canvasContainer["webkitRequestFullScreen"] + ? function () { + canvasContainer["webkitRequestFullScreen"]( + Element["ALLOW_KEYBOARD_INPUT"], + ); + } + : null); + canvasContainer.requestFullscreen(); + }, + requestFullScreen: function () { + abort( + "Module.requestFullScreen has been replaced by Module.requestFullscreen (without a capital S)", + ); + }, + exitFullscreen: function () { + if (!Browser.isFullscreen) { + return false; + } + var CFS = + document["exitFullscreen"] || + document["cancelFullScreen"] || + document["mozCancelFullScreen"] || + document["msExitFullscreen"] || + document["webkitCancelFullScreen"] || + function () {}; + CFS.apply(document, []); + return true; + }, + nextRAF: 0, + fakeRequestAnimationFrame: function (func) { + var now = Date.now(); + if (Browser.nextRAF === 0) { + Browser.nextRAF = now + 1e3 / 60; + } else { + while (now + 2 >= Browser.nextRAF) { + Browser.nextRAF += 1e3 / 60; + } + } + var delay = Math.max(Browser.nextRAF - now, 0); + setTimeout(func, delay); + }, + requestAnimationFrame: function (func) { + if (typeof requestAnimationFrame == "function") { + requestAnimationFrame(func); + return; + } + var RAF = Browser.fakeRequestAnimationFrame; + RAF(func); + }, + safeSetTimeout: function (func) { + return safeSetTimeout(func); + }, + safeRequestAnimationFrame: function (func) { + return Browser.requestAnimationFrame(function () { + callUserCallback(func); + }); + }, + getMimetype: function (name) { + return { + jpg: "image/jpeg", + jpeg: "image/jpeg", + png: "image/png", + bmp: "image/bmp", + ogg: "audio/ogg", + wav: "audio/wav", + mp3: "audio/mpeg", + }[name.substr(name.lastIndexOf(".") + 1)]; + }, + getUserMedia: function (func) { + if (!window.getUserMedia) { + window.getUserMedia = + navigator["getUserMedia"] || navigator["mozGetUserMedia"]; + } + window.getUserMedia(func); + }, + getMovementX: function (event) { + return ( + event["movementX"] || + event["mozMovementX"] || + event["webkitMovementX"] || + 0 + ); + }, + getMovementY: function (event) { + return ( + event["movementY"] || + event["mozMovementY"] || + event["webkitMovementY"] || + 0 + ); + }, + getMouseWheelDelta: function (event) { + var delta = 0; + switch (event.type) { + case "DOMMouseScroll": + delta = event.detail / 3; + break; + case "mousewheel": + delta = event.wheelDelta / 120; + break; + case "wheel": + delta = event.deltaY; + switch (event.deltaMode) { + case 0: + delta /= 100; + break; + case 1: + delta /= 3; + break; + case 2: + delta *= 80; + break; + default: + throw "unrecognized mouse wheel delta mode: " + event.deltaMode; + } + break; + default: + throw "unrecognized mouse wheel event: " + event.type; + } + return delta; + }, + mouseX: 0, + mouseY: 0, + mouseMovementX: 0, + mouseMovementY: 0, + touches: {}, + lastTouches: {}, + calculateMouseEvent: function (event) { + if (Browser.pointerLock) { + if (event.type != "mousemove" && "mozMovementX" in event) { + Browser.mouseMovementX = Browser.mouseMovementY = 0; + } else { + Browser.mouseMovementX = Browser.getMovementX(event); + Browser.mouseMovementY = Browser.getMovementY(event); + } + if (typeof SDL != "undefined") { + Browser.mouseX = SDL.mouseX + Browser.mouseMovementX; + Browser.mouseY = SDL.mouseY + Browser.mouseMovementY; + } else { + Browser.mouseX += Browser.mouseMovementX; + Browser.mouseY += Browser.mouseMovementY; + } + } else { + var rect = Module["canvas"].getBoundingClientRect(); + var cw = Module["canvas"].width; + var ch = Module["canvas"].height; + var scrollX = + typeof window.scrollX != "undefined" + ? window.scrollX + : window.pageXOffset; + var scrollY = + typeof window.scrollY != "undefined" + ? window.scrollY + : window.pageYOffset; + assert( + typeof scrollX != "undefined" && typeof scrollY != "undefined", + "Unable to retrieve scroll position, mouse positions likely broken.", + ); + if ( + event.type === "touchstart" || + event.type === "touchend" || + event.type === "touchmove" + ) { + var touch = event.touch; + if (touch === undefined) { + return; + } + var adjustedX = touch.pageX - (scrollX + rect.left); + var adjustedY = touch.pageY - (scrollY + rect.top); + adjustedX = adjustedX * (cw / rect.width); + adjustedY = adjustedY * (ch / rect.height); + var coords = { x: adjustedX, y: adjustedY }; + if (event.type === "touchstart") { + Browser.lastTouches[touch.identifier] = coords; + Browser.touches[touch.identifier] = coords; + } else if ( + event.type === "touchend" || + event.type === "touchmove" + ) { + var last = Browser.touches[touch.identifier]; + if (!last) last = coords; + Browser.lastTouches[touch.identifier] = last; + Browser.touches[touch.identifier] = coords; + } + return; + } + var x = event.pageX - (scrollX + rect.left); + var y = event.pageY - (scrollY + rect.top); + x = x * (cw / rect.width); + y = y * (ch / rect.height); + Browser.mouseMovementX = x - Browser.mouseX; + Browser.mouseMovementY = y - Browser.mouseY; + Browser.mouseX = x; + Browser.mouseY = y; + } + }, + resizeListeners: [], + updateResizeListeners: function () { + var canvas = Module["canvas"]; + Browser.resizeListeners.forEach(function (listener) { + listener(canvas.width, canvas.height); + }); + }, + setCanvasSize: function (width, height, noUpdates) { + var canvas = Module["canvas"]; + Browser.updateCanvasDimensions(canvas, width, height); + if (!noUpdates) Browser.updateResizeListeners(); + }, + windowedWidth: 0, + windowedHeight: 0, + setFullscreenCanvasSize: function () { + if (typeof SDL != "undefined") { + var flags = HEAPU32[SDL.screen >> 2]; + flags = flags | 8388608; + HEAP32[SDL.screen >> 2] = flags; + } + Browser.updateCanvasDimensions(Module["canvas"]); + Browser.updateResizeListeners(); + }, + setWindowedCanvasSize: function () { + if (typeof SDL != "undefined") { + var flags = HEAPU32[SDL.screen >> 2]; + flags = flags & ~8388608; + HEAP32[SDL.screen >> 2] = flags; + } + Browser.updateCanvasDimensions(Module["canvas"]); + Browser.updateResizeListeners(); + }, + updateCanvasDimensions: function (canvas, wNative, hNative) { + if (wNative && hNative) { + canvas.widthNative = wNative; + canvas.heightNative = hNative; + } else { + wNative = canvas.widthNative; + hNative = canvas.heightNative; + } + var w = wNative; + var h = hNative; + if (Module["forcedAspectRatio"] && Module["forcedAspectRatio"] > 0) { + if (w / h < Module["forcedAspectRatio"]) { + w = Math.round(h * Module["forcedAspectRatio"]); + } else { + h = Math.round(w / Module["forcedAspectRatio"]); + } + } + if ( + (document["fullscreenElement"] || + document["mozFullScreenElement"] || + document["msFullscreenElement"] || + document["webkitFullscreenElement"] || + document["webkitCurrentFullScreenElement"]) === canvas.parentNode && + typeof screen != "undefined" + ) { + var factor = Math.min(screen.width / w, screen.height / h); + w = Math.round(w * factor); + h = Math.round(h * factor); + } + if (Browser.resizeCanvas) { + if (canvas.width != w) canvas.width = w; + if (canvas.height != h) canvas.height = h; + if (typeof canvas.style != "undefined") { + canvas.style.removeProperty("width"); + canvas.style.removeProperty("height"); + } + } else { + if (canvas.width != wNative) canvas.width = wNative; + if (canvas.height != hNative) canvas.height = hNative; + if (typeof canvas.style != "undefined") { + if (w != wNative || h != hNative) { + canvas.style.setProperty("width", w + "px", "important"); + canvas.style.setProperty("height", h + "px", "important"); + } else { + canvas.style.removeProperty("width"); + canvas.style.removeProperty("height"); + } + } + } + }, + }; + function _emscripten_memcpy_big(dest, src, num) { + HEAPU8.copyWithin(dest, src, src + num); + } + function _emscripten_get_heap_max() { + return 2147483648; + } + function emscripten_realloc_buffer(size) { + try { + wasmMemory.grow((size - buffer.byteLength + 65535) >>> 16); + updateGlobalBufferAndViews(wasmMemory.buffer); + return 1; + } catch (e) { + err( + "emscripten_realloc_buffer: Attempted to grow heap from " + + buffer.byteLength + + " bytes to " + + size + + " bytes, but got error: " + + e, + ); + } + } + function _emscripten_resize_heap(requestedSize) { + var oldSize = HEAPU8.length; + requestedSize = requestedSize >>> 0; + assert(requestedSize > oldSize); + var maxHeapSize = _emscripten_get_heap_max(); + if (requestedSize > maxHeapSize) { + err( + "Cannot enlarge memory, asked to go up to " + + requestedSize + + " bytes, but the limit is " + + maxHeapSize + + " bytes!", + ); + return false; + } + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); + overGrownHeapSize = Math.min( + overGrownHeapSize, + requestedSize + 100663296, + ); + var newSize = Math.min( + maxHeapSize, + alignUp(Math.max(requestedSize, overGrownHeapSize), 65536), + ); + var replacement = emscripten_realloc_buffer(newSize); + if (replacement) { + return true; + } + } + err( + "Failed to grow the heap from " + + oldSize + + " bytes to " + + newSize + + " bytes, not enough memory!", + ); + return false; + } + function _emscripten_run_script_int(ptr) { + return eval(UTF8ToString(ptr)) | 0; + } + function _emscripten_sleep(ms) { + Asyncify.handleSleep((wakeUp) => safeSetTimeout(wakeUp, ms)); + } + function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } + } + function _fd_read(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doReadv(stream, iov, iovcnt); + HEAP32[pnum >> 2] = num; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } + } + function _fd_seek(fd, offset_bigint, whence, newOffset) { + try { + var offset_low = Number(offset_bigint & BigInt(4294967295)) | 0, + offset_high = Number(offset_bigint >> BigInt(32)) | 0; + var stream = SYSCALLS.getStreamFromFD(fd); + var HIGH_OFFSET = 4294967296; + var offset = offset_high * HIGH_OFFSET + (offset_low >>> 0); + var DOUBLE_LIMIT = 9007199254740992; + if (offset <= -DOUBLE_LIMIT || offset >= DOUBLE_LIMIT) { + return -61; + } + FS.llseek(stream, offset, whence); + HEAP64[newOffset >> 3] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) + stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } + } + function _fd_write(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doWritev(stream, iov, iovcnt); + HEAP32[pnum >> 2] = num; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } + } + function _gettimeofday(ptr) { + var now = Date.now(); + HEAP32[ptr >> 2] = (now / 1e3) | 0; + HEAP32[(ptr + 4) >> 2] = ((now % 1e3) * 1e3) | 0; + return 0; + } + function _time(ptr) { + var ret = (Date.now() / 1e3) | 0; + if (ptr) { + HEAP32[ptr >> 2] = ret; + } + return ret; + } + function runAndAbortIfError(func) { + try { + return func(); + } catch (e) { + abort(e); + } + } + var Asyncify = { + State: { Normal: 0, Unwinding: 1, Rewinding: 2, Disabled: 3 }, + state: 0, + StackSize: 4096, + currData: null, + handleSleepReturnValue: 0, + exportCallStack: [], + callStackNameToId: {}, + callStackIdToName: {}, + callStackId: 0, + asyncPromiseHandlers: null, + sleepCallbacks: [], + getCallStackId: function (funcName) { + var id = Asyncify.callStackNameToId[funcName]; + if (id === undefined) { + id = Asyncify.callStackId++; + Asyncify.callStackNameToId[funcName] = id; + Asyncify.callStackIdToName[id] = funcName; + } + return id; + }, + instrumentWasmImports: function (imports) { + var ASYNCIFY_IMPORTS = [ + "env.invoke_*", + "env.emscripten_sleep", + "env.emscripten_wget", + "env.emscripten_wget_data", + "env.emscripten_idb_load", + "env.emscripten_idb_store", + "env.emscripten_idb_delete", + "env.emscripten_idb_exists", + "env.emscripten_idb_load_blob", + "env.emscripten_idb_store_blob", + "env.SDL_Delay", + "env.emscripten_scan_registers", + "env.emscripten_lazy_load_code", + "env.emscripten_fiber_swap", + "wasi_snapshot_preview1.fd_sync", + "env.__wasi_fd_sync", + "env._emval_await", + "env._dlopen_js", + "env.__asyncjs__*", + ].map((x) => x.split(".")[1]); + for (var x in imports) { + (function (x) { + var original = imports[x]; + if (typeof original == "function") { + imports[x] = function () { + var originalAsyncifyState = Asyncify.state; + try { + return original.apply(null, arguments); + } finally { + var isAsyncifyImport = + ASYNCIFY_IMPORTS.indexOf(x) >= 0 || + x.startsWith("__asyncjs__"); + var changedToDisabled = + originalAsyncifyState === Asyncify.State.Normal && + Asyncify.state === Asyncify.State.Disabled; + var ignoredInvoke = x.startsWith("invoke_") && true; + if ( + Asyncify.state !== originalAsyncifyState && + !isAsyncifyImport && + !changedToDisabled && + !ignoredInvoke + ) { + throw new Error( + "import " + + x + + " was not in ASYNCIFY_IMPORTS, but changed the state", + ); + } + } + }; + } + })(x); + } + }, + instrumentWasmExports: function (exports) { + var ret = {}; + for (var x in exports) { + (function (x) { + var original = exports[x]; + if (typeof original == "function") { + ret[x] = function () { + Asyncify.exportCallStack.push(x); + try { + return original.apply(null, arguments); + } finally { + if (!ABORT) { + var y = Asyncify.exportCallStack.pop(); + assert(y === x); + Asyncify.maybeStopUnwind(); + } + } + }; + } else { + ret[x] = original; + } + })(x); + } + return ret; + }, + maybeStopUnwind: function () { + if ( + Asyncify.currData && + Asyncify.state === Asyncify.State.Unwinding && + Asyncify.exportCallStack.length === 0 + ) { + Asyncify.state = Asyncify.State.Normal; + runAndAbortIfError(Module["_asyncify_stop_unwind"]); + if (typeof Fibers != "undefined") { + Fibers.trampoline(); + } + } + }, + whenDone: function () { + assert( + Asyncify.currData, + "Tried to wait for an async operation when none is in progress.", + ); + assert( + !Asyncify.asyncPromiseHandlers, + "Cannot have multiple async operations in flight at once", + ); + return new Promise((resolve, reject) => { + Asyncify.asyncPromiseHandlers = { resolve: resolve, reject: reject }; + }); + }, + allocateData: function () { + var ptr = _malloc(12 + Asyncify.StackSize); + Asyncify.setDataHeader(ptr, ptr + 12, Asyncify.StackSize); + Asyncify.setDataRewindFunc(ptr); + return ptr; + }, + setDataHeader: function (ptr, stack, stackSize) { + HEAP32[ptr >> 2] = stack; + HEAP32[(ptr + 4) >> 2] = stack + stackSize; + }, + setDataRewindFunc: function (ptr) { + var bottomOfCallStack = Asyncify.exportCallStack[0]; + var rewindId = Asyncify.getCallStackId(bottomOfCallStack); + HEAP32[(ptr + 8) >> 2] = rewindId; + }, + getDataRewindFunc: function (ptr) { + var id = HEAP32[(ptr + 8) >> 2]; + var name = Asyncify.callStackIdToName[id]; + var func = Module["asm"][name]; + return func; + }, + doRewind: function (ptr) { + var start = Asyncify.getDataRewindFunc(ptr); + return start(); + }, + handleSleep: function (startAsync) { + assert( + Asyncify.state !== Asyncify.State.Disabled, + "Asyncify cannot be done during or after the runtime exits", + ); + if (ABORT) return; + if (Asyncify.state === Asyncify.State.Normal) { + var reachedCallback = false; + var reachedAfterCallback = false; + startAsync((handleSleepReturnValue) => { + assert( + !handleSleepReturnValue || + typeof handleSleepReturnValue == "number" || + typeof handleSleepReturnValue == "boolean", + ); + if (ABORT) return; + Asyncify.handleSleepReturnValue = handleSleepReturnValue || 0; + reachedCallback = true; + if (!reachedAfterCallback) { + return; + } + assert( + !Asyncify.exportCallStack.length, + "Waking up (starting to rewind) must be done from JS, without compiled code on the stack.", + ); + Asyncify.state = Asyncify.State.Rewinding; + runAndAbortIfError(() => + Module["_asyncify_start_rewind"](Asyncify.currData), + ); + if (typeof Browser != "undefined" && Browser.mainLoop.func) { + Browser.mainLoop.resume(); + } + var asyncWasmReturnValue, + isError = false; + try { + asyncWasmReturnValue = Asyncify.doRewind(Asyncify.currData); + } catch (err) { + asyncWasmReturnValue = err; + isError = true; + } + var handled = false; + if (!Asyncify.currData) { + var asyncPromiseHandlers = Asyncify.asyncPromiseHandlers; + if (asyncPromiseHandlers) { + Asyncify.asyncPromiseHandlers = null; + (isError + ? asyncPromiseHandlers.reject + : asyncPromiseHandlers.resolve)(asyncWasmReturnValue); + handled = true; + } + } + if (isError && !handled) { + throw asyncWasmReturnValue; + } + }); + reachedAfterCallback = true; + if (!reachedCallback) { + Asyncify.state = Asyncify.State.Unwinding; + Asyncify.currData = Asyncify.allocateData(); + runAndAbortIfError(() => + Module["_asyncify_start_unwind"](Asyncify.currData), + ); + if (typeof Browser != "undefined" && Browser.mainLoop.func) { + Browser.mainLoop.pause(); + } + } + } else if (Asyncify.state === Asyncify.State.Rewinding) { + Asyncify.state = Asyncify.State.Normal; + runAndAbortIfError(Module["_asyncify_stop_rewind"]); + _free(Asyncify.currData); + Asyncify.currData = null; + Asyncify.sleepCallbacks.forEach((func) => callUserCallback(func)); + } else { + abort("invalid state: " + Asyncify.state); + } + return Asyncify.handleSleepReturnValue; + }, + handleAsync: function (startAsync) { + return Asyncify.handleSleep((wakeUp) => { + startAsync().then(wakeUp); + }); + }, + }; + var FSNode = function (parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; + }; + var readMode = 292 | 73; + var writeMode = 146; + Object.defineProperties(FSNode.prototype, { + read: { + get: function () { + return (this.mode & readMode) === readMode; + }, + set: function (val) { + val ? (this.mode |= readMode) : (this.mode &= ~readMode); + }, + }, + write: { + get: function () { + return (this.mode & writeMode) === writeMode; + }, + set: function (val) { + val ? (this.mode |= writeMode) : (this.mode &= ~writeMode); + }, + }, + isFolder: { + get: function () { + return FS.isDir(this.mode); + }, + }, + isDevice: { + get: function () { + return FS.isChrdev(this.mode); + }, + }, + }); + FS.FSNode = FSNode; + FS.staticInit(); + ERRNO_CODES = { + EPERM: 63, + ENOENT: 44, + ESRCH: 71, + EINTR: 27, + EIO: 29, + ENXIO: 60, + E2BIG: 1, + ENOEXEC: 45, + EBADF: 8, + ECHILD: 12, + EAGAIN: 6, + EWOULDBLOCK: 6, + ENOMEM: 48, + EACCES: 2, + EFAULT: 21, + ENOTBLK: 105, + EBUSY: 10, + EEXIST: 20, + EXDEV: 75, + ENODEV: 43, + ENOTDIR: 54, + EISDIR: 31, + EINVAL: 28, + ENFILE: 41, + EMFILE: 33, + ENOTTY: 59, + ETXTBSY: 74, + EFBIG: 22, + ENOSPC: 51, + ESPIPE: 70, + EROFS: 69, + EMLINK: 34, + EPIPE: 64, + EDOM: 18, + ERANGE: 68, + ENOMSG: 49, + EIDRM: 24, + ECHRNG: 106, + EL2NSYNC: 156, + EL3HLT: 107, + EL3RST: 108, + ELNRNG: 109, + EUNATCH: 110, + ENOCSI: 111, + EL2HLT: 112, + EDEADLK: 16, + ENOLCK: 46, + EBADE: 113, + EBADR: 114, + EXFULL: 115, + ENOANO: 104, + EBADRQC: 103, + EBADSLT: 102, + EDEADLOCK: 16, + EBFONT: 101, + ENOSTR: 100, + ENODATA: 116, + ETIME: 117, + ENOSR: 118, + ENONET: 119, + ENOPKG: 120, + EREMOTE: 121, + ENOLINK: 47, + EADV: 122, + ESRMNT: 123, + ECOMM: 124, + EPROTO: 65, + EMULTIHOP: 36, + EDOTDOT: 125, + EBADMSG: 9, + ENOTUNIQ: 126, + EBADFD: 127, + EREMCHG: 128, + ELIBACC: 129, + ELIBBAD: 130, + ELIBSCN: 131, + ELIBMAX: 132, + ELIBEXEC: 133, + ENOSYS: 52, + ENOTEMPTY: 55, + ENAMETOOLONG: 37, + ELOOP: 32, + EOPNOTSUPP: 138, + EPFNOSUPPORT: 139, + ECONNRESET: 15, + ENOBUFS: 42, + EAFNOSUPPORT: 5, + EPROTOTYPE: 67, + ENOTSOCK: 57, + ENOPROTOOPT: 50, + ESHUTDOWN: 140, + ECONNREFUSED: 14, + EADDRINUSE: 3, + ECONNABORTED: 13, + ENETUNREACH: 40, + ENETDOWN: 38, + ETIMEDOUT: 73, + EHOSTDOWN: 142, + EHOSTUNREACH: 23, + EINPROGRESS: 26, + EALREADY: 7, + EDESTADDRREQ: 17, + EMSGSIZE: 35, + EPROTONOSUPPORT: 66, + ESOCKTNOSUPPORT: 137, + EADDRNOTAVAIL: 4, + ENETRESET: 39, + EISCONN: 30, + ENOTCONN: 53, + ETOOMANYREFS: 141, + EUSERS: 136, + EDQUOT: 19, + ESTALE: 72, + ENOTSUP: 138, + ENOMEDIUM: 148, + EILSEQ: 25, + EOVERFLOW: 61, + ECANCELED: 11, + ENOTRECOVERABLE: 56, + EOWNERDEAD: 62, + ESTRPIPE: 135, + }; + Module["requestFullscreen"] = function Module_requestFullscreen( + lockPointer, + resizeCanvas, + ) { + Browser.requestFullscreen(lockPointer, resizeCanvas); + }; + Module["requestFullScreen"] = function Module_requestFullScreen() { + Browser.requestFullScreen(); + }; + Module["requestAnimationFrame"] = function Module_requestAnimationFrame( + func, + ) { + Browser.requestAnimationFrame(func); + }; + Module["setCanvasSize"] = function Module_setCanvasSize( + width, + height, + noUpdates, + ) { + Browser.setCanvasSize(width, height, noUpdates); + }; + Module["pauseMainLoop"] = function Module_pauseMainLoop() { + Browser.mainLoop.pause(); + }; + Module["resumeMainLoop"] = function Module_resumeMainLoop() { + Browser.mainLoop.resume(); + }; + Module["getUserMedia"] = function Module_getUserMedia() { + Browser.getUserMedia(); + }; + Module["createContext"] = function Module_createContext( + canvas, + useWebGL, + setInModule, + webGLContextAttributes, + ) { + return Browser.createContext( + canvas, + useWebGL, + setInModule, + webGLContextAttributes, + ); + }; + var ASSERTIONS = true; + function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array( + stringy, + u8array, + 0, + u8array.length, + ); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; + } + var asmLibraryArg = { + __assert_fail: ___assert_fail, + __syscall_fcntl64: ___syscall_fcntl64, + __syscall_fstat64: ___syscall_fstat64, + __syscall_ioctl: ___syscall_ioctl, + __syscall_open: ___syscall_open, + _mmap_js: __mmap_js, + _munmap_js: __munmap_js, + abort: _abort, + emscripten_memcpy_big: _emscripten_memcpy_big, + emscripten_resize_heap: _emscripten_resize_heap, + emscripten_run_script_int: _emscripten_run_script_int, + emscripten_sleep: _emscripten_sleep, + exit: _exit, + fd_close: _fd_close, + fd_read: _fd_read, + fd_seek: _fd_seek, + fd_write: _fd_write, + gettimeofday: _gettimeofday, + time: _time, + }; + Asyncify.instrumentWasmImports(asmLibraryArg); + var asm = createWasm(); + var ___wasm_call_ctors = (Module["___wasm_call_ctors"] = + createExportWrapper("__wasm_call_ctors")); + var _malloc = (Module["_malloc"] = createExportWrapper("malloc")); + var _free = (Module["_free"] = createExportWrapper("free")); + var _send_int_to_C = (Module["_send_int_to_C"] = + createExportWrapper("send_int_to_C")); + var _send_float_to_C = (Module["_send_float_to_C"] = + createExportWrapper("send_float_to_C")); + var _send_double_to_C = (Module["_send_double_to_C"] = + createExportWrapper("send_double_to_C")); + var _send_char_to_C = (Module["_send_char_to_C"] = + createExportWrapper("send_char_to_C")); + var _send_string_to_C = (Module["_send_string_to_C"] = + createExportWrapper("send_string_to_C")); + var _reanudar_ejecucion = (Module["_reanudar_ejecucion"] = + createExportWrapper("reanudar_ejecucion")); + var ___errno_location = (Module["___errno_location"] = + createExportWrapper("__errno_location")); + var _main = (Module["_main"] = createExportWrapper("main")); + var ___stdio_exit = (Module["___stdio_exit"] = + createExportWrapper("__stdio_exit")); + var _emscripten_builtin_memalign = (Module["_emscripten_builtin_memalign"] = + createExportWrapper("emscripten_builtin_memalign")); + var _emscripten_stack_init = (Module["_emscripten_stack_init"] = + function () { + return (_emscripten_stack_init = Module["_emscripten_stack_init"] = + Module["asm"]["emscripten_stack_init"]).apply(null, arguments); + }); + var _emscripten_stack_set_limits = (Module["_emscripten_stack_set_limits"] = + function () { + return (_emscripten_stack_set_limits = Module[ + "_emscripten_stack_set_limits" + ] = + Module["asm"]["emscripten_stack_set_limits"]).apply(null, arguments); + }); + var _emscripten_stack_get_free = (Module["_emscripten_stack_get_free"] = + function () { + return (_emscripten_stack_get_free = Module[ + "_emscripten_stack_get_free" + ] = + Module["asm"]["emscripten_stack_get_free"]).apply(null, arguments); + }); + var _emscripten_stack_get_base = (Module["_emscripten_stack_get_base"] = + function () { + return (_emscripten_stack_get_base = Module[ + "_emscripten_stack_get_base" + ] = + Module["asm"]["emscripten_stack_get_base"]).apply(null, arguments); + }); + var _emscripten_stack_get_end = (Module["_emscripten_stack_get_end"] = + function () { + return (_emscripten_stack_get_end = Module[ + "_emscripten_stack_get_end" + ] = + Module["asm"]["emscripten_stack_get_end"]).apply(null, arguments); + }); + var stackSave = (Module["stackSave"] = createExportWrapper("stackSave")); + var stackRestore = (Module["stackRestore"] = + createExportWrapper("stackRestore")); + var stackAlloc = (Module["stackAlloc"] = createExportWrapper("stackAlloc")); + var dynCall_ii = (Module["dynCall_ii"] = createExportWrapper("dynCall_ii")); + var dynCall_iiii = (Module["dynCall_iiii"] = + createExportWrapper("dynCall_iiii")); + var dynCall_vii = (Module["dynCall_vii"] = + createExportWrapper("dynCall_vii")); + var dynCall_jiji = (Module["dynCall_jiji"] = + createExportWrapper("dynCall_jiji")); + var dynCall_iidiiii = (Module["dynCall_iidiiii"] = + createExportWrapper("dynCall_iidiiii")); + var _asyncify_start_unwind = (Module["_asyncify_start_unwind"] = + createExportWrapper("asyncify_start_unwind")); + var _asyncify_stop_unwind = (Module["_asyncify_stop_unwind"] = + createExportWrapper("asyncify_stop_unwind")); + var _asyncify_start_rewind = (Module["_asyncify_start_rewind"] = + createExportWrapper("asyncify_start_rewind")); + var _asyncify_stop_rewind = (Module["_asyncify_stop_rewind"] = + createExportWrapper("asyncify_stop_rewind")); + if (!Object.getOwnPropertyDescriptor(Module, "intArrayFromString")) + Module["intArrayFromString"] = () => + abort( + "'intArrayFromString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "intArrayToString")) + Module["intArrayToString"] = () => + abort( + "'intArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + Module["ccall"] = ccall; + if (!Object.getOwnPropertyDescriptor(Module, "cwrap")) + Module["cwrap"] = () => + abort( + "'cwrap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setValue")) + Module["setValue"] = () => + abort( + "'setValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getValue")) + Module["getValue"] = () => + abort( + "'getValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "allocate")) + Module["allocate"] = () => + abort( + "'allocate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "UTF8ArrayToString")) + Module["UTF8ArrayToString"] = () => + abort( + "'UTF8ArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "UTF8ToString")) + Module["UTF8ToString"] = () => + abort( + "'UTF8ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8Array")) + Module["stringToUTF8Array"] = () => + abort( + "'stringToUTF8Array' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + + Module["stringToUTF8"] = stringToUTF8; + Module["lengthBytesUTF8"] = lengthBytesUTF8; + if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) + Module["stackTrace"] = () => + abort( + "'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "addOnPreRun")) + Module["addOnPreRun"] = () => + abort( + "'addOnPreRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "addOnInit")) + Module["addOnInit"] = () => + abort( + "'addOnInit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "addOnPreMain")) + Module["addOnPreMain"] = () => + abort( + "'addOnPreMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "addOnExit")) + Module["addOnExit"] = () => + abort( + "'addOnExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "addOnPostRun")) + Module["addOnPostRun"] = () => + abort( + "'addOnPostRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeStringToMemory")) + Module["writeStringToMemory"] = () => + abort( + "'writeStringToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeArrayToMemory")) + Module["writeArrayToMemory"] = () => + abort( + "'writeArrayToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeAsciiToMemory")) + Module["writeAsciiToMemory"] = () => + abort( + "'writeAsciiToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "addRunDependency")) + Module["addRunDependency"] = () => + abort( + "'addRunDependency' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "removeRunDependency")) + Module["removeRunDependency"] = () => + abort( + "'removeRunDependency' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_createFolder")) + Module["FS_createFolder"] = () => + abort( + "'FS_createFolder' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_createPath")) + Module["FS_createPath"] = () => + abort( + "'FS_createPath' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_createDataFile")) + Module["FS_createDataFile"] = () => + abort( + "'FS_createDataFile' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_createPreloadedFile")) + Module["FS_createPreloadedFile"] = () => + abort( + "'FS_createPreloadedFile' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_createLazyFile")) + Module["FS_createLazyFile"] = () => + abort( + "'FS_createLazyFile' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_createLink")) + Module["FS_createLink"] = () => + abort( + "'FS_createLink' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_createDevice")) + Module["FS_createDevice"] = () => + abort( + "'FS_createDevice' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_unlink")) + Module["FS_unlink"] = () => + abort( + "'FS_unlink' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getLEB")) + Module["getLEB"] = () => + abort( + "'getLEB' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getFunctionTables")) + Module["getFunctionTables"] = () => + abort( + "'getFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "alignFunctionTables")) + Module["alignFunctionTables"] = () => + abort( + "'alignFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerFunctions")) + Module["registerFunctions"] = () => + abort( + "'registerFunctions' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "addFunction")) + Module["addFunction"] = () => + abort( + "'addFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "removeFunction")) + Module["removeFunction"] = () => + abort( + "'removeFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) + Module["getFuncWrapper"] = () => + abort( + "'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "prettyPrint")) + Module["prettyPrint"] = () => + abort( + "'prettyPrint' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) + Module["dynCall"] = () => + abort( + "'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getCompilerSetting")) + Module["getCompilerSetting"] = () => + abort( + "'getCompilerSetting' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "print")) + Module["print"] = () => + abort( + "'print' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "printErr")) + Module["printErr"] = () => + abort( + "'printErr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getTempRet0")) + Module["getTempRet0"] = () => + abort( + "'getTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setTempRet0")) + Module["setTempRet0"] = () => + abort( + "'setTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + Module["callMain"] = callMain; + if (!Object.getOwnPropertyDescriptor(Module, "abort")) + Module["abort"] = () => + abort( + "'abort' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "keepRuntimeAlive")) + Module["keepRuntimeAlive"] = () => + abort( + "'keepRuntimeAlive' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "zeroMemory")) + Module["zeroMemory"] = () => + abort( + "'zeroMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stringToNewUTF8")) + Module["stringToNewUTF8"] = () => + abort( + "'stringToNewUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "emscripten_realloc_buffer")) + Module["emscripten_realloc_buffer"] = () => + abort( + "'emscripten_realloc_buffer' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "ENV")) + Module["ENV"] = () => + abort( + "'ENV' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "withStackSave")) + Module["withStackSave"] = () => + abort( + "'withStackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_CODES")) + Module["ERRNO_CODES"] = () => + abort( + "'ERRNO_CODES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_MESSAGES")) + Module["ERRNO_MESSAGES"] = () => + abort( + "'ERRNO_MESSAGES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setErrNo")) + Module["setErrNo"] = () => + abort( + "'setErrNo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "inetPton4")) + Module["inetPton4"] = () => + abort( + "'inetPton4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "inetNtop4")) + Module["inetNtop4"] = () => + abort( + "'inetNtop4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "inetPton6")) + Module["inetPton6"] = () => + abort( + "'inetPton6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "inetNtop6")) + Module["inetNtop6"] = () => + abort( + "'inetNtop6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "readSockaddr")) + Module["readSockaddr"] = () => + abort( + "'readSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeSockaddr")) + Module["writeSockaddr"] = () => + abort( + "'writeSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "DNS")) + Module["DNS"] = () => + abort( + "'DNS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getHostByName")) + Module["getHostByName"] = () => + abort( + "'getHostByName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "Protocols")) + Module["Protocols"] = () => + abort( + "'Protocols' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "Sockets")) + Module["Sockets"] = () => + abort( + "'Sockets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getRandomDevice")) + Module["getRandomDevice"] = () => + abort( + "'getRandomDevice' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "traverseStack")) + Module["traverseStack"] = () => + abort( + "'traverseStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "convertFrameToPC")) + Module["convertFrameToPC"] = () => + abort( + "'convertFrameToPC' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "UNWIND_CACHE")) + Module["UNWIND_CACHE"] = () => + abort( + "'UNWIND_CACHE' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "saveInUnwindCache")) + Module["saveInUnwindCache"] = () => + abort( + "'saveInUnwindCache' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "convertPCtoSourceLocation")) + Module["convertPCtoSourceLocation"] = () => + abort( + "'convertPCtoSourceLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgsArray")) + Module["readAsmConstArgsArray"] = () => + abort( + "'readAsmConstArgsArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgs")) + Module["readAsmConstArgs"] = () => + abort( + "'readAsmConstArgs' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "mainThreadEM_ASM")) + Module["mainThreadEM_ASM"] = () => + abort( + "'mainThreadEM_ASM' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "jstoi_q")) + Module["jstoi_q"] = () => + abort( + "'jstoi_q' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "jstoi_s")) + Module["jstoi_s"] = () => + abort( + "'jstoi_s' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getExecutableName")) + Module["getExecutableName"] = () => + abort( + "'getExecutableName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "listenOnce")) + Module["listenOnce"] = () => + abort( + "'listenOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "autoResumeAudioContext")) + Module["autoResumeAudioContext"] = () => + abort( + "'autoResumeAudioContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "dynCallLegacy")) + Module["dynCallLegacy"] = () => + abort( + "'dynCallLegacy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getDynCaller")) + Module["getDynCaller"] = () => + abort( + "'getDynCaller' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) + Module["dynCall"] = () => + abort( + "'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "callRuntimeCallbacks")) + Module["callRuntimeCallbacks"] = () => + abort( + "'callRuntimeCallbacks' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "wasmTableMirror")) + Module["wasmTableMirror"] = () => + abort( + "'wasmTableMirror' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setWasmTableEntry")) + Module["setWasmTableEntry"] = () => + abort( + "'setWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getWasmTableEntry")) + Module["getWasmTableEntry"] = () => + abort( + "'getWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "handleException")) + Module["handleException"] = () => + abort( + "'handleException' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePush")) + Module["runtimeKeepalivePush"] = () => + abort( + "'runtimeKeepalivePush' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePop")) + Module["runtimeKeepalivePop"] = () => + abort( + "'runtimeKeepalivePop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "callUserCallback")) + Module["callUserCallback"] = () => + abort( + "'callUserCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "maybeExit")) + Module["maybeExit"] = () => + abort( + "'maybeExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "safeSetTimeout")) + Module["safeSetTimeout"] = () => + abort( + "'safeSetTimeout' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "asmjsMangle")) + Module["asmjsMangle"] = () => + abort( + "'asmjsMangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "asyncLoad")) + Module["asyncLoad"] = () => + abort( + "'asyncLoad' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "alignMemory")) + Module["alignMemory"] = () => + abort( + "'alignMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "mmapAlloc")) + Module["mmapAlloc"] = () => + abort( + "'mmapAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "reallyNegative")) + Module["reallyNegative"] = () => + abort( + "'reallyNegative' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "unSign")) + Module["unSign"] = () => + abort( + "'unSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "reSign")) + Module["reSign"] = () => + abort( + "'reSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "formatString")) + Module["formatString"] = () => + abort( + "'formatString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "PATH")) + Module["PATH"] = () => + abort( + "'PATH' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "PATH_FS")) + Module["PATH_FS"] = () => + abort( + "'PATH_FS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "SYSCALLS")) + Module["SYSCALLS"] = () => + abort( + "'SYSCALLS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getSocketFromFD")) + Module["getSocketFromFD"] = () => + abort( + "'getSocketFromFD' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getSocketAddress")) + Module["getSocketAddress"] = () => + abort( + "'getSocketAddress' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "JSEvents")) + Module["JSEvents"] = () => + abort( + "'JSEvents' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerKeyEventCallback")) + Module["registerKeyEventCallback"] = () => + abort( + "'registerKeyEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "specialHTMLTargets")) + Module["specialHTMLTargets"] = () => + abort( + "'specialHTMLTargets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "maybeCStringToJsString")) + Module["maybeCStringToJsString"] = () => + abort( + "'maybeCStringToJsString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "findEventTarget")) + Module["findEventTarget"] = () => + abort( + "'findEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "findCanvasEventTarget")) + Module["findCanvasEventTarget"] = () => + abort( + "'findCanvasEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getBoundingClientRect")) + Module["getBoundingClientRect"] = () => + abort( + "'getBoundingClientRect' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "fillMouseEventData")) + Module["fillMouseEventData"] = () => + abort( + "'fillMouseEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerMouseEventCallback")) + Module["registerMouseEventCallback"] = () => + abort( + "'registerMouseEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerWheelEventCallback")) + Module["registerWheelEventCallback"] = () => + abort( + "'registerWheelEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerUiEventCallback")) + Module["registerUiEventCallback"] = () => + abort( + "'registerUiEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerFocusEventCallback")) + Module["registerFocusEventCallback"] = () => + abort( + "'registerFocusEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "fillDeviceOrientationEventData") + ) + Module["fillDeviceOrientationEventData"] = () => + abort( + "'fillDeviceOrientationEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerDeviceOrientationEventCallback", + ) + ) + Module["registerDeviceOrientationEventCallback"] = () => + abort( + "'registerDeviceOrientationEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceMotionEventData")) + Module["fillDeviceMotionEventData"] = () => + abort( + "'fillDeviceMotionEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerDeviceMotionEventCallback", + ) + ) + Module["registerDeviceMotionEventCallback"] = () => + abort( + "'registerDeviceMotionEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "screenOrientation")) + Module["screenOrientation"] = () => + abort( + "'screenOrientation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "fillOrientationChangeEventData") + ) + Module["fillOrientationChangeEventData"] = () => + abort( + "'fillOrientationChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerOrientationChangeEventCallback", + ) + ) + Module["registerOrientationChangeEventCallback"] = () => + abort( + "'registerOrientationChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "fillFullscreenChangeEventData") + ) + Module["fillFullscreenChangeEventData"] = () => + abort( + "'fillFullscreenChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerFullscreenChangeEventCallback", + ) + ) + Module["registerFullscreenChangeEventCallback"] = () => + abort( + "'registerFullscreenChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerRestoreOldStyle")) + Module["registerRestoreOldStyle"] = () => + abort( + "'registerRestoreOldStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "hideEverythingExceptGivenElement", + ) + ) + Module["hideEverythingExceptGivenElement"] = () => + abort( + "'hideEverythingExceptGivenElement' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "restoreHiddenElements")) + Module["restoreHiddenElements"] = () => + abort( + "'restoreHiddenElements' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setLetterbox")) + Module["setLetterbox"] = () => + abort( + "'setLetterbox' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "currentFullscreenStrategy")) + Module["currentFullscreenStrategy"] = () => + abort( + "'currentFullscreenStrategy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "restoreOldWindowedStyle")) + Module["restoreOldWindowedStyle"] = () => + abort( + "'restoreOldWindowedStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "softFullscreenResizeWebGLRenderTarget", + ) + ) + Module["softFullscreenResizeWebGLRenderTarget"] = () => + abort( + "'softFullscreenResizeWebGLRenderTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "doRequestFullscreen")) + Module["doRequestFullscreen"] = () => + abort( + "'doRequestFullscreen' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "fillPointerlockChangeEventData") + ) + Module["fillPointerlockChangeEventData"] = () => + abort( + "'fillPointerlockChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerPointerlockChangeEventCallback", + ) + ) + Module["registerPointerlockChangeEventCallback"] = () => + abort( + "'registerPointerlockChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerPointerlockErrorEventCallback", + ) + ) + Module["registerPointerlockErrorEventCallback"] = () => + abort( + "'registerPointerlockErrorEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "requestPointerLock")) + Module["requestPointerLock"] = () => + abort( + "'requestPointerLock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "fillVisibilityChangeEventData") + ) + Module["fillVisibilityChangeEventData"] = () => + abort( + "'fillVisibilityChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerVisibilityChangeEventCallback", + ) + ) + Module["registerVisibilityChangeEventCallback"] = () => + abort( + "'registerVisibilityChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerTouchEventCallback")) + Module["registerTouchEventCallback"] = () => + abort( + "'registerTouchEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "fillGamepadEventData")) + Module["fillGamepadEventData"] = () => + abort( + "'fillGamepadEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "registerGamepadEventCallback") + ) + Module["registerGamepadEventCallback"] = () => + abort( + "'registerGamepadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerBeforeUnloadEventCallback", + ) + ) + Module["registerBeforeUnloadEventCallback"] = () => + abort( + "'registerBeforeUnloadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "fillBatteryEventData")) + Module["fillBatteryEventData"] = () => + abort( + "'fillBatteryEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "battery")) + Module["battery"] = () => + abort( + "'battery' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "registerBatteryEventCallback") + ) + Module["registerBatteryEventCallback"] = () => + abort( + "'registerBatteryEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setCanvasElementSize")) + Module["setCanvasElementSize"] = () => + abort( + "'setCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getCanvasElementSize")) + Module["getCanvasElementSize"] = () => + abort( + "'getCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "demangle")) + Module["demangle"] = () => + abort( + "'demangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "demangleAll")) + Module["demangleAll"] = () => + abort( + "'demangleAll' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "jsStackTrace")) + Module["jsStackTrace"] = () => + abort( + "'jsStackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) + Module["stackTrace"] = () => + abort( + "'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getEnvStrings")) + Module["getEnvStrings"] = () => + abort( + "'getEnvStrings' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "checkWasiClock")) + Module["checkWasiClock"] = () => + abort( + "'checkWasiClock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64")) + Module["writeI53ToI64"] = () => + abort( + "'writeI53ToI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Clamped")) + Module["writeI53ToI64Clamped"] = () => + abort( + "'writeI53ToI64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Signaling")) + Module["writeI53ToI64Signaling"] = () => + abort( + "'writeI53ToI64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Clamped")) + Module["writeI53ToU64Clamped"] = () => + abort( + "'writeI53ToU64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Signaling")) + Module["writeI53ToU64Signaling"] = () => + abort( + "'writeI53ToU64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "readI53FromI64")) + Module["readI53FromI64"] = () => + abort( + "'readI53FromI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "readI53FromU64")) + Module["readI53FromU64"] = () => + abort( + "'readI53FromU64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "convertI32PairToI53")) + Module["convertI32PairToI53"] = () => + abort( + "'convertI32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "convertU32PairToI53")) + Module["convertU32PairToI53"] = () => + abort( + "'convertU32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setImmediateWrapped")) + Module["setImmediateWrapped"] = () => + abort( + "'setImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "clearImmediateWrapped")) + Module["clearImmediateWrapped"] = () => + abort( + "'clearImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "polyfillSetImmediate")) + Module["polyfillSetImmediate"] = () => + abort( + "'polyfillSetImmediate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "uncaughtExceptionCount")) + Module["uncaughtExceptionCount"] = () => + abort( + "'uncaughtExceptionCount' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "exceptionLast")) + Module["exceptionLast"] = () => + abort( + "'exceptionLast' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "exceptionCaught")) + Module["exceptionCaught"] = () => + abort( + "'exceptionCaught' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "ExceptionInfo")) + Module["ExceptionInfo"] = () => + abort( + "'ExceptionInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "CatchInfo")) + Module["CatchInfo"] = () => + abort( + "'CatchInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "exception_addRef")) + Module["exception_addRef"] = () => + abort( + "'exception_addRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "exception_decRef")) + Module["exception_decRef"] = () => + abort( + "'exception_decRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "Browser")) + Module["Browser"] = () => + abort( + "'Browser' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "funcWrappers")) + Module["funcWrappers"] = () => + abort( + "'funcWrappers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) + Module["getFuncWrapper"] = () => + abort( + "'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setMainLoop")) + Module["setMainLoop"] = () => + abort( + "'setMainLoop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "wget")) + Module["wget"] = () => + abort( + "'wget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS")) + Module["FS"] = () => + abort( + "'FS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "MEMFS")) + Module["MEMFS"] = () => + abort( + "'MEMFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "TTY")) + Module["TTY"] = () => + abort( + "'TTY' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "PIPEFS")) + Module["PIPEFS"] = () => + abort( + "'PIPEFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "SOCKFS")) + Module["SOCKFS"] = () => + abort( + "'SOCKFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "_setNetworkCallback")) + Module["_setNetworkCallback"] = () => + abort( + "'_setNetworkCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "tempFixedLengthArray")) + Module["tempFixedLengthArray"] = () => + abort( + "'tempFixedLengthArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "miniTempWebGLFloatBuffers")) + Module["miniTempWebGLFloatBuffers"] = () => + abort( + "'miniTempWebGLFloatBuffers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "heapObjectForWebGLType")) + Module["heapObjectForWebGLType"] = () => + abort( + "'heapObjectForWebGLType' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "heapAccessShiftForWebGLHeap")) + Module["heapAccessShiftForWebGLHeap"] = () => + abort( + "'heapAccessShiftForWebGLHeap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "GL")) + Module["GL"] = () => + abort( + "'GL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGet")) + Module["emscriptenWebGLGet"] = () => + abort( + "'emscriptenWebGLGet' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "computeUnpackAlignedImageSize") + ) + Module["computeUnpackAlignedImageSize"] = () => + abort( + "'computeUnpackAlignedImageSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetTexPixelData") + ) + Module["emscriptenWebGLGetTexPixelData"] = () => + abort( + "'emscriptenWebGLGetTexPixelData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetUniform")) + Module["emscriptenWebGLGetUniform"] = () => + abort( + "'emscriptenWebGLGetUniform' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "webglGetUniformLocation")) + Module["webglGetUniformLocation"] = () => + abort( + "'webglGetUniformLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "webglPrepareUniformLocationsBeforeFirstUse", + ) + ) + Module["webglPrepareUniformLocationsBeforeFirstUse"] = () => + abort( + "'webglPrepareUniformLocationsBeforeFirstUse' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "webglGetLeftBracePos")) + Module["webglGetLeftBracePos"] = () => + abort( + "'webglGetLeftBracePos' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetVertexAttrib") + ) + Module["emscriptenWebGLGetVertexAttrib"] = () => + abort( + "'emscriptenWebGLGetVertexAttrib' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeGLArray")) + Module["writeGLArray"] = () => + abort( + "'writeGLArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "AL")) + Module["AL"] = () => + abort( + "'AL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "SDL_unicode")) + Module["SDL_unicode"] = () => + abort( + "'SDL_unicode' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "SDL_ttfContext")) + Module["SDL_ttfContext"] = () => + abort( + "'SDL_ttfContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "SDL_audio")) + Module["SDL_audio"] = () => + abort( + "'SDL_audio' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "SDL")) + Module["SDL"] = () => + abort( + "'SDL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "SDL_gfx")) + Module["SDL_gfx"] = () => + abort( + "'SDL_gfx' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "GLUT")) + Module["GLUT"] = () => + abort( + "'GLUT' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "EGL")) + Module["EGL"] = () => + abort( + "'EGL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "GLFW_Window")) + Module["GLFW_Window"] = () => + abort( + "'GLFW_Window' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "GLFW")) + Module["GLFW"] = () => + abort( + "'GLFW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "GLEW")) + Module["GLEW"] = () => + abort( + "'GLEW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "IDBStore")) + Module["IDBStore"] = () => + abort( + "'IDBStore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "runAndAbortIfError")) + Module["runAndAbortIfError"] = () => + abort( + "'runAndAbortIfError' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "Asyncify")) + Module["Asyncify"] = () => + abort( + "'Asyncify' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "Fibers")) + Module["Fibers"] = () => + abort( + "'Fibers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "warnOnce")) + Module["warnOnce"] = () => + abort( + "'warnOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stackSave")) + Module["stackSave"] = () => + abort( + "'stackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stackRestore")) + Module["stackRestore"] = () => + abort( + "'stackRestore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stackAlloc")) + Module["stackAlloc"] = () => + abort( + "'stackAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "AsciiToString")) + Module["AsciiToString"] = () => + abort( + "'AsciiToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stringToAscii")) + Module["stringToAscii"] = () => + abort( + "'stringToAscii' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "UTF16ToString")) + Module["UTF16ToString"] = () => + abort( + "'UTF16ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF16")) + Module["stringToUTF16"] = () => + abort( + "'stringToUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF16")) + Module["lengthBytesUTF16"] = () => + abort( + "'lengthBytesUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "UTF32ToString")) + Module["UTF32ToString"] = () => + abort( + "'UTF32ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF32")) + Module["stringToUTF32"] = () => + abort( + "'stringToUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF32")) + Module["lengthBytesUTF32"] = () => + abort( + "'lengthBytesUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8")) + Module["allocateUTF8"] = () => + abort( + "'allocateUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8OnStack")) + Module["allocateUTF8OnStack"] = () => + abort( + "'allocateUTF8OnStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + Module["writeStackCookie"] = writeStackCookie; + Module["checkStackCookie"] = checkStackCookie; + if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_NORMAL")) + Object.defineProperty(Module, "ALLOC_NORMAL", { + configurable: true, + get: function () { + abort( + "'ALLOC_NORMAL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + }, + }); + if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_STACK")) + Object.defineProperty(Module, "ALLOC_STACK", { + configurable: true, + get: function () { + abort( + "'ALLOC_STACK' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + }, + }); + var calledRun; + function ExitStatus(status) { + this.name = "ExitStatus"; + this.message = "Program terminated with exit(" + status + ")"; + this.status = status; + } + var calledMain = false; + // dependenciesFulfilled = function runCaller() { + // if (!calledRun) run(); + // if (!calledRun) dependenciesFulfilled = runCaller; + // }; + function callMain(args) { + assert( + runDependencies == 0, + 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])', + ); + assert( + __ATPRERUN__.length == 0, + "cannot call main when preRun functions remain to be called", + ); + var entryFunction = Module["_main"]; + args = args || []; + var argc = args.length + 1; + var argv = stackAlloc((argc + 1) * 4); + HEAP32[argv >> 2] = allocateUTF8OnStack(thisProgram); + for (var i = 1; i < argc; i++) { + HEAP32[(argv >> 2) + i] = allocateUTF8OnStack(args[i - 1]); + } + HEAP32[(argv >> 2) + argc] = 0; + try { + var ret = entryFunction(argc, argv); + exit(ret, true); + return ret; + } catch (e) { + return handleException(e); + } finally { + calledMain = true; + } + } + function stackCheckInit() { + _emscripten_stack_init(); + writeStackCookie(); + } + function run(args) { + shouldRunNow = true; + args = args || arguments_; + if (runDependencies > 0) { + return; + } + stackCheckInit(); + preRun(); + if (runDependencies > 0) { + return; + } + function doRun() { + if (calledRun) return; + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + FS.writeFile("output.elf", args[0]); + args.shift(); + preMain(); + // readyPromiseResolve(Module); + if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"](); + if (shouldRunNow) callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(function () { + setTimeout(function () { + Module["setStatus"](""); + }, 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); + } + Module["run"] = run; + function checkUnflushedContent() { + var oldOut = out; + var oldErr = err; + var has = false; + out = err = (x) => { + has = true; + }; + try { + ___stdio_exit(); + ["stdout", "stderr"].forEach(function (name) { + var info = FS.analyzePath("/dev/" + name); + if (!info) return; + var stream = info.object; + var rdev = stream.rdev; + var tty = TTY.ttys[rdev]; + if (tty && tty.output && tty.output.length) { + has = true; + } + }); + } catch (e) {} + out = oldOut; + err = oldErr; + if (has) { + warnOnce( + "stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc.", + ); + } + } + function exit(statusw, implicit) { + EXITSTATUS = statusw; + if (!runtimeKeepaliveCounter) { + checkUnflushedContent(); + } + if (keepRuntimeAlive()) { + if (!implicit) { + + for (let i = 0; i < instructions.length; i++){ + instructions[i]._rowVariant = ''; + } + status.run_program = -1; // program finished + if (statusw !== 0){ + coreEvents.emit("executor-buttons-update", { + reset_disable: false, + instruction_disable: true, + run_disable: true, + stop_disable: false, + }); + show_notification("Your program has finished with errors.", "danger"); + } else { + coreEvents.emit("executor-buttons-update", { + reset_disable: false, + instruction_disable: false, + run_disable: false, + stop_disable: true, + isFinished: true, + }); + } + var msg = + "program exited (with status: " + + statusw + + "), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)"; + readyPromiseReject(msg); + err(msg); + } + } else { + exitRuntime(); + } + procExit(statusw); + } + function procExit(code) { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + if (Module["onExit"]) Module["onExit"](code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); + } + if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") + Module["preInit"] = [Module["preInit"]]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } + } + var shouldRunNow = true; + if (Module["noInitialRun"]) shouldRunNow = false; + // run(); + readyPromiseResolve(Module); + + return Module.ready; + }; +})(); +export default Module; diff --git a/src/core/executor/sailSimRV/wasm/riscv_sim_RV32.wasm b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32.wasm new file mode 100755 index 000000000..23c080166 Binary files /dev/null and b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32.wasm differ diff --git a/src/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.js b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.js new file mode 100644 index 000000000..b119bc7b5 --- /dev/null +++ b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.js @@ -0,0 +1,5690 @@ +import { instructions, setInstructions, clear_instructions, tag_instructions } from "@/core/assembler/assembler.mjs"; +import { readRegister, writeRegister, notifyRegisterUpdate } from "@/core/register/registerOperations.mjs"; +import { crex_findReg_bytag, crex_findReg } from "@/core/register/registerLookup.mjs" +import { status, set_execution_mode, PC_REG_INDEX, REGISTERS, getPC, main_memory, updateCacheMem } from "@/core/core.mjs"; +import { display_print } from "../../IO.mjs"; +import { SYSCALL } from "@/core/capi/syscall.mts"; +import { coreEvents, CoreEventTypes } from "@/core/events.mts"; +import { show_notification } from "@/core/utils/notifications.mts"; +import { architecture } from "../../../core.mjs"; +import { clearAllRegisterGlows } from "@/core/register/registerGlowState.mjs"; + + +export var userMode32vd = false; + +var Module = (() => { + var _scriptName = import.meta.url; + var insn_number; + + return async function (moduleArg = {}) {document.app.$data.is_breakpoint = instructions[0].Break; + var pc_sail = crex_findReg_bytag("program_counter"); + var pc_min = architecture.memory_layout.text.start; + var pc_max = architecture.memory_layout.text.end; + var hiden_executed, hiden_next_execute; + + var registers_before_function = [ + { name: "t0", can_operate : false}, + { name: "t1", can_operate : false}, + { name: "t2", can_operate : false}, + { name: "t3", can_operate : false}, + { name: "t4", can_operate : false}, + { name: "t5", can_operate : false}, + { name: "t6", can_operate : false}, + { name: "s0", can_operate : false}, + { name: "s1", can_operate : false}, + { name: "s2", can_operate : false}, + { name: "s3", can_operate : false}, + { name: "s4", can_operate : false}, + { name: "s5", can_operate : false}, + { name: "s6", can_operate : false}, + { name: "s7", can_operate : false}, + { name: "s8", can_operate : false}, + { name: "s9", can_operate : false}, + { name: "s10", can_operate : false}, + { name: "s11", can_operate : false} + ] + var callstack_convention = []; + var inside_function = false; + var moduleRtn; + + var Module = moduleArg; + var readyPromiseResolve, readyPromiseReject; + var readyPromise = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; + }); + var ENVIRONMENT_IS_WEB = true; + var ENVIRONMENT_IS_WORKER = false; + var ENVIRONMENT_IS_NODE = false; + var ENVIRONMENT_IS_SHELL = false; + var moduleOverrides = Object.assign({}, Module); + var arguments_ = []; + var thisProgram = "./this.program"; + var quit_ = (status, toThrow) => { + throw toThrow; + }; + var scriptDirectory = ""; + function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; + } + var readAsync, readBinary; + if (ENVIRONMENT_IS_SHELL) { + if ( + (typeof process == "object" && typeof require === "function") || + typeof window == "object" || + typeof WorkerGlobalScope != "undefined" + ) + throw new Error( + "not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)", + ); + } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + if (_scriptName) { + scriptDirectory = _scriptName; + } + if (scriptDirectory.startsWith("blob:")) { + scriptDirectory = ""; + } else { + scriptDirectory = scriptDirectory.slice( + 0, + scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1, + ); + } + if ( + !(typeof window == "object" || typeof WorkerGlobalScope != "undefined") + ) + throw new Error( + "not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)", + ); + { + readAsync = async (url) => { + assert(!isFileURI(url), "readAsync does not work with file:// URLs"); + var response = await fetch(url, { credentials: "same-origin" }); + if (response.ok) { + return response.arrayBuffer(); + } + throw new Error(response.status + " : " + response.url); + }; + } + } else { + throw new Error("environment detection error"); + } + + + + // const instructionExp = /\[(\d+)\] \[(\w+)\]: 0x([0-9A-Fa-f]+) \(0x([0-9A-Fa-f]+)\) (\w+) ([^,]+), ([^,]+)(?:, (.+))?/; + var instructionExp = /\[(\d+)\] \[(\w+)\]: 0x([0-9A-Fa-f]+) \(0x([0-9A-Fa-f]+)\) ([\w.]+)(?: ([^,]+), ([^,]+)(?:, (.+))?)?/; + var registerExp = /([xf]\d+) (<-) 0x([0-9A-Fa-f]+)/; // /(x\d+) (<-|->) 0x([0-9A-Fa-f]+)/; + var vectorExp = /(v\d+) (<-) 0x([0-9A-Fa-f]+)/; + var memoryExp = /mem\[0x([0-9A-Fa-f]+)\]\s*(<-|->)\s*0x([0-9A-Fa-f]+)/; + var CSRTypeExp = /(CSR\S*)\s+(\S+)\s+(\S+)\s+(0x)([\dA-Fa-f]{1,8})/; + var CSRExp = /^(CSR)\s+(\w+)\s+(<-|->)\s+0x([0-9a-fA-F]+)(?:\s+(.*))?$/; + var jumpExp = /Next_PC:\s*(0x[0-9a-fA-F]+)/; + var cacheExp = /^\[(\d+)\]\s+(L1_I|L1_D|L1|L2|L2_I|L2_D):\s*\((0x[0-9A-Fa-f]+)\)\s$/; + var configCacheExp = /^Configuration:\s*([A-Za-z_][A-Za-z0-9_]*)\s*<-\s*(\S+)\s*$/; + + // var displayExp = /^[A-Za-z\s]+:\s*(.*)$/; + // var displayExp = /^([\w\s]+):\s*(.*)$/; + var displayExp = /^ECALL\s+(SIGNED|UNSIGNED|STRING|CHAR|FLOAT|DOUBLE):\s*(.+)$/; + var instoper = ""; + var syscall_print_code = -1; + var prev_add_to_jump; + + function updateCacheStat(index, access, data="") { + switch(access) { + case "Cache L1 hit inst": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 1; + break; + case "Cache L1 miss inst": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + break; + case "Cache L1 miss": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + break; + case "Cache L1 hit data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 1; + break; + case "Cache L1 miss data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 1; + break; + case "Cache L1_I hit": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 1; + break; + case "Cache L1_I miss": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + break; + case "Cache L1_D hit": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 1; + break; + case "Cache L1_D miss": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 1; + break; + case "Cache L2 hit inst": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 1; + break; + case "Cache L2 miss inst": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 1; + break; + case "Cache L2_I hit": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 1; + break; + case "Cache L2_I miss": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 1; + break; + case "Cache L2 hit data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 1; + break; + case "Cache L2 miss data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 1; + break; + case "Cache L2_D hit": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 1; + break; + case "Cache L2_D miss": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 1; + break; + } + + } + + async function check_call_convention_temp_regs(instMatch) { + if(((instMatch[7] != undefined && (instMatch[7].includes("t") || (instMatch[7].includes("s") && !instMatch[7].includes("sp")) ) ) || (instMatch[8] != undefined && (instMatch[8].includes("t") || (instMatch[8].includes("s") && !instMatch[8].includes("sp")) ))) && instMatch[6] !== undefined && inside_function) { + if((instMatch[5] != "li" && instMatch[5] != "lui" && instMatch[5] != "la") ){ + for (var i = 0; i < callstack_convention[callstack_convention.length - 1].length; i++ ){ + (callstack_convention[callstack_convention.length - 1][i].name === instMatch[7] || callstack_convention[callstack_convention.length - 1][i].name === instMatch[8]) && + (callstack_convention[callstack_convention.length - 1][i].can_operate === false) ? show_notification("Possible failure in the parameter passing convention", "warning") : 0 ; + } + + // callstack_convention[callstack_convention.length - 1].name + + } + } + if (instMatch[6] !== undefined && (instMatch[6].includes("t") || (instMatch[6].includes("s") && !instMatch[6].includes("sp"))) && inside_function) { + for (var i = 0; i < callstack_convention[callstack_convention.length - 1].length; i++ ){ + callstack_convention[callstack_convention.length - 1][i].can_operate = (callstack_convention[callstack_convention.length - 1][i].name === instMatch[6]) ? true : callstack_convention[callstack_convention.length - 1][i].can_operate; + } + } + } + + // var to_measure = ""; + var start_m, start_m; + var cache_inst; + + function writeMemory(value, addr) { + // Primero pasar el valor al formato hexadecimal por pares + if (value.startsWith("0x")) + value = value.slice(2); + if (value.length % 2 !== 0) + value = "0" + value; + + // const bytes = new Uint8Array(value.length / 2); + for (let i = 0; i < value.length / 2; i ++) { + main_memory.write((addr + BigInt(i)), Number("0x" + value.substring(i*2, i * 2 + 2))); + } + + // if (memoMatch[2] === '<-'){ + // switch(op){ + // case 'sh': // Para almacenar un half + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + // break; + // case 'sb': // Para almacenar un byte + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'sw': // Para almacenar un int/word + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'fsw': // Para almacenar un float + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'float'); + // break; + // case 'fsd': // Para almacenar un double + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // case 'vse8.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'vse16.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + // break; + // case 'vse32.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'vse64.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // default: + // break; + // } + // } + } + + Module['print'] = function (message) { + if(message === "err call_convenction"){ + show_notification("Possible failure in the parameter passing convention", "warning"); + } + + var next_add_to_jump; + let instMatch = message.match(instructionExp); + let regiMatch = message.match(registerExp); + let memoMatch = message.match(memoryExp); + let printMatch = message.match(displayExp); + let CSRMatch = message.match(CSRTypeExp); + let CSREMatch = message.match(CSRExp); + let vectorMatch = message.match(vectorExp); + let jumpMatch = message.match(jumpExp); + let cacheMatch = message.match(cacheExp); + let configCacheMatch = message.match(configCacheExp); + + if (message.startsWith("Cache") || message.startsWith("Next_PC:")){ + if (message.includes("Cache prefetch")) { + let newpc = message.substring(15,message.length).toLowerCase(); + cache_inst = instructions.findIndex(insn => insn.Address === newpc); + } else if (message.includes("Next_PC:")) { + let newpc = message.substring(9, message.length).toLowerCase(); + cache_inst = instructions.findIndex(insn => insn.Address == newpc); + } + if (cache_inst != -1 && document.app.$data.execution_mode_run === 1) { + let hexmatch = message.match(/0x[0-9A-Fa-f]+$/); + if (hexmatch && !message.startsWith("Cache prefetch")) { + let hexa = hexmatch[0]; + message = message.replace(/on:\s*0x[0-9A-Fa-f]+$/, "").trim(); + updateCacheStat(cache_inst, message, hexa); + }else { + updateCacheStat(cache_inst, message); + } + + } + } + + if (message === "May your execution has an infinity loop."){ + document.app.$data.execution_mode_run = 1; + show_notification(message, "danger"); + instructions[hiden_executed]._rowVariant = "info"; + instructions[hiden_next_execute]._rowVariant = "success"; + } + + if (jumpMatch){ + const current_ins = instructions.findIndex(insn => insn.Address === (jumpMatch[1].toLowerCase())); + + for (var i = 0; i < instructions.length; i++){ + if(instructions[i]._rowVariant === "success" && document.app.$data.execution_mode_run !== 0) // ajustar lo del user mode + instructions[i]._rowVariant = ""; + } + if (current_ins !== -1) instructions[current_ins]._rowVariant = "success"; + } + + if (configCacheMatch) { + switch(configCacheMatch[1]) { + case "L1_I_SIZE": + config_cache.push({configuration: "Size L1_I", value: configCacheMatch[2] + " lines"}); + break; + case "L1_D_SIZE": + config_cache.push({configuration: "Size L1_D", value: configCacheMatch[2] + " lines"}); + break; + case "L1_SIZE": + config_cache.push({configuration: "Size L1", value: configCacheMatch[2] + " lines"}); + break; + case "L2_I_SIZE": + config_cache.push({configuration: "Size L2_I", value: configCacheMatch[2] + " lines"}); + break; + case "L2_D_SIZE": + config_cache.push({configuration: "Size L2_D", value: configCacheMatch[2] + " lines"}); + break; + case "L2_SIZE": + config_cache.push({configuration: "Size L2", value: configCacheMatch[2] + " lines"}); + break; + case "Rep_policy": + config_cache.push({configuration: "Replacement policy", value: configCacheMatch[2]}); + break; + case "L1_I_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1_I block", value: configCacheMatch[2] + " bits"}); + break; + case "L1_D_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1_D block", value: configCacheMatch[2] + " bits"}); + break; + case "L1_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1 block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_I_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2_I block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_D_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2_D block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2 block", value: configCacheMatch[2] + " bits"}); + break; + } + } + + if (cacheMatch) { + console.log(cacheMatch); + switch(cacheMatch[2]) { + case "L1_I": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_I_size_block); + break; + case "L1_D": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_D_size_block); + + break; + case "L1": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_size_block); + + break; + case "L2_I": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_I_size_block); + + break; + case "L2_D": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_D_size_block); + + break; + case "L2": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_size_block); + + break; + + } + } + + if(CSREMatch){ + console.log(CSREMatch); + if (CSREMatch[2] !== "vtype" && CSREMatch[2] !== "vl"){ + let regtowrite = crex_findReg(CSREMatch[2]); + if(regtowrite.match !== 0) + writeRegister(CSREMatch[4], regtowrite.indexComp, regtowrite.indexElem); + } + } + if (CSRMatch){ + if (CSRMatch[2] === "vtype"){ + var size_elem = parseInt(CSRMatch[5], 16).toString(2).padStart(32, '0'); + size_elem = size_elem.slice(26, 29); + // console.log("Tamaño: ", size_elem); + if(size_elem === "000"){ + document.app.$data.v_length = 8; + // architecture.components[3].total_elements = 64; + } else if (size_elem === "001") { + document.app.$data.v_length = 16; + // length_vext = 16; + // architecture.components[3].total_elements = 32; + } else if (size_elem === "010"){ + document.app.$data.v_length = 32; + // length_vext = 32; + // architecture.components[3].total_elements = 16; + }else { + document.app.$data.v_length = 64; + // length_vext = 64; + // architecture.components[3].total_elements = 8; + } + // architecture.components[3].length_elem = length_vext; + } + else if (CSRMatch[2] === "vl"){ + // architecture.components[3].elems_op = parseInt(CSRMatch[5], 16); + } + } + if (vectorMatch){ + let regtowrite = crex_findReg(vectorMatch[1]); + writeRegister(vectorMatch[3], regtowrite.indexComp, regtowrite.indexElem); + } + + if (instMatch && (parseInt(instMatch[3], 16) >= pc_min && parseInt(instMatch[3], 16) <= pc_max )){ + clearAllRegisterGlows(); + coreEvents.emit("step-about-to-execute"); + userMode32vd = true; + if (inside_function) + check_call_convention_temp_regs(instMatch); + + //Actualizamos el pc + writeRegister(BigInt(parseInt(instMatch[3], 16)), pc_sail.indexComp, pc_sail.indexElem); + for (var i = 0; i < instructions.length; i++) { + if (instructions[i]._rowVariant === "info") + instructions[i]._rowVariant = ""; + } + instoper = ""; + // console.log("PC actual:",pc_sail); + + + console.log("Instruccion: ", instMatch); + const current_ins = instructions.findIndex(insn => insn.Address === ("0x"+instMatch[3].toLowerCase())); + if(prev_add_to_jump !== undefined){ + instructions[prev_add_to_jump]._rowVariant = ""; + prev_add_to_jump = undefined; + } + + if (instructions[current_ins].loaded.includes("jalr")){ + var next_add = instructions[current_ins].loaded.split("\t"); + const match = next_add[1].match(/(-?\d+)\((\w+)\)/); + var aux_reg = crex_findReg(match[2]); + var aux_val = readRegister(aux_reg.indexComp, aux_reg.indexElem); + + next_add_to_jump = (aux_val + BigInt(parseInt(match[1], 10))).toString(16); + next_add_to_jump = instructions.findIndex(insn => insn.Address === ("0x"+next_add_to_jump.toLowerCase())); + prev_add_to_jump = current_ins; + + // var stack_entry_func = instructions[next_add_to_jump].label; + // creator_callstack_enter(instructions[next_add_to_jump].Label); + // track_stack_enter(instructions[next_add_to_jump].Label); + // callstack_convention.push(structuredClone(registers_before_function)); + // inside_function = true; + } + if (instructions[current_ins].loaded.includes("jal") && !instructions[current_ins].loaded.includes("jalr")){ + var next_add = instructions[current_ins].loaded.split("\t"); + + } + if (instructions[current_ins].loaded.includes("ret") && !instructions[current_ins].loaded.includes("mret")){ + // Mirar el ra + var aux_reg = crex_findReg("ra"); + next_add_to_jump = readRegister(aux_reg.indexComp, aux_reg.indexElem).toString(16); + next_add_to_jump = instructions.findIndex(insn => insn.Address === ("0x"+next_add_to_jump.toLowerCase())); + if (next_add_to_jump !== -1){ + prev_add_to_jump = current_ins; + // track_stack_leave(); + // creator_callstack_leave(); + // callstack_convention.pop(); + // inside_function = (callstack_convention.length > 0); + }else + next_add_to_jump = undefined; + } + + + // Primero caso de paso a paso + if (document.app.$data.execution_mode_run === 1){ + instructions[current_ins]._rowVariant = 'info'; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined){ + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + document.app.$data.is_breakpoint = instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)].Break; + } + if (current_ins > 0 || prev_add_to_jump !== undefined) + instructions[(prev_add_to_jump !== undefined && prev_add_to_jump !== current_ins) ? prev_add_to_jump : ((current_ins > 0) ? current_ins -1 : 0)]._rowVariant = ''; + } + // Para el caso de run without stop y la siguiente instruccion es un breakpoint + else if (document.app.$data.execution_mode_run === 0){ + // se almacena el estado de la instruccion en caso de que haya una parada por infinity loop + hiden_executed = current_ins; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + hiden_next_execute = (next_add_to_jump !== undefined) ? next_add_to_jump : current_ins + 1; + } else + hiden_next_execute = current_ins + 1; + + + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + document.app.$data.is_breakpoint = instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)].Break; + } + if(document.app.$data.is_breakpoint){ + instructions[current_ins]._rowVariant = 'info'; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + } + coreEvents.emit("pause-execution"); + }else { + instructions[current_ins]._rowVariant = ''; + } + if (current_ins > 0 || prev_add_to_jump !== undefined) + instructions[(prev_add_to_jump !== undefined && prev_add_to_jump !== current_ins) ? prev_add_to_jump : ((current_ins > 0) ? current_ins -1 : 0)]._rowVariant = ''; + + } + else + instructions[current_ins]._rowVariant = ''; + + if (instMatch[5] === "ecall"){ + let argument_register = crex_findReg("a7"); // obtenemos el registro para ver que llamada al sistema es + let syscall_code = readRegister(argument_register.indexComp, argument_register.indexElem); // Lectura del registro para obtener el valor + + switch(syscall_code){ + case 5n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para enteros + // capi_read_int('a0'); + SYSCALL.read('a0', "int"); + break; + case 6n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para floats + // capi_read_float('fa0'); + SYSCALL.read("fa0", "float"); + break; + case 7n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // Manejo para double + // capi_read_double('fa0'); + SYSCALL.read("fa0", "double"); + break; + case 8n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // Manejo para strings + // capi_read_string('a0','a1'); + SYSCALL.read("a0", "string", "a1"); + break; + + case 12n: + if(document.app.$data.execution_mode_run === 0){ + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para char + // capi_read_char('a0'); + SYSCALL.read("a0", "char"); + break; + default: + // console.log("No hago nada."); + syscall_print_code = syscall_code; + break; + } + + next_add_to_jump = undefined; + } + + + + instoper = instMatch[5]; + setInstructions(instructions); + coreEvents.emit("sail-instruction-update"); + // window.updateUI({ error: false, msg: "" }); + + + + + + + } else if (instMatch && (parseInt(instMatch[3], 16) <= pc_min || parseInt(instMatch[3], 16) >= pc_max )) + userMode32vd = false; + + if (regiMatch /*&& userMode === true*/) { + // En caso de ser escritura '<-' pintamos el valor en el registro que corresponde + if (regiMatch[2] === '<-'){ + let regtowrite = crex_findReg(regiMatch[1]); + // console.log("Registro identificado: ", regtowrite); + // if (regiMatch[1] !== 'x2') + if (regtowrite.indexComp === 2){ + if (regiMatch[3].startsWith("0x")) regiMatch[3] = regiMatch[3].slice(2).replace(/^0+/, ''); + else regiMatch[3] = regiMatch[3].replace(/^0+/, ''); + if (regiMatch[3].length <= 8){ + regiMatch[3] = regiMatch[3].padStart(8, "0"); + writeRegister(BigInt("0x" + regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem); + } + else{ + writeRegister(BigInt("0x" + regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem); + } + + } + else + writeRegister(BigInt(parseInt(regiMatch[3], 16)), regtowrite.indexComp, regtowrite.indexElem); + } + + } + + if (memoMatch /*&& userMode === true*/) { + if (memoMatch[2] === '<-'){ + // switch(instoper){ + // case 'sh': // Para almacenar un half + writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'sb': // Para almacenar un byte + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'sw': // Para almacenar un int/word + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'fsw': // Para almacenar un float + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'fsd': // Para almacenar un double + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse8.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse16.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse32.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse64.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // default: + // break; + // } + + // instoper = ""; + } + + } + + if(printMatch && syscall_print_code !== -1){ + + let value_2_print = printMatch[2].trim(); + // console.log("Estoy dentro de ecall a imprimir"); + // console.log(message); + // console.log("Valor a imprimir: ", value_2_print); + switch(syscall_print_code){ + + case 1n: // Print int + // SYSCALL.print(Number(parseInt(value_2_print)), "int32"); + + display_print(value_2_print); + // display_print(full_print(parseInt(value_2_print), null, false)); + syscall_print_code = -1; + break; + case 2n: // Print float + // SYSCALL.print(Number(parseFloat(value_2_print)), "float"); + display_print(value_2_print); + // display_print(full_print(parseFloat(value_2_print), 0, true)); + syscall_print_code = -1; + break; + + case 3n: // Print double + // SYSCALL.print(Number(parseFloat(value_2_print)), "double"); + display_print(value_2_print); + // display_print(full_print(parseFloat(value_2_print), 0, true)); + syscall_print_code = -1; + break; + + case 4n: // Print String + display_print(value_2_print); + syscall_print_code = -1; + break; + + case 11n: // Print char + // SYSCALL.print(BigInt(value_2_print.charCodeAt(0)), char); + display_print(value_2_print); + syscall_print_code = -1; + break; + + default: // Rest of syscall codes not able to print + syscall_print_code = -1; + break; + + } + + } + + console.log(message); + + } + + Module['printErr'] = function (message) { + // if (message.includes("Execution:") || message.includes("Instructions:") || message.includes("Perf:")) + // show_notification(message, "success"); + // else + console.warn(message); + } + + var out = Module["print"] /*|| console.log.bind(console)*/; + // var out = console.log.bind(console); + var err = Module["printErr"] /*|| console.warn.bind(console)*/; + + + Object.assign(Module, moduleOverrides); + moduleOverrides = null; + checkIncomingModuleAPI(); + if (Module["arguments"]) arguments_ = Module["arguments"]; + legacyModuleProp("arguments", "arguments_"); + if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + legacyModuleProp("thisProgram", "thisProgram"); + assert( + typeof Module["memoryInitializerPrefixURL"] == "undefined", + "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["pthreadMainPrefixURL"] == "undefined", + "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["cdInitializerPrefixURL"] == "undefined", + "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["filePackagePrefixURL"] == "undefined", + "Module.filePackagePrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["read"] == "undefined", + "Module.read option was removed", + ); + assert( + typeof Module["readAsync"] == "undefined", + "Module.readAsync option was removed (modify readAsync in JS)", + ); + assert( + typeof Module["readBinary"] == "undefined", + "Module.readBinary option was removed (modify readBinary in JS)", + ); + assert( + typeof Module["setWindowTitle"] == "undefined", + "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)", + ); + assert( + typeof Module["TOTAL_MEMORY"] == "undefined", + "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY", + ); + legacyModuleProp("asm", "wasmExports"); + legacyModuleProp("readAsync", "readAsync"); + legacyModuleProp("readBinary", "readBinary"); + legacyModuleProp("setWindowTitle", "setWindowTitle"); + assert( + !ENVIRONMENT_IS_WORKER, + "worker environment detected but not enabled at build time. Add `worker` to `-sENVIRONMENT` to enable.", + ); + assert( + !ENVIRONMENT_IS_NODE, + "node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable.", + ); + assert( + !ENVIRONMENT_IS_SHELL, + "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.", + ); + var wasmBinary = Module["wasmBinary"]; + legacyModuleProp("wasmBinary", "wasmBinary"); + if (typeof WebAssembly != "object") { + err("no native wasm support detected"); + } + var wasmMemory; + var ABORT = false; + var EXITSTATUS; + function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } + } + var HEAP8, + HEAPU8, + HEAP16, + HEAPU16, + HEAP32, + HEAPU32, + HEAPF32, + HEAP64, + HEAPU64, + HEAPF64; + var runtimeInitialized = false; + var isFileURI = (filename) => filename.startsWith("file://"); + function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + if (max == 0) { + max += 4; + } + HEAPU32[max / 4] = 34821223; + HEAPU32[(max + 4) / 4] = 2310721022; + HEAPU32[0 / 4] = 1668509029; + } + function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + if (max == 0) { + max += 4; + } + var cookie1 = HEAPU32[max / 4]; + var cookie2 = HEAPU32[(max + 4) / 4]; + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort( + `Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`, + ); + } + if (HEAPU32[0 / 4] != 1668509029) { + abort( + "Runtime error: The application has corrupted its heap memory area (address zero)!", + ); + } + } + (() => { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) + throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"; + })(); + if (Module["ENVIRONMENT"]) { + throw new Error( + "Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)", + ); + } + function legacyModuleProp(prop, newName, incoming = true) { + if (!Object.getOwnPropertyDescriptor(Module, prop)) { + Object.defineProperty(Module, prop, { + configurable: true, + get() { + let extra = incoming + ? " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)" + : ""; + abort( + `\`Module.${prop}\` has been replaced by \`${newName}\`` + extra, + ); + }, + }); + } + } + function ignoredModuleProp(prop) { + if (Object.getOwnPropertyDescriptor(Module, prop)) { + abort( + `\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`, + ); + } + } + function isExportedByForceFilesystem(name) { + return ( + name === "FS_createPath" || + name === "FS_createDataFile" || + name === "FS_createPreloadedFile" || + name === "FS_unlink" || + name === "addRunDependency" || + name === "FS_createLazyFile" || + name === "FS_createDevice" || + name === "removeRunDependency" + ); + } + function hookGlobalSymbolAccess(sym, func) { + if ( + typeof globalThis != "undefined" && + !Object.getOwnPropertyDescriptor(globalThis, sym) + ) { + Object.defineProperty(globalThis, sym, { + configurable: true, + get() { + func(); + return undefined; + }, + }); + } + } + function missingGlobal(sym, msg) { + hookGlobalSymbolAccess(sym, () => { + warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`); + }); + } + missingGlobal("buffer", "Please use HEAP8.buffer or wasmMemory.buffer"); + missingGlobal("asm", "Please use wasmExports instead"); + function missingLibrarySymbol(sym) { + hookGlobalSymbolAccess(sym, () => { + var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`; + var librarySymbol = sym; + if (!librarySymbol.startsWith("_")) { + librarySymbol = "$" + sym; + } + msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`; + if (isExportedByForceFilesystem(sym)) { + msg += + ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + warnOnce(msg); + }); + unexportedRuntimeSymbol(sym); + } + function unexportedRuntimeSymbol(sym) { + if (!Object.getOwnPropertyDescriptor(Module, sym)) { + Object.defineProperty(Module, sym, { + configurable: true, + get() { + var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`; + if (isExportedByForceFilesystem(sym)) { + msg += + ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + abort(msg); + }, + }); + } + } + function updateMemoryViews() { + var b = wasmMemory.buffer; + Module["HEAP8"] = HEAP8 = new Int8Array(b); + Module["HEAP16"] = HEAP16 = new Int16Array(b); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(b); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(b); + Module["HEAP32"] = HEAP32 = new Int32Array(b); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(b); + Module["HEAPF32"] = HEAPF32 = new Float32Array(b); + Module["HEAPF64"] = HEAPF64 = new Float64Array(b); + Module["HEAP64"] = HEAP64 = new BigInt64Array(b); + Module["HEAPU64"] = HEAPU64 = new BigUint64Array(b); + } + assert( + !Module["STACK_SIZE"], + "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time", + ); + assert( + typeof Int32Array != "undefined" && + typeof Float64Array !== "undefined" && + Int32Array.prototype.subarray != undefined && + Int32Array.prototype.set != undefined, + "JS engine does not provide full typed array support", + ); + assert( + !Module["wasmMemory"], + "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally", + ); + assert( + !Module["INITIAL_MEMORY"], + "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically", + ); + function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") + Module["preRun"] = [Module["preRun"]]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(onPreRuns); + } + function initRuntime() { + assert(!runtimeInitialized); + runtimeInitialized = true; + checkStackCookie(); + if (!Module["noFSInit"] && !FS.initialized) FS.init(); + TTY.init(); + wasmExports["__wasm_call_ctors"](); + FS.ignorePermissions = false; + } + function preMain() { + checkStackCookie(); + } + function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") + Module["postRun"] = [Module["postRun"]]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(onPostRuns); + } + var runDependencies = 0; + var dependenciesFulfilled = null; + var runDependencyTracking = {}; + var runDependencyWatcher = null; + function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } + } + function addRunDependency(id) { + runDependencies++; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if ( + runDependencyWatcher === null && + typeof setInterval != "undefined" + ) { + runDependencyWatcher = setInterval(() => { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err(`dependency: ${dep}`); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } + } + function removeRunDependency(id) { + runDependencies--; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } + } + function abort(what) { + Module["onAbort"]?.(what); + what = "Aborted(" + what + ")"; + err(what); + ABORT = true; + if (what.indexOf("RuntimeError: unreachable") >= 0) { + what += + '. "unreachable" may be due to ASYNCIFY_STACK_SIZE not being large enough (try increasing it)'; + } + var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + throw e; + } + function createExportWrapper(name, nargs) { + return (...args) => { + assert( + runtimeInitialized, + `native function \`${name}\` called before runtime initialization`, + ); + var f = wasmExports[name]; + assert(f, `exported native function \`${name}\` not found`); + assert( + args.length <= nargs, + `native function \`${name}\` called with ${args.length} args but expects ${nargs}`, + ); + return f(...args); + }; + } + var wasmBinaryFile; + function findWasmBinary() { + if (Module["locateFile"]) { + return locateFile("riscv_sim_RV32vd.wasm"); + } + return new URL("riscv_sim_RV32vd.wasm", import.meta.url).href; + } + function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw "both async and sync fetching of the wasm failed"; + } + async function getWasmBinary(binaryFile) { + if (!wasmBinary) { + try { + var response = await readAsync(binaryFile); + return new Uint8Array(response); + } catch {} + } + return getBinarySync(binaryFile); + } + async function instantiateArrayBuffer(binaryFile, imports) { + try { + var binary = await getWasmBinary(binaryFile); + var instance = await WebAssembly.instantiate(binary, imports); + return instance; + } catch (reason) { + err(`failed to asynchronously prepare wasm: ${reason}`); + if (isFileURI(wasmBinaryFile)) { + err( + `warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`, + ); + } + abort(reason); + } + } + async function instantiateAsync(binary, binaryFile, imports) { + if (!binary && typeof WebAssembly.instantiateStreaming == "function") { + try { + var response = fetch(binaryFile, { credentials: "same-origin" }); + var instantiationResult = await WebAssembly.instantiateStreaming( + response, + imports, + ); + return instantiationResult; + } catch (reason) { + err(`wasm streaming compile failed: ${reason}`); + err("falling back to ArrayBuffer instantiation"); + } + } + return instantiateArrayBuffer(binaryFile, imports); + } + function getWasmImports() { + Asyncify.instrumentWasmImports(wasmImports); + return { env: wasmImports, wasi_snapshot_preview1: wasmImports }; + } + async function createWasm() { + function receiveInstance(instance, module) { + wasmExports = instance.exports; + wasmExports = Asyncify.instrumentWasmExports(wasmExports); + wasmExports = applySignatureConversions(wasmExports); + wasmMemory = wasmExports["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateMemoryViews(); + removeRunDependency("wasm-instantiate"); + return wasmExports; + } + addRunDependency("wasm-instantiate"); + var trueModule = Module; + function receiveInstantiationResult(result) { + assert( + Module === trueModule, + "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?", + ); + trueModule = null; + return receiveInstance(result["instance"]); + } + var info = getWasmImports(); + if (Module["instantiateWasm"]) { + return new Promise((resolve, reject) => { + try { + Module["instantiateWasm"](info, (mod, inst) => { + receiveInstance(mod, inst); + resolve(mod.exports); + }); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + reject(e); + } + }); + } + wasmBinaryFile ??= findWasmBinary(); + try { + var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info); + var exports = receiveInstantiationResult(result); + return exports; + } catch (e) { + readyPromiseReject(e); + return Promise.reject(e); + } + } + class ExitStatus { + name = "ExitStatus"; + constructor(status) { + this.message = `Program terminated with exit(${status})`; + this.status = status; + } + } + var callRuntimeCallbacks = (callbacks) => { + while (callbacks.length > 0) { + callbacks.shift()(Module); + } + }; + var onPostRuns = []; + var addOnPostRun = (cb) => onPostRuns.unshift(cb); + var onPreRuns = []; + var addOnPreRun = (cb) => onPreRuns.unshift(cb); + var noExitRuntime = Module["noExitRuntime"] || true; + var ptrToString = (ptr) => { + assert(typeof ptr === "number"); + return "0x" + ptr.toString(16).padStart(8, "0"); + }; + var stackRestore = (val) => __emscripten_stack_restore(val); + var stackSave = () => _emscripten_stack_get_current(); + var warnOnce = (text) => { + warnOnce.shown ||= {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + err(text); + } + }; + var INT53_MAX = 9007199254740992; + var INT53_MIN = -9007199254740992; + var bigintToI53Checked = (num) => + num < INT53_MIN || num > INT53_MAX ? NaN : Number(num); + var UTF8Decoder = + typeof TextDecoder != "undefined" ? new TextDecoder() : undefined; + var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ""; + while (idx < endPtr) { + var u0 = heapOrArray[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + if ((u0 & 248) != 240) + warnOnce( + "Invalid UTF-8 leading byte " + + ptrToString(u0) + + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!", + ); + u0 = + ((u0 & 7) << 18) | + (u1 << 12) | + (u2 << 6) | + (heapOrArray[idx++] & 63); + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } + } + return str; + }; + var UTF8ToString = (ptr, maxBytesToRead) => { + assert( + typeof ptr == "number", + `UTF8ToString expects a number (got ${typeof ptr})`, + ); + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; + }; + function ___assert_fail(condition, filename, line, func) { + condition = bigintToI53Checked(condition); + filename = bigintToI53Checked(filename); + func = bigintToI53Checked(func); + return abort( + `Assertion failed: ${UTF8ToString(condition)}, at: ` + + [ + filename ? UTF8ToString(filename) : "unknown filename", + line, + func ? UTF8ToString(func) : "unknown function", + ], + ); + } + var syscallGetVarargP = () => { + assert(SYSCALLS.varargs != undefined); + var ret = Number(HEAPU64[SYSCALLS.varargs / 8]); + SYSCALLS.varargs += 8; + return ret; + }; + var syscallGetVarargI = () => { + assert(SYSCALLS.varargs != undefined); + var ret = HEAP32[+SYSCALLS.varargs / 4]; + SYSCALLS.varargs += 4; + return ret; + }; + var PATH = { + isAbs: (path) => path.charAt(0) === "/", + splitPath: (filename) => { + var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (; up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: (path) => { + var isAbsolute = PATH.isAbs(path), + trailingSlash = path.slice(-1) === "/"; + path = PATH.normalizeArray( + path.split("/").filter((p) => !!p), + !isAbsolute, + ).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: (path) => { + var result = PATH.splitPath(path), + root = result[0], + dir = result[1]; + if (!root && !dir) { + return "."; + } + if (dir) { + dir = dir.slice(0, -1); + } + return root + dir; + }, + basename: (path) => path && path.match(/([^\/]+|\/)\/*$/)[1], + join: (...paths) => PATH.normalize(paths.join("/")), + join2: (l, r) => PATH.normalize(l + "/" + r), + }; + var initRandomFill = () => (view) => crypto.getRandomValues(view); + var randomFill = (view) => { + (randomFill = initRandomFill())(view); + }; + var PATH_FS = { + resolve: (...args) => { + var resolvedPath = "", + resolvedAbsolute = false; + for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? args[i] : FS.cwd(); + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + resolvedPath = PATH.normalizeArray( + resolvedPath.split("/").filter((p) => !!p), + !resolvedAbsolute, + ).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).slice(1); + to = PATH_FS.resolve(to).slice(1); + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + }, + }; + var FS_stdin_getChar_buffer = []; + var lengthBytesUTF8 = (str) => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var c = str.charCodeAt(i); + if (c <= 127) { + len++; + } else if (c <= 2047) { + len += 2; + } else if (c >= 55296 && c <= 57343) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; + }; + var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + assert( + typeof str === "string", + `stringToUTF8Array expects a string (got ${typeof str})`, + ); + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = (65536 + ((u & 1023) << 10)) | (u1 & 1023); + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | (u >> 6); + heap[outIdx++] = 128 | (u & 63); + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | (u >> 12); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) + warnOnce( + "Invalid Unicode code point " + + ptrToString(u) + + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).", + ); + heap[outIdx++] = 240 | (u >> 18); + heap[outIdx++] = 128 | ((u >> 12) & 63); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } + } + heap[outIdx] = 0; + return outIdx - startIdx; + }; + var intArrayFromString = (stringy, dontAddNull, length) => { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array( + stringy, + u8array, + 0, + u8array.length, + ); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; + }; + var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if ( + typeof window != "undefined" && + typeof window.prompt == "function" + ) { + result = window.prompt("Input: "); + if (result !== null) { + result += "\n"; + } + } else { + } + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); + }; + var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + }, + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ + 3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [24, 80]; + }, + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + }, + }; + var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); + }; + var alignMemory = (size, alignment) => { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; + }; + var mmapAlloc = (size) => { + size = alignMemory(size, 65536); + var ptr = _emscripten_builtin_memalign(65536, size); + if (ptr) zeroMemory(ptr, size); + return ptr; + }; + var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, "/", 16895, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + MEMFS.ops_table ||= { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink, + }, + stream: { llseek: MEMFS.stream_ops.llseek }, + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync, + }, + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink, + }, + stream: {}, + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: FS.chrdev_stream_ops, + }, + }; + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.atime = node.mtime = node.ctime = Date.now(); + if (parent) { + parent.contents[name] = node; + parent.atime = parent.mtime = parent.ctime = node.atime; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) + return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max( + newCapacity, + (prevCapacity * + (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125)) >>> + 0, + ); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) + node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set( + oldContents.subarray(0, Math.min(newSize, node.usedBytes)), + ); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.atime); + attr.mtime = new Date(node.mtime); + attr.ctime = new Date(node.ctime); + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + for (const key of ["mode", "atime", "mtime", "ctime"]) { + if (attr[key] != null) { + node[key] = attr[key]; + } + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw new FS.ErrnoError(44); + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + if (FS.isDir(old_node.mode)) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + FS.hashRemoveNode(new_node); + } + delete old_node.parent.contents[old_node.name]; + new_dir.contents[new_name] = old_node; + old_node.name = new_name; + new_dir.ctime = + new_dir.mtime = + old_node.parent.ctime = + old_node.parent.mtime = + Date.now(); + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + readdir(node) { + return [".", "..", ...Object.keys(node.contents)]; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + }, + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) + buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + assert(!(buffer instanceof ArrayBuffer)); + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.mtime = node.ctime = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + assert( + position === 0, + "canOwn must imply no weird position inside the file", + ); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + return length; + } + } + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max( + stream.node.usedBytes, + offset + length, + ); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + if (contents) { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call( + contents, + position, + position + length, + ); + } + } + HEAP8.set(contents, ptr); + } + } + return { ptr, allocated }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + return 0; + }, + }, + }; + var asyncLoad = async (url) => { + var arrayBuffer = await readAsync(url); + assert( + arrayBuffer, + `Loading data file "${url}" failed (no arrayBuffer).`, + ); + return new Uint8Array(arrayBuffer); + }; + asyncLoad.isAsync = true; + var FS_createDataFile = ( + parent, + name, + fileData, + canRead, + canWrite, + canOwn, + ) => { + FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); + }; + var preloadPlugins = Module["preloadPlugins"] || []; + var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + if (typeof Browser != "undefined") Browser.init(); + var handled = false; + preloadPlugins.forEach((plugin) => { + if (handled) return; + if (plugin["canHandle"](fullname)) { + plugin["handle"](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; + }; + var FS_createPreloadedFile = ( + parent, + name, + url, + canRead, + canWrite, + onload, + onerror, + dontCreateFile, + canOwn, + preFinish, + ) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + function processData(byteArray) { + function finish(byteArray) { + preFinish?.(); + if (!dontCreateFile) { + FS_createDataFile( + parent, + name, + byteArray, + canRead, + canWrite, + canOwn, + ); + } + onload?.(); + removeRunDependency(dep); + } + if ( + FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + onerror?.(); + removeRunDependency(dep); + }) + ) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url).then(processData, onerror); + } else { + processData(url); + } + }; + var FS_modeStringToFlags = (str) => { + var flagModes = { + r: 0, + "r+": 2, + w: 512 | 64 | 1, + "w+": 512 | 64 | 2, + a: 1024 | 64 | 1, + "a+": 1024 | 64 | 2, + }; + var flags = flagModes[str]; + if (typeof flags == "undefined") { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; + }; + var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }; + var strError = (errno) => UTF8ToString(_strerror(errno)); + var ERRNO_CODES = { + EPERM: 63, + ENOENT: 44, + ESRCH: 71, + EINTR: 27, + EIO: 29, + ENXIO: 60, + E2BIG: 1, + ENOEXEC: 45, + EBADF: 8, + ECHILD: 12, + EAGAIN: 6, + EWOULDBLOCK: 6, + ENOMEM: 48, + EACCES: 2, + EFAULT: 21, + ENOTBLK: 105, + EBUSY: 10, + EEXIST: 20, + EXDEV: 75, + ENODEV: 43, + ENOTDIR: 54, + EISDIR: 31, + EINVAL: 28, + ENFILE: 41, + EMFILE: 33, + ENOTTY: 59, + ETXTBSY: 74, + EFBIG: 22, + ENOSPC: 51, + ESPIPE: 70, + EROFS: 69, + EMLINK: 34, + EPIPE: 64, + EDOM: 18, + ERANGE: 68, + ENOMSG: 49, + EIDRM: 24, + ECHRNG: 106, + EL2NSYNC: 156, + EL3HLT: 107, + EL3RST: 108, + ELNRNG: 109, + EUNATCH: 110, + ENOCSI: 111, + EL2HLT: 112, + EDEADLK: 16, + ENOLCK: 46, + EBADE: 113, + EBADR: 114, + EXFULL: 115, + ENOANO: 104, + EBADRQC: 103, + EBADSLT: 102, + EDEADLOCK: 16, + EBFONT: 101, + ENOSTR: 100, + ENODATA: 116, + ETIME: 117, + ENOSR: 118, + ENONET: 119, + ENOPKG: 120, + EREMOTE: 121, + ENOLINK: 47, + EADV: 122, + ESRMNT: 123, + ECOMM: 124, + EPROTO: 65, + EMULTIHOP: 36, + EDOTDOT: 125, + EBADMSG: 9, + ENOTUNIQ: 126, + EBADFD: 127, + EREMCHG: 128, + ELIBACC: 129, + ELIBBAD: 130, + ELIBSCN: 131, + ELIBMAX: 132, + ELIBEXEC: 133, + ENOSYS: 52, + ENOTEMPTY: 55, + ENAMETOOLONG: 37, + ELOOP: 32, + EOPNOTSUPP: 138, + EPFNOSUPPORT: 139, + ECONNRESET: 15, + ENOBUFS: 42, + EAFNOSUPPORT: 5, + EPROTOTYPE: 67, + ENOTSOCK: 57, + ENOPROTOOPT: 50, + ESHUTDOWN: 140, + ECONNREFUSED: 14, + EADDRINUSE: 3, + ECONNABORTED: 13, + ENETUNREACH: 40, + ENETDOWN: 38, + ETIMEDOUT: 73, + EHOSTDOWN: 142, + EHOSTUNREACH: 23, + EINPROGRESS: 26, + EALREADY: 7, + EDESTADDRREQ: 17, + EMSGSIZE: 35, + EPROTONOSUPPORT: 66, + ESOCKTNOSUPPORT: 137, + EADDRNOTAVAIL: 4, + ENETRESET: 39, + EISCONN: 30, + ENOTCONN: 53, + ETOOMANYREFS: 141, + EUSERS: 136, + EDQUOT: 19, + ESTALE: 72, + ENOTSUP: 138, + ENOMEDIUM: 148, + EILSEQ: 25, + EOVERFLOW: 61, + ECANCELED: 11, + ENOTRECOVERABLE: 56, + EOWNERDEAD: 62, + ESTRPIPE: 135, + }; + var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: class extends Error { + name = "ErrnoError"; + constructor(errno) { + super(runtimeInitialized ? strError(errno) : ""); + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + } + }, + filesystems: null, + syncFSRequests: 0, + readFiles: {}, + FSStream: class { + shared = {}; + get object() { + return this.node; + } + set object(val) { + this.node = val; + } + get isRead() { + return (this.flags & 2097155) !== 1; + } + get isWrite() { + return (this.flags & 2097155) !== 0; + } + get isAppend() { + return this.flags & 1024; + } + get flags() { + return this.shared.flags; + } + set flags(val) { + this.shared.flags = val; + } + get position() { + return this.shared.position; + } + set position(val) { + this.shared.position = val; + } + }, + FSNode: class { + node_ops = {}; + stream_ops = {}; + readMode = 292 | 73; + writeMode = 146; + mounted = null; + constructor(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.rdev = rdev; + this.atime = this.mtime = this.ctime = Date.now(); + } + get read() { + return (this.mode & this.readMode) === this.readMode; + } + set read(val) { + val ? (this.mode |= this.readMode) : (this.mode &= ~this.readMode); + } + get write() { + return (this.mode & this.writeMode) === this.writeMode; + } + set write(val) { + val ? (this.mode |= this.writeMode) : (this.mode &= ~this.writeMode); + } + get isFolder() { + return FS.isDir(this.mode); + } + get isDevice() { + return FS.isChrdev(this.mode); + } + }, + lookupPath(path, opts = {}) { + if (!path) { + throw new FS.ErrnoError(44); + } + opts.follow_mount ??= true; + if (!PATH.isAbs(path)) { + path = FS.cwd() + "/" + path; + } + linkloop: for (var nlinks = 0; nlinks < 40; nlinks++) { + var parts = path.split("/").filter((p) => !!p); + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + if (parts[i] === ".") { + continue; + } + if (parts[i] === "..") { + current_path = PATH.dirname(current_path); + current = current.parent; + continue; + } + current_path = PATH.join2(current_path, parts[i]); + try { + current = FS.lookupNode(current, parts[i]); + } catch (e) { + if (e?.errno === 44 && islast && opts.noent_okay) { + return { path: current_path }; + } + throw e; + } + if (FS.isMountpoint(current) && (!islast || opts.follow_mount)) { + current = current.mounted.root; + } + if (FS.isLink(current.mode) && (!islast || opts.follow)) { + if (!current.node_ops.readlink) { + throw new FS.ErrnoError(52); + } + var link = current.node_ops.readlink(current); + if (!PATH.isAbs(link)) { + link = PATH.dirname(current_path) + "/" + link; + } + path = link + "/" + parts.slice(i + 1).join("/"); + continue linkloop; + } + } + return { path: current_path, node: current }; + } + throw new FS.ErrnoError(32); + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" + ? `${mount}/${path}` + : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = ["r", "w", "rw"][flag & 3]; + if (flag & 512) { + perms += "w"; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + if (!FS.isDir(dir.mode)) return 54; + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + if (!FS.isDir(dir.mode)) { + return 54; + } + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || flags & (512 | 64)) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + checkOpExists(op, err) { + if (!op) { + throw new FS.ErrnoError(err); + } + return op; + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: (fd) => FS.streams[fd], + createStream(stream, fd = -1) { + assert(fd >= -1); + stream = Object.assign(new FS.FSStream(), stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + dupStream(origStream, fd = -1) { + var stream = FS.createStream(origStream, fd); + stream.stream_ops?.dup?.(stream); + return stream; + }, + doSetAttr(stream, node, attr) { + var setattr = stream?.stream_ops.setattr; + var arg = setattr ? stream : node; + setattr ??= node.node_ops.setattr; + FS.checkOpExists(setattr, 63); + setattr(arg, attr); + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + stream.stream_ops = device.stream_ops; + stream.stream_ops.open?.(stream); + }, + llseek() { + throw new FS.ErrnoError(70); + }, + }, + major: (dev) => dev >> 8, + minor: (dev) => dev & 255, + makedev: (ma, mi) => (ma << 8) | mi, + registerDevice(dev, ops) { + FS.devices[dev] = { stream_ops: ops }; + }, + getDevice: (dev) => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [mount]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push(...m.mounts); + } + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err( + `warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`, + ); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + mounts.forEach((mount) => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + if (typeof type == "string") { + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + mountpoint = lookup.path; + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { type, opts, mountpoint, mounts: [] }; + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach((hash) => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + node.mounted = null; + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name) { + throw new FS.ErrnoError(28); + } + if (name === "." || name === "..") { + throw new FS.ErrnoError(20); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + statfs(path) { + return FS.statfsNode(FS.lookupPath(path, { follow: true }).node); + }, + statfsStream(stream) { + return FS.statfsNode(stream.node); + }, + statfsNode(node) { + var rtn = { + bsize: 4096, + frsize: 4096, + blocks: 1e6, + bfree: 5e5, + bavail: 5e5, + files: FS.nextInode, + ffree: FS.nextInode - 1, + fsid: 42, + flags: 2, + namelen: 255, + }; + if (node.node_ops.statfs) { + Object.assign(rtn, node.node_ops.statfs(node.mount.opts.root)); + } + return rtn; + }, + create(path, mode = 438) { + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode = 511) { + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + var lookup, old_dir, new_dir; + lookup = FS.lookupPath(old_path, { parent: true }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { parent: true }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + var old_node = FS.lookupNode(old_dir, old_name); + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (old_node === new_node) { + return; + } + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + errCode = new_node + ? FS.mayDelete(new_dir, new_name, isdir) + : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if ( + FS.isMountpoint(old_node) || + (new_node && FS.isMountpoint(new_node)) + ) { + throw new FS.ErrnoError(10); + } + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + FS.hashRemoveNode(old_node); + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + old_node.parent = new_dir; + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + var readdir = FS.checkOpExists(node.node_ops.readdir, 54); + return readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return link.node_ops.readlink(link); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + var node = lookup.node; + var getattr = FS.checkOpExists(node.node_ops.getattr, 63); + return getattr(node); + }, + fstat(fd) { + var stream = FS.getStreamChecked(fd); + var node = stream.node; + var getattr = stream.stream_ops.getattr; + var arg = getattr ? stream : node; + getattr ??= node.node_ops.getattr; + FS.checkOpExists(getattr, 63); + return getattr(arg); + }, + lstat(path) { + return FS.stat(path, true); + }, + doChmod(stream, node, mode, dontFollow) { + FS.doSetAttr(stream, node, { + mode: (mode & 4095) | (node.mode & ~4095), + ctime: Date.now(), + dontFollow, + }); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + FS.doChmod(null, node, mode, dontFollow); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.doChmod(stream, stream.node, mode, false); + }, + doChown(stream, node, dontFollow) { + FS.doSetAttr(stream, node, { timestamp: Date.now(), dontFollow }); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + FS.doChown(null, node, dontFollow); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.doChown(stream, stream.node, false); + }, + doTruncate(stream, node, len) { + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.doSetAttr(stream, node, { size: len, timestamp: Date.now() }); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: true }); + node = lookup.node; + } else { + node = path; + } + FS.doTruncate(null, node, len); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if (len < 0 || (stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.doTruncate(stream, stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + var setattr = FS.checkOpExists(node.node_ops.setattr, 63); + setattr(node, { atime, mtime }); + }, + open(path, flags, mode = 438) { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags; + if (flags & 64) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + var isDirPath; + if (typeof path == "object") { + node = path; + } else { + isDirPath = path.endsWith("/"); + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072), + noent_okay: true, + }); + node = lookup.node; + path = lookup.path; + } + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else if (isDirPath) { + throw new FS.ErrnoError(31); + } else { + node = FS.mknod(path, mode | 511, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + if (flags & 512 && !created) { + FS.truncate(node, 0); + } + flags &= ~(128 | 512 | 131072); + var stream = FS.createStream({ + node, + path: FS.getPath(node), + flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + ungotten: [], + error: false, + }); + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (created) { + FS.chmod(node, mode & 511); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read( + stream, + buffer, + offset, + length, + position, + ); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write( + stream, + buffer, + offset, + length, + position, + canOwn, + ); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + if ( + (prot & 2) !== 0 && + (flags & 2) === 0 && + (stream.flags & 2097155) !== 2 + ) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + if (!length) { + throw new FS.ErrnoError(28); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + assert(offset >= 0); + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync( + stream, + buffer, + offset, + length, + mmapFlags, + ); + }, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices() { + FS.mkdir("/dev"); + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + llseek: () => 0, + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + var randomBuffer = new Uint8Array(1024), + randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomFill(randomBuffer); + randomLeft = randomBuffer.byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice("/dev", "random", randomByte); + FS.createDevice("/dev", "urandom", randomByte); + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories() { + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount( + { + mount() { + var node = FS.createNode(proc_self, "fd", 16895, 73); + node.stream_ops = { llseek: MEMFS.stream_ops.llseek }; + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { mountpoint: "fake" }, + node_ops: { readlink: () => stream.path }, + id: fd + 1, + }; + ret.parent = ret; + return ret; + }, + readdir() { + return Array.from(FS.streams.entries()) + .filter(([k, v]) => v) + .map(([k, v]) => k.toString()); + }, + }; + return node; + }, + }, + {}, + "/proc/self/fd", + ); + }, + createStandardStreams(input, output, error) { + if (input) { + FS.createDevice("/dev", "stdin", input); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (output) { + FS.createDevice("/dev", "stdout", null, output); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (error) { + FS.createDevice("/dev", "stderr", null, error); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, `invalid handle for stdin (${stdin.fd})`); + assert(stdout.fd === 1, `invalid handle for stdout (${stdout.fd})`); + assert(stderr.fd === 2, `invalid handle for stderr (${stderr.fd})`); + }, + staticInit() { + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { MEMFS }; + }, + init(input, output, error) { + assert( + !FS.initialized, + "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)", + ); + FS.initialized = true; + input ??= Module["stdin"]; + output ??= Module["stdout"]; + error ??= Module["stderr"]; + FS.createStandardStreams(input, output, error); + }, + quit() { + FS.initialized = false; + _fflush(0); + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + try { + var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null, + }; + try { + var lookup = FS.lookupPath(path, { parent: true }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) + arr[i] = data.charCodeAt(i); + data = arr; + } + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + }, + createDevice(parent, name, input, output) { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(!!input, !!output); + FS.createDevice.major ??= 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + if (output?.buffer?.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + }, + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) + return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error( + "Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.", + ); + } else { + try { + obj.contents = readBinary(obj.url); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + class LazyUint8Array { + lengthKnown = false; + chunks = []; + get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + } + setDataGetter(getter) { + this.getter = getter; + } + cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open("HEAD", url, false); + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = + (header = xhr.getResponseHeader("Accept-Ranges")) && + header === "bytes"; + var usesGzip = + (header = xhr.getResponseHeader("Content-Encoding")) && + header === "gzip"; + var chunkSize = 1024 * 1024; + if (!hasByteServing) chunkSize = datalength; + var doXHR = (from, to) => { + if (from > to) + throw new Error( + "invalid range (" + + from + + ", " + + to + + ") or no bytes requested!", + ); + if (to > datalength - 1) + throw new Error( + "only " + datalength + " bytes available! programmer error!", + ); + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + if (datalength !== chunkSize) + xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } + return intArrayFromString(xhr.responseText || "", true); + }; + var lazyArray = this; + lazyArray.setDataGetter((chunkNum) => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") + throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out( + "LazyFiles on gzip forces download of the whole file when length is accessed", + ); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + get length() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + get chunkSize() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) + throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array(); + var properties = { isDevice: false, contents: lazyArray }; + } else { + var properties = { isDevice: false, url }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + Object.defineProperties(node, { + usedBytes: { + get: function () { + return this.contents.length; + }, + }, + }); + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach((key) => { + var fn = node.stream_ops[key]; + stream_ops[key] = (...args) => { + FS.forceLoadFile(node); + return fn(...args); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { ptr, allocated: true }; + }; + node.stream_ops = stream_ops; + return node; + }, + absolutePath() { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder() { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink() { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath() { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc() { + abort( + "FS.mmapAlloc has been replaced by the top level function mmapAlloc", + ); + }, + standardizePath() { + abort( + "FS.standardizePath has been removed; use PATH.normalize instead", + ); + }, + }; + var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return dir + "/" + path; + }, + writeStat(buf, stat) { + HEAP32[buf / 4] = stat.dev; + HEAP32[(buf + 4) / 4] = stat.mode; + HEAPU64[(buf + 8) / 8] = BigInt(stat.nlink); + HEAP32[(buf + 16) / 4] = stat.uid; + HEAP32[(buf + 20) / 4] = stat.gid; + HEAP32[(buf + 24) / 4] = stat.rdev; + HEAP64[(buf + 32) / 8] = BigInt(stat.size); + HEAP32[(buf + 40) / 4] = 4096; + HEAP32[(buf + 44) / 4] = stat.blocks; + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + HEAP64[(buf + 48) / 8] = BigInt(Math.floor(atime / 1e3)); + HEAPU64[(buf + 56) / 8] = BigInt((atime % 1e3) * 1e3 * 1e3); + HEAP64[(buf + 64) / 8] = BigInt(Math.floor(mtime / 1e3)); + HEAPU64[(buf + 72) / 8] = BigInt((mtime % 1e3) * 1e3 * 1e3); + HEAP64[(buf + 80) / 8] = BigInt(Math.floor(ctime / 1e3)); + HEAPU64[(buf + 88) / 8] = BigInt((ctime % 1e3) * 1e3 * 1e3); + HEAP64[(buf + 96) / 8] = BigInt(stat.ino); + return 0; + }, + writeStatFs(buf, stats) { + HEAP32[(buf + 8) / 4] = stats.bsize; + HEAP32[(buf + 56) / 4] = stats.bsize; + HEAP32[(buf + 16) / 4] = stats.blocks; + HEAP32[(buf + 20) / 4] = stats.bfree; + HEAP32[(buf + 24) / 4] = stats.bavail; + HEAP32[(buf + 28) / 4] = stats.files; + HEAP32[(buf + 32) / 4] = stats.ffree; + HEAP32[(buf + 36) / 4] = stats.fsid; + HEAP32[(buf + 64) / 4] = stats.flags; + HEAP32[(buf + 48) / 4] = stats.namelen; + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + varargs: undefined, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + }; + function ___syscall_fcntl64(fd, cmd, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: { + var arg = syscallGetVarargI(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.dupStream(stream, arg); + return newStream.fd; + } + case 1: + case 2: + return 0; + case 3: + return stream.flags; + case 4: { + var arg = syscallGetVarargI(); + stream.flags |= arg; + return 0; + } + case 5: { + var arg = syscallGetVarargP(); + var offset = 0; + HEAP16[(arg + offset) / 2] = 2; + return 0; + } + case 6: + case 7: + return 0; + } + return -28; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_fstat64(fd, buf) { + buf = bigintToI53Checked(buf); + try { + return SYSCALLS.writeStat(buf, FS.fstat(fd)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_ioctl(fd, op, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: { + if (!stream.tty) return -59; + return 0; + } + case 21505: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = syscallGetVarargP(); + HEAP32[argp / 4] = termios.c_iflag || 0; + HEAP32[(argp + 4) / 4] = termios.c_oflag || 0; + HEAP32[(argp + 8) / 4] = termios.c_cflag || 0; + HEAP32[(argp + 12) / 4] = termios.c_lflag || 0; + for (var i = 0; i < 32; i++) { + HEAP8[argp + i + 17] = termios.c_cc[i] || 0; + } + return 0; + } + return 0; + } + case 21510: + case 21511: + case 21512: { + if (!stream.tty) return -59; + return 0; + } + case 21506: + case 21507: + case 21508: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = syscallGetVarargP(); + var c_iflag = HEAP32[argp / 4]; + var c_oflag = HEAP32[(argp + 4) / 4]; + var c_cflag = HEAP32[(argp + 8) / 4]; + var c_lflag = HEAP32[(argp + 12) / 4]; + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(HEAP8[argp + i + 17]); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag, + c_oflag, + c_cflag, + c_lflag, + c_cc, + }); + } + return 0; + } + case 21519: { + if (!stream.tty) return -59; + var argp = syscallGetVarargP(); + HEAP32[argp / 4] = 0; + return 0; + } + case 21520: { + if (!stream.tty) return -59; + return -28; + } + case 21531: { + var argp = syscallGetVarargP(); + return FS.ioctl(stream, op, argp); + } + case 21523: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = syscallGetVarargP(); + HEAP16[argp / 2] = winsize[0]; + HEAP16[(argp + 2) / 2] = winsize[1]; + } + return 0; + } + case 21524: { + if (!stream.tty) return -59; + return 0; + } + case 21515: { + if (!stream.tty) return -59; + return 0; + } + default: + return -28; + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_openat(dirfd, path, flags, varargs) { + path = bigintToI53Checked(path); + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? syscallGetVarargI() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + var __abort_js = () => abort("native code called abort()"); + var runtimeKeepaliveCounter = 0; + var __emscripten_runtime_keepalive_clear = () => { + noExitRuntime = false; + runtimeKeepaliveCounter = 0; + }; + function __mmap_js(len, prot, flags, fd, offset, allocated, addr) { + len = bigintToI53Checked(len); + offset = bigintToI53Checked(offset); + allocated = bigintToI53Checked(allocated); + addr = bigintToI53Checked(addr); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var res = FS.mmap(stream, len, offset, prot, flags); + var ptr = res.ptr; + HEAP32[allocated / 4] = res.allocated; + HEAPU64[addr / 8] = BigInt(ptr); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function __munmap_js(addr, len, prot, flags, fd, offset) { + addr = bigintToI53Checked(addr); + len = bigintToI53Checked(len); + offset = bigintToI53Checked(offset); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (prot & 2) { + SYSCALLS.doMsync(addr, stream, len, flags, offset); + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + var timers = {}; + var handleException = (e) => { + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + checkStackCookie(); + if (e instanceof WebAssembly.RuntimeError) { + if (_emscripten_stack_get_current() <= 0) { + err( + "Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)", + ); + } + } + quit_(1, e); + }; + var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0; + var _proc_exit = (code) => { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + Module["onExit"]?.(code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); + }; + var exitJS = (statusw, implicit) => { + EXITSTATUS = statusw; + checkUnflushedContent(); + if (keepRuntimeAlive() && !implicit) { + for (let i = 0; i < instructions.length; i++){ + instructions[i]._rowVariant = ''; + } + status.run_program = -1; // program finished + if (statusw !== 0){ + coreEvents.emit("executor-buttons-update", { + reset_disable: false, + instruction_disable: true, + run_disable: true, + stop_disable: false, + }); + show_notification("Your program has finished with errors.", "danger"); + } else { + coreEvents.emit("executor-buttons-update", { + reset_disable: false, + instruction_disable: false, + run_disable: false, + stop_disable: true, + isFinished: true, + }); + } + var msg = `program exited (with status: ${statusw}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`; + readyPromiseReject(msg); + err(msg); + } + _proc_exit(status); + }; + var _exit = exitJS; + var maybeExit = () => { + if (!keepRuntimeAlive()) { + try { + _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } + }; + var callUserCallback = (func) => { + if (ABORT) { + err( + "user callback triggered after runtime exited or application aborted. Ignoring.", + ); + return; + } + try { + func(); + maybeExit(); + } catch (e) { + handleException(e); + } + }; + var _emscripten_get_now = () => performance.now(); + var __setitimer_js = (which, timeout_ms) => { + if (timers[which]) { + clearTimeout(timers[which].id); + delete timers[which]; + } + if (!timeout_ms) return 0; + var id = setTimeout(() => { + assert(which in timers); + delete timers[which]; + callUserCallback(() => + __emscripten_timeout(which, _emscripten_get_now()), + ); + }, timeout_ms); + timers[which] = { id, timeout_ms }; + return 0; + }; + var _emscripten_set_main_loop_timing = (mode, value) => { + MainLoop.timingMode = mode; + MainLoop.timingValue = value; + if (!MainLoop.func) { + err( + "emscripten_set_main_loop_timing: Cannot set timing mode for main loop since a main loop does not exist! Call emscripten_set_main_loop first to set one up.", + ); + return 1; + } + if (!MainLoop.running) { + MainLoop.running = true; + } + if (mode == 0) { + MainLoop.scheduler = function MainLoop_scheduler_setTimeout() { + var timeUntilNextTick = + Math.max( + 0, + MainLoop.tickStartTime + value - _emscripten_get_now(), + ) | 0; + setTimeout(MainLoop.runner, timeUntilNextTick); + }; + MainLoop.method = "timeout"; + } else if (mode == 1) { + MainLoop.scheduler = function MainLoop_scheduler_rAF() { + MainLoop.requestAnimationFrame(MainLoop.runner); + }; + MainLoop.method = "rAF"; + } else if (mode == 2) { + if (typeof MainLoop.setImmediate == "undefined") { + if (typeof setImmediate == "undefined") { + var setImmediates = []; + var emscriptenMainLoopMessageId = "setimmediate"; + var MainLoop_setImmediate_messageHandler = (event) => { + if ( + event.data === emscriptenMainLoopMessageId || + event.data.target === emscriptenMainLoopMessageId + ) { + event.stopPropagation(); + setImmediates.shift()(); + } + }; + addEventListener( + "message", + MainLoop_setImmediate_messageHandler, + true, + ); + MainLoop.setImmediate = (func) => { + setImmediates.push(func); + if (ENVIRONMENT_IS_WORKER) { + Module["setImmediates"] ??= []; + Module["setImmediates"].push(func); + postMessage({ target: emscriptenMainLoopMessageId }); + } else postMessage(emscriptenMainLoopMessageId, "*"); + }; + } else { + MainLoop.setImmediate = setImmediate; + } + } + MainLoop.scheduler = function MainLoop_scheduler_setImmediate() { + MainLoop.setImmediate(MainLoop.runner); + }; + MainLoop.method = "immediate"; + } + return 0; + }; + var setMainLoop = ( + iterFunc, + fps, + simulateInfiniteLoop, + arg, + noSetTiming, + ) => { + assert( + !MainLoop.func, + "emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.", + ); + MainLoop.func = iterFunc; + MainLoop.arg = arg; + var thisMainLoopId = MainLoop.currentlyRunningMainloop; + function checkIsRunning() { + if (thisMainLoopId < MainLoop.currentlyRunningMainloop) { + maybeExit(); + return false; + } + return true; + } + MainLoop.running = false; + MainLoop.runner = function MainLoop_runner() { + if (ABORT) return; + if (MainLoop.queue.length > 0) { + var start = Date.now(); + var blocker = MainLoop.queue.shift(); + blocker.func(blocker.arg); + if (MainLoop.remainingBlockers) { + var remaining = MainLoop.remainingBlockers; + var next = + remaining % 1 == 0 ? remaining - 1 : Math.floor(remaining); + if (blocker.counted) { + MainLoop.remainingBlockers = next; + } else { + next = next + 0.5; + MainLoop.remainingBlockers = (8 * remaining + next) / 9; + } + } + MainLoop.updateStatus(); + if (!checkIsRunning()) return; + setTimeout(MainLoop.runner, 0); + return; + } + if (!checkIsRunning()) return; + MainLoop.currentFrameNumber = (MainLoop.currentFrameNumber + 1) | 0; + if ( + MainLoop.timingMode == 1 && + MainLoop.timingValue > 1 && + MainLoop.currentFrameNumber % MainLoop.timingValue != 0 + ) { + MainLoop.scheduler(); + return; + } else if (MainLoop.timingMode == 0) { + MainLoop.tickStartTime = _emscripten_get_now(); + } + if (MainLoop.method === "timeout" && Module["ctx"]) { + warnOnce( + "Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!", + ); + MainLoop.method = ""; + } + MainLoop.runIter(iterFunc); + if (!checkIsRunning()) return; + MainLoop.scheduler(); + }; + if (!noSetTiming) { + if (fps > 0) { + _emscripten_set_main_loop_timing(0, 1e3 / fps); + } else { + _emscripten_set_main_loop_timing(1, 1); + } + MainLoop.scheduler(); + } + if (simulateInfiniteLoop) { + throw "unwind"; + } + }; + var MainLoop = { + running: false, + scheduler: null, + method: "", + currentlyRunningMainloop: 0, + func: null, + arg: 0, + timingMode: 0, + timingValue: 0, + currentFrameNumber: 0, + queue: [], + preMainLoop: [], + postMainLoop: [], + pause() { + MainLoop.scheduler = null; + MainLoop.currentlyRunningMainloop++; + }, + resume() { + MainLoop.currentlyRunningMainloop++; + var timingMode = MainLoop.timingMode; + var timingValue = MainLoop.timingValue; + var func = MainLoop.func; + MainLoop.func = null; + setMainLoop(func, 0, false, MainLoop.arg, true); + _emscripten_set_main_loop_timing(timingMode, timingValue); + MainLoop.scheduler(); + }, + updateStatus() { + if (Module["setStatus"]) { + var message = Module["statusMessage"] || "Please wait..."; + var remaining = MainLoop.remainingBlockers ?? 0; + var expected = MainLoop.expectedBlockers ?? 0; + if (remaining) { + if (remaining < expected) { + Module["setStatus"]( + `{message} ({expected - remaining}/{expected})`, + ); + } else { + Module["setStatus"](message); + } + } else { + Module["setStatus"](""); + } + } + }, + init() { + Module["preMainLoop"] && + MainLoop.preMainLoop.push(Module["preMainLoop"]); + Module["postMainLoop"] && + MainLoop.postMainLoop.push(Module["postMainLoop"]); + }, + runIter(func) { + if (ABORT) return; + for (var pre of MainLoop.preMainLoop) { + if (pre() === false) { + return; + } + } + callUserCallback(func); + for (var post of MainLoop.postMainLoop) { + post(); + } + checkStackCookie(); + }, + nextRAF: 0, + fakeRequestAnimationFrame(func) { + var now = Date.now(); + if (MainLoop.nextRAF === 0) { + MainLoop.nextRAF = now + 1e3 / 60; + } else { + while (now + 2 >= MainLoop.nextRAF) { + MainLoop.nextRAF += 1e3 / 60; + } + } + var delay = Math.max(MainLoop.nextRAF - now, 0); + setTimeout(func, delay); + }, + requestAnimationFrame(func) { + if (typeof requestAnimationFrame == "function") { + requestAnimationFrame(func); + return; + } + var RAF = MainLoop.fakeRequestAnimationFrame; + RAF(func); + }, + }; + var _emscripten_date_now = () => Date.now(); + var getHeapMax = () => 2147483648; + var growMemory = (size) => { + var b = wasmMemory.buffer; + var pages = ((size - b.byteLength + 65535) / 65536) | 0; + try { + wasmMemory.grow(BigInt(pages)); + updateMemoryViews(); + return 1; + } catch (e) { + err( + `growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`, + ); + } + }; + function _emscripten_resize_heap(requestedSize) { + requestedSize = bigintToI53Checked(requestedSize); + var oldSize = HEAPU8.length; + assert(requestedSize > oldSize); + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + err( + `Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`, + ); + return false; + } + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); + overGrownHeapSize = Math.min( + overGrownHeapSize, + requestedSize + 100663296, + ); + var newSize = Math.min( + maxHeapSize, + alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536), + ); + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + err( + `Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`, + ); + return false; + } + function _emscripten_run_script_int(ptr) { + ptr = bigintToI53Checked(ptr); + return eval(UTF8ToString(ptr)) | 0; + } + var safeSetTimeout = (func, timeout) => + setTimeout(() => { + callUserCallback(func); + }, timeout); + var _emscripten_sleep = (ms) => + Asyncify.handleSleep((wakeUp) => safeSetTimeout(wakeUp, ms)); + _emscripten_sleep.isAsync = true; + function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[iov / 8]); + var len = Number(HEAPU64[(iov + 8) / 8]); + iov += 16; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; + }; + function _fd_read(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU64[pnum / 8] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + function _fd_seek(fd, offset, whence, newOffset) { + offset = bigintToI53Checked(offset); + newOffset = bigintToI53Checked(newOffset); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + HEAP64[newOffset / 8] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) + stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[iov / 8]); + var len = Number(HEAPU64[(iov + 8) / 8]); + iov += 16; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) { + break; + } + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; + }; + function _fd_write(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU64[pnum / 8] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + assert( + typeof maxBytesToWrite == "number", + "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!", + ); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); + }; + var stackAlloc = (sz) => __emscripten_stack_alloc(sz); + var stringToUTF8OnStack = (str) => { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8(str, ret, size); + return ret; + }; + var runAndAbortIfError = (func) => { + try { + return func(); + } catch (e) { + abort(e); + } + }; + var runtimeKeepalivePush = () => { + runtimeKeepaliveCounter += 1; + }; + var runtimeKeepalivePop = () => { + assert(runtimeKeepaliveCounter > 0); + runtimeKeepaliveCounter -= 1; + }; + var Asyncify = { + rewindArguments: {}, + instrumentWasmImports(imports) { + var importPattern = /^(invoke_.*|__asyncjs__.*)$/; + for (let [x, original] of Object.entries(imports)) { + if (typeof original == "function") { + let isAsyncifyImport = original.isAsync || importPattern.test(x); + imports[x] = (...args) => { + var originalAsyncifyState = Asyncify.state; + try { + return original(...args); + } finally { + var changedToDisabled = + originalAsyncifyState === Asyncify.State.Normal && + Asyncify.state === Asyncify.State.Disabled; + var ignoredInvoke = x.startsWith("invoke_") && true; + if ( + Asyncify.state !== originalAsyncifyState && + !isAsyncifyImport && + !changedToDisabled && + !ignoredInvoke + ) { + throw new Error( + `import ${x} was not in ASYNCIFY_IMPORTS, but changed the state`, + ); + } + } + }; + } + } + }, + saveRewindArguments(funcName, passedArguments) { + return (Asyncify.rewindArguments[funcName] = + Array.from(passedArguments)); + }, + restoreRewindArguments(funcName) { + return Asyncify.rewindArguments[funcName] || []; + }, + instrumentWasmExports(exports) { + var ret = {}; + for (let [x, original] of Object.entries(exports)) { + if (typeof original == "function") { + ret[x] = (...args) => { + Asyncify.exportCallStack.push(x); + try { + Asyncify.saveRewindArguments(x, args); + return original(...args); + } finally { + if (!ABORT) { + var y = Asyncify.exportCallStack.pop(); + assert(y === x); + Asyncify.maybeStopUnwind(); + } + } + }; + } else { + ret[x] = original; + } + } + return ret; + }, + State: { Normal: 0, Unwinding: 1, Rewinding: 2, Disabled: 3 }, + state: 0, + StackSize: 4096, + currData: null, + handleSleepReturnValue: 0, + exportCallStack: [], + callStackNameToId: {}, + callStackIdToName: {}, + callStackId: 0, + asyncPromiseHandlers: null, + sleepCallbacks: [], + getCallStackId(funcName) { + var id = Asyncify.callStackNameToId[funcName]; + if (id === undefined) { + id = Asyncify.callStackId++; + Asyncify.callStackNameToId[funcName] = id; + Asyncify.callStackIdToName[id] = funcName; + } + return id; + }, + maybeStopUnwind() { + if ( + Asyncify.currData && + Asyncify.state === Asyncify.State.Unwinding && + Asyncify.exportCallStack.length === 0 + ) { + Asyncify.state = Asyncify.State.Normal; + runAndAbortIfError(_asyncify_stop_unwind); + if (typeof Fibers != "undefined") { + Fibers.trampoline(); + } + } + }, + whenDone() { + assert( + Asyncify.currData, + "Tried to wait for an async operation when none is in progress.", + ); + assert( + !Asyncify.asyncPromiseHandlers, + "Cannot have multiple async operations in flight at once", + ); + return new Promise((resolve, reject) => { + Asyncify.asyncPromiseHandlers = { resolve, reject }; + }); + }, + allocateData() { + var ptr = _malloc(24 + Asyncify.StackSize); + Asyncify.setDataHeader(ptr, ptr + 24, Asyncify.StackSize); + Asyncify.setDataRewindFunc(ptr); + return ptr; + }, + setDataHeader(ptr, stack, stackSize) { + HEAPU64[ptr / 8] = BigInt(stack); + HEAPU64[(ptr + 8) / 8] = BigInt(stack + stackSize); + }, + setDataRewindFunc(ptr) { + var bottomOfCallStack = Asyncify.exportCallStack[0]; + var rewindId = Asyncify.getCallStackId(bottomOfCallStack); + HEAP32[(ptr + 16) / 4] = rewindId; + }, + getDataRewindFuncName(ptr) { + var id = HEAP32[(ptr + 16) / 4]; + var name = Asyncify.callStackIdToName[id]; + return name; + }, + getDataRewindFunc(name) { + var func = wasmExports[name]; + return func; + }, + doRewind(ptr) { + var name = Asyncify.getDataRewindFuncName(ptr); + var func = Asyncify.getDataRewindFunc(name); + return func(...Asyncify.restoreRewindArguments(name)); + }, + handleSleep(startAsync) { + assert( + Asyncify.state !== Asyncify.State.Disabled, + "Asyncify cannot be done during or after the runtime exits", + ); + if (ABORT) return; + if (Asyncify.state === Asyncify.State.Normal) { + var reachedCallback = false; + var reachedAfterCallback = false; + startAsync((handleSleepReturnValue = 0) => { + assert( + !handleSleepReturnValue || + typeof handleSleepReturnValue == "number" || + typeof handleSleepReturnValue == "boolean", + ); + if (ABORT) return; + Asyncify.handleSleepReturnValue = handleSleepReturnValue; + reachedCallback = true; + if (!reachedAfterCallback) { + return; + } + assert( + !Asyncify.exportCallStack.length, + "Waking up (starting to rewind) must be done from JS, without compiled code on the stack.", + ); + Asyncify.state = Asyncify.State.Rewinding; + runAndAbortIfError(() => _asyncify_start_rewind(Asyncify.currData)); + if (typeof MainLoop != "undefined" && MainLoop.func) { + MainLoop.resume(); + } + var asyncWasmReturnValue, + isError = false; + try { + asyncWasmReturnValue = Asyncify.doRewind(Asyncify.currData); + } catch (err) { + asyncWasmReturnValue = err; + isError = true; + } + var handled = false; + if (!Asyncify.currData) { + var asyncPromiseHandlers = Asyncify.asyncPromiseHandlers; + if (asyncPromiseHandlers) { + Asyncify.asyncPromiseHandlers = null; + (isError + ? asyncPromiseHandlers.reject + : asyncPromiseHandlers.resolve)(asyncWasmReturnValue); + handled = true; + } + } + if (isError && !handled) { + throw asyncWasmReturnValue; + } + }); + reachedAfterCallback = true; + if (!reachedCallback) { + Asyncify.state = Asyncify.State.Unwinding; + Asyncify.currData = Asyncify.allocateData(); + if (typeof MainLoop != "undefined" && MainLoop.func) { + MainLoop.pause(); + } + runAndAbortIfError(() => _asyncify_start_unwind(Asyncify.currData)); + } + } else if (Asyncify.state === Asyncify.State.Rewinding) { + Asyncify.state = Asyncify.State.Normal; + runAndAbortIfError(_asyncify_stop_rewind); + _free(Asyncify.currData); + Asyncify.currData = null; + Asyncify.sleepCallbacks.forEach(callUserCallback); + } else { + abort(`invalid state: ${Asyncify.state}`); + } + return Asyncify.handleSleepReturnValue; + }, + handleAsync(startAsync) { + return Asyncify.handleSleep((wakeUp) => { + startAsync().then(wakeUp); + }); + }, + }; + var getCFunc = (ident) => { + var func = Module["_" + ident]; + assert( + func, + "Cannot call unknown function " + ident + ", make sure it is exported", + ); + return func; + }; + var writeArrayToMemory = (array, buffer) => { + assert( + array.length >= 0, + "writeArrayToMemory array must have a length (should be an array or typed array)", + ); + HEAP8.set(array, buffer); + }; + var ccall = (ident, returnType, argTypes, args, opts) => { + var toC = { + pointer: (p) => BigInt(p), + string: (str) => { + var ret = 0; + if (str !== null && str !== undefined && str !== 0) { + ret = stringToUTF8OnStack(str); + } + return BigInt(ret); + }, + array: (arr) => { + var ret = stackAlloc(arr.length); + writeArrayToMemory(arr, ret); + return BigInt(ret); + }, + }; + function convertReturnValue(ret) { + if (returnType === "string") { + return UTF8ToString(Number(ret)); + } + if (returnType === "pointer") return Number(ret); + if (returnType === "boolean") return Boolean(ret); + return ret; + } + var func = getCFunc(ident); + var cArgs = []; + var stack = 0; + assert(returnType !== "array", 'Return type should not be "array".'); + if (args) { + for (var i = 0; i < args.length; i++) { + var converter = toC[argTypes[i]]; + if (converter) { + if (stack === 0) stack = stackSave(); + cArgs[i] = converter(args[i]); + } else { + cArgs[i] = args[i]; + } + } + } + var previousAsync = Asyncify.currData; + var ret = func(...cArgs); + function onDone(ret) { + runtimeKeepalivePop(); + if (stack !== 0) stackRestore(stack); + return convertReturnValue(ret); + } + var asyncMode = opts?.async; + runtimeKeepalivePush(); + if (Asyncify.currData != previousAsync) { + assert( + !(previousAsync && Asyncify.currData), + "We cannot start an async operation when one is already flight", + ); + assert( + !(previousAsync && !Asyncify.currData), + "We cannot stop an async operation in flight", + ); + assert( + asyncMode, + "The call to " + + ident + + " is running asynchronously. If this was intended, add the async option to the ccall/cwrap call.", + ); + return Asyncify.whenDone().then(onDone); + } + ret = onDone(ret); + if (asyncMode) return Promise.resolve(ret); + return ret; + }; + FS.createPreloadedFile = FS_createPreloadedFile; + FS.staticInit(); + Module["requestAnimationFrame"] = MainLoop.requestAnimationFrame; + Module["pauseMainLoop"] = MainLoop.pause; + Module["resumeMainLoop"] = MainLoop.resume; + MainLoop.init(); + function checkIncomingModuleAPI() { + ignoredModuleProp("fetchSettings"); + } + var wasmImports = { + __assert_fail: ___assert_fail, + __syscall_fcntl64: ___syscall_fcntl64, + __syscall_fstat64: ___syscall_fstat64, + __syscall_ioctl: ___syscall_ioctl, + __syscall_openat: ___syscall_openat, + _abort_js: __abort_js, + _emscripten_runtime_keepalive_clear: __emscripten_runtime_keepalive_clear, + _mmap_js: __mmap_js, + _munmap_js: __munmap_js, + _setitimer_js: __setitimer_js, + emscripten_date_now: _emscripten_date_now, + emscripten_resize_heap: _emscripten_resize_heap, + emscripten_run_script_int: _emscripten_run_script_int, + emscripten_sleep: _emscripten_sleep, + exit: _exit, + fd_close: _fd_close, + fd_read: _fd_read, + fd_seek: _fd_seek, + fd_write: _fd_write, + proc_exit: _proc_exit, + }; + var wasmExports = await createWasm(); + var ___wasm_call_ctors = createExportWrapper("__wasm_call_ctors", 0); + var _malloc = (Module["_malloc"] = createExportWrapper("malloc", 1)); + var _free = (Module["_free"] = createExportWrapper("free", 1)); + var _send_int_to_C = (Module["_send_int_to_C"] = createExportWrapper( + "send_int_to_C", + 1, + )); + var _send_float_to_C = (Module["_send_float_to_C"] = createExportWrapper( + "send_float_to_C", + 1, + )); + var _send_double_to_C = (Module["_send_double_to_C"] = createExportWrapper( + "send_double_to_C", + 1, + )); + var _send_char_to_C = (Module["_send_char_to_C"] = createExportWrapper( + "send_char_to_C", + 1, + )); + var _send_string_to_C = (Module["_send_string_to_C"] = createExportWrapper( + "send_string_to_C", + 1, + )); + var _reanudar_ejecucion = (Module["_reanudar_ejecucion"] = + createExportWrapper("reanudar_ejecucion", 1)); + var _strerror = createExportWrapper("strerror", 1); + var _fflush = createExportWrapper("fflush", 1); + var _main = (Module["_main"] = createExportWrapper("__main_argc_argv", 2)); + var _emscripten_builtin_memalign = createExportWrapper( + "emscripten_builtin_memalign", + 2, + ); + var __emscripten_timeout = createExportWrapper("_emscripten_timeout", 2); + var _emscripten_stack_init = wasmExports["emscripten_stack_init"]; + var _emscripten_stack_get_free = wasmExports["emscripten_stack_get_free"]; + var _emscripten_stack_get_base = wasmExports["emscripten_stack_get_base"]; + var _emscripten_stack_get_end = wasmExports["emscripten_stack_get_end"]; + var __emscripten_stack_restore = wasmExports["_emscripten_stack_restore"]; + var __emscripten_stack_alloc = wasmExports["_emscripten_stack_alloc"]; + var _emscripten_stack_get_current = + wasmExports["emscripten_stack_get_current"]; + var ___cxa_increment_exception_refcount = createExportWrapper( + "__cxa_increment_exception_refcount", + 1, + ); + var dynCall_jj = (Module["dynCall_jj"] = createExportWrapper( + "dynCall_jj", + 2, + )); + var dynCall_jjjj = (Module["dynCall_jjjj"] = createExportWrapper( + "dynCall_jjjj", + 4, + )); + var dynCall_vjj = (Module["dynCall_vjj"] = createExportWrapper( + "dynCall_vjj", + 3, + )); + var dynCall_ijjj = (Module["dynCall_ijjj"] = createExportWrapper( + "dynCall_ijjj", + 4, + )); + var dynCall_ijii = (Module["dynCall_ijii"] = createExportWrapper( + "dynCall_ijii", + 4, + )); + var dynCall_ij = (Module["dynCall_ij"] = createExportWrapper( + "dynCall_ij", + 2, + )); + var dynCall_jjii = (Module["dynCall_jjii"] = createExportWrapper( + "dynCall_jjii", + 4, + )); + var dynCall_jjji = (Module["dynCall_jjji"] = createExportWrapper( + "dynCall_jjji", + 4, + )); + var dynCall_ijdiiii = (Module["dynCall_ijdiiii"] = createExportWrapper( + "dynCall_ijdiiii", + 7, + )); + var dynCall_v = (Module["dynCall_v"] = createExportWrapper("dynCall_v", 1)); + var dynCall_vi = (Module["dynCall_vi"] = createExportWrapper( + "dynCall_vi", + 2, + )); + var _asyncify_start_unwind = createExportWrapper( + "asyncify_start_unwind", + 1, + ); + var _asyncify_stop_unwind = createExportWrapper("asyncify_stop_unwind", 0); + var _asyncify_start_rewind = createExportWrapper( + "asyncify_start_rewind", + 1, + ); + var _asyncify_stop_rewind = createExportWrapper("asyncify_stop_rewind", 0); + function applySignatureConversions(wasmExports) { + wasmExports = Object.assign({}, wasmExports); + var makeWrapper_pp = (f) => (a0) => Number(f(BigInt(a0))); + var makeWrapper__p = (f) => (a0) => f(BigInt(a0)); + var makeWrapper_p_ = (f) => (a0) => Number(f(a0)); + var makeWrapper___PP = (f) => (a0, a1, a2) => + f(a0, BigInt(a1 ? a1 : 0), BigInt(a2 ? a2 : 0)); + var makeWrapper_ppp = (f) => (a0, a1) => + Number(f(BigInt(a0), BigInt(a1))); + var makeWrapper_p = (f) => () => Number(f()); + var makeWrapper__p_ = (f) => (a0, a1) => f(BigInt(a0), a1); + var makeWrapper__p___ = (f) => (a0, a1, a2, a3) => + f(BigInt(a0), a1, a2, a3); + var makeWrapper__p__ = (f) => (a0, a1, a2) => f(BigInt(a0), a1, a2); + var makeWrapper__p______ = (f) => (a0, a1, a2, a3, a4, a5, a6) => + f(BigInt(a0), a1, a2, a3, a4, a5, a6); + wasmExports["malloc"] = makeWrapper_pp(wasmExports["malloc"]); + wasmExports["free"] = makeWrapper__p(wasmExports["free"]); + wasmExports["strerror"] = makeWrapper_p_(wasmExports["strerror"]); + wasmExports["fflush"] = makeWrapper__p(wasmExports["fflush"]); + wasmExports["__main_argc_argv"] = makeWrapper___PP( + wasmExports["__main_argc_argv"], + ); + wasmExports["emscripten_builtin_memalign"] = makeWrapper_ppp( + wasmExports["emscripten_builtin_memalign"], + ); + wasmExports["emscripten_stack_get_base"] = makeWrapper_p( + wasmExports["emscripten_stack_get_base"], + ); + wasmExports["emscripten_stack_get_end"] = makeWrapper_p( + wasmExports["emscripten_stack_get_end"], + ); + wasmExports["_emscripten_stack_restore"] = makeWrapper__p( + wasmExports["_emscripten_stack_restore"], + ); + wasmExports["_emscripten_stack_alloc"] = makeWrapper_pp( + wasmExports["_emscripten_stack_alloc"], + ); + wasmExports["emscripten_stack_get_current"] = makeWrapper_p( + wasmExports["emscripten_stack_get_current"], + ); + wasmExports["__cxa_increment_exception_refcount"] = makeWrapper__p( + wasmExports["__cxa_increment_exception_refcount"], + ); + wasmExports["dynCall_jj"] = makeWrapper__p_(wasmExports["dynCall_jj"]); + wasmExports["dynCall_jjjj"] = makeWrapper__p___( + wasmExports["dynCall_jjjj"], + ); + wasmExports["dynCall_vjj"] = makeWrapper__p__(wasmExports["dynCall_vjj"]); + wasmExports["dynCall_ijjj"] = makeWrapper__p___( + wasmExports["dynCall_ijjj"], + ); + wasmExports["dynCall_ijii"] = makeWrapper__p___( + wasmExports["dynCall_ijii"], + ); + wasmExports["dynCall_ij"] = makeWrapper__p_(wasmExports["dynCall_ij"]); + wasmExports["dynCall_jjii"] = makeWrapper__p___( + wasmExports["dynCall_jjii"], + ); + wasmExports["dynCall_jjji"] = makeWrapper__p___( + wasmExports["dynCall_jjji"], + ); + wasmExports["dynCall_ijdiiii"] = makeWrapper__p______( + wasmExports["dynCall_ijdiiii"], + ); + wasmExports["dynCall_v"] = makeWrapper__p(wasmExports["dynCall_v"]); + wasmExports["dynCall_vi"] = makeWrapper__p_(wasmExports["dynCall_vi"]); + wasmExports["asyncify_start_unwind"] = makeWrapper__p( + wasmExports["asyncify_start_unwind"], + ); + wasmExports["asyncify_start_rewind"] = makeWrapper__p( + wasmExports["asyncify_start_rewind"], + ); + return wasmExports; + } + Module["run"] = run; + Module["callMain"] = callMain; + Module["ccall"] = ccall; + Module["stringToUTF8"] = stringToUTF8; + Module["lengthBytesUTF8"] = lengthBytesUTF8; + Module["FS"] = FS; + var missingLibrarySymbols = [ + "writeI53ToI64", + "writeI53ToI64Clamped", + "writeI53ToI64Signaling", + "writeI53ToU64Clamped", + "writeI53ToU64Signaling", + "readI53FromI64", + "readI53FromU64", + "convertI32PairToI53", + "convertI32PairToI53Checked", + "convertU32PairToI53", + "getTempRet0", + "setTempRet0", + "inetPton4", + "inetNtop4", + "inetPton6", + "inetNtop6", + "readSockaddr", + "writeSockaddr", + "emscriptenLog", + "readEmAsmArgs", + "jstoi_q", + "getExecutableName", + "listenOnce", + "autoResumeAudioContext", + "dynCallLegacy", + "getDynCaller", + "dynCall", + "asmjsMangle", + "HandleAllocator", + "getNativeTypeSize", + "addOnInit", + "addOnPostCtor", + "addOnPreMain", + "addOnExit", + "STACK_SIZE", + "STACK_ALIGN", + "POINTER_SIZE", + "ASSERTIONS", + "cwrap", + "uleb128Encode", + "generateFuncType", + "convertJsFunctionToWasm", + "getEmptyTableSlot", + "updateTableMap", + "getFunctionAddress", + "addFunction", + "removeFunction", + "reallyNegative", + "unSign", + "strLen", + "reSign", + "formatString", + "intArrayToString", + "AsciiToString", + "stringToAscii", + "UTF16ToString", + "stringToUTF16", + "lengthBytesUTF16", + "UTF32ToString", + "stringToUTF32", + "lengthBytesUTF32", + "stringToNewUTF8", + "registerKeyEventCallback", + "maybeCStringToJsString", + "findEventTarget", + "getBoundingClientRect", + "fillMouseEventData", + "registerMouseEventCallback", + "registerWheelEventCallback", + "registerUiEventCallback", + "registerFocusEventCallback", + "fillDeviceOrientationEventData", + "registerDeviceOrientationEventCallback", + "fillDeviceMotionEventData", + "registerDeviceMotionEventCallback", + "screenOrientation", + "fillOrientationChangeEventData", + "registerOrientationChangeEventCallback", + "fillFullscreenChangeEventData", + "registerFullscreenChangeEventCallback", + "JSEvents_requestFullscreen", + "JSEvents_resizeCanvasForFullscreen", + "registerRestoreOldStyle", + "hideEverythingExceptGivenElement", + "restoreHiddenElements", + "setLetterbox", + "softFullscreenResizeWebGLRenderTarget", + "doRequestFullscreen", + "fillPointerlockChangeEventData", + "registerPointerlockChangeEventCallback", + "registerPointerlockErrorEventCallback", + "requestPointerLock", + "fillVisibilityChangeEventData", + "registerVisibilityChangeEventCallback", + "registerTouchEventCallback", + "fillGamepadEventData", + "registerGamepadEventCallback", + "registerBeforeUnloadEventCallback", + "fillBatteryEventData", + "battery", + "registerBatteryEventCallback", + "setCanvasElementSize", + "getCanvasElementSize", + "jsStackTrace", + "getCallstack", + "convertPCtoSourceLocation", + "getEnvStrings", + "checkWasiClock", + "wasiRightsToMuslOFlags", + "wasiOFlagsToMuslOFlags", + "setImmediateWrapped", + "safeRequestAnimationFrame", + "clearImmediateWrapped", + "registerPostMainLoop", + "registerPreMainLoop", + "getPromise", + "makePromise", + "idsToPromises", + "makePromiseCallback", + "ExceptionInfo", + "findMatchingCatch", + "Browser_asyncPrepareDataCounter", + "isLeapYear", + "ydayFromDate", + "arraySum", + "addDays", + "getSocketFromFD", + "getSocketAddress", + "FS_unlink", + "FS_mkdirTree", + "_setNetworkCallback", + "heapObjectForWebGLType", + "toTypedArrayIndex", + "webgl_enable_ANGLE_instanced_arrays", + "webgl_enable_OES_vertex_array_object", + "webgl_enable_WEBGL_draw_buffers", + "webgl_enable_WEBGL_multi_draw", + "webgl_enable_EXT_polygon_offset_clamp", + "webgl_enable_EXT_clip_control", + "webgl_enable_WEBGL_polygon_mode", + "emscriptenWebGLGet", + "computeUnpackAlignedImageSize", + "colorChannelsInGlTextureFormat", + "emscriptenWebGLGetTexPixelData", + "emscriptenWebGLGetUniform", + "webglGetUniformLocation", + "webglPrepareUniformLocationsBeforeFirstUse", + "webglGetLeftBracePos", + "emscriptenWebGLGetVertexAttrib", + "__glGetActiveAttribOrUniform", + "writeGLArray", + "registerWebGlEventCallback", + "ALLOC_NORMAL", + "ALLOC_STACK", + "allocate", + "writeStringToMemory", + "writeAsciiToMemory", + "setErrNo", + "demangle", + "stackTrace", + ]; + missingLibrarySymbols.forEach(missingLibrarySymbol); + var unexportedSymbols = [ + "addRunDependency", + "removeRunDependency", + "out", + "err", + "abort", + "wasmMemory", + "wasmExports", + "writeStackCookie", + "checkStackCookie", + "INT53_MAX", + "INT53_MIN", + "bigintToI53Checked", + "stackSave", + "stackRestore", + "stackAlloc", + "ptrToString", + "zeroMemory", + "exitJS", + "getHeapMax", + "growMemory", + "ENV", + "ERRNO_CODES", + "strError", + "DNS", + "Protocols", + "Sockets", + "timers", + "warnOnce", + "readEmAsmArgsArray", + "jstoi_s", + "handleException", + "keepRuntimeAlive", + "runtimeKeepalivePush", + "runtimeKeepalivePop", + "callUserCallback", + "maybeExit", + "asyncLoad", + "alignMemory", + "mmapAlloc", + "wasmTable", + "noExitRuntime", + "addOnPreRun", + "addOnPostRun", + "getCFunc", + "sigToWasmTypes", + "freeTableIndexes", + "functionsInTableMap", + "setValue", + "getValue", + "PATH", + "PATH_FS", + "UTF8Decoder", + "UTF8ArrayToString", + "UTF8ToString", + "stringToUTF8Array", + "intArrayFromString", + "UTF16Decoder", + "stringToUTF8OnStack", + "writeArrayToMemory", + "JSEvents", + "specialHTMLTargets", + "findCanvasEventTarget", + "currentFullscreenStrategy", + "restoreOldWindowedStyle", + "UNWIND_CACHE", + "ExitStatus", + "doReadv", + "doWritev", + "initRandomFill", + "randomFill", + "safeSetTimeout", + "emSetImmediate", + "emClearImmediate_deps", + "emClearImmediate", + "promiseMap", + "uncaughtExceptionCount", + "exceptionLast", + "exceptionCaught", + "Browser", + "getPreloadedImageData__data", + "wget", + "MONTH_DAYS_REGULAR", + "MONTH_DAYS_LEAP", + "MONTH_DAYS_REGULAR_CUMULATIVE", + "MONTH_DAYS_LEAP_CUMULATIVE", + "SYSCALLS", + "preloadPlugins", + "FS_createPreloadedFile", + "FS_modeStringToFlags", + "FS_getMode", + "FS_stdin_getChar_buffer", + "FS_stdin_getChar", + "FS_createPath", + "FS_createDevice", + "FS_readFile", + "FS_createDataFile", + "FS_createLazyFile", + "MEMFS", + "TTY", + "PIPEFS", + "SOCKFS", + "tempFixedLengthArray", + "miniTempWebGLFloatBuffers", + "miniTempWebGLIntBuffers", + "GL", + "AL", + "GLUT", + "EGL", + "GLEW", + "IDBStore", + "runAndAbortIfError", + "Asyncify", + "Fibers", + "SDL", + "SDL_gfx", + "allocateUTF8", + "allocateUTF8OnStack", + "print", + "printErr", + ]; + unexportedSymbols.forEach(unexportedRuntimeSymbol); + var calledRun; + function callMain(args = []) { + assert( + runDependencies == 0, + 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])', + ); + assert( + typeof onPreRuns === "undefined" || onPreRuns.length == 0, + "cannot call main when preRun functions remain to be called", + ); + var entryFunction = _main; + args.unshift(thisProgram); + var argc = args.length; + var argv = stackAlloc((argc + 1) * 8); + var argv_ptr = argv; + args.forEach((arg) => { + HEAPU64[argv_ptr / 8] = BigInt(stringToUTF8OnStack(arg)); + argv_ptr += 8; + }); + HEAPU64[argv_ptr / 8] = BigInt(0); + try { + var ret = entryFunction(argc, BigInt(argv)); + exitJS(ret, true); + return ret; + } catch (e) { + return handleException(e); + } + } + function stackCheckInit() { + _emscripten_stack_init(); + writeStackCookie(); + } + function run(args = arguments_) { + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + stackCheckInit(); + preRun(); + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + function doRun() { + assert(!calledRun); + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + FS.writeFile("./output.elf", args[0]); + args.shift(); + preMain(); + readyPromiseResolve(Module); + Module["onRuntimeInitialized"]?.(); + var noInitialRun = Module["noInitialRun"]; + legacyModuleProp("noInitialRun", "noInitialRun"); + callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(() => { + setTimeout(() => Module["setStatus"](""), 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); + } + function checkUnflushedContent() { + var oldOut = out; + var oldErr = err; + var has = false; + out = err = (x) => { + has = true; + }; + try { + _fflush(0); + ["stdout", "stderr"].forEach((name) => { + var info = FS.analyzePath("/dev/" + name); + if (!info) return; + var stream = info.object; + var rdev = stream.rdev; + var tty = TTY.ttys[rdev]; + if (tty?.output?.length) { + has = true; + } + }); + } catch (e) {} + out = oldOut; + err = oldErr; + if (has) { + warnOnce( + "stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.", + ); + } + } + if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") + Module["preInit"] = [Module["preInit"]]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } + } + // run(); + moduleRtn = readyPromise; + for (const prop of Object.keys(Module)) { + if (!(prop in moduleArg)) { + Object.defineProperty(moduleArg, prop, { + configurable: true, + get() { + abort( + `Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`, + ); + }, + }); + } + } + + readyPromiseResolve(Module); + return moduleRtn; + }; +})(); +(() => { + // Create a small, never-async wrapper around Module which + // checks for callers incorrectly using it with `new`. + var real_Module = Module; + Module = function (arg) { + if (new.target) + throw new Error("Module() should not be called with `new Module()`"); + return real_Module(arg); + }; +})(); +export default Module; diff --git a/src/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.wasm b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.wasm new file mode 100755 index 000000000..b9574ecfd Binary files /dev/null and b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.wasm differ diff --git a/src/core/executor/sailSimRV/wasm/riscv_sim_RV64.js b/src/core/executor/sailSimRV/wasm/riscv_sim_RV64.js new file mode 100644 index 000000000..1ceffd49f --- /dev/null +++ b/src/core/executor/sailSimRV/wasm/riscv_sim_RV64.js @@ -0,0 +1,5741 @@ +import { setInstructions, clear_instructions, instructions } from "@/core/assembler/assembler.mjs"; +import { readRegister, writeRegister, notifyRegisterUpdate } from "@/core/register/registerOperations.mjs"; +import { crex_findReg_bytag, crex_findReg } from "@/core/register/registerLookup.mjs" +import { status, PC_REG_INDEX, REGISTERS, getPC, main_memory, config_cache, L1_cache_memory, L1_I_cache_memory, L1_D_cache_memory, L2_D_cache_memory, L2_I_cache_memory, L2_cache_memory, updateCacheMem } from "@/core/core.mjs"; +import { display_print } from "../../IO.mjs"; +import { SYSCALL } from "@/core/capi/syscall.mts"; +import { coreEvents } from "@/core/events.mts"; +import { show_notification } from "@/core/utils/notifications.mts"; +import { architecture } from "../../../core.mjs"; +import { clearAllRegisterGlows } from "@/core/register/registerGlowState.mjs"; + +export var userMode64 = false; + +var Module = (() => { + var _scriptName = import.meta.url; + var insn_number; + + return async function (moduleArg = {}) { + document.app.$data.is_breakpoint = instructions[0].Break; + var pc_sail = crex_findReg_bytag("program_counter"); + var pc_min = architecture.memory_layout.text.start; + var pc_max = architecture.memory_layout.text.end; + var hiden_executed, hiden_next_execute; + + var registers_before_function = [ + { name: "t0", can_operate : false}, + { name: "t1", can_operate : false}, + { name: "t2", can_operate : false}, + { name: "t3", can_operate : false}, + { name: "t4", can_operate : false}, + { name: "t5", can_operate : false}, + { name: "t6", can_operate : false}, + { name: "s0", can_operate : false}, + { name: "s1", can_operate : false}, + { name: "s2", can_operate : false}, + { name: "s3", can_operate : false}, + { name: "s4", can_operate : false}, + { name: "s5", can_operate : false}, + { name: "s6", can_operate : false}, + { name: "s7", can_operate : false}, + { name: "s8", can_operate : false}, + { name: "s9", can_operate : false}, + { name: "s10", can_operate : false}, + { name: "s11", can_operate : false} + ] + var callstack_convention = []; + var inside_function = false; + Module = Module || {}; + var moduleRtn; + + var Module = moduleArg; + var readyPromiseResolve, readyPromiseReject; + var readyPromise = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; + }); + var ENVIRONMENT_IS_WEB = true; + var ENVIRONMENT_IS_WORKER = false; + var ENVIRONMENT_IS_NODE = false; + var ENVIRONMENT_IS_SHELL = false; + var moduleOverrides = Object.assign({}, Module); + var arguments_ = []; + var thisProgram = "./this.program"; + var quit_ = (status, toThrow) => { + throw toThrow; + }; + var scriptDirectory = ""; + function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; + } + var readAsync, readBinary; + if (ENVIRONMENT_IS_SHELL) { + if ( + (typeof process == "object" && typeof require === "function") || + typeof window == "object" || + typeof WorkerGlobalScope != "undefined" + ) + throw new Error( + "not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)", + ); + } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + if (_scriptName) { + scriptDirectory = _scriptName; + } + if (scriptDirectory.startsWith("blob:")) { + scriptDirectory = ""; + } else { + scriptDirectory = scriptDirectory.slice( + 0, + scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1, + ); + } + if ( + !(typeof window == "object" || typeof WorkerGlobalScope != "undefined") + ) + throw new Error( + "not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)", + ); + { + readAsync = async (url) => { + assert(!isFileURI(url), "readAsync does not work with file:// URLs"); + var response = await fetch(url, { credentials: "same-origin" }); + if (response.ok) { + return response.arrayBuffer(); + } + throw new Error(response.status + " : " + response.url); + }; + } + } else { + throw new Error("environment detection error"); + } + + + // const instructionExp = /\[(\d+)\] \[(\w+)\]: 0x([0-9A-Fa-f]+) \(0x([0-9A-Fa-f]+)\) (\w+) ([^,]+), ([^,]+)(?:, (.+))?/; + var instructionExp = /\[(\d+)\] \[(\w+)\]: 0x([0-9A-Fa-f]+) \(0x([0-9A-Fa-f]+)\) ([\w.]+)(?: ([^,]+), ([^,]+)(?:, (.+))?)?/; + var registerExp = /([xf]\d+) (<-) 0x([0-9A-Fa-f]+)/; // /(x\d+) (<-|->) 0x([0-9A-Fa-f]+)/; + var vectorExp = /(v\d+) (<-) 0x([0-9A-Fa-f]+)/; + var memoryExp = /mem\[0x([0-9A-Fa-f]+)\]\s*(<-|->)\s*0x([0-9A-Fa-f]+)/; + var CSRTypeExp = /(CSR\S*)\s+(\S+)\s+(\S+)\s+(0x)([\dA-Fa-f]{1,16})/; + var CSRExp = /^(CSR)\s+(\w+)\s+(<-|->)\s+0x([0-9a-fA-F]+)(?:\s+(.*))?$/; + var jumpExp = /Next_PC:\s*0x([0-9a-fA-F]+)/; + // var cacheExp = /^\[(\d+)\]\s+(L1_I|L1_D|L1|L2|L2_I|L2_D):\s*\((0x[0-9A-Fa-f]+)\)\s$/; + var cacheExp = /^\[(\d+)\]\s+(L1_I|L1_D|L1|L2|L2_I|L2_D):\s*\((0x[0-9A-Fa-f]+)\)\s*$/; + var configCacheExp = /^Configuration:\s*([A-Za-z_][A-Za-z0-9_]*)\s*<-\s*(\S+)\s*$/; + // var displayExp = /^[A-Za-z\s]+:\s*(.*)$/; + // var displayExp = /^([\w\s]+):\s*(.*)$/; + var displayExp = /^ECALL\s+(SIGNED|UNSIGNED|STRING|CHAR|FLOAT|DOUBLE):\s*(.+)$/; + var instoper = ""; + var syscall_print_code = -1; + var prev_add_to_jump; + // var type_to_write; + + + + function updateCacheStat(index, access, data="") { + switch(access) { + case "Cache L1 hit inst": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 1; + break; + case "Cache L1 miss inst": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + break; + case "Cache L1 miss": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + break; + case "Cache L1 hit data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 1; + break; + case "Cache L1 miss data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 1; + break; + case "Cache L1_I hit": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 1; + break; + case "Cache L1_I miss": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + break; + case "Cache L1_D hit": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 1; + break; + case "Cache L1_D miss": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 1; + break; + case "Cache L2 hit inst": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 1; + break; + case "Cache L2 miss inst": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 1; + break; + case "Cache L2_I hit": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 1; + break; + case "Cache L2_I miss": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 1; + break; + case "Cache L2 hit data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 1; + break; + case "Cache L2 miss data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 1; + break; + case "Cache L2_D hit": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 1; + break; + case "Cache L2_D miss": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 1; + break; + } + + } + + + async function check_call_convention_temp_regs(instMatch) { + if(((instMatch[7] != undefined && (instMatch[7].includes("t") || (instMatch[7].includes("s") && !instMatch[7].includes("sp")) ) ) || (instMatch[8] != undefined && (instMatch[8].includes("t") || (instMatch[8].includes("s") && !instMatch[8].includes("sp")) ))) && instMatch[6] !== undefined && inside_function) { + if((instMatch[5] != "li" && instMatch[5] != "lui" && instMatch[5] != "la") ){ + for (var i = 0; i < callstack_convention[callstack_convention.length - 1].length; i++ ){ + (callstack_convention[callstack_convention.length - 1][i].name === instMatch[7] || callstack_convention[callstack_convention.length - 1][i].name === instMatch[8]) && + (callstack_convention[callstack_convention.length - 1][i].can_operate === false) ? show_notification("Possible failure in the parameter passing convention", "danger") : 0 ; + } + + // callstack_convention[callstack_convention.length - 1].name + + } + } + if (instMatch[6] !== undefined && (instMatch[6].includes("t") || (instMatch[6].includes("s") && !instMatch[6].includes("sp"))) && inside_function) { + for (var i = 0; i < callstack_convention[callstack_convention.length - 1].length; i++ ){ + callstack_convention[callstack_convention.length - 1][i].can_operate = (callstack_convention[callstack_convention.length - 1][i].name === instMatch[6]) ? true : callstack_convention[callstack_convention.length - 1][i].can_operate; + } + } + } + + + + // var to_measure = ""; + var start_m, start_m; + var cache_inst; + + function writeMemory(value, addr) { + // Primero pasar el valor al formato hexadecimal por pares + if (value.startsWith("0x")) + value = value.slice(2); + if (value.length % 2 !== 0) + value = "0" + value; + + // const bytes = new Uint8Array(value.length / 2); + for (let i = 0; i < value.length / 2; i ++) { + main_memory.write((addr + BigInt(i)), Number("0x" + value.substring(i*2, i * 2 + 2))); + } + + // if (memoMatch[2] === '<-'){ + // switch(op){ + // case 'sh': // Para almacenar un half + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + // break; + // case 'sb': // Para almacenar un byte + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'sw': // Para almacenar un int/word + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'fsw': // Para almacenar un float + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'float'); + // break; + // case 'fsd': // Para almacenar un double + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // case 'vse8.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'vse16.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + // break; + // case 'vse32.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'vse64.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // default: + // break; + // } + // } + } + + // var no_print_more = false; + Module['print'] = function (message) { + // console.log(message); + if (message === "Divergence execution detected: Aborted.") + show_notification(message, "danger"); + if (message === "err call_convenction") + show_notification("Possible failure in the parameter passing convention", "warning"); + + if (message === "May your execution has an infinity loop."){ + document.app.$data.execution_mode_run = 1; + show_notification("May your execution has an infinity loop", "danger"); + instructions[hiden_executed]._rowVariant = "info"; + instructions[hiden_next_execute]._rowVariant = "success"; + } + + var next_add_to_jump; + let instMatch = message.match(instructionExp); + let regiMatch = message.match(registerExp); + let memoMatch = message.match(memoryExp); + let printMatch = message.match(displayExp); + let CSRMatch = message.match(CSRTypeExp); + let CSREMatch = message.match(CSRExp); + let vectorMatch = message.match(vectorExp); + let jumpMatch = message.match(jumpExp); + let cacheMatch = message.match(cacheExp); + let configCacheMatch = message.match(configCacheExp); + + if (message.startsWith("Cache") || message.startsWith("Next_PC:")){ + if (message.includes("Cache prefetch")) { + let newpc = message.substring(15,message.length).toLowerCase(); + cache_inst = instructions.findIndex(insn => insn.Address === ("0x" + BigInt(newpc).toString(16))); + } else if (message.includes("Next_PC:")) { + let newpc = message.substring(9, message.length).toLowerCase(); + cache_inst = instructions.findIndex(insn => insn.Address == ("0x" + BigInt(newpc).toString(16))); + } + if (cache_inst != -1 && document.app.$data.execution_mode_run === 1) { + let hexmatch = message.match(/0x[0-9A-Fa-f]+$/); + if (hexmatch && !message.startsWith("Cache prefetch")) { + let hexa = hexmatch[0]; + message = message.replace(/on:\s*0x[0-9A-Fa-f]+$/, "").trim(); + updateCacheStat(cache_inst, message, hexa); + }else { + updateCacheStat(cache_inst, message); + } + + } + } + + + if (jumpMatch){ + jumpMatch[1] = "0x" + jumpMatch[1].replace(/^0+/, ''); + if (jumpMatch[1] === "0x") jumpMatch[1] = "0x0"; + // console.log(jumpMatch); + const current_ins = instructions.findIndex(insn => insn.Address === (jumpMatch[1].toLowerCase())); + + for (var i = 0; i < instructions.length; i++){ + if(instructions[i]._rowVariant === "success" && document.app.$data.execution_mode_run !== 0) // ajustar lo del user mode + instructions[i]._rowVariant = ""; + } + if (current_ins !== -1) instructions[current_ins]._rowVariant = "success"; + } + + if (configCacheMatch) { + // console.log(configCacheMatch); + switch(configCacheMatch[1]) { + case "L1_I_SIZE": + config_cache.push({configuration: "Size L1_I", value: configCacheMatch[2] + " lines"}); + break; + case "L1_D_SIZE": + config_cache.push({configuration: "Size L1_D", value: configCacheMatch[2] + " lines"}); + break; + case "L1_SIZE": + config_cache.push({configuration: "Size L1", value: configCacheMatch[2] + " lines"}); + break; + case "L2_I_SIZE": + config_cache.push({configuration: "Size L2_I", value: configCacheMatch[2] + " lines"}); + break; + case "L2_D_SIZE": + config_cache.push({configuration: "Size L2_D", value: configCacheMatch[2] + " lines"}); + break; + case "L2_SIZE": + config_cache.push({configuration: "Size L2", value: configCacheMatch[2] + " lines"}); + break; + case "Rep_policy": + config_cache.push({configuration: "Replacement policy", value: configCacheMatch[2]}); + break; + case "L1_I_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1_I block", value: configCacheMatch[2] + " bits"}); + break; + case "L1_D_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1_D block", value: configCacheMatch[2] + " bits"}); + break; + case "L1_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1 block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_I_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2_I block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_D_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2_D block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2 block", value: configCacheMatch[2] + " bits"}); + break; + } + } + + if (cacheMatch) { + console.log(cacheMatch); + // updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], parseInt(cacheMatch[4], 10)); + switch(cacheMatch[2]) { + case "L1_I": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_I_size_block); + break; + case "L1_D": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_D_size_block); + + break; + case "L1": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_size_block); + + break; + case "L2_I": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_I_size_block); + + break; + case "L2_D": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_D_size_block); + + break; + case "L2": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_size_block); + + break; + + } + } + + if(CSREMatch){ + console.log(CSREMatch); + if (CSREMatch[2] !== "vtype" && CSREMatch[2] !== "vl"){ + let regtowrite = crex_findReg(CSREMatch[2]); + if(regtowrite.match !== 0) + writeRegister(CSREMatch[4], regtowrite.indexComp, regtowrite.indexElem); + } + } + if (CSRMatch){ + if (CSRMatch[2] === "vtype"){ + var size_elem = parseInt(CSRMatch[5], 16).toString(2).padStart(32, '0'); + size_elem = size_elem.slice(26, 29); + console.log("Tamaño: ", size_elem); + if(size_elem === "000"){ + document.app.$data.v_length = 8; + // length_vext = 8; + // architecture.components[3].total_elements = 64; + } else if (size_elem === "001") { + document.app.$data.v_length = 16; + // length_vext = 16; + // architecture.components[3].total_elements = 32; + } else if (size_elem === "010"){ + document.app.$data.v_length = 32; + // length_vext = 32; + // architecture.components[3].total_elements = 16; + }else { + document.app.$data.v_length = 64; + // length_vext = 64; + // architecture.components[3].total_elements = 8; + } + // architecture.components[3].length_elem = length_vext; + } + else if (CSRMatch[2] === "vl"){ + // architecture.components[3].elems_op = parseInt(CSRMatch[5], 16); + } + } + if (vectorMatch){ + let regtowrite = crex_findReg(vectorMatch[1]); + writeRegister(vectorMatch[3], regtowrite.indexComp, regtowrite.indexElem); + } + if (instMatch && /*(instMatch[2] === 'U' ||*/ ((parseInt(instMatch[3], 16) >= pc_min) && parseInt(instMatch[3], 16) < parseInt("0x20000", 16) )){ + clearAllRegisterGlows(); + coreEvents.emit("step-about-to-execute"); + userMode64 = true; + if (inside_function) + check_call_convention_temp_regs(instMatch); + + + //Actualizamos el pc + writeRegister(BigInt(parseInt(instMatch[3], 16)), pc_sail.indexComp, pc_sail.indexElem); + for (var i = 0; i < instructions.length; i++) { + if (instructions[i]._rowVariant === "info") + instructions[i]._rowVariant = ""; + } + instoper = ""; + // console.log("PC actual:",pc_sail); + // if ((instMatch[5].includes("w") || instMatch[5].includes(".s") || instMatch[5].includes(".w")) && !instMatch.includes(".d")) + // type_toWrite = 32; + // else if (instMatch[5].includes("d")) + // type_toWrite = 64; + // else + // type_toWrite = 0; + console.log("Instruccion: ", instMatch); + const current_ins = instructions.findIndex(insn => ( '0x' + (insn.Address.slice(2)).padStart(16, '0')) === ("0x"+instMatch[3].toLowerCase())); + if (current_ins !== -1) { + if(prev_add_to_jump !== undefined){ + instructions[prev_add_to_jump]._rowVariant = ""; + prev_add_to_jump = undefined; + } + + if (instructions[current_ins].loaded.includes("jalr")){ + var next_add = instructions[current_ins].loaded.split("\t"); + var match = next_add[1].match(/(-?\d+)\((\w+)\)/); + + if (match === undefined || match === null) { + match = "zero"; + var aux_reg = crex_findReg(match); + var aux_val = readRegister(aux_reg.indexComp, aux_reg.indexElem); + + next_add_to_jump = aux_val.toString(16); + next_add_to_jump = instructions.findIndex(insn => insn.Address === ("0x"+next_add_to_jump.toLowerCase())); + prev_add_to_jump = current_ins; + }else { + var aux_reg = crex_findReg(match[2]); + var aux_val = readRegister(aux_reg.indexComp, aux_reg.indexElem); + + next_add_to_jump = (aux_val + BigInt(parseInt(match[1], 10))).toString(16); + next_add_to_jump = instructions.findIndex(insn => insn.Address === ("0x"+next_add_to_jump.toLowerCase())); + prev_add_to_jump = current_ins; + } + + // creator_callstack_enter(instructions[next_add_to_jump].Label); + // track_stack_enter(instructions[next_add_to_jump].Label); + // callstack_convention.push(structuredClone(registers_before_function)); + // inside_function = true; + + console.log("Siguiente direccion del jalr: ", next_add); + } + if (instructions[current_ins].loaded.includes("jal") && !instructions[current_ins].loaded.includes("jalr")){ + var next_add = instructions[current_ins].loaded.split("\t"); + console.log("Siguiente direccion del jal: ", next_add); + + } + if (instructions[current_ins].loaded.includes("ret") && !instructions[current_ins].loaded.includes("mret")){ + // Mirar el ra + var aux_reg = crex_findReg("ra"); + next_add_to_jump = readRegister(aux_reg.indexComp, aux_reg.indexElem).toString(16); + next_add_to_jump = instructions.findIndex(insn => ( '0x' + (insn.Address.slice(2))) === ("0x"+next_add_to_jump.toLowerCase())); + if (next_add_to_jump !== -1) { + prev_add_to_jump = current_ins; + // track_stack_leave(); + // creator_callstack_leave(); + // callstack_convention.pop(); + // inside_function = (callstack_convention.length > 0); + } else { + next_add_to_jump = undefined; + } + } + // Primero caso de paso a paso + if (document.app.$data.execution_mode_run === 1){ + instructions[current_ins]._rowVariant = 'info'; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined){ + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + document.app.$data.is_breakpoint = instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)].Break; + } + if (current_ins > 0 || prev_add_to_jump !== undefined) + instructions[(prev_add_to_jump !== undefined && prev_add_to_jump !== current_ins) ? prev_add_to_jump : ((current_ins > 0) ? current_ins -1 : 0)]._rowVariant = ''; + } + // Para el caso de run without stop y la siguiente instruccion es un breakpoint + else if (document.app.$data.execution_mode_run === 0){ + // se almacena el estado de la instruccion en caso de que haya una parada por infinity loop + hiden_executed = current_ins; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + hiden_next_execute = (next_add_to_jump !== undefined) ? next_add_to_jump : current_ins + 1; + } else + hiden_next_execute = current_ins + 1; + + + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + document.app.$data.is_breakpoint = instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)].Break; + } + if(document.app.$data.is_breakpoint){ + instructions[current_ins]._rowVariant = 'info'; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + } + coreEvents.emit("pause-execution"); + }else { + instructions[current_ins]._rowVariant = ''; + } + if (current_ins > 0 || prev_add_to_jump !== undefined) + instructions[(prev_add_to_jump !== undefined && prev_add_to_jump !== current_ins) ? prev_add_to_jump : ((current_ins > 0) ? current_ins -1 : 0)]._rowVariant = ''; + + } + else + instructions[current_ins]._rowVariant = ''; + + if (instMatch[5] === "ecall"){ + let argument_register = crex_findReg("a7"); // obtenemos el registro para ver que llamada al sistema es + let syscall_code = readRegister(argument_register.indexComp, argument_register.indexElem); // Lectura del registro para obtener el valor + + switch(syscall_code){ + case 5n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para enteros + // capi_read_int('a0'); + SYSCALL.read('a0', "int"); + break; + case 6n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para floats + // capi_read_float('fa0'); + SYSCALL.read("fa0", "float"); + break; + case 7n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // Manejo para double + // capi_read_double('fa0'); + SYSCALL.read("fa0", "double"); + break; + case 8n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // Manejo para strings + // capi_read_string('a0','a1'); + SYSCALL.read("a0", "string", "a1"); + break; + + case 12n: + if(document.app.$data.execution_mode_run === 0){ + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para char + // capi_read_char('a0'); + SYSCALL.read("a0", "char"); + break; + default: + // console.log("No hago nada."); + syscall_print_code = syscall_code; + break; + } + + next_add_to_jump = undefined; + } + + + + instoper = instMatch[5]; + coreEvents.emit("sail-instruction-update"); + + } + + } else if (instMatch && (parseInt(instMatch[3], 16) <= pc_min || parseInt(instMatch[3], 16) >= pc_max )) + userMode64 = false; + + + if (regiMatch /*&& userMode === true*/) { + // En caso de ser escritura '<-' pintamos el valor en el registro que corresponde + if (regiMatch[2] === '<-'){ + let regtowrite = crex_findReg(regiMatch[1]); + if (regtowrite.indexComp === 2){ + if (regiMatch[3].startsWith("0x")) regiMatch[3] = regiMatch[3].slice(2).replace(/^0+/, ''); + else regiMatch[3] = regiMatch[3].replace(/^0+/, ''); + if (regiMatch[3].length <= 8){ + regiMatch[3] = regiMatch[3].padStart(8, "0"); + writeRegister(BigInt("0x" + regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem, "SFP-Reg"); + } + else{ + // if (type_toWrite === 32){ + // regiMatch[3] = regiMatch[3].slice(8,16); + // writeRegister(hex2float(regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem, "SFP-Reg"); + // } + // else if (type_toWrite === 64) + // writeRegister(hex2double(regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem, "DFP-Reg"); + // else + writeRegister(BigInt("0x" + regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem, "DFP-Reg"); + // type_to_write = 0; + } + } + else + writeRegister(BigInt(parseInt(regiMatch[3], 16)), regtowrite.indexComp, regtowrite.indexElem); + } + + } + + if (memoMatch /*&& userMode === true*/) { + // En caso de ser escritura '<-' pintamos el valor en la posicion de memoria + if (memoMatch[2] === '<-'){ + + writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // console.log("Operador: ", instoper); + // switch(instoper){ + // case 'sh': // Para almacenar un half + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + + // break; + // case 'sb': // Para almacenar un byte + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'sd': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'dword'); + // break; + // case 'sw': // Para almacenar un int/word + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'fsw': // Para almacenar un float + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'float'); + // break; + // case 'fsd': // Para almacenar un double + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // case 'vse8.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'vse16.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + // break; + // case 'vse32.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'vse64.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // default: + // break; + // } + + // instoper = ""; + } + + } + + + + if(printMatch && syscall_print_code !== -1){ + + let value_2_print = printMatch[2].trim(); + console.log("Estoy dentro de ecall a imprimir"); + // console.log(message); + console.log("Valor a imprimir: ", value_2_print); + switch(syscall_print_code){ + + case 1n: // Print int + // SYSCALL.print(Number(parseInt(value_2_print)), "int32"); + + display_print(value_2_print); + // display_print(full_print(parseInt(value_2_print), null, false)); + syscall_print_code = -1; + break; + case 2n: // Print float + // SYSCALL.print(Number(parseFloat(value_2_print)), "float"); + display_print(value_2_print); + // display_print(full_print(parseFloat(value_2_print), 0, true)); + syscall_print_code = -1; + break; + + case 3n: // Print double + // SYSCALL.print(Number(parseFloat(value_2_print)), "double"); + display_print(value_2_print); + // display_print(full_print(parseFloat(value_2_print), 0, true)); + syscall_print_code = -1; + break; + + case 4n: // Print String + display_print(value_2_print); + syscall_print_code = -1; + break; + + case 11n: // Print char + // SYSCALL.print(BigInt(value_2_print.charCodeAt(0)), char); + display_print(value_2_print); + syscall_print_code = -1; + break; + + default: // Rest of syscall codes not able to print + syscall_print_code = -1; + break; + + } + + } + + + + // if (!no_print_more) + console.log(message); + + + // clear_instructions(); + // setInstructions(instructions); + + } + + Module['printErr'] = function (message) { + // if (message.includes("Execution:") || message.includes("Instructions:") || message.includes("Perf:")) + // show_notification(message, "success"); + // else + console.warn(message); + } + + + var out = Module["print"] /*|| console.log.bind(console)*/; + var err = Module["printErr"] /*|| console.error.bind(console)*/; + + + Object.assign(Module, moduleOverrides); + moduleOverrides = null; + checkIncomingModuleAPI(); + if (Module["arguments"]) arguments_ = Module["arguments"]; + legacyModuleProp("arguments", "arguments_"); + if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + legacyModuleProp("thisProgram", "thisProgram"); + assert( + typeof Module["memoryInitializerPrefixURL"] == "undefined", + "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["pthreadMainPrefixURL"] == "undefined", + "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["cdInitializerPrefixURL"] == "undefined", + "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["filePackagePrefixURL"] == "undefined", + "Module.filePackagePrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["read"] == "undefined", + "Module.read option was removed", + ); + assert( + typeof Module["readAsync"] == "undefined", + "Module.readAsync option was removed (modify readAsync in JS)", + ); + assert( + typeof Module["readBinary"] == "undefined", + "Module.readBinary option was removed (modify readBinary in JS)", + ); + assert( + typeof Module["setWindowTitle"] == "undefined", + "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)", + ); + assert( + typeof Module["TOTAL_MEMORY"] == "undefined", + "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY", + ); + legacyModuleProp("asm", "wasmExports"); + legacyModuleProp("readAsync", "readAsync"); + legacyModuleProp("readBinary", "readBinary"); + legacyModuleProp("setWindowTitle", "setWindowTitle"); + assert( + !ENVIRONMENT_IS_WORKER, + "worker environment detected but not enabled at build time. Add `worker` to `-sENVIRONMENT` to enable.", + ); + assert( + !ENVIRONMENT_IS_NODE, + "node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable.", + ); + assert( + !ENVIRONMENT_IS_SHELL, + "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.", + ); + var wasmBinary = Module["wasmBinary"]; + legacyModuleProp("wasmBinary", "wasmBinary"); + if (typeof WebAssembly != "object") { + err("no native wasm support detected"); + } + var wasmMemory; + var ABORT = false; + var EXITSTATUS; + function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } + } + var HEAP8, + HEAPU8, + HEAP16, + HEAPU16, + HEAP32, + HEAPU32, + HEAPF32, + HEAP64, + HEAPU64, + HEAPF64; + var runtimeInitialized = false; + var isFileURI = (filename) => filename.startsWith("file://"); + function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + if (max == 0) { + max += 4; + } + HEAPU32[max / 4] = 34821223; + HEAPU32[(max + 4) / 4] = 2310721022; + HEAPU32[0 / 4] = 1668509029; + } + function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + if (max == 0) { + max += 4; + } + var cookie1 = HEAPU32[max / 4]; + var cookie2 = HEAPU32[(max + 4) / 4]; + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort( + `Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`, + ); + } + if (HEAPU32[0 / 4] != 1668509029) { + abort( + "Runtime error: The application has corrupted its heap memory area (address zero)!", + ); + } + } + (() => { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) + throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"; + })(); + if (Module["ENVIRONMENT"]) { + throw new Error( + "Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)", + ); + } + function legacyModuleProp(prop, newName, incoming = true) { + if (!Object.getOwnPropertyDescriptor(Module, prop)) { + Object.defineProperty(Module, prop, { + configurable: true, + get() { + let extra = incoming + ? " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)" + : ""; + abort( + `\`Module.${prop}\` has been replaced by \`${newName}\`` + extra, + ); + }, + }); + } + } + function ignoredModuleProp(prop) { + if (Object.getOwnPropertyDescriptor(Module, prop)) { + abort( + `\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`, + ); + } + } + function isExportedByForceFilesystem(name) { + return ( + name === "FS_createPath" || + name === "FS_createDataFile" || + name === "FS_createPreloadedFile" || + name === "FS_unlink" || + name === "addRunDependency" || + name === "FS_createLazyFile" || + name === "FS_createDevice" || + name === "removeRunDependency" + ); + } + function hookGlobalSymbolAccess(sym, func) { + if ( + typeof globalThis != "undefined" && + !Object.getOwnPropertyDescriptor(globalThis, sym) + ) { + Object.defineProperty(globalThis, sym, { + configurable: true, + get() { + func(); + return undefined; + }, + }); + } + } + function missingGlobal(sym, msg) { + hookGlobalSymbolAccess(sym, () => { + warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`); + }); + } + missingGlobal("buffer", "Please use HEAP8.buffer or wasmMemory.buffer"); + missingGlobal("asm", "Please use wasmExports instead"); + function missingLibrarySymbol(sym) { + hookGlobalSymbolAccess(sym, () => { + var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`; + var librarySymbol = sym; + if (!librarySymbol.startsWith("_")) { + librarySymbol = "$" + sym; + } + msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`; + if (isExportedByForceFilesystem(sym)) { + msg += + ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + warnOnce(msg); + }); + unexportedRuntimeSymbol(sym); + } + function unexportedRuntimeSymbol(sym) { + if (!Object.getOwnPropertyDescriptor(Module, sym)) { + Object.defineProperty(Module, sym, { + configurable: true, + get() { + var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`; + if (isExportedByForceFilesystem(sym)) { + msg += + ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + abort(msg); + }, + }); + } + } + function updateMemoryViews() { + var b = wasmMemory.buffer; + Module["HEAP8"] = HEAP8 = new Int8Array(b); + Module["HEAP16"] = HEAP16 = new Int16Array(b); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(b); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(b); + Module["HEAP32"] = HEAP32 = new Int32Array(b); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(b); + Module["HEAPF32"] = HEAPF32 = new Float32Array(b); + Module["HEAPF64"] = HEAPF64 = new Float64Array(b); + Module["HEAP64"] = HEAP64 = new BigInt64Array(b); + Module["HEAPU64"] = HEAPU64 = new BigUint64Array(b); + } + assert( + !Module["STACK_SIZE"], + "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time", + ); + assert( + typeof Int32Array != "undefined" && + typeof Float64Array !== "undefined" && + Int32Array.prototype.subarray != undefined && + Int32Array.prototype.set != undefined, + "JS engine does not provide full typed array support", + ); + assert( + !Module["wasmMemory"], + "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally", + ); + assert( + !Module["INITIAL_MEMORY"], + "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically", + ); + function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") + Module["preRun"] = [Module["preRun"]]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(onPreRuns); + } + function initRuntime() { + assert(!runtimeInitialized); + runtimeInitialized = true; + checkStackCookie(); + if (!Module["noFSInit"] && !FS.initialized) FS.init(); + TTY.init(); + wasmExports["__wasm_call_ctors"](); + FS.ignorePermissions = false; + } + function preMain() { + checkStackCookie(); + } + function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") + Module["postRun"] = [Module["postRun"]]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(onPostRuns); + } + var runDependencies = 0; + var dependenciesFulfilled = null; + var runDependencyTracking = {}; + var runDependencyWatcher = null; + function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } + } + function addRunDependency(id) { + runDependencies++; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if ( + runDependencyWatcher === null && + typeof setInterval != "undefined" + ) { + runDependencyWatcher = setInterval(() => { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err(`dependency: ${dep}`); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } + } + function removeRunDependency(id) { + runDependencies--; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } + } + function abort(what) { + Module["onAbort"]?.(what); + what = "Aborted(" + what + ")"; + err(what); + ABORT = true; + if (what.indexOf("RuntimeError: unreachable") >= 0) { + what += + '. "unreachable" may be due to ASYNCIFY_STACK_SIZE not being large enough (try increasing it)'; + } + var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + throw e; + } + function createExportWrapper(name, nargs) { + return (...args) => { + assert( + runtimeInitialized, + `native function \`${name}\` called before runtime initialization`, + ); + var f = wasmExports[name]; + assert(f, `exported native function \`${name}\` not found`); + assert( + args.length <= nargs, + `native function \`${name}\` called with ${args.length} args but expects ${nargs}`, + ); + return f(...args); + }; + } + var wasmBinaryFile; + function findWasmBinary() { + if (Module["locateFile"]) { + return locateFile("riscv_sim_RV64.wasm"); + } + return new URL("riscv_sim_RV64.wasm", import.meta.url).href; + } + function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw "both async and sync fetching of the wasm failed"; + } + async function getWasmBinary(binaryFile) { + if (!wasmBinary) { + try { + var response = await readAsync(binaryFile); + return new Uint8Array(response); + } catch {} + } + return getBinarySync(binaryFile); + } + async function instantiateArrayBuffer(binaryFile, imports) { + try { + var binary = await getWasmBinary(binaryFile); + var instance = await WebAssembly.instantiate(binary, imports); + return instance; + } catch (reason) { + err(`failed to asynchronously prepare wasm: ${reason}`); + if (isFileURI(wasmBinaryFile)) { + err( + `warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`, + ); + } + abort(reason); + } + } + async function instantiateAsync(binary, binaryFile, imports) { + if (!binary && typeof WebAssembly.instantiateStreaming == "function") { + try { + var response = fetch(binaryFile, { credentials: "same-origin" }); + var instantiationResult = await WebAssembly.instantiateStreaming( + response, + imports, + ); + return instantiationResult; + } catch (reason) { + err(`wasm streaming compile failed: ${reason}`); + err("falling back to ArrayBuffer instantiation"); + } + } + return instantiateArrayBuffer(binaryFile, imports); + } + function getWasmImports() { + Asyncify.instrumentWasmImports(wasmImports); + return { env: wasmImports, wasi_snapshot_preview1: wasmImports }; + } + async function createWasm() { + function receiveInstance(instance, module) { + wasmExports = instance.exports; + wasmExports = Asyncify.instrumentWasmExports(wasmExports); + wasmExports = applySignatureConversions(wasmExports); + wasmMemory = wasmExports["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateMemoryViews(); + removeRunDependency("wasm-instantiate"); + return wasmExports; + } + addRunDependency("wasm-instantiate"); + var trueModule = Module; + function receiveInstantiationResult(result) { + assert( + Module === trueModule, + "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?", + ); + trueModule = null; + return receiveInstance(result["instance"]); + } + var info = getWasmImports(); + if (Module["instantiateWasm"]) { + return new Promise((resolve, reject) => { + try { + Module["instantiateWasm"](info, (mod, inst) => { + receiveInstance(mod, inst); + resolve(mod.exports); + }); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + reject(e); + } + }); + } + wasmBinaryFile ??= findWasmBinary(); + try { + var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info); + var exports = receiveInstantiationResult(result); + return exports; + } catch (e) { + readyPromiseReject(e); + return Promise.reject(e); + } + } + class ExitStatus { + name = "ExitStatus"; + constructor(status) { + this.message = `Program terminated with exit(${status})`; + this.status = status; + } + } + var callRuntimeCallbacks = (callbacks) => { + while (callbacks.length > 0) { + callbacks.shift()(Module); + } + }; + var onPostRuns = []; + var addOnPostRun = (cb) => onPostRuns.unshift(cb); + var onPreRuns = []; + var addOnPreRun = (cb) => onPreRuns.unshift(cb); + var noExitRuntime = Module["noExitRuntime"] || true; + var ptrToString = (ptr) => { + assert(typeof ptr === "number"); + return "0x" + ptr.toString(16).padStart(8, "0"); + }; + var stackRestore = (val) => __emscripten_stack_restore(val); + var stackSave = () => _emscripten_stack_get_current(); + var warnOnce = (text) => { + warnOnce.shown ||= {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + err(text); + } + }; + var INT53_MAX = 9007199254740992; + var INT53_MIN = -9007199254740992; + var bigintToI53Checked = (num) => + num < INT53_MIN || num > INT53_MAX ? NaN : Number(num); + var UTF8Decoder = + typeof TextDecoder != "undefined" ? new TextDecoder() : undefined; + var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ""; + while (idx < endPtr) { + var u0 = heapOrArray[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + if ((u0 & 248) != 240) + warnOnce( + "Invalid UTF-8 leading byte " + + ptrToString(u0) + + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!", + ); + u0 = + ((u0 & 7) << 18) | + (u1 << 12) | + (u2 << 6) | + (heapOrArray[idx++] & 63); + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } + } + return str; + }; + var UTF8ToString = (ptr, maxBytesToRead) => { + assert( + typeof ptr == "number", + `UTF8ToString expects a number (got ${typeof ptr})`, + ); + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; + }; + function ___assert_fail(condition, filename, line, func) { + condition = bigintToI53Checked(condition); + filename = bigintToI53Checked(filename); + func = bigintToI53Checked(func); + return abort( + `Assertion failed: ${UTF8ToString(condition)}, at: ` + + [ + filename ? UTF8ToString(filename) : "unknown filename", + line, + func ? UTF8ToString(func) : "unknown function", + ], + ); + } + var syscallGetVarargP = () => { + assert(SYSCALLS.varargs != undefined); + var ret = Number(HEAPU64[SYSCALLS.varargs / 8]); + SYSCALLS.varargs += 8; + return ret; + }; + var syscallGetVarargI = () => { + assert(SYSCALLS.varargs != undefined); + var ret = HEAP32[+SYSCALLS.varargs / 4]; + SYSCALLS.varargs += 4; + return ret; + }; + var PATH = { + isAbs: (path) => path.charAt(0) === "/", + splitPath: (filename) => { + var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (; up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: (path) => { + var isAbsolute = PATH.isAbs(path), + trailingSlash = path.slice(-1) === "/"; + path = PATH.normalizeArray( + path.split("/").filter((p) => !!p), + !isAbsolute, + ).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: (path) => { + var result = PATH.splitPath(path), + root = result[0], + dir = result[1]; + if (!root && !dir) { + return "."; + } + if (dir) { + dir = dir.slice(0, -1); + } + return root + dir; + }, + basename: (path) => path && path.match(/([^\/]+|\/)\/*$/)[1], + join: (...paths) => PATH.normalize(paths.join("/")), + join2: (l, r) => PATH.normalize(l + "/" + r), + }; + var initRandomFill = () => (view) => crypto.getRandomValues(view); + var randomFill = (view) => { + (randomFill = initRandomFill())(view); + }; + var PATH_FS = { + resolve: (...args) => { + var resolvedPath = "", + resolvedAbsolute = false; + for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? args[i] : FS.cwd(); + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + resolvedPath = PATH.normalizeArray( + resolvedPath.split("/").filter((p) => !!p), + !resolvedAbsolute, + ).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).slice(1); + to = PATH_FS.resolve(to).slice(1); + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + }, + }; + var FS_stdin_getChar_buffer = []; + var lengthBytesUTF8 = (str) => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var c = str.charCodeAt(i); + if (c <= 127) { + len++; + } else if (c <= 2047) { + len += 2; + } else if (c >= 55296 && c <= 57343) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; + }; + var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + assert( + typeof str === "string", + `stringToUTF8Array expects a string (got ${typeof str})`, + ); + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = (65536 + ((u & 1023) << 10)) | (u1 & 1023); + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | (u >> 6); + heap[outIdx++] = 128 | (u & 63); + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | (u >> 12); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) + warnOnce( + "Invalid Unicode code point " + + ptrToString(u) + + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).", + ); + heap[outIdx++] = 240 | (u >> 18); + heap[outIdx++] = 128 | ((u >> 12) & 63); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } + } + heap[outIdx] = 0; + return outIdx - startIdx; + }; + var intArrayFromString = (stringy, dontAddNull, length) => { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array( + stringy, + u8array, + 0, + u8array.length, + ); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; + }; + var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if ( + typeof window != "undefined" && + typeof window.prompt == "function" + ) { + result = window.prompt("Input: "); + if (result !== null) { + result += "\n"; + } + } else { + } + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); + }; + var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + }, + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ + 3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [24, 80]; + }, + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + }, + }; + var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); + }; + var alignMemory = (size, alignment) => { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; + }; + var mmapAlloc = (size) => { + size = alignMemory(size, 65536); + var ptr = _emscripten_builtin_memalign(65536, size); + if (ptr) zeroMemory(ptr, size); + return ptr; + }; + var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, "/", 16895, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + MEMFS.ops_table ||= { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink, + }, + stream: { llseek: MEMFS.stream_ops.llseek }, + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync, + }, + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink, + }, + stream: {}, + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: FS.chrdev_stream_ops, + }, + }; + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.atime = node.mtime = node.ctime = Date.now(); + if (parent) { + parent.contents[name] = node; + parent.atime = parent.mtime = parent.ctime = node.atime; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) + return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max( + newCapacity, + (prevCapacity * + (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125)) >>> + 0, + ); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) + node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set( + oldContents.subarray(0, Math.min(newSize, node.usedBytes)), + ); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.atime); + attr.mtime = new Date(node.mtime); + attr.ctime = new Date(node.ctime); + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + for (const key of ["mode", "atime", "mtime", "ctime"]) { + if (attr[key] != null) { + node[key] = attr[key]; + } + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw new FS.ErrnoError(44); + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + if (FS.isDir(old_node.mode)) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + FS.hashRemoveNode(new_node); + } + delete old_node.parent.contents[old_node.name]; + new_dir.contents[new_name] = old_node; + old_node.name = new_name; + new_dir.ctime = + new_dir.mtime = + old_node.parent.ctime = + old_node.parent.mtime = + Date.now(); + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + readdir(node) { + return [".", "..", ...Object.keys(node.contents)]; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + }, + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) + buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + assert(!(buffer instanceof ArrayBuffer)); + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.mtime = node.ctime = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + assert( + position === 0, + "canOwn must imply no weird position inside the file", + ); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + return length; + } + } + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max( + stream.node.usedBytes, + offset + length, + ); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + if (contents) { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call( + contents, + position, + position + length, + ); + } + } + HEAP8.set(contents, ptr); + } + } + return { ptr, allocated }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + return 0; + }, + }, + }; + var asyncLoad = async (url) => { + var arrayBuffer = await readAsync(url); + assert( + arrayBuffer, + `Loading data file "${url}" failed (no arrayBuffer).`, + ); + return new Uint8Array(arrayBuffer); + }; + asyncLoad.isAsync = true; + var FS_createDataFile = ( + parent, + name, + fileData, + canRead, + canWrite, + canOwn, + ) => { + FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); + }; + var preloadPlugins = Module["preloadPlugins"] || []; + var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + if (typeof Browser != "undefined") Browser.init(); + var handled = false; + preloadPlugins.forEach((plugin) => { + if (handled) return; + if (plugin["canHandle"](fullname)) { + plugin["handle"](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; + }; + var FS_createPreloadedFile = ( + parent, + name, + url, + canRead, + canWrite, + onload, + onerror, + dontCreateFile, + canOwn, + preFinish, + ) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + function processData(byteArray) { + function finish(byteArray) { + preFinish?.(); + if (!dontCreateFile) { + FS_createDataFile( + parent, + name, + byteArray, + canRead, + canWrite, + canOwn, + ); + } + onload?.(); + removeRunDependency(dep); + } + if ( + FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + onerror?.(); + removeRunDependency(dep); + }) + ) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url).then(processData, onerror); + } else { + processData(url); + } + }; + var FS_modeStringToFlags = (str) => { + var flagModes = { + r: 0, + "r+": 2, + w: 512 | 64 | 1, + "w+": 512 | 64 | 2, + a: 1024 | 64 | 1, + "a+": 1024 | 64 | 2, + }; + var flags = flagModes[str]; + if (typeof flags == "undefined") { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; + }; + var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }; + var strError = (errno) => UTF8ToString(_strerror(errno)); + var ERRNO_CODES = { + EPERM: 63, + ENOENT: 44, + ESRCH: 71, + EINTR: 27, + EIO: 29, + ENXIO: 60, + E2BIG: 1, + ENOEXEC: 45, + EBADF: 8, + ECHILD: 12, + EAGAIN: 6, + EWOULDBLOCK: 6, + ENOMEM: 48, + EACCES: 2, + EFAULT: 21, + ENOTBLK: 105, + EBUSY: 10, + EEXIST: 20, + EXDEV: 75, + ENODEV: 43, + ENOTDIR: 54, + EISDIR: 31, + EINVAL: 28, + ENFILE: 41, + EMFILE: 33, + ENOTTY: 59, + ETXTBSY: 74, + EFBIG: 22, + ENOSPC: 51, + ESPIPE: 70, + EROFS: 69, + EMLINK: 34, + EPIPE: 64, + EDOM: 18, + ERANGE: 68, + ENOMSG: 49, + EIDRM: 24, + ECHRNG: 106, + EL2NSYNC: 156, + EL3HLT: 107, + EL3RST: 108, + ELNRNG: 109, + EUNATCH: 110, + ENOCSI: 111, + EL2HLT: 112, + EDEADLK: 16, + ENOLCK: 46, + EBADE: 113, + EBADR: 114, + EXFULL: 115, + ENOANO: 104, + EBADRQC: 103, + EBADSLT: 102, + EDEADLOCK: 16, + EBFONT: 101, + ENOSTR: 100, + ENODATA: 116, + ETIME: 117, + ENOSR: 118, + ENONET: 119, + ENOPKG: 120, + EREMOTE: 121, + ENOLINK: 47, + EADV: 122, + ESRMNT: 123, + ECOMM: 124, + EPROTO: 65, + EMULTIHOP: 36, + EDOTDOT: 125, + EBADMSG: 9, + ENOTUNIQ: 126, + EBADFD: 127, + EREMCHG: 128, + ELIBACC: 129, + ELIBBAD: 130, + ELIBSCN: 131, + ELIBMAX: 132, + ELIBEXEC: 133, + ENOSYS: 52, + ENOTEMPTY: 55, + ENAMETOOLONG: 37, + ELOOP: 32, + EOPNOTSUPP: 138, + EPFNOSUPPORT: 139, + ECONNRESET: 15, + ENOBUFS: 42, + EAFNOSUPPORT: 5, + EPROTOTYPE: 67, + ENOTSOCK: 57, + ENOPROTOOPT: 50, + ESHUTDOWN: 140, + ECONNREFUSED: 14, + EADDRINUSE: 3, + ECONNABORTED: 13, + ENETUNREACH: 40, + ENETDOWN: 38, + ETIMEDOUT: 73, + EHOSTDOWN: 142, + EHOSTUNREACH: 23, + EINPROGRESS: 26, + EALREADY: 7, + EDESTADDRREQ: 17, + EMSGSIZE: 35, + EPROTONOSUPPORT: 66, + ESOCKTNOSUPPORT: 137, + EADDRNOTAVAIL: 4, + ENETRESET: 39, + EISCONN: 30, + ENOTCONN: 53, + ETOOMANYREFS: 141, + EUSERS: 136, + EDQUOT: 19, + ESTALE: 72, + ENOTSUP: 138, + ENOMEDIUM: 148, + EILSEQ: 25, + EOVERFLOW: 61, + ECANCELED: 11, + ENOTRECOVERABLE: 56, + EOWNERDEAD: 62, + ESTRPIPE: 135, + }; + var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: class extends Error { + name = "ErrnoError"; + constructor(errno) { + super(runtimeInitialized ? strError(errno) : ""); + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + } + }, + filesystems: null, + syncFSRequests: 0, + readFiles: {}, + FSStream: class { + shared = {}; + get object() { + return this.node; + } + set object(val) { + this.node = val; + } + get isRead() { + return (this.flags & 2097155) !== 1; + } + get isWrite() { + return (this.flags & 2097155) !== 0; + } + get isAppend() { + return this.flags & 1024; + } + get flags() { + return this.shared.flags; + } + set flags(val) { + this.shared.flags = val; + } + get position() { + return this.shared.position; + } + set position(val) { + this.shared.position = val; + } + }, + FSNode: class { + node_ops = {}; + stream_ops = {}; + readMode = 292 | 73; + writeMode = 146; + mounted = null; + constructor(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.rdev = rdev; + this.atime = this.mtime = this.ctime = Date.now(); + } + get read() { + return (this.mode & this.readMode) === this.readMode; + } + set read(val) { + val ? (this.mode |= this.readMode) : (this.mode &= ~this.readMode); + } + get write() { + return (this.mode & this.writeMode) === this.writeMode; + } + set write(val) { + val ? (this.mode |= this.writeMode) : (this.mode &= ~this.writeMode); + } + get isFolder() { + return FS.isDir(this.mode); + } + get isDevice() { + return FS.isChrdev(this.mode); + } + }, + lookupPath(path, opts = {}) { + if (!path) { + throw new FS.ErrnoError(44); + } + opts.follow_mount ??= true; + if (!PATH.isAbs(path)) { + path = FS.cwd() + "/" + path; + } + linkloop: for (var nlinks = 0; nlinks < 40; nlinks++) { + var parts = path.split("/").filter((p) => !!p); + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + if (parts[i] === ".") { + continue; + } + if (parts[i] === "..") { + current_path = PATH.dirname(current_path); + current = current.parent; + continue; + } + current_path = PATH.join2(current_path, parts[i]); + try { + current = FS.lookupNode(current, parts[i]); + } catch (e) { + if (e?.errno === 44 && islast && opts.noent_okay) { + return { path: current_path }; + } + throw e; + } + if (FS.isMountpoint(current) && (!islast || opts.follow_mount)) { + current = current.mounted.root; + } + if (FS.isLink(current.mode) && (!islast || opts.follow)) { + if (!current.node_ops.readlink) { + throw new FS.ErrnoError(52); + } + var link = current.node_ops.readlink(current); + if (!PATH.isAbs(link)) { + link = PATH.dirname(current_path) + "/" + link; + } + path = link + "/" + parts.slice(i + 1).join("/"); + continue linkloop; + } + } + return { path: current_path, node: current }; + } + throw new FS.ErrnoError(32); + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" + ? `${mount}/${path}` + : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = ["r", "w", "rw"][flag & 3]; + if (flag & 512) { + perms += "w"; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + if (!FS.isDir(dir.mode)) return 54; + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + if (!FS.isDir(dir.mode)) { + return 54; + } + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || flags & (512 | 64)) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + checkOpExists(op, err) { + if (!op) { + throw new FS.ErrnoError(err); + } + return op; + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: (fd) => FS.streams[fd], + createStream(stream, fd = -1) { + assert(fd >= -1); + stream = Object.assign(new FS.FSStream(), stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + dupStream(origStream, fd = -1) { + var stream = FS.createStream(origStream, fd); + stream.stream_ops?.dup?.(stream); + return stream; + }, + doSetAttr(stream, node, attr) { + var setattr = stream?.stream_ops.setattr; + var arg = setattr ? stream : node; + setattr ??= node.node_ops.setattr; + FS.checkOpExists(setattr, 63); + setattr(arg, attr); + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + stream.stream_ops = device.stream_ops; + stream.stream_ops.open?.(stream); + }, + llseek() { + throw new FS.ErrnoError(70); + }, + }, + major: (dev) => dev >> 8, + minor: (dev) => dev & 255, + makedev: (ma, mi) => (ma << 8) | mi, + registerDevice(dev, ops) { + FS.devices[dev] = { stream_ops: ops }; + }, + getDevice: (dev) => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [mount]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push(...m.mounts); + } + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err( + `warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`, + ); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + mounts.forEach((mount) => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + if (typeof type == "string") { + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + mountpoint = lookup.path; + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { type, opts, mountpoint, mounts: [] }; + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach((hash) => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + node.mounted = null; + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name) { + throw new FS.ErrnoError(28); + } + if (name === "." || name === "..") { + throw new FS.ErrnoError(20); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + statfs(path) { + return FS.statfsNode(FS.lookupPath(path, { follow: true }).node); + }, + statfsStream(stream) { + return FS.statfsNode(stream.node); + }, + statfsNode(node) { + var rtn = { + bsize: 4096, + frsize: 4096, + blocks: 1e6, + bfree: 5e5, + bavail: 5e5, + files: FS.nextInode, + ffree: FS.nextInode - 1, + fsid: 42, + flags: 2, + namelen: 255, + }; + if (node.node_ops.statfs) { + Object.assign(rtn, node.node_ops.statfs(node.mount.opts.root)); + } + return rtn; + }, + create(path, mode = 438) { + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode = 511) { + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + var lookup, old_dir, new_dir; + lookup = FS.lookupPath(old_path, { parent: true }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { parent: true }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + var old_node = FS.lookupNode(old_dir, old_name); + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (old_node === new_node) { + return; + } + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + errCode = new_node + ? FS.mayDelete(new_dir, new_name, isdir) + : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if ( + FS.isMountpoint(old_node) || + (new_node && FS.isMountpoint(new_node)) + ) { + throw new FS.ErrnoError(10); + } + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + FS.hashRemoveNode(old_node); + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + old_node.parent = new_dir; + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + var readdir = FS.checkOpExists(node.node_ops.readdir, 54); + return readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return link.node_ops.readlink(link); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + var node = lookup.node; + var getattr = FS.checkOpExists(node.node_ops.getattr, 63); + return getattr(node); + }, + fstat(fd) { + var stream = FS.getStreamChecked(fd); + var node = stream.node; + var getattr = stream.stream_ops.getattr; + var arg = getattr ? stream : node; + getattr ??= node.node_ops.getattr; + FS.checkOpExists(getattr, 63); + return getattr(arg); + }, + lstat(path) { + return FS.stat(path, true); + }, + doChmod(stream, node, mode, dontFollow) { + FS.doSetAttr(stream, node, { + mode: (mode & 4095) | (node.mode & ~4095), + ctime: Date.now(), + dontFollow, + }); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + FS.doChmod(null, node, mode, dontFollow); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.doChmod(stream, stream.node, mode, false); + }, + doChown(stream, node, dontFollow) { + FS.doSetAttr(stream, node, { timestamp: Date.now(), dontFollow }); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + FS.doChown(null, node, dontFollow); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.doChown(stream, stream.node, false); + }, + doTruncate(stream, node, len) { + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.doSetAttr(stream, node, { size: len, timestamp: Date.now() }); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: true }); + node = lookup.node; + } else { + node = path; + } + FS.doTruncate(null, node, len); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if (len < 0 || (stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.doTruncate(stream, stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + var setattr = FS.checkOpExists(node.node_ops.setattr, 63); + setattr(node, { atime, mtime }); + }, + open(path, flags, mode = 438) { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags; + if (flags & 64) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + var isDirPath; + if (typeof path == "object") { + node = path; + } else { + isDirPath = path.endsWith("/"); + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072), + noent_okay: true, + }); + node = lookup.node; + path = lookup.path; + } + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else if (isDirPath) { + throw new FS.ErrnoError(31); + } else { + node = FS.mknod(path, mode | 511, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + if (flags & 512 && !created) { + FS.truncate(node, 0); + } + flags &= ~(128 | 512 | 131072); + var stream = FS.createStream({ + node, + path: FS.getPath(node), + flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + ungotten: [], + error: false, + }); + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (created) { + FS.chmod(node, mode & 511); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read( + stream, + buffer, + offset, + length, + position, + ); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write( + stream, + buffer, + offset, + length, + position, + canOwn, + ); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + if ( + (prot & 2) !== 0 && + (flags & 2) === 0 && + (stream.flags & 2097155) !== 2 + ) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + if (!length) { + throw new FS.ErrnoError(28); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + assert(offset >= 0); + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync( + stream, + buffer, + offset, + length, + mmapFlags, + ); + }, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices() { + FS.mkdir("/dev"); + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + llseek: () => 0, + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + var randomBuffer = new Uint8Array(1024), + randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomFill(randomBuffer); + randomLeft = randomBuffer.byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice("/dev", "random", randomByte); + FS.createDevice("/dev", "urandom", randomByte); + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories() { + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount( + { + mount() { + var node = FS.createNode(proc_self, "fd", 16895, 73); + node.stream_ops = { llseek: MEMFS.stream_ops.llseek }; + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { mountpoint: "fake" }, + node_ops: { readlink: () => stream.path }, + id: fd + 1, + }; + ret.parent = ret; + return ret; + }, + readdir() { + return Array.from(FS.streams.entries()) + .filter(([k, v]) => v) + .map(([k, v]) => k.toString()); + }, + }; + return node; + }, + }, + {}, + "/proc/self/fd", + ); + }, + createStandardStreams(input, output, error) { + if (input) { + FS.createDevice("/dev", "stdin", input); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (output) { + FS.createDevice("/dev", "stdout", null, output); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (error) { + FS.createDevice("/dev", "stderr", null, error); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, `invalid handle for stdin (${stdin.fd})`); + assert(stdout.fd === 1, `invalid handle for stdout (${stdout.fd})`); + assert(stderr.fd === 2, `invalid handle for stderr (${stderr.fd})`); + }, + staticInit() { + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { MEMFS }; + }, + init(input, output, error) { + assert( + !FS.initialized, + "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)", + ); + FS.initialized = true; + input ??= Module["stdin"]; + output ??= Module["stdout"]; + error ??= Module["stderr"]; + FS.createStandardStreams(input, output, error); + }, + quit() { + FS.initialized = false; + _fflush(0); + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + try { + var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null, + }; + try { + var lookup = FS.lookupPath(path, { parent: true }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) + arr[i] = data.charCodeAt(i); + data = arr; + } + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + }, + createDevice(parent, name, input, output) { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(!!input, !!output); + FS.createDevice.major ??= 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + if (output?.buffer?.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + }, + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) + return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error( + "Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.", + ); + } else { + try { + obj.contents = readBinary(obj.url); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + class LazyUint8Array { + lengthKnown = false; + chunks = []; + get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + } + setDataGetter(getter) { + this.getter = getter; + } + cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open("HEAD", url, false); + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = + (header = xhr.getResponseHeader("Accept-Ranges")) && + header === "bytes"; + var usesGzip = + (header = xhr.getResponseHeader("Content-Encoding")) && + header === "gzip"; + var chunkSize = 1024 * 1024; + if (!hasByteServing) chunkSize = datalength; + var doXHR = (from, to) => { + if (from > to) + throw new Error( + "invalid range (" + + from + + ", " + + to + + ") or no bytes requested!", + ); + if (to > datalength - 1) + throw new Error( + "only " + datalength + " bytes available! programmer error!", + ); + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + if (datalength !== chunkSize) + xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } + return intArrayFromString(xhr.responseText || "", true); + }; + var lazyArray = this; + lazyArray.setDataGetter((chunkNum) => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") + throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out( + "LazyFiles on gzip forces download of the whole file when length is accessed", + ); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + get length() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + get chunkSize() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) + throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array(); + var properties = { isDevice: false, contents: lazyArray }; + } else { + var properties = { isDevice: false, url }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + Object.defineProperties(node, { + usedBytes: { + get: function () { + return this.contents.length; + }, + }, + }); + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach((key) => { + var fn = node.stream_ops[key]; + stream_ops[key] = (...args) => { + FS.forceLoadFile(node); + return fn(...args); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { ptr, allocated: true }; + }; + node.stream_ops = stream_ops; + return node; + }, + absolutePath() { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder() { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink() { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath() { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc() { + abort( + "FS.mmapAlloc has been replaced by the top level function mmapAlloc", + ); + }, + standardizePath() { + abort( + "FS.standardizePath has been removed; use PATH.normalize instead", + ); + }, + }; + var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return dir + "/" + path; + }, + writeStat(buf, stat) { + HEAP32[buf / 4] = stat.dev; + HEAP32[(buf + 4) / 4] = stat.mode; + HEAPU64[(buf + 8) / 8] = BigInt(stat.nlink); + HEAP32[(buf + 16) / 4] = stat.uid; + HEAP32[(buf + 20) / 4] = stat.gid; + HEAP32[(buf + 24) / 4] = stat.rdev; + HEAP64[(buf + 32) / 8] = BigInt(stat.size); + HEAP32[(buf + 40) / 4] = 4096; + HEAP32[(buf + 44) / 4] = stat.blocks; + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + HEAP64[(buf + 48) / 8] = BigInt(Math.floor(atime / 1e3)); + HEAPU64[(buf + 56) / 8] = BigInt((atime % 1e3) * 1e3 * 1e3); + HEAP64[(buf + 64) / 8] = BigInt(Math.floor(mtime / 1e3)); + HEAPU64[(buf + 72) / 8] = BigInt((mtime % 1e3) * 1e3 * 1e3); + HEAP64[(buf + 80) / 8] = BigInt(Math.floor(ctime / 1e3)); + HEAPU64[(buf + 88) / 8] = BigInt((ctime % 1e3) * 1e3 * 1e3); + HEAP64[(buf + 96) / 8] = BigInt(stat.ino); + return 0; + }, + writeStatFs(buf, stats) { + HEAP32[(buf + 8) / 4] = stats.bsize; + HEAP32[(buf + 56) / 4] = stats.bsize; + HEAP32[(buf + 16) / 4] = stats.blocks; + HEAP32[(buf + 20) / 4] = stats.bfree; + HEAP32[(buf + 24) / 4] = stats.bavail; + HEAP32[(buf + 28) / 4] = stats.files; + HEAP32[(buf + 32) / 4] = stats.ffree; + HEAP32[(buf + 36) / 4] = stats.fsid; + HEAP32[(buf + 64) / 4] = stats.flags; + HEAP32[(buf + 48) / 4] = stats.namelen; + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + varargs: undefined, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + }; + function ___syscall_fcntl64(fd, cmd, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: { + var arg = syscallGetVarargI(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.dupStream(stream, arg); + return newStream.fd; + } + case 1: + case 2: + return 0; + case 3: + return stream.flags; + case 4: { + var arg = syscallGetVarargI(); + stream.flags |= arg; + return 0; + } + case 5: { + var arg = syscallGetVarargP(); + var offset = 0; + HEAP16[(arg + offset) / 2] = 2; + return 0; + } + case 6: + case 7: + return 0; + } + return -28; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_fstat64(fd, buf) { + buf = bigintToI53Checked(buf); + try { + return SYSCALLS.writeStat(buf, FS.fstat(fd)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_ioctl(fd, op, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: { + if (!stream.tty) return -59; + return 0; + } + case 21505: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = syscallGetVarargP(); + HEAP32[argp / 4] = termios.c_iflag || 0; + HEAP32[(argp + 4) / 4] = termios.c_oflag || 0; + HEAP32[(argp + 8) / 4] = termios.c_cflag || 0; + HEAP32[(argp + 12) / 4] = termios.c_lflag || 0; + for (var i = 0; i < 32; i++) { + HEAP8[argp + i + 17] = termios.c_cc[i] || 0; + } + return 0; + } + return 0; + } + case 21510: + case 21511: + case 21512: { + if (!stream.tty) return -59; + return 0; + } + case 21506: + case 21507: + case 21508: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = syscallGetVarargP(); + var c_iflag = HEAP32[argp / 4]; + var c_oflag = HEAP32[(argp + 4) / 4]; + var c_cflag = HEAP32[(argp + 8) / 4]; + var c_lflag = HEAP32[(argp + 12) / 4]; + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(HEAP8[argp + i + 17]); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag, + c_oflag, + c_cflag, + c_lflag, + c_cc, + }); + } + return 0; + } + case 21519: { + if (!stream.tty) return -59; + var argp = syscallGetVarargP(); + HEAP32[argp / 4] = 0; + return 0; + } + case 21520: { + if (!stream.tty) return -59; + return -28; + } + case 21531: { + var argp = syscallGetVarargP(); + return FS.ioctl(stream, op, argp); + } + case 21523: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = syscallGetVarargP(); + HEAP16[argp / 2] = winsize[0]; + HEAP16[(argp + 2) / 2] = winsize[1]; + } + return 0; + } + case 21524: { + if (!stream.tty) return -59; + return 0; + } + case 21515: { + if (!stream.tty) return -59; + return 0; + } + default: + return -28; + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_openat(dirfd, path, flags, varargs) { + path = bigintToI53Checked(path); + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? syscallGetVarargI() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + var __abort_js = () => abort("native code called abort()"); + var runtimeKeepaliveCounter = 0; + var __emscripten_runtime_keepalive_clear = () => { + noExitRuntime = false; + runtimeKeepaliveCounter = 0; + }; + function __mmap_js(len, prot, flags, fd, offset, allocated, addr) { + len = bigintToI53Checked(len); + offset = bigintToI53Checked(offset); + allocated = bigintToI53Checked(allocated); + addr = bigintToI53Checked(addr); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var res = FS.mmap(stream, len, offset, prot, flags); + var ptr = res.ptr; + HEAP32[allocated / 4] = res.allocated; + HEAPU64[addr / 8] = BigInt(ptr); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function __munmap_js(addr, len, prot, flags, fd, offset) { + addr = bigintToI53Checked(addr); + len = bigintToI53Checked(len); + offset = bigintToI53Checked(offset); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (prot & 2) { + SYSCALLS.doMsync(addr, stream, len, flags, offset); + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + var timers = {}; + var handleException = (e) => { + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + checkStackCookie(); + if (e instanceof WebAssembly.RuntimeError) { + if (_emscripten_stack_get_current() <= 0) { + err( + "Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)", + ); + } + } + quit_(1, e); + }; + var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0; + var _proc_exit = (code) => { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + Module["onExit"]?.(code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); + }; + var exitJS = (statusw, implicit) => { + EXITSTATUS = statusw; + checkUnflushedContent(); + if (keepRuntimeAlive() && !implicit) { + + for (let i = 0; i < instructions.length; i++){ + instructions[i]._rowVariant = ''; + } + status.run_program = -1; // program finished + if (statusw !== 0){ + coreEvents.emit("executor-buttons-update", { + reset_disable: false, + instruction_disable: true, + run_disable: true, + stop_disable: false, + }); + show_notification("Your program has finished with errors.", "danger"); + } else { + coreEvents.emit("executor-buttons-update", { + reset_disable: false, + instruction_disable: false, + run_disable: false, + stop_disable: true, + isFinished: true, + }); + } + var msg = `program exited (with status: ${statusw}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`; + readyPromiseReject(msg); + err(msg); + } + _proc_exit(statusw); + }; + var _exit = exitJS; + var maybeExit = () => { + if (!keepRuntimeAlive()) { + try { + _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } + }; + var callUserCallback = (func) => { + if (ABORT) { + err( + "user callback triggered after runtime exited or application aborted. Ignoring.", + ); + return; + } + try { + func(); + maybeExit(); + } catch (e) { + handleException(e); + } + }; + var _emscripten_get_now = () => performance.now(); + var __setitimer_js = (which, timeout_ms) => { + if (timers[which]) { + clearTimeout(timers[which].id); + delete timers[which]; + } + if (!timeout_ms) return 0; + var id = setTimeout(() => { + assert(which in timers); + delete timers[which]; + callUserCallback(() => + __emscripten_timeout(which, _emscripten_get_now()), + ); + }, timeout_ms); + timers[which] = { id, timeout_ms }; + return 0; + }; + var _emscripten_set_main_loop_timing = (mode, value) => { + MainLoop.timingMode = mode; + MainLoop.timingValue = value; + if (!MainLoop.func) { + err( + "emscripten_set_main_loop_timing: Cannot set timing mode for main loop since a main loop does not exist! Call emscripten_set_main_loop first to set one up.", + ); + return 1; + } + if (!MainLoop.running) { + MainLoop.running = true; + } + if (mode == 0) { + MainLoop.scheduler = function MainLoop_scheduler_setTimeout() { + var timeUntilNextTick = + Math.max( + 0, + MainLoop.tickStartTime + value - _emscripten_get_now(), + ) | 0; + setTimeout(MainLoop.runner, timeUntilNextTick); + }; + MainLoop.method = "timeout"; + } else if (mode == 1) { + MainLoop.scheduler = function MainLoop_scheduler_rAF() { + MainLoop.requestAnimationFrame(MainLoop.runner); + }; + MainLoop.method = "rAF"; + } else if (mode == 2) { + if (typeof MainLoop.setImmediate == "undefined") { + if (typeof setImmediate == "undefined") { + var setImmediates = []; + var emscriptenMainLoopMessageId = "setimmediate"; + var MainLoop_setImmediate_messageHandler = (event) => { + if ( + event.data === emscriptenMainLoopMessageId || + event.data.target === emscriptenMainLoopMessageId + ) { + event.stopPropagation(); + setImmediates.shift()(); + } + }; + addEventListener( + "message", + MainLoop_setImmediate_messageHandler, + true, + ); + MainLoop.setImmediate = (func) => { + setImmediates.push(func); + if (ENVIRONMENT_IS_WORKER) { + Module["setImmediates"] ??= []; + Module["setImmediates"].push(func); + postMessage({ target: emscriptenMainLoopMessageId }); + } else postMessage(emscriptenMainLoopMessageId, "*"); + }; + } else { + MainLoop.setImmediate = setImmediate; + } + } + MainLoop.scheduler = function MainLoop_scheduler_setImmediate() { + MainLoop.setImmediate(MainLoop.runner); + }; + MainLoop.method = "immediate"; + } + return 0; + }; + var setMainLoop = ( + iterFunc, + fps, + simulateInfiniteLoop, + arg, + noSetTiming, + ) => { + assert( + !MainLoop.func, + "emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.", + ); + MainLoop.func = iterFunc; + MainLoop.arg = arg; + var thisMainLoopId = MainLoop.currentlyRunningMainloop; + function checkIsRunning() { + if (thisMainLoopId < MainLoop.currentlyRunningMainloop) { + maybeExit(); + return false; + } + return true; + } + MainLoop.running = false; + MainLoop.runner = function MainLoop_runner() { + if (ABORT) return; + if (MainLoop.queue.length > 0) { + var start = Date.now(); + var blocker = MainLoop.queue.shift(); + blocker.func(blocker.arg); + if (MainLoop.remainingBlockers) { + var remaining = MainLoop.remainingBlockers; + var next = + remaining % 1 == 0 ? remaining - 1 : Math.floor(remaining); + if (blocker.counted) { + MainLoop.remainingBlockers = next; + } else { + next = next + 0.5; + MainLoop.remainingBlockers = (8 * remaining + next) / 9; + } + } + MainLoop.updateStatus(); + if (!checkIsRunning()) return; + setTimeout(MainLoop.runner, 0); + return; + } + if (!checkIsRunning()) return; + MainLoop.currentFrameNumber = (MainLoop.currentFrameNumber + 1) | 0; + if ( + MainLoop.timingMode == 1 && + MainLoop.timingValue > 1 && + MainLoop.currentFrameNumber % MainLoop.timingValue != 0 + ) { + MainLoop.scheduler(); + return; + } else if (MainLoop.timingMode == 0) { + MainLoop.tickStartTime = _emscripten_get_now(); + } + if (MainLoop.method === "timeout" && Module["ctx"]) { + warnOnce( + "Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!", + ); + MainLoop.method = ""; + } + MainLoop.runIter(iterFunc); + if (!checkIsRunning()) return; + MainLoop.scheduler(); + }; + if (!noSetTiming) { + if (fps > 0) { + _emscripten_set_main_loop_timing(0, 1e3 / fps); + } else { + _emscripten_set_main_loop_timing(1, 1); + } + MainLoop.scheduler(); + } + if (simulateInfiniteLoop) { + throw "unwind"; + } + }; + var MainLoop = { + running: false, + scheduler: null, + method: "", + currentlyRunningMainloop: 0, + func: null, + arg: 0, + timingMode: 0, + timingValue: 0, + currentFrameNumber: 0, + queue: [], + preMainLoop: [], + postMainLoop: [], + pause() { + MainLoop.scheduler = null; + MainLoop.currentlyRunningMainloop++; + }, + resume() { + MainLoop.currentlyRunningMainloop++; + var timingMode = MainLoop.timingMode; + var timingValue = MainLoop.timingValue; + var func = MainLoop.func; + MainLoop.func = null; + setMainLoop(func, 0, false, MainLoop.arg, true); + _emscripten_set_main_loop_timing(timingMode, timingValue); + MainLoop.scheduler(); + }, + updateStatus() { + if (Module["setStatus"]) { + var message = Module["statusMessage"] || "Please wait..."; + var remaining = MainLoop.remainingBlockers ?? 0; + var expected = MainLoop.expectedBlockers ?? 0; + if (remaining) { + if (remaining < expected) { + Module["setStatus"]( + `{message} ({expected - remaining}/{expected})`, + ); + } else { + Module["setStatus"](message); + } + } else { + Module["setStatus"](""); + } + } + }, + init() { + Module["preMainLoop"] && + MainLoop.preMainLoop.push(Module["preMainLoop"]); + Module["postMainLoop"] && + MainLoop.postMainLoop.push(Module["postMainLoop"]); + }, + runIter(func) { + if (ABORT) return; + for (var pre of MainLoop.preMainLoop) { + if (pre() === false) { + return; + } + } + callUserCallback(func); + for (var post of MainLoop.postMainLoop) { + post(); + } + checkStackCookie(); + }, + nextRAF: 0, + fakeRequestAnimationFrame(func) { + var now = Date.now(); + if (MainLoop.nextRAF === 0) { + MainLoop.nextRAF = now + 1e3 / 60; + } else { + while (now + 2 >= MainLoop.nextRAF) { + MainLoop.nextRAF += 1e3 / 60; + } + } + var delay = Math.max(MainLoop.nextRAF - now, 0); + setTimeout(func, delay); + }, + requestAnimationFrame(func) { + if (typeof requestAnimationFrame == "function") { + requestAnimationFrame(func); + return; + } + var RAF = MainLoop.fakeRequestAnimationFrame; + RAF(func); + }, + }; + var _emscripten_date_now = () => Date.now(); + var getHeapMax = () => 2147483648; + var growMemory = (size) => { + var b = wasmMemory.buffer; + var pages = ((size - b.byteLength + 65535) / 65536) | 0; + try { + wasmMemory.grow(BigInt(pages)); + updateMemoryViews(); + return 1; + } catch (e) { + err( + `growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`, + ); + } + }; + function _emscripten_resize_heap(requestedSize) { + requestedSize = bigintToI53Checked(requestedSize); + var oldSize = HEAPU8.length; + assert(requestedSize > oldSize); + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + err( + `Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`, + ); + return false; + } + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); + overGrownHeapSize = Math.min( + overGrownHeapSize, + requestedSize + 100663296, + ); + var newSize = Math.min( + maxHeapSize, + alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536), + ); + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + err( + `Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`, + ); + return false; + } + function _emscripten_run_script_int(ptr) { + ptr = bigintToI53Checked(ptr); + return eval(UTF8ToString(ptr)) | 0; + } + var safeSetTimeout = (func, timeout) => + setTimeout(() => { + callUserCallback(func); + }, timeout); + var _emscripten_sleep = (ms) => + Asyncify.handleSleep((wakeUp) => safeSetTimeout(wakeUp, ms)); + _emscripten_sleep.isAsync = true; + function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[iov / 8]); + var len = Number(HEAPU64[(iov + 8) / 8]); + iov += 16; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; + }; + function _fd_read(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU64[pnum / 8] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + function _fd_seek(fd, offset, whence, newOffset) { + offset = bigintToI53Checked(offset); + newOffset = bigintToI53Checked(newOffset); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + HEAP64[newOffset / 8] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) + stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[iov / 8]); + var len = Number(HEAPU64[(iov + 8) / 8]); + iov += 16; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) { + break; + } + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; + }; + function _fd_write(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU64[pnum / 8] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + assert( + typeof maxBytesToWrite == "number", + "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!", + ); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); + }; + var stackAlloc = (sz) => __emscripten_stack_alloc(sz); + var stringToUTF8OnStack = (str) => { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8(str, ret, size); + return ret; + }; + var runAndAbortIfError = (func) => { + try { + return func(); + } catch (e) { + abort(e); + } + }; + var runtimeKeepalivePush = () => { + runtimeKeepaliveCounter += 1; + }; + var runtimeKeepalivePop = () => { + assert(runtimeKeepaliveCounter > 0); + runtimeKeepaliveCounter -= 1; + }; + var Asyncify = { + rewindArguments: {}, + instrumentWasmImports(imports) { + var importPattern = /^(invoke_.*|__asyncjs__.*)$/; + for (let [x, original] of Object.entries(imports)) { + if (typeof original == "function") { + let isAsyncifyImport = original.isAsync || importPattern.test(x); + imports[x] = (...args) => { + var originalAsyncifyState = Asyncify.state; + try { + return original(...args); + } finally { + var changedToDisabled = + originalAsyncifyState === Asyncify.State.Normal && + Asyncify.state === Asyncify.State.Disabled; + var ignoredInvoke = x.startsWith("invoke_") && true; + if ( + Asyncify.state !== originalAsyncifyState && + !isAsyncifyImport && + !changedToDisabled && + !ignoredInvoke + ) { + throw new Error( + `import ${x} was not in ASYNCIFY_IMPORTS, but changed the state`, + ); + } + } + }; + } + } + }, + saveRewindArguments(funcName, passedArguments) { + return (Asyncify.rewindArguments[funcName] = + Array.from(passedArguments)); + }, + restoreRewindArguments(funcName) { + return Asyncify.rewindArguments[funcName] || []; + }, + instrumentWasmExports(exports) { + var ret = {}; + for (let [x, original] of Object.entries(exports)) { + if (typeof original == "function") { + ret[x] = (...args) => { + Asyncify.exportCallStack.push(x); + try { + Asyncify.saveRewindArguments(x, args); + return original(...args); + } finally { + if (!ABORT) { + var y = Asyncify.exportCallStack.pop(); + assert(y === x); + Asyncify.maybeStopUnwind(); + } + } + }; + } else { + ret[x] = original; + } + } + return ret; + }, + State: { Normal: 0, Unwinding: 1, Rewinding: 2, Disabled: 3 }, + state: 0, + StackSize: 4096, + currData: null, + handleSleepReturnValue: 0, + exportCallStack: [], + callStackNameToId: {}, + callStackIdToName: {}, + callStackId: 0, + asyncPromiseHandlers: null, + sleepCallbacks: [], + getCallStackId(funcName) { + var id = Asyncify.callStackNameToId[funcName]; + if (id === undefined) { + id = Asyncify.callStackId++; + Asyncify.callStackNameToId[funcName] = id; + Asyncify.callStackIdToName[id] = funcName; + } + return id; + }, + maybeStopUnwind() { + if ( + Asyncify.currData && + Asyncify.state === Asyncify.State.Unwinding && + Asyncify.exportCallStack.length === 0 + ) { + Asyncify.state = Asyncify.State.Normal; + runAndAbortIfError(_asyncify_stop_unwind); + if (typeof Fibers != "undefined") { + Fibers.trampoline(); + } + } + }, + whenDone() { + assert( + Asyncify.currData, + "Tried to wait for an async operation when none is in progress.", + ); + assert( + !Asyncify.asyncPromiseHandlers, + "Cannot have multiple async operations in flight at once", + ); + return new Promise((resolve, reject) => { + Asyncify.asyncPromiseHandlers = { resolve, reject }; + }); + }, + allocateData() { + var ptr = _malloc(24 + Asyncify.StackSize); + Asyncify.setDataHeader(ptr, ptr + 24, Asyncify.StackSize); + Asyncify.setDataRewindFunc(ptr); + return ptr; + }, + setDataHeader(ptr, stack, stackSize) { + HEAPU64[ptr / 8] = BigInt(stack); + HEAPU64[(ptr + 8) / 8] = BigInt(stack + stackSize); + }, + setDataRewindFunc(ptr) { + var bottomOfCallStack = Asyncify.exportCallStack[0]; + var rewindId = Asyncify.getCallStackId(bottomOfCallStack); + HEAP32[(ptr + 16) / 4] = rewindId; + }, + getDataRewindFuncName(ptr) { + var id = HEAP32[(ptr + 16) / 4]; + var name = Asyncify.callStackIdToName[id]; + return name; + }, + getDataRewindFunc(name) { + var func = wasmExports[name]; + return func; + }, + doRewind(ptr) { + var name = Asyncify.getDataRewindFuncName(ptr); + var func = Asyncify.getDataRewindFunc(name); + return func(...Asyncify.restoreRewindArguments(name)); + }, + handleSleep(startAsync) { + assert( + Asyncify.state !== Asyncify.State.Disabled, + "Asyncify cannot be done during or after the runtime exits", + ); + if (ABORT) return; + if (Asyncify.state === Asyncify.State.Normal) { + var reachedCallback = false; + var reachedAfterCallback = false; + startAsync((handleSleepReturnValue = 0) => { + assert( + !handleSleepReturnValue || + typeof handleSleepReturnValue == "number" || + typeof handleSleepReturnValue == "boolean", + ); + if (ABORT) return; + Asyncify.handleSleepReturnValue = handleSleepReturnValue; + reachedCallback = true; + if (!reachedAfterCallback) { + return; + } + assert( + !Asyncify.exportCallStack.length, + "Waking up (starting to rewind) must be done from JS, without compiled code on the stack.", + ); + Asyncify.state = Asyncify.State.Rewinding; + runAndAbortIfError(() => _asyncify_start_rewind(Asyncify.currData)); + if (typeof MainLoop != "undefined" && MainLoop.func) { + MainLoop.resume(); + } + var asyncWasmReturnValue, + isError = false; + try { + asyncWasmReturnValue = Asyncify.doRewind(Asyncify.currData); + } catch (err) { + asyncWasmReturnValue = err; + isError = true; + } + var handled = false; + if (!Asyncify.currData) { + var asyncPromiseHandlers = Asyncify.asyncPromiseHandlers; + if (asyncPromiseHandlers) { + Asyncify.asyncPromiseHandlers = null; + (isError + ? asyncPromiseHandlers.reject + : asyncPromiseHandlers.resolve)(asyncWasmReturnValue); + handled = true; + } + } + if (isError && !handled) { + throw asyncWasmReturnValue; + } + }); + reachedAfterCallback = true; + if (!reachedCallback) { + Asyncify.state = Asyncify.State.Unwinding; + Asyncify.currData = Asyncify.allocateData(); + if (typeof MainLoop != "undefined" && MainLoop.func) { + MainLoop.pause(); + } + runAndAbortIfError(() => _asyncify_start_unwind(Asyncify.currData)); + } + } else if (Asyncify.state === Asyncify.State.Rewinding) { + Asyncify.state = Asyncify.State.Normal; + runAndAbortIfError(_asyncify_stop_rewind); + _free(Asyncify.currData); + Asyncify.currData = null; + Asyncify.sleepCallbacks.forEach(callUserCallback); + } else { + abort(`invalid state: ${Asyncify.state}`); + } + return Asyncify.handleSleepReturnValue; + }, + handleAsync(startAsync) { + return Asyncify.handleSleep((wakeUp) => { + startAsync().then(wakeUp); + }); + }, + }; + var getCFunc = (ident) => { + var func = Module["_" + ident]; + assert( + func, + "Cannot call unknown function " + ident + ", make sure it is exported", + ); + return func; + }; + var writeArrayToMemory = (array, buffer) => { + assert( + array.length >= 0, + "writeArrayToMemory array must have a length (should be an array or typed array)", + ); + HEAP8.set(array, buffer); + }; + var ccall = (ident, returnType, argTypes, args, opts) => { + var toC = { + pointer: (p) => BigInt(p), + string: (str) => { + var ret = 0; + if (str !== null && str !== undefined && str !== 0) { + ret = stringToUTF8OnStack(str); + } + return BigInt(ret); + }, + array: (arr) => { + var ret = stackAlloc(arr.length); + writeArrayToMemory(arr, ret); + return BigInt(ret); + }, + }; + function convertReturnValue(ret) { + if (returnType === "string") { + return UTF8ToString(Number(ret)); + } + if (returnType === "pointer") return Number(ret); + if (returnType === "boolean") return Boolean(ret); + return ret; + } + var func = getCFunc(ident); + var cArgs = []; + var stack = 0; + assert(returnType !== "array", 'Return type should not be "array".'); + if (args) { + for (var i = 0; i < args.length; i++) { + var converter = toC[argTypes[i]]; + if (converter) { + if (stack === 0) stack = stackSave(); + cArgs[i] = converter(args[i]); + } else { + cArgs[i] = args[i]; + } + } + } + var previousAsync = Asyncify.currData; + var ret = func(...cArgs); + function onDone(ret) { + runtimeKeepalivePop(); + if (stack !== 0) stackRestore(stack); + return convertReturnValue(ret); + } + var asyncMode = opts?.async; + runtimeKeepalivePush(); + if (Asyncify.currData != previousAsync) { + assert( + !(previousAsync && Asyncify.currData), + "We cannot start an async operation when one is already flight", + ); + assert( + !(previousAsync && !Asyncify.currData), + "We cannot stop an async operation in flight", + ); + assert( + asyncMode, + "The call to " + + ident + + " is running asynchronously. If this was intended, add the async option to the ccall/cwrap call.", + ); + return Asyncify.whenDone().then(onDone); + } + ret = onDone(ret); + if (asyncMode) return Promise.resolve(ret); + return ret; + }; + FS.createPreloadedFile = FS_createPreloadedFile; + FS.staticInit(); + Module["requestAnimationFrame"] = MainLoop.requestAnimationFrame; + Module["pauseMainLoop"] = MainLoop.pause; + Module["resumeMainLoop"] = MainLoop.resume; + MainLoop.init(); + function checkIncomingModuleAPI() { + ignoredModuleProp("fetchSettings"); + } + var wasmImports = { + __assert_fail: ___assert_fail, + __syscall_fcntl64: ___syscall_fcntl64, + __syscall_fstat64: ___syscall_fstat64, + __syscall_ioctl: ___syscall_ioctl, + __syscall_openat: ___syscall_openat, + _abort_js: __abort_js, + _emscripten_runtime_keepalive_clear: __emscripten_runtime_keepalive_clear, + _mmap_js: __mmap_js, + _munmap_js: __munmap_js, + _setitimer_js: __setitimer_js, + emscripten_date_now: _emscripten_date_now, + emscripten_resize_heap: _emscripten_resize_heap, + emscripten_run_script_int: _emscripten_run_script_int, + emscripten_sleep: _emscripten_sleep, + exit: _exit, + fd_close: _fd_close, + fd_read: _fd_read, + fd_seek: _fd_seek, + fd_write: _fd_write, + proc_exit: _proc_exit, + }; + var wasmExports = await createWasm(); + var ___wasm_call_ctors = createExportWrapper("__wasm_call_ctors", 0); + var _malloc = (Module["_malloc"] = createExportWrapper("malloc", 1)); + var _free = (Module["_free"] = createExportWrapper("free", 1)); + var _send_int_to_C = (Module["_send_int_to_C"] = createExportWrapper( + "send_int_to_C", + 1, + )); + var _send_float_to_C = (Module["_send_float_to_C"] = createExportWrapper( + "send_float_to_C", + 1, + )); + var _send_double_to_C = (Module["_send_double_to_C"] = createExportWrapper( + "send_double_to_C", + 1, + )); + var _send_char_to_C = (Module["_send_char_to_C"] = createExportWrapper( + "send_char_to_C", + 1, + )); + var _send_string_to_C = (Module["_send_string_to_C"] = createExportWrapper( + "send_string_to_C", + 1, + )); + var _reanudar_ejecucion = (Module["_reanudar_ejecucion"] = + createExportWrapper("reanudar_ejecucion", 1)); + var _strerror = createExportWrapper("strerror", 1); + var _fflush = createExportWrapper("fflush", 1); + var _main = (Module["_main"] = createExportWrapper("__main_argc_argv", 2)); + var _emscripten_builtin_memalign = createExportWrapper( + "emscripten_builtin_memalign", + 2, + ); + var __emscripten_timeout = createExportWrapper("_emscripten_timeout", 2); + var _emscripten_stack_init = wasmExports["emscripten_stack_init"]; + var _emscripten_stack_get_free = wasmExports["emscripten_stack_get_free"]; + var _emscripten_stack_get_base = wasmExports["emscripten_stack_get_base"]; + var _emscripten_stack_get_end = wasmExports["emscripten_stack_get_end"]; + var __emscripten_stack_restore = wasmExports["_emscripten_stack_restore"]; + var __emscripten_stack_alloc = wasmExports["_emscripten_stack_alloc"]; + var _emscripten_stack_get_current = + wasmExports["emscripten_stack_get_current"]; + var ___cxa_increment_exception_refcount = createExportWrapper( + "__cxa_increment_exception_refcount", + 1, + ); + var dynCall_jj = (Module["dynCall_jj"] = createExportWrapper( + "dynCall_jj", + 2, + )); + var dynCall_jjjj = (Module["dynCall_jjjj"] = createExportWrapper( + "dynCall_jjjj", + 4, + )); + var dynCall_vjj = (Module["dynCall_vjj"] = createExportWrapper( + "dynCall_vjj", + 3, + )); + var dynCall_ijjj = (Module["dynCall_ijjj"] = createExportWrapper( + "dynCall_ijjj", + 4, + )); + var dynCall_ijii = (Module["dynCall_ijii"] = createExportWrapper( + "dynCall_ijii", + 4, + )); + var dynCall_ij = (Module["dynCall_ij"] = createExportWrapper( + "dynCall_ij", + 2, + )); + var dynCall_jjii = (Module["dynCall_jjii"] = createExportWrapper( + "dynCall_jjii", + 4, + )); + var dynCall_jjji = (Module["dynCall_jjji"] = createExportWrapper( + "dynCall_jjji", + 4, + )); + var dynCall_ijdiiii = (Module["dynCall_ijdiiii"] = createExportWrapper( + "dynCall_ijdiiii", + 7, + )); + var dynCall_v = (Module["dynCall_v"] = createExportWrapper("dynCall_v", 1)); + var dynCall_vi = (Module["dynCall_vi"] = createExportWrapper( + "dynCall_vi", + 2, + )); + var _asyncify_start_unwind = createExportWrapper( + "asyncify_start_unwind", + 1, + ); + var _asyncify_stop_unwind = createExportWrapper("asyncify_stop_unwind", 0); + var _asyncify_start_rewind = createExportWrapper( + "asyncify_start_rewind", + 1, + ); + var _asyncify_stop_rewind = createExportWrapper("asyncify_stop_rewind", 0); + function applySignatureConversions(wasmExports) { + wasmExports = Object.assign({}, wasmExports); + var makeWrapper_pp = (f) => (a0) => Number(f(BigInt(a0))); + var makeWrapper__p = (f) => (a0) => f(BigInt(a0)); + var makeWrapper_p_ = (f) => (a0) => Number(f(a0)); + var makeWrapper___PP = (f) => (a0, a1, a2) => + f(a0, BigInt(a1 ? a1 : 0), BigInt(a2 ? a2 : 0)); + var makeWrapper_ppp = (f) => (a0, a1) => + Number(f(BigInt(a0), BigInt(a1))); + var makeWrapper_p = (f) => () => Number(f()); + var makeWrapper__p_ = (f) => (a0, a1) => f(BigInt(a0), a1); + var makeWrapper__p___ = (f) => (a0, a1, a2, a3) => + f(BigInt(a0), a1, a2, a3); + var makeWrapper__p__ = (f) => (a0, a1, a2) => f(BigInt(a0), a1, a2); + var makeWrapper__p______ = (f) => (a0, a1, a2, a3, a4, a5, a6) => + f(BigInt(a0), a1, a2, a3, a4, a5, a6); + wasmExports["malloc"] = makeWrapper_pp(wasmExports["malloc"]); + wasmExports["free"] = makeWrapper__p(wasmExports["free"]); + wasmExports["strerror"] = makeWrapper_p_(wasmExports["strerror"]); + wasmExports["fflush"] = makeWrapper__p(wasmExports["fflush"]); + wasmExports["__main_argc_argv"] = makeWrapper___PP( + wasmExports["__main_argc_argv"], + ); + wasmExports["emscripten_builtin_memalign"] = makeWrapper_ppp( + wasmExports["emscripten_builtin_memalign"], + ); + wasmExports["emscripten_stack_get_base"] = makeWrapper_p( + wasmExports["emscripten_stack_get_base"], + ); + wasmExports["emscripten_stack_get_end"] = makeWrapper_p( + wasmExports["emscripten_stack_get_end"], + ); + wasmExports["_emscripten_stack_restore"] = makeWrapper__p( + wasmExports["_emscripten_stack_restore"], + ); + wasmExports["_emscripten_stack_alloc"] = makeWrapper_pp( + wasmExports["_emscripten_stack_alloc"], + ); + wasmExports["emscripten_stack_get_current"] = makeWrapper_p( + wasmExports["emscripten_stack_get_current"], + ); + wasmExports["__cxa_increment_exception_refcount"] = makeWrapper__p( + wasmExports["__cxa_increment_exception_refcount"], + ); + wasmExports["dynCall_jj"] = makeWrapper__p_(wasmExports["dynCall_jj"]); + wasmExports["dynCall_jjjj"] = makeWrapper__p___( + wasmExports["dynCall_jjjj"], + ); + wasmExports["dynCall_vjj"] = makeWrapper__p__(wasmExports["dynCall_vjj"]); + wasmExports["dynCall_ijjj"] = makeWrapper__p___( + wasmExports["dynCall_ijjj"], + ); + wasmExports["dynCall_ijii"] = makeWrapper__p___( + wasmExports["dynCall_ijii"], + ); + wasmExports["dynCall_ij"] = makeWrapper__p_(wasmExports["dynCall_ij"]); + wasmExports["dynCall_jjii"] = makeWrapper__p___( + wasmExports["dynCall_jjii"], + ); + wasmExports["dynCall_jjji"] = makeWrapper__p___( + wasmExports["dynCall_jjji"], + ); + wasmExports["dynCall_ijdiiii"] = makeWrapper__p______( + wasmExports["dynCall_ijdiiii"], + ); + wasmExports["dynCall_v"] = makeWrapper__p(wasmExports["dynCall_v"]); + wasmExports["dynCall_vi"] = makeWrapper__p_(wasmExports["dynCall_vi"]); + wasmExports["asyncify_start_unwind"] = makeWrapper__p( + wasmExports["asyncify_start_unwind"], + ); + wasmExports["asyncify_start_rewind"] = makeWrapper__p( + wasmExports["asyncify_start_rewind"], + ); + return wasmExports; + } + Module["run"] = run; + Module["callMain"] = callMain; + Module["ccall"] = ccall; + Module["stringToUTF8"] = stringToUTF8; + Module["lengthBytesUTF8"] = lengthBytesUTF8; + var missingLibrarySymbols = [ + "writeI53ToI64", + "writeI53ToI64Clamped", + "writeI53ToI64Signaling", + "writeI53ToU64Clamped", + "writeI53ToU64Signaling", + "readI53FromI64", + "readI53FromU64", + "convertI32PairToI53", + "convertI32PairToI53Checked", + "convertU32PairToI53", + "getTempRet0", + "setTempRet0", + "inetPton4", + "inetNtop4", + "inetPton6", + "inetNtop6", + "readSockaddr", + "writeSockaddr", + "emscriptenLog", + "readEmAsmArgs", + "jstoi_q", + "getExecutableName", + "listenOnce", + "autoResumeAudioContext", + "dynCallLegacy", + "getDynCaller", + "dynCall", + "asmjsMangle", + "HandleAllocator", + "getNativeTypeSize", + "addOnInit", + "addOnPostCtor", + "addOnPreMain", + "addOnExit", + "STACK_SIZE", + "STACK_ALIGN", + "POINTER_SIZE", + "ASSERTIONS", + "cwrap", + "uleb128Encode", + "generateFuncType", + "convertJsFunctionToWasm", + "getEmptyTableSlot", + "updateTableMap", + "getFunctionAddress", + "addFunction", + "removeFunction", + "reallyNegative", + "unSign", + "strLen", + "reSign", + "formatString", + "intArrayToString", + "AsciiToString", + "stringToAscii", + "UTF16ToString", + "stringToUTF16", + "lengthBytesUTF16", + "UTF32ToString", + "stringToUTF32", + "lengthBytesUTF32", + "stringToNewUTF8", + "registerKeyEventCallback", + "maybeCStringToJsString", + "findEventTarget", + "getBoundingClientRect", + "fillMouseEventData", + "registerMouseEventCallback", + "registerWheelEventCallback", + "registerUiEventCallback", + "registerFocusEventCallback", + "fillDeviceOrientationEventData", + "registerDeviceOrientationEventCallback", + "fillDeviceMotionEventData", + "registerDeviceMotionEventCallback", + "screenOrientation", + "fillOrientationChangeEventData", + "registerOrientationChangeEventCallback", + "fillFullscreenChangeEventData", + "registerFullscreenChangeEventCallback", + "JSEvents_requestFullscreen", + "JSEvents_resizeCanvasForFullscreen", + "registerRestoreOldStyle", + "hideEverythingExceptGivenElement", + "restoreHiddenElements", + "setLetterbox", + "softFullscreenResizeWebGLRenderTarget", + "doRequestFullscreen", + "fillPointerlockChangeEventData", + "registerPointerlockChangeEventCallback", + "registerPointerlockErrorEventCallback", + "requestPointerLock", + "fillVisibilityChangeEventData", + "registerVisibilityChangeEventCallback", + "registerTouchEventCallback", + "fillGamepadEventData", + "registerGamepadEventCallback", + "registerBeforeUnloadEventCallback", + "fillBatteryEventData", + "battery", + "registerBatteryEventCallback", + "setCanvasElementSize", + "getCanvasElementSize", + "jsStackTrace", + "getCallstack", + "convertPCtoSourceLocation", + "getEnvStrings", + "checkWasiClock", + "wasiRightsToMuslOFlags", + "wasiOFlagsToMuslOFlags", + "setImmediateWrapped", + "safeRequestAnimationFrame", + "clearImmediateWrapped", + "registerPostMainLoop", + "registerPreMainLoop", + "getPromise", + "makePromise", + "idsToPromises", + "makePromiseCallback", + "ExceptionInfo", + "findMatchingCatch", + "Browser_asyncPrepareDataCounter", + "isLeapYear", + "ydayFromDate", + "arraySum", + "addDays", + "getSocketFromFD", + "getSocketAddress", + "FS_unlink", + "FS_mkdirTree", + "_setNetworkCallback", + "heapObjectForWebGLType", + "toTypedArrayIndex", + "webgl_enable_ANGLE_instanced_arrays", + "webgl_enable_OES_vertex_array_object", + "webgl_enable_WEBGL_draw_buffers", + "webgl_enable_WEBGL_multi_draw", + "webgl_enable_EXT_polygon_offset_clamp", + "webgl_enable_EXT_clip_control", + "webgl_enable_WEBGL_polygon_mode", + "emscriptenWebGLGet", + "computeUnpackAlignedImageSize", + "colorChannelsInGlTextureFormat", + "emscriptenWebGLGetTexPixelData", + "emscriptenWebGLGetUniform", + "webglGetUniformLocation", + "webglPrepareUniformLocationsBeforeFirstUse", + "webglGetLeftBracePos", + "emscriptenWebGLGetVertexAttrib", + "__glGetActiveAttribOrUniform", + "writeGLArray", + "registerWebGlEventCallback", + "ALLOC_NORMAL", + "ALLOC_STACK", + "allocate", + "writeStringToMemory", + "writeAsciiToMemory", + "setErrNo", + "demangle", + "stackTrace", + ]; + missingLibrarySymbols.forEach(missingLibrarySymbol); + var unexportedSymbols = [ + "addRunDependency", + "removeRunDependency", + "out", + "err", + "abort", + "wasmMemory", + "wasmExports", + "writeStackCookie", + "checkStackCookie", + "INT53_MAX", + "INT53_MIN", + "bigintToI53Checked", + "stackSave", + "stackRestore", + "stackAlloc", + "ptrToString", + "zeroMemory", + "exitJS", + "getHeapMax", + "growMemory", + "ENV", + "ERRNO_CODES", + "strError", + "DNS", + "Protocols", + "Sockets", + "timers", + "warnOnce", + "readEmAsmArgsArray", + "jstoi_s", + "handleException", + "keepRuntimeAlive", + "runtimeKeepalivePush", + "runtimeKeepalivePop", + "callUserCallback", + "maybeExit", + "asyncLoad", + "alignMemory", + "mmapAlloc", + "wasmTable", + "noExitRuntime", + "addOnPreRun", + "addOnPostRun", + "getCFunc", + "sigToWasmTypes", + "freeTableIndexes", + "functionsInTableMap", + "setValue", + "getValue", + "PATH", + "PATH_FS", + "UTF8Decoder", + "UTF8ArrayToString", + "UTF8ToString", + "stringToUTF8Array", + "intArrayFromString", + "UTF16Decoder", + "stringToUTF8OnStack", + "writeArrayToMemory", + "JSEvents", + "specialHTMLTargets", + "findCanvasEventTarget", + "currentFullscreenStrategy", + "restoreOldWindowedStyle", + "UNWIND_CACHE", + "ExitStatus", + "doReadv", + "doWritev", + "initRandomFill", + "randomFill", + "safeSetTimeout", + "emSetImmediate", + "emClearImmediate_deps", + "emClearImmediate", + "promiseMap", + "uncaughtExceptionCount", + "exceptionLast", + "exceptionCaught", + "Browser", + "getPreloadedImageData__data", + "wget", + "MONTH_DAYS_REGULAR", + "MONTH_DAYS_LEAP", + "MONTH_DAYS_REGULAR_CUMULATIVE", + "MONTH_DAYS_LEAP_CUMULATIVE", + "SYSCALLS", + "preloadPlugins", + "FS_createPreloadedFile", + "FS_modeStringToFlags", + "FS_getMode", + "FS_stdin_getChar_buffer", + "FS_stdin_getChar", + "FS_createPath", + "FS_createDevice", + "FS_readFile", + "FS", + "FS_createDataFile", + "FS_createLazyFile", + "MEMFS", + "TTY", + "PIPEFS", + "SOCKFS", + "tempFixedLengthArray", + "miniTempWebGLFloatBuffers", + "miniTempWebGLIntBuffers", + "GL", + "AL", + "GLUT", + "EGL", + "GLEW", + "IDBStore", + "runAndAbortIfError", + "Asyncify", + "Fibers", + "SDL", + "SDL_gfx", + "allocateUTF8", + "allocateUTF8OnStack", + "print", + "printErr", + ]; + unexportedSymbols.forEach(unexportedRuntimeSymbol); + var calledRun; + function callMain(args = []) { + assert( + runDependencies == 0, + 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])', + ); + assert( + typeof onPreRuns === "undefined" || onPreRuns.length == 0, + "cannot call main when preRun functions remain to be called", + ); + var entryFunction = _main; + args.unshift(thisProgram); + var argc = args.length; + var argv = stackAlloc((argc + 1) * 8); + var argv_ptr = argv; + args.forEach((arg) => { + HEAPU64[argv_ptr / 8] = BigInt(stringToUTF8OnStack(arg)); + argv_ptr += 8; + }); + HEAPU64[argv_ptr / 8] = BigInt(0); + try { + var ret = entryFunction(argc, BigInt(argv)); + exitJS(ret, true); + return ret; + } catch (e) { + return handleException(e); + } + } + function stackCheckInit() { + _emscripten_stack_init(); + writeStackCookie(); + } + function run(args = arguments_) { + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + stackCheckInit(); + preRun(); + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + function doRun() { + assert(!calledRun); + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + FS.writeFile("output.elf", args[0]); + args.shift(); + preMain(); + readyPromiseResolve(Module); + Module["onRuntimeInitialized"]?.(); + var noInitialRun = Module["noInitialRun"]; + legacyModuleProp("noInitialRun", "noInitialRun"); + callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(() => { + setTimeout(() => Module["setStatus"](""), 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); + } + function checkUnflushedContent() { + var oldOut = out; + var oldErr = err; + var has = false; + out = err = (x) => { + has = true; + }; + try { + _fflush(0); + ["stdout", "stderr"].forEach((name) => { + var info = FS.analyzePath("/dev/" + name); + if (!info) return; + var stream = info.object; + var rdev = stream.rdev; + var tty = TTY.ttys[rdev]; + if (tty?.output?.length) { + has = true; + } + }); + } catch (e) {} + out = oldOut; + err = oldErr; + if (has) { + warnOnce( + "stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.", + ); + } + } + if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") + Module["preInit"] = [Module["preInit"]]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } + } + // run(); + moduleRtn = readyPromise; + for (const prop of Object.keys(Module)) { + if (!(prop in moduleArg)) { + Object.defineProperty(moduleArg, prop, { + configurable: true, + get() { + abort( + `Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`, + ); + }, + }); + } + } + readyPromiseResolve(Module); + return moduleRtn; + }; +})(); +(() => { + // Create a small, never-async wrapper around Module which + // checks for callers incorrectly using it with `new`. + var real_Module = Module; + Module = function (arg) { + if (new.target) + throw new Error("Module() should not be called with `new Module()`"); + return real_Module(arg); + }; +})(); +export default Module; diff --git a/src/core/executor/sailSimRV/wasm/riscv_sim_RV64.wasm b/src/core/executor/sailSimRV/wasm/riscv_sim_RV64.wasm new file mode 100755 index 000000000..eea7771a3 Binary files /dev/null and b/src/core/executor/sailSimRV/wasm/riscv_sim_RV64.wasm differ diff --git a/src/core/memory/Memory.mts b/src/core/memory/Memory.mts index 4d1967d7c..d690075cc 100644 --- a/src/core/memory/Memory.mts +++ b/src/core/memory/Memory.mts @@ -146,7 +146,7 @@ interface MemorySegment { */ interface MemoryHint { address: bigint; - tag: string; + tag: string[]; type: string; sizeInBits?: number; // Optional size of the type in bits } @@ -170,9 +170,8 @@ export interface MemoryBackup { size: number; hints?: { address: string; - tag?: string; - type?: string; - hint?: string; + tag: string[]; + type: string; sizeInBits?: number; }[]; } @@ -628,7 +627,7 @@ export class Memory { } /** - * Returns the addreses that have been written + * Returns the addresses that have been written */ getWritten(): Array<{ addr: number; value: number }> { return ( @@ -643,7 +642,7 @@ export class Memory { } /** - * Returns all memory addreses and values. + * Returns all memory addresses and values. */ getAll(): Array<{ addr: number; value: number }> { return Array.from(this.uint8View).map((value, i) => ({ @@ -687,7 +686,7 @@ export class Memory { // Include hints in the dump const hints: { address: string; - tag: string; + tag: string[]; type: string; sizeInBits?: number; }[] = []; @@ -757,24 +756,10 @@ export class Memory { this.hints.clear(); if (dump.hints) { for (const hint of dump.hints) { - // Backward compatibility: if only "hint" exists, split it - let tag = hint.tag; - let type = hint.type; - if (!tag && !type && typeof hint.hint === "string") { - // Try to split "type:tag" or "type" or "tag" - const m = /^<([^>]+)>(?::(.*))?$/.exec(hint.hint); - if (m) { - type = m[1]; - tag = m[2] || ""; - } else { - tag = hint.hint; - type = ""; - } - } this.hints.set(BigInt(hint.address), { address: BigInt(hint.address), - tag: tag || "", - type: type || "", + tag: hint.tag, + type: hint.type, sizeInBits: hint.sizeInBits, }); } @@ -1354,14 +1339,18 @@ export class Memory { */ addHint( address: bigint, - tag: string, + tag: string|string[], type: string, sizeInBits?: number, ): void { // If no tag is provided and a hint exists, preserve the existing tag - let finalTag = tag; + let finalTag; + if (typeof tag === "string") + finalTag = tag === ""? [] : [tag] + else + finalTag = tag; const existing = this.hints.get(address); - if ((!tag || tag === "") && existing) { + if (tag.length === 0 && existing) { finalTag = existing.tag; } this.hints.set(address, { diff --git a/src/core/register/registerOperations.mjs b/src/core/register/registerOperations.mjs index 58ff9dc4a..f402fbe25 100644 --- a/src/core/register/registerOperations.mjs +++ b/src/core/register/registerOperations.mjs @@ -24,6 +24,9 @@ import { sentinel } from "../sentinel/sentinel.mjs"; import { packExecute } from "../utils/utils.mjs"; import { coreEvents } from "../events.mts"; import { setRegisterGlow } from "./registerGlowState.mjs"; +import { userMode32 } from "@/core/executor/sailSimRV/wasm/riscv_sim_RV32.js"; +import { userMode32vd } from "@/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.js"; +import { userMode64 } from "@/core/executor/sailSimRV/wasm/riscv_sim_RV64.js"; /** * Notifies UI layers about a register update via event emission @@ -118,7 +121,7 @@ export function writeRegister(value, indexComp, indexElem) { throw packExecute( true, - "The register " + elementName + " cannot be written", + "The register " + elementName + " is not writeable", "danger", null, ); @@ -132,6 +135,12 @@ export function writeRegister(value, indexComp, indexElem) { } if (typeof document !== "undefined" && document?.app) { // Notify UI layers about the update (CLI ignores, web UI listens) - notifyRegisterUpdate(indexComp, indexElem); + // check if in RISC-V Sail has to be glowed the register by instruction execution + if (architecture.config.name.includes("SRV")){ + if (userMode32 || userMode64 || userMode32vd) + notifyRegisterUpdate(indexComp, indexElem); + }else + notifyRegisterUpdate(indexComp, indexElem); + } } diff --git a/src/rpc/server.mts b/src/rpc/server.mts index 1e373bc8d..ae73d9ea5 100644 --- a/src/rpc/server.mts +++ b/src/rpc/server.mts @@ -36,6 +36,7 @@ import { instructions } from "../core/assembler/assembler.mjs"; import { sjasmplusAssemble } from "../core/assembler/sjasmplus/deno/sjasmplus.mjs"; import { assembleCreator } from "../core/assembler/creatorAssembler/deno/creatorAssembler.mjs"; import { rasmAssemble } from "../core/assembler/rasm/deno/rasm.mjs"; +import { SailCompile } from "../core/assembler/sailAssembler/web/CNAssambler.mjs"; import fs from "node:fs"; import type { StackTracker } from "@/core/memory/StackTracker.mjs"; @@ -44,6 +45,7 @@ const assembler_map = { default: assembleCreator, sjasmplus: sjasmplusAssemble, rasm: rasmAssemble, + Sail: SailCompile, } as const; type CompilerType = keyof typeof assembler_map; diff --git a/src/web/App.vue b/src/web/App.vue index 0b60ec00b..adbd361dc 100644 --- a/src/web/App.vue +++ b/src/web/App.vue @@ -67,7 +67,6 @@ const creatorASCII = ` ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██║ ██║██╔══██╗ ╚██████╗██║ ██║███████╗██║ ██║ ██║ ╚██████╔╝██║ ██║ ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ - didaCtic and geneRic assEmbly progrAmming simulaTOR ${("v." + package_json.version).padStart(58)} `; @@ -209,6 +208,47 @@ export default { // Debug c_debug: false, + // Vector size elem + v_length: 64, + + L1_I_num_lines : 32, + L1_D_num_lines : 32, + L1_num_lines : 32, + L2_num_lines : 32, + L2_I_num_lines : 32, + L2_D_num_lines : 32, + L1_size : 32, + L1_I_size : 32, + L1_D_size : 32, + L1_size_block : 32, + L1_I_size_block : 32, + L1_D_size_block : 32, + L2_size : 32, + L2_I_size : 32, + L2_D_size : 32, + L2_size_block : 32, + L2_I_size_block : 32, + L2_D_size_block : 32, + + // Cache architecture + cache_type : 0, + isDirect : 0, + + // Cache Location + cache_location : "Associative", + + // Cache policy + cache_policy : "FIFO", + + // Execution run + execution_mode_run : -1, + + // Is a breakpoint instruction + is_breakpoint : 0, + + // Integrated Kernel (exclusive to Sail Version) + c_kernel: true, + // Dark Mode dark: false, // the actual dark mode state dark_mode_setting: @@ -387,9 +427,9 @@ export default { window.removeEventListener("resize", this.resizeHandler); }, - /*************** + /**************** * Vue watchers * - ***************/ + ****************/ watch: { dark_mode_setting(newSetting: string) { @@ -678,6 +718,7 @@ export default { v-model:notification_time="notification_time" v-model:dark_mode_setting="dark_mode_setting" v-model:c_debug="c_debug" + v-model:c_kernel="c_kernel" v-model:vim_custom_keybinds="vim_custom_keybinds" v-model:vim_mode="vim_mode" v-model:reg_name_representation="reg_name_representation" diff --git a/src/web/arduino/pinstates.mts b/src/web/arduino/pinstates.mts new file mode 100644 index 000000000..7ac211788 --- /dev/null +++ b/src/web/arduino/pinstates.mts @@ -0,0 +1,149 @@ +import { ref, type Ref } from "vue"; +import { coreEvents, type ArduinoPinRead } from "@/core/events.mts"; +// --- Tipado --- +export interface PinStateMap { + [key: string]: number; +} + +export interface BoardConfig { + name: string; + svg: string; + pinLabels: string[][]; // Estructura de columnas [izquierda, derecha] + initialStates: PinStateMap; +} +const env = (import.meta as any).env || {}; +const baseUrl = env.BASE_URL || '/'; +// Board definition +const BOARDS: Record = { + esp32c3devkit2: { + name: "ESP32-C3 DevKitC-02", + svg: baseUrl + "maker/boards/esp32c3devkit2.svg", + pinLabels: [ + ["GPIO4", "GPIO5", "GPIO6", "GPIO7", "GPIO8", "GPIO9", "GPIO30"], + [ + "GPIO0", + "GPIO1", + "GPIO2", + "GPIO3", + "GPIO20", + "GPIO21", + "GPIO18", + "GPIO19", + ], + ], + initialStates: { + GPIO0: 0, + GPIO1: 0, + GPIO2: 0, + GPIO3: 0, + GPIO4: 0, + GPIO5: 0, + GPIO6: 0, + GPIO7: 0, + GPIO8: 0, + GPIO9: 0, + GPIO10: 0, + GPIO18: 0, + GPIO19: 0, + GPIO20: 0, + GPIO21: 0, + GPIO30: 0, + }, + }, + esp32c6devkit1: { + name: "ESP32-C6 DevKit", + svg: baseUrl + "maker/boards/esp32c6devkit1.svg", + pinLabels: [ + [ + "GPIO4", + "GPIO5", + "GPIO6", + "GPIO7", + "GPIO0", + "GPIO1", + "GPIO8", + "GPIO10", + "GPIO11", + "GPIO2", + "GPIO3", + ], + [ + "GPIO15", + "GPIO23", + "GPIO22", + "GPIO21", + "GPIO20", + "GPIO19", + "GPIO18", + "GPIO9", + "GPIO17", + "GPIO9", + "GPIO13", + "GPIO12", + ], + ], + initialStates: { + GPIO0: 0, + GPIO1: 0, + GPIO2: 0, + GPIO3: 0, + GPIO4: 0, + GPIO5: 0, + GPIO6: 0, + GPIO7: 0, + GPIO8: 0, + GPIO9: 0, + GPIO10: 0, + GPIO11: 0, + GPIO12: 0, + GPIO13: 0, + GPIO15: 0, + GPIO17: 0, + GPIO18: 0, + GPIO19: 0, + GPIO20: 0, + GPIO21: 0, + GPIO22: 0, + GPIO23: 0, + }, + }, +}; + +// interrupt +// Vector table for ESP32 (for demonstration, not fully implemented): [pin,ISR,MODE] +let esp32vectRef = ref<[bigint, bigint, bigint][]>( + Array.from({ length: 32 }, () => [0n, 0n, 0n]), +); +const entry = esp32vectRef.value[0]; +if (entry) { + entry[0] = 0xffffn; // pin + entry[1] = 0xffffn; // isr + entry[2] = 0n; // mode +} + +// States + +// Por defecto empezamos con la ESP32 +const currentBoardKey = "esp32c3devkit2"; + +export const activeBoard = ref(BOARDS[currentBoardKey]); +export const pinStates: Ref = ref({ + ...BOARDS[currentBoardKey]?.initialStates, +}); +export const pinLabels = ref(BOARDS[currentBoardKey]?.pinLabels); +export const esp32vect = esp32vectRef; // Exportamos el vector de interrupciones + +// Change boards +export function switchBoard(boardKey: string) { + if (BOARDS[boardKey]) { + activeBoard.value = BOARDS[boardKey]; + pinStates.value = { ...BOARDS[boardKey].initialStates }; + pinLabels.value = BOARDS[boardKey].pinLabels; + } +} + +// Functions +coreEvents.on("arduino-pin-read", (event: ArduinoPinRead) => { + const value = pinStates.value[event.pin] ?? 0; + event.callback(value); +}); \ No newline at end of file diff --git a/src/web/assemblers.ts b/src/web/assemblers.ts index 0c5ad2eab..1de689b48 100644 --- a/src/web/assemblers.ts +++ b/src/web/assemblers.ts @@ -24,6 +24,7 @@ import { rasmAssemble } from "@/core/assembler/rasm/web/rasm.mjs"; import { assembleCreator } from "@/core/assembler/creatorAssembler/web/creatorAssembler.mjs"; +import { SailCompile } from "@/core/assembler/sailAssembler/web/CNAssambler.mjs"; /** * Assembler function type - flexible to accommodate different assembler signatures @@ -36,6 +37,7 @@ type AssemblerFunction = (...args: any[]) => Promise; */ export const assemblerMap: Record = { // eslint-disable-next-line @typescript-eslint/no-explicit-any + Sail: SailCompile as any, CreatorAssembler: assembleCreator as any, // eslint-disable-next-line @typescript-eslint/no-explicit-any RASM: rasmAssemble as any, diff --git a/src/web/components/ArchitectureView.vue b/src/web/components/ArchitectureView.vue index 37d106560..dd07d67af 100644 --- a/src/web/components/ArchitectureView.vue +++ b/src/web/components/ArchitectureView.vue @@ -29,7 +29,7 @@ import RegisterFileArch from "./architecture/register_file/RegisterFileArch.vue" import Instructions from "./architecture/instructions/Instructions.vue"; import Directives from "./architecture/directives/Directives.vue"; import Pseudoinstructions from "./architecture/pseudoinstructions/Pseudoinstructions.vue"; - +import CacheMemory from "./architecture/cache_memory/CacheMemory.vue"; export default defineComponent({ props: { browser: { type: String, required: true }, @@ -48,6 +48,7 @@ export default defineComponent({ Instructions, Directives, Pseudoinstructions, + CacheMemory, }, data() { @@ -159,6 +160,20 @@ export default defineComponent({ Registers + + + + @@ -181,6 +196,32 @@ export default defineComponent({
+ +
+ +
diff --git a/src/web/components/AssemblyView.vue b/src/web/components/AssemblyView.vue index 2a5ec5b86..3b3e12243 100644 --- a/src/web/components/AssemblyView.vue +++ b/src/web/components/AssemblyView.vue @@ -28,6 +28,7 @@ import MakeURI from "./assembly/MakeURI.vue"; import LoadLibrary from "./assembly/LoadLibrary.vue"; import SaveLibrary from "./assembly/SaveLibrary.vue"; import LibraryTags from "./assembly/LibraryTags.vue"; +import Calculator from "./simulator/Calculator.vue"; export default defineComponent({ props: { @@ -58,6 +59,7 @@ export default defineComponent({ LoadLibrary, SaveLibrary, LibraryTags, + Calculator, }, }); @@ -81,7 +83,7 @@ export default defineComponent({ @@ -102,6 +104,9 @@ export default defineComponent({ + + + . import { defineComponent, type PropType } from "vue"; import type { StackFrame } from "@/core/memory/StackTracker.mjs"; -import { architecture } from "@/core/core.mjs"; +import { architecture, loadedCreatino } from "@/core/core.mjs"; import { main_memory } from "@/core/core"; import { type Device, devices } from "@/core/executor/devices.mts"; @@ -33,6 +33,7 @@ import Calculator from "./simulator/Calculator.vue"; import Terminal from "./simulator/Terminal.vue"; import Stats from "./simulator/Stats.vue"; import Flash from "./simulator/Flash.vue"; +import ArduinoTerminal from "./simulator/ArduinoTerminal.vue"; export default defineComponent({ props: { @@ -75,6 +76,8 @@ export default defineComponent({ Stats, Flash, Terminal, + ArduinoTerminal + // App }, data() { @@ -109,13 +112,14 @@ export default defineComponent({ - + + @@ -152,7 +157,7 @@ export default defineComponent({ + diff --git a/src/web/components/architecture/cache_memory/CacheInfo.vue b/src/web/components/architecture/cache_memory/CacheInfo.vue new file mode 100644 index 000000000..d18c18fc6 --- /dev/null +++ b/src/web/components/architecture/cache_memory/CacheInfo.vue @@ -0,0 +1,58 @@ + + + \ No newline at end of file diff --git a/src/web/components/architecture/cache_memory/CacheMemory.vue b/src/web/components/architecture/cache_memory/CacheMemory.vue new file mode 100644 index 000000000..bbd58ba72 --- /dev/null +++ b/src/web/components/architecture/cache_memory/CacheMemory.vue @@ -0,0 +1,797 @@ + + + \ No newline at end of file diff --git a/src/web/components/architecture/memory_layout/MemoryLayoutDiagram.vue b/src/web/components/architecture/memory_layout/MemoryLayoutDiagram.vue index 039513735..690bade0a 100644 --- a/src/web/components/architecture/memory_layout/MemoryLayoutDiagram.vue +++ b/src/web/components/architecture/memory_layout/MemoryLayoutDiagram.vue @@ -100,9 +100,9 @@ export default defineComponent({ formatGapSize(bytes: number): string { if (bytes >= 1024 * 1024) { - return `${(bytes / (1024 * 1024)).toFixed(1)} MB gap`; + return `${(bytes / (1024 * 1024)).toFixed(1)} MiB gap`; } else if (bytes >= 1024) { - return `${(bytes / 1024).toFixed(1)} KB gap`; + return `${(bytes / 1024).toFixed(1)} KiB gap`; } else { return `${bytes} B gap`; } diff --git a/src/web/components/assembly/AssemblyActions.vue b/src/web/components/assembly/AssemblyActions.vue index 5b10d4aae..bc4da5b98 100644 --- a/src/web/components/assembly/AssemblyActions.vue +++ b/src/web/components/assembly/AssemblyActions.vue @@ -28,6 +28,8 @@ import { useAssembly, type AssemblyResult, } from "@/web/composables/useAssembly"; +import { libtags32 } from "@/core/assembler/sailAssembler/web/wasm/objdump"; +import { libtags64 } from "@/core/assembler/sailAssembler/web/wasm/objdump64"; // State for dropdown visibility const dropdownOpen = ref(false); @@ -103,6 +105,10 @@ const libraryTagsCount = computed(() => { // Access libraryVersion to make this reactive if (libraryVersion.value < 0 || !libraryLoaded.value) return 0; + // Counter to Sail Version of libs + if (libtags32.length !== 0 || libtags64.length !== 0) + return (libtags32.length + libtags64.length); + // YAML format: symbols is an object with symbol names as keys if ((loadedLibrary as any)?.symbols) { return Object.keys((loadedLibrary as any).symbols).length; @@ -119,12 +125,12 @@ const usesCreatorAssembler = computed(() => { } // Check if CreatorAssembler is in the list return assemblers.some( - (asm: { name: string }) => asm.name === "CreatorAssembler", + (asm: { name: string }) => (asm.name === "CreatorAssembler" || asm.name === "Sail"), ); }); const showLibraryButton = computed(() => { - return usesCreatorAssembler.value && libraryLoaded.value; + return ((usesCreatorAssembler.value && libraryLoaded.value) || architecture.config.name.includes("SRV")); }); // Watch for architecture changes @@ -294,7 +300,7 @@ function handleBlur() { @click="toggleVim" > Vim: {{ root.vim_mode ? "on" : "off" }} diff --git a/src/web/components/assembly/AssemblyError.vue b/src/web/components/assembly/AssemblyError.vue index 3f73db068..09b431979 100644 --- a/src/web/components/assembly/AssemblyError.vue +++ b/src/web/components/assembly/AssemblyError.vue @@ -45,5 +45,9 @@ export default defineComponent({ overflow-x: auto; line-height: 112%; border-radius: 3px; + // creator-assembler's color codes + --err-red: #ff0000; + --err-bright-blue: #00BCFE; + --err-yellow: #ffff00; } diff --git a/src/web/components/assembly/Examples.vue b/src/web/components/assembly/Examples.vue index 0c0ff7f20..6f27304a1 100644 --- a/src/web/components/assembly/Examples.vue +++ b/src/web/components/assembly/Examples.vue @@ -31,6 +31,8 @@ import { import example_set from "../../../../examples/example_set.json"; import MakeURI from "./MakeURI.vue"; +import { architecture } from "@/core/core.mjs"; +import { assembly_files, createFile } from "./MultifileEditor.mjs"; interface Props { id: string; @@ -159,6 +161,16 @@ async function load_example(url: string, shouldAssemble: boolean) { const code = await response.text(); const root = (document as any).app; + + if(architecture.config.name.includes("SRV")){ + var ex_name = url.split("/"); + for (let i= 0; i < assembly_files.length; i++){ + assembly_files[i].to_compile = false; + + } + createFile(root.assembly_code, ex_name[ex_name.length - 1], code); + } + root.assembly_code = code; if (shouldAssemble) { diff --git a/src/web/components/assembly/LibraryTags.vue b/src/web/components/assembly/LibraryTags.vue index fefe9ccc2..f13086e7e 100644 --- a/src/web/components/assembly/LibraryTags.vue +++ b/src/web/components/assembly/LibraryTags.vue @@ -17,8 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with CREATOR. If not, see . --> - diff --git a/src/web/components/simulator/Flash.vue b/src/web/components/simulator/Flash.vue index a20705f2d..89d891bca 100644 --- a/src/web/components/simulator/Flash.vue +++ b/src/web/components/simulator/Flash.vue @@ -25,6 +25,7 @@ import { REMOTELAB } from "@/web/src/remoteLab.js"; import { console_log, show_notification } from "@/web/utils.mjs"; import { creator_ga } from "@/core/utils/creator_ga.mjs"; import { instructions } from "@/core/assembler/assembler.mjs"; +import { loadedCreatino } from "@/core/core.mjs"; export default defineComponent({ props: { @@ -277,6 +278,21 @@ export default defineComponent({ creator_ga("simulator", "simulator.arduinoMode", "simulator.arduinoMode") }, + handleCheckboxChange(value: boolean) { + this.creatinoMode(value) + }, + creatinoMode(isChecked: boolean) { + LOCALLAB.gateway_monitor(this.flashURL + "/arduinoMode", { + state: isChecked, + }).then(data => { + this.eraseflash = false + console_log(JSON.stringify(data, null, 2), "DEBUG") + }) + + // Google Analytics + creator_ga("simulator", "simulator.arduinoMode", "simulator.arduinoMode") + }, + handleCheckboxChange(value: boolean) { this.creatinoMode(value) }, @@ -294,6 +310,8 @@ export default defineComponent({ target_port: this.targetPort, target_location: this.targetLocation, assembly: this.assembly_code, + arduino: loadedCreatino, + }).then(data => { this.flashing = false; console_log(JSON.stringify(data, null, 2), "DEBUG"); @@ -350,6 +368,7 @@ export default defineComponent({ target_port: this.targetPort, target_location: this.targetLocation, assembly: this.assembly_code, + arduino: loadedCreatino, }).then(data => { this.stoprunning = false; const dataStr = JSON.stringify(data, null, 2); @@ -391,6 +410,7 @@ export default defineComponent({ target_port: this.targetPort, target_location: this.targetLocation, assembly: this.assembly_code, + arduino: loadedCreatino, }).then(data => { this.running = false; const dataStr = JSON.stringify(data, null, 2); @@ -431,6 +451,7 @@ export default defineComponent({ target_port: this.targetPort, target_location: this.targetLocation, assembly: this.assembly_code, + arduino: loadedCreatino, }).then(data => { this.debugging = false; const dataStr = JSON.stringify(data, null, 2); @@ -482,6 +503,7 @@ export default defineComponent({ target_port: this.targetPort, target_location: this.targetLocation, assembly: this.assembly_code, + arduino: loadedCreatino, }).then(data => { this.fullclean = false; const dataStr = JSON.stringify(data, null, 2); @@ -565,7 +587,7 @@ export default defineComponent({ + diff --git a/src/web/components/simulator/HexViewer.vue b/src/web/components/simulator/HexViewer.vue index 3ec1dad8c..47f18c2d0 100644 --- a/src/web/components/simulator/HexViewer.vue +++ b/src/web/components/simulator/HexViewer.vue @@ -30,23 +30,12 @@ import { SP_REG_INDEX, } from "@/core/core.mjs"; import type { StackFrame } from "@/core/memory/StackTracker.mjs"; +import type { MemoryBackup } from "@/core/memory/Memory.mts"; import MemoryLayoutDiagram from "../architecture/memory_layout/MemoryLayoutDiagram.vue"; import { decode } from "@/core/executor/decoder.mjs"; import { MAXNWORDS } from "@/core/utils/architectureProcessor.mjs"; import { instructions } from "@/core/assembler/assembler.mjs"; -interface MemoryDump { - addresses: number[]; - values: number[]; - highestAddress: number; - hints: Array<{ - address: string; - tag: string; - type: string; - sizeInBits?: number; - }>; -} - export default defineComponent({ props: { main_memory: { type: Object as PropType, required: true }, @@ -60,7 +49,7 @@ export default defineComponent({ data() { return { - memoryDump: null as MemoryDump | null, + memoryDump: null as MemoryBackup | null, pc: -1, sp: -1, bytesPerRow: 8, @@ -496,7 +485,7 @@ export default defineComponent({ this.setMemoryDump(dump); }, - generateMemoryDump(): MemoryDump { + generateMemoryDump(): MemoryBackup { // Get all written memory const written = this.main_memory.getWritten(); @@ -574,7 +563,7 @@ export default defineComponent({ return { addresses, values, highestAddress, hints }; }, - setMemoryDump(dump: MemoryDump) { + setMemoryDump(dump: MemoryBackup) { this.renderState = {}; // Save current scroll position before updating @@ -614,7 +603,7 @@ export default defineComponent({ for (let i = 0; i < sizeInBytes; i++) { this.hintMap.set(address + i, { - tag: hint.tag, + tag: typeof hint.tag === "string" ? hint.tag : hint.tag.join(", "), type: hint.type, sizeInBits: hint.sizeInBits, colorIndex: hintColorIndex, @@ -792,21 +781,7 @@ export default defineComponent({ handleByteClick(index: number, event: MouseEvent) { this.selectByte(index); - - const hintInfo = this.hintMap.get(index); - if (index === this.pc) { - this.showHintTooltip(event.target as HTMLElement, { - tag: "Program Counter", - type: "Register", - }); - } else if (index === this.sp) { - this.showHintTooltip(event.target as HTMLElement, { - tag: "Stack Pointer", - type: "Register", - }); - } else if (hintInfo) { - this.showHintTooltip(event.target as HTMLElement, hintInfo); - } + this.handleByteMouseOver(index, event); }, handleByteDoubleClick(index: number) { diff --git a/src/web/components/simulator/Register.vue b/src/web/components/simulator/Register.vue index 39bb0e4d3..d5357c403 100644 --- a/src/web/components/simulator/Register.vue +++ b/src/web/components/simulator/Register.vue @@ -97,7 +97,12 @@ export default defineComponent({ // Access render to create a reactive dependency // eslint-disable-next-line @typescript-eslint/no-unused-expressions this.render; - return this.show_value(this.value_representation).toString(); + if (this.type === "v_registers"){ + // Only show the first elem of the vector + let elem_size = document.app.$data.v_length / 4; // hex format + return this.show_value(this.value_representation).toString().slice(-elem_size); + } else + return this.show_value(this.value_representation).toString(); }, }, diff --git a/src/web/components/simulator/RegisterSpaceView.vue b/src/web/components/simulator/RegisterSpaceView.vue index 2be4bc255..9beadbb77 100644 --- a/src/web/components/simulator/RegisterSpaceView.vue +++ b/src/web/components/simulator/RegisterSpaceView.vue @@ -23,8 +23,9 @@ import { writeRegister } from "@/core/register/registerOperations.mjs"; import { crex_findReg } from "@/core/register/registerLookup.mjs"; import { creator_ga } from "@/core/utils/creator_ga.mjs"; import { show_notification } from "@/web/utils.mjs"; -import { float2bin, double2bin } from "@/core/utils/utils.mjs"; +import { float2bin, double2bin, hex2float, hex2double } from "@/core/utils/utils.mjs"; import { defineComponent, type PropType } from "vue"; +import { architecture } from "@/core/core.mjs"; export default defineComponent({ props: { @@ -41,6 +42,8 @@ export default defineComponent({ return { newValue: "", precision: "single", + Sail_arch: (architecture.config.name.includes("SRV")) ? true : false, + is_vtype: this.$props.item?.type === "v_registers", }; }, @@ -49,16 +52,12 @@ export default defineComponent({ // TODO return false; }, - - // sync w/ parent - // showValue: { - // get() { - // return this.show - // }, - // set(value) { - // this.$emit("update:show", value) - // }, - // }, + modalSize() { + return (this.item?.type === "v_registers") ? 'modal-xl' : '' + }, + vectorMaxLength(){ + return (512 / document.app.$data.v_length) - 1; + } }, methods: { @@ -113,6 +112,81 @@ export default defineComponent({ creator_ga("data", "data.change", "data.change.register_value"); creator_ga("data", "data.change", "data.change.register_value_" + name); }, + + // function to split in vector register file + showValues(reg_type, data) { + + let size_elem = document.app.$data.v_length; + var elems = []; + switch (reg_type) { + case "Hex": + for (let i = 0; i < data.length; i+= (size_elem / 4)) { + if (data.startsWith("0x")) { + elems.push("0x" + data.slice((i + 2), (i + 2) + (size_elem / 4))); + } else + elems.push("0x" + data.slice(i, i + (size_elem / 4))); + } + break; + case "Signed": + for (let i = 0; i < data.length; i+= (size_elem / 4)) { + const singBit = 1n << BigInt(size_elem - 1); + const mask = 1n << BigInt(size_elem); + if (data.startsWith("0x")) { + const value = BigInt("0x" + data.slice((i + 2), (i + 2) + (size_elem / 4))); + elems.push((value & singBit) ? value - mask : value); + } else { + const value = BigInt("0x" + data.slice(i, i + (size_elem / 4))); + elems.push((value & singBit) ? value - mask : value); + } + + } + break; + case "Unsigned": + for (let i = 0; i < data.length; i+= (size_elem / 4)) { + // if (size_elem <= 32) { + if (data.startsWith("0x")) { + elems.push(BigInt("0x" + data.slice((i + 2), (i + 2) + (size_elem / 4)))); + } else + elems.push(BigInt("0x" + data.slice(i, i + (size_elem / 4)))); + } + break; + case "Binary": + for (let i = 0; i < data.length; i+= (size_elem / 4)) { + if (data.startsWith("0x")) { + elems.push(data.slice((i + 2), (i + 2) + (size_elem / 4)).split('').map(h => parseInt(h, 16).toString(2).padStart(4, '0')).join('')); + } else { + elems.push(data.slice(i, i + (size_elem / 4)).split('').map(h => parseInt(h, 16).toString(2).padStart(4, '0')).join('')); + } + } + break; + case "Char": + if (data.startsWith("0x")) + data = data.slice(2, data.length); + for (let i = 0; i < data.length; i+= (size_elem / 4)) { + var elem = data.slice((i + 2), (i + 2) + (size_elem / 4)); + elems.push(String.fromCharCode(parseInt(elem.slice(-2), 16))); + } + + break; + case "IEEE 754 32": + if (data.startsWith("0x")) + data = data.slice(2); + for (let i = 0; i < data.length; i+= (size_elem / 4)) { + var elem = data.slice(i, i + (size_elem / 4)); + elems.push(hex2float(elem)); + } + break; + case "IEEE 754 64": + if (data.startsWith("0x")) + data = data.slice(2, data.length); + for (let i = 0; i < data.length; i+= (size_elem / 4)) { + var elem = data.slice(i, i + (size_elem / 4)); + elems.push(hex2double(elem)); + } + break; + } + return elems; + } }, }); @@ -123,49 +197,89 @@ export default defineComponent({ responsive no-footer centered + :class="modalSize" :title="`Space view for ${item?.name.join(' | ')}`" > - Hexadecimal - + Hexadecimal
(v[{{ vectorMaxLength }}] - v[0])
+ Hexadecimal + + {{ value }} + + {{ item.hex }}
- Binary - + Binary
(v[{{ vectorMaxLength }}] - v[0])
+ Binary + + + {{ value }} + + {{ item.bin }}
- Signed - + Signed
(v[{{ vectorMaxLength }}] - v[0])
+ Signed + + + + {{ value }} + + {{ item.signed }}
- Unsigned - + Unsigned
(v[{{ vectorMaxLength }}] - v[0])
+ Unsigned + + + + {{ value }} + + {{ item.unsigned }}
- Char - + + Char
(v[{{ vectorMaxLength }}] - v[0])
+ Char + + + {{ value }} + + {{ item.char }}
- IEEE 754 (32 bits) - + + IEEE 754 (32 bits)
(v[{{ vectorMaxLength }}] - v[0])
+ IEEE 754 (32 bits) + + + {{ value }} + + {{ item.ieee32 }}
- IEEE 754 (64 bits) - + + IEEE 754 (64 bits)
(v[{{ vectorMaxLength }}] - v[0])
+ IEEE 754 (64 bits) + + + {{ value }} + + {{ item.ieee64 }}
diff --git a/src/web/components/simulator/SimulatorControls.vue b/src/web/components/simulator/SimulatorControls.vue index 6b254e8a1..d017a9665 100644 --- a/src/web/components/simulator/SimulatorControls.vue +++ b/src/web/components/simulator/SimulatorControls.vue @@ -24,14 +24,17 @@ import { onBeforeUnmount, watch, type PropType, + onUnmounted, } from "vue"; import { + architecture, set_execution_mode, status, guiVariables, instructions_packed, reset as coreReset, getPC, + setPC, } from "@/core/core.mjs"; import { instructions as coreInstructions, @@ -42,7 +45,8 @@ import { creator_ga } from "@/core/utils/creator_ga.mjs"; import { packExecute } from "@/core/utils/utils.mjs"; import { show_notification } from "@/web/utils.mjs"; import type { Instruction } from "@/core/assembler/assembler"; -import { coreEvents, CoreEventTypes } from "@/core/events.mjs"; +import { coreEvents, CoreEventTypes } from "@/core/events.mts"; +import { sailexec, SailExecute } from "@/core/executor/sailSimRV/sailExecutor.mjs"; const props = defineProps({ instructions: { @@ -78,6 +82,7 @@ const run_disable = ref(false); const stop_disable = ref(true); const isFinished = ref(false); + const hasError = ref(false); const errorMessage = ref(""); @@ -110,6 +115,7 @@ const accesskey_prefix = computed(() => { onMounted(() => { // Enable execution buttons only if there are instructions to execute const prepared_for_execution = props.instructions.length > 0; + coreEvents.on("pause-execution", pauseExec); if (status.run_program !== 3) { run_disable.value = !prepared_for_execution; @@ -138,6 +144,10 @@ onBeforeUnmount(() => { ); }); +onUnmounted(() => { + coreEvents.off("pause-execution", pauseExec); +}); + // Handler for button state updates from core function handleButtonStateUpdate(event: any) { if (event.reset_disable !== undefined) { @@ -178,6 +188,13 @@ watch( ); // Methods +function pauseExec() { + reset_disable.value = false; + instruction_disable.value = false; + run_disable.value = false; + stop_disable.value = true; +} + function execution_UI_update(ret: ExecutionResult | undefined) { if (ret === undefined) { return; @@ -224,6 +241,12 @@ function execution_UI_reset() { danger: [], flash: [], }; + if (architecture.config.name.includes("SRV")){ + let ind = props.instructions.findIndex(insn => insn.Address == document.app.$data.entry_elf); + setPC(BigInt(parseInt(instruction_values.value[ind]!.Address))); + draw.success.push(ind); + document.app.$data.execution_mode_run = -1; + } for (let i = 0; i < props.instructions.length; i++) { draw.space.push(i); @@ -266,70 +289,87 @@ function reset() { coreReset(); execution_UI_reset(); + + coreEvents.emit('arduino-reset'); } function execute_instruction() { creator_ga("execute", "execute.instruction", "execute.instruction"); - - set_execution_mode(0); - - let ret; - try { - ret = step() as unknown as ExecutionResult; - } catch (err: any) { - console.error("Execution error:", err); - errorMessage.value = `${err.message || err}`; - - if ( - status.execution_index >= 0 && - status.execution_index < instruction_values.value.length - ) { - instruction_values.value[status.execution_index]!._rowVariant = "danger"; + if (architecture.config.name.includes("SRV")) { + if (status.run_program < 0) { + isFinished.value = true; + show_notification("The program has finished", "warning"); + } else if (document.app.$data.execution_mode_run === -1) { + document.app.$data.execution_mode_run = 1; + status.run_program = 1; + SailExecute(document.app.$data.binary, ["--entry-address", /*"0x80000000"*/ document.app.$data.entry_elf.toString(16), "--disable-compressed", "--cache-pol", "1", "-p", "output.elf"]); + // console.log("Ejecutado"); + } else if (document.app.$data.execution_mode_run !== -1 && document.app.$data.execution_mode_run !== 2){ + document.app.$data.execution_mode_run = 1; + status.run_program = 1; + sailexec._reanudar_ejecucion(parseInt(1,10)); } + } else { + set_execution_mode(0); + + let ret; + try { + ret = step() as unknown as ExecutionResult; + } catch (err: any) { + console.error("Execution error:", err); + errorMessage.value = `${err.message || err.msg || err}`; + + if ( + status.execution_index >= 0 && + status.execution_index < instruction_values.value.length + ) { + instruction_values.value[status.execution_index]!._rowVariant = "danger"; + } - status.execution_index = -1; - status.error = true; - hasError.value = true; + status.execution_index = -1; + status.error = true; + hasError.value = true; - execution_UI_update({ error: true, msg: err.message || err }); - return; - } + execution_UI_update({ error: true, msg: err.message || err }); + return; + } - if (status.run_program === 3) { - instruction_disable.value = true; - run_disable.value = true; - } + if (status.run_program === 3) { + instruction_disable.value = true; + run_disable.value = true; + } - // Disable buttons if program has finished (execution_index === -2) - if (status.execution_index === -2) { - instruction_disable.value = true; - run_disable.value = true; - isFinished.value = true; - } + // Disable buttons if program has finished (execution_index === -2) + if (status.execution_index === -2) { + instruction_disable.value = true; + run_disable.value = true; + isFinished.value = true; + } - if (status.execution_index === -1) { - instruction_disable.value = true; - run_disable.value = true; - hasError.value = true; - if (!errorMessage.value) { - errorMessage.value = "The program has finished with errors"; + if (status.execution_index === -1) { + instruction_disable.value = true; + run_disable.value = true; + hasError.value = true; + if (!errorMessage.value) { + errorMessage.value = "The program has finished with errors"; + } } - } - if (typeof ret === "undefined") { - console.log("Something weird happened :-S"); - } + if (typeof ret === "undefined") { + console.log("Something weird happened :-S"); + } - if (ret.msg) { - if (status.execution_index === -1) { - errorMessage.value = ret.msg; - } else { - show_notification(ret.msg, ret.type!); + if (ret.msg) { + if (status.execution_index === -1) { + errorMessage.value = ret.msg; + } else { + show_notification(ret.msg, ret.type!); + } } - } - if (ret.draw !== null) { - execution_UI_update(ret); + if (ret.draw !== null) { + execution_UI_update(ret); + } } } @@ -366,114 +406,129 @@ function execute_program() { } function execute_program_packed() { - let ret = undefined; - - for (let i = 0; i < instructions_packed && status.execution_index >= 0; i++) { - if ( - status.run_program === 0 || - status.run_program === 3 || - (coreInstructions[status.execution_index]?.Break === true && - status.run_program !== 2) - ) { - execution_UI_update(ret); - - reset_disable.value = false; - instruction_disable.value = false; - run_disable.value = false; - stop_disable.value = true; - - if (coreInstructions[status.execution_index]?.Break === true) { - status.run_program = 2; - } - return; - } else { - if (status.run_program === 2) { - status.run_program = 1; - } - - try { - ret = step() as unknown as ExecutionResult; - } catch (err: any) { - console.error("Execution error:", err); - errorMessage.value = `${err.message || err}`; - - if ( - status.execution_index >= 0 && - status.execution_index < instruction_values.value.length - ) { - instruction_values.value[status.execution_index]!._rowVariant = - "danger"; - } - - status.run_program = 0; - status.execution_index = -1; - status.error = true; - hasError.value = true; - - execution_UI_update({ error: true, msg: err.message || err }); + if ( architecture.config.name.includes("SRV")) { + if (status.run_program < 0) { + isFinished.value = true; + show_notification("The program has finished", "warning"); + } else if (document.app.$data.execution_mode_run === -1){ + status.run_program = 1; + document.app.$data.execution_mode_run = 0; + SailExecute(document.app.$data.binary, ["--entry-address", /*"0x80000000"*/ document.app.$data.entry_elf.toString(16), "--disable-compressed", "--cache-pol", "1", "-p", "output.elf"]); + } else if (document.app.$data.execution_mode_run !== -1 && document.app.$data.execution_mode_run !== 2){ + document.app.$data.execution_mode_run = 0; + sailexec._reanudar_ejecucion(parseInt(0,10)); + } + } else { + + let ret = undefined; + + for (let i = 0; i < instructions_packed && status.execution_index >= 0; i++) { + if ( + status.run_program === 0 || + status.run_program === 3 || + (coreInstructions[status.execution_index]?.Break === true && + status.run_program !== 2) + ) { + execution_UI_update(ret); reset_disable.value = false; - instruction_disable.value = true; - run_disable.value = true; + instruction_disable.value = false; + run_disable.value = false; stop_disable.value = true; + if (coreInstructions[status.execution_index]?.Break === true) { + status.run_program = 2; + } return; - } + } else { + if (status.run_program === 2) { + status.run_program = 1; + } - if (typeof ret === "undefined") { - console.log("Something weird happened :-S"); - status.run_program = 0; + try { + ret = step() as unknown as ExecutionResult; + } catch (err: any) { + console.error("Execution error:", err); + errorMessage.value = `${err.message || err}`; + + if ( + status.execution_index >= 0 && + status.execution_index < instruction_values.value.length + ) { + instruction_values.value[status.execution_index]!._rowVariant = + "danger"; + } + + status.run_program = 0; + status.execution_index = -1; + status.error = true; + hasError.value = true; - execution_UI_update(ret); + execution_UI_update({ error: true, msg: err.message || err }); - reset_disable.value = false; - instruction_disable.value = true; - run_disable.value = true; - stop_disable.value = true; + reset_disable.value = false; + instruction_disable.value = true; + run_disable.value = true; + stop_disable.value = true; - return; - } - - if (ret.msg) { - if (status.execution_index === -1) { - errorMessage.value = ret.msg; - } else { - show_notification(ret.msg, ret.type!); + return; } - execution_UI_update(ret); + if (typeof ret === "undefined") { + console.log("Something weird happened :-S"); + status.run_program = 0; - reset_disable.value = false; - instruction_disable.value = true; - run_disable.value = true; - stop_disable.value = true; + execution_UI_update(ret); - if (status.execution_index === -2) { - isFinished.value = true; - } else if (status.execution_index === -1) { - hasError.value = true; + reset_disable.value = false; + instruction_disable.value = true; + run_disable.value = true; + stop_disable.value = true; + + return; + } + + if (ret.msg) { + if (status.execution_index === -1) { + errorMessage.value = ret.msg; + } else { + show_notification(ret.msg, ret.type!); + } + + execution_UI_update(ret); + + reset_disable.value = false; + instruction_disable.value = true; + run_disable.value = true; + stop_disable.value = true; + + if (status.execution_index === -2) { + isFinished.value = true; + } else if (status.execution_index === -1) { + hasError.value = true; + } } } } - } - if (status.execution_index >= 0) { - setTimeout(execute_program_packed, 15, ret); - } else { - execution_UI_update(ret); - reset_disable.value = false; - instruction_disable.value = true; - run_disable.value = true; - stop_disable.value = true; + if (status.execution_index >= 0) { + setTimeout(execute_program_packed, 15, ret); + } else { + execution_UI_update(ret); + reset_disable.value = false; + instruction_disable.value = true; + run_disable.value = true; + stop_disable.value = true; - if (status.execution_index === -2) { - isFinished.value = true; - } else if (status.execution_index === -1) { - hasError.value = true; - errorMessage.value = - ret?.msg || - errorMessage.value || - "The program has finished with errors"; + if (status.execution_index === -2) { + isFinished.value = true; + } else if (status.execution_index === -1) { + hasError.value = true; + errorMessage.value = + ret?.msg || + errorMessage.value || + "The program has finished with errors"; + } } } } @@ -742,4 +797,4 @@ defineExpose({ .execution-error-popover { z-index: 2000 !important; } - + \ No newline at end of file diff --git a/src/web/components/simulator/TableExecution.vue b/src/web/components/simulator/TableExecution.vue index cd7d37861..771ea9394 100644 --- a/src/web/components/simulator/TableExecution.vue +++ b/src/web/components/simulator/TableExecution.vue @@ -17,7 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with CREATOR. If not, see . --> + + + + + diff --git a/src/web/components/simulator/Terminal.vue b/src/web/components/simulator/Terminal.vue index 23b73cfb0..6f47ecf51 100644 --- a/src/web/components/simulator/Terminal.vue +++ b/src/web/components/simulator/Terminal.vue @@ -92,6 +92,9 @@ export default { fontWeightBold: "700", letterSpacing: 0, lineHeight: 1.2, + // Interprets \n as \r\n (move to the beginning of the next line) + // instead of just moving the cursor down + convertEol: true, theme: { background: "#0d1117", foreground: "#c9d1d9", @@ -150,16 +153,17 @@ export default { // Handle special keys if (data === "\r") { // Enter key - this.terminal.write("\r\n"); + this.terminal.write("\n"); + this.inputBuffer += "\n"; this.submitInput(); return; } if (data === "\u007F") { - // Backspace + // Delete if (this.inputBuffer.length > 0) { this.inputBuffer = this.inputBuffer.slice(0, -1); - this.terminal.write("\b \b"); + this.terminal.write("\b"); } return; } diff --git a/src/web/composables/useAssembly.ts b/src/web/composables/useAssembly.ts index 5ae019790..0daf6ef6c 100644 --- a/src/web/composables/useAssembly.ts +++ b/src/web/composables/useAssembly.ts @@ -23,7 +23,7 @@ import { resetStats } from "@/core/executor/stats.mts"; import { instructions } from "@/core/assembler/assembler.mjs"; import { show_notification, storeBackup } from "@/web/utils.mjs"; import { assemblerMap, getDefaultCompiler } from "@/web/assemblers"; -import { coreEvents, CoreEventTypes } from "@/core/events.mjs"; +import { coreEvents, CoreEventTypes } from "@/core/events.mts"; export interface AssemblyResult { type: "success" | "error" | "warning"; diff --git a/src/web/main.ts b/src/web/main.ts index 4944b1049..57b684f51 100644 --- a/src/web/main.ts +++ b/src/web/main.ts @@ -45,7 +45,7 @@ window.onbeforeunload = function (e) { const app = createApp(App) .component("font-awesome-icon", FontAwesomeIcon) .use(createBootstrap()); - +app.component('fa-icon', FontAwesomeIcon) //Error handler app.config.errorHandler = function (err, _vm, _info) { // Log the error for debugging diff --git a/src/web/monaco/validation.ts b/src/web/monaco/validation.ts index f0ade06ae..dc3fb3463 100644 --- a/src/web/monaco/validation.ts +++ b/src/web/monaco/validation.ts @@ -122,6 +122,9 @@ export async function validateAssemblyCode( const compilerFunction = getCompilerFunction(architecture); try { + + if (architecture.config?.name?.includes("SRV")) + return; // Compile the code to check for errors const result = await compilerFunction(code, false); diff --git a/src/web/utils.mjs b/src/web/utils.mjs index 6fe9a1c5b..824d7e5ba 100644 --- a/src/web/utils.mjs +++ b/src/web/utils.mjs @@ -20,10 +20,13 @@ import humanizeDuration from "humanize-duration"; import { creator_ga } from "@/core/utils/creator_ga.mjs"; -import { architecture, loadArchitecture } from "@/core/core.mjs"; +import { architecture, loadArchitecture, loadedLibrary } from "@/core/core.mjs"; import { initCAPI } from "@/core/capi/initCAPI.mts"; import { console_log as clog } from "@/core/utils/creator_logger.mjs"; import example_set from "../../examples/example_set.json" with { type: "json" }; +import { assembly_files } from "./components/assembly/MultifileEditor.mjs"; +import { show_notification } from "@/core/utils/notifications.mts"; + // Re-export from core for backward compatibility export { @@ -244,7 +247,13 @@ export function storeBackup(root = document.app) { // disabled in config return; } - + if (architecture.config.name.includes("SRV")){ + // We must to store as a JSON the list of files and the list of libraries + localStorage.setItem("backup_files", JSON.stringify(assembly_files)); + if (Object.keys(loadedLibrary).length !== 0) + loadedLibrary.library_file = Array.from(loadedLibrary.library_file); + localStorage.setItem("backup_libs", JSON.stringify(loadedLibrary)); + } localStorage.setItem("backup_asm", root.assembly_code); localStorage.setItem("backup_arch", root.arch_code); localStorage.setItem("backup_arch_name", root.architecture_name); diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_009.out b/tests/arch/mips/error/executor/test_mips_error_executor_009.out index 4250e5e73..8be2fd58a 100644 --- a/tests/arch/mips/error/executor/test_mips_error_executor_009.out +++ b/tests/arch/mips/error/executor/test_mips_error_executor_009.out @@ -1,6 +1,6 @@ Error found. - The register 0 | zero cannot be written + The register 0 | zero is not writeable cr[PC]:0x4; keyboard[0x0]:''; display[0x0]:''; diff --git a/tsconfig.json b/tsconfig.json index b1c1495bd..fcc34c1d2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,6 +9,7 @@ } ], "compilerOptions": { + "types": ["vite/client", "vitest/globals"], "target": "es2024", "lib": ["dom", "es2024"], "strict": true,