sandbox 2.0.0-alpha5 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -12
- package/README.md +18 -93
- package/bin/sandbox.mjs +3 -0
- package/dist/ansi-styles-B57ln_zO.mjs +168 -0
- package/dist/ansi-styles-B57ln_zO.mjs.map +1 -0
- package/dist/app-BQds8e4O.mjs +14168 -0
- package/dist/app-BQds8e4O.mjs.map +1 -0
- package/dist/chunk-btbCw1m3.mjs +52 -0
- package/dist/cli-cursor-Dab4mDU2.mjs +348 -0
- package/dist/cli-cursor-Dab4mDU2.mjs.map +1 -0
- package/dist/cli-truncate-DMIDACmY.mjs +124 -0
- package/dist/cli-truncate-DMIDACmY.mjs.map +1 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +17 -0
- package/dist/index.mjs.map +1 -0
- package/dist/log-update-txb7Or7B.mjs +223 -0
- package/dist/log-update-txb7Or7B.mjs.map +1 -0
- package/dist/pty-server-linux-x86_64 +0 -0
- package/dist/sandbox.d.mts +1 -0
- package/dist/sandbox.mjs +647 -0
- package/dist/sandbox.mjs.map +1 -0
- package/dist/string-width-D78SVDLD.mjs +85 -0
- package/dist/string-width-D78SVDLD.mjs.map +1 -0
- package/dist/token-Bwtve9Y6.mjs +51 -0
- package/dist/token-Bwtve9Y6.mjs.map +1 -0
- package/dist/token-error-C0CafU2G.mjs +43 -0
- package/dist/token-error-C0CafU2G.mjs.map +1 -0
- package/dist/token-util-BpWskZEO.mjs +357 -0
- package/dist/token-util-BpWskZEO.mjs.map +1 -0
- package/dist/token-util-CRAtcwBI.mjs +6 -0
- package/dist/wrap-ansi-CEi7ZT5i.mjs +5 -0
- package/dist/wrap-ansi-DoQ74EEn.mjs +130 -0
- package/dist/wrap-ansi-DoQ74EEn.mjs.map +1 -0
- package/package.json +52 -31
- package/index.js +0 -29
- package/install.js +0 -5
- package/platform-target.js +0 -217
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { a as stripAnsi, i as init_strip_ansi, n as isFullWidth, r as isWide } from "./string-width-D78SVDLD.mjs";
|
|
2
|
+
import { t as cli_cursor_default } from "./cli-cursor-Dab4mDU2.mjs";
|
|
3
|
+
import { t as ansi_styles_default } from "./ansi-styles-B57ln_zO.mjs";
|
|
4
|
+
import { t as wrapAnsi } from "./wrap-ansi-DoQ74EEn.mjs";
|
|
5
|
+
import process from "node:process";
|
|
6
|
+
|
|
7
|
+
//#region ../../node_modules/.pnpm/environment@1.1.0/node_modules/environment/index.js
|
|
8
|
+
const isBrowser = globalThis.window?.document !== void 0;
|
|
9
|
+
const isNode = globalThis.process?.versions?.node !== void 0;
|
|
10
|
+
const isBun = globalThis.process?.versions?.bun !== void 0;
|
|
11
|
+
const isDeno = globalThis.Deno?.version?.deno !== void 0;
|
|
12
|
+
const isElectron = globalThis.process?.versions?.electron !== void 0;
|
|
13
|
+
const isJsDom = globalThis.navigator?.userAgent?.includes("jsdom") === true;
|
|
14
|
+
const isWebWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
15
|
+
const isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== "undefined" && globalThis instanceof DedicatedWorkerGlobalScope;
|
|
16
|
+
const isSharedWorker = typeof SharedWorkerGlobalScope !== "undefined" && globalThis instanceof SharedWorkerGlobalScope;
|
|
17
|
+
const isServiceWorker = typeof ServiceWorkerGlobalScope !== "undefined" && globalThis instanceof ServiceWorkerGlobalScope;
|
|
18
|
+
const platform = globalThis.navigator?.userAgentData?.platform;
|
|
19
|
+
const isMacOs = platform === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === true || globalThis.process?.platform === "darwin";
|
|
20
|
+
const isWindows$1 = platform === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform === "win32";
|
|
21
|
+
const isLinux = platform === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === true || globalThis.navigator?.userAgent?.includes(" Linux ") === true || globalThis.process?.platform === "linux";
|
|
22
|
+
const isIos = platform === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
|
|
23
|
+
const isAndroid = platform === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform === "android";
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region ../../node_modules/.pnpm/ansi-escapes@7.1.0/node_modules/ansi-escapes/base.js
|
|
27
|
+
const ESC = "\x1B[";
|
|
28
|
+
const isTerminalApp = !isBrowser && process.env.TERM_PROGRAM === "Apple_Terminal";
|
|
29
|
+
const isWindows = !isBrowser && process.platform === "win32";
|
|
30
|
+
const cwdFunction = isBrowser ? () => {
|
|
31
|
+
throw new Error("`process.cwd()` only works in Node.js, not the browser.");
|
|
32
|
+
} : process.cwd;
|
|
33
|
+
const cursorUp = (count = 1) => ESC + count + "A";
|
|
34
|
+
const cursorLeft = ESC + "G";
|
|
35
|
+
const cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
|
|
36
|
+
const cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
|
|
37
|
+
const cursorGetPosition = ESC + "6n";
|
|
38
|
+
const cursorNextLine = ESC + "E";
|
|
39
|
+
const cursorPrevLine = ESC + "F";
|
|
40
|
+
const cursorHide = ESC + "?25l";
|
|
41
|
+
const cursorShow = ESC + "?25h";
|
|
42
|
+
const eraseLines = (count) => {
|
|
43
|
+
let clear = "";
|
|
44
|
+
for (let i = 0; i < count; i++) clear += eraseLine + (i < count - 1 ? cursorUp() : "");
|
|
45
|
+
if (count) clear += cursorLeft;
|
|
46
|
+
return clear;
|
|
47
|
+
};
|
|
48
|
+
const eraseEndLine = ESC + "K";
|
|
49
|
+
const eraseStartLine = ESC + "1K";
|
|
50
|
+
const eraseLine = ESC + "2K";
|
|
51
|
+
const eraseDown = ESC + "J";
|
|
52
|
+
const eraseUp = ESC + "1J";
|
|
53
|
+
const eraseScreen = ESC + "2J";
|
|
54
|
+
const scrollUp = ESC + "S";
|
|
55
|
+
const scrollDown = ESC + "T";
|
|
56
|
+
const clearViewport = `${eraseScreen}${ESC}H`;
|
|
57
|
+
const clearTerminal = isWindows ? `${eraseScreen}${ESC}0f` : `${eraseScreen}${ESC}3J${ESC}H`;
|
|
58
|
+
const enterAlternativeScreen = ESC + "?1049h";
|
|
59
|
+
const exitAlternativeScreen = ESC + "?1049l";
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region ../../node_modules/.pnpm/is-fullwidth-code-point@5.1.0/node_modules/is-fullwidth-code-point/index.js
|
|
63
|
+
function isFullwidthCodePoint(codePoint) {
|
|
64
|
+
if (!Number.isInteger(codePoint)) return false;
|
|
65
|
+
return isFullWidth(codePoint) || isWide(codePoint);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region ../../node_modules/.pnpm/slice-ansi@7.1.0/node_modules/slice-ansi/index.js
|
|
70
|
+
const ESCAPES = new Set([27, 155]);
|
|
71
|
+
const CODE_POINT_0 = "0".codePointAt(0);
|
|
72
|
+
const CODE_POINT_9 = "9".codePointAt(0);
|
|
73
|
+
const endCodesSet = /* @__PURE__ */ new Set();
|
|
74
|
+
const endCodesMap = /* @__PURE__ */ new Map();
|
|
75
|
+
for (const [start, end] of ansi_styles_default.codes) {
|
|
76
|
+
endCodesSet.add(ansi_styles_default.color.ansi(end));
|
|
77
|
+
endCodesMap.set(ansi_styles_default.color.ansi(start), ansi_styles_default.color.ansi(end));
|
|
78
|
+
}
|
|
79
|
+
function getEndCode(code) {
|
|
80
|
+
if (endCodesSet.has(code)) return code;
|
|
81
|
+
if (endCodesMap.has(code)) return endCodesMap.get(code);
|
|
82
|
+
code = code.slice(2);
|
|
83
|
+
if (code.includes(";")) code = code[0] + "0";
|
|
84
|
+
const returnValue = ansi_styles_default.codes.get(Number.parseInt(code, 10));
|
|
85
|
+
if (returnValue) return ansi_styles_default.color.ansi(returnValue);
|
|
86
|
+
return ansi_styles_default.reset.open;
|
|
87
|
+
}
|
|
88
|
+
function findNumberIndex(string) {
|
|
89
|
+
for (let index = 0; index < string.length; index++) {
|
|
90
|
+
const codePoint = string.codePointAt(index);
|
|
91
|
+
if (codePoint >= CODE_POINT_0 && codePoint <= CODE_POINT_9) return index;
|
|
92
|
+
}
|
|
93
|
+
return -1;
|
|
94
|
+
}
|
|
95
|
+
function parseAnsiCode(string, offset) {
|
|
96
|
+
string = string.slice(offset, offset + 19);
|
|
97
|
+
const startIndex = findNumberIndex(string);
|
|
98
|
+
if (startIndex !== -1) {
|
|
99
|
+
let endIndex = string.indexOf("m", startIndex);
|
|
100
|
+
if (endIndex === -1) endIndex = string.length;
|
|
101
|
+
return string.slice(0, endIndex + 1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function tokenize(string, endCharacter = Number.POSITIVE_INFINITY) {
|
|
105
|
+
const returnValue = [];
|
|
106
|
+
let index = 0;
|
|
107
|
+
let visibleCount = 0;
|
|
108
|
+
while (index < string.length) {
|
|
109
|
+
const codePoint = string.codePointAt(index);
|
|
110
|
+
if (ESCAPES.has(codePoint)) {
|
|
111
|
+
const code = parseAnsiCode(string, index);
|
|
112
|
+
if (code) {
|
|
113
|
+
returnValue.push({
|
|
114
|
+
type: "ansi",
|
|
115
|
+
code,
|
|
116
|
+
endCode: getEndCode(code)
|
|
117
|
+
});
|
|
118
|
+
index += code.length;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const isFullWidth$1 = isFullwidthCodePoint(codePoint);
|
|
123
|
+
const character = String.fromCodePoint(codePoint);
|
|
124
|
+
returnValue.push({
|
|
125
|
+
type: "character",
|
|
126
|
+
value: character,
|
|
127
|
+
isFullWidth: isFullWidth$1
|
|
128
|
+
});
|
|
129
|
+
index += character.length;
|
|
130
|
+
visibleCount += isFullWidth$1 ? 2 : character.length;
|
|
131
|
+
if (visibleCount >= endCharacter) break;
|
|
132
|
+
}
|
|
133
|
+
return returnValue;
|
|
134
|
+
}
|
|
135
|
+
function reduceAnsiCodes(codes) {
|
|
136
|
+
let returnValue = [];
|
|
137
|
+
for (const code of codes) if (code.code === ansi_styles_default.reset.open) returnValue = [];
|
|
138
|
+
else if (endCodesSet.has(code.code)) returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.code);
|
|
139
|
+
else {
|
|
140
|
+
returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.endCode);
|
|
141
|
+
returnValue.push(code);
|
|
142
|
+
}
|
|
143
|
+
return returnValue;
|
|
144
|
+
}
|
|
145
|
+
function undoAnsiCodes(codes) {
|
|
146
|
+
return reduceAnsiCodes(codes).map(({ endCode }) => endCode).reverse().join("");
|
|
147
|
+
}
|
|
148
|
+
function sliceAnsi(string, start, end) {
|
|
149
|
+
const tokens = tokenize(string, end);
|
|
150
|
+
let activeCodes = [];
|
|
151
|
+
let position = 0;
|
|
152
|
+
let returnValue = "";
|
|
153
|
+
let include = false;
|
|
154
|
+
for (const token of tokens) {
|
|
155
|
+
if (end !== void 0 && position >= end) break;
|
|
156
|
+
if (token.type === "ansi") {
|
|
157
|
+
activeCodes.push(token);
|
|
158
|
+
if (include) returnValue += token.code;
|
|
159
|
+
} else {
|
|
160
|
+
if (!include && position >= start) {
|
|
161
|
+
include = true;
|
|
162
|
+
activeCodes = reduceAnsiCodes(activeCodes);
|
|
163
|
+
returnValue = activeCodes.map(({ code }) => code).join("");
|
|
164
|
+
}
|
|
165
|
+
if (include) returnValue += token.value;
|
|
166
|
+
position += token.isFullWidth ? 2 : token.value.length;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
returnValue += undoAnsiCodes(activeCodes);
|
|
170
|
+
return returnValue;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region ../../node_modules/.pnpm/log-update@6.1.0/node_modules/log-update/index.js
|
|
175
|
+
init_strip_ansi();
|
|
176
|
+
const defaultTerminalHeight = 24;
|
|
177
|
+
const getWidth = ({ columns = 80 }) => columns;
|
|
178
|
+
const fitToTerminalHeight = (stream, text) => {
|
|
179
|
+
const terminalHeight = stream.rows ?? defaultTerminalHeight;
|
|
180
|
+
const lines = text.split("\n");
|
|
181
|
+
const toRemove = Math.max(0, lines.length - terminalHeight);
|
|
182
|
+
return toRemove ? sliceAnsi(text, stripAnsi(lines.slice(0, toRemove).join("\n")).length + 1) : text;
|
|
183
|
+
};
|
|
184
|
+
function createLogUpdate(stream, { showCursor = false } = {}) {
|
|
185
|
+
let previousLineCount = 0;
|
|
186
|
+
let previousWidth = getWidth(stream);
|
|
187
|
+
let previousOutput = "";
|
|
188
|
+
const reset = () => {
|
|
189
|
+
previousOutput = "";
|
|
190
|
+
previousWidth = getWidth(stream);
|
|
191
|
+
previousLineCount = 0;
|
|
192
|
+
};
|
|
193
|
+
const render = (...arguments_) => {
|
|
194
|
+
if (!showCursor) cli_cursor_default.hide();
|
|
195
|
+
let output = fitToTerminalHeight(stream, arguments_.join(" ") + "\n");
|
|
196
|
+
const width = getWidth(stream);
|
|
197
|
+
if (output === previousOutput && previousWidth === width) return;
|
|
198
|
+
previousOutput = output;
|
|
199
|
+
previousWidth = width;
|
|
200
|
+
output = wrapAnsi(output, width, {
|
|
201
|
+
trim: false,
|
|
202
|
+
hard: true,
|
|
203
|
+
wordWrap: false
|
|
204
|
+
});
|
|
205
|
+
stream.write(eraseLines(previousLineCount) + output);
|
|
206
|
+
previousLineCount = output.split("\n").length;
|
|
207
|
+
};
|
|
208
|
+
render.clear = () => {
|
|
209
|
+
stream.write(eraseLines(previousLineCount));
|
|
210
|
+
reset();
|
|
211
|
+
};
|
|
212
|
+
render.done = () => {
|
|
213
|
+
reset();
|
|
214
|
+
if (!showCursor) cli_cursor_default.show();
|
|
215
|
+
};
|
|
216
|
+
return render;
|
|
217
|
+
}
|
|
218
|
+
const logUpdate = createLogUpdate(process.stdout);
|
|
219
|
+
const logUpdateStderr = createLogUpdate(process.stderr);
|
|
220
|
+
|
|
221
|
+
//#endregion
|
|
222
|
+
export { createLogUpdate };
|
|
223
|
+
//# sourceMappingURL=log-update-txb7Or7B.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-update-txb7Or7B.mjs","names":["isWindows","ansiStyles","isFullWidth","ansiEscapes.eraseLines"],"sources":["../../../node_modules/.pnpm/environment@1.1.0/node_modules/environment/index.js","../../../node_modules/.pnpm/ansi-escapes@7.1.0/node_modules/ansi-escapes/base.js","../../../node_modules/.pnpm/is-fullwidth-code-point@5.1.0/node_modules/is-fullwidth-code-point/index.js","../../../node_modules/.pnpm/slice-ansi@7.1.0/node_modules/slice-ansi/index.js","../../../node_modules/.pnpm/log-update@6.1.0/node_modules/log-update/index.js"],"sourcesContent":["/* globals WorkerGlobalScope, DedicatedWorkerGlobalScope, SharedWorkerGlobalScope, ServiceWorkerGlobalScope */\n\nexport const isBrowser = globalThis.window?.document !== undefined;\n\nexport const isNode = globalThis.process?.versions?.node !== undefined;\n\nexport const isBun = globalThis.process?.versions?.bun !== undefined;\n\nexport const isDeno = globalThis.Deno?.version?.deno !== undefined;\n\nexport const isElectron = globalThis.process?.versions?.electron !== undefined;\n\nexport const isJsDom = globalThis.navigator?.userAgent?.includes('jsdom') === true;\n\nexport const isWebWorker = typeof WorkerGlobalScope !== 'undefined' && globalThis instanceof WorkerGlobalScope;\n\nexport const isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== 'undefined' && globalThis instanceof DedicatedWorkerGlobalScope;\n\nexport const isSharedWorker = typeof SharedWorkerGlobalScope !== 'undefined' && globalThis instanceof SharedWorkerGlobalScope;\n\nexport const isServiceWorker = typeof ServiceWorkerGlobalScope !== 'undefined' && globalThis instanceof ServiceWorkerGlobalScope;\n\n// Note: I'm intentionally not DRYing up the other variables to keep them \"lazy\".\nconst platform = globalThis.navigator?.userAgentData?.platform;\n\nexport const isMacOs = platform === 'macOS'\n\t|| globalThis.navigator?.platform === 'MacIntel' // Even on Apple silicon Macs.\n\t|| globalThis.navigator?.userAgent?.includes(' Mac ') === true\n\t|| globalThis.process?.platform === 'darwin';\n\nexport const isWindows = platform === 'Windows'\n\t|| globalThis.navigator?.platform === 'Win32'\n\t|| globalThis.process?.platform === 'win32';\n\nexport const isLinux = platform === 'Linux'\n\t|| globalThis.navigator?.platform?.startsWith('Linux') === true\n\t|| globalThis.navigator?.userAgent?.includes(' Linux ') === true\n\t|| globalThis.process?.platform === 'linux';\n\nexport const isIos = platform === 'iOS'\n\t|| (globalThis.navigator?.platform === 'MacIntel' && globalThis.navigator?.maxTouchPoints > 1)\n\t|| /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);\n\nexport const isAndroid = platform === 'Android'\n\t|| globalThis.navigator?.platform === 'Android'\n\t|| globalThis.navigator?.userAgent?.includes(' Android ') === true\n\t|| globalThis.process?.platform === 'android';\n","import process from 'node:process';\nimport {isBrowser} from 'environment';\n\nconst ESC = '\\u001B[';\nconst OSC = '\\u001B]';\nconst BEL = '\\u0007';\nconst SEP = ';';\n\nconst isTerminalApp = !isBrowser && process.env.TERM_PROGRAM === 'Apple_Terminal';\nconst isWindows = !isBrowser && process.platform === 'win32';\n\nconst cwdFunction = isBrowser ? () => {\n\tthrow new Error('`process.cwd()` only works in Node.js, not the browser.');\n} : process.cwd;\n\nexport const cursorTo = (x, y) => {\n\tif (typeof x !== 'number') {\n\t\tthrow new TypeError('The `x` argument is required');\n\t}\n\n\tif (typeof y !== 'number') {\n\t\treturn ESC + (x + 1) + 'G';\n\t}\n\n\treturn ESC + (y + 1) + SEP + (x + 1) + 'H';\n};\n\nexport const cursorMove = (x, y) => {\n\tif (typeof x !== 'number') {\n\t\tthrow new TypeError('The `x` argument is required');\n\t}\n\n\tlet returnValue = '';\n\n\tif (x < 0) {\n\t\treturnValue += ESC + (-x) + 'D';\n\t} else if (x > 0) {\n\t\treturnValue += ESC + x + 'C';\n\t}\n\n\tif (y < 0) {\n\t\treturnValue += ESC + (-y) + 'A';\n\t} else if (y > 0) {\n\t\treturnValue += ESC + y + 'B';\n\t}\n\n\treturn returnValue;\n};\n\nexport const cursorUp = (count = 1) => ESC + count + 'A';\nexport const cursorDown = (count = 1) => ESC + count + 'B';\nexport const cursorForward = (count = 1) => ESC + count + 'C';\nexport const cursorBackward = (count = 1) => ESC + count + 'D';\n\nexport const cursorLeft = ESC + 'G';\nexport const cursorSavePosition = isTerminalApp ? '\\u001B7' : ESC + 's';\nexport const cursorRestorePosition = isTerminalApp ? '\\u001B8' : ESC + 'u';\nexport const cursorGetPosition = ESC + '6n';\nexport const cursorNextLine = ESC + 'E';\nexport const cursorPrevLine = ESC + 'F';\nexport const cursorHide = ESC + '?25l';\nexport const cursorShow = ESC + '?25h';\n\nexport const eraseLines = count => {\n\tlet clear = '';\n\n\tfor (let i = 0; i < count; i++) {\n\t\tclear += eraseLine + (i < count - 1 ? cursorUp() : '');\n\t}\n\n\tif (count) {\n\t\tclear += cursorLeft;\n\t}\n\n\treturn clear;\n};\n\nexport const eraseEndLine = ESC + 'K';\nexport const eraseStartLine = ESC + '1K';\nexport const eraseLine = ESC + '2K';\nexport const eraseDown = ESC + 'J';\nexport const eraseUp = ESC + '1J';\nexport const eraseScreen = ESC + '2J';\nexport const scrollUp = ESC + 'S';\nexport const scrollDown = ESC + 'T';\n\nexport const clearScreen = '\\u001Bc';\n\nexport const clearViewport = `${eraseScreen}${ESC}H`;\n\nexport const clearTerminal = isWindows\n\t? `${eraseScreen}${ESC}0f`\n\t// 1. Erases the screen (Only done in case `2` is not supported)\n\t// 2. Erases the whole screen including scrollback buffer\n\t// 3. Moves cursor to the top-left position\n\t// More info: https://www.real-world-systems.com/docs/ANSIcode.html\n\t:\t`${eraseScreen}${ESC}3J${ESC}H`;\n\nexport const enterAlternativeScreen = ESC + '?1049h';\nexport const exitAlternativeScreen = ESC + '?1049l';\n\nexport const beep = BEL;\n\nexport const link = (text, url) => [\n\tOSC,\n\t'8',\n\tSEP,\n\tSEP,\n\turl,\n\tBEL,\n\ttext,\n\tOSC,\n\t'8',\n\tSEP,\n\tSEP,\n\tBEL,\n].join('');\n\nexport const image = (data, options = {}) => {\n\tlet returnValue = `${OSC}1337;File=inline=1`;\n\n\tif (options.width) {\n\t\treturnValue += `;width=${options.width}`;\n\t}\n\n\tif (options.height) {\n\t\treturnValue += `;height=${options.height}`;\n\t}\n\n\tif (options.preserveAspectRatio === false) {\n\t\treturnValue += ';preserveAspectRatio=0';\n\t}\n\n\treturn returnValue + ':' + Buffer.from(data).toString('base64') + BEL;\n};\n\nexport const iTerm = {\n\tsetCwd: (cwd = cwdFunction()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,\n\n\tannotation(message, options = {}) {\n\t\tlet returnValue = `${OSC}1337;`;\n\n\t\tconst hasX = options.x !== undefined;\n\t\tconst hasY = options.y !== undefined;\n\t\tif ((hasX || hasY) && !(hasX && hasY && options.length !== undefined)) {\n\t\t\tthrow new Error('`x`, `y` and `length` must be defined when `x` or `y` is defined');\n\t\t}\n\n\t\tmessage = message.replaceAll('|', '');\n\n\t\treturnValue += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation=';\n\n\t\tif (options.length > 0) {\n\t\t\treturnValue += (\n\t\t\t\thasX\n\t\t\t\t\t? [message, options.length, options.x, options.y]\n\t\t\t\t\t: [options.length, message]\n\t\t\t).join('|');\n\t\t} else {\n\t\t\treturnValue += message;\n\t\t}\n\n\t\treturn returnValue + BEL;\n\t},\n};\n\nexport const ConEmu = {\n\tsetCwd: (cwd = cwdFunction()) => `${OSC}9;9;${cwd}${BEL}`,\n};\n\nexport const setCwd = (cwd = cwdFunction()) => iTerm.setCwd(cwd) + ConEmu.setCwd(cwd);\n","import {\n\t_isFullWidth as isFullWidth,\n\t_isWide as isWide,\n} from 'get-east-asian-width';\n\nexport default function isFullwidthCodePoint(codePoint) {\n\tif (!Number.isInteger(codePoint)) {\n\t\treturn false;\n\t}\n\n\treturn isFullWidth(codePoint) || isWide(codePoint);\n}\n","import ansiStyles from 'ansi-styles';\nimport isFullwidthCodePoint from 'is-fullwidth-code-point';\n\n// \\x1b and \\x9b\nconst ESCAPES = new Set([27, 155]);\n\nconst CODE_POINT_0 = '0'.codePointAt(0);\nconst CODE_POINT_9 = '9'.codePointAt(0);\n\nconst endCodesSet = new Set();\nconst endCodesMap = new Map();\nfor (const [start, end] of ansiStyles.codes) {\n\tendCodesSet.add(ansiStyles.color.ansi(end));\n\tendCodesMap.set(ansiStyles.color.ansi(start), ansiStyles.color.ansi(end));\n}\n\nfunction getEndCode(code) {\n\tif (endCodesSet.has(code)) {\n\t\treturn code;\n\t}\n\n\tif (endCodesMap.has(code)) {\n\t\treturn endCodesMap.get(code);\n\t}\n\n\tcode = code.slice(2);\n\tif (code.includes(';')) {\n\t\tcode = code[0] + '0';\n\t}\n\n\tconst returnValue = ansiStyles.codes.get(Number.parseInt(code, 10));\n\tif (returnValue) {\n\t\treturn ansiStyles.color.ansi(returnValue);\n\t}\n\n\treturn ansiStyles.reset.open;\n}\n\nfunction findNumberIndex(string) {\n\tfor (let index = 0; index < string.length; index++) {\n\t\tconst codePoint = string.codePointAt(index);\n\t\tif (codePoint >= CODE_POINT_0 && codePoint <= CODE_POINT_9) {\n\t\t\treturn index;\n\t\t}\n\t}\n\n\treturn -1;\n}\n\nfunction parseAnsiCode(string, offset) {\n\tstring = string.slice(offset, offset + 19);\n\tconst startIndex = findNumberIndex(string);\n\tif (startIndex !== -1) {\n\t\tlet endIndex = string.indexOf('m', startIndex);\n\t\tif (endIndex === -1) {\n\t\t\tendIndex = string.length;\n\t\t}\n\n\t\treturn string.slice(0, endIndex + 1);\n\t}\n}\n\nfunction tokenize(string, endCharacter = Number.POSITIVE_INFINITY) {\n\tconst returnValue = [];\n\n\tlet index = 0;\n\tlet visibleCount = 0;\n\twhile (index < string.length) {\n\t\tconst codePoint = string.codePointAt(index);\n\n\t\tif (ESCAPES.has(codePoint)) {\n\t\t\tconst code = parseAnsiCode(string, index);\n\t\t\tif (code) {\n\t\t\t\treturnValue.push({\n\t\t\t\t\ttype: 'ansi',\n\t\t\t\t\tcode,\n\t\t\t\t\tendCode: getEndCode(code),\n\t\t\t\t});\n\t\t\t\tindex += code.length;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tconst isFullWidth = isFullwidthCodePoint(codePoint);\n\t\tconst character = String.fromCodePoint(codePoint);\n\n\t\treturnValue.push({\n\t\t\ttype: 'character',\n\t\t\tvalue: character,\n\t\t\tisFullWidth,\n\t\t});\n\n\t\tindex += character.length;\n\t\tvisibleCount += isFullWidth ? 2 : character.length;\n\n\t\tif (visibleCount >= endCharacter) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn returnValue;\n}\n\nfunction reduceAnsiCodes(codes) {\n\tlet returnValue = [];\n\n\tfor (const code of codes) {\n\t\tif (code.code === ansiStyles.reset.open) {\n\t\t\t// Reset code, disable all codes\n\t\t\treturnValue = [];\n\t\t} else if (endCodesSet.has(code.code)) {\n\t\t\t// This is an end code, disable all matching start codes\n\t\t\treturnValue = returnValue.filter(returnValueCode => returnValueCode.endCode !== code.code);\n\t\t} else {\n\t\t\t// This is a start code. Disable all styles this \"overrides\", then enable it\n\t\t\treturnValue = returnValue.filter(returnValueCode => returnValueCode.endCode !== code.endCode);\n\t\t\treturnValue.push(code);\n\t\t}\n\t}\n\n\treturn returnValue;\n}\n\nfunction undoAnsiCodes(codes) {\n\tconst reduced = reduceAnsiCodes(codes);\n\tconst endCodes = reduced.map(({endCode}) => endCode);\n\treturn endCodes.reverse().join('');\n}\n\nexport default function sliceAnsi(string, start, end) {\n\tconst tokens = tokenize(string, end);\n\tlet activeCodes = [];\n\tlet position = 0;\n\tlet returnValue = '';\n\tlet include = false;\n\n\tfor (const token of tokens) {\n\t\tif (end !== undefined && position >= end) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (token.type === 'ansi') {\n\t\t\tactiveCodes.push(token);\n\t\t\tif (include) {\n\t\t\t\treturnValue += token.code;\n\t\t\t}\n\t\t} else {\n\t\t\t// Character\n\t\t\tif (!include && position >= start) {\n\t\t\t\tinclude = true;\n\t\t\t\t// Simplify active codes\n\t\t\t\tactiveCodes = reduceAnsiCodes(activeCodes);\n\t\t\t\treturnValue = activeCodes.map(({code}) => code).join('');\n\t\t\t}\n\n\t\t\tif (include) {\n\t\t\t\treturnValue += token.value;\n\t\t\t}\n\n\t\t\tposition += token.isFullWidth ? 2 : token.value.length;\n\t\t}\n\t}\n\n\t// Disable active codes at the end\n\treturnValue += undoAnsiCodes(activeCodes);\n\treturn returnValue;\n}\n","import process from 'node:process';\nimport ansiEscapes from 'ansi-escapes';\nimport cliCursor from 'cli-cursor';\nimport wrapAnsi from 'wrap-ansi';\nimport sliceAnsi from 'slice-ansi';\nimport stripAnsi from 'strip-ansi';\n\nconst defaultTerminalHeight = 24;\n\nconst getWidth = ({columns = 80}) => columns;\n\nconst fitToTerminalHeight = (stream, text) => {\n\tconst terminalHeight = stream.rows ?? defaultTerminalHeight;\n\tconst lines = text.split('\\n');\n\tconst toRemove = Math.max(0, lines.length - terminalHeight);\n\treturn toRemove ? sliceAnsi(text, stripAnsi(lines.slice(0, toRemove).join('\\n')).length + 1) : text;\n};\n\nexport function createLogUpdate(stream, {showCursor = false} = {}) {\n\tlet previousLineCount = 0;\n\tlet previousWidth = getWidth(stream);\n\tlet previousOutput = '';\n\n\tconst reset = () => {\n\t\tpreviousOutput = '';\n\t\tpreviousWidth = getWidth(stream);\n\t\tpreviousLineCount = 0;\n\t};\n\n\tconst render = (...arguments_) => {\n\t\tif (!showCursor) {\n\t\t\tcliCursor.hide();\n\t\t}\n\n\t\tlet output = fitToTerminalHeight(stream, arguments_.join(' ') + '\\n');\n\t\tconst width = getWidth(stream);\n\n\t\tif (output === previousOutput && previousWidth === width) {\n\t\t\treturn;\n\t\t}\n\n\t\tpreviousOutput = output;\n\t\tpreviousWidth = width;\n\t\toutput = wrapAnsi(output, width, {trim: false, hard: true, wordWrap: false});\n\n\t\tstream.write(ansiEscapes.eraseLines(previousLineCount) + output);\n\t\tpreviousLineCount = output.split('\\n').length;\n\t};\n\n\trender.clear = () => {\n\t\tstream.write(ansiEscapes.eraseLines(previousLineCount));\n\t\treset();\n\t};\n\n\trender.done = () => {\n\t\treset();\n\t\tif (!showCursor) {\n\t\t\tcliCursor.show();\n\t\t}\n\t};\n\n\treturn render;\n}\n\nconst logUpdate = createLogUpdate(process.stdout);\nexport default logUpdate;\n\nexport const logUpdateStderr = createLogUpdate(process.stderr);\n"],"x_google_ignoreList":[0,1,2,3,4],"mappings":";;;;;;;AAEA,MAAa,YAAY,WAAW,QAAQ,aAAa;AAEzD,MAAa,SAAS,WAAW,SAAS,UAAU,SAAS;AAE7D,MAAa,QAAQ,WAAW,SAAS,UAAU,QAAQ;AAE3D,MAAa,SAAS,WAAW,MAAM,SAAS,SAAS;AAEzD,MAAa,aAAa,WAAW,SAAS,UAAU,aAAa;AAErE,MAAa,UAAU,WAAW,WAAW,WAAW,SAAS,QAAQ,KAAK;AAE9E,MAAa,cAAc,OAAO,sBAAsB,eAAe,sBAAsB;AAE7F,MAAa,oBAAoB,OAAO,+BAA+B,eAAe,sBAAsB;AAE5G,MAAa,iBAAiB,OAAO,4BAA4B,eAAe,sBAAsB;AAEtG,MAAa,kBAAkB,OAAO,6BAA6B,eAAe,sBAAsB;AAGxG,MAAM,WAAW,WAAW,WAAW,eAAe;AAEtD,MAAa,UAAU,aAAa,WAChC,WAAW,WAAW,aAAa,cACnC,WAAW,WAAW,WAAW,SAAS,QAAQ,KAAK,QACvD,WAAW,SAAS,aAAa;AAErC,MAAaA,cAAY,aAAa,aAClC,WAAW,WAAW,aAAa,WACnC,WAAW,SAAS,aAAa;AAErC,MAAa,UAAU,aAAa,WAChC,WAAW,WAAW,UAAU,WAAW,QAAQ,KAAK,QACxD,WAAW,WAAW,WAAW,SAAS,UAA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