@bamboocss/node 1.11.1

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/index.mjs ADDED
@@ -0,0 +1,2959 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __esm = (fn, res) => function __init() {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ };
10
+ var __commonJS = (cb, mod) => function __require() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+
30
+ // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.3_@swc+helpers@0.5.17__jiti@2.7.0_postcss@8.5.14_tsx@4.20.6_typescript@6.0.2_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js
31
+ import path from "path";
32
+ import { fileURLToPath } from "url";
33
+ var init_esm_shims = __esm({
34
+ "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.3_@swc+helpers@0.5.17__jiti@2.7.0_postcss@8.5.14_tsx@4.20.6_typescript@6.0.2_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js"() {
35
+ "use strict";
36
+ }
37
+ });
38
+
39
+ // ../../node_modules/.pnpm/cli-boxes@3.0.0/node_modules/cli-boxes/boxes.json
40
+ var require_boxes = __commonJS({
41
+ "../../node_modules/.pnpm/cli-boxes@3.0.0/node_modules/cli-boxes/boxes.json"(exports, module) {
42
+ module.exports = {
43
+ single: {
44
+ topLeft: "\u250C",
45
+ top: "\u2500",
46
+ topRight: "\u2510",
47
+ right: "\u2502",
48
+ bottomRight: "\u2518",
49
+ bottom: "\u2500",
50
+ bottomLeft: "\u2514",
51
+ left: "\u2502"
52
+ },
53
+ double: {
54
+ topLeft: "\u2554",
55
+ top: "\u2550",
56
+ topRight: "\u2557",
57
+ right: "\u2551",
58
+ bottomRight: "\u255D",
59
+ bottom: "\u2550",
60
+ bottomLeft: "\u255A",
61
+ left: "\u2551"
62
+ },
63
+ round: {
64
+ topLeft: "\u256D",
65
+ top: "\u2500",
66
+ topRight: "\u256E",
67
+ right: "\u2502",
68
+ bottomRight: "\u256F",
69
+ bottom: "\u2500",
70
+ bottomLeft: "\u2570",
71
+ left: "\u2502"
72
+ },
73
+ bold: {
74
+ topLeft: "\u250F",
75
+ top: "\u2501",
76
+ topRight: "\u2513",
77
+ right: "\u2503",
78
+ bottomRight: "\u251B",
79
+ bottom: "\u2501",
80
+ bottomLeft: "\u2517",
81
+ left: "\u2503"
82
+ },
83
+ singleDouble: {
84
+ topLeft: "\u2553",
85
+ top: "\u2500",
86
+ topRight: "\u2556",
87
+ right: "\u2551",
88
+ bottomRight: "\u255C",
89
+ bottom: "\u2500",
90
+ bottomLeft: "\u2559",
91
+ left: "\u2551"
92
+ },
93
+ doubleSingle: {
94
+ topLeft: "\u2552",
95
+ top: "\u2550",
96
+ topRight: "\u2555",
97
+ right: "\u2502",
98
+ bottomRight: "\u255B",
99
+ bottom: "\u2550",
100
+ bottomLeft: "\u2558",
101
+ left: "\u2502"
102
+ },
103
+ classic: {
104
+ topLeft: "+",
105
+ top: "-",
106
+ topRight: "+",
107
+ right: "|",
108
+ bottomRight: "+",
109
+ bottom: "-",
110
+ bottomLeft: "+",
111
+ left: "|"
112
+ },
113
+ arrow: {
114
+ topLeft: "\u2198",
115
+ top: "\u2193",
116
+ topRight: "\u2199",
117
+ right: "\u2190",
118
+ bottomRight: "\u2196",
119
+ bottom: "\u2191",
120
+ bottomLeft: "\u2197",
121
+ left: "\u2192"
122
+ }
123
+ };
124
+ }
125
+ });
126
+
127
+ // ../../node_modules/.pnpm/cli-boxes@3.0.0/node_modules/cli-boxes/index.js
128
+ var require_cli_boxes = __commonJS({
129
+ "../../node_modules/.pnpm/cli-boxes@3.0.0/node_modules/cli-boxes/index.js"(exports, module) {
130
+ "use strict";
131
+ init_esm_shims();
132
+ var cliBoxes2 = require_boxes();
133
+ module.exports = cliBoxes2;
134
+ module.exports.default = cliBoxes2;
135
+ }
136
+ });
137
+
138
+ // ../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js
139
+ var require_ansi_regex = __commonJS({
140
+ "../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js"(exports, module) {
141
+ "use strict";
142
+ init_esm_shims();
143
+ module.exports = ({ onlyFirst = false } = {}) => {
144
+ const pattern = [
145
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
146
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
147
+ ].join("|");
148
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
149
+ };
150
+ }
151
+ });
152
+
153
+ // ../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js
154
+ var require_strip_ansi = __commonJS({
155
+ "../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js"(exports, module) {
156
+ "use strict";
157
+ init_esm_shims();
158
+ var ansiRegex2 = require_ansi_regex();
159
+ module.exports = (string) => typeof string === "string" ? string.replace(ansiRegex2(), "") : string;
160
+ }
161
+ });
162
+
163
+ // ../../node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js
164
+ var require_is_fullwidth_code_point = __commonJS({
165
+ "../../node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js"(exports, module) {
166
+ "use strict";
167
+ init_esm_shims();
168
+ var isFullwidthCodePoint = (codePoint) => {
169
+ if (Number.isNaN(codePoint)) {
170
+ return false;
171
+ }
172
+ if (codePoint >= 4352 && (codePoint <= 4447 || // Hangul Jamo
173
+ codePoint === 9001 || // LEFT-POINTING ANGLE BRACKET
174
+ codePoint === 9002 || // RIGHT-POINTING ANGLE BRACKET
175
+ // CJK Radicals Supplement .. Enclosed CJK Letters and Months
176
+ 11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
177
+ 12880 <= codePoint && codePoint <= 19903 || // CJK Unified Ideographs .. Yi Radicals
178
+ 19968 <= codePoint && codePoint <= 42182 || // Hangul Jamo Extended-A
179
+ 43360 <= codePoint && codePoint <= 43388 || // Hangul Syllables
180
+ 44032 <= codePoint && codePoint <= 55203 || // CJK Compatibility Ideographs
181
+ 63744 <= codePoint && codePoint <= 64255 || // Vertical Forms
182
+ 65040 <= codePoint && codePoint <= 65049 || // CJK Compatibility Forms .. Small Form Variants
183
+ 65072 <= codePoint && codePoint <= 65131 || // Halfwidth and Fullwidth Forms
184
+ 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || // Kana Supplement
185
+ 110592 <= codePoint && codePoint <= 110593 || // Enclosed Ideographic Supplement
186
+ 127488 <= codePoint && codePoint <= 127569 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
187
+ 131072 <= codePoint && codePoint <= 262141)) {
188
+ return true;
189
+ }
190
+ return false;
191
+ };
192
+ module.exports = isFullwidthCodePoint;
193
+ module.exports.default = isFullwidthCodePoint;
194
+ }
195
+ });
196
+
197
+ // ../../node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js
198
+ var require_emoji_regex = __commonJS({
199
+ "../../node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js"(exports, module) {
200
+ "use strict";
201
+ init_esm_shims();
202
+ module.exports = function() {
203
+ return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
204
+ };
205
+ }
206
+ });
207
+
208
+ // ../../node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js
209
+ var require_string_width = __commonJS({
210
+ "../../node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js"(exports, module) {
211
+ "use strict";
212
+ init_esm_shims();
213
+ var stripAnsi2 = require_strip_ansi();
214
+ var isFullwidthCodePoint = require_is_fullwidth_code_point();
215
+ var emojiRegex = require_emoji_regex();
216
+ var stringWidth2 = (string) => {
217
+ if (typeof string !== "string" || string.length === 0) {
218
+ return 0;
219
+ }
220
+ string = stripAnsi2(string);
221
+ if (string.length === 0) {
222
+ return 0;
223
+ }
224
+ string = string.replace(emojiRegex(), " ");
225
+ let width = 0;
226
+ for (let i = 0; i < string.length; i++) {
227
+ const code = string.codePointAt(i);
228
+ if (code <= 31 || code >= 127 && code <= 159) {
229
+ continue;
230
+ }
231
+ if (code >= 768 && code <= 879) {
232
+ continue;
233
+ }
234
+ if (code > 65535) {
235
+ i++;
236
+ }
237
+ width += isFullwidthCodePoint(code) ? 2 : 1;
238
+ }
239
+ return width;
240
+ };
241
+ module.exports = stringWidth2;
242
+ module.exports.default = stringWidth2;
243
+ }
244
+ });
245
+
246
+ // ../../node_modules/.pnpm/ansi-align@3.0.1/node_modules/ansi-align/index.js
247
+ var require_ansi_align = __commonJS({
248
+ "../../node_modules/.pnpm/ansi-align@3.0.1/node_modules/ansi-align/index.js"(exports, module) {
249
+ "use strict";
250
+ init_esm_shims();
251
+ var stringWidth2 = require_string_width();
252
+ function ansiAlign2(text, opts) {
253
+ if (!text) return text;
254
+ opts = opts || {};
255
+ const align = opts.align || "center";
256
+ if (align === "left") return text;
257
+ const split = opts.split || "\n";
258
+ const pad = opts.pad || " ";
259
+ const widthDiffFn = align !== "right" ? halfDiff : fullDiff;
260
+ let returnString = false;
261
+ if (!Array.isArray(text)) {
262
+ returnString = true;
263
+ text = String(text).split(split);
264
+ }
265
+ let width;
266
+ let maxWidth = 0;
267
+ text = text.map(function(str) {
268
+ str = String(str);
269
+ width = stringWidth2(str);
270
+ maxWidth = Math.max(width, maxWidth);
271
+ return {
272
+ str,
273
+ width
274
+ };
275
+ }).map(function(obj) {
276
+ return new Array(widthDiffFn(maxWidth, obj.width) + 1).join(pad) + obj.str;
277
+ });
278
+ return returnString ? text.join(split) : text;
279
+ }
280
+ ansiAlign2.left = function left(text) {
281
+ return ansiAlign2(text, { align: "left" });
282
+ };
283
+ ansiAlign2.center = function center(text) {
284
+ return ansiAlign2(text, { align: "center" });
285
+ };
286
+ ansiAlign2.right = function right(text) {
287
+ return ansiAlign2(text, { align: "right" });
288
+ };
289
+ module.exports = ansiAlign2;
290
+ function halfDiff(maxWidth, curWidth) {
291
+ return Math.floor((maxWidth - curWidth) / 2);
292
+ }
293
+ function fullDiff(maxWidth, curWidth) {
294
+ return maxWidth - curWidth;
295
+ }
296
+ }
297
+ });
298
+
299
+ // src/index.ts
300
+ init_esm_shims();
301
+
302
+ // src/analyze.ts
303
+ init_esm_shims();
304
+ import { Reporter, formatRecipeReport, formatTokenReport } from "@bamboocss/reporter";
305
+ function analyze(ctx, options = {}) {
306
+ const reporter = new Reporter(ctx, {
307
+ project: ctx.project,
308
+ getRelativePath: ctx.runtime.path.relative,
309
+ getFiles: ctx.getFiles,
310
+ ...options
311
+ });
312
+ reporter.init();
313
+ return {
314
+ getRecipeReport(format = "table") {
315
+ const report = reporter.getRecipeReport();
316
+ return { report, formatted: formatRecipeReport(report, format) };
317
+ },
318
+ getTokenReport(format = "table") {
319
+ const report = reporter.getTokenReport();
320
+ return { report, formatted: formatTokenReport(report.getSummary(), format) };
321
+ },
322
+ writeReport(filePath) {
323
+ const dirname2 = ctx.runtime.path.dirname(filePath);
324
+ ctx.runtime.fs.ensureDirSync(dirname2);
325
+ const str = JSON.stringify(reporter.report, replacer, 2);
326
+ return ctx.runtime.fs.writeFile(filePath, str);
327
+ }
328
+ };
329
+ }
330
+ function replacer(_, value) {
331
+ if (value instanceof Set) return Array.from(value);
332
+ if (value instanceof Map) return Object.fromEntries(value);
333
+ return value;
334
+ }
335
+
336
+ // src/build-info.ts
337
+ init_esm_shims();
338
+ import { colors, logger } from "@bamboocss/logger";
339
+ async function buildInfo(ctx, outfile) {
340
+ const { filesWithCss, files } = ctx.parseFiles();
341
+ logger.info("cli", `Found ${colors.bold(`${filesWithCss.length}/${files.length}`)} files using Bamboo`);
342
+ const { minify, staticCss } = ctx.config;
343
+ logger.info("cli", `Writing ${minify ? "[min] " : " "}${colors.bold(outfile)}`);
344
+ if (staticCss) {
345
+ logger.info("cli", "Adding staticCss definitions...");
346
+ ctx.staticCss.process(staticCss);
347
+ }
348
+ const output = JSON.stringify(ctx.encoder.toJSON(), null, minify ? 0 : 2);
349
+ ctx.output.ensure(outfile, process.cwd());
350
+ await ctx.runtime.fs.writeFile(outfile, output);
351
+ logger.info("cli", "Done!");
352
+ }
353
+
354
+ // src/builder.ts
355
+ init_esm_shims();
356
+ import { findConfig, getConfigDependencies } from "@bamboocss/config";
357
+ import { logger as logger5 } from "@bamboocss/logger";
358
+ import { BambooError, uniq as uniq2 } from "@bamboocss/shared";
359
+ import { existsSync, statSync } from "fs";
360
+ import { normalize as normalize2, resolve as resolve3 } from "path";
361
+
362
+ // src/codegen.ts
363
+ init_esm_shims();
364
+ async function codegen(ctx, ids) {
365
+ const { default: pLimit } = await import("p-limit");
366
+ const limit = pLimit(20);
367
+ if (ctx.config.clean) ctx.output.empty();
368
+ let artifacts = ctx.getArtifacts(ids);
369
+ if (ctx.hooks["codegen:prepare"]) {
370
+ const results = await ctx.hooks["codegen:prepare"]?.({ changed: ids, artifacts });
371
+ if (results) artifacts = results;
372
+ }
373
+ const promises = artifacts.map((artifact) => limit(() => ctx.output.write(artifact)));
374
+ await Promise.allSettled(promises);
375
+ await ctx.hooks["codegen:done"]?.({ changed: ids });
376
+ return {
377
+ box: ctx.initMessage(),
378
+ msg: ctx.messages.artifactsGenerated()
379
+ };
380
+ }
381
+
382
+ // src/config.ts
383
+ init_esm_shims();
384
+ import { loadConfig as loadConfig2, mergeHooks } from "@bamboocss/config";
385
+ import { pluginLightningcss } from "@bamboocss/plugin-lightningcss";
386
+ import { pluginSvelte } from "@bamboocss/plugin-svelte";
387
+ import { pluginVue } from "@bamboocss/plugin-vue";
388
+ import browserslist from "browserslist";
389
+
390
+ // src/create-context.ts
391
+ init_esm_shims();
392
+ import { Generator as Generator2 } from "@bamboocss/generator";
393
+ import { logger as logger4 } from "@bamboocss/logger";
394
+ import { Project } from "@bamboocss/parser";
395
+ import { uniq } from "@bamboocss/shared";
396
+ import { debounce } from "perfect-debounce";
397
+
398
+ // src/cli-box.ts
399
+ init_esm_shims();
400
+
401
+ // ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
402
+ init_esm_shims();
403
+ import process3 from "process";
404
+
405
+ // ../../node_modules/.pnpm/string-width@7.2.0/node_modules/string-width/index.js
406
+ init_esm_shims();
407
+
408
+ // ../../node_modules/.pnpm/strip-ansi@7.1.2/node_modules/strip-ansi/index.js
409
+ init_esm_shims();
410
+
411
+ // ../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
412
+ init_esm_shims();
413
+ function ansiRegex({ onlyFirst = false } = {}) {
414
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
415
+ const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
416
+ const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
417
+ const pattern = `${osc}|${csi}`;
418
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
419
+ }
420
+
421
+ // ../../node_modules/.pnpm/strip-ansi@7.1.2/node_modules/strip-ansi/index.js
422
+ var regex = ansiRegex();
423
+ function stripAnsi(string) {
424
+ if (typeof string !== "string") {
425
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
426
+ }
427
+ return string.replace(regex, "");
428
+ }
429
+
430
+ // ../../node_modules/.pnpm/get-east-asian-width@1.4.0/node_modules/get-east-asian-width/index.js
431
+ init_esm_shims();
432
+
433
+ // ../../node_modules/.pnpm/get-east-asian-width@1.4.0/node_modules/get-east-asian-width/lookup.js
434
+ init_esm_shims();
435
+ function isAmbiguous(x) {
436
+ return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
437
+ }
438
+ function isFullWidth(x) {
439
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
440
+ }
441
+ function isWide(x) {
442
+ return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x >= 94192 && x <= 94198 || x >= 94208 && x <= 101589 || x >= 101631 && x <= 101662 || x >= 101760 && x <= 101874 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128728 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129674 || x >= 129678 && x <= 129734 || x === 129736 || x >= 129741 && x <= 129756 || x >= 129759 && x <= 129770 || x >= 129775 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
443
+ }
444
+
445
+ // ../../node_modules/.pnpm/get-east-asian-width@1.4.0/node_modules/get-east-asian-width/index.js
446
+ function validate(codePoint) {
447
+ if (!Number.isSafeInteger(codePoint)) {
448
+ throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
449
+ }
450
+ }
451
+ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
452
+ validate(codePoint);
453
+ if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
454
+ return 2;
455
+ }
456
+ return 1;
457
+ }
458
+
459
+ // ../../node_modules/.pnpm/emoji-regex@10.6.0/node_modules/emoji-regex/index.mjs
460
+ init_esm_shims();
461
+ var emoji_regex_default = () => {
462
+ return /[#*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-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
463
+ };
464
+
465
+ // ../../node_modules/.pnpm/string-width@7.2.0/node_modules/string-width/index.js
466
+ var segmenter = new Intl.Segmenter();
467
+ var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
468
+ function stringWidth(string, options = {}) {
469
+ if (typeof string !== "string" || string.length === 0) {
470
+ return 0;
471
+ }
472
+ const {
473
+ ambiguousIsNarrow = true,
474
+ countAnsiEscapeCodes = false
475
+ } = options;
476
+ if (!countAnsiEscapeCodes) {
477
+ string = stripAnsi(string);
478
+ }
479
+ if (string.length === 0) {
480
+ return 0;
481
+ }
482
+ let width = 0;
483
+ const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
484
+ for (const { segment: character } of segmenter.segment(string)) {
485
+ const codePoint = character.codePointAt(0);
486
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
487
+ continue;
488
+ }
489
+ if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
490
+ continue;
491
+ }
492
+ if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
493
+ continue;
494
+ }
495
+ if (codePoint >= 55296 && codePoint <= 57343) {
496
+ continue;
497
+ }
498
+ if (codePoint >= 65024 && codePoint <= 65039) {
499
+ continue;
500
+ }
501
+ if (defaultIgnorableCodePointRegex.test(character)) {
502
+ continue;
503
+ }
504
+ if (emoji_regex_default().test(character)) {
505
+ width += 2;
506
+ continue;
507
+ }
508
+ width += eastAsianWidth(codePoint, eastAsianWidthOptions);
509
+ }
510
+ return width;
511
+ }
512
+
513
+ // ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
514
+ init_esm_shims();
515
+
516
+ // ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
517
+ init_esm_shims();
518
+ var ANSI_BACKGROUND_OFFSET = 10;
519
+ var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
520
+ var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
521
+ var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
522
+ var styles = {
523
+ modifier: {
524
+ reset: [0, 0],
525
+ // 21 isn't widely supported and 22 does the same thing
526
+ bold: [1, 22],
527
+ dim: [2, 22],
528
+ italic: [3, 23],
529
+ underline: [4, 24],
530
+ overline: [53, 55],
531
+ inverse: [7, 27],
532
+ hidden: [8, 28],
533
+ strikethrough: [9, 29]
534
+ },
535
+ color: {
536
+ black: [30, 39],
537
+ red: [31, 39],
538
+ green: [32, 39],
539
+ yellow: [33, 39],
540
+ blue: [34, 39],
541
+ magenta: [35, 39],
542
+ cyan: [36, 39],
543
+ white: [37, 39],
544
+ // Bright color
545
+ blackBright: [90, 39],
546
+ gray: [90, 39],
547
+ // Alias of `blackBright`
548
+ grey: [90, 39],
549
+ // Alias of `blackBright`
550
+ redBright: [91, 39],
551
+ greenBright: [92, 39],
552
+ yellowBright: [93, 39],
553
+ blueBright: [94, 39],
554
+ magentaBright: [95, 39],
555
+ cyanBright: [96, 39],
556
+ whiteBright: [97, 39]
557
+ },
558
+ bgColor: {
559
+ bgBlack: [40, 49],
560
+ bgRed: [41, 49],
561
+ bgGreen: [42, 49],
562
+ bgYellow: [43, 49],
563
+ bgBlue: [44, 49],
564
+ bgMagenta: [45, 49],
565
+ bgCyan: [46, 49],
566
+ bgWhite: [47, 49],
567
+ // Bright color
568
+ bgBlackBright: [100, 49],
569
+ bgGray: [100, 49],
570
+ // Alias of `bgBlackBright`
571
+ bgGrey: [100, 49],
572
+ // Alias of `bgBlackBright`
573
+ bgRedBright: [101, 49],
574
+ bgGreenBright: [102, 49],
575
+ bgYellowBright: [103, 49],
576
+ bgBlueBright: [104, 49],
577
+ bgMagentaBright: [105, 49],
578
+ bgCyanBright: [106, 49],
579
+ bgWhiteBright: [107, 49]
580
+ }
581
+ };
582
+ var modifierNames = Object.keys(styles.modifier);
583
+ var foregroundColorNames = Object.keys(styles.color);
584
+ var backgroundColorNames = Object.keys(styles.bgColor);
585
+ var colorNames = [...foregroundColorNames, ...backgroundColorNames];
586
+ function assembleStyles() {
587
+ const codes = /* @__PURE__ */ new Map();
588
+ for (const [groupName, group] of Object.entries(styles)) {
589
+ for (const [styleName, style] of Object.entries(group)) {
590
+ styles[styleName] = {
591
+ open: `\x1B[${style[0]}m`,
592
+ close: `\x1B[${style[1]}m`
593
+ };
594
+ group[styleName] = styles[styleName];
595
+ codes.set(style[0], style[1]);
596
+ }
597
+ Object.defineProperty(styles, groupName, {
598
+ value: group,
599
+ enumerable: false
600
+ });
601
+ }
602
+ Object.defineProperty(styles, "codes", {
603
+ value: codes,
604
+ enumerable: false
605
+ });
606
+ styles.color.close = "\x1B[39m";
607
+ styles.bgColor.close = "\x1B[49m";
608
+ styles.color.ansi = wrapAnsi16();
609
+ styles.color.ansi256 = wrapAnsi256();
610
+ styles.color.ansi16m = wrapAnsi16m();
611
+ styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
612
+ styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
613
+ styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
614
+ Object.defineProperties(styles, {
615
+ rgbToAnsi256: {
616
+ value(red, green, blue) {
617
+ if (red === green && green === blue) {
618
+ if (red < 8) {
619
+ return 16;
620
+ }
621
+ if (red > 248) {
622
+ return 231;
623
+ }
624
+ return Math.round((red - 8) / 247 * 24) + 232;
625
+ }
626
+ return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
627
+ },
628
+ enumerable: false
629
+ },
630
+ hexToRgb: {
631
+ value(hex) {
632
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
633
+ if (!matches) {
634
+ return [0, 0, 0];
635
+ }
636
+ let [colorString] = matches;
637
+ if (colorString.length === 3) {
638
+ colorString = [...colorString].map((character) => character + character).join("");
639
+ }
640
+ const integer = Number.parseInt(colorString, 16);
641
+ return [
642
+ /* eslint-disable no-bitwise */
643
+ integer >> 16 & 255,
644
+ integer >> 8 & 255,
645
+ integer & 255
646
+ /* eslint-enable no-bitwise */
647
+ ];
648
+ },
649
+ enumerable: false
650
+ },
651
+ hexToAnsi256: {
652
+ value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
653
+ enumerable: false
654
+ },
655
+ ansi256ToAnsi: {
656
+ value(code) {
657
+ if (code < 8) {
658
+ return 30 + code;
659
+ }
660
+ if (code < 16) {
661
+ return 90 + (code - 8);
662
+ }
663
+ let red;
664
+ let green;
665
+ let blue;
666
+ if (code >= 232) {
667
+ red = ((code - 232) * 10 + 8) / 255;
668
+ green = red;
669
+ blue = red;
670
+ } else {
671
+ code -= 16;
672
+ const remainder = code % 36;
673
+ red = Math.floor(code / 36) / 5;
674
+ green = Math.floor(remainder / 6) / 5;
675
+ blue = remainder % 6 / 5;
676
+ }
677
+ const value = Math.max(red, green, blue) * 2;
678
+ if (value === 0) {
679
+ return 30;
680
+ }
681
+ let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
682
+ if (value === 2) {
683
+ result += 60;
684
+ }
685
+ return result;
686
+ },
687
+ enumerable: false
688
+ },
689
+ rgbToAnsi: {
690
+ value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
691
+ enumerable: false
692
+ },
693
+ hexToAnsi: {
694
+ value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
695
+ enumerable: false
696
+ }
697
+ });
698
+ return styles;
699
+ }
700
+ var ansiStyles = assembleStyles();
701
+ var ansi_styles_default = ansiStyles;
702
+
703
+ // ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
704
+ init_esm_shims();
705
+ import process2 from "process";
706
+ import os from "os";
707
+ import tty from "tty";
708
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
709
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
710
+ const position = argv.indexOf(prefix + flag);
711
+ const terminatorPosition = argv.indexOf("--");
712
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
713
+ }
714
+ var { env } = process2;
715
+ var flagForceColor;
716
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
717
+ flagForceColor = 0;
718
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
719
+ flagForceColor = 1;
720
+ }
721
+ function envForceColor() {
722
+ if ("FORCE_COLOR" in env) {
723
+ if (env.FORCE_COLOR === "true") {
724
+ return 1;
725
+ }
726
+ if (env.FORCE_COLOR === "false") {
727
+ return 0;
728
+ }
729
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
730
+ }
731
+ }
732
+ function translateLevel(level) {
733
+ if (level === 0) {
734
+ return false;
735
+ }
736
+ return {
737
+ level,
738
+ hasBasic: true,
739
+ has256: level >= 2,
740
+ has16m: level >= 3
741
+ };
742
+ }
743
+ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
744
+ const noFlagForceColor = envForceColor();
745
+ if (noFlagForceColor !== void 0) {
746
+ flagForceColor = noFlagForceColor;
747
+ }
748
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
749
+ if (forceColor === 0) {
750
+ return 0;
751
+ }
752
+ if (sniffFlags) {
753
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
754
+ return 3;
755
+ }
756
+ if (hasFlag("color=256")) {
757
+ return 2;
758
+ }
759
+ }
760
+ if ("TF_BUILD" in env && "AGENT_NAME" in env) {
761
+ return 1;
762
+ }
763
+ if (haveStream && !streamIsTTY && forceColor === void 0) {
764
+ return 0;
765
+ }
766
+ const min = forceColor || 0;
767
+ if (env.TERM === "dumb") {
768
+ return min;
769
+ }
770
+ if (process2.platform === "win32") {
771
+ const osRelease = os.release().split(".");
772
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
773
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
774
+ }
775
+ return 1;
776
+ }
777
+ if ("CI" in env) {
778
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
779
+ return 3;
780
+ }
781
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
782
+ return 1;
783
+ }
784
+ return min;
785
+ }
786
+ if ("TEAMCITY_VERSION" in env) {
787
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
788
+ }
789
+ if (env.COLORTERM === "truecolor") {
790
+ return 3;
791
+ }
792
+ if (env.TERM === "xterm-kitty") {
793
+ return 3;
794
+ }
795
+ if (env.TERM === "xterm-ghostty") {
796
+ return 3;
797
+ }
798
+ if (env.TERM === "wezterm") {
799
+ return 3;
800
+ }
801
+ if ("TERM_PROGRAM" in env) {
802
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
803
+ switch (env.TERM_PROGRAM) {
804
+ case "iTerm.app": {
805
+ return version >= 3 ? 3 : 2;
806
+ }
807
+ case "Apple_Terminal": {
808
+ return 2;
809
+ }
810
+ }
811
+ }
812
+ if (/-256(color)?$/i.test(env.TERM)) {
813
+ return 2;
814
+ }
815
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
816
+ return 1;
817
+ }
818
+ if ("COLORTERM" in env) {
819
+ return 1;
820
+ }
821
+ return min;
822
+ }
823
+ function createSupportsColor(stream, options = {}) {
824
+ const level = _supportsColor(stream, {
825
+ streamIsTTY: stream && stream.isTTY,
826
+ ...options
827
+ });
828
+ return translateLevel(level);
829
+ }
830
+ var supportsColor = {
831
+ stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
832
+ stderr: createSupportsColor({ isTTY: tty.isatty(2) })
833
+ };
834
+ var supports_color_default = supportsColor;
835
+
836
+ // ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
837
+ init_esm_shims();
838
+ function stringReplaceAll(string, substring, replacer2) {
839
+ let index = string.indexOf(substring);
840
+ if (index === -1) {
841
+ return string;
842
+ }
843
+ const substringLength = substring.length;
844
+ let endIndex = 0;
845
+ let returnValue = "";
846
+ do {
847
+ returnValue += string.slice(endIndex, index) + substring + replacer2;
848
+ endIndex = index + substringLength;
849
+ index = string.indexOf(substring, endIndex);
850
+ } while (index !== -1);
851
+ returnValue += string.slice(endIndex);
852
+ return returnValue;
853
+ }
854
+ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
855
+ let endIndex = 0;
856
+ let returnValue = "";
857
+ do {
858
+ const gotCR = string[index - 1] === "\r";
859
+ returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
860
+ endIndex = index + 1;
861
+ index = string.indexOf("\n", endIndex);
862
+ } while (index !== -1);
863
+ returnValue += string.slice(endIndex);
864
+ return returnValue;
865
+ }
866
+
867
+ // ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
868
+ var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
869
+ var GENERATOR = Symbol("GENERATOR");
870
+ var STYLER = Symbol("STYLER");
871
+ var IS_EMPTY = Symbol("IS_EMPTY");
872
+ var levelMapping = [
873
+ "ansi",
874
+ "ansi",
875
+ "ansi256",
876
+ "ansi16m"
877
+ ];
878
+ var styles2 = /* @__PURE__ */ Object.create(null);
879
+ var applyOptions = (object, options = {}) => {
880
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
881
+ throw new Error("The `level` option should be an integer from 0 to 3");
882
+ }
883
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
884
+ object.level = options.level === void 0 ? colorLevel : options.level;
885
+ };
886
+ var chalkFactory = (options) => {
887
+ const chalk2 = (...strings) => strings.join(" ");
888
+ applyOptions(chalk2, options);
889
+ Object.setPrototypeOf(chalk2, createChalk.prototype);
890
+ return chalk2;
891
+ };
892
+ function createChalk(options) {
893
+ return chalkFactory(options);
894
+ }
895
+ Object.setPrototypeOf(createChalk.prototype, Function.prototype);
896
+ for (const [styleName, style] of Object.entries(ansi_styles_default)) {
897
+ styles2[styleName] = {
898
+ get() {
899
+ const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
900
+ Object.defineProperty(this, styleName, { value: builder });
901
+ return builder;
902
+ }
903
+ };
904
+ }
905
+ styles2.visible = {
906
+ get() {
907
+ const builder = createBuilder(this, this[STYLER], true);
908
+ Object.defineProperty(this, "visible", { value: builder });
909
+ return builder;
910
+ }
911
+ };
912
+ var getModelAnsi = (model, level, type, ...arguments_) => {
913
+ if (model === "rgb") {
914
+ if (level === "ansi16m") {
915
+ return ansi_styles_default[type].ansi16m(...arguments_);
916
+ }
917
+ if (level === "ansi256") {
918
+ return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
919
+ }
920
+ return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
921
+ }
922
+ if (model === "hex") {
923
+ return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
924
+ }
925
+ return ansi_styles_default[type][model](...arguments_);
926
+ };
927
+ var usedModels = ["rgb", "hex", "ansi256"];
928
+ for (const model of usedModels) {
929
+ styles2[model] = {
930
+ get() {
931
+ const { level } = this;
932
+ return function(...arguments_) {
933
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
934
+ return createBuilder(this, styler, this[IS_EMPTY]);
935
+ };
936
+ }
937
+ };
938
+ const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
939
+ styles2[bgModel] = {
940
+ get() {
941
+ const { level } = this;
942
+ return function(...arguments_) {
943
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
944
+ return createBuilder(this, styler, this[IS_EMPTY]);
945
+ };
946
+ }
947
+ };
948
+ }
949
+ var proto = Object.defineProperties(() => {
950
+ }, {
951
+ ...styles2,
952
+ level: {
953
+ enumerable: true,
954
+ get() {
955
+ return this[GENERATOR].level;
956
+ },
957
+ set(level) {
958
+ this[GENERATOR].level = level;
959
+ }
960
+ }
961
+ });
962
+ var createStyler = (open, close, parent) => {
963
+ let openAll;
964
+ let closeAll;
965
+ if (parent === void 0) {
966
+ openAll = open;
967
+ closeAll = close;
968
+ } else {
969
+ openAll = parent.openAll + open;
970
+ closeAll = close + parent.closeAll;
971
+ }
972
+ return {
973
+ open,
974
+ close,
975
+ openAll,
976
+ closeAll,
977
+ parent
978
+ };
979
+ };
980
+ var createBuilder = (self, _styler, _isEmpty) => {
981
+ const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
982
+ Object.setPrototypeOf(builder, proto);
983
+ builder[GENERATOR] = self;
984
+ builder[STYLER] = _styler;
985
+ builder[IS_EMPTY] = _isEmpty;
986
+ return builder;
987
+ };
988
+ var applyStyle = (self, string) => {
989
+ if (self.level <= 0 || !string) {
990
+ return self[IS_EMPTY] ? "" : string;
991
+ }
992
+ let styler = self[STYLER];
993
+ if (styler === void 0) {
994
+ return string;
995
+ }
996
+ const { openAll, closeAll } = styler;
997
+ if (string.includes("\x1B")) {
998
+ while (styler !== void 0) {
999
+ string = stringReplaceAll(string, styler.close, styler.open);
1000
+ styler = styler.parent;
1001
+ }
1002
+ }
1003
+ const lfIndex = string.indexOf("\n");
1004
+ if (lfIndex !== -1) {
1005
+ string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
1006
+ }
1007
+ return openAll + string + closeAll;
1008
+ };
1009
+ Object.defineProperties(createChalk.prototype, styles2);
1010
+ var chalk = createChalk();
1011
+ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
1012
+ var source_default = chalk;
1013
+
1014
+ // ../../node_modules/.pnpm/widest-line@5.0.0/node_modules/widest-line/index.js
1015
+ init_esm_shims();
1016
+ function widestLine(string) {
1017
+ let lineWidth = 0;
1018
+ for (const line of string.split("\n")) {
1019
+ lineWidth = Math.max(lineWidth, stringWidth(line));
1020
+ }
1021
+ return lineWidth;
1022
+ }
1023
+
1024
+ // ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
1025
+ var import_cli_boxes = __toESM(require_cli_boxes(), 1);
1026
+
1027
+ // ../../node_modules/.pnpm/camelcase@8.0.0/node_modules/camelcase/index.js
1028
+ init_esm_shims();
1029
+ var UPPERCASE = /[\p{Lu}]/u;
1030
+ var LOWERCASE = /[\p{Ll}]/u;
1031
+ var LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
1032
+ var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
1033
+ var SEPARATORS = /[_.\- ]+/;
1034
+ var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
1035
+ var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
1036
+ var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
1037
+ var preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase2) => {
1038
+ let isLastCharLower = false;
1039
+ let isLastCharUpper = false;
1040
+ let isLastLastCharUpper = false;
1041
+ let isLastLastCharPreserved = false;
1042
+ for (let index = 0; index < string.length; index++) {
1043
+ const character = string[index];
1044
+ isLastLastCharPreserved = index > 2 ? string[index - 3] === "-" : true;
1045
+ if (isLastCharLower && UPPERCASE.test(character)) {
1046
+ string = string.slice(0, index) + "-" + string.slice(index);
1047
+ isLastCharLower = false;
1048
+ isLastLastCharUpper = isLastCharUpper;
1049
+ isLastCharUpper = true;
1050
+ index++;
1051
+ } else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase2)) {
1052
+ string = string.slice(0, index - 1) + "-" + string.slice(index - 1);
1053
+ isLastLastCharUpper = isLastCharUpper;
1054
+ isLastCharUpper = false;
1055
+ isLastCharLower = true;
1056
+ } else {
1057
+ isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
1058
+ isLastLastCharUpper = isLastCharUpper;
1059
+ isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
1060
+ }
1061
+ }
1062
+ return string;
1063
+ };
1064
+ var preserveConsecutiveUppercase = (input, toLowerCase) => {
1065
+ LEADING_CAPITAL.lastIndex = 0;
1066
+ return input.replaceAll(LEADING_CAPITAL, (match) => toLowerCase(match));
1067
+ };
1068
+ var postProcess = (input, toUpperCase) => {
1069
+ SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
1070
+ NUMBERS_AND_IDENTIFIER.lastIndex = 0;
1071
+ return input.replaceAll(NUMBERS_AND_IDENTIFIER, (match, pattern, offset) => ["_", "-"].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match)).replaceAll(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier));
1072
+ };
1073
+ function camelCase(input, options) {
1074
+ if (!(typeof input === "string" || Array.isArray(input))) {
1075
+ throw new TypeError("Expected the input to be `string | string[]`");
1076
+ }
1077
+ options = {
1078
+ pascalCase: false,
1079
+ preserveConsecutiveUppercase: false,
1080
+ ...options
1081
+ };
1082
+ if (Array.isArray(input)) {
1083
+ input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
1084
+ } else {
1085
+ input = input.trim();
1086
+ }
1087
+ if (input.length === 0) {
1088
+ return "";
1089
+ }
1090
+ const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale);
1091
+ const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale);
1092
+ if (input.length === 1) {
1093
+ if (SEPARATORS.test(input)) {
1094
+ return "";
1095
+ }
1096
+ return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
1097
+ }
1098
+ const hasUpperCase = input !== toLowerCase(input);
1099
+ if (hasUpperCase) {
1100
+ input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);
1101
+ }
1102
+ input = input.replace(LEADING_SEPARATORS, "");
1103
+ input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
1104
+ if (options.pascalCase) {
1105
+ input = toUpperCase(input.charAt(0)) + input.slice(1);
1106
+ }
1107
+ return postProcess(input, toUpperCase);
1108
+ }
1109
+
1110
+ // ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
1111
+ var import_ansi_align = __toESM(require_ansi_align(), 1);
1112
+
1113
+ // ../../node_modules/.pnpm/wrap-ansi@9.0.2/node_modules/wrap-ansi/index.js
1114
+ init_esm_shims();
1115
+
1116
+ // ../../node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.js
1117
+ init_esm_shims();
1118
+ var ANSI_BACKGROUND_OFFSET2 = 10;
1119
+ var wrapAnsi162 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
1120
+ var wrapAnsi2562 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
1121
+ var wrapAnsi16m2 = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
1122
+ var styles3 = {
1123
+ modifier: {
1124
+ reset: [0, 0],
1125
+ // 21 isn't widely supported and 22 does the same thing
1126
+ bold: [1, 22],
1127
+ dim: [2, 22],
1128
+ italic: [3, 23],
1129
+ underline: [4, 24],
1130
+ overline: [53, 55],
1131
+ inverse: [7, 27],
1132
+ hidden: [8, 28],
1133
+ strikethrough: [9, 29]
1134
+ },
1135
+ color: {
1136
+ black: [30, 39],
1137
+ red: [31, 39],
1138
+ green: [32, 39],
1139
+ yellow: [33, 39],
1140
+ blue: [34, 39],
1141
+ magenta: [35, 39],
1142
+ cyan: [36, 39],
1143
+ white: [37, 39],
1144
+ // Bright color
1145
+ blackBright: [90, 39],
1146
+ gray: [90, 39],
1147
+ // Alias of `blackBright`
1148
+ grey: [90, 39],
1149
+ // Alias of `blackBright`
1150
+ redBright: [91, 39],
1151
+ greenBright: [92, 39],
1152
+ yellowBright: [93, 39],
1153
+ blueBright: [94, 39],
1154
+ magentaBright: [95, 39],
1155
+ cyanBright: [96, 39],
1156
+ whiteBright: [97, 39]
1157
+ },
1158
+ bgColor: {
1159
+ bgBlack: [40, 49],
1160
+ bgRed: [41, 49],
1161
+ bgGreen: [42, 49],
1162
+ bgYellow: [43, 49],
1163
+ bgBlue: [44, 49],
1164
+ bgMagenta: [45, 49],
1165
+ bgCyan: [46, 49],
1166
+ bgWhite: [47, 49],
1167
+ // Bright color
1168
+ bgBlackBright: [100, 49],
1169
+ bgGray: [100, 49],
1170
+ // Alias of `bgBlackBright`
1171
+ bgGrey: [100, 49],
1172
+ // Alias of `bgBlackBright`
1173
+ bgRedBright: [101, 49],
1174
+ bgGreenBright: [102, 49],
1175
+ bgYellowBright: [103, 49],
1176
+ bgBlueBright: [104, 49],
1177
+ bgMagentaBright: [105, 49],
1178
+ bgCyanBright: [106, 49],
1179
+ bgWhiteBright: [107, 49]
1180
+ }
1181
+ };
1182
+ var modifierNames2 = Object.keys(styles3.modifier);
1183
+ var foregroundColorNames2 = Object.keys(styles3.color);
1184
+ var backgroundColorNames2 = Object.keys(styles3.bgColor);
1185
+ var colorNames2 = [...foregroundColorNames2, ...backgroundColorNames2];
1186
+ function assembleStyles2() {
1187
+ const codes = /* @__PURE__ */ new Map();
1188
+ for (const [groupName, group] of Object.entries(styles3)) {
1189
+ for (const [styleName, style] of Object.entries(group)) {
1190
+ styles3[styleName] = {
1191
+ open: `\x1B[${style[0]}m`,
1192
+ close: `\x1B[${style[1]}m`
1193
+ };
1194
+ group[styleName] = styles3[styleName];
1195
+ codes.set(style[0], style[1]);
1196
+ }
1197
+ Object.defineProperty(styles3, groupName, {
1198
+ value: group,
1199
+ enumerable: false
1200
+ });
1201
+ }
1202
+ Object.defineProperty(styles3, "codes", {
1203
+ value: codes,
1204
+ enumerable: false
1205
+ });
1206
+ styles3.color.close = "\x1B[39m";
1207
+ styles3.bgColor.close = "\x1B[49m";
1208
+ styles3.color.ansi = wrapAnsi162();
1209
+ styles3.color.ansi256 = wrapAnsi2562();
1210
+ styles3.color.ansi16m = wrapAnsi16m2();
1211
+ styles3.bgColor.ansi = wrapAnsi162(ANSI_BACKGROUND_OFFSET2);
1212
+ styles3.bgColor.ansi256 = wrapAnsi2562(ANSI_BACKGROUND_OFFSET2);
1213
+ styles3.bgColor.ansi16m = wrapAnsi16m2(ANSI_BACKGROUND_OFFSET2);
1214
+ Object.defineProperties(styles3, {
1215
+ rgbToAnsi256: {
1216
+ value(red, green, blue) {
1217
+ if (red === green && green === blue) {
1218
+ if (red < 8) {
1219
+ return 16;
1220
+ }
1221
+ if (red > 248) {
1222
+ return 231;
1223
+ }
1224
+ return Math.round((red - 8) / 247 * 24) + 232;
1225
+ }
1226
+ return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
1227
+ },
1228
+ enumerable: false
1229
+ },
1230
+ hexToRgb: {
1231
+ value(hex) {
1232
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
1233
+ if (!matches) {
1234
+ return [0, 0, 0];
1235
+ }
1236
+ let [colorString] = matches;
1237
+ if (colorString.length === 3) {
1238
+ colorString = [...colorString].map((character) => character + character).join("");
1239
+ }
1240
+ const integer = Number.parseInt(colorString, 16);
1241
+ return [
1242
+ /* eslint-disable no-bitwise */
1243
+ integer >> 16 & 255,
1244
+ integer >> 8 & 255,
1245
+ integer & 255
1246
+ /* eslint-enable no-bitwise */
1247
+ ];
1248
+ },
1249
+ enumerable: false
1250
+ },
1251
+ hexToAnsi256: {
1252
+ value: (hex) => styles3.rgbToAnsi256(...styles3.hexToRgb(hex)),
1253
+ enumerable: false
1254
+ },
1255
+ ansi256ToAnsi: {
1256
+ value(code) {
1257
+ if (code < 8) {
1258
+ return 30 + code;
1259
+ }
1260
+ if (code < 16) {
1261
+ return 90 + (code - 8);
1262
+ }
1263
+ let red;
1264
+ let green;
1265
+ let blue;
1266
+ if (code >= 232) {
1267
+ red = ((code - 232) * 10 + 8) / 255;
1268
+ green = red;
1269
+ blue = red;
1270
+ } else {
1271
+ code -= 16;
1272
+ const remainder = code % 36;
1273
+ red = Math.floor(code / 36) / 5;
1274
+ green = Math.floor(remainder / 6) / 5;
1275
+ blue = remainder % 6 / 5;
1276
+ }
1277
+ const value = Math.max(red, green, blue) * 2;
1278
+ if (value === 0) {
1279
+ return 30;
1280
+ }
1281
+ let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
1282
+ if (value === 2) {
1283
+ result += 60;
1284
+ }
1285
+ return result;
1286
+ },
1287
+ enumerable: false
1288
+ },
1289
+ rgbToAnsi: {
1290
+ value: (red, green, blue) => styles3.ansi256ToAnsi(styles3.rgbToAnsi256(red, green, blue)),
1291
+ enumerable: false
1292
+ },
1293
+ hexToAnsi: {
1294
+ value: (hex) => styles3.ansi256ToAnsi(styles3.hexToAnsi256(hex)),
1295
+ enumerable: false
1296
+ }
1297
+ });
1298
+ return styles3;
1299
+ }
1300
+ var ansiStyles2 = assembleStyles2();
1301
+ var ansi_styles_default2 = ansiStyles2;
1302
+
1303
+ // ../../node_modules/.pnpm/wrap-ansi@9.0.2/node_modules/wrap-ansi/index.js
1304
+ var ESCAPES = /* @__PURE__ */ new Set([
1305
+ "\x1B",
1306
+ "\x9B"
1307
+ ]);
1308
+ var END_CODE = 39;
1309
+ var ANSI_ESCAPE_BELL = "\x07";
1310
+ var ANSI_CSI = "[";
1311
+ var ANSI_OSC = "]";
1312
+ var ANSI_SGR_TERMINATOR = "m";
1313
+ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
1314
+ var wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
1315
+ var wrapAnsiHyperlink = (url) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
1316
+ var wordLengths = (string) => string.split(" ").map((character) => stringWidth(character));
1317
+ var wrapWord = (rows, word, columns) => {
1318
+ const characters = [...word];
1319
+ let isInsideEscape = false;
1320
+ let isInsideLinkEscape = false;
1321
+ let visible = stringWidth(stripAnsi(rows.at(-1)));
1322
+ for (const [index, character] of characters.entries()) {
1323
+ const characterLength = stringWidth(character);
1324
+ if (visible + characterLength <= columns) {
1325
+ rows[rows.length - 1] += character;
1326
+ } else {
1327
+ rows.push(character);
1328
+ visible = 0;
1329
+ }
1330
+ if (ESCAPES.has(character)) {
1331
+ isInsideEscape = true;
1332
+ const ansiEscapeLinkCandidate = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join("");
1333
+ isInsideLinkEscape = ansiEscapeLinkCandidate === ANSI_ESCAPE_LINK;
1334
+ }
1335
+ if (isInsideEscape) {
1336
+ if (isInsideLinkEscape) {
1337
+ if (character === ANSI_ESCAPE_BELL) {
1338
+ isInsideEscape = false;
1339
+ isInsideLinkEscape = false;
1340
+ }
1341
+ } else if (character === ANSI_SGR_TERMINATOR) {
1342
+ isInsideEscape = false;
1343
+ }
1344
+ continue;
1345
+ }
1346
+ visible += characterLength;
1347
+ if (visible === columns && index < characters.length - 1) {
1348
+ rows.push("");
1349
+ visible = 0;
1350
+ }
1351
+ }
1352
+ if (!visible && rows.at(-1).length > 0 && rows.length > 1) {
1353
+ rows[rows.length - 2] += rows.pop();
1354
+ }
1355
+ };
1356
+ var stringVisibleTrimSpacesRight = (string) => {
1357
+ const words = string.split(" ");
1358
+ let last = words.length;
1359
+ while (last > 0) {
1360
+ if (stringWidth(words[last - 1]) > 0) {
1361
+ break;
1362
+ }
1363
+ last--;
1364
+ }
1365
+ if (last === words.length) {
1366
+ return string;
1367
+ }
1368
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
1369
+ };
1370
+ var exec = (string, columns, options = {}) => {
1371
+ if (options.trim !== false && string.trim() === "") {
1372
+ return "";
1373
+ }
1374
+ let returnValue = "";
1375
+ let escapeCode;
1376
+ let escapeUrl;
1377
+ const lengths = wordLengths(string);
1378
+ let rows = [""];
1379
+ for (const [index, word] of string.split(" ").entries()) {
1380
+ if (options.trim !== false) {
1381
+ rows[rows.length - 1] = rows.at(-1).trimStart();
1382
+ }
1383
+ let rowLength = stringWidth(rows.at(-1));
1384
+ if (index !== 0) {
1385
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
1386
+ rows.push("");
1387
+ rowLength = 0;
1388
+ }
1389
+ if (rowLength > 0 || options.trim === false) {
1390
+ rows[rows.length - 1] += " ";
1391
+ rowLength++;
1392
+ }
1393
+ }
1394
+ if (options.hard && lengths[index] > columns) {
1395
+ const remainingColumns = columns - rowLength;
1396
+ const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
1397
+ const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
1398
+ if (breaksStartingNextLine < breaksStartingThisLine) {
1399
+ rows.push("");
1400
+ }
1401
+ wrapWord(rows, word, columns);
1402
+ continue;
1403
+ }
1404
+ if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
1405
+ if (options.wordWrap === false && rowLength < columns) {
1406
+ wrapWord(rows, word, columns);
1407
+ continue;
1408
+ }
1409
+ rows.push("");
1410
+ }
1411
+ if (rowLength + lengths[index] > columns && options.wordWrap === false) {
1412
+ wrapWord(rows, word, columns);
1413
+ continue;
1414
+ }
1415
+ rows[rows.length - 1] += word;
1416
+ }
1417
+ if (options.trim !== false) {
1418
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
1419
+ }
1420
+ const preString = rows.join("\n");
1421
+ const pre = [...preString];
1422
+ let preStringIndex = 0;
1423
+ for (const [index, character] of pre.entries()) {
1424
+ returnValue += character;
1425
+ if (ESCAPES.has(character)) {
1426
+ const { groups } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(preString.slice(preStringIndex)) || { groups: {} };
1427
+ if (groups.code !== void 0) {
1428
+ const code2 = Number.parseFloat(groups.code);
1429
+ escapeCode = code2 === END_CODE ? void 0 : code2;
1430
+ } else if (groups.uri !== void 0) {
1431
+ escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
1432
+ }
1433
+ }
1434
+ const code = ansi_styles_default2.codes.get(Number(escapeCode));
1435
+ if (pre[index + 1] === "\n") {
1436
+ if (escapeUrl) {
1437
+ returnValue += wrapAnsiHyperlink("");
1438
+ }
1439
+ if (escapeCode && code) {
1440
+ returnValue += wrapAnsiCode(code);
1441
+ }
1442
+ } else if (character === "\n") {
1443
+ if (escapeCode && code) {
1444
+ returnValue += wrapAnsiCode(escapeCode);
1445
+ }
1446
+ if (escapeUrl) {
1447
+ returnValue += wrapAnsiHyperlink(escapeUrl);
1448
+ }
1449
+ }
1450
+ preStringIndex += character.length;
1451
+ }
1452
+ return returnValue;
1453
+ };
1454
+ function wrapAnsi(string, columns, options) {
1455
+ return String(string).normalize().replaceAll("\r\n", "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
1456
+ }
1457
+
1458
+ // ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
1459
+ var import_cli_boxes2 = __toESM(require_cli_boxes(), 1);
1460
+ var NEWLINE = "\n";
1461
+ var PAD = " ";
1462
+ var NONE = "none";
1463
+ var terminalColumns = () => {
1464
+ const { env: env2, stdout, stderr } = process3;
1465
+ if (stdout?.columns) {
1466
+ return stdout.columns;
1467
+ }
1468
+ if (stderr?.columns) {
1469
+ return stderr.columns;
1470
+ }
1471
+ if (env2.COLUMNS) {
1472
+ return Number.parseInt(env2.COLUMNS, 10);
1473
+ }
1474
+ return 80;
1475
+ };
1476
+ var getObject = (detail) => typeof detail === "number" ? {
1477
+ top: detail,
1478
+ right: detail * 3,
1479
+ bottom: detail,
1480
+ left: detail * 3
1481
+ } : {
1482
+ top: 0,
1483
+ right: 0,
1484
+ bottom: 0,
1485
+ left: 0,
1486
+ ...detail
1487
+ };
1488
+ var getBorderWidth = (borderStyle) => borderStyle === NONE ? 0 : 2;
1489
+ var getBorderChars = (borderStyle) => {
1490
+ const sides = [
1491
+ "topLeft",
1492
+ "topRight",
1493
+ "bottomRight",
1494
+ "bottomLeft",
1495
+ "left",
1496
+ "right",
1497
+ "top",
1498
+ "bottom"
1499
+ ];
1500
+ let characters;
1501
+ if (borderStyle === NONE) {
1502
+ borderStyle = {};
1503
+ for (const side of sides) {
1504
+ borderStyle[side] = "";
1505
+ }
1506
+ }
1507
+ if (typeof borderStyle === "string") {
1508
+ characters = import_cli_boxes.default[borderStyle];
1509
+ if (!characters) {
1510
+ throw new TypeError(`Invalid border style: ${borderStyle}`);
1511
+ }
1512
+ } else {
1513
+ if (typeof borderStyle?.vertical === "string") {
1514
+ borderStyle.left = borderStyle.vertical;
1515
+ borderStyle.right = borderStyle.vertical;
1516
+ }
1517
+ if (typeof borderStyle?.horizontal === "string") {
1518
+ borderStyle.top = borderStyle.horizontal;
1519
+ borderStyle.bottom = borderStyle.horizontal;
1520
+ }
1521
+ for (const side of sides) {
1522
+ if (borderStyle[side] === null || typeof borderStyle[side] !== "string") {
1523
+ throw new TypeError(`Invalid border style: ${side}`);
1524
+ }
1525
+ }
1526
+ characters = borderStyle;
1527
+ }
1528
+ return characters;
1529
+ };
1530
+ var makeTitle = (text, horizontal, alignment) => {
1531
+ let title = "";
1532
+ const textWidth = stringWidth(text);
1533
+ switch (alignment) {
1534
+ case "left": {
1535
+ title = text + horizontal.slice(textWidth);
1536
+ break;
1537
+ }
1538
+ case "right": {
1539
+ title = horizontal.slice(textWidth) + text;
1540
+ break;
1541
+ }
1542
+ default: {
1543
+ horizontal = horizontal.slice(textWidth);
1544
+ if (horizontal.length % 2 === 1) {
1545
+ horizontal = horizontal.slice(Math.floor(horizontal.length / 2));
1546
+ title = horizontal.slice(1) + text + horizontal;
1547
+ } else {
1548
+ horizontal = horizontal.slice(horizontal.length / 2);
1549
+ title = horizontal + text + horizontal;
1550
+ }
1551
+ break;
1552
+ }
1553
+ }
1554
+ return title;
1555
+ };
1556
+ var makeContentText = (text, { padding, width, textAlignment, height }) => {
1557
+ text = (0, import_ansi_align.default)(text, { align: textAlignment });
1558
+ let lines = text.split(NEWLINE);
1559
+ const textWidth = widestLine(text);
1560
+ const max = width - padding.left - padding.right;
1561
+ if (textWidth > max) {
1562
+ const newLines = [];
1563
+ for (const line of lines) {
1564
+ const createdLines = wrapAnsi(line, max, { hard: true });
1565
+ const alignedLines = (0, import_ansi_align.default)(createdLines, { align: textAlignment });
1566
+ const alignedLinesArray = alignedLines.split("\n");
1567
+ const longestLength = Math.max(...alignedLinesArray.map((s) => stringWidth(s)));
1568
+ for (const alignedLine of alignedLinesArray) {
1569
+ let paddedLine;
1570
+ switch (textAlignment) {
1571
+ case "center": {
1572
+ paddedLine = PAD.repeat((max - longestLength) / 2) + alignedLine;
1573
+ break;
1574
+ }
1575
+ case "right": {
1576
+ paddedLine = PAD.repeat(max - longestLength) + alignedLine;
1577
+ break;
1578
+ }
1579
+ default: {
1580
+ paddedLine = alignedLine;
1581
+ break;
1582
+ }
1583
+ }
1584
+ newLines.push(paddedLine);
1585
+ }
1586
+ }
1587
+ lines = newLines;
1588
+ }
1589
+ if (textAlignment === "center" && textWidth < max) {
1590
+ lines = lines.map((line) => PAD.repeat((max - textWidth) / 2) + line);
1591
+ } else if (textAlignment === "right" && textWidth < max) {
1592
+ lines = lines.map((line) => PAD.repeat(max - textWidth) + line);
1593
+ }
1594
+ const paddingLeft = PAD.repeat(padding.left);
1595
+ const paddingRight = PAD.repeat(padding.right);
1596
+ lines = lines.map((line) => {
1597
+ const newLine = paddingLeft + line + paddingRight;
1598
+ return newLine + PAD.repeat(width - stringWidth(newLine));
1599
+ });
1600
+ if (padding.top > 0) {
1601
+ lines = [...Array.from({ length: padding.top }).fill(PAD.repeat(width)), ...lines];
1602
+ }
1603
+ if (padding.bottom > 0) {
1604
+ lines = [...lines, ...Array.from({ length: padding.bottom }).fill(PAD.repeat(width))];
1605
+ }
1606
+ if (height && lines.length > height) {
1607
+ lines = lines.slice(0, height);
1608
+ } else if (height && lines.length < height) {
1609
+ lines = [...lines, ...Array.from({ length: height - lines.length }).fill(PAD.repeat(width))];
1610
+ }
1611
+ return lines.join(NEWLINE);
1612
+ };
1613
+ var boxContent = (content, contentWidth, options) => {
1614
+ const colorizeBorder = (border) => {
1615
+ const newBorder = options.borderColor ? getColorFunction(options.borderColor)(border) : border;
1616
+ return options.dimBorder ? source_default.dim(newBorder) : newBorder;
1617
+ };
1618
+ const colorizeContent = (content2) => options.backgroundColor ? getBGColorFunction(options.backgroundColor)(content2) : content2;
1619
+ const chars = getBorderChars(options.borderStyle);
1620
+ const columns = terminalColumns();
1621
+ let marginLeft = PAD.repeat(options.margin.left);
1622
+ if (options.float === "center") {
1623
+ const marginWidth = Math.max((columns - contentWidth - getBorderWidth(options.borderStyle)) / 2, 0);
1624
+ marginLeft = PAD.repeat(marginWidth);
1625
+ } else if (options.float === "right") {
1626
+ const marginWidth = Math.max(columns - contentWidth - options.margin.right - getBorderWidth(options.borderStyle), 0);
1627
+ marginLeft = PAD.repeat(marginWidth);
1628
+ }
1629
+ let result = "";
1630
+ if (options.margin.top) {
1631
+ result += NEWLINE.repeat(options.margin.top);
1632
+ }
1633
+ if (options.borderStyle !== NONE || options.title) {
1634
+ result += colorizeBorder(marginLeft + chars.topLeft + (options.title ? makeTitle(options.title, chars.top.repeat(contentWidth), options.titleAlignment) : chars.top.repeat(contentWidth)) + chars.topRight) + NEWLINE;
1635
+ }
1636
+ const lines = content.split(NEWLINE);
1637
+ result += lines.map((line) => marginLeft + colorizeBorder(chars.left) + colorizeContent(line) + colorizeBorder(chars.right)).join(NEWLINE);
1638
+ if (options.borderStyle !== NONE) {
1639
+ result += NEWLINE + colorizeBorder(marginLeft + chars.bottomLeft + chars.bottom.repeat(contentWidth) + chars.bottomRight);
1640
+ }
1641
+ if (options.margin.bottom) {
1642
+ result += NEWLINE.repeat(options.margin.bottom);
1643
+ }
1644
+ return result;
1645
+ };
1646
+ var sanitizeOptions = (options) => {
1647
+ if (options.fullscreen && process3?.stdout) {
1648
+ let newDimensions = [process3.stdout.columns, process3.stdout.rows];
1649
+ if (typeof options.fullscreen === "function") {
1650
+ newDimensions = options.fullscreen(...newDimensions);
1651
+ }
1652
+ options.width ||= newDimensions[0];
1653
+ options.height ||= newDimensions[1];
1654
+ }
1655
+ options.width &&= Math.max(1, options.width - getBorderWidth(options.borderStyle));
1656
+ options.height &&= Math.max(1, options.height - getBorderWidth(options.borderStyle));
1657
+ return options;
1658
+ };
1659
+ var formatTitle = (title, borderStyle) => borderStyle === NONE ? title : ` ${title} `;
1660
+ var determineDimensions = (text, options) => {
1661
+ options = sanitizeOptions(options);
1662
+ const widthOverride = options.width !== void 0;
1663
+ const columns = terminalColumns();
1664
+ const borderWidth = getBorderWidth(options.borderStyle);
1665
+ const maxWidth = columns - options.margin.left - options.margin.right - borderWidth;
1666
+ const widest = widestLine(wrapAnsi(text, columns - borderWidth, { hard: true, trim: false })) + options.padding.left + options.padding.right;
1667
+ if (options.title && widthOverride) {
1668
+ options.title = options.title.slice(0, Math.max(0, options.width - 2));
1669
+ options.title &&= formatTitle(options.title, options.borderStyle);
1670
+ } else if (options.title) {
1671
+ options.title = options.title.slice(0, Math.max(0, maxWidth - 2));
1672
+ if (options.title) {
1673
+ options.title = formatTitle(options.title, options.borderStyle);
1674
+ if (stringWidth(options.title) > widest) {
1675
+ options.width = stringWidth(options.title);
1676
+ }
1677
+ }
1678
+ }
1679
+ options.width ||= widest;
1680
+ if (!widthOverride) {
1681
+ if (options.margin.left && options.margin.right && options.width > maxWidth) {
1682
+ const spaceForMargins = columns - options.width - borderWidth;
1683
+ const multiplier = spaceForMargins / (options.margin.left + options.margin.right);
1684
+ options.margin.left = Math.max(0, Math.floor(options.margin.left * multiplier));
1685
+ options.margin.right = Math.max(0, Math.floor(options.margin.right * multiplier));
1686
+ }
1687
+ options.width = Math.min(options.width, columns - borderWidth - options.margin.left - options.margin.right);
1688
+ }
1689
+ if (options.width - (options.padding.left + options.padding.right) <= 0) {
1690
+ options.padding.left = 0;
1691
+ options.padding.right = 0;
1692
+ }
1693
+ if (options.height && options.height - (options.padding.top + options.padding.bottom) <= 0) {
1694
+ options.padding.top = 0;
1695
+ options.padding.bottom = 0;
1696
+ }
1697
+ return options;
1698
+ };
1699
+ var isHex = (color) => color.match(/^#(?:[0-f]{3}){1,2}$/i);
1700
+ var isColorValid = (color) => typeof color === "string" && (source_default[color] ?? isHex(color));
1701
+ var getColorFunction = (color) => isHex(color) ? source_default.hex(color) : source_default[color];
1702
+ var getBGColorFunction = (color) => isHex(color) ? source_default.bgHex(color) : source_default[camelCase(["bg", color])];
1703
+ function boxen(text, options) {
1704
+ options = {
1705
+ padding: 0,
1706
+ borderStyle: "single",
1707
+ dimBorder: false,
1708
+ textAlignment: "left",
1709
+ float: "left",
1710
+ titleAlignment: "left",
1711
+ ...options
1712
+ };
1713
+ if (options.align) {
1714
+ options.textAlignment = options.align;
1715
+ }
1716
+ if (options.borderColor && !isColorValid(options.borderColor)) {
1717
+ throw new Error(`${options.borderColor} is not a valid borderColor`);
1718
+ }
1719
+ if (options.backgroundColor && !isColorValid(options.backgroundColor)) {
1720
+ throw new Error(`${options.backgroundColor} is not a valid backgroundColor`);
1721
+ }
1722
+ options.padding = getObject(options.padding);
1723
+ options.margin = getObject(options.margin);
1724
+ options = determineDimensions(text, options);
1725
+ text = makeContentText(text, options);
1726
+ return boxContent(text, options.width, options);
1727
+ }
1728
+
1729
+ // src/cli-box.ts
1730
+ var createBox = (options) => boxen(options.content, {
1731
+ padding: { left: 3, right: 3, top: 1, bottom: 1 },
1732
+ borderColor: "magenta",
1733
+ borderStyle: "round",
1734
+ title: options.title,
1735
+ titleAlignment: "center"
1736
+ });
1737
+
1738
+ // src/diff-engine.ts
1739
+ init_esm_shims();
1740
+ import { diffConfigs, loadConfig } from "@bamboocss/config";
1741
+ import "@bamboocss/generator";
1742
+ var DiffEngine = class {
1743
+ constructor(ctx) {
1744
+ this.ctx = ctx;
1745
+ this.prevConfig = ctx.conf.deserialize();
1746
+ }
1747
+ prevConfig;
1748
+ /**
1749
+ * Reload config from disk and refresh the context
1750
+ */
1751
+ async reloadConfigAndRefreshContext(fn) {
1752
+ const conf = await loadConfig({ cwd: this.ctx.config.cwd, file: this.ctx.conf.path });
1753
+ const { tsconfig, tsconfigFile, tsOptions } = this.ctx.conf;
1754
+ Object.assign(conf, { tsconfig, tsconfigFile, tsOptions });
1755
+ return this.refresh(conf, fn);
1756
+ }
1757
+ /**
1758
+ * Update the context from the refreshed config
1759
+ * then persist the changes on each affected engines
1760
+ * Returns the list of affected artifacts/engines
1761
+ */
1762
+ refresh(conf, fn) {
1763
+ const affected = diffConfigs(() => conf.deserialize(), this.prevConfig);
1764
+ if (!affected.hasConfigChanged || !this.prevConfig) return affected;
1765
+ fn?.(conf);
1766
+ this.prevConfig = conf.deserialize();
1767
+ return affected;
1768
+ }
1769
+ };
1770
+
1771
+ // src/node-runtime.ts
1772
+ init_esm_shims();
1773
+ import { logger as logger2 } from "@bamboocss/logger";
1774
+ import chokidar from "chokidar";
1775
+ import glob from "fast-glob";
1776
+ import fsExtra from "fs-extra";
1777
+ import { dirname, extname, isAbsolute, join as join2, relative, resolve, sep } from "path";
1778
+ import picomatch2 from "picomatch";
1779
+
1780
+ // src/glob-dirname.ts
1781
+ init_esm_shims();
1782
+ import { join } from "path";
1783
+ import picomatch from "picomatch";
1784
+ function globDirname(globs) {
1785
+ const rootDirs = /* @__PURE__ */ new Set();
1786
+ for (const glob2 of globs) {
1787
+ const scan = picomatch.scan(glob2, { tokens: true });
1788
+ if (!scan.isGlob) {
1789
+ rootDirs.add(glob2);
1790
+ continue;
1791
+ }
1792
+ const nonGlobTokens = scan.tokens?.filter((token) => !token.isPrefix && !token.isGlob);
1793
+ if (nonGlobTokens?.length) {
1794
+ rootDirs.add(join(...nonGlobTokens.map((token) => token.value)));
1795
+ }
1796
+ }
1797
+ if (rootDirs.size === 0) {
1798
+ return ["."];
1799
+ }
1800
+ return Array.from(rootDirs);
1801
+ }
1802
+
1803
+ // src/node-runtime.ts
1804
+ var nodeRuntime = {
1805
+ cwd() {
1806
+ return process.cwd();
1807
+ },
1808
+ env(name) {
1809
+ return process.env[name];
1810
+ },
1811
+ path: {
1812
+ join: join2,
1813
+ relative,
1814
+ dirname,
1815
+ extname,
1816
+ isAbsolute,
1817
+ sep,
1818
+ resolve,
1819
+ abs(cwd, str) {
1820
+ return isAbsolute(str) ? str : join2(cwd, str);
1821
+ }
1822
+ },
1823
+ fs: {
1824
+ existsSync: fsExtra.existsSync,
1825
+ readFileSync(filePath) {
1826
+ return fsExtra.readFileSync(filePath, "utf8");
1827
+ },
1828
+ glob(opts) {
1829
+ if (!opts.include) return [];
1830
+ const ignore = opts.exclude ?? [];
1831
+ if (!ignore.length) {
1832
+ ignore.push("**/*.d.ts");
1833
+ }
1834
+ return glob.sync(opts.include, { cwd: opts.cwd, ignore, absolute: true });
1835
+ },
1836
+ writeFile: fsExtra.writeFile,
1837
+ writeFileSync: fsExtra.writeFileSync,
1838
+ readDirSync: fsExtra.readdirSync,
1839
+ rmDirSync: fsExtra.emptyDirSync,
1840
+ rmFileSync: fsExtra.removeSync,
1841
+ ensureDirSync(path6) {
1842
+ return fsExtra.ensureDirSync(path6);
1843
+ },
1844
+ watch(options) {
1845
+ const { include, exclude, cwd, poll } = options;
1846
+ const coalesce = poll || process.platform === "win32";
1847
+ const dirnames = globDirname(include);
1848
+ const isValidPath = picomatch2(include, { cwd, ignore: exclude });
1849
+ const workingDir = cwd || process.cwd();
1850
+ const watcher = chokidar.watch(dirnames, {
1851
+ usePolling: poll,
1852
+ cwd,
1853
+ ignored(path6, stats) {
1854
+ const relativePath = relative(workingDir, path6);
1855
+ return !!stats?.isFile() && !isValidPath(relativePath);
1856
+ },
1857
+ ignoreInitial: true,
1858
+ ignorePermissionErrors: true,
1859
+ awaitWriteFinish: coalesce ? { stabilityThreshold: 50, pollInterval: 10 } : false
1860
+ });
1861
+ logger2.debug("watch:file", `Watching [ ${dirnames.join(", ")} ]`);
1862
+ process.once("SIGINT", async () => {
1863
+ await watcher.close();
1864
+ });
1865
+ return watcher;
1866
+ }
1867
+ }
1868
+ };
1869
+ process.setMaxListeners(Infinity);
1870
+ process.on("unhandledRejection", (reason) => {
1871
+ logger2.caughtError("process", "Unhandled rejection", reason);
1872
+ });
1873
+ process.on("uncaughtException", (error) => {
1874
+ logger2.caughtError("process", "Uncaught exception", error);
1875
+ });
1876
+
1877
+ // src/output-engine.ts
1878
+ init_esm_shims();
1879
+ import { logger as logger3 } from "@bamboocss/logger";
1880
+ var OutputEngine = class {
1881
+ paths;
1882
+ fs;
1883
+ path;
1884
+ constructor(options) {
1885
+ const { paths, runtime } = options;
1886
+ this.paths = paths;
1887
+ this.fs = runtime.fs;
1888
+ this.path = runtime.path;
1889
+ }
1890
+ empty = () => {
1891
+ this.fs.rmDirSync(this.path.join(...this.paths.root));
1892
+ };
1893
+ ensure = (file, cwd) => {
1894
+ const outPath = this.path.resolve(cwd, file);
1895
+ const dirname2 = this.path.dirname(outPath);
1896
+ this.fs.ensureDirSync(dirname2);
1897
+ return outPath;
1898
+ };
1899
+ write = (output) => {
1900
+ if (!output) return;
1901
+ const { dir = this.paths.root, files } = output;
1902
+ this.fs.ensureDirSync(this.path.join(...dir));
1903
+ return Promise.allSettled(
1904
+ files.map(async (artifact) => {
1905
+ if (!artifact?.code) return;
1906
+ const { file, code } = artifact;
1907
+ const absPath = this.path.join(...dir, file);
1908
+ logger3.debug("write:file", dir.slice(-1).concat(file).join("/"));
1909
+ return this.fs.writeFile(absPath, code);
1910
+ })
1911
+ );
1912
+ };
1913
+ };
1914
+
1915
+ // src/create-context.ts
1916
+ var BambooContext = class extends Generator2 {
1917
+ runtime;
1918
+ project;
1919
+ output;
1920
+ diff;
1921
+ explicitDeps = [];
1922
+ constructor(conf) {
1923
+ super(conf);
1924
+ const config = conf.config;
1925
+ this.runtime = nodeRuntime;
1926
+ config.cwd ||= this.runtime.cwd();
1927
+ if (config.logLevel) {
1928
+ logger4.level = config.logLevel;
1929
+ }
1930
+ this.project = new Project({
1931
+ ...conf.tsconfig,
1932
+ getFiles: this.getFiles.bind(this),
1933
+ readFile: this.runtime.fs.readFileSync.bind(this),
1934
+ hooks: conf.hooks,
1935
+ parserOptions: {
1936
+ ...this.parserOptions,
1937
+ join: this.runtime.path.join || this.parserOptions.join
1938
+ }
1939
+ });
1940
+ this.output = new OutputEngine(this);
1941
+ this.diff = new DiffEngine(this);
1942
+ this.explicitDeps = this.getExplicitDependencies();
1943
+ }
1944
+ getExplicitDependencies = () => {
1945
+ const { cwd, dependencies } = this.config;
1946
+ if (!dependencies) return [];
1947
+ return this.runtime.fs.glob({ include: dependencies, cwd });
1948
+ };
1949
+ initMessage = () => {
1950
+ return createBox({
1951
+ content: this.messages.codegenComplete(),
1952
+ title: this.messages.exclamation()
1953
+ });
1954
+ };
1955
+ getFiles = () => {
1956
+ const { include, exclude, cwd } = this.config;
1957
+ return this.runtime.fs.glob({ include, exclude, cwd });
1958
+ };
1959
+ parseFile = (filePath, styleEncoder) => {
1960
+ const file = this.runtime.path.abs(this.config.cwd, filePath);
1961
+ logger4.debug("file:extract", file);
1962
+ const measure = logger4.time.debug(`Parsed ${file}`);
1963
+ let result;
1964
+ try {
1965
+ const encoder = styleEncoder || this.parserOptions.encoder;
1966
+ result = this.project.parseSourceFile(file, encoder);
1967
+ } catch (error) {
1968
+ logger4.caughtError("file:extract", `Failed to parse ${file}`, error);
1969
+ }
1970
+ measure();
1971
+ return result;
1972
+ };
1973
+ parseFiles = (styleEncoder) => {
1974
+ const encoder = styleEncoder || this.parserOptions.encoder;
1975
+ const files = this.getFiles();
1976
+ const filesWithCss = [];
1977
+ const results = [];
1978
+ files.forEach((file) => {
1979
+ const measure = logger4.time.debug(`Parsed ${file}`);
1980
+ const result = this.project.parseSourceFile(file, encoder);
1981
+ measure();
1982
+ if (!result || result.isEmpty() || encoder.isEmpty()) return;
1983
+ filesWithCss.push(file);
1984
+ results.push(result);
1985
+ });
1986
+ return {
1987
+ filesWithCss,
1988
+ files,
1989
+ results
1990
+ };
1991
+ };
1992
+ writeCss = (sheet) => {
1993
+ logger4.info("css", this.runtime.path.join(...this.paths.root, "styles.css"));
1994
+ return this.output.write({
1995
+ id: "styles.css",
1996
+ dir: this.paths.root,
1997
+ files: [{ file: "styles.css", code: this.getCss(sheet) }]
1998
+ });
1999
+ };
2000
+ writeSplitCss = async (sheet) => {
2001
+ const { path: pathUtil, fs: fs4 } = this.runtime;
2002
+ const rootDir = this.paths.root;
2003
+ const stylesDir = [...rootDir, "styles"];
2004
+ const artifacts = this.getSplitCssArtifacts(sheet);
2005
+ const subDirs = new Set([...artifacts.recipes, ...artifacts.themes].map((a) => a.dir).filter(Boolean));
2006
+ fs4.ensureDirSync(pathUtil.join(...stylesDir));
2007
+ subDirs.forEach((dir) => fs4.ensureDirSync(pathUtil.join(...stylesDir, dir)));
2008
+ const styleFiles = [];
2009
+ for (const layer of artifacts.layers) {
2010
+ styleFiles.push({ file: layer.file, code: layer.code });
2011
+ logger4.info("css", pathUtil.join(...stylesDir, layer.file));
2012
+ }
2013
+ for (const recipe of artifacts.recipes) {
2014
+ styleFiles.push({ file: `${recipe.dir}/${recipe.file}`, code: recipe.code });
2015
+ logger4.info("css", pathUtil.join(...stylesDir, recipe.dir, recipe.file));
2016
+ }
2017
+ if (artifacts.recipes.length) {
2018
+ styleFiles.push({ file: "recipes.css", code: artifacts.recipesIndex });
2019
+ logger4.info("css", pathUtil.join(...stylesDir, "recipes.css"));
2020
+ }
2021
+ for (const theme of artifacts.themes) {
2022
+ styleFiles.push({ file: `${theme.dir}/${theme.file}`, code: theme.code });
2023
+ logger4.info("css", pathUtil.join(...stylesDir, theme.dir, theme.file));
2024
+ }
2025
+ await this.output.write({
2026
+ id: "styles",
2027
+ dir: stylesDir,
2028
+ files: styleFiles
2029
+ });
2030
+ logger4.info("css", pathUtil.join(...rootDir, "styles.css"));
2031
+ await this.output.write({
2032
+ id: "styles.css",
2033
+ dir: rootDir,
2034
+ files: [{ file: "styles.css", code: artifacts.index }]
2035
+ });
2036
+ };
2037
+ watchConfig = (cb, opts) => {
2038
+ const { cwd, poll, exclude } = opts ?? {};
2039
+ logger4.info("ctx:watch", this.messages.configWatch());
2040
+ const watcher = this.runtime.fs.watch({
2041
+ include: uniq([...this.explicitDeps, ...this.conf.dependencies]),
2042
+ exclude,
2043
+ cwd,
2044
+ poll
2045
+ });
2046
+ watcher.on(
2047
+ "change",
2048
+ debounce(async (file) => {
2049
+ logger4.info("ctx:change", "config changed, rebuilding...");
2050
+ await cb(file);
2051
+ })
2052
+ );
2053
+ };
2054
+ watchFiles = (cb, opts) => {
2055
+ const { include, exclude, poll, cwd } = this.config;
2056
+ logger4.info("ctx:watch", this.messages.watch());
2057
+ const watcher = this.runtime.fs.watch({
2058
+ ...opts,
2059
+ include,
2060
+ exclude,
2061
+ poll,
2062
+ cwd
2063
+ });
2064
+ watcher.on(
2065
+ "all",
2066
+ debounce(async (event, file) => {
2067
+ logger4.info(`file:${event}`, file);
2068
+ await cb(event, file);
2069
+ })
2070
+ );
2071
+ };
2072
+ };
2073
+
2074
+ // src/load-tsconfig.ts
2075
+ init_esm_shims();
2076
+ import { convertTsPathsToRegexes } from "@bamboocss/config";
2077
+ import path3 from "path";
2078
+
2079
+ // src/tsconfig-utils.ts
2080
+ init_esm_shims();
2081
+ import { promises as fs } from "fs";
2082
+ import path2 from "path";
2083
+ async function resolveDirectTsconfigJson(filename) {
2084
+ if (path2.extname(filename) !== ".json") return null;
2085
+ const resolved = path2.resolve(filename);
2086
+ try {
2087
+ const stat = await fs.stat(resolved);
2088
+ if (stat.isFile() || stat.isFIFO()) return resolved;
2089
+ throw new Error(`${filename} exists but is not a regular file.`);
2090
+ } catch (e) {
2091
+ if (e && typeof e === "object" && "code" in e && e.code === "ENOENT") {
2092
+ return null;
2093
+ }
2094
+ throw e;
2095
+ }
2096
+ }
2097
+ async function findClosestTsconfig(filename, root, configName = "tsconfig.json") {
2098
+ const resolvedRoot = path2.resolve(root);
2099
+ let dir = path2.dirname(path2.resolve(filename));
2100
+ for (; ; ) {
2101
+ const candidate = path2.join(dir, configName);
2102
+ try {
2103
+ const stat = await fs.stat(candidate);
2104
+ if (stat.isFile() || stat.isFIFO()) {
2105
+ return candidate;
2106
+ }
2107
+ } catch {
2108
+ }
2109
+ if (dir === resolvedRoot || path2.dirname(dir) === dir) {
2110
+ return null;
2111
+ }
2112
+ dir = path2.dirname(dir);
2113
+ }
2114
+ }
2115
+ function resolveBaseUrlForCompilerOptions(baseUrl, tsconfigFile, cwd) {
2116
+ if (baseUrl == null) return cwd;
2117
+ if (baseUrl.startsWith("${")) return baseUrl;
2118
+ if (path2.isAbsolute(baseUrl)) return baseUrl;
2119
+ return path2.resolve(path2.dirname(tsconfigFile), baseUrl);
2120
+ }
2121
+ var SOURCE_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
2122
+ function resolveReferencedTsconfigPath(refPath, fromDir, configName = "tsconfig.json") {
2123
+ const p = refPath.endsWith(".json") ? refPath : path2.join(refPath, configName);
2124
+ return path2.resolve(fromDir, p);
2125
+ }
2126
+ async function resolveSolutionTsconfigForFile(absoluteFilename, rootTsconfigPath, rootParsed, getTsconfigModule) {
2127
+ const { parseTsconfig } = getTsconfigModule;
2128
+ if (isSourceFileIncludedInTsconfig(absoluteFilename, rootTsconfigPath, rootParsed)) {
2129
+ return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
2130
+ }
2131
+ const refs = rootParsed.references;
2132
+ if (!refs?.length) {
2133
+ return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
2134
+ }
2135
+ if (!SOURCE_EXTENSIONS.some((ext) => absoluteFilename.endsWith(ext))) {
2136
+ return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
2137
+ }
2138
+ const rootDir = path2.dirname(rootTsconfigPath);
2139
+ for (const ref of refs) {
2140
+ const refPath = resolveReferencedTsconfigPath(ref.path, rootDir);
2141
+ try {
2142
+ await fs.access(refPath);
2143
+ } catch {
2144
+ continue;
2145
+ }
2146
+ const childParsed = parseTsconfig(refPath);
2147
+ if (isSourceFileIncludedInTsconfig(absoluteFilename, refPath, childParsed)) {
2148
+ return { tsconfig: childParsed, tsconfigFile: refPath };
2149
+ }
2150
+ }
2151
+ return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
2152
+ }
2153
+ var POSIX_SEP_RE = new RegExp("\\" + path2.posix.sep, "g");
2154
+ var NATIVE_SEP_RE = new RegExp("\\" + path2.sep, "g");
2155
+ var PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
2156
+ var GLOB_ALL_PATTERN = `**/*`;
2157
+ var TS_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
2158
+ var JS_EXTENSIONS = [".js", ".jsx", ".mjs", ".cjs"];
2159
+ var TSJS_EXTENSIONS = TS_EXTENSIONS.concat(JS_EXTENSIONS);
2160
+ var TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
2161
+ var TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
2162
+ var IS_POSIX = path2.posix.sep === path2.sep;
2163
+ var native2posix = IS_POSIX ? (filename) => filename : (filename) => filename.replace(NATIVE_SEP_RE, path2.posix.sep);
2164
+ var resolve2posix = IS_POSIX ? (dir, filename) => dir ? path2.resolve(dir, filename) : path2.resolve(filename) : (dir, filename) => {
2165
+ const posix2native = (f) => f.replace(POSIX_SEP_RE, path2.sep);
2166
+ return native2posix(
2167
+ dir ? path2.resolve(posix2native(dir), posix2native(filename)) : path2.resolve(posix2native(filename))
2168
+ );
2169
+ };
2170
+ function isGlobMatch(filename, dir, patterns, allowJs) {
2171
+ const extensions = allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
2172
+ return patterns.some((patternArg) => {
2173
+ let pattern = patternArg;
2174
+ let lastWildcardIndex = pattern.length;
2175
+ let hasWildcard = false;
2176
+ let hasExtension = false;
2177
+ let hasSlash = false;
2178
+ let lastSlashIndex = -1;
2179
+ for (let i = pattern.length - 1; i > -1; i--) {
2180
+ const c = pattern[i];
2181
+ if (!hasWildcard) {
2182
+ if (c === "*" || c === "?") {
2183
+ lastWildcardIndex = i;
2184
+ hasWildcard = true;
2185
+ }
2186
+ }
2187
+ if (!hasSlash) {
2188
+ if (c === ".") {
2189
+ hasExtension = true;
2190
+ } else if (c === "/") {
2191
+ lastSlashIndex = i;
2192
+ hasSlash = true;
2193
+ }
2194
+ }
2195
+ if (hasWildcard && hasSlash) {
2196
+ break;
2197
+ }
2198
+ }
2199
+ if (!hasExtension && (!hasWildcard || lastWildcardIndex < lastSlashIndex)) {
2200
+ pattern += `${pattern.endsWith("/") ? "" : "/"}${GLOB_ALL_PATTERN}`;
2201
+ lastWildcardIndex = pattern.length - 1;
2202
+ hasWildcard = true;
2203
+ }
2204
+ if (lastWildcardIndex < pattern.length - 1 && !filename.endsWith(pattern.slice(lastWildcardIndex + 1))) {
2205
+ return false;
2206
+ }
2207
+ if (pattern.endsWith("*") && !extensions.some((ext) => filename.endsWith(ext))) {
2208
+ return false;
2209
+ }
2210
+ if (pattern === GLOB_ALL_PATTERN) {
2211
+ return filename.startsWith(`${dir}/`);
2212
+ }
2213
+ const resolvedPattern = resolve2posix(dir, pattern);
2214
+ let firstWildcardIndex = -1;
2215
+ for (let i = 0; i < resolvedPattern.length; i++) {
2216
+ if (resolvedPattern[i] === "*" || resolvedPattern[i] === "?") {
2217
+ firstWildcardIndex = i;
2218
+ hasWildcard = true;
2219
+ break;
2220
+ }
2221
+ }
2222
+ if (firstWildcardIndex > 1 && !filename.startsWith(resolvedPattern.slice(0, firstWildcardIndex - 1))) {
2223
+ return false;
2224
+ }
2225
+ if (!hasWildcard) {
2226
+ return filename === resolvedPattern;
2227
+ }
2228
+ if (firstWildcardIndex + GLOB_ALL_PATTERN.length === resolvedPattern.length - (pattern.length - 1 - lastWildcardIndex) && resolvedPattern.slice(firstWildcardIndex, firstWildcardIndex + GLOB_ALL_PATTERN.length) === GLOB_ALL_PATTERN) {
2229
+ return true;
2230
+ }
2231
+ if (PATTERN_REGEX_CACHE.has(resolvedPattern)) {
2232
+ return PATTERN_REGEX_CACHE.get(resolvedPattern).test(filename);
2233
+ }
2234
+ const regex2 = pattern2regex(resolvedPattern, allowJs);
2235
+ PATTERN_REGEX_CACHE.set(resolvedPattern, regex2);
2236
+ return regex2.test(filename);
2237
+ });
2238
+ }
2239
+ function pattern2regex(resolvedPattern, allowJs) {
2240
+ let regexStr = "^";
2241
+ for (let i = 0; i < resolvedPattern.length; i++) {
2242
+ const char = resolvedPattern[i];
2243
+ if (char === "?") {
2244
+ regexStr += "[^\\/]";
2245
+ continue;
2246
+ }
2247
+ if (char === "*") {
2248
+ if (resolvedPattern[i + 1] === "*" && resolvedPattern[i + 2] === "/") {
2249
+ i += 2;
2250
+ regexStr += "(?:[^\\/]*\\/)*";
2251
+ continue;
2252
+ }
2253
+ regexStr += "[^\\/]*";
2254
+ continue;
2255
+ }
2256
+ if ("/.+^${}()|[]\\".includes(char)) {
2257
+ regexStr += "\\";
2258
+ }
2259
+ regexStr += char;
2260
+ }
2261
+ if (resolvedPattern.endsWith("*")) {
2262
+ regexStr += allowJs ? TSJS_EXTENSIONS_RE_GROUP : TS_EXTENSIONS_RE_GROUP;
2263
+ }
2264
+ regexStr += "$";
2265
+ return new RegExp(regexStr);
2266
+ }
2267
+ function isIncluded(filename, tsconfigFile, tsconfig) {
2268
+ const dir = native2posix(path2.dirname(tsconfigFile));
2269
+ const files = (tsconfig.files || []).map((file) => resolve2posix(dir, file));
2270
+ const absoluteFilename = resolve2posix(null, filename);
2271
+ if (files.includes(filename)) {
2272
+ return true;
2273
+ }
2274
+ const allowJs = tsconfig.compilerOptions?.allowJs;
2275
+ const included = isGlobMatch(
2276
+ absoluteFilename,
2277
+ dir,
2278
+ tsconfig.include || (tsconfig.files ? [] : [GLOB_ALL_PATTERN]),
2279
+ allowJs
2280
+ );
2281
+ if (included) {
2282
+ const excluded = isGlobMatch(absoluteFilename, dir, tsconfig.exclude || [], allowJs);
2283
+ return !excluded;
2284
+ }
2285
+ return false;
2286
+ }
2287
+ function isSourceFileIncludedInTsconfig(absoluteFilename, tsconfigFile, tsconfig) {
2288
+ return isIncluded(absoluteFilename, tsconfigFile, tsconfig);
2289
+ }
2290
+
2291
+ // src/load-tsconfig.ts
2292
+ async function loadTsConfig(conf, cwd) {
2293
+ const root = cwd;
2294
+ let tsconfigFile = await resolveDirectTsconfigJson(conf.path);
2295
+ if (!tsconfigFile) {
2296
+ tsconfigFile = await findClosestTsconfig(conf.path, root, "tsconfig.json");
2297
+ }
2298
+ if (!tsconfigFile) {
2299
+ return {
2300
+ tsconfig: {},
2301
+ tsconfigFile: void 0
2302
+ };
2303
+ }
2304
+ const gtc = await import("get-tsconfig");
2305
+ const rootParsed = gtc.parseTsconfig(tsconfigFile);
2306
+ const { tsconfig, tsconfigFile: effectiveTsconfigPath } = await resolveSolutionTsconfigForFile(
2307
+ path3.resolve(conf.path),
2308
+ tsconfigFile,
2309
+ rootParsed,
2310
+ gtc
2311
+ );
2312
+ const compilerOptions = tsconfig?.compilerOptions;
2313
+ const result = {
2314
+ tsconfig,
2315
+ tsconfigFile: effectiveTsconfigPath
2316
+ };
2317
+ if (compilerOptions?.paths) {
2318
+ const baseUrl = compilerOptions.baseUrl;
2319
+ result.tsOptions = {
2320
+ baseUrl,
2321
+ pathMappings: convertTsPathsToRegexes(
2322
+ compilerOptions.paths,
2323
+ resolveBaseUrlForCompilerOptions(baseUrl, effectiveTsconfigPath, cwd)
2324
+ )
2325
+ };
2326
+ }
2327
+ return result;
2328
+ }
2329
+
2330
+ // src/config.ts
2331
+ var RESOLVED_HOOKS_NAME = "__resolved__";
2332
+ function getAutoPlugins(config) {
2333
+ const plugins = [pluginVue(), pluginSvelte()];
2334
+ if (config.lightningcss) {
2335
+ plugins.push(pluginLightningcss());
2336
+ }
2337
+ return plugins;
2338
+ }
2339
+ async function loadConfigAndCreateContext(options = {}) {
2340
+ const { config, configPath } = options;
2341
+ const cwd = options.cwd ?? options?.config?.cwd ?? process.cwd();
2342
+ const conf = await loadConfig2({ cwd, file: configPath });
2343
+ if (config) {
2344
+ Object.assign(conf.config, config);
2345
+ }
2346
+ if (options.cwd) {
2347
+ conf.config.cwd = options.cwd;
2348
+ }
2349
+ if (conf.config.lightningcss && !conf.config.browserslist) {
2350
+ conf.config.browserslist ||= browserslist.findConfig(cwd)?.defaults;
2351
+ }
2352
+ const autoPlugins = getAutoPlugins(conf.config);
2353
+ conf.hooks = mergeHooks([...autoPlugins, { name: RESOLVED_HOOKS_NAME, hooks: conf.hooks }]);
2354
+ conf.config.plugins = [...autoPlugins, ...conf.config.plugins ?? []];
2355
+ const tsConfResult = await loadTsConfig(conf, cwd);
2356
+ if (tsConfResult) {
2357
+ Object.assign(conf, tsConfResult);
2358
+ }
2359
+ return new BambooContext(conf);
2360
+ }
2361
+
2362
+ // src/parse-dependency.ts
2363
+ init_esm_shims();
2364
+ import isGlob from "is-glob";
2365
+ import { normalize, resolve as resolve2 } from "path";
2366
+
2367
+ // src/parse-glob.ts
2368
+ init_esm_shims();
2369
+ import globParent from "glob-parent";
2370
+ function parseGlob(pattern) {
2371
+ let glob2 = pattern;
2372
+ const base = globParent(pattern);
2373
+ if (base !== ".") {
2374
+ glob2 = pattern.substring(base.length);
2375
+ if (glob2.charAt(0) === "/") {
2376
+ glob2 = glob2.substring(1);
2377
+ }
2378
+ }
2379
+ if (glob2.substring(0, 2) === "./") {
2380
+ glob2 = glob2.substring(2);
2381
+ }
2382
+ if (glob2.charAt(0) === "/") {
2383
+ glob2 = glob2.substring(1);
2384
+ }
2385
+ return { base, glob: glob2 };
2386
+ }
2387
+
2388
+ // src/parse-dependency.ts
2389
+ function parseDependency(fileOrGlob) {
2390
+ if (fileOrGlob.startsWith("!")) {
2391
+ return null;
2392
+ }
2393
+ let message = null;
2394
+ if (isGlob(fileOrGlob)) {
2395
+ const { base, glob: glob2 } = parseGlob(fileOrGlob);
2396
+ message = { type: "dir-dependency", dir: normalize(resolve2(base)), glob: glob2 };
2397
+ } else {
2398
+ message = { type: "dependency", file: normalize(resolve2(fileOrGlob)) };
2399
+ }
2400
+ if (message.type === "dir-dependency" && process.env.ROLLUP_WATCH === "true") {
2401
+ message = { type: "dependency", file: normalize(resolve2(message.dir)) };
2402
+ }
2403
+ return message;
2404
+ }
2405
+
2406
+ // src/builder.ts
2407
+ var fileModifiedMap = /* @__PURE__ */ new Map();
2408
+ var Builder = class {
2409
+ /**
2410
+ * The current bamboo context
2411
+ */
2412
+ context;
2413
+ hasEmitted = false;
2414
+ filesMeta;
2415
+ explicitDepsMeta;
2416
+ affecteds;
2417
+ configDependencies = /* @__PURE__ */ new Set();
2418
+ setConfigDependencies(options) {
2419
+ const tsOptions = this.context?.conf.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
2420
+ const compilerOptions = this.context?.conf.tsconfig?.compilerOptions ?? {};
2421
+ const { deps: foundDeps } = getConfigDependencies(options.configPath, tsOptions, compilerOptions);
2422
+ const cwd = options?.cwd ?? this.context?.config.cwd ?? process.cwd();
2423
+ const configDeps = /* @__PURE__ */ new Set([
2424
+ ...foundDeps,
2425
+ ...(this.context?.conf.dependencies ?? []).map((file) => resolve3(cwd, file))
2426
+ ]);
2427
+ configDeps.forEach((file) => {
2428
+ this.configDependencies.add(file);
2429
+ });
2430
+ logger5.debug("builder", "Config dependencies");
2431
+ logger5.debug("builder", configDeps);
2432
+ }
2433
+ setup = async (options = {}) => {
2434
+ logger5.debug("builder", "\u{1F6A7} Setup");
2435
+ const configPath = options.configPath ?? findConfig({ cwd: options.cwd });
2436
+ this.setConfigDependencies({ configPath, cwd: options.cwd });
2437
+ if (!this.context) {
2438
+ return this.setupContext({ configPath, cwd: options.cwd });
2439
+ }
2440
+ const ctx = this.getContextOrThrow();
2441
+ this.affecteds = await ctx.diff.reloadConfigAndRefreshContext((conf) => {
2442
+ this.context = new BambooContext(conf);
2443
+ });
2444
+ logger5.debug("builder", this.affecteds);
2445
+ this.explicitDepsMeta = this.checkFilesChanged(this.context.explicitDeps);
2446
+ if (this.explicitDepsMeta.hasFilesChanged) {
2447
+ this.explicitDepsMeta.changes.forEach((meta, file) => {
2448
+ fileModifiedMap.set(file, meta.mtime);
2449
+ });
2450
+ logger5.debug("builder", "\u2699\uFE0F Explicit config dependencies changed");
2451
+ this.affecteds.hasConfigChanged = true;
2452
+ }
2453
+ if (this.affecteds.hasConfigChanged) {
2454
+ logger5.debug("builder", "\u2699\uFE0F Config changed, reloading");
2455
+ await ctx.hooks["config:change"]?.({ config: ctx.config, changes: this.affecteds });
2456
+ return;
2457
+ }
2458
+ this.filesMeta = this.checkFilesChanged(ctx.getFiles());
2459
+ if (this.filesMeta.hasFilesChanged) {
2460
+ logger5.debug("builder", "Files changed, invalidating them");
2461
+ ctx.project.reloadSourceFiles();
2462
+ }
2463
+ };
2464
+ async emit() {
2465
+ if (this.hasEmitted && this.affecteds?.hasConfigChanged) {
2466
+ logger5.debug("builder", "Emit artifacts after config change");
2467
+ await codegen(this.getContextOrThrow(), Array.from(this.affecteds.artifacts));
2468
+ }
2469
+ this.hasEmitted = true;
2470
+ }
2471
+ setupContext = async (options) => {
2472
+ const { configPath, cwd } = options;
2473
+ const ctx = await loadConfigAndCreateContext({ configPath, cwd });
2474
+ const configDeps = uniq2([...ctx.conf.dependencies, ...ctx.explicitDeps]);
2475
+ configDeps.forEach((file) => {
2476
+ this.configDependencies.add(resolve3(cwd || ctx.conf.config.cwd, file));
2477
+ });
2478
+ this.context = ctx;
2479
+ return ctx;
2480
+ };
2481
+ getContextOrThrow = () => {
2482
+ if (!this.context) {
2483
+ throw new BambooError("NO_CONTEXT", "context not loaded");
2484
+ }
2485
+ return this.context;
2486
+ };
2487
+ getFileMeta = (file) => {
2488
+ const mtime = existsSync(file) ? statSync(file).mtimeMs : -Infinity;
2489
+ const isUnchanged = fileModifiedMap.has(file) && mtime === fileModifiedMap.get(file);
2490
+ return { mtime, isUnchanged };
2491
+ };
2492
+ checkFilesChanged(files) {
2493
+ const changes = /* @__PURE__ */ new Map();
2494
+ let hasFilesChanged = false;
2495
+ for (const file of files) {
2496
+ const meta = this.getFileMeta(file);
2497
+ changes.set(file, meta);
2498
+ if (!meta.isUnchanged) {
2499
+ hasFilesChanged = true;
2500
+ }
2501
+ }
2502
+ return { changes, hasFilesChanged };
2503
+ }
2504
+ extractFile = (ctx, file) => {
2505
+ const meta = this.filesMeta?.changes.get(file) ?? this.getFileMeta(file);
2506
+ const hasConfigChanged = this.affecteds ? this.affecteds.hasConfigChanged : true;
2507
+ if (meta.isUnchanged && !hasConfigChanged) return;
2508
+ const parserResult = ctx.parseFile(file);
2509
+ fileModifiedMap.set(file, meta.mtime);
2510
+ return parserResult;
2511
+ };
2512
+ extract = () => {
2513
+ const hasConfigChanged = this.affecteds ? this.affecteds.hasConfigChanged : true;
2514
+ if (!this.filesMeta && !hasConfigChanged) {
2515
+ logger5.debug("builder", "No files or config changed, skipping extract");
2516
+ return;
2517
+ }
2518
+ const ctx = this.getContextOrThrow();
2519
+ const files = ctx.getFiles();
2520
+ const done = logger5.time.info("Extracted in");
2521
+ files.map((file) => this.extractFile(ctx, file));
2522
+ done();
2523
+ };
2524
+ isValidRoot = (root) => {
2525
+ const ctx = this.getContextOrThrow();
2526
+ let valid = false;
2527
+ root.walkAtRules("layer", (rule) => {
2528
+ if (ctx.isValidLayerParams(rule.params)) {
2529
+ valid = true;
2530
+ }
2531
+ });
2532
+ return valid;
2533
+ };
2534
+ write = (root) => {
2535
+ const ctx = this.getContextOrThrow();
2536
+ const sheet = ctx.createSheet();
2537
+ ctx.appendBaselineCss(sheet);
2538
+ const css = ctx.getCss(sheet);
2539
+ root.append(css);
2540
+ };
2541
+ registerDependency = (fn) => {
2542
+ const ctx = this.getContextOrThrow();
2543
+ for (const fileOrGlob of ctx.config.include) {
2544
+ const dependency = parseDependency(fileOrGlob);
2545
+ if (dependency) fn(dependency);
2546
+ }
2547
+ for (const file of this.configDependencies) {
2548
+ fn({ type: "dependency", file: normalize2(resolve3(file)) });
2549
+ }
2550
+ };
2551
+ };
2552
+
2553
+ // src/cpu-profile.ts
2554
+ init_esm_shims();
2555
+ import { logger as logger6 } from "@bamboocss/logger";
2556
+ import fs2 from "fs";
2557
+ import path4 from "path";
2558
+ import readline from "readline";
2559
+ var startProfiling = async (cwd, prefix, isWatching) => {
2560
+ const inspector = await import("inspector").then((r) => r.default);
2561
+ const session = new inspector.Session();
2562
+ session.connect();
2563
+ let state = "idle";
2564
+ const setState = (s) => {
2565
+ state = s;
2566
+ };
2567
+ await new Promise((resolve4) => {
2568
+ session.post("Profiler.enable", () => {
2569
+ session.post("Profiler.start", () => {
2570
+ setState("profiling");
2571
+ resolve4();
2572
+ });
2573
+ });
2574
+ });
2575
+ const toggleProfiler = () => {
2576
+ if (state === "idle") {
2577
+ console.log("Starting CPU profiling...");
2578
+ setState("starting");
2579
+ session.post("Profiler.start", () => {
2580
+ setState("profiling");
2581
+ console.log("Press 'p' to stop profiling...");
2582
+ });
2583
+ } else if (state === "profiling") {
2584
+ console.log("Stopping CPU profiling...");
2585
+ stopProfiling();
2586
+ }
2587
+ };
2588
+ if (isWatching) {
2589
+ readline.emitKeypressEvents(process.stdin);
2590
+ if (process.stdin.isTTY) process.stdin.setRawMode(true);
2591
+ console.log("Press 'p' to stop profiling...");
2592
+ process.stdin.on("keypress", (str, key) => {
2593
+ if (key.name === "p") {
2594
+ toggleProfiler();
2595
+ }
2596
+ if (key.ctrl && key.name === "c") {
2597
+ stopProfiling(() => process.exit());
2598
+ }
2599
+ });
2600
+ }
2601
+ const stopProfiling = (cb) => {
2602
+ if (state !== "profiling") {
2603
+ cb?.();
2604
+ return;
2605
+ }
2606
+ setState("stopping");
2607
+ session.post("Profiler.stop", (err, params) => {
2608
+ setState("idle");
2609
+ if (err) {
2610
+ logger6.error("cpu-prof", err);
2611
+ cb?.();
2612
+ return;
2613
+ }
2614
+ if (!params?.profile) {
2615
+ cb?.();
2616
+ return;
2617
+ }
2618
+ const date = /* @__PURE__ */ new Date();
2619
+ const timestamp = date.toISOString().replace(/[-:.]/g, "");
2620
+ const title = `bamboo-${prefix}-${timestamp}`;
2621
+ const outfile = path4.join(cwd, `${title}.cpuprofile`);
2622
+ fs2.writeFileSync(outfile, JSON.stringify(params.profile));
2623
+ logger6.info("cpu-prof", outfile);
2624
+ cb?.();
2625
+ });
2626
+ };
2627
+ return stopProfiling;
2628
+ };
2629
+
2630
+ // src/cssgen.ts
2631
+ init_esm_shims();
2632
+ import { logger as logger7 } from "@bamboocss/logger";
2633
+ var cssgen = async (ctx, options) => {
2634
+ const { outfile, type, minimal, splitting } = options;
2635
+ const sheet = ctx.createSheet();
2636
+ if (type) {
2637
+ const done = logger7.time.info(ctx.messages.cssArtifactComplete(type));
2638
+ ctx.appendCssOfType(type, sheet);
2639
+ if (outfile) {
2640
+ const css = ctx.getCss(sheet);
2641
+ logger7.info("css", ctx.runtime.path.resolve(outfile));
2642
+ await ctx.runtime.fs.writeFile(outfile, css);
2643
+ } else {
2644
+ await ctx.writeCss(sheet);
2645
+ }
2646
+ done();
2647
+ } else {
2648
+ const { files } = ctx.parseFiles();
2649
+ const done = logger7.time.info(ctx.messages.buildComplete(files.length));
2650
+ if (!minimal) {
2651
+ ctx.appendLayerParams(sheet);
2652
+ ctx.appendBaselineCss(sheet);
2653
+ }
2654
+ ctx.appendParserCss(sheet);
2655
+ if (splitting) {
2656
+ await ctx.writeSplitCss(sheet);
2657
+ } else if (outfile) {
2658
+ const css = ctx.getCss(sheet);
2659
+ logger7.info("css", ctx.runtime.path.resolve(outfile));
2660
+ await ctx.runtime.fs.writeFile(outfile, css);
2661
+ } else {
2662
+ await ctx.writeCss(sheet);
2663
+ }
2664
+ done();
2665
+ }
2666
+ };
2667
+
2668
+ // src/debug.ts
2669
+ init_esm_shims();
2670
+ import { colors as colors2, logger as logger8 } from "@bamboocss/logger";
2671
+ import { parse } from "path";
2672
+ async function debug(ctx, options) {
2673
+ const files = ctx.getFiles();
2674
+ const measureTotal = logger8.time.debug(`Done parsing ${files.length} files`);
2675
+ ctx.config.minify = false;
2676
+ const { fs: fs4, path: path6 } = ctx.runtime;
2677
+ const outdir = options.outdir;
2678
+ if (!options.dry && outdir) {
2679
+ fs4.ensureDirSync(outdir);
2680
+ logger8.info("cli", `Writing ${colors2.bold(`${outdir}/config.json`)}`);
2681
+ await fs4.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
2682
+ }
2683
+ if (options.onlyConfig) {
2684
+ measureTotal();
2685
+ return;
2686
+ }
2687
+ const filesWithCss = [];
2688
+ files.map((file) => {
2689
+ const measure = logger8.time.debug(`Parsed ${file}`);
2690
+ const encoder = ctx.encoder.clone();
2691
+ const result = ctx.project.parseSourceFile(file, encoder);
2692
+ measure();
2693
+ if (!result || result.isEmpty() || encoder.isEmpty()) return;
2694
+ const styles4 = ctx.decoder.clone().collect(encoder);
2695
+ const css = ctx.getParserCss(styles4);
2696
+ if (!css) return;
2697
+ if (options.dry) {
2698
+ console.log({ path: file, ast: result, code: css });
2699
+ return;
2700
+ }
2701
+ if (outdir) {
2702
+ filesWithCss.push(file);
2703
+ const parsedPath = parse(file);
2704
+ const relative2 = path6.relative(ctx.config.cwd, parsedPath.dir);
2705
+ const astJsonPath = `${relative2}${path6.sep}${parsedPath.name}.ast.json`.replaceAll(path6.sep, "__");
2706
+ const cssPath = `${relative2}${path6.sep}${parsedPath.name}.css`.replaceAll(path6.sep, "__");
2707
+ logger8.info("cli", `Writing ${colors2.bold(`${outdir}/${astJsonPath}`)}`);
2708
+ logger8.info("cli", `Writing ${colors2.bold(`${outdir}/${cssPath}`)}`);
2709
+ return Promise.allSettled([
2710
+ fs4.writeFile(`${outdir}${path6.sep}${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
2711
+ fs4.writeFile(`${outdir}${path6.sep}${cssPath}`, css)
2712
+ ]);
2713
+ }
2714
+ });
2715
+ logger8.info("cli", `Found ${colors2.bold(`${filesWithCss.length}/${files.length}`)} files using Bamboo`);
2716
+ measureTotal();
2717
+ }
2718
+
2719
+ // src/generate.ts
2720
+ init_esm_shims();
2721
+ import { logger as logger9 } from "@bamboocss/logger";
2722
+ async function build(ctx, artifactIds) {
2723
+ await codegen(ctx, artifactIds);
2724
+ if (ctx.config.emitTokensOnly) {
2725
+ return logger9.info("css:emit", "Successfully rebuilt the css variables and js function to query your tokens \u2728");
2726
+ }
2727
+ const done = logger9.time.info("");
2728
+ const sheet = ctx.createSheet();
2729
+ ctx.appendLayerParams(sheet);
2730
+ ctx.appendBaselineCss(sheet);
2731
+ const parsed = ctx.parseFiles();
2732
+ ctx.appendParserCss(sheet);
2733
+ await ctx.writeCss(sheet);
2734
+ done(ctx.messages.buildComplete(parsed.files.length));
2735
+ }
2736
+ async function generate(config, configPath) {
2737
+ let ctx = await loadConfigAndCreateContext({ config, configPath });
2738
+ await build(ctx);
2739
+ const { cwd, watch, poll } = ctx.config;
2740
+ if (watch) {
2741
+ ctx.watchConfig(
2742
+ async () => {
2743
+ const affecteds = await ctx.diff.reloadConfigAndRefreshContext((conf) => {
2744
+ ctx = new BambooContext(conf);
2745
+ });
2746
+ logger9.info("ctx:updated", "config rebuilt \u2705");
2747
+ await ctx.hooks["config:change"]?.({ config: ctx.config, changes: affecteds });
2748
+ return build(ctx, Array.from(affecteds.artifacts));
2749
+ },
2750
+ { cwd, poll }
2751
+ );
2752
+ const bundleStyles = async (ctx2, changedFilePath) => {
2753
+ const outfile = ctx2.runtime.path.join(...ctx2.paths.root, "styles.css");
2754
+ const parserResult = ctx2.project.parseSourceFile(changedFilePath);
2755
+ if (parserResult) {
2756
+ const done = logger9.time.info(ctx2.messages.buildComplete(1));
2757
+ const sheet = ctx2.createSheet();
2758
+ ctx2.appendLayerParams(sheet);
2759
+ ctx2.appendBaselineCss(sheet);
2760
+ ctx2.appendParserCss(sheet);
2761
+ const css = ctx2.getCss(sheet);
2762
+ await ctx2.runtime.fs.writeFile(outfile, css);
2763
+ done();
2764
+ }
2765
+ };
2766
+ ctx.watchFiles(async (event, file) => {
2767
+ const filePath = ctx.runtime.path.abs(cwd, file);
2768
+ if (event === "unlink") {
2769
+ ctx.project.removeSourceFile(filePath);
2770
+ } else if (event === "change") {
2771
+ ctx.project.reloadSourceFile(file);
2772
+ await bundleStyles(ctx, filePath);
2773
+ } else if (event === "add") {
2774
+ ctx.project.createSourceFile(file);
2775
+ await bundleStyles(ctx, filePath);
2776
+ }
2777
+ });
2778
+ }
2779
+ }
2780
+
2781
+ // src/git-ignore.ts
2782
+ init_esm_shims();
2783
+ import { appendFileSync, readFileSync, writeFileSync } from "fs";
2784
+ import { lookItUpSync } from "look-it-up";
2785
+ import outdent from "outdent";
2786
+ function setupGitIgnore(ctx) {
2787
+ const { outdir, gitignore } = ctx.config;
2788
+ if (!gitignore) return;
2789
+ const txt = outdent`
2790
+
2791
+ ## Bamboo
2792
+ ${outdir}
2793
+ ${ctx.studio.outdir}
2794
+ `;
2795
+ const file = lookItUpSync(".gitignore");
2796
+ if (!file) {
2797
+ return writeFileSync(".gitignore", txt);
2798
+ }
2799
+ const content = readFileSync(file, "utf-8");
2800
+ if (!content.includes(outdir)) {
2801
+ appendFileSync(file, txt);
2802
+ }
2803
+ }
2804
+
2805
+ // src/logstream.ts
2806
+ init_esm_shims();
2807
+ import { logger as logger10 } from "@bamboocss/logger";
2808
+ import fs3 from "fs";
2809
+ import path5 from "path";
2810
+ var setLogStream = (options) => {
2811
+ const { cwd = process.cwd() } = options;
2812
+ let stream;
2813
+ if (options.logfile) {
2814
+ const outPath = path5.resolve(cwd, options.logfile);
2815
+ ensure(outPath);
2816
+ logger10.info("logfile", outPath);
2817
+ stream = fs3.createWriteStream(outPath, { flags: "a" });
2818
+ logger10.onLog = (entry) => {
2819
+ stream?.write(JSON.stringify(entry) + "\n");
2820
+ };
2821
+ }
2822
+ process.once("SIGINT", () => {
2823
+ stream?.end();
2824
+ });
2825
+ return {
2826
+ end() {
2827
+ stream?.end();
2828
+ },
2829
+ [Symbol.dispose]: () => {
2830
+ stream?.end();
2831
+ }
2832
+ };
2833
+ };
2834
+ var ensure = (outPath) => {
2835
+ const dirname2 = path5.dirname(outPath);
2836
+ fs3.mkdirSync(dirname2, { recursive: true });
2837
+ return outPath;
2838
+ };
2839
+
2840
+ // src/setup-config.ts
2841
+ init_esm_shims();
2842
+ import { findConfig as findConfig2 } from "@bamboocss/config";
2843
+ import { messages } from "@bamboocss/core";
2844
+ import { logger as logger11, quote } from "@bamboocss/logger";
2845
+ import { BambooError as BambooError2 } from "@bamboocss/shared";
2846
+ import fsExtra2 from "fs-extra";
2847
+ import { lookItUpSync as lookItUpSync2 } from "look-it-up";
2848
+ import { outdent as outdent2 } from "outdent";
2849
+ import { join as join3 } from "path";
2850
+ import { execFileSync } from "child_process";
2851
+ async function setupConfig(cwd, opts = {}) {
2852
+ const { force, outExtension, jsxFramework, syntax, outdir = "styled-system" } = opts;
2853
+ let configFile;
2854
+ try {
2855
+ configFile = findConfig2({ cwd });
2856
+ } catch (err) {
2857
+ if (!(err instanceof BambooError2)) {
2858
+ throw err;
2859
+ }
2860
+ }
2861
+ const { detect } = await import("package-manager-detector");
2862
+ const pmResult = await detect({ cwd });
2863
+ const pm = (pmResult?.agent ?? "npm").split("@")[0];
2864
+ const cmd = pm === "npm" ? "npm run" : pm;
2865
+ const isTs = lookItUpSync2("tsconfig.json", cwd);
2866
+ const file = isTs ? "bamboo.config.ts" : "bamboo.config.mjs";
2867
+ logger11.info("init:config", `creating bamboo config file: ${quote(file)}`);
2868
+ if (!force && configFile) {
2869
+ logger11.warn("init:config", messages.configExists(cmd));
2870
+ } else {
2871
+ const content = outdent2`
2872
+ import { defineConfig } from "@bamboocss/dev"
2873
+
2874
+ export default defineConfig({
2875
+ // Whether to use css reset
2876
+ preflight: true,
2877
+ ${outExtension ? `
2878
+ // The extension for the emitted JavaScript files
2879
+ outExtension: '${outExtension}',` : ""}
2880
+ // Where to look for your css declarations
2881
+ include: ["./src/**/*.{js,jsx,ts,tsx}", "./pages/**/*.{js,jsx,ts,tsx}"],
2882
+
2883
+ // Files to exclude
2884
+ exclude: [],
2885
+
2886
+ // Useful for theme customization
2887
+ theme: {
2888
+ extend: {}
2889
+ },
2890
+
2891
+ // The output directory for your css system
2892
+ outdir: ${JSON.stringify(outdir)},
2893
+ ${jsxFramework ? `
2894
+ // The JSX framework to use
2895
+ jsxFramework: '${jsxFramework}',` : ""}
2896
+ ${syntax ? `
2897
+ // The CSS Syntax to use to use
2898
+ syntax: '${syntax}'` : ""}
2899
+ })
2900
+ `;
2901
+ const filePath = join3(cwd, file);
2902
+ await fsExtra2.writeFile(filePath, content);
2903
+ try {
2904
+ execFileSync("oxfmt", [filePath], { stdio: "ignore" });
2905
+ } catch {
2906
+ }
2907
+ logger11.log(messages.thankYou());
2908
+ }
2909
+ }
2910
+ async function setupPostcss(cwd) {
2911
+ logger11.info("init:postcss", `creating postcss config file: ${quote("postcss.config.cjs")}`);
2912
+ const content = outdent2`
2913
+ module.exports = {
2914
+ plugins: {
2915
+ '@bamboocss/dev/postcss': {},
2916
+ },
2917
+ }
2918
+ `;
2919
+ await fsExtra2.writeFile(join3(cwd, "postcss.config.cjs"), content);
2920
+ }
2921
+
2922
+ // src/spec.ts
2923
+ init_esm_shims();
2924
+ import { logger as logger12 } from "@bamboocss/logger";
2925
+ async function spec(ctx, options) {
2926
+ const { outdir } = options;
2927
+ const specs = ctx.getSpec();
2928
+ const specDir = outdir ? [ctx.config.cwd, outdir] : ctx.paths.specs;
2929
+ const specDirPath = ctx.runtime.path.join(...specDir);
2930
+ const writeSpec = async (spec2) => {
2931
+ await ctx.output.write({
2932
+ id: `spec-${spec2.type}`,
2933
+ dir: specDir,
2934
+ files: [{ file: `${spec2.type}.json`, code: JSON.stringify(spec2, null, 2) }]
2935
+ });
2936
+ };
2937
+ await Promise.all(specs.map(writeSpec));
2938
+ const specTypes = specs.map((s) => s.type);
2939
+ logger12.info("spec", `Generated ${specTypes.length} spec file(s) \u2192 ${specDirPath}`);
2940
+ return specs;
2941
+ }
2942
+ export {
2943
+ BambooContext,
2944
+ Builder,
2945
+ analyze,
2946
+ buildInfo,
2947
+ codegen,
2948
+ cssgen,
2949
+ debug,
2950
+ generate,
2951
+ loadConfigAndCreateContext,
2952
+ parseDependency,
2953
+ setLogStream,
2954
+ setupConfig,
2955
+ setupGitIgnore,
2956
+ setupPostcss,
2957
+ spec,
2958
+ startProfiling
2959
+ };