esbuild-wasm-strapkit 0.18.2-build.3 → 0.18.3-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 +0 -0
- package/esm/browser.js +5 -5
- package/esm/browser.min.js +3 -3
- package/lib/browser.js +5 -5
- package/lib/browser.min.js +3 -3
- package/lib/main.js +7 -7
- package/package.json +3 -3
package/esbuild.wasm
CHANGED
|
Binary file
|
package/esm/browser.js
CHANGED
|
@@ -711,8 +711,8 @@ function createChannel(streamIn) {
|
|
|
711
711
|
if (isFirstPacket) {
|
|
712
712
|
isFirstPacket = false;
|
|
713
713
|
let binaryVersion = String.fromCharCode(...bytes);
|
|
714
|
-
if (binaryVersion !== "0.18.
|
|
715
|
-
throw new Error(`Cannot start service: Host version "${"0.18.
|
|
714
|
+
if (binaryVersion !== "0.18.3") {
|
|
715
|
+
throw new Error(`Cannot start service: Host version "${"0.18.3"}" does not match binary version ${quote(binaryVersion)}`);
|
|
716
716
|
}
|
|
717
717
|
return;
|
|
718
718
|
}
|
|
@@ -1706,7 +1706,7 @@ function convertOutputFiles({ path, contents }) {
|
|
|
1706
1706
|
}
|
|
1707
1707
|
|
|
1708
1708
|
// lib/npm/browser.ts
|
|
1709
|
-
var version = "0.18.
|
|
1709
|
+
var version = "0.18.3";
|
|
1710
1710
|
var build = (options) => ensureServiceIsRunning().build(options);
|
|
1711
1711
|
var context = (options) => ensureServiceIsRunning().context(options);
|
|
1712
1712
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
@@ -1751,7 +1751,7 @@ var initialize = (options) => {
|
|
|
1751
1751
|
var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
1752
1752
|
let worker;
|
|
1753
1753
|
if (useWorker) {
|
|
1754
|
-
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.2"}`];\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" });
|
|
1754
|
+
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.3"}`];\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" });
|
|
1755
1755
|
worker = new Worker(URL.createObjectURL(blob));
|
|
1756
1756
|
} else {
|
|
1757
1757
|
let onmessage = ((postMessage) => {
|
|
@@ -2370,7 +2370,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
|
2370
2370
|
callback(null, count);
|
|
2371
2371
|
};
|
|
2372
2372
|
let go = new globalThis.Go();
|
|
2373
|
-
go.argv = ["", `--service=${"0.18.
|
|
2373
|
+
go.argv = ["", `--service=${"0.18.3"}`];
|
|
2374
2374
|
tryToInstantiateModule(wasm, go).then(
|
|
2375
2375
|
(instance) => {
|
|
2376
2376
|
postMessage(null);
|
package/esm/browser.min.js
CHANGED
|
@@ -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",h=e=>typeof e=="string"?null:"a string",ye=e=>e instanceof RegExp?null:"a RegExp object",se=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",h),o=r(t,n,"logLimit",se);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",h),d=r(t,n,"sourceRoot",h),i=r(t,n,"sourcesContent",I),f=r(t,n,"target",Ye),o=r(t,n,"format",h),y=r(t,n,"globalName",h),w=r(t,n,"mangleProps",ye),v=r(t,n,"reserveProps",ye),F=r(t,n,"mangleQuoted",I),U=r(t,n,"minify",I),B=r(t,n,"minifySyntax",I),j=r(t,n,"minifyWhitespace",I),Q=r(t,n,"minifyIdentifiers",I),T=r(t,n,"drop",z),W=r(t,n,"charset",h),Y=r(t,n,"treeShaking",I),x=r(t,n,"ignoreAnnotations",I),m=r(t,n,"jsx",h),c=r(t,n,"jsxFactory",h),s=r(t,n,"jsxFragment",h),R=r(t,n,"jsxImportSource",h),S=r(t,n,"jsxDev",I),$=r(t,n,"jsxSideEffects",I),O=r(t,n,"define",ee),a=r(t,n,"logOverride",ee),u=r(t,n,"supported",ee),b=r(t,n,"pure",z),M=r(t,n,"keepNames",I),k=r(t,n,"platform",h),E=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}`),y&&e.push(`--global-name=${y}`),k&&e.push(`--platform=${k}`),E&&e.push(`--tsconfig-raw=${typeof E=="string"?E:JSON.stringify(E)}`),U&&e.push("--minify"),B&&e.push("--minify-syntax"),j&&e.push("--minify-whitespace"),Q&&e.push("--minify-identifiers"),W&&e.push(`--charset=${W}`),Y!==void 0&&e.push(`--tree-shaking=${Y}`),x&&e.push("--ignore-annotations"),T)for(let p of T)e.push(`--drop:${J(p,"drop")}`);if(w&&e.push(`--mangle-props=${w.source}`),v&&e.push(`--reserve-props=${v.source}`),F!==void 0&&e.push(`--mangle-quoted=${F}`),m&&e.push(`--jsx=${m}`),c&&e.push(`--jsx-factory=${c}`),s&&e.push(`--jsx-fragment=${s}`),R&&e.push(`--jsx-import-source=${R}`),S&&e.push("--jsx-dev"),$&&e.push("--jsx-side-effects"),O)for(let p in O){if(p.indexOf("=")>=0)throw new Error(`Invalid define: ${p}`);e.push(`--define:${p}=${J(O[p],"define",p)}`)}if(a)for(let p in a){if(p.indexOf("=")>=0)throw new Error(`Invalid log override: ${p}`);e.push(`--log-override:${p}=${J(a[p],"log override",p)}`)}if(u)for(let p in u){if(p.indexOf("=")>=0)throw new Error(`Invalid supported: ${p}`);let C=u[p];if(typeof C!="boolean")throw new Error(`Expected value for supported ${V(p)} to be a boolean, got ${typeof C} instead`);e.push(`--supported:${p}=${C}`)}if(b)for(let p of b)e.push(`--pure:${J(p,"pure")}`);M&&e.push("--keep-names")}function Qe(e,t,n,l,d){var le;let i=[],f=[],o=Object.create(null),y=null,w=null;he(i,t,o,n,l),Be(i,t,o);let v=r(t,o,"sourcemap",De),F=r(t,o,"bundle",I),U=r(t,o,"splitting",I),B=r(t,o,"preserveSymlinks",I),j=r(t,o,"metafile",I),Q=r(t,o,"outfile",h),T=r(t,o,"outdir",h),W=r(t,o,"outbase",h),Y=r(t,o,"tsconfig",h),x=r(t,o,"resolveExtensions",z),m=r(t,o,"nodePaths",z),c=r(t,o,"mainFields",z),s=r(t,o,"conditions",z),R=r(t,o,"external",z),S=r(t,o,"packages",h),$=r(t,o,"alias",ee),O=r(t,o,"loader",ee),a=r(t,o,"outExtension",ee),u=r(t,o,"publicPath",h),b=r(t,o,"entryNames",h),M=r(t,o,"chunkNames",h),k=r(t,o,"assetNames",h),E=r(t,o,"inject",z),p=r(t,o,"banner",ee),C=r(t,o,"footer",ee),L=r(t,o,"entryPoints",Ke),A=r(t,o,"absWorkingDir",h),P=r(t,o,"stdin",ee),D=(le=r(t,o,"write",I))!=null?le:d,q=r(t,o,"allowOverwrite",I),_=r(t,o,"mangleCache",ee);if(o.plugins=!0,K(t,o,`in ${e}() call`),v&&i.push(`--sourcemap${v===!0?"":`=${v}`}`),F&&i.push("--bundle"),q&&i.push("--allow-overwrite"),U&&i.push("--splitting"),B&&i.push("--preserve-symlinks"),j&&i.push("--metafile"),Q&&i.push(`--outfile=${Q}`),T&&i.push(`--outdir=${T}`),W&&i.push(`--outbase=${W}`),Y&&i.push(`--tsconfig=${Y}`),S&&i.push(`--packages=${S}`),x){let g=[];for(let N of x){if(J(N,"resolve extension"),N.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${N}`);g.push(N)}i.push(`--resolve-extensions=${g.join(",")}`)}if(u&&i.push(`--public-path=${u}`),b&&i.push(`--entry-names=${b}`),M&&i.push(`--chunk-names=${M}`),k&&i.push(`--asset-names=${k}`),c){let g=[];for(let N of c){if(J(N,"main field"),N.indexOf(",")>=0)throw new Error(`Invalid main field: ${N}`);g.push(N)}i.push(`--main-fields=${g.join(",")}`)}if(s){let g=[];for(let N of s){if(J(N,"condition"),N.indexOf(",")>=0)throw new Error(`Invalid condition: ${N}`);g.push(N)}i.push(`--conditions=${g.join(",")}`)}if(R)for(let g of R)i.push(`--external:${J(g,"external")}`);if($)for(let g in $){if(g.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${g}`);i.push(`--alias:${g}=${J($[g],"alias",g)}`)}if(p)for(let g in p){if(g.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${g}`);i.push(`--banner:${g}=${J(p[g],"banner",g)}`)}if(C)for(let g in C){if(g.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${g}`);i.push(`--footer:${g}=${J(C[g],"footer",g)}`)}if(E)for(let g of E)i.push(`--inject:${J(g,"inject")}`);if(O)for(let g in O){if(g.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${g}`);i.push(`--loader:${g}=${J(O[g],"loader",g)}`)}if(a)for(let g in a){if(g.indexOf("=")>=0)throw new Error(`Invalid out extension: ${g}`);i.push(`--out-extension:${g}=${J(a[g],"out extension",g)}`)}if(L)if(Array.isArray(L))for(let g=0,N=L.length;g<N;g++){let G=L[g];if(typeof G=="object"&&G!==null){let X=Object.create(null),ne=r(G,X,"in",h),fe=r(G,X,"out",h);if(K(G,X,"in entry point at index "+g),ne===void 0)throw new Error('Missing property "in" for entry point at index '+g);if(fe===void 0)throw new Error('Missing property "out" for entry point at index '+g);f.push([fe,ne])}else f.push(["",J(G,"entry point at index "+g)])}else for(let g in L)f.push([g,J(L[g],"entry point",g)]);if(P){let g=Object.create(null),N=r(P,g,"contents",Pe),G=r(P,g,"resolveDir",h),X=r(P,g,"sourcefile",h),ne=r(P,g,"loader",h);K(P,g,'in "stdin" object'),X&&i.push(`--sourcefile=${X}`),ne&&i.push(`--loader=${ne}`),G&&(w=G),typeof N=="string"?y=Z(N):N instanceof Uint8Array&&(y=N)}let H=[];if(m)for(let g of m)g+="",H.push(g);return{entries:f,flags:i,write:D,stdinContents:y,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",h),y=r(t,i,"loader",h),w=r(t,i,"banner",h),v=r(t,i,"footer",h),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}`),y&&d.push(`--loader=${y}`),w&&d.push(`--banner=${w}`),v&&d.push(`--footer=${v}`),{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,y=x=>{let m=o+x.length;if(m>f.length){let s=new Uint8Array(m*2);s.set(f),f=s}f.set(x,o),o+=x.length;let c=0;for(;c+4<=o;){let s=Re(f,c);if(c+4+s>o)break;c+=4,j(f.subarray(c,c+s)),c+=s}c>0&&(f.copyWithin(0,c,o),o-=c)},w=x=>{n.didClose=!0,x&&(n.reason=": "+(x.message||x));let m="The service was stopped"+n.reason;for(let c in l)l[c](m,null);l={}},v=(x,m,c)=>{if(n.didClose)return c("The service is no longer running"+n.reason,null);let s=d++;l[s]=(R,S)=>{try{c(R,S)}finally{x&&x.unref()}},x&&x.ref(),e.writeToStdin(xe({id:s,isRequest:!0,value:m}))},F=(x,m)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(xe({id:x,isRequest:!1,value:m}))},U=async(x,m)=>{try{if(m.command==="ping"){F(x,{});return}if(typeof m.key=="number"){let c=t[m.key];if(c){let s=c[m.command];if(s){await s(x,m);return}}}throw new Error("Invalid command: "+m.command)}catch(c){F(x,{errors:[ie(c,e,null,void 0,"")]})}},B=!0,j=x=>{if(B){B=!1;let c=String.fromCharCode(...x);if(c!=="0.18.2")throw new Error(`Cannot start service: Host version "0.18.2" does not match binary version ${V(c)}`);return}let m=Ee(x);if(m.isRequest)U(m.id,m.value);else{let c=l[m.id];delete l[m.id],m.value.error?c(m.value.error,{}):c(null,m.value)}};return{readFromStdout:y,afterClose:w,service:{buildOrContext:({callName:x,refs:m,options:c,isTTY:s,defaultWD:R,callback:S})=>{let $=0,O=i++,a={},u={ref(){++$===1&&m&&m.ref()},unref(){--$===0&&(delete t[O],m&&m.unref())}};t[O]=a,u.ref(),Ge(x,O,v,F,u,e,a,c,s,R,(b,M)=>{try{S(b,M)}finally{u.unref()}})},transform:({callName:x,refs:m,input:c,options:s,isTTY:R,fs:S,callback:$})=>{let O=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:M}=He(x,s,R,ke),k={command:"transform",flags:b,inputFS:u!==null,input:u!==null?Z(u):typeof c=="string"?Z(c):c};M&&(k.mangleCache=M),v(m,k,(E,p)=>{if(E)return $(new Error(E),null);let C=oe(p.errors,O),L=oe(p.warnings,O),A=1,P=()=>{if(--A===0){let D={warnings:L,code:p.code,map:p.map,mangleCache:void 0,legalComments:void 0};"legalComments"in p&&(D.legalComments=p==null?void 0:p.legalComments),p.mangleCache&&(D.mangleCache=p==null?void 0:p.mangleCache),$(null,D)}};if(C.length>0)return $(ue("Transform failed",C,L),null);p.codeFS&&(A++,S.readFile(p.code,(D,q)=>{D!==null?$(D,null):(p.code=q,P())})),p.mapFS&&(A++,S.readFile(p.map,(D,q)=>{D!==null?$(D,null):(p.map=q,P())})),P()})}catch(b){let M=[];try{he(M,s,{},R,ke)}catch(E){}let k=ie(b,e,O,void 0,"");v(m,{command:"error",flags:M,error:k},()=>{k.detail=O.load(k.detail),$(ue("Transform failed",[k],[]),null)})}};if((typeof c=="string"||c instanceof Uint8Array)&&c.length>1024*1024){let u=a;a=()=>S.writeFile(c,u)}a(null)},formatMessages:({callName:x,refs:m,messages:c,options:s,callback:R})=>{let S=te(c,"messages",null,"");if(!s)throw new Error(`Missing second argument in ${x}() call`);let $={},O=r(s,$,"kind",h),a=r(s,$,"color",I),u=r(s,$,"terminalWidth",se);if(K(s,$,`in ${x}() call`),O===void 0)throw new Error(`Missing "kind" in ${x}() call`);if(O!=="error"&&O!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${x}() call`);let b={command:"format-msgs",messages:S,isWarning:O==="warning"};a!==void 0&&(b.color=a),u!==void 0&&(b.terminalWidth=u),v(m,b,(M,k)=>{if(M)return R(new Error(M),null);R(null,k.messages)})},analyzeMetafile:({callName:x,refs:m,metafile:c,options:s,callback:R})=>{s===void 0&&(s={});let S={},$=r(s,S,"color",I),O=r(s,S,"verbose",I);K(s,S,`in ${x}() call`);let a={command:"analyze-metafile",metafile:c};$!==void 0&&(a.color=$),O!==void 0&&(a.verbose=O),v(m,a,(u,b)=>{if(u)return R(new Error(u),null);R(null,b.result)})}}}}function Ge(e,t,n,l,d,i,f,o,y,w,v){let F=je(),U=e==="context",B=(T,W)=>{let Y=[];try{he(Y,o,{},y,Se)}catch(m){}let x=ie(T,i,F,void 0,W);n(d,{command:"error",flags:Y,error:x},()=>{x.detail=F.load(x.detail),v(ue(U?"Context failed":"Build failed",[x],[]),null)})},j;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'),"");j=T}}if(j&&j.length>0){if(i.isSync)return B(new Error("Cannot use plugins in synchronous API calls"),"");Xe(t,n,l,d,i,f,o,j,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 x=i.hasFS,{entries:m,flags:c,write:s,stdinContents:R,stdinResolveDir:S,absWorkingDir:$,nodePaths:O,mangleCache:a}=Qe(e,o,y,Se,x);if(s&&!i.hasFS)throw new Error('The "write" option is unavailable in this environment');let u={command:"build",key:t,entries:m,flags:c,write:s,stdinContents:R,stdinResolveDir:S,absWorkingDir:$||w,nodePaths:O,context:U};T&&(u.plugins=T),a&&(u.mangleCache=a);let b=(E,p)=>{let C={errors:oe(E.errors,F),warnings:oe(E.warnings,F),outputFiles:void 0,metafile:void 0,mangleCache:void 0},L=C.errors.slice(),A=C.warnings.slice();E.outputFiles&&(C.outputFiles=E.outputFiles.map(Ze)),E.metafile&&(C.metafile=JSON.parse(E.metafile)),E.mangleCache&&(C.mangleCache=E.mangleCache),E.writeToStdout!==void 0&&console.log(re(E.writeToStdout).replace(/\n$/,"")),W(C,(P,D)=>{if(L.length>0||P.length>0){let q=ue("Build failed",L.concat(P),A.concat(D));return p(q,null,P,D)}p(null,C,P,D)})},M,k;U&&(f["on-end"]=(E,p)=>new Promise(C=>{b(p,(L,A,P,D)=>{let q={errors:P,warnings:D};k&&k(L,A),M=void 0,k=void 0,l(E,q),C()})})),n(d,u,(E,p)=>{if(E)return v(new Error(E),null);if(!U)return b(p,(A,P)=>(Y(),v(A,P)));if(p.errors.length>0)return v(ue("Context failed",p.errors,p.warnings),null);let C=!1,L={rebuild:()=>(M||(M=new Promise((A,P)=>{let D;k=(_,H)=>{D||(D=()=>_?P(_):A(H))};let q=()=>{n(d,{command:"rebuild",key:t},(H,le)=>{H?P(new Error(H)):D?D():q()})};q()})),M),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 q={},_=r(A,q,"port",se),H=r(A,q,"host",h),le=r(A,q,"servedir",h),g=r(A,q,"keyfile",h),N=r(A,q,"certfile",h),G=r(A,q,"onRequest",Ae);K(A,q,"in serve() call");let X={command:"serve",key:t,onRequest:!!G};_!==void 0&&(X.port=_),H!==void 0&&(X.host=H),le!==void 0&&(X.servedir=le),g!==void 0&&(X.keyfile=g),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(C)return A();n(d,{command:"cancel",key:t},()=>{A()})}),dispose:()=>new Promise(A=>{if(C)return A();C=!0,n(d,{command:"dispose",key:t},()=>{A(),Y(),d.unref()})})};d.ref(),v(null,L)})}}var Xe=async(e,t,n,l,d,i,f,o,y)=>{let w=[],v=[],F={},U={},B=[],j=0,Q=0,T=[],W=!1;o=[...o];for(let m of o){let c={};if(typeof m!="object")throw new Error(`Plugin at index ${Q} must be an object`);let s=r(m,c,"name",h);if(typeof s!="string"||s==="")throw new Error(`Plugin at index ${Q} is missing a name`);try{let R=r(m,c,"setup",Ae);if(typeof R!="function")throw new Error("Plugin is missing a setup function");K(m,c,`on plugin ${V(s)}`);let S={name:s,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};Q++;let O=R({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),M=r(u,b,"pluginName",h),k=r(u,b,"importer",h),E=r(u,b,"namespace",h),p=r(u,b,"resolveDir",h),C=r(u,b,"kind",h),L=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(M!=null&&(D.pluginName=M),k!=null&&(D.importer=k),E!=null&&(D.namespace=E),p!=null&&(D.resolveDir=p),C!=null)D.kind=C;else throw new Error('Must specify "kind" when calling "resolve"');L!=null&&(D.pluginData=y.store(L)),t(l,D,(q,_)=>{q!==null?P(new Error(q)):A({errors:oe(_.errors,y),warnings:oe(_.warnings,y),path:_.path,external:_.external,sideEffects:_.sideEffects,namespace:_.namespace,suffix:_.suffix,pluginData:y.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}),S.onStart=!0},onEnd(a){let u='This error came from the "onEnd" callback registered here:',b=pe(new Error(u),d,"onEnd");v.push({name:s,callback:a,note:b}),S.onEnd=!0},onResolve(a,u){let b='This error came from the "onResolve" callback registered here:',M=pe(new Error(b),d,"onResolve"),k={},E=r(a,k,"filter",ye),p=r(a,k,"namespace",h);if(K(a,k,`in onResolve() call for plugin ${V(s)}`),E==null)throw new Error("onResolve() call is missing a filter");let C=j++;F[C]={name:s,callback:u,note:M},S.onResolve.push({id:C,filter:E.source,namespace:p||""})},onLoad(a,u){let b='This error came from the "onLoad" callback registered here:',M=pe(new Error(b),d,"onLoad"),k={},E=r(a,k,"filter",ye),p=r(a,k,"namespace",h);if(K(a,k,`in onLoad() call for plugin ${V(s)}`),E==null)throw new Error("onLoad() call is missing a filter");let C=j++;U[C]={name:s,callback:u,note:M},S.onLoad.push({id:C,filter:E.source,namespace:p||""})},onDispose(a){B.push(a)},esbuild:d.esbuild});O&&await O,T.push(S)}catch(R){return{ok:!1,error:R,pluginName:s}}}i["on-start"]=async(m,c)=>{let s={errors:[],warnings:[]};await Promise.all(w.map(async({name:R,callback:S,note:$})=>{try{let O=await S();if(O!=null){if(typeof O!="object")throw new Error(`Expected onStart() callback in plugin ${V(R)} to return an object`);let a={},u=r(O,a,"errors",z),b=r(O,a,"warnings",z);K(O,a,`from onStart() callback in plugin ${V(R)}`),u!=null&&s.errors.push(...te(u,"errors",y,R)),b!=null&&s.warnings.push(...te(b,"warnings",y,R))}}catch(O){s.errors.push(ie(O,d,y,$&&$(),R))}})),n(m,s)},i["on-resolve"]=async(m,c)=>{let s={},R="",S,$;for(let O of c.ids)try{({name:R,callback:S,note:$}=F[O]);let a=await S({path:c.path,importer:c.importer,namespace:c.namespace,resolveDir:c.resolveDir,kind:c.kind,pluginData:y.load(c.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onResolve() callback in plugin ${V(R)} to return an object`);let u={},b=r(a,u,"pluginName",h),M=r(a,u,"path",h),k=r(a,u,"namespace",h),E=r(a,u,"suffix",h),p=r(a,u,"external",I),C=r(a,u,"sideEffects",I),L=r(a,u,"pluginData",me),A=r(a,u,"errors",z),P=r(a,u,"warnings",z),D=r(a,u,"watchFiles",z),q=r(a,u,"watchDirs",z);K(a,u,`from onResolve() callback in plugin ${V(R)}`),s.id=O,b!=null&&(s.pluginName=b),M!=null&&(s.path=M),k!=null&&(s.namespace=k),E!=null&&(s.suffix=E),p!=null&&(s.external=p),C!=null&&(s.sideEffects=C),L!=null&&(s.pluginData=y.store(L)),A!=null&&(s.errors=te(A,"errors",y,R)),P!=null&&(s.warnings=te(P,"warnings",y,R)),D!=null&&(s.watchFiles=ge(D,"watchFiles")),q!=null&&(s.watchDirs=ge(q,"watchDirs"));break}}catch(a){s={id:O,errors:[ie(a,d,y,$&&$(),R)]};break}n(m,s)},i["on-load"]=async(m,c)=>{let s={},R="",S,$;for(let O of c.ids)try{({name:R,callback:S,note:$}=U[O]);let a=await S({path:c.path,namespace:c.namespace,suffix:c.suffix,pluginData:y.load(c.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onLoad() callback in plugin ${V(R)} to return an object`);let u={},b=r(a,u,"pluginName",h),M=r(a,u,"contents",Pe),k=r(a,u,"resolveDir",h),E=r(a,u,"pluginData",me),p=r(a,u,"loader",h),C=r(a,u,"errors",z),L=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(R)}`),s.id=O,b!=null&&(s.pluginName=b),M instanceof Uint8Array?s.contents=M:M!=null&&(s.contents=Z(M)),k!=null&&(s.resolveDir=k),E!=null&&(s.pluginData=y.store(E)),p!=null&&(s.loader=p),C!=null&&(s.errors=te(C,"errors",y,R)),L!=null&&(s.warnings=te(L,"warnings",y,R)),A!=null&&(s.watchFiles=ge(A,"watchFiles")),P!=null&&(s.watchDirs=ge(P,"watchDirs"));break}}catch(a){s={id:O,errors:[ie(a,d,y,$&&$(),R)]};break}n(m,s)};let Y=(m,c)=>c([],[]);v.length>0&&(Y=(m,c)=>{(async()=>{let s=[],R=[];for(let{name:S,callback:$,note:O}of v){let a,u;try{let b=await $(m);if(b!=null){if(typeof b!="object")throw new Error(`Expected onEnd() callback in plugin ${V(S)} to return an object`);let M={},k=r(b,M,"errors",z),E=r(b,M,"warnings",z);K(b,M,`from onEnd() callback in plugin ${V(S)}`),k!=null&&(a=te(k,"errors",y,S)),E!=null&&(u=te(E,"warnings",y,S))}}catch(b){a=[ie(b,d,y,O&&O(),S)]}if(a){s.push(...a);try{m.errors.push(...a)}catch(b){}}if(u){R.push(...u);try{m.warnings.push(...u)}catch(b){}}}c(s,R)})()});let x=()=>{for(let m of B)setTimeout(()=>m(),0)};return W=!0,{ok:!0,requestPlugins:T,runOnEndCallbacks:Y,scheduleOnDisposeCallbacks:x}};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",h=e=>typeof e=="string"?null:"a string",ye=e=>e instanceof RegExp?null:"a RegExp object",se=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",h),o=r(t,n,"logLimit",se);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",h),d=r(t,n,"sourceRoot",h),i=r(t,n,"sourcesContent",I),f=r(t,n,"target",Ye),o=r(t,n,"format",h),y=r(t,n,"globalName",h),w=r(t,n,"mangleProps",ye),v=r(t,n,"reserveProps",ye),F=r(t,n,"mangleQuoted",I),U=r(t,n,"minify",I),B=r(t,n,"minifySyntax",I),j=r(t,n,"minifyWhitespace",I),Q=r(t,n,"minifyIdentifiers",I),T=r(t,n,"drop",z),W=r(t,n,"charset",h),Y=r(t,n,"treeShaking",I),x=r(t,n,"ignoreAnnotations",I),m=r(t,n,"jsx",h),c=r(t,n,"jsxFactory",h),s=r(t,n,"jsxFragment",h),R=r(t,n,"jsxImportSource",h),S=r(t,n,"jsxDev",I),$=r(t,n,"jsxSideEffects",I),O=r(t,n,"define",ee),a=r(t,n,"logOverride",ee),u=r(t,n,"supported",ee),b=r(t,n,"pure",z),M=r(t,n,"keepNames",I),k=r(t,n,"platform",h),E=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}`),y&&e.push(`--global-name=${y}`),k&&e.push(`--platform=${k}`),E&&e.push(`--tsconfig-raw=${typeof E=="string"?E:JSON.stringify(E)}`),U&&e.push("--minify"),B&&e.push("--minify-syntax"),j&&e.push("--minify-whitespace"),Q&&e.push("--minify-identifiers"),W&&e.push(`--charset=${W}`),Y!==void 0&&e.push(`--tree-shaking=${Y}`),x&&e.push("--ignore-annotations"),T)for(let p of T)e.push(`--drop:${J(p,"drop")}`);if(w&&e.push(`--mangle-props=${w.source}`),v&&e.push(`--reserve-props=${v.source}`),F!==void 0&&e.push(`--mangle-quoted=${F}`),m&&e.push(`--jsx=${m}`),c&&e.push(`--jsx-factory=${c}`),s&&e.push(`--jsx-fragment=${s}`),R&&e.push(`--jsx-import-source=${R}`),S&&e.push("--jsx-dev"),$&&e.push("--jsx-side-effects"),O)for(let p in O){if(p.indexOf("=")>=0)throw new Error(`Invalid define: ${p}`);e.push(`--define:${p}=${J(O[p],"define",p)}`)}if(a)for(let p in a){if(p.indexOf("=")>=0)throw new Error(`Invalid log override: ${p}`);e.push(`--log-override:${p}=${J(a[p],"log override",p)}`)}if(u)for(let p in u){if(p.indexOf("=")>=0)throw new Error(`Invalid supported: ${p}`);let C=u[p];if(typeof C!="boolean")throw new Error(`Expected value for supported ${V(p)} to be a boolean, got ${typeof C} instead`);e.push(`--supported:${p}=${C}`)}if(b)for(let p of b)e.push(`--pure:${J(p,"pure")}`);M&&e.push("--keep-names")}function Qe(e,t,n,l,d){var le;let i=[],f=[],o=Object.create(null),y=null,w=null;he(i,t,o,n,l),Be(i,t,o);let v=r(t,o,"sourcemap",De),F=r(t,o,"bundle",I),U=r(t,o,"splitting",I),B=r(t,o,"preserveSymlinks",I),j=r(t,o,"metafile",I),Q=r(t,o,"outfile",h),T=r(t,o,"outdir",h),W=r(t,o,"outbase",h),Y=r(t,o,"tsconfig",h),x=r(t,o,"resolveExtensions",z),m=r(t,o,"nodePaths",z),c=r(t,o,"mainFields",z),s=r(t,o,"conditions",z),R=r(t,o,"external",z),S=r(t,o,"packages",h),$=r(t,o,"alias",ee),O=r(t,o,"loader",ee),a=r(t,o,"outExtension",ee),u=r(t,o,"publicPath",h),b=r(t,o,"entryNames",h),M=r(t,o,"chunkNames",h),k=r(t,o,"assetNames",h),E=r(t,o,"inject",z),p=r(t,o,"banner",ee),C=r(t,o,"footer",ee),L=r(t,o,"entryPoints",Ke),A=r(t,o,"absWorkingDir",h),P=r(t,o,"stdin",ee),D=(le=r(t,o,"write",I))!=null?le:d,q=r(t,o,"allowOverwrite",I),_=r(t,o,"mangleCache",ee);if(o.plugins=!0,K(t,o,`in ${e}() call`),v&&i.push(`--sourcemap${v===!0?"":`=${v}`}`),F&&i.push("--bundle"),q&&i.push("--allow-overwrite"),U&&i.push("--splitting"),B&&i.push("--preserve-symlinks"),j&&i.push("--metafile"),Q&&i.push(`--outfile=${Q}`),T&&i.push(`--outdir=${T}`),W&&i.push(`--outbase=${W}`),Y&&i.push(`--tsconfig=${Y}`),S&&i.push(`--packages=${S}`),x){let g=[];for(let N of x){if(J(N,"resolve extension"),N.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${N}`);g.push(N)}i.push(`--resolve-extensions=${g.join(",")}`)}if(u&&i.push(`--public-path=${u}`),b&&i.push(`--entry-names=${b}`),M&&i.push(`--chunk-names=${M}`),k&&i.push(`--asset-names=${k}`),c){let g=[];for(let N of c){if(J(N,"main field"),N.indexOf(",")>=0)throw new Error(`Invalid main field: ${N}`);g.push(N)}i.push(`--main-fields=${g.join(",")}`)}if(s){let g=[];for(let N of s){if(J(N,"condition"),N.indexOf(",")>=0)throw new Error(`Invalid condition: ${N}`);g.push(N)}i.push(`--conditions=${g.join(",")}`)}if(R)for(let g of R)i.push(`--external:${J(g,"external")}`);if($)for(let g in $){if(g.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${g}`);i.push(`--alias:${g}=${J($[g],"alias",g)}`)}if(p)for(let g in p){if(g.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${g}`);i.push(`--banner:${g}=${J(p[g],"banner",g)}`)}if(C)for(let g in C){if(g.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${g}`);i.push(`--footer:${g}=${J(C[g],"footer",g)}`)}if(E)for(let g of E)i.push(`--inject:${J(g,"inject")}`);if(O)for(let g in O){if(g.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${g}`);i.push(`--loader:${g}=${J(O[g],"loader",g)}`)}if(a)for(let g in a){if(g.indexOf("=")>=0)throw new Error(`Invalid out extension: ${g}`);i.push(`--out-extension:${g}=${J(a[g],"out extension",g)}`)}if(L)if(Array.isArray(L))for(let g=0,N=L.length;g<N;g++){let G=L[g];if(typeof G=="object"&&G!==null){let X=Object.create(null),ne=r(G,X,"in",h),fe=r(G,X,"out",h);if(K(G,X,"in entry point at index "+g),ne===void 0)throw new Error('Missing property "in" for entry point at index '+g);if(fe===void 0)throw new Error('Missing property "out" for entry point at index '+g);f.push([fe,ne])}else f.push(["",J(G,"entry point at index "+g)])}else for(let g in L)f.push([g,J(L[g],"entry point",g)]);if(P){let g=Object.create(null),N=r(P,g,"contents",Pe),G=r(P,g,"resolveDir",h),X=r(P,g,"sourcefile",h),ne=r(P,g,"loader",h);K(P,g,'in "stdin" object'),X&&i.push(`--sourcefile=${X}`),ne&&i.push(`--loader=${ne}`),G&&(w=G),typeof N=="string"?y=Z(N):N instanceof Uint8Array&&(y=N)}let H=[];if(m)for(let g of m)g+="",H.push(g);return{entries:f,flags:i,write:D,stdinContents:y,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",h),y=r(t,i,"loader",h),w=r(t,i,"banner",h),v=r(t,i,"footer",h),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}`),y&&d.push(`--loader=${y}`),w&&d.push(`--banner=${w}`),v&&d.push(`--footer=${v}`),{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,y=x=>{let m=o+x.length;if(m>f.length){let s=new Uint8Array(m*2);s.set(f),f=s}f.set(x,o),o+=x.length;let c=0;for(;c+4<=o;){let s=Re(f,c);if(c+4+s>o)break;c+=4,j(f.subarray(c,c+s)),c+=s}c>0&&(f.copyWithin(0,c,o),o-=c)},w=x=>{n.didClose=!0,x&&(n.reason=": "+(x.message||x));let m="The service was stopped"+n.reason;for(let c in l)l[c](m,null);l={}},v=(x,m,c)=>{if(n.didClose)return c("The service is no longer running"+n.reason,null);let s=d++;l[s]=(R,S)=>{try{c(R,S)}finally{x&&x.unref()}},x&&x.ref(),e.writeToStdin(xe({id:s,isRequest:!0,value:m}))},F=(x,m)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(xe({id:x,isRequest:!1,value:m}))},U=async(x,m)=>{try{if(m.command==="ping"){F(x,{});return}if(typeof m.key=="number"){let c=t[m.key];if(c){let s=c[m.command];if(s){await s(x,m);return}}}throw new Error("Invalid command: "+m.command)}catch(c){F(x,{errors:[ie(c,e,null,void 0,"")]})}},B=!0,j=x=>{if(B){B=!1;let c=String.fromCharCode(...x);if(c!=="0.18.3")throw new Error(`Cannot start service: Host version "0.18.3" does not match binary version ${V(c)}`);return}let m=Ee(x);if(m.isRequest)U(m.id,m.value);else{let c=l[m.id];delete l[m.id],m.value.error?c(m.value.error,{}):c(null,m.value)}};return{readFromStdout:y,afterClose:w,service:{buildOrContext:({callName:x,refs:m,options:c,isTTY:s,defaultWD:R,callback:S})=>{let $=0,O=i++,a={},u={ref(){++$===1&&m&&m.ref()},unref(){--$===0&&(delete t[O],m&&m.unref())}};t[O]=a,u.ref(),Ge(x,O,v,F,u,e,a,c,s,R,(b,M)=>{try{S(b,M)}finally{u.unref()}})},transform:({callName:x,refs:m,input:c,options:s,isTTY:R,fs:S,callback:$})=>{let O=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:M}=He(x,s,R,ke),k={command:"transform",flags:b,inputFS:u!==null,input:u!==null?Z(u):typeof c=="string"?Z(c):c};M&&(k.mangleCache=M),v(m,k,(E,p)=>{if(E)return $(new Error(E),null);let C=oe(p.errors,O),L=oe(p.warnings,O),A=1,P=()=>{if(--A===0){let D={warnings:L,code:p.code,map:p.map,mangleCache:void 0,legalComments:void 0};"legalComments"in p&&(D.legalComments=p==null?void 0:p.legalComments),p.mangleCache&&(D.mangleCache=p==null?void 0:p.mangleCache),$(null,D)}};if(C.length>0)return $(ue("Transform failed",C,L),null);p.codeFS&&(A++,S.readFile(p.code,(D,q)=>{D!==null?$(D,null):(p.code=q,P())})),p.mapFS&&(A++,S.readFile(p.map,(D,q)=>{D!==null?$(D,null):(p.map=q,P())})),P()})}catch(b){let M=[];try{he(M,s,{},R,ke)}catch(E){}let k=ie(b,e,O,void 0,"");v(m,{command:"error",flags:M,error:k},()=>{k.detail=O.load(k.detail),$(ue("Transform failed",[k],[]),null)})}};if((typeof c=="string"||c instanceof Uint8Array)&&c.length>1024*1024){let u=a;a=()=>S.writeFile(c,u)}a(null)},formatMessages:({callName:x,refs:m,messages:c,options:s,callback:R})=>{let S=te(c,"messages",null,"");if(!s)throw new Error(`Missing second argument in ${x}() call`);let $={},O=r(s,$,"kind",h),a=r(s,$,"color",I),u=r(s,$,"terminalWidth",se);if(K(s,$,`in ${x}() call`),O===void 0)throw new Error(`Missing "kind" in ${x}() call`);if(O!=="error"&&O!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${x}() call`);let b={command:"format-msgs",messages:S,isWarning:O==="warning"};a!==void 0&&(b.color=a),u!==void 0&&(b.terminalWidth=u),v(m,b,(M,k)=>{if(M)return R(new Error(M),null);R(null,k.messages)})},analyzeMetafile:({callName:x,refs:m,metafile:c,options:s,callback:R})=>{s===void 0&&(s={});let S={},$=r(s,S,"color",I),O=r(s,S,"verbose",I);K(s,S,`in ${x}() call`);let a={command:"analyze-metafile",metafile:c};$!==void 0&&(a.color=$),O!==void 0&&(a.verbose=O),v(m,a,(u,b)=>{if(u)return R(new Error(u),null);R(null,b.result)})}}}}function Ge(e,t,n,l,d,i,f,o,y,w,v){let F=je(),U=e==="context",B=(T,W)=>{let Y=[];try{he(Y,o,{},y,Se)}catch(m){}let x=ie(T,i,F,void 0,W);n(d,{command:"error",flags:Y,error:x},()=>{x.detail=F.load(x.detail),v(ue(U?"Context failed":"Build failed",[x],[]),null)})},j;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'),"");j=T}}if(j&&j.length>0){if(i.isSync)return B(new Error("Cannot use plugins in synchronous API calls"),"");Xe(t,n,l,d,i,f,o,j,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 x=i.hasFS,{entries:m,flags:c,write:s,stdinContents:R,stdinResolveDir:S,absWorkingDir:$,nodePaths:O,mangleCache:a}=Qe(e,o,y,Se,x);if(s&&!i.hasFS)throw new Error('The "write" option is unavailable in this environment');let u={command:"build",key:t,entries:m,flags:c,write:s,stdinContents:R,stdinResolveDir:S,absWorkingDir:$||w,nodePaths:O,context:U};T&&(u.plugins=T),a&&(u.mangleCache=a);let b=(E,p)=>{let C={errors:oe(E.errors,F),warnings:oe(E.warnings,F),outputFiles:void 0,metafile:void 0,mangleCache:void 0},L=C.errors.slice(),A=C.warnings.slice();E.outputFiles&&(C.outputFiles=E.outputFiles.map(Ze)),E.metafile&&(C.metafile=JSON.parse(E.metafile)),E.mangleCache&&(C.mangleCache=E.mangleCache),E.writeToStdout!==void 0&&console.log(re(E.writeToStdout).replace(/\n$/,"")),W(C,(P,D)=>{if(L.length>0||P.length>0){let q=ue("Build failed",L.concat(P),A.concat(D));return p(q,null,P,D)}p(null,C,P,D)})},M,k;U&&(f["on-end"]=(E,p)=>new Promise(C=>{b(p,(L,A,P,D)=>{let q={errors:P,warnings:D};k&&k(L,A),M=void 0,k=void 0,l(E,q),C()})})),n(d,u,(E,p)=>{if(E)return v(new Error(E),null);if(!U)return b(p,(A,P)=>(Y(),v(A,P)));if(p.errors.length>0)return v(ue("Context failed",p.errors,p.warnings),null);let C=!1,L={rebuild:()=>(M||(M=new Promise((A,P)=>{let D;k=(_,H)=>{D||(D=()=>_?P(_):A(H))};let q=()=>{n(d,{command:"rebuild",key:t},(H,le)=>{H?P(new Error(H)):D?D():q()})};q()})),M),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 q={},_=r(A,q,"port",se),H=r(A,q,"host",h),le=r(A,q,"servedir",h),g=r(A,q,"keyfile",h),N=r(A,q,"certfile",h),G=r(A,q,"onRequest",Ae);K(A,q,"in serve() call");let X={command:"serve",key:t,onRequest:!!G};_!==void 0&&(X.port=_),H!==void 0&&(X.host=H),le!==void 0&&(X.servedir=le),g!==void 0&&(X.keyfile=g),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(C)return A();n(d,{command:"cancel",key:t},()=>{A()})}),dispose:()=>new Promise(A=>{if(C)return A();C=!0,n(d,{command:"dispose",key:t},()=>{A(),Y(),d.unref()})})};d.ref(),v(null,L)})}}var Xe=async(e,t,n,l,d,i,f,o,y)=>{let w=[],v=[],F={},U={},B=[],j=0,Q=0,T=[],W=!1;o=[...o];for(let m of o){let c={};if(typeof m!="object")throw new Error(`Plugin at index ${Q} must be an object`);let s=r(m,c,"name",h);if(typeof s!="string"||s==="")throw new Error(`Plugin at index ${Q} is missing a name`);try{let R=r(m,c,"setup",Ae);if(typeof R!="function")throw new Error("Plugin is missing a setup function");K(m,c,`on plugin ${V(s)}`);let S={name:s,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};Q++;let O=R({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),M=r(u,b,"pluginName",h),k=r(u,b,"importer",h),E=r(u,b,"namespace",h),p=r(u,b,"resolveDir",h),C=r(u,b,"kind",h),L=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(M!=null&&(D.pluginName=M),k!=null&&(D.importer=k),E!=null&&(D.namespace=E),p!=null&&(D.resolveDir=p),C!=null)D.kind=C;else throw new Error('Must specify "kind" when calling "resolve"');L!=null&&(D.pluginData=y.store(L)),t(l,D,(q,_)=>{q!==null?P(new Error(q)):A({errors:oe(_.errors,y),warnings:oe(_.warnings,y),path:_.path,external:_.external,sideEffects:_.sideEffects,namespace:_.namespace,suffix:_.suffix,pluginData:y.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}),S.onStart=!0},onEnd(a){let u='This error came from the "onEnd" callback registered here:',b=pe(new Error(u),d,"onEnd");v.push({name:s,callback:a,note:b}),S.onEnd=!0},onResolve(a,u){let b='This error came from the "onResolve" callback registered here:',M=pe(new Error(b),d,"onResolve"),k={},E=r(a,k,"filter",ye),p=r(a,k,"namespace",h);if(K(a,k,`in onResolve() call for plugin ${V(s)}`),E==null)throw new Error("onResolve() call is missing a filter");let C=j++;F[C]={name:s,callback:u,note:M},S.onResolve.push({id:C,filter:E.source,namespace:p||""})},onLoad(a,u){let b='This error came from the "onLoad" callback registered here:',M=pe(new Error(b),d,"onLoad"),k={},E=r(a,k,"filter",ye),p=r(a,k,"namespace",h);if(K(a,k,`in onLoad() call for plugin ${V(s)}`),E==null)throw new Error("onLoad() call is missing a filter");let C=j++;U[C]={name:s,callback:u,note:M},S.onLoad.push({id:C,filter:E.source,namespace:p||""})},onDispose(a){B.push(a)},esbuild:d.esbuild});O&&await O,T.push(S)}catch(R){return{ok:!1,error:R,pluginName:s}}}i["on-start"]=async(m,c)=>{let s={errors:[],warnings:[]};await Promise.all(w.map(async({name:R,callback:S,note:$})=>{try{let O=await S();if(O!=null){if(typeof O!="object")throw new Error(`Expected onStart() callback in plugin ${V(R)} to return an object`);let a={},u=r(O,a,"errors",z),b=r(O,a,"warnings",z);K(O,a,`from onStart() callback in plugin ${V(R)}`),u!=null&&s.errors.push(...te(u,"errors",y,R)),b!=null&&s.warnings.push(...te(b,"warnings",y,R))}}catch(O){s.errors.push(ie(O,d,y,$&&$(),R))}})),n(m,s)},i["on-resolve"]=async(m,c)=>{let s={},R="",S,$;for(let O of c.ids)try{({name:R,callback:S,note:$}=F[O]);let a=await S({path:c.path,importer:c.importer,namespace:c.namespace,resolveDir:c.resolveDir,kind:c.kind,pluginData:y.load(c.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onResolve() callback in plugin ${V(R)} to return an object`);let u={},b=r(a,u,"pluginName",h),M=r(a,u,"path",h),k=r(a,u,"namespace",h),E=r(a,u,"suffix",h),p=r(a,u,"external",I),C=r(a,u,"sideEffects",I),L=r(a,u,"pluginData",me),A=r(a,u,"errors",z),P=r(a,u,"warnings",z),D=r(a,u,"watchFiles",z),q=r(a,u,"watchDirs",z);K(a,u,`from onResolve() callback in plugin ${V(R)}`),s.id=O,b!=null&&(s.pluginName=b),M!=null&&(s.path=M),k!=null&&(s.namespace=k),E!=null&&(s.suffix=E),p!=null&&(s.external=p),C!=null&&(s.sideEffects=C),L!=null&&(s.pluginData=y.store(L)),A!=null&&(s.errors=te(A,"errors",y,R)),P!=null&&(s.warnings=te(P,"warnings",y,R)),D!=null&&(s.watchFiles=ge(D,"watchFiles")),q!=null&&(s.watchDirs=ge(q,"watchDirs"));break}}catch(a){s={id:O,errors:[ie(a,d,y,$&&$(),R)]};break}n(m,s)},i["on-load"]=async(m,c)=>{let s={},R="",S,$;for(let O of c.ids)try{({name:R,callback:S,note:$}=U[O]);let a=await S({path:c.path,namespace:c.namespace,suffix:c.suffix,pluginData:y.load(c.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onLoad() callback in plugin ${V(R)} to return an object`);let u={},b=r(a,u,"pluginName",h),M=r(a,u,"contents",Pe),k=r(a,u,"resolveDir",h),E=r(a,u,"pluginData",me),p=r(a,u,"loader",h),C=r(a,u,"errors",z),L=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(R)}`),s.id=O,b!=null&&(s.pluginName=b),M instanceof Uint8Array?s.contents=M:M!=null&&(s.contents=Z(M)),k!=null&&(s.resolveDir=k),E!=null&&(s.pluginData=y.store(E)),p!=null&&(s.loader=p),C!=null&&(s.errors=te(C,"errors",y,R)),L!=null&&(s.warnings=te(L,"warnings",y,R)),A!=null&&(s.watchFiles=ge(A,"watchFiles")),P!=null&&(s.watchDirs=ge(P,"watchDirs"));break}}catch(a){s={id:O,errors:[ie(a,d,y,$&&$(),R)]};break}n(m,s)};let Y=(m,c)=>c([],[]);v.length>0&&(Y=(m,c)=>{(async()=>{let s=[],R=[];for(let{name:S,callback:$,note:O}of v){let a,u;try{let b=await $(m);if(b!=null){if(typeof b!="object")throw new Error(`Expected onEnd() callback in plugin ${V(S)} to return an object`);let M={},k=r(b,M,"errors",z),E=r(b,M,"warnings",z);K(b,M,`from onEnd() callback in plugin ${V(S)}`),k!=null&&(a=te(k,"errors",y,S)),E!=null&&(u=te(E,"warnings",y,S))}}catch(b){a=[ie(b,d,y,O&&O(),S)]}if(a){s.push(...a);try{m.errors.push(...a)}catch(b){}}if(u){R.push(...u);try{m.warnings.push(...u)}catch(b){}}}c(s,R)})()});let x=()=>{for(let m of B)setTimeout(()=>m(),0)};return W=!0,{ok:!0,requestPlugins:T,runOnEndCallbacks:Y,scheduleOnDisposeCallbacks:x}};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 y=o.split(/\r\n|\r|\n|\u2028|\u2029/)[+f[2]-1]||"",w=+f[3]-1,v=y.slice(w,w+n.length)===n?n.length:0;return{file:f[1],namespace:"file",line:+f[2],column:Z(y.slice(0,w)).length,length:Z(y.slice(w,w+v)).length,lineText:y+`
|
|
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:y,line:w,column:v}=f.location,F=f.pluginName?`[plugin: ${f.pluginName}] `:"";return`
|
|
13
|
-
${y}:${w}:${v}: 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",h),d=r(e,n,"namespace",h),i=r(e,n,"line",se),f=r(e,n,"column",se),o=r(e,n,"length",se),y=r(e,n,"lineText",h),w=r(e,n,"suggestion",h);return K(e,n,t),{file:l||"",namespace:d||"",line:i||0,column:f||0,length:o||0,lineText:y||"",suggestion:w||""}}function te(e,t,n,l){let d=[],i=0;for(let f of e){let o={},y=r(f,o,"id",h),w=r(f,o,"pluginName",h),v=r(f,o,"text",h),F=r(f,o,"location",Me),U=r(f,o,"notes",z),B=r(f,o,"detail",me),j=`in element ${i} of "${t}"`;K(f,o,j);let Q=[];if(U)for(let T of U){let W={},Y=r(T,W,"text",h),x=r(T,W,"location",Me);K(T,W,j),Q.push({text:Y||"",location:Ce(x,j)})}d.push({id:y||"",pluginName:w||l,text:v||"",location:Ce(F,j),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.2",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.2"],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
|
+
${y}:${w}:${v}: 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",h),d=r(e,n,"namespace",h),i=r(e,n,"line",se),f=r(e,n,"column",se),o=r(e,n,"length",se),y=r(e,n,"lineText",h),w=r(e,n,"suggestion",h);return K(e,n,t),{file:l||"",namespace:d||"",line:i||0,column:f||0,length:o||0,lineText:y||"",suggestion:w||""}}function te(e,t,n,l){let d=[],i=0;for(let f of e){let o={},y=r(f,o,"id",h),w=r(f,o,"pluginName",h),v=r(f,o,"text",h),F=r(f,o,"location",Me),U=r(f,o,"notes",z),B=r(f,o,"detail",me),j=`in element ${i} of "${t}"`;K(f,o,j);let Q=[];if(U)for(let T of U){let W={},Y=r(T,W,"text",h),x=r(T,W,"location",Me);K(T,W,j),Q.push({text:Y||"",location:Ce(x,j)})}d.push({id:y||"",pluginName:w||l,text:v||"",location:Ce(F,j),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.3",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.3"],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.
|
|
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.3"],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);})(v=>l.onmessage({data:v}));l={onmessage:null,postMessage:v=>setTimeout(()=>w({data:v})),terminate(){}}}let d,i,f=new Promise((w,v)=>{d=w,i=v});l.onmessage=({data:w})=>{l.onmessage=({data:v})=>o(v),w?i(w):d()},l.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:o,service:y}=Ue({writeToStdin(w){l.postMessage(w)},isSync:!1,hasFS:!1,esbuild:be});await f,Oe={build:w=>new Promise((v,F)=>y.buildOrContext({callName:"build",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(U,B)=>U?F(U):v(B)})),context:w=>new Promise((v,F)=>y.buildOrContext({callName:"context",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(U,B)=>U?F(U):v(B)})),transform:(w,v)=>new Promise((F,U)=>y.transform({callName:"transform",refs:null,input:w,options:v||{},isTTY:!1,fs:{readFile(B,j){j(new Error("Internal error"),null)},writeFile(B,j){j(null)}},callback:(B,j)=>B?U(B):F(j)})),formatMessages:(w,v)=>new Promise((F,U)=>y.formatMessages({callName:"formatMessages",refs:null,messages:w,options:v,callback:(B,j)=>B?U(B):F(j)})),analyzeMetafile:(w,v)=>new Promise((F,U)=>y.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof w=="string"?w:JSON.stringify(w),options:v,callback:(B,j)=>B?U(B):F(j)}))}},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
|
@@ -746,8 +746,8 @@ function createChannel(streamIn) {
|
|
|
746
746
|
if (isFirstPacket) {
|
|
747
747
|
isFirstPacket = false;
|
|
748
748
|
let binaryVersion = String.fromCharCode(...bytes);
|
|
749
|
-
if (binaryVersion !== "0.18.
|
|
750
|
-
throw new Error(`Cannot start service: Host version "${"0.18.
|
|
749
|
+
if (binaryVersion !== "0.18.3") {
|
|
750
|
+
throw new Error(`Cannot start service: Host version "${"0.18.3"}" does not match binary version ${quote(binaryVersion)}`);
|
|
751
751
|
}
|
|
752
752
|
return;
|
|
753
753
|
}
|
|
@@ -1741,7 +1741,7 @@ function convertOutputFiles({ path, contents }) {
|
|
|
1741
1741
|
}
|
|
1742
1742
|
|
|
1743
1743
|
// lib/npm/browser.ts
|
|
1744
|
-
var version = "0.18.
|
|
1744
|
+
var version = "0.18.3";
|
|
1745
1745
|
var build = (options) => ensureServiceIsRunning().build(options);
|
|
1746
1746
|
var context = (options) => ensureServiceIsRunning().context(options);
|
|
1747
1747
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
@@ -1786,7 +1786,7 @@ var initialize = (options) => {
|
|
|
1786
1786
|
var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, null, function* () {
|
|
1787
1787
|
let worker;
|
|
1788
1788
|
if (useWorker) {
|
|
1789
|
-
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.2"}`];\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" });
|
|
1789
|
+
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.3"}`];\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" });
|
|
1790
1790
|
worker = new Worker(URL.createObjectURL(blob));
|
|
1791
1791
|
} else {
|
|
1792
1792
|
let onmessage = ((postMessage) => {
|
|
@@ -2427,7 +2427,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
|
|
|
2427
2427
|
callback(null, count);
|
|
2428
2428
|
};
|
|
2429
2429
|
let go = new globalThis.Go();
|
|
2430
|
-
go.argv = ["", `--service=${"0.18.
|
|
2430
|
+
go.argv = ["", `--service=${"0.18.3"}`];
|
|
2431
2431
|
tryToInstantiateModule(wasm, go).then(
|
|
2432
2432
|
(instance) => {
|
|
2433
2433
|
postMessage(null);
|
package/lib/browser.min.js
CHANGED
|
@@ -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",h=e=>typeof e=="string"?null:"a string",he=e=>e instanceof RegExp?null:"a RegExp object",oe=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",h),s=r(t,n,"logLimit",oe);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",h),u=r(t,n,"sourceRoot",h),l=r(t,n,"sourcesContent",I),f=r(t,n,"target",Ze),s=r(t,n,"format",h),g=r(t,n,"globalName",h),w=r(t,n,"mangleProps",he),v=r(t,n,"reserveProps",he),F=r(t,n,"mangleQuoted",I),U=r(t,n,"minify",I),B=r(t,n,"minifySyntax",I),j=r(t,n,"minifyWhitespace",I),Q=r(t,n,"minifyIdentifiers",I),T=r(t,n,"drop",z),W=r(t,n,"charset",h),Y=r(t,n,"treeShaking",I),x=r(t,n,"ignoreAnnotations",I),y=r(t,n,"jsx",h),d=r(t,n,"jsxFactory",h),o=r(t,n,"jsxFragment",h),R=r(t,n,"jsxImportSource",h),S=r(t,n,"jsxDev",I),M=r(t,n,"jsxSideEffects",I),k=r(t,n,"define",ee),a=r(t,n,"logOverride",ee),c=r(t,n,"supported",ee),b=r(t,n,"pure",z),E=r(t,n,"keepNames",I),$=r(t,n,"platform",h),O=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}`),g&&e.push(`--global-name=${g}`),$&&e.push(`--platform=${$}`),O&&e.push(`--tsconfig-raw=${typeof O=="string"?O:JSON.stringify(O)}`),U&&e.push("--minify"),B&&e.push("--minify-syntax"),j&&e.push("--minify-whitespace"),Q&&e.push("--minify-identifiers"),W&&e.push(`--charset=${W}`),Y!==void 0&&e.push(`--tree-shaking=${Y}`),x&&e.push("--ignore-annotations"),T)for(let p of T)e.push(`--drop:${J(p,"drop")}`);if(w&&e.push(`--mangle-props=${w.source}`),v&&e.push(`--reserve-props=${v.source}`),F!==void 0&&e.push(`--mangle-quoted=${F}`),y&&e.push(`--jsx=${y}`),d&&e.push(`--jsx-factory=${d}`),o&&e.push(`--jsx-fragment=${o}`),R&&e.push(`--jsx-import-source=${R}`),S&&e.push("--jsx-dev"),M&&e.push("--jsx-side-effects"),k)for(let p in k){if(p.indexOf("=")>=0)throw new Error(`Invalid define: ${p}`);e.push(`--define:${p}=${J(k[p],"define",p)}`)}if(a)for(let p in a){if(p.indexOf("=")>=0)throw new Error(`Invalid log override: ${p}`);e.push(`--log-override:${p}=${J(a[p],"log override",p)}`)}if(c)for(let p in c){if(p.indexOf("=")>=0)throw new Error(`Invalid supported: ${p}`);let C=c[p];if(typeof C!="boolean")throw new Error(`Expected value for supported ${V(p)} to be a boolean, got ${typeof C} instead`);e.push(`--supported:${p}=${C}`)}if(b)for(let p of b)e.push(`--pure:${J(p,"pure")}`);E&&e.push("--keep-names")}function tt(e,t,n,i,u){var se;let l=[],f=[],s=Object.create(null),g=null,w=null;be(l,t,s,n,i),je(l,t,s);let v=r(t,s,"sourcemap",Fe),F=r(t,s,"bundle",I),U=r(t,s,"splitting",I),B=r(t,s,"preserveSymlinks",I),j=r(t,s,"metafile",I),Q=r(t,s,"outfile",h),T=r(t,s,"outdir",h),W=r(t,s,"outbase",h),Y=r(t,s,"tsconfig",h),x=r(t,s,"resolveExtensions",z),y=r(t,s,"nodePaths",z),d=r(t,s,"mainFields",z),o=r(t,s,"conditions",z),R=r(t,s,"external",z),S=r(t,s,"packages",h),M=r(t,s,"alias",ee),k=r(t,s,"loader",ee),a=r(t,s,"outExtension",ee),c=r(t,s,"publicPath",h),b=r(t,s,"entryNames",h),E=r(t,s,"chunkNames",h),$=r(t,s,"assetNames",h),O=r(t,s,"inject",z),p=r(t,s,"banner",ee),C=r(t,s,"footer",ee),L=r(t,s,"entryPoints",He),A=r(t,s,"absWorkingDir",h),P=r(t,s,"stdin",ee),D=(se=r(t,s,"write",I))!=null?se:u,q=r(t,s,"allowOverwrite",I),_=r(t,s,"mangleCache",ee);if(s.plugins=!0,K(t,s,`in ${e}() call`),v&&l.push(`--sourcemap${v===!0?"":`=${v}`}`),F&&l.push("--bundle"),q&&l.push("--allow-overwrite"),U&&l.push("--splitting"),B&&l.push("--preserve-symlinks"),j&&l.push("--metafile"),Q&&l.push(`--outfile=${Q}`),T&&l.push(`--outdir=${T}`),W&&l.push(`--outbase=${W}`),Y&&l.push(`--tsconfig=${Y}`),S&&l.push(`--packages=${S}`),x){let m=[];for(let N of x){if(J(N,"resolve extension"),N.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${N}`);m.push(N)}l.push(`--resolve-extensions=${m.join(",")}`)}if(c&&l.push(`--public-path=${c}`),b&&l.push(`--entry-names=${b}`),E&&l.push(`--chunk-names=${E}`),$&&l.push(`--asset-names=${$}`),d){let m=[];for(let N of d){if(J(N,"main field"),N.indexOf(",")>=0)throw new Error(`Invalid main field: ${N}`);m.push(N)}l.push(`--main-fields=${m.join(",")}`)}if(o){let m=[];for(let N of o){if(J(N,"condition"),N.indexOf(",")>=0)throw new Error(`Invalid condition: ${N}`);m.push(N)}l.push(`--conditions=${m.join(",")}`)}if(R)for(let m of R)l.push(`--external:${J(m,"external")}`);if(M)for(let m in M){if(m.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${m}`);l.push(`--alias:${m}=${J(M[m],"alias",m)}`)}if(p)for(let m in p){if(m.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${m}`);l.push(`--banner:${m}=${J(p[m],"banner",m)}`)}if(C)for(let m in C){if(m.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${m}`);l.push(`--footer:${m}=${J(C[m],"footer",m)}`)}if(O)for(let m of O)l.push(`--inject:${J(m,"inject")}`);if(k)for(let m in k){if(m.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${m}`);l.push(`--loader:${m}=${J(k[m],"loader",m)}`)}if(a)for(let m in a){if(m.indexOf("=")>=0)throw new Error(`Invalid out extension: ${m}`);l.push(`--out-extension:${m}=${J(a[m],"out extension",m)}`)}if(L)if(Array.isArray(L))for(let m=0,N=L.length;m<N;m++){let G=L[m];if(typeof G=="object"&&G!==null){let X=Object.create(null),re=r(G,X,"in",h),de=r(G,X,"out",h);if(K(G,X,"in entry point at index "+m),re===void 0)throw new Error('Missing property "in" for entry point at index '+m);if(de===void 0)throw new Error('Missing property "out" for entry point at index '+m);f.push([de,re])}else f.push(["",J(G,"entry point at index "+m)])}else for(let m in L)f.push([m,J(L[m],"entry point",m)]);if(P){let m=Object.create(null),N=r(P,m,"contents",Te),G=r(P,m,"resolveDir",h),X=r(P,m,"sourcefile",h),re=r(P,m,"loader",h);K(P,m,'in "stdin" object'),X&&l.push(`--sourcefile=${X}`),re&&l.push(`--loader=${re}`),G&&(w=G),typeof N=="string"?g=Z(N):N instanceof Uint8Array&&(g=N)}let H=[];if(y)for(let m of y)m+="",H.push(m);return{entries:f,flags:l,write:D,stdinContents:g,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",h),g=r(t,l,"loader",h),w=r(t,l,"banner",h),v=r(t,l,"footer",h),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}`),g&&u.push(`--loader=${g}`),w&&u.push(`--banner=${w}`),v&&u.push(`--footer=${v}`),{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,g=x=>{let y=s+x.length;if(y>f.length){let o=new Uint8Array(y*2);o.set(f),f=o}f.set(x,s),s+=x.length;let d=0;for(;d+4<=s;){let o=Ee(f,d);if(d+4+o>s)break;d+=4,j(f.subarray(d,d+o)),d+=o}d>0&&(f.copyWithin(0,d,s),s-=d)},w=x=>{n.didClose=!0,x&&(n.reason=": "+(x.message||x));let y="The service was stopped"+n.reason;for(let d in i)i[d](y,null);i={}},v=(x,y,d)=>{if(n.didClose)return d("The service is no longer running"+n.reason,null);let o=u++;i[o]=(R,S)=>{try{d(R,S)}finally{x&&x.unref()}},x&&x.ref(),e.writeToStdin(Oe({id:o,isRequest:!0,value:y}))},F=(x,y)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(Oe({id:x,isRequest:!1,value:y}))},U=(x,y)=>te(this,null,function*(){try{if(y.command==="ping"){F(x,{});return}if(typeof y.key=="number"){let d=t[y.key];if(d){let o=d[y.command];if(o){yield o(x,y);return}}}throw new Error("Invalid command: "+y.command)}catch(d){F(x,{errors:[le(d,e,null,void 0,"")]})}}),B=!0,j=x=>{if(B){B=!1;let d=String.fromCharCode(...x);if(d!=="0.18.2")throw new Error(`Cannot start service: Host version "0.18.2" does not match binary version ${V(d)}`);return}let y=ke(x);if(y.isRequest)U(y.id,y.value);else{let d=i[y.id];delete i[y.id],y.value.error?d(y.value.error,{}):d(null,y.value)}};return{readFromStdout:g,afterClose:w,service:{buildOrContext:({callName:x,refs:y,options:d,isTTY:o,defaultWD:R,callback:S})=>{let M=0,k=l++,a={},c={ref(){++M===1&&y&&y.ref()},unref(){--M===0&&(delete t[k],y&&y.unref())}};t[k]=a,c.ref(),rt(x,k,v,F,c,e,a,d,o,R,(b,E)=>{try{S(b,E)}finally{c.unref()}})},transform:({callName:x,refs:y,input:d,options:o,isTTY:R,fs:S,callback:M})=>{let k=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(x,o,R,Me),$={command:"transform",flags:b,inputFS:c!==null,input:c!==null?Z(c):typeof d=="string"?Z(d):d};E&&($.mangleCache=E),v(y,$,(O,p)=>{if(O)return M(new Error(O),null);let C=ae(p.errors,k),L=ae(p.warnings,k),A=1,P=()=>{if(--A===0){let D={warnings:L,code:p.code,map:p.map,mangleCache:void 0,legalComments:void 0};"legalComments"in p&&(D.legalComments=p==null?void 0:p.legalComments),p.mangleCache&&(D.mangleCache=p==null?void 0:p.mangleCache),M(null,D)}};if(C.length>0)return M(ce("Transform failed",C,L),null);p.codeFS&&(A++,S.readFile(p.code,(D,q)=>{D!==null?M(D,null):(p.code=q,P())})),p.mapFS&&(A++,S.readFile(p.map,(D,q)=>{D!==null?M(D,null):(p.map=q,P())})),P()})}catch(b){let E=[];try{be(E,o,{},R,Me)}catch(O){}let $=le(b,e,k,void 0,"");v(y,{command:"error",flags:E,error:$},()=>{$.detail=k.load($.detail),M(ce("Transform failed",[$],[]),null)})}};if((typeof d=="string"||d instanceof Uint8Array)&&d.length>1024*1024){let c=a;a=()=>S.writeFile(d,c)}a(null)},formatMessages:({callName:x,refs:y,messages:d,options:o,callback:R})=>{let S=ne(d,"messages",null,"");if(!o)throw new Error(`Missing second argument in ${x}() call`);let M={},k=r(o,M,"kind",h),a=r(o,M,"color",I),c=r(o,M,"terminalWidth",oe);if(K(o,M,`in ${x}() call`),k===void 0)throw new Error(`Missing "kind" in ${x}() call`);if(k!=="error"&&k!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${x}() call`);let b={command:"format-msgs",messages:S,isWarning:k==="warning"};a!==void 0&&(b.color=a),c!==void 0&&(b.terminalWidth=c),v(y,b,(E,$)=>{if(E)return R(new Error(E),null);R(null,$.messages)})},analyzeMetafile:({callName:x,refs:y,metafile:d,options:o,callback:R})=>{o===void 0&&(o={});let S={},M=r(o,S,"color",I),k=r(o,S,"verbose",I);K(o,S,`in ${x}() call`);let a={command:"analyze-metafile",metafile:d};M!==void 0&&(a.color=M),k!==void 0&&(a.verbose=k),v(y,a,(c,b)=>{if(c)return R(new Error(c),null);R(null,b.result)})}}}}function rt(e,t,n,i,u,l,f,s,g,w,v){let F=Le(),U=e==="context",B=(T,W)=>{let Y=[];try{be(Y,s,{},g,$e)}catch(y){}let x=le(T,l,F,void 0,W);n(u,{command:"error",flags:Y,error:x},()=>{x.detail=F.load(x.detail),v(ce(U?"Context failed":"Build failed",[x],[]),null)})},j;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'),"");j=T}}if(j&&j.length>0){if(l.isSync)return B(new Error("Cannot use plugins in synchronous API calls"),"");it(t,n,i,u,l,f,s,j,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 x=l.hasFS,{entries:y,flags:d,write:o,stdinContents:R,stdinResolveDir:S,absWorkingDir:M,nodePaths:k,mangleCache:a}=tt(e,s,g,$e,x);if(o&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let c={command:"build",key:t,entries:y,flags:d,write:o,stdinContents:R,stdinResolveDir:S,absWorkingDir:M||w,nodePaths:k,context:U};T&&(c.plugins=T),a&&(c.mangleCache=a);let b=(O,p)=>{let C={errors:ae(O.errors,F),warnings:ae(O.warnings,F),outputFiles:void 0,metafile:void 0,mangleCache:void 0},L=C.errors.slice(),A=C.warnings.slice();O.outputFiles&&(C.outputFiles=O.outputFiles.map(lt)),O.metafile&&(C.metafile=JSON.parse(O.metafile)),O.mangleCache&&(C.mangleCache=O.mangleCache),O.writeToStdout!==void 0&&console.log(ie(O.writeToStdout).replace(/\n$/,"")),W(C,(P,D)=>{if(L.length>0||P.length>0){let q=ce("Build failed",L.concat(P),A.concat(D));return p(q,null,P,D)}p(null,C,P,D)})},E,$;U&&(f["on-end"]=(O,p)=>new Promise(C=>{b(p,(L,A,P,D)=>{let q={errors:P,warnings:D};$&&$(L,A),E=void 0,$=void 0,i(O,q),C()})})),n(u,c,(O,p)=>{if(O)return v(new Error(O),null);if(!U)return b(p,(A,P)=>(Y(),v(A,P)));if(p.errors.length>0)return v(ce("Context failed",p.errors,p.warnings),null);let C=!1,L={rebuild:()=>(E||(E=new Promise((A,P)=>{let D;$=(_,H)=>{D||(D=()=>_?P(_):A(H))};let q=()=>{n(u,{command:"rebuild",key:t},(H,se)=>{H?P(new Error(H)):D?D():q()})};q()})),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 q={},_=r(A,q,"port",oe),H=r(A,q,"host",h),se=r(A,q,"servedir",h),m=r(A,q,"keyfile",h),N=r(A,q,"certfile",h),G=r(A,q,"onRequest",Pe);K(A,q,"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),m!==void 0&&(X.keyfile=m),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(C)return A();n(u,{command:"cancel",key:t},()=>{A()})}),dispose:()=>new Promise(A=>{if(C)return A();C=!0,n(u,{command:"dispose",key:t},()=>{A(),Y(),u.unref()})})};u.ref(),v(null,L)})}}var it=(e,t,n,i,u,l,f,s,g)=>te(void 0,null,function*(){let w=[],v=[],F={},U={},B=[],j=0,Q=0,T=[],W=!1;s=[...s];for(let y of s){let d={};if(typeof y!="object")throw new Error(`Plugin at index ${Q} must be an object`);let o=r(y,d,"name",h);if(typeof o!="string"||o==="")throw new Error(`Plugin at index ${Q} is missing a name`);try{let R=r(y,d,"setup",Pe);if(typeof R!="function")throw new Error("Plugin is missing a setup function");K(y,d,`on plugin ${V(o)}`);let S={name:o,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};Q++;let k=R({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",h),$=r(c,b,"importer",h),O=r(c,b,"namespace",h),p=r(c,b,"resolveDir",h),C=r(c,b,"kind",h),L=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),$!=null&&(D.importer=$),O!=null&&(D.namespace=O),p!=null&&(D.resolveDir=p),C!=null)D.kind=C;else throw new Error('Must specify "kind" when calling "resolve"');L!=null&&(D.pluginData=g.store(L)),t(i,D,(q,_)=>{q!==null?P(new Error(q)):A({errors:ae(_.errors,g),warnings:ae(_.warnings,g),path:_.path,external:_.external,sideEffects:_.sideEffects,namespace:_.namespace,suffix:_.suffix,pluginData:g.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}),S.onStart=!0},onEnd(a){let c='This error came from the "onEnd" callback registered here:',b=ge(new Error(c),u,"onEnd");v.push({name:o,callback:a,note:b}),S.onEnd=!0},onResolve(a,c){let b='This error came from the "onResolve" callback registered here:',E=ge(new Error(b),u,"onResolve"),$={},O=r(a,$,"filter",he),p=r(a,$,"namespace",h);if(K(a,$,`in onResolve() call for plugin ${V(o)}`),O==null)throw new Error("onResolve() call is missing a filter");let C=j++;F[C]={name:o,callback:c,note:E},S.onResolve.push({id:C,filter:O.source,namespace:p||""})},onLoad(a,c){let b='This error came from the "onLoad" callback registered here:',E=ge(new Error(b),u,"onLoad"),$={},O=r(a,$,"filter",he),p=r(a,$,"namespace",h);if(K(a,$,`in onLoad() call for plugin ${V(o)}`),O==null)throw new Error("onLoad() call is missing a filter");let C=j++;U[C]={name:o,callback:c,note:E},S.onLoad.push({id:C,filter:O.source,namespace:p||""})},onDispose(a){B.push(a)},esbuild:u.esbuild});k&&(yield k),T.push(S)}catch(R){return{ok:!1,error:R,pluginName:o}}}l["on-start"]=(y,d)=>te(void 0,null,function*(){let o={errors:[],warnings:[]};yield Promise.all(w.map(k=>te(void 0,[k],function*({name:R,callback:S,note:M}){try{let a=yield S();if(a!=null){if(typeof a!="object")throw new Error(`Expected onStart() callback in plugin ${V(R)} 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(R)}`),b!=null&&o.errors.push(...ne(b,"errors",g,R)),E!=null&&o.warnings.push(...ne(E,"warnings",g,R))}}catch(a){o.errors.push(le(a,u,g,M&&M(),R))}}))),n(y,o)}),l["on-resolve"]=(y,d)=>te(void 0,null,function*(){let o={},R="",S,M;for(let k of d.ids)try{({name:R,callback:S,note:M}=F[k]);let a=yield S({path:d.path,importer:d.importer,namespace:d.namespace,resolveDir:d.resolveDir,kind:d.kind,pluginData:g.load(d.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onResolve() callback in plugin ${V(R)} to return an object`);let c={},b=r(a,c,"pluginName",h),E=r(a,c,"path",h),$=r(a,c,"namespace",h),O=r(a,c,"suffix",h),p=r(a,c,"external",I),C=r(a,c,"sideEffects",I),L=r(a,c,"pluginData",ye),A=r(a,c,"errors",z),P=r(a,c,"warnings",z),D=r(a,c,"watchFiles",z),q=r(a,c,"watchDirs",z);K(a,c,`from onResolve() callback in plugin ${V(R)}`),o.id=k,b!=null&&(o.pluginName=b),E!=null&&(o.path=E),$!=null&&(o.namespace=$),O!=null&&(o.suffix=O),p!=null&&(o.external=p),C!=null&&(o.sideEffects=C),L!=null&&(o.pluginData=g.store(L)),A!=null&&(o.errors=ne(A,"errors",g,R)),P!=null&&(o.warnings=ne(P,"warnings",g,R)),D!=null&&(o.watchFiles=me(D,"watchFiles")),q!=null&&(o.watchDirs=me(q,"watchDirs"));break}}catch(a){o={id:k,errors:[le(a,u,g,M&&M(),R)]};break}n(y,o)}),l["on-load"]=(y,d)=>te(void 0,null,function*(){let o={},R="",S,M;for(let k of d.ids)try{({name:R,callback:S,note:M}=U[k]);let a=yield S({path:d.path,namespace:d.namespace,suffix:d.suffix,pluginData:g.load(d.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onLoad() callback in plugin ${V(R)} to return an object`);let c={},b=r(a,c,"pluginName",h),E=r(a,c,"contents",Te),$=r(a,c,"resolveDir",h),O=r(a,c,"pluginData",ye),p=r(a,c,"loader",h),C=r(a,c,"errors",z),L=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(R)}`),o.id=k,b!=null&&(o.pluginName=b),E instanceof Uint8Array?o.contents=E:E!=null&&(o.contents=Z(E)),$!=null&&(o.resolveDir=$),O!=null&&(o.pluginData=g.store(O)),p!=null&&(o.loader=p),C!=null&&(o.errors=ne(C,"errors",g,R)),L!=null&&(o.warnings=ne(L,"warnings",g,R)),A!=null&&(o.watchFiles=me(A,"watchFiles")),P!=null&&(o.watchDirs=me(P,"watchDirs"));break}}catch(a){o={id:k,errors:[le(a,u,g,M&&M(),R)]};break}n(y,o)});let Y=(y,d)=>d([],[]);v.length>0&&(Y=(y,d)=>{te(void 0,null,function*(){let o=[],R=[];for(let{name:S,callback:M,note:k}of v){let a,c;try{let b=yield M(y);if(b!=null){if(typeof b!="object")throw new Error(`Expected onEnd() callback in plugin ${V(S)} to return an object`);let E={},$=r(b,E,"errors",z),O=r(b,E,"warnings",z);K(b,E,`from onEnd() callback in plugin ${V(S)}`),$!=null&&(a=ne($,"errors",g,S)),O!=null&&(c=ne(O,"warnings",g,S))}}catch(b){a=[le(b,u,g,k&&k(),S)]}if(a){o.push(...a);try{y.errors.push(...a)}catch(b){}}if(c){R.push(...c);try{y.warnings.push(...c)}catch(b){}}}d(o,R)})});let x=()=>{for(let y of B)setTimeout(()=>y(),0)};return W=!0,{ok:!0,requestPlugins:T,runOnEndCallbacks:Y,scheduleOnDisposeCallbacks:x}});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",h=e=>typeof e=="string"?null:"a string",he=e=>e instanceof RegExp?null:"a RegExp object",oe=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",h),s=r(t,n,"logLimit",oe);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",h),u=r(t,n,"sourceRoot",h),l=r(t,n,"sourcesContent",I),f=r(t,n,"target",Ze),s=r(t,n,"format",h),g=r(t,n,"globalName",h),w=r(t,n,"mangleProps",he),v=r(t,n,"reserveProps",he),F=r(t,n,"mangleQuoted",I),U=r(t,n,"minify",I),B=r(t,n,"minifySyntax",I),j=r(t,n,"minifyWhitespace",I),Q=r(t,n,"minifyIdentifiers",I),T=r(t,n,"drop",z),W=r(t,n,"charset",h),Y=r(t,n,"treeShaking",I),x=r(t,n,"ignoreAnnotations",I),y=r(t,n,"jsx",h),d=r(t,n,"jsxFactory",h),o=r(t,n,"jsxFragment",h),R=r(t,n,"jsxImportSource",h),S=r(t,n,"jsxDev",I),M=r(t,n,"jsxSideEffects",I),k=r(t,n,"define",ee),a=r(t,n,"logOverride",ee),c=r(t,n,"supported",ee),b=r(t,n,"pure",z),E=r(t,n,"keepNames",I),$=r(t,n,"platform",h),O=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}`),g&&e.push(`--global-name=${g}`),$&&e.push(`--platform=${$}`),O&&e.push(`--tsconfig-raw=${typeof O=="string"?O:JSON.stringify(O)}`),U&&e.push("--minify"),B&&e.push("--minify-syntax"),j&&e.push("--minify-whitespace"),Q&&e.push("--minify-identifiers"),W&&e.push(`--charset=${W}`),Y!==void 0&&e.push(`--tree-shaking=${Y}`),x&&e.push("--ignore-annotations"),T)for(let p of T)e.push(`--drop:${J(p,"drop")}`);if(w&&e.push(`--mangle-props=${w.source}`),v&&e.push(`--reserve-props=${v.source}`),F!==void 0&&e.push(`--mangle-quoted=${F}`),y&&e.push(`--jsx=${y}`),d&&e.push(`--jsx-factory=${d}`),o&&e.push(`--jsx-fragment=${o}`),R&&e.push(`--jsx-import-source=${R}`),S&&e.push("--jsx-dev"),M&&e.push("--jsx-side-effects"),k)for(let p in k){if(p.indexOf("=")>=0)throw new Error(`Invalid define: ${p}`);e.push(`--define:${p}=${J(k[p],"define",p)}`)}if(a)for(let p in a){if(p.indexOf("=")>=0)throw new Error(`Invalid log override: ${p}`);e.push(`--log-override:${p}=${J(a[p],"log override",p)}`)}if(c)for(let p in c){if(p.indexOf("=")>=0)throw new Error(`Invalid supported: ${p}`);let C=c[p];if(typeof C!="boolean")throw new Error(`Expected value for supported ${V(p)} to be a boolean, got ${typeof C} instead`);e.push(`--supported:${p}=${C}`)}if(b)for(let p of b)e.push(`--pure:${J(p,"pure")}`);E&&e.push("--keep-names")}function tt(e,t,n,i,u){var se;let l=[],f=[],s=Object.create(null),g=null,w=null;be(l,t,s,n,i),je(l,t,s);let v=r(t,s,"sourcemap",Fe),F=r(t,s,"bundle",I),U=r(t,s,"splitting",I),B=r(t,s,"preserveSymlinks",I),j=r(t,s,"metafile",I),Q=r(t,s,"outfile",h),T=r(t,s,"outdir",h),W=r(t,s,"outbase",h),Y=r(t,s,"tsconfig",h),x=r(t,s,"resolveExtensions",z),y=r(t,s,"nodePaths",z),d=r(t,s,"mainFields",z),o=r(t,s,"conditions",z),R=r(t,s,"external",z),S=r(t,s,"packages",h),M=r(t,s,"alias",ee),k=r(t,s,"loader",ee),a=r(t,s,"outExtension",ee),c=r(t,s,"publicPath",h),b=r(t,s,"entryNames",h),E=r(t,s,"chunkNames",h),$=r(t,s,"assetNames",h),O=r(t,s,"inject",z),p=r(t,s,"banner",ee),C=r(t,s,"footer",ee),L=r(t,s,"entryPoints",He),A=r(t,s,"absWorkingDir",h),P=r(t,s,"stdin",ee),D=(se=r(t,s,"write",I))!=null?se:u,q=r(t,s,"allowOverwrite",I),_=r(t,s,"mangleCache",ee);if(s.plugins=!0,K(t,s,`in ${e}() call`),v&&l.push(`--sourcemap${v===!0?"":`=${v}`}`),F&&l.push("--bundle"),q&&l.push("--allow-overwrite"),U&&l.push("--splitting"),B&&l.push("--preserve-symlinks"),j&&l.push("--metafile"),Q&&l.push(`--outfile=${Q}`),T&&l.push(`--outdir=${T}`),W&&l.push(`--outbase=${W}`),Y&&l.push(`--tsconfig=${Y}`),S&&l.push(`--packages=${S}`),x){let m=[];for(let N of x){if(J(N,"resolve extension"),N.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${N}`);m.push(N)}l.push(`--resolve-extensions=${m.join(",")}`)}if(c&&l.push(`--public-path=${c}`),b&&l.push(`--entry-names=${b}`),E&&l.push(`--chunk-names=${E}`),$&&l.push(`--asset-names=${$}`),d){let m=[];for(let N of d){if(J(N,"main field"),N.indexOf(",")>=0)throw new Error(`Invalid main field: ${N}`);m.push(N)}l.push(`--main-fields=${m.join(",")}`)}if(o){let m=[];for(let N of o){if(J(N,"condition"),N.indexOf(",")>=0)throw new Error(`Invalid condition: ${N}`);m.push(N)}l.push(`--conditions=${m.join(",")}`)}if(R)for(let m of R)l.push(`--external:${J(m,"external")}`);if(M)for(let m in M){if(m.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${m}`);l.push(`--alias:${m}=${J(M[m],"alias",m)}`)}if(p)for(let m in p){if(m.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${m}`);l.push(`--banner:${m}=${J(p[m],"banner",m)}`)}if(C)for(let m in C){if(m.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${m}`);l.push(`--footer:${m}=${J(C[m],"footer",m)}`)}if(O)for(let m of O)l.push(`--inject:${J(m,"inject")}`);if(k)for(let m in k){if(m.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${m}`);l.push(`--loader:${m}=${J(k[m],"loader",m)}`)}if(a)for(let m in a){if(m.indexOf("=")>=0)throw new Error(`Invalid out extension: ${m}`);l.push(`--out-extension:${m}=${J(a[m],"out extension",m)}`)}if(L)if(Array.isArray(L))for(let m=0,N=L.length;m<N;m++){let G=L[m];if(typeof G=="object"&&G!==null){let X=Object.create(null),re=r(G,X,"in",h),de=r(G,X,"out",h);if(K(G,X,"in entry point at index "+m),re===void 0)throw new Error('Missing property "in" for entry point at index '+m);if(de===void 0)throw new Error('Missing property "out" for entry point at index '+m);f.push([de,re])}else f.push(["",J(G,"entry point at index "+m)])}else for(let m in L)f.push([m,J(L[m],"entry point",m)]);if(P){let m=Object.create(null),N=r(P,m,"contents",Te),G=r(P,m,"resolveDir",h),X=r(P,m,"sourcefile",h),re=r(P,m,"loader",h);K(P,m,'in "stdin" object'),X&&l.push(`--sourcefile=${X}`),re&&l.push(`--loader=${re}`),G&&(w=G),typeof N=="string"?g=Z(N):N instanceof Uint8Array&&(g=N)}let H=[];if(y)for(let m of y)m+="",H.push(m);return{entries:f,flags:l,write:D,stdinContents:g,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",h),g=r(t,l,"loader",h),w=r(t,l,"banner",h),v=r(t,l,"footer",h),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}`),g&&u.push(`--loader=${g}`),w&&u.push(`--banner=${w}`),v&&u.push(`--footer=${v}`),{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,g=x=>{let y=s+x.length;if(y>f.length){let o=new Uint8Array(y*2);o.set(f),f=o}f.set(x,s),s+=x.length;let d=0;for(;d+4<=s;){let o=Ee(f,d);if(d+4+o>s)break;d+=4,j(f.subarray(d,d+o)),d+=o}d>0&&(f.copyWithin(0,d,s),s-=d)},w=x=>{n.didClose=!0,x&&(n.reason=": "+(x.message||x));let y="The service was stopped"+n.reason;for(let d in i)i[d](y,null);i={}},v=(x,y,d)=>{if(n.didClose)return d("The service is no longer running"+n.reason,null);let o=u++;i[o]=(R,S)=>{try{d(R,S)}finally{x&&x.unref()}},x&&x.ref(),e.writeToStdin(Oe({id:o,isRequest:!0,value:y}))},F=(x,y)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(Oe({id:x,isRequest:!1,value:y}))},U=(x,y)=>te(this,null,function*(){try{if(y.command==="ping"){F(x,{});return}if(typeof y.key=="number"){let d=t[y.key];if(d){let o=d[y.command];if(o){yield o(x,y);return}}}throw new Error("Invalid command: "+y.command)}catch(d){F(x,{errors:[le(d,e,null,void 0,"")]})}}),B=!0,j=x=>{if(B){B=!1;let d=String.fromCharCode(...x);if(d!=="0.18.3")throw new Error(`Cannot start service: Host version "0.18.3" does not match binary version ${V(d)}`);return}let y=ke(x);if(y.isRequest)U(y.id,y.value);else{let d=i[y.id];delete i[y.id],y.value.error?d(y.value.error,{}):d(null,y.value)}};return{readFromStdout:g,afterClose:w,service:{buildOrContext:({callName:x,refs:y,options:d,isTTY:o,defaultWD:R,callback:S})=>{let M=0,k=l++,a={},c={ref(){++M===1&&y&&y.ref()},unref(){--M===0&&(delete t[k],y&&y.unref())}};t[k]=a,c.ref(),rt(x,k,v,F,c,e,a,d,o,R,(b,E)=>{try{S(b,E)}finally{c.unref()}})},transform:({callName:x,refs:y,input:d,options:o,isTTY:R,fs:S,callback:M})=>{let k=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(x,o,R,Me),$={command:"transform",flags:b,inputFS:c!==null,input:c!==null?Z(c):typeof d=="string"?Z(d):d};E&&($.mangleCache=E),v(y,$,(O,p)=>{if(O)return M(new Error(O),null);let C=ae(p.errors,k),L=ae(p.warnings,k),A=1,P=()=>{if(--A===0){let D={warnings:L,code:p.code,map:p.map,mangleCache:void 0,legalComments:void 0};"legalComments"in p&&(D.legalComments=p==null?void 0:p.legalComments),p.mangleCache&&(D.mangleCache=p==null?void 0:p.mangleCache),M(null,D)}};if(C.length>0)return M(ce("Transform failed",C,L),null);p.codeFS&&(A++,S.readFile(p.code,(D,q)=>{D!==null?M(D,null):(p.code=q,P())})),p.mapFS&&(A++,S.readFile(p.map,(D,q)=>{D!==null?M(D,null):(p.map=q,P())})),P()})}catch(b){let E=[];try{be(E,o,{},R,Me)}catch(O){}let $=le(b,e,k,void 0,"");v(y,{command:"error",flags:E,error:$},()=>{$.detail=k.load($.detail),M(ce("Transform failed",[$],[]),null)})}};if((typeof d=="string"||d instanceof Uint8Array)&&d.length>1024*1024){let c=a;a=()=>S.writeFile(d,c)}a(null)},formatMessages:({callName:x,refs:y,messages:d,options:o,callback:R})=>{let S=ne(d,"messages",null,"");if(!o)throw new Error(`Missing second argument in ${x}() call`);let M={},k=r(o,M,"kind",h),a=r(o,M,"color",I),c=r(o,M,"terminalWidth",oe);if(K(o,M,`in ${x}() call`),k===void 0)throw new Error(`Missing "kind" in ${x}() call`);if(k!=="error"&&k!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${x}() call`);let b={command:"format-msgs",messages:S,isWarning:k==="warning"};a!==void 0&&(b.color=a),c!==void 0&&(b.terminalWidth=c),v(y,b,(E,$)=>{if(E)return R(new Error(E),null);R(null,$.messages)})},analyzeMetafile:({callName:x,refs:y,metafile:d,options:o,callback:R})=>{o===void 0&&(o={});let S={},M=r(o,S,"color",I),k=r(o,S,"verbose",I);K(o,S,`in ${x}() call`);let a={command:"analyze-metafile",metafile:d};M!==void 0&&(a.color=M),k!==void 0&&(a.verbose=k),v(y,a,(c,b)=>{if(c)return R(new Error(c),null);R(null,b.result)})}}}}function rt(e,t,n,i,u,l,f,s,g,w,v){let F=Le(),U=e==="context",B=(T,W)=>{let Y=[];try{be(Y,s,{},g,$e)}catch(y){}let x=le(T,l,F,void 0,W);n(u,{command:"error",flags:Y,error:x},()=>{x.detail=F.load(x.detail),v(ce(U?"Context failed":"Build failed",[x],[]),null)})},j;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'),"");j=T}}if(j&&j.length>0){if(l.isSync)return B(new Error("Cannot use plugins in synchronous API calls"),"");it(t,n,i,u,l,f,s,j,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 x=l.hasFS,{entries:y,flags:d,write:o,stdinContents:R,stdinResolveDir:S,absWorkingDir:M,nodePaths:k,mangleCache:a}=tt(e,s,g,$e,x);if(o&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let c={command:"build",key:t,entries:y,flags:d,write:o,stdinContents:R,stdinResolveDir:S,absWorkingDir:M||w,nodePaths:k,context:U};T&&(c.plugins=T),a&&(c.mangleCache=a);let b=(O,p)=>{let C={errors:ae(O.errors,F),warnings:ae(O.warnings,F),outputFiles:void 0,metafile:void 0,mangleCache:void 0},L=C.errors.slice(),A=C.warnings.slice();O.outputFiles&&(C.outputFiles=O.outputFiles.map(lt)),O.metafile&&(C.metafile=JSON.parse(O.metafile)),O.mangleCache&&(C.mangleCache=O.mangleCache),O.writeToStdout!==void 0&&console.log(ie(O.writeToStdout).replace(/\n$/,"")),W(C,(P,D)=>{if(L.length>0||P.length>0){let q=ce("Build failed",L.concat(P),A.concat(D));return p(q,null,P,D)}p(null,C,P,D)})},E,$;U&&(f["on-end"]=(O,p)=>new Promise(C=>{b(p,(L,A,P,D)=>{let q={errors:P,warnings:D};$&&$(L,A),E=void 0,$=void 0,i(O,q),C()})})),n(u,c,(O,p)=>{if(O)return v(new Error(O),null);if(!U)return b(p,(A,P)=>(Y(),v(A,P)));if(p.errors.length>0)return v(ce("Context failed",p.errors,p.warnings),null);let C=!1,L={rebuild:()=>(E||(E=new Promise((A,P)=>{let D;$=(_,H)=>{D||(D=()=>_?P(_):A(H))};let q=()=>{n(u,{command:"rebuild",key:t},(H,se)=>{H?P(new Error(H)):D?D():q()})};q()})),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 q={},_=r(A,q,"port",oe),H=r(A,q,"host",h),se=r(A,q,"servedir",h),m=r(A,q,"keyfile",h),N=r(A,q,"certfile",h),G=r(A,q,"onRequest",Pe);K(A,q,"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),m!==void 0&&(X.keyfile=m),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(C)return A();n(u,{command:"cancel",key:t},()=>{A()})}),dispose:()=>new Promise(A=>{if(C)return A();C=!0,n(u,{command:"dispose",key:t},()=>{A(),Y(),u.unref()})})};u.ref(),v(null,L)})}}var it=(e,t,n,i,u,l,f,s,g)=>te(void 0,null,function*(){let w=[],v=[],F={},U={},B=[],j=0,Q=0,T=[],W=!1;s=[...s];for(let y of s){let d={};if(typeof y!="object")throw new Error(`Plugin at index ${Q} must be an object`);let o=r(y,d,"name",h);if(typeof o!="string"||o==="")throw new Error(`Plugin at index ${Q} is missing a name`);try{let R=r(y,d,"setup",Pe);if(typeof R!="function")throw new Error("Plugin is missing a setup function");K(y,d,`on plugin ${V(o)}`);let S={name:o,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};Q++;let k=R({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",h),$=r(c,b,"importer",h),O=r(c,b,"namespace",h),p=r(c,b,"resolveDir",h),C=r(c,b,"kind",h),L=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),$!=null&&(D.importer=$),O!=null&&(D.namespace=O),p!=null&&(D.resolveDir=p),C!=null)D.kind=C;else throw new Error('Must specify "kind" when calling "resolve"');L!=null&&(D.pluginData=g.store(L)),t(i,D,(q,_)=>{q!==null?P(new Error(q)):A({errors:ae(_.errors,g),warnings:ae(_.warnings,g),path:_.path,external:_.external,sideEffects:_.sideEffects,namespace:_.namespace,suffix:_.suffix,pluginData:g.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}),S.onStart=!0},onEnd(a){let c='This error came from the "onEnd" callback registered here:',b=ge(new Error(c),u,"onEnd");v.push({name:o,callback:a,note:b}),S.onEnd=!0},onResolve(a,c){let b='This error came from the "onResolve" callback registered here:',E=ge(new Error(b),u,"onResolve"),$={},O=r(a,$,"filter",he),p=r(a,$,"namespace",h);if(K(a,$,`in onResolve() call for plugin ${V(o)}`),O==null)throw new Error("onResolve() call is missing a filter");let C=j++;F[C]={name:o,callback:c,note:E},S.onResolve.push({id:C,filter:O.source,namespace:p||""})},onLoad(a,c){let b='This error came from the "onLoad" callback registered here:',E=ge(new Error(b),u,"onLoad"),$={},O=r(a,$,"filter",he),p=r(a,$,"namespace",h);if(K(a,$,`in onLoad() call for plugin ${V(o)}`),O==null)throw new Error("onLoad() call is missing a filter");let C=j++;U[C]={name:o,callback:c,note:E},S.onLoad.push({id:C,filter:O.source,namespace:p||""})},onDispose(a){B.push(a)},esbuild:u.esbuild});k&&(yield k),T.push(S)}catch(R){return{ok:!1,error:R,pluginName:o}}}l["on-start"]=(y,d)=>te(void 0,null,function*(){let o={errors:[],warnings:[]};yield Promise.all(w.map(k=>te(void 0,[k],function*({name:R,callback:S,note:M}){try{let a=yield S();if(a!=null){if(typeof a!="object")throw new Error(`Expected onStart() callback in plugin ${V(R)} 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(R)}`),b!=null&&o.errors.push(...ne(b,"errors",g,R)),E!=null&&o.warnings.push(...ne(E,"warnings",g,R))}}catch(a){o.errors.push(le(a,u,g,M&&M(),R))}}))),n(y,o)}),l["on-resolve"]=(y,d)=>te(void 0,null,function*(){let o={},R="",S,M;for(let k of d.ids)try{({name:R,callback:S,note:M}=F[k]);let a=yield S({path:d.path,importer:d.importer,namespace:d.namespace,resolveDir:d.resolveDir,kind:d.kind,pluginData:g.load(d.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onResolve() callback in plugin ${V(R)} to return an object`);let c={},b=r(a,c,"pluginName",h),E=r(a,c,"path",h),$=r(a,c,"namespace",h),O=r(a,c,"suffix",h),p=r(a,c,"external",I),C=r(a,c,"sideEffects",I),L=r(a,c,"pluginData",ye),A=r(a,c,"errors",z),P=r(a,c,"warnings",z),D=r(a,c,"watchFiles",z),q=r(a,c,"watchDirs",z);K(a,c,`from onResolve() callback in plugin ${V(R)}`),o.id=k,b!=null&&(o.pluginName=b),E!=null&&(o.path=E),$!=null&&(o.namespace=$),O!=null&&(o.suffix=O),p!=null&&(o.external=p),C!=null&&(o.sideEffects=C),L!=null&&(o.pluginData=g.store(L)),A!=null&&(o.errors=ne(A,"errors",g,R)),P!=null&&(o.warnings=ne(P,"warnings",g,R)),D!=null&&(o.watchFiles=me(D,"watchFiles")),q!=null&&(o.watchDirs=me(q,"watchDirs"));break}}catch(a){o={id:k,errors:[le(a,u,g,M&&M(),R)]};break}n(y,o)}),l["on-load"]=(y,d)=>te(void 0,null,function*(){let o={},R="",S,M;for(let k of d.ids)try{({name:R,callback:S,note:M}=U[k]);let a=yield S({path:d.path,namespace:d.namespace,suffix:d.suffix,pluginData:g.load(d.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onLoad() callback in plugin ${V(R)} to return an object`);let c={},b=r(a,c,"pluginName",h),E=r(a,c,"contents",Te),$=r(a,c,"resolveDir",h),O=r(a,c,"pluginData",ye),p=r(a,c,"loader",h),C=r(a,c,"errors",z),L=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(R)}`),o.id=k,b!=null&&(o.pluginName=b),E instanceof Uint8Array?o.contents=E:E!=null&&(o.contents=Z(E)),$!=null&&(o.resolveDir=$),O!=null&&(o.pluginData=g.store(O)),p!=null&&(o.loader=p),C!=null&&(o.errors=ne(C,"errors",g,R)),L!=null&&(o.warnings=ne(L,"warnings",g,R)),A!=null&&(o.watchFiles=me(A,"watchFiles")),P!=null&&(o.watchDirs=me(P,"watchDirs"));break}}catch(a){o={id:k,errors:[le(a,u,g,M&&M(),R)]};break}n(y,o)});let Y=(y,d)=>d([],[]);v.length>0&&(Y=(y,d)=>{te(void 0,null,function*(){let o=[],R=[];for(let{name:S,callback:M,note:k}of v){let a,c;try{let b=yield M(y);if(b!=null){if(typeof b!="object")throw new Error(`Expected onEnd() callback in plugin ${V(S)} to return an object`);let E={},$=r(b,E,"errors",z),O=r(b,E,"warnings",z);K(b,E,`from onEnd() callback in plugin ${V(S)}`),$!=null&&(a=ne($,"errors",g,S)),O!=null&&(c=ne(O,"warnings",g,S))}}catch(b){a=[le(b,u,g,k&&k(),S)]}if(a){o.push(...a);try{y.errors.push(...a)}catch(b){}}if(c){R.push(...c);try{y.warnings.push(...c)}catch(b){}}}d(o,R)})});let x=()=>{for(let y of B)setTimeout(()=>y(),0)};return W=!0,{ok:!0,requestPlugins:T,runOnEndCallbacks:Y,scheduleOnDisposeCallbacks:x}});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 g=s.split(/\r\n|\r|\n|\u2028|\u2029/)[+f[2]-1]||"",w=+f[3]-1,v=g.slice(w,w+n.length)===n?n.length:0;return{file:f[1],namespace:"file",line:+f[2],column:Z(g.slice(0,w)).length,length:Z(g.slice(w,w+v)).length,lineText:g+`
|
|
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:g,line:w,column:v}=f.location,F=f.pluginName?`[plugin: ${f.pluginName}] `:"";return`
|
|
14
|
-
${g}:${w}:${v}: 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",h),u=r(e,n,"namespace",h),l=r(e,n,"line",oe),f=r(e,n,"column",oe),s=r(e,n,"length",oe),g=r(e,n,"lineText",h),w=r(e,n,"suggestion",h);return K(e,n,t),{file:i||"",namespace:u||"",line:l||0,column:f||0,length:s||0,lineText:g||"",suggestion:w||""}}function ne(e,t,n,i){let u=[],l=0;for(let f of e){let s={},g=r(f,s,"id",h),w=r(f,s,"pluginName",h),v=r(f,s,"text",h),F=r(f,s,"location",Ae),U=r(f,s,"notes",z),B=r(f,s,"detail",ye),j=`in element ${l} of "${t}"`;K(f,s,j);let Q=[];if(U)for(let T of U){let W={},Y=r(T,W,"text",h),x=r(T,W,"location",Ae);K(T,W,j),Q.push({text:Y||"",location:De(x,j)})}u.push({id:g||"",pluginName:w||i,text:v||"",location:De(F,j),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.2",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.2"],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
|
+
${g}:${w}:${v}: 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",h),u=r(e,n,"namespace",h),l=r(e,n,"line",oe),f=r(e,n,"column",oe),s=r(e,n,"length",oe),g=r(e,n,"lineText",h),w=r(e,n,"suggestion",h);return K(e,n,t),{file:i||"",namespace:u||"",line:l||0,column:f||0,length:s||0,lineText:g||"",suggestion:w||""}}function ne(e,t,n,i){let u=[],l=0;for(let f of e){let s={},g=r(f,s,"id",h),w=r(f,s,"pluginName",h),v=r(f,s,"text",h),F=r(f,s,"location",Ae),U=r(f,s,"notes",z),B=r(f,s,"detail",ye),j=`in element ${l} of "${t}"`;K(f,s,j);let Q=[];if(U)for(let T of U){let W={},Y=r(T,W,"text",h),x=r(T,W,"location",Ae);K(T,W,j),Q.push({text:Y||"",location:De(x,j)})}u.push({id:g||"",pluginName:w||i,text:v||"",location:De(F,j),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.3",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.3"],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.
|
|
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.3"],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);})(v=>i.onmessage({data:v}));i={onmessage:null,postMessage:v=>setTimeout(()=>w({data:v})),terminate(){}}}let u,l,f=new Promise((w,v)=>{u=w,l=v});i.onmessage=({data:w})=>{i.onmessage=({data:v})=>s(v),w?l(w):u()},i.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:s,service:g}=qe({writeToStdin(w){i.postMessage(w)},isSync:!1,hasFS:!1,esbuild:we});yield f,Se={build:w=>new Promise((v,F)=>g.buildOrContext({callName:"build",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(U,B)=>U?F(U):v(B)})),context:w=>new Promise((v,F)=>g.buildOrContext({callName:"context",refs:null,options:w,isTTY:!1,defaultWD:"/",callback:(U,B)=>U?F(U):v(B)})),transform:(w,v)=>new Promise((F,U)=>g.transform({callName:"transform",refs:null,input:w,options:v||{},isTTY:!1,fs:{readFile(B,j){j(new Error("Internal error"),null)},writeFile(B,j){j(null)}},callback:(B,j)=>B?U(B):F(j)})),formatMessages:(w,v)=>new Promise((F,U)=>g.formatMessages({callName:"formatMessages",refs:null,messages:w,options:v,callback:(B,j)=>B?U(B):F(j)})),analyzeMetafile:(w,v)=>new Promise((F,U)=>g.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof w=="string"?w:JSON.stringify(w),options:v,callback:(B,j)=>B?U(B):F(j)}))}}),wt=we;
|
|
22
22
|
})(typeof module==="object"?module:{set exports(x){(typeof self!=="undefined"?self:this).esbuild=x}});
|
package/lib/main.js
CHANGED
|
@@ -725,8 +725,8 @@ function createChannel(streamIn) {
|
|
|
725
725
|
if (isFirstPacket) {
|
|
726
726
|
isFirstPacket = false;
|
|
727
727
|
let binaryVersion = String.fromCharCode(...bytes);
|
|
728
|
-
if (binaryVersion !== "0.18.
|
|
729
|
-
throw new Error(`Cannot start service: Host version "${"0.18.
|
|
728
|
+
if (binaryVersion !== "0.18.3") {
|
|
729
|
+
throw new Error(`Cannot start service: Host version "${"0.18.3"}" does not match binary version ${quote(binaryVersion)}`);
|
|
730
730
|
}
|
|
731
731
|
return;
|
|
732
732
|
}
|
|
@@ -1747,7 +1747,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
|
|
|
1747
1747
|
}
|
|
1748
1748
|
}
|
|
1749
1749
|
var _a;
|
|
1750
|
-
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.18.
|
|
1750
|
+
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.18.3";
|
|
1751
1751
|
var esbuildCommandAndArgs = () => {
|
|
1752
1752
|
if ((!ESBUILD_BINARY_PATH || true) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
|
|
1753
1753
|
throw new Error(
|
|
@@ -1814,7 +1814,7 @@ var fsAsync = {
|
|
|
1814
1814
|
}
|
|
1815
1815
|
}
|
|
1816
1816
|
};
|
|
1817
|
-
var version = "0.18.
|
|
1817
|
+
var version = "0.18.3";
|
|
1818
1818
|
var build = (options) => ensureServiceIsRunning().build(options);
|
|
1819
1819
|
var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
|
|
1820
1820
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
@@ -1924,7 +1924,7 @@ var ensureServiceIsRunning = () => {
|
|
|
1924
1924
|
if (longLivedService)
|
|
1925
1925
|
return longLivedService;
|
|
1926
1926
|
let [command, args] = esbuildCommandAndArgs();
|
|
1927
|
-
let child = child_process.spawn(command, args.concat(`--service=${"0.18.
|
|
1927
|
+
let child = child_process.spawn(command, args.concat(`--service=${"0.18.3"}`, "--ping"), {
|
|
1928
1928
|
windowsHide: true,
|
|
1929
1929
|
stdio: ["pipe", "pipe", "inherit"],
|
|
1930
1930
|
cwd: defaultWD
|
|
@@ -2024,7 +2024,7 @@ var runServiceSync = (callback) => {
|
|
|
2024
2024
|
esbuild: node_exports
|
|
2025
2025
|
});
|
|
2026
2026
|
callback(service);
|
|
2027
|
-
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.18.
|
|
2027
|
+
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.18.3"}`), {
|
|
2028
2028
|
cwd: defaultWD,
|
|
2029
2029
|
windowsHide: true,
|
|
2030
2030
|
input: stdin,
|
|
@@ -2044,7 +2044,7 @@ var workerThreadService = null;
|
|
|
2044
2044
|
var startWorkerThreadService = (worker_threads2) => {
|
|
2045
2045
|
let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
|
|
2046
2046
|
let worker = new worker_threads2.Worker(__filename, {
|
|
2047
|
-
workerData: { workerPort, defaultWD, esbuildVersion: "0.18.
|
|
2047
|
+
workerData: { workerPort, defaultWD, esbuildVersion: "0.18.3" },
|
|
2048
2048
|
transferList: [workerPort],
|
|
2049
2049
|
// From node's documentation: https://nodejs.org/api/worker_threads.html
|
|
2050
2050
|
//
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "esbuild-wasm-strapkit",
|
|
3
|
-
"version": "0.18.
|
|
4
|
-
"esbuildVersion": "0.18.
|
|
5
|
-
"description": "esbuild-wasm 0.18.
|
|
3
|
+
"version": "0.18.3-build.3",
|
|
4
|
+
"esbuildVersion": "0.18.3",
|
|
5
|
+
"description": "esbuild-wasm 0.18.3",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=12"
|