@poe-platform/safe-bash 0.1.710 → 0.1.712
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/README.md +21 -1
- package/dist/safe-bash/commands/fmt/index.d.ts +2 -0
- package/dist/safe-bash/commands/fmt/index.d.ts.map +1 -0
- package/dist/safe-bash/commands/fmt/index.js +2 -0
- package/dist/safe-bash/commands/fmt/index.js.map +1 -0
- package/dist/safe-bash/commands/fmt.d.ts +1 -2
- package/dist/safe-bash/commands/fmt.d.ts.map +1 -1
- package/dist/safe-bash/commands/fmt.js +1 -838
- package/dist/safe-bash/commands/fmt.js.map +1 -1
- package/dist/safe-bash/commands/time-env/printenv.d.ts +1 -1
- package/dist/safe-bash/commands/time-env/printenv.d.ts.map +1 -1
- package/dist/safe-bash/commands/time-env/sleep.d.ts +1 -1
- package/dist/safe-bash/commands/time-env/sleep.d.ts.map +1 -1
- package/dist/safe-bash/core.browser.js +155 -2099
- package/dist/safe-bash/core.browser.js.map +3 -3
- package/dist/safe-bash/playwright/private-target-transport.d.ts.map +1 -1
- package/dist/safe-bash/playwright/private-target-transport.js +18 -2
- package/dist/safe-bash/playwright/private-target-transport.js.map +1 -1
- package/dist/safe-bash/playwright/profile.d.ts +3 -1
- package/dist/safe-bash/playwright/profile.d.ts.map +1 -1
- package/dist/safe-bash/playwright/profile.js +3 -3
- package/dist/safe-bash/playwright/profile.js.map +1 -1
- package/dist/safe-bash-command-exiftool/index.js +1401 -6
- package/dist/safe-bash-command-exiftool/index.js.map +7 -0
- package/dist/safe-bash-command-fmt/arguments.d.ts +8 -0
- package/dist/safe-bash-command-fmt/command.d.ts +20 -0
- package/dist/safe-bash-command-fmt/contracts.d.ts +42 -0
- package/dist/safe-bash-command-fmt/engine.d.ts +20 -0
- package/dist/safe-bash-command-fmt/index.d.ts +5 -0
- package/dist/safe-bash-command-fmt/index.js +2419 -0
- package/dist/safe-bash-command-fmt/index.js.map +7 -0
- package/dist/safe-bash-command-fmt/sdk.d.ts +15 -0
- package/dist/safe-bash-command-wkhtmltopdf/index.js +1458 -7
- package/dist/safe-bash-command-wkhtmltopdf/index.js.map +7 -0
- package/dist/safe-bash-contracts/index.d.ts +8 -0
- package/dist/safe-bash-contracts/index.js +8 -0
- package/dist/safe-playwright-cloudflare/browser-run-code.js +15 -1
- package/package.json +6 -2
- package/dist/safe-bash-command-exiftool/argfiles.js +0 -163
- package/dist/safe-bash-command-exiftool/arguments.js +0 -128
- package/dist/safe-bash-command-exiftool/command.js +0 -324
- package/dist/safe-bash-command-exiftool/csv.js +0 -78
- package/dist/safe-bash-command-exiftool/paths.js +0 -18
- package/dist/safe-bash-command-exiftool/png.js +0 -308
- package/dist/safe-bash-command-exiftool/publication.js +0 -80
- package/dist/safe-bash-command-exiftool/registry.js +0 -14
- package/dist/safe-bash-command-exiftool/resources.js +0 -29
- package/dist/safe-bash-command-exiftool/scalar.js +0 -103
- package/dist/safe-bash-command-exiftool/sdk.js +0 -113
- package/dist/safe-bash-command-exiftool/shifts.js +0 -29
- package/dist/safe-bash-command-wkhtmltopdf/command.js +0 -373
- package/dist/safe-bash-command-wkhtmltopdf/engine.js +0 -99
- package/dist/safe-bash-command-wkhtmltopdf/errors.js +0 -11
- package/dist/safe-bash-command-wkhtmltopdf/limits.js +0 -69
- package/dist/safe-bash-command-wkhtmltopdf/outcome.js +0 -38
- package/dist/safe-bash-command-wkhtmltopdf/parser.js +0 -146
- package/dist/safe-bash-command-wkhtmltopdf/resources.js +0 -284
- package/dist/safe-bash-command-wkhtmltopdf/settings.js +0 -35
- package/dist/safe-bash-command-wkhtmltopdf/switches.js +0 -127
- package/dist/safe-bash-command-wkhtmltopdf/values.js +0 -66
|
@@ -0,0 +1,2419 @@
|
|
|
1
|
+
// packages/safe-bash-command-fmt/dist/contracts.js
|
|
2
|
+
var fmtBaseline = Object.freeze({
|
|
3
|
+
release: "GNU coreutils 9.10",
|
|
4
|
+
archiveSha256: "16535a9adf0b10037364e2d612aad3d9f4eca3a344949ced74d12faf4bd51d25",
|
|
5
|
+
developmentSource: "b25722854370b8206d7f53f8934c36710cdd9974",
|
|
6
|
+
profile: "gnu-coreutils-9.10-C-bytes"
|
|
7
|
+
});
|
|
8
|
+
var defaultFmtLimits = Object.freeze({
|
|
9
|
+
inputBytes: 32 * 1024 * 1024,
|
|
10
|
+
outputBytes: 32 * 1024 * 1024,
|
|
11
|
+
retainedBytes: 80 * 1024,
|
|
12
|
+
work: 128 * 1024 * 1024,
|
|
13
|
+
argumentBytes: 65536
|
|
14
|
+
});
|
|
15
|
+
var FmtError = class extends Error {
|
|
16
|
+
code;
|
|
17
|
+
usage;
|
|
18
|
+
constructor(code, message, usage = false) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.code = code;
|
|
21
|
+
this.usage = usage;
|
|
22
|
+
this.name = "FmtError";
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
function validateFmtLimits(limits) {
|
|
26
|
+
for (const value of Object.values(limits))
|
|
27
|
+
if (!Number.isSafeInteger(value) || value < 0)
|
|
28
|
+
throw new FmtError("LIMIT", "Limits must be nonnegative safe integers");
|
|
29
|
+
for (const key of ["inputBytes", "outputBytes", "retainedBytes", "work", "argumentBytes"])
|
|
30
|
+
if (limits[key] === void 0)
|
|
31
|
+
throw new FmtError("LIMIT", `Missing ${key} limit`);
|
|
32
|
+
}
|
|
33
|
+
function validateFmtProfile(profile) {
|
|
34
|
+
if (profile !== fmtBaseline.profile && profile !== "gnu-coreutils-8.30-C-bytes")
|
|
35
|
+
throw new FmtError("PROFILE", "Unavailable fmt byte/locale profile");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// packages/safe-bash-command-fmt/dist/bytes.js
|
|
39
|
+
var prototype = Object.getPrototypeOf(Uint8Array.prototype);
|
|
40
|
+
var tag = Object.getOwnPropertyDescriptor(prototype, Symbol.toStringTag).get;
|
|
41
|
+
var length = Object.getOwnPropertyDescriptor(prototype, "byteLength").get;
|
|
42
|
+
var buffer = Object.getOwnPropertyDescriptor(prototype, "buffer").get;
|
|
43
|
+
var byteOffset = Object.getOwnPropertyDescriptor(prototype, "byteOffset").get;
|
|
44
|
+
var values = Uint8Array.prototype.values;
|
|
45
|
+
function byteView(input) {
|
|
46
|
+
try {
|
|
47
|
+
if (tag.call(input) !== "Uint8Array")
|
|
48
|
+
throw new Error();
|
|
49
|
+
return { length: length.call(input), values: values.call(input) };
|
|
50
|
+
} catch {
|
|
51
|
+
throw new FmtError("INPUT", "Input must be an available Uint8Array byte view");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function ownedBytes(input, maximum) {
|
|
55
|
+
const view = byteView(input);
|
|
56
|
+
if (view.length > maximum)
|
|
57
|
+
throw new FmtError("LIMIT", "Argument byte limit exceeded");
|
|
58
|
+
const result = new Uint8Array(view.length);
|
|
59
|
+
let offset = 0;
|
|
60
|
+
for (const byte of view.values)
|
|
61
|
+
result[offset++] = byte;
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
function byteSpan(input, offset, count) {
|
|
65
|
+
return new Uint8Array(buffer.call(input), byteOffset.call(input) + offset, count);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// packages/safe-bash-command-fmt/dist/quoting.js
|
|
69
|
+
var glibc231PrintableRanges = [
|
|
70
|
+
32,
|
|
71
|
+
126,
|
|
72
|
+
160,
|
|
73
|
+
887,
|
|
74
|
+
890,
|
|
75
|
+
895,
|
|
76
|
+
900,
|
|
77
|
+
906,
|
|
78
|
+
908,
|
|
79
|
+
908,
|
|
80
|
+
910,
|
|
81
|
+
929,
|
|
82
|
+
931,
|
|
83
|
+
1327,
|
|
84
|
+
1329,
|
|
85
|
+
1366,
|
|
86
|
+
1369,
|
|
87
|
+
1375,
|
|
88
|
+
1377,
|
|
89
|
+
1415,
|
|
90
|
+
1417,
|
|
91
|
+
1418,
|
|
92
|
+
1421,
|
|
93
|
+
1423,
|
|
94
|
+
1425,
|
|
95
|
+
1479,
|
|
96
|
+
1488,
|
|
97
|
+
1514,
|
|
98
|
+
1520,
|
|
99
|
+
1524,
|
|
100
|
+
1536,
|
|
101
|
+
1564,
|
|
102
|
+
1566,
|
|
103
|
+
1805,
|
|
104
|
+
1807,
|
|
105
|
+
1866,
|
|
106
|
+
1869,
|
|
107
|
+
1969,
|
|
108
|
+
1984,
|
|
109
|
+
2042,
|
|
110
|
+
2048,
|
|
111
|
+
2093,
|
|
112
|
+
2096,
|
|
113
|
+
2110,
|
|
114
|
+
2112,
|
|
115
|
+
2139,
|
|
116
|
+
2142,
|
|
117
|
+
2142,
|
|
118
|
+
2208,
|
|
119
|
+
2228,
|
|
120
|
+
2230,
|
|
121
|
+
2237,
|
|
122
|
+
2260,
|
|
123
|
+
2435,
|
|
124
|
+
2437,
|
|
125
|
+
2444,
|
|
126
|
+
2447,
|
|
127
|
+
2448,
|
|
128
|
+
2451,
|
|
129
|
+
2472,
|
|
130
|
+
2474,
|
|
131
|
+
2480,
|
|
132
|
+
2482,
|
|
133
|
+
2482,
|
|
134
|
+
2486,
|
|
135
|
+
2489,
|
|
136
|
+
2492,
|
|
137
|
+
2500,
|
|
138
|
+
2503,
|
|
139
|
+
2504,
|
|
140
|
+
2507,
|
|
141
|
+
2510,
|
|
142
|
+
2519,
|
|
143
|
+
2519,
|
|
144
|
+
2524,
|
|
145
|
+
2525,
|
|
146
|
+
2527,
|
|
147
|
+
2531,
|
|
148
|
+
2534,
|
|
149
|
+
2555,
|
|
150
|
+
2561,
|
|
151
|
+
2563,
|
|
152
|
+
2565,
|
|
153
|
+
2570,
|
|
154
|
+
2575,
|
|
155
|
+
2576,
|
|
156
|
+
2579,
|
|
157
|
+
2600,
|
|
158
|
+
2602,
|
|
159
|
+
2608,
|
|
160
|
+
2610,
|
|
161
|
+
2611,
|
|
162
|
+
2613,
|
|
163
|
+
2614,
|
|
164
|
+
2616,
|
|
165
|
+
2617,
|
|
166
|
+
2620,
|
|
167
|
+
2620,
|
|
168
|
+
2622,
|
|
169
|
+
2626,
|
|
170
|
+
2631,
|
|
171
|
+
2632,
|
|
172
|
+
2635,
|
|
173
|
+
2637,
|
|
174
|
+
2641,
|
|
175
|
+
2641,
|
|
176
|
+
2649,
|
|
177
|
+
2652,
|
|
178
|
+
2654,
|
|
179
|
+
2654,
|
|
180
|
+
2662,
|
|
181
|
+
2677,
|
|
182
|
+
2689,
|
|
183
|
+
2691,
|
|
184
|
+
2693,
|
|
185
|
+
2701,
|
|
186
|
+
2703,
|
|
187
|
+
2705,
|
|
188
|
+
2707,
|
|
189
|
+
2728,
|
|
190
|
+
2730,
|
|
191
|
+
2736,
|
|
192
|
+
2738,
|
|
193
|
+
2739,
|
|
194
|
+
2741,
|
|
195
|
+
2745,
|
|
196
|
+
2748,
|
|
197
|
+
2757,
|
|
198
|
+
2759,
|
|
199
|
+
2761,
|
|
200
|
+
2763,
|
|
201
|
+
2765,
|
|
202
|
+
2768,
|
|
203
|
+
2768,
|
|
204
|
+
2784,
|
|
205
|
+
2787,
|
|
206
|
+
2790,
|
|
207
|
+
2801,
|
|
208
|
+
2809,
|
|
209
|
+
2809,
|
|
210
|
+
2817,
|
|
211
|
+
2819,
|
|
212
|
+
2821,
|
|
213
|
+
2828,
|
|
214
|
+
2831,
|
|
215
|
+
2832,
|
|
216
|
+
2835,
|
|
217
|
+
2856,
|
|
218
|
+
2858,
|
|
219
|
+
2864,
|
|
220
|
+
2866,
|
|
221
|
+
2867,
|
|
222
|
+
2869,
|
|
223
|
+
2873,
|
|
224
|
+
2876,
|
|
225
|
+
2884,
|
|
226
|
+
2887,
|
|
227
|
+
2888,
|
|
228
|
+
2891,
|
|
229
|
+
2893,
|
|
230
|
+
2902,
|
|
231
|
+
2903,
|
|
232
|
+
2908,
|
|
233
|
+
2909,
|
|
234
|
+
2911,
|
|
235
|
+
2915,
|
|
236
|
+
2918,
|
|
237
|
+
2935,
|
|
238
|
+
2946,
|
|
239
|
+
2947,
|
|
240
|
+
2949,
|
|
241
|
+
2954,
|
|
242
|
+
2958,
|
|
243
|
+
2960,
|
|
244
|
+
2962,
|
|
245
|
+
2965,
|
|
246
|
+
2969,
|
|
247
|
+
2970,
|
|
248
|
+
2972,
|
|
249
|
+
2972,
|
|
250
|
+
2974,
|
|
251
|
+
2975,
|
|
252
|
+
2979,
|
|
253
|
+
2980,
|
|
254
|
+
2984,
|
|
255
|
+
2986,
|
|
256
|
+
2990,
|
|
257
|
+
3001,
|
|
258
|
+
3006,
|
|
259
|
+
3010,
|
|
260
|
+
3014,
|
|
261
|
+
3016,
|
|
262
|
+
3018,
|
|
263
|
+
3021,
|
|
264
|
+
3024,
|
|
265
|
+
3024,
|
|
266
|
+
3031,
|
|
267
|
+
3031,
|
|
268
|
+
3046,
|
|
269
|
+
3066,
|
|
270
|
+
3072,
|
|
271
|
+
3075,
|
|
272
|
+
3077,
|
|
273
|
+
3084,
|
|
274
|
+
3086,
|
|
275
|
+
3088,
|
|
276
|
+
3090,
|
|
277
|
+
3112,
|
|
278
|
+
3114,
|
|
279
|
+
3129,
|
|
280
|
+
3133,
|
|
281
|
+
3140,
|
|
282
|
+
3142,
|
|
283
|
+
3144,
|
|
284
|
+
3146,
|
|
285
|
+
3149,
|
|
286
|
+
3157,
|
|
287
|
+
3158,
|
|
288
|
+
3160,
|
|
289
|
+
3162,
|
|
290
|
+
3168,
|
|
291
|
+
3171,
|
|
292
|
+
3174,
|
|
293
|
+
3183,
|
|
294
|
+
3192,
|
|
295
|
+
3203,
|
|
296
|
+
3205,
|
|
297
|
+
3212,
|
|
298
|
+
3214,
|
|
299
|
+
3216,
|
|
300
|
+
3218,
|
|
301
|
+
3240,
|
|
302
|
+
3242,
|
|
303
|
+
3251,
|
|
304
|
+
3253,
|
|
305
|
+
3257,
|
|
306
|
+
3260,
|
|
307
|
+
3268,
|
|
308
|
+
3270,
|
|
309
|
+
3272,
|
|
310
|
+
3274,
|
|
311
|
+
3277,
|
|
312
|
+
3285,
|
|
313
|
+
3286,
|
|
314
|
+
3294,
|
|
315
|
+
3294,
|
|
316
|
+
3296,
|
|
317
|
+
3299,
|
|
318
|
+
3302,
|
|
319
|
+
3311,
|
|
320
|
+
3313,
|
|
321
|
+
3314,
|
|
322
|
+
3329,
|
|
323
|
+
3331,
|
|
324
|
+
3333,
|
|
325
|
+
3340,
|
|
326
|
+
3342,
|
|
327
|
+
3344,
|
|
328
|
+
3346,
|
|
329
|
+
3386,
|
|
330
|
+
3389,
|
|
331
|
+
3396,
|
|
332
|
+
3398,
|
|
333
|
+
3400,
|
|
334
|
+
3402,
|
|
335
|
+
3407,
|
|
336
|
+
3412,
|
|
337
|
+
3427,
|
|
338
|
+
3430,
|
|
339
|
+
3455,
|
|
340
|
+
3458,
|
|
341
|
+
3459,
|
|
342
|
+
3461,
|
|
343
|
+
3478,
|
|
344
|
+
3482,
|
|
345
|
+
3505,
|
|
346
|
+
3507,
|
|
347
|
+
3515,
|
|
348
|
+
3517,
|
|
349
|
+
3517,
|
|
350
|
+
3520,
|
|
351
|
+
3526,
|
|
352
|
+
3530,
|
|
353
|
+
3530,
|
|
354
|
+
3535,
|
|
355
|
+
3540,
|
|
356
|
+
3542,
|
|
357
|
+
3542,
|
|
358
|
+
3544,
|
|
359
|
+
3551,
|
|
360
|
+
3558,
|
|
361
|
+
3567,
|
|
362
|
+
3570,
|
|
363
|
+
3572,
|
|
364
|
+
3585,
|
|
365
|
+
3642,
|
|
366
|
+
3647,
|
|
367
|
+
3675,
|
|
368
|
+
3713,
|
|
369
|
+
3714,
|
|
370
|
+
3716,
|
|
371
|
+
3716,
|
|
372
|
+
3719,
|
|
373
|
+
3720,
|
|
374
|
+
3722,
|
|
375
|
+
3722,
|
|
376
|
+
3725,
|
|
377
|
+
3725,
|
|
378
|
+
3732,
|
|
379
|
+
3735,
|
|
380
|
+
3737,
|
|
381
|
+
3743,
|
|
382
|
+
3745,
|
|
383
|
+
3747,
|
|
384
|
+
3749,
|
|
385
|
+
3749,
|
|
386
|
+
3751,
|
|
387
|
+
3751,
|
|
388
|
+
3754,
|
|
389
|
+
3755,
|
|
390
|
+
3757,
|
|
391
|
+
3769,
|
|
392
|
+
3771,
|
|
393
|
+
3773,
|
|
394
|
+
3776,
|
|
395
|
+
3780,
|
|
396
|
+
3782,
|
|
397
|
+
3782,
|
|
398
|
+
3784,
|
|
399
|
+
3789,
|
|
400
|
+
3792,
|
|
401
|
+
3801,
|
|
402
|
+
3804,
|
|
403
|
+
3807,
|
|
404
|
+
3840,
|
|
405
|
+
3911,
|
|
406
|
+
3913,
|
|
407
|
+
3948,
|
|
408
|
+
3953,
|
|
409
|
+
3991,
|
|
410
|
+
3993,
|
|
411
|
+
4028,
|
|
412
|
+
4030,
|
|
413
|
+
4044,
|
|
414
|
+
4046,
|
|
415
|
+
4058,
|
|
416
|
+
4096,
|
|
417
|
+
4293,
|
|
418
|
+
4295,
|
|
419
|
+
4295,
|
|
420
|
+
4301,
|
|
421
|
+
4301,
|
|
422
|
+
4304,
|
|
423
|
+
4680,
|
|
424
|
+
4682,
|
|
425
|
+
4685,
|
|
426
|
+
4688,
|
|
427
|
+
4694,
|
|
428
|
+
4696,
|
|
429
|
+
4696,
|
|
430
|
+
4698,
|
|
431
|
+
4701,
|
|
432
|
+
4704,
|
|
433
|
+
4744,
|
|
434
|
+
4746,
|
|
435
|
+
4749,
|
|
436
|
+
4752,
|
|
437
|
+
4784,
|
|
438
|
+
4786,
|
|
439
|
+
4789,
|
|
440
|
+
4792,
|
|
441
|
+
4798,
|
|
442
|
+
4800,
|
|
443
|
+
4800,
|
|
444
|
+
4802,
|
|
445
|
+
4805,
|
|
446
|
+
4808,
|
|
447
|
+
4822,
|
|
448
|
+
4824,
|
|
449
|
+
4880,
|
|
450
|
+
4882,
|
|
451
|
+
4885,
|
|
452
|
+
4888,
|
|
453
|
+
4954,
|
|
454
|
+
4957,
|
|
455
|
+
4988,
|
|
456
|
+
4992,
|
|
457
|
+
5017,
|
|
458
|
+
5024,
|
|
459
|
+
5109,
|
|
460
|
+
5112,
|
|
461
|
+
5117,
|
|
462
|
+
5120,
|
|
463
|
+
5788,
|
|
464
|
+
5792,
|
|
465
|
+
5880,
|
|
466
|
+
5888,
|
|
467
|
+
5900,
|
|
468
|
+
5902,
|
|
469
|
+
5908,
|
|
470
|
+
5920,
|
|
471
|
+
5942,
|
|
472
|
+
5952,
|
|
473
|
+
5971,
|
|
474
|
+
5984,
|
|
475
|
+
5996,
|
|
476
|
+
5998,
|
|
477
|
+
6e3,
|
|
478
|
+
6002,
|
|
479
|
+
6003,
|
|
480
|
+
6016,
|
|
481
|
+
6109,
|
|
482
|
+
6112,
|
|
483
|
+
6121,
|
|
484
|
+
6128,
|
|
485
|
+
6137,
|
|
486
|
+
6144,
|
|
487
|
+
6158,
|
|
488
|
+
6160,
|
|
489
|
+
6169,
|
|
490
|
+
6176,
|
|
491
|
+
6263,
|
|
492
|
+
6272,
|
|
493
|
+
6314,
|
|
494
|
+
6320,
|
|
495
|
+
6389,
|
|
496
|
+
6400,
|
|
497
|
+
6430,
|
|
498
|
+
6432,
|
|
499
|
+
6443,
|
|
500
|
+
6448,
|
|
501
|
+
6459,
|
|
502
|
+
6464,
|
|
503
|
+
6464,
|
|
504
|
+
6468,
|
|
505
|
+
6509,
|
|
506
|
+
6512,
|
|
507
|
+
6516,
|
|
508
|
+
6528,
|
|
509
|
+
6571,
|
|
510
|
+
6576,
|
|
511
|
+
6601,
|
|
512
|
+
6608,
|
|
513
|
+
6618,
|
|
514
|
+
6622,
|
|
515
|
+
6683,
|
|
516
|
+
6686,
|
|
517
|
+
6750,
|
|
518
|
+
6752,
|
|
519
|
+
6780,
|
|
520
|
+
6783,
|
|
521
|
+
6793,
|
|
522
|
+
6800,
|
|
523
|
+
6809,
|
|
524
|
+
6816,
|
|
525
|
+
6829,
|
|
526
|
+
6832,
|
|
527
|
+
6846,
|
|
528
|
+
6912,
|
|
529
|
+
6987,
|
|
530
|
+
6992,
|
|
531
|
+
7036,
|
|
532
|
+
7040,
|
|
533
|
+
7155,
|
|
534
|
+
7164,
|
|
535
|
+
7223,
|
|
536
|
+
7227,
|
|
537
|
+
7241,
|
|
538
|
+
7245,
|
|
539
|
+
7304,
|
|
540
|
+
7360,
|
|
541
|
+
7367,
|
|
542
|
+
7376,
|
|
543
|
+
7414,
|
|
544
|
+
7416,
|
|
545
|
+
7417,
|
|
546
|
+
7424,
|
|
547
|
+
7669,
|
|
548
|
+
7675,
|
|
549
|
+
7957,
|
|
550
|
+
7960,
|
|
551
|
+
7965,
|
|
552
|
+
7968,
|
|
553
|
+
8005,
|
|
554
|
+
8008,
|
|
555
|
+
8013,
|
|
556
|
+
8016,
|
|
557
|
+
8023,
|
|
558
|
+
8025,
|
|
559
|
+
8025,
|
|
560
|
+
8027,
|
|
561
|
+
8027,
|
|
562
|
+
8029,
|
|
563
|
+
8029,
|
|
564
|
+
8031,
|
|
565
|
+
8061,
|
|
566
|
+
8064,
|
|
567
|
+
8116,
|
|
568
|
+
8118,
|
|
569
|
+
8132,
|
|
570
|
+
8134,
|
|
571
|
+
8147,
|
|
572
|
+
8150,
|
|
573
|
+
8155,
|
|
574
|
+
8157,
|
|
575
|
+
8175,
|
|
576
|
+
8178,
|
|
577
|
+
8180,
|
|
578
|
+
8182,
|
|
579
|
+
8190,
|
|
580
|
+
8192,
|
|
581
|
+
8231,
|
|
582
|
+
8234,
|
|
583
|
+
8292,
|
|
584
|
+
8294,
|
|
585
|
+
8305,
|
|
586
|
+
8308,
|
|
587
|
+
8334,
|
|
588
|
+
8336,
|
|
589
|
+
8348,
|
|
590
|
+
8352,
|
|
591
|
+
8382,
|
|
592
|
+
8400,
|
|
593
|
+
8432,
|
|
594
|
+
8448,
|
|
595
|
+
8587,
|
|
596
|
+
8592,
|
|
597
|
+
9214,
|
|
598
|
+
9216,
|
|
599
|
+
9254,
|
|
600
|
+
9280,
|
|
601
|
+
9290,
|
|
602
|
+
9312,
|
|
603
|
+
11123,
|
|
604
|
+
11126,
|
|
605
|
+
11157,
|
|
606
|
+
11160,
|
|
607
|
+
11193,
|
|
608
|
+
11197,
|
|
609
|
+
11208,
|
|
610
|
+
11210,
|
|
611
|
+
11217,
|
|
612
|
+
11244,
|
|
613
|
+
11247,
|
|
614
|
+
11264,
|
|
615
|
+
11310,
|
|
616
|
+
11312,
|
|
617
|
+
11358,
|
|
618
|
+
11360,
|
|
619
|
+
11507,
|
|
620
|
+
11513,
|
|
621
|
+
11557,
|
|
622
|
+
11559,
|
|
623
|
+
11559,
|
|
624
|
+
11565,
|
|
625
|
+
11565,
|
|
626
|
+
11568,
|
|
627
|
+
11623,
|
|
628
|
+
11631,
|
|
629
|
+
11632,
|
|
630
|
+
11647,
|
|
631
|
+
11670,
|
|
632
|
+
11680,
|
|
633
|
+
11686,
|
|
634
|
+
11688,
|
|
635
|
+
11694,
|
|
636
|
+
11696,
|
|
637
|
+
11702,
|
|
638
|
+
11704,
|
|
639
|
+
11710,
|
|
640
|
+
11712,
|
|
641
|
+
11718,
|
|
642
|
+
11720,
|
|
643
|
+
11726,
|
|
644
|
+
11728,
|
|
645
|
+
11734,
|
|
646
|
+
11736,
|
|
647
|
+
11742,
|
|
648
|
+
11744,
|
|
649
|
+
11844,
|
|
650
|
+
11904,
|
|
651
|
+
11929,
|
|
652
|
+
11931,
|
|
653
|
+
12019,
|
|
654
|
+
12032,
|
|
655
|
+
12245,
|
|
656
|
+
12272,
|
|
657
|
+
12283,
|
|
658
|
+
12288,
|
|
659
|
+
12351,
|
|
660
|
+
12353,
|
|
661
|
+
12438,
|
|
662
|
+
12441,
|
|
663
|
+
12543,
|
|
664
|
+
12549,
|
|
665
|
+
12589,
|
|
666
|
+
12593,
|
|
667
|
+
12686,
|
|
668
|
+
12688,
|
|
669
|
+
12730,
|
|
670
|
+
12736,
|
|
671
|
+
12771,
|
|
672
|
+
12784,
|
|
673
|
+
12830,
|
|
674
|
+
12832,
|
|
675
|
+
13054,
|
|
676
|
+
13056,
|
|
677
|
+
19893,
|
|
678
|
+
19904,
|
|
679
|
+
40917,
|
|
680
|
+
40960,
|
|
681
|
+
42124,
|
|
682
|
+
42128,
|
|
683
|
+
42182,
|
|
684
|
+
42192,
|
|
685
|
+
42539,
|
|
686
|
+
42560,
|
|
687
|
+
42743,
|
|
688
|
+
42752,
|
|
689
|
+
42926,
|
|
690
|
+
42928,
|
|
691
|
+
42935,
|
|
692
|
+
42999,
|
|
693
|
+
43051,
|
|
694
|
+
43056,
|
|
695
|
+
43065,
|
|
696
|
+
43072,
|
|
697
|
+
43127,
|
|
698
|
+
43136,
|
|
699
|
+
43205,
|
|
700
|
+
43214,
|
|
701
|
+
43225,
|
|
702
|
+
43232,
|
|
703
|
+
43261,
|
|
704
|
+
43264,
|
|
705
|
+
43347,
|
|
706
|
+
43359,
|
|
707
|
+
43388,
|
|
708
|
+
43392,
|
|
709
|
+
43469,
|
|
710
|
+
43471,
|
|
711
|
+
43481,
|
|
712
|
+
43486,
|
|
713
|
+
43518,
|
|
714
|
+
43520,
|
|
715
|
+
43574,
|
|
716
|
+
43584,
|
|
717
|
+
43597,
|
|
718
|
+
43600,
|
|
719
|
+
43609,
|
|
720
|
+
43612,
|
|
721
|
+
43714,
|
|
722
|
+
43739,
|
|
723
|
+
43766,
|
|
724
|
+
43777,
|
|
725
|
+
43782,
|
|
726
|
+
43785,
|
|
727
|
+
43790,
|
|
728
|
+
43793,
|
|
729
|
+
43798,
|
|
730
|
+
43808,
|
|
731
|
+
43814,
|
|
732
|
+
43816,
|
|
733
|
+
43822,
|
|
734
|
+
43824,
|
|
735
|
+
43877,
|
|
736
|
+
43888,
|
|
737
|
+
44013,
|
|
738
|
+
44016,
|
|
739
|
+
44025,
|
|
740
|
+
44032,
|
|
741
|
+
55203,
|
|
742
|
+
55216,
|
|
743
|
+
55238,
|
|
744
|
+
55243,
|
|
745
|
+
55291,
|
|
746
|
+
57344,
|
|
747
|
+
64109,
|
|
748
|
+
64112,
|
|
749
|
+
64217,
|
|
750
|
+
64256,
|
|
751
|
+
64262,
|
|
752
|
+
64275,
|
|
753
|
+
64279,
|
|
754
|
+
64285,
|
|
755
|
+
64310,
|
|
756
|
+
64312,
|
|
757
|
+
64316,
|
|
758
|
+
64318,
|
|
759
|
+
64318,
|
|
760
|
+
64320,
|
|
761
|
+
64321,
|
|
762
|
+
64323,
|
|
763
|
+
64324,
|
|
764
|
+
64326,
|
|
765
|
+
64449,
|
|
766
|
+
64467,
|
|
767
|
+
64831,
|
|
768
|
+
64848,
|
|
769
|
+
64911,
|
|
770
|
+
64914,
|
|
771
|
+
64967,
|
|
772
|
+
65008,
|
|
773
|
+
65021,
|
|
774
|
+
65024,
|
|
775
|
+
65049,
|
|
776
|
+
65056,
|
|
777
|
+
65106,
|
|
778
|
+
65108,
|
|
779
|
+
65126,
|
|
780
|
+
65128,
|
|
781
|
+
65131,
|
|
782
|
+
65136,
|
|
783
|
+
65140,
|
|
784
|
+
65142,
|
|
785
|
+
65276,
|
|
786
|
+
65279,
|
|
787
|
+
65279,
|
|
788
|
+
65281,
|
|
789
|
+
65470,
|
|
790
|
+
65474,
|
|
791
|
+
65479,
|
|
792
|
+
65482,
|
|
793
|
+
65487,
|
|
794
|
+
65490,
|
|
795
|
+
65495,
|
|
796
|
+
65498,
|
|
797
|
+
65500,
|
|
798
|
+
65504,
|
|
799
|
+
65510,
|
|
800
|
+
65512,
|
|
801
|
+
65518,
|
|
802
|
+
65529,
|
|
803
|
+
65533,
|
|
804
|
+
65536,
|
|
805
|
+
65547,
|
|
806
|
+
65549,
|
|
807
|
+
65574,
|
|
808
|
+
65576,
|
|
809
|
+
65594,
|
|
810
|
+
65596,
|
|
811
|
+
65597,
|
|
812
|
+
65599,
|
|
813
|
+
65613,
|
|
814
|
+
65616,
|
|
815
|
+
65629,
|
|
816
|
+
65664,
|
|
817
|
+
65786,
|
|
818
|
+
65792,
|
|
819
|
+
65794,
|
|
820
|
+
65799,
|
|
821
|
+
65843,
|
|
822
|
+
65847,
|
|
823
|
+
65934,
|
|
824
|
+
65936,
|
|
825
|
+
65947,
|
|
826
|
+
65952,
|
|
827
|
+
65952,
|
|
828
|
+
66e3,
|
|
829
|
+
66045,
|
|
830
|
+
66176,
|
|
831
|
+
66204,
|
|
832
|
+
66208,
|
|
833
|
+
66256,
|
|
834
|
+
66272,
|
|
835
|
+
66299,
|
|
836
|
+
66304,
|
|
837
|
+
66339,
|
|
838
|
+
66352,
|
|
839
|
+
66378,
|
|
840
|
+
66384,
|
|
841
|
+
66426,
|
|
842
|
+
66432,
|
|
843
|
+
66461,
|
|
844
|
+
66463,
|
|
845
|
+
66499,
|
|
846
|
+
66504,
|
|
847
|
+
66517,
|
|
848
|
+
66560,
|
|
849
|
+
66717,
|
|
850
|
+
66720,
|
|
851
|
+
66729,
|
|
852
|
+
66736,
|
|
853
|
+
66771,
|
|
854
|
+
66776,
|
|
855
|
+
66811,
|
|
856
|
+
66816,
|
|
857
|
+
66855,
|
|
858
|
+
66864,
|
|
859
|
+
66915,
|
|
860
|
+
66927,
|
|
861
|
+
66927,
|
|
862
|
+
67072,
|
|
863
|
+
67382,
|
|
864
|
+
67392,
|
|
865
|
+
67413,
|
|
866
|
+
67424,
|
|
867
|
+
67431,
|
|
868
|
+
67584,
|
|
869
|
+
67589,
|
|
870
|
+
67592,
|
|
871
|
+
67592,
|
|
872
|
+
67594,
|
|
873
|
+
67637,
|
|
874
|
+
67639,
|
|
875
|
+
67640,
|
|
876
|
+
67644,
|
|
877
|
+
67644,
|
|
878
|
+
67647,
|
|
879
|
+
67669,
|
|
880
|
+
67671,
|
|
881
|
+
67742,
|
|
882
|
+
67751,
|
|
883
|
+
67759,
|
|
884
|
+
67808,
|
|
885
|
+
67826,
|
|
886
|
+
67828,
|
|
887
|
+
67829,
|
|
888
|
+
67835,
|
|
889
|
+
67867,
|
|
890
|
+
67871,
|
|
891
|
+
67897,
|
|
892
|
+
67903,
|
|
893
|
+
67903,
|
|
894
|
+
67968,
|
|
895
|
+
68023,
|
|
896
|
+
68028,
|
|
897
|
+
68047,
|
|
898
|
+
68050,
|
|
899
|
+
68099,
|
|
900
|
+
68101,
|
|
901
|
+
68102,
|
|
902
|
+
68108,
|
|
903
|
+
68115,
|
|
904
|
+
68117,
|
|
905
|
+
68119,
|
|
906
|
+
68121,
|
|
907
|
+
68147,
|
|
908
|
+
68152,
|
|
909
|
+
68154,
|
|
910
|
+
68159,
|
|
911
|
+
68167,
|
|
912
|
+
68176,
|
|
913
|
+
68184,
|
|
914
|
+
68192,
|
|
915
|
+
68255,
|
|
916
|
+
68288,
|
|
917
|
+
68326,
|
|
918
|
+
68331,
|
|
919
|
+
68342,
|
|
920
|
+
68352,
|
|
921
|
+
68405,
|
|
922
|
+
68409,
|
|
923
|
+
68437,
|
|
924
|
+
68440,
|
|
925
|
+
68466,
|
|
926
|
+
68472,
|
|
927
|
+
68497,
|
|
928
|
+
68505,
|
|
929
|
+
68508,
|
|
930
|
+
68521,
|
|
931
|
+
68527,
|
|
932
|
+
68608,
|
|
933
|
+
68680,
|
|
934
|
+
68736,
|
|
935
|
+
68786,
|
|
936
|
+
68800,
|
|
937
|
+
68850,
|
|
938
|
+
68858,
|
|
939
|
+
68863,
|
|
940
|
+
69216,
|
|
941
|
+
69246,
|
|
942
|
+
69632,
|
|
943
|
+
69709,
|
|
944
|
+
69714,
|
|
945
|
+
69743,
|
|
946
|
+
69759,
|
|
947
|
+
69825,
|
|
948
|
+
69840,
|
|
949
|
+
69864,
|
|
950
|
+
69872,
|
|
951
|
+
69881,
|
|
952
|
+
69888,
|
|
953
|
+
69940,
|
|
954
|
+
69942,
|
|
955
|
+
69955,
|
|
956
|
+
69968,
|
|
957
|
+
70006,
|
|
958
|
+
70016,
|
|
959
|
+
70093,
|
|
960
|
+
70096,
|
|
961
|
+
70111,
|
|
962
|
+
70113,
|
|
963
|
+
70132,
|
|
964
|
+
70144,
|
|
965
|
+
70161,
|
|
966
|
+
70163,
|
|
967
|
+
70206,
|
|
968
|
+
70272,
|
|
969
|
+
70278,
|
|
970
|
+
70280,
|
|
971
|
+
70280,
|
|
972
|
+
70282,
|
|
973
|
+
70285,
|
|
974
|
+
70287,
|
|
975
|
+
70301,
|
|
976
|
+
70303,
|
|
977
|
+
70313,
|
|
978
|
+
70320,
|
|
979
|
+
70378,
|
|
980
|
+
70384,
|
|
981
|
+
70393,
|
|
982
|
+
70400,
|
|
983
|
+
70403,
|
|
984
|
+
70405,
|
|
985
|
+
70412,
|
|
986
|
+
70415,
|
|
987
|
+
70416,
|
|
988
|
+
70419,
|
|
989
|
+
70440,
|
|
990
|
+
70442,
|
|
991
|
+
70448,
|
|
992
|
+
70450,
|
|
993
|
+
70451,
|
|
994
|
+
70453,
|
|
995
|
+
70457,
|
|
996
|
+
70460,
|
|
997
|
+
70468,
|
|
998
|
+
70471,
|
|
999
|
+
70472,
|
|
1000
|
+
70475,
|
|
1001
|
+
70477,
|
|
1002
|
+
70480,
|
|
1003
|
+
70480,
|
|
1004
|
+
70487,
|
|
1005
|
+
70487,
|
|
1006
|
+
70493,
|
|
1007
|
+
70499,
|
|
1008
|
+
70502,
|
|
1009
|
+
70508,
|
|
1010
|
+
70512,
|
|
1011
|
+
70516,
|
|
1012
|
+
70656,
|
|
1013
|
+
70745,
|
|
1014
|
+
70747,
|
|
1015
|
+
70747,
|
|
1016
|
+
70749,
|
|
1017
|
+
70749,
|
|
1018
|
+
70784,
|
|
1019
|
+
70855,
|
|
1020
|
+
70864,
|
|
1021
|
+
70873,
|
|
1022
|
+
71040,
|
|
1023
|
+
71093,
|
|
1024
|
+
71096,
|
|
1025
|
+
71133,
|
|
1026
|
+
71168,
|
|
1027
|
+
71236,
|
|
1028
|
+
71248,
|
|
1029
|
+
71257,
|
|
1030
|
+
71264,
|
|
1031
|
+
71276,
|
|
1032
|
+
71296,
|
|
1033
|
+
71351,
|
|
1034
|
+
71360,
|
|
1035
|
+
71369,
|
|
1036
|
+
71424,
|
|
1037
|
+
71449,
|
|
1038
|
+
71453,
|
|
1039
|
+
71467,
|
|
1040
|
+
71472,
|
|
1041
|
+
71487,
|
|
1042
|
+
71840,
|
|
1043
|
+
71922,
|
|
1044
|
+
71935,
|
|
1045
|
+
71935,
|
|
1046
|
+
72384,
|
|
1047
|
+
72440,
|
|
1048
|
+
72704,
|
|
1049
|
+
72712,
|
|
1050
|
+
72714,
|
|
1051
|
+
72758,
|
|
1052
|
+
72760,
|
|
1053
|
+
72773,
|
|
1054
|
+
72784,
|
|
1055
|
+
72812,
|
|
1056
|
+
72816,
|
|
1057
|
+
72847,
|
|
1058
|
+
72850,
|
|
1059
|
+
72871,
|
|
1060
|
+
72873,
|
|
1061
|
+
72886,
|
|
1062
|
+
73728,
|
|
1063
|
+
74649,
|
|
1064
|
+
74752,
|
|
1065
|
+
74862,
|
|
1066
|
+
74864,
|
|
1067
|
+
74868,
|
|
1068
|
+
74880,
|
|
1069
|
+
75075,
|
|
1070
|
+
77824,
|
|
1071
|
+
78894,
|
|
1072
|
+
82944,
|
|
1073
|
+
83526,
|
|
1074
|
+
92160,
|
|
1075
|
+
92728,
|
|
1076
|
+
92736,
|
|
1077
|
+
92766,
|
|
1078
|
+
92768,
|
|
1079
|
+
92777,
|
|
1080
|
+
92782,
|
|
1081
|
+
92783,
|
|
1082
|
+
92880,
|
|
1083
|
+
92909,
|
|
1084
|
+
92912,
|
|
1085
|
+
92917,
|
|
1086
|
+
92928,
|
|
1087
|
+
92997,
|
|
1088
|
+
93008,
|
|
1089
|
+
93017,
|
|
1090
|
+
93019,
|
|
1091
|
+
93025,
|
|
1092
|
+
93027,
|
|
1093
|
+
93047,
|
|
1094
|
+
93053,
|
|
1095
|
+
93071,
|
|
1096
|
+
93952,
|
|
1097
|
+
94020,
|
|
1098
|
+
94032,
|
|
1099
|
+
94078,
|
|
1100
|
+
94095,
|
|
1101
|
+
94111,
|
|
1102
|
+
94176,
|
|
1103
|
+
94176,
|
|
1104
|
+
94208,
|
|
1105
|
+
100332,
|
|
1106
|
+
100352,
|
|
1107
|
+
101106,
|
|
1108
|
+
110592,
|
|
1109
|
+
110593,
|
|
1110
|
+
113664,
|
|
1111
|
+
113770,
|
|
1112
|
+
113776,
|
|
1113
|
+
113788,
|
|
1114
|
+
113792,
|
|
1115
|
+
113800,
|
|
1116
|
+
113808,
|
|
1117
|
+
113817,
|
|
1118
|
+
113820,
|
|
1119
|
+
113827,
|
|
1120
|
+
118784,
|
|
1121
|
+
119029,
|
|
1122
|
+
119040,
|
|
1123
|
+
119078,
|
|
1124
|
+
119081,
|
|
1125
|
+
119272,
|
|
1126
|
+
119296,
|
|
1127
|
+
119365,
|
|
1128
|
+
119552,
|
|
1129
|
+
119638,
|
|
1130
|
+
119648,
|
|
1131
|
+
119665,
|
|
1132
|
+
119808,
|
|
1133
|
+
119892,
|
|
1134
|
+
119894,
|
|
1135
|
+
119964,
|
|
1136
|
+
119966,
|
|
1137
|
+
119967,
|
|
1138
|
+
119970,
|
|
1139
|
+
119970,
|
|
1140
|
+
119973,
|
|
1141
|
+
119974,
|
|
1142
|
+
119977,
|
|
1143
|
+
119980,
|
|
1144
|
+
119982,
|
|
1145
|
+
119993,
|
|
1146
|
+
119995,
|
|
1147
|
+
119995,
|
|
1148
|
+
119997,
|
|
1149
|
+
120003,
|
|
1150
|
+
120005,
|
|
1151
|
+
120069,
|
|
1152
|
+
120071,
|
|
1153
|
+
120074,
|
|
1154
|
+
120077,
|
|
1155
|
+
120084,
|
|
1156
|
+
120086,
|
|
1157
|
+
120092,
|
|
1158
|
+
120094,
|
|
1159
|
+
120121,
|
|
1160
|
+
120123,
|
|
1161
|
+
120126,
|
|
1162
|
+
120128,
|
|
1163
|
+
120132,
|
|
1164
|
+
120134,
|
|
1165
|
+
120134,
|
|
1166
|
+
120138,
|
|
1167
|
+
120144,
|
|
1168
|
+
120146,
|
|
1169
|
+
120485,
|
|
1170
|
+
120488,
|
|
1171
|
+
120779,
|
|
1172
|
+
120782,
|
|
1173
|
+
121483,
|
|
1174
|
+
121499,
|
|
1175
|
+
121503,
|
|
1176
|
+
121505,
|
|
1177
|
+
121519,
|
|
1178
|
+
122880,
|
|
1179
|
+
122886,
|
|
1180
|
+
122888,
|
|
1181
|
+
122904,
|
|
1182
|
+
122907,
|
|
1183
|
+
122913,
|
|
1184
|
+
122915,
|
|
1185
|
+
122916,
|
|
1186
|
+
122918,
|
|
1187
|
+
122922,
|
|
1188
|
+
124928,
|
|
1189
|
+
125124,
|
|
1190
|
+
125127,
|
|
1191
|
+
125142,
|
|
1192
|
+
125184,
|
|
1193
|
+
125258,
|
|
1194
|
+
125264,
|
|
1195
|
+
125273,
|
|
1196
|
+
125278,
|
|
1197
|
+
125279,
|
|
1198
|
+
126464,
|
|
1199
|
+
126467,
|
|
1200
|
+
126469,
|
|
1201
|
+
126495,
|
|
1202
|
+
126497,
|
|
1203
|
+
126498,
|
|
1204
|
+
126500,
|
|
1205
|
+
126500,
|
|
1206
|
+
126503,
|
|
1207
|
+
126503,
|
|
1208
|
+
126505,
|
|
1209
|
+
126514,
|
|
1210
|
+
126516,
|
|
1211
|
+
126519,
|
|
1212
|
+
126521,
|
|
1213
|
+
126521,
|
|
1214
|
+
126523,
|
|
1215
|
+
126523,
|
|
1216
|
+
126530,
|
|
1217
|
+
126530,
|
|
1218
|
+
126535,
|
|
1219
|
+
126535,
|
|
1220
|
+
126537,
|
|
1221
|
+
126537,
|
|
1222
|
+
126539,
|
|
1223
|
+
126539,
|
|
1224
|
+
126541,
|
|
1225
|
+
126543,
|
|
1226
|
+
126545,
|
|
1227
|
+
126546,
|
|
1228
|
+
126548,
|
|
1229
|
+
126548,
|
|
1230
|
+
126551,
|
|
1231
|
+
126551,
|
|
1232
|
+
126553,
|
|
1233
|
+
126553,
|
|
1234
|
+
126555,
|
|
1235
|
+
126555,
|
|
1236
|
+
126557,
|
|
1237
|
+
126557,
|
|
1238
|
+
126559,
|
|
1239
|
+
126559,
|
|
1240
|
+
126561,
|
|
1241
|
+
126562,
|
|
1242
|
+
126564,
|
|
1243
|
+
126564,
|
|
1244
|
+
126567,
|
|
1245
|
+
126570,
|
|
1246
|
+
126572,
|
|
1247
|
+
126578,
|
|
1248
|
+
126580,
|
|
1249
|
+
126583,
|
|
1250
|
+
126585,
|
|
1251
|
+
126588,
|
|
1252
|
+
126590,
|
|
1253
|
+
126590,
|
|
1254
|
+
126592,
|
|
1255
|
+
126601,
|
|
1256
|
+
126603,
|
|
1257
|
+
126619,
|
|
1258
|
+
126625,
|
|
1259
|
+
126627,
|
|
1260
|
+
126629,
|
|
1261
|
+
126633,
|
|
1262
|
+
126635,
|
|
1263
|
+
126651,
|
|
1264
|
+
126704,
|
|
1265
|
+
126705,
|
|
1266
|
+
126976,
|
|
1267
|
+
127019,
|
|
1268
|
+
127024,
|
|
1269
|
+
127123,
|
|
1270
|
+
127136,
|
|
1271
|
+
127150,
|
|
1272
|
+
127153,
|
|
1273
|
+
127167,
|
|
1274
|
+
127169,
|
|
1275
|
+
127183,
|
|
1276
|
+
127185,
|
|
1277
|
+
127221,
|
|
1278
|
+
127232,
|
|
1279
|
+
127244,
|
|
1280
|
+
127248,
|
|
1281
|
+
127278,
|
|
1282
|
+
127280,
|
|
1283
|
+
127339,
|
|
1284
|
+
127344,
|
|
1285
|
+
127404,
|
|
1286
|
+
127462,
|
|
1287
|
+
127490,
|
|
1288
|
+
127504,
|
|
1289
|
+
127547,
|
|
1290
|
+
127552,
|
|
1291
|
+
127560,
|
|
1292
|
+
127568,
|
|
1293
|
+
127569,
|
|
1294
|
+
127744,
|
|
1295
|
+
128722,
|
|
1296
|
+
128736,
|
|
1297
|
+
128748,
|
|
1298
|
+
128752,
|
|
1299
|
+
128758,
|
|
1300
|
+
128768,
|
|
1301
|
+
128883,
|
|
1302
|
+
128896,
|
|
1303
|
+
128980,
|
|
1304
|
+
129024,
|
|
1305
|
+
129035,
|
|
1306
|
+
129040,
|
|
1307
|
+
129095,
|
|
1308
|
+
129104,
|
|
1309
|
+
129113,
|
|
1310
|
+
129120,
|
|
1311
|
+
129159,
|
|
1312
|
+
129168,
|
|
1313
|
+
129197,
|
|
1314
|
+
129296,
|
|
1315
|
+
129310,
|
|
1316
|
+
129312,
|
|
1317
|
+
129319,
|
|
1318
|
+
129328,
|
|
1319
|
+
129328,
|
|
1320
|
+
129331,
|
|
1321
|
+
129342,
|
|
1322
|
+
129344,
|
|
1323
|
+
129355,
|
|
1324
|
+
129360,
|
|
1325
|
+
129374,
|
|
1326
|
+
129408,
|
|
1327
|
+
129425,
|
|
1328
|
+
129472,
|
|
1329
|
+
129472,
|
|
1330
|
+
131072,
|
|
1331
|
+
173782,
|
|
1332
|
+
173824,
|
|
1333
|
+
177972,
|
|
1334
|
+
177984,
|
|
1335
|
+
178205,
|
|
1336
|
+
178208,
|
|
1337
|
+
183969,
|
|
1338
|
+
194560,
|
|
1339
|
+
195101,
|
|
1340
|
+
917505,
|
|
1341
|
+
917505,
|
|
1342
|
+
917536,
|
|
1343
|
+
917631,
|
|
1344
|
+
917760,
|
|
1345
|
+
917999,
|
|
1346
|
+
983040,
|
|
1347
|
+
1048573,
|
|
1348
|
+
1048576,
|
|
1349
|
+
1114109
|
|
1350
|
+
];
|
|
1351
|
+
function unicodeLocale(context) {
|
|
1352
|
+
const locale = (context.env.LC_ALL || context.env.LC_CTYPE || context.env.LANG || "C").toLowerCase();
|
|
1353
|
+
if (locale === "c" || locale === "posix")
|
|
1354
|
+
return false;
|
|
1355
|
+
if (locale === "c.utf-8" || locale === "c.utf8" || locale === "en_us.utf-8" || locale === "en_us.utf8")
|
|
1356
|
+
return true;
|
|
1357
|
+
throw new FmtError("PROFILE", "Unavailable fmt byte/locale profile");
|
|
1358
|
+
}
|
|
1359
|
+
function quote(bytes, shell, unicode = false) {
|
|
1360
|
+
const decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
1361
|
+
const units = [];
|
|
1362
|
+
for (let offset = 0; offset < bytes.length; ) {
|
|
1363
|
+
const first = bytes[offset];
|
|
1364
|
+
let length2 = 1;
|
|
1365
|
+
let text = String.fromCharCode(first);
|
|
1366
|
+
let valid = first < 128;
|
|
1367
|
+
if (unicode && first >= 194 && first <= 244) {
|
|
1368
|
+
const size = first < 224 ? 2 : first < 240 ? 3 : 4;
|
|
1369
|
+
try {
|
|
1370
|
+
text = decoder.decode(bytes.subarray(offset, offset + size));
|
|
1371
|
+
length2 = size;
|
|
1372
|
+
valid = true;
|
|
1373
|
+
} catch {
|
|
1374
|
+
valid = false;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
units.push({ text, bytes: bytes.subarray(offset, offset + length2), valid });
|
|
1378
|
+
offset += length2;
|
|
1379
|
+
}
|
|
1380
|
+
const escapes = { "\x07": "\\a", "\b": "\\b", " ": "\\t", "\n": "\\n", "\v": "\\v", "\f": "\\f", "\r": "\\r" };
|
|
1381
|
+
const printable = (unit) => {
|
|
1382
|
+
if (!unit.valid)
|
|
1383
|
+
return false;
|
|
1384
|
+
const point = unit.text.codePointAt(0);
|
|
1385
|
+
if (point < 128)
|
|
1386
|
+
return point >= 32 && point < 127;
|
|
1387
|
+
if (!unicode)
|
|
1388
|
+
return false;
|
|
1389
|
+
let low = 0;
|
|
1390
|
+
let high = glibc231PrintableRanges.length / 2;
|
|
1391
|
+
while (low < high) {
|
|
1392
|
+
const middle = Math.trunc((low + high) / 2);
|
|
1393
|
+
if (point < glibc231PrintableRanges[middle * 2])
|
|
1394
|
+
high = middle;
|
|
1395
|
+
else if (point > glibc231PrintableRanges[middle * 2 + 1])
|
|
1396
|
+
low = middle + 1;
|
|
1397
|
+
else
|
|
1398
|
+
return true;
|
|
1399
|
+
}
|
|
1400
|
+
return false;
|
|
1401
|
+
};
|
|
1402
|
+
if (shell && bytes.includes(39) && units.every((unit, index) => printable(unit) && !'!"$&()*;<=>?[^`|\\{}'.includes(unit.text) && (index === 0 || !"#~".includes(unit.text))))
|
|
1403
|
+
return `"${units.map((unit) => unit.text).join("")}"`;
|
|
1404
|
+
const left = !shell && unicode ? "\u2018" : "'";
|
|
1405
|
+
const right = !shell && unicode ? "\u2019" : "'";
|
|
1406
|
+
let result = left;
|
|
1407
|
+
let escaping = shell && bytes.includes(39) && units.length > 0 && !printable(units[units.length - 1]);
|
|
1408
|
+
for (const unit of units) {
|
|
1409
|
+
if (shell && unit.text === "'") {
|
|
1410
|
+
result += "'\\''";
|
|
1411
|
+
escaping = false;
|
|
1412
|
+
} else if (!printable(unit)) {
|
|
1413
|
+
if (shell && !escaping)
|
|
1414
|
+
result += "'$'";
|
|
1415
|
+
escaping = true;
|
|
1416
|
+
result += escapes[unit.text] ?? Array.from(unit.bytes, (byte) => `\\${byte.toString(8).padStart(3, "0")}`).join("");
|
|
1417
|
+
} else {
|
|
1418
|
+
if (shell && escaping)
|
|
1419
|
+
result += "''";
|
|
1420
|
+
escaping = false;
|
|
1421
|
+
if (!shell && (unit.text === right || unit.text === "\\"))
|
|
1422
|
+
result += "\\";
|
|
1423
|
+
result += unit.text;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
return result + right;
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
// packages/safe-bash-command-fmt/dist/arguments.js
|
|
1430
|
+
function optionError(message) {
|
|
1431
|
+
throw new FmtError("OPTION", message, true);
|
|
1432
|
+
}
|
|
1433
|
+
function widthValue(text, maximum, unicode, profile, goal = false) {
|
|
1434
|
+
let offset = 0;
|
|
1435
|
+
while (text.charCodeAt(offset) === 32 || text.charCodeAt(offset) >= 9 && text.charCodeAt(offset) <= 13)
|
|
1436
|
+
offset++;
|
|
1437
|
+
if (text[offset] === "+")
|
|
1438
|
+
offset++;
|
|
1439
|
+
const start = offset;
|
|
1440
|
+
let number = 0;
|
|
1441
|
+
while (text.charCodeAt(offset) >= 48 && text.charCodeAt(offset) <= 57) {
|
|
1442
|
+
number = Math.min(1073741824, number * 10 + text.charCodeAt(offset++) - 48);
|
|
1443
|
+
}
|
|
1444
|
+
if (offset === start || offset !== text.length || number > maximum) {
|
|
1445
|
+
const range = offset === text.length && offset !== start && number > maximum;
|
|
1446
|
+
const overflow = profile === "gnu-coreutils-8.30-C-bytes" ? number > 1073741823 : goal;
|
|
1447
|
+
throw new FmtError("WIDTH", `invalid width: ${quote(Uint8Array.from(text, (unit) => unit.charCodeAt(0)), false, unicode)}${range ? overflow ? ": Value too large for defined data type" : ": Numerical result out of range" : ""}`);
|
|
1448
|
+
}
|
|
1449
|
+
return number;
|
|
1450
|
+
}
|
|
1451
|
+
function parseFmtArguments(input, configuration = {}) {
|
|
1452
|
+
const limits = configuration.limits ?? defaultFmtLimits;
|
|
1453
|
+
validateFmtLimits(limits);
|
|
1454
|
+
const profile = configuration.profile ?? fmtBaseline.profile;
|
|
1455
|
+
validateFmtProfile(profile);
|
|
1456
|
+
if (input.length > 4096)
|
|
1457
|
+
throw new FmtError("LIMIT", "argument count limit exceeded");
|
|
1458
|
+
let size = 0;
|
|
1459
|
+
const bytes = input.map((value) => {
|
|
1460
|
+
const copy = ownedBytes(value, limits.argumentBytes - size);
|
|
1461
|
+
size += copy.length;
|
|
1462
|
+
return copy;
|
|
1463
|
+
});
|
|
1464
|
+
const names = bytes.map((value) => new TextDecoder("utf-8", { ignoreBOM: true }).decode(value));
|
|
1465
|
+
const args = bytes.map((value) => Array.from(value, (byte) => String.fromCharCode(byte)).join(""));
|
|
1466
|
+
const settings = { profile, width: 75, goal: 70, crown: false, tagged: false, split: false, uniform: false, prefix: new Uint8Array(), leading: 0, fullPrefix: 0, files: [] };
|
|
1467
|
+
let width;
|
|
1468
|
+
let goal;
|
|
1469
|
+
let stopped = false;
|
|
1470
|
+
const long = { "crown-margin": "c", prefix: "p", "split-only": "s", "tagged-paragraph": "t", "uniform-spacing": "u", width: "w", goal: "g", help: "help", version: "version" };
|
|
1471
|
+
let index = 0;
|
|
1472
|
+
const first = args[0];
|
|
1473
|
+
if (first?.startsWith("-") && first.charCodeAt(1) >= 48 && first.charCodeAt(1) <= 57) {
|
|
1474
|
+
width = first.slice(1);
|
|
1475
|
+
index++;
|
|
1476
|
+
}
|
|
1477
|
+
for (; index < args.length; index++) {
|
|
1478
|
+
const argument = args[index];
|
|
1479
|
+
if (stopped || !argument.startsWith("-") || argument === "-") {
|
|
1480
|
+
settings.files.push({ name: names[index], bytes: bytes[index] });
|
|
1481
|
+
if (configuration.posixlyCorrect === true)
|
|
1482
|
+
stopped = true;
|
|
1483
|
+
continue;
|
|
1484
|
+
}
|
|
1485
|
+
if (argument === "--") {
|
|
1486
|
+
stopped = true;
|
|
1487
|
+
continue;
|
|
1488
|
+
}
|
|
1489
|
+
const expanded = [];
|
|
1490
|
+
if (argument.startsWith("--")) {
|
|
1491
|
+
const equals = argument.indexOf("=");
|
|
1492
|
+
const name = argument.slice(2, equals < 0 ? void 0 : equals);
|
|
1493
|
+
const matches = Object.keys(long).filter((key2) => key2.startsWith(name));
|
|
1494
|
+
const selected = Object.hasOwn(long, name) ? name : matches.length === 1 ? matches[0] : void 0;
|
|
1495
|
+
if (!selected) {
|
|
1496
|
+
if (matches.length > 1)
|
|
1497
|
+
optionError(`option '${argument}' is ambiguous; possibilities: ${matches.map((key2) => `'--${key2}'`).join(" ")}`);
|
|
1498
|
+
optionError(`unrecognized option '${argument}'`);
|
|
1499
|
+
}
|
|
1500
|
+
const key = long[selected];
|
|
1501
|
+
let value;
|
|
1502
|
+
let position = index;
|
|
1503
|
+
if ("pwg".includes(key)) {
|
|
1504
|
+
value = equals < 0 ? args[++index] : argument.slice(equals + 1);
|
|
1505
|
+
position = index;
|
|
1506
|
+
if (value === void 0)
|
|
1507
|
+
optionError(`option '--${selected}' requires an argument`);
|
|
1508
|
+
} else if (equals >= 0)
|
|
1509
|
+
optionError(`option '--${selected}' doesn't allow an argument`);
|
|
1510
|
+
expanded.push({ key, ...value === void 0 ? {} : { value }, position, valueOffset: equals < 0 ? 0 : equals + 1 });
|
|
1511
|
+
} else {
|
|
1512
|
+
for (let offset = 1; offset < argument.length; offset++) {
|
|
1513
|
+
const key = argument[offset];
|
|
1514
|
+
if (key >= "0" && key <= "9")
|
|
1515
|
+
optionError(`invalid option -- ${key}; -WIDTH is recognized only when it is the first
|
|
1516
|
+
option; use -w N instead`);
|
|
1517
|
+
if (!"cstuwpg".includes(key))
|
|
1518
|
+
optionError(`invalid option -- '${key}'`);
|
|
1519
|
+
let value;
|
|
1520
|
+
let valueOffset = 0;
|
|
1521
|
+
if ("pwg".includes(key)) {
|
|
1522
|
+
if (offset + 1 < argument.length)
|
|
1523
|
+
valueOffset = offset + 1;
|
|
1524
|
+
value = argument.slice(offset + 1) || args[++index];
|
|
1525
|
+
if (value === void 0)
|
|
1526
|
+
optionError(`option requires an argument -- '${key}'`);
|
|
1527
|
+
offset = argument.length;
|
|
1528
|
+
}
|
|
1529
|
+
expanded.push({ key, ...value === void 0 ? {} : { value }, position: index, valueOffset });
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
for (const option of expanded) {
|
|
1533
|
+
switch (option.key) {
|
|
1534
|
+
case "c":
|
|
1535
|
+
settings.crown = true;
|
|
1536
|
+
break;
|
|
1537
|
+
case "t":
|
|
1538
|
+
settings.tagged = true;
|
|
1539
|
+
break;
|
|
1540
|
+
case "s":
|
|
1541
|
+
settings.split = true;
|
|
1542
|
+
break;
|
|
1543
|
+
case "u":
|
|
1544
|
+
settings.uniform = true;
|
|
1545
|
+
break;
|
|
1546
|
+
case "w":
|
|
1547
|
+
width = option.value;
|
|
1548
|
+
break;
|
|
1549
|
+
case "g":
|
|
1550
|
+
goal = option.value;
|
|
1551
|
+
break;
|
|
1552
|
+
case "help":
|
|
1553
|
+
case "version":
|
|
1554
|
+
settings.information = option.key;
|
|
1555
|
+
return settings;
|
|
1556
|
+
case "p": {
|
|
1557
|
+
const prefixBytes = bytes[option.position].subarray(option.valueOffset);
|
|
1558
|
+
let start = 0;
|
|
1559
|
+
let end = prefixBytes.indexOf(0);
|
|
1560
|
+
if (end < 0)
|
|
1561
|
+
end = prefixBytes.length;
|
|
1562
|
+
while (start < end && prefixBytes[start] === 32)
|
|
1563
|
+
start++;
|
|
1564
|
+
settings.leading = start;
|
|
1565
|
+
settings.fullPrefix = end - start;
|
|
1566
|
+
while (end > start && prefixBytes[end - 1] === 32)
|
|
1567
|
+
end--;
|
|
1568
|
+
settings.prefix = new Uint8Array(prefixBytes.subarray(start, end));
|
|
1569
|
+
break;
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
const unicode = configuration.unicodeQuotes ?? false;
|
|
1575
|
+
if (width !== void 0)
|
|
1576
|
+
settings.width = widthValue(width, 2500, unicode, profile);
|
|
1577
|
+
if (goal !== void 0) {
|
|
1578
|
+
settings.goal = widthValue(goal, settings.width, unicode, profile, true);
|
|
1579
|
+
if (width === void 0)
|
|
1580
|
+
settings.width = settings.goal + 10;
|
|
1581
|
+
} else
|
|
1582
|
+
settings.goal = Math.trunc(settings.width * 187 / 200);
|
|
1583
|
+
if (!settings.files.length)
|
|
1584
|
+
settings.files.push({ name: "-", bytes: Uint8Array.of(45) });
|
|
1585
|
+
return settings;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
// packages/safe-bash-command-fmt/dist/engine.js
|
|
1589
|
+
var WorkBudget = class {
|
|
1590
|
+
limits;
|
|
1591
|
+
signal;
|
|
1592
|
+
operations = 0;
|
|
1593
|
+
output = 0;
|
|
1594
|
+
input = 0;
|
|
1595
|
+
closed = false;
|
|
1596
|
+
sinceCheckpoint = 0;
|
|
1597
|
+
constructor(limits, signal) {
|
|
1598
|
+
this.limits = limits;
|
|
1599
|
+
this.signal = signal;
|
|
1600
|
+
}
|
|
1601
|
+
check() {
|
|
1602
|
+
if (this.closed)
|
|
1603
|
+
throw new FmtError("CLOSED", "fmt engine is closed");
|
|
1604
|
+
if (this.signal.aborted)
|
|
1605
|
+
throw new FmtError("CANCELLED", "fmt engine cancelled");
|
|
1606
|
+
}
|
|
1607
|
+
*step(count = 1) {
|
|
1608
|
+
this.charge(count);
|
|
1609
|
+
if (this.sinceCheckpoint >= 1024) {
|
|
1610
|
+
this.sinceCheckpoint = 0;
|
|
1611
|
+
if ((yield void 0) !== void 0)
|
|
1612
|
+
throw new FmtError("INPUT", "Unexpected input on fmt checkpoint event");
|
|
1613
|
+
}
|
|
1614
|
+
this.check();
|
|
1615
|
+
}
|
|
1616
|
+
charge(count) {
|
|
1617
|
+
this.check();
|
|
1618
|
+
if (count > this.limits.work - this.operations)
|
|
1619
|
+
throw new FmtError("LIMIT", "work limit exceeded");
|
|
1620
|
+
this.operations += count;
|
|
1621
|
+
this.sinceCheckpoint += count;
|
|
1622
|
+
}
|
|
1623
|
+
admitInput(size) {
|
|
1624
|
+
this.check();
|
|
1625
|
+
if (size > 4096 || size > this.limits.inputBytes - this.input)
|
|
1626
|
+
throw new FmtError("LIMIT", "input byte or bounded-call limit exceeded");
|
|
1627
|
+
this.input += size;
|
|
1628
|
+
}
|
|
1629
|
+
admitOutput() {
|
|
1630
|
+
if (this.output === this.limits.outputBytes)
|
|
1631
|
+
throw new FmtError("LIMIT", "output limit exceeded");
|
|
1632
|
+
this.output++;
|
|
1633
|
+
}
|
|
1634
|
+
exact(value) {
|
|
1635
|
+
if (!Number.isSafeInteger(value))
|
|
1636
|
+
throw new FmtError("ARITHMETIC", "fmt exact arithmetic limit exceeded");
|
|
1637
|
+
return value;
|
|
1638
|
+
}
|
|
1639
|
+
};
|
|
1640
|
+
var Formatter = class {
|
|
1641
|
+
settings;
|
|
1642
|
+
budget;
|
|
1643
|
+
chunk = new Uint8Array(4096);
|
|
1644
|
+
chunkUsed = 0;
|
|
1645
|
+
offset = 0;
|
|
1646
|
+
eof = false;
|
|
1647
|
+
pending = new Uint8Array(1024);
|
|
1648
|
+
pendingUsed = 0;
|
|
1649
|
+
text = new Uint8Array(5e3);
|
|
1650
|
+
used = 0;
|
|
1651
|
+
words = [];
|
|
1652
|
+
costs = [];
|
|
1653
|
+
breaks = [];
|
|
1654
|
+
lengths = [];
|
|
1655
|
+
column = 0;
|
|
1656
|
+
nextPrefix = 0;
|
|
1657
|
+
prefixIndent = 0;
|
|
1658
|
+
firstIndent = 0;
|
|
1659
|
+
otherIndent = 0;
|
|
1660
|
+
lastLength = 0;
|
|
1661
|
+
outColumn = 0;
|
|
1662
|
+
tabs = false;
|
|
1663
|
+
constructor(settings, budget) {
|
|
1664
|
+
this.settings = settings;
|
|
1665
|
+
this.budget = budget;
|
|
1666
|
+
}
|
|
1667
|
+
*read() {
|
|
1668
|
+
yield* this.budget.step();
|
|
1669
|
+
while (this.offset === this.chunkUsed) {
|
|
1670
|
+
if (this.eof)
|
|
1671
|
+
return -1;
|
|
1672
|
+
const incoming = yield "input";
|
|
1673
|
+
this.budget.check();
|
|
1674
|
+
if (incoming === null) {
|
|
1675
|
+
this.eof = true;
|
|
1676
|
+
return -1;
|
|
1677
|
+
}
|
|
1678
|
+
if (incoming === void 0)
|
|
1679
|
+
throw new FmtError("INPUT", "Expected input bytes or null EOF");
|
|
1680
|
+
const view = byteView(incoming);
|
|
1681
|
+
this.budget.charge(view.length + 1);
|
|
1682
|
+
this.budget.admitInput(view.length);
|
|
1683
|
+
let position = 0;
|
|
1684
|
+
for (const byte of view.values)
|
|
1685
|
+
this.chunk[position++] = byte;
|
|
1686
|
+
this.chunkUsed = view.length;
|
|
1687
|
+
this.offset = 0;
|
|
1688
|
+
yield* this.budget.step(0);
|
|
1689
|
+
}
|
|
1690
|
+
return this.chunk[this.offset++];
|
|
1691
|
+
}
|
|
1692
|
+
*emit(byte) {
|
|
1693
|
+
yield* this.budget.step();
|
|
1694
|
+
this.budget.admitOutput();
|
|
1695
|
+
this.pending[this.pendingUsed++] = byte;
|
|
1696
|
+
if (this.pendingUsed === this.pending.length) {
|
|
1697
|
+
if ((yield this.pending.slice()) !== void 0)
|
|
1698
|
+
throw new FmtError("INPUT", "Unexpected input on fmt output event");
|
|
1699
|
+
this.pendingUsed = 0;
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
*spaces(count) {
|
|
1703
|
+
const target = this.budget.exact(this.outColumn + count);
|
|
1704
|
+
const tabEnd = Math.trunc(target / 8) * 8;
|
|
1705
|
+
if (this.tabs && this.outColumn + 1 < tabEnd) {
|
|
1706
|
+
while (this.outColumn < tabEnd) {
|
|
1707
|
+
yield* this.emit(9);
|
|
1708
|
+
this.outColumn = (Math.trunc(this.outColumn / 8) + 1) * 8;
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
while (this.outColumn < target) {
|
|
1712
|
+
yield* this.emit(32);
|
|
1713
|
+
this.outColumn++;
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
*whitespace(byte) {
|
|
1717
|
+
while (byte === 32 || byte === 9) {
|
|
1718
|
+
if (byte === 32)
|
|
1719
|
+
this.column = this.budget.exact(this.column + 1);
|
|
1720
|
+
else {
|
|
1721
|
+
this.tabs = true;
|
|
1722
|
+
this.column = this.budget.exact((Math.trunc(this.column / 8) + 1) * 8);
|
|
1723
|
+
}
|
|
1724
|
+
byte = yield* this.read();
|
|
1725
|
+
}
|
|
1726
|
+
return byte;
|
|
1727
|
+
}
|
|
1728
|
+
*lineStart() {
|
|
1729
|
+
this.column = 0;
|
|
1730
|
+
let byte = yield* this.whitespace(yield* this.read());
|
|
1731
|
+
const { prefix, leading } = this.settings;
|
|
1732
|
+
this.nextPrefix = prefix.length ? this.column : Math.min(leading, this.column);
|
|
1733
|
+
if (prefix.length) {
|
|
1734
|
+
for (const expected of prefix) {
|
|
1735
|
+
if (byte !== expected)
|
|
1736
|
+
return byte;
|
|
1737
|
+
this.column++;
|
|
1738
|
+
byte = yield* this.read();
|
|
1739
|
+
}
|
|
1740
|
+
byte = yield* this.whitespace(byte);
|
|
1741
|
+
}
|
|
1742
|
+
return byte;
|
|
1743
|
+
}
|
|
1744
|
+
compatible(byte) {
|
|
1745
|
+
return byte !== -1 && byte !== 10 && this.nextPrefix === this.prefixIndent && this.column >= this.nextPrefix + this.settings.fullPrefix;
|
|
1746
|
+
}
|
|
1747
|
+
secondary(compatible) {
|
|
1748
|
+
if (this.settings.split)
|
|
1749
|
+
this.otherIndent = this.firstIndent;
|
|
1750
|
+
else if (this.settings.crown)
|
|
1751
|
+
this.otherIndent = compatible ? this.column : this.firstIndent;
|
|
1752
|
+
else if (this.settings.tagged) {
|
|
1753
|
+
if (compatible && this.column !== this.firstIndent)
|
|
1754
|
+
this.otherIndent = this.column;
|
|
1755
|
+
else if (this.otherIndent === this.firstIndent)
|
|
1756
|
+
this.otherIndent = this.firstIndent === 0 ? 3 : 0;
|
|
1757
|
+
} else
|
|
1758
|
+
this.otherIndent = this.firstIndent;
|
|
1759
|
+
}
|
|
1760
|
+
*optimize() {
|
|
1761
|
+
const count = this.words.length;
|
|
1762
|
+
this.costs[count] = 0;
|
|
1763
|
+
for (let start = count - 1; start >= 0; start--) {
|
|
1764
|
+
const word = this.words[start];
|
|
1765
|
+
let penalty = 4900;
|
|
1766
|
+
const previous = this.words[start - 1];
|
|
1767
|
+
if (previous?.period)
|
|
1768
|
+
penalty += previous.final ? -2500 : 36e4;
|
|
1769
|
+
else if (previous?.punctuation)
|
|
1770
|
+
penalty -= 1600;
|
|
1771
|
+
else if (previous && this.words[start - 2]?.final)
|
|
1772
|
+
penalty += Math.trunc(4e4 / (previous.length + 2));
|
|
1773
|
+
if (word.opening)
|
|
1774
|
+
penalty -= 1600;
|
|
1775
|
+
else if (word.final)
|
|
1776
|
+
penalty += Math.trunc(22500 / (word.length + 2));
|
|
1777
|
+
let length2 = (start === 0 ? this.firstIndent : this.otherIndent) + word.length;
|
|
1778
|
+
let best = Infinity;
|
|
1779
|
+
for (let end = start + 1; ; end++) {
|
|
1780
|
+
yield* this.budget.step();
|
|
1781
|
+
let cost = this.costs[end];
|
|
1782
|
+
if (end !== count) {
|
|
1783
|
+
cost += 100 * (this.settings.goal - length2) ** 2;
|
|
1784
|
+
if (this.breaks[end] !== count)
|
|
1785
|
+
cost += 50 * (length2 - this.lengths[end]) ** 2;
|
|
1786
|
+
}
|
|
1787
|
+
if (start === 0 && this.lastLength > 0)
|
|
1788
|
+
cost += 50 * (length2 - this.lastLength) ** 2;
|
|
1789
|
+
this.budget.exact(cost);
|
|
1790
|
+
if (cost < best) {
|
|
1791
|
+
best = cost;
|
|
1792
|
+
this.breaks[start] = end;
|
|
1793
|
+
this.lengths[start] = length2;
|
|
1794
|
+
}
|
|
1795
|
+
if (end === count)
|
|
1796
|
+
break;
|
|
1797
|
+
length2 += this.words[end - 1].space + this.words[end].length;
|
|
1798
|
+
if (this.settings.profile === "gnu-coreutils-8.30-C-bytes" ? length2 >= this.settings.width : length2 > this.settings.width)
|
|
1799
|
+
break;
|
|
1800
|
+
}
|
|
1801
|
+
this.costs[start] = this.budget.exact(best + penalty);
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
*render(finish) {
|
|
1805
|
+
for (let start = 0; start < finish; start = this.breaks[start]) {
|
|
1806
|
+
this.outColumn = 0;
|
|
1807
|
+
yield* this.spaces(this.prefixIndent);
|
|
1808
|
+
for (const byte of this.settings.prefix)
|
|
1809
|
+
yield* this.emit(byte);
|
|
1810
|
+
this.outColumn += this.settings.prefix.length;
|
|
1811
|
+
yield* this.spaces((start === 0 ? this.firstIndent : this.otherIndent) - this.outColumn);
|
|
1812
|
+
const end = this.breaks[start];
|
|
1813
|
+
for (let index = start; index < end; index++) {
|
|
1814
|
+
const word = this.words[index];
|
|
1815
|
+
for (let position = word.start; position < word.start + word.length; position++)
|
|
1816
|
+
yield* this.emit(this.text[position]);
|
|
1817
|
+
this.outColumn += word.length;
|
|
1818
|
+
if (index + 1 !== end)
|
|
1819
|
+
yield* this.spaces(word.space);
|
|
1820
|
+
}
|
|
1821
|
+
this.lastLength = this.outColumn;
|
|
1822
|
+
yield* this.emit(10);
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
*makeRoom(current) {
|
|
1826
|
+
this.secondary(true);
|
|
1827
|
+
if (!this.words.length) {
|
|
1828
|
+
for (let position = 0; position < this.used; position++)
|
|
1829
|
+
yield* this.emit(this.text[position]);
|
|
1830
|
+
this.used = 0;
|
|
1831
|
+
current.start = 0;
|
|
1832
|
+
return;
|
|
1833
|
+
}
|
|
1834
|
+
yield* this.optimize();
|
|
1835
|
+
let cut = this.words.length;
|
|
1836
|
+
let score = Infinity;
|
|
1837
|
+
for (let line = this.breaks[0]; line !== this.words.length; line = this.breaks[line]) {
|
|
1838
|
+
yield* this.budget.step();
|
|
1839
|
+
const candidate = this.costs[line] - this.costs[this.breaks[line]];
|
|
1840
|
+
if (candidate < score) {
|
|
1841
|
+
cut = line;
|
|
1842
|
+
score = candidate;
|
|
1843
|
+
}
|
|
1844
|
+
score += 9;
|
|
1845
|
+
}
|
|
1846
|
+
yield* this.render(cut);
|
|
1847
|
+
const offset = cut === this.words.length ? current.start : this.words[cut].start;
|
|
1848
|
+
yield* this.budget.step(this.used - offset + this.words.length);
|
|
1849
|
+
this.text.copyWithin(0, offset, this.used);
|
|
1850
|
+
this.used -= offset;
|
|
1851
|
+
this.words = this.words.slice(cut);
|
|
1852
|
+
for (const word of this.words)
|
|
1853
|
+
word.start -= offset;
|
|
1854
|
+
current.start -= offset;
|
|
1855
|
+
}
|
|
1856
|
+
*readLine(byte) {
|
|
1857
|
+
do {
|
|
1858
|
+
const word = { start: this.used, length: 0, space: 0, opening: false, period: false, punctuation: false, final: false };
|
|
1859
|
+
do {
|
|
1860
|
+
if (this.used === this.text.length)
|
|
1861
|
+
yield* this.makeRoom(word);
|
|
1862
|
+
this.text[this.used++] = byte;
|
|
1863
|
+
byte = yield* this.read();
|
|
1864
|
+
} while (byte !== -1 && byte !== 32 && !(byte >= 9 && byte <= 13));
|
|
1865
|
+
word.length = this.used - word.start;
|
|
1866
|
+
this.column = this.budget.exact(this.column + word.length);
|
|
1867
|
+
const first = this.text[word.start];
|
|
1868
|
+
const last = this.text[this.used - 1];
|
|
1869
|
+
word.opening = first === 0 || "(['`\"".includes(String.fromCharCode(first));
|
|
1870
|
+
word.punctuation = last >= 33 && last <= 47 || last >= 58 && last <= 64 || last >= 91 && last <= 96 || last >= 123 && last <= 126;
|
|
1871
|
+
let terminal = this.used - 1;
|
|
1872
|
+
yield* this.budget.step(word.length);
|
|
1873
|
+
while (terminal > word.start && (this.text[terminal] === 0 || `)]'"`.includes(String.fromCharCode(this.text[terminal]))))
|
|
1874
|
+
terminal--;
|
|
1875
|
+
word.period = this.text[terminal] === 0 || ".?!".includes(String.fromCharCode(this.text[terminal]));
|
|
1876
|
+
const before = this.column;
|
|
1877
|
+
byte = yield* this.whitespace(byte);
|
|
1878
|
+
word.space = this.column - before;
|
|
1879
|
+
word.final = byte === -1 || word.period && (byte === 10 || word.space > 1);
|
|
1880
|
+
if (byte === 10 || byte === -1 || this.settings.uniform)
|
|
1881
|
+
word.space = word.final ? 2 : 1;
|
|
1882
|
+
if (this.words.length === 998)
|
|
1883
|
+
yield* this.makeRoom(word);
|
|
1884
|
+
this.words.push(word);
|
|
1885
|
+
} while (byte !== -1 && byte !== 10);
|
|
1886
|
+
return yield* this.lineStart();
|
|
1887
|
+
}
|
|
1888
|
+
dispose() {
|
|
1889
|
+
this.chunk = new Uint8Array();
|
|
1890
|
+
this.pending = new Uint8Array();
|
|
1891
|
+
this.text = new Uint8Array();
|
|
1892
|
+
this.chunkUsed = this.pendingUsed = this.used = 0;
|
|
1893
|
+
this.words = [];
|
|
1894
|
+
this.costs = [];
|
|
1895
|
+
this.breaks = [];
|
|
1896
|
+
this.lengths = [];
|
|
1897
|
+
this.settings = { ...this.settings, prefix: new Uint8Array(), files: [] };
|
|
1898
|
+
}
|
|
1899
|
+
*run() {
|
|
1900
|
+
let byte = yield* this.lineStart();
|
|
1901
|
+
while (true) {
|
|
1902
|
+
if (byte === 10 || byte === -1 || this.nextPrefix < this.settings.leading || this.column < this.nextPrefix + this.settings.fullPrefix) {
|
|
1903
|
+
this.outColumn = 0;
|
|
1904
|
+
if (this.column > this.nextPrefix || byte !== 10 && byte !== -1) {
|
|
1905
|
+
yield* this.spaces(this.nextPrefix);
|
|
1906
|
+
for (const prefixByte of this.settings.prefix) {
|
|
1907
|
+
if (this.outColumn === this.column)
|
|
1908
|
+
break;
|
|
1909
|
+
yield* this.emit(prefixByte);
|
|
1910
|
+
this.outColumn++;
|
|
1911
|
+
}
|
|
1912
|
+
if (byte !== -1 && byte !== 10)
|
|
1913
|
+
yield* this.spaces(this.column - this.outColumn);
|
|
1914
|
+
if (byte === -1 && this.column >= this.nextPrefix + this.settings.prefix.length)
|
|
1915
|
+
yield* this.emit(10);
|
|
1916
|
+
}
|
|
1917
|
+
while (byte !== -1 && byte !== 10) {
|
|
1918
|
+
yield* this.emit(byte);
|
|
1919
|
+
byte = yield* this.read();
|
|
1920
|
+
}
|
|
1921
|
+
if (byte === -1)
|
|
1922
|
+
break;
|
|
1923
|
+
yield* this.emit(10);
|
|
1924
|
+
byte = yield* this.lineStart();
|
|
1925
|
+
continue;
|
|
1926
|
+
}
|
|
1927
|
+
this.lastLength = 0;
|
|
1928
|
+
this.prefixIndent = this.nextPrefix;
|
|
1929
|
+
this.firstIndent = this.column;
|
|
1930
|
+
this.words = [];
|
|
1931
|
+
this.used = 0;
|
|
1932
|
+
byte = yield* this.readLine(byte);
|
|
1933
|
+
this.secondary(this.compatible(byte));
|
|
1934
|
+
if (!this.settings.split) {
|
|
1935
|
+
const acceptSecond = this.compatible(byte) && (this.settings.crown || this.settings.tagged ? this.settings.crown || this.column !== this.firstIndent : this.column === this.otherIndent);
|
|
1936
|
+
if (acceptSecond) {
|
|
1937
|
+
do {
|
|
1938
|
+
byte = yield* this.readLine(byte);
|
|
1939
|
+
} while (this.compatible(byte) && this.column === this.otherIndent);
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
const last = this.words[this.words.length - 1];
|
|
1943
|
+
last.period = true;
|
|
1944
|
+
last.final = true;
|
|
1945
|
+
yield* this.optimize();
|
|
1946
|
+
yield* this.render(this.words.length);
|
|
1947
|
+
}
|
|
1948
|
+
if (this.pendingUsed) {
|
|
1949
|
+
if ((yield this.pending.slice(0, this.pendingUsed)) !== void 0)
|
|
1950
|
+
throw new FmtError("INPUT", "Unexpected input on fmt output event");
|
|
1951
|
+
this.pendingUsed = 0;
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
};
|
|
1955
|
+
function createFmtEngine(options, limits, signal) {
|
|
1956
|
+
if (signal.aborted)
|
|
1957
|
+
throw new FmtError("CANCELLED", "fmt engine cancelled");
|
|
1958
|
+
validateFmtLimits(limits);
|
|
1959
|
+
validateFmtProfile(options.profile);
|
|
1960
|
+
for (const [value, maximum] of [[options.width, 2500], [options.goal, options.width], [options.leading, limits.argumentBytes], [options.fullPrefix, limits.argumentBytes]]) {
|
|
1961
|
+
if (!Number.isSafeInteger(value) || value < 0 || value > maximum)
|
|
1962
|
+
throw new FmtError("WIDTH", "Invalid fmt width, goal or prefix indentation");
|
|
1963
|
+
}
|
|
1964
|
+
const prefixSize = byteView(options.prefix).length;
|
|
1965
|
+
const retained = 5e3 + 4096 + 1024 + prefixSize;
|
|
1966
|
+
if (retained > limits.retainedBytes)
|
|
1967
|
+
throw new FmtError("LIMIT", "fmt buffer retention limit exceeded");
|
|
1968
|
+
let prefix = ownedBytes(options.prefix, limits.argumentBytes);
|
|
1969
|
+
const budget = new WorkBudget(Object.freeze({ ...limits }), signal);
|
|
1970
|
+
const formatter = new Formatter({ ...options, prefix, files: [] }, budget);
|
|
1971
|
+
let started = false;
|
|
1972
|
+
const dispose = () => {
|
|
1973
|
+
budget.closed = true;
|
|
1974
|
+
formatter.dispose();
|
|
1975
|
+
prefix.fill(0);
|
|
1976
|
+
prefix = new Uint8Array();
|
|
1977
|
+
};
|
|
1978
|
+
return {
|
|
1979
|
+
*run() {
|
|
1980
|
+
if (started)
|
|
1981
|
+
throw new FmtError("CLOSED", "fmt engine has already started");
|
|
1982
|
+
started = true;
|
|
1983
|
+
try {
|
|
1984
|
+
budget.check();
|
|
1985
|
+
yield* formatter.run();
|
|
1986
|
+
budget.check();
|
|
1987
|
+
} finally {
|
|
1988
|
+
dispose();
|
|
1989
|
+
}
|
|
1990
|
+
},
|
|
1991
|
+
dispose,
|
|
1992
|
+
accounting: () => Object.freeze({ inputBytes: budget.input, decodedBytes: 0, outputBytes: budget.output, work: budget.operations, retainedBytes: budget.closed ? 0 : retained, peakRetainedBytes: retained })
|
|
1993
|
+
};
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
// packages/safe-bash-command-fmt/dist/command.js
|
|
1997
|
+
import { commandRuntimeIdentity, CommandArgumentIdentityError, FsError, getCommandArguments, isFsError, readBytes, writeBytes, shellValueByteLength as shellValueByteLength2 } from "../safe-bash-contracts/index.js";
|
|
1998
|
+
import { isAbsolutePath, validatePath } from "@poe-platform/safe-fs/core";
|
|
1999
|
+
import { assertCommandRequirements } from "../safe-bash-contracts/command-requirements.js";
|
|
2000
|
+
import { createOutputOperation } from "../safe-bash-contracts/output.js";
|
|
2001
|
+
|
|
2002
|
+
// packages/safe-bash-command-fmt/dist/sdk.js
|
|
2003
|
+
import { shellValueByteLength } from "../safe-bash-contracts/value.js";
|
|
2004
|
+
var formattingKeys = ["width", "goal", "crown", "tagged", "split", "uniform", "prefix", "files"];
|
|
2005
|
+
function captureFmtArguments(options, limits) {
|
|
2006
|
+
const typed = formattingKeys.some((key) => options[key] !== void 0);
|
|
2007
|
+
if (options.arguments !== void 0 && typed)
|
|
2008
|
+
throw new FmtError("OPTION", "SDK arguments cannot be combined with formatting options");
|
|
2009
|
+
if (options.arguments === void 0 && !typed)
|
|
2010
|
+
return void 0;
|
|
2011
|
+
const args = [];
|
|
2012
|
+
let extent = 0;
|
|
2013
|
+
const append = (value) => {
|
|
2014
|
+
if (args.length >= 4096)
|
|
2015
|
+
throw new FmtError("LIMIT", "argument count limit exceeded");
|
|
2016
|
+
let bytes;
|
|
2017
|
+
if (typeof value === "string") {
|
|
2018
|
+
if (value.length > limits.argumentBytes - extent || shellValueByteLength(value) > limits.argumentBytes - extent)
|
|
2019
|
+
throw new FmtError("LIMIT", "Argument byte limit exceeded");
|
|
2020
|
+
bytes = new TextEncoder().encode(value);
|
|
2021
|
+
} else
|
|
2022
|
+
bytes = ownedBytes(value, limits.argumentBytes - extent);
|
|
2023
|
+
extent += bytes.length;
|
|
2024
|
+
args.push(bytes);
|
|
2025
|
+
};
|
|
2026
|
+
if (options.arguments !== void 0) {
|
|
2027
|
+
if (options.arguments.length > 4096)
|
|
2028
|
+
throw new FmtError("LIMIT", "argument count limit exceeded");
|
|
2029
|
+
for (const argument of options.arguments)
|
|
2030
|
+
append(argument);
|
|
2031
|
+
} else {
|
|
2032
|
+
for (const key of ["width", "goal"]) {
|
|
2033
|
+
const value = options[key];
|
|
2034
|
+
if (value !== void 0) {
|
|
2035
|
+
if (!Number.isSafeInteger(value) || value < 0)
|
|
2036
|
+
throw new FmtError("WIDTH", "SDK widths must be nonnegative safe integers");
|
|
2037
|
+
append(key === "width" ? "-w" : "-g");
|
|
2038
|
+
append(String(value));
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
for (const [key, flag] of [["crown", "-c"], ["tagged", "-t"], ["split", "-s"], ["uniform", "-u"]]) {
|
|
2042
|
+
const value = options[key];
|
|
2043
|
+
if (value !== void 0 && typeof value !== "boolean")
|
|
2044
|
+
throw new FmtError("OPTION", `SDK ${key} must be boolean`);
|
|
2045
|
+
if (value)
|
|
2046
|
+
append(flag);
|
|
2047
|
+
}
|
|
2048
|
+
if (options.prefix !== void 0) {
|
|
2049
|
+
append("-p");
|
|
2050
|
+
append(options.prefix);
|
|
2051
|
+
}
|
|
2052
|
+
append("--");
|
|
2053
|
+
if (options.files !== void 0) {
|
|
2054
|
+
if (options.files.length > 4096)
|
|
2055
|
+
throw new FmtError("LIMIT", "argument count limit exceeded");
|
|
2056
|
+
for (const file of options.files) {
|
|
2057
|
+
if (typeof file !== "string")
|
|
2058
|
+
throw new FmtError("OPTION", "SDK files must be literal VFS paths");
|
|
2059
|
+
append(file);
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
return args;
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
// packages/safe-bash-command-fmt/dist/command.js
|
|
2067
|
+
var inputRequirements = [
|
|
2068
|
+
{ id: "stdin", description: "Read standard input", capabilities: [] },
|
|
2069
|
+
{ id: "file", description: "Read file operands", capabilities: [], anyOf: [["streamingRead"], ["read"]] }
|
|
2070
|
+
];
|
|
2071
|
+
async function yieldTurn(signal) {
|
|
2072
|
+
signal.throwIfAborted();
|
|
2073
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
2074
|
+
signal.throwIfAborted();
|
|
2075
|
+
}
|
|
2076
|
+
async function output(context, bytes) {
|
|
2077
|
+
await writeBytes(context.stdout, typeof bytes === "string" ? new TextEncoder().encode(bytes) : bytes, context.signal);
|
|
2078
|
+
}
|
|
2079
|
+
async function diagnostic(context, error) {
|
|
2080
|
+
let message = "internal error";
|
|
2081
|
+
if (error instanceof FmtError || error instanceof FsError || error instanceof CommandArgumentIdentityError)
|
|
2082
|
+
message = error.message;
|
|
2083
|
+
else {
|
|
2084
|
+
try {
|
|
2085
|
+
const pending = context.onInternalError?.(error);
|
|
2086
|
+
if (pending !== void 0)
|
|
2087
|
+
void Promise.resolve(pending).catch(() => void 0);
|
|
2088
|
+
} catch {
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
let escaped = "";
|
|
2092
|
+
for (const character of message) {
|
|
2093
|
+
const point = character.codePointAt(0);
|
|
2094
|
+
if (point === 9 || point === 10 || point >= 32 && (point < 127 || point > 159))
|
|
2095
|
+
escaped += character;
|
|
2096
|
+
else
|
|
2097
|
+
for (const byte of new TextEncoder().encode(character))
|
|
2098
|
+
escaped += `\\${byte.toString(8).padStart(3, "0")}`;
|
|
2099
|
+
}
|
|
2100
|
+
await writeBytes(context.stderr, new TextEncoder().encode(`fmt: ${escaped}
|
|
2101
|
+
`), context.signal);
|
|
2102
|
+
}
|
|
2103
|
+
function pathOf(context, path) {
|
|
2104
|
+
if (!path)
|
|
2105
|
+
throw new FsError("ENOENT", { path });
|
|
2106
|
+
validatePath(path);
|
|
2107
|
+
validatePath(context.cwd);
|
|
2108
|
+
if (!isAbsolutePath(context.cwd))
|
|
2109
|
+
throw new FsError("EINVAL", { path: context.cwd, message: "cwd must be absolute" });
|
|
2110
|
+
return isAbsolutePath(path) ? path : `${context.cwd.endsWith("/") ? context.cwd.slice(0, -1) : context.cwd}/${path}`;
|
|
2111
|
+
}
|
|
2112
|
+
var InputBudget = class {
|
|
2113
|
+
maximum;
|
|
2114
|
+
sourceBufferBytes;
|
|
2115
|
+
used = 0;
|
|
2116
|
+
constructor(maximum, sourceBufferBytes) {
|
|
2117
|
+
this.maximum = maximum;
|
|
2118
|
+
this.sourceBufferBytes = sourceBufferBytes;
|
|
2119
|
+
}
|
|
2120
|
+
get maxReadBytes() {
|
|
2121
|
+
return Math.max(0, Math.min(this.sourceBufferBytes, this.maximum - this.used));
|
|
2122
|
+
}
|
|
2123
|
+
async *read(source, signal) {
|
|
2124
|
+
for await (const chunk of readBytes(source, signal)) {
|
|
2125
|
+
signal.throwIfAborted();
|
|
2126
|
+
const size = byteView(chunk).length;
|
|
2127
|
+
if (size > this.maximum - this.used)
|
|
2128
|
+
throw new FsError("EFBIG", { message: "byte command input limit exceeded" });
|
|
2129
|
+
if (size > this.maxReadBytes)
|
|
2130
|
+
throw new FmtError("LIMIT", "source chunk retention limit exceeded");
|
|
2131
|
+
this.used += size;
|
|
2132
|
+
if (!size)
|
|
2133
|
+
yield byteSpan(chunk, 0, 0);
|
|
2134
|
+
for (let offset = 0; offset < size; offset += 4096)
|
|
2135
|
+
yield byteSpan(chunk, offset, Math.min(4096, size - offset));
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
};
|
|
2139
|
+
var InputScope = class {
|
|
2140
|
+
context;
|
|
2141
|
+
budget;
|
|
2142
|
+
iterator;
|
|
2143
|
+
reader;
|
|
2144
|
+
finished = false;
|
|
2145
|
+
retirement;
|
|
2146
|
+
closing;
|
|
2147
|
+
acquisition;
|
|
2148
|
+
constructor(context, budget) {
|
|
2149
|
+
this.context = context;
|
|
2150
|
+
this.budget = budget;
|
|
2151
|
+
}
|
|
2152
|
+
open(name, bytes) {
|
|
2153
|
+
if (this.closing)
|
|
2154
|
+
throw new FmtError("CLOSED", "fmt input is closed");
|
|
2155
|
+
const { context } = this;
|
|
2156
|
+
context.signal.throwIfAborted();
|
|
2157
|
+
this.acquisition = Promise.resolve().then(async () => {
|
|
2158
|
+
context.signal.throwIfAborted();
|
|
2159
|
+
let file;
|
|
2160
|
+
if (name !== "-") {
|
|
2161
|
+
const encoded = new TextEncoder().encode(name);
|
|
2162
|
+
if (encoded.length !== bytes.length || encoded.some((byte, index) => byte !== bytes[index]))
|
|
2163
|
+
throw new FsError("ENOENT", { path: name });
|
|
2164
|
+
const path = pathOf(context, name);
|
|
2165
|
+
const capabilities = await context.fs.capabilitiesFor?.(path, { signal: context.signal }) ?? context.fs.capabilities;
|
|
2166
|
+
context.signal.throwIfAborted();
|
|
2167
|
+
file = { path, capabilities };
|
|
2168
|
+
}
|
|
2169
|
+
context.signal.throwIfAborted();
|
|
2170
|
+
let source = context.stdin;
|
|
2171
|
+
if (file) {
|
|
2172
|
+
const { path, capabilities } = file;
|
|
2173
|
+
assertCommandRequirements(context, inputRequirements, ["file"], capabilities);
|
|
2174
|
+
if (context.fs.readStream && capabilities.streamingRead !== false)
|
|
2175
|
+
source = context.fs.readStream(path, { signal: context.signal, chunkSize: 4096 });
|
|
2176
|
+
else {
|
|
2177
|
+
if (capabilities.read === false)
|
|
2178
|
+
throw new FsError("ENOTSUP", { path, syscall: "readFile" });
|
|
2179
|
+
const maximum = this.budget.maxReadBytes;
|
|
2180
|
+
source = { async *[Symbol.asyncIterator]() {
|
|
2181
|
+
yield await context.fs.readFile(path, { signal: context.signal, maxBytes: maximum });
|
|
2182
|
+
} };
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
context.signal.throwIfAborted();
|
|
2186
|
+
this.iterator = source[Symbol.asyncIterator]();
|
|
2187
|
+
this.reader = this.budget.read({ [Symbol.asyncIterator]: () => ({
|
|
2188
|
+
next: async () => {
|
|
2189
|
+
const item = await this.iterator.next();
|
|
2190
|
+
if (item.done)
|
|
2191
|
+
this.finished = true;
|
|
2192
|
+
return item;
|
|
2193
|
+
},
|
|
2194
|
+
return: async () => {
|
|
2195
|
+
await this.retire();
|
|
2196
|
+
return { done: true, value: void 0 };
|
|
2197
|
+
}
|
|
2198
|
+
}) }, context.signal)[Symbol.asyncIterator]();
|
|
2199
|
+
});
|
|
2200
|
+
return this.acquisition;
|
|
2201
|
+
}
|
|
2202
|
+
async next() {
|
|
2203
|
+
const item = await this.reader.next();
|
|
2204
|
+
return item.done ? null : item.value;
|
|
2205
|
+
}
|
|
2206
|
+
retire() {
|
|
2207
|
+
this.retirement ??= Promise.resolve().then(async () => {
|
|
2208
|
+
if (!this.finished)
|
|
2209
|
+
await this.iterator?.return?.();
|
|
2210
|
+
});
|
|
2211
|
+
return this.retirement;
|
|
2212
|
+
}
|
|
2213
|
+
close() {
|
|
2214
|
+
this.closing ??= (async () => {
|
|
2215
|
+
const results = await Promise.allSettled([this.retire(), this.reader?.return?.()]);
|
|
2216
|
+
for (const result of results)
|
|
2217
|
+
if (result.status === "rejected")
|
|
2218
|
+
throw result.reason;
|
|
2219
|
+
})();
|
|
2220
|
+
return this.closing;
|
|
2221
|
+
}
|
|
2222
|
+
};
|
|
2223
|
+
function fileError(error, name, bytes, opening, context, releasedRead = false) {
|
|
2224
|
+
if (!(error instanceof FsError))
|
|
2225
|
+
return error;
|
|
2226
|
+
const messages = { ENOENT: "No such file or directory", EACCES: "Permission denied", EISDIR: "Is a directory", ENOTDIR: "Not a directory", ELOOP: "Too many levels of symbolic links", EIO: "Input/output error", EBADF: "Bad file descriptor" };
|
|
2227
|
+
const message = messages[error.code];
|
|
2228
|
+
if (!message)
|
|
2229
|
+
return error;
|
|
2230
|
+
if (releasedRead && !opening)
|
|
2231
|
+
return new FmtError("INPUT", `${name === "-" ? "read error" : `error reading ${quote(bytes, true, unicodeLocale(context))}`}: ${message}`);
|
|
2232
|
+
return new FmtError("INPUT", `${opening ? `cannot open ${quote(bytes, true, unicodeLocale(context))} for reading` : name === "-" ? "standard input" : name}: ${message}`);
|
|
2233
|
+
}
|
|
2234
|
+
function fmtCommand(configuration = {}) {
|
|
2235
|
+
return { name: "fmt", runtimeIdentity: commandRuntimeIdentity, filesystemRequirements: inputRequirements, execute: (context) => fmt(context, configuration) };
|
|
2236
|
+
}
|
|
2237
|
+
function fmtCommands(configuration = {}) {
|
|
2238
|
+
const command = fmtCommand(configuration);
|
|
2239
|
+
const replace = configuration.replace ?? false;
|
|
2240
|
+
return { name: "fmt", setup(host) {
|
|
2241
|
+
host.commands.register(command, { replace });
|
|
2242
|
+
} };
|
|
2243
|
+
}
|
|
2244
|
+
async function fmt(context, configuration = {}) {
|
|
2245
|
+
context.signal.throwIfAborted();
|
|
2246
|
+
const controller = new AbortController();
|
|
2247
|
+
const local = { ...context, signal: AbortSignal.any([context.signal, controller.signal]) };
|
|
2248
|
+
const limits = { ...defaultFmtLimits, ...configuration.limits };
|
|
2249
|
+
let sdkArguments;
|
|
2250
|
+
let argumentFailure;
|
|
2251
|
+
let activeEngine;
|
|
2252
|
+
let stdout;
|
|
2253
|
+
let current;
|
|
2254
|
+
let closing;
|
|
2255
|
+
const close = () => {
|
|
2256
|
+
if (closing)
|
|
2257
|
+
return closing;
|
|
2258
|
+
let resolve, reject;
|
|
2259
|
+
closing = new Promise((complete, fail) => {
|
|
2260
|
+
resolve = complete;
|
|
2261
|
+
reject = fail;
|
|
2262
|
+
});
|
|
2263
|
+
controller.abort(new FsError("EPIPE", { message: "fmt input closed" }));
|
|
2264
|
+
activeEngine?.dispose();
|
|
2265
|
+
void Promise.allSettled([current?.close(), stdout?.close()]).then((results) => {
|
|
2266
|
+
const failures = results.filter((result) => result.status === "rejected").map((result) => result.reason);
|
|
2267
|
+
if (failures.length)
|
|
2268
|
+
reject(failures.length === 1 ? failures[0] : new AggregateError(failures, "fmt cleanup failed"));
|
|
2269
|
+
else
|
|
2270
|
+
resolve();
|
|
2271
|
+
});
|
|
2272
|
+
return closing;
|
|
2273
|
+
};
|
|
2274
|
+
context.registerCleanup?.(close);
|
|
2275
|
+
try {
|
|
2276
|
+
validateFmtLimits(limits);
|
|
2277
|
+
sdkArguments = captureFmtArguments(configuration, limits);
|
|
2278
|
+
} catch (error) {
|
|
2279
|
+
argumentFailure = { error };
|
|
2280
|
+
}
|
|
2281
|
+
let failed = false;
|
|
2282
|
+
const run = async () => {
|
|
2283
|
+
try {
|
|
2284
|
+
if (argumentFailure)
|
|
2285
|
+
throw argumentFailure.error;
|
|
2286
|
+
const argumentsWithBytes = getCommandArguments(context);
|
|
2287
|
+
let extent = 0;
|
|
2288
|
+
if (argumentsWithBytes.values.length > 4096)
|
|
2289
|
+
throw new FmtError("LIMIT", "argument count limit exceeded");
|
|
2290
|
+
const bytes = sdkArguments ?? argumentsWithBytes.values.map((value, index) => {
|
|
2291
|
+
if (typeof value === "string" && value.length > limits.argumentBytes - extent)
|
|
2292
|
+
throw new FmtError("LIMIT", "argument limit exceeded");
|
|
2293
|
+
const size = shellValueByteLength2(value);
|
|
2294
|
+
if (size > limits.argumentBytes - extent)
|
|
2295
|
+
throw new FmtError("LIMIT", "argument limit exceeded");
|
|
2296
|
+
extent += size;
|
|
2297
|
+
return argumentsWithBytes.bytes(index);
|
|
2298
|
+
});
|
|
2299
|
+
const settings = parseFmtArguments(bytes, { limits, ...configuration.profile !== void 0 ? { profile: configuration.profile } : {}, posixlyCorrect: context.env.POSIXLY_CORRECT !== void 0, unicodeQuotes: unicodeLocale(context) });
|
|
2300
|
+
if (settings.information) {
|
|
2301
|
+
await output(context, settings.information === "version" ? "fmt (virtual-bash)\n" : "Usage: fmt [-WIDTH] [OPTION]... [FILE]...\nReformat paragraphs; omitted FILE or '-' reads standard input.\n -c, --crown-margin preserve indentation of first two lines\n -t, --tagged-paragraph use distinct first and following margins\n -p, --prefix=STRING format only lines with this prefix\n -s, --split-only split lines without joining\n -u, --uniform-spacing one space between words, two after sentences\n -w, --width=WIDTH maximum width (default 75)\n -g, --goal=WIDTH preferred width (default 93% of width)\n --help display this help\n --version display virtual command identity\n");
|
|
2302
|
+
return { exitCode: 0 };
|
|
2303
|
+
}
|
|
2304
|
+
const budget = new InputBudget(limits.inputBytes, limits.retainedBytes - 10120 - settings.prefix.length);
|
|
2305
|
+
let work = 0, outputBytes = 0;
|
|
2306
|
+
stdout = createOutputOperation({ signal: local.signal }, context.stdout);
|
|
2307
|
+
const outputContext = { ...context, stdout: stdout.output };
|
|
2308
|
+
let stdinDone = false;
|
|
2309
|
+
let emptyChunks = 0;
|
|
2310
|
+
let chunks = 0;
|
|
2311
|
+
let exitCode = 0;
|
|
2312
|
+
for (const { name, bytes: nameBytes } of settings.files) {
|
|
2313
|
+
local.signal.throwIfAborted();
|
|
2314
|
+
if (name === "-" && stdinDone)
|
|
2315
|
+
continue;
|
|
2316
|
+
current = new InputScope(local, budget);
|
|
2317
|
+
try {
|
|
2318
|
+
await current.open(name, nameBytes);
|
|
2319
|
+
} catch (error) {
|
|
2320
|
+
local.signal.throwIfAborted();
|
|
2321
|
+
await diagnostic(context, fileError(error, name, nameBytes, true, context));
|
|
2322
|
+
await current.close();
|
|
2323
|
+
exitCode = 1;
|
|
2324
|
+
continue;
|
|
2325
|
+
}
|
|
2326
|
+
activeEngine = createFmtEngine(settings, { ...limits, inputBytes: limits.inputBytes, work: limits.work - work, outputBytes: limits.outputBytes - outputBytes }, local.signal);
|
|
2327
|
+
const machine = activeEngine.run();
|
|
2328
|
+
let step = machine.next();
|
|
2329
|
+
let readFailed = false;
|
|
2330
|
+
let readError;
|
|
2331
|
+
let received = false;
|
|
2332
|
+
while (!step.done) {
|
|
2333
|
+
local.signal.throwIfAborted();
|
|
2334
|
+
if (step.value === "input") {
|
|
2335
|
+
let bytes2 = null;
|
|
2336
|
+
if (!readFailed) {
|
|
2337
|
+
try {
|
|
2338
|
+
bytes2 = await current.next();
|
|
2339
|
+
if (bytes2?.length)
|
|
2340
|
+
received = true;
|
|
2341
|
+
} catch (error) {
|
|
2342
|
+
local.signal.throwIfAborted();
|
|
2343
|
+
if (isFsError(error, "EFBIG"))
|
|
2344
|
+
throw new FmtError("LIMIT", "byte command input limit exceeded");
|
|
2345
|
+
readFailed = true;
|
|
2346
|
+
readError = !received && name !== "-" && error instanceof FsError && ["ENOENT", "EACCES", "ENOTDIR", "ELOOP"].includes(error.code) ? fileError(error, name, nameBytes, true, context) : error;
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
if (bytes2?.length === 0 && ++emptyChunks > 4096)
|
|
2350
|
+
throw new FmtError("LIMIT", "empty input chunk limit exceeded");
|
|
2351
|
+
if (++chunks % 64 === 0)
|
|
2352
|
+
await yieldTurn(local.signal);
|
|
2353
|
+
step = machine.next(bytes2);
|
|
2354
|
+
} else {
|
|
2355
|
+
if (step.value)
|
|
2356
|
+
await output(outputContext, step.value);
|
|
2357
|
+
else
|
|
2358
|
+
await yieldTurn(local.signal);
|
|
2359
|
+
step = machine.next();
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
try {
|
|
2363
|
+
await current.close();
|
|
2364
|
+
} catch (error) {
|
|
2365
|
+
if (!readFailed)
|
|
2366
|
+
throw error;
|
|
2367
|
+
}
|
|
2368
|
+
current = void 0;
|
|
2369
|
+
work += activeEngine.accounting().work;
|
|
2370
|
+
outputBytes += activeEngine.accounting().outputBytes;
|
|
2371
|
+
activeEngine.dispose();
|
|
2372
|
+
activeEngine = void 0;
|
|
2373
|
+
if (name === "-")
|
|
2374
|
+
stdinDone = true;
|
|
2375
|
+
if (readFailed && (settings.profile !== "gnu-coreutils-8.30-C-bytes" || !isFsError(readError, "EISDIR") && !isFsError(readError, "EIO") && !isFsError(readError, "EBADF"))) {
|
|
2376
|
+
await diagnostic(context, fileError(readError, name, nameBytes, false, context, settings.profile !== "gnu-coreutils-8.30-C-bytes"));
|
|
2377
|
+
exitCode = 1;
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
return { exitCode };
|
|
2381
|
+
} catch (error) {
|
|
2382
|
+
failed = true;
|
|
2383
|
+
context.signal.throwIfAborted();
|
|
2384
|
+
if (error instanceof FmtError && error.usage)
|
|
2385
|
+
await writeBytes(context.stderr, Uint8Array.from(`fmt: ${error.message}
|
|
2386
|
+
Try 'fmt --help' for more information.
|
|
2387
|
+
`, (character) => character.charCodeAt(0)), context.signal);
|
|
2388
|
+
else
|
|
2389
|
+
await diagnostic(context, error);
|
|
2390
|
+
return { exitCode: 1 };
|
|
2391
|
+
}
|
|
2392
|
+
};
|
|
2393
|
+
let outcome;
|
|
2394
|
+
try {
|
|
2395
|
+
outcome = { result: await run() };
|
|
2396
|
+
} catch (error) {
|
|
2397
|
+
outcome = { error };
|
|
2398
|
+
}
|
|
2399
|
+
try {
|
|
2400
|
+
await close();
|
|
2401
|
+
} catch (error) {
|
|
2402
|
+
if (!failed)
|
|
2403
|
+
throw error;
|
|
2404
|
+
}
|
|
2405
|
+
if ("error" in outcome)
|
|
2406
|
+
throw outcome.error;
|
|
2407
|
+
return outcome.result;
|
|
2408
|
+
}
|
|
2409
|
+
export {
|
|
2410
|
+
FmtError,
|
|
2411
|
+
createFmtEngine,
|
|
2412
|
+
defaultFmtLimits,
|
|
2413
|
+
fmt,
|
|
2414
|
+
fmtBaseline,
|
|
2415
|
+
fmtCommand,
|
|
2416
|
+
fmtCommands,
|
|
2417
|
+
parseFmtArguments
|
|
2418
|
+
};
|
|
2419
|
+
//# sourceMappingURL=index.js.map
|