esbuild-wasm-strapkit 0.18.8-build.3 → 0.18.9-build.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esbuild.wasm CHANGED
Binary file
package/esm/browser.js CHANGED
@@ -714,8 +714,8 @@ function createChannel(streamIn) {
714
714
  if (isFirstPacket) {
715
715
  isFirstPacket = false;
716
716
  let binaryVersion = String.fromCharCode(...bytes);
717
- if (binaryVersion !== "0.18.8") {
718
- throw new Error(`Cannot start service: Host version "${"0.18.8"}" does not match binary version ${quote(binaryVersion)}`);
717
+ if (binaryVersion !== "0.18.9") {
718
+ throw new Error(`Cannot start service: Host version "${"0.18.9"}" does not match binary version ${quote(binaryVersion)}`);
719
719
  }
720
720
  return;
721
721
  }
@@ -1709,7 +1709,7 @@ function convertOutputFiles({ path, contents }) {
1709
1709
  }
1710
1710
 
1711
1711
  // lib/npm/browser.ts
1712
- var version = "0.18.8";
1712
+ var version = "0.18.9";
1713
1713
  var build = (options) => ensureServiceIsRunning().build(options);
1714
1714
  var context = (options) => ensureServiceIsRunning().context(options);
1715
1715
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -1754,7 +1754,7 @@ var initialize = (options) => {
1754
1754
  var startRunningService = async (wasmURL, wasmModule, useWorker) => {
1755
1755
  let worker;
1756
1756
  if (useWorker) {
1757
- let blob = new Blob([`onmessage=${'((postMessage) => {\n // Copyright 2018 The Go Authors. All rights reserved.\n // Use of this source code is governed by a BSD-style\n // license that can be found in the LICENSE file.\n let onmessage;\n let globalThis = {};\n for (let o = self; o; o = Object.getPrototypeOf(o))\n for (let k of Object.getOwnPropertyNames(o))\n if (!(k in globalThis))\n Object.defineProperty(globalThis, k, { get: () => self[k] });\n "use strict";\n (() => {\n const enosys = () => {\n const err = new Error("not implemented");\n err.code = "ENOSYS";\n return err;\n };\n if (!globalThis.fs) {\n let outputBuf = "";\n globalThis.fs = {\n constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 },\n // unused\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substring(0, nl));\n outputBuf = outputBuf.substring(nl + 1);\n }\n return buf.length;\n },\n write(fd, buf, offset, length, position, callback) {\n if (offset !== 0 || length !== buf.length || position !== null) {\n callback(enosys());\n return;\n }\n const n = this.writeSync(fd, buf);\n callback(null, n);\n },\n chmod(path, mode, callback) {\n callback(enosys());\n },\n chown(path, uid, gid, callback) {\n callback(enosys());\n },\n close(fd, callback) {\n callback(enosys());\n },\n fchmod(fd, mode, callback) {\n callback(enosys());\n },\n fchown(fd, uid, gid, callback) {\n callback(enosys());\n },\n fstat(fd, callback) {\n callback(enosys());\n },\n fsync(fd, callback) {\n callback(null);\n },\n ftruncate(fd, length, callback) {\n callback(enosys());\n },\n lchown(path, uid, gid, callback) {\n callback(enosys());\n },\n link(path, link, callback) {\n callback(enosys());\n },\n lstat(path, callback) {\n callback(enosys());\n },\n mkdir(path, perm, callback) {\n callback(enosys());\n },\n open(path, flags, mode, callback) {\n callback(enosys());\n },\n read(fd, buffer, offset, length, position, callback) {\n callback(enosys());\n },\n readdir(path, callback) {\n callback(enosys());\n },\n readlink(path, callback) {\n callback(enosys());\n },\n rename(from, to, callback) {\n callback(enosys());\n },\n rmdir(path, callback) {\n callback(enosys());\n },\n stat(path, callback) {\n callback(enosys());\n },\n symlink(path, link, callback) {\n callback(enosys());\n },\n truncate(path, length, callback) {\n callback(enosys());\n },\n unlink(path, callback) {\n callback(enosys());\n },\n utimes(path, atime, mtime, callback) {\n callback(enosys());\n }\n };\n }\n if (!globalThis.process) {\n globalThis.process = {\n getuid() {\n return -1;\n },\n getgid() {\n return -1;\n },\n geteuid() {\n return -1;\n },\n getegid() {\n return -1;\n },\n getgroups() {\n throw enosys();\n },\n pid: -1,\n ppid: -1,\n umask() {\n throw enosys();\n },\n cwd() {\n throw enosys();\n },\n chdir() {\n throw enosys();\n }\n };\n }\n if (!globalThis.crypto) {\n throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");\n }\n if (!globalThis.performance) {\n throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");\n }\n if (!globalThis.TextEncoder) {\n throw new Error("globalThis.TextEncoder is not available, polyfill required");\n }\n if (!globalThis.TextDecoder) {\n throw new Error("globalThis.TextDecoder is not available, polyfill required");\n }\n const encoder = new TextEncoder("utf-8");\n const decoder = new TextDecoder("utf-8");\n globalThis.Go = class {\n constructor() {\n this.argv = ["js"];\n this.env = {};\n this.exit = (code) => {\n if (code !== 0) {\n console.warn("exit code:", code);\n }\n };\n this._exitPromise = new Promise((resolve) => {\n this._resolveExitPromise = resolve;\n });\n this._pendingEvent = null;\n this._scheduledTimeouts = /* @__PURE__ */ new Map();\n this._nextCallbackTimeoutID = 1;\n const setInt64 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);\n };\n const setInt32 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n };\n const getInt64 = (addr) => {\n const low = this.mem.getUint32(addr + 0, true);\n const high = this.mem.getInt32(addr + 4, true);\n return low + high * 4294967296;\n };\n const loadValue = (addr) => {\n const f = this.mem.getFloat64(addr, true);\n if (f === 0) {\n return void 0;\n }\n if (!isNaN(f)) {\n return f;\n }\n const id = this.mem.getUint32(addr, true);\n return this._values[id];\n };\n const storeValue = (addr, v) => {\n const nanHead = 2146959360;\n if (typeof v === "number" && v !== 0) {\n if (isNaN(v)) {\n this.mem.setUint32(addr + 4, nanHead, true);\n this.mem.setUint32(addr, 0, true);\n return;\n }\n this.mem.setFloat64(addr, v, true);\n return;\n }\n if (v === void 0) {\n this.mem.setFloat64(addr, 0, true);\n return;\n }\n let id = this._ids.get(v);\n if (id === void 0) {\n id = this._idPool.pop();\n if (id === void 0) {\n id = this._values.length;\n }\n this._values[id] = v;\n this._goRefCounts[id] = 0;\n this._ids.set(v, id);\n }\n this._goRefCounts[id]++;\n let typeFlag = 0;\n switch (typeof v) {\n case "object":\n if (v !== null) {\n typeFlag = 1;\n }\n break;\n case "string":\n typeFlag = 2;\n break;\n case "symbol":\n typeFlag = 3;\n break;\n case "function":\n typeFlag = 4;\n break;\n }\n this.mem.setUint32(addr + 4, nanHead | typeFlag, true);\n this.mem.setUint32(addr, id, true);\n };\n const loadSlice = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return new Uint8Array(this._inst.exports.mem.buffer, array, len);\n };\n const loadSliceOfValues = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n const a = new Array(len);\n for (let i = 0; i < len; i++) {\n a[i] = loadValue(array + i * 8);\n }\n return a;\n };\n const loadString = (addr) => {\n const saddr = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));\n };\n const timeOrigin = Date.now() - performance.now();\n this.importObject = {\n _gotest: {\n add: (a, b) => a + b\n },\n gojs: {\n // Go\'s SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)\n // may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported\n // function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).\n // This changes the SP, thus we have to update the SP used by the imported function.\n // func wasmExit(code int32)\n "runtime.wasmExit": (sp) => {\n sp = Number(sp);\n const code = this.mem.getInt32(sp + 8, true);\n this.exited = true;\n delete this._inst;\n delete this._values;\n delete this._goRefCounts;\n delete this._ids;\n delete this._idPool;\n this.exit(code);\n },\n // func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)\n "runtime.wasmWrite": (sp) => {\n sp = Number(sp);\n const fd = getInt64(sp + 8);\n const p = getInt64(sp + 16);\n const n = this.mem.getInt32(sp + 24, true);\n globalThis.fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));\n },\n // func resetMemoryDataView()\n "runtime.resetMemoryDataView": (sp) => {\n sp = Number(sp);\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n // func nanotime1() int64\n "runtime.nanotime1": (sp) => {\n sp = Number(sp);\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n // func walltime() (sec int64, nsec int32)\n "runtime.walltime": (sp) => {\n sp = Number(sp);\n const msec = (/* @__PURE__ */ new Date()).getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n // func scheduleTimeoutEvent(delay int64) int32\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(\n () => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n },\n getInt64(sp + 8)\n ));\n this.mem.setInt32(sp + 16, id, true);\n },\n // func clearTimeoutEvent(id int32)\n "runtime.clearTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n // func getRandomData(r []byte)\n "runtime.getRandomData": (sp) => {\n sp = Number(sp);\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n // func finalizeRef(v ref)\n "syscall/js.finalizeRef": (sp) => {\n sp = Number(sp);\n const id = this.mem.getUint32(sp + 8, true);\n this._goRefCounts[id]--;\n if (this._goRefCounts[id] === 0) {\n const v = this._values[id];\n this._values[id] = null;\n this._ids.delete(v);\n this._idPool.push(id);\n }\n },\n // func stringVal(value string) ref\n "syscall/js.stringVal": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, loadString(sp + 8));\n },\n // func valueGet(v ref, p string) ref\n "syscall/js.valueGet": (sp) => {\n sp = Number(sp);\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 32, result);\n },\n // func valueSet(v ref, p string, x ref)\n "syscall/js.valueSet": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n // func valueDelete(v ref, p string)\n "syscall/js.valueDelete": (sp) => {\n sp = Number(sp);\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n // func valueIndex(v ref, i int) ref\n "syscall/js.valueIndex": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n // valueSetIndex(v ref, i int, x ref)\n "syscall/js.valueSetIndex": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n // func valueCall(v ref, m string, args []ref) (ref, bool)\n "syscall/js.valueCall": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const m = Reflect.get(v, loadString(sp + 16));\n const args = loadSliceOfValues(sp + 32);\n const result = Reflect.apply(m, v, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n // func valueInvoke(v ref, args []ref) (ref, bool)\n "syscall/js.valueInvoke": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.apply(v, void 0, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueNew(v ref, args []ref) (ref, bool)\n "syscall/js.valueNew": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueLength(v ref) int\n "syscall/js.valueLength": (sp) => {\n sp = Number(sp);\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n // valuePrepareString(v ref) (ref, int)\n "syscall/js.valuePrepareString": (sp) => {\n sp = Number(sp);\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n // valueLoadString(v ref, b []byte)\n "syscall/js.valueLoadString": (sp) => {\n sp = Number(sp);\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n // func valueInstanceOf(v ref, t ref) bool\n "syscall/js.valueInstanceOf": (sp) => {\n sp = Number(sp);\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n // func copyBytesToGo(dst []byte, src ref) (int, bool)\n "syscall/js.copyBytesToGo": (sp) => {\n sp = Number(sp);\n const dst = loadSlice(sp + 8);\n const src = loadValue(sp + 32);\n if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n // func copyBytesToJS(dst ref, src []byte) (int, bool)\n "syscall/js.copyBytesToJS": (sp) => {\n sp = Number(sp);\n const dst = loadValue(sp + 8);\n const src = loadSlice(sp + 16);\n if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "debug": (value) => {\n console.log(value);\n }\n }\n };\n }\n async run(instance) {\n if (!(instance instanceof WebAssembly.Instance)) {\n throw new Error("Go.run: WebAssembly.Instance expected");\n }\n this._inst = instance;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n this._values = [\n // JS values that Go currently has references to, indexed by reference id\n NaN,\n 0,\n null,\n true,\n false,\n globalThis,\n this\n ];\n this._goRefCounts = new Array(this._values.length).fill(Infinity);\n this._ids = /* @__PURE__ */ new Map([\n // mapping from JS values to reference ids\n [0, 1],\n [null, 2],\n [true, 3],\n [false, 4],\n [globalThis, 5],\n [this, 6]\n ]);\n this._idPool = [];\n this.exited = false;\n let offset = 4096;\n const strPtr = (str) => {\n const ptr = offset;\n const bytes = encoder.encode(str + "\\0");\n new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);\n offset += bytes.length;\n if (offset % 8 !== 0) {\n offset += 8 - offset % 8;\n }\n return ptr;\n };\n const argc = this.argv.length;\n const argvPtrs = [];\n this.argv.forEach((arg) => {\n argvPtrs.push(strPtr(arg));\n });\n argvPtrs.push(0);\n const keys = Object.keys(this.env).sort();\n keys.forEach((key) => {\n argvPtrs.push(strPtr(`${key}=${this.env[key]}`));\n });\n argvPtrs.push(0);\n const argv = offset;\n argvPtrs.forEach((ptr) => {\n this.mem.setUint32(offset, ptr, true);\n this.mem.setUint32(offset + 4, 0, true);\n offset += 8;\n });\n const wasmMinDataAddr = 4096 + 8192;\n if (offset >= wasmMinDataAddr) {\n throw new Error("total length of command line and environment variables exceeds limit");\n }\n this._inst.exports.run(argc, argv);\n if (this.exited) {\n this._resolveExitPromise();\n }\n await this._exitPromise;\n }\n _resume() {\n if (this.exited) {\n throw new Error("Go program has already exited");\n }\n this._inst.exports.resume();\n if (this.exited) {\n this._resolveExitPromise();\n }\n }\n _makeFuncWrapper(id) {\n const go = this;\n return function() {\n const event = { id, this: this, args: arguments };\n go._pendingEvent = event;\n go._resume();\n return event.result;\n };\n }\n };\n })();\n onmessage = ({ data: wasm }) => {\n let decoder = new TextDecoder();\n let fs = globalThis.fs;\n let stderr = "";\n fs.writeSync = (fd, buffer) => {\n if (fd === 1) {\n postMessage(buffer);\n } else if (fd === 2) {\n stderr += decoder.decode(buffer);\n let parts = stderr.split("\\n");\n if (parts.length > 1)\n console.log(parts.slice(0, -1).join("\\n"));\n stderr = parts[parts.length - 1];\n } else {\n throw new Error("Bad write");\n }\n return buffer.length;\n };\n let stdin = [];\n let resumeStdin;\n let stdinPos = 0;\n onmessage = ({ data }) => {\n if (data.length > 0) {\n stdin.push(data);\n if (resumeStdin)\n resumeStdin();\n }\n };\n fs.read = (fd, buffer, offset, length, position, callback) => {\n if (fd !== 0 || offset !== 0 || length !== buffer.length || position !== null) {\n throw new Error("Bad read");\n }\n if (stdin.length === 0) {\n resumeStdin = () => fs.read(fd, buffer, offset, length, position, callback);\n return;\n }\n let first = stdin[0];\n let count = Math.max(0, Math.min(length, first.length - stdinPos));\n buffer.set(first.subarray(stdinPos, stdinPos + count), offset);\n stdinPos += count;\n if (stdinPos === first.length) {\n stdin.shift();\n stdinPos = 0;\n }\n callback(null, count);\n };\n let go = new globalThis.Go();\n go.argv = ["", `--service=${"0.18.8"}`];\n tryToInstantiateModule(wasm, go).then(\n (instance) => {\n postMessage(null);\n go.run(instance);\n },\n (error) => {\n postMessage(error);\n }\n );\n };\n async function tryToInstantiateModule(wasm, go) {\n if (wasm instanceof WebAssembly.Module) {\n return WebAssembly.instantiate(wasm, go.importObject);\n }\n const res = await fetch(wasm);\n if (!res.ok)\n throw new Error(`Failed to download ${JSON.stringify(wasm)}`);\n if ("instantiateStreaming" in WebAssembly && /^application\\/wasm($|;)/i.test(res.headers.get("Content-Type") || "")) {\n const result2 = await WebAssembly.instantiateStreaming(res, go.importObject);\n return result2.instance;\n }\n const bytes = await res.arrayBuffer();\n const result = await WebAssembly.instantiate(bytes, go.importObject);\n return result.instance;\n }\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
1757
+ let blob = new Blob([`onmessage=${'((postMessage) => {\n // Copyright 2018 The Go Authors. All rights reserved.\n // Use of this source code is governed by a BSD-style\n // license that can be found in the LICENSE file.\n let onmessage;\n let globalThis = {};\n for (let o = self; o; o = Object.getPrototypeOf(o))\n for (let k of Object.getOwnPropertyNames(o))\n if (!(k in globalThis))\n Object.defineProperty(globalThis, k, { get: () => self[k] });\n "use strict";\n (() => {\n const enosys = () => {\n const err = new Error("not implemented");\n err.code = "ENOSYS";\n return err;\n };\n if (!globalThis.fs) {\n let outputBuf = "";\n globalThis.fs = {\n constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 },\n // unused\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substring(0, nl));\n outputBuf = outputBuf.substring(nl + 1);\n }\n return buf.length;\n },\n write(fd, buf, offset, length, position, callback) {\n if (offset !== 0 || length !== buf.length || position !== null) {\n callback(enosys());\n return;\n }\n const n = this.writeSync(fd, buf);\n callback(null, n);\n },\n chmod(path, mode, callback) {\n callback(enosys());\n },\n chown(path, uid, gid, callback) {\n callback(enosys());\n },\n close(fd, callback) {\n callback(enosys());\n },\n fchmod(fd, mode, callback) {\n callback(enosys());\n },\n fchown(fd, uid, gid, callback) {\n callback(enosys());\n },\n fstat(fd, callback) {\n callback(enosys());\n },\n fsync(fd, callback) {\n callback(null);\n },\n ftruncate(fd, length, callback) {\n callback(enosys());\n },\n lchown(path, uid, gid, callback) {\n callback(enosys());\n },\n link(path, link, callback) {\n callback(enosys());\n },\n lstat(path, callback) {\n callback(enosys());\n },\n mkdir(path, perm, callback) {\n callback(enosys());\n },\n open(path, flags, mode, callback) {\n callback(enosys());\n },\n read(fd, buffer, offset, length, position, callback) {\n callback(enosys());\n },\n readdir(path, callback) {\n callback(enosys());\n },\n readlink(path, callback) {\n callback(enosys());\n },\n rename(from, to, callback) {\n callback(enosys());\n },\n rmdir(path, callback) {\n callback(enosys());\n },\n stat(path, callback) {\n callback(enosys());\n },\n symlink(path, link, callback) {\n callback(enosys());\n },\n truncate(path, length, callback) {\n callback(enosys());\n },\n unlink(path, callback) {\n callback(enosys());\n },\n utimes(path, atime, mtime, callback) {\n callback(enosys());\n }\n };\n }\n if (!globalThis.process) {\n globalThis.process = {\n getuid() {\n return -1;\n },\n getgid() {\n return -1;\n },\n geteuid() {\n return -1;\n },\n getegid() {\n return -1;\n },\n getgroups() {\n throw enosys();\n },\n pid: -1,\n ppid: -1,\n umask() {\n throw enosys();\n },\n cwd() {\n throw enosys();\n },\n chdir() {\n throw enosys();\n }\n };\n }\n if (!globalThis.crypto) {\n throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");\n }\n if (!globalThis.performance) {\n throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");\n }\n if (!globalThis.TextEncoder) {\n throw new Error("globalThis.TextEncoder is not available, polyfill required");\n }\n if (!globalThis.TextDecoder) {\n throw new Error("globalThis.TextDecoder is not available, polyfill required");\n }\n const encoder = new TextEncoder("utf-8");\n const decoder = new TextDecoder("utf-8");\n globalThis.Go = class {\n constructor() {\n this.argv = ["js"];\n this.env = {};\n this.exit = (code) => {\n if (code !== 0) {\n console.warn("exit code:", code);\n }\n };\n this._exitPromise = new Promise((resolve) => {\n this._resolveExitPromise = resolve;\n });\n this._pendingEvent = null;\n this._scheduledTimeouts = /* @__PURE__ */ new Map();\n this._nextCallbackTimeoutID = 1;\n const setInt64 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);\n };\n const setInt32 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n };\n const getInt64 = (addr) => {\n const low = this.mem.getUint32(addr + 0, true);\n const high = this.mem.getInt32(addr + 4, true);\n return low + high * 4294967296;\n };\n const loadValue = (addr) => {\n const f = this.mem.getFloat64(addr, true);\n if (f === 0) {\n return void 0;\n }\n if (!isNaN(f)) {\n return f;\n }\n const id = this.mem.getUint32(addr, true);\n return this._values[id];\n };\n const storeValue = (addr, v) => {\n const nanHead = 2146959360;\n if (typeof v === "number" && v !== 0) {\n if (isNaN(v)) {\n this.mem.setUint32(addr + 4, nanHead, true);\n this.mem.setUint32(addr, 0, true);\n return;\n }\n this.mem.setFloat64(addr, v, true);\n return;\n }\n if (v === void 0) {\n this.mem.setFloat64(addr, 0, true);\n return;\n }\n let id = this._ids.get(v);\n if (id === void 0) {\n id = this._idPool.pop();\n if (id === void 0) {\n id = this._values.length;\n }\n this._values[id] = v;\n this._goRefCounts[id] = 0;\n this._ids.set(v, id);\n }\n this._goRefCounts[id]++;\n let typeFlag = 0;\n switch (typeof v) {\n case "object":\n if (v !== null) {\n typeFlag = 1;\n }\n break;\n case "string":\n typeFlag = 2;\n break;\n case "symbol":\n typeFlag = 3;\n break;\n case "function":\n typeFlag = 4;\n break;\n }\n this.mem.setUint32(addr + 4, nanHead | typeFlag, true);\n this.mem.setUint32(addr, id, true);\n };\n const loadSlice = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return new Uint8Array(this._inst.exports.mem.buffer, array, len);\n };\n const loadSliceOfValues = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n const a = new Array(len);\n for (let i = 0; i < len; i++) {\n a[i] = loadValue(array + i * 8);\n }\n return a;\n };\n const loadString = (addr) => {\n const saddr = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));\n };\n const timeOrigin = Date.now() - performance.now();\n this.importObject = {\n _gotest: {\n add: (a, b) => a + b\n },\n gojs: {\n // Go\'s SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)\n // may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported\n // function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).\n // This changes the SP, thus we have to update the SP used by the imported function.\n // func wasmExit(code int32)\n "runtime.wasmExit": (sp) => {\n sp = Number(sp);\n const code = this.mem.getInt32(sp + 8, true);\n this.exited = true;\n delete this._inst;\n delete this._values;\n delete this._goRefCounts;\n delete this._ids;\n delete this._idPool;\n this.exit(code);\n },\n // func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)\n "runtime.wasmWrite": (sp) => {\n sp = Number(sp);\n const fd = getInt64(sp + 8);\n const p = getInt64(sp + 16);\n const n = this.mem.getInt32(sp + 24, true);\n globalThis.fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));\n },\n // func resetMemoryDataView()\n "runtime.resetMemoryDataView": (sp) => {\n sp = Number(sp);\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n // func nanotime1() int64\n "runtime.nanotime1": (sp) => {\n sp = Number(sp);\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n // func walltime() (sec int64, nsec int32)\n "runtime.walltime": (sp) => {\n sp = Number(sp);\n const msec = (/* @__PURE__ */ new Date()).getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n // func scheduleTimeoutEvent(delay int64) int32\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(\n () => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n },\n getInt64(sp + 8)\n ));\n this.mem.setInt32(sp + 16, id, true);\n },\n // func clearTimeoutEvent(id int32)\n "runtime.clearTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n // func getRandomData(r []byte)\n "runtime.getRandomData": (sp) => {\n sp = Number(sp);\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n // func finalizeRef(v ref)\n "syscall/js.finalizeRef": (sp) => {\n sp = Number(sp);\n const id = this.mem.getUint32(sp + 8, true);\n this._goRefCounts[id]--;\n if (this._goRefCounts[id] === 0) {\n const v = this._values[id];\n this._values[id] = null;\n this._ids.delete(v);\n this._idPool.push(id);\n }\n },\n // func stringVal(value string) ref\n "syscall/js.stringVal": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, loadString(sp + 8));\n },\n // func valueGet(v ref, p string) ref\n "syscall/js.valueGet": (sp) => {\n sp = Number(sp);\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 32, result);\n },\n // func valueSet(v ref, p string, x ref)\n "syscall/js.valueSet": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n // func valueDelete(v ref, p string)\n "syscall/js.valueDelete": (sp) => {\n sp = Number(sp);\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n // func valueIndex(v ref, i int) ref\n "syscall/js.valueIndex": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n // valueSetIndex(v ref, i int, x ref)\n "syscall/js.valueSetIndex": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n // func valueCall(v ref, m string, args []ref) (ref, bool)\n "syscall/js.valueCall": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const m = Reflect.get(v, loadString(sp + 16));\n const args = loadSliceOfValues(sp + 32);\n const result = Reflect.apply(m, v, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n // func valueInvoke(v ref, args []ref) (ref, bool)\n "syscall/js.valueInvoke": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.apply(v, void 0, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueNew(v ref, args []ref) (ref, bool)\n "syscall/js.valueNew": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueLength(v ref) int\n "syscall/js.valueLength": (sp) => {\n sp = Number(sp);\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n // valuePrepareString(v ref) (ref, int)\n "syscall/js.valuePrepareString": (sp) => {\n sp = Number(sp);\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n // valueLoadString(v ref, b []byte)\n "syscall/js.valueLoadString": (sp) => {\n sp = Number(sp);\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n // func valueInstanceOf(v ref, t ref) bool\n "syscall/js.valueInstanceOf": (sp) => {\n sp = Number(sp);\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n // func copyBytesToGo(dst []byte, src ref) (int, bool)\n "syscall/js.copyBytesToGo": (sp) => {\n sp = Number(sp);\n const dst = loadSlice(sp + 8);\n const src = loadValue(sp + 32);\n if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n // func copyBytesToJS(dst ref, src []byte) (int, bool)\n "syscall/js.copyBytesToJS": (sp) => {\n sp = Number(sp);\n const dst = loadValue(sp + 8);\n const src = loadSlice(sp + 16);\n if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "debug": (value) => {\n console.log(value);\n }\n }\n };\n }\n async run(instance) {\n if (!(instance instanceof WebAssembly.Instance)) {\n throw new Error("Go.run: WebAssembly.Instance expected");\n }\n this._inst = instance;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n this._values = [\n // JS values that Go currently has references to, indexed by reference id\n NaN,\n 0,\n null,\n true,\n false,\n globalThis,\n this\n ];\n this._goRefCounts = new Array(this._values.length).fill(Infinity);\n this._ids = /* @__PURE__ */ new Map([\n // mapping from JS values to reference ids\n [0, 1],\n [null, 2],\n [true, 3],\n [false, 4],\n [globalThis, 5],\n [this, 6]\n ]);\n this._idPool = [];\n this.exited = false;\n let offset = 4096;\n const strPtr = (str) => {\n const ptr = offset;\n const bytes = encoder.encode(str + "\\0");\n new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);\n offset += bytes.length;\n if (offset % 8 !== 0) {\n offset += 8 - offset % 8;\n }\n return ptr;\n };\n const argc = this.argv.length;\n const argvPtrs = [];\n this.argv.forEach((arg) => {\n argvPtrs.push(strPtr(arg));\n });\n argvPtrs.push(0);\n const keys = Object.keys(this.env).sort();\n keys.forEach((key) => {\n argvPtrs.push(strPtr(`${key}=${this.env[key]}`));\n });\n argvPtrs.push(0);\n const argv = offset;\n argvPtrs.forEach((ptr) => {\n this.mem.setUint32(offset, ptr, true);\n this.mem.setUint32(offset + 4, 0, true);\n offset += 8;\n });\n const wasmMinDataAddr = 4096 + 8192;\n if (offset >= wasmMinDataAddr) {\n throw new Error("total length of command line and environment variables exceeds limit");\n }\n this._inst.exports.run(argc, argv);\n if (this.exited) {\n this._resolveExitPromise();\n }\n await this._exitPromise;\n }\n _resume() {\n if (this.exited) {\n throw new Error("Go program has already exited");\n }\n this._inst.exports.resume();\n if (this.exited) {\n this._resolveExitPromise();\n }\n }\n _makeFuncWrapper(id) {\n const go = this;\n return function() {\n const event = { id, this: this, args: arguments };\n go._pendingEvent = event;\n go._resume();\n return event.result;\n };\n }\n };\n })();\n onmessage = ({ data: wasm }) => {\n let decoder = new TextDecoder();\n let fs = globalThis.fs;\n let stderr = "";\n fs.writeSync = (fd, buffer) => {\n if (fd === 1) {\n postMessage(buffer);\n } else if (fd === 2) {\n stderr += decoder.decode(buffer);\n let parts = stderr.split("\\n");\n if (parts.length > 1)\n console.log(parts.slice(0, -1).join("\\n"));\n stderr = parts[parts.length - 1];\n } else {\n throw new Error("Bad write");\n }\n return buffer.length;\n };\n let stdin = [];\n let resumeStdin;\n let stdinPos = 0;\n onmessage = ({ data }) => {\n if (data.length > 0) {\n stdin.push(data);\n if (resumeStdin)\n resumeStdin();\n }\n };\n fs.read = (fd, buffer, offset, length, position, callback) => {\n if (fd !== 0 || offset !== 0 || length !== buffer.length || position !== null) {\n throw new Error("Bad read");\n }\n if (stdin.length === 0) {\n resumeStdin = () => fs.read(fd, buffer, offset, length, position, callback);\n return;\n }\n let first = stdin[0];\n let count = Math.max(0, Math.min(length, first.length - stdinPos));\n buffer.set(first.subarray(stdinPos, stdinPos + count), offset);\n stdinPos += count;\n if (stdinPos === first.length) {\n stdin.shift();\n stdinPos = 0;\n }\n callback(null, count);\n };\n let go = new globalThis.Go();\n go.argv = ["", `--service=${"0.18.9"}`];\n tryToInstantiateModule(wasm, go).then(\n (instance) => {\n postMessage(null);\n go.run(instance);\n },\n (error) => {\n postMessage(error);\n }\n );\n };\n async function tryToInstantiateModule(wasm, go) {\n if (wasm instanceof WebAssembly.Module) {\n return WebAssembly.instantiate(wasm, go.importObject);\n }\n const res = await fetch(wasm);\n if (!res.ok)\n throw new Error(`Failed to download ${JSON.stringify(wasm)}`);\n if ("instantiateStreaming" in WebAssembly && /^application\\/wasm($|;)/i.test(res.headers.get("Content-Type") || "")) {\n const result2 = await WebAssembly.instantiateStreaming(res, go.importObject);\n return result2.instance;\n }\n const bytes = await res.arrayBuffer();\n const result = await WebAssembly.instantiate(bytes, go.importObject);\n return result.instance;\n }\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
1758
1758
  worker = new Worker(URL.createObjectURL(blob));
1759
1759
  } else {
1760
1760
  let onmessage = ((postMessage) => {
@@ -2373,7 +2373,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
2373
2373
  callback(null, count);
2374
2374
  };
2375
2375
  let go = new globalThis.Go();
2376
- go.argv = ["", `--service=${"0.18.8"}`];
2376
+ go.argv = ["", `--service=${"0.18.9"}`];
2377
2377
  tryToInstantiateModule(wasm, go).then(
2378
2378
  (instance) => {
2379
2379
  postMessage(null);
@@ -3,18 +3,18 @@ var Ie=Object.defineProperty;var We=(e,t)=>{for(var n in t)Ie(e,n,{get:t[n],enum
3
3
  This indicates that your JavaScript environment is broken. You cannot use
4
4
  esbuild in this environment because esbuild relies on this invariant. This
5
5
  is not a problem with esbuild. You need to fix your environment instead.
6
- `);function Re(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function ve(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var V=JSON.stringify,Se="warning",ke="silent";function $e(e){if(J(e,"target"),e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var me=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",y=e=>typeof e=="string"?null:"a string",ye=e=>e instanceof RegExp?null:"a RegExp object",le=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Ae=e=>typeof e=="function"?null:"a function",z=e=>Array.isArray(e)?null:"an array",ee=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",Ke=e=>typeof e=="object"&&e!==null?null:"an array or an object",_e=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Me=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",De=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",Ve=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Ye=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",Pe=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",Je=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function r(e,t,n,l){let d=e[n];if(t[n+""]=!0,d===void 0)return;let i=l(d);if(i!==null)throw new Error(`${V(n)} must be ${i}`);return d}function K(e,t,n){for(let l in e)if(!(l in t))throw new Error(`Invalid option ${n}: ${V(l)}`)}function Fe(e){let t=Object.create(null),n=r(e,t,"wasmURL",Je),l=r(e,t,"wasmModule",_e),d=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:l,worker:d}}function Te(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let l=e[n];if(typeof l=="string"||l===!1)t[n]=l;else throw new Error(`Expected ${V(n)} in mangle cache to map to either a string or false`)}}return t}function he(e,t,n,l,d){let i=r(t,n,"color",I),f=r(t,n,"logLevel",y),o=r(t,n,"logLimit",le);i!==void 0?e.push(`--color=${i}`):l&&e.push("--color=true"),e.push(`--log-level=${f||d}`),e.push(`--log-limit=${o||0}`)}function J(e,t,n){if(typeof e!="string")throw new Error(`Expected value for ${t}${n!==void 0?" "+V(n):""} to be a string, got ${typeof e} instead`);return e}function Be(e,t,n){let l=r(t,n,"legalComments",y),d=r(t,n,"sourceRoot",y),i=r(t,n,"sourcesContent",I),f=r(t,n,"target",Ye),o=r(t,n,"format",y),m=r(t,n,"globalName",y),w=r(t,n,"mangleProps",ye),x=r(t,n,"reserveProps",ye),F=r(t,n,"mangleQuoted",I),j=r(t,n,"minify",I),B=r(t,n,"minifySyntax",I),q=r(t,n,"minifyWhitespace",I),Q=r(t,n,"minifyIdentifiers",I),T=r(t,n,"lineLimit",le),W=r(t,n,"drop",z),Y=r(t,n,"charset",y),R=r(t,n,"treeShaking",I),g=r(t,n,"ignoreAnnotations",I),c=r(t,n,"jsx",y),s=r(t,n,"jsxFactory",y),O=r(t,n,"jsxFragment",y),k=r(t,n,"jsxImportSource",y),M=r(t,n,"jsxDev",I),E=r(t,n,"jsxSideEffects",I),a=r(t,n,"define",ee),u=r(t,n,"logOverride",ee),b=r(t,n,"supported",ee),$=r(t,n,"pure",z),C=r(t,n,"keepNames",I),S=r(t,n,"platform",y),v=r(t,n,"tsconfigRaw",Ve);if(l&&e.push(`--legal-comments=${l}`),d!==void 0&&e.push(`--source-root=${d}`),i!==void 0&&e.push(`--sources-content=${i}`),f&&(Array.isArray(f)?e.push(`--target=${Array.from(f).map($e).join(",")}`):e.push(`--target=${$e(f)}`)),o&&e.push(`--format=${o}`),m&&e.push(`--global-name=${m}`),S&&e.push(`--platform=${S}`),v&&e.push(`--tsconfig-raw=${typeof v=="string"?v:JSON.stringify(v)}`),j&&e.push("--minify"),B&&e.push("--minify-syntax"),q&&e.push("--minify-whitespace"),Q&&e.push("--minify-identifiers"),T&&e.push(`--line-limit=${T}`),Y&&e.push(`--charset=${Y}`),R!==void 0&&e.push(`--tree-shaking=${R}`),g&&e.push("--ignore-annotations"),W)for(let h of W)e.push(`--drop:${J(h,"drop")}`);if(w&&e.push(`--mangle-props=${w.source}`),x&&e.push(`--reserve-props=${x.source}`),F!==void 0&&e.push(`--mangle-quoted=${F}`),c&&e.push(`--jsx=${c}`),s&&e.push(`--jsx-factory=${s}`),O&&e.push(`--jsx-fragment=${O}`),k&&e.push(`--jsx-import-source=${k}`),M&&e.push("--jsx-dev"),E&&e.push("--jsx-side-effects"),a)for(let h in a){if(h.indexOf("=")>=0)throw new Error(`Invalid define: ${h}`);e.push(`--define:${h}=${J(a[h],"define",h)}`)}if(u)for(let h in u){if(h.indexOf("=")>=0)throw new Error(`Invalid log override: ${h}`);e.push(`--log-override:${h}=${J(u[h],"log override",h)}`)}if(b)for(let h in b){if(h.indexOf("=")>=0)throw new Error(`Invalid supported: ${h}`);let U=b[h];if(typeof U!="boolean")throw new Error(`Expected value for supported ${V(h)} to be a boolean, got ${typeof U} instead`);e.push(`--supported:${h}=${U}`)}if($)for(let h of $)e.push(`--pure:${J(h,"pure")}`);C&&e.push("--keep-names")}function Qe(e,t,n,l,d){var se;let i=[],f=[],o=Object.create(null),m=null,w=null;he(i,t,o,n,l),Be(i,t,o);let x=r(t,o,"sourcemap",De),F=r(t,o,"bundle",I),j=r(t,o,"splitting",I),B=r(t,o,"preserveSymlinks",I),q=r(t,o,"metafile",I),Q=r(t,o,"outfile",y),T=r(t,o,"outdir",y),W=r(t,o,"outbase",y),Y=r(t,o,"tsconfig",y),R=r(t,o,"resolveExtensions",z),g=r(t,o,"nodePaths",z),c=r(t,o,"mainFields",z),s=r(t,o,"conditions",z),O=r(t,o,"external",z),k=r(t,o,"packages",y),M=r(t,o,"alias",ee),E=r(t,o,"loader",ee),a=r(t,o,"outExtension",ee),u=r(t,o,"publicPath",y),b=r(t,o,"entryNames",y),$=r(t,o,"chunkNames",y),C=r(t,o,"assetNames",y),S=r(t,o,"inject",z),v=r(t,o,"banner",ee),h=r(t,o,"footer",ee),U=r(t,o,"entryPoints",Ke),A=r(t,o,"absWorkingDir",y),P=r(t,o,"stdin",ee),D=(se=r(t,o,"write",I))!=null?se:d,L=r(t,o,"allowOverwrite",I),_=r(t,o,"mangleCache",ee);if(o.plugins=!0,K(t,o,`in ${e}() call`),x&&i.push(`--sourcemap${x===!0?"":`=${x}`}`),F&&i.push("--bundle"),L&&i.push("--allow-overwrite"),j&&i.push("--splitting"),B&&i.push("--preserve-symlinks"),q&&i.push("--metafile"),Q&&i.push(`--outfile=${Q}`),T&&i.push(`--outdir=${T}`),W&&i.push(`--outbase=${W}`),Y&&i.push(`--tsconfig=${Y}`),k&&i.push(`--packages=${k}`),R){let p=[];for(let N of R){if(J(N,"resolve extension"),N.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${N}`);p.push(N)}i.push(`--resolve-extensions=${p.join(",")}`)}if(u&&i.push(`--public-path=${u}`),b&&i.push(`--entry-names=${b}`),$&&i.push(`--chunk-names=${$}`),C&&i.push(`--asset-names=${C}`),c){let p=[];for(let N of c){if(J(N,"main field"),N.indexOf(",")>=0)throw new Error(`Invalid main field: ${N}`);p.push(N)}i.push(`--main-fields=${p.join(",")}`)}if(s){let p=[];for(let N of s){if(J(N,"condition"),N.indexOf(",")>=0)throw new Error(`Invalid condition: ${N}`);p.push(N)}i.push(`--conditions=${p.join(",")}`)}if(O)for(let p of O)i.push(`--external:${J(p,"external")}`);if(M)for(let p in M){if(p.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${p}`);i.push(`--alias:${p}=${J(M[p],"alias",p)}`)}if(v)for(let p in v){if(p.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${p}`);i.push(`--banner:${p}=${J(v[p],"banner",p)}`)}if(h)for(let p in h){if(p.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${p}`);i.push(`--footer:${p}=${J(h[p],"footer",p)}`)}if(S)for(let p of S)i.push(`--inject:${J(p,"inject")}`);if(E)for(let p in E){if(p.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${p}`);i.push(`--loader:${p}=${J(E[p],"loader",p)}`)}if(a)for(let p in a){if(p.indexOf("=")>=0)throw new Error(`Invalid out extension: ${p}`);i.push(`--out-extension:${p}=${J(a[p],"out extension",p)}`)}if(U)if(Array.isArray(U))for(let p=0,N=U.length;p<N;p++){let G=U[p];if(typeof G=="object"&&G!==null){let X=Object.create(null),ne=r(G,X,"in",y),fe=r(G,X,"out",y);if(K(G,X,"in entry point at index "+p),ne===void 0)throw new Error('Missing property "in" for entry point at index '+p);if(fe===void 0)throw new Error('Missing property "out" for entry point at index '+p);f.push([fe,ne])}else f.push(["",J(G,"entry point at index "+p)])}else for(let p in U)f.push([p,J(U[p],"entry point",p)]);if(P){let p=Object.create(null),N=r(P,p,"contents",Pe),G=r(P,p,"resolveDir",y),X=r(P,p,"sourcefile",y),ne=r(P,p,"loader",y);K(P,p,'in "stdin" object'),X&&i.push(`--sourcefile=${X}`),ne&&i.push(`--loader=${ne}`),G&&(w=G),typeof N=="string"?m=Z(N):N instanceof Uint8Array&&(m=N)}let H=[];if(g)for(let p of g)p+="",H.push(p);return{entries:f,flags:i,write:D,stdinContents:m,stdinResolveDir:w,absWorkingDir:A,nodePaths:H,mangleCache:Te(_)}}function He(e,t,n,l){let d=[],i=Object.create(null);he(d,t,i,n,l),Be(d,t,i);let f=r(t,i,"sourcemap",De),o=r(t,i,"sourcefile",y),m=r(t,i,"loader",y),w=r(t,i,"banner",y),x=r(t,i,"footer",y),F=r(t,i,"mangleCache",ee);return K(t,i,`in ${e}() call`),f&&d.push(`--sourcemap=${f===!0?"external":f}`),o&&d.push(`--sourcefile=${o}`),m&&d.push(`--loader=${m}`),w&&d.push(`--banner=${w}`),x&&d.push(`--footer=${x}`),{flags:d,mangleCache:Te(F)}}function Ue(e){let t={},n={didClose:!1,reason:""},l={},d=0,i=0,f=new Uint8Array(16*1024),o=0,m=R=>{let g=o+R.length;if(g>f.length){let s=new Uint8Array(g*2);s.set(f),f=s}f.set(R,o),o+=R.length;let c=0;for(;c+4<=o;){let s=Re(f,c);if(c+4+s>o)break;c+=4,q(f.subarray(c,c+s)),c+=s}c>0&&(f.copyWithin(0,c,o),o-=c)},w=R=>{n.didClose=!0,R&&(n.reason=": "+(R.message||R));let g="The service was stopped"+n.reason;for(let c in l)l[c](g,null);l={}},x=(R,g,c)=>{if(n.didClose)return c("The service is no longer running"+n.reason,null);let s=d++;l[s]=(O,k)=>{try{c(O,k)}finally{R&&R.unref()}},R&&R.ref(),e.writeToStdin(xe({id:s,isRequest:!0,value:g}))},F=(R,g)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(xe({id:R,isRequest:!1,value:g}))},j=async(R,g)=>{try{if(g.command==="ping"){F(R,{});return}if(typeof g.key=="number"){let c=t[g.key];if(c){let s=c[g.command];if(s){await s(R,g);return}}}throw new Error("Invalid command: "+g.command)}catch(c){F(R,{errors:[ie(c,e,null,void 0,"")]})}},B=!0,q=R=>{if(B){B=!1;let c=String.fromCharCode(...R);if(c!=="0.18.8")throw new Error(`Cannot start service: Host version "0.18.8" does not match binary version ${V(c)}`);return}let g=Ee(R);if(g.isRequest)j(g.id,g.value);else{let c=l[g.id];delete l[g.id],g.value.error?c(g.value.error,{}):c(null,g.value)}};return{readFromStdout:m,afterClose:w,service:{buildOrContext:({callName:R,refs:g,options:c,isTTY:s,defaultWD:O,callback:k})=>{let M=0,E=i++,a={},u={ref(){++M===1&&g&&g.ref()},unref(){--M===0&&(delete t[E],g&&g.unref())}};t[E]=a,u.ref(),Ge(R,E,x,F,u,e,a,c,s,O,(b,$)=>{try{k(b,$)}finally{u.unref()}})},transform:({callName:R,refs:g,input:c,options:s,isTTY:O,fs:k,callback:M})=>{let E=je(),a=u=>{try{if(typeof c!="string"&&!(c instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:b,mangleCache:$}=He(R,s,O,ke),C={command:"transform",flags:b,inputFS:u!==null,input:u!==null?Z(u):typeof c=="string"?Z(c):c};$&&(C.mangleCache=$),x(g,C,(S,v)=>{if(S)return M(new Error(S),null);let h=oe(v.errors,E),U=oe(v.warnings,E),A=1,P=()=>{if(--A===0){let D={warnings:U,code:v.code,map:v.map,mangleCache:void 0,legalComments:void 0};"legalComments"in v&&(D.legalComments=v==null?void 0:v.legalComments),v.mangleCache&&(D.mangleCache=v==null?void 0:v.mangleCache),M(null,D)}};if(h.length>0)return M(ue("Transform failed",h,U),null);v.codeFS&&(A++,k.readFile(v.code,(D,L)=>{D!==null?M(D,null):(v.code=L,P())})),v.mapFS&&(A++,k.readFile(v.map,(D,L)=>{D!==null?M(D,null):(v.map=L,P())})),P()})}catch(b){let $=[];try{he($,s,{},O,ke)}catch(S){}let C=ie(b,e,E,void 0,"");x(g,{command:"error",flags:$,error:C},()=>{C.detail=E.load(C.detail),M(ue("Transform failed",[C],[]),null)})}};if((typeof c=="string"||c instanceof Uint8Array)&&c.length>1024*1024){let u=a;a=()=>k.writeFile(c,u)}a(null)},formatMessages:({callName:R,refs:g,messages:c,options:s,callback:O})=>{let k=te(c,"messages",null,"");if(!s)throw new Error(`Missing second argument in ${R}() call`);let M={},E=r(s,M,"kind",y),a=r(s,M,"color",I),u=r(s,M,"terminalWidth",le);if(K(s,M,`in ${R}() call`),E===void 0)throw new Error(`Missing "kind" in ${R}() call`);if(E!=="error"&&E!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${R}() call`);let b={command:"format-msgs",messages:k,isWarning:E==="warning"};a!==void 0&&(b.color=a),u!==void 0&&(b.terminalWidth=u),x(g,b,($,C)=>{if($)return O(new Error($),null);O(null,C.messages)})},analyzeMetafile:({callName:R,refs:g,metafile:c,options:s,callback:O})=>{s===void 0&&(s={});let k={},M=r(s,k,"color",I),E=r(s,k,"verbose",I);K(s,k,`in ${R}() call`);let a={command:"analyze-metafile",metafile:c};M!==void 0&&(a.color=M),E!==void 0&&(a.verbose=E),x(g,a,(u,b)=>{if(u)return O(new Error(u),null);O(null,b.result)})}}}}function Ge(e,t,n,l,d,i,f,o,m,w,x){let F=je(),j=e==="context",B=(T,W)=>{let Y=[];try{he(Y,o,{},m,Se)}catch(g){}let R=ie(T,i,F,void 0,W);n(d,{command:"error",flags:Y,error:R},()=>{R.detail=F.load(R.detail),x(ue(j?"Context failed":"Build failed",[R],[]),null)})},q;if(typeof o=="object"){let T=o.plugins;if(T!==void 0){if(!Array.isArray(T))return B(new Error('"plugins" must be an array'),"");q=T}}if(q&&q.length>0){if(i.isSync)return B(new Error("Cannot use plugins in synchronous API calls"),"");Xe(t,n,l,d,i,f,o,q,F).then(T=>{if(!T.ok)return B(T.error,T.pluginName);try{Q(T.requestPlugins,T.runOnEndCallbacks,T.scheduleOnDisposeCallbacks)}catch(W){B(W,"")}},T=>B(T,""));return}try{Q(null,(T,W)=>W([],[]),()=>{})}catch(T){B(T,"")}function Q(T,W,Y){let R=i.hasFS,{entries:g,flags:c,write:s,stdinContents:O,stdinResolveDir:k,absWorkingDir:M,nodePaths:E,mangleCache:a}=Qe(e,o,m,Se,R);if(s&&!i.hasFS)throw new Error('The "write" option is unavailable in this environment');let u={command:"build",key:t,entries:g,flags:c,write:s,stdinContents:O,stdinResolveDir:k,absWorkingDir:M||w,nodePaths:E,context:j};T&&(u.plugins=T),a&&(u.mangleCache=a);let b=(S,v)=>{let h={errors:oe(S.errors,F),warnings:oe(S.warnings,F),outputFiles:void 0,metafile:void 0,mangleCache:void 0},U=h.errors.slice(),A=h.warnings.slice();S.outputFiles&&(h.outputFiles=S.outputFiles.map(Ze)),S.metafile&&(h.metafile=JSON.parse(S.metafile)),S.mangleCache&&(h.mangleCache=S.mangleCache),S.writeToStdout!==void 0&&console.log(re(S.writeToStdout).replace(/\n$/,"")),W(h,(P,D)=>{if(U.length>0||P.length>0){let L=ue("Build failed",U.concat(P),A.concat(D));return v(L,null,P,D)}v(null,h,P,D)})},$,C;j&&(f["on-end"]=(S,v)=>new Promise(h=>{b(v,(U,A,P,D)=>{let L={errors:P,warnings:D};C&&C(U,A),$=void 0,C=void 0,l(S,L),h()})})),n(d,u,(S,v)=>{if(S)return x(new Error(S),null);if(!j)return b(v,(A,P)=>(Y(),x(A,P)));if(v.errors.length>0)return x(ue("Context failed",v.errors,v.warnings),null);let h=!1,U={rebuild:()=>($||($=new Promise((A,P)=>{let D;C=(_,H)=>{D||(D=()=>_?P(_):A(H))};let L=()=>{n(d,{command:"rebuild",key:t},(H,se)=>{H?P(new Error(H)):D?D():L()})};L()})),$),watch:(A={})=>new Promise((P,D)=>{if(!i.hasFS)throw new Error('Cannot use the "watch" API in this environment');K(A,{},"in watch() call"),n(d,{command:"watch",key:t},H=>{H?D(new Error(H)):P(void 0)})}),serve:(A={})=>new Promise((P,D)=>{if(!i.hasFS)throw new Error('Cannot use the "serve" API in this environment');let L={},_=r(A,L,"port",le),H=r(A,L,"host",y),se=r(A,L,"servedir",y),p=r(A,L,"keyfile",y),N=r(A,L,"certfile",y),G=r(A,L,"onRequest",Ae);K(A,L,"in serve() call");let X={command:"serve",key:t,onRequest:!!G};_!==void 0&&(X.port=_),H!==void 0&&(X.host=H),se!==void 0&&(X.servedir=se),p!==void 0&&(X.keyfile=p),N!==void 0&&(X.certfile=N),n(d,X,(ne,fe)=>{if(ne)return D(new Error(ne));G&&(f["serve-request"]=(Le,Ne)=>{G(Ne.args),l(Le,{})}),P(fe)})}),cancel:()=>new Promise(A=>{if(h)return A();n(d,{command:"cancel",key:t},()=>{A()})}),dispose:()=>new Promise(A=>{if(h)return A();h=!0,n(d,{command:"dispose",key:t},()=>{A(),Y(),d.unref()})})};d.ref(),x(null,U)})}}var Xe=async(e,t,n,l,d,i,f,o,m)=>{let w=[],x=[],F={},j={},B=[],q=0,Q=0,T=[],W=!1;o=[...o];for(let g of o){let c={};if(typeof g!="object")throw new Error(`Plugin at index ${Q} must be an object`);let s=r(g,c,"name",y);if(typeof s!="string"||s==="")throw new Error(`Plugin at index ${Q} is missing a name`);try{let O=r(g,c,"setup",Ae);if(typeof O!="function")throw new Error("Plugin is missing a setup function");K(g,c,`on plugin ${V(s)}`);let k={name:s,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};Q++;let E=O({initialOptions:f,resolve:(a,u={})=>{if(!W)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof a!="string")throw new Error("The path to resolve must be a string");let b=Object.create(null),$=r(u,b,"pluginName",y),C=r(u,b,"importer",y),S=r(u,b,"namespace",y),v=r(u,b,"resolveDir",y),h=r(u,b,"kind",y),U=r(u,b,"pluginData",me);return K(u,b,"in resolve() call"),new Promise((A,P)=>{let D={command:"resolve",path:a,key:e,pluginName:s};if($!=null&&(D.pluginName=$),C!=null&&(D.importer=C),S!=null&&(D.namespace=S),v!=null&&(D.resolveDir=v),h!=null)D.kind=h;else throw new Error('Must specify "kind" when calling "resolve"');U!=null&&(D.pluginData=m.store(U)),t(l,D,(L,_)=>{L!==null?P(new Error(L)):A({errors:oe(_.errors,m),warnings:oe(_.warnings,m),path:_.path,external:_.external,sideEffects:_.sideEffects,namespace:_.namespace,suffix:_.suffix,pluginData:m.load(_.pluginData)})})})},onStart(a){let u='This error came from the "onStart" callback registered here:',b=pe(new Error(u),d,"onStart");w.push({name:s,callback:a,note:b}),k.onStart=!0},onEnd(a){let u='This error came from the "onEnd" callback registered here:',b=pe(new Error(u),d,"onEnd");x.push({name:s,callback:a,note:b}),k.onEnd=!0},onResolve(a,u){let b='This error came from the "onResolve" callback registered here:',$=pe(new Error(b),d,"onResolve"),C={},S=r(a,C,"filter",ye),v=r(a,C,"namespace",y);if(K(a,C,`in onResolve() call for plugin ${V(s)}`),S==null)throw new Error("onResolve() call is missing a filter");let h=q++;F[h]={name:s,callback:u,note:$},k.onResolve.push({id:h,filter:S.source,namespace:v||""})},onLoad(a,u){let b='This error came from the "onLoad" callback registered here:',$=pe(new Error(b),d,"onLoad"),C={},S=r(a,C,"filter",ye),v=r(a,C,"namespace",y);if(K(a,C,`in onLoad() call for plugin ${V(s)}`),S==null)throw new Error("onLoad() call is missing a filter");let h=q++;j[h]={name:s,callback:u,note:$},k.onLoad.push({id:h,filter:S.source,namespace:v||""})},onDispose(a){B.push(a)},esbuild:d.esbuild});E&&await E,T.push(k)}catch(O){return{ok:!1,error:O,pluginName:s}}}i["on-start"]=async(g,c)=>{let s={errors:[],warnings:[]};await Promise.all(w.map(async({name:O,callback:k,note:M})=>{try{let E=await k();if(E!=null){if(typeof E!="object")throw new Error(`Expected onStart() callback in plugin ${V(O)} to return an object`);let a={},u=r(E,a,"errors",z),b=r(E,a,"warnings",z);K(E,a,`from onStart() callback in plugin ${V(O)}`),u!=null&&s.errors.push(...te(u,"errors",m,O)),b!=null&&s.warnings.push(...te(b,"warnings",m,O))}}catch(E){s.errors.push(ie(E,d,m,M&&M(),O))}})),n(g,s)},i["on-resolve"]=async(g,c)=>{let s={},O="",k,M;for(let E of c.ids)try{({name:O,callback:k,note:M}=F[E]);let a=await k({path:c.path,importer:c.importer,namespace:c.namespace,resolveDir:c.resolveDir,kind:c.kind,pluginData:m.load(c.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onResolve() callback in plugin ${V(O)} to return an object`);let u={},b=r(a,u,"pluginName",y),$=r(a,u,"path",y),C=r(a,u,"namespace",y),S=r(a,u,"suffix",y),v=r(a,u,"external",I),h=r(a,u,"sideEffects",I),U=r(a,u,"pluginData",me),A=r(a,u,"errors",z),P=r(a,u,"warnings",z),D=r(a,u,"watchFiles",z),L=r(a,u,"watchDirs",z);K(a,u,`from onResolve() callback in plugin ${V(O)}`),s.id=E,b!=null&&(s.pluginName=b),$!=null&&(s.path=$),C!=null&&(s.namespace=C),S!=null&&(s.suffix=S),v!=null&&(s.external=v),h!=null&&(s.sideEffects=h),U!=null&&(s.pluginData=m.store(U)),A!=null&&(s.errors=te(A,"errors",m,O)),P!=null&&(s.warnings=te(P,"warnings",m,O)),D!=null&&(s.watchFiles=ge(D,"watchFiles")),L!=null&&(s.watchDirs=ge(L,"watchDirs"));break}}catch(a){s={id:E,errors:[ie(a,d,m,M&&M(),O)]};break}n(g,s)},i["on-load"]=async(g,c)=>{let s={},O="",k,M;for(let E of c.ids)try{({name:O,callback:k,note:M}=j[E]);let a=await k({path:c.path,namespace:c.namespace,suffix:c.suffix,pluginData:m.load(c.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onLoad() callback in plugin ${V(O)} to return an object`);let u={},b=r(a,u,"pluginName",y),$=r(a,u,"contents",Pe),C=r(a,u,"resolveDir",y),S=r(a,u,"pluginData",me),v=r(a,u,"loader",y),h=r(a,u,"errors",z),U=r(a,u,"warnings",z),A=r(a,u,"watchFiles",z),P=r(a,u,"watchDirs",z);K(a,u,`from onLoad() callback in plugin ${V(O)}`),s.id=E,b!=null&&(s.pluginName=b),$ instanceof Uint8Array?s.contents=$:$!=null&&(s.contents=Z($)),C!=null&&(s.resolveDir=C),S!=null&&(s.pluginData=m.store(S)),v!=null&&(s.loader=v),h!=null&&(s.errors=te(h,"errors",m,O)),U!=null&&(s.warnings=te(U,"warnings",m,O)),A!=null&&(s.watchFiles=ge(A,"watchFiles")),P!=null&&(s.watchDirs=ge(P,"watchDirs"));break}}catch(a){s={id:E,errors:[ie(a,d,m,M&&M(),O)]};break}n(g,s)};let Y=(g,c)=>c([],[]);x.length>0&&(Y=(g,c)=>{(async()=>{let s=[],O=[];for(let{name:k,callback:M,note:E}of x){let a,u;try{let b=await M(g);if(b!=null){if(typeof b!="object")throw new Error(`Expected onEnd() callback in plugin ${V(k)} to return an object`);let $={},C=r(b,$,"errors",z),S=r(b,$,"warnings",z);K(b,$,`from onEnd() callback in plugin ${V(k)}`),C!=null&&(a=te(C,"errors",m,k)),S!=null&&(u=te(S,"warnings",m,k))}}catch(b){a=[ie(b,d,m,E&&E(),k)]}if(a){s.push(...a);try{g.errors.push(...a)}catch(b){}}if(u){O.push(...u);try{g.warnings.push(...u)}catch(b){}}}c(s,O)})()});let R=()=>{for(let g of B)setTimeout(()=>g(),0)};return W=!0,{ok:!0,requestPlugins:T,runOnEndCallbacks:Y,scheduleOnDisposeCallbacks:R}};function je(){let e=new Map,t=0;return{load(n){return e.get(n)},store(n){if(n===void 0)return-1;let l=t++;return e.set(l,n),l}}}function pe(e,t,n){let l,d=!1;return()=>{if(d)return l;d=!0;try{let i=(e.stack+"").split(`
6
+ `);function Re(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function ve(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var V=JSON.stringify,Se="warning",ke="silent";function $e(e){if(J(e,"target"),e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var me=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",y=e=>typeof e=="string"?null:"a string",ye=e=>e instanceof RegExp?null:"a RegExp object",le=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Ae=e=>typeof e=="function"?null:"a function",z=e=>Array.isArray(e)?null:"an array",ee=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",Ke=e=>typeof e=="object"&&e!==null?null:"an array or an object",_e=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Me=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",De=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",Ve=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Ye=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",Pe=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",Je=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function r(e,t,n,l){let d=e[n];if(t[n+""]=!0,d===void 0)return;let i=l(d);if(i!==null)throw new Error(`${V(n)} must be ${i}`);return d}function K(e,t,n){for(let l in e)if(!(l in t))throw new Error(`Invalid option ${n}: ${V(l)}`)}function Fe(e){let t=Object.create(null),n=r(e,t,"wasmURL",Je),l=r(e,t,"wasmModule",_e),d=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:l,worker:d}}function Te(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let l=e[n];if(typeof l=="string"||l===!1)t[n]=l;else throw new Error(`Expected ${V(n)} in mangle cache to map to either a string or false`)}}return t}function he(e,t,n,l,d){let i=r(t,n,"color",I),f=r(t,n,"logLevel",y),o=r(t,n,"logLimit",le);i!==void 0?e.push(`--color=${i}`):l&&e.push("--color=true"),e.push(`--log-level=${f||d}`),e.push(`--log-limit=${o||0}`)}function J(e,t,n){if(typeof e!="string")throw new Error(`Expected value for ${t}${n!==void 0?" "+V(n):""} to be a string, got ${typeof e} instead`);return e}function Be(e,t,n){let l=r(t,n,"legalComments",y),d=r(t,n,"sourceRoot",y),i=r(t,n,"sourcesContent",I),f=r(t,n,"target",Ye),o=r(t,n,"format",y),m=r(t,n,"globalName",y),w=r(t,n,"mangleProps",ye),x=r(t,n,"reserveProps",ye),F=r(t,n,"mangleQuoted",I),j=r(t,n,"minify",I),B=r(t,n,"minifySyntax",I),q=r(t,n,"minifyWhitespace",I),Q=r(t,n,"minifyIdentifiers",I),T=r(t,n,"lineLimit",le),W=r(t,n,"drop",z),Y=r(t,n,"charset",y),R=r(t,n,"treeShaking",I),g=r(t,n,"ignoreAnnotations",I),c=r(t,n,"jsx",y),s=r(t,n,"jsxFactory",y),O=r(t,n,"jsxFragment",y),k=r(t,n,"jsxImportSource",y),M=r(t,n,"jsxDev",I),E=r(t,n,"jsxSideEffects",I),a=r(t,n,"define",ee),u=r(t,n,"logOverride",ee),b=r(t,n,"supported",ee),$=r(t,n,"pure",z),C=r(t,n,"keepNames",I),S=r(t,n,"platform",y),v=r(t,n,"tsconfigRaw",Ve);if(l&&e.push(`--legal-comments=${l}`),d!==void 0&&e.push(`--source-root=${d}`),i!==void 0&&e.push(`--sources-content=${i}`),f&&(Array.isArray(f)?e.push(`--target=${Array.from(f).map($e).join(",")}`):e.push(`--target=${$e(f)}`)),o&&e.push(`--format=${o}`),m&&e.push(`--global-name=${m}`),S&&e.push(`--platform=${S}`),v&&e.push(`--tsconfig-raw=${typeof v=="string"?v:JSON.stringify(v)}`),j&&e.push("--minify"),B&&e.push("--minify-syntax"),q&&e.push("--minify-whitespace"),Q&&e.push("--minify-identifiers"),T&&e.push(`--line-limit=${T}`),Y&&e.push(`--charset=${Y}`),R!==void 0&&e.push(`--tree-shaking=${R}`),g&&e.push("--ignore-annotations"),W)for(let h of W)e.push(`--drop:${J(h,"drop")}`);if(w&&e.push(`--mangle-props=${w.source}`),x&&e.push(`--reserve-props=${x.source}`),F!==void 0&&e.push(`--mangle-quoted=${F}`),c&&e.push(`--jsx=${c}`),s&&e.push(`--jsx-factory=${s}`),O&&e.push(`--jsx-fragment=${O}`),k&&e.push(`--jsx-import-source=${k}`),M&&e.push("--jsx-dev"),E&&e.push("--jsx-side-effects"),a)for(let h in a){if(h.indexOf("=")>=0)throw new Error(`Invalid define: ${h}`);e.push(`--define:${h}=${J(a[h],"define",h)}`)}if(u)for(let h in u){if(h.indexOf("=")>=0)throw new Error(`Invalid log override: ${h}`);e.push(`--log-override:${h}=${J(u[h],"log override",h)}`)}if(b)for(let h in b){if(h.indexOf("=")>=0)throw new Error(`Invalid supported: ${h}`);let U=b[h];if(typeof U!="boolean")throw new Error(`Expected value for supported ${V(h)} to be a boolean, got ${typeof U} instead`);e.push(`--supported:${h}=${U}`)}if($)for(let h of $)e.push(`--pure:${J(h,"pure")}`);C&&e.push("--keep-names")}function Qe(e,t,n,l,d){var se;let i=[],f=[],o=Object.create(null),m=null,w=null;he(i,t,o,n,l),Be(i,t,o);let x=r(t,o,"sourcemap",De),F=r(t,o,"bundle",I),j=r(t,o,"splitting",I),B=r(t,o,"preserveSymlinks",I),q=r(t,o,"metafile",I),Q=r(t,o,"outfile",y),T=r(t,o,"outdir",y),W=r(t,o,"outbase",y),Y=r(t,o,"tsconfig",y),R=r(t,o,"resolveExtensions",z),g=r(t,o,"nodePaths",z),c=r(t,o,"mainFields",z),s=r(t,o,"conditions",z),O=r(t,o,"external",z),k=r(t,o,"packages",y),M=r(t,o,"alias",ee),E=r(t,o,"loader",ee),a=r(t,o,"outExtension",ee),u=r(t,o,"publicPath",y),b=r(t,o,"entryNames",y),$=r(t,o,"chunkNames",y),C=r(t,o,"assetNames",y),S=r(t,o,"inject",z),v=r(t,o,"banner",ee),h=r(t,o,"footer",ee),U=r(t,o,"entryPoints",Ke),A=r(t,o,"absWorkingDir",y),P=r(t,o,"stdin",ee),D=(se=r(t,o,"write",I))!=null?se:d,L=r(t,o,"allowOverwrite",I),_=r(t,o,"mangleCache",ee);if(o.plugins=!0,K(t,o,`in ${e}() call`),x&&i.push(`--sourcemap${x===!0?"":`=${x}`}`),F&&i.push("--bundle"),L&&i.push("--allow-overwrite"),j&&i.push("--splitting"),B&&i.push("--preserve-symlinks"),q&&i.push("--metafile"),Q&&i.push(`--outfile=${Q}`),T&&i.push(`--outdir=${T}`),W&&i.push(`--outbase=${W}`),Y&&i.push(`--tsconfig=${Y}`),k&&i.push(`--packages=${k}`),R){let p=[];for(let N of R){if(J(N,"resolve extension"),N.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${N}`);p.push(N)}i.push(`--resolve-extensions=${p.join(",")}`)}if(u&&i.push(`--public-path=${u}`),b&&i.push(`--entry-names=${b}`),$&&i.push(`--chunk-names=${$}`),C&&i.push(`--asset-names=${C}`),c){let p=[];for(let N of c){if(J(N,"main field"),N.indexOf(",")>=0)throw new Error(`Invalid main field: ${N}`);p.push(N)}i.push(`--main-fields=${p.join(",")}`)}if(s){let p=[];for(let N of s){if(J(N,"condition"),N.indexOf(",")>=0)throw new Error(`Invalid condition: ${N}`);p.push(N)}i.push(`--conditions=${p.join(",")}`)}if(O)for(let p of O)i.push(`--external:${J(p,"external")}`);if(M)for(let p in M){if(p.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${p}`);i.push(`--alias:${p}=${J(M[p],"alias",p)}`)}if(v)for(let p in v){if(p.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${p}`);i.push(`--banner:${p}=${J(v[p],"banner",p)}`)}if(h)for(let p in h){if(p.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${p}`);i.push(`--footer:${p}=${J(h[p],"footer",p)}`)}if(S)for(let p of S)i.push(`--inject:${J(p,"inject")}`);if(E)for(let p in E){if(p.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${p}`);i.push(`--loader:${p}=${J(E[p],"loader",p)}`)}if(a)for(let p in a){if(p.indexOf("=")>=0)throw new Error(`Invalid out extension: ${p}`);i.push(`--out-extension:${p}=${J(a[p],"out extension",p)}`)}if(U)if(Array.isArray(U))for(let p=0,N=U.length;p<N;p++){let G=U[p];if(typeof G=="object"&&G!==null){let X=Object.create(null),ne=r(G,X,"in",y),fe=r(G,X,"out",y);if(K(G,X,"in entry point at index "+p),ne===void 0)throw new Error('Missing property "in" for entry point at index '+p);if(fe===void 0)throw new Error('Missing property "out" for entry point at index '+p);f.push([fe,ne])}else f.push(["",J(G,"entry point at index "+p)])}else for(let p in U)f.push([p,J(U[p],"entry point",p)]);if(P){let p=Object.create(null),N=r(P,p,"contents",Pe),G=r(P,p,"resolveDir",y),X=r(P,p,"sourcefile",y),ne=r(P,p,"loader",y);K(P,p,'in "stdin" object'),X&&i.push(`--sourcefile=${X}`),ne&&i.push(`--loader=${ne}`),G&&(w=G),typeof N=="string"?m=Z(N):N instanceof Uint8Array&&(m=N)}let H=[];if(g)for(let p of g)p+="",H.push(p);return{entries:f,flags:i,write:D,stdinContents:m,stdinResolveDir:w,absWorkingDir:A,nodePaths:H,mangleCache:Te(_)}}function He(e,t,n,l){let d=[],i=Object.create(null);he(d,t,i,n,l),Be(d,t,i);let f=r(t,i,"sourcemap",De),o=r(t,i,"sourcefile",y),m=r(t,i,"loader",y),w=r(t,i,"banner",y),x=r(t,i,"footer",y),F=r(t,i,"mangleCache",ee);return K(t,i,`in ${e}() call`),f&&d.push(`--sourcemap=${f===!0?"external":f}`),o&&d.push(`--sourcefile=${o}`),m&&d.push(`--loader=${m}`),w&&d.push(`--banner=${w}`),x&&d.push(`--footer=${x}`),{flags:d,mangleCache:Te(F)}}function Ue(e){let t={},n={didClose:!1,reason:""},l={},d=0,i=0,f=new Uint8Array(16*1024),o=0,m=R=>{let g=o+R.length;if(g>f.length){let s=new Uint8Array(g*2);s.set(f),f=s}f.set(R,o),o+=R.length;let c=0;for(;c+4<=o;){let s=Re(f,c);if(c+4+s>o)break;c+=4,q(f.subarray(c,c+s)),c+=s}c>0&&(f.copyWithin(0,c,o),o-=c)},w=R=>{n.didClose=!0,R&&(n.reason=": "+(R.message||R));let g="The service was stopped"+n.reason;for(let c in l)l[c](g,null);l={}},x=(R,g,c)=>{if(n.didClose)return c("The service is no longer running"+n.reason,null);let s=d++;l[s]=(O,k)=>{try{c(O,k)}finally{R&&R.unref()}},R&&R.ref(),e.writeToStdin(xe({id:s,isRequest:!0,value:g}))},F=(R,g)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(xe({id:R,isRequest:!1,value:g}))},j=async(R,g)=>{try{if(g.command==="ping"){F(R,{});return}if(typeof g.key=="number"){let c=t[g.key];if(c){let s=c[g.command];if(s){await s(R,g);return}}}throw new Error("Invalid command: "+g.command)}catch(c){F(R,{errors:[ie(c,e,null,void 0,"")]})}},B=!0,q=R=>{if(B){B=!1;let c=String.fromCharCode(...R);if(c!=="0.18.9")throw new Error(`Cannot start service: Host version "0.18.9" does not match binary version ${V(c)}`);return}let g=Ee(R);if(g.isRequest)j(g.id,g.value);else{let c=l[g.id];delete l[g.id],g.value.error?c(g.value.error,{}):c(null,g.value)}};return{readFromStdout:m,afterClose:w,service:{buildOrContext:({callName:R,refs:g,options:c,isTTY:s,defaultWD:O,callback:k})=>{let M=0,E=i++,a={},u={ref(){++M===1&&g&&g.ref()},unref(){--M===0&&(delete t[E],g&&g.unref())}};t[E]=a,u.ref(),Ge(R,E,x,F,u,e,a,c,s,O,(b,$)=>{try{k(b,$)}finally{u.unref()}})},transform:({callName:R,refs:g,input:c,options:s,isTTY:O,fs:k,callback:M})=>{let E=je(),a=u=>{try{if(typeof c!="string"&&!(c instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:b,mangleCache:$}=He(R,s,O,ke),C={command:"transform",flags:b,inputFS:u!==null,input:u!==null?Z(u):typeof c=="string"?Z(c):c};$&&(C.mangleCache=$),x(g,C,(S,v)=>{if(S)return M(new Error(S),null);let h=oe(v.errors,E),U=oe(v.warnings,E),A=1,P=()=>{if(--A===0){let D={warnings:U,code:v.code,map:v.map,mangleCache:void 0,legalComments:void 0};"legalComments"in v&&(D.legalComments=v==null?void 0:v.legalComments),v.mangleCache&&(D.mangleCache=v==null?void 0:v.mangleCache),M(null,D)}};if(h.length>0)return M(ue("Transform failed",h,U),null);v.codeFS&&(A++,k.readFile(v.code,(D,L)=>{D!==null?M(D,null):(v.code=L,P())})),v.mapFS&&(A++,k.readFile(v.map,(D,L)=>{D!==null?M(D,null):(v.map=L,P())})),P()})}catch(b){let $=[];try{he($,s,{},O,ke)}catch(S){}let C=ie(b,e,E,void 0,"");x(g,{command:"error",flags:$,error:C},()=>{C.detail=E.load(C.detail),M(ue("Transform failed",[C],[]),null)})}};if((typeof c=="string"||c instanceof Uint8Array)&&c.length>1024*1024){let u=a;a=()=>k.writeFile(c,u)}a(null)},formatMessages:({callName:R,refs:g,messages:c,options:s,callback:O})=>{let k=te(c,"messages",null,"");if(!s)throw new Error(`Missing second argument in ${R}() call`);let M={},E=r(s,M,"kind",y),a=r(s,M,"color",I),u=r(s,M,"terminalWidth",le);if(K(s,M,`in ${R}() call`),E===void 0)throw new Error(`Missing "kind" in ${R}() call`);if(E!=="error"&&E!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${R}() call`);let b={command:"format-msgs",messages:k,isWarning:E==="warning"};a!==void 0&&(b.color=a),u!==void 0&&(b.terminalWidth=u),x(g,b,($,C)=>{if($)return O(new Error($),null);O(null,C.messages)})},analyzeMetafile:({callName:R,refs:g,metafile:c,options:s,callback:O})=>{s===void 0&&(s={});let k={},M=r(s,k,"color",I),E=r(s,k,"verbose",I);K(s,k,`in ${R}() call`);let a={command:"analyze-metafile",metafile:c};M!==void 0&&(a.color=M),E!==void 0&&(a.verbose=E),x(g,a,(u,b)=>{if(u)return O(new Error(u),null);O(null,b.result)})}}}}function Ge(e,t,n,l,d,i,f,o,m,w,x){let F=je(),j=e==="context",B=(T,W)=>{let Y=[];try{he(Y,o,{},m,Se)}catch(g){}let R=ie(T,i,F,void 0,W);n(d,{command:"error",flags:Y,error:R},()=>{R.detail=F.load(R.detail),x(ue(j?"Context failed":"Build failed",[R],[]),null)})},q;if(typeof o=="object"){let T=o.plugins;if(T!==void 0){if(!Array.isArray(T))return B(new Error('"plugins" must be an array'),"");q=T}}if(q&&q.length>0){if(i.isSync)return B(new Error("Cannot use plugins in synchronous API calls"),"");Xe(t,n,l,d,i,f,o,q,F).then(T=>{if(!T.ok)return B(T.error,T.pluginName);try{Q(T.requestPlugins,T.runOnEndCallbacks,T.scheduleOnDisposeCallbacks)}catch(W){B(W,"")}},T=>B(T,""));return}try{Q(null,(T,W)=>W([],[]),()=>{})}catch(T){B(T,"")}function Q(T,W,Y){let R=i.hasFS,{entries:g,flags:c,write:s,stdinContents:O,stdinResolveDir:k,absWorkingDir:M,nodePaths:E,mangleCache:a}=Qe(e,o,m,Se,R);if(s&&!i.hasFS)throw new Error('The "write" option is unavailable in this environment');let u={command:"build",key:t,entries:g,flags:c,write:s,stdinContents:O,stdinResolveDir:k,absWorkingDir:M||w,nodePaths:E,context:j};T&&(u.plugins=T),a&&(u.mangleCache=a);let b=(S,v)=>{let h={errors:oe(S.errors,F),warnings:oe(S.warnings,F),outputFiles:void 0,metafile:void 0,mangleCache:void 0},U=h.errors.slice(),A=h.warnings.slice();S.outputFiles&&(h.outputFiles=S.outputFiles.map(Ze)),S.metafile&&(h.metafile=JSON.parse(S.metafile)),S.mangleCache&&(h.mangleCache=S.mangleCache),S.writeToStdout!==void 0&&console.log(re(S.writeToStdout).replace(/\n$/,"")),W(h,(P,D)=>{if(U.length>0||P.length>0){let L=ue("Build failed",U.concat(P),A.concat(D));return v(L,null,P,D)}v(null,h,P,D)})},$,C;j&&(f["on-end"]=(S,v)=>new Promise(h=>{b(v,(U,A,P,D)=>{let L={errors:P,warnings:D};C&&C(U,A),$=void 0,C=void 0,l(S,L),h()})})),n(d,u,(S,v)=>{if(S)return x(new Error(S),null);if(!j)return b(v,(A,P)=>(Y(),x(A,P)));if(v.errors.length>0)return x(ue("Context failed",v.errors,v.warnings),null);let h=!1,U={rebuild:()=>($||($=new Promise((A,P)=>{let D;C=(_,H)=>{D||(D=()=>_?P(_):A(H))};let L=()=>{n(d,{command:"rebuild",key:t},(H,se)=>{H?P(new Error(H)):D?D():L()})};L()})),$),watch:(A={})=>new Promise((P,D)=>{if(!i.hasFS)throw new Error('Cannot use the "watch" API in this environment');K(A,{},"in watch() call"),n(d,{command:"watch",key:t},H=>{H?D(new Error(H)):P(void 0)})}),serve:(A={})=>new Promise((P,D)=>{if(!i.hasFS)throw new Error('Cannot use the "serve" API in this environment');let L={},_=r(A,L,"port",le),H=r(A,L,"host",y),se=r(A,L,"servedir",y),p=r(A,L,"keyfile",y),N=r(A,L,"certfile",y),G=r(A,L,"onRequest",Ae);K(A,L,"in serve() call");let X={command:"serve",key:t,onRequest:!!G};_!==void 0&&(X.port=_),H!==void 0&&(X.host=H),se!==void 0&&(X.servedir=se),p!==void 0&&(X.keyfile=p),N!==void 0&&(X.certfile=N),n(d,X,(ne,fe)=>{if(ne)return D(new Error(ne));G&&(f["serve-request"]=(Le,Ne)=>{G(Ne.args),l(Le,{})}),P(fe)})}),cancel:()=>new Promise(A=>{if(h)return A();n(d,{command:"cancel",key:t},()=>{A()})}),dispose:()=>new Promise(A=>{if(h)return A();h=!0,n(d,{command:"dispose",key:t},()=>{A(),Y(),d.unref()})})};d.ref(),x(null,U)})}}var Xe=async(e,t,n,l,d,i,f,o,m)=>{let w=[],x=[],F={},j={},B=[],q=0,Q=0,T=[],W=!1;o=[...o];for(let g of o){let c={};if(typeof g!="object")throw new Error(`Plugin at index ${Q} must be an object`);let s=r(g,c,"name",y);if(typeof s!="string"||s==="")throw new Error(`Plugin at index ${Q} is missing a name`);try{let O=r(g,c,"setup",Ae);if(typeof O!="function")throw new Error("Plugin is missing a setup function");K(g,c,`on plugin ${V(s)}`);let k={name:s,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};Q++;let E=O({initialOptions:f,resolve:(a,u={})=>{if(!W)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof a!="string")throw new Error("The path to resolve must be a string");let b=Object.create(null),$=r(u,b,"pluginName",y),C=r(u,b,"importer",y),S=r(u,b,"namespace",y),v=r(u,b,"resolveDir",y),h=r(u,b,"kind",y),U=r(u,b,"pluginData",me);return K(u,b,"in resolve() call"),new Promise((A,P)=>{let D={command:"resolve",path:a,key:e,pluginName:s};if($!=null&&(D.pluginName=$),C!=null&&(D.importer=C),S!=null&&(D.namespace=S),v!=null&&(D.resolveDir=v),h!=null)D.kind=h;else throw new Error('Must specify "kind" when calling "resolve"');U!=null&&(D.pluginData=m.store(U)),t(l,D,(L,_)=>{L!==null?P(new Error(L)):A({errors:oe(_.errors,m),warnings:oe(_.warnings,m),path:_.path,external:_.external,sideEffects:_.sideEffects,namespace:_.namespace,suffix:_.suffix,pluginData:m.load(_.pluginData)})})})},onStart(a){let u='This error came from the "onStart" callback registered here:',b=pe(new Error(u),d,"onStart");w.push({name:s,callback:a,note:b}),k.onStart=!0},onEnd(a){let u='This error came from the "onEnd" callback registered here:',b=pe(new Error(u),d,"onEnd");x.push({name:s,callback:a,note:b}),k.onEnd=!0},onResolve(a,u){let b='This error came from the "onResolve" callback registered here:',$=pe(new Error(b),d,"onResolve"),C={},S=r(a,C,"filter",ye),v=r(a,C,"namespace",y);if(K(a,C,`in onResolve() call for plugin ${V(s)}`),S==null)throw new Error("onResolve() call is missing a filter");let h=q++;F[h]={name:s,callback:u,note:$},k.onResolve.push({id:h,filter:S.source,namespace:v||""})},onLoad(a,u){let b='This error came from the "onLoad" callback registered here:',$=pe(new Error(b),d,"onLoad"),C={},S=r(a,C,"filter",ye),v=r(a,C,"namespace",y);if(K(a,C,`in onLoad() call for plugin ${V(s)}`),S==null)throw new Error("onLoad() call is missing a filter");let h=q++;j[h]={name:s,callback:u,note:$},k.onLoad.push({id:h,filter:S.source,namespace:v||""})},onDispose(a){B.push(a)},esbuild:d.esbuild});E&&await E,T.push(k)}catch(O){return{ok:!1,error:O,pluginName:s}}}i["on-start"]=async(g,c)=>{let s={errors:[],warnings:[]};await Promise.all(w.map(async({name:O,callback:k,note:M})=>{try{let E=await k();if(E!=null){if(typeof E!="object")throw new Error(`Expected onStart() callback in plugin ${V(O)} to return an object`);let a={},u=r(E,a,"errors",z),b=r(E,a,"warnings",z);K(E,a,`from onStart() callback in plugin ${V(O)}`),u!=null&&s.errors.push(...te(u,"errors",m,O)),b!=null&&s.warnings.push(...te(b,"warnings",m,O))}}catch(E){s.errors.push(ie(E,d,m,M&&M(),O))}})),n(g,s)},i["on-resolve"]=async(g,c)=>{let s={},O="",k,M;for(let E of c.ids)try{({name:O,callback:k,note:M}=F[E]);let a=await k({path:c.path,importer:c.importer,namespace:c.namespace,resolveDir:c.resolveDir,kind:c.kind,pluginData:m.load(c.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onResolve() callback in plugin ${V(O)} to return an object`);let u={},b=r(a,u,"pluginName",y),$=r(a,u,"path",y),C=r(a,u,"namespace",y),S=r(a,u,"suffix",y),v=r(a,u,"external",I),h=r(a,u,"sideEffects",I),U=r(a,u,"pluginData",me),A=r(a,u,"errors",z),P=r(a,u,"warnings",z),D=r(a,u,"watchFiles",z),L=r(a,u,"watchDirs",z);K(a,u,`from onResolve() callback in plugin ${V(O)}`),s.id=E,b!=null&&(s.pluginName=b),$!=null&&(s.path=$),C!=null&&(s.namespace=C),S!=null&&(s.suffix=S),v!=null&&(s.external=v),h!=null&&(s.sideEffects=h),U!=null&&(s.pluginData=m.store(U)),A!=null&&(s.errors=te(A,"errors",m,O)),P!=null&&(s.warnings=te(P,"warnings",m,O)),D!=null&&(s.watchFiles=ge(D,"watchFiles")),L!=null&&(s.watchDirs=ge(L,"watchDirs"));break}}catch(a){s={id:E,errors:[ie(a,d,m,M&&M(),O)]};break}n(g,s)},i["on-load"]=async(g,c)=>{let s={},O="",k,M;for(let E of c.ids)try{({name:O,callback:k,note:M}=j[E]);let a=await k({path:c.path,namespace:c.namespace,suffix:c.suffix,pluginData:m.load(c.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onLoad() callback in plugin ${V(O)} to return an object`);let u={},b=r(a,u,"pluginName",y),$=r(a,u,"contents",Pe),C=r(a,u,"resolveDir",y),S=r(a,u,"pluginData",me),v=r(a,u,"loader",y),h=r(a,u,"errors",z),U=r(a,u,"warnings",z),A=r(a,u,"watchFiles",z),P=r(a,u,"watchDirs",z);K(a,u,`from onLoad() callback in plugin ${V(O)}`),s.id=E,b!=null&&(s.pluginName=b),$ instanceof Uint8Array?s.contents=$:$!=null&&(s.contents=Z($)),C!=null&&(s.resolveDir=C),S!=null&&(s.pluginData=m.store(S)),v!=null&&(s.loader=v),h!=null&&(s.errors=te(h,"errors",m,O)),U!=null&&(s.warnings=te(U,"warnings",m,O)),A!=null&&(s.watchFiles=ge(A,"watchFiles")),P!=null&&(s.watchDirs=ge(P,"watchDirs"));break}}catch(a){s={id:E,errors:[ie(a,d,m,M&&M(),O)]};break}n(g,s)};let Y=(g,c)=>c([],[]);x.length>0&&(Y=(g,c)=>{(async()=>{let s=[],O=[];for(let{name:k,callback:M,note:E}of x){let a,u;try{let b=await M(g);if(b!=null){if(typeof b!="object")throw new Error(`Expected onEnd() callback in plugin ${V(k)} to return an object`);let $={},C=r(b,$,"errors",z),S=r(b,$,"warnings",z);K(b,$,`from onEnd() callback in plugin ${V(k)}`),C!=null&&(a=te(C,"errors",m,k)),S!=null&&(u=te(S,"warnings",m,k))}}catch(b){a=[ie(b,d,m,E&&E(),k)]}if(a){s.push(...a);try{g.errors.push(...a)}catch(b){}}if(u){O.push(...u);try{g.warnings.push(...u)}catch(b){}}}c(s,O)})()});let R=()=>{for(let g of B)setTimeout(()=>g(),0)};return W=!0,{ok:!0,requestPlugins:T,runOnEndCallbacks:Y,scheduleOnDisposeCallbacks:R}};function je(){let e=new Map,t=0;return{load(n){return e.get(n)},store(n){if(n===void 0)return-1;let l=t++;return e.set(l,n),l}}}function pe(e,t,n){let l,d=!1;return()=>{if(d)return l;d=!0;try{let i=(e.stack+"").split(`
7
7
  `);i.splice(1,1);let f=qe(t,i,n);if(f)return l={text:e.message,location:f},l}catch(i){}}}function ie(e,t,n,l,d){let i="Internal error",f=null;try{i=(e&&e.message||e)+""}catch(o){}try{f=qe(t,(e.stack+"").split(`
8
8
  `),"")}catch(o){}return{id:"",pluginName:d,text:i,location:f,notes:l?[l]:[],detail:n?n.store(e):-1}}function qe(e,t,n){let l=" at ";if(e.readFileSync&&!t[0].startsWith(l)&&t[1].startsWith(l))for(let d=1;d<t.length;d++){let i=t[d];if(i.startsWith(l))for(i=i.slice(l.length);;){let f=/^(?:new |async )?\S+ \((.*)\)$/.exec(i);if(f){i=f[1];continue}if(f=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(i),f){i=f[1];continue}if(f=/^(\S+):(\d+):(\d+)$/.exec(i),f){let o;try{o=e.readFileSync(f[1],"utf8")}catch(F){break}let m=o.split(/\r\n|\r|\n|\u2028|\u2029/)[+f[2]-1]||"",w=+f[3]-1,x=m.slice(w,w+n.length)===n?n.length:0;return{file:f[1],namespace:"file",line:+f[2],column:Z(m.slice(0,w)).length,length:Z(m.slice(w,w+x)).length,lineText:m+`
9
9
  `+t.slice(1).join(`
10
10
  `),suggestion:""}}break}}return null}function ue(e,t,n){let l=5,d=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,l+1).map((f,o)=>{if(o===l)return`
11
11
  ...`;if(!f.location)return`
12
12
  error: ${f.text}`;let{file:m,line:w,column:x}=f.location,F=f.pluginName?`[plugin: ${f.pluginName}] `:"";return`
13
- ${m}:${w}:${x}: ERROR: ${F}${f.text}`}).join(""),i=new Error(`${e}${d}`);return i.errors=t,i.warnings=n,i}function oe(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function Ce(e,t){if(e==null)return null;let n={},l=r(e,n,"file",y),d=r(e,n,"namespace",y),i=r(e,n,"line",le),f=r(e,n,"column",le),o=r(e,n,"length",le),m=r(e,n,"lineText",y),w=r(e,n,"suggestion",y);return K(e,n,t),{file:l||"",namespace:d||"",line:i||0,column:f||0,length:o||0,lineText:m||"",suggestion:w||""}}function te(e,t,n,l){let d=[],i=0;for(let f of e){let o={},m=r(f,o,"id",y),w=r(f,o,"pluginName",y),x=r(f,o,"text",y),F=r(f,o,"location",Me),j=r(f,o,"notes",z),B=r(f,o,"detail",me),q=`in element ${i} of "${t}"`;K(f,o,q);let Q=[];if(j)for(let T of j){let W={},Y=r(T,W,"text",y),R=r(T,W,"location",Me);K(T,W,q),Q.push({text:Y||"",location:Ce(R,q)})}d.push({id:m||"",pluginName:w||l,text:x||"",location:Ce(F,q),notes:Q,detail:n?n.store(B):-1}),i++}return d}function ge(e,t){let n=[];for(let l of e){if(typeof l!="string")throw new Error(`${V(t)} must be an array of strings`);n.push(l)}return n}function Ze({path:e,contents:t}){let n=null;return{path:e,contents:t,get text(){let l=this.contents;return(n===null||l!==t)&&(t=l,n=re(l)),n}}}var tt="0.18.8",nt=e=>ce().build(e),rt=e=>ce().context(e),it=(e,t)=>ce().transform(e,t),lt=(e,t)=>ce().formatMessages(e,t),st=(e,t)=>ce().analyzeMetafile(e,t),ot=()=>{throw new Error('The "buildSync" API only works in node')},at=()=>{throw new Error('The "transformSync" API only works in node')},ut=()=>{throw new Error('The "formatMessagesSync" API only works in node')},ct=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ae,Oe,ce=()=>{if(Oe)return Oe;throw ae?new Error('You need to wait for the promise returned from "initialize" to be resolved before calling this'):new Error('You need to call "initialize" before calling this')},ft=e=>{e=Fe(e||{});let t=e.wasmURL,n=e.wasmModule,l=e.worker!==!1;if(!t&&!n)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(ae)throw new Error('Cannot call "initialize" more than once');return ae=dt(t||"",n,l),ae.catch(()=>{ae=void 0}),ae},dt=async(e,t,n)=>{let l;if(n){let w=new Blob(['onmessage=(postMessage=>{\n// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\nlet onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let f of Object.getOwnPropertyNames(r))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const r=()=>{const u=new Error("not implemented");return u.code="ENOSYS",u};if(!globalThis.fs){let u="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(i,s){u+=y.decode(s);const n=u.lastIndexOf(`\n`);return n!=-1&&(console.log(u.substring(0,n)),u=u.substring(n+1)),s.length},write(i,s,n,o,c,m){if(n!==0||o!==s.length||c!==null){m(r());return}const h=this.writeSync(i,s);m(null,h)},chmod(i,s,n){n(r())},chown(i,s,n,o){o(r())},close(i,s){s(r())},fchmod(i,s,n){n(r())},fchown(i,s,n,o){o(r())},fstat(i,s){s(r())},fsync(i,s){s(null)},ftruncate(i,s,n){n(r())},lchown(i,s,n,o){o(r())},link(i,s,n){n(r())},lstat(i,s){s(r())},mkdir(i,s,n){n(r())},open(i,s,n,o){o(r())},read(i,s,n,o,c,m){m(r())},readdir(i,s){s(r())},readlink(i,s){s(r())},rename(i,s,n){n(r())},rmdir(i,s){s(r())},stat(i,s){s(r())},symlink(i,s,n){n(r())},truncate(i,s,n){n(r())},unlink(i,s){s(r())},utimes(i,s,n,o){o(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const f=new TextEncoder("utf-8"),y=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const u=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},i=(e,t)=>{this.mem.setUint32(e+0,t,!0)},s=e=>{const t=this.mem.getUint32(e+0,!0),l=this.mem.getInt32(e+4,!0);return t+l*4294967296},n=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const l=this.mem.getUint32(e,!0);return this._values[l]},o=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;let g=0;switch(typeof t){case"object":t!==null&&(g=1);break;case"string":g=2;break;case"symbol":g=3;break;case"function":g=4;break}this.mem.setUint32(e+4,2146959360|g,!0),this.mem.setUint32(e,a,!0)},c=e=>{const t=s(e+0),l=s(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,l)},m=e=>{const t=s(e+0),l=s(e+8),a=new Array(l);for(let g=0;g<l;g++)a[g]=n(t+g*8);return a},h=e=>{const t=s(e+0),l=s(e+8);return y.decode(new DataView(this._inst.exports.mem.buffer,t,l))},d=Date.now()-performance.now();this.importObject={_gotest:{add:(e,t)=>e+t},gojs:{"runtime.wasmExit":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e=Number(e);const t=s(e+8),l=s(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,l,a))},"runtime.resetMemoryDataView":e=>{e=Number(e),this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e=Number(e),u(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e=Number(e);const t=new Date().getTime();u(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e=Number(e);const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},s(e+8))),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e=Number(e),crypto.getRandomValues(c(e+8))},"syscall/js.finalizeRef":e=>{e=Number(e);const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const l=this._values[t];this._values[t]=null,this._ids.delete(l),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e=Number(e),o(e+24,h(e+8))},"syscall/js.valueGet":e=>{e=Number(e);const t=Reflect.get(n(e+8),h(e+16));e=Number(this._inst.exports.getsp()),o(e+32,t)},"syscall/js.valueSet":e=>{e=Number(e),Reflect.set(n(e+8),h(e+16),n(e+32))},"syscall/js.valueDelete":e=>{e=Number(e),Reflect.deleteProperty(n(e+8),h(e+16))},"syscall/js.valueIndex":e=>{e=Number(e),o(e+24,Reflect.get(n(e+8),s(e+16)))},"syscall/js.valueSetIndex":e=>{e=Number(e),Reflect.set(n(e+8),s(e+16),n(e+24))},"syscall/js.valueCall":e=>{e=Number(e);try{const t=n(e+8),l=Reflect.get(t,h(e+16)),a=m(e+32),g=Reflect.apply(l,t,a);e=Number(this._inst.exports.getsp()),o(e+56,g),this.mem.setUint8(e+64,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.apply(t,void 0,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.construct(t,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e=Number(e),u(e+16,parseInt(n(e+8).length))},"syscall/js.valuePrepareString":e=>{e=Number(e);const t=f.encode(String(n(e+8)));o(e+16,t),u(e+24,t.length)},"syscall/js.valueLoadString":e=>{e=Number(e);const t=n(e+8);c(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e=Number(e),this.mem.setUint8(e+24,n(e+8)instanceof n(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e=Number(e);const t=c(e+8),l=n(e+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),u(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e=Number(e);const t=n(e+8),l=c(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),u(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(u){if(!(u instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=u,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let i=4096;const s=d=>{const e=i,t=f.encode(d+"\\0");return new Uint8Array(this.mem.buffer,i,t.length).set(t),i+=t.length,i%8!==0&&(i+=8-i%8),e},n=this.argv.length,o=[];this.argv.forEach(d=>{o.push(s(d))}),o.push(0),Object.keys(this.env).sort().forEach(d=>{o.push(s(`${d}=${this.env[d]}`))}),o.push(0);const m=i;o.forEach(d=>{this.mem.setUint32(i,d,!0),this.mem.setUint32(i+4,0,!0),i+=8});const h=4096+8192;if(i>=h)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,m),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(u){const i=this;return function(){const s={id:u,this:this,args:arguments};return i._pendingEvent=s,i._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,y=globalThis.fs,u="";y.writeSync=(c,m)=>{if(c===1)postMessage(m);else if(c===2){u+=f.decode(m);let h=u.split(`\n`);h.length>1&&console.log(h.slice(0,-1).join(`\n`)),u=h[h.length-1]}else throw new Error("Bad write");return m.length};let i=[],s,n=0;onmessage=({data:c})=>{c.length>0&&(i.push(c),s&&s())},y.read=(c,m,h,d,e,t)=>{if(c!==0||h!==0||d!==m.length||e!==null)throw new Error("Bad read");if(i.length===0){s=()=>y.read(c,m,h,d,e,t);return}let l=i[0],a=Math.max(0,Math.min(d,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(i.shift(),n=0),t(null,a)};let o=new globalThis.Go;o.argv=["","--service=0.18.8"],tryToInstantiateModule(r,o).then(c=>{postMessage(null),o.run(c)},c=>{postMessage(c)})};async function tryToInstantiateModule(r,f){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const y=await fetch(r);if(!y.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(y.headers.get("Content-Type")||""))return(await WebAssembly.instantiateStreaming(y,f.importObject)).instance;const u=await y.arrayBuffer();return(await WebAssembly.instantiate(u,f.importObject)).instance}return r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});l=new Worker(URL.createObjectURL(w))}else{let w=(postMessage=>{
13
+ ${m}:${w}:${x}: ERROR: ${F}${f.text}`}).join(""),i=new Error(`${e}${d}`);return i.errors=t,i.warnings=n,i}function oe(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function Ce(e,t){if(e==null)return null;let n={},l=r(e,n,"file",y),d=r(e,n,"namespace",y),i=r(e,n,"line",le),f=r(e,n,"column",le),o=r(e,n,"length",le),m=r(e,n,"lineText",y),w=r(e,n,"suggestion",y);return K(e,n,t),{file:l||"",namespace:d||"",line:i||0,column:f||0,length:o||0,lineText:m||"",suggestion:w||""}}function te(e,t,n,l){let d=[],i=0;for(let f of e){let o={},m=r(f,o,"id",y),w=r(f,o,"pluginName",y),x=r(f,o,"text",y),F=r(f,o,"location",Me),j=r(f,o,"notes",z),B=r(f,o,"detail",me),q=`in element ${i} of "${t}"`;K(f,o,q);let Q=[];if(j)for(let T of j){let W={},Y=r(T,W,"text",y),R=r(T,W,"location",Me);K(T,W,q),Q.push({text:Y||"",location:Ce(R,q)})}d.push({id:m||"",pluginName:w||l,text:x||"",location:Ce(F,q),notes:Q,detail:n?n.store(B):-1}),i++}return d}function ge(e,t){let n=[];for(let l of e){if(typeof l!="string")throw new Error(`${V(t)} must be an array of strings`);n.push(l)}return n}function Ze({path:e,contents:t}){let n=null;return{path:e,contents:t,get text(){let l=this.contents;return(n===null||l!==t)&&(t=l,n=re(l)),n}}}var tt="0.18.9",nt=e=>ce().build(e),rt=e=>ce().context(e),it=(e,t)=>ce().transform(e,t),lt=(e,t)=>ce().formatMessages(e,t),st=(e,t)=>ce().analyzeMetafile(e,t),ot=()=>{throw new Error('The "buildSync" API only works in node')},at=()=>{throw new Error('The "transformSync" API only works in node')},ut=()=>{throw new Error('The "formatMessagesSync" API only works in node')},ct=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ae,Oe,ce=()=>{if(Oe)return Oe;throw ae?new Error('You need to wait for the promise returned from "initialize" to be resolved before calling this'):new Error('You need to call "initialize" before calling this')},ft=e=>{e=Fe(e||{});let t=e.wasmURL,n=e.wasmModule,l=e.worker!==!1;if(!t&&!n)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(ae)throw new Error('Cannot call "initialize" more than once');return ae=dt(t||"",n,l),ae.catch(()=>{ae=void 0}),ae},dt=async(e,t,n)=>{let l;if(n){let w=new Blob(['onmessage=(postMessage=>{\n// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\nlet onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let f of Object.getOwnPropertyNames(r))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const r=()=>{const u=new Error("not implemented");return u.code="ENOSYS",u};if(!globalThis.fs){let u="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(i,s){u+=y.decode(s);const n=u.lastIndexOf(`\n`);return n!=-1&&(console.log(u.substring(0,n)),u=u.substring(n+1)),s.length},write(i,s,n,o,c,m){if(n!==0||o!==s.length||c!==null){m(r());return}const h=this.writeSync(i,s);m(null,h)},chmod(i,s,n){n(r())},chown(i,s,n,o){o(r())},close(i,s){s(r())},fchmod(i,s,n){n(r())},fchown(i,s,n,o){o(r())},fstat(i,s){s(r())},fsync(i,s){s(null)},ftruncate(i,s,n){n(r())},lchown(i,s,n,o){o(r())},link(i,s,n){n(r())},lstat(i,s){s(r())},mkdir(i,s,n){n(r())},open(i,s,n,o){o(r())},read(i,s,n,o,c,m){m(r())},readdir(i,s){s(r())},readlink(i,s){s(r())},rename(i,s,n){n(r())},rmdir(i,s){s(r())},stat(i,s){s(r())},symlink(i,s,n){n(r())},truncate(i,s,n){n(r())},unlink(i,s){s(r())},utimes(i,s,n,o){o(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const f=new TextEncoder("utf-8"),y=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const u=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},i=(e,t)=>{this.mem.setUint32(e+0,t,!0)},s=e=>{const t=this.mem.getUint32(e+0,!0),l=this.mem.getInt32(e+4,!0);return t+l*4294967296},n=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const l=this.mem.getUint32(e,!0);return this._values[l]},o=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;let g=0;switch(typeof t){case"object":t!==null&&(g=1);break;case"string":g=2;break;case"symbol":g=3;break;case"function":g=4;break}this.mem.setUint32(e+4,2146959360|g,!0),this.mem.setUint32(e,a,!0)},c=e=>{const t=s(e+0),l=s(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,l)},m=e=>{const t=s(e+0),l=s(e+8),a=new Array(l);for(let g=0;g<l;g++)a[g]=n(t+g*8);return a},h=e=>{const t=s(e+0),l=s(e+8);return y.decode(new DataView(this._inst.exports.mem.buffer,t,l))},d=Date.now()-performance.now();this.importObject={_gotest:{add:(e,t)=>e+t},gojs:{"runtime.wasmExit":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e=Number(e);const t=s(e+8),l=s(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,l,a))},"runtime.resetMemoryDataView":e=>{e=Number(e),this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e=Number(e),u(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e=Number(e);const t=new Date().getTime();u(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e=Number(e);const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},s(e+8))),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e=Number(e),crypto.getRandomValues(c(e+8))},"syscall/js.finalizeRef":e=>{e=Number(e);const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const l=this._values[t];this._values[t]=null,this._ids.delete(l),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e=Number(e),o(e+24,h(e+8))},"syscall/js.valueGet":e=>{e=Number(e);const t=Reflect.get(n(e+8),h(e+16));e=Number(this._inst.exports.getsp()),o(e+32,t)},"syscall/js.valueSet":e=>{e=Number(e),Reflect.set(n(e+8),h(e+16),n(e+32))},"syscall/js.valueDelete":e=>{e=Number(e),Reflect.deleteProperty(n(e+8),h(e+16))},"syscall/js.valueIndex":e=>{e=Number(e),o(e+24,Reflect.get(n(e+8),s(e+16)))},"syscall/js.valueSetIndex":e=>{e=Number(e),Reflect.set(n(e+8),s(e+16),n(e+24))},"syscall/js.valueCall":e=>{e=Number(e);try{const t=n(e+8),l=Reflect.get(t,h(e+16)),a=m(e+32),g=Reflect.apply(l,t,a);e=Number(this._inst.exports.getsp()),o(e+56,g),this.mem.setUint8(e+64,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.apply(t,void 0,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.construct(t,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e=Number(e),u(e+16,parseInt(n(e+8).length))},"syscall/js.valuePrepareString":e=>{e=Number(e);const t=f.encode(String(n(e+8)));o(e+16,t),u(e+24,t.length)},"syscall/js.valueLoadString":e=>{e=Number(e);const t=n(e+8);c(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e=Number(e),this.mem.setUint8(e+24,n(e+8)instanceof n(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e=Number(e);const t=c(e+8),l=n(e+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),u(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e=Number(e);const t=n(e+8),l=c(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),u(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(u){if(!(u instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=u,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let i=4096;const s=d=>{const e=i,t=f.encode(d+"\\0");return new Uint8Array(this.mem.buffer,i,t.length).set(t),i+=t.length,i%8!==0&&(i+=8-i%8),e},n=this.argv.length,o=[];this.argv.forEach(d=>{o.push(s(d))}),o.push(0),Object.keys(this.env).sort().forEach(d=>{o.push(s(`${d}=${this.env[d]}`))}),o.push(0);const m=i;o.forEach(d=>{this.mem.setUint32(i,d,!0),this.mem.setUint32(i+4,0,!0),i+=8});const h=4096+8192;if(i>=h)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,m),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(u){const i=this;return function(){const s={id:u,this:this,args:arguments};return i._pendingEvent=s,i._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,y=globalThis.fs,u="";y.writeSync=(c,m)=>{if(c===1)postMessage(m);else if(c===2){u+=f.decode(m);let h=u.split(`\n`);h.length>1&&console.log(h.slice(0,-1).join(`\n`)),u=h[h.length-1]}else throw new Error("Bad write");return m.length};let i=[],s,n=0;onmessage=({data:c})=>{c.length>0&&(i.push(c),s&&s())},y.read=(c,m,h,d,e,t)=>{if(c!==0||h!==0||d!==m.length||e!==null)throw new Error("Bad read");if(i.length===0){s=()=>y.read(c,m,h,d,e,t);return}let l=i[0],a=Math.max(0,Math.min(d,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(i.shift(),n=0),t(null,a)};let o=new globalThis.Go;o.argv=["","--service=0.18.9"],tryToInstantiateModule(r,o).then(c=>{postMessage(null),o.run(c)},c=>{postMessage(c)})};async function tryToInstantiateModule(r,f){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const y=await fetch(r);if(!y.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(y.headers.get("Content-Type")||""))return(await WebAssembly.instantiateStreaming(y,f.importObject)).instance;const u=await y.arrayBuffer();return(await WebAssembly.instantiate(u,f.importObject)).instance}return r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});l=new Worker(URL.createObjectURL(w))}else{let w=(postMessage=>{
14
14
  // Copyright 2018 The Go Authors. All rights reserved.
15
15
  // Use of this source code is governed by a BSD-style
16
16
  // license that can be found in the LICENSE file.
17
17
  let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let f of Object.getOwnPropertyNames(r))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const r=()=>{const u=new Error("not implemented");return u.code="ENOSYS",u};if(!globalThis.fs){let u="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(i,s){u+=y.decode(s);const n=u.lastIndexOf(`
18
18
  `);return n!=-1&&(console.log(u.substring(0,n)),u=u.substring(n+1)),s.length},write(i,s,n,o,c,m){if(n!==0||o!==s.length||c!==null){m(r());return}const h=this.writeSync(i,s);m(null,h)},chmod(i,s,n){n(r())},chown(i,s,n,o){o(r())},close(i,s){s(r())},fchmod(i,s,n){n(r())},fchown(i,s,n,o){o(r())},fstat(i,s){s(r())},fsync(i,s){s(null)},ftruncate(i,s,n){n(r())},lchown(i,s,n,o){o(r())},link(i,s,n){n(r())},lstat(i,s){s(r())},mkdir(i,s,n){n(r())},open(i,s,n,o){o(r())},read(i,s,n,o,c,m){m(r())},readdir(i,s){s(r())},readlink(i,s){s(r())},rename(i,s,n){n(r())},rmdir(i,s){s(r())},stat(i,s){s(r())},symlink(i,s,n){n(r())},truncate(i,s,n){n(r())},unlink(i,s){s(r())},utimes(i,s,n,o){o(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const f=new TextEncoder("utf-8"),y=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const u=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},i=(e,t)=>{this.mem.setUint32(e+0,t,!0)},s=e=>{const t=this.mem.getUint32(e+0,!0),l=this.mem.getInt32(e+4,!0);return t+l*4294967296},n=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const l=this.mem.getUint32(e,!0);return this._values[l]},o=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;let g=0;switch(typeof t){case"object":t!==null&&(g=1);break;case"string":g=2;break;case"symbol":g=3;break;case"function":g=4;break}this.mem.setUint32(e+4,2146959360|g,!0),this.mem.setUint32(e,a,!0)},c=e=>{const t=s(e+0),l=s(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,l)},m=e=>{const t=s(e+0),l=s(e+8),a=new Array(l);for(let g=0;g<l;g++)a[g]=n(t+g*8);return a},h=e=>{const t=s(e+0),l=s(e+8);return y.decode(new DataView(this._inst.exports.mem.buffer,t,l))},d=Date.now()-performance.now();this.importObject={_gotest:{add:(e,t)=>e+t},gojs:{"runtime.wasmExit":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e=Number(e);const t=s(e+8),l=s(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,l,a))},"runtime.resetMemoryDataView":e=>{e=Number(e),this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e=Number(e),u(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e=Number(e);const t=new Date().getTime();u(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e=Number(e);const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},s(e+8))),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e=Number(e),crypto.getRandomValues(c(e+8))},"syscall/js.finalizeRef":e=>{e=Number(e);const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const l=this._values[t];this._values[t]=null,this._ids.delete(l),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e=Number(e),o(e+24,h(e+8))},"syscall/js.valueGet":e=>{e=Number(e);const t=Reflect.get(n(e+8),h(e+16));e=Number(this._inst.exports.getsp()),o(e+32,t)},"syscall/js.valueSet":e=>{e=Number(e),Reflect.set(n(e+8),h(e+16),n(e+32))},"syscall/js.valueDelete":e=>{e=Number(e),Reflect.deleteProperty(n(e+8),h(e+16))},"syscall/js.valueIndex":e=>{e=Number(e),o(e+24,Reflect.get(n(e+8),s(e+16)))},"syscall/js.valueSetIndex":e=>{e=Number(e),Reflect.set(n(e+8),s(e+16),n(e+24))},"syscall/js.valueCall":e=>{e=Number(e);try{const t=n(e+8),l=Reflect.get(t,h(e+16)),a=m(e+32),g=Reflect.apply(l,t,a);e=Number(this._inst.exports.getsp()),o(e+56,g),this.mem.setUint8(e+64,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.apply(t,void 0,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.construct(t,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e=Number(e),u(e+16,parseInt(n(e+8).length))},"syscall/js.valuePrepareString":e=>{e=Number(e);const t=f.encode(String(n(e+8)));o(e+16,t),u(e+24,t.length)},"syscall/js.valueLoadString":e=>{e=Number(e);const t=n(e+8);c(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e=Number(e),this.mem.setUint8(e+24,n(e+8)instanceof n(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e=Number(e);const t=c(e+8),l=n(e+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),u(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e=Number(e);const t=n(e+8),l=c(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),u(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(u){if(!(u instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=u,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let i=4096;const s=d=>{const e=i,t=f.encode(d+"\0");return new Uint8Array(this.mem.buffer,i,t.length).set(t),i+=t.length,i%8!==0&&(i+=8-i%8),e},n=this.argv.length,o=[];this.argv.forEach(d=>{o.push(s(d))}),o.push(0),Object.keys(this.env).sort().forEach(d=>{o.push(s(`${d}=${this.env[d]}`))}),o.push(0);const m=i;o.forEach(d=>{this.mem.setUint32(i,d,!0),this.mem.setUint32(i+4,0,!0),i+=8});const h=4096+8192;if(i>=h)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,m),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(u){const i=this;return function(){const s={id:u,this:this,args:arguments};return i._pendingEvent=s,i._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,y=globalThis.fs,u="";y.writeSync=(c,m)=>{if(c===1)postMessage(m);else if(c===2){u+=f.decode(m);let h=u.split(`
19
19
  `);h.length>1&&console.log(h.slice(0,-1).join(`
20
- `)),u=h[h.length-1]}else throw new Error("Bad write");return m.length};let i=[],s,n=0;onmessage=({data:c})=>{c.length>0&&(i.push(c),s&&s())},y.read=(c,m,h,d,e,t)=>{if(c!==0||h!==0||d!==m.length||e!==null)throw new Error("Bad read");if(i.length===0){s=()=>y.read(c,m,h,d,e,t);return}let l=i[0],a=Math.max(0,Math.min(d,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(i.shift(),n=0),t(null,a)};let o=new globalThis.Go;o.argv=["","--service=0.18.8"],tryToInstantiateModule(r,o).then(c=>{postMessage(null),o.run(c)},c=>{postMessage(c)})};async function tryToInstantiateModule(r,f){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const y=await fetch(r);if(!y.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\/wasm($|;)/i.test(y.headers.get("Content-Type")||""))return(await WebAssembly.instantiateStreaming(y,f.importObject)).instance;const u=await y.arrayBuffer();return(await WebAssembly.instantiate(u,f.importObject)).instance}return r=>onmessage(r);})(x=>l.onmessage({data:x}));l={onmessage:null,postMessage:x=>setTimeout(()=>w({data:x})),terminate(){}}}let d,i,f=new Promise((w,x)=>{d=w,i=x});l.onmessage=({data:w})=>{l.onmessage=({data:x})=>o(x),w?i(w):d()},l.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:o,service:m}=Ue({writeToStdin(w){l.postMessage(w)},isSync:!1,hasFS:!1,esbuild:be});await f,Oe={build:w=>new Promise((x,F)=>m.buildOrContext({callName:"build",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(j,B)=>j?F(j):x(B)})),context:w=>new Promise((x,F)=>m.buildOrContext({callName:"context",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(j,B)=>j?F(j):x(B)})),transform:(w,x)=>new Promise((F,j)=>m.transform({callName:"transform",refs:null,input:w,options:x||{},isTTY:!1,fs:{readFile(B,q){q(new Error("Internal error"),null)},writeFile(B,q){q(null)}},callback:(B,q)=>B?j(B):F(q)})),formatMessages:(w,x)=>new Promise((F,j)=>m.formatMessages({callName:"formatMessages",refs:null,messages:w,options:x,callback:(B,q)=>B?j(B):F(q)})),analyzeMetafile:(w,x)=>new Promise((F,j)=>m.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof w=="string"?w:JSON.stringify(w),options:x,callback:(B,q)=>B?j(B):F(q)}))}},pt=be;export{st as analyzeMetafile,ct as analyzeMetafileSync,nt as build,ot as buildSync,rt as context,pt as default,lt as formatMessages,ut as formatMessagesSync,ft as initialize,it as transform,at as transformSync,tt as version};
20
+ `)),u=h[h.length-1]}else throw new Error("Bad write");return m.length};let i=[],s,n=0;onmessage=({data:c})=>{c.length>0&&(i.push(c),s&&s())},y.read=(c,m,h,d,e,t)=>{if(c!==0||h!==0||d!==m.length||e!==null)throw new Error("Bad read");if(i.length===0){s=()=>y.read(c,m,h,d,e,t);return}let l=i[0],a=Math.max(0,Math.min(d,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(i.shift(),n=0),t(null,a)};let o=new globalThis.Go;o.argv=["","--service=0.18.9"],tryToInstantiateModule(r,o).then(c=>{postMessage(null),o.run(c)},c=>{postMessage(c)})};async function tryToInstantiateModule(r,f){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const y=await fetch(r);if(!y.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\/wasm($|;)/i.test(y.headers.get("Content-Type")||""))return(await WebAssembly.instantiateStreaming(y,f.importObject)).instance;const u=await y.arrayBuffer();return(await WebAssembly.instantiate(u,f.importObject)).instance}return r=>onmessage(r);})(x=>l.onmessage({data:x}));l={onmessage:null,postMessage:x=>setTimeout(()=>w({data:x})),terminate(){}}}let d,i,f=new Promise((w,x)=>{d=w,i=x});l.onmessage=({data:w})=>{l.onmessage=({data:x})=>o(x),w?i(w):d()},l.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:o,service:m}=Ue({writeToStdin(w){l.postMessage(w)},isSync:!1,hasFS:!1,esbuild:be});await f,Oe={build:w=>new Promise((x,F)=>m.buildOrContext({callName:"build",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(j,B)=>j?F(j):x(B)})),context:w=>new Promise((x,F)=>m.buildOrContext({callName:"context",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(j,B)=>j?F(j):x(B)})),transform:(w,x)=>new Promise((F,j)=>m.transform({callName:"transform",refs:null,input:w,options:x||{},isTTY:!1,fs:{readFile(B,q){q(new Error("Internal error"),null)},writeFile(B,q){q(null)}},callback:(B,q)=>B?j(B):F(q)})),formatMessages:(w,x)=>new Promise((F,j)=>m.formatMessages({callName:"formatMessages",refs:null,messages:w,options:x,callback:(B,q)=>B?j(B):F(q)})),analyzeMetafile:(w,x)=>new Promise((F,j)=>m.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof w=="string"?w:JSON.stringify(w),options:x,callback:(B,q)=>B?j(B):F(q)}))}},pt=be;export{st as analyzeMetafile,ct as analyzeMetafileSync,nt as build,ot as buildSync,rt as context,pt as default,lt as formatMessages,ut as formatMessagesSync,ft as initialize,it as transform,at as transformSync,tt as version};
package/lib/browser.js CHANGED
@@ -749,8 +749,8 @@ function createChannel(streamIn) {
749
749
  if (isFirstPacket) {
750
750
  isFirstPacket = false;
751
751
  let binaryVersion = String.fromCharCode(...bytes);
752
- if (binaryVersion !== "0.18.8") {
753
- throw new Error(`Cannot start service: Host version "${"0.18.8"}" does not match binary version ${quote(binaryVersion)}`);
752
+ if (binaryVersion !== "0.18.9") {
753
+ throw new Error(`Cannot start service: Host version "${"0.18.9"}" does not match binary version ${quote(binaryVersion)}`);
754
754
  }
755
755
  return;
756
756
  }
@@ -1744,7 +1744,7 @@ function convertOutputFiles({ path, contents }) {
1744
1744
  }
1745
1745
 
1746
1746
  // lib/npm/browser.ts
1747
- var version = "0.18.8";
1747
+ var version = "0.18.9";
1748
1748
  var build = (options) => ensureServiceIsRunning().build(options);
1749
1749
  var context = (options) => ensureServiceIsRunning().context(options);
1750
1750
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -1789,7 +1789,7 @@ var initialize = (options) => {
1789
1789
  var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, null, function* () {
1790
1790
  let worker;
1791
1791
  if (useWorker) {
1792
- let blob = new Blob([`onmessage=${'((postMessage) => {\n // Copyright 2018 The Go Authors. All rights reserved.\n // Use of this source code is governed by a BSD-style\n // license that can be found in the LICENSE file.\n var __async = (__this, __arguments, generator) => {\n return new Promise((resolve, reject) => {\n var fulfilled = (value) => {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n };\n var rejected = (value) => {\n try {\n step(generator.throw(value));\n } catch (e) {\n reject(e);\n }\n };\n var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);\n step((generator = generator.apply(__this, __arguments)).next());\n });\n };\n let onmessage;\n let globalThis = {};\n for (let o = self; o; o = Object.getPrototypeOf(o))\n for (let k of Object.getOwnPropertyNames(o))\n if (!(k in globalThis))\n Object.defineProperty(globalThis, k, { get: () => self[k] });\n "use strict";\n (() => {\n const enosys = () => {\n const err = new Error("not implemented");\n err.code = "ENOSYS";\n return err;\n };\n if (!globalThis.fs) {\n let outputBuf = "";\n globalThis.fs = {\n constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 },\n // unused\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substring(0, nl));\n outputBuf = outputBuf.substring(nl + 1);\n }\n return buf.length;\n },\n write(fd, buf, offset, length, position, callback) {\n if (offset !== 0 || length !== buf.length || position !== null) {\n callback(enosys());\n return;\n }\n const n = this.writeSync(fd, buf);\n callback(null, n);\n },\n chmod(path, mode, callback) {\n callback(enosys());\n },\n chown(path, uid, gid, callback) {\n callback(enosys());\n },\n close(fd, callback) {\n callback(enosys());\n },\n fchmod(fd, mode, callback) {\n callback(enosys());\n },\n fchown(fd, uid, gid, callback) {\n callback(enosys());\n },\n fstat(fd, callback) {\n callback(enosys());\n },\n fsync(fd, callback) {\n callback(null);\n },\n ftruncate(fd, length, callback) {\n callback(enosys());\n },\n lchown(path, uid, gid, callback) {\n callback(enosys());\n },\n link(path, link, callback) {\n callback(enosys());\n },\n lstat(path, callback) {\n callback(enosys());\n },\n mkdir(path, perm, callback) {\n callback(enosys());\n },\n open(path, flags, mode, callback) {\n callback(enosys());\n },\n read(fd, buffer, offset, length, position, callback) {\n callback(enosys());\n },\n readdir(path, callback) {\n callback(enosys());\n },\n readlink(path, callback) {\n callback(enosys());\n },\n rename(from, to, callback) {\n callback(enosys());\n },\n rmdir(path, callback) {\n callback(enosys());\n },\n stat(path, callback) {\n callback(enosys());\n },\n symlink(path, link, callback) {\n callback(enosys());\n },\n truncate(path, length, callback) {\n callback(enosys());\n },\n unlink(path, callback) {\n callback(enosys());\n },\n utimes(path, atime, mtime, callback) {\n callback(enosys());\n }\n };\n }\n if (!globalThis.process) {\n globalThis.process = {\n getuid() {\n return -1;\n },\n getgid() {\n return -1;\n },\n geteuid() {\n return -1;\n },\n getegid() {\n return -1;\n },\n getgroups() {\n throw enosys();\n },\n pid: -1,\n ppid: -1,\n umask() {\n throw enosys();\n },\n cwd() {\n throw enosys();\n },\n chdir() {\n throw enosys();\n }\n };\n }\n if (!globalThis.crypto) {\n throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");\n }\n if (!globalThis.performance) {\n throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");\n }\n if (!globalThis.TextEncoder) {\n throw new Error("globalThis.TextEncoder is not available, polyfill required");\n }\n if (!globalThis.TextDecoder) {\n throw new Error("globalThis.TextDecoder is not available, polyfill required");\n }\n const encoder = new TextEncoder("utf-8");\n const decoder = new TextDecoder("utf-8");\n globalThis.Go = class {\n constructor() {\n this.argv = ["js"];\n this.env = {};\n this.exit = (code) => {\n if (code !== 0) {\n console.warn("exit code:", code);\n }\n };\n this._exitPromise = new Promise((resolve) => {\n this._resolveExitPromise = resolve;\n });\n this._pendingEvent = null;\n this._scheduledTimeouts = /* @__PURE__ */ new Map();\n this._nextCallbackTimeoutID = 1;\n const setInt64 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);\n };\n const setInt32 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n };\n const getInt64 = (addr) => {\n const low = this.mem.getUint32(addr + 0, true);\n const high = this.mem.getInt32(addr + 4, true);\n return low + high * 4294967296;\n };\n const loadValue = (addr) => {\n const f = this.mem.getFloat64(addr, true);\n if (f === 0) {\n return void 0;\n }\n if (!isNaN(f)) {\n return f;\n }\n const id = this.mem.getUint32(addr, true);\n return this._values[id];\n };\n const storeValue = (addr, v) => {\n const nanHead = 2146959360;\n if (typeof v === "number" && v !== 0) {\n if (isNaN(v)) {\n this.mem.setUint32(addr + 4, nanHead, true);\n this.mem.setUint32(addr, 0, true);\n return;\n }\n this.mem.setFloat64(addr, v, true);\n return;\n }\n if (v === void 0) {\n this.mem.setFloat64(addr, 0, true);\n return;\n }\n let id = this._ids.get(v);\n if (id === void 0) {\n id = this._idPool.pop();\n if (id === void 0) {\n id = this._values.length;\n }\n this._values[id] = v;\n this._goRefCounts[id] = 0;\n this._ids.set(v, id);\n }\n this._goRefCounts[id]++;\n let typeFlag = 0;\n switch (typeof v) {\n case "object":\n if (v !== null) {\n typeFlag = 1;\n }\n break;\n case "string":\n typeFlag = 2;\n break;\n case "symbol":\n typeFlag = 3;\n break;\n case "function":\n typeFlag = 4;\n break;\n }\n this.mem.setUint32(addr + 4, nanHead | typeFlag, true);\n this.mem.setUint32(addr, id, true);\n };\n const loadSlice = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return new Uint8Array(this._inst.exports.mem.buffer, array, len);\n };\n const loadSliceOfValues = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n const a = new Array(len);\n for (let i = 0; i < len; i++) {\n a[i] = loadValue(array + i * 8);\n }\n return a;\n };\n const loadString = (addr) => {\n const saddr = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));\n };\n const timeOrigin = Date.now() - performance.now();\n this.importObject = {\n _gotest: {\n add: (a, b) => a + b\n },\n gojs: {\n // Go\'s SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)\n // may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported\n // function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).\n // This changes the SP, thus we have to update the SP used by the imported function.\n // func wasmExit(code int32)\n "runtime.wasmExit": (sp) => {\n sp = Number(sp);\n const code = this.mem.getInt32(sp + 8, true);\n this.exited = true;\n delete this._inst;\n delete this._values;\n delete this._goRefCounts;\n delete this._ids;\n delete this._idPool;\n this.exit(code);\n },\n // func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)\n "runtime.wasmWrite": (sp) => {\n sp = Number(sp);\n const fd = getInt64(sp + 8);\n const p = getInt64(sp + 16);\n const n = this.mem.getInt32(sp + 24, true);\n globalThis.fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));\n },\n // func resetMemoryDataView()\n "runtime.resetMemoryDataView": (sp) => {\n sp = Number(sp);\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n // func nanotime1() int64\n "runtime.nanotime1": (sp) => {\n sp = Number(sp);\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n // func walltime() (sec int64, nsec int32)\n "runtime.walltime": (sp) => {\n sp = Number(sp);\n const msec = (/* @__PURE__ */ new Date()).getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n // func scheduleTimeoutEvent(delay int64) int32\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(\n () => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n },\n getInt64(sp + 8)\n ));\n this.mem.setInt32(sp + 16, id, true);\n },\n // func clearTimeoutEvent(id int32)\n "runtime.clearTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n // func getRandomData(r []byte)\n "runtime.getRandomData": (sp) => {\n sp = Number(sp);\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n // func finalizeRef(v ref)\n "syscall/js.finalizeRef": (sp) => {\n sp = Number(sp);\n const id = this.mem.getUint32(sp + 8, true);\n this._goRefCounts[id]--;\n if (this._goRefCounts[id] === 0) {\n const v = this._values[id];\n this._values[id] = null;\n this._ids.delete(v);\n this._idPool.push(id);\n }\n },\n // func stringVal(value string) ref\n "syscall/js.stringVal": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, loadString(sp + 8));\n },\n // func valueGet(v ref, p string) ref\n "syscall/js.valueGet": (sp) => {\n sp = Number(sp);\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 32, result);\n },\n // func valueSet(v ref, p string, x ref)\n "syscall/js.valueSet": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n // func valueDelete(v ref, p string)\n "syscall/js.valueDelete": (sp) => {\n sp = Number(sp);\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n // func valueIndex(v ref, i int) ref\n "syscall/js.valueIndex": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n // valueSetIndex(v ref, i int, x ref)\n "syscall/js.valueSetIndex": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n // func valueCall(v ref, m string, args []ref) (ref, bool)\n "syscall/js.valueCall": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const m = Reflect.get(v, loadString(sp + 16));\n const args = loadSliceOfValues(sp + 32);\n const result = Reflect.apply(m, v, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n // func valueInvoke(v ref, args []ref) (ref, bool)\n "syscall/js.valueInvoke": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.apply(v, void 0, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueNew(v ref, args []ref) (ref, bool)\n "syscall/js.valueNew": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueLength(v ref) int\n "syscall/js.valueLength": (sp) => {\n sp = Number(sp);\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n // valuePrepareString(v ref) (ref, int)\n "syscall/js.valuePrepareString": (sp) => {\n sp = Number(sp);\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n // valueLoadString(v ref, b []byte)\n "syscall/js.valueLoadString": (sp) => {\n sp = Number(sp);\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n // func valueInstanceOf(v ref, t ref) bool\n "syscall/js.valueInstanceOf": (sp) => {\n sp = Number(sp);\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n // func copyBytesToGo(dst []byte, src ref) (int, bool)\n "syscall/js.copyBytesToGo": (sp) => {\n sp = Number(sp);\n const dst = loadSlice(sp + 8);\n const src = loadValue(sp + 32);\n if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n // func copyBytesToJS(dst ref, src []byte) (int, bool)\n "syscall/js.copyBytesToJS": (sp) => {\n sp = Number(sp);\n const dst = loadValue(sp + 8);\n const src = loadSlice(sp + 16);\n if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "debug": (value) => {\n console.log(value);\n }\n }\n };\n }\n run(instance) {\n return __async(this, null, function* () {\n if (!(instance instanceof WebAssembly.Instance)) {\n throw new Error("Go.run: WebAssembly.Instance expected");\n }\n this._inst = instance;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n this._values = [\n // JS values that Go currently has references to, indexed by reference id\n NaN,\n 0,\n null,\n true,\n false,\n globalThis,\n this\n ];\n this._goRefCounts = new Array(this._values.length).fill(Infinity);\n this._ids = /* @__PURE__ */ new Map([\n // mapping from JS values to reference ids\n [0, 1],\n [null, 2],\n [true, 3],\n [false, 4],\n [globalThis, 5],\n [this, 6]\n ]);\n this._idPool = [];\n this.exited = false;\n let offset = 4096;\n const strPtr = (str) => {\n const ptr = offset;\n const bytes = encoder.encode(str + "\\0");\n new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);\n offset += bytes.length;\n if (offset % 8 !== 0) {\n offset += 8 - offset % 8;\n }\n return ptr;\n };\n const argc = this.argv.length;\n const argvPtrs = [];\n this.argv.forEach((arg) => {\n argvPtrs.push(strPtr(arg));\n });\n argvPtrs.push(0);\n const keys = Object.keys(this.env).sort();\n keys.forEach((key) => {\n argvPtrs.push(strPtr(`${key}=${this.env[key]}`));\n });\n argvPtrs.push(0);\n const argv = offset;\n argvPtrs.forEach((ptr) => {\n this.mem.setUint32(offset, ptr, true);\n this.mem.setUint32(offset + 4, 0, true);\n offset += 8;\n });\n const wasmMinDataAddr = 4096 + 8192;\n if (offset >= wasmMinDataAddr) {\n throw new Error("total length of command line and environment variables exceeds limit");\n }\n this._inst.exports.run(argc, argv);\n if (this.exited) {\n this._resolveExitPromise();\n }\n yield this._exitPromise;\n });\n }\n _resume() {\n if (this.exited) {\n throw new Error("Go program has already exited");\n }\n this._inst.exports.resume();\n if (this.exited) {\n this._resolveExitPromise();\n }\n }\n _makeFuncWrapper(id) {\n const go = this;\n return function() {\n const event = { id, this: this, args: arguments };\n go._pendingEvent = event;\n go._resume();\n return event.result;\n };\n }\n };\n })();\n onmessage = ({ data: wasm }) => {\n let decoder = new TextDecoder();\n let fs = globalThis.fs;\n let stderr = "";\n fs.writeSync = (fd, buffer) => {\n if (fd === 1) {\n postMessage(buffer);\n } else if (fd === 2) {\n stderr += decoder.decode(buffer);\n let parts = stderr.split("\\n");\n if (parts.length > 1)\n console.log(parts.slice(0, -1).join("\\n"));\n stderr = parts[parts.length - 1];\n } else {\n throw new Error("Bad write");\n }\n return buffer.length;\n };\n let stdin = [];\n let resumeStdin;\n let stdinPos = 0;\n onmessage = ({ data }) => {\n if (data.length > 0) {\n stdin.push(data);\n if (resumeStdin)\n resumeStdin();\n }\n };\n fs.read = (fd, buffer, offset, length, position, callback) => {\n if (fd !== 0 || offset !== 0 || length !== buffer.length || position !== null) {\n throw new Error("Bad read");\n }\n if (stdin.length === 0) {\n resumeStdin = () => fs.read(fd, buffer, offset, length, position, callback);\n return;\n }\n let first = stdin[0];\n let count = Math.max(0, Math.min(length, first.length - stdinPos));\n buffer.set(first.subarray(stdinPos, stdinPos + count), offset);\n stdinPos += count;\n if (stdinPos === first.length) {\n stdin.shift();\n stdinPos = 0;\n }\n callback(null, count);\n };\n let go = new globalThis.Go();\n go.argv = ["", `--service=${"0.18.8"}`];\n tryToInstantiateModule(wasm, go).then(\n (instance) => {\n postMessage(null);\n go.run(instance);\n },\n (error) => {\n postMessage(error);\n }\n );\n };\n function tryToInstantiateModule(wasm, go) {\n return __async(this, null, function* () {\n if (wasm instanceof WebAssembly.Module) {\n return WebAssembly.instantiate(wasm, go.importObject);\n }\n const res = yield fetch(wasm);\n if (!res.ok)\n throw new Error(`Failed to download ${JSON.stringify(wasm)}`);\n if ("instantiateStreaming" in WebAssembly && /^application\\/wasm($|;)/i.test(res.headers.get("Content-Type") || "")) {\n const result2 = yield WebAssembly.instantiateStreaming(res, go.importObject);\n return result2.instance;\n }\n const bytes = yield res.arrayBuffer();\n const result = yield WebAssembly.instantiate(bytes, go.importObject);\n return result.instance;\n });\n }\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
1792
+ let blob = new Blob([`onmessage=${'((postMessage) => {\n // Copyright 2018 The Go Authors. All rights reserved.\n // Use of this source code is governed by a BSD-style\n // license that can be found in the LICENSE file.\n var __async = (__this, __arguments, generator) => {\n return new Promise((resolve, reject) => {\n var fulfilled = (value) => {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n };\n var rejected = (value) => {\n try {\n step(generator.throw(value));\n } catch (e) {\n reject(e);\n }\n };\n var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);\n step((generator = generator.apply(__this, __arguments)).next());\n });\n };\n let onmessage;\n let globalThis = {};\n for (let o = self; o; o = Object.getPrototypeOf(o))\n for (let k of Object.getOwnPropertyNames(o))\n if (!(k in globalThis))\n Object.defineProperty(globalThis, k, { get: () => self[k] });\n "use strict";\n (() => {\n const enosys = () => {\n const err = new Error("not implemented");\n err.code = "ENOSYS";\n return err;\n };\n if (!globalThis.fs) {\n let outputBuf = "";\n globalThis.fs = {\n constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 },\n // unused\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substring(0, nl));\n outputBuf = outputBuf.substring(nl + 1);\n }\n return buf.length;\n },\n write(fd, buf, offset, length, position, callback) {\n if (offset !== 0 || length !== buf.length || position !== null) {\n callback(enosys());\n return;\n }\n const n = this.writeSync(fd, buf);\n callback(null, n);\n },\n chmod(path, mode, callback) {\n callback(enosys());\n },\n chown(path, uid, gid, callback) {\n callback(enosys());\n },\n close(fd, callback) {\n callback(enosys());\n },\n fchmod(fd, mode, callback) {\n callback(enosys());\n },\n fchown(fd, uid, gid, callback) {\n callback(enosys());\n },\n fstat(fd, callback) {\n callback(enosys());\n },\n fsync(fd, callback) {\n callback(null);\n },\n ftruncate(fd, length, callback) {\n callback(enosys());\n },\n lchown(path, uid, gid, callback) {\n callback(enosys());\n },\n link(path, link, callback) {\n callback(enosys());\n },\n lstat(path, callback) {\n callback(enosys());\n },\n mkdir(path, perm, callback) {\n callback(enosys());\n },\n open(path, flags, mode, callback) {\n callback(enosys());\n },\n read(fd, buffer, offset, length, position, callback) {\n callback(enosys());\n },\n readdir(path, callback) {\n callback(enosys());\n },\n readlink(path, callback) {\n callback(enosys());\n },\n rename(from, to, callback) {\n callback(enosys());\n },\n rmdir(path, callback) {\n callback(enosys());\n },\n stat(path, callback) {\n callback(enosys());\n },\n symlink(path, link, callback) {\n callback(enosys());\n },\n truncate(path, length, callback) {\n callback(enosys());\n },\n unlink(path, callback) {\n callback(enosys());\n },\n utimes(path, atime, mtime, callback) {\n callback(enosys());\n }\n };\n }\n if (!globalThis.process) {\n globalThis.process = {\n getuid() {\n return -1;\n },\n getgid() {\n return -1;\n },\n geteuid() {\n return -1;\n },\n getegid() {\n return -1;\n },\n getgroups() {\n throw enosys();\n },\n pid: -1,\n ppid: -1,\n umask() {\n throw enosys();\n },\n cwd() {\n throw enosys();\n },\n chdir() {\n throw enosys();\n }\n };\n }\n if (!globalThis.crypto) {\n throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");\n }\n if (!globalThis.performance) {\n throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");\n }\n if (!globalThis.TextEncoder) {\n throw new Error("globalThis.TextEncoder is not available, polyfill required");\n }\n if (!globalThis.TextDecoder) {\n throw new Error("globalThis.TextDecoder is not available, polyfill required");\n }\n const encoder = new TextEncoder("utf-8");\n const decoder = new TextDecoder("utf-8");\n globalThis.Go = class {\n constructor() {\n this.argv = ["js"];\n this.env = {};\n this.exit = (code) => {\n if (code !== 0) {\n console.warn("exit code:", code);\n }\n };\n this._exitPromise = new Promise((resolve) => {\n this._resolveExitPromise = resolve;\n });\n this._pendingEvent = null;\n this._scheduledTimeouts = /* @__PURE__ */ new Map();\n this._nextCallbackTimeoutID = 1;\n const setInt64 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);\n };\n const setInt32 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n };\n const getInt64 = (addr) => {\n const low = this.mem.getUint32(addr + 0, true);\n const high = this.mem.getInt32(addr + 4, true);\n return low + high * 4294967296;\n };\n const loadValue = (addr) => {\n const f = this.mem.getFloat64(addr, true);\n if (f === 0) {\n return void 0;\n }\n if (!isNaN(f)) {\n return f;\n }\n const id = this.mem.getUint32(addr, true);\n return this._values[id];\n };\n const storeValue = (addr, v) => {\n const nanHead = 2146959360;\n if (typeof v === "number" && v !== 0) {\n if (isNaN(v)) {\n this.mem.setUint32(addr + 4, nanHead, true);\n this.mem.setUint32(addr, 0, true);\n return;\n }\n this.mem.setFloat64(addr, v, true);\n return;\n }\n if (v === void 0) {\n this.mem.setFloat64(addr, 0, true);\n return;\n }\n let id = this._ids.get(v);\n if (id === void 0) {\n id = this._idPool.pop();\n if (id === void 0) {\n id = this._values.length;\n }\n this._values[id] = v;\n this._goRefCounts[id] = 0;\n this._ids.set(v, id);\n }\n this._goRefCounts[id]++;\n let typeFlag = 0;\n switch (typeof v) {\n case "object":\n if (v !== null) {\n typeFlag = 1;\n }\n break;\n case "string":\n typeFlag = 2;\n break;\n case "symbol":\n typeFlag = 3;\n break;\n case "function":\n typeFlag = 4;\n break;\n }\n this.mem.setUint32(addr + 4, nanHead | typeFlag, true);\n this.mem.setUint32(addr, id, true);\n };\n const loadSlice = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return new Uint8Array(this._inst.exports.mem.buffer, array, len);\n };\n const loadSliceOfValues = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n const a = new Array(len);\n for (let i = 0; i < len; i++) {\n a[i] = loadValue(array + i * 8);\n }\n return a;\n };\n const loadString = (addr) => {\n const saddr = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));\n };\n const timeOrigin = Date.now() - performance.now();\n this.importObject = {\n _gotest: {\n add: (a, b) => a + b\n },\n gojs: {\n // Go\'s SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)\n // may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported\n // function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).\n // This changes the SP, thus we have to update the SP used by the imported function.\n // func wasmExit(code int32)\n "runtime.wasmExit": (sp) => {\n sp = Number(sp);\n const code = this.mem.getInt32(sp + 8, true);\n this.exited = true;\n delete this._inst;\n delete this._values;\n delete this._goRefCounts;\n delete this._ids;\n delete this._idPool;\n this.exit(code);\n },\n // func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)\n "runtime.wasmWrite": (sp) => {\n sp = Number(sp);\n const fd = getInt64(sp + 8);\n const p = getInt64(sp + 16);\n const n = this.mem.getInt32(sp + 24, true);\n globalThis.fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));\n },\n // func resetMemoryDataView()\n "runtime.resetMemoryDataView": (sp) => {\n sp = Number(sp);\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n // func nanotime1() int64\n "runtime.nanotime1": (sp) => {\n sp = Number(sp);\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n // func walltime() (sec int64, nsec int32)\n "runtime.walltime": (sp) => {\n sp = Number(sp);\n const msec = (/* @__PURE__ */ new Date()).getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n // func scheduleTimeoutEvent(delay int64) int32\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(\n () => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n },\n getInt64(sp + 8)\n ));\n this.mem.setInt32(sp + 16, id, true);\n },\n // func clearTimeoutEvent(id int32)\n "runtime.clearTimeoutEvent": (sp) => {\n sp = Number(sp);\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n // func getRandomData(r []byte)\n "runtime.getRandomData": (sp) => {\n sp = Number(sp);\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n // func finalizeRef(v ref)\n "syscall/js.finalizeRef": (sp) => {\n sp = Number(sp);\n const id = this.mem.getUint32(sp + 8, true);\n this._goRefCounts[id]--;\n if (this._goRefCounts[id] === 0) {\n const v = this._values[id];\n this._values[id] = null;\n this._ids.delete(v);\n this._idPool.push(id);\n }\n },\n // func stringVal(value string) ref\n "syscall/js.stringVal": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, loadString(sp + 8));\n },\n // func valueGet(v ref, p string) ref\n "syscall/js.valueGet": (sp) => {\n sp = Number(sp);\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 32, result);\n },\n // func valueSet(v ref, p string, x ref)\n "syscall/js.valueSet": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n // func valueDelete(v ref, p string)\n "syscall/js.valueDelete": (sp) => {\n sp = Number(sp);\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n // func valueIndex(v ref, i int) ref\n "syscall/js.valueIndex": (sp) => {\n sp = Number(sp);\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n // valueSetIndex(v ref, i int, x ref)\n "syscall/js.valueSetIndex": (sp) => {\n sp = Number(sp);\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n // func valueCall(v ref, m string, args []ref) (ref, bool)\n "syscall/js.valueCall": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const m = Reflect.get(v, loadString(sp + 16));\n const args = loadSliceOfValues(sp + 32);\n const result = Reflect.apply(m, v, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n // func valueInvoke(v ref, args []ref) (ref, bool)\n "syscall/js.valueInvoke": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.apply(v, void 0, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueNew(v ref, args []ref) (ref, bool)\n "syscall/js.valueNew": (sp) => {\n sp = Number(sp);\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = Number(this._inst.exports.getsp());\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueLength(v ref) int\n "syscall/js.valueLength": (sp) => {\n sp = Number(sp);\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n // valuePrepareString(v ref) (ref, int)\n "syscall/js.valuePrepareString": (sp) => {\n sp = Number(sp);\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n // valueLoadString(v ref, b []byte)\n "syscall/js.valueLoadString": (sp) => {\n sp = Number(sp);\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n // func valueInstanceOf(v ref, t ref) bool\n "syscall/js.valueInstanceOf": (sp) => {\n sp = Number(sp);\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n // func copyBytesToGo(dst []byte, src ref) (int, bool)\n "syscall/js.copyBytesToGo": (sp) => {\n sp = Number(sp);\n const dst = loadSlice(sp + 8);\n const src = loadValue(sp + 32);\n if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n // func copyBytesToJS(dst ref, src []byte) (int, bool)\n "syscall/js.copyBytesToJS": (sp) => {\n sp = Number(sp);\n const dst = loadValue(sp + 8);\n const src = loadSlice(sp + 16);\n if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "debug": (value) => {\n console.log(value);\n }\n }\n };\n }\n run(instance) {\n return __async(this, null, function* () {\n if (!(instance instanceof WebAssembly.Instance)) {\n throw new Error("Go.run: WebAssembly.Instance expected");\n }\n this._inst = instance;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n this._values = [\n // JS values that Go currently has references to, indexed by reference id\n NaN,\n 0,\n null,\n true,\n false,\n globalThis,\n this\n ];\n this._goRefCounts = new Array(this._values.length).fill(Infinity);\n this._ids = /* @__PURE__ */ new Map([\n // mapping from JS values to reference ids\n [0, 1],\n [null, 2],\n [true, 3],\n [false, 4],\n [globalThis, 5],\n [this, 6]\n ]);\n this._idPool = [];\n this.exited = false;\n let offset = 4096;\n const strPtr = (str) => {\n const ptr = offset;\n const bytes = encoder.encode(str + "\\0");\n new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);\n offset += bytes.length;\n if (offset % 8 !== 0) {\n offset += 8 - offset % 8;\n }\n return ptr;\n };\n const argc = this.argv.length;\n const argvPtrs = [];\n this.argv.forEach((arg) => {\n argvPtrs.push(strPtr(arg));\n });\n argvPtrs.push(0);\n const keys = Object.keys(this.env).sort();\n keys.forEach((key) => {\n argvPtrs.push(strPtr(`${key}=${this.env[key]}`));\n });\n argvPtrs.push(0);\n const argv = offset;\n argvPtrs.forEach((ptr) => {\n this.mem.setUint32(offset, ptr, true);\n this.mem.setUint32(offset + 4, 0, true);\n offset += 8;\n });\n const wasmMinDataAddr = 4096 + 8192;\n if (offset >= wasmMinDataAddr) {\n throw new Error("total length of command line and environment variables exceeds limit");\n }\n this._inst.exports.run(argc, argv);\n if (this.exited) {\n this._resolveExitPromise();\n }\n yield this._exitPromise;\n });\n }\n _resume() {\n if (this.exited) {\n throw new Error("Go program has already exited");\n }\n this._inst.exports.resume();\n if (this.exited) {\n this._resolveExitPromise();\n }\n }\n _makeFuncWrapper(id) {\n const go = this;\n return function() {\n const event = { id, this: this, args: arguments };\n go._pendingEvent = event;\n go._resume();\n return event.result;\n };\n }\n };\n })();\n onmessage = ({ data: wasm }) => {\n let decoder = new TextDecoder();\n let fs = globalThis.fs;\n let stderr = "";\n fs.writeSync = (fd, buffer) => {\n if (fd === 1) {\n postMessage(buffer);\n } else if (fd === 2) {\n stderr += decoder.decode(buffer);\n let parts = stderr.split("\\n");\n if (parts.length > 1)\n console.log(parts.slice(0, -1).join("\\n"));\n stderr = parts[parts.length - 1];\n } else {\n throw new Error("Bad write");\n }\n return buffer.length;\n };\n let stdin = [];\n let resumeStdin;\n let stdinPos = 0;\n onmessage = ({ data }) => {\n if (data.length > 0) {\n stdin.push(data);\n if (resumeStdin)\n resumeStdin();\n }\n };\n fs.read = (fd, buffer, offset, length, position, callback) => {\n if (fd !== 0 || offset !== 0 || length !== buffer.length || position !== null) {\n throw new Error("Bad read");\n }\n if (stdin.length === 0) {\n resumeStdin = () => fs.read(fd, buffer, offset, length, position, callback);\n return;\n }\n let first = stdin[0];\n let count = Math.max(0, Math.min(length, first.length - stdinPos));\n buffer.set(first.subarray(stdinPos, stdinPos + count), offset);\n stdinPos += count;\n if (stdinPos === first.length) {\n stdin.shift();\n stdinPos = 0;\n }\n callback(null, count);\n };\n let go = new globalThis.Go();\n go.argv = ["", `--service=${"0.18.9"}`];\n tryToInstantiateModule(wasm, go).then(\n (instance) => {\n postMessage(null);\n go.run(instance);\n },\n (error) => {\n postMessage(error);\n }\n );\n };\n function tryToInstantiateModule(wasm, go) {\n return __async(this, null, function* () {\n if (wasm instanceof WebAssembly.Module) {\n return WebAssembly.instantiate(wasm, go.importObject);\n }\n const res = yield fetch(wasm);\n if (!res.ok)\n throw new Error(`Failed to download ${JSON.stringify(wasm)}`);\n if ("instantiateStreaming" in WebAssembly && /^application\\/wasm($|;)/i.test(res.headers.get("Content-Type") || "")) {\n const result2 = yield WebAssembly.instantiateStreaming(res, go.importObject);\n return result2.instance;\n }\n const bytes = yield res.arrayBuffer();\n const result = yield WebAssembly.instantiate(bytes, go.importObject);\n return result.instance;\n });\n }\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
1793
1793
  worker = new Worker(URL.createObjectURL(blob));
1794
1794
  } else {
1795
1795
  let onmessage = ((postMessage) => {
@@ -2430,7 +2430,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
2430
2430
  callback(null, count);
2431
2431
  };
2432
2432
  let go = new globalThis.Go();
2433
- go.argv = ["", `--service=${"0.18.8"}`];
2433
+ go.argv = ["", `--service=${"0.18.9"}`];
2434
2434
  tryToInstantiateModule(wasm, go).then(
2435
2435
  (instance) => {
2436
2436
  postMessage(null);
@@ -4,19 +4,19 @@
4
4
  This indicates that your JavaScript environment is broken. You cannot use
5
5
  esbuild in this environment because esbuild relies on this invariant. This
6
6
  is not a problem with esbuild. You need to fix your environment instead.
7
- `);function Ee(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Re(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var V=JSON.stringify,$e="warning",Me="silent";function Ce(e){if(J(e,"target"),e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var ye=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",y=e=>typeof e=="string"?null:"a string",he=e=>e instanceof RegExp?null:"a RegExp object",se=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Pe=e=>typeof e=="function"?null:"a function",z=e=>Array.isArray(e)?null:"an array",ee=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",He=e=>typeof e=="object"&&e!==null?null:"an array or an object",Ge=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Ae=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Fe=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",Xe=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Ze=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",Te=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",et=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function r(e,t,n,i){let u=e[n];if(t[n+""]=!0,u===void 0)return;let l=i(u);if(l!==null)throw new Error(`${V(n)} must be ${l}`);return u}function K(e,t,n){for(let i in e)if(!(i in t))throw new Error(`Invalid option ${n}: ${V(i)}`)}function Be(e){let t=Object.create(null),n=r(e,t,"wasmURL",et),i=r(e,t,"wasmModule",Ge),u=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:i,worker:u}}function Ue(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let i=e[n];if(typeof i=="string"||i===!1)t[n]=i;else throw new Error(`Expected ${V(n)} in mangle cache to map to either a string or false`)}}return t}function be(e,t,n,i,u){let l=r(t,n,"color",I),f=r(t,n,"logLevel",y),s=r(t,n,"logLimit",se);l!==void 0?e.push(`--color=${l}`):i&&e.push("--color=true"),e.push(`--log-level=${f||u}`),e.push(`--log-limit=${s||0}`)}function J(e,t,n){if(typeof e!="string")throw new Error(`Expected value for ${t}${n!==void 0?" "+V(n):""} to be a string, got ${typeof e} instead`);return e}function je(e,t,n){let i=r(t,n,"legalComments",y),u=r(t,n,"sourceRoot",y),l=r(t,n,"sourcesContent",I),f=r(t,n,"target",Ze),s=r(t,n,"format",y),p=r(t,n,"globalName",y),w=r(t,n,"mangleProps",he),x=r(t,n,"reserveProps",he),F=r(t,n,"mangleQuoted",I),j=r(t,n,"minify",I),B=r(t,n,"minifySyntax",I),q=r(t,n,"minifyWhitespace",I),Q=r(t,n,"minifyIdentifiers",I),T=r(t,n,"lineLimit",se),W=r(t,n,"drop",z),Y=r(t,n,"charset",y),R=r(t,n,"treeShaking",I),m=r(t,n,"ignoreAnnotations",I),d=r(t,n,"jsx",y),o=r(t,n,"jsxFactory",y),O=r(t,n,"jsxFragment",y),k=r(t,n,"jsxImportSource",y),$=r(t,n,"jsxDev",I),C=r(t,n,"jsxSideEffects",I),a=r(t,n,"define",ee),c=r(t,n,"logOverride",ee),b=r(t,n,"supported",ee),E=r(t,n,"pure",z),M=r(t,n,"keepNames",I),S=r(t,n,"platform",y),v=r(t,n,"tsconfigRaw",Xe);if(i&&e.push(`--legal-comments=${i}`),u!==void 0&&e.push(`--source-root=${u}`),l!==void 0&&e.push(`--sources-content=${l}`),f&&(Array.isArray(f)?e.push(`--target=${Array.from(f).map(Ce).join(",")}`):e.push(`--target=${Ce(f)}`)),s&&e.push(`--format=${s}`),p&&e.push(`--global-name=${p}`),S&&e.push(`--platform=${S}`),v&&e.push(`--tsconfig-raw=${typeof v=="string"?v:JSON.stringify(v)}`),j&&e.push("--minify"),B&&e.push("--minify-syntax"),q&&e.push("--minify-whitespace"),Q&&e.push("--minify-identifiers"),T&&e.push(`--line-limit=${T}`),Y&&e.push(`--charset=${Y}`),R!==void 0&&e.push(`--tree-shaking=${R}`),m&&e.push("--ignore-annotations"),W)for(let h of W)e.push(`--drop:${J(h,"drop")}`);if(w&&e.push(`--mangle-props=${w.source}`),x&&e.push(`--reserve-props=${x.source}`),F!==void 0&&e.push(`--mangle-quoted=${F}`),d&&e.push(`--jsx=${d}`),o&&e.push(`--jsx-factory=${o}`),O&&e.push(`--jsx-fragment=${O}`),k&&e.push(`--jsx-import-source=${k}`),$&&e.push("--jsx-dev"),C&&e.push("--jsx-side-effects"),a)for(let h in a){if(h.indexOf("=")>=0)throw new Error(`Invalid define: ${h}`);e.push(`--define:${h}=${J(a[h],"define",h)}`)}if(c)for(let h in c){if(h.indexOf("=")>=0)throw new Error(`Invalid log override: ${h}`);e.push(`--log-override:${h}=${J(c[h],"log override",h)}`)}if(b)for(let h in b){if(h.indexOf("=")>=0)throw new Error(`Invalid supported: ${h}`);let U=b[h];if(typeof U!="boolean")throw new Error(`Expected value for supported ${V(h)} to be a boolean, got ${typeof U} instead`);e.push(`--supported:${h}=${U}`)}if(E)for(let h of E)e.push(`--pure:${J(h,"pure")}`);M&&e.push("--keep-names")}function tt(e,t,n,i,u){var oe;let l=[],f=[],s=Object.create(null),p=null,w=null;be(l,t,s,n,i),je(l,t,s);let x=r(t,s,"sourcemap",Fe),F=r(t,s,"bundle",I),j=r(t,s,"splitting",I),B=r(t,s,"preserveSymlinks",I),q=r(t,s,"metafile",I),Q=r(t,s,"outfile",y),T=r(t,s,"outdir",y),W=r(t,s,"outbase",y),Y=r(t,s,"tsconfig",y),R=r(t,s,"resolveExtensions",z),m=r(t,s,"nodePaths",z),d=r(t,s,"mainFields",z),o=r(t,s,"conditions",z),O=r(t,s,"external",z),k=r(t,s,"packages",y),$=r(t,s,"alias",ee),C=r(t,s,"loader",ee),a=r(t,s,"outExtension",ee),c=r(t,s,"publicPath",y),b=r(t,s,"entryNames",y),E=r(t,s,"chunkNames",y),M=r(t,s,"assetNames",y),S=r(t,s,"inject",z),v=r(t,s,"banner",ee),h=r(t,s,"footer",ee),U=r(t,s,"entryPoints",He),A=r(t,s,"absWorkingDir",y),P=r(t,s,"stdin",ee),D=(oe=r(t,s,"write",I))!=null?oe:u,L=r(t,s,"allowOverwrite",I),_=r(t,s,"mangleCache",ee);if(s.plugins=!0,K(t,s,`in ${e}() call`),x&&l.push(`--sourcemap${x===!0?"":`=${x}`}`),F&&l.push("--bundle"),L&&l.push("--allow-overwrite"),j&&l.push("--splitting"),B&&l.push("--preserve-symlinks"),q&&l.push("--metafile"),Q&&l.push(`--outfile=${Q}`),T&&l.push(`--outdir=${T}`),W&&l.push(`--outbase=${W}`),Y&&l.push(`--tsconfig=${Y}`),k&&l.push(`--packages=${k}`),R){let g=[];for(let N of R){if(J(N,"resolve extension"),N.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${N}`);g.push(N)}l.push(`--resolve-extensions=${g.join(",")}`)}if(c&&l.push(`--public-path=${c}`),b&&l.push(`--entry-names=${b}`),E&&l.push(`--chunk-names=${E}`),M&&l.push(`--asset-names=${M}`),d){let g=[];for(let N of d){if(J(N,"main field"),N.indexOf(",")>=0)throw new Error(`Invalid main field: ${N}`);g.push(N)}l.push(`--main-fields=${g.join(",")}`)}if(o){let g=[];for(let N of o){if(J(N,"condition"),N.indexOf(",")>=0)throw new Error(`Invalid condition: ${N}`);g.push(N)}l.push(`--conditions=${g.join(",")}`)}if(O)for(let g of O)l.push(`--external:${J(g,"external")}`);if($)for(let g in $){if(g.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${g}`);l.push(`--alias:${g}=${J($[g],"alias",g)}`)}if(v)for(let g in v){if(g.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${g}`);l.push(`--banner:${g}=${J(v[g],"banner",g)}`)}if(h)for(let g in h){if(g.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${g}`);l.push(`--footer:${g}=${J(h[g],"footer",g)}`)}if(S)for(let g of S)l.push(`--inject:${J(g,"inject")}`);if(C)for(let g in C){if(g.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${g}`);l.push(`--loader:${g}=${J(C[g],"loader",g)}`)}if(a)for(let g in a){if(g.indexOf("=")>=0)throw new Error(`Invalid out extension: ${g}`);l.push(`--out-extension:${g}=${J(a[g],"out extension",g)}`)}if(U)if(Array.isArray(U))for(let g=0,N=U.length;g<N;g++){let G=U[g];if(typeof G=="object"&&G!==null){let X=Object.create(null),re=r(G,X,"in",y),de=r(G,X,"out",y);if(K(G,X,"in entry point at index "+g),re===void 0)throw new Error('Missing property "in" for entry point at index '+g);if(de===void 0)throw new Error('Missing property "out" for entry point at index '+g);f.push([de,re])}else f.push(["",J(G,"entry point at index "+g)])}else for(let g in U)f.push([g,J(U[g],"entry point",g)]);if(P){let g=Object.create(null),N=r(P,g,"contents",Te),G=r(P,g,"resolveDir",y),X=r(P,g,"sourcefile",y),re=r(P,g,"loader",y);K(P,g,'in "stdin" object'),X&&l.push(`--sourcefile=${X}`),re&&l.push(`--loader=${re}`),G&&(w=G),typeof N=="string"?p=Z(N):N instanceof Uint8Array&&(p=N)}let H=[];if(m)for(let g of m)g+="",H.push(g);return{entries:f,flags:l,write:D,stdinContents:p,stdinResolveDir:w,absWorkingDir:A,nodePaths:H,mangleCache:Ue(_)}}function nt(e,t,n,i){let u=[],l=Object.create(null);be(u,t,l,n,i),je(u,t,l);let f=r(t,l,"sourcemap",Fe),s=r(t,l,"sourcefile",y),p=r(t,l,"loader",y),w=r(t,l,"banner",y),x=r(t,l,"footer",y),F=r(t,l,"mangleCache",ee);return K(t,l,`in ${e}() call`),f&&u.push(`--sourcemap=${f===!0?"external":f}`),s&&u.push(`--sourcefile=${s}`),p&&u.push(`--loader=${p}`),w&&u.push(`--banner=${w}`),x&&u.push(`--footer=${x}`),{flags:u,mangleCache:Ue(F)}}function qe(e){let t={},n={didClose:!1,reason:""},i={},u=0,l=0,f=new Uint8Array(16*1024),s=0,p=R=>{let m=s+R.length;if(m>f.length){let o=new Uint8Array(m*2);o.set(f),f=o}f.set(R,s),s+=R.length;let d=0;for(;d+4<=s;){let o=Ee(f,d);if(d+4+o>s)break;d+=4,q(f.subarray(d,d+o)),d+=o}d>0&&(f.copyWithin(0,d,s),s-=d)},w=R=>{n.didClose=!0,R&&(n.reason=": "+(R.message||R));let m="The service was stopped"+n.reason;for(let d in i)i[d](m,null);i={}},x=(R,m,d)=>{if(n.didClose)return d("The service is no longer running"+n.reason,null);let o=u++;i[o]=(O,k)=>{try{d(O,k)}finally{R&&R.unref()}},R&&R.ref(),e.writeToStdin(Oe({id:o,isRequest:!0,value:m}))},F=(R,m)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(Oe({id:R,isRequest:!1,value:m}))},j=(R,m)=>te(this,null,function*(){try{if(m.command==="ping"){F(R,{});return}if(typeof m.key=="number"){let d=t[m.key];if(d){let o=d[m.command];if(o){yield o(R,m);return}}}throw new Error("Invalid command: "+m.command)}catch(d){F(R,{errors:[le(d,e,null,void 0,"")]})}}),B=!0,q=R=>{if(B){B=!1;let d=String.fromCharCode(...R);if(d!=="0.18.8")throw new Error(`Cannot start service: Host version "0.18.8" does not match binary version ${V(d)}`);return}let m=ke(R);if(m.isRequest)j(m.id,m.value);else{let d=i[m.id];delete i[m.id],m.value.error?d(m.value.error,{}):d(null,m.value)}};return{readFromStdout:p,afterClose:w,service:{buildOrContext:({callName:R,refs:m,options:d,isTTY:o,defaultWD:O,callback:k})=>{let $=0,C=l++,a={},c={ref(){++$===1&&m&&m.ref()},unref(){--$===0&&(delete t[C],m&&m.unref())}};t[C]=a,c.ref(),rt(R,C,x,F,c,e,a,d,o,O,(b,E)=>{try{k(b,E)}finally{c.unref()}})},transform:({callName:R,refs:m,input:d,options:o,isTTY:O,fs:k,callback:$})=>{let C=Le(),a=c=>{try{if(typeof d!="string"&&!(d instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:b,mangleCache:E}=nt(R,o,O,Me),M={command:"transform",flags:b,inputFS:c!==null,input:c!==null?Z(c):typeof d=="string"?Z(d):d};E&&(M.mangleCache=E),x(m,M,(S,v)=>{if(S)return $(new Error(S),null);let h=ae(v.errors,C),U=ae(v.warnings,C),A=1,P=()=>{if(--A===0){let D={warnings:U,code:v.code,map:v.map,mangleCache:void 0,legalComments:void 0};"legalComments"in v&&(D.legalComments=v==null?void 0:v.legalComments),v.mangleCache&&(D.mangleCache=v==null?void 0:v.mangleCache),$(null,D)}};if(h.length>0)return $(ce("Transform failed",h,U),null);v.codeFS&&(A++,k.readFile(v.code,(D,L)=>{D!==null?$(D,null):(v.code=L,P())})),v.mapFS&&(A++,k.readFile(v.map,(D,L)=>{D!==null?$(D,null):(v.map=L,P())})),P()})}catch(b){let E=[];try{be(E,o,{},O,Me)}catch(S){}let M=le(b,e,C,void 0,"");x(m,{command:"error",flags:E,error:M},()=>{M.detail=C.load(M.detail),$(ce("Transform failed",[M],[]),null)})}};if((typeof d=="string"||d instanceof Uint8Array)&&d.length>1024*1024){let c=a;a=()=>k.writeFile(d,c)}a(null)},formatMessages:({callName:R,refs:m,messages:d,options:o,callback:O})=>{let k=ne(d,"messages",null,"");if(!o)throw new Error(`Missing second argument in ${R}() call`);let $={},C=r(o,$,"kind",y),a=r(o,$,"color",I),c=r(o,$,"terminalWidth",se);if(K(o,$,`in ${R}() call`),C===void 0)throw new Error(`Missing "kind" in ${R}() call`);if(C!=="error"&&C!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${R}() call`);let b={command:"format-msgs",messages:k,isWarning:C==="warning"};a!==void 0&&(b.color=a),c!==void 0&&(b.terminalWidth=c),x(m,b,(E,M)=>{if(E)return O(new Error(E),null);O(null,M.messages)})},analyzeMetafile:({callName:R,refs:m,metafile:d,options:o,callback:O})=>{o===void 0&&(o={});let k={},$=r(o,k,"color",I),C=r(o,k,"verbose",I);K(o,k,`in ${R}() call`);let a={command:"analyze-metafile",metafile:d};$!==void 0&&(a.color=$),C!==void 0&&(a.verbose=C),x(m,a,(c,b)=>{if(c)return O(new Error(c),null);O(null,b.result)})}}}}function rt(e,t,n,i,u,l,f,s,p,w,x){let F=Le(),j=e==="context",B=(T,W)=>{let Y=[];try{be(Y,s,{},p,$e)}catch(m){}let R=le(T,l,F,void 0,W);n(u,{command:"error",flags:Y,error:R},()=>{R.detail=F.load(R.detail),x(ce(j?"Context failed":"Build failed",[R],[]),null)})},q;if(typeof s=="object"){let T=s.plugins;if(T!==void 0){if(!Array.isArray(T))return B(new Error('"plugins" must be an array'),"");q=T}}if(q&&q.length>0){if(l.isSync)return B(new Error("Cannot use plugins in synchronous API calls"),"");it(t,n,i,u,l,f,s,q,F).then(T=>{if(!T.ok)return B(T.error,T.pluginName);try{Q(T.requestPlugins,T.runOnEndCallbacks,T.scheduleOnDisposeCallbacks)}catch(W){B(W,"")}},T=>B(T,""));return}try{Q(null,(T,W)=>W([],[]),()=>{})}catch(T){B(T,"")}function Q(T,W,Y){let R=l.hasFS,{entries:m,flags:d,write:o,stdinContents:O,stdinResolveDir:k,absWorkingDir:$,nodePaths:C,mangleCache:a}=tt(e,s,p,$e,R);if(o&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let c={command:"build",key:t,entries:m,flags:d,write:o,stdinContents:O,stdinResolveDir:k,absWorkingDir:$||w,nodePaths:C,context:j};T&&(c.plugins=T),a&&(c.mangleCache=a);let b=(S,v)=>{let h={errors:ae(S.errors,F),warnings:ae(S.warnings,F),outputFiles:void 0,metafile:void 0,mangleCache:void 0},U=h.errors.slice(),A=h.warnings.slice();S.outputFiles&&(h.outputFiles=S.outputFiles.map(lt)),S.metafile&&(h.metafile=JSON.parse(S.metafile)),S.mangleCache&&(h.mangleCache=S.mangleCache),S.writeToStdout!==void 0&&console.log(ie(S.writeToStdout).replace(/\n$/,"")),W(h,(P,D)=>{if(U.length>0||P.length>0){let L=ce("Build failed",U.concat(P),A.concat(D));return v(L,null,P,D)}v(null,h,P,D)})},E,M;j&&(f["on-end"]=(S,v)=>new Promise(h=>{b(v,(U,A,P,D)=>{let L={errors:P,warnings:D};M&&M(U,A),E=void 0,M=void 0,i(S,L),h()})})),n(u,c,(S,v)=>{if(S)return x(new Error(S),null);if(!j)return b(v,(A,P)=>(Y(),x(A,P)));if(v.errors.length>0)return x(ce("Context failed",v.errors,v.warnings),null);let h=!1,U={rebuild:()=>(E||(E=new Promise((A,P)=>{let D;M=(_,H)=>{D||(D=()=>_?P(_):A(H))};let L=()=>{n(u,{command:"rebuild",key:t},(H,oe)=>{H?P(new Error(H)):D?D():L()})};L()})),E),watch:(A={})=>new Promise((P,D)=>{if(!l.hasFS)throw new Error('Cannot use the "watch" API in this environment');K(A,{},"in watch() call"),n(u,{command:"watch",key:t},H=>{H?D(new Error(H)):P(void 0)})}),serve:(A={})=>new Promise((P,D)=>{if(!l.hasFS)throw new Error('Cannot use the "serve" API in this environment');let L={},_=r(A,L,"port",se),H=r(A,L,"host",y),oe=r(A,L,"servedir",y),g=r(A,L,"keyfile",y),N=r(A,L,"certfile",y),G=r(A,L,"onRequest",Pe);K(A,L,"in serve() call");let X={command:"serve",key:t,onRequest:!!G};_!==void 0&&(X.port=_),H!==void 0&&(X.host=H),oe!==void 0&&(X.servedir=oe),g!==void 0&&(X.keyfile=g),N!==void 0&&(X.certfile=N),n(u,X,(re,de)=>{if(re)return D(new Error(re));G&&(f["serve-request"]=(Ie,We)=>{G(We.args),i(Ie,{})}),P(de)})}),cancel:()=>new Promise(A=>{if(h)return A();n(u,{command:"cancel",key:t},()=>{A()})}),dispose:()=>new Promise(A=>{if(h)return A();h=!0,n(u,{command:"dispose",key:t},()=>{A(),Y(),u.unref()})})};u.ref(),x(null,U)})}}var it=(e,t,n,i,u,l,f,s,p)=>te(void 0,null,function*(){let w=[],x=[],F={},j={},B=[],q=0,Q=0,T=[],W=!1;s=[...s];for(let m of s){let d={};if(typeof m!="object")throw new Error(`Plugin at index ${Q} must be an object`);let o=r(m,d,"name",y);if(typeof o!="string"||o==="")throw new Error(`Plugin at index ${Q} is missing a name`);try{let O=r(m,d,"setup",Pe);if(typeof O!="function")throw new Error("Plugin is missing a setup function");K(m,d,`on plugin ${V(o)}`);let k={name:o,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};Q++;let C=O({initialOptions:f,resolve:(a,c={})=>{if(!W)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof a!="string")throw new Error("The path to resolve must be a string");let b=Object.create(null),E=r(c,b,"pluginName",y),M=r(c,b,"importer",y),S=r(c,b,"namespace",y),v=r(c,b,"resolveDir",y),h=r(c,b,"kind",y),U=r(c,b,"pluginData",ye);return K(c,b,"in resolve() call"),new Promise((A,P)=>{let D={command:"resolve",path:a,key:e,pluginName:o};if(E!=null&&(D.pluginName=E),M!=null&&(D.importer=M),S!=null&&(D.namespace=S),v!=null&&(D.resolveDir=v),h!=null)D.kind=h;else throw new Error('Must specify "kind" when calling "resolve"');U!=null&&(D.pluginData=p.store(U)),t(i,D,(L,_)=>{L!==null?P(new Error(L)):A({errors:ae(_.errors,p),warnings:ae(_.warnings,p),path:_.path,external:_.external,sideEffects:_.sideEffects,namespace:_.namespace,suffix:_.suffix,pluginData:p.load(_.pluginData)})})})},onStart(a){let c='This error came from the "onStart" callback registered here:',b=ge(new Error(c),u,"onStart");w.push({name:o,callback:a,note:b}),k.onStart=!0},onEnd(a){let c='This error came from the "onEnd" callback registered here:',b=ge(new Error(c),u,"onEnd");x.push({name:o,callback:a,note:b}),k.onEnd=!0},onResolve(a,c){let b='This error came from the "onResolve" callback registered here:',E=ge(new Error(b),u,"onResolve"),M={},S=r(a,M,"filter",he),v=r(a,M,"namespace",y);if(K(a,M,`in onResolve() call for plugin ${V(o)}`),S==null)throw new Error("onResolve() call is missing a filter");let h=q++;F[h]={name:o,callback:c,note:E},k.onResolve.push({id:h,filter:S.source,namespace:v||""})},onLoad(a,c){let b='This error came from the "onLoad" callback registered here:',E=ge(new Error(b),u,"onLoad"),M={},S=r(a,M,"filter",he),v=r(a,M,"namespace",y);if(K(a,M,`in onLoad() call for plugin ${V(o)}`),S==null)throw new Error("onLoad() call is missing a filter");let h=q++;j[h]={name:o,callback:c,note:E},k.onLoad.push({id:h,filter:S.source,namespace:v||""})},onDispose(a){B.push(a)},esbuild:u.esbuild});C&&(yield C),T.push(k)}catch(O){return{ok:!1,error:O,pluginName:o}}}l["on-start"]=(m,d)=>te(void 0,null,function*(){let o={errors:[],warnings:[]};yield Promise.all(w.map(C=>te(void 0,[C],function*({name:O,callback:k,note:$}){try{let a=yield k();if(a!=null){if(typeof a!="object")throw new Error(`Expected onStart() callback in plugin ${V(O)} to return an object`);let c={},b=r(a,c,"errors",z),E=r(a,c,"warnings",z);K(a,c,`from onStart() callback in plugin ${V(O)}`),b!=null&&o.errors.push(...ne(b,"errors",p,O)),E!=null&&o.warnings.push(...ne(E,"warnings",p,O))}}catch(a){o.errors.push(le(a,u,p,$&&$(),O))}}))),n(m,o)}),l["on-resolve"]=(m,d)=>te(void 0,null,function*(){let o={},O="",k,$;for(let C of d.ids)try{({name:O,callback:k,note:$}=F[C]);let a=yield k({path:d.path,importer:d.importer,namespace:d.namespace,resolveDir:d.resolveDir,kind:d.kind,pluginData:p.load(d.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onResolve() callback in plugin ${V(O)} to return an object`);let c={},b=r(a,c,"pluginName",y),E=r(a,c,"path",y),M=r(a,c,"namespace",y),S=r(a,c,"suffix",y),v=r(a,c,"external",I),h=r(a,c,"sideEffects",I),U=r(a,c,"pluginData",ye),A=r(a,c,"errors",z),P=r(a,c,"warnings",z),D=r(a,c,"watchFiles",z),L=r(a,c,"watchDirs",z);K(a,c,`from onResolve() callback in plugin ${V(O)}`),o.id=C,b!=null&&(o.pluginName=b),E!=null&&(o.path=E),M!=null&&(o.namespace=M),S!=null&&(o.suffix=S),v!=null&&(o.external=v),h!=null&&(o.sideEffects=h),U!=null&&(o.pluginData=p.store(U)),A!=null&&(o.errors=ne(A,"errors",p,O)),P!=null&&(o.warnings=ne(P,"warnings",p,O)),D!=null&&(o.watchFiles=me(D,"watchFiles")),L!=null&&(o.watchDirs=me(L,"watchDirs"));break}}catch(a){o={id:C,errors:[le(a,u,p,$&&$(),O)]};break}n(m,o)}),l["on-load"]=(m,d)=>te(void 0,null,function*(){let o={},O="",k,$;for(let C of d.ids)try{({name:O,callback:k,note:$}=j[C]);let a=yield k({path:d.path,namespace:d.namespace,suffix:d.suffix,pluginData:p.load(d.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onLoad() callback in plugin ${V(O)} to return an object`);let c={},b=r(a,c,"pluginName",y),E=r(a,c,"contents",Te),M=r(a,c,"resolveDir",y),S=r(a,c,"pluginData",ye),v=r(a,c,"loader",y),h=r(a,c,"errors",z),U=r(a,c,"warnings",z),A=r(a,c,"watchFiles",z),P=r(a,c,"watchDirs",z);K(a,c,`from onLoad() callback in plugin ${V(O)}`),o.id=C,b!=null&&(o.pluginName=b),E instanceof Uint8Array?o.contents=E:E!=null&&(o.contents=Z(E)),M!=null&&(o.resolveDir=M),S!=null&&(o.pluginData=p.store(S)),v!=null&&(o.loader=v),h!=null&&(o.errors=ne(h,"errors",p,O)),U!=null&&(o.warnings=ne(U,"warnings",p,O)),A!=null&&(o.watchFiles=me(A,"watchFiles")),P!=null&&(o.watchDirs=me(P,"watchDirs"));break}}catch(a){o={id:C,errors:[le(a,u,p,$&&$(),O)]};break}n(m,o)});let Y=(m,d)=>d([],[]);x.length>0&&(Y=(m,d)=>{te(void 0,null,function*(){let o=[],O=[];for(let{name:k,callback:$,note:C}of x){let a,c;try{let b=yield $(m);if(b!=null){if(typeof b!="object")throw new Error(`Expected onEnd() callback in plugin ${V(k)} to return an object`);let E={},M=r(b,E,"errors",z),S=r(b,E,"warnings",z);K(b,E,`from onEnd() callback in plugin ${V(k)}`),M!=null&&(a=ne(M,"errors",p,k)),S!=null&&(c=ne(S,"warnings",p,k))}}catch(b){a=[le(b,u,p,C&&C(),k)]}if(a){o.push(...a);try{m.errors.push(...a)}catch(b){}}if(c){O.push(...c);try{m.warnings.push(...c)}catch(b){}}}d(o,O)})});let R=()=>{for(let m of B)setTimeout(()=>m(),0)};return W=!0,{ok:!0,requestPlugins:T,runOnEndCallbacks:Y,scheduleOnDisposeCallbacks:R}});function Le(){let e=new Map,t=0;return{load(n){return e.get(n)},store(n){if(n===void 0)return-1;let i=t++;return e.set(i,n),i}}}function ge(e,t,n){let i,u=!1;return()=>{if(u)return i;u=!0;try{let l=(e.stack+"").split(`
7
+ `);function Ee(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Re(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var V=JSON.stringify,$e="warning",Me="silent";function Ce(e){if(J(e,"target"),e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var ye=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",y=e=>typeof e=="string"?null:"a string",he=e=>e instanceof RegExp?null:"a RegExp object",se=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Pe=e=>typeof e=="function"?null:"a function",z=e=>Array.isArray(e)?null:"an array",ee=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",He=e=>typeof e=="object"&&e!==null?null:"an array or an object",Ge=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Ae=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Fe=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",Xe=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Ze=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",Te=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",et=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function r(e,t,n,i){let u=e[n];if(t[n+""]=!0,u===void 0)return;let l=i(u);if(l!==null)throw new Error(`${V(n)} must be ${l}`);return u}function K(e,t,n){for(let i in e)if(!(i in t))throw new Error(`Invalid option ${n}: ${V(i)}`)}function Be(e){let t=Object.create(null),n=r(e,t,"wasmURL",et),i=r(e,t,"wasmModule",Ge),u=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:i,worker:u}}function Ue(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let i=e[n];if(typeof i=="string"||i===!1)t[n]=i;else throw new Error(`Expected ${V(n)} in mangle cache to map to either a string or false`)}}return t}function be(e,t,n,i,u){let l=r(t,n,"color",I),f=r(t,n,"logLevel",y),s=r(t,n,"logLimit",se);l!==void 0?e.push(`--color=${l}`):i&&e.push("--color=true"),e.push(`--log-level=${f||u}`),e.push(`--log-limit=${s||0}`)}function J(e,t,n){if(typeof e!="string")throw new Error(`Expected value for ${t}${n!==void 0?" "+V(n):""} to be a string, got ${typeof e} instead`);return e}function je(e,t,n){let i=r(t,n,"legalComments",y),u=r(t,n,"sourceRoot",y),l=r(t,n,"sourcesContent",I),f=r(t,n,"target",Ze),s=r(t,n,"format",y),p=r(t,n,"globalName",y),w=r(t,n,"mangleProps",he),x=r(t,n,"reserveProps",he),F=r(t,n,"mangleQuoted",I),j=r(t,n,"minify",I),B=r(t,n,"minifySyntax",I),q=r(t,n,"minifyWhitespace",I),Q=r(t,n,"minifyIdentifiers",I),T=r(t,n,"lineLimit",se),W=r(t,n,"drop",z),Y=r(t,n,"charset",y),R=r(t,n,"treeShaking",I),m=r(t,n,"ignoreAnnotations",I),d=r(t,n,"jsx",y),o=r(t,n,"jsxFactory",y),O=r(t,n,"jsxFragment",y),k=r(t,n,"jsxImportSource",y),$=r(t,n,"jsxDev",I),C=r(t,n,"jsxSideEffects",I),a=r(t,n,"define",ee),c=r(t,n,"logOverride",ee),b=r(t,n,"supported",ee),E=r(t,n,"pure",z),M=r(t,n,"keepNames",I),S=r(t,n,"platform",y),v=r(t,n,"tsconfigRaw",Xe);if(i&&e.push(`--legal-comments=${i}`),u!==void 0&&e.push(`--source-root=${u}`),l!==void 0&&e.push(`--sources-content=${l}`),f&&(Array.isArray(f)?e.push(`--target=${Array.from(f).map(Ce).join(",")}`):e.push(`--target=${Ce(f)}`)),s&&e.push(`--format=${s}`),p&&e.push(`--global-name=${p}`),S&&e.push(`--platform=${S}`),v&&e.push(`--tsconfig-raw=${typeof v=="string"?v:JSON.stringify(v)}`),j&&e.push("--minify"),B&&e.push("--minify-syntax"),q&&e.push("--minify-whitespace"),Q&&e.push("--minify-identifiers"),T&&e.push(`--line-limit=${T}`),Y&&e.push(`--charset=${Y}`),R!==void 0&&e.push(`--tree-shaking=${R}`),m&&e.push("--ignore-annotations"),W)for(let h of W)e.push(`--drop:${J(h,"drop")}`);if(w&&e.push(`--mangle-props=${w.source}`),x&&e.push(`--reserve-props=${x.source}`),F!==void 0&&e.push(`--mangle-quoted=${F}`),d&&e.push(`--jsx=${d}`),o&&e.push(`--jsx-factory=${o}`),O&&e.push(`--jsx-fragment=${O}`),k&&e.push(`--jsx-import-source=${k}`),$&&e.push("--jsx-dev"),C&&e.push("--jsx-side-effects"),a)for(let h in a){if(h.indexOf("=")>=0)throw new Error(`Invalid define: ${h}`);e.push(`--define:${h}=${J(a[h],"define",h)}`)}if(c)for(let h in c){if(h.indexOf("=")>=0)throw new Error(`Invalid log override: ${h}`);e.push(`--log-override:${h}=${J(c[h],"log override",h)}`)}if(b)for(let h in b){if(h.indexOf("=")>=0)throw new Error(`Invalid supported: ${h}`);let U=b[h];if(typeof U!="boolean")throw new Error(`Expected value for supported ${V(h)} to be a boolean, got ${typeof U} instead`);e.push(`--supported:${h}=${U}`)}if(E)for(let h of E)e.push(`--pure:${J(h,"pure")}`);M&&e.push("--keep-names")}function tt(e,t,n,i,u){var oe;let l=[],f=[],s=Object.create(null),p=null,w=null;be(l,t,s,n,i),je(l,t,s);let x=r(t,s,"sourcemap",Fe),F=r(t,s,"bundle",I),j=r(t,s,"splitting",I),B=r(t,s,"preserveSymlinks",I),q=r(t,s,"metafile",I),Q=r(t,s,"outfile",y),T=r(t,s,"outdir",y),W=r(t,s,"outbase",y),Y=r(t,s,"tsconfig",y),R=r(t,s,"resolveExtensions",z),m=r(t,s,"nodePaths",z),d=r(t,s,"mainFields",z),o=r(t,s,"conditions",z),O=r(t,s,"external",z),k=r(t,s,"packages",y),$=r(t,s,"alias",ee),C=r(t,s,"loader",ee),a=r(t,s,"outExtension",ee),c=r(t,s,"publicPath",y),b=r(t,s,"entryNames",y),E=r(t,s,"chunkNames",y),M=r(t,s,"assetNames",y),S=r(t,s,"inject",z),v=r(t,s,"banner",ee),h=r(t,s,"footer",ee),U=r(t,s,"entryPoints",He),A=r(t,s,"absWorkingDir",y),P=r(t,s,"stdin",ee),D=(oe=r(t,s,"write",I))!=null?oe:u,L=r(t,s,"allowOverwrite",I),_=r(t,s,"mangleCache",ee);if(s.plugins=!0,K(t,s,`in ${e}() call`),x&&l.push(`--sourcemap${x===!0?"":`=${x}`}`),F&&l.push("--bundle"),L&&l.push("--allow-overwrite"),j&&l.push("--splitting"),B&&l.push("--preserve-symlinks"),q&&l.push("--metafile"),Q&&l.push(`--outfile=${Q}`),T&&l.push(`--outdir=${T}`),W&&l.push(`--outbase=${W}`),Y&&l.push(`--tsconfig=${Y}`),k&&l.push(`--packages=${k}`),R){let g=[];for(let N of R){if(J(N,"resolve extension"),N.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${N}`);g.push(N)}l.push(`--resolve-extensions=${g.join(",")}`)}if(c&&l.push(`--public-path=${c}`),b&&l.push(`--entry-names=${b}`),E&&l.push(`--chunk-names=${E}`),M&&l.push(`--asset-names=${M}`),d){let g=[];for(let N of d){if(J(N,"main field"),N.indexOf(",")>=0)throw new Error(`Invalid main field: ${N}`);g.push(N)}l.push(`--main-fields=${g.join(",")}`)}if(o){let g=[];for(let N of o){if(J(N,"condition"),N.indexOf(",")>=0)throw new Error(`Invalid condition: ${N}`);g.push(N)}l.push(`--conditions=${g.join(",")}`)}if(O)for(let g of O)l.push(`--external:${J(g,"external")}`);if($)for(let g in $){if(g.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${g}`);l.push(`--alias:${g}=${J($[g],"alias",g)}`)}if(v)for(let g in v){if(g.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${g}`);l.push(`--banner:${g}=${J(v[g],"banner",g)}`)}if(h)for(let g in h){if(g.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${g}`);l.push(`--footer:${g}=${J(h[g],"footer",g)}`)}if(S)for(let g of S)l.push(`--inject:${J(g,"inject")}`);if(C)for(let g in C){if(g.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${g}`);l.push(`--loader:${g}=${J(C[g],"loader",g)}`)}if(a)for(let g in a){if(g.indexOf("=")>=0)throw new Error(`Invalid out extension: ${g}`);l.push(`--out-extension:${g}=${J(a[g],"out extension",g)}`)}if(U)if(Array.isArray(U))for(let g=0,N=U.length;g<N;g++){let G=U[g];if(typeof G=="object"&&G!==null){let X=Object.create(null),re=r(G,X,"in",y),de=r(G,X,"out",y);if(K(G,X,"in entry point at index "+g),re===void 0)throw new Error('Missing property "in" for entry point at index '+g);if(de===void 0)throw new Error('Missing property "out" for entry point at index '+g);f.push([de,re])}else f.push(["",J(G,"entry point at index "+g)])}else for(let g in U)f.push([g,J(U[g],"entry point",g)]);if(P){let g=Object.create(null),N=r(P,g,"contents",Te),G=r(P,g,"resolveDir",y),X=r(P,g,"sourcefile",y),re=r(P,g,"loader",y);K(P,g,'in "stdin" object'),X&&l.push(`--sourcefile=${X}`),re&&l.push(`--loader=${re}`),G&&(w=G),typeof N=="string"?p=Z(N):N instanceof Uint8Array&&(p=N)}let H=[];if(m)for(let g of m)g+="",H.push(g);return{entries:f,flags:l,write:D,stdinContents:p,stdinResolveDir:w,absWorkingDir:A,nodePaths:H,mangleCache:Ue(_)}}function nt(e,t,n,i){let u=[],l=Object.create(null);be(u,t,l,n,i),je(u,t,l);let f=r(t,l,"sourcemap",Fe),s=r(t,l,"sourcefile",y),p=r(t,l,"loader",y),w=r(t,l,"banner",y),x=r(t,l,"footer",y),F=r(t,l,"mangleCache",ee);return K(t,l,`in ${e}() call`),f&&u.push(`--sourcemap=${f===!0?"external":f}`),s&&u.push(`--sourcefile=${s}`),p&&u.push(`--loader=${p}`),w&&u.push(`--banner=${w}`),x&&u.push(`--footer=${x}`),{flags:u,mangleCache:Ue(F)}}function qe(e){let t={},n={didClose:!1,reason:""},i={},u=0,l=0,f=new Uint8Array(16*1024),s=0,p=R=>{let m=s+R.length;if(m>f.length){let o=new Uint8Array(m*2);o.set(f),f=o}f.set(R,s),s+=R.length;let d=0;for(;d+4<=s;){let o=Ee(f,d);if(d+4+o>s)break;d+=4,q(f.subarray(d,d+o)),d+=o}d>0&&(f.copyWithin(0,d,s),s-=d)},w=R=>{n.didClose=!0,R&&(n.reason=": "+(R.message||R));let m="The service was stopped"+n.reason;for(let d in i)i[d](m,null);i={}},x=(R,m,d)=>{if(n.didClose)return d("The service is no longer running"+n.reason,null);let o=u++;i[o]=(O,k)=>{try{d(O,k)}finally{R&&R.unref()}},R&&R.ref(),e.writeToStdin(Oe({id:o,isRequest:!0,value:m}))},F=(R,m)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(Oe({id:R,isRequest:!1,value:m}))},j=(R,m)=>te(this,null,function*(){try{if(m.command==="ping"){F(R,{});return}if(typeof m.key=="number"){let d=t[m.key];if(d){let o=d[m.command];if(o){yield o(R,m);return}}}throw new Error("Invalid command: "+m.command)}catch(d){F(R,{errors:[le(d,e,null,void 0,"")]})}}),B=!0,q=R=>{if(B){B=!1;let d=String.fromCharCode(...R);if(d!=="0.18.9")throw new Error(`Cannot start service: Host version "0.18.9" does not match binary version ${V(d)}`);return}let m=ke(R);if(m.isRequest)j(m.id,m.value);else{let d=i[m.id];delete i[m.id],m.value.error?d(m.value.error,{}):d(null,m.value)}};return{readFromStdout:p,afterClose:w,service:{buildOrContext:({callName:R,refs:m,options:d,isTTY:o,defaultWD:O,callback:k})=>{let $=0,C=l++,a={},c={ref(){++$===1&&m&&m.ref()},unref(){--$===0&&(delete t[C],m&&m.unref())}};t[C]=a,c.ref(),rt(R,C,x,F,c,e,a,d,o,O,(b,E)=>{try{k(b,E)}finally{c.unref()}})},transform:({callName:R,refs:m,input:d,options:o,isTTY:O,fs:k,callback:$})=>{let C=Le(),a=c=>{try{if(typeof d!="string"&&!(d instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:b,mangleCache:E}=nt(R,o,O,Me),M={command:"transform",flags:b,inputFS:c!==null,input:c!==null?Z(c):typeof d=="string"?Z(d):d};E&&(M.mangleCache=E),x(m,M,(S,v)=>{if(S)return $(new Error(S),null);let h=ae(v.errors,C),U=ae(v.warnings,C),A=1,P=()=>{if(--A===0){let D={warnings:U,code:v.code,map:v.map,mangleCache:void 0,legalComments:void 0};"legalComments"in v&&(D.legalComments=v==null?void 0:v.legalComments),v.mangleCache&&(D.mangleCache=v==null?void 0:v.mangleCache),$(null,D)}};if(h.length>0)return $(ce("Transform failed",h,U),null);v.codeFS&&(A++,k.readFile(v.code,(D,L)=>{D!==null?$(D,null):(v.code=L,P())})),v.mapFS&&(A++,k.readFile(v.map,(D,L)=>{D!==null?$(D,null):(v.map=L,P())})),P()})}catch(b){let E=[];try{be(E,o,{},O,Me)}catch(S){}let M=le(b,e,C,void 0,"");x(m,{command:"error",flags:E,error:M},()=>{M.detail=C.load(M.detail),$(ce("Transform failed",[M],[]),null)})}};if((typeof d=="string"||d instanceof Uint8Array)&&d.length>1024*1024){let c=a;a=()=>k.writeFile(d,c)}a(null)},formatMessages:({callName:R,refs:m,messages:d,options:o,callback:O})=>{let k=ne(d,"messages",null,"");if(!o)throw new Error(`Missing second argument in ${R}() call`);let $={},C=r(o,$,"kind",y),a=r(o,$,"color",I),c=r(o,$,"terminalWidth",se);if(K(o,$,`in ${R}() call`),C===void 0)throw new Error(`Missing "kind" in ${R}() call`);if(C!=="error"&&C!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${R}() call`);let b={command:"format-msgs",messages:k,isWarning:C==="warning"};a!==void 0&&(b.color=a),c!==void 0&&(b.terminalWidth=c),x(m,b,(E,M)=>{if(E)return O(new Error(E),null);O(null,M.messages)})},analyzeMetafile:({callName:R,refs:m,metafile:d,options:o,callback:O})=>{o===void 0&&(o={});let k={},$=r(o,k,"color",I),C=r(o,k,"verbose",I);K(o,k,`in ${R}() call`);let a={command:"analyze-metafile",metafile:d};$!==void 0&&(a.color=$),C!==void 0&&(a.verbose=C),x(m,a,(c,b)=>{if(c)return O(new Error(c),null);O(null,b.result)})}}}}function rt(e,t,n,i,u,l,f,s,p,w,x){let F=Le(),j=e==="context",B=(T,W)=>{let Y=[];try{be(Y,s,{},p,$e)}catch(m){}let R=le(T,l,F,void 0,W);n(u,{command:"error",flags:Y,error:R},()=>{R.detail=F.load(R.detail),x(ce(j?"Context failed":"Build failed",[R],[]),null)})},q;if(typeof s=="object"){let T=s.plugins;if(T!==void 0){if(!Array.isArray(T))return B(new Error('"plugins" must be an array'),"");q=T}}if(q&&q.length>0){if(l.isSync)return B(new Error("Cannot use plugins in synchronous API calls"),"");it(t,n,i,u,l,f,s,q,F).then(T=>{if(!T.ok)return B(T.error,T.pluginName);try{Q(T.requestPlugins,T.runOnEndCallbacks,T.scheduleOnDisposeCallbacks)}catch(W){B(W,"")}},T=>B(T,""));return}try{Q(null,(T,W)=>W([],[]),()=>{})}catch(T){B(T,"")}function Q(T,W,Y){let R=l.hasFS,{entries:m,flags:d,write:o,stdinContents:O,stdinResolveDir:k,absWorkingDir:$,nodePaths:C,mangleCache:a}=tt(e,s,p,$e,R);if(o&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let c={command:"build",key:t,entries:m,flags:d,write:o,stdinContents:O,stdinResolveDir:k,absWorkingDir:$||w,nodePaths:C,context:j};T&&(c.plugins=T),a&&(c.mangleCache=a);let b=(S,v)=>{let h={errors:ae(S.errors,F),warnings:ae(S.warnings,F),outputFiles:void 0,metafile:void 0,mangleCache:void 0},U=h.errors.slice(),A=h.warnings.slice();S.outputFiles&&(h.outputFiles=S.outputFiles.map(lt)),S.metafile&&(h.metafile=JSON.parse(S.metafile)),S.mangleCache&&(h.mangleCache=S.mangleCache),S.writeToStdout!==void 0&&console.log(ie(S.writeToStdout).replace(/\n$/,"")),W(h,(P,D)=>{if(U.length>0||P.length>0){let L=ce("Build failed",U.concat(P),A.concat(D));return v(L,null,P,D)}v(null,h,P,D)})},E,M;j&&(f["on-end"]=(S,v)=>new Promise(h=>{b(v,(U,A,P,D)=>{let L={errors:P,warnings:D};M&&M(U,A),E=void 0,M=void 0,i(S,L),h()})})),n(u,c,(S,v)=>{if(S)return x(new Error(S),null);if(!j)return b(v,(A,P)=>(Y(),x(A,P)));if(v.errors.length>0)return x(ce("Context failed",v.errors,v.warnings),null);let h=!1,U={rebuild:()=>(E||(E=new Promise((A,P)=>{let D;M=(_,H)=>{D||(D=()=>_?P(_):A(H))};let L=()=>{n(u,{command:"rebuild",key:t},(H,oe)=>{H?P(new Error(H)):D?D():L()})};L()})),E),watch:(A={})=>new Promise((P,D)=>{if(!l.hasFS)throw new Error('Cannot use the "watch" API in this environment');K(A,{},"in watch() call"),n(u,{command:"watch",key:t},H=>{H?D(new Error(H)):P(void 0)})}),serve:(A={})=>new Promise((P,D)=>{if(!l.hasFS)throw new Error('Cannot use the "serve" API in this environment');let L={},_=r(A,L,"port",se),H=r(A,L,"host",y),oe=r(A,L,"servedir",y),g=r(A,L,"keyfile",y),N=r(A,L,"certfile",y),G=r(A,L,"onRequest",Pe);K(A,L,"in serve() call");let X={command:"serve",key:t,onRequest:!!G};_!==void 0&&(X.port=_),H!==void 0&&(X.host=H),oe!==void 0&&(X.servedir=oe),g!==void 0&&(X.keyfile=g),N!==void 0&&(X.certfile=N),n(u,X,(re,de)=>{if(re)return D(new Error(re));G&&(f["serve-request"]=(Ie,We)=>{G(We.args),i(Ie,{})}),P(de)})}),cancel:()=>new Promise(A=>{if(h)return A();n(u,{command:"cancel",key:t},()=>{A()})}),dispose:()=>new Promise(A=>{if(h)return A();h=!0,n(u,{command:"dispose",key:t},()=>{A(),Y(),u.unref()})})};u.ref(),x(null,U)})}}var it=(e,t,n,i,u,l,f,s,p)=>te(void 0,null,function*(){let w=[],x=[],F={},j={},B=[],q=0,Q=0,T=[],W=!1;s=[...s];for(let m of s){let d={};if(typeof m!="object")throw new Error(`Plugin at index ${Q} must be an object`);let o=r(m,d,"name",y);if(typeof o!="string"||o==="")throw new Error(`Plugin at index ${Q} is missing a name`);try{let O=r(m,d,"setup",Pe);if(typeof O!="function")throw new Error("Plugin is missing a setup function");K(m,d,`on plugin ${V(o)}`);let k={name:o,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};Q++;let C=O({initialOptions:f,resolve:(a,c={})=>{if(!W)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof a!="string")throw new Error("The path to resolve must be a string");let b=Object.create(null),E=r(c,b,"pluginName",y),M=r(c,b,"importer",y),S=r(c,b,"namespace",y),v=r(c,b,"resolveDir",y),h=r(c,b,"kind",y),U=r(c,b,"pluginData",ye);return K(c,b,"in resolve() call"),new Promise((A,P)=>{let D={command:"resolve",path:a,key:e,pluginName:o};if(E!=null&&(D.pluginName=E),M!=null&&(D.importer=M),S!=null&&(D.namespace=S),v!=null&&(D.resolveDir=v),h!=null)D.kind=h;else throw new Error('Must specify "kind" when calling "resolve"');U!=null&&(D.pluginData=p.store(U)),t(i,D,(L,_)=>{L!==null?P(new Error(L)):A({errors:ae(_.errors,p),warnings:ae(_.warnings,p),path:_.path,external:_.external,sideEffects:_.sideEffects,namespace:_.namespace,suffix:_.suffix,pluginData:p.load(_.pluginData)})})})},onStart(a){let c='This error came from the "onStart" callback registered here:',b=ge(new Error(c),u,"onStart");w.push({name:o,callback:a,note:b}),k.onStart=!0},onEnd(a){let c='This error came from the "onEnd" callback registered here:',b=ge(new Error(c),u,"onEnd");x.push({name:o,callback:a,note:b}),k.onEnd=!0},onResolve(a,c){let b='This error came from the "onResolve" callback registered here:',E=ge(new Error(b),u,"onResolve"),M={},S=r(a,M,"filter",he),v=r(a,M,"namespace",y);if(K(a,M,`in onResolve() call for plugin ${V(o)}`),S==null)throw new Error("onResolve() call is missing a filter");let h=q++;F[h]={name:o,callback:c,note:E},k.onResolve.push({id:h,filter:S.source,namespace:v||""})},onLoad(a,c){let b='This error came from the "onLoad" callback registered here:',E=ge(new Error(b),u,"onLoad"),M={},S=r(a,M,"filter",he),v=r(a,M,"namespace",y);if(K(a,M,`in onLoad() call for plugin ${V(o)}`),S==null)throw new Error("onLoad() call is missing a filter");let h=q++;j[h]={name:o,callback:c,note:E},k.onLoad.push({id:h,filter:S.source,namespace:v||""})},onDispose(a){B.push(a)},esbuild:u.esbuild});C&&(yield C),T.push(k)}catch(O){return{ok:!1,error:O,pluginName:o}}}l["on-start"]=(m,d)=>te(void 0,null,function*(){let o={errors:[],warnings:[]};yield Promise.all(w.map(C=>te(void 0,[C],function*({name:O,callback:k,note:$}){try{let a=yield k();if(a!=null){if(typeof a!="object")throw new Error(`Expected onStart() callback in plugin ${V(O)} to return an object`);let c={},b=r(a,c,"errors",z),E=r(a,c,"warnings",z);K(a,c,`from onStart() callback in plugin ${V(O)}`),b!=null&&o.errors.push(...ne(b,"errors",p,O)),E!=null&&o.warnings.push(...ne(E,"warnings",p,O))}}catch(a){o.errors.push(le(a,u,p,$&&$(),O))}}))),n(m,o)}),l["on-resolve"]=(m,d)=>te(void 0,null,function*(){let o={},O="",k,$;for(let C of d.ids)try{({name:O,callback:k,note:$}=F[C]);let a=yield k({path:d.path,importer:d.importer,namespace:d.namespace,resolveDir:d.resolveDir,kind:d.kind,pluginData:p.load(d.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onResolve() callback in plugin ${V(O)} to return an object`);let c={},b=r(a,c,"pluginName",y),E=r(a,c,"path",y),M=r(a,c,"namespace",y),S=r(a,c,"suffix",y),v=r(a,c,"external",I),h=r(a,c,"sideEffects",I),U=r(a,c,"pluginData",ye),A=r(a,c,"errors",z),P=r(a,c,"warnings",z),D=r(a,c,"watchFiles",z),L=r(a,c,"watchDirs",z);K(a,c,`from onResolve() callback in plugin ${V(O)}`),o.id=C,b!=null&&(o.pluginName=b),E!=null&&(o.path=E),M!=null&&(o.namespace=M),S!=null&&(o.suffix=S),v!=null&&(o.external=v),h!=null&&(o.sideEffects=h),U!=null&&(o.pluginData=p.store(U)),A!=null&&(o.errors=ne(A,"errors",p,O)),P!=null&&(o.warnings=ne(P,"warnings",p,O)),D!=null&&(o.watchFiles=me(D,"watchFiles")),L!=null&&(o.watchDirs=me(L,"watchDirs"));break}}catch(a){o={id:C,errors:[le(a,u,p,$&&$(),O)]};break}n(m,o)}),l["on-load"]=(m,d)=>te(void 0,null,function*(){let o={},O="",k,$;for(let C of d.ids)try{({name:O,callback:k,note:$}=j[C]);let a=yield k({path:d.path,namespace:d.namespace,suffix:d.suffix,pluginData:p.load(d.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onLoad() callback in plugin ${V(O)} to return an object`);let c={},b=r(a,c,"pluginName",y),E=r(a,c,"contents",Te),M=r(a,c,"resolveDir",y),S=r(a,c,"pluginData",ye),v=r(a,c,"loader",y),h=r(a,c,"errors",z),U=r(a,c,"warnings",z),A=r(a,c,"watchFiles",z),P=r(a,c,"watchDirs",z);K(a,c,`from onLoad() callback in plugin ${V(O)}`),o.id=C,b!=null&&(o.pluginName=b),E instanceof Uint8Array?o.contents=E:E!=null&&(o.contents=Z(E)),M!=null&&(o.resolveDir=M),S!=null&&(o.pluginData=p.store(S)),v!=null&&(o.loader=v),h!=null&&(o.errors=ne(h,"errors",p,O)),U!=null&&(o.warnings=ne(U,"warnings",p,O)),A!=null&&(o.watchFiles=me(A,"watchFiles")),P!=null&&(o.watchDirs=me(P,"watchDirs"));break}}catch(a){o={id:C,errors:[le(a,u,p,$&&$(),O)]};break}n(m,o)});let Y=(m,d)=>d([],[]);x.length>0&&(Y=(m,d)=>{te(void 0,null,function*(){let o=[],O=[];for(let{name:k,callback:$,note:C}of x){let a,c;try{let b=yield $(m);if(b!=null){if(typeof b!="object")throw new Error(`Expected onEnd() callback in plugin ${V(k)} to return an object`);let E={},M=r(b,E,"errors",z),S=r(b,E,"warnings",z);K(b,E,`from onEnd() callback in plugin ${V(k)}`),M!=null&&(a=ne(M,"errors",p,k)),S!=null&&(c=ne(S,"warnings",p,k))}}catch(b){a=[le(b,u,p,C&&C(),k)]}if(a){o.push(...a);try{m.errors.push(...a)}catch(b){}}if(c){O.push(...c);try{m.warnings.push(...c)}catch(b){}}}d(o,O)})});let R=()=>{for(let m of B)setTimeout(()=>m(),0)};return W=!0,{ok:!0,requestPlugins:T,runOnEndCallbacks:Y,scheduleOnDisposeCallbacks:R}});function Le(){let e=new Map,t=0;return{load(n){return e.get(n)},store(n){if(n===void 0)return-1;let i=t++;return e.set(i,n),i}}}function ge(e,t,n){let i,u=!1;return()=>{if(u)return i;u=!0;try{let l=(e.stack+"").split(`
8
8
  `);l.splice(1,1);let f=Ne(t,l,n);if(f)return i={text:e.message,location:f},i}catch(l){}}}function le(e,t,n,i,u){let l="Internal error",f=null;try{l=(e&&e.message||e)+""}catch(s){}try{f=Ne(t,(e.stack+"").split(`
9
9
  `),"")}catch(s){}return{id:"",pluginName:u,text:l,location:f,notes:i?[i]:[],detail:n?n.store(e):-1}}function Ne(e,t,n){let i=" at ";if(e.readFileSync&&!t[0].startsWith(i)&&t[1].startsWith(i))for(let u=1;u<t.length;u++){let l=t[u];if(l.startsWith(i))for(l=l.slice(i.length);;){let f=/^(?:new |async )?\S+ \((.*)\)$/.exec(l);if(f){l=f[1];continue}if(f=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(l),f){l=f[1];continue}if(f=/^(\S+):(\d+):(\d+)$/.exec(l),f){let s;try{s=e.readFileSync(f[1],"utf8")}catch(F){break}let p=s.split(/\r\n|\r|\n|\u2028|\u2029/)[+f[2]-1]||"",w=+f[3]-1,x=p.slice(w,w+n.length)===n?n.length:0;return{file:f[1],namespace:"file",line:+f[2],column:Z(p.slice(0,w)).length,length:Z(p.slice(w,w+x)).length,lineText:p+`
10
10
  `+t.slice(1).join(`
11
11
  `),suggestion:""}}break}}return null}function ce(e,t,n){let i=5,u=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,i+1).map((f,s)=>{if(s===i)return`
12
12
  ...`;if(!f.location)return`
13
13
  error: ${f.text}`;let{file:p,line:w,column:x}=f.location,F=f.pluginName?`[plugin: ${f.pluginName}] `:"";return`
14
- ${p}:${w}:${x}: ERROR: ${F}${f.text}`}).join(""),l=new Error(`${e}${u}`);return l.errors=t,l.warnings=n,l}function ae(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function De(e,t){if(e==null)return null;let n={},i=r(e,n,"file",y),u=r(e,n,"namespace",y),l=r(e,n,"line",se),f=r(e,n,"column",se),s=r(e,n,"length",se),p=r(e,n,"lineText",y),w=r(e,n,"suggestion",y);return K(e,n,t),{file:i||"",namespace:u||"",line:l||0,column:f||0,length:s||0,lineText:p||"",suggestion:w||""}}function ne(e,t,n,i){let u=[],l=0;for(let f of e){let s={},p=r(f,s,"id",y),w=r(f,s,"pluginName",y),x=r(f,s,"text",y),F=r(f,s,"location",Ae),j=r(f,s,"notes",z),B=r(f,s,"detail",ye),q=`in element ${l} of "${t}"`;K(f,s,q);let Q=[];if(j)for(let T of j){let W={},Y=r(T,W,"text",y),R=r(T,W,"location",Ae);K(T,W,q),Q.push({text:Y||"",location:De(R,q)})}u.push({id:p||"",pluginName:w||i,text:x||"",location:De(F,q),notes:Q,detail:n?n.store(B):-1}),l++}return u}function me(e,t){let n=[];for(let i of e){if(typeof i!="string")throw new Error(`${V(t)} must be an array of strings`);n.push(i)}return n}function lt({path:e,contents:t}){let n=null;return{path:e,contents:t,get text(){let i=this.contents;return(n===null||i!==t)&&(t=i,n=ie(i)),n}}}var ot="0.18.8",at=e=>fe().build(e),ut=e=>fe().context(e),ct=(e,t)=>fe().transform(e,t),ft=(e,t)=>fe().formatMessages(e,t),dt=(e,t)=>fe().analyzeMetafile(e,t),pt=()=>{throw new Error('The "buildSync" API only works in node')},gt=()=>{throw new Error('The "transformSync" API only works in node')},mt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},yt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ue,Se,fe=()=>{if(Se)return Se;throw ue?new Error('You need to wait for the promise returned from "initialize" to be resolved before calling this'):new Error('You need to call "initialize" before calling this')},ht=e=>{e=Be(e||{});let t=e.wasmURL,n=e.wasmModule,i=e.worker!==!1;if(!t&&!n)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(ue)throw new Error('Cannot call "initialize" more than once');return ue=bt(t||"",n,i),ue.catch(()=>{ue=void 0}),ue},bt=(e,t,n)=>te(void 0,null,function*(){let i;if(n){let w=new Blob(['onmessage=(postMessage=>{\n// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\nvar b=(r,f,d)=>new Promise((c,i)=>{var s=u=>{try{o(d.next(u))}catch(m){i(m)}},n=u=>{try{o(d.throw(u))}catch(m){i(m)}},o=u=>u.done?c(u.value):Promise.resolve(u.value).then(s,n);o((d=d.apply(r,f)).next())});let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let f of Object.getOwnPropertyNames(r))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const r=()=>{const c=new Error("not implemented");return c.code="ENOSYS",c};if(!globalThis.fs){let c="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(i,s){c+=d.decode(s);const n=c.lastIndexOf(`\n`);return n!=-1&&(console.log(c.substring(0,n)),c=c.substring(n+1)),s.length},write(i,s,n,o,u,m){if(n!==0||o!==s.length||u!==null){m(r());return}const h=this.writeSync(i,s);m(null,h)},chmod(i,s,n){n(r())},chown(i,s,n,o){o(r())},close(i,s){s(r())},fchmod(i,s,n){n(r())},fchown(i,s,n,o){o(r())},fstat(i,s){s(r())},fsync(i,s){s(null)},ftruncate(i,s,n){n(r())},lchown(i,s,n,o){o(r())},link(i,s,n){n(r())},lstat(i,s){s(r())},mkdir(i,s,n){n(r())},open(i,s,n,o){o(r())},read(i,s,n,o,u,m){m(r())},readdir(i,s){s(r())},readlink(i,s){s(r())},rename(i,s,n){n(r())},rmdir(i,s){s(r())},stat(i,s){s(r())},symlink(i,s,n){n(r())},truncate(i,s,n){n(r())},unlink(i,s){s(r())},utimes(i,s,n,o){o(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const f=new TextEncoder("utf-8"),d=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const c=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},i=(e,t)=>{this.mem.setUint32(e+0,t,!0)},s=e=>{const t=this.mem.getUint32(e+0,!0),l=this.mem.getInt32(e+4,!0);return t+l*4294967296},n=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const l=this.mem.getUint32(e,!0);return this._values[l]},o=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;let y=0;switch(typeof t){case"object":t!==null&&(y=1);break;case"string":y=2;break;case"symbol":y=3;break;case"function":y=4;break}this.mem.setUint32(e+4,2146959360|y,!0),this.mem.setUint32(e,a,!0)},u=e=>{const t=s(e+0),l=s(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,l)},m=e=>{const t=s(e+0),l=s(e+8),a=new Array(l);for(let y=0;y<l;y++)a[y]=n(t+y*8);return a},h=e=>{const t=s(e+0),l=s(e+8);return d.decode(new DataView(this._inst.exports.mem.buffer,t,l))},g=Date.now()-performance.now();this.importObject={_gotest:{add:(e,t)=>e+t},gojs:{"runtime.wasmExit":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e=Number(e);const t=s(e+8),l=s(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,l,a))},"runtime.resetMemoryDataView":e=>{e=Number(e),this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e=Number(e),c(e+8,(g+performance.now())*1e6)},"runtime.walltime":e=>{e=Number(e);const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e=Number(e);const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},s(e+8))),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e=Number(e),crypto.getRandomValues(u(e+8))},"syscall/js.finalizeRef":e=>{e=Number(e);const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const l=this._values[t];this._values[t]=null,this._ids.delete(l),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e=Number(e),o(e+24,h(e+8))},"syscall/js.valueGet":e=>{e=Number(e);const t=Reflect.get(n(e+8),h(e+16));e=Number(this._inst.exports.getsp()),o(e+32,t)},"syscall/js.valueSet":e=>{e=Number(e),Reflect.set(n(e+8),h(e+16),n(e+32))},"syscall/js.valueDelete":e=>{e=Number(e),Reflect.deleteProperty(n(e+8),h(e+16))},"syscall/js.valueIndex":e=>{e=Number(e),o(e+24,Reflect.get(n(e+8),s(e+16)))},"syscall/js.valueSetIndex":e=>{e=Number(e),Reflect.set(n(e+8),s(e+16),n(e+24))},"syscall/js.valueCall":e=>{e=Number(e);try{const t=n(e+8),l=Reflect.get(t,h(e+16)),a=m(e+32),y=Reflect.apply(l,t,a);e=Number(this._inst.exports.getsp()),o(e+56,y),this.mem.setUint8(e+64,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.apply(t,void 0,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.construct(t,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e=Number(e),c(e+16,parseInt(n(e+8).length))},"syscall/js.valuePrepareString":e=>{e=Number(e);const t=f.encode(String(n(e+8)));o(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e=Number(e);const t=n(e+8);u(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e=Number(e),this.mem.setUint8(e+24,n(e+8)instanceof n(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e=Number(e);const t=u(e+8),l=n(e+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e=Number(e);const t=n(e+8),l=u(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(c){return b(this,null,function*(){if(!(c instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=c,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let i=4096;const s=g=>{const e=i,t=f.encode(g+"\\0");return new Uint8Array(this.mem.buffer,i,t.length).set(t),i+=t.length,i%8!==0&&(i+=8-i%8),e},n=this.argv.length,o=[];this.argv.forEach(g=>{o.push(s(g))}),o.push(0),Object.keys(this.env).sort().forEach(g=>{o.push(s(`${g}=${this.env[g]}`))}),o.push(0);const m=i;o.forEach(g=>{this.mem.setUint32(i,g,!0),this.mem.setUint32(i+4,0,!0),i+=8});const h=4096+8192;if(i>=h)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,m),this.exited&&this._resolveExitPromise(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(c){const i=this;return function(){const s={id:c,this:this,args:arguments};return i._pendingEvent=s,i._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,d=globalThis.fs,c="";d.writeSync=(u,m)=>{if(u===1)postMessage(m);else if(u===2){c+=f.decode(m);let h=c.split(`\n`);h.length>1&&console.log(h.slice(0,-1).join(`\n`)),c=h[h.length-1]}else throw new Error("Bad write");return m.length};let i=[],s,n=0;onmessage=({data:u})=>{u.length>0&&(i.push(u),s&&s())},d.read=(u,m,h,g,e,t)=>{if(u!==0||h!==0||g!==m.length||e!==null)throw new Error("Bad read");if(i.length===0){s=()=>d.read(u,m,h,g,e,t);return}let l=i[0],a=Math.max(0,Math.min(g,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(i.shift(),n=0),t(null,a)};let o=new globalThis.Go;o.argv=["","--service=0.18.8"],tryToInstantiateModule(r,o).then(u=>{postMessage(null),o.run(u)},u=>{postMessage(u)})};function tryToInstantiateModule(r,f){return b(this,null,function*(){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const d=yield fetch(r);if(!d.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(d.headers.get("Content-Type")||""))return(yield WebAssembly.instantiateStreaming(d,f.importObject)).instance;const c=yield d.arrayBuffer();return(yield WebAssembly.instantiate(c,f.importObject)).instance})}return r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});i=new Worker(URL.createObjectURL(w))}else{let w=(postMessage=>{
14
+ ${p}:${w}:${x}: ERROR: ${F}${f.text}`}).join(""),l=new Error(`${e}${u}`);return l.errors=t,l.warnings=n,l}function ae(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function De(e,t){if(e==null)return null;let n={},i=r(e,n,"file",y),u=r(e,n,"namespace",y),l=r(e,n,"line",se),f=r(e,n,"column",se),s=r(e,n,"length",se),p=r(e,n,"lineText",y),w=r(e,n,"suggestion",y);return K(e,n,t),{file:i||"",namespace:u||"",line:l||0,column:f||0,length:s||0,lineText:p||"",suggestion:w||""}}function ne(e,t,n,i){let u=[],l=0;for(let f of e){let s={},p=r(f,s,"id",y),w=r(f,s,"pluginName",y),x=r(f,s,"text",y),F=r(f,s,"location",Ae),j=r(f,s,"notes",z),B=r(f,s,"detail",ye),q=`in element ${l} of "${t}"`;K(f,s,q);let Q=[];if(j)for(let T of j){let W={},Y=r(T,W,"text",y),R=r(T,W,"location",Ae);K(T,W,q),Q.push({text:Y||"",location:De(R,q)})}u.push({id:p||"",pluginName:w||i,text:x||"",location:De(F,q),notes:Q,detail:n?n.store(B):-1}),l++}return u}function me(e,t){let n=[];for(let i of e){if(typeof i!="string")throw new Error(`${V(t)} must be an array of strings`);n.push(i)}return n}function lt({path:e,contents:t}){let n=null;return{path:e,contents:t,get text(){let i=this.contents;return(n===null||i!==t)&&(t=i,n=ie(i)),n}}}var ot="0.18.9",at=e=>fe().build(e),ut=e=>fe().context(e),ct=(e,t)=>fe().transform(e,t),ft=(e,t)=>fe().formatMessages(e,t),dt=(e,t)=>fe().analyzeMetafile(e,t),pt=()=>{throw new Error('The "buildSync" API only works in node')},gt=()=>{throw new Error('The "transformSync" API only works in node')},mt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},yt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ue,Se,fe=()=>{if(Se)return Se;throw ue?new Error('You need to wait for the promise returned from "initialize" to be resolved before calling this'):new Error('You need to call "initialize" before calling this')},ht=e=>{e=Be(e||{});let t=e.wasmURL,n=e.wasmModule,i=e.worker!==!1;if(!t&&!n)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(ue)throw new Error('Cannot call "initialize" more than once');return ue=bt(t||"",n,i),ue.catch(()=>{ue=void 0}),ue},bt=(e,t,n)=>te(void 0,null,function*(){let i;if(n){let w=new Blob(['onmessage=(postMessage=>{\n// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\nvar b=(r,f,d)=>new Promise((c,i)=>{var s=u=>{try{o(d.next(u))}catch(m){i(m)}},n=u=>{try{o(d.throw(u))}catch(m){i(m)}},o=u=>u.done?c(u.value):Promise.resolve(u.value).then(s,n);o((d=d.apply(r,f)).next())});let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let f of Object.getOwnPropertyNames(r))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const r=()=>{const c=new Error("not implemented");return c.code="ENOSYS",c};if(!globalThis.fs){let c="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(i,s){c+=d.decode(s);const n=c.lastIndexOf(`\n`);return n!=-1&&(console.log(c.substring(0,n)),c=c.substring(n+1)),s.length},write(i,s,n,o,u,m){if(n!==0||o!==s.length||u!==null){m(r());return}const h=this.writeSync(i,s);m(null,h)},chmod(i,s,n){n(r())},chown(i,s,n,o){o(r())},close(i,s){s(r())},fchmod(i,s,n){n(r())},fchown(i,s,n,o){o(r())},fstat(i,s){s(r())},fsync(i,s){s(null)},ftruncate(i,s,n){n(r())},lchown(i,s,n,o){o(r())},link(i,s,n){n(r())},lstat(i,s){s(r())},mkdir(i,s,n){n(r())},open(i,s,n,o){o(r())},read(i,s,n,o,u,m){m(r())},readdir(i,s){s(r())},readlink(i,s){s(r())},rename(i,s,n){n(r())},rmdir(i,s){s(r())},stat(i,s){s(r())},symlink(i,s,n){n(r())},truncate(i,s,n){n(r())},unlink(i,s){s(r())},utimes(i,s,n,o){o(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const f=new TextEncoder("utf-8"),d=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const c=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},i=(e,t)=>{this.mem.setUint32(e+0,t,!0)},s=e=>{const t=this.mem.getUint32(e+0,!0),l=this.mem.getInt32(e+4,!0);return t+l*4294967296},n=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const l=this.mem.getUint32(e,!0);return this._values[l]},o=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;let y=0;switch(typeof t){case"object":t!==null&&(y=1);break;case"string":y=2;break;case"symbol":y=3;break;case"function":y=4;break}this.mem.setUint32(e+4,2146959360|y,!0),this.mem.setUint32(e,a,!0)},u=e=>{const t=s(e+0),l=s(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,l)},m=e=>{const t=s(e+0),l=s(e+8),a=new Array(l);for(let y=0;y<l;y++)a[y]=n(t+y*8);return a},h=e=>{const t=s(e+0),l=s(e+8);return d.decode(new DataView(this._inst.exports.mem.buffer,t,l))},g=Date.now()-performance.now();this.importObject={_gotest:{add:(e,t)=>e+t},gojs:{"runtime.wasmExit":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e=Number(e);const t=s(e+8),l=s(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,l,a))},"runtime.resetMemoryDataView":e=>{e=Number(e),this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e=Number(e),c(e+8,(g+performance.now())*1e6)},"runtime.walltime":e=>{e=Number(e);const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e=Number(e);const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},s(e+8))),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e=Number(e),crypto.getRandomValues(u(e+8))},"syscall/js.finalizeRef":e=>{e=Number(e);const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const l=this._values[t];this._values[t]=null,this._ids.delete(l),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e=Number(e),o(e+24,h(e+8))},"syscall/js.valueGet":e=>{e=Number(e);const t=Reflect.get(n(e+8),h(e+16));e=Number(this._inst.exports.getsp()),o(e+32,t)},"syscall/js.valueSet":e=>{e=Number(e),Reflect.set(n(e+8),h(e+16),n(e+32))},"syscall/js.valueDelete":e=>{e=Number(e),Reflect.deleteProperty(n(e+8),h(e+16))},"syscall/js.valueIndex":e=>{e=Number(e),o(e+24,Reflect.get(n(e+8),s(e+16)))},"syscall/js.valueSetIndex":e=>{e=Number(e),Reflect.set(n(e+8),s(e+16),n(e+24))},"syscall/js.valueCall":e=>{e=Number(e);try{const t=n(e+8),l=Reflect.get(t,h(e+16)),a=m(e+32),y=Reflect.apply(l,t,a);e=Number(this._inst.exports.getsp()),o(e+56,y),this.mem.setUint8(e+64,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.apply(t,void 0,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.construct(t,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e=Number(e),c(e+16,parseInt(n(e+8).length))},"syscall/js.valuePrepareString":e=>{e=Number(e);const t=f.encode(String(n(e+8)));o(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e=Number(e);const t=n(e+8);u(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e=Number(e),this.mem.setUint8(e+24,n(e+8)instanceof n(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e=Number(e);const t=u(e+8),l=n(e+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e=Number(e);const t=n(e+8),l=u(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(c){return b(this,null,function*(){if(!(c instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=c,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let i=4096;const s=g=>{const e=i,t=f.encode(g+"\\0");return new Uint8Array(this.mem.buffer,i,t.length).set(t),i+=t.length,i%8!==0&&(i+=8-i%8),e},n=this.argv.length,o=[];this.argv.forEach(g=>{o.push(s(g))}),o.push(0),Object.keys(this.env).sort().forEach(g=>{o.push(s(`${g}=${this.env[g]}`))}),o.push(0);const m=i;o.forEach(g=>{this.mem.setUint32(i,g,!0),this.mem.setUint32(i+4,0,!0),i+=8});const h=4096+8192;if(i>=h)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,m),this.exited&&this._resolveExitPromise(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(c){const i=this;return function(){const s={id:c,this:this,args:arguments};return i._pendingEvent=s,i._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,d=globalThis.fs,c="";d.writeSync=(u,m)=>{if(u===1)postMessage(m);else if(u===2){c+=f.decode(m);let h=c.split(`\n`);h.length>1&&console.log(h.slice(0,-1).join(`\n`)),c=h[h.length-1]}else throw new Error("Bad write");return m.length};let i=[],s,n=0;onmessage=({data:u})=>{u.length>0&&(i.push(u),s&&s())},d.read=(u,m,h,g,e,t)=>{if(u!==0||h!==0||g!==m.length||e!==null)throw new Error("Bad read");if(i.length===0){s=()=>d.read(u,m,h,g,e,t);return}let l=i[0],a=Math.max(0,Math.min(g,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(i.shift(),n=0),t(null,a)};let o=new globalThis.Go;o.argv=["","--service=0.18.9"],tryToInstantiateModule(r,o).then(u=>{postMessage(null),o.run(u)},u=>{postMessage(u)})};function tryToInstantiateModule(r,f){return b(this,null,function*(){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const d=yield fetch(r);if(!d.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(d.headers.get("Content-Type")||""))return(yield WebAssembly.instantiateStreaming(d,f.importObject)).instance;const c=yield d.arrayBuffer();return(yield WebAssembly.instantiate(c,f.importObject)).instance})}return r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});i=new Worker(URL.createObjectURL(w))}else{let w=(postMessage=>{
15
15
  // Copyright 2018 The Go Authors. All rights reserved.
16
16
  // Use of this source code is governed by a BSD-style
17
17
  // license that can be found in the LICENSE file.
18
18
  var b=(r,f,d)=>new Promise((c,i)=>{var s=u=>{try{o(d.next(u))}catch(m){i(m)}},n=u=>{try{o(d.throw(u))}catch(m){i(m)}},o=u=>u.done?c(u.value):Promise.resolve(u.value).then(s,n);o((d=d.apply(r,f)).next())});let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let f of Object.getOwnPropertyNames(r))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const r=()=>{const c=new Error("not implemented");return c.code="ENOSYS",c};if(!globalThis.fs){let c="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(i,s){c+=d.decode(s);const n=c.lastIndexOf(`
19
19
  `);return n!=-1&&(console.log(c.substring(0,n)),c=c.substring(n+1)),s.length},write(i,s,n,o,u,m){if(n!==0||o!==s.length||u!==null){m(r());return}const h=this.writeSync(i,s);m(null,h)},chmod(i,s,n){n(r())},chown(i,s,n,o){o(r())},close(i,s){s(r())},fchmod(i,s,n){n(r())},fchown(i,s,n,o){o(r())},fstat(i,s){s(r())},fsync(i,s){s(null)},ftruncate(i,s,n){n(r())},lchown(i,s,n,o){o(r())},link(i,s,n){n(r())},lstat(i,s){s(r())},mkdir(i,s,n){n(r())},open(i,s,n,o){o(r())},read(i,s,n,o,u,m){m(r())},readdir(i,s){s(r())},readlink(i,s){s(r())},rename(i,s,n){n(r())},rmdir(i,s){s(r())},stat(i,s){s(r())},symlink(i,s,n){n(r())},truncate(i,s,n){n(r())},unlink(i,s){s(r())},utimes(i,s,n,o){o(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const f=new TextEncoder("utf-8"),d=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const c=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},i=(e,t)=>{this.mem.setUint32(e+0,t,!0)},s=e=>{const t=this.mem.getUint32(e+0,!0),l=this.mem.getInt32(e+4,!0);return t+l*4294967296},n=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const l=this.mem.getUint32(e,!0);return this._values[l]},o=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;let y=0;switch(typeof t){case"object":t!==null&&(y=1);break;case"string":y=2;break;case"symbol":y=3;break;case"function":y=4;break}this.mem.setUint32(e+4,2146959360|y,!0),this.mem.setUint32(e,a,!0)},u=e=>{const t=s(e+0),l=s(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,l)},m=e=>{const t=s(e+0),l=s(e+8),a=new Array(l);for(let y=0;y<l;y++)a[y]=n(t+y*8);return a},h=e=>{const t=s(e+0),l=s(e+8);return d.decode(new DataView(this._inst.exports.mem.buffer,t,l))},g=Date.now()-performance.now();this.importObject={_gotest:{add:(e,t)=>e+t},gojs:{"runtime.wasmExit":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e=Number(e);const t=s(e+8),l=s(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,l,a))},"runtime.resetMemoryDataView":e=>{e=Number(e),this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e=Number(e),c(e+8,(g+performance.now())*1e6)},"runtime.walltime":e=>{e=Number(e);const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e=Number(e);const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},s(e+8))),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e=Number(e);const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e=Number(e),crypto.getRandomValues(u(e+8))},"syscall/js.finalizeRef":e=>{e=Number(e);const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const l=this._values[t];this._values[t]=null,this._ids.delete(l),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e=Number(e),o(e+24,h(e+8))},"syscall/js.valueGet":e=>{e=Number(e);const t=Reflect.get(n(e+8),h(e+16));e=Number(this._inst.exports.getsp()),o(e+32,t)},"syscall/js.valueSet":e=>{e=Number(e),Reflect.set(n(e+8),h(e+16),n(e+32))},"syscall/js.valueDelete":e=>{e=Number(e),Reflect.deleteProperty(n(e+8),h(e+16))},"syscall/js.valueIndex":e=>{e=Number(e),o(e+24,Reflect.get(n(e+8),s(e+16)))},"syscall/js.valueSetIndex":e=>{e=Number(e),Reflect.set(n(e+8),s(e+16),n(e+24))},"syscall/js.valueCall":e=>{e=Number(e);try{const t=n(e+8),l=Reflect.get(t,h(e+16)),a=m(e+32),y=Reflect.apply(l,t,a);e=Number(this._inst.exports.getsp()),o(e+56,y),this.mem.setUint8(e+64,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.apply(t,void 0,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e=Number(e);try{const t=n(e+8),l=m(e+16),a=Reflect.construct(t,l);e=Number(this._inst.exports.getsp()),o(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=Number(this._inst.exports.getsp()),o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e=Number(e),c(e+16,parseInt(n(e+8).length))},"syscall/js.valuePrepareString":e=>{e=Number(e);const t=f.encode(String(n(e+8)));o(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e=Number(e);const t=n(e+8);u(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e=Number(e),this.mem.setUint8(e+24,n(e+8)instanceof n(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e=Number(e);const t=u(e+8),l=n(e+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e=Number(e);const t=n(e+8),l=u(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=l.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(c){return b(this,null,function*(){if(!(c instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=c,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let i=4096;const s=g=>{const e=i,t=f.encode(g+"\0");return new Uint8Array(this.mem.buffer,i,t.length).set(t),i+=t.length,i%8!==0&&(i+=8-i%8),e},n=this.argv.length,o=[];this.argv.forEach(g=>{o.push(s(g))}),o.push(0),Object.keys(this.env).sort().forEach(g=>{o.push(s(`${g}=${this.env[g]}`))}),o.push(0);const m=i;o.forEach(g=>{this.mem.setUint32(i,g,!0),this.mem.setUint32(i+4,0,!0),i+=8});const h=4096+8192;if(i>=h)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,m),this.exited&&this._resolveExitPromise(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(c){const i=this;return function(){const s={id:c,this:this,args:arguments};return i._pendingEvent=s,i._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,d=globalThis.fs,c="";d.writeSync=(u,m)=>{if(u===1)postMessage(m);else if(u===2){c+=f.decode(m);let h=c.split(`
20
20
  `);h.length>1&&console.log(h.slice(0,-1).join(`
21
- `)),c=h[h.length-1]}else throw new Error("Bad write");return m.length};let i=[],s,n=0;onmessage=({data:u})=>{u.length>0&&(i.push(u),s&&s())},d.read=(u,m,h,g,e,t)=>{if(u!==0||h!==0||g!==m.length||e!==null)throw new Error("Bad read");if(i.length===0){s=()=>d.read(u,m,h,g,e,t);return}let l=i[0],a=Math.max(0,Math.min(g,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(i.shift(),n=0),t(null,a)};let o=new globalThis.Go;o.argv=["","--service=0.18.8"],tryToInstantiateModule(r,o).then(u=>{postMessage(null),o.run(u)},u=>{postMessage(u)})};function tryToInstantiateModule(r,f){return b(this,null,function*(){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const d=yield fetch(r);if(!d.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\/wasm($|;)/i.test(d.headers.get("Content-Type")||""))return(yield WebAssembly.instantiateStreaming(d,f.importObject)).instance;const c=yield d.arrayBuffer();return(yield WebAssembly.instantiate(c,f.importObject)).instance})}return r=>onmessage(r);})(x=>i.onmessage({data:x}));i={onmessage:null,postMessage:x=>setTimeout(()=>w({data:x})),terminate(){}}}let u,l,f=new Promise((w,x)=>{u=w,l=x});i.onmessage=({data:w})=>{i.onmessage=({data:x})=>s(x),w?l(w):u()},i.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:s,service:p}=qe({writeToStdin(w){i.postMessage(w)},isSync:!1,hasFS:!1,esbuild:we});yield f,Se={build:w=>new Promise((x,F)=>p.buildOrContext({callName:"build",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(j,B)=>j?F(j):x(B)})),context:w=>new Promise((x,F)=>p.buildOrContext({callName:"context",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(j,B)=>j?F(j):x(B)})),transform:(w,x)=>new Promise((F,j)=>p.transform({callName:"transform",refs:null,input:w,options:x||{},isTTY:!1,fs:{readFile(B,q){q(new Error("Internal error"),null)},writeFile(B,q){q(null)}},callback:(B,q)=>B?j(B):F(q)})),formatMessages:(w,x)=>new Promise((F,j)=>p.formatMessages({callName:"formatMessages",refs:null,messages:w,options:x,callback:(B,q)=>B?j(B):F(q)})),analyzeMetafile:(w,x)=>new Promise((F,j)=>p.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof w=="string"?w:JSON.stringify(w),options:x,callback:(B,q)=>B?j(B):F(q)}))}}),wt=we;
21
+ `)),c=h[h.length-1]}else throw new Error("Bad write");return m.length};let i=[],s,n=0;onmessage=({data:u})=>{u.length>0&&(i.push(u),s&&s())},d.read=(u,m,h,g,e,t)=>{if(u!==0||h!==0||g!==m.length||e!==null)throw new Error("Bad read");if(i.length===0){s=()=>d.read(u,m,h,g,e,t);return}let l=i[0],a=Math.max(0,Math.min(g,l.length-n));m.set(l.subarray(n,n+a),h),n+=a,n===l.length&&(i.shift(),n=0),t(null,a)};let o=new globalThis.Go;o.argv=["","--service=0.18.9"],tryToInstantiateModule(r,o).then(u=>{postMessage(null),o.run(u)},u=>{postMessage(u)})};function tryToInstantiateModule(r,f){return b(this,null,function*(){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const d=yield fetch(r);if(!d.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\/wasm($|;)/i.test(d.headers.get("Content-Type")||""))return(yield WebAssembly.instantiateStreaming(d,f.importObject)).instance;const c=yield d.arrayBuffer();return(yield WebAssembly.instantiate(c,f.importObject)).instance})}return r=>onmessage(r);})(x=>i.onmessage({data:x}));i={onmessage:null,postMessage:x=>setTimeout(()=>w({data:x})),terminate(){}}}let u,l,f=new Promise((w,x)=>{u=w,l=x});i.onmessage=({data:w})=>{i.onmessage=({data:x})=>s(x),w?l(w):u()},i.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:s,service:p}=qe({writeToStdin(w){i.postMessage(w)},isSync:!1,hasFS:!1,esbuild:we});yield f,Se={build:w=>new Promise((x,F)=>p.buildOrContext({callName:"build",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(j,B)=>j?F(j):x(B)})),context:w=>new Promise((x,F)=>p.buildOrContext({callName:"context",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(j,B)=>j?F(j):x(B)})),transform:(w,x)=>new Promise((F,j)=>p.transform({callName:"transform",refs:null,input:w,options:x||{},isTTY:!1,fs:{readFile(B,q){q(new Error("Internal error"),null)},writeFile(B,q){q(null)}},callback:(B,q)=>B?j(B):F(q)})),formatMessages:(w,x)=>new Promise((F,j)=>p.formatMessages({callName:"formatMessages",refs:null,messages:w,options:x,callback:(B,q)=>B?j(B):F(q)})),analyzeMetafile:(w,x)=>new Promise((F,j)=>p.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof w=="string"?w:JSON.stringify(w),options:x,callback:(B,q)=>B?j(B):F(q)}))}}),wt=we;
22
22
  })(typeof module==="object"?module:{set exports(x){(typeof self!=="undefined"?self:this).esbuild=x}});
package/lib/main.js CHANGED
@@ -728,8 +728,8 @@ function createChannel(streamIn) {
728
728
  if (isFirstPacket) {
729
729
  isFirstPacket = false;
730
730
  let binaryVersion = String.fromCharCode(...bytes);
731
- if (binaryVersion !== "0.18.8") {
732
- throw new Error(`Cannot start service: Host version "${"0.18.8"}" does not match binary version ${quote(binaryVersion)}`);
731
+ if (binaryVersion !== "0.18.9") {
732
+ throw new Error(`Cannot start service: Host version "${"0.18.9"}" does not match binary version ${quote(binaryVersion)}`);
733
733
  }
734
734
  return;
735
735
  }
@@ -1750,7 +1750,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
1750
1750
  }
1751
1751
  }
1752
1752
  var _a;
1753
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.18.8";
1753
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.18.9";
1754
1754
  var esbuildCommandAndArgs = () => {
1755
1755
  if ((!ESBUILD_BINARY_PATH || true) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
1756
1756
  throw new Error(
@@ -1817,7 +1817,7 @@ var fsAsync = {
1817
1817
  }
1818
1818
  }
1819
1819
  };
1820
- var version = "0.18.8";
1820
+ var version = "0.18.9";
1821
1821
  var build = (options) => ensureServiceIsRunning().build(options);
1822
1822
  var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
1823
1823
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -1927,7 +1927,7 @@ var ensureServiceIsRunning = () => {
1927
1927
  if (longLivedService)
1928
1928
  return longLivedService;
1929
1929
  let [command, args] = esbuildCommandAndArgs();
1930
- let child = child_process.spawn(command, args.concat(`--service=${"0.18.8"}`, "--ping"), {
1930
+ let child = child_process.spawn(command, args.concat(`--service=${"0.18.9"}`, "--ping"), {
1931
1931
  windowsHide: true,
1932
1932
  stdio: ["pipe", "pipe", "inherit"],
1933
1933
  cwd: defaultWD
@@ -2027,7 +2027,7 @@ var runServiceSync = (callback) => {
2027
2027
  esbuild: node_exports
2028
2028
  });
2029
2029
  callback(service);
2030
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.18.8"}`), {
2030
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.18.9"}`), {
2031
2031
  cwd: defaultWD,
2032
2032
  windowsHide: true,
2033
2033
  input: stdin,
@@ -2047,7 +2047,7 @@ var workerThreadService = null;
2047
2047
  var startWorkerThreadService = (worker_threads2) => {
2048
2048
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
2049
2049
  let worker = new worker_threads2.Worker(__filename, {
2050
- workerData: { workerPort, defaultWD, esbuildVersion: "0.18.8" },
2050
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.18.9" },
2051
2051
  transferList: [workerPort],
2052
2052
  // From node's documentation: https://nodejs.org/api/worker_threads.html
2053
2053
  //
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "esbuild-wasm-strapkit",
3
- "version": "0.18.8-build.3",
4
- "esbuildVersion": "0.18.8",
5
- "description": "esbuild-wasm 0.18.8",
3
+ "version": "0.18.9-build.3",
4
+ "esbuildVersion": "0.18.9",
5
+ "description": "esbuild-wasm 0.18.9",
6
6
  "license": "MIT",
7
7
  "engines": {
8
8
  "node": ">=12"