isomorfeus-asset-manager 0.19.5 → 0.19.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isomorfeus/asset_manager/version.rb +1 -1
- data/node_modules/.package-lock.json +3 -3
- data/node_modules/esbuild-wasm/esbuild.wasm +0 -0
- data/node_modules/esbuild-wasm/esm/browser.js +12 -11
- data/node_modules/esbuild-wasm/esm/browser.min.js +3 -3
- data/node_modules/esbuild-wasm/lib/browser.js +12 -11
- data/node_modules/esbuild-wasm/lib/browser.min.js +3 -3
- data/node_modules/esbuild-wasm/lib/main.js +14 -13
- data/node_modules/esbuild-wasm/package.json +1 -1
- data/package.json +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78e9580782919245ff3fdf6b60840513259297c7975df94c9a1560fced17b457
|
4
|
+
data.tar.gz: 8320b4b6900ab9b1ba040f9e4316a908e49488d12482a3ececd239a43f9746e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7384c3f98c95547f6c679091e6d557a0c3e53920618c11f99424935c9292d7cb00e804f1a88ebd23604c93c65a293c7c98993a59dfcf3332d1aac2f6349a0257
|
7
|
+
data.tar.gz: b7fb4f774b2d45de704249ab6491c1340edaa0f569e3106ce44ee4a177ae4baea1e0bbb205098232f206c4db6a775e969e26c641b8c5064e25922f60c7cf35a6
|
@@ -4,9 +4,9 @@
|
|
4
4
|
"requires": true,
|
5
5
|
"packages": {
|
6
6
|
"node_modules/esbuild-wasm": {
|
7
|
-
"version": "0.19.
|
8
|
-
"resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.19.
|
9
|
-
"integrity": "sha512-
|
7
|
+
"version": "0.19.3",
|
8
|
+
"resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.19.3.tgz",
|
9
|
+
"integrity": "sha512-Vx94kkrz9CwaYutautk+RhIvwhcpawSRmKD/zz6n3wQqJgBzaMRVZaF9eAuVseXwOmfJexSGmwwgToQ1uAoOjg==",
|
10
10
|
"bin": {
|
11
11
|
"esbuild": "bin/esbuild"
|
12
12
|
},
|
Binary file
|
@@ -699,12 +699,13 @@ function createChannel(streamIn) {
|
|
699
699
|
}
|
700
700
|
if (typeof request.key === "number") {
|
701
701
|
const requestCallbacks = requestCallbacksByKey[request.key];
|
702
|
-
if (requestCallbacks) {
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
702
|
+
if (!requestCallbacks) {
|
703
|
+
return;
|
704
|
+
}
|
705
|
+
const callback = requestCallbacks[request.command];
|
706
|
+
if (callback) {
|
707
|
+
await callback(id, request);
|
708
|
+
return;
|
708
709
|
}
|
709
710
|
}
|
710
711
|
throw new Error(`Invalid command: ` + request.command);
|
@@ -721,8 +722,8 @@ function createChannel(streamIn) {
|
|
721
722
|
if (isFirstPacket) {
|
722
723
|
isFirstPacket = false;
|
723
724
|
let binaryVersion = String.fromCharCode(...bytes);
|
724
|
-
if (binaryVersion !== "0.19.
|
725
|
-
throw new Error(`Cannot start service: Host version "${"0.19.
|
725
|
+
if (binaryVersion !== "0.19.3") {
|
726
|
+
throw new Error(`Cannot start service: Host version "${"0.19.3"}" does not match binary version ${quote(binaryVersion)}`);
|
726
727
|
}
|
727
728
|
return;
|
728
729
|
}
|
@@ -1730,7 +1731,7 @@ function convertOutputFiles({ path, contents, hash }) {
|
|
1730
1731
|
}
|
1731
1732
|
|
1732
1733
|
// lib/npm/browser.ts
|
1733
|
-
var version = "0.19.
|
1734
|
+
var version = "0.19.3";
|
1734
1735
|
var build = (options) => ensureServiceIsRunning().build(options);
|
1735
1736
|
var context = (options) => ensureServiceIsRunning().context(options);
|
1736
1737
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
@@ -1775,7 +1776,7 @@ var initialize = (options) => {
|
|
1775
1776
|
var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
1776
1777
|
let worker;
|
1777
1778
|
if (useWorker) {
|
1778
|
-
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 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 go: {\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n // func nanotime1() int64\n "runtime.nanotime1": (sp) => {\n sp >>>= 0;\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n // func walltime() (sec int64, nsec int32)\n "runtime.walltime": (sp) => {\n sp >>>= 0;\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 >>>= 0;\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) + 1\n // setTimeout has been seen to fire up to 1 millisecond early\n ));\n this.mem.setInt32(sp + 16, id, true);\n },\n // func clearTimeoutEvent(id int32)\n "runtime.clearTimeoutEvent": (sp) => {\n sp >>>= 0;\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 >>>= 0;\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n // func finalizeRef(v ref)\n "syscall/js.finalizeRef": (sp) => {\n sp >>>= 0;\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 >>>= 0;\n storeValue(sp + 24, loadString(sp + 8));\n },\n // func valueGet(v ref, p string) ref\n "syscall/js.valueGet": (sp) => {\n sp >>>= 0;\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 32, result);\n },\n // func valueSet(v ref, p string, x ref)\n "syscall/js.valueSet": (sp) => {\n sp >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\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 >>>= 0;\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 = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\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 >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\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 >>>= 0;\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n // valuePrepareString(v ref) (ref, int)\n "syscall/js.valuePrepareString": (sp) => {\n sp >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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.19.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" });
|
1779
|
+
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 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 go: {\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n // func nanotime1() int64\n "runtime.nanotime1": (sp) => {\n sp >>>= 0;\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n // func walltime() (sec int64, nsec int32)\n "runtime.walltime": (sp) => {\n sp >>>= 0;\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 >>>= 0;\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) + 1\n // setTimeout has been seen to fire up to 1 millisecond early\n ));\n this.mem.setInt32(sp + 16, id, true);\n },\n // func clearTimeoutEvent(id int32)\n "runtime.clearTimeoutEvent": (sp) => {\n sp >>>= 0;\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 >>>= 0;\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n // func finalizeRef(v ref)\n "syscall/js.finalizeRef": (sp) => {\n sp >>>= 0;\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 >>>= 0;\n storeValue(sp + 24, loadString(sp + 8));\n },\n // func valueGet(v ref, p string) ref\n "syscall/js.valueGet": (sp) => {\n sp >>>= 0;\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 32, result);\n },\n // func valueSet(v ref, p string, x ref)\n "syscall/js.valueSet": (sp) => {\n sp >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\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 >>>= 0;\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 = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\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 >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\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 >>>= 0;\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n // valuePrepareString(v ref) (ref, int)\n "syscall/js.valuePrepareString": (sp) => {\n sp >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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.19.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" });
|
1779
1780
|
worker = new Worker(URL.createObjectURL(blob));
|
1780
1781
|
} else {
|
1781
1782
|
let onmessage = ((postMessage) => {
|
@@ -2389,7 +2390,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
2389
2390
|
callback(null, count);
|
2390
2391
|
};
|
2391
2392
|
let go = new globalThis.Go();
|
2392
|
-
go.argv = ["", `--service=${"0.19.
|
2393
|
+
go.argv = ["", `--service=${"0.19.3"}`];
|
2393
2394
|
tryToInstantiateModule(wasm, go).then(
|
2394
2395
|
(instance) => {
|
2395
2396
|
postMessage(null);
|
@@ -3,18 +3,18 @@ var We=Object.defineProperty;var ze=(e,t)=>{for(var n in t)We(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 Y=JSON.stringify,Se="warning",ke="silent";function $e(e){if(V(e,"target"),e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var me=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",m=e=>typeof e=="string"?null:"a string",ye=e=>e instanceof RegExp?null:"a RegExp object",le=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Ae=e=>typeof e=="function"?null:"a function",W=e=>Array.isArray(e)?null:"an array",ee=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",_e=e=>typeof e=="object"&&e!==null?null:"an array or an object",Ve=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Me=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Pe=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",Ye=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Je=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",De=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",Qe=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function r(e,t,n,l){let u=e[n];if(t[n+""]=!0,u===void 0)return;let i=l(u);if(i!==null)throw new Error(`${Y(n)} must be ${i}`);return u}function K(e,t,n){for(let l in e)if(!(l in t))throw new Error(`Invalid option ${n}: ${Y(l)}`)}function Fe(e){let t=Object.create(null),n=r(e,t,"wasmURL",Qe),l=r(e,t,"wasmModule",Ve),u=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:l,worker:u}}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 ${Y(n)} in mangle cache to map to either a string or false`)}}return t}function he(e,t,n,l,u){let i=r(t,n,"color",I),d=r(t,n,"logLevel",m),o=r(t,n,"logLimit",le);i!==void 0?e.push(`--color=${i}`):l&&e.push("--color=true"),e.push(`--log-level=${d||u}`),e.push(`--log-limit=${o||0}`)}function V(e,t,n){if(typeof e!="string")throw new Error(`Expected value for ${t}${n!==void 0?" "+Y(n):""} to be a string, got ${typeof e} instead`);return e}function Be(e,t,n){let l=r(t,n,"legalComments",m),u=r(t,n,"sourceRoot",m),i=r(t,n,"sourcesContent",I),d=r(t,n,"target",Je),o=r(t,n,"format",m),y=r(t,n,"globalName",m),b=r(t,n,"mangleProps",ye),w=r(t,n,"reserveProps",ye),U=r(t,n,"mangleQuoted",I),j=r(t,n,"minify",I),B=r(t,n,"minifySyntax",I),L=r(t,n,"minifyWhitespace",I),Q=r(t,n,"minifyIdentifiers",I),T=r(t,n,"lineLimit",le),z=r(t,n,"drop",W),J=r(t,n,"dropLabels",W),v=r(t,n,"charset",m),g=r(t,n,"treeShaking",I),f=r(t,n,"ignoreAnnotations",I),s=r(t,n,"jsx",m),x=r(t,n,"jsxFactory",m),$=r(t,n,"jsxFragment",m),C=r(t,n,"jsxImportSource",m),E=r(t,n,"jsxDev",I),a=r(t,n,"jsxSideEffects",I),c=r(t,n,"define",ee),h=r(t,n,"logOverride",ee),M=r(t,n,"supported",ee),A=r(t,n,"pure",W),S=r(t,n,"keepNames",I),O=r(t,n,"platform",m),P=r(t,n,"tsconfigRaw",Ye);if(l&&e.push(`--legal-comments=${l}`),u!==void 0&&e.push(`--source-root=${u}`),i!==void 0&&e.push(`--sources-content=${i}`),d&&(Array.isArray(d)?e.push(`--target=${Array.from(d).map($e).join(",")}`):e.push(`--target=${$e(d)}`)),o&&e.push(`--format=${o}`),y&&e.push(`--global-name=${y}`),O&&e.push(`--platform=${O}`),P&&e.push(`--tsconfig-raw=${typeof P=="string"?P:JSON.stringify(P)}`),j&&e.push("--minify"),B&&e.push("--minify-syntax"),L&&e.push("--minify-whitespace"),Q&&e.push("--minify-identifiers"),T&&e.push(`--line-limit=${T}`),v&&e.push(`--charset=${v}`),g!==void 0&&e.push(`--tree-shaking=${g}`),f&&e.push("--ignore-annotations"),z)for(let R of z)e.push(`--drop:${V(R,"drop")}`);if(J&&e.push(`--drop-labels=${Array.from(J).map(R=>V(R,"dropLabels")).join(",")}`),b&&e.push(`--mangle-props=${b.source}`),w&&e.push(`--reserve-props=${w.source}`),U!==void 0&&e.push(`--mangle-quoted=${U}`),s&&e.push(`--jsx=${s}`),x&&e.push(`--jsx-factory=${x}`),$&&e.push(`--jsx-fragment=${$}`),C&&e.push(`--jsx-import-source=${C}`),E&&e.push("--jsx-dev"),a&&e.push("--jsx-side-effects"),c)for(let R in c){if(R.indexOf("=")>=0)throw new Error(`Invalid define: ${R}`);e.push(`--define:${R}=${V(c[R],"define",R)}`)}if(h)for(let R in h){if(R.indexOf("=")>=0)throw new Error(`Invalid log override: ${R}`);e.push(`--log-override:${R}=${V(h[R],"log override",R)}`)}if(M)for(let R in M){if(R.indexOf("=")>=0)throw new Error(`Invalid supported: ${R}`);let k=M[R];if(typeof k!="boolean")throw new Error(`Expected value for supported ${Y(R)} to be a boolean, got ${typeof k} instead`);e.push(`--supported:${R}=${k}`)}if(A)for(let R of A)e.push(`--pure:${V(R,"pure")}`);S&&e.push("--keep-names")}function He(e,t,n,l,u){var se;let i=[],d=[],o=Object.create(null),y=null,b=null;he(i,t,o,n,l),Be(i,t,o);let w=r(t,o,"sourcemap",Pe),U=r(t,o,"bundle",I),j=r(t,o,"splitting",I),B=r(t,o,"preserveSymlinks",I),L=r(t,o,"metafile",I),Q=r(t,o,"outfile",m),T=r(t,o,"outdir",m),z=r(t,o,"outbase",m),J=r(t,o,"tsconfig",m),v=r(t,o,"resolveExtensions",W),g=r(t,o,"nodePaths",W),f=r(t,o,"mainFields",W),s=r(t,o,"conditions",W),x=r(t,o,"external",W),$=r(t,o,"packages",m),C=r(t,o,"alias",ee),E=r(t,o,"loader",ee),a=r(t,o,"outExtension",ee),c=r(t,o,"publicPath",m),h=r(t,o,"entryNames",m),M=r(t,o,"chunkNames",m),A=r(t,o,"assetNames",m),S=r(t,o,"inject",W),O=r(t,o,"banner",ee),P=r(t,o,"footer",ee),R=r(t,o,"entryPoints",_e),k=r(t,o,"absWorkingDir",m),F=r(t,o,"stdin",ee),D=(se=r(t,o,"write",I))!=null?se:u,q=r(t,o,"allowOverwrite",I),_=r(t,o,"mangleCache",ee);if(o.plugins=!0,K(t,o,`in ${e}() call`),w&&i.push(`--sourcemap${w===!0?"":`=${w}`}`),U&&i.push("--bundle"),q&&i.push("--allow-overwrite"),j&&i.push("--splitting"),B&&i.push("--preserve-symlinks"),L&&i.push("--metafile"),Q&&i.push(`--outfile=${Q}`),T&&i.push(`--outdir=${T}`),z&&i.push(`--outbase=${z}`),J&&i.push(`--tsconfig=${J}`),$&&i.push(`--packages=${$}`),v){let p=[];for(let N of v){if(V(N,"resolve extension"),N.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${N}`);p.push(N)}i.push(`--resolve-extensions=${p.join(",")}`)}if(c&&i.push(`--public-path=${c}`),h&&i.push(`--entry-names=${h}`),M&&i.push(`--chunk-names=${M}`),A&&i.push(`--asset-names=${A}`),f){let p=[];for(let N of f){if(V(N,"main field"),N.indexOf(",")>=0)throw new Error(`Invalid main field: ${N}`);p.push(N)}i.push(`--main-fields=${p.join(",")}`)}if(s){let p=[];for(let N of s){if(V(N,"condition"),N.indexOf(",")>=0)throw new Error(`Invalid condition: ${N}`);p.push(N)}i.push(`--conditions=${p.join(",")}`)}if(x)for(let p of x)i.push(`--external:${V(p,"external")}`);if(C)for(let p in C){if(p.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${p}`);i.push(`--alias:${p}=${V(C[p],"alias",p)}`)}if(O)for(let p in O){if(p.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${p}`);i.push(`--banner:${p}=${V(O[p],"banner",p)}`)}if(P)for(let p in P){if(p.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${p}`);i.push(`--footer:${p}=${V(P[p],"footer",p)}`)}if(S)for(let p of S)i.push(`--inject:${V(p,"inject")}`);if(E)for(let p in E){if(p.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${p}`);i.push(`--loader:${p}=${V(E[p],"loader",p)}`)}if(a)for(let p in a){if(p.indexOf("=")>=0)throw new Error(`Invalid out extension: ${p}`);i.push(`--out-extension:${p}=${V(a[p],"out extension",p)}`)}if(R)if(Array.isArray(R))for(let p=0,N=R.length;p<N;p++){let X=R[p];if(typeof X=="object"&&X!==null){let te=Object.create(null),G=r(X,te,"in",m),ue=r(X,te,"out",m);if(K(X,te,"in entry point at index "+p),G===void 0)throw new Error('Missing property "in" for entry point at index '+p);if(ue===void 0)throw new Error('Missing property "out" for entry point at index '+p);d.push([ue,G])}else d.push(["",V(X,"entry point at index "+p)])}else for(let p in R)d.push([p,V(R[p],"entry point",p)]);if(F){let p=Object.create(null),N=r(F,p,"contents",De),X=r(F,p,"resolveDir",m),te=r(F,p,"sourcefile",m),G=r(F,p,"loader",m);K(F,p,'in "stdin" object'),te&&i.push(`--sourcefile=${te}`),G&&i.push(`--loader=${G}`),X&&(b=X),typeof N=="string"?y=Z(N):N instanceof Uint8Array&&(y=N)}let H=[];if(g)for(let p of g)p+="",H.push(p);return{entries:d,flags:i,write:D,stdinContents:y,stdinResolveDir:b,absWorkingDir:k,nodePaths:H,mangleCache:Te(_)}}function Ge(e,t,n,l){let u=[],i=Object.create(null);he(u,t,i,n,l),Be(u,t,i);let d=r(t,i,"sourcemap",Pe),o=r(t,i,"sourcefile",m),y=r(t,i,"loader",m),b=r(t,i,"banner",m),w=r(t,i,"footer",m),U=r(t,i,"mangleCache",ee);return K(t,i,`in ${e}() call`),d&&u.push(`--sourcemap=${d===!0?"external":d}`),o&&u.push(`--sourcefile=${o}`),y&&u.push(`--loader=${y}`),b&&u.push(`--banner=${b}`),w&&u.push(`--footer=${w}`),{flags:u,mangleCache:Te(U)}}function Ue(e){let t={},n={didClose:!1,reason:""},l={},u=0,i=0,d=new Uint8Array(16*1024),o=0,y=v=>{let g=o+v.length;if(g>d.length){let s=new Uint8Array(g*2);s.set(d),d=s}d.set(v,o),o+=v.length;let f=0;for(;f+4<=o;){let s=Re(d,f);if(f+4+s>o)break;f+=4,L(d.subarray(f,f+s)),f+=s}f>0&&(d.copyWithin(0,f,o),o-=f)},b=v=>{n.didClose=!0,v&&(n.reason=": "+(v.message||v));let g="The service was stopped"+n.reason;for(let f in l)l[f](g,null);l={}},w=(v,g,f)=>{if(n.didClose)return f("The service is no longer running"+n.reason,null);let s=u++;l[s]=(x,$)=>{try{f(x,$)}finally{v&&v.unref()}},v&&v.ref(),e.writeToStdin(xe({id:s,isRequest:!0,value:g}))},U=(v,g)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(xe({id:v,isRequest:!1,value:g}))},j=async(v,g)=>{try{if(g.command==="ping"){U(v,{});return}if(typeof g.key=="number"){let f=t[g.key];if(f){let s=f[g.command];if(s){await s(v,g);return}}}throw new Error("Invalid command: "+g.command)}catch(f){let s=[ie(f,e,null,void 0,"")];try{U(v,{errors:s})}catch(x){}}},B=!0,L=v=>{if(B){B=!1;let f=String.fromCharCode(...v);if(f!=="0.19.2")throw new Error(`Cannot start service: Host version "0.19.2" does not match binary version ${Y(f)}`);return}let g=Ee(v);if(g.isRequest)j(g.id,g.value);else{let f=l[g.id];delete l[g.id],g.value.error?f(g.value.error,{}):f(null,g.value)}};return{readFromStdout:y,afterClose:b,service:{buildOrContext:({callName:v,refs:g,options:f,isTTY:s,defaultWD:x,callback:$})=>{let C=0,E=i++,a={},c={ref(){++C===1&&g&&g.ref()},unref(){--C===0&&(delete t[E],g&&g.unref())}};t[E]=a,c.ref(),Xe(v,E,w,U,c,e,a,f,s,x,(h,M)=>{try{$(h,M)}finally{c.unref()}})},transform:({callName:v,refs:g,input:f,options:s,isTTY:x,fs:$,callback:C})=>{let E=je(),a=c=>{try{if(typeof f!="string"&&!(f instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:h,mangleCache:M}=Ge(v,s,x,ke),A={command:"transform",flags:h,inputFS:c!==null,input:c!==null?Z(c):typeof f=="string"?Z(f):f};M&&(A.mangleCache=M),w(g,A,(S,O)=>{if(S)return C(new Error(S),null);let P=oe(O.errors,E),R=oe(O.warnings,E),k=1,F=()=>{if(--k===0){let D={warnings:R,code:O.code,map:O.map,mangleCache:void 0,legalComments:void 0};"legalComments"in O&&(D.legalComments=O==null?void 0:O.legalComments),O.mangleCache&&(D.mangleCache=O==null?void 0:O.mangleCache),C(null,D)}};if(P.length>0)return C(ce("Transform failed",P,R),null);O.codeFS&&(k++,$.readFile(O.code,(D,q)=>{D!==null?C(D,null):(O.code=q,F())})),O.mapFS&&(k++,$.readFile(O.map,(D,q)=>{D!==null?C(D,null):(O.map=q,F())})),F()})}catch(h){let M=[];try{he(M,s,{},x,ke)}catch(S){}let A=ie(h,e,E,void 0,"");w(g,{command:"error",flags:M,error:A},()=>{A.detail=E.load(A.detail),C(ce("Transform failed",[A],[]),null)})}};if((typeof f=="string"||f instanceof Uint8Array)&&f.length>1024*1024){let c=a;a=()=>$.writeFile(f,c)}a(null)},formatMessages:({callName:v,refs:g,messages:f,options:s,callback:x})=>{let $=ne(f,"messages",null,"");if(!s)throw new Error(`Missing second argument in ${v}() call`);let C={},E=r(s,C,"kind",m),a=r(s,C,"color",I),c=r(s,C,"terminalWidth",le);if(K(s,C,`in ${v}() call`),E===void 0)throw new Error(`Missing "kind" in ${v}() call`);if(E!=="error"&&E!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${v}() call`);let h={command:"format-msgs",messages:$,isWarning:E==="warning"};a!==void 0&&(h.color=a),c!==void 0&&(h.terminalWidth=c),w(g,h,(M,A)=>{if(M)return x(new Error(M),null);x(null,A.messages)})},analyzeMetafile:({callName:v,refs:g,metafile:f,options:s,callback:x})=>{s===void 0&&(s={});let $={},C=r(s,$,"color",I),E=r(s,$,"verbose",I);K(s,$,`in ${v}() call`);let a={command:"analyze-metafile",metafile:f};C!==void 0&&(a.color=C),E!==void 0&&(a.verbose=E),w(g,a,(c,h)=>{if(c)return x(new Error(c),null);x(null,h.result)})}}}}function Xe(e,t,n,l,u,i,d,o,y,b,w){let U=je(),j=e==="context",B=(T,z)=>{let J=[];try{he(J,o,{},y,Se)}catch(g){}let v=ie(T,i,U,void 0,z);n(u,{command:"error",flags:J,error:v},()=>{v.detail=U.load(v.detail),w(ce(j?"Context failed":"Build failed",[v],[]),null)})},L;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'),"");L=T}}if(L&&L.length>0){if(i.isSync)return B(new Error("Cannot use plugins in synchronous API calls"),"");Ze(t,n,l,u,i,d,o,L,U).then(T=>{if(!T.ok)return B(T.error,T.pluginName);try{Q(T.requestPlugins,T.runOnEndCallbacks,T.scheduleOnDisposeCallbacks)}catch(z){B(z,"")}},T=>B(T,""));return}try{Q(null,(T,z)=>z([],[]),()=>{})}catch(T){B(T,"")}function Q(T,z,J){let v=i.hasFS,{entries:g,flags:f,write:s,stdinContents:x,stdinResolveDir:$,absWorkingDir:C,nodePaths:E,mangleCache:a}=He(e,o,y,Se,v);if(s&&!i.hasFS)throw new Error('The "write" option is unavailable in this environment');let c={command:"build",key:t,entries:g,flags:f,write:s,stdinContents:x,stdinResolveDir:$,absWorkingDir:C||b,nodePaths:E,context:j};T&&(c.plugins=T),a&&(c.mangleCache=a);let h=(S,O)=>{let P={errors:oe(S.errors,U),warnings:oe(S.warnings,U),outputFiles:void 0,metafile:void 0,mangleCache:void 0},R=P.errors.slice(),k=P.warnings.slice();S.outputFiles&&(P.outputFiles=S.outputFiles.map(et)),S.metafile&&(P.metafile=JSON.parse(S.metafile)),S.mangleCache&&(P.mangleCache=S.mangleCache),S.writeToStdout!==void 0&&console.log(re(S.writeToStdout).replace(/\n$/,"")),z(P,(F,D)=>{if(R.length>0||F.length>0){let q=ce("Build failed",R.concat(F),k.concat(D));return O(q,null,F,D)}O(null,P,F,D)})},M,A;j&&(d["on-end"]=(S,O)=>new Promise(P=>{h(O,(R,k,F,D)=>{let q={errors:F,warnings:D};A&&A(R,k),M=void 0,A=void 0,l(S,q),P()})})),n(u,c,(S,O)=>{if(S)return w(new Error(S),null);if(!j)return h(O,(k,F)=>(J(),w(k,F)));if(O.errors.length>0)return w(ce("Context failed",O.errors,O.warnings),null);let P=!1,R={rebuild:()=>(M||(M=new Promise((k,F)=>{let D;A=(_,H)=>{D||(D=()=>_?F(_):k(H))};let q=()=>{n(u,{command:"rebuild",key:t},(H,se)=>{H?F(new Error(H)):D?D():q()})};q()})),M),watch:(k={})=>new Promise((F,D)=>{if(!i.hasFS)throw new Error('Cannot use the "watch" API in this environment');K(k,{},"in watch() call"),n(u,{command:"watch",key:t},H=>{H?D(new Error(H)):F(void 0)})}),serve:(k={})=>new Promise((F,D)=>{if(!i.hasFS)throw new Error('Cannot use the "serve" API in this environment');let q={},_=r(k,q,"port",le),H=r(k,q,"host",m),se=r(k,q,"servedir",m),p=r(k,q,"keyfile",m),N=r(k,q,"certfile",m),X=r(k,q,"fallback",m),te=r(k,q,"onRequest",Ae);K(k,q,"in serve() call");let G={command:"serve",key:t,onRequest:!!te};_!==void 0&&(G.port=_),H!==void 0&&(G.host=H),se!==void 0&&(G.servedir=se),p!==void 0&&(G.keyfile=p),N!==void 0&&(G.certfile=N),X!==void 0&&(G.fallback=X),n(u,G,(ue,qe)=>{if(ue)return D(new Error(ue));te&&(d["serve-request"]=(Ne,Ie)=>{te(Ie.args),l(Ne,{})}),F(qe)})}),cancel:()=>new Promise(k=>{if(P)return k();n(u,{command:"cancel",key:t},()=>{k()})}),dispose:()=>new Promise(k=>{if(P)return k();P=!0,n(u,{command:"dispose",key:t},()=>{k(),J(),u.unref()})})};u.ref(),w(null,R)})}}var Ze=async(e,t,n,l,u,i,d,o,y)=>{let b=[],w=[],U={},j={},B=[],L=0,Q=0,T=[],z=!1;o=[...o];for(let g of o){let f={};if(typeof g!="object")throw new Error(`Plugin at index ${Q} must be an object`);let s=r(g,f,"name",m);if(typeof s!="string"||s==="")throw new Error(`Plugin at index ${Q} is missing a name`);try{let x=r(g,f,"setup",Ae);if(typeof x!="function")throw new Error("Plugin is missing a setup function");K(g,f,`on plugin ${Y(s)}`);let $={name:s,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};Q++;let E=x({initialOptions:d,resolve:(a,c={})=>{if(!z)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 h=Object.create(null),M=r(c,h,"pluginName",m),A=r(c,h,"importer",m),S=r(c,h,"namespace",m),O=r(c,h,"resolveDir",m),P=r(c,h,"kind",m),R=r(c,h,"pluginData",me);return K(c,h,"in resolve() call"),new Promise((k,F)=>{let D={command:"resolve",path:a,key:e,pluginName:s};if(M!=null&&(D.pluginName=M),A!=null&&(D.importer=A),S!=null&&(D.namespace=S),O!=null&&(D.resolveDir=O),P!=null)D.kind=P;else throw new Error('Must specify "kind" when calling "resolve"');R!=null&&(D.pluginData=y.store(R)),t(l,D,(q,_)=>{q!==null?F(new Error(q)):k({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 c='This error came from the "onStart" callback registered here:',h=pe(new Error(c),u,"onStart");b.push({name:s,callback:a,note:h}),$.onStart=!0},onEnd(a){let c='This error came from the "onEnd" callback registered here:',h=pe(new Error(c),u,"onEnd");w.push({name:s,callback:a,note:h}),$.onEnd=!0},onResolve(a,c){let h='This error came from the "onResolve" callback registered here:',M=pe(new Error(h),u,"onResolve"),A={},S=r(a,A,"filter",ye),O=r(a,A,"namespace",m);if(K(a,A,`in onResolve() call for plugin ${Y(s)}`),S==null)throw new Error("onResolve() call is missing a filter");let P=L++;U[P]={name:s,callback:c,note:M},$.onResolve.push({id:P,filter:S.source,namespace:O||""})},onLoad(a,c){let h='This error came from the "onLoad" callback registered here:',M=pe(new Error(h),u,"onLoad"),A={},S=r(a,A,"filter",ye),O=r(a,A,"namespace",m);if(K(a,A,`in onLoad() call for plugin ${Y(s)}`),S==null)throw new Error("onLoad() call is missing a filter");let P=L++;j[P]={name:s,callback:c,note:M},$.onLoad.push({id:P,filter:S.source,namespace:O||""})},onDispose(a){B.push(a)},esbuild:u.esbuild});E&&await E,T.push($)}catch(x){return{ok:!1,error:x,pluginName:s}}}i["on-start"]=async(g,f)=>{let s={errors:[],warnings:[]};await Promise.all(b.map(async({name:x,callback:$,note:C})=>{try{let E=await $();if(E!=null){if(typeof E!="object")throw new Error(`Expected onStart() callback in plugin ${Y(x)} to return an object`);let a={},c=r(E,a,"errors",W),h=r(E,a,"warnings",W);K(E,a,`from onStart() callback in plugin ${Y(x)}`),c!=null&&s.errors.push(...ne(c,"errors",y,x)),h!=null&&s.warnings.push(...ne(h,"warnings",y,x))}}catch(E){s.errors.push(ie(E,u,y,C&&C(),x))}})),n(g,s)},i["on-resolve"]=async(g,f)=>{let s={},x="",$,C;for(let E of f.ids)try{({name:x,callback:$,note:C}=U[E]);let a=await $({path:f.path,importer:f.importer,namespace:f.namespace,resolveDir:f.resolveDir,kind:f.kind,pluginData:y.load(f.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onResolve() callback in plugin ${Y(x)} to return an object`);let c={},h=r(a,c,"pluginName",m),M=r(a,c,"path",m),A=r(a,c,"namespace",m),S=r(a,c,"suffix",m),O=r(a,c,"external",I),P=r(a,c,"sideEffects",I),R=r(a,c,"pluginData",me),k=r(a,c,"errors",W),F=r(a,c,"warnings",W),D=r(a,c,"watchFiles",W),q=r(a,c,"watchDirs",W);K(a,c,`from onResolve() callback in plugin ${Y(x)}`),s.id=E,h!=null&&(s.pluginName=h),M!=null&&(s.path=M),A!=null&&(s.namespace=A),S!=null&&(s.suffix=S),O!=null&&(s.external=O),P!=null&&(s.sideEffects=P),R!=null&&(s.pluginData=y.store(R)),k!=null&&(s.errors=ne(k,"errors",y,x)),F!=null&&(s.warnings=ne(F,"warnings",y,x)),D!=null&&(s.watchFiles=ge(D,"watchFiles")),q!=null&&(s.watchDirs=ge(q,"watchDirs"));break}}catch(a){s={id:E,errors:[ie(a,u,y,C&&C(),x)]};break}n(g,s)},i["on-load"]=async(g,f)=>{let s={},x="",$,C;for(let E of f.ids)try{({name:x,callback:$,note:C}=j[E]);let a=await $({path:f.path,namespace:f.namespace,suffix:f.suffix,pluginData:y.load(f.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onLoad() callback in plugin ${Y(x)} to return an object`);let c={},h=r(a,c,"pluginName",m),M=r(a,c,"contents",De),A=r(a,c,"resolveDir",m),S=r(a,c,"pluginData",me),O=r(a,c,"loader",m),P=r(a,c,"errors",W),R=r(a,c,"warnings",W),k=r(a,c,"watchFiles",W),F=r(a,c,"watchDirs",W);K(a,c,`from onLoad() callback in plugin ${Y(x)}`),s.id=E,h!=null&&(s.pluginName=h),M instanceof Uint8Array?s.contents=M:M!=null&&(s.contents=Z(M)),A!=null&&(s.resolveDir=A),S!=null&&(s.pluginData=y.store(S)),O!=null&&(s.loader=O),P!=null&&(s.errors=ne(P,"errors",y,x)),R!=null&&(s.warnings=ne(R,"warnings",y,x)),k!=null&&(s.watchFiles=ge(k,"watchFiles")),F!=null&&(s.watchDirs=ge(F,"watchDirs"));break}}catch(a){s={id:E,errors:[ie(a,u,y,C&&C(),x)]};break}n(g,s)};let J=(g,f)=>f([],[]);w.length>0&&(J=(g,f)=>{(async()=>{let s=[],x=[];for(let{name:$,callback:C,note:E}of w){let a,c;try{let h=await C(g);if(h!=null){if(typeof h!="object")throw new Error(`Expected onEnd() callback in plugin ${Y($)} to return an object`);let M={},A=r(h,M,"errors",W),S=r(h,M,"warnings",W);K(h,M,`from onEnd() callback in plugin ${Y($)}`),A!=null&&(a=ne(A,"errors",y,$)),S!=null&&(c=ne(S,"warnings",y,$))}}catch(h){a=[ie(h,u,y,E&&E(),$)]}if(a){s.push(...a);try{g.errors.push(...a)}catch(h){}}if(c){x.push(...c);try{g.warnings.push(...c)}catch(h){}}}f(s,x)})()});let v=()=>{for(let g of B)setTimeout(()=>g(),0)};return z=!0,{ok:!0,requestPlugins:T,runOnEndCallbacks:J,scheduleOnDisposeCallbacks:v}};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,u=!1;return()=>{if(u)return l;u=!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 Y=JSON.stringify,Se="warning",ke="silent";function $e(e){if(V(e,"target"),e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var me=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",m=e=>typeof e=="string"?null:"a string",ye=e=>e instanceof RegExp?null:"a RegExp object",le=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Ae=e=>typeof e=="function"?null:"a function",W=e=>Array.isArray(e)?null:"an array",ee=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",_e=e=>typeof e=="object"&&e!==null?null:"an array or an object",Ve=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Me=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Pe=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",Ye=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Je=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",De=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",Qe=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function r(e,t,n,l){let u=e[n];if(t[n+""]=!0,u===void 0)return;let i=l(u);if(i!==null)throw new Error(`${Y(n)} must be ${i}`);return u}function K(e,t,n){for(let l in e)if(!(l in t))throw new Error(`Invalid option ${n}: ${Y(l)}`)}function Fe(e){let t=Object.create(null),n=r(e,t,"wasmURL",Qe),l=r(e,t,"wasmModule",Ve),u=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:l,worker:u}}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 ${Y(n)} in mangle cache to map to either a string or false`)}}return t}function he(e,t,n,l,u){let i=r(t,n,"color",I),d=r(t,n,"logLevel",m),o=r(t,n,"logLimit",le);i!==void 0?e.push(`--color=${i}`):l&&e.push("--color=true"),e.push(`--log-level=${d||u}`),e.push(`--log-limit=${o||0}`)}function V(e,t,n){if(typeof e!="string")throw new Error(`Expected value for ${t}${n!==void 0?" "+Y(n):""} to be a string, got ${typeof e} instead`);return e}function Be(e,t,n){let l=r(t,n,"legalComments",m),u=r(t,n,"sourceRoot",m),i=r(t,n,"sourcesContent",I),d=r(t,n,"target",Je),o=r(t,n,"format",m),y=r(t,n,"globalName",m),b=r(t,n,"mangleProps",ye),w=r(t,n,"reserveProps",ye),U=r(t,n,"mangleQuoted",I),j=r(t,n,"minify",I),B=r(t,n,"minifySyntax",I),L=r(t,n,"minifyWhitespace",I),Q=r(t,n,"minifyIdentifiers",I),T=r(t,n,"lineLimit",le),z=r(t,n,"drop",W),J=r(t,n,"dropLabels",W),v=r(t,n,"charset",m),g=r(t,n,"treeShaking",I),f=r(t,n,"ignoreAnnotations",I),s=r(t,n,"jsx",m),x=r(t,n,"jsxFactory",m),$=r(t,n,"jsxFragment",m),C=r(t,n,"jsxImportSource",m),E=r(t,n,"jsxDev",I),a=r(t,n,"jsxSideEffects",I),c=r(t,n,"define",ee),h=r(t,n,"logOverride",ee),M=r(t,n,"supported",ee),A=r(t,n,"pure",W),S=r(t,n,"keepNames",I),O=r(t,n,"platform",m),P=r(t,n,"tsconfigRaw",Ye);if(l&&e.push(`--legal-comments=${l}`),u!==void 0&&e.push(`--source-root=${u}`),i!==void 0&&e.push(`--sources-content=${i}`),d&&(Array.isArray(d)?e.push(`--target=${Array.from(d).map($e).join(",")}`):e.push(`--target=${$e(d)}`)),o&&e.push(`--format=${o}`),y&&e.push(`--global-name=${y}`),O&&e.push(`--platform=${O}`),P&&e.push(`--tsconfig-raw=${typeof P=="string"?P:JSON.stringify(P)}`),j&&e.push("--minify"),B&&e.push("--minify-syntax"),L&&e.push("--minify-whitespace"),Q&&e.push("--minify-identifiers"),T&&e.push(`--line-limit=${T}`),v&&e.push(`--charset=${v}`),g!==void 0&&e.push(`--tree-shaking=${g}`),f&&e.push("--ignore-annotations"),z)for(let R of z)e.push(`--drop:${V(R,"drop")}`);if(J&&e.push(`--drop-labels=${Array.from(J).map(R=>V(R,"dropLabels")).join(",")}`),b&&e.push(`--mangle-props=${b.source}`),w&&e.push(`--reserve-props=${w.source}`),U!==void 0&&e.push(`--mangle-quoted=${U}`),s&&e.push(`--jsx=${s}`),x&&e.push(`--jsx-factory=${x}`),$&&e.push(`--jsx-fragment=${$}`),C&&e.push(`--jsx-import-source=${C}`),E&&e.push("--jsx-dev"),a&&e.push("--jsx-side-effects"),c)for(let R in c){if(R.indexOf("=")>=0)throw new Error(`Invalid define: ${R}`);e.push(`--define:${R}=${V(c[R],"define",R)}`)}if(h)for(let R in h){if(R.indexOf("=")>=0)throw new Error(`Invalid log override: ${R}`);e.push(`--log-override:${R}=${V(h[R],"log override",R)}`)}if(M)for(let R in M){if(R.indexOf("=")>=0)throw new Error(`Invalid supported: ${R}`);let k=M[R];if(typeof k!="boolean")throw new Error(`Expected value for supported ${Y(R)} to be a boolean, got ${typeof k} instead`);e.push(`--supported:${R}=${k}`)}if(A)for(let R of A)e.push(`--pure:${V(R,"pure")}`);S&&e.push("--keep-names")}function He(e,t,n,l,u){var se;let i=[],d=[],o=Object.create(null),y=null,b=null;he(i,t,o,n,l),Be(i,t,o);let w=r(t,o,"sourcemap",Pe),U=r(t,o,"bundle",I),j=r(t,o,"splitting",I),B=r(t,o,"preserveSymlinks",I),L=r(t,o,"metafile",I),Q=r(t,o,"outfile",m),T=r(t,o,"outdir",m),z=r(t,o,"outbase",m),J=r(t,o,"tsconfig",m),v=r(t,o,"resolveExtensions",W),g=r(t,o,"nodePaths",W),f=r(t,o,"mainFields",W),s=r(t,o,"conditions",W),x=r(t,o,"external",W),$=r(t,o,"packages",m),C=r(t,o,"alias",ee),E=r(t,o,"loader",ee),a=r(t,o,"outExtension",ee),c=r(t,o,"publicPath",m),h=r(t,o,"entryNames",m),M=r(t,o,"chunkNames",m),A=r(t,o,"assetNames",m),S=r(t,o,"inject",W),O=r(t,o,"banner",ee),P=r(t,o,"footer",ee),R=r(t,o,"entryPoints",_e),k=r(t,o,"absWorkingDir",m),F=r(t,o,"stdin",ee),D=(se=r(t,o,"write",I))!=null?se:u,q=r(t,o,"allowOverwrite",I),_=r(t,o,"mangleCache",ee);if(o.plugins=!0,K(t,o,`in ${e}() call`),w&&i.push(`--sourcemap${w===!0?"":`=${w}`}`),U&&i.push("--bundle"),q&&i.push("--allow-overwrite"),j&&i.push("--splitting"),B&&i.push("--preserve-symlinks"),L&&i.push("--metafile"),Q&&i.push(`--outfile=${Q}`),T&&i.push(`--outdir=${T}`),z&&i.push(`--outbase=${z}`),J&&i.push(`--tsconfig=${J}`),$&&i.push(`--packages=${$}`),v){let p=[];for(let N of v){if(V(N,"resolve extension"),N.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${N}`);p.push(N)}i.push(`--resolve-extensions=${p.join(",")}`)}if(c&&i.push(`--public-path=${c}`),h&&i.push(`--entry-names=${h}`),M&&i.push(`--chunk-names=${M}`),A&&i.push(`--asset-names=${A}`),f){let p=[];for(let N of f){if(V(N,"main field"),N.indexOf(",")>=0)throw new Error(`Invalid main field: ${N}`);p.push(N)}i.push(`--main-fields=${p.join(",")}`)}if(s){let p=[];for(let N of s){if(V(N,"condition"),N.indexOf(",")>=0)throw new Error(`Invalid condition: ${N}`);p.push(N)}i.push(`--conditions=${p.join(",")}`)}if(x)for(let p of x)i.push(`--external:${V(p,"external")}`);if(C)for(let p in C){if(p.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${p}`);i.push(`--alias:${p}=${V(C[p],"alias",p)}`)}if(O)for(let p in O){if(p.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${p}`);i.push(`--banner:${p}=${V(O[p],"banner",p)}`)}if(P)for(let p in P){if(p.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${p}`);i.push(`--footer:${p}=${V(P[p],"footer",p)}`)}if(S)for(let p of S)i.push(`--inject:${V(p,"inject")}`);if(E)for(let p in E){if(p.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${p}`);i.push(`--loader:${p}=${V(E[p],"loader",p)}`)}if(a)for(let p in a){if(p.indexOf("=")>=0)throw new Error(`Invalid out extension: ${p}`);i.push(`--out-extension:${p}=${V(a[p],"out extension",p)}`)}if(R)if(Array.isArray(R))for(let p=0,N=R.length;p<N;p++){let X=R[p];if(typeof X=="object"&&X!==null){let te=Object.create(null),G=r(X,te,"in",m),ue=r(X,te,"out",m);if(K(X,te,"in entry point at index "+p),G===void 0)throw new Error('Missing property "in" for entry point at index '+p);if(ue===void 0)throw new Error('Missing property "out" for entry point at index '+p);d.push([ue,G])}else d.push(["",V(X,"entry point at index "+p)])}else for(let p in R)d.push([p,V(R[p],"entry point",p)]);if(F){let p=Object.create(null),N=r(F,p,"contents",De),X=r(F,p,"resolveDir",m),te=r(F,p,"sourcefile",m),G=r(F,p,"loader",m);K(F,p,'in "stdin" object'),te&&i.push(`--sourcefile=${te}`),G&&i.push(`--loader=${G}`),X&&(b=X),typeof N=="string"?y=Z(N):N instanceof Uint8Array&&(y=N)}let H=[];if(g)for(let p of g)p+="",H.push(p);return{entries:d,flags:i,write:D,stdinContents:y,stdinResolveDir:b,absWorkingDir:k,nodePaths:H,mangleCache:Te(_)}}function Ge(e,t,n,l){let u=[],i=Object.create(null);he(u,t,i,n,l),Be(u,t,i);let d=r(t,i,"sourcemap",Pe),o=r(t,i,"sourcefile",m),y=r(t,i,"loader",m),b=r(t,i,"banner",m),w=r(t,i,"footer",m),U=r(t,i,"mangleCache",ee);return K(t,i,`in ${e}() call`),d&&u.push(`--sourcemap=${d===!0?"external":d}`),o&&u.push(`--sourcefile=${o}`),y&&u.push(`--loader=${y}`),b&&u.push(`--banner=${b}`),w&&u.push(`--footer=${w}`),{flags:u,mangleCache:Te(U)}}function Ue(e){let t={},n={didClose:!1,reason:""},l={},u=0,i=0,d=new Uint8Array(16*1024),o=0,y=v=>{let g=o+v.length;if(g>d.length){let s=new Uint8Array(g*2);s.set(d),d=s}d.set(v,o),o+=v.length;let f=0;for(;f+4<=o;){let s=Re(d,f);if(f+4+s>o)break;f+=4,L(d.subarray(f,f+s)),f+=s}f>0&&(d.copyWithin(0,f,o),o-=f)},b=v=>{n.didClose=!0,v&&(n.reason=": "+(v.message||v));let g="The service was stopped"+n.reason;for(let f in l)l[f](g,null);l={}},w=(v,g,f)=>{if(n.didClose)return f("The service is no longer running"+n.reason,null);let s=u++;l[s]=(x,$)=>{try{f(x,$)}finally{v&&v.unref()}},v&&v.ref(),e.writeToStdin(xe({id:s,isRequest:!0,value:g}))},U=(v,g)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(xe({id:v,isRequest:!1,value:g}))},j=async(v,g)=>{try{if(g.command==="ping"){U(v,{});return}if(typeof g.key=="number"){let f=t[g.key];if(!f)return;let s=f[g.command];if(s){await s(v,g);return}}throw new Error("Invalid command: "+g.command)}catch(f){let s=[ie(f,e,null,void 0,"")];try{U(v,{errors:s})}catch(x){}}},B=!0,L=v=>{if(B){B=!1;let f=String.fromCharCode(...v);if(f!=="0.19.3")throw new Error(`Cannot start service: Host version "0.19.3" does not match binary version ${Y(f)}`);return}let g=Ee(v);if(g.isRequest)j(g.id,g.value);else{let f=l[g.id];delete l[g.id],g.value.error?f(g.value.error,{}):f(null,g.value)}};return{readFromStdout:y,afterClose:b,service:{buildOrContext:({callName:v,refs:g,options:f,isTTY:s,defaultWD:x,callback:$})=>{let C=0,E=i++,a={},c={ref(){++C===1&&g&&g.ref()},unref(){--C===0&&(delete t[E],g&&g.unref())}};t[E]=a,c.ref(),Xe(v,E,w,U,c,e,a,f,s,x,(h,M)=>{try{$(h,M)}finally{c.unref()}})},transform:({callName:v,refs:g,input:f,options:s,isTTY:x,fs:$,callback:C})=>{let E=je(),a=c=>{try{if(typeof f!="string"&&!(f instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:h,mangleCache:M}=Ge(v,s,x,ke),A={command:"transform",flags:h,inputFS:c!==null,input:c!==null?Z(c):typeof f=="string"?Z(f):f};M&&(A.mangleCache=M),w(g,A,(S,O)=>{if(S)return C(new Error(S),null);let P=oe(O.errors,E),R=oe(O.warnings,E),k=1,F=()=>{if(--k===0){let D={warnings:R,code:O.code,map:O.map,mangleCache:void 0,legalComments:void 0};"legalComments"in O&&(D.legalComments=O==null?void 0:O.legalComments),O.mangleCache&&(D.mangleCache=O==null?void 0:O.mangleCache),C(null,D)}};if(P.length>0)return C(ce("Transform failed",P,R),null);O.codeFS&&(k++,$.readFile(O.code,(D,q)=>{D!==null?C(D,null):(O.code=q,F())})),O.mapFS&&(k++,$.readFile(O.map,(D,q)=>{D!==null?C(D,null):(O.map=q,F())})),F()})}catch(h){let M=[];try{he(M,s,{},x,ke)}catch(S){}let A=ie(h,e,E,void 0,"");w(g,{command:"error",flags:M,error:A},()=>{A.detail=E.load(A.detail),C(ce("Transform failed",[A],[]),null)})}};if((typeof f=="string"||f instanceof Uint8Array)&&f.length>1024*1024){let c=a;a=()=>$.writeFile(f,c)}a(null)},formatMessages:({callName:v,refs:g,messages:f,options:s,callback:x})=>{let $=ne(f,"messages",null,"");if(!s)throw new Error(`Missing second argument in ${v}() call`);let C={},E=r(s,C,"kind",m),a=r(s,C,"color",I),c=r(s,C,"terminalWidth",le);if(K(s,C,`in ${v}() call`),E===void 0)throw new Error(`Missing "kind" in ${v}() call`);if(E!=="error"&&E!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${v}() call`);let h={command:"format-msgs",messages:$,isWarning:E==="warning"};a!==void 0&&(h.color=a),c!==void 0&&(h.terminalWidth=c),w(g,h,(M,A)=>{if(M)return x(new Error(M),null);x(null,A.messages)})},analyzeMetafile:({callName:v,refs:g,metafile:f,options:s,callback:x})=>{s===void 0&&(s={});let $={},C=r(s,$,"color",I),E=r(s,$,"verbose",I);K(s,$,`in ${v}() call`);let a={command:"analyze-metafile",metafile:f};C!==void 0&&(a.color=C),E!==void 0&&(a.verbose=E),w(g,a,(c,h)=>{if(c)return x(new Error(c),null);x(null,h.result)})}}}}function Xe(e,t,n,l,u,i,d,o,y,b,w){let U=je(),j=e==="context",B=(T,z)=>{let J=[];try{he(J,o,{},y,Se)}catch(g){}let v=ie(T,i,U,void 0,z);n(u,{command:"error",flags:J,error:v},()=>{v.detail=U.load(v.detail),w(ce(j?"Context failed":"Build failed",[v],[]),null)})},L;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'),"");L=T}}if(L&&L.length>0){if(i.isSync)return B(new Error("Cannot use plugins in synchronous API calls"),"");Ze(t,n,l,u,i,d,o,L,U).then(T=>{if(!T.ok)return B(T.error,T.pluginName);try{Q(T.requestPlugins,T.runOnEndCallbacks,T.scheduleOnDisposeCallbacks)}catch(z){B(z,"")}},T=>B(T,""));return}try{Q(null,(T,z)=>z([],[]),()=>{})}catch(T){B(T,"")}function Q(T,z,J){let v=i.hasFS,{entries:g,flags:f,write:s,stdinContents:x,stdinResolveDir:$,absWorkingDir:C,nodePaths:E,mangleCache:a}=He(e,o,y,Se,v);if(s&&!i.hasFS)throw new Error('The "write" option is unavailable in this environment');let c={command:"build",key:t,entries:g,flags:f,write:s,stdinContents:x,stdinResolveDir:$,absWorkingDir:C||b,nodePaths:E,context:j};T&&(c.plugins=T),a&&(c.mangleCache=a);let h=(S,O)=>{let P={errors:oe(S.errors,U),warnings:oe(S.warnings,U),outputFiles:void 0,metafile:void 0,mangleCache:void 0},R=P.errors.slice(),k=P.warnings.slice();S.outputFiles&&(P.outputFiles=S.outputFiles.map(et)),S.metafile&&(P.metafile=JSON.parse(S.metafile)),S.mangleCache&&(P.mangleCache=S.mangleCache),S.writeToStdout!==void 0&&console.log(re(S.writeToStdout).replace(/\n$/,"")),z(P,(F,D)=>{if(R.length>0||F.length>0){let q=ce("Build failed",R.concat(F),k.concat(D));return O(q,null,F,D)}O(null,P,F,D)})},M,A;j&&(d["on-end"]=(S,O)=>new Promise(P=>{h(O,(R,k,F,D)=>{let q={errors:F,warnings:D};A&&A(R,k),M=void 0,A=void 0,l(S,q),P()})})),n(u,c,(S,O)=>{if(S)return w(new Error(S),null);if(!j)return h(O,(k,F)=>(J(),w(k,F)));if(O.errors.length>0)return w(ce("Context failed",O.errors,O.warnings),null);let P=!1,R={rebuild:()=>(M||(M=new Promise((k,F)=>{let D;A=(_,H)=>{D||(D=()=>_?F(_):k(H))};let q=()=>{n(u,{command:"rebuild",key:t},(H,se)=>{H?F(new Error(H)):D?D():q()})};q()})),M),watch:(k={})=>new Promise((F,D)=>{if(!i.hasFS)throw new Error('Cannot use the "watch" API in this environment');K(k,{},"in watch() call"),n(u,{command:"watch",key:t},H=>{H?D(new Error(H)):F(void 0)})}),serve:(k={})=>new Promise((F,D)=>{if(!i.hasFS)throw new Error('Cannot use the "serve" API in this environment');let q={},_=r(k,q,"port",le),H=r(k,q,"host",m),se=r(k,q,"servedir",m),p=r(k,q,"keyfile",m),N=r(k,q,"certfile",m),X=r(k,q,"fallback",m),te=r(k,q,"onRequest",Ae);K(k,q,"in serve() call");let G={command:"serve",key:t,onRequest:!!te};_!==void 0&&(G.port=_),H!==void 0&&(G.host=H),se!==void 0&&(G.servedir=se),p!==void 0&&(G.keyfile=p),N!==void 0&&(G.certfile=N),X!==void 0&&(G.fallback=X),n(u,G,(ue,qe)=>{if(ue)return D(new Error(ue));te&&(d["serve-request"]=(Ne,Ie)=>{te(Ie.args),l(Ne,{})}),F(qe)})}),cancel:()=>new Promise(k=>{if(P)return k();n(u,{command:"cancel",key:t},()=>{k()})}),dispose:()=>new Promise(k=>{if(P)return k();P=!0,n(u,{command:"dispose",key:t},()=>{k(),J(),u.unref()})})};u.ref(),w(null,R)})}}var Ze=async(e,t,n,l,u,i,d,o,y)=>{let b=[],w=[],U={},j={},B=[],L=0,Q=0,T=[],z=!1;o=[...o];for(let g of o){let f={};if(typeof g!="object")throw new Error(`Plugin at index ${Q} must be an object`);let s=r(g,f,"name",m);if(typeof s!="string"||s==="")throw new Error(`Plugin at index ${Q} is missing a name`);try{let x=r(g,f,"setup",Ae);if(typeof x!="function")throw new Error("Plugin is missing a setup function");K(g,f,`on plugin ${Y(s)}`);let $={name:s,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};Q++;let E=x({initialOptions:d,resolve:(a,c={})=>{if(!z)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 h=Object.create(null),M=r(c,h,"pluginName",m),A=r(c,h,"importer",m),S=r(c,h,"namespace",m),O=r(c,h,"resolveDir",m),P=r(c,h,"kind",m),R=r(c,h,"pluginData",me);return K(c,h,"in resolve() call"),new Promise((k,F)=>{let D={command:"resolve",path:a,key:e,pluginName:s};if(M!=null&&(D.pluginName=M),A!=null&&(D.importer=A),S!=null&&(D.namespace=S),O!=null&&(D.resolveDir=O),P!=null)D.kind=P;else throw new Error('Must specify "kind" when calling "resolve"');R!=null&&(D.pluginData=y.store(R)),t(l,D,(q,_)=>{q!==null?F(new Error(q)):k({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 c='This error came from the "onStart" callback registered here:',h=pe(new Error(c),u,"onStart");b.push({name:s,callback:a,note:h}),$.onStart=!0},onEnd(a){let c='This error came from the "onEnd" callback registered here:',h=pe(new Error(c),u,"onEnd");w.push({name:s,callback:a,note:h}),$.onEnd=!0},onResolve(a,c){let h='This error came from the "onResolve" callback registered here:',M=pe(new Error(h),u,"onResolve"),A={},S=r(a,A,"filter",ye),O=r(a,A,"namespace",m);if(K(a,A,`in onResolve() call for plugin ${Y(s)}`),S==null)throw new Error("onResolve() call is missing a filter");let P=L++;U[P]={name:s,callback:c,note:M},$.onResolve.push({id:P,filter:S.source,namespace:O||""})},onLoad(a,c){let h='This error came from the "onLoad" callback registered here:',M=pe(new Error(h),u,"onLoad"),A={},S=r(a,A,"filter",ye),O=r(a,A,"namespace",m);if(K(a,A,`in onLoad() call for plugin ${Y(s)}`),S==null)throw new Error("onLoad() call is missing a filter");let P=L++;j[P]={name:s,callback:c,note:M},$.onLoad.push({id:P,filter:S.source,namespace:O||""})},onDispose(a){B.push(a)},esbuild:u.esbuild});E&&await E,T.push($)}catch(x){return{ok:!1,error:x,pluginName:s}}}i["on-start"]=async(g,f)=>{let s={errors:[],warnings:[]};await Promise.all(b.map(async({name:x,callback:$,note:C})=>{try{let E=await $();if(E!=null){if(typeof E!="object")throw new Error(`Expected onStart() callback in plugin ${Y(x)} to return an object`);let a={},c=r(E,a,"errors",W),h=r(E,a,"warnings",W);K(E,a,`from onStart() callback in plugin ${Y(x)}`),c!=null&&s.errors.push(...ne(c,"errors",y,x)),h!=null&&s.warnings.push(...ne(h,"warnings",y,x))}}catch(E){s.errors.push(ie(E,u,y,C&&C(),x))}})),n(g,s)},i["on-resolve"]=async(g,f)=>{let s={},x="",$,C;for(let E of f.ids)try{({name:x,callback:$,note:C}=U[E]);let a=await $({path:f.path,importer:f.importer,namespace:f.namespace,resolveDir:f.resolveDir,kind:f.kind,pluginData:y.load(f.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onResolve() callback in plugin ${Y(x)} to return an object`);let c={},h=r(a,c,"pluginName",m),M=r(a,c,"path",m),A=r(a,c,"namespace",m),S=r(a,c,"suffix",m),O=r(a,c,"external",I),P=r(a,c,"sideEffects",I),R=r(a,c,"pluginData",me),k=r(a,c,"errors",W),F=r(a,c,"warnings",W),D=r(a,c,"watchFiles",W),q=r(a,c,"watchDirs",W);K(a,c,`from onResolve() callback in plugin ${Y(x)}`),s.id=E,h!=null&&(s.pluginName=h),M!=null&&(s.path=M),A!=null&&(s.namespace=A),S!=null&&(s.suffix=S),O!=null&&(s.external=O),P!=null&&(s.sideEffects=P),R!=null&&(s.pluginData=y.store(R)),k!=null&&(s.errors=ne(k,"errors",y,x)),F!=null&&(s.warnings=ne(F,"warnings",y,x)),D!=null&&(s.watchFiles=ge(D,"watchFiles")),q!=null&&(s.watchDirs=ge(q,"watchDirs"));break}}catch(a){s={id:E,errors:[ie(a,u,y,C&&C(),x)]};break}n(g,s)},i["on-load"]=async(g,f)=>{let s={},x="",$,C;for(let E of f.ids)try{({name:x,callback:$,note:C}=j[E]);let a=await $({path:f.path,namespace:f.namespace,suffix:f.suffix,pluginData:y.load(f.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onLoad() callback in plugin ${Y(x)} to return an object`);let c={},h=r(a,c,"pluginName",m),M=r(a,c,"contents",De),A=r(a,c,"resolveDir",m),S=r(a,c,"pluginData",me),O=r(a,c,"loader",m),P=r(a,c,"errors",W),R=r(a,c,"warnings",W),k=r(a,c,"watchFiles",W),F=r(a,c,"watchDirs",W);K(a,c,`from onLoad() callback in plugin ${Y(x)}`),s.id=E,h!=null&&(s.pluginName=h),M instanceof Uint8Array?s.contents=M:M!=null&&(s.contents=Z(M)),A!=null&&(s.resolveDir=A),S!=null&&(s.pluginData=y.store(S)),O!=null&&(s.loader=O),P!=null&&(s.errors=ne(P,"errors",y,x)),R!=null&&(s.warnings=ne(R,"warnings",y,x)),k!=null&&(s.watchFiles=ge(k,"watchFiles")),F!=null&&(s.watchDirs=ge(F,"watchDirs"));break}}catch(a){s={id:E,errors:[ie(a,u,y,C&&C(),x)]};break}n(g,s)};let J=(g,f)=>f([],[]);w.length>0&&(J=(g,f)=>{(async()=>{let s=[],x=[];for(let{name:$,callback:C,note:E}of w){let a,c;try{let h=await C(g);if(h!=null){if(typeof h!="object")throw new Error(`Expected onEnd() callback in plugin ${Y($)} to return an object`);let M={},A=r(h,M,"errors",W),S=r(h,M,"warnings",W);K(h,M,`from onEnd() callback in plugin ${Y($)}`),A!=null&&(a=ne(A,"errors",y,$)),S!=null&&(c=ne(S,"warnings",y,$))}}catch(h){a=[ie(h,u,y,E&&E(),$)]}if(a){s.push(...a);try{g.errors.push(...a)}catch(h){}}if(c){x.push(...c);try{g.warnings.push(...c)}catch(h){}}}f(s,x)})()});let v=()=>{for(let g of B)setTimeout(()=>g(),0)};return z=!0,{ok:!0,requestPlugins:T,runOnEndCallbacks:J,scheduleOnDisposeCallbacks:v}};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,u=!1;return()=>{if(u)return l;u=!0;try{let i=(e.stack+"").split(`
|
7
7
|
`);i.splice(1,1);let d=Le(t,i,n);if(d)return l={text:e.message,location:d},l}catch(i){}}}function ie(e,t,n,l,u){let i="Internal error",d=null;try{i=(e&&e.message||e)+""}catch(o){}try{d=Le(t,(e.stack+"").split(`
|
8
8
|
`),"")}catch(o){}return{id:"",pluginName:u,text:i,location:d,notes:l?[l]:[],detail:n?n.store(e):-1}}function Le(e,t,n){let l=" at ";if(e.readFileSync&&!t[0].startsWith(l)&&t[1].startsWith(l))for(let u=1;u<t.length;u++){let i=t[u];if(i.startsWith(l))for(i=i.slice(l.length);;){let d=/^(?:new |async )?\S+ \((.*)\)$/.exec(i);if(d){i=d[1];continue}if(d=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(i),d){i=d[1];continue}if(d=/^(\S+):(\d+):(\d+)$/.exec(i),d){let o;try{o=e.readFileSync(d[1],"utf8")}catch(U){break}let y=o.split(/\r\n|\r|\n|\u2028|\u2029/)[+d[2]-1]||"",b=+d[3]-1,w=y.slice(b,b+n.length)===n?n.length:0;return{file:d[1],namespace:"file",line:+d[2],column:Z(y.slice(0,b)).length,length:Z(y.slice(b,b+w)).length,lineText:y+`
|
9
9
|
`+t.slice(1).join(`
|
10
10
|
`),suggestion:""}}break}}return null}function ce(e,t,n){let l=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,l+1).map((i,d)=>{if(d===l)return`
|
11
11
|
...`;if(!i.location)return`
|
12
12
|
error: ${i.text}`;let{file:o,line:y,column:b}=i.location,w=i.pluginName?`[plugin: ${i.pluginName}] `:"";return`
|
13
|
-
${o}:${y}:${b}: ERROR: ${w}${i.text}`}).join("");let u=new Error(e);for(let[i,d]of[["errors",t],["warnings",n]])Object.defineProperty(u,i,{configurable:!0,enumerable:!0,get:()=>d,set:o=>Object.defineProperty(u,i,{configurable:!0,enumerable:!0,value:o})});return u}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",m),u=r(e,n,"namespace",m),i=r(e,n,"line",le),d=r(e,n,"column",le),o=r(e,n,"length",le),y=r(e,n,"lineText",m),b=r(e,n,"suggestion",m);return K(e,n,t),{file:l||"",namespace:u||"",line:i||0,column:d||0,length:o||0,lineText:y||"",suggestion:b||""}}function ne(e,t,n,l){let u=[],i=0;for(let d of e){let o={},y=r(d,o,"id",m),b=r(d,o,"pluginName",m),w=r(d,o,"text",m),U=r(d,o,"location",Me),j=r(d,o,"notes",W),B=r(d,o,"detail",me),L=`in element ${i} of "${t}"`;K(d,o,L);let Q=[];if(j)for(let T of j){let z={},J=r(T,z,"text",m),v=r(T,z,"location",Me);K(T,z,L),Q.push({text:J||"",location:Ce(v,L)})}u.push({id:y||"",pluginName:b||l,text:w||"",location:Ce(U,L),notes:Q,detail:n?n.store(B):-1}),i++}return u}function ge(e,t){let n=[];for(let l of e){if(typeof l!="string")throw new Error(`${Y(t)} must be an array of strings`);n.push(l)}return n}function et({path:e,contents:t,hash:n}){let l=null;return{path:e,contents:t,hash:n,get text(){let u=this.contents;return(l===null||u!==t)&&(t=u,l=re(u)),l}}}var nt="0.19.2",rt=e=>fe().build(e),it=e=>fe().context(e),lt=(e,t)=>fe().transform(e,t),st=(e,t)=>fe().formatMessages(e,t),ot=(e,t)=>fe().analyzeMetafile(e,t),at=()=>{throw new Error('The "buildSync" API only works in node')},ut=()=>{throw new Error('The "transformSync" API only works in node')},ct=()=>{throw new Error('The "formatMessagesSync" API only works in node')},ft=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ae,Oe,fe=()=>{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')},dt=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=pt(t||"",n,l),ae.catch(()=>{ae=void 0}),ae},pt=async(e,t,n)=>{let l;if(n){let b=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 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(n,s){c+=g.decode(s);const i=c.lastIndexOf(`\n`);return i!=-1&&(console.log(c.substring(0,i)),c=c.substring(i+1)),s.length},write(n,s,i,a,h,u){if(i!==0||a!==s.length||h!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,a){a(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,a){a(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,a){a(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,a){a(r())},read(n,s,i,a,h,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,a){a(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"),g=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)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(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 l=this._ids.get(t);l===void 0&&(l=this._idPool.pop(),l===void 0&&(l=this._values.length),this._values[l]=t,this._goRefCounts[l]=0,this._ids.set(t,l)),this._goRefCounts[l]++;let m=0;switch(typeof t){case"object":t!==null&&(m=1);break;case"string":m=2;break;case"symbol":m=3;break;case"function":m=4;break}this.mem.setUint32(e+4,2146959360|m,!0),this.mem.setUint32(e,l,!0)},a=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},h=e=>{const t=n(e+0),o=n(e+8),l=new Array(o);for(let m=0;m<o;m++)l[m]=s(t+m*8);return l},u=e=>{const t=n(e+0),o=n(e+8);return g.decode(new DataView(this._inst.exports.mem.buffer,t,o))},d=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;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>>>=0;const t=n(e+8),o=n(e+16),l=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,l))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,c(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;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()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(a(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),l=h(e+32),m=Reflect.apply(o,t,l);e=this._inst.exports.getsp()>>>0,i(e+56,m),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),l=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),l=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,c(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=f.encode(String(s(e+8)));i(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);a(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=a(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=a(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(c){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 n=4096;const s=e=>{const t=n,o=f.encode(e+"\\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,a=[];this.argv.forEach(e=>{a.push(s(e))}),a.push(0),Object.keys(this.env).sort().forEach(e=>{a.push(s(`${e}=${this.env[e]}`))}),a.push(0);const u=n;a.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const d=4096+8192;if(n>=d)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),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(c){const n=this;return function(){const s={id:c,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,g=globalThis.fs,c="";g.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){c+=f.decode(u);let d=c.split(`\n`);d.length>1&&console.log(d.slice(0,-1).join(`\n`)),c=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:h})=>{h.length>0&&(n.push(h),s&&s())},g.read=(h,u,d,e,t,o)=>{if(h!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>g.read(h,u,d,e,t,o);return}let l=n[0],m=Math.max(0,Math.min(e,l.length-i));u.set(l.subarray(i,i+m),d),i+=m,i===l.length&&(n.shift(),i=0),o(null,m)};let a=new globalThis.Go;a.argv=["","--service=0.19.2"],tryToInstantiateModule(r,a).then(h=>{postMessage(null),a.run(h)},h=>{postMessage(h)})};async function tryToInstantiateModule(r,f){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const g=await fetch(r);if(!g.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(g.headers.get("Content-Type")||""))return(await WebAssembly.instantiateStreaming(g,f.importObject)).instance;const c=await g.arrayBuffer();return(await WebAssembly.instantiate(c,f.importObject)).instance}return r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});l=new Worker(URL.createObjectURL(b))}else{let b=(postMessage=>{
|
13
|
+
${o}:${y}:${b}: ERROR: ${w}${i.text}`}).join("");let u=new Error(e);for(let[i,d]of[["errors",t],["warnings",n]])Object.defineProperty(u,i,{configurable:!0,enumerable:!0,get:()=>d,set:o=>Object.defineProperty(u,i,{configurable:!0,enumerable:!0,value:o})});return u}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",m),u=r(e,n,"namespace",m),i=r(e,n,"line",le),d=r(e,n,"column",le),o=r(e,n,"length",le),y=r(e,n,"lineText",m),b=r(e,n,"suggestion",m);return K(e,n,t),{file:l||"",namespace:u||"",line:i||0,column:d||0,length:o||0,lineText:y||"",suggestion:b||""}}function ne(e,t,n,l){let u=[],i=0;for(let d of e){let o={},y=r(d,o,"id",m),b=r(d,o,"pluginName",m),w=r(d,o,"text",m),U=r(d,o,"location",Me),j=r(d,o,"notes",W),B=r(d,o,"detail",me),L=`in element ${i} of "${t}"`;K(d,o,L);let Q=[];if(j)for(let T of j){let z={},J=r(T,z,"text",m),v=r(T,z,"location",Me);K(T,z,L),Q.push({text:J||"",location:Ce(v,L)})}u.push({id:y||"",pluginName:b||l,text:w||"",location:Ce(U,L),notes:Q,detail:n?n.store(B):-1}),i++}return u}function ge(e,t){let n=[];for(let l of e){if(typeof l!="string")throw new Error(`${Y(t)} must be an array of strings`);n.push(l)}return n}function et({path:e,contents:t,hash:n}){let l=null;return{path:e,contents:t,hash:n,get text(){let u=this.contents;return(l===null||u!==t)&&(t=u,l=re(u)),l}}}var nt="0.19.3",rt=e=>fe().build(e),it=e=>fe().context(e),lt=(e,t)=>fe().transform(e,t),st=(e,t)=>fe().formatMessages(e,t),ot=(e,t)=>fe().analyzeMetafile(e,t),at=()=>{throw new Error('The "buildSync" API only works in node')},ut=()=>{throw new Error('The "transformSync" API only works in node')},ct=()=>{throw new Error('The "formatMessagesSync" API only works in node')},ft=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ae,Oe,fe=()=>{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')},dt=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=pt(t||"",n,l),ae.catch(()=>{ae=void 0}),ae},pt=async(e,t,n)=>{let l;if(n){let b=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 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(n,s){c+=g.decode(s);const i=c.lastIndexOf(`\n`);return i!=-1&&(console.log(c.substring(0,i)),c=c.substring(i+1)),s.length},write(n,s,i,a,h,u){if(i!==0||a!==s.length||h!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,a){a(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,a){a(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,a){a(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,a){a(r())},read(n,s,i,a,h,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,a){a(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"),g=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)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(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 l=this._ids.get(t);l===void 0&&(l=this._idPool.pop(),l===void 0&&(l=this._values.length),this._values[l]=t,this._goRefCounts[l]=0,this._ids.set(t,l)),this._goRefCounts[l]++;let m=0;switch(typeof t){case"object":t!==null&&(m=1);break;case"string":m=2;break;case"symbol":m=3;break;case"function":m=4;break}this.mem.setUint32(e+4,2146959360|m,!0),this.mem.setUint32(e,l,!0)},a=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},h=e=>{const t=n(e+0),o=n(e+8),l=new Array(o);for(let m=0;m<o;m++)l[m]=s(t+m*8);return l},u=e=>{const t=n(e+0),o=n(e+8);return g.decode(new DataView(this._inst.exports.mem.buffer,t,o))},d=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;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>>>=0;const t=n(e+8),o=n(e+16),l=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,l))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,c(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;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()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(a(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),l=h(e+32),m=Reflect.apply(o,t,l);e=this._inst.exports.getsp()>>>0,i(e+56,m),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),l=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),l=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,c(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=f.encode(String(s(e+8)));i(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);a(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=a(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=a(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(c){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 n=4096;const s=e=>{const t=n,o=f.encode(e+"\\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,a=[];this.argv.forEach(e=>{a.push(s(e))}),a.push(0),Object.keys(this.env).sort().forEach(e=>{a.push(s(`${e}=${this.env[e]}`))}),a.push(0);const u=n;a.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const d=4096+8192;if(n>=d)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),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(c){const n=this;return function(){const s={id:c,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,g=globalThis.fs,c="";g.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){c+=f.decode(u);let d=c.split(`\n`);d.length>1&&console.log(d.slice(0,-1).join(`\n`)),c=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:h})=>{h.length>0&&(n.push(h),s&&s())},g.read=(h,u,d,e,t,o)=>{if(h!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>g.read(h,u,d,e,t,o);return}let l=n[0],m=Math.max(0,Math.min(e,l.length-i));u.set(l.subarray(i,i+m),d),i+=m,i===l.length&&(n.shift(),i=0),o(null,m)};let a=new globalThis.Go;a.argv=["","--service=0.19.3"],tryToInstantiateModule(r,a).then(h=>{postMessage(null),a.run(h)},h=>{postMessage(h)})};async function tryToInstantiateModule(r,f){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const g=await fetch(r);if(!g.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(g.headers.get("Content-Type")||""))return(await WebAssembly.instantiateStreaming(g,f.importObject)).instance;const c=await g.arrayBuffer();return(await WebAssembly.instantiate(c,f.importObject)).instance}return r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});l=new Worker(URL.createObjectURL(b))}else{let b=(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 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(n,s){c+=g.decode(s);const i=c.lastIndexOf(`
|
18
18
|
`);return i!=-1&&(console.log(c.substring(0,i)),c=c.substring(i+1)),s.length},write(n,s,i,a,h,u){if(i!==0||a!==s.length||h!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,a){a(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,a){a(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,a){a(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,a){a(r())},read(n,s,i,a,h,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,a){a(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"),g=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)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(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 l=this._ids.get(t);l===void 0&&(l=this._idPool.pop(),l===void 0&&(l=this._values.length),this._values[l]=t,this._goRefCounts[l]=0,this._ids.set(t,l)),this._goRefCounts[l]++;let m=0;switch(typeof t){case"object":t!==null&&(m=1);break;case"string":m=2;break;case"symbol":m=3;break;case"function":m=4;break}this.mem.setUint32(e+4,2146959360|m,!0),this.mem.setUint32(e,l,!0)},a=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},h=e=>{const t=n(e+0),o=n(e+8),l=new Array(o);for(let m=0;m<o;m++)l[m]=s(t+m*8);return l},u=e=>{const t=n(e+0),o=n(e+8);return g.decode(new DataView(this._inst.exports.mem.buffer,t,o))},d=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;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>>>=0;const t=n(e+8),o=n(e+16),l=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,l))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,c(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;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()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(a(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),l=h(e+32),m=Reflect.apply(o,t,l);e=this._inst.exports.getsp()>>>0,i(e+56,m),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),l=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),l=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,c(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=f.encode(String(s(e+8)));i(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);a(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=a(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=a(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(c){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 n=4096;const s=e=>{const t=n,o=f.encode(e+"\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,a=[];this.argv.forEach(e=>{a.push(s(e))}),a.push(0),Object.keys(this.env).sort().forEach(e=>{a.push(s(`${e}=${this.env[e]}`))}),a.push(0);const u=n;a.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const d=4096+8192;if(n>=d)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),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(c){const n=this;return function(){const s={id:c,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,g=globalThis.fs,c="";g.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){c+=f.decode(u);let d=c.split(`
|
19
19
|
`);d.length>1&&console.log(d.slice(0,-1).join(`
|
20
|
-
`)),c=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:h})=>{h.length>0&&(n.push(h),s&&s())},g.read=(h,u,d,e,t,o)=>{if(h!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>g.read(h,u,d,e,t,o);return}let l=n[0],m=Math.max(0,Math.min(e,l.length-i));u.set(l.subarray(i,i+m),d),i+=m,i===l.length&&(n.shift(),i=0),o(null,m)};let a=new globalThis.Go;a.argv=["","--service=0.19.
|
20
|
+
`)),c=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:h})=>{h.length>0&&(n.push(h),s&&s())},g.read=(h,u,d,e,t,o)=>{if(h!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>g.read(h,u,d,e,t,o);return}let l=n[0],m=Math.max(0,Math.min(e,l.length-i));u.set(l.subarray(i,i+m),d),i+=m,i===l.length&&(n.shift(),i=0),o(null,m)};let a=new globalThis.Go;a.argv=["","--service=0.19.3"],tryToInstantiateModule(r,a).then(h=>{postMessage(null),a.run(h)},h=>{postMessage(h)})};async function tryToInstantiateModule(r,f){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const g=await fetch(r);if(!g.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\/wasm($|;)/i.test(g.headers.get("Content-Type")||""))return(await WebAssembly.instantiateStreaming(g,f.importObject)).instance;const c=await g.arrayBuffer();return(await WebAssembly.instantiate(c,f.importObject)).instance}return r=>onmessage(r);})(w=>l.onmessage({data:w}));l={onmessage:null,postMessage:w=>setTimeout(()=>b({data:w})),terminate(){}}}let u,i,d=new Promise((b,w)=>{u=b,i=w});l.onmessage=({data:b})=>{l.onmessage=({data:w})=>o(w),b?i(b):u()},l.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:o,service:y}=Ue({writeToStdin(b){l.postMessage(b)},isSync:!1,hasFS:!1,esbuild:be});await d,Oe={build:b=>new Promise((w,U)=>y.buildOrContext({callName:"build",refs:null,options:b,isTTY:!1,defaultWD:"/",callback:(j,B)=>j?U(j):w(B)})),context:b=>new Promise((w,U)=>y.buildOrContext({callName:"context",refs:null,options:b,isTTY:!1,defaultWD:"/",callback:(j,B)=>j?U(j):w(B)})),transform:(b,w)=>new Promise((U,j)=>y.transform({callName:"transform",refs:null,input:b,options:w||{},isTTY:!1,fs:{readFile(B,L){L(new Error("Internal error"),null)},writeFile(B,L){L(null)}},callback:(B,L)=>B?j(B):U(L)})),formatMessages:(b,w)=>new Promise((U,j)=>y.formatMessages({callName:"formatMessages",refs:null,messages:b,options:w,callback:(B,L)=>B?j(B):U(L)})),analyzeMetafile:(b,w)=>new Promise((U,j)=>y.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof b=="string"?b:JSON.stringify(b),options:w,callback:(B,L)=>B?j(B):U(L)}))}},gt=be;export{ot as analyzeMetafile,ft as analyzeMetafileSync,rt as build,at as buildSync,it as context,gt as default,st as formatMessages,ct as formatMessagesSync,dt as initialize,lt as transform,ut as transformSync,nt as version};
|
@@ -734,12 +734,13 @@ function createChannel(streamIn) {
|
|
734
734
|
}
|
735
735
|
if (typeof request.key === "number") {
|
736
736
|
const requestCallbacks = requestCallbacksByKey[request.key];
|
737
|
-
if (requestCallbacks) {
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
737
|
+
if (!requestCallbacks) {
|
738
|
+
return;
|
739
|
+
}
|
740
|
+
const callback = requestCallbacks[request.command];
|
741
|
+
if (callback) {
|
742
|
+
yield callback(id, request);
|
743
|
+
return;
|
743
744
|
}
|
744
745
|
}
|
745
746
|
throw new Error(`Invalid command: ` + request.command);
|
@@ -756,8 +757,8 @@ function createChannel(streamIn) {
|
|
756
757
|
if (isFirstPacket) {
|
757
758
|
isFirstPacket = false;
|
758
759
|
let binaryVersion = String.fromCharCode(...bytes);
|
759
|
-
if (binaryVersion !== "0.19.
|
760
|
-
throw new Error(`Cannot start service: Host version "${"0.19.
|
760
|
+
if (binaryVersion !== "0.19.3") {
|
761
|
+
throw new Error(`Cannot start service: Host version "${"0.19.3"}" does not match binary version ${quote(binaryVersion)}`);
|
761
762
|
}
|
762
763
|
return;
|
763
764
|
}
|
@@ -1765,7 +1766,7 @@ function convertOutputFiles({ path, contents, hash }) {
|
|
1765
1766
|
}
|
1766
1767
|
|
1767
1768
|
// lib/npm/browser.ts
|
1768
|
-
var version = "0.19.
|
1769
|
+
var version = "0.19.3";
|
1769
1770
|
var build = (options) => ensureServiceIsRunning().build(options);
|
1770
1771
|
var context = (options) => ensureServiceIsRunning().context(options);
|
1771
1772
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
@@ -1810,7 +1811,7 @@ var initialize = (options) => {
|
|
1810
1811
|
var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, null, function* () {
|
1811
1812
|
let worker;
|
1812
1813
|
if (useWorker) {
|
1813
|
-
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 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 go: {\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n // func nanotime1() int64\n "runtime.nanotime1": (sp) => {\n sp >>>= 0;\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n // func walltime() (sec int64, nsec int32)\n "runtime.walltime": (sp) => {\n sp >>>= 0;\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 >>>= 0;\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) + 1\n // setTimeout has been seen to fire up to 1 millisecond early\n ));\n this.mem.setInt32(sp + 16, id, true);\n },\n // func clearTimeoutEvent(id int32)\n "runtime.clearTimeoutEvent": (sp) => {\n sp >>>= 0;\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 >>>= 0;\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n // func finalizeRef(v ref)\n "syscall/js.finalizeRef": (sp) => {\n sp >>>= 0;\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 >>>= 0;\n storeValue(sp + 24, loadString(sp + 8));\n },\n // func valueGet(v ref, p string) ref\n "syscall/js.valueGet": (sp) => {\n sp >>>= 0;\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 32, result);\n },\n // func valueSet(v ref, p string, x ref)\n "syscall/js.valueSet": (sp) => {\n sp >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\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 >>>= 0;\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 = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\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 >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\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 >>>= 0;\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n // valuePrepareString(v ref) (ref, int)\n "syscall/js.valuePrepareString": (sp) => {\n sp >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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.19.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" });
|
1814
|
+
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 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 go: {\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n // func nanotime1() int64\n "runtime.nanotime1": (sp) => {\n sp >>>= 0;\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n // func walltime() (sec int64, nsec int32)\n "runtime.walltime": (sp) => {\n sp >>>= 0;\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 >>>= 0;\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) + 1\n // setTimeout has been seen to fire up to 1 millisecond early\n ));\n this.mem.setInt32(sp + 16, id, true);\n },\n // func clearTimeoutEvent(id int32)\n "runtime.clearTimeoutEvent": (sp) => {\n sp >>>= 0;\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 >>>= 0;\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n // func finalizeRef(v ref)\n "syscall/js.finalizeRef": (sp) => {\n sp >>>= 0;\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 >>>= 0;\n storeValue(sp + 24, loadString(sp + 8));\n },\n // func valueGet(v ref, p string) ref\n "syscall/js.valueGet": (sp) => {\n sp >>>= 0;\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 32, result);\n },\n // func valueSet(v ref, p string, x ref)\n "syscall/js.valueSet": (sp) => {\n sp >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\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 >>>= 0;\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 = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\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 >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\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 >>>= 0;\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n // valuePrepareString(v ref) (ref, int)\n "syscall/js.valuePrepareString": (sp) => {\n sp >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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 >>>= 0;\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.19.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" });
|
1814
1815
|
worker = new Worker(URL.createObjectURL(blob));
|
1815
1816
|
} else {
|
1816
1817
|
let onmessage = ((postMessage) => {
|
@@ -2446,7 +2447,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
|
|
2446
2447
|
callback(null, count);
|
2447
2448
|
};
|
2448
2449
|
let go = new globalThis.Go();
|
2449
|
-
go.argv = ["", `--service=${"0.19.
|
2450
|
+
go.argv = ["", `--service=${"0.19.3"}`];
|
2450
2451
|
tryToInstantiateModule(wasm, go).then(
|
2451
2452
|
(instance) => {
|
2452
2453
|
postMessage(null);
|
@@ -4,19 +4,19 @@
|
|
4
4
|
This indicates that your JavaScript environment is broken. You cannot use
|
5
5
|
esbuild in this environment because esbuild relies on this invariant. This
|
6
6
|
is not a problem with esbuild. You need to fix your environment instead.
|
7
|
-
`);function Ee(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Re(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var Y=JSON.stringify,$e="warning",Me="silent";function Ce(e){if(V(e,"target"),e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var ye=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",y=e=>typeof e=="string"?null:"a string",he=e=>e instanceof RegExp?null:"a RegExp object",se=e=>typeof e=="number"&&e===(e|0)?null:"an integer",De=e=>typeof e=="function"?null:"a function",W=e=>Array.isArray(e)?null:"an array",ee=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",Ge=e=>typeof e=="object"&&e!==null?null:"an array or an object",Xe=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",Ze=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",et=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",tt=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function r(e,t,n,l){let a=e[n];if(t[n+""]=!0,a===void 0)return;let i=l(a);if(i!==null)throw new Error(`${Y(n)} must be ${i}`);return a}function K(e,t,n){for(let l in e)if(!(l in t))throw new Error(`Invalid option ${n}: ${Y(l)}`)}function Be(e){let t=Object.create(null),n=r(e,t,"wasmURL",tt),l=r(e,t,"wasmModule",Xe),a=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:l,worker:a}}function Ue(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 ${Y(n)} in mangle cache to map to either a string or false`)}}return t}function be(e,t,n,l,a){let i=r(t,n,"color",I),d=r(t,n,"logLevel",y),s=r(t,n,"logLimit",se);i!==void 0?e.push(`--color=${i}`):l&&e.push("--color=true"),e.push(`--log-level=${d||a}`),e.push(`--log-limit=${s||0}`)}function V(e,t,n){if(typeof e!="string")throw new Error(`Expected value for ${t}${n!==void 0?" "+Y(n):""} to be a string, got ${typeof e} instead`);return e}function je(e,t,n){let l=r(t,n,"legalComments",y),a=r(t,n,"sourceRoot",y),i=r(t,n,"sourcesContent",I),d=r(t,n,"target",et),s=r(t,n,"format",y),p=r(t,n,"globalName",y),b=r(t,n,"mangleProps",he),w=r(t,n,"reserveProps",he),U=r(t,n,"mangleQuoted",I),j=r(t,n,"minify",I),B=r(t,n,"minifySyntax",I),L=r(t,n,"minifyWhitespace",I),Q=r(t,n,"minifyIdentifiers",I),T=r(t,n,"lineLimit",se),z=r(t,n,"drop",W),J=r(t,n,"dropLabels",W),v=r(t,n,"charset",y),m=r(t,n,"treeShaking",I),f=r(t,n,"ignoreAnnotations",I),o=r(t,n,"jsx",y),x=r(t,n,"jsxFactory",y),$=r(t,n,"jsxFragment",y),M=r(t,n,"jsxImportSource",y),P=r(t,n,"jsxDev",I),u=r(t,n,"jsxSideEffects",I),c=r(t,n,"define",ee),h=r(t,n,"logOverride",ee),E=r(t,n,"supported",ee),C=r(t,n,"pure",W),S=r(t,n,"keepNames",I),O=r(t,n,"platform",y),A=r(t,n,"tsconfigRaw",Ze);if(l&&e.push(`--legal-comments=${l}`),a!==void 0&&e.push(`--source-root=${a}`),i!==void 0&&e.push(`--sources-content=${i}`),d&&(Array.isArray(d)?e.push(`--target=${Array.from(d).map(Ce).join(",")}`):e.push(`--target=${Ce(d)}`)),s&&e.push(`--format=${s}`),p&&e.push(`--global-name=${p}`),O&&e.push(`--platform=${O}`),A&&e.push(`--tsconfig-raw=${typeof A=="string"?A:JSON.stringify(A)}`),j&&e.push("--minify"),B&&e.push("--minify-syntax"),L&&e.push("--minify-whitespace"),Q&&e.push("--minify-identifiers"),T&&e.push(`--line-limit=${T}`),v&&e.push(`--charset=${v}`),m!==void 0&&e.push(`--tree-shaking=${m}`),f&&e.push("--ignore-annotations"),z)for(let R of z)e.push(`--drop:${V(R,"drop")}`);if(J&&e.push(`--drop-labels=${Array.from(J).map(R=>V(R,"dropLabels")).join(",")}`),b&&e.push(`--mangle-props=${b.source}`),w&&e.push(`--reserve-props=${w.source}`),U!==void 0&&e.push(`--mangle-quoted=${U}`),o&&e.push(`--jsx=${o}`),x&&e.push(`--jsx-factory=${x}`),$&&e.push(`--jsx-fragment=${$}`),M&&e.push(`--jsx-import-source=${M}`),P&&e.push("--jsx-dev"),u&&e.push("--jsx-side-effects"),c)for(let R in c){if(R.indexOf("=")>=0)throw new Error(`Invalid define: ${R}`);e.push(`--define:${R}=${V(c[R],"define",R)}`)}if(h)for(let R in h){if(R.indexOf("=")>=0)throw new Error(`Invalid log override: ${R}`);e.push(`--log-override:${R}=${V(h[R],"log override",R)}`)}if(E)for(let R in E){if(R.indexOf("=")>=0)throw new Error(`Invalid supported: ${R}`);let k=E[R];if(typeof k!="boolean")throw new Error(`Expected value for supported ${Y(R)} to be a boolean, got ${typeof k} instead`);e.push(`--supported:${R}=${k}`)}if(C)for(let R of C)e.push(`--pure:${V(R,"pure")}`);S&&e.push("--keep-names")}function nt(e,t,n,l,a){var oe;let i=[],d=[],s=Object.create(null),p=null,b=null;be(i,t,s,n,l),je(i,t,s);let w=r(t,s,"sourcemap",Fe),U=r(t,s,"bundle",I),j=r(t,s,"splitting",I),B=r(t,s,"preserveSymlinks",I),L=r(t,s,"metafile",I),Q=r(t,s,"outfile",y),T=r(t,s,"outdir",y),z=r(t,s,"outbase",y),J=r(t,s,"tsconfig",y),v=r(t,s,"resolveExtensions",W),m=r(t,s,"nodePaths",W),f=r(t,s,"mainFields",W),o=r(t,s,"conditions",W),x=r(t,s,"external",W),$=r(t,s,"packages",y),M=r(t,s,"alias",ee),P=r(t,s,"loader",ee),u=r(t,s,"outExtension",ee),c=r(t,s,"publicPath",y),h=r(t,s,"entryNames",y),E=r(t,s,"chunkNames",y),C=r(t,s,"assetNames",y),S=r(t,s,"inject",W),O=r(t,s,"banner",ee),A=r(t,s,"footer",ee),R=r(t,s,"entryPoints",Ge),k=r(t,s,"absWorkingDir",y),F=r(t,s,"stdin",ee),D=(oe=r(t,s,"write",I))!=null?oe:a,q=r(t,s,"allowOverwrite",I),_=r(t,s,"mangleCache",ee);if(s.plugins=!0,K(t,s,`in ${e}() call`),w&&i.push(`--sourcemap${w===!0?"":`=${w}`}`),U&&i.push("--bundle"),q&&i.push("--allow-overwrite"),j&&i.push("--splitting"),B&&i.push("--preserve-symlinks"),L&&i.push("--metafile"),Q&&i.push(`--outfile=${Q}`),T&&i.push(`--outdir=${T}`),z&&i.push(`--outbase=${z}`),J&&i.push(`--tsconfig=${J}`),$&&i.push(`--packages=${$}`),v){let g=[];for(let N of v){if(V(N,"resolve extension"),N.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${N}`);g.push(N)}i.push(`--resolve-extensions=${g.join(",")}`)}if(c&&i.push(`--public-path=${c}`),h&&i.push(`--entry-names=${h}`),E&&i.push(`--chunk-names=${E}`),C&&i.push(`--asset-names=${C}`),f){let g=[];for(let N of f){if(V(N,"main field"),N.indexOf(",")>=0)throw new Error(`Invalid main field: ${N}`);g.push(N)}i.push(`--main-fields=${g.join(",")}`)}if(o){let g=[];for(let N of o){if(V(N,"condition"),N.indexOf(",")>=0)throw new Error(`Invalid condition: ${N}`);g.push(N)}i.push(`--conditions=${g.join(",")}`)}if(x)for(let g of x)i.push(`--external:${V(g,"external")}`);if(M)for(let g in M){if(g.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${g}`);i.push(`--alias:${g}=${V(M[g],"alias",g)}`)}if(O)for(let g in O){if(g.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${g}`);i.push(`--banner:${g}=${V(O[g],"banner",g)}`)}if(A)for(let g in A){if(g.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${g}`);i.push(`--footer:${g}=${V(A[g],"footer",g)}`)}if(S)for(let g of S)i.push(`--inject:${V(g,"inject")}`);if(P)for(let g in P){if(g.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${g}`);i.push(`--loader:${g}=${V(P[g],"loader",g)}`)}if(u)for(let g in u){if(g.indexOf("=")>=0)throw new Error(`Invalid out extension: ${g}`);i.push(`--out-extension:${g}=${V(u[g],"out extension",g)}`)}if(R)if(Array.isArray(R))for(let g=0,N=R.length;g<N;g++){let X=R[g];if(typeof X=="object"&&X!==null){let te=Object.create(null),G=r(X,te,"in",y),ce=r(X,te,"out",y);if(K(X,te,"in entry point at index "+g),G===void 0)throw new Error('Missing property "in" for entry point at index '+g);if(ce===void 0)throw new Error('Missing property "out" for entry point at index '+g);d.push([ce,G])}else d.push(["",V(X,"entry point at index "+g)])}else for(let g in R)d.push([g,V(R[g],"entry point",g)]);if(F){let g=Object.create(null),N=r(F,g,"contents",Te),X=r(F,g,"resolveDir",y),te=r(F,g,"sourcefile",y),G=r(F,g,"loader",y);K(F,g,'in "stdin" object'),te&&i.push(`--sourcefile=${te}`),G&&i.push(`--loader=${G}`),X&&(b=X),typeof N=="string"?p=Z(N):N instanceof Uint8Array&&(p=N)}let H=[];if(m)for(let g of m)g+="",H.push(g);return{entries:d,flags:i,write:D,stdinContents:p,stdinResolveDir:b,absWorkingDir:k,nodePaths:H,mangleCache:Ue(_)}}function rt(e,t,n,l){let a=[],i=Object.create(null);be(a,t,i,n,l),je(a,t,i);let d=r(t,i,"sourcemap",Fe),s=r(t,i,"sourcefile",y),p=r(t,i,"loader",y),b=r(t,i,"banner",y),w=r(t,i,"footer",y),U=r(t,i,"mangleCache",ee);return K(t,i,`in ${e}() call`),d&&a.push(`--sourcemap=${d===!0?"external":d}`),s&&a.push(`--sourcefile=${s}`),p&&a.push(`--loader=${p}`),b&&a.push(`--banner=${b}`),w&&a.push(`--footer=${w}`),{flags:a,mangleCache:Ue(U)}}function Le(e){let t={},n={didClose:!1,reason:""},l={},a=0,i=0,d=new Uint8Array(16*1024),s=0,p=v=>{let m=s+v.length;if(m>d.length){let o=new Uint8Array(m*2);o.set(d),d=o}d.set(v,s),s+=v.length;let f=0;for(;f+4<=s;){let o=Ee(d,f);if(f+4+o>s)break;f+=4,L(d.subarray(f,f+o)),f+=o}f>0&&(d.copyWithin(0,f,s),s-=f)},b=v=>{n.didClose=!0,v&&(n.reason=": "+(v.message||v));let m="The service was stopped"+n.reason;for(let f in l)l[f](m,null);l={}},w=(v,m,f)=>{if(n.didClose)return f("The service is no longer running"+n.reason,null);let o=a++;l[o]=(x,$)=>{try{f(x,$)}finally{v&&v.unref()}},v&&v.ref(),e.writeToStdin(Oe({id:o,isRequest:!0,value:m}))},U=(v,m)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(Oe({id:v,isRequest:!1,value:m}))},j=(v,m)=>ne(this,null,function*(){try{if(m.command==="ping"){U(v,{});return}if(typeof m.key=="number"){let f=t[m.key];if(f){let o=f[m.command];if(o){yield o(v,m);return}}}throw new Error("Invalid command: "+m.command)}catch(f){let o=[le(f,e,null,void 0,"")];try{U(v,{errors:o})}catch(x){}}}),B=!0,L=v=>{if(B){B=!1;let f=String.fromCharCode(...v);if(f!=="0.19.2")throw new Error(`Cannot start service: Host version "0.19.2" does not match binary version ${Y(f)}`);return}let m=ke(v);if(m.isRequest)j(m.id,m.value);else{let f=l[m.id];delete l[m.id],m.value.error?f(m.value.error,{}):f(null,m.value)}};return{readFromStdout:p,afterClose:b,service:{buildOrContext:({callName:v,refs:m,options:f,isTTY:o,defaultWD:x,callback:$})=>{let M=0,P=i++,u={},c={ref(){++M===1&&m&&m.ref()},unref(){--M===0&&(delete t[P],m&&m.unref())}};t[P]=u,c.ref(),it(v,P,w,U,c,e,u,f,o,x,(h,E)=>{try{$(h,E)}finally{c.unref()}})},transform:({callName:v,refs:m,input:f,options:o,isTTY:x,fs:$,callback:M})=>{let P=qe(),u=c=>{try{if(typeof f!="string"&&!(f instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:h,mangleCache:E}=rt(v,o,x,Me),C={command:"transform",flags:h,inputFS:c!==null,input:c!==null?Z(c):typeof f=="string"?Z(f):f};E&&(C.mangleCache=E),w(m,C,(S,O)=>{if(S)return M(new Error(S),null);let A=ae(O.errors,P),R=ae(O.warnings,P),k=1,F=()=>{if(--k===0){let D={warnings:R,code:O.code,map:O.map,mangleCache:void 0,legalComments:void 0};"legalComments"in O&&(D.legalComments=O==null?void 0:O.legalComments),O.mangleCache&&(D.mangleCache=O==null?void 0:O.mangleCache),M(null,D)}};if(A.length>0)return M(fe("Transform failed",A,R),null);O.codeFS&&(k++,$.readFile(O.code,(D,q)=>{D!==null?M(D,null):(O.code=q,F())})),O.mapFS&&(k++,$.readFile(O.map,(D,q)=>{D!==null?M(D,null):(O.map=q,F())})),F()})}catch(h){let E=[];try{be(E,o,{},x,Me)}catch(S){}let C=le(h,e,P,void 0,"");w(m,{command:"error",flags:E,error:C},()=>{C.detail=P.load(C.detail),M(fe("Transform failed",[C],[]),null)})}};if((typeof f=="string"||f instanceof Uint8Array)&&f.length>1024*1024){let c=u;u=()=>$.writeFile(f,c)}u(null)},formatMessages:({callName:v,refs:m,messages:f,options:o,callback:x})=>{let $=re(f,"messages",null,"");if(!o)throw new Error(`Missing second argument in ${v}() call`);let M={},P=r(o,M,"kind",y),u=r(o,M,"color",I),c=r(o,M,"terminalWidth",se);if(K(o,M,`in ${v}() call`),P===void 0)throw new Error(`Missing "kind" in ${v}() call`);if(P!=="error"&&P!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${v}() call`);let h={command:"format-msgs",messages:$,isWarning:P==="warning"};u!==void 0&&(h.color=u),c!==void 0&&(h.terminalWidth=c),w(m,h,(E,C)=>{if(E)return x(new Error(E),null);x(null,C.messages)})},analyzeMetafile:({callName:v,refs:m,metafile:f,options:o,callback:x})=>{o===void 0&&(o={});let $={},M=r(o,$,"color",I),P=r(o,$,"verbose",I);K(o,$,`in ${v}() call`);let u={command:"analyze-metafile",metafile:f};M!==void 0&&(u.color=M),P!==void 0&&(u.verbose=P),w(m,u,(c,h)=>{if(c)return x(new Error(c),null);x(null,h.result)})}}}}function it(e,t,n,l,a,i,d,s,p,b,w){let U=qe(),j=e==="context",B=(T,z)=>{let J=[];try{be(J,s,{},p,$e)}catch(m){}let v=le(T,i,U,void 0,z);n(a,{command:"error",flags:J,error:v},()=>{v.detail=U.load(v.detail),w(fe(j?"Context failed":"Build failed",[v],[]),null)})},L;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'),"");L=T}}if(L&&L.length>0){if(i.isSync)return B(new Error("Cannot use plugins in synchronous API calls"),"");lt(t,n,l,a,i,d,s,L,U).then(T=>{if(!T.ok)return B(T.error,T.pluginName);try{Q(T.requestPlugins,T.runOnEndCallbacks,T.scheduleOnDisposeCallbacks)}catch(z){B(z,"")}},T=>B(T,""));return}try{Q(null,(T,z)=>z([],[]),()=>{})}catch(T){B(T,"")}function Q(T,z,J){let v=i.hasFS,{entries:m,flags:f,write:o,stdinContents:x,stdinResolveDir:$,absWorkingDir:M,nodePaths:P,mangleCache:u}=nt(e,s,p,$e,v);if(o&&!i.hasFS)throw new Error('The "write" option is unavailable in this environment');let c={command:"build",key:t,entries:m,flags:f,write:o,stdinContents:x,stdinResolveDir:$,absWorkingDir:M||b,nodePaths:P,context:j};T&&(c.plugins=T),u&&(c.mangleCache=u);let h=(S,O)=>{let A={errors:ae(S.errors,U),warnings:ae(S.warnings,U),outputFiles:void 0,metafile:void 0,mangleCache:void 0},R=A.errors.slice(),k=A.warnings.slice();S.outputFiles&&(A.outputFiles=S.outputFiles.map(st)),S.metafile&&(A.metafile=JSON.parse(S.metafile)),S.mangleCache&&(A.mangleCache=S.mangleCache),S.writeToStdout!==void 0&&console.log(ie(S.writeToStdout).replace(/\n$/,"")),z(A,(F,D)=>{if(R.length>0||F.length>0){let q=fe("Build failed",R.concat(F),k.concat(D));return O(q,null,F,D)}O(null,A,F,D)})},E,C;j&&(d["on-end"]=(S,O)=>new Promise(A=>{h(O,(R,k,F,D)=>{let q={errors:F,warnings:D};C&&C(R,k),E=void 0,C=void 0,l(S,q),A()})})),n(a,c,(S,O)=>{if(S)return w(new Error(S),null);if(!j)return h(O,(k,F)=>(J(),w(k,F)));if(O.errors.length>0)return w(fe("Context failed",O.errors,O.warnings),null);let A=!1,R={rebuild:()=>(E||(E=new Promise((k,F)=>{let D;C=(_,H)=>{D||(D=()=>_?F(_):k(H))};let q=()=>{n(a,{command:"rebuild",key:t},(H,oe)=>{H?F(new Error(H)):D?D():q()})};q()})),E),watch:(k={})=>new Promise((F,D)=>{if(!i.hasFS)throw new Error('Cannot use the "watch" API in this environment');K(k,{},"in watch() call"),n(a,{command:"watch",key:t},H=>{H?D(new Error(H)):F(void 0)})}),serve:(k={})=>new Promise((F,D)=>{if(!i.hasFS)throw new Error('Cannot use the "serve" API in this environment');let q={},_=r(k,q,"port",se),H=r(k,q,"host",y),oe=r(k,q,"servedir",y),g=r(k,q,"keyfile",y),N=r(k,q,"certfile",y),X=r(k,q,"fallback",y),te=r(k,q,"onRequest",De);K(k,q,"in serve() call");let G={command:"serve",key:t,onRequest:!!te};_!==void 0&&(G.port=_),H!==void 0&&(G.host=H),oe!==void 0&&(G.servedir=oe),g!==void 0&&(G.keyfile=g),N!==void 0&&(G.certfile=N),X!==void 0&&(G.fallback=X),n(a,G,(ce,Ie)=>{if(ce)return D(new Error(ce));te&&(d["serve-request"]=(We,ze)=>{te(ze.args),l(We,{})}),F(Ie)})}),cancel:()=>new Promise(k=>{if(A)return k();n(a,{command:"cancel",key:t},()=>{k()})}),dispose:()=>new Promise(k=>{if(A)return k();A=!0,n(a,{command:"dispose",key:t},()=>{k(),J(),a.unref()})})};a.ref(),w(null,R)})}}var lt=(e,t,n,l,a,i,d,s,p)=>ne(void 0,null,function*(){let b=[],w=[],U={},j={},B=[],L=0,Q=0,T=[],z=!1;s=[...s];for(let m of s){let f={};if(typeof m!="object")throw new Error(`Plugin at index ${Q} must be an object`);let o=r(m,f,"name",y);if(typeof o!="string"||o==="")throw new Error(`Plugin at index ${Q} is missing a name`);try{let x=r(m,f,"setup",De);if(typeof x!="function")throw new Error("Plugin is missing a setup function");K(m,f,`on plugin ${Y(o)}`);let $={name:o,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};Q++;let P=x({initialOptions:d,resolve:(u,c={})=>{if(!z)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof u!="string")throw new Error("The path to resolve must be a string");let h=Object.create(null),E=r(c,h,"pluginName",y),C=r(c,h,"importer",y),S=r(c,h,"namespace",y),O=r(c,h,"resolveDir",y),A=r(c,h,"kind",y),R=r(c,h,"pluginData",ye);return K(c,h,"in resolve() call"),new Promise((k,F)=>{let D={command:"resolve",path:u,key:e,pluginName:o};if(E!=null&&(D.pluginName=E),C!=null&&(D.importer=C),S!=null&&(D.namespace=S),O!=null&&(D.resolveDir=O),A!=null)D.kind=A;else throw new Error('Must specify "kind" when calling "resolve"');R!=null&&(D.pluginData=p.store(R)),t(l,D,(q,_)=>{q!==null?F(new Error(q)):k({errors:ae(_.errors,p),warnings:ae(_.warnings,p),path:_.path,external:_.external,sideEffects:_.sideEffects,namespace:_.namespace,suffix:_.suffix,pluginData:p.load(_.pluginData)})})})},onStart(u){let c='This error came from the "onStart" callback registered here:',h=ge(new Error(c),a,"onStart");b.push({name:o,callback:u,note:h}),$.onStart=!0},onEnd(u){let c='This error came from the "onEnd" callback registered here:',h=ge(new Error(c),a,"onEnd");w.push({name:o,callback:u,note:h}),$.onEnd=!0},onResolve(u,c){let h='This error came from the "onResolve" callback registered here:',E=ge(new Error(h),a,"onResolve"),C={},S=r(u,C,"filter",he),O=r(u,C,"namespace",y);if(K(u,C,`in onResolve() call for plugin ${Y(o)}`),S==null)throw new Error("onResolve() call is missing a filter");let A=L++;U[A]={name:o,callback:c,note:E},$.onResolve.push({id:A,filter:S.source,namespace:O||""})},onLoad(u,c){let h='This error came from the "onLoad" callback registered here:',E=ge(new Error(h),a,"onLoad"),C={},S=r(u,C,"filter",he),O=r(u,C,"namespace",y);if(K(u,C,`in onLoad() call for plugin ${Y(o)}`),S==null)throw new Error("onLoad() call is missing a filter");let A=L++;j[A]={name:o,callback:c,note:E},$.onLoad.push({id:A,filter:S.source,namespace:O||""})},onDispose(u){B.push(u)},esbuild:a.esbuild});P&&(yield P),T.push($)}catch(x){return{ok:!1,error:x,pluginName:o}}}i["on-start"]=(m,f)=>ne(void 0,null,function*(){let o={errors:[],warnings:[]};yield Promise.all(b.map(P=>ne(void 0,[P],function*({name:x,callback:$,note:M}){try{let u=yield $();if(u!=null){if(typeof u!="object")throw new Error(`Expected onStart() callback in plugin ${Y(x)} to return an object`);let c={},h=r(u,c,"errors",W),E=r(u,c,"warnings",W);K(u,c,`from onStart() callback in plugin ${Y(x)}`),h!=null&&o.errors.push(...re(h,"errors",p,x)),E!=null&&o.warnings.push(...re(E,"warnings",p,x))}}catch(u){o.errors.push(le(u,a,p,M&&M(),x))}}))),n(m,o)}),i["on-resolve"]=(m,f)=>ne(void 0,null,function*(){let o={},x="",$,M;for(let P of f.ids)try{({name:x,callback:$,note:M}=U[P]);let u=yield $({path:f.path,importer:f.importer,namespace:f.namespace,resolveDir:f.resolveDir,kind:f.kind,pluginData:p.load(f.pluginData)});if(u!=null){if(typeof u!="object")throw new Error(`Expected onResolve() callback in plugin ${Y(x)} to return an object`);let c={},h=r(u,c,"pluginName",y),E=r(u,c,"path",y),C=r(u,c,"namespace",y),S=r(u,c,"suffix",y),O=r(u,c,"external",I),A=r(u,c,"sideEffects",I),R=r(u,c,"pluginData",ye),k=r(u,c,"errors",W),F=r(u,c,"warnings",W),D=r(u,c,"watchFiles",W),q=r(u,c,"watchDirs",W);K(u,c,`from onResolve() callback in plugin ${Y(x)}`),o.id=P,h!=null&&(o.pluginName=h),E!=null&&(o.path=E),C!=null&&(o.namespace=C),S!=null&&(o.suffix=S),O!=null&&(o.external=O),A!=null&&(o.sideEffects=A),R!=null&&(o.pluginData=p.store(R)),k!=null&&(o.errors=re(k,"errors",p,x)),F!=null&&(o.warnings=re(F,"warnings",p,x)),D!=null&&(o.watchFiles=me(D,"watchFiles")),q!=null&&(o.watchDirs=me(q,"watchDirs"));break}}catch(u){o={id:P,errors:[le(u,a,p,M&&M(),x)]};break}n(m,o)}),i["on-load"]=(m,f)=>ne(void 0,null,function*(){let o={},x="",$,M;for(let P of f.ids)try{({name:x,callback:$,note:M}=j[P]);let u=yield $({path:f.path,namespace:f.namespace,suffix:f.suffix,pluginData:p.load(f.pluginData)});if(u!=null){if(typeof u!="object")throw new Error(`Expected onLoad() callback in plugin ${Y(x)} to return an object`);let c={},h=r(u,c,"pluginName",y),E=r(u,c,"contents",Te),C=r(u,c,"resolveDir",y),S=r(u,c,"pluginData",ye),O=r(u,c,"loader",y),A=r(u,c,"errors",W),R=r(u,c,"warnings",W),k=r(u,c,"watchFiles",W),F=r(u,c,"watchDirs",W);K(u,c,`from onLoad() callback in plugin ${Y(x)}`),o.id=P,h!=null&&(o.pluginName=h),E instanceof Uint8Array?o.contents=E:E!=null&&(o.contents=Z(E)),C!=null&&(o.resolveDir=C),S!=null&&(o.pluginData=p.store(S)),O!=null&&(o.loader=O),A!=null&&(o.errors=re(A,"errors",p,x)),R!=null&&(o.warnings=re(R,"warnings",p,x)),k!=null&&(o.watchFiles=me(k,"watchFiles")),F!=null&&(o.watchDirs=me(F,"watchDirs"));break}}catch(u){o={id:P,errors:[le(u,a,p,M&&M(),x)]};break}n(m,o)});let J=(m,f)=>f([],[]);w.length>0&&(J=(m,f)=>{ne(void 0,null,function*(){let o=[],x=[];for(let{name:$,callback:M,note:P}of w){let u,c;try{let h=yield M(m);if(h!=null){if(typeof h!="object")throw new Error(`Expected onEnd() callback in plugin ${Y($)} to return an object`);let E={},C=r(h,E,"errors",W),S=r(h,E,"warnings",W);K(h,E,`from onEnd() callback in plugin ${Y($)}`),C!=null&&(u=re(C,"errors",p,$)),S!=null&&(c=re(S,"warnings",p,$))}}catch(h){u=[le(h,a,p,P&&P(),$)]}if(u){o.push(...u);try{m.errors.push(...u)}catch(h){}}if(c){x.push(...c);try{m.warnings.push(...c)}catch(h){}}}f(o,x)})});let v=()=>{for(let m of B)setTimeout(()=>m(),0)};return z=!0,{ok:!0,requestPlugins:T,runOnEndCallbacks:J,scheduleOnDisposeCallbacks:v}});function qe(){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 ge(e,t,n){let l,a=!1;return()=>{if(a)return l;a=!0;try{let i=(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 Y=JSON.stringify,$e="warning",Me="silent";function Ce(e){if(V(e,"target"),e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var ye=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",y=e=>typeof e=="string"?null:"a string",he=e=>e instanceof RegExp?null:"a RegExp object",se=e=>typeof e=="number"&&e===(e|0)?null:"an integer",De=e=>typeof e=="function"?null:"a function",W=e=>Array.isArray(e)?null:"an array",ee=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",Ge=e=>typeof e=="object"&&e!==null?null:"an array or an object",Xe=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",Ze=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",et=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",tt=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function r(e,t,n,l){let a=e[n];if(t[n+""]=!0,a===void 0)return;let i=l(a);if(i!==null)throw new Error(`${Y(n)} must be ${i}`);return a}function K(e,t,n){for(let l in e)if(!(l in t))throw new Error(`Invalid option ${n}: ${Y(l)}`)}function Be(e){let t=Object.create(null),n=r(e,t,"wasmURL",tt),l=r(e,t,"wasmModule",Xe),a=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:l,worker:a}}function Ue(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 ${Y(n)} in mangle cache to map to either a string or false`)}}return t}function be(e,t,n,l,a){let i=r(t,n,"color",I),d=r(t,n,"logLevel",y),s=r(t,n,"logLimit",se);i!==void 0?e.push(`--color=${i}`):l&&e.push("--color=true"),e.push(`--log-level=${d||a}`),e.push(`--log-limit=${s||0}`)}function V(e,t,n){if(typeof e!="string")throw new Error(`Expected value for ${t}${n!==void 0?" "+Y(n):""} to be a string, got ${typeof e} instead`);return e}function je(e,t,n){let l=r(t,n,"legalComments",y),a=r(t,n,"sourceRoot",y),i=r(t,n,"sourcesContent",I),d=r(t,n,"target",et),s=r(t,n,"format",y),p=r(t,n,"globalName",y),b=r(t,n,"mangleProps",he),w=r(t,n,"reserveProps",he),U=r(t,n,"mangleQuoted",I),j=r(t,n,"minify",I),B=r(t,n,"minifySyntax",I),L=r(t,n,"minifyWhitespace",I),Q=r(t,n,"minifyIdentifiers",I),T=r(t,n,"lineLimit",se),z=r(t,n,"drop",W),J=r(t,n,"dropLabels",W),v=r(t,n,"charset",y),m=r(t,n,"treeShaking",I),f=r(t,n,"ignoreAnnotations",I),o=r(t,n,"jsx",y),x=r(t,n,"jsxFactory",y),$=r(t,n,"jsxFragment",y),M=r(t,n,"jsxImportSource",y),P=r(t,n,"jsxDev",I),u=r(t,n,"jsxSideEffects",I),c=r(t,n,"define",ee),h=r(t,n,"logOverride",ee),E=r(t,n,"supported",ee),C=r(t,n,"pure",W),S=r(t,n,"keepNames",I),O=r(t,n,"platform",y),A=r(t,n,"tsconfigRaw",Ze);if(l&&e.push(`--legal-comments=${l}`),a!==void 0&&e.push(`--source-root=${a}`),i!==void 0&&e.push(`--sources-content=${i}`),d&&(Array.isArray(d)?e.push(`--target=${Array.from(d).map(Ce).join(",")}`):e.push(`--target=${Ce(d)}`)),s&&e.push(`--format=${s}`),p&&e.push(`--global-name=${p}`),O&&e.push(`--platform=${O}`),A&&e.push(`--tsconfig-raw=${typeof A=="string"?A:JSON.stringify(A)}`),j&&e.push("--minify"),B&&e.push("--minify-syntax"),L&&e.push("--minify-whitespace"),Q&&e.push("--minify-identifiers"),T&&e.push(`--line-limit=${T}`),v&&e.push(`--charset=${v}`),m!==void 0&&e.push(`--tree-shaking=${m}`),f&&e.push("--ignore-annotations"),z)for(let R of z)e.push(`--drop:${V(R,"drop")}`);if(J&&e.push(`--drop-labels=${Array.from(J).map(R=>V(R,"dropLabels")).join(",")}`),b&&e.push(`--mangle-props=${b.source}`),w&&e.push(`--reserve-props=${w.source}`),U!==void 0&&e.push(`--mangle-quoted=${U}`),o&&e.push(`--jsx=${o}`),x&&e.push(`--jsx-factory=${x}`),$&&e.push(`--jsx-fragment=${$}`),M&&e.push(`--jsx-import-source=${M}`),P&&e.push("--jsx-dev"),u&&e.push("--jsx-side-effects"),c)for(let R in c){if(R.indexOf("=")>=0)throw new Error(`Invalid define: ${R}`);e.push(`--define:${R}=${V(c[R],"define",R)}`)}if(h)for(let R in h){if(R.indexOf("=")>=0)throw new Error(`Invalid log override: ${R}`);e.push(`--log-override:${R}=${V(h[R],"log override",R)}`)}if(E)for(let R in E){if(R.indexOf("=")>=0)throw new Error(`Invalid supported: ${R}`);let k=E[R];if(typeof k!="boolean")throw new Error(`Expected value for supported ${Y(R)} to be a boolean, got ${typeof k} instead`);e.push(`--supported:${R}=${k}`)}if(C)for(let R of C)e.push(`--pure:${V(R,"pure")}`);S&&e.push("--keep-names")}function nt(e,t,n,l,a){var oe;let i=[],d=[],s=Object.create(null),p=null,b=null;be(i,t,s,n,l),je(i,t,s);let w=r(t,s,"sourcemap",Fe),U=r(t,s,"bundle",I),j=r(t,s,"splitting",I),B=r(t,s,"preserveSymlinks",I),L=r(t,s,"metafile",I),Q=r(t,s,"outfile",y),T=r(t,s,"outdir",y),z=r(t,s,"outbase",y),J=r(t,s,"tsconfig",y),v=r(t,s,"resolveExtensions",W),m=r(t,s,"nodePaths",W),f=r(t,s,"mainFields",W),o=r(t,s,"conditions",W),x=r(t,s,"external",W),$=r(t,s,"packages",y),M=r(t,s,"alias",ee),P=r(t,s,"loader",ee),u=r(t,s,"outExtension",ee),c=r(t,s,"publicPath",y),h=r(t,s,"entryNames",y),E=r(t,s,"chunkNames",y),C=r(t,s,"assetNames",y),S=r(t,s,"inject",W),O=r(t,s,"banner",ee),A=r(t,s,"footer",ee),R=r(t,s,"entryPoints",Ge),k=r(t,s,"absWorkingDir",y),F=r(t,s,"stdin",ee),D=(oe=r(t,s,"write",I))!=null?oe:a,q=r(t,s,"allowOverwrite",I),_=r(t,s,"mangleCache",ee);if(s.plugins=!0,K(t,s,`in ${e}() call`),w&&i.push(`--sourcemap${w===!0?"":`=${w}`}`),U&&i.push("--bundle"),q&&i.push("--allow-overwrite"),j&&i.push("--splitting"),B&&i.push("--preserve-symlinks"),L&&i.push("--metafile"),Q&&i.push(`--outfile=${Q}`),T&&i.push(`--outdir=${T}`),z&&i.push(`--outbase=${z}`),J&&i.push(`--tsconfig=${J}`),$&&i.push(`--packages=${$}`),v){let g=[];for(let N of v){if(V(N,"resolve extension"),N.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${N}`);g.push(N)}i.push(`--resolve-extensions=${g.join(",")}`)}if(c&&i.push(`--public-path=${c}`),h&&i.push(`--entry-names=${h}`),E&&i.push(`--chunk-names=${E}`),C&&i.push(`--asset-names=${C}`),f){let g=[];for(let N of f){if(V(N,"main field"),N.indexOf(",")>=0)throw new Error(`Invalid main field: ${N}`);g.push(N)}i.push(`--main-fields=${g.join(",")}`)}if(o){let g=[];for(let N of o){if(V(N,"condition"),N.indexOf(",")>=0)throw new Error(`Invalid condition: ${N}`);g.push(N)}i.push(`--conditions=${g.join(",")}`)}if(x)for(let g of x)i.push(`--external:${V(g,"external")}`);if(M)for(let g in M){if(g.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${g}`);i.push(`--alias:${g}=${V(M[g],"alias",g)}`)}if(O)for(let g in O){if(g.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${g}`);i.push(`--banner:${g}=${V(O[g],"banner",g)}`)}if(A)for(let g in A){if(g.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${g}`);i.push(`--footer:${g}=${V(A[g],"footer",g)}`)}if(S)for(let g of S)i.push(`--inject:${V(g,"inject")}`);if(P)for(let g in P){if(g.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${g}`);i.push(`--loader:${g}=${V(P[g],"loader",g)}`)}if(u)for(let g in u){if(g.indexOf("=")>=0)throw new Error(`Invalid out extension: ${g}`);i.push(`--out-extension:${g}=${V(u[g],"out extension",g)}`)}if(R)if(Array.isArray(R))for(let g=0,N=R.length;g<N;g++){let X=R[g];if(typeof X=="object"&&X!==null){let te=Object.create(null),G=r(X,te,"in",y),ce=r(X,te,"out",y);if(K(X,te,"in entry point at index "+g),G===void 0)throw new Error('Missing property "in" for entry point at index '+g);if(ce===void 0)throw new Error('Missing property "out" for entry point at index '+g);d.push([ce,G])}else d.push(["",V(X,"entry point at index "+g)])}else for(let g in R)d.push([g,V(R[g],"entry point",g)]);if(F){let g=Object.create(null),N=r(F,g,"contents",Te),X=r(F,g,"resolveDir",y),te=r(F,g,"sourcefile",y),G=r(F,g,"loader",y);K(F,g,'in "stdin" object'),te&&i.push(`--sourcefile=${te}`),G&&i.push(`--loader=${G}`),X&&(b=X),typeof N=="string"?p=Z(N):N instanceof Uint8Array&&(p=N)}let H=[];if(m)for(let g of m)g+="",H.push(g);return{entries:d,flags:i,write:D,stdinContents:p,stdinResolveDir:b,absWorkingDir:k,nodePaths:H,mangleCache:Ue(_)}}function rt(e,t,n,l){let a=[],i=Object.create(null);be(a,t,i,n,l),je(a,t,i);let d=r(t,i,"sourcemap",Fe),s=r(t,i,"sourcefile",y),p=r(t,i,"loader",y),b=r(t,i,"banner",y),w=r(t,i,"footer",y),U=r(t,i,"mangleCache",ee);return K(t,i,`in ${e}() call`),d&&a.push(`--sourcemap=${d===!0?"external":d}`),s&&a.push(`--sourcefile=${s}`),p&&a.push(`--loader=${p}`),b&&a.push(`--banner=${b}`),w&&a.push(`--footer=${w}`),{flags:a,mangleCache:Ue(U)}}function Le(e){let t={},n={didClose:!1,reason:""},l={},a=0,i=0,d=new Uint8Array(16*1024),s=0,p=v=>{let m=s+v.length;if(m>d.length){let o=new Uint8Array(m*2);o.set(d),d=o}d.set(v,s),s+=v.length;let f=0;for(;f+4<=s;){let o=Ee(d,f);if(f+4+o>s)break;f+=4,L(d.subarray(f,f+o)),f+=o}f>0&&(d.copyWithin(0,f,s),s-=f)},b=v=>{n.didClose=!0,v&&(n.reason=": "+(v.message||v));let m="The service was stopped"+n.reason;for(let f in l)l[f](m,null);l={}},w=(v,m,f)=>{if(n.didClose)return f("The service is no longer running"+n.reason,null);let o=a++;l[o]=(x,$)=>{try{f(x,$)}finally{v&&v.unref()}},v&&v.ref(),e.writeToStdin(Oe({id:o,isRequest:!0,value:m}))},U=(v,m)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(Oe({id:v,isRequest:!1,value:m}))},j=(v,m)=>ne(this,null,function*(){try{if(m.command==="ping"){U(v,{});return}if(typeof m.key=="number"){let f=t[m.key];if(!f)return;let o=f[m.command];if(o){yield o(v,m);return}}throw new Error("Invalid command: "+m.command)}catch(f){let o=[le(f,e,null,void 0,"")];try{U(v,{errors:o})}catch(x){}}}),B=!0,L=v=>{if(B){B=!1;let f=String.fromCharCode(...v);if(f!=="0.19.3")throw new Error(`Cannot start service: Host version "0.19.3" does not match binary version ${Y(f)}`);return}let m=ke(v);if(m.isRequest)j(m.id,m.value);else{let f=l[m.id];delete l[m.id],m.value.error?f(m.value.error,{}):f(null,m.value)}};return{readFromStdout:p,afterClose:b,service:{buildOrContext:({callName:v,refs:m,options:f,isTTY:o,defaultWD:x,callback:$})=>{let M=0,P=i++,u={},c={ref(){++M===1&&m&&m.ref()},unref(){--M===0&&(delete t[P],m&&m.unref())}};t[P]=u,c.ref(),it(v,P,w,U,c,e,u,f,o,x,(h,E)=>{try{$(h,E)}finally{c.unref()}})},transform:({callName:v,refs:m,input:f,options:o,isTTY:x,fs:$,callback:M})=>{let P=qe(),u=c=>{try{if(typeof f!="string"&&!(f instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:h,mangleCache:E}=rt(v,o,x,Me),C={command:"transform",flags:h,inputFS:c!==null,input:c!==null?Z(c):typeof f=="string"?Z(f):f};E&&(C.mangleCache=E),w(m,C,(S,O)=>{if(S)return M(new Error(S),null);let A=ae(O.errors,P),R=ae(O.warnings,P),k=1,F=()=>{if(--k===0){let D={warnings:R,code:O.code,map:O.map,mangleCache:void 0,legalComments:void 0};"legalComments"in O&&(D.legalComments=O==null?void 0:O.legalComments),O.mangleCache&&(D.mangleCache=O==null?void 0:O.mangleCache),M(null,D)}};if(A.length>0)return M(fe("Transform failed",A,R),null);O.codeFS&&(k++,$.readFile(O.code,(D,q)=>{D!==null?M(D,null):(O.code=q,F())})),O.mapFS&&(k++,$.readFile(O.map,(D,q)=>{D!==null?M(D,null):(O.map=q,F())})),F()})}catch(h){let E=[];try{be(E,o,{},x,Me)}catch(S){}let C=le(h,e,P,void 0,"");w(m,{command:"error",flags:E,error:C},()=>{C.detail=P.load(C.detail),M(fe("Transform failed",[C],[]),null)})}};if((typeof f=="string"||f instanceof Uint8Array)&&f.length>1024*1024){let c=u;u=()=>$.writeFile(f,c)}u(null)},formatMessages:({callName:v,refs:m,messages:f,options:o,callback:x})=>{let $=re(f,"messages",null,"");if(!o)throw new Error(`Missing second argument in ${v}() call`);let M={},P=r(o,M,"kind",y),u=r(o,M,"color",I),c=r(o,M,"terminalWidth",se);if(K(o,M,`in ${v}() call`),P===void 0)throw new Error(`Missing "kind" in ${v}() call`);if(P!=="error"&&P!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${v}() call`);let h={command:"format-msgs",messages:$,isWarning:P==="warning"};u!==void 0&&(h.color=u),c!==void 0&&(h.terminalWidth=c),w(m,h,(E,C)=>{if(E)return x(new Error(E),null);x(null,C.messages)})},analyzeMetafile:({callName:v,refs:m,metafile:f,options:o,callback:x})=>{o===void 0&&(o={});let $={},M=r(o,$,"color",I),P=r(o,$,"verbose",I);K(o,$,`in ${v}() call`);let u={command:"analyze-metafile",metafile:f};M!==void 0&&(u.color=M),P!==void 0&&(u.verbose=P),w(m,u,(c,h)=>{if(c)return x(new Error(c),null);x(null,h.result)})}}}}function it(e,t,n,l,a,i,d,s,p,b,w){let U=qe(),j=e==="context",B=(T,z)=>{let J=[];try{be(J,s,{},p,$e)}catch(m){}let v=le(T,i,U,void 0,z);n(a,{command:"error",flags:J,error:v},()=>{v.detail=U.load(v.detail),w(fe(j?"Context failed":"Build failed",[v],[]),null)})},L;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'),"");L=T}}if(L&&L.length>0){if(i.isSync)return B(new Error("Cannot use plugins in synchronous API calls"),"");lt(t,n,l,a,i,d,s,L,U).then(T=>{if(!T.ok)return B(T.error,T.pluginName);try{Q(T.requestPlugins,T.runOnEndCallbacks,T.scheduleOnDisposeCallbacks)}catch(z){B(z,"")}},T=>B(T,""));return}try{Q(null,(T,z)=>z([],[]),()=>{})}catch(T){B(T,"")}function Q(T,z,J){let v=i.hasFS,{entries:m,flags:f,write:o,stdinContents:x,stdinResolveDir:$,absWorkingDir:M,nodePaths:P,mangleCache:u}=nt(e,s,p,$e,v);if(o&&!i.hasFS)throw new Error('The "write" option is unavailable in this environment');let c={command:"build",key:t,entries:m,flags:f,write:o,stdinContents:x,stdinResolveDir:$,absWorkingDir:M||b,nodePaths:P,context:j};T&&(c.plugins=T),u&&(c.mangleCache=u);let h=(S,O)=>{let A={errors:ae(S.errors,U),warnings:ae(S.warnings,U),outputFiles:void 0,metafile:void 0,mangleCache:void 0},R=A.errors.slice(),k=A.warnings.slice();S.outputFiles&&(A.outputFiles=S.outputFiles.map(st)),S.metafile&&(A.metafile=JSON.parse(S.metafile)),S.mangleCache&&(A.mangleCache=S.mangleCache),S.writeToStdout!==void 0&&console.log(ie(S.writeToStdout).replace(/\n$/,"")),z(A,(F,D)=>{if(R.length>0||F.length>0){let q=fe("Build failed",R.concat(F),k.concat(D));return O(q,null,F,D)}O(null,A,F,D)})},E,C;j&&(d["on-end"]=(S,O)=>new Promise(A=>{h(O,(R,k,F,D)=>{let q={errors:F,warnings:D};C&&C(R,k),E=void 0,C=void 0,l(S,q),A()})})),n(a,c,(S,O)=>{if(S)return w(new Error(S),null);if(!j)return h(O,(k,F)=>(J(),w(k,F)));if(O.errors.length>0)return w(fe("Context failed",O.errors,O.warnings),null);let A=!1,R={rebuild:()=>(E||(E=new Promise((k,F)=>{let D;C=(_,H)=>{D||(D=()=>_?F(_):k(H))};let q=()=>{n(a,{command:"rebuild",key:t},(H,oe)=>{H?F(new Error(H)):D?D():q()})};q()})),E),watch:(k={})=>new Promise((F,D)=>{if(!i.hasFS)throw new Error('Cannot use the "watch" API in this environment');K(k,{},"in watch() call"),n(a,{command:"watch",key:t},H=>{H?D(new Error(H)):F(void 0)})}),serve:(k={})=>new Promise((F,D)=>{if(!i.hasFS)throw new Error('Cannot use the "serve" API in this environment');let q={},_=r(k,q,"port",se),H=r(k,q,"host",y),oe=r(k,q,"servedir",y),g=r(k,q,"keyfile",y),N=r(k,q,"certfile",y),X=r(k,q,"fallback",y),te=r(k,q,"onRequest",De);K(k,q,"in serve() call");let G={command:"serve",key:t,onRequest:!!te};_!==void 0&&(G.port=_),H!==void 0&&(G.host=H),oe!==void 0&&(G.servedir=oe),g!==void 0&&(G.keyfile=g),N!==void 0&&(G.certfile=N),X!==void 0&&(G.fallback=X),n(a,G,(ce,Ie)=>{if(ce)return D(new Error(ce));te&&(d["serve-request"]=(We,ze)=>{te(ze.args),l(We,{})}),F(Ie)})}),cancel:()=>new Promise(k=>{if(A)return k();n(a,{command:"cancel",key:t},()=>{k()})}),dispose:()=>new Promise(k=>{if(A)return k();A=!0,n(a,{command:"dispose",key:t},()=>{k(),J(),a.unref()})})};a.ref(),w(null,R)})}}var lt=(e,t,n,l,a,i,d,s,p)=>ne(void 0,null,function*(){let b=[],w=[],U={},j={},B=[],L=0,Q=0,T=[],z=!1;s=[...s];for(let m of s){let f={};if(typeof m!="object")throw new Error(`Plugin at index ${Q} must be an object`);let o=r(m,f,"name",y);if(typeof o!="string"||o==="")throw new Error(`Plugin at index ${Q} is missing a name`);try{let x=r(m,f,"setup",De);if(typeof x!="function")throw new Error("Plugin is missing a setup function");K(m,f,`on plugin ${Y(o)}`);let $={name:o,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};Q++;let P=x({initialOptions:d,resolve:(u,c={})=>{if(!z)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof u!="string")throw new Error("The path to resolve must be a string");let h=Object.create(null),E=r(c,h,"pluginName",y),C=r(c,h,"importer",y),S=r(c,h,"namespace",y),O=r(c,h,"resolveDir",y),A=r(c,h,"kind",y),R=r(c,h,"pluginData",ye);return K(c,h,"in resolve() call"),new Promise((k,F)=>{let D={command:"resolve",path:u,key:e,pluginName:o};if(E!=null&&(D.pluginName=E),C!=null&&(D.importer=C),S!=null&&(D.namespace=S),O!=null&&(D.resolveDir=O),A!=null)D.kind=A;else throw new Error('Must specify "kind" when calling "resolve"');R!=null&&(D.pluginData=p.store(R)),t(l,D,(q,_)=>{q!==null?F(new Error(q)):k({errors:ae(_.errors,p),warnings:ae(_.warnings,p),path:_.path,external:_.external,sideEffects:_.sideEffects,namespace:_.namespace,suffix:_.suffix,pluginData:p.load(_.pluginData)})})})},onStart(u){let c='This error came from the "onStart" callback registered here:',h=ge(new Error(c),a,"onStart");b.push({name:o,callback:u,note:h}),$.onStart=!0},onEnd(u){let c='This error came from the "onEnd" callback registered here:',h=ge(new Error(c),a,"onEnd");w.push({name:o,callback:u,note:h}),$.onEnd=!0},onResolve(u,c){let h='This error came from the "onResolve" callback registered here:',E=ge(new Error(h),a,"onResolve"),C={},S=r(u,C,"filter",he),O=r(u,C,"namespace",y);if(K(u,C,`in onResolve() call for plugin ${Y(o)}`),S==null)throw new Error("onResolve() call is missing a filter");let A=L++;U[A]={name:o,callback:c,note:E},$.onResolve.push({id:A,filter:S.source,namespace:O||""})},onLoad(u,c){let h='This error came from the "onLoad" callback registered here:',E=ge(new Error(h),a,"onLoad"),C={},S=r(u,C,"filter",he),O=r(u,C,"namespace",y);if(K(u,C,`in onLoad() call for plugin ${Y(o)}`),S==null)throw new Error("onLoad() call is missing a filter");let A=L++;j[A]={name:o,callback:c,note:E},$.onLoad.push({id:A,filter:S.source,namespace:O||""})},onDispose(u){B.push(u)},esbuild:a.esbuild});P&&(yield P),T.push($)}catch(x){return{ok:!1,error:x,pluginName:o}}}i["on-start"]=(m,f)=>ne(void 0,null,function*(){let o={errors:[],warnings:[]};yield Promise.all(b.map(P=>ne(void 0,[P],function*({name:x,callback:$,note:M}){try{let u=yield $();if(u!=null){if(typeof u!="object")throw new Error(`Expected onStart() callback in plugin ${Y(x)} to return an object`);let c={},h=r(u,c,"errors",W),E=r(u,c,"warnings",W);K(u,c,`from onStart() callback in plugin ${Y(x)}`),h!=null&&o.errors.push(...re(h,"errors",p,x)),E!=null&&o.warnings.push(...re(E,"warnings",p,x))}}catch(u){o.errors.push(le(u,a,p,M&&M(),x))}}))),n(m,o)}),i["on-resolve"]=(m,f)=>ne(void 0,null,function*(){let o={},x="",$,M;for(let P of f.ids)try{({name:x,callback:$,note:M}=U[P]);let u=yield $({path:f.path,importer:f.importer,namespace:f.namespace,resolveDir:f.resolveDir,kind:f.kind,pluginData:p.load(f.pluginData)});if(u!=null){if(typeof u!="object")throw new Error(`Expected onResolve() callback in plugin ${Y(x)} to return an object`);let c={},h=r(u,c,"pluginName",y),E=r(u,c,"path",y),C=r(u,c,"namespace",y),S=r(u,c,"suffix",y),O=r(u,c,"external",I),A=r(u,c,"sideEffects",I),R=r(u,c,"pluginData",ye),k=r(u,c,"errors",W),F=r(u,c,"warnings",W),D=r(u,c,"watchFiles",W),q=r(u,c,"watchDirs",W);K(u,c,`from onResolve() callback in plugin ${Y(x)}`),o.id=P,h!=null&&(o.pluginName=h),E!=null&&(o.path=E),C!=null&&(o.namespace=C),S!=null&&(o.suffix=S),O!=null&&(o.external=O),A!=null&&(o.sideEffects=A),R!=null&&(o.pluginData=p.store(R)),k!=null&&(o.errors=re(k,"errors",p,x)),F!=null&&(o.warnings=re(F,"warnings",p,x)),D!=null&&(o.watchFiles=me(D,"watchFiles")),q!=null&&(o.watchDirs=me(q,"watchDirs"));break}}catch(u){o={id:P,errors:[le(u,a,p,M&&M(),x)]};break}n(m,o)}),i["on-load"]=(m,f)=>ne(void 0,null,function*(){let o={},x="",$,M;for(let P of f.ids)try{({name:x,callback:$,note:M}=j[P]);let u=yield $({path:f.path,namespace:f.namespace,suffix:f.suffix,pluginData:p.load(f.pluginData)});if(u!=null){if(typeof u!="object")throw new Error(`Expected onLoad() callback in plugin ${Y(x)} to return an object`);let c={},h=r(u,c,"pluginName",y),E=r(u,c,"contents",Te),C=r(u,c,"resolveDir",y),S=r(u,c,"pluginData",ye),O=r(u,c,"loader",y),A=r(u,c,"errors",W),R=r(u,c,"warnings",W),k=r(u,c,"watchFiles",W),F=r(u,c,"watchDirs",W);K(u,c,`from onLoad() callback in plugin ${Y(x)}`),o.id=P,h!=null&&(o.pluginName=h),E instanceof Uint8Array?o.contents=E:E!=null&&(o.contents=Z(E)),C!=null&&(o.resolveDir=C),S!=null&&(o.pluginData=p.store(S)),O!=null&&(o.loader=O),A!=null&&(o.errors=re(A,"errors",p,x)),R!=null&&(o.warnings=re(R,"warnings",p,x)),k!=null&&(o.watchFiles=me(k,"watchFiles")),F!=null&&(o.watchDirs=me(F,"watchDirs"));break}}catch(u){o={id:P,errors:[le(u,a,p,M&&M(),x)]};break}n(m,o)});let J=(m,f)=>f([],[]);w.length>0&&(J=(m,f)=>{ne(void 0,null,function*(){let o=[],x=[];for(let{name:$,callback:M,note:P}of w){let u,c;try{let h=yield M(m);if(h!=null){if(typeof h!="object")throw new Error(`Expected onEnd() callback in plugin ${Y($)} to return an object`);let E={},C=r(h,E,"errors",W),S=r(h,E,"warnings",W);K(h,E,`from onEnd() callback in plugin ${Y($)}`),C!=null&&(u=re(C,"errors",p,$)),S!=null&&(c=re(S,"warnings",p,$))}}catch(h){u=[le(h,a,p,P&&P(),$)]}if(u){o.push(...u);try{m.errors.push(...u)}catch(h){}}if(c){x.push(...c);try{m.warnings.push(...c)}catch(h){}}}f(o,x)})});let v=()=>{for(let m of B)setTimeout(()=>m(),0)};return z=!0,{ok:!0,requestPlugins:T,runOnEndCallbacks:J,scheduleOnDisposeCallbacks:v}});function qe(){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 ge(e,t,n){let l,a=!1;return()=>{if(a)return l;a=!0;try{let i=(e.stack+"").split(`
|
8
8
|
`);i.splice(1,1);let d=Ne(t,i,n);if(d)return l={text:e.message,location:d},l}catch(i){}}}function le(e,t,n,l,a){let i="Internal error",d=null;try{i=(e&&e.message||e)+""}catch(s){}try{d=Ne(t,(e.stack+"").split(`
|
9
9
|
`),"")}catch(s){}return{id:"",pluginName:a,text:i,location:d,notes:l?[l]:[],detail:n?n.store(e):-1}}function Ne(e,t,n){let l=" at ";if(e.readFileSync&&!t[0].startsWith(l)&&t[1].startsWith(l))for(let a=1;a<t.length;a++){let i=t[a];if(i.startsWith(l))for(i=i.slice(l.length);;){let d=/^(?:new |async )?\S+ \((.*)\)$/.exec(i);if(d){i=d[1];continue}if(d=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(i),d){i=d[1];continue}if(d=/^(\S+):(\d+):(\d+)$/.exec(i),d){let s;try{s=e.readFileSync(d[1],"utf8")}catch(U){break}let p=s.split(/\r\n|\r|\n|\u2028|\u2029/)[+d[2]-1]||"",b=+d[3]-1,w=p.slice(b,b+n.length)===n?n.length:0;return{file:d[1],namespace:"file",line:+d[2],column:Z(p.slice(0,b)).length,length:Z(p.slice(b,b+w)).length,lineText:p+`
|
10
10
|
`+t.slice(1).join(`
|
11
11
|
`),suggestion:""}}break}}return null}function fe(e,t,n){let l=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,l+1).map((i,d)=>{if(d===l)return`
|
12
12
|
...`;if(!i.location)return`
|
13
13
|
error: ${i.text}`;let{file:s,line:p,column:b}=i.location,w=i.pluginName?`[plugin: ${i.pluginName}] `:"";return`
|
14
|
-
${s}:${p}:${b}: ERROR: ${w}${i.text}`}).join("");let a=new Error(e);for(let[i,d]of[["errors",t],["warnings",n]])Object.defineProperty(a,i,{configurable:!0,enumerable:!0,get:()=>d,set:s=>Object.defineProperty(a,i,{configurable:!0,enumerable:!0,value:s})});return a}function ae(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function Pe(e,t){if(e==null)return null;let n={},l=r(e,n,"file",y),a=r(e,n,"namespace",y),i=r(e,n,"line",se),d=r(e,n,"column",se),s=r(e,n,"length",se),p=r(e,n,"lineText",y),b=r(e,n,"suggestion",y);return K(e,n,t),{file:l||"",namespace:a||"",line:i||0,column:d||0,length:s||0,lineText:p||"",suggestion:b||""}}function re(e,t,n,l){let a=[],i=0;for(let d of e){let s={},p=r(d,s,"id",y),b=r(d,s,"pluginName",y),w=r(d,s,"text",y),U=r(d,s,"location",Ae),j=r(d,s,"notes",W),B=r(d,s,"detail",ye),L=`in element ${i} of "${t}"`;K(d,s,L);let Q=[];if(j)for(let T of j){let z={},J=r(T,z,"text",y),v=r(T,z,"location",Ae);K(T,z,L),Q.push({text:J||"",location:Pe(v,L)})}a.push({id:p||"",pluginName:b||l,text:w||"",location:Pe(U,L),notes:Q,detail:n?n.store(B):-1}),i++}return a}function me(e,t){let n=[];for(let l of e){if(typeof l!="string")throw new Error(`${Y(t)} must be an array of strings`);n.push(l)}return n}function st({path:e,contents:t,hash:n}){let l=null;return{path:e,contents:t,hash:n,get text(){let a=this.contents;return(l===null||a!==t)&&(t=a,l=ie(a)),l}}}var at="0.19.2",ut=e=>de().build(e),ct=e=>de().context(e),ft=(e,t)=>de().transform(e,t),dt=(e,t)=>de().formatMessages(e,t),pt=(e,t)=>de().analyzeMetafile(e,t),gt=()=>{throw new Error('The "buildSync" API only works in node')},mt=()=>{throw new Error('The "transformSync" API only works in node')},yt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},ht=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ue,Se,de=()=>{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')},bt=e=>{e=Be(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(ue)throw new Error('Cannot call "initialize" more than once');return ue=wt(t||"",n,l),ue.catch(()=>{ue=void 0}),ue},wt=(e,t,n)=>ne(void 0,null,function*(){let l;if(n){let b=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 y=(r,f,m)=>new Promise((c,n)=>{var s=h=>{try{l(m.next(h))}catch(u){n(u)}},i=h=>{try{l(m.throw(h))}catch(u){n(u)}},l=h=>h.done?c(h.value):Promise.resolve(h.value).then(s,i);l((m=m.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(n,s){c+=m.decode(s);const i=c.lastIndexOf(`\n`);return i!=-1&&(console.log(c.substring(0,i)),c=c.substring(i+1)),s.length},write(n,s,i,l,h,u){if(i!==0||l!==s.length||h!==null){u(r());return}const g=this.writeSync(n,s);u(null,g)},chmod(n,s,i){i(r())},chown(n,s,i,l){l(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,l){l(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,l){l(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,l){l(r())},read(n,s,i,l,h,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,l){l(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"),m=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)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(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 d=0;switch(typeof t){case"object":t!==null&&(d=1);break;case"string":d=2;break;case"symbol":d=3;break;case"function":d=4;break}this.mem.setUint32(e+4,2146959360|d,!0),this.mem.setUint32(e,a,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},h=e=>{const t=n(e+0),o=n(e+8),a=new Array(o);for(let d=0;d<o;d++)a[d]=s(t+d*8);return a},u=e=>{const t=n(e+0),o=n(e+8);return m.decode(new DataView(this._inst.exports.mem.buffer,t,o))},g=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;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>>>=0;const t=n(e+8),o=n(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,c(e+8,(g+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;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()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(l(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),a=h(e+32),d=Reflect.apply(o,t,a);e=this._inst.exports.getsp()>>>0,i(e+56,d),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,c(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=f.encode(String(s(e+8)));i(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);l(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=l(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.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 y(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 n=4096;const s=e=>{const t=n,o=f.encode(e+"\\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,l=[];this.argv.forEach(e=>{l.push(s(e))}),l.push(0),Object.keys(this.env).sort().forEach(e=>{l.push(s(`${e}=${this.env[e]}`))}),l.push(0);const u=n;l.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const g=4096+8192;if(n>=g)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),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 n=this;return function(){const s={id:c,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,m=globalThis.fs,c="";m.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){c+=f.decode(u);let g=c.split(`\n`);g.length>1&&console.log(g.slice(0,-1).join(`\n`)),c=g[g.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:h})=>{h.length>0&&(n.push(h),s&&s())},m.read=(h,u,g,e,t,o)=>{if(h!==0||g!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>m.read(h,u,g,e,t,o);return}let a=n[0],d=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+d),g),i+=d,i===a.length&&(n.shift(),i=0),o(null,d)};let l=new globalThis.Go;l.argv=["","--service=0.19.2"],tryToInstantiateModule(r,l).then(h=>{postMessage(null),l.run(h)},h=>{postMessage(h)})};function tryToInstantiateModule(r,f){return y(this,null,function*(){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const m=yield fetch(r);if(!m.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(m.headers.get("Content-Type")||""))return(yield WebAssembly.instantiateStreaming(m,f.importObject)).instance;const c=yield m.arrayBuffer();return(yield WebAssembly.instantiate(c,f.importObject)).instance})}return r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});l=new Worker(URL.createObjectURL(b))}else{let b=(postMessage=>{
|
14
|
+
${s}:${p}:${b}: ERROR: ${w}${i.text}`}).join("");let a=new Error(e);for(let[i,d]of[["errors",t],["warnings",n]])Object.defineProperty(a,i,{configurable:!0,enumerable:!0,get:()=>d,set:s=>Object.defineProperty(a,i,{configurable:!0,enumerable:!0,value:s})});return a}function ae(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function Pe(e,t){if(e==null)return null;let n={},l=r(e,n,"file",y),a=r(e,n,"namespace",y),i=r(e,n,"line",se),d=r(e,n,"column",se),s=r(e,n,"length",se),p=r(e,n,"lineText",y),b=r(e,n,"suggestion",y);return K(e,n,t),{file:l||"",namespace:a||"",line:i||0,column:d||0,length:s||0,lineText:p||"",suggestion:b||""}}function re(e,t,n,l){let a=[],i=0;for(let d of e){let s={},p=r(d,s,"id",y),b=r(d,s,"pluginName",y),w=r(d,s,"text",y),U=r(d,s,"location",Ae),j=r(d,s,"notes",W),B=r(d,s,"detail",ye),L=`in element ${i} of "${t}"`;K(d,s,L);let Q=[];if(j)for(let T of j){let z={},J=r(T,z,"text",y),v=r(T,z,"location",Ae);K(T,z,L),Q.push({text:J||"",location:Pe(v,L)})}a.push({id:p||"",pluginName:b||l,text:w||"",location:Pe(U,L),notes:Q,detail:n?n.store(B):-1}),i++}return a}function me(e,t){let n=[];for(let l of e){if(typeof l!="string")throw new Error(`${Y(t)} must be an array of strings`);n.push(l)}return n}function st({path:e,contents:t,hash:n}){let l=null;return{path:e,contents:t,hash:n,get text(){let a=this.contents;return(l===null||a!==t)&&(t=a,l=ie(a)),l}}}var at="0.19.3",ut=e=>de().build(e),ct=e=>de().context(e),ft=(e,t)=>de().transform(e,t),dt=(e,t)=>de().formatMessages(e,t),pt=(e,t)=>de().analyzeMetafile(e,t),gt=()=>{throw new Error('The "buildSync" API only works in node')},mt=()=>{throw new Error('The "transformSync" API only works in node')},yt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},ht=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ue,Se,de=()=>{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')},bt=e=>{e=Be(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(ue)throw new Error('Cannot call "initialize" more than once');return ue=wt(t||"",n,l),ue.catch(()=>{ue=void 0}),ue},wt=(e,t,n)=>ne(void 0,null,function*(){let l;if(n){let b=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 y=(r,f,m)=>new Promise((c,n)=>{var s=h=>{try{l(m.next(h))}catch(u){n(u)}},i=h=>{try{l(m.throw(h))}catch(u){n(u)}},l=h=>h.done?c(h.value):Promise.resolve(h.value).then(s,i);l((m=m.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(n,s){c+=m.decode(s);const i=c.lastIndexOf(`\n`);return i!=-1&&(console.log(c.substring(0,i)),c=c.substring(i+1)),s.length},write(n,s,i,l,h,u){if(i!==0||l!==s.length||h!==null){u(r());return}const g=this.writeSync(n,s);u(null,g)},chmod(n,s,i){i(r())},chown(n,s,i,l){l(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,l){l(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,l){l(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,l){l(r())},read(n,s,i,l,h,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,l){l(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"),m=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)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(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 d=0;switch(typeof t){case"object":t!==null&&(d=1);break;case"string":d=2;break;case"symbol":d=3;break;case"function":d=4;break}this.mem.setUint32(e+4,2146959360|d,!0),this.mem.setUint32(e,a,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},h=e=>{const t=n(e+0),o=n(e+8),a=new Array(o);for(let d=0;d<o;d++)a[d]=s(t+d*8);return a},u=e=>{const t=n(e+0),o=n(e+8);return m.decode(new DataView(this._inst.exports.mem.buffer,t,o))},g=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;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>>>=0;const t=n(e+8),o=n(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,c(e+8,(g+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;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()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(l(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),a=h(e+32),d=Reflect.apply(o,t,a);e=this._inst.exports.getsp()>>>0,i(e+56,d),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,c(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=f.encode(String(s(e+8)));i(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);l(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=l(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.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 y(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 n=4096;const s=e=>{const t=n,o=f.encode(e+"\\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,l=[];this.argv.forEach(e=>{l.push(s(e))}),l.push(0),Object.keys(this.env).sort().forEach(e=>{l.push(s(`${e}=${this.env[e]}`))}),l.push(0);const u=n;l.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const g=4096+8192;if(n>=g)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),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 n=this;return function(){const s={id:c,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,m=globalThis.fs,c="";m.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){c+=f.decode(u);let g=c.split(`\n`);g.length>1&&console.log(g.slice(0,-1).join(`\n`)),c=g[g.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:h})=>{h.length>0&&(n.push(h),s&&s())},m.read=(h,u,g,e,t,o)=>{if(h!==0||g!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>m.read(h,u,g,e,t,o);return}let a=n[0],d=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+d),g),i+=d,i===a.length&&(n.shift(),i=0),o(null,d)};let l=new globalThis.Go;l.argv=["","--service=0.19.3"],tryToInstantiateModule(r,l).then(h=>{postMessage(null),l.run(h)},h=>{postMessage(h)})};function tryToInstantiateModule(r,f){return y(this,null,function*(){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const m=yield fetch(r);if(!m.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(m.headers.get("Content-Type")||""))return(yield WebAssembly.instantiateStreaming(m,f.importObject)).instance;const c=yield m.arrayBuffer();return(yield WebAssembly.instantiate(c,f.importObject)).instance})}return r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});l=new Worker(URL.createObjectURL(b))}else{let b=(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 y=(r,f,m)=>new Promise((c,n)=>{var s=h=>{try{l(m.next(h))}catch(u){n(u)}},i=h=>{try{l(m.throw(h))}catch(u){n(u)}},l=h=>h.done?c(h.value):Promise.resolve(h.value).then(s,i);l((m=m.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(n,s){c+=m.decode(s);const i=c.lastIndexOf(`
|
19
19
|
`);return i!=-1&&(console.log(c.substring(0,i)),c=c.substring(i+1)),s.length},write(n,s,i,l,h,u){if(i!==0||l!==s.length||h!==null){u(r());return}const g=this.writeSync(n,s);u(null,g)},chmod(n,s,i){i(r())},chown(n,s,i,l){l(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,l){l(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,l){l(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,l){l(r())},read(n,s,i,l,h,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,l){l(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"),m=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)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(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 d=0;switch(typeof t){case"object":t!==null&&(d=1);break;case"string":d=2;break;case"symbol":d=3;break;case"function":d=4;break}this.mem.setUint32(e+4,2146959360|d,!0),this.mem.setUint32(e,a,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},h=e=>{const t=n(e+0),o=n(e+8),a=new Array(o);for(let d=0;d<o;d++)a[d]=s(t+d*8);return a},u=e=>{const t=n(e+0),o=n(e+8);return m.decode(new DataView(this._inst.exports.mem.buffer,t,o))},g=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;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>>>=0;const t=n(e+8),o=n(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,c(e+8,(g+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;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()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(l(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),a=h(e+32),d=Reflect.apply(o,t,a);e=this._inst.exports.getsp()>>>0,i(e+56,d),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,c(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=f.encode(String(s(e+8)));i(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);l(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=l(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.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 y(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 n=4096;const s=e=>{const t=n,o=f.encode(e+"\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,l=[];this.argv.forEach(e=>{l.push(s(e))}),l.push(0),Object.keys(this.env).sort().forEach(e=>{l.push(s(`${e}=${this.env[e]}`))}),l.push(0);const u=n;l.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const g=4096+8192;if(n>=g)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),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 n=this;return function(){const s={id:c,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,m=globalThis.fs,c="";m.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){c+=f.decode(u);let g=c.split(`
|
20
20
|
`);g.length>1&&console.log(g.slice(0,-1).join(`
|
21
|
-
`)),c=g[g.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:h})=>{h.length>0&&(n.push(h),s&&s())},m.read=(h,u,g,e,t,o)=>{if(h!==0||g!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>m.read(h,u,g,e,t,o);return}let a=n[0],d=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+d),g),i+=d,i===a.length&&(n.shift(),i=0),o(null,d)};let l=new globalThis.Go;l.argv=["","--service=0.19.
|
21
|
+
`)),c=g[g.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:h})=>{h.length>0&&(n.push(h),s&&s())},m.read=(h,u,g,e,t,o)=>{if(h!==0||g!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>m.read(h,u,g,e,t,o);return}let a=n[0],d=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+d),g),i+=d,i===a.length&&(n.shift(),i=0),o(null,d)};let l=new globalThis.Go;l.argv=["","--service=0.19.3"],tryToInstantiateModule(r,l).then(h=>{postMessage(null),l.run(h)},h=>{postMessage(h)})};function tryToInstantiateModule(r,f){return y(this,null,function*(){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const m=yield fetch(r);if(!m.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\/wasm($|;)/i.test(m.headers.get("Content-Type")||""))return(yield WebAssembly.instantiateStreaming(m,f.importObject)).instance;const c=yield m.arrayBuffer();return(yield WebAssembly.instantiate(c,f.importObject)).instance})}return r=>onmessage(r);})(w=>l.onmessage({data:w}));l={onmessage:null,postMessage:w=>setTimeout(()=>b({data:w})),terminate(){}}}let a,i,d=new Promise((b,w)=>{a=b,i=w});l.onmessage=({data:b})=>{l.onmessage=({data:w})=>s(w),b?i(b):a()},l.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:s,service:p}=Le({writeToStdin(b){l.postMessage(b)},isSync:!1,hasFS:!1,esbuild:we});yield d,Se={build:b=>new Promise((w,U)=>p.buildOrContext({callName:"build",refs:null,options:b,isTTY:!1,defaultWD:"/",callback:(j,B)=>j?U(j):w(B)})),context:b=>new Promise((w,U)=>p.buildOrContext({callName:"context",refs:null,options:b,isTTY:!1,defaultWD:"/",callback:(j,B)=>j?U(j):w(B)})),transform:(b,w)=>new Promise((U,j)=>p.transform({callName:"transform",refs:null,input:b,options:w||{},isTTY:!1,fs:{readFile(B,L){L(new Error("Internal error"),null)},writeFile(B,L){L(null)}},callback:(B,L)=>B?j(B):U(L)})),formatMessages:(b,w)=>new Promise((U,j)=>p.formatMessages({callName:"formatMessages",refs:null,messages:b,options:w,callback:(B,L)=>B?j(B):U(L)})),analyzeMetafile:(b,w)=>new Promise((U,j)=>p.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof b=="string"?b:JSON.stringify(b),options:w,callback:(B,L)=>B?j(B):U(L)}))}}),vt=we;
|
22
22
|
})(typeof module==="object"?module:{set exports(x){(typeof self!=="undefined"?self:this).esbuild=x}});
|
@@ -713,12 +713,13 @@ function createChannel(streamIn) {
|
|
713
713
|
}
|
714
714
|
if (typeof request.key === "number") {
|
715
715
|
const requestCallbacks = requestCallbacksByKey[request.key];
|
716
|
-
if (requestCallbacks) {
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
716
|
+
if (!requestCallbacks) {
|
717
|
+
return;
|
718
|
+
}
|
719
|
+
const callback = requestCallbacks[request.command];
|
720
|
+
if (callback) {
|
721
|
+
await callback(id, request);
|
722
|
+
return;
|
722
723
|
}
|
723
724
|
}
|
724
725
|
throw new Error(`Invalid command: ` + request.command);
|
@@ -735,8 +736,8 @@ function createChannel(streamIn) {
|
|
735
736
|
if (isFirstPacket) {
|
736
737
|
isFirstPacket = false;
|
737
738
|
let binaryVersion = String.fromCharCode(...bytes);
|
738
|
-
if (binaryVersion !== "0.19.
|
739
|
-
throw new Error(`Cannot start service: Host version "${"0.19.
|
739
|
+
if (binaryVersion !== "0.19.3") {
|
740
|
+
throw new Error(`Cannot start service: Host version "${"0.19.3"}" does not match binary version ${quote(binaryVersion)}`);
|
740
741
|
}
|
741
742
|
return;
|
742
743
|
}
|
@@ -1771,7 +1772,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
|
|
1771
1772
|
}
|
1772
1773
|
}
|
1773
1774
|
var _a;
|
1774
|
-
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.19.
|
1775
|
+
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.19.3";
|
1775
1776
|
var esbuildCommandAndArgs = () => {
|
1776
1777
|
if ((!ESBUILD_BINARY_PATH || true) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
|
1777
1778
|
throw new Error(
|
@@ -1838,7 +1839,7 @@ var fsAsync = {
|
|
1838
1839
|
}
|
1839
1840
|
}
|
1840
1841
|
};
|
1841
|
-
var version = "0.19.
|
1842
|
+
var version = "0.19.3";
|
1842
1843
|
var build = (options) => ensureServiceIsRunning().build(options);
|
1843
1844
|
var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
|
1844
1845
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
@@ -1948,7 +1949,7 @@ var ensureServiceIsRunning = () => {
|
|
1948
1949
|
if (longLivedService)
|
1949
1950
|
return longLivedService;
|
1950
1951
|
let [command, args] = esbuildCommandAndArgs();
|
1951
|
-
let child = child_process.spawn(command, args.concat(`--service=${"0.19.
|
1952
|
+
let child = child_process.spawn(command, args.concat(`--service=${"0.19.3"}`, "--ping"), {
|
1952
1953
|
windowsHide: true,
|
1953
1954
|
stdio: ["pipe", "pipe", "inherit"],
|
1954
1955
|
cwd: defaultWD
|
@@ -2048,7 +2049,7 @@ var runServiceSync = (callback) => {
|
|
2048
2049
|
esbuild: node_exports
|
2049
2050
|
});
|
2050
2051
|
callback(service);
|
2051
|
-
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.19.
|
2052
|
+
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.19.3"}`), {
|
2052
2053
|
cwd: defaultWD,
|
2053
2054
|
windowsHide: true,
|
2054
2055
|
input: stdin,
|
@@ -2068,7 +2069,7 @@ var workerThreadService = null;
|
|
2068
2069
|
var startWorkerThreadService = (worker_threads2) => {
|
2069
2070
|
let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
|
2070
2071
|
let worker = new worker_threads2.Worker(__filename, {
|
2071
|
-
workerData: { workerPort, defaultWD, esbuildVersion: "0.19.
|
2072
|
+
workerData: { workerPort, defaultWD, esbuildVersion: "0.19.3" },
|
2072
2073
|
transferList: [workerPort],
|
2073
2074
|
// From node's documentation: https://nodejs.org/api/worker_threads.html
|
2074
2075
|
//
|
data/package.json
CHANGED