mcp-proxy
Version:
A TypeScript SSE proxy for MCP servers that use stdio transport.
1 lines • 456 kB
Source Map (JSON)
{"version":3,"file":"mcp-proxy.mjs","names":["_a","_b","inspect","_a","mixin","code","ansiStyles","key","argv","args","value","val","env","defaults","aliases","guessType","require","argv","shim","y18n","y18n","_y18n","shim","getCallerFile","stack","escalade","y18n","cmd","global","argv","result","shim","usage","validation","module","command","argv","c","shim","fail","command","ui","usage","maxWidth","_a","_b","_c","usage","command","shim","argv","desc","templates.completionZshTemplate","templates.completionShTemplate","shim","argv","_a","usage","key","distance","shim","global","argv","_a","type","key","value","_b","_c","k","Usage","Validation","Command","Completion","completion","validation","esmPlatformShim","resolve","yargs","server"],"sources":["../../node_modules/.pnpm/eventsource-parser@3.0.2/node_modules/eventsource-parser/dist/index.js","../../node_modules/.pnpm/eventsource@4.1.0/node_modules/eventsource/dist/index.js","../../node_modules/.pnpm/cliui@9.0.1/node_modules/cliui/build/lib/index.js","../../node_modules/.pnpm/ansi-regex@6.1.0/node_modules/ansi-regex/index.js","../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js","../../node_modules/.pnpm/get-east-asian-width@1.3.0/node_modules/get-east-asian-width/lookup.js","../../node_modules/.pnpm/get-east-asian-width@1.3.0/node_modules/get-east-asian-width/index.js","../../node_modules/.pnpm/emoji-regex@10.4.0/node_modules/emoji-regex/index.js","../../node_modules/.pnpm/string-width@7.2.0/node_modules/string-width/index.js","../../node_modules/.pnpm/ansi-styles@6.2.1/node_modules/ansi-styles/index.js","../../node_modules/.pnpm/wrap-ansi@9.0.0/node_modules/wrap-ansi/index.js","../../node_modules/.pnpm/cliui@9.0.1/node_modules/cliui/index.mjs","../../node_modules/.pnpm/escalade@3.2.0/node_modules/escalade/sync/index.mjs","../../node_modules/.pnpm/yargs-parser@22.0.0/node_modules/yargs-parser/build/lib/string-utils.js","../../node_modules/.pnpm/yargs-parser@22.0.0/node_modules/yargs-parser/build/lib/tokenize-arg-string.js","../../node_modules/.pnpm/yargs-parser@22.0.0/node_modules/yargs-parser/build/lib/yargs-parser-types.js","../../node_modules/.pnpm/yargs-parser@22.0.0/node_modules/yargs-parser/build/lib/yargs-parser.js","../../node_modules/.pnpm/yargs-parser@22.0.0/node_modules/yargs-parser/build/lib/index.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/utils/process-argv.js","../../node_modules/.pnpm/y18n@5.0.8/node_modules/y18n/build/lib/platform-shims/node.js","../../node_modules/.pnpm/y18n@5.0.8/node_modules/y18n/build/lib/index.js","../../node_modules/.pnpm/y18n@5.0.8/node_modules/y18n/index.mjs","../../node_modules/.pnpm/get-caller-file@2.0.5/node_modules/get-caller-file/index.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/lib/platform-shims/esm.mjs","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/typings/common-types.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/utils/is-promise.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/yerror.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/parse-command.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/argsert.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/middleware.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/utils/maybe-async-result.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/command.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/utils/obj-filter.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/utils/set-blocking.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/usage.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/completion-templates.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/completion.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/utils/levenshtein.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/validation.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/utils/apply-extends.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/yargs-factory.js","../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/index.mjs","../../src/JSONFilterTransform.ts","../../src/StdioClientTransport.ts","../../src/bin/mcp-proxy.ts"],"sourcesContent":["class ParseError extends Error {\n constructor(message, options) {\n super(message), this.name = \"ParseError\", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;\n }\n}\nfunction noop(_arg) {\n}\nfunction createParser(callbacks) {\n if (typeof callbacks == \"function\")\n throw new TypeError(\n \"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?\"\n );\n const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;\n let incompleteLine = \"\", isFirstChunk = !0, id, data = \"\", eventType = \"\";\n function feed(newChunk) {\n const chunk = isFirstChunk ? newChunk.replace(/^\\xEF\\xBB\\xBF/, \"\") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);\n for (const line of complete)\n parseLine(line);\n incompleteLine = incomplete, isFirstChunk = !1;\n }\n function parseLine(line) {\n if (line === \"\") {\n dispatchEvent();\n return;\n }\n if (line.startsWith(\":\")) {\n onComment && onComment(line.slice(line.startsWith(\": \") ? 2 : 1));\n return;\n }\n const fieldSeparatorIndex = line.indexOf(\":\");\n if (fieldSeparatorIndex !== -1) {\n const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === \" \" ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);\n processField(field, value, line);\n return;\n }\n processField(line, \"\", line);\n }\n function processField(field, value, line) {\n switch (field) {\n case \"event\":\n eventType = value;\n break;\n case \"data\":\n data = `${data}${value}\n`;\n break;\n case \"id\":\n id = value.includes(\"\\0\") ? void 0 : value;\n break;\n case \"retry\":\n /^\\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(\n new ParseError(`Invalid \\`retry\\` value: \"${value}\"`, {\n type: \"invalid-retry\",\n value,\n line\n })\n );\n break;\n default:\n onError(\n new ParseError(\n `Unknown field \"${field.length > 20 ? `${field.slice(0, 20)}\\u2026` : field}\"`,\n { type: \"unknown-field\", field, value, line }\n )\n );\n break;\n }\n }\n function dispatchEvent() {\n data.length > 0 && onEvent({\n id,\n event: eventType || void 0,\n // If the data buffer's last character is a U+000A LINE FEED (LF) character,\n // then remove the last character from the data buffer.\n data: data.endsWith(`\n`) ? data.slice(0, -1) : data\n }), id = void 0, data = \"\", eventType = \"\";\n }\n function reset(options = {}) {\n incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = !0, id = void 0, data = \"\", eventType = \"\", incompleteLine = \"\";\n }\n return { feed, reset };\n}\nfunction splitLines(chunk) {\n const lines = [];\n let incompleteLine = \"\", searchIndex = 0;\n for (; searchIndex < chunk.length; ) {\n const crIndex = chunk.indexOf(\"\\r\", searchIndex), lfIndex = chunk.indexOf(`\n`, searchIndex);\n let lineEnd = -1;\n if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {\n incompleteLine = chunk.slice(searchIndex);\n break;\n } else {\n const line = chunk.slice(searchIndex, lineEnd);\n lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === \"\\r\" && chunk[searchIndex] === `\n` && searchIndex++;\n }\n }\n return [lines, incompleteLine];\n}\nexport {\n ParseError,\n createParser\n};\n//# sourceMappingURL=index.js.map\n","import { createParser } from \"eventsource-parser\";\nclass ErrorEvent extends Event {\n /**\n * Constructs a new `ErrorEvent` instance. This is typically not called directly,\n * but rather emitted by the `EventSource` object when an error occurs.\n *\n * @param type - The type of the event (should be \"error\")\n * @param errorEventInitDict - Optional properties to include in the error event\n */\n constructor(type, errorEventInitDict) {\n var _a, _b;\n super(type), this.code = (_a = errorEventInitDict == null ? void 0 : errorEventInitDict.code) != null ? _a : void 0, this.message = (_b = errorEventInitDict == null ? void 0 : errorEventInitDict.message) != null ? _b : void 0;\n }\n /**\n * Node.js \"hides\" the `message` and `code` properties of the `ErrorEvent` instance,\n * when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging,\n * we explicitly include the properties in the `inspect` method.\n *\n * This is automatically called by Node.js when you `console.log` an instance of this class.\n *\n * @param _depth - The current depth\n * @param options - The options passed to `util.inspect`\n * @param inspect - The inspect function to use (prevents having to import it from `util`)\n * @returns A string representation of the error\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")](_depth, options, inspect) {\n return inspect(inspectableError(this), options);\n }\n /**\n * Deno \"hides\" the `message` and `code` properties of the `ErrorEvent` instance,\n * when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging,\n * we explicitly include the properties in the `inspect` method.\n *\n * This is automatically called by Deno when you `console.log` an instance of this class.\n *\n * @param inspect - The inspect function to use (prevents having to import it from `util`)\n * @param options - The options passed to `Deno.inspect`\n * @returns A string representation of the error\n */\n [Symbol.for(\"Deno.customInspect\")](inspect, options) {\n return inspect(inspectableError(this), options);\n }\n}\nfunction syntaxError(message) {\n const DomException = globalThis.DOMException;\n return typeof DomException == \"function\" ? new DomException(message, \"SyntaxError\") : new SyntaxError(message);\n}\nfunction flattenError(err) {\n return err instanceof Error ? \"errors\" in err && Array.isArray(err.errors) ? err.errors.map(flattenError).join(\", \") : \"cause\" in err && err.cause instanceof Error ? `${err}: ${flattenError(err.cause)}` : err.message : `${err}`;\n}\nfunction inspectableError(err) {\n return {\n type: err.type,\n message: err.message,\n code: err.code,\n defaultPrevented: err.defaultPrevented,\n cancelable: err.cancelable,\n timeStamp: err.timeStamp\n };\n}\nvar __typeError = (msg) => {\n throw TypeError(msg);\n}, __accessCheck = (obj, member, msg) => member.has(obj) || __typeError(\"Cannot \" + msg), __privateGet = (obj, member, getter) => (__accessCheck(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => member.has(obj) ? __typeError(\"Cannot add the same private member more than once\") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value), __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, \"write to private field\"), member.set(obj, value), value), __privateMethod = (obj, member, method) => (__accessCheck(obj, member, \"access private method\"), method), _readyState, _url, _redirectUrl, _withCredentials, _fetch, _reconnectInterval, _reconnectTimer, _lastEventId, _controller, _parser, _onError, _onMessage, _onOpen, _EventSource_instances, connect_fn, _onFetchResponse, _onFetchError, getRequestOptions_fn, _onEvent, _onRetryChange, failConnection_fn, scheduleReconnect_fn, _reconnect;\nclass EventSource extends EventTarget {\n constructor(url, eventSourceInitDict) {\n var _a, _b;\n super(), __privateAdd(this, _EventSource_instances), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, __privateAdd(this, _readyState), __privateAdd(this, _url), __privateAdd(this, _redirectUrl), __privateAdd(this, _withCredentials), __privateAdd(this, _fetch), __privateAdd(this, _reconnectInterval), __privateAdd(this, _reconnectTimer), __privateAdd(this, _lastEventId, null), __privateAdd(this, _controller), __privateAdd(this, _parser), __privateAdd(this, _onError, null), __privateAdd(this, _onMessage, null), __privateAdd(this, _onOpen, null), __privateAdd(this, _onFetchResponse, async (response) => {\n var _a2;\n __privateGet(this, _parser).reset();\n const { body, redirected, status, headers } = response;\n if (status === 204) {\n __privateMethod(this, _EventSource_instances, failConnection_fn).call(this, \"Server sent HTTP 204, not reconnecting\", 204), this.close();\n return;\n }\n if (redirected ? __privateSet(this, _redirectUrl, new URL(response.url)) : __privateSet(this, _redirectUrl, void 0), status !== 200) {\n __privateMethod(this, _EventSource_instances, failConnection_fn).call(this, `Non-200 status code (${status})`, status);\n return;\n }\n if (!(headers.get(\"content-type\") || \"\").startsWith(\"text/event-stream\")) {\n __privateMethod(this, _EventSource_instances, failConnection_fn).call(this, 'Invalid content type, expected \"text/event-stream\"', status);\n return;\n }\n if (__privateGet(this, _readyState) === this.CLOSED)\n return;\n __privateSet(this, _readyState, this.OPEN);\n const openEvent = new Event(\"open\");\n if ((_a2 = __privateGet(this, _onOpen)) == null || _a2.call(this, openEvent), this.dispatchEvent(openEvent), typeof body != \"object\" || !body || !(\"getReader\" in body)) {\n __privateMethod(this, _EventSource_instances, failConnection_fn).call(this, \"Invalid response body, expected a web ReadableStream\", status), this.close();\n return;\n }\n const decoder = new TextDecoder(), reader = body.getReader();\n let open = !0;\n do {\n const { done, value } = await reader.read();\n value && __privateGet(this, _parser).feed(decoder.decode(value, { stream: !done })), done && (open = !1, __privateGet(this, _parser).reset(), __privateMethod(this, _EventSource_instances, scheduleReconnect_fn).call(this));\n } while (open);\n }), __privateAdd(this, _onFetchError, (err) => {\n __privateSet(this, _controller, void 0), !(err.name === \"AbortError\" || err.type === \"aborted\") && __privateMethod(this, _EventSource_instances, scheduleReconnect_fn).call(this, flattenError(err));\n }), __privateAdd(this, _onEvent, (event) => {\n typeof event.id == \"string\" && __privateSet(this, _lastEventId, event.id);\n const messageEvent = new MessageEvent(event.event || \"message\", {\n data: event.data,\n origin: __privateGet(this, _redirectUrl) ? __privateGet(this, _redirectUrl).origin : __privateGet(this, _url).origin,\n lastEventId: event.id || \"\"\n });\n __privateGet(this, _onMessage) && (!event.event || event.event === \"message\") && __privateGet(this, _onMessage).call(this, messageEvent), this.dispatchEvent(messageEvent);\n }), __privateAdd(this, _onRetryChange, (value) => {\n __privateSet(this, _reconnectInterval, value);\n }), __privateAdd(this, _reconnect, () => {\n __privateSet(this, _reconnectTimer, void 0), __privateGet(this, _readyState) === this.CONNECTING && __privateMethod(this, _EventSource_instances, connect_fn).call(this);\n });\n try {\n if (url instanceof URL)\n __privateSet(this, _url, url);\n else if (typeof url == \"string\")\n __privateSet(this, _url, new URL(url, getBaseURL()));\n else\n throw new Error(\"Invalid URL\");\n } catch {\n throw syntaxError(\"An invalid or illegal string was specified\");\n }\n __privateSet(this, _parser, createParser({\n onEvent: __privateGet(this, _onEvent),\n onRetry: __privateGet(this, _onRetryChange)\n })), __privateSet(this, _readyState, this.CONNECTING), __privateSet(this, _reconnectInterval, 3e3), __privateSet(this, _fetch, (_a = eventSourceInitDict == null ? void 0 : eventSourceInitDict.fetch) != null ? _a : globalThis.fetch), __privateSet(this, _withCredentials, (_b = eventSourceInitDict == null ? void 0 : eventSourceInitDict.withCredentials) != null ? _b : !1), __privateMethod(this, _EventSource_instances, connect_fn).call(this);\n }\n /**\n * Returns the state of this EventSource object's connection. It can have the values described below.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)\n *\n * Note: typed as `number` instead of `0 | 1 | 2` for compatibility with the `EventSource` interface,\n * defined in the TypeScript `dom` library.\n *\n * @public\n */\n get readyState() {\n return __privateGet(this, _readyState);\n }\n /**\n * Returns the URL providing the event stream.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)\n *\n * @public\n */\n get url() {\n return __privateGet(this, _url).href;\n }\n /**\n * Returns true if the credentials mode for connection requests to the URL providing the event stream is set to \"include\", and false otherwise.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)\n */\n get withCredentials() {\n return __privateGet(this, _withCredentials);\n }\n /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */\n get onerror() {\n return __privateGet(this, _onError);\n }\n set onerror(value) {\n __privateSet(this, _onError, value);\n }\n /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */\n get onmessage() {\n return __privateGet(this, _onMessage);\n }\n set onmessage(value) {\n __privateSet(this, _onMessage, value);\n }\n /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */\n get onopen() {\n return __privateGet(this, _onOpen);\n }\n set onopen(value) {\n __privateSet(this, _onOpen, value);\n }\n addEventListener(type, listener, options) {\n const listen = listener;\n super.addEventListener(type, listen, options);\n }\n removeEventListener(type, listener, options) {\n const listen = listener;\n super.removeEventListener(type, listen, options);\n }\n /**\n * Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)\n *\n * @public\n */\n close() {\n __privateGet(this, _reconnectTimer) && clearTimeout(__privateGet(this, _reconnectTimer)), __privateGet(this, _readyState) !== this.CLOSED && (__privateGet(this, _controller) && __privateGet(this, _controller).abort(), __privateSet(this, _readyState, this.CLOSED), __privateSet(this, _controller, void 0));\n }\n}\n_readyState = /* @__PURE__ */ new WeakMap(), _url = /* @__PURE__ */ new WeakMap(), _redirectUrl = /* @__PURE__ */ new WeakMap(), _withCredentials = /* @__PURE__ */ new WeakMap(), _fetch = /* @__PURE__ */ new WeakMap(), _reconnectInterval = /* @__PURE__ */ new WeakMap(), _reconnectTimer = /* @__PURE__ */ new WeakMap(), _lastEventId = /* @__PURE__ */ new WeakMap(), _controller = /* @__PURE__ */ new WeakMap(), _parser = /* @__PURE__ */ new WeakMap(), _onError = /* @__PURE__ */ new WeakMap(), _onMessage = /* @__PURE__ */ new WeakMap(), _onOpen = /* @__PURE__ */ new WeakMap(), _EventSource_instances = /* @__PURE__ */ new WeakSet(), /**\n* Connect to the given URL and start receiving events\n*\n* @internal\n*/\nconnect_fn = function() {\n __privateSet(this, _readyState, this.CONNECTING), __privateSet(this, _controller, new AbortController()), __privateGet(this, _fetch)(__privateGet(this, _url), __privateMethod(this, _EventSource_instances, getRequestOptions_fn).call(this)).then(__privateGet(this, _onFetchResponse)).catch(__privateGet(this, _onFetchError));\n}, _onFetchResponse = /* @__PURE__ */ new WeakMap(), _onFetchError = /* @__PURE__ */ new WeakMap(), /**\n* Get request options for the `fetch()` request\n*\n* @returns The request options\n* @internal\n*/\ngetRequestOptions_fn = function() {\n var _a;\n const init = {\n // [spec] Let `corsAttributeState` be `Anonymous`…\n // [spec] …will have their mode set to \"cors\"…\n mode: \"cors\",\n redirect: \"follow\",\n headers: { Accept: \"text/event-stream\", ...__privateGet(this, _lastEventId) ? { \"Last-Event-ID\": __privateGet(this, _lastEventId) } : void 0 },\n cache: \"no-store\",\n signal: (_a = __privateGet(this, _controller)) == null ? void 0 : _a.signal\n };\n return \"window\" in globalThis && (init.credentials = this.withCredentials ? \"include\" : \"same-origin\"), init;\n}, _onEvent = /* @__PURE__ */ new WeakMap(), _onRetryChange = /* @__PURE__ */ new WeakMap(), /**\n* Handles the process referred to in the EventSource specification as \"failing a connection\".\n*\n* @param error - The error causing the connection to fail\n* @param code - The HTTP status code, if available\n* @internal\n*/\nfailConnection_fn = function(message, code) {\n var _a;\n __privateGet(this, _readyState) !== this.CLOSED && __privateSet(this, _readyState, this.CLOSED);\n const errorEvent = new ErrorEvent(\"error\", { code, message });\n (_a = __privateGet(this, _onError)) == null || _a.call(this, errorEvent), this.dispatchEvent(errorEvent);\n}, /**\n* Schedules a reconnection attempt against the EventSource endpoint.\n*\n* @param message - The error causing the connection to fail\n* @param code - The HTTP status code, if available\n* @internal\n*/\nscheduleReconnect_fn = function(message, code) {\n var _a;\n if (__privateGet(this, _readyState) === this.CLOSED)\n return;\n __privateSet(this, _readyState, this.CONNECTING);\n const errorEvent = new ErrorEvent(\"error\", { code, message });\n (_a = __privateGet(this, _onError)) == null || _a.call(this, errorEvent), this.dispatchEvent(errorEvent), __privateSet(this, _reconnectTimer, setTimeout(__privateGet(this, _reconnect), __privateGet(this, _reconnectInterval)));\n}, _reconnect = /* @__PURE__ */ new WeakMap(), /**\n* ReadyState representing an EventSource currently trying to connect\n*\n* @public\n*/\nEventSource.CONNECTING = 0, /**\n* ReadyState representing an EventSource connection that is open (eg connected)\n*\n* @public\n*/\nEventSource.OPEN = 1, /**\n* ReadyState representing an EventSource connection that is closed (eg disconnected)\n*\n* @public\n*/\nEventSource.CLOSED = 2;\nObject.defineProperty(EventSource, Symbol.for(\"eventsource.supports-fetch-override\"), {\n value: !0,\n writable: !1,\n configurable: !1,\n enumerable: !1\n});\nfunction getBaseURL() {\n const doc = \"document\" in globalThis ? globalThis.document : void 0;\n return doc && typeof doc == \"object\" && \"baseURI\" in doc && typeof doc.baseURI == \"string\" ? doc.baseURI : void 0;\n}\nexport {\n ErrorEvent,\n EventSource\n};\n//# sourceMappingURL=index.js.map\n","'use strict';\nconst align = {\n right: alignRight,\n center: alignCenter\n};\nconst top = 0;\nconst right = 1;\nconst bottom = 2;\nconst left = 3;\nexport class UI {\n constructor(opts) {\n var _a;\n this.width = opts.width;\n this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true;\n this.rows = [];\n }\n span(...args) {\n const cols = this.div(...args);\n cols.span = true;\n }\n resetOutput() {\n this.rows = [];\n }\n div(...args) {\n if (args.length === 0) {\n this.div('');\n }\n if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') {\n return this.applyLayoutDSL(args[0]);\n }\n const cols = args.map(arg => {\n if (typeof arg === 'string') {\n return this.colFromString(arg);\n }\n return arg;\n });\n this.rows.push(cols);\n return cols;\n }\n shouldApplyLayoutDSL(...args) {\n return args.length === 1 && typeof args[0] === 'string' &&\n /[\\t\\n]/.test(args[0]);\n }\n applyLayoutDSL(str) {\n const rows = str.split('\\n').map(row => row.split('\\t'));\n let leftColumnWidth = 0;\n // simple heuristic for layout, make sure the\n // second column lines up along the left-hand.\n // don't allow the first column to take up more\n // than 50% of the screen.\n rows.forEach(columns => {\n if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) {\n leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0]));\n }\n });\n // generate a table:\n // replacing ' ' with padding calculations.\n // using the algorithmically generated width.\n rows.forEach(columns => {\n this.div(...columns.map((r, i) => {\n return {\n text: r.trim(),\n padding: this.measurePadding(r),\n width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined\n };\n }));\n });\n return this.rows[this.rows.length - 1];\n }\n colFromString(text) {\n return {\n text,\n padding: this.measurePadding(text)\n };\n }\n measurePadding(str) {\n // measure padding without ansi escape codes\n const noAnsi = mixin.stripAnsi(str);\n return [0, noAnsi.match(/\\s*$/)[0].length, 0, noAnsi.match(/^\\s*/)[0].length];\n }\n toString() {\n const lines = [];\n this.rows.forEach(row => {\n this.rowToString(row, lines);\n });\n // don't display any lines with the\n // hidden flag set.\n return lines\n .filter(line => !line.hidden)\n .map(line => line.text)\n .join('\\n');\n }\n rowToString(row, lines) {\n this.rasterize(row).forEach((rrow, r) => {\n let str = '';\n rrow.forEach((col, c) => {\n const { width } = row[c]; // the width with padding.\n const wrapWidth = this.negatePadding(row[c]); // the width without padding.\n let ts = col; // temporary string used during alignment/padding.\n if (wrapWidth > mixin.stringWidth(col)) {\n ts += ' '.repeat(wrapWidth - mixin.stringWidth(col));\n }\n // align the string within its column.\n if (row[c].align && row[c].align !== 'left' && this.wrap) {\n const fn = align[row[c].align];\n ts = fn(ts, wrapWidth);\n if (mixin.stringWidth(ts) < wrapWidth) {\n ts += ' '.repeat((width || 0) - mixin.stringWidth(ts) - 1);\n }\n }\n // apply border and padding to string.\n const padding = row[c].padding || [0, 0, 0, 0];\n if (padding[left]) {\n str += ' '.repeat(padding[left]);\n }\n str += addBorder(row[c], ts, '| ');\n str += ts;\n str += addBorder(row[c], ts, ' |');\n if (padding[right]) {\n str += ' '.repeat(padding[right]);\n }\n // if prior row is span, try to render the\n // current row on the prior line.\n if (r === 0 && lines.length > 0) {\n str = this.renderInline(str, lines[lines.length - 1]);\n }\n });\n // remove trailing whitespace.\n lines.push({\n text: str.replace(/ +$/, ''),\n span: row.span\n });\n });\n return lines;\n }\n // if the full 'source' can render in\n // the target line, do so.\n renderInline(source, previousLine) {\n const match = source.match(/^ */);\n const leadingWhitespace = match ? match[0].length : 0;\n const target = previousLine.text;\n const targetTextWidth = mixin.stringWidth(target.trimRight());\n if (!previousLine.span) {\n return source;\n }\n // if we're not applying wrapping logic,\n // just always append to the span.\n if (!this.wrap) {\n previousLine.hidden = true;\n return target + source;\n }\n if (leadingWhitespace < targetTextWidth) {\n return source;\n }\n previousLine.hidden = true;\n return target.trimRight() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimLeft();\n }\n rasterize(row) {\n const rrows = [];\n const widths = this.columnWidths(row);\n let wrapped;\n // word wrap all columns, and create\n // a data-structure that is easy to rasterize.\n row.forEach((col, c) => {\n // leave room for left and right padding.\n col.width = widths[c];\n if (this.wrap) {\n wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\\n');\n }\n else {\n wrapped = col.text.split('\\n');\n }\n if (col.border) {\n wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.');\n wrapped.push(\"'\" + '-'.repeat(this.negatePadding(col) + 2) + \"'\");\n }\n // add top and bottom padding.\n if (col.padding) {\n wrapped.unshift(...new Array(col.padding[top] || 0).fill(''));\n wrapped.push(...new Array(col.padding[bottom] || 0).fill(''));\n }\n wrapped.forEach((str, r) => {\n if (!rrows[r]) {\n rrows.push([]);\n }\n const rrow = rrows[r];\n for (let i = 0; i < c; i++) {\n if (rrow[i] === undefined) {\n rrow.push('');\n }\n }\n rrow.push(str);\n });\n });\n return rrows;\n }\n negatePadding(col) {\n let wrapWidth = col.width || 0;\n if (col.padding) {\n wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);\n }\n if (col.border) {\n wrapWidth -= 4;\n }\n return wrapWidth;\n }\n columnWidths(row) {\n if (!this.wrap) {\n return row.map(col => {\n return col.width || mixin.stringWidth(col.text);\n });\n }\n let unset = row.length;\n let remainingWidth = this.width;\n // column widths can be set in config.\n const widths = row.map(col => {\n if (col.width) {\n unset--;\n remainingWidth -= col.width;\n return col.width;\n }\n return undefined;\n });\n // any unset widths should be calculated.\n const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;\n return widths.map((w, i) => {\n if (w === undefined) {\n return Math.max(unsetWidth, _minWidth(row[i]));\n }\n return w;\n });\n }\n}\nfunction addBorder(col, ts, style) {\n if (col.border) {\n if (/[.']-+[.']/.test(ts)) {\n return '';\n }\n if (ts.trim().length !== 0) {\n return style;\n }\n return ' ';\n }\n return '';\n}\n// calculates the minimum width of\n// a column, based on padding preferences.\nfunction _minWidth(col) {\n const padding = col.padding || [];\n const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);\n if (col.border) {\n return minWidth + 4;\n }\n return minWidth;\n}\nfunction getWindowWidth() {\n /* c8 ignore next 5: depends on terminal */\n if (typeof process === 'object' && process.stdout && process.stdout.columns) {\n return process.stdout.columns;\n }\n return 80;\n}\nfunction alignRight(str, width) {\n str = str.trim();\n const strWidth = mixin.stringWidth(str);\n if (strWidth < width) {\n return ' '.repeat(width - strWidth) + str;\n }\n return str;\n}\nfunction alignCenter(str, width) {\n str = str.trim();\n const strWidth = mixin.stringWidth(str);\n /* c8 ignore next 3 */\n if (strWidth >= width) {\n return str;\n }\n return ' '.repeat((width - strWidth) >> 1) + str;\n}\nlet mixin;\nexport function cliui(opts, _mixin) {\n mixin = _mixin;\n return new UI({\n width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(),\n wrap: opts === null || opts === void 0 ? void 0 : opts.wrap\n });\n}\n","export default function ansiRegex({onlyFirst = false} = {}) {\n\t// Valid string terminator sequences are BEL, ESC\\, and 0x9c\n\tconst ST = '(?:\\\\u0007|\\\\u001B\\\\u005C|\\\\u009C)';\n\tconst pattern = [\n\t\t`[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?${ST})`,\n\t\t'(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]))',\n\t].join('|');\n\n\treturn new RegExp(pattern, onlyFirst ? undefined : 'g');\n}\n","import ansiRegex from 'ansi-regex';\n\nconst regex = ansiRegex();\n\nexport default function stripAnsi(string) {\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError(`Expected a \\`string\\`, got \\`${typeof string}\\``);\n\t}\n\n\t// Even though the regex is global, we don't need to reset the `.lastIndex`\n\t// because unlike `.exec()` and `.test()`, `.replace()` does it automatically\n\t// and doing it manually has a performance penalty.\n\treturn string.replace(regex, '');\n}\n","// Generated code.\n\nfunction isAmbiguous(x) {\n\treturn x === 0xA1\n\t\t|| x === 0xA4\n\t\t|| x === 0xA7\n\t\t|| x === 0xA8\n\t\t|| x === 0xAA\n\t\t|| x === 0xAD\n\t\t|| x === 0xAE\n\t\t|| x >= 0xB0 && x <= 0xB4\n\t\t|| x >= 0xB6 && x <= 0xBA\n\t\t|| x >= 0xBC && x <= 0xBF\n\t\t|| x === 0xC6\n\t\t|| x === 0xD0\n\t\t|| x === 0xD7\n\t\t|| x === 0xD8\n\t\t|| x >= 0xDE && x <= 0xE1\n\t\t|| x === 0xE6\n\t\t|| x >= 0xE8 && x <= 0xEA\n\t\t|| x === 0xEC\n\t\t|| x === 0xED\n\t\t|| x === 0xF0\n\t\t|| x === 0xF2\n\t\t|| x === 0xF3\n\t\t|| x >= 0xF7 && x <= 0xFA\n\t\t|| x === 0xFC\n\t\t|| x === 0xFE\n\t\t|| x === 0x101\n\t\t|| x === 0x111\n\t\t|| x === 0x113\n\t\t|| x === 0x11B\n\t\t|| x === 0x126\n\t\t|| x === 0x127\n\t\t|| x === 0x12B\n\t\t|| x >= 0x131 && x <= 0x133\n\t\t|| x === 0x138\n\t\t|| x >= 0x13F && x <= 0x142\n\t\t|| x === 0x144\n\t\t|| x >= 0x148 && x <= 0x14B\n\t\t|| x === 0x14D\n\t\t|| x === 0x152\n\t\t|| x === 0x153\n\t\t|| x === 0x166\n\t\t|| x === 0x167\n\t\t|| x === 0x16B\n\t\t|| x === 0x1CE\n\t\t|| x === 0x1D0\n\t\t|| x === 0x1D2\n\t\t|| x === 0x1D4\n\t\t|| x === 0x1D6\n\t\t|| x === 0x1D8\n\t\t|| x === 0x1DA\n\t\t|| x === 0x1DC\n\t\t|| x === 0x251\n\t\t|| x === 0x261\n\t\t|| x === 0x2C4\n\t\t|| x === 0x2C7\n\t\t|| x >= 0x2C9 && x <= 0x2CB\n\t\t|| x === 0x2CD\n\t\t|| x === 0x2D0\n\t\t|| x >= 0x2D8 && x <= 0x2DB\n\t\t|| x === 0x2DD\n\t\t|| x === 0x2DF\n\t\t|| x >= 0x300 && x <= 0x36F\n\t\t|| x >= 0x391 && x <= 0x3A1\n\t\t|| x >= 0x3A3 && x <= 0x3A9\n\t\t|| x >= 0x3B1 && x <= 0x3C1\n\t\t|| x >= 0x3C3 && x <= 0x3C9\n\t\t|| x === 0x401\n\t\t|| x >= 0x410 && x <= 0x44F\n\t\t|| x === 0x451\n\t\t|| x === 0x2010\n\t\t|| x >= 0x2013 && x <= 0x2016\n\t\t|| x === 0x2018\n\t\t|| x === 0x2019\n\t\t|| x === 0x201C\n\t\t|| x === 0x201D\n\t\t|| x >= 0x2020 && x <= 0x2022\n\t\t|| x >= 0x2024 && x <= 0x2027\n\t\t|| x === 0x2030\n\t\t|| x === 0x2032\n\t\t|| x === 0x2033\n\t\t|| x === 0x2035\n\t\t|| x === 0x203B\n\t\t|| x === 0x203E\n\t\t|| x === 0x2074\n\t\t|| x === 0x207F\n\t\t|| x >= 0x2081 && x <= 0x2084\n\t\t|| x === 0x20AC\n\t\t|| x === 0x2103\n\t\t|| x === 0x2105\n\t\t|| x === 0x2109\n\t\t|| x === 0x2113\n\t\t|| x === 0x2116\n\t\t|| x === 0x2121\n\t\t|| x === 0x2122\n\t\t|| x === 0x2126\n\t\t|| x === 0x212B\n\t\t|| x === 0x2153\n\t\t|| x === 0x2154\n\t\t|| x >= 0x215B && x <= 0x215E\n\t\t|| x >= 0x2160 && x <= 0x216B\n\t\t|| x >= 0x2170 && x <= 0x2179\n\t\t|| x === 0x2189\n\t\t|| x >= 0x2190 && x <= 0x2199\n\t\t|| x === 0x21B8\n\t\t|| x === 0x21B9\n\t\t|| x === 0x21D2\n\t\t|| x === 0x21D4\n\t\t|| x === 0x21E7\n\t\t|| x === 0x2200\n\t\t|| x === 0x2202\n\t\t|| x === 0x2203\n\t\t|| x === 0x2207\n\t\t|| x === 0x2208\n\t\t|| x === 0x220B\n\t\t|| x === 0x220F\n\t\t|| x === 0x2211\n\t\t|| x === 0x2215\n\t\t|| x === 0x221A\n\t\t|| x >= 0x221D && x <= 0x2220\n\t\t|| x === 0x2223\n\t\t|| x === 0x2225\n\t\t|| x >= 0x2227 && x <= 0x222C\n\t\t|| x === 0x222E\n\t\t|| x >= 0x2234 && x <= 0x2237\n\t\t|| x === 0x223C\n\t\t|| x === 0x223D\n\t\t|| x === 0x2248\n\t\t|| x === 0x224C\n\t\t|| x === 0x2252\n\t\t|| x === 0x2260\n\t\t|| x === 0x2261\n\t\t|| x >= 0x2264 && x <= 0x2267\n\t\t|| x === 0x226A\n\t\t|| x === 0x226B\n\t\t|| x === 0x226E\n\t\t|| x === 0x226F\n\t\t|| x === 0x2282\n\t\t|| x === 0x2283\n\t\t|| x === 0x2286\n\t\t|| x === 0x2287\n\t\t|| x === 0x2295\n\t\t|| x === 0x2299\n\t\t|| x === 0x22A5\n\t\t|| x === 0x22BF\n\t\t|| x === 0x2312\n\t\t|| x >= 0x2460 && x <= 0x24E9\n\t\t|| x >= 0x24EB && x <= 0x254B\n\t\t|| x >= 0x2550 && x <= 0x2573\n\t\t|| x >= 0x2580 && x <= 0x258F\n\t\t|| x >= 0x2592 && x <= 0x2595\n\t\t|| x === 0x25A0\n\t\t|| x === 0x25A1\n\t\t|| x >= 0x25A3 && x <= 0x25A9\n\t\t|| x === 0x25B2\n\t\t|| x === 0x25B3\n\t\t|| x === 0x25B6\n\t\t|| x === 0x25B7\n\t\t|| x === 0x25BC\n\t\t|| x === 0x25BD\n\t\t|| x === 0x25C0\n\t\t|| x === 0x25C1\n\t\t|| x >= 0x25C6 && x <= 0x25C8\n\t\t|| x === 0x25CB\n\t\t|| x >= 0x25CE && x <= 0x25D1\n\t\t|| x >= 0x25E2 && x <= 0x25E5\n\t\t|| x === 0x25EF\n\t\t|| x === 0x2605\n\t\t|| x === 0x2606\n\t\t|| x === 0x2609\n\t\t|| x === 0x260E\n\t\t|| x === 0x260F\n\t\t|| x === 0x261C\n\t\t|| x === 0x261E\n\t\t|| x === 0x2640\n\t\t|| x === 0x2642\n\t\t|| x === 0x2660\n\t\t|| x === 0x2661\n\t\t|| x >= 0x2663 && x <= 0x2665\n\t\t|| x >= 0x2667 && x <= 0x266A\n\t\t|| x === 0x266C\n\t\t|| x === 0x266D\n\t\t|| x === 0x266F\n\t\t|| x === 0x269E\n\t\t|| x === 0x269F\n\t\t|| x === 0x26BF\n\t\t|| x >= 0x26C6 && x <= 0x26CD\n\t\t|| x >= 0x26CF && x <= 0x26D3\n\t\t|| x >= 0x26D5 && x <= 0x26E1\n\t\t|| x === 0x26E3\n\t\t|| x === 0x26E8\n\t\t|| x === 0x26E9\n\t\t|| x >= 0x26EB && x <= 0x26F1\n\t\t|| x === 0x26F4\n\t\t|| x >= 0x26F6 && x <= 0x26F9\n\t\t|| x === 0x26FB\n\t\t|| x === 0x26FC\n\t\t|| x === 0x26FE\n\t\t|| x === 0x26FF\n\t\t|| x === 0x273D\n\t\t|| x >= 0x2776 && x <= 0x277F\n\t\t|| x >= 0x2B56 && x <= 0x2B59\n\t\t|| x >= 0x3248 && x <= 0x324F\n\t\t|| x >= 0xE000 && x <= 0xF8FF\n\t\t|| x >= 0xFE00 && x <= 0xFE0F\n\t\t|| x === 0xFFFD\n\t\t|| x >= 0x1F100 && x <= 0x1F10A\n\t\t|| x >= 0x1F110 && x <= 0x1F12D\n\t\t|| x >= 0x1F130 && x <= 0x1F169\n\t\t|| x >= 0x1F170 && x <= 0x1F18D\n\t\t|| x === 0x1F18F\n\t\t|| x === 0x1F190\n\t\t|| x >= 0x1F19B && x <= 0x1F1AC\n\t\t|| x >= 0xE0100 && x <= 0xE01EF\n\t\t|| x >= 0xF0000 && x <= 0xFFFFD\n\t\t|| x >= 0x100000 && x <= 0x10FFFD;\n}\n\nfunction isFullWidth(x) {\n\treturn x === 0x3000\n\t\t|| x >= 0xFF01 && x <= 0xFF60\n\t\t|| x >= 0xFFE0 && x <= 0xFFE6;\n}\n\nfunction isWide(x) {\n\treturn x >= 0x1100 && x <= 0x115F\n\t\t|| x === 0x231A\n\t\t|| x === 0x231B\n\t\t|| x === 0x2329\n\t\t|| x === 0x232A\n\t\t|| x >= 0x23E9 && x <= 0x23EC\n\t\t|| x === 0x23F0\n\t\t|| x === 0x23F3\n\t\t|| x === 0x25FD\n\t\t|| x === 0x25FE\n\t\t|| x === 0x2614\n\t\t|| x === 0x2615\n\t\t|| x >= 0x2630 && x <= 0x2637\n\t\t|| x >= 0x2648 && x <= 0x2653\n\t\t|| x === 0x267F\n\t\t|| x >= 0x268A && x <= 0x268F\n\t\t|| x === 0x2693\n\t\t|| x === 0x26A1\n\t\t|| x === 0x26AA\n\t\t|| x === 0x26AB\n\t\t|| x === 0x26BD\n\t\t|| x === 0x26BE\n\t\t|| x === 0x26C4\n\t\t|| x === 0x26C5\n\t\t|| x === 0x26CE\n\t\t|| x === 0x26D4\n\t\t|| x === 0x26EA\n\t\t|| x === 0x26F2\n\t\t|| x === 0x26F3\n\t\t|| x === 0x26F5\n\t\t|| x === 0x26FA\n\t\t|| x === 0x26FD\n\t\t|| x === 0x2705\n\t\t|| x === 0x270A\n\t\t|| x === 0x270B\n\t\t|| x === 0x2728\n\t\t|| x === 0x274C\n\t\t|| x === 0x274E\n\t\t|| x >= 0x2753 && x <= 0x2755\n\t\t|| x === 0x2757\n\t\t|| x >= 0x2795 && x <= 0x2797\n\t\t|| x === 0x27B0\n\t\t|| x === 0x27BF\n\t\t|| x === 0x2B1B\n\t\t|| x === 0x2B1C\n\t\t|| x === 0x2B50\n\t\t|| x === 0x2B55\n\t\t|| x >= 0x2E80 && x <= 0x2E99\n\t\t|| x >= 0x2E9B && x <= 0x2EF3\n\t\t|| x >= 0x2F00 && x <= 0x2FD5\n\t\t|| x >= 0x2FF0 && x <= 0x2FFF\n\t\t|| x >= 0x3001 && x <= 0x303E\n\t\t|| x >= 0x3041 && x <= 0x3096\n\t\t|| x >= 0x3099 && x <= 0x30FF\n\t\t|| x >= 0x3105 && x <= 0x312F\n\t\t|| x >= 0x3131 && x <= 0x318E\n\t\t|| x >= 0x3190 && x <= 0x31E5\n\t\t|| x >= 0x31EF && x <= 0x321E\n\t\t|| x >= 0x3220 && x <= 0x3247\n\t\t|| x >= 0x3250 && x <= 0xA48C\n\t\t|| x >= 0xA490 && x <= 0xA4C6\n\t\t|| x >= 0xA960 && x <= 0xA97C\n\t\t|| x >= 0xAC00 && x <= 0xD7A3\n\t\t|| x >= 0xF900 && x <= 0xFAFF\n\t\t|| x >= 0xFE10 && x <= 0xFE19\n\t\t|| x >= 0xFE30 && x <= 0xFE52\n\t\t|| x >= 0xFE54 && x <= 0xFE66\n\t\t|| x >= 0xFE68 && x <= 0xFE6B\n\t\t|| x >= 0x16FE0 && x <= 0x16FE4\n\t\t|| x === 0x16FF0\n\t\t|| x === 0x16FF1\n\t\t|| x >= 0x17000 && x <= 0x187F7\n\t\t|| x >= 0x18800 && x <= 0x18CD5\n\t\t|| x >= 0x18CFF && x <= 0x18D08\n\t\t|| x >= 0x1AFF0 && x <= 0x1AFF3\n\t\t|| x >= 0x1AFF5 && x <= 0x1AFFB\n\t\t|| x === 0x1AFFD\n\t\t|| x === 0x1AFFE\n\t\t|| x >= 0x1B000 && x <= 0x1B122\n\t\t|| x === 0x1B132\n\t\t|| x >= 0x1B150 && x <= 0x1B152\n\t\t|| x === 0x1B155\n\t\t|| x >= 0x1B164 && x <= 0x1B167\n\t\t|| x >= 0x1B170 && x <= 0x1B2FB\n\t\t|| x >= 0x1D300 && x <= 0x1D356\n\t\t|| x >= 0x1D360 && x <= 0x1D376\n\t\t|| x === 0x1F004\n\t\t|| x === 0x1F0CF\n\t\t|| x === 0x1F18E\n\t\t|| x >= 0x1F191 && x <= 0x1F19A\n\t\t|| x >= 0x1F200 && x <= 0x1F202\n\t\t|| x >= 0x1F210 && x <= 0x1F23B\n\t\t|| x >= 0x1F240 && x <= 0x1F248\n\t\t|| x === 0x1F250\n\t\t|| x === 0x1F251\n\t\t|| x >= 0x1F260 && x <= 0x1F265\n\t\t|| x >= 0x1F300 && x <= 0x1F320\n\t\t|| x >= 0x1F32D && x <= 0x1F335\n\t\t|| x >= 0x1F337 && x <= 0x1F37C\n\t\t|| x >= 0x1F37E && x <= 0x1F393\n\t\t|| x >= 0x1F3A0 && x <= 0x1F3CA\n\t\t|| x >= 0x1F3CF && x <= 0x1F3D3\n\t\t|| x >= 0x1F3E0 && x <= 0x1F3F0\n\t\t|| x === 0x1F3F4\n\t\t|| x >= 0x1F3F8 && x <= 0x1F43E\n\t\t|| x === 0x1F440\n\t\t|| x >= 0x1F442 && x <= 0x1F4FC\n\t\t|| x >= 0x1F4FF && x <= 0x1F53D\n\t\t|| x >= 0x1F54B && x <= 0x1F54E\n\t\t|| x >= 0x1F550 && x <= 0x1F567\n\t\t|| x === 0x1F57A\n\t\t|| x === 0x1F595\n\t\t|| x === 0x1F596\n\t\t|| x === 0x1F5A4\n\t\t|| x >= 0x1F5FB && x <= 0x1F64F\n\t\t|| x >= 0x1F680 && x <= 0x1F6C5\n\t\t|| x === 0x1F6CC\n\t\t|| x >= 0x1F6D0 && x <= 0x1F6D2\n\t\t|| x >= 0x1F6D5 && x <= 0x1F6D7\n\t\t|| x >= 0x1F6DC && x <= 0x1F6DF\n\t\t|| x === 0x1F6EB\n\t\t|| x === 0x1F6EC\n\t\t|| x >= 0x1F6F4 && x <= 0x1F6FC\n\t\t|| x >= 0x1F7E0 && x <= 0x1F7EB\n\t\t|| x === 0x1F7F0\n\t\t|| x >= 0x1F90C && x <= 0x1F93A\n\t\t|| x >= 0x1F93C && x <= 0x1F945\n\t\t|| x >= 0x1F947 && x <= 0x1F9FF\n\t\t|| x >= 0x1FA70 && x <= 0x1FA7C\n\t\t|| x >= 0x1FA80 && x <= 0x1FA89\n\t\t|| x >= 0x1FA8F && x <= 0x1FAC6\n\t\t|| x >= 0x1FACE && x <= 0x1FADC\n\t\t|| x >= 0x1FADF && x <= 0x1FAE9\n\t\t|| x >= 0x1FAF0 && x <= 0x1FAF8\n\t\t|| x >= 0x20000 && x <= 0x2FFFD\n\t\t|| x >= 0x30000 && x <= 0x3FFFD;\n}\n\nfunction getCategory(x) {\n\tif (isAmbiguous(x)) return 'ambiguous';\n\n\tif (isFullWidth(x)) return 'fullwidth';\n\n\tif (\n\t\tx === 0x20A9\n\t\t|| x >= 0xFF61 && x <= 0xFFBE\n\t\t|| x >= 0xFFC2 && x <= 0xFFC7\n\t\t|| x >= 0xFFCA && x <= 0xFFCF\n\t\t|| x >= 0xFFD2 && x <= 0xFFD7\n\t\t|| x >= 0xFFDA && x <= 0xFFDC\n\t\t|| x >= 0xFFE8 && x <= 0xFFEE\n\t) {\n\t\treturn 'halfwidth';\n\t}\n\n\tif (\n\t\tx >= 0x20 && x <= 0x7E\n\t\t|| x === 0xA2\n\t\t|| x === 0xA3\n\t\t|| x === 0xA5\n\t\t|| x === 0xA6\n\t\t|| x === 0xAC\n\t\t|| x === 0xAF\n\t\t|| x >= 0x27E6 && x <= 0x27ED\n\t\t|| x === 0x2985\n\t\t|| x === 0x2986\n\t) {\n\t\treturn 'narrow';\n\t}\n\n\tif (isWide(x)) return 'wide';\n\n\treturn 'neutral';\n}\n\nexport {isAmbiguous, isFullWidth, isWide, getCategory};\n","import {getCategory, isAmbiguous, isFullWidth, isWide} from './lookup.js';\n\nfunction validate(codePoint) {\n\tif (!Number.isSafeInteger(codePoint)) {\n\t\tthrow new TypeError(`Expected a code point, got \\`${typeof codePoint}\\`.`);\n\t}\n}\n\nexport function eastAsianWidthType(codePoint) {\n\tvalidate(codePoint);\n\n\treturn getCategory(codePoint);\n}\n\nexport function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {\n\tvalidate(codePoint);\n\n\tif (\n\t\tisFullWidth(codePoint)\n\t\t|| isWide(codePoint)\n\t\t|| (ambiguousAsWide && isAmbiguous(codePoint))\n\t) {\n\t\treturn 2;\n\t}\n\n\treturn 1;\n}\n\n// For Prettier. This doesn't count \"ambiguous\" characters or check for valid input.\n// https://github.com/sindresorhus/get-east-asian-width/pull/6\nexport const _isNarrowWidth = codePoint => !(isFullWidth(codePoint) || isWide(codePoint));\n","module.exports = () => {\n\t// https://mths.be/emoji\n\treturn /[#*0-9]\\uFE0F?\\u20E3|[\\xA9\\xAE\\u203C\\u2049\\u2122\\u2139\\u2194-\\u2199\\u21A9\\u21AA\\u231A\\u231B\\u2328\\u23CF\\u23ED-\\u23EF\\u23F1\\u23F2\\u23F8-\\u23FA\\u24C2\\u25AA\\u25AB\\u25B6\\u25C0\\u25FB\\u25FC\\u25FE\\u2600-\\u2604\\u260E\\u2611\\u2614\\u2615\\u2618\\u2620\\u2622\\u2623\\u2626\\u262A\\u262E\\u262F\\u2638-\\u263A\\u2640\\u2642\\u2648-\\u2653\\u265F\\u2660\\u2663\\u2665\\u2666\\u2668\\u267B\\u267E\\u267F\\u2692\\u2694-\\u2697\\u2699\\u269B\\u269C\\u26A0\\u26A7\\u26AA\\u26B0\\u26B1\\u26BD\\u26BE\\u26C4\\u26C8\\u26CF\\u26D1\\u26E9\\u26F0-\\u26F5\\u26F7\\u26F8\\u26FA\\u2702\\u2708\\u2709\\u270F\\u2712\\u2714\\u2716\\u271D\\u2721\\u2733\\u2734\\u2744\\u2747\\u2757\\u2763\\u27A1\\u2934\\u2935\\u2B05-\\u2B07\\u2B1B\\u2B1C\\u2B55\\u3030\\u303D\\u3297\\u3299]\\uFE0F?|[\\u261D\\u270C\\u270D](?:\\uD83C[\\uDFFB-\\uDFFF]|\\uFE0F)?|[\\u270A\\u270B](?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\u23E9-\\u23EC\\u23F0\\u23F3\\u25FD\\u2693\\u26A1\\u26AB\\u26C5\\u26CE\\u26D4\\u26EA\\u26FD\\u2705\\u2728\\u274C\\u274E\\u2753-\\u2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