@nulab/bee 1.1.1 → 1.2.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/dist/activities-BPTHt_MD.mjs +69 -0
- package/dist/activities-CRiEq51-.mjs +72 -0
- package/dist/activities-DyOMqdsM.mjs +69 -0
- package/dist/activity-labels-CLFpxp8o.mjs +34 -0
- package/dist/add-Br-_TLRp.mjs +55 -0
- package/dist/add-CTmmy2t9.mjs +26 -0
- package/dist/add-user-BVWFcbH7.mjs +26 -0
- package/dist/api-DhA8avDD.mjs +134 -0
- package/dist/attachments-CnL8t9tK.mjs +50 -0
- package/dist/attachments-D8IoJjYE.mjs +50 -0
- package/dist/attachments-DfgEkAY2.mjs +46 -0
- package/dist/auth-5TJGBPxi.mjs +13 -0
- package/dist/bee-command-v0qvZeth.mjs +57 -0
- package/dist/browse-vgF6nz7X.mjs +304 -0
- package/dist/category-BZ7XdVgx.mjs +11 -0
- package/dist/clone-DAWVtVbZ.mjs +43 -0
- package/dist/close-cTyZPv77.mjs +37 -0
- package/dist/comment-CkYJYFrF.mjs +115 -0
- package/dist/comment-DzRBQNv8.mjs +102 -0
- package/dist/comments-SnOZ-EUJ.mjs +47 -0
- package/dist/common-options-BuYWxYdO.mjs +45 -0
- package/dist/completion-yX2VOQSl.mjs +113 -0
- package/dist/count-BI7ld4k5.mjs +50 -0
- package/dist/count-Bw0mVlxC.mjs +40 -0
- package/dist/count-CH_LN4k6.mjs +51 -0
- package/dist/count-CHzDiMV3.mjs +25 -0
- package/dist/count-DvmYzPD_.mjs +46 -0
- package/dist/create-BHjwacOk.mjs +47 -0
- package/dist/create-BXWATibN.mjs +41 -0
- package/dist/create-BtLVFmbR.mjs +29 -0
- package/dist/create-CoF2bahH.mjs +29 -0
- package/dist/create-DhAOhro9.mjs +60 -0
- package/dist/create-DtMLv7Wq.mjs +26 -0
- package/dist/create-PtahSFdG.mjs +66 -0
- package/dist/create-Y4vo2zwX.mjs +44 -0
- package/dist/create-vwRKZ3Lm.mjs +31 -0
- package/dist/dashboard-CYYU5Yii.mjs +97 -0
- package/dist/delete-BCAPHs-g.mjs +25 -0
- package/dist/delete-BHNt5SWa.mjs +24 -0
- package/dist/delete-BlmanW0H.mjs +25 -0
- package/dist/delete-Bxk14ntp.mjs +24 -0
- package/dist/delete-C05oMZEW.mjs +24 -0
- package/dist/delete-CMwkcSiA.mjs +25 -0
- package/dist/delete-CTeH7nzL.mjs +29 -0
- package/dist/delete-D2yDBhZc.mjs +24 -0
- package/dist/delete-HMOfvtv3.mjs +25 -0
- package/dist/document-vTiqLew9.mjs +14 -0
- package/dist/edit-BBvSbt0m.mjs +22 -0
- package/dist/edit-BfCZ2Abi.mjs +50 -0
- package/dist/edit-CN1gdpjd.mjs +37 -0
- package/dist/edit-C_KbKopB.mjs +36 -0
- package/dist/edit-D5Z45NVj.mjs +27 -0
- package/dist/edit-DKQw-XXP.mjs +27 -0
- package/dist/edit-DRxr4r-r.mjs +60 -0
- package/dist/edit-DxsP-aPX.mjs +43 -0
- package/dist/edit-Otc7XHU7.mjs +52 -0
- package/dist/file-DwPTUKOI.mjs +17 -0
- package/dist/format-DHAR0n3J.mjs +9 -0
- package/dist/history-DpjqxFkX.mjs +55 -0
- package/dist/index.mjs +33 -37918
- package/dist/issue-BRzJy3k1.mjs +18 -0
- package/dist/issue-type-Byzh4yLx.mjs +11 -0
- package/dist/list-B3A5SDEm.mjs +35 -0
- package/dist/list-BMKaJoe_.mjs +64 -0
- package/dist/list-BOMbpS4m.mjs +46 -0
- package/dist/list-BmZ_JbLB.mjs +104 -0
- package/dist/list-BpUUxxwQ.mjs +46 -0
- package/dist/list-CgIebllW.mjs +94 -0
- package/dist/list-D0Z__0nw.mjs +42 -0
- package/dist/list-D3FkO9gb.mjs +56 -0
- package/dist/list-D7WLdHvX.mjs +42 -0
- package/dist/list-DAr3urtu.mjs +53 -0
- package/dist/list-DqpWd9aR.mjs +59 -0
- package/dist/list-VO_PbRjC.mjs +50 -0
- package/dist/list-b6ByzUFt.mjs +79 -0
- package/dist/list-jpQ28gU2.mjs +56 -0
- package/dist/list-y93EXyDj.mjs +42 -0
- package/dist/login-BnJYzdR3.mjs +228 -0
- package/dist/logout-YMnSRLLF.mjs +56 -0
- package/dist/me-CLPAe7X2.mjs +36 -0
- package/dist/milestone-Dc3alfp9.mjs +11 -0
- package/dist/notification-CsOuC8Uk.mjs +11 -0
- package/dist/output-DBvfyU1J.mjs +39 -0
- package/dist/pr-BBe07JUp.mjs +15 -0
- package/dist/project-Dilo1T5e.mjs +16 -0
- package/dist/read-BS2G4sNq.mjs +17 -0
- package/dist/read-CyCASx6U.mjs +17 -0
- package/dist/read-all-CjgMJ2to.mjs +16 -0
- package/dist/refresh-DDU2ZLnc.mjs +54 -0
- package/dist/registry-D8DfbunX.mjs +2 -0
- package/dist/registry-PlBmfTR4.mjs +35 -0
- package/dist/remove-BSDJvkVJ.mjs +17 -0
- package/dist/remove-user-CShNCvf8.mjs +26 -0
- package/dist/reopen-BIRhcmsI.mjs +28 -0
- package/dist/repo-B2K8y0mD.mjs +10 -0
- package/dist/role-labels-CLA2wmjO.mjs +11 -0
- package/dist/space-BgZeUqoH.mjs +6 -0
- package/dist/{shared/bee.CHtg3F43.mjs → src-BWaxjrq_.mjs} +143 -175
- package/dist/src-CP4YLIAh.mjs +1008 -0
- package/dist/src-CTD9-bSB.mjs +22760 -0
- package/dist/star-Sgb-e2CQ.mjs +11 -0
- package/dist/status-BkFMW8Jh.mjs +53 -0
- package/dist/status-CaGqMXh7.mjs +64 -0
- package/dist/status-DDFyQrRZ.mjs +11 -0
- package/dist/status-nI4Dpcoo.mjs +58 -0
- package/dist/stdin-C-vjNi9T.mjs +17 -0
- package/dist/switch-CMLfVGDN.mjs +34 -0
- package/dist/tags-DuMJZyBL.mjs +29 -0
- package/dist/team-DfQn8Tf5.mjs +6 -0
- package/dist/token-BmkUX9vc.mjs +28 -0
- package/dist/tree-CozBqPbN.mjs +46 -0
- package/dist/user-DMyFmoP3.mjs +11 -0
- package/dist/users-BSGqsGSy.mjs +51 -0
- package/dist/view-Bj99sk7O.mjs +48 -0
- package/dist/view-Bs8o0c7i.mjs +36 -0
- package/dist/view-C1ECwTMN.mjs +54 -0
- package/dist/view-COBYBfu7.mjs +38 -0
- package/dist/view-CZHT-HiE.mjs +36 -0
- package/dist/view-D1RuQJV6.mjs +76 -0
- package/dist/view-DBO75WzR.mjs +54 -0
- package/dist/view-DJHrnN8j.mjs +62 -0
- package/dist/view-DLx6qQt9.mjs +51 -0
- package/dist/watching-D22YYxOT.mjs +12 -0
- package/dist/wiki-B-DQUuIX.mjs +16 -0
- package/package.json +14 -11
- package/dist/chunks/activities.mjs +0 -75
- package/dist/chunks/activities2.mjs +0 -75
- package/dist/chunks/activities3.mjs +0 -75
- package/dist/chunks/add-user.mjs +0 -38
- package/dist/chunks/add.mjs +0 -63
- package/dist/chunks/add2.mjs +0 -39
- package/dist/chunks/api.mjs +0 -174
- package/dist/chunks/attachments.mjs +0 -47
- package/dist/chunks/attachments2.mjs +0 -47
- package/dist/chunks/attachments3.mjs +0 -48
- package/dist/chunks/browse.mjs +0 -269
- package/dist/chunks/clone.mjs +0 -60
- package/dist/chunks/close.mjs +0 -50
- package/dist/chunks/comment.mjs +0 -125
- package/dist/chunks/comment2.mjs +0 -111
- package/dist/chunks/comments.mjs +0 -57
- package/dist/chunks/completion.mjs +0 -113
- package/dist/chunks/count.mjs +0 -68
- package/dist/chunks/count2.mjs +0 -69
- package/dist/chunks/count3.mjs +0 -59
- package/dist/chunks/count4.mjs +0 -35
- package/dist/chunks/count5.mjs +0 -52
- package/dist/chunks/create.mjs +0 -60
- package/dist/chunks/create2.mjs +0 -88
- package/dist/chunks/create3.mjs +0 -64
- package/dist/chunks/create4.mjs +0 -74
- package/dist/chunks/create5.mjs +0 -56
- package/dist/chunks/create6.mjs +0 -37
- package/dist/chunks/create7.mjs +0 -45
- package/dist/chunks/create8.mjs +0 -49
- package/dist/chunks/create9.mjs +0 -49
- package/dist/chunks/dashboard.mjs +0 -84
- package/dist/chunks/delete.mjs +0 -48
- package/dist/chunks/delete2.mjs +0 -46
- package/dist/chunks/delete3.mjs +0 -46
- package/dist/chunks/delete4.mjs +0 -49
- package/dist/chunks/delete5.mjs +0 -50
- package/dist/chunks/delete6.mjs +0 -50
- package/dist/chunks/delete7.mjs +0 -62
- package/dist/chunks/delete8.mjs +0 -53
- package/dist/chunks/delete9.mjs +0 -48
- package/dist/chunks/edit.mjs +0 -56
- package/dist/chunks/edit2.mjs +0 -78
- package/dist/chunks/edit3.mjs +0 -65
- package/dist/chunks/edit4.mjs +0 -51
- package/dist/chunks/edit5.mjs +0 -43
- package/dist/chunks/edit6.mjs +0 -54
- package/dist/chunks/edit7.mjs +0 -50
- package/dist/chunks/edit8.mjs +0 -50
- package/dist/chunks/history.mjs +0 -56
- package/dist/chunks/index.mjs +0 -15
- package/dist/chunks/index10.mjs +0 -18
- package/dist/chunks/index11.mjs +0 -13
- package/dist/chunks/index12.mjs +0 -13
- package/dist/chunks/index13.mjs +0 -13
- package/dist/chunks/index14.mjs +0 -8
- package/dist/chunks/index15.mjs +0 -13
- package/dist/chunks/index16.mjs +0 -13
- package/dist/chunks/index17.mjs +0 -14
- package/dist/chunks/index2.mjs +0 -18
- package/dist/chunks/index3.mjs +0 -20
- package/dist/chunks/index4.mjs +0 -15
- package/dist/chunks/index5.mjs +0 -13
- package/dist/chunks/index6.mjs +0 -17
- package/dist/chunks/index7.mjs +0 -8
- package/dist/chunks/index8.mjs +0 -8
- package/dist/chunks/index9.mjs +0 -13
- package/dist/chunks/list.mjs +0 -52
- package/dist/chunks/list10.mjs +0 -44
- package/dist/chunks/list11.mjs +0 -49
- package/dist/chunks/list12.mjs +0 -45
- package/dist/chunks/list13.mjs +0 -45
- package/dist/chunks/list14.mjs +0 -54
- package/dist/chunks/list15.mjs +0 -46
- package/dist/chunks/list2.mjs +0 -103
- package/dist/chunks/list3.mjs +0 -85
- package/dist/chunks/list4.mjs +0 -79
- package/dist/chunks/list5.mjs +0 -77
- package/dist/chunks/list6.mjs +0 -45
- package/dist/chunks/list7.mjs +0 -48
- package/dist/chunks/list8.mjs +0 -46
- package/dist/chunks/list9.mjs +0 -53
- package/dist/chunks/login.mjs +0 -218
- package/dist/chunks/logout.mjs +0 -76
- package/dist/chunks/me.mjs +0 -48
- package/dist/chunks/read-all.mjs +0 -29
- package/dist/chunks/read.mjs +0 -29
- package/dist/chunks/read2.mjs +0 -27
- package/dist/chunks/refresh.mjs +0 -76
- package/dist/chunks/remove-user.mjs +0 -38
- package/dist/chunks/remove.mjs +0 -27
- package/dist/chunks/reopen.mjs +0 -42
- package/dist/chunks/status.mjs +0 -64
- package/dist/chunks/status2.mjs +0 -61
- package/dist/chunks/status3.mjs +0 -66
- package/dist/chunks/switch.mjs +0 -55
- package/dist/chunks/tags.mjs +0 -41
- package/dist/chunks/token.mjs +0 -42
- package/dist/chunks/tree.mjs +0 -61
- package/dist/chunks/users.mjs +0 -48
- package/dist/chunks/view.mjs +0 -58
- package/dist/chunks/view2.mjs +0 -95
- package/dist/chunks/view3.mjs +0 -68
- package/dist/chunks/view4.mjs +0 -70
- package/dist/chunks/view5.mjs +0 -61
- package/dist/chunks/view6.mjs +0 -52
- package/dist/chunks/view7.mjs +0 -48
- package/dist/chunks/view8.mjs +0 -61
- package/dist/chunks/view9.mjs +0 -48
- package/dist/shared/bee.084B_7FC.mjs +0 -27
- package/dist/shared/bee.BTBGpv4K.mjs +0 -34
- package/dist/shared/bee.BXiuAfjJ.mjs +0 -10
- package/dist/shared/bee.Btmq3TXs.mjs +0 -19
- package/dist/shared/bee.C--ZWPxf.mjs +0 -14
- package/dist/shared/bee.C4p7W8_P.mjs +0 -18
- package/dist/shared/bee.CAARNIp6.mjs +0 -49
- package/dist/shared/bee.CirccSk2.mjs +0 -51
- package/dist/shared/bee.CktwmH8R.mjs +0 -25
- package/dist/shared/bee.CzKcWSES.mjs +0 -42
- package/dist/shared/bee.DFnSWb6q.mjs +0 -396
- package/dist/shared/bee.DoTvz3uW.mjs +0 -13
- package/dist/shared/bee.KteAW2rM.mjs +0 -73
- package/dist/shared/bee.RsR9yniy.mjs +0 -131
- package/dist/shared/bee.a05kNWpn.mjs +0 -32
- package/dist/shared/bee.n5MYN4a6.mjs +0 -12
- package/dist/shared/bee.q93n012-.mjs +0 -14
|
@@ -0,0 +1,1008 @@
|
|
|
1
|
+
import consola from "consola";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
import { ValiError, flatten, safeParse } from "valibot";
|
|
4
|
+
//#region ../../packages/cli-utils/src/user-error.ts
|
|
5
|
+
/**
|
|
6
|
+
* An error representing a known, expected failure condition.
|
|
7
|
+
*
|
|
8
|
+
* UserError is for "normal" errors — invalid input, missing configuration,
|
|
9
|
+
* failed authentication, etc. The global error handler prints only the
|
|
10
|
+
* message (via `consola.error`) with **no stack trace**.
|
|
11
|
+
*
|
|
12
|
+
* Any error that is NOT a UserError (and not a handled API/validation error)
|
|
13
|
+
* is treated as an unexpected bug and printed with the full stack trace.
|
|
14
|
+
*/
|
|
15
|
+
var UserError = class extends Error {
|
|
16
|
+
constructor(message) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.name = "UserError";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region ../../packages/cli-utils/src/prompt.ts
|
|
23
|
+
const promptRequired = async (label, existing, options) => {
|
|
24
|
+
if (existing !== void 0) {
|
|
25
|
+
if (existing) return existing;
|
|
26
|
+
throw new UserError(`${label.replace(/:$/, "")} is required.`);
|
|
27
|
+
}
|
|
28
|
+
if (!process.stdin.isTTY) throw new UserError(`${label.replace(/:$/, "")} is required. Use arguments to provide it in non-interactive mode.`);
|
|
29
|
+
const displayLabel = options?.valueHint ? label.replace(/:$/, ` ${options.valueHint}:`) : label;
|
|
30
|
+
const { valueHint: _, ...promptOptions } = options ?? {};
|
|
31
|
+
const value = await consola.prompt(displayLabel, {
|
|
32
|
+
type: "text",
|
|
33
|
+
...promptOptions
|
|
34
|
+
});
|
|
35
|
+
if (typeof value !== "string" || !value) throw new UserError(`${label.replace(/:$/, "")} is required.`);
|
|
36
|
+
return value;
|
|
37
|
+
};
|
|
38
|
+
const confirmOrExit = async (message, skipConfirm) => {
|
|
39
|
+
if (skipConfirm) return true;
|
|
40
|
+
if (!process.stdin.isTTY) throw new UserError("Confirmation required. Use --yes to skip in non-interactive mode.");
|
|
41
|
+
if (!await consola.prompt(message, { type: "confirm" })) {
|
|
42
|
+
consola.info("Cancelled.");
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../../packages/cli-utils/src/valibot-utils.ts
|
|
49
|
+
/**
|
|
50
|
+
* Schema that transforms a string to a validated finite number.
|
|
51
|
+
* Rejects NaN and Infinity — use this instead of bare `Number()` casting.
|
|
52
|
+
*/
|
|
53
|
+
const vFiniteNumber = v.pipe(v.string(), v.transform(Number), v.number(), v.finite());
|
|
54
|
+
/**
|
|
55
|
+
* Schema that transforms a string to a validated integer.
|
|
56
|
+
* Rejects NaN, Infinity, and non-integer values.
|
|
57
|
+
*/
|
|
58
|
+
const vInteger = v.pipe(v.string(), v.transform(Number), v.number(), v.integer());
|
|
59
|
+
/**
|
|
60
|
+
* Parse a CLI argument with a valibot schema, throwing a UserError on failure.
|
|
61
|
+
*
|
|
62
|
+
* Unlike bare `v.parse()`, this converts ValiError into a UserError so the
|
|
63
|
+
* global error handler shows a friendly message instead of
|
|
64
|
+
* "API response validation failed."
|
|
65
|
+
*/
|
|
66
|
+
const parseArg = (schema, value, label) => {
|
|
67
|
+
const result = v.safeParse(schema, value);
|
|
68
|
+
if (result.success) return result.output;
|
|
69
|
+
const reason = result.issues[0]?.message;
|
|
70
|
+
const message = reason ? `Invalid value for "${label}": "${value}" — ${reason}` : `Invalid value for "${label}": "${value}"`;
|
|
71
|
+
consola.debug("parseArg validation issues:", result.issues);
|
|
72
|
+
throw new UserError(message);
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region ../../packages/cli-utils/src/split-arg.ts
|
|
76
|
+
const splitArg = (input, schema) => {
|
|
77
|
+
if (!input) return [];
|
|
78
|
+
const parts = input.split(",").map((s) => s.trim()).filter(Boolean);
|
|
79
|
+
const results = [];
|
|
80
|
+
for (const part of parts) {
|
|
81
|
+
const result = safeParse(schema, part);
|
|
82
|
+
if (result.success) {
|
|
83
|
+
results.push(result.output);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const numResult = safeParse(vFiniteNumber, part);
|
|
87
|
+
if (numResult.success) {
|
|
88
|
+
const schemaResult = safeParse(schema, numResult.output);
|
|
89
|
+
if (schemaResult.success) results.push(schemaResult.output);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return results;
|
|
93
|
+
};
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region ../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
|
|
96
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
97
|
+
return new RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`, onlyFirst ? void 0 : "g");
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region ../../node_modules/.pnpm/strip-ansi@7.2.0/node_modules/strip-ansi/index.js
|
|
101
|
+
const regex = ansiRegex();
|
|
102
|
+
function stripAnsi(string) {
|
|
103
|
+
if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
104
|
+
if (!string.includes("\x1B") && !string.includes("")) return string;
|
|
105
|
+
return string.replace(regex, "");
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region ../../node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup-data.js
|
|
109
|
+
const ambiguousRanges = [
|
|
110
|
+
161,
|
|
111
|
+
161,
|
|
112
|
+
164,
|
|
113
|
+
164,
|
|
114
|
+
167,
|
|
115
|
+
168,
|
|
116
|
+
170,
|
|
117
|
+
170,
|
|
118
|
+
173,
|
|
119
|
+
174,
|
|
120
|
+
176,
|
|
121
|
+
180,
|
|
122
|
+
182,
|
|
123
|
+
186,
|
|
124
|
+
188,
|
|
125
|
+
191,
|
|
126
|
+
198,
|
|
127
|
+
198,
|
|
128
|
+
208,
|
|
129
|
+
208,
|
|
130
|
+
215,
|
|
131
|
+
216,
|
|
132
|
+
222,
|
|
133
|
+
225,
|
|
134
|
+
230,
|
|
135
|
+
230,
|
|
136
|
+
232,
|
|
137
|
+
234,
|
|
138
|
+
236,
|
|
139
|
+
237,
|
|
140
|
+
240,
|
|
141
|
+
240,
|
|
142
|
+
242,
|
|
143
|
+
243,
|
|
144
|
+
247,
|
|
145
|
+
250,
|
|
146
|
+
252,
|
|
147
|
+
252,
|
|
148
|
+
254,
|
|
149
|
+
254,
|
|
150
|
+
257,
|
|
151
|
+
257,
|
|
152
|
+
273,
|
|
153
|
+
273,
|
|
154
|
+
275,
|
|
155
|
+
275,
|
|
156
|
+
283,
|
|
157
|
+
283,
|
|
158
|
+
294,
|
|
159
|
+
295,
|
|
160
|
+
299,
|
|
161
|
+
299,
|
|
162
|
+
305,
|
|
163
|
+
307,
|
|
164
|
+
312,
|
|
165
|
+
312,
|
|
166
|
+
319,
|
|
167
|
+
322,
|
|
168
|
+
324,
|
|
169
|
+
324,
|
|
170
|
+
328,
|
|
171
|
+
331,
|
|
172
|
+
333,
|
|
173
|
+
333,
|
|
174
|
+
338,
|
|
175
|
+
339,
|
|
176
|
+
358,
|
|
177
|
+
359,
|
|
178
|
+
363,
|
|
179
|
+
363,
|
|
180
|
+
462,
|
|
181
|
+
462,
|
|
182
|
+
464,
|
|
183
|
+
464,
|
|
184
|
+
466,
|
|
185
|
+
466,
|
|
186
|
+
468,
|
|
187
|
+
468,
|
|
188
|
+
470,
|
|
189
|
+
470,
|
|
190
|
+
472,
|
|
191
|
+
472,
|
|
192
|
+
474,
|
|
193
|
+
474,
|
|
194
|
+
476,
|
|
195
|
+
476,
|
|
196
|
+
593,
|
|
197
|
+
593,
|
|
198
|
+
609,
|
|
199
|
+
609,
|
|
200
|
+
708,
|
|
201
|
+
708,
|
|
202
|
+
711,
|
|
203
|
+
711,
|
|
204
|
+
713,
|
|
205
|
+
715,
|
|
206
|
+
717,
|
|
207
|
+
717,
|
|
208
|
+
720,
|
|
209
|
+
720,
|
|
210
|
+
728,
|
|
211
|
+
731,
|
|
212
|
+
733,
|
|
213
|
+
733,
|
|
214
|
+
735,
|
|
215
|
+
735,
|
|
216
|
+
768,
|
|
217
|
+
879,
|
|
218
|
+
913,
|
|
219
|
+
929,
|
|
220
|
+
931,
|
|
221
|
+
937,
|
|
222
|
+
945,
|
|
223
|
+
961,
|
|
224
|
+
963,
|
|
225
|
+
969,
|
|
226
|
+
1025,
|
|
227
|
+
1025,
|
|
228
|
+
1040,
|
|
229
|
+
1103,
|
|
230
|
+
1105,
|
|
231
|
+
1105,
|
|
232
|
+
8208,
|
|
233
|
+
8208,
|
|
234
|
+
8211,
|
|
235
|
+
8214,
|
|
236
|
+
8216,
|
|
237
|
+
8217,
|
|
238
|
+
8220,
|
|
239
|
+
8221,
|
|
240
|
+
8224,
|
|
241
|
+
8226,
|
|
242
|
+
8228,
|
|
243
|
+
8231,
|
|
244
|
+
8240,
|
|
245
|
+
8240,
|
|
246
|
+
8242,
|
|
247
|
+
8243,
|
|
248
|
+
8245,
|
|
249
|
+
8245,
|
|
250
|
+
8251,
|
|
251
|
+
8251,
|
|
252
|
+
8254,
|
|
253
|
+
8254,
|
|
254
|
+
8308,
|
|
255
|
+
8308,
|
|
256
|
+
8319,
|
|
257
|
+
8319,
|
|
258
|
+
8321,
|
|
259
|
+
8324,
|
|
260
|
+
8364,
|
|
261
|
+
8364,
|
|
262
|
+
8451,
|
|
263
|
+
8451,
|
|
264
|
+
8453,
|
|
265
|
+
8453,
|
|
266
|
+
8457,
|
|
267
|
+
8457,
|
|
268
|
+
8467,
|
|
269
|
+
8467,
|
|
270
|
+
8470,
|
|
271
|
+
8470,
|
|
272
|
+
8481,
|
|
273
|
+
8482,
|
|
274
|
+
8486,
|
|
275
|
+
8486,
|
|
276
|
+
8491,
|
|
277
|
+
8491,
|
|
278
|
+
8531,
|
|
279
|
+
8532,
|
|
280
|
+
8539,
|
|
281
|
+
8542,
|
|
282
|
+
8544,
|
|
283
|
+
8555,
|
|
284
|
+
8560,
|
|
285
|
+
8569,
|
|
286
|
+
8585,
|
|
287
|
+
8585,
|
|
288
|
+
8592,
|
|
289
|
+
8601,
|
|
290
|
+
8632,
|
|
291
|
+
8633,
|
|
292
|
+
8658,
|
|
293
|
+
8658,
|
|
294
|
+
8660,
|
|
295
|
+
8660,
|
|
296
|
+
8679,
|
|
297
|
+
8679,
|
|
298
|
+
8704,
|
|
299
|
+
8704,
|
|
300
|
+
8706,
|
|
301
|
+
8707,
|
|
302
|
+
8711,
|
|
303
|
+
8712,
|
|
304
|
+
8715,
|
|
305
|
+
8715,
|
|
306
|
+
8719,
|
|
307
|
+
8719,
|
|
308
|
+
8721,
|
|
309
|
+
8721,
|
|
310
|
+
8725,
|
|
311
|
+
8725,
|
|
312
|
+
8730,
|
|
313
|
+
8730,
|
|
314
|
+
8733,
|
|
315
|
+
8736,
|
|
316
|
+
8739,
|
|
317
|
+
8739,
|
|
318
|
+
8741,
|
|
319
|
+
8741,
|
|
320
|
+
8743,
|
|
321
|
+
8748,
|
|
322
|
+
8750,
|
|
323
|
+
8750,
|
|
324
|
+
8756,
|
|
325
|
+
8759,
|
|
326
|
+
8764,
|
|
327
|
+
8765,
|
|
328
|
+
8776,
|
|
329
|
+
8776,
|
|
330
|
+
8780,
|
|
331
|
+
8780,
|
|
332
|
+
8786,
|
|
333
|
+
8786,
|
|
334
|
+
8800,
|
|
335
|
+
8801,
|
|
336
|
+
8804,
|
|
337
|
+
8807,
|
|
338
|
+
8810,
|
|
339
|
+
8811,
|
|
340
|
+
8814,
|
|
341
|
+
8815,
|
|
342
|
+
8834,
|
|
343
|
+
8835,
|
|
344
|
+
8838,
|
|
345
|
+
8839,
|
|
346
|
+
8853,
|
|
347
|
+
8853,
|
|
348
|
+
8857,
|
|
349
|
+
8857,
|
|
350
|
+
8869,
|
|
351
|
+
8869,
|
|
352
|
+
8895,
|
|
353
|
+
8895,
|
|
354
|
+
8978,
|
|
355
|
+
8978,
|
|
356
|
+
9312,
|
|
357
|
+
9449,
|
|
358
|
+
9451,
|
|
359
|
+
9547,
|
|
360
|
+
9552,
|
|
361
|
+
9587,
|
|
362
|
+
9600,
|
|
363
|
+
9615,
|
|
364
|
+
9618,
|
|
365
|
+
9621,
|
|
366
|
+
9632,
|
|
367
|
+
9633,
|
|
368
|
+
9635,
|
|
369
|
+
9641,
|
|
370
|
+
9650,
|
|
371
|
+
9651,
|
|
372
|
+
9654,
|
|
373
|
+
9655,
|
|
374
|
+
9660,
|
|
375
|
+
9661,
|
|
376
|
+
9664,
|
|
377
|
+
9665,
|
|
378
|
+
9670,
|
|
379
|
+
9672,
|
|
380
|
+
9675,
|
|
381
|
+
9675,
|
|
382
|
+
9678,
|
|
383
|
+
9681,
|
|
384
|
+
9698,
|
|
385
|
+
9701,
|
|
386
|
+
9711,
|
|
387
|
+
9711,
|
|
388
|
+
9733,
|
|
389
|
+
9734,
|
|
390
|
+
9737,
|
|
391
|
+
9737,
|
|
392
|
+
9742,
|
|
393
|
+
9743,
|
|
394
|
+
9756,
|
|
395
|
+
9756,
|
|
396
|
+
9758,
|
|
397
|
+
9758,
|
|
398
|
+
9792,
|
|
399
|
+
9792,
|
|
400
|
+
9794,
|
|
401
|
+
9794,
|
|
402
|
+
9824,
|
|
403
|
+
9825,
|
|
404
|
+
9827,
|
|
405
|
+
9829,
|
|
406
|
+
9831,
|
|
407
|
+
9834,
|
|
408
|
+
9836,
|
|
409
|
+
9837,
|
|
410
|
+
9839,
|
|
411
|
+
9839,
|
|
412
|
+
9886,
|
|
413
|
+
9887,
|
|
414
|
+
9919,
|
|
415
|
+
9919,
|
|
416
|
+
9926,
|
|
417
|
+
9933,
|
|
418
|
+
9935,
|
|
419
|
+
9939,
|
|
420
|
+
9941,
|
|
421
|
+
9953,
|
|
422
|
+
9955,
|
|
423
|
+
9955,
|
|
424
|
+
9960,
|
|
425
|
+
9961,
|
|
426
|
+
9963,
|
|
427
|
+
9969,
|
|
428
|
+
9972,
|
|
429
|
+
9972,
|
|
430
|
+
9974,
|
|
431
|
+
9977,
|
|
432
|
+
9979,
|
|
433
|
+
9980,
|
|
434
|
+
9982,
|
|
435
|
+
9983,
|
|
436
|
+
10045,
|
|
437
|
+
10045,
|
|
438
|
+
10102,
|
|
439
|
+
10111,
|
|
440
|
+
11094,
|
|
441
|
+
11097,
|
|
442
|
+
12872,
|
|
443
|
+
12879,
|
|
444
|
+
57344,
|
|
445
|
+
63743,
|
|
446
|
+
65024,
|
|
447
|
+
65039,
|
|
448
|
+
65533,
|
|
449
|
+
65533,
|
|
450
|
+
127232,
|
|
451
|
+
127242,
|
|
452
|
+
127248,
|
|
453
|
+
127277,
|
|
454
|
+
127280,
|
|
455
|
+
127337,
|
|
456
|
+
127344,
|
|
457
|
+
127373,
|
|
458
|
+
127375,
|
|
459
|
+
127376,
|
|
460
|
+
127387,
|
|
461
|
+
127404,
|
|
462
|
+
917760,
|
|
463
|
+
917999,
|
|
464
|
+
983040,
|
|
465
|
+
1048573,
|
|
466
|
+
1048576,
|
|
467
|
+
1114109
|
|
468
|
+
];
|
|
469
|
+
const fullwidthRanges = [
|
|
470
|
+
12288,
|
|
471
|
+
12288,
|
|
472
|
+
65281,
|
|
473
|
+
65376,
|
|
474
|
+
65504,
|
|
475
|
+
65510
|
|
476
|
+
];
|
|
477
|
+
const halfwidthRanges = [
|
|
478
|
+
8361,
|
|
479
|
+
8361,
|
|
480
|
+
65377,
|
|
481
|
+
65470,
|
|
482
|
+
65474,
|
|
483
|
+
65479,
|
|
484
|
+
65482,
|
|
485
|
+
65487,
|
|
486
|
+
65490,
|
|
487
|
+
65495,
|
|
488
|
+
65498,
|
|
489
|
+
65500,
|
|
490
|
+
65512,
|
|
491
|
+
65518
|
|
492
|
+
];
|
|
493
|
+
const narrowRanges = [
|
|
494
|
+
32,
|
|
495
|
+
126,
|
|
496
|
+
162,
|
|
497
|
+
163,
|
|
498
|
+
165,
|
|
499
|
+
166,
|
|
500
|
+
172,
|
|
501
|
+
172,
|
|
502
|
+
175,
|
|
503
|
+
175,
|
|
504
|
+
10214,
|
|
505
|
+
10221,
|
|
506
|
+
10629,
|
|
507
|
+
10630
|
|
508
|
+
];
|
|
509
|
+
const wideRanges = [
|
|
510
|
+
4352,
|
|
511
|
+
4447,
|
|
512
|
+
8986,
|
|
513
|
+
8987,
|
|
514
|
+
9001,
|
|
515
|
+
9002,
|
|
516
|
+
9193,
|
|
517
|
+
9196,
|
|
518
|
+
9200,
|
|
519
|
+
9200,
|
|
520
|
+
9203,
|
|
521
|
+
9203,
|
|
522
|
+
9725,
|
|
523
|
+
9726,
|
|
524
|
+
9748,
|
|
525
|
+
9749,
|
|
526
|
+
9776,
|
|
527
|
+
9783,
|
|
528
|
+
9800,
|
|
529
|
+
9811,
|
|
530
|
+
9855,
|
|
531
|
+
9855,
|
|
532
|
+
9866,
|
|
533
|
+
9871,
|
|
534
|
+
9875,
|
|
535
|
+
9875,
|
|
536
|
+
9889,
|
|
537
|
+
9889,
|
|
538
|
+
9898,
|
|
539
|
+
9899,
|
|
540
|
+
9917,
|
|
541
|
+
9918,
|
|
542
|
+
9924,
|
|
543
|
+
9925,
|
|
544
|
+
9934,
|
|
545
|
+
9934,
|
|
546
|
+
9940,
|
|
547
|
+
9940,
|
|
548
|
+
9962,
|
|
549
|
+
9962,
|
|
550
|
+
9970,
|
|
551
|
+
9971,
|
|
552
|
+
9973,
|
|
553
|
+
9973,
|
|
554
|
+
9978,
|
|
555
|
+
9978,
|
|
556
|
+
9981,
|
|
557
|
+
9981,
|
|
558
|
+
9989,
|
|
559
|
+
9989,
|
|
560
|
+
9994,
|
|
561
|
+
9995,
|
|
562
|
+
10024,
|
|
563
|
+
10024,
|
|
564
|
+
10060,
|
|
565
|
+
10060,
|
|
566
|
+
10062,
|
|
567
|
+
10062,
|
|
568
|
+
10067,
|
|
569
|
+
10069,
|
|
570
|
+
10071,
|
|
571
|
+
10071,
|
|
572
|
+
10133,
|
|
573
|
+
10135,
|
|
574
|
+
10160,
|
|
575
|
+
10160,
|
|
576
|
+
10175,
|
|
577
|
+
10175,
|
|
578
|
+
11035,
|
|
579
|
+
11036,
|
|
580
|
+
11088,
|
|
581
|
+
11088,
|
|
582
|
+
11093,
|
|
583
|
+
11093,
|
|
584
|
+
11904,
|
|
585
|
+
11929,
|
|
586
|
+
11931,
|
|
587
|
+
12019,
|
|
588
|
+
12032,
|
|
589
|
+
12245,
|
|
590
|
+
12272,
|
|
591
|
+
12287,
|
|
592
|
+
12289,
|
|
593
|
+
12350,
|
|
594
|
+
12353,
|
|
595
|
+
12438,
|
|
596
|
+
12441,
|
|
597
|
+
12543,
|
|
598
|
+
12549,
|
|
599
|
+
12591,
|
|
600
|
+
12593,
|
|
601
|
+
12686,
|
|
602
|
+
12688,
|
|
603
|
+
12773,
|
|
604
|
+
12783,
|
|
605
|
+
12830,
|
|
606
|
+
12832,
|
|
607
|
+
12871,
|
|
608
|
+
12880,
|
|
609
|
+
42124,
|
|
610
|
+
42128,
|
|
611
|
+
42182,
|
|
612
|
+
43360,
|
|
613
|
+
43388,
|
|
614
|
+
44032,
|
|
615
|
+
55203,
|
|
616
|
+
63744,
|
|
617
|
+
64255,
|
|
618
|
+
65040,
|
|
619
|
+
65049,
|
|
620
|
+
65072,
|
|
621
|
+
65106,
|
|
622
|
+
65108,
|
|
623
|
+
65126,
|
|
624
|
+
65128,
|
|
625
|
+
65131,
|
|
626
|
+
94176,
|
|
627
|
+
94180,
|
|
628
|
+
94192,
|
|
629
|
+
94198,
|
|
630
|
+
94208,
|
|
631
|
+
101589,
|
|
632
|
+
101631,
|
|
633
|
+
101662,
|
|
634
|
+
101760,
|
|
635
|
+
101874,
|
|
636
|
+
110576,
|
|
637
|
+
110579,
|
|
638
|
+
110581,
|
|
639
|
+
110587,
|
|
640
|
+
110589,
|
|
641
|
+
110590,
|
|
642
|
+
110592,
|
|
643
|
+
110882,
|
|
644
|
+
110898,
|
|
645
|
+
110898,
|
|
646
|
+
110928,
|
|
647
|
+
110930,
|
|
648
|
+
110933,
|
|
649
|
+
110933,
|
|
650
|
+
110948,
|
|
651
|
+
110951,
|
|
652
|
+
110960,
|
|
653
|
+
111355,
|
|
654
|
+
119552,
|
|
655
|
+
119638,
|
|
656
|
+
119648,
|
|
657
|
+
119670,
|
|
658
|
+
126980,
|
|
659
|
+
126980,
|
|
660
|
+
127183,
|
|
661
|
+
127183,
|
|
662
|
+
127374,
|
|
663
|
+
127374,
|
|
664
|
+
127377,
|
|
665
|
+
127386,
|
|
666
|
+
127488,
|
|
667
|
+
127490,
|
|
668
|
+
127504,
|
|
669
|
+
127547,
|
|
670
|
+
127552,
|
|
671
|
+
127560,
|
|
672
|
+
127568,
|
|
673
|
+
127569,
|
|
674
|
+
127584,
|
|
675
|
+
127589,
|
|
676
|
+
127744,
|
|
677
|
+
127776,
|
|
678
|
+
127789,
|
|
679
|
+
127797,
|
|
680
|
+
127799,
|
|
681
|
+
127868,
|
|
682
|
+
127870,
|
|
683
|
+
127891,
|
|
684
|
+
127904,
|
|
685
|
+
127946,
|
|
686
|
+
127951,
|
|
687
|
+
127955,
|
|
688
|
+
127968,
|
|
689
|
+
127984,
|
|
690
|
+
127988,
|
|
691
|
+
127988,
|
|
692
|
+
127992,
|
|
693
|
+
128062,
|
|
694
|
+
128064,
|
|
695
|
+
128064,
|
|
696
|
+
128066,
|
|
697
|
+
128252,
|
|
698
|
+
128255,
|
|
699
|
+
128317,
|
|
700
|
+
128331,
|
|
701
|
+
128334,
|
|
702
|
+
128336,
|
|
703
|
+
128359,
|
|
704
|
+
128378,
|
|
705
|
+
128378,
|
|
706
|
+
128405,
|
|
707
|
+
128406,
|
|
708
|
+
128420,
|
|
709
|
+
128420,
|
|
710
|
+
128507,
|
|
711
|
+
128591,
|
|
712
|
+
128640,
|
|
713
|
+
128709,
|
|
714
|
+
128716,
|
|
715
|
+
128716,
|
|
716
|
+
128720,
|
|
717
|
+
128722,
|
|
718
|
+
128725,
|
|
719
|
+
128728,
|
|
720
|
+
128732,
|
|
721
|
+
128735,
|
|
722
|
+
128747,
|
|
723
|
+
128748,
|
|
724
|
+
128756,
|
|
725
|
+
128764,
|
|
726
|
+
128992,
|
|
727
|
+
129003,
|
|
728
|
+
129008,
|
|
729
|
+
129008,
|
|
730
|
+
129292,
|
|
731
|
+
129338,
|
|
732
|
+
129340,
|
|
733
|
+
129349,
|
|
734
|
+
129351,
|
|
735
|
+
129535,
|
|
736
|
+
129648,
|
|
737
|
+
129660,
|
|
738
|
+
129664,
|
|
739
|
+
129674,
|
|
740
|
+
129678,
|
|
741
|
+
129734,
|
|
742
|
+
129736,
|
|
743
|
+
129736,
|
|
744
|
+
129741,
|
|
745
|
+
129756,
|
|
746
|
+
129759,
|
|
747
|
+
129770,
|
|
748
|
+
129775,
|
|
749
|
+
129784,
|
|
750
|
+
131072,
|
|
751
|
+
196605,
|
|
752
|
+
196608,
|
|
753
|
+
262141
|
|
754
|
+
];
|
|
755
|
+
//#endregion
|
|
756
|
+
//#region ../../node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/utilities.js
|
|
757
|
+
/**
|
|
758
|
+
Binary search on a sorted flat array of [start, end] pairs.
|
|
759
|
+
|
|
760
|
+
@param {number[]} ranges - Flat array of inclusive [start, end] range pairs, e.g. [0, 5, 10, 20].
|
|
761
|
+
@param {number} codePoint - The value to search for.
|
|
762
|
+
@returns {boolean} Whether the value falls within any of the ranges.
|
|
763
|
+
*/
|
|
764
|
+
const isInRange = (ranges, codePoint) => {
|
|
765
|
+
let low = 0;
|
|
766
|
+
let high = Math.floor(ranges.length / 2) - 1;
|
|
767
|
+
while (low <= high) {
|
|
768
|
+
const mid = Math.floor((low + high) / 2);
|
|
769
|
+
const i = mid * 2;
|
|
770
|
+
if (codePoint < ranges[i]) high = mid - 1;
|
|
771
|
+
else if (codePoint > ranges[i + 1]) low = mid + 1;
|
|
772
|
+
else return true;
|
|
773
|
+
}
|
|
774
|
+
return false;
|
|
775
|
+
};
|
|
776
|
+
//#endregion
|
|
777
|
+
//#region ../../node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup.js
|
|
778
|
+
const minimumAmbiguousCodePoint = ambiguousRanges[0];
|
|
779
|
+
const maximumAmbiguousCodePoint = ambiguousRanges.at(-1);
|
|
780
|
+
const minimumFullWidthCodePoint = fullwidthRanges[0];
|
|
781
|
+
const maximumFullWidthCodePoint = fullwidthRanges.at(-1);
|
|
782
|
+
halfwidthRanges[0];
|
|
783
|
+
halfwidthRanges.at(-1);
|
|
784
|
+
narrowRanges[0];
|
|
785
|
+
narrowRanges.at(-1);
|
|
786
|
+
const minimumWideCodePoint = wideRanges[0];
|
|
787
|
+
const maximumWideCodePoint = wideRanges.at(-1);
|
|
788
|
+
const commonCjkCodePoint = 19968;
|
|
789
|
+
const [wideFastPathStart, wideFastPathEnd] = findWideFastPathRange(wideRanges);
|
|
790
|
+
function findWideFastPathRange(ranges) {
|
|
791
|
+
let fastPathStart = ranges[0];
|
|
792
|
+
let fastPathEnd = ranges[1];
|
|
793
|
+
for (let index = 0; index < ranges.length; index += 2) {
|
|
794
|
+
const start = ranges[index];
|
|
795
|
+
const end = ranges[index + 1];
|
|
796
|
+
if (commonCjkCodePoint >= start && commonCjkCodePoint <= end) return [start, end];
|
|
797
|
+
if (end - start > fastPathEnd - fastPathStart) {
|
|
798
|
+
fastPathStart = start;
|
|
799
|
+
fastPathEnd = end;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
return [fastPathStart, fastPathEnd];
|
|
803
|
+
}
|
|
804
|
+
const isAmbiguous = (codePoint) => {
|
|
805
|
+
if (codePoint < minimumAmbiguousCodePoint || codePoint > maximumAmbiguousCodePoint) return false;
|
|
806
|
+
return isInRange(ambiguousRanges, codePoint);
|
|
807
|
+
};
|
|
808
|
+
const isFullWidth = (codePoint) => {
|
|
809
|
+
if (codePoint < minimumFullWidthCodePoint || codePoint > maximumFullWidthCodePoint) return false;
|
|
810
|
+
return isInRange(fullwidthRanges, codePoint);
|
|
811
|
+
};
|
|
812
|
+
const isWide = (codePoint) => {
|
|
813
|
+
if (codePoint >= wideFastPathStart && codePoint <= wideFastPathEnd) return true;
|
|
814
|
+
if (codePoint < minimumWideCodePoint || codePoint > maximumWideCodePoint) return false;
|
|
815
|
+
return isInRange(wideRanges, codePoint);
|
|
816
|
+
};
|
|
817
|
+
//#endregion
|
|
818
|
+
//#region ../../node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/index.js
|
|
819
|
+
function validate(codePoint) {
|
|
820
|
+
if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
821
|
+
}
|
|
822
|
+
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
823
|
+
validate(codePoint);
|
|
824
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
|
|
825
|
+
return 1;
|
|
826
|
+
}
|
|
827
|
+
//#endregion
|
|
828
|
+
//#region ../../node_modules/.pnpm/string-width@8.2.2/node_modules/string-width/index.js
|
|
829
|
+
/**
|
|
830
|
+
Logic:
|
|
831
|
+
- Segment graphemes to match how terminals render clusters.
|
|
832
|
+
- Width rules:
|
|
833
|
+
1. Skip non-printing clusters (Default_Ignorable, Control, pure nonspacing/enclosing Mark, lone Surrogates). Tabs are ignored by design.
|
|
834
|
+
2. RGI emoji clusters (\p{RGI_Emoji}) are double-width.
|
|
835
|
+
3. Minimally-qualified/unqualified emoji clusters (ZWJ sequences with 2+ Extended_Pictographic, or keycap sequences) are double-width.
|
|
836
|
+
4. Hangul jamo collapse each standard modern Hangul L+V or L+V+T syllable piece to width 2.
|
|
837
|
+
Unmatched repeated leading/vowel/trailing jamo stay additive because that matches how the terminals we target render them.
|
|
838
|
+
5. Otherwise use East Asian Width of the cluster's first visible code point, and add widths for trailing spacing marks and Halfwidth/Fullwidth Forms within the same cluster (e.g., dakuten/handakuten/prolonged sound mark).
|
|
839
|
+
*/
|
|
840
|
+
const segmenter = new Intl.Segmenter();
|
|
841
|
+
const zeroWidthClusterRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Nonspacing_Mark}|\p{Enclosing_Mark}|\p{Surrogate})+$/v;
|
|
842
|
+
const leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Nonspacing_Mark}\p{Enclosing_Mark}\p{Surrogate}]+/v;
|
|
843
|
+
const spacingMarkRegex = /\p{Spacing_Mark}/v;
|
|
844
|
+
const rgiEmojiRegex = /^\p{RGI_Emoji}$/v;
|
|
845
|
+
const unqualifiedKeycapRegex = /^[\d#*]\u20E3$/;
|
|
846
|
+
const extendedPictographicRegex = /\p{Extended_Pictographic}/gu;
|
|
847
|
+
function isDoubleWidthNonRgiEmojiSequence(segment) {
|
|
848
|
+
if (segment.length > 50) return false;
|
|
849
|
+
if (unqualifiedKeycapRegex.test(segment)) return true;
|
|
850
|
+
if (segment.includes("")) {
|
|
851
|
+
const pictographics = segment.match(extendedPictographicRegex);
|
|
852
|
+
return pictographics !== null && pictographics.length >= 2;
|
|
853
|
+
}
|
|
854
|
+
return false;
|
|
855
|
+
}
|
|
856
|
+
function baseVisible(segment) {
|
|
857
|
+
return segment.replace(leadingNonPrintingRegex, "");
|
|
858
|
+
}
|
|
859
|
+
function isZeroWidthCluster(segment) {
|
|
860
|
+
return zeroWidthClusterRegex.test(segment);
|
|
861
|
+
}
|
|
862
|
+
function isHangulLeadingJamo(codePoint) {
|
|
863
|
+
return codePoint >= 4352 && codePoint <= 4447 || codePoint >= 43360 && codePoint <= 43388;
|
|
864
|
+
}
|
|
865
|
+
function isHangulVowelJamo(codePoint) {
|
|
866
|
+
return codePoint >= 4448 && codePoint <= 4519 || codePoint >= 55216 && codePoint <= 55238;
|
|
867
|
+
}
|
|
868
|
+
function isHangulTrailingJamo(codePoint) {
|
|
869
|
+
return codePoint >= 4520 && codePoint <= 4607 || codePoint >= 55243 && codePoint <= 55291;
|
|
870
|
+
}
|
|
871
|
+
function isHangulJamo(codePoint) {
|
|
872
|
+
return isHangulLeadingJamo(codePoint) || isHangulVowelJamo(codePoint) || isHangulTrailingJamo(codePoint);
|
|
873
|
+
}
|
|
874
|
+
function hangulClusterWidth(visibleSegment, eastAsianWidthOptions) {
|
|
875
|
+
const codePoints = [];
|
|
876
|
+
for (const character of visibleSegment) {
|
|
877
|
+
if (zeroWidthClusterRegex.test(character)) continue;
|
|
878
|
+
codePoints.push(character.codePointAt(0));
|
|
879
|
+
}
|
|
880
|
+
if (codePoints.length === 0) return;
|
|
881
|
+
let width = 0;
|
|
882
|
+
for (let index = 0; index < codePoints.length; index++) {
|
|
883
|
+
const codePoint = codePoints[index];
|
|
884
|
+
if (!isHangulJamo(codePoint)) {
|
|
885
|
+
if (width === 0) return;
|
|
886
|
+
for (let remaining = index; remaining < codePoints.length; remaining++) width += eastAsianWidth(codePoints[remaining], eastAsianWidthOptions);
|
|
887
|
+
return width;
|
|
888
|
+
}
|
|
889
|
+
if (isHangulLeadingJamo(codePoint) && isHangulVowelJamo(codePoints[index + 1])) {
|
|
890
|
+
width += 2;
|
|
891
|
+
index += isHangulTrailingJamo(codePoints[index + 2]) ? 2 : 1;
|
|
892
|
+
continue;
|
|
893
|
+
}
|
|
894
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
895
|
+
}
|
|
896
|
+
return width;
|
|
897
|
+
}
|
|
898
|
+
function trailingWidth(visibleSegment, eastAsianWidthOptions) {
|
|
899
|
+
let extra = 0;
|
|
900
|
+
let first = true;
|
|
901
|
+
for (const character of visibleSegment) {
|
|
902
|
+
if (first) {
|
|
903
|
+
first = false;
|
|
904
|
+
continue;
|
|
905
|
+
}
|
|
906
|
+
if (spacingMarkRegex.test(character) || character >= "" && character <= "") extra += eastAsianWidth(character.codePointAt(0), eastAsianWidthOptions);
|
|
907
|
+
}
|
|
908
|
+
return extra;
|
|
909
|
+
}
|
|
910
|
+
function stringWidth(input, options = {}) {
|
|
911
|
+
if (typeof input !== "string" || input.length === 0) return 0;
|
|
912
|
+
const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options;
|
|
913
|
+
let string = input;
|
|
914
|
+
if (!countAnsiEscapeCodes && (string.includes("\x1B") || string.includes(""))) string = stripAnsi(string);
|
|
915
|
+
if (string.length === 0) return 0;
|
|
916
|
+
if (/^[\u0020-\u007E]*$/.test(string)) return string.length;
|
|
917
|
+
let width = 0;
|
|
918
|
+
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
919
|
+
for (const { segment } of segmenter.segment(string)) {
|
|
920
|
+
if (isZeroWidthCluster(segment)) continue;
|
|
921
|
+
if (rgiEmojiRegex.test(segment) || isDoubleWidthNonRgiEmojiSequence(segment)) {
|
|
922
|
+
width += 2;
|
|
923
|
+
continue;
|
|
924
|
+
}
|
|
925
|
+
const visibleSegment = baseVisible(segment);
|
|
926
|
+
const hangulWidth = hangulClusterWidth(visibleSegment, eastAsianWidthOptions);
|
|
927
|
+
if (hangulWidth !== void 0) {
|
|
928
|
+
width += hangulWidth;
|
|
929
|
+
continue;
|
|
930
|
+
}
|
|
931
|
+
const codePoint = visibleSegment.codePointAt(0);
|
|
932
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
933
|
+
width += trailingWidth(visibleSegment, eastAsianWidthOptions);
|
|
934
|
+
}
|
|
935
|
+
return width;
|
|
936
|
+
}
|
|
937
|
+
//#endregion
|
|
938
|
+
//#region ../../packages/cli-utils/src/string-width.ts
|
|
939
|
+
const widthPadEnd = (str, targetWidth) => {
|
|
940
|
+
const w = stringWidth(str);
|
|
941
|
+
if (w >= targetWidth) return str;
|
|
942
|
+
return str + " ".repeat(targetWidth - w);
|
|
943
|
+
};
|
|
944
|
+
const widthTruncate = (str, maxWidth) => {
|
|
945
|
+
if (stringWidth(str) <= maxWidth) return str;
|
|
946
|
+
let width = 0;
|
|
947
|
+
let result = "";
|
|
948
|
+
for (const char of str) {
|
|
949
|
+
const charWidth = stringWidth(char);
|
|
950
|
+
if (width + charWidth > maxWidth - 1) break;
|
|
951
|
+
result += char;
|
|
952
|
+
width += charWidth;
|
|
953
|
+
}
|
|
954
|
+
return `${result}…`;
|
|
955
|
+
};
|
|
956
|
+
//#endregion
|
|
957
|
+
//#region ../../packages/cli-utils/src/table.ts
|
|
958
|
+
const printTable = (rows) => {
|
|
959
|
+
if (rows.length === 0) return;
|
|
960
|
+
const columnCount = rows[0].length;
|
|
961
|
+
const widths = [];
|
|
962
|
+
for (let col = 0; col < columnCount; col++) {
|
|
963
|
+
let max = stringWidth(rows[0][col].header);
|
|
964
|
+
for (const row of rows) {
|
|
965
|
+
const w = stringWidth(row[col].value);
|
|
966
|
+
if (w > max) max = w;
|
|
967
|
+
}
|
|
968
|
+
widths.push(max);
|
|
969
|
+
}
|
|
970
|
+
const header = widths.map((w, i) => widthPadEnd(rows[0][i].header, w)).join(" ");
|
|
971
|
+
consola.log(header);
|
|
972
|
+
for (const row of rows) {
|
|
973
|
+
const line = widths.map((w, i) => {
|
|
974
|
+
const isLast = i === widths.length - 1;
|
|
975
|
+
const val = widthTruncate(row[i].value, w);
|
|
976
|
+
return isLast ? val : widthPadEnd(val, w);
|
|
977
|
+
}).join(" ");
|
|
978
|
+
consola.log(line);
|
|
979
|
+
}
|
|
980
|
+
};
|
|
981
|
+
//#endregion
|
|
982
|
+
//#region ../../packages/cli-utils/src/definition-list.ts
|
|
983
|
+
const printDefinitionList = (items, indent = 4) => {
|
|
984
|
+
const filtered = items.filter((item) => item[1] !== null && item[1] !== void 0 && item[1] !== "");
|
|
985
|
+
if (filtered.length === 0) return;
|
|
986
|
+
const maxLabel = Math.max(...filtered.map(([label]) => stringWidth(label)));
|
|
987
|
+
const pad = " ".repeat(indent);
|
|
988
|
+
for (const [label, value] of filtered) consola.log(`${pad}${widthPadEnd(label, maxLabel)} ${value}`);
|
|
989
|
+
};
|
|
990
|
+
//#endregion
|
|
991
|
+
//#region ../../packages/cli-utils/src/validation-error.ts
|
|
992
|
+
/**
|
|
993
|
+
* Handles ValiError from hey-api's response validators.
|
|
994
|
+
* Returns true if the error was a ValiError and was handled.
|
|
995
|
+
*/
|
|
996
|
+
const handleValidationError = (error) => {
|
|
997
|
+
if (!(error instanceof ValiError)) return false;
|
|
998
|
+
consola.error("API response validation failed.");
|
|
999
|
+
const flat = flatten(error.issues);
|
|
1000
|
+
consola.debug("Validation details:");
|
|
1001
|
+
if (flat.root) consola.debug(` (root): ${flat.root.join(", ")}`);
|
|
1002
|
+
if (flat.nested) for (const [field, errors] of Object.entries(flat.nested)) consola.debug(` ${field}: ${errors?.join(", ")}`);
|
|
1003
|
+
if (flat.other) consola.debug(` (other): ${flat.other.join(", ")}`);
|
|
1004
|
+
consola.debug("Raw error:", error);
|
|
1005
|
+
return true;
|
|
1006
|
+
};
|
|
1007
|
+
//#endregion
|
|
1008
|
+
export { parseArg as a, confirmOrExit as c, splitArg as i, promptRequired as l, printDefinitionList as n, vFiniteNumber as o, printTable as r, vInteger as s, handleValidationError as t, UserError as u };
|