forge-terminal 0.1.0 → 0.2.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/README.md +333 -24
- package/dist/chunks/adm-zip-SQKLKBDP.js +3 -0
- package/dist/chunks/available-HEUREG6L.js +3 -0
- package/dist/chunks/boot-BUGERSEB.js +3 -0
- package/dist/chunks/catalog-NTACQH5V.js +3 -0
- package/dist/chunks/cfb-V6M2PYOD.js +13 -0
- package/dist/chunks/chunk-2WYHI73Y.js +3 -0
- package/dist/chunks/chunk-4YCO7S4K.js +3 -0
- package/dist/chunks/chunk-5B7WODWH.js +3 -0
- package/dist/chunks/chunk-C2WYXNRM.js +4 -0
- package/dist/chunks/chunk-C7OOWUMU.js +3 -0
- package/dist/chunks/chunk-EOYBXOCV.js +4 -0
- package/dist/chunks/chunk-G2D6BKOS.js +4 -0
- package/dist/chunks/chunk-HUAEVW2A.js +3 -0
- package/dist/chunks/chunk-J7FLFHQJ.js +3 -0
- package/dist/chunks/chunk-L76Q54MB.js +3 -0
- package/dist/chunks/chunk-LFE3WRU4.js +3 -0
- package/dist/chunks/chunk-PBIS2ONZ.js +3 -0
- package/dist/chunks/chunk-PD5DFBCU.js +3 -0
- package/dist/chunks/chunk-PN73WK2S.js +3 -0
- package/dist/chunks/chunk-QVACE4IE.js +3 -0
- package/dist/chunks/chunk-TEGB7JRM.js +3 -0
- package/dist/chunks/chunk-TMUK2DD3.js +3 -0
- package/dist/chunks/chunk-UNVHKJW4.js +41 -0
- package/dist/chunks/chunk-VH5RWPGZ.js +10 -0
- package/dist/chunks/chunk-XFEHJ4C7.js +3 -0
- package/dist/chunks/chunk-YXDEOLNA.js +3 -0
- package/dist/chunks/colour-DE6N6AZO.js +3 -0
- package/dist/chunks/config-command-SQXRTBRO.js +3 -0
- package/dist/chunks/dist-J2V6ITHG.js +29 -0
- package/dist/chunks/es-T2U7NBLD.js +3 -0
- package/dist/chunks/execute-M3C3TTWB.js +3 -0
- package/dist/chunks/extensions-command-HJDBUBYO.js +3 -0
- package/dist/chunks/image-GYUUMS6H.js +3 -0
- package/dist/chunks/launch-WBUFRVQ7.js +65 -0
- package/dist/chunks/lib-TPEJ5CJJ.js +46 -0
- package/dist/chunks/lock-XD4L3WFM.js +3 -0
- package/dist/chunks/manager-KBJTXZ27.js +4 -0
- package/dist/chunks/paths-JUM6GKQU.js +3 -0
- package/dist/chunks/pdf-compress-IMRFBLZF.js +3 -0
- package/dist/chunks/react-devtools-core-UM4FS6CU.js +3 -0
- package/dist/chunks/run-RXVQD4DZ.js +4 -0
- package/dist/chunks/server-DU7QWDAH.js +73 -0
- package/dist/chunks/theme-DESCJOCE.js +3 -0
- package/dist/chunks/word-OGQ2KZAJ.js +24 -0
- package/dist/index.js +67 -95
- package/dist/third-party-licenses.txt +2856 -0
- package/package.json +28 -21
- package/skills/forge/SKILL.md +149 -0
- package/dist/cli/args.js +0 -278
- package/dist/cli/args.js.map +0 -1
- package/dist/cli/config-command.js +0 -55
- package/dist/cli/config-command.js.map +0 -1
- package/dist/cli/execute.js +0 -377
- package/dist/cli/execute.js.map +0 -1
- package/dist/cli/report.js +0 -123
- package/dist/cli/report.js.map +0 -1
- package/dist/cli/spinner.js +0 -60
- package/dist/cli/spinner.js.map +0 -1
- package/dist/cli/stdin.js +0 -47
- package/dist/cli/stdin.js.map +0 -1
- package/dist/config/preferences.js +0 -143
- package/dist/config/preferences.js.map +0 -1
- package/dist/core/actions/compress.js +0 -157
- package/dist/core/actions/compress.js.map +0 -1
- package/dist/core/actions/convert.js +0 -270
- package/dist/core/actions/convert.js.map +0 -1
- package/dist/core/actions/extract.js +0 -94
- package/dist/core/actions/extract.js.map +0 -1
- package/dist/core/actions/index.js +0 -23
- package/dist/core/actions/index.js.map +0 -1
- package/dist/core/actions/merge.js +0 -16
- package/dist/core/actions/merge.js.map +0 -1
- package/dist/core/actions/rotate.js +0 -36
- package/dist/core/actions/rotate.js.map +0 -1
- package/dist/core/actions/split.js +0 -65
- package/dist/core/actions/split.js.map +0 -1
- package/dist/core/atomic.js +0 -61
- package/dist/core/atomic.js.map +0 -1
- package/dist/core/capabilities.js +0 -59
- package/dist/core/capabilities.js.map +0 -1
- package/dist/core/compress.js +0 -76
- package/dist/core/compress.js.map +0 -1
- package/dist/core/describe.js +0 -49
- package/dist/core/describe.js.map +0 -1
- package/dist/core/errors.js +0 -469
- package/dist/core/errors.js.map +0 -1
- package/dist/core/execute-jobs.js +0 -122
- package/dist/core/execute-jobs.js.map +0 -1
- package/dist/core/formats.js +0 -108
- package/dist/core/formats.js.map +0 -1
- package/dist/core/order.js +0 -44
- package/dist/core/order.js.map +0 -1
- package/dist/core/output-path.js +0 -176
- package/dist/core/output-path.js.map +0 -1
- package/dist/core/pages.js +0 -107
- package/dist/core/pages.js.map +0 -1
- package/dist/core/pdf-compress.js +0 -206
- package/dist/core/pdf-compress.js.map +0 -1
- package/dist/core/plan.js +0 -42
- package/dist/core/plan.js.map +0 -1
- package/dist/core/resolve.js +0 -115
- package/dist/core/resolve.js.map +0 -1
- package/dist/core/run.js +0 -66
- package/dist/core/run.js.map +0 -1
- package/dist/core/suggest.js +0 -50
- package/dist/core/suggest.js.map +0 -1
- package/dist/core/types.js +0 -2
- package/dist/core/types.js.map +0 -1
- package/dist/core/units.js +0 -94
- package/dist/core/units.js.map +0 -1
- package/dist/core/write-safety.js +0 -128
- package/dist/core/write-safety.js.map +0 -1
- package/dist/engines/heic.js +0 -166
- package/dist/engines/heic.js.map +0 -1
- package/dist/engines/image.js +0 -342
- package/dist/engines/image.js.map +0 -1
- package/dist/engines/pdf.js +0 -444
- package/dist/engines/pdf.js.map +0 -1
- package/dist/engines/pdfium.js +0 -161
- package/dist/engines/pdfium.js.map +0 -1
- package/dist/engines/registry.js +0 -65
- package/dist/engines/registry.js.map +0 -1
- package/dist/engines/types.js +0 -2
- package/dist/engines/types.js.map +0 -1
- package/dist/engines/word.js +0 -385
- package/dist/engines/word.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/shell/App.js +0 -1972
- package/dist/shell/App.js.map +0 -1
- package/dist/shell/ClickTargets.js +0 -183
- package/dist/shell/ClickTargets.js.map +0 -1
- package/dist/shell/ThemeContext.js +0 -21
- package/dist/shell/ThemeContext.js.map +0 -1
- package/dist/shell/blocks.js +0 -160
- package/dist/shell/blocks.js.map +0 -1
- package/dist/shell/clipboard.js +0 -64
- package/dist/shell/clipboard.js.map +0 -1
- package/dist/shell/commands.js +0 -51
- package/dist/shell/commands.js.map +0 -1
- package/dist/shell/components/Banner.js +0 -73
- package/dist/shell/components/Banner.js.map +0 -1
- package/dist/shell/components/CommandPalette.js +0 -37
- package/dist/shell/components/CommandPalette.js.map +0 -1
- package/dist/shell/components/FileCard.js +0 -59
- package/dist/shell/components/FileCard.js.map +0 -1
- package/dist/shell/components/HintBar.js +0 -18
- package/dist/shell/components/HintBar.js.map +0 -1
- package/dist/shell/components/Hints.js +0 -21
- package/dist/shell/components/Hints.js.map +0 -1
- package/dist/shell/components/MergeList.js +0 -268
- package/dist/shell/components/MergeList.js.map +0 -1
- package/dist/shell/components/ModeHeader.js +0 -21
- package/dist/shell/components/ModeHeader.js.map +0 -1
- package/dist/shell/components/PageGrid.js +0 -324
- package/dist/shell/components/PageGrid.js.map +0 -1
- package/dist/shell/components/PathInput.js +0 -147
- package/dist/shell/components/PathInput.js.map +0 -1
- package/dist/shell/components/Progress.js +0 -43
- package/dist/shell/components/Progress.js.map +0 -1
- package/dist/shell/components/Prompt.js +0 -667
- package/dist/shell/components/Prompt.js.map +0 -1
- package/dist/shell/components/ResultLinks.js +0 -26
- package/dist/shell/components/ResultLinks.js.map +0 -1
- package/dist/shell/components/Select.js +0 -152
- package/dist/shell/components/Select.js.map +0 -1
- package/dist/shell/components/Slider.js +0 -48
- package/dist/shell/components/Slider.js.map +0 -1
- package/dist/shell/components/StagedFiles.js +0 -92
- package/dist/shell/components/StagedFiles.js.map +0 -1
- package/dist/shell/components/ThemePicker.js +0 -18
- package/dist/shell/components/ThemePicker.js.map +0 -1
- package/dist/shell/components/UnitRow.js +0 -30
- package/dist/shell/components/UnitRow.js.map +0 -1
- package/dist/shell/flows/pdf.js +0 -424
- package/dist/shell/flows/pdf.js.map +0 -1
- package/dist/shell/frame-geometry.js +0 -56
- package/dist/shell/frame-geometry.js.map +0 -1
- package/dist/shell/hyperlink.js +0 -27
- package/dist/shell/hyperlink.js.map +0 -1
- package/dist/shell/intro.js +0 -101
- package/dist/shell/intro.js.map +0 -1
- package/dist/shell/launch.js +0 -75
- package/dist/shell/launch.js.map +0 -1
- package/dist/shell/mark.js +0 -134
- package/dist/shell/mark.js.map +0 -1
- package/dist/shell/mouse.js +0 -209
- package/dist/shell/mouse.js.map +0 -1
- package/dist/shell/redraw.js +0 -36
- package/dist/shell/redraw.js.map +0 -1
- package/dist/shell/reveal.js +0 -24
- package/dist/shell/reveal.js.map +0 -1
- package/dist/shell/stage.js +0 -34
- package/dist/shell/stage.js.map +0 -1
- package/dist/shell/terminal-write.js +0 -16
- package/dist/shell/terminal-write.js.map +0 -1
- package/dist/shell/theme.js +0 -178
- package/dist/shell/theme.js.map +0 -1
- package/dist/shell/useFrameOrigin.js +0 -175
- package/dist/shell/useFrameOrigin.js.map +0 -1
- package/dist/shell/useKeys.js +0 -28
- package/dist/shell/useKeys.js.map +0 -1
- package/dist/shell/useMouse.js +0 -150
- package/dist/shell/useMouse.js.map +0 -1
- package/dist/shell/useMouseRouting.js +0 -69
- package/dist/shell/useMouseRouting.js.map +0 -1
- package/dist/shell/width.js +0 -62
- package/dist/shell/width.js.map +0 -1
- package/dist/utils/display-path.js +0 -31
- package/dist/utils/display-path.js.map +0 -1
- package/dist/utils/unescape-path.js +0 -68
- package/dist/utils/unescape-path.js.map +0 -1
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ That puts `forge` on your `PATH`, so it works from any directory. Verify:
|
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
43
|
forge --version
|
|
44
|
-
# 0.1
|
|
44
|
+
# 0.2.1
|
|
45
45
|
|
|
46
46
|
forge photo.jpg --to webp
|
|
47
47
|
```
|
|
@@ -216,6 +216,70 @@ so — and it encodes a candidate to find out rather than guessing:
|
|
|
216
216
|
↵ convert another · c convert to WebP · o open · s show in finder · ctrl-c close app
|
|
217
217
|
```
|
|
218
218
|
|
|
219
|
+
## Resize and trim edges
|
|
220
|
+
|
|
221
|
+
Both need nothing extra, keep the file's own format unless `--to` says otherwise,
|
|
222
|
+
and work on images only:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
forge photo.jpg --resize 50% # photo-2016x1512.jpg (percent, 1-200)
|
|
226
|
+
forge photo.jpg --width 1200 # photo-1200x900.jpg (the height follows)
|
|
227
|
+
forge photo.jpg --height 900 # the width follows
|
|
228
|
+
forge photo.jpg --trim # photo-trimmed.jpg (transparent or solid-colour edges)
|
|
229
|
+
forge photo.jpg --trim --width 1200 --to webp -q 80 # photo-trimmed-1200w.webp
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Use one of `--resize`, `--width` and `--height`. A percent is of the upright
|
|
233
|
+
(and trimmed) size. They combine with `--to`, `-q`, `-o`, `--background`,
|
|
234
|
+
`--keep-metadata`, `--recursive`, `--force`, `--concurrency` and `--json`, and
|
|
235
|
+
are refused with `--max-size`, `--sharpen`, `--boost`, `--remove-bg` and the PDF
|
|
236
|
+
page operations, and with a `--to` that is not an image format. No side may pass
|
|
237
|
+
16,384 px, nor the result 100 MP. Trimming an animated image is refused; so is
|
|
238
|
+
trimming one with nothing to trim, unless it is also resized, which then only
|
|
239
|
+
warns. `forge_convert` takes
|
|
240
|
+
`trim: true` and `resize: { percent } | { width } | { height }`, and then `to`
|
|
241
|
+
is optional.
|
|
242
|
+
|
|
243
|
+
## Boost resolution and remove background
|
|
244
|
+
|
|
245
|
+
Two image operations that need a model, so they are optional extensions rather
|
|
246
|
+
than part of the install. Both need macOS 14 or later. Nothing downloads until
|
|
247
|
+
you ask:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
forge extensions # list: installed or not, size, licence
|
|
251
|
+
forge extensions add boost # about 15 MB; Apple Silicon only for now
|
|
252
|
+
forge extensions add remove-background # about 32 KB
|
|
253
|
+
forge extensions remove boost
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
forge photo.jpg --sharpen # photo-sharp.png (the same size, sharper)
|
|
258
|
+
forge photo.jpg --boost # photo-2x.png (2x, the default)
|
|
259
|
+
forge photo.jpg --boost 3 # photo-3x.png (needs boost 1.1.0 or later)
|
|
260
|
+
forge photo.jpg --boost 4 # photo-4x.png
|
|
261
|
+
forge photo.jpg --remove-bg # photo-cutout.png
|
|
262
|
+
forge photo.jpg --remove-bg --to webp
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Output goes beside the source unless `-o` says otherwise. Boost keeps
|
|
266
|
+
transparency, and flattens it onto `--background` only when `--to` names a
|
|
267
|
+
format that cannot carry it. A cutout must be saved in a format that holds
|
|
268
|
+
transparency (PNG, WebP, AVIF, TIFF); JPEG is refused, because flattening would
|
|
269
|
+
undo the cutout. Without the extension installed, either flag stops with
|
|
270
|
+
`extension-missing` and the install command (exit 1). `--boost 3` on an older
|
|
271
|
+
boost stops with `extension-outdated`; `forge extensions add boost` updates it
|
|
272
|
+
(and while no released boost makes 3x, it is refused naming the factors that work).
|
|
273
|
+
Output more than 16,384 px on a side, or over 100 MP, is refused before
|
|
274
|
+
anything runs.
|
|
275
|
+
|
|
276
|
+
`forge probe` lists `boost` / `remove-background` among a file's `actions` only
|
|
277
|
+
while that extension is installed, and `--json` results report `op: "boost"` or
|
|
278
|
+
`op: "remove-background"`. `forge_convert` accepts `sharpen: true`, `boost: 2 | 3 | 4` and
|
|
279
|
+
`removeBackground: true`, with the same `extension-missing` tool error.
|
|
280
|
+
|
|
281
|
+
The shell's enhance Done shows the real pictures in iTerm2, WezTerm, Kitty and Ghostty (a half-block close-up elsewhere); `FORGE_INLINE_IMAGES=0` turns them off, `=1` forces them on (e.g. tmux with passthrough).
|
|
282
|
+
|
|
219
283
|
## PDF
|
|
220
284
|
|
|
221
285
|
Five page operations, one flag each: merge, split, extract, delete and
|
|
@@ -402,6 +466,8 @@ Forge can **read** a password-protected PDF — probing and `--to jpeg`/`--to
|
|
|
402
466
|
png` both work once it has the password. Page operations (`--merge`,
|
|
403
467
|
`--split`, `--extract`, `--delete`, `--rotate`) refuse an encrypted PDF
|
|
404
468
|
outright: they rewrite the file, and Forge cannot write an encrypted one.
|
|
469
|
+
`forge probe` says so: for an encrypted PDF it lists only the image formats
|
|
470
|
+
as targets and `convert` as the only action.
|
|
405
471
|
|
|
406
472
|
It cannot **remove** a password either; there is no unlock or decrypt-and-resave
|
|
407
473
|
feature, on purpose. The only libraries that can decrypt and rewrite a PDF
|
|
@@ -419,8 +485,8 @@ $ echo -n "hunter2" | forge locked-hunter2.pdf --to png --password-stdin
|
|
|
419
485
|
2.7 KB → 22.4 KB total
|
|
420
486
|
```
|
|
421
487
|
|
|
422
|
-
or leave `--password-stdin` off and Forge prompts on stderr,
|
|
423
|
-
line without echoing it back:
|
|
488
|
+
or, at a terminal, leave `--password-stdin` off and Forge prompts on stderr,
|
|
489
|
+
reading one line without echoing it back:
|
|
424
490
|
|
|
425
491
|
```
|
|
426
492
|
$ forge locked-hunter2.pdf --to jpeg
|
|
@@ -430,8 +496,8 @@ Password:
|
|
|
430
496
|
2.7 KB → 16.6 KB total
|
|
431
497
|
```
|
|
432
498
|
|
|
433
|
-
A wrong password
|
|
434
|
-
|
|
499
|
+
A wrong password is told apart from a missing one, and Forge never echoes the
|
|
500
|
+
attempt itself:
|
|
435
501
|
|
|
436
502
|
```
|
|
437
503
|
$ echo -n "wrongpass" | forge locked-hunter2.pdf --to png --password-stdin
|
|
@@ -439,9 +505,14 @@ $ echo -n "wrongpass" | forge locked-hunter2.pdf --to png --password-stdin
|
|
|
439
505
|
|
|
440
506
|
locked-hunter2.pdf is password-protected.
|
|
441
507
|
|
|
442
|
-
|
|
508
|
+
That password didn't open it. Check it and try again.
|
|
443
509
|
```
|
|
444
510
|
|
|
511
|
+
`--password-stdin` reads one line, so a pipe that stays open after sending
|
|
512
|
+
the password does not hold Forge up. Without a terminal (piped, scripted, or
|
|
513
|
+
driven by an agent) Forge never prompts: an encrypted PDF without
|
|
514
|
+
`--password-stdin` fails at once with exit 1.
|
|
515
|
+
|
|
445
516
|
### In the shell
|
|
446
517
|
|
|
447
518
|
`/pdf` needs at least one staged PDF (drop a file, then drop another to
|
|
@@ -467,15 +538,86 @@ multi-page render has a real count to report against.
|
|
|
467
538
|
|
|
468
539
|
### Not yet
|
|
469
540
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
541
|
+
PDF↔image conversion, reading a password-protected PDF (see [PDF →
|
|
542
|
+
image](#pdf--image) and [Encrypted PDFs](#encrypted-pdfs) above — including
|
|
543
|
+
in the shell), and compressing a PDF that holds images (`forge scan.pdf
|
|
544
|
+
--max-size 2mb`) all work. A PDF that is only text and layout has nothing
|
|
545
|
+
compression can shrink, and Forge says so. Still not implemented: Markdown,
|
|
546
|
+
HTML and Office conversion beyond Word. Removing a password from a PDF is not
|
|
547
|
+
planned at all — see [Encrypted PDFs](#encrypted-pdfs) for why. Separately,
|
|
548
|
+
and not specific to PDFs: the shell refuses to convert or compress several
|
|
549
|
+
staged files at once today — that's a deliberate limit while batch handling
|
|
550
|
+
through the shell is still unbuilt, not a bug.
|
|
551
|
+
|
|
552
|
+
## Colour
|
|
553
|
+
|
|
554
|
+
Two things for designers: an image's palette, and a tonal scale from one
|
|
555
|
+
colour. Both are in the shell as its fourth mode, and on the command line.
|
|
556
|
+
|
|
557
|
+
### In the shell
|
|
558
|
+
|
|
559
|
+
Press **4** (or type `/colour`). Home shows two cards, **Palette** and
|
|
560
|
+
**Scale**. Choose one with ←→ and open it with ↵. You can also drop an image
|
|
561
|
+
straight onto colour's home, or press `#` to type a colour.
|
|
562
|
+
|
|
563
|
+
- **Palette.** Drop an image, or type its path into the field at the top. The
|
|
564
|
+
photo is drawn in its own colours next to the list, with each colour's share
|
|
565
|
+
of the image.
|
|
566
|
+
- ↑↓ choose a colour; it stays lit in the photo and the rest dim.
|
|
567
|
+
- → goes inside a colour: its shades, lit where they are in the photo.
|
|
568
|
+
← comes back.
|
|
569
|
+
- `s` makes a scale from the chosen colour.
|
|
570
|
+
- **Scale.** Type a hex code. You get 50–950 with your colour at 500, and a
|
|
571
|
+
preview of the chosen step: "Aa" in white and black, with each rated
|
|
572
|
+
(AAA, AA, large, fails).
|
|
573
|
+
- ←→ choose a step.
|
|
574
|
+
- `r` makes that step the new centre and rebuilds the scale around it.
|
|
575
|
+
- `#` types a new colour.
|
|
576
|
+
|
|
577
|
+
On both screens, ↵ copies the chosen hex and `c` copies the whole set. Paste
|
|
578
|
+
it into Figma with ⌘V: you get real shapes and text layers, named
|
|
579
|
+
`blue-500` and so on. esc goes back one step, and the bar at the top shows
|
|
580
|
+
the way back. Under `NO_COLOR`, both screens are plain text with every key
|
|
581
|
+
still working.
|
|
582
|
+
|
|
583
|
+
### On the command line
|
|
584
|
+
|
|
585
|
+
```
|
|
586
|
+
$ forge palette photo.jpg
|
|
587
|
+
#B897E4 16%
|
|
588
|
+
#86B627 16%
|
|
589
|
+
#256129 14%
|
|
590
|
+
…
|
|
591
|
+
$ forge palette photo.jpg --inside F96363 # the shades one colour is made of
|
|
592
|
+
#FF665A 63%
|
|
593
|
+
#F35949 15%
|
|
594
|
+
#E58A9F 14%
|
|
595
|
+
#BE5C38 8%
|
|
596
|
+
$ forge scale 6579FD
|
|
597
|
+
50 #F4F6FF white 1.0 fails · black 19.4 AAA
|
|
598
|
+
…
|
|
599
|
+
500 #6579FD white 3.6 large · black 5.7 AA
|
|
600
|
+
…
|
|
601
|
+
950 #161B58 white 15.7 AAA · black 1.3 fails
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
- **`forge palette <image>`** gives an image's main colours, most of the image
|
|
605
|
+
first. Each one is a real pixel from the image, not an average, and the
|
|
606
|
+
percentages add up to 100. The image is probed by content, so a PDF named
|
|
607
|
+
`.png` is refused as not an image.
|
|
608
|
+
- **`forge scale <colour>`** gives 50–950 built in OKLCH, with your colour
|
|
609
|
+
exactly at 500. Each step is rated for white and black text (WCAG: AAA, AA,
|
|
610
|
+
large, fails). Ratios are rounded down, so 4.48:1 shows as `4.4 large` and
|
|
611
|
+
is never passed off as AA. Pass the colour without the `#`, or quote it (`'#6579FD'`):
|
|
612
|
+
an unquoted `#` starts a comment in the shell.
|
|
613
|
+
- **`--svg`** prints a card of swatches. Pipe it to `pbcopy` and press ⌘V in
|
|
614
|
+
Figma to get real shapes and text layers: `forge scale 6579FD --svg | pbcopy`.
|
|
615
|
+
- **`--json`** returns `palette` (`source`, `colours[]` with `hex`, `rgb`,
|
|
616
|
+
`oklch`, `share`) or `scale` (`reference`, `steps[]` with `step`, `hex`,
|
|
617
|
+
`oklch`, `white`, `black`).
|
|
618
|
+
|
|
619
|
+
On a colour terminal each row starts with a swatch. Piped, or under
|
|
620
|
+
`NO_COLOR`, the rows are plain text.
|
|
479
621
|
|
|
480
622
|
## Usage
|
|
481
623
|
|
|
@@ -589,8 +731,9 @@ deep, unless you pass `--recursive`):
|
|
|
589
731
|
$ forge photos --to webp -o ./out/
|
|
590
732
|
✓ 3 converted
|
|
591
733
|
6.2 KB → 1.9 KB · 69.6% smaller
|
|
592
|
-
|
|
593
|
-
|
|
734
|
+
out/photo1.webp
|
|
735
|
+
out/photo2.webp
|
|
736
|
+
out/photo3.webp
|
|
594
737
|
```
|
|
595
738
|
|
|
596
739
|
With `--recursive`, the source tree is recreated under the output directory
|
|
@@ -600,8 +743,10 @@ instead of being flattened:
|
|
|
600
743
|
$ forge photos --to png -o ./t/ --recursive
|
|
601
744
|
✓ 4 converted
|
|
602
745
|
8.3 KB → 1.7 KB · 80% smaller
|
|
603
|
-
|
|
604
|
-
|
|
746
|
+
t/photo1.png
|
|
747
|
+
t/photo2.png
|
|
748
|
+
t/photo3.png
|
|
749
|
+
t/sub/deeper/bottom.png
|
|
605
750
|
```
|
|
606
751
|
|
|
607
752
|
```
|
|
@@ -650,6 +795,163 @@ $ echo $?
|
|
|
650
795
|
2
|
|
651
796
|
```
|
|
652
797
|
|
|
798
|
+
## Use with AI agents
|
|
799
|
+
|
|
800
|
+
Tell an agent *"take this image and use Forge on it"* and it can: Forge is
|
|
801
|
+
local, private, and built to be driven without a person at the keyboard.
|
|
802
|
+
|
|
803
|
+
### As an MCP server
|
|
804
|
+
|
|
805
|
+
```bash
|
|
806
|
+
claude mcp add forge -- forge mcp # Claude Code
|
|
807
|
+
codex mcp add forge -- forge mcp # Codex / ChatGPT desktop's Codex
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
Claude Desktop and Cursor:
|
|
811
|
+
|
|
812
|
+
```json
|
|
813
|
+
{ "mcpServers": { "forge": { "command": "forge", "args": ["mcp"] } } }
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
Seven tools, deliberately few:
|
|
817
|
+
|
|
818
|
+
| Tool | Does |
|
|
819
|
+
| --- | --- |
|
|
820
|
+
| `forge_probe` | what files are and what Forge can do with them |
|
|
821
|
+
| `forge_formats` | the capability matrix |
|
|
822
|
+
| `forge_convert` | convert to a target format (`quality`, `dpi`, `pages`, `background`, `password`, `overwrite`; images also `sharpen`, `boost: 2 \| 3 \| 4` and `removeBackground`, which need the optional extensions) |
|
|
823
|
+
| `forge_compress` | compress by `quality` or to a `maxSize` (also `dpi` for PDFs, `output`, `overwrite`; no `password`: compression refuses encrypted PDFs) |
|
|
824
|
+
| `forge_pdf` | `merge`, `split`, `extract`, `delete`, `rotate` |
|
|
825
|
+
| `forge_palette` | an image's main colours with their shares; `inside` gives one colour's shades (read-only) |
|
|
826
|
+
| `forge_scale` | a 50–950 tonal scale with the colour at 500, rated for white and black text (read-only) |
|
|
827
|
+
|
|
828
|
+
Paths must be absolute. Results come back as structured content in the
|
|
829
|
+
`--json` shape below, with a `file://` link to every output, and never as
|
|
830
|
+
file contents. Nothing is overwritten unless the call passes
|
|
831
|
+
`overwrite: true`. An encrypted PDF takes a `password` argument to
|
|
832
|
+
`forge_convert`; there is no prompt. The server speaks MCP over stdio,
|
|
833
|
+
negotiates protocol revision 2025-11-25 with current Claude Code, writes
|
|
834
|
+
nothing but protocol messages to stdout, and exits when its client closes
|
|
835
|
+
stdin.
|
|
836
|
+
|
|
837
|
+
**Limitation:** an image pasted into a chat app is not a file on disk, so a
|
|
838
|
+
path-based tool cannot see it. Agents with file access (Claude Code, Cursor,
|
|
839
|
+
Codex) are the natural fit.
|
|
840
|
+
|
|
841
|
+
### As a CLI, with the skill
|
|
842
|
+
|
|
843
|
+
[`skills/forge/SKILL.md`](skills/forge/SKILL.md) teaches an agent with a
|
|
844
|
+
shell to probe before converting, pass `--json`, read exit codes, and never
|
|
845
|
+
pass `--force` unless asked. For Claude Code, copy it to
|
|
846
|
+
`~/.claude/skills/forge/SKILL.md`. It ships in the npm package: after
|
|
847
|
+
`npm install -g forge-terminal` it is at
|
|
848
|
+
`$(npm root -g)/forge-terminal/skills/forge/SKILL.md`.
|
|
849
|
+
|
|
850
|
+
### `forge probe`
|
|
851
|
+
|
|
852
|
+
```
|
|
853
|
+
$ forge probe locked.pdf photo.png
|
|
854
|
+
locked.pdf · PDF · 2.7 KB · 3 pages · password-protected
|
|
855
|
+
converts to jpeg, png, pdf, docx
|
|
856
|
+
actions convert, split, extract, delete, rotate
|
|
857
|
+
|
|
858
|
+
photo.png · PNG · 122 KB · 2756×774
|
|
859
|
+
converts to jpeg, png, webp, avif, gif, tiff, pdf
|
|
860
|
+
actions convert
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
With `--json`:
|
|
864
|
+
|
|
865
|
+
```json
|
|
866
|
+
{"forge":"0.2.1","ok":true,"probes":[{"path":"/Users/me/photo.png","kind":"image","format":"png","bytes":122449,"width":2756,"height":774,"targets":["jpeg","png","webp","avif","gif","tiff","pdf"],"actions":["convert"]}],"failures":[]}
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
`targets` and `actions` come from the engines' own capabilities, so they are
|
|
870
|
+
always true for that file. `format` is read from the file's content, not its
|
|
871
|
+
name. `actions` lists `convert` plus what else applies: `compress`,
|
|
872
|
+
`split`, `extract`, `delete`, `rotate`; `merge` appears only when several
|
|
873
|
+
PDFs are probed together. `compress` appears when quality or size can be
|
|
874
|
+
reduced: lossy images, and PDFs that contain compressible images (a PNG has
|
|
875
|
+
only `convert`). Run it as `--quality N` or `--max-size S` without `--to`;
|
|
876
|
+
its `--json` result reports `op: "convert"`. The encrypted PDF above omits
|
|
877
|
+
`compress` and `merge`; a plain PDF with images would also list `compress`.
|
|
878
|
+
A probe has `width`/`height` for an image,
|
|
879
|
+
`pages` and `encrypted` for a PDF. Probing writes nothing. A file that cannot
|
|
880
|
+
be probed goes in `failures` and does not stop the others.
|
|
881
|
+
|
|
882
|
+
### `--json`
|
|
883
|
+
|
|
884
|
+
Every command accepts `--json`. stdout then carries exactly one JSON document
|
|
885
|
+
on one line, and nothing else: no colour, no glyphs, no progress. Every
|
|
886
|
+
document has `forge` (the version), `ok` (true only if every input
|
|
887
|
+
succeeded) and `failures`. A conversion, compression or page operation adds
|
|
888
|
+
`results`:
|
|
889
|
+
|
|
890
|
+
```jsonc
|
|
891
|
+
{
|
|
892
|
+
"forge": "0.2.1",
|
|
893
|
+
"ok": false,
|
|
894
|
+
"results": [
|
|
895
|
+
{
|
|
896
|
+
"op": "convert", // convert | merge | split | extract | delete | rotate
|
|
897
|
+
"source": "/abs/photo.heic", // = sources[0]
|
|
898
|
+
"sources": ["/abs/photo.heic"], // all of them, for a merge
|
|
899
|
+
"outputs": ["/abs/photo.webp"], // always absolute, always every file written
|
|
900
|
+
"inputBytes": 52074,
|
|
901
|
+
"outputBytes": 42684,
|
|
902
|
+
"warnings": [{ "code": "animation-flattened", "message": "…" }]
|
|
903
|
+
}
|
|
904
|
+
],
|
|
905
|
+
"failures": [
|
|
906
|
+
{
|
|
907
|
+
"path": "/abs/locked.pdf", // absent for a command-level error
|
|
908
|
+
"code": "encrypted-source", // a stable ErrorCode
|
|
909
|
+
"title": "…", "detail": "…", "hint": "…"
|
|
910
|
+
}
|
|
911
|
+
]
|
|
912
|
+
}
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
`--formats --json` returns `formats` (`id`, `label`, `extensions`, `read`,
|
|
916
|
+
`write`, `lossy`). `forge probe --json` returns `probes`. `forge palette
|
|
917
|
+
--json` returns `palette`, and `forge scale --json` returns `scale` (see
|
|
918
|
+
[Colour](#colour)). `forge config
|
|
919
|
+
--json` returns `config` and `warnings`. An argument error is a document with
|
|
920
|
+
one `invalid-arguments` failure and exit code 2. Fields are not renamed or
|
|
921
|
+
removed within a minor version; the `forge` field says which version you are
|
|
922
|
+
reading. `--help` and `--version` print text even with `--json`.
|
|
923
|
+
|
|
924
|
+
### Exit codes
|
|
925
|
+
|
|
926
|
+
| Code | Meaning |
|
|
927
|
+
| --- | --- |
|
|
928
|
+
| 0 | Every input succeeded |
|
|
929
|
+
| 1 | The command was understood, and at least one input failed or was refused |
|
|
930
|
+
| 2 | The command itself was invalid: an unknown flag, a missing argument, contradictory flags |
|
|
931
|
+
|
|
932
|
+
If the same flags could succeed on a different file, it's 1; otherwise it's 2.
|
|
933
|
+
The table is also in `forge --help`.
|
|
934
|
+
|
|
935
|
+
### No terminal, no prompt
|
|
936
|
+
|
|
937
|
+
Without a TTY, Forge never waits for input. An encrypted PDF without
|
|
938
|
+
`--password-stdin` fails at once (exit 1), and `--password-stdin` reads a
|
|
939
|
+
single line, so a pipe left open by the caller does not hold it up.
|
|
940
|
+
|
|
941
|
+
### By hand, before a release
|
|
942
|
+
|
|
943
|
+
Registering a server in a real agent config is a human step, so it is not
|
|
944
|
+
part of the test suite:
|
|
945
|
+
|
|
946
|
+
1. `npm run build && npm link`, then `claude mcp add forge -- forge mcp`. In
|
|
947
|
+
Claude Code: "convert ~/Desktop/x.heic to jpeg", "compress it to 200kb",
|
|
948
|
+
"split ~/Desktop/doc.pdf into pages". Each must succeed and name its
|
|
949
|
+
outputs. `/mcp` should show the server connected.
|
|
950
|
+
2. Repeat in Claude Desktop with the `mcpServers` snippet above, and record
|
|
951
|
+
which protocol revision it negotiates (its MCP log shows the `initialize`
|
|
952
|
+
exchange).
|
|
953
|
+
3. If either client cannot connect, read its MCP log before changing code.
|
|
954
|
+
|
|
653
955
|
## Interactive shell
|
|
654
956
|
|
|
655
957
|
Ink/React are only loaded (via a dynamic `import()`) once the TTY check
|
|
@@ -903,7 +1205,8 @@ src/
|
|
|
903
1205
|
│ ├── run.ts bounded-concurrency batch runner, emits events
|
|
904
1206
|
│ ├── output-path.ts output path resolution (the table above)
|
|
905
1207
|
│ ├── units.ts byte / percentage formatting
|
|
906
|
-
│
|
|
1208
|
+
│ ├── errors.ts ForgeError taxonomy and rendering
|
|
1209
|
+
│ └── colour/ OKLab/OKLCH, contrast, palette (k-means), scale, the Figma card
|
|
907
1210
|
│
|
|
908
1211
|
├── engines/
|
|
909
1212
|
│ ├── types.ts Engine interface (reads, writes, probe, convert)
|
|
@@ -912,9 +1215,15 @@ src/
|
|
|
912
1215
|
│
|
|
913
1216
|
├── cli/
|
|
914
1217
|
│ ├── args.ts Commander wiring → Intent
|
|
915
|
-
│ ├── execute.ts
|
|
1218
|
+
│ ├── execute.ts runIntent() → RunReport (data); execute() renders text or --json
|
|
916
1219
|
│ └── report.ts stdout formatting (success, batch, errors, --formats)
|
|
917
1220
|
│
|
|
1221
|
+
├── mcp/ the MCP server — a third front end, loaded only by `forge mcp`
|
|
1222
|
+
│ ├── server.ts createForgeServer(): seven tools; runMcpServer(): stdio
|
|
1223
|
+
│ ├── tools.ts tool handlers → the same intents and runIntent() the CLI uses
|
|
1224
|
+
│ ├── schemas.ts zod input/output schemas, vocabularies read from core/actions
|
|
1225
|
+
│ └── stdout-guard.ts stdout belongs to the protocol; stray writes go to stderr
|
|
1226
|
+
│
|
|
918
1227
|
├── shell/ the interactive shell (Ink + React) — the only place
|
|
919
1228
|
│ │ that renders to a real terminal frame by frame
|
|
920
1229
|
│ ├── App.tsx the state machine: file → target → quality →
|
|
@@ -959,7 +1268,7 @@ dynamically imports `shell/launch.js` and hands off to it instead.
|
|
|
959
1268
|
|
|
960
1269
|
```bash
|
|
961
1270
|
npm run dev # run from source with tsx, no build step
|
|
962
|
-
npm run build #
|
|
1271
|
+
npm run build # one esbuild bundle → dist/ (scripts/build.mjs)
|
|
963
1272
|
npm run typecheck # tsc --noEmit over src + tests
|
|
964
1273
|
npm run lint # biome check src tests
|
|
965
1274
|
npm run format # biome format --write src tests
|
|
@@ -976,7 +1285,7 @@ npm test # vitest run
|
|
|
976
1285
|
npm run test:watch
|
|
977
1286
|
```
|
|
978
1287
|
|
|
979
|
-
|
|
1288
|
+
1413 tests (4 skipped), all passing. Fixtures (transparent PNGs, EXIF-rotated JPEGs,
|
|
980
1289
|
animated GIFs, HEIC/AVIF samples) are generated by Sharp — or, for HEIC,
|
|
981
1290
|
`sips` — at test time, never committed as binaries; the one exception is
|
|
982
1291
|
`tests/fixtures/locked-hunter2.pdf`, a real encrypted PDF (password
|
|
@@ -1026,7 +1335,7 @@ Not yet built, in rough order:
|
|
|
1026
1335
|
`Engine` interface `image.ts` and the PDF engine already implement, so the
|
|
1027
1336
|
CLI and format menu won't need to change to support it. The PDF engine
|
|
1028
1337
|
itself now covers page operations and PDF↔image (see [PDF](#pdf) above);
|
|
1029
|
-
|
|
1338
|
+
splitting a PDF to a target size is still to come.
|
|
1030
1339
|
|
|
1031
1340
|
Explicitly out of scope for 0.1: HEIC encoding (the underlying library
|
|
1032
1341
|
can't), DOCX/PPTX/SVG output, MP4/MP3, recursive watch mode, config files,
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a as j,c as H}from"./chunk-TMUK2DD3.js";var ee=H((it,se)=>{se.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var b=H(ce=>{var fe={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",MAX_OUTPUT_EXCEEDED:"Decompressed data exceeds the declared uncompressed size",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DUPLICATE_ENTRY:"Duplicate entry name {0}",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",ZIP64_VALUE_TOO_LARGE:"Zip64 value exceeds the maximum safe integer",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function Pe(t){return function(...o){return o.length&&(t=t.replace(/\{(\d)\}/g,(n,c)=>o[c]||"")),new Error("ADM-ZIP: "+t)}}for(let t of Object.keys(fe))ce[t]=Pe(fe[t])});var de=H((st,Ee)=>{var Me=j("fs"),R=j("path"),ue=ee(),te=b(),ze=typeof process=="object"&&process.platform==="win32",ae=t=>typeof t=="object"&&t!==null,le=new Uint32Array(256).map((t,o)=>{for(let n=0;n<8;n++)(o&1)!==0?o=3988292384^o>>>1:o>>>=1;return o>>>0});function w(t){this.sep=R.sep,this.fs=Me,ae(t)&&ae(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}Ee.exports=w;w.prototype.makeDir=function(t){let o=this;function n(c){let a=c.split(o.sep)[0];c.split(o.sep).forEach(function(d){if(!(!d||d.substr(-1,1)===":")){a+=o.sep+d;var r;try{r=o.fs.statSync(a)}catch(I){if(I.message&&I.message.startsWith("ENOENT"))o.fs.mkdirSync(a);else throw I}if(r&&r.isFile())throw te.FILE_IN_THE_WAY(`"${a}"`)}})}n(t)};w.prototype.writeFileTo=function(t,o,n,c){let a=this;if(a.fs.existsSync(t)){if(!n)return!1;var d=a.fs.statSync(t);if(d.isDirectory())return!1}var r=R.dirname(t);a.fs.existsSync(r)||a.makeDir(r);var I;try{I=a.fs.openSync(t,"w",438)}catch{a.fs.chmodSync(t,438),I=a.fs.openSync(t,"w",438)}if(I)try{a.fs.writeSync(I,o,0,o.length,0)}finally{a.fs.closeSync(I)}return a.fs.chmodSync(t,c||438),!0};w.prototype.writeFileToAsync=function(t,o,n,c,a){typeof c=="function"&&(a=c,c=void 0);let d=this;d.fs.exists(t,function(r){if(r&&!n)return a(!1);d.fs.stat(t,function(I,C){if(r&&C&&C.isDirectory())return a(!1);var S=R.dirname(t);d.fs.exists(S,function(_){if(!_)try{d.makeDir(S)}catch{return a(!1)}let y=function(p){d.fs.write(p,o,0,o.length,0,function(O){d.fs.close(p,function(){if(O)return a(!1);d.fs.chmod(t,c||438,function(){a(!0)})})})};d.fs.open(t,"w",438,function(p,O){p?d.fs.chmod(t,438,function(){d.fs.open(t,"w",438,function(i,s){if(i||!s)return a(!1);y(s)})}):O?y(O):a(!1)})})})})};w.prototype.assertPathSafe=function(t,o){let n=this;if(typeof n.fs.lstatSync!="function")return;let c=R.resolve(t),a=R.resolve(o);if(a===c)return;let d=R.relative(c,a);if(!d||d===".."||d.startsWith(".."+R.sep)||R.isAbsolute(d))return;let r=c;for(let I of d.split(R.sep)){if(!I||I===".")continue;r=R.join(r,I);let C;try{C=n.fs.lstatSync(r)}catch{break}if(C.isSymbolicLink())throw te.FILE_IN_THE_WAY(`"${r}"`)}};w.prototype.findFiles=function(t){let o=this,n=typeof o.fs.lstatSync=="function",c=o.fs.realpathSync(t);function a(r){if(!n||!o.fs.lstatSync(r).isSymbolicLink())return!1;let I;try{I=o.fs.realpathSync(r)}catch{return!0}return!(I===c||I.startsWith(c+R.sep))}function d(r,I,C,S){typeof I=="boolean"&&(C=I,I=void 0);let _=[];return o.fs.readdirSync(r).forEach(function(y){let p=R.join(r,y);if(a(p))return;let O=o.fs.statSync(p);if((!I||I.test(p))&&_.push(R.normalize(p)+(O.isDirectory()?o.sep:"")),O.isDirectory()&&C){let i=o.fs.realpathSync(p);S.has(i)||(S.add(i),_=_.concat(d(p,I,C,S)))}}),_}return d(t,void 0,!0,new Set([c]))};w.prototype.findFilesAsync=function(t,o){let n=this,c=[],a=!1,d=function(_){a||(a=!0,o(_,_?void 0:c))},r=typeof n.fs.lstat=="function",I=null,C=function(_,y){if(!r)return y(null,!1);n.fs.lstat(_,function(p,O){if(p)return y(p);if(!O||!O.isSymbolicLink())return y(null,!1);n.fs.realpath(_,function(i,s){if(i)return y(null,!0);y(null,!(s===I||s.startsWith(I+R.sep)))})})},S=function(_,y,p){n.fs.readdir(_,function(O,i){if(O)return p(O);let s=i.length;if(!s)return p();i.forEach(function(f){let l=R.join(_,f);C(l,function(E,e){if(E)return p(E);if(e){--s||p();return}n.fs.stat(l,function(u,m){if(u)return p(u);if(!m){--s||p();return}if(c.push(R.normalize(l)+(m.isDirectory()?n.sep:"")),!m.isDirectory()){--s||p();return}n.fs.realpath(l,function(D,L){if(D)return p(D);if(y.has(L)){--s||p();return}y.add(L),S(l,y,function(N){if(N)return p(N);--s||p()})})})})})})};n.fs.realpath(t,function(_,y){if(_)return d(_);I=y,S(t,new Set([y]),d)})};w.prototype.getAttributes=function(){};w.prototype.setAttributes=function(){};w.crc32update=function(t,o){return le[(t^o)&255]^t>>>8};w.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let o=t.length,n=-1;for(let c=0;c<o;)n=w.crc32update(n,t[c++]);return~n>>>0};w.methodToString=function(t){switch(t){case ue.STORED:return"STORED ("+t+")";case ue.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};w.canonical=function(t){if(!t)return"";let o=R.posix.normalize("/"+t.split("\\").join("/"));return R.join(".",o)};w.zipnamefix=function(t){if(!t)return"";let o=R.posix.normalize("/"+t.split("\\").join("/"));return R.posix.join(".",o)};w.findLast=function(t,o){if(!Array.isArray(t))throw new TypeError("arr is not array");let n=t.length>>>0;for(let c=n-1;c>=0;c--)if(o(t[c],c,t))return t[c]};w.sanitize=function(t,o){t=R.resolve(R.normalize(t));for(var n=o.split("/"),c=0,a=n.length;c<a;c++){var d=R.normalize(R.join(t,n.slice(c,a).join(R.sep)));if(d===t||d.startsWith(t+R.sep))return d}return R.normalize(R.join(t,R.basename(o)))};w.toBuffer=function(o,n){return Buffer.isBuffer(o)?o:o instanceof Uint8Array?Buffer.from(o):typeof o=="string"?n(o):Buffer.alloc(0)};w.readBigUInt64LE=function(t,o){let n=t.readUInt32LE(o),a=t.readUInt32LE(o+4)*4294967296+n;if(a>Number.MAX_SAFE_INTEGER)throw te.ZIP64_VALUE_TOO_LARGE();return a};w.writeBigUInt64LE=function(t,o,n){let c=o>>>0,a=Math.floor(o/4294967296)>>>0;t.writeUInt32LE(c,n),t.writeUInt32LE(a,n+4)};w.fromDOS2Date=function(t){return new Date((t>>25&127)+1980,Math.max((t>>21&15)-1,0),Math.max(t>>16&31,1),t>>11&31,t>>5&63,(t&31)<<1)};w.fromDate2DOS=function(t){let o=0,n=0;return t.getFullYear()>1979&&(o=(t.getFullYear()-1980&127)<<9|t.getMonth()+1<<5|t.getDate(),n=t.getHours()<<11|t.getMinutes()<<5|t.getSeconds()>>1),o<<16|n};w.isWin=ze;w.crcTable=le});var he=H((ft,Ie)=>{var Ge=j("path");Ie.exports=function(t,{fs:o}){var n=t||"",c=d(),a=null;function d(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return n&&o.existsSync(n)?(a=o.statSync(n),c.directory=a.isDirectory(),c.mtime=a.mtime,c.atime=a.atime,c.executable=(73&a.mode)!==0,c.readonly=(128&a.mode)===0,c.hidden=Ge.basename(n)[0]==="."):console.warn("Invalid path: "+n),{get directory(){return c.directory},get readOnly(){return c.readonly},get hidden(){return c.hidden},get mtime(){return c.mtime},get atime(){return c.atime},get executable(){return c.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:n,isDirectory:c.directory,isReadOnly:c.readonly,isHidden:c.hidden,isExecutable:c.executable,mTime:c.mtime,aTime:c.atime}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Le=H((ct,me)=>{me.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var W=H((ut,q)=>{q.exports=de();q.exports.Constants=ee();q.exports.Errors=b();q.exports.FileAttr=he();q.exports.decoder=Le()});var Ne=H((at,De)=>{var G=W(),h=G.Constants;De.exports=function(){var t=20,o=10,n=0,c=0,a=0,d=0,r=0,I=0,C=0,S=0,_=0,y=0,p=0,O=0,i=0;t|=G.isWin?2560:768,n|=h.FLG_EFS;let s={extraLen:0},f=e=>Math.max(0,e)>>>0,l=e=>Math.max(0,e)&65535,E=e=>Math.max(0,e)&255;return a=G.fromDate2DOS(new Date),{get made(){return t},set made(e){t=e},get version(){return o},set version(e){o=e},get flags(){return n},set flags(e){n=e},get flags_efs(){return(n&h.FLG_EFS)>0},set flags_efs(e){e?n|=h.FLG_EFS:n&=~h.FLG_EFS},get flags_desc(){return(n&h.FLG_DESC)>0},set flags_desc(e){e?n|=h.FLG_DESC:n&=~h.FLG_DESC},get method(){return c},set method(e){switch(e){case h.STORED:this.version=10;break;case h.DEFLATED:default:this.version=20}c=e},get time(){return G.fromDOS2Date(this.timeval)},set time(e){e=new Date(e),this.timeval=G.fromDate2DOS(e)},get timeval(){return a},set timeval(e){a=f(e)},get timeHighByte(){return E(a>>>8)},get crc(){return d},set crc(e){d=f(e)},get compressedSize(){return r},set compressedSize(e){r=f(e)},get size(){return I},set size(e){I=f(e)},get fileNameLength(){return C},set fileNameLength(e){C=e},get extraLength(){return S},set extraLength(e){S=e},get extraLocalLength(){return s.extraLen},set extraLocalLength(e){s.extraLen=e},get commentLength(){return _},set commentLength(e){_=e},get diskNumStart(){return y},set diskNumStart(e){y=f(e)},get inAttr(){return p},set inAttr(e){p=f(e)},get attr(){return O},set attr(e){O=f(e)},get fileAttr(){return(O||0)>>16&511},get offset(){return i},set offset(e){i=f(e)},get encrypted(){return(n&h.FLG_ENC)===h.FLG_ENC},get centralHeaderSize(){return h.CENHDR+C+S+_},get realDataOffset(){return i+h.LOCHDR+s.fnameLen+s.extraLen},get localHeader(){return s},loadLocalHeaderFromBinary:function(e){if(i<0||i+h.LOCHDR>e.length)throw G.Errors.INVALID_LOC();var u=e.slice(i,i+h.LOCHDR);if(u.readUInt32LE(0)!==h.LOCSIG)throw G.Errors.INVALID_LOC();s.version=u.readUInt16LE(h.LOCVER),s.flags=u.readUInt16LE(h.LOCFLG),s.flags_desc=(s.flags&h.FLG_DESC)>0,s.method=u.readUInt16LE(h.LOCHOW),s.time=u.readUInt32LE(h.LOCTIM),s.crc=u.readUInt32LE(h.LOCCRC),s.compressedSize=u.readUInt32LE(h.LOCSIZ),s.size=u.readUInt32LE(h.LOCLEN),s.fnameLen=u.readUInt16LE(h.LOCNAM),s.extraLen=u.readUInt16LE(h.LOCEXT);let m=i+h.LOCHDR+s.fnameLen,D=m+s.extraLen;return e.slice(m,D)},loadFromBinary:function(e){if(e.length!==h.CENHDR||e.readUInt32LE(0)!==h.CENSIG)throw G.Errors.INVALID_CEN();t=e.readUInt16LE(h.CENVEM),o=e.readUInt16LE(h.CENVER),n=e.readUInt16LE(h.CENFLG),c=e.readUInt16LE(h.CENHOW),a=e.readUInt32LE(h.CENTIM),d=e.readUInt32LE(h.CENCRC),r=e.readUInt32LE(h.CENSIZ),I=e.readUInt32LE(h.CENLEN),C=e.readUInt16LE(h.CENNAM),S=e.readUInt16LE(h.CENEXT),_=e.readUInt16LE(h.CENCOM),y=e.readUInt16LE(h.CENDSK),p=e.readUInt16LE(h.CENATT),O=e.readUInt32LE(h.CENATX),i=e.readUInt32LE(h.CENOFF)},localHeaderToBinary:function(){var e=Buffer.alloc(h.LOCHDR);return e.writeUInt32LE(h.LOCSIG,0),e.writeUInt16LE(o,h.LOCVER),e.writeUInt16LE(n&~h.FLG_DESC,h.LOCFLG),e.writeUInt16LE(c,h.LOCHOW),e.writeUInt32LE(a,h.LOCTIM),e.writeUInt32LE(d,h.LOCCRC),e.writeUInt32LE(r,h.LOCSIZ),e.writeUInt32LE(I,h.LOCLEN),e.writeUInt16LE(C,h.LOCNAM),e.writeUInt16LE(s.extraLen,h.LOCEXT),e},centralHeaderToBinary:function(){var e=Buffer.alloc(h.CENHDR+C+S+_);return e.writeUInt32LE(h.CENSIG,0),e.writeUInt16LE(t,h.CENVEM),e.writeUInt16LE(o,h.CENVER),e.writeUInt16LE(n&~h.FLG_DESC,h.CENFLG),e.writeUInt16LE(c,h.CENHOW),e.writeUInt32LE(a,h.CENTIM),e.writeUInt32LE(d,h.CENCRC),e.writeUInt32LE(r,h.CENSIZ),e.writeUInt32LE(I,h.CENLEN),e.writeUInt16LE(C,h.CENNAM),e.writeUInt16LE(S,h.CENEXT),e.writeUInt16LE(_,h.CENCOM),e.writeUInt16LE(y,h.CENDSK),e.writeUInt16LE(p,h.CENATT),e.writeUInt32LE(O,h.CENATX),e.writeUInt32LE(i,h.CENOFF),e},toJSON:function(){let e=function(u){return u+" bytes"};return{made:t,version:o,flags:n,method:G.methodToString(c),time:this.time,crc:"0x"+d.toString(16).toUpperCase(),compressedSize:e(r),size:e(I),fileNameLength:e(C),extraLength:e(S),commentLength:e(_),diskNumStart:y,inAttr:p,attr:O,offset:i,centralHeaderSize:e(h.CENHDR+C+S+_)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var _e=H((lt,ge)=>{var z=W(),g=z.Constants;ge.exports=function(){var t=0,o=0,n=0,c=0,a=0;let d=()=>t>g.EF_ZIP64_OR_16||o>g.EF_ZIP64_OR_16||n>g.EF_ZIP64_OR_32||c>g.EF_ZIP64_OR_32;return{get diskEntries(){return t},set diskEntries(r){t=o=r},get totalEntries(){return o},set totalEntries(r){o=t=r},get size(){return n},set size(r){n=r},get offset(){return c},set offset(r){c=r},get commentLength(){return a},set commentLength(r){a=r},get mainHeaderSize(){return(d()?g.ZIP64HDR+g.END64HDR:0)+g.ENDHDR+a},loadFromBinary:function(r){if((r.length!==g.ENDHDR||r.readUInt32LE(0)!==g.ENDSIG)&&(r.length<g.ZIP64HDR||r.readUInt32LE(0)!==g.ZIP64SIG))throw z.Errors.INVALID_END();r.readUInt32LE(0)===g.ENDSIG?(t=r.readUInt16LE(g.ENDSUB),o=r.readUInt16LE(g.ENDTOT),n=r.readUInt32LE(g.ENDSIZ),c=r.readUInt32LE(g.ENDOFF),a=r.readUInt16LE(g.ENDCOM)):(t=z.readBigUInt64LE(r,g.ZIP64SUB),o=z.readBigUInt64LE(r,g.ZIP64TOT),n=z.readBigUInt64LE(r,g.ZIP64SIZB),c=z.readBigUInt64LE(r,g.ZIP64OFF),a=0)},toBinary:function(){if(!d()){var r=Buffer.alloc(g.ENDHDR+a);return r.writeUInt32LE(g.ENDSIG,0),r.writeUInt32LE(0,4),r.writeUInt16LE(t,g.ENDSUB),r.writeUInt16LE(o,g.ENDTOT),r.writeUInt32LE(n,g.ENDSIZ),r.writeUInt32LE(c,g.ENDOFF),r.writeUInt16LE(a,g.ENDCOM),r.fill(" ",g.ENDHDR),r}var r=Buffer.alloc(this.mainHeaderSize);let I=0;r.writeUInt32LE(g.ZIP64SIG,I),z.writeBigUInt64LE(r,g.ZIP64HDR-g.ZIP64LEAD,I+g.ZIP64SIZE),r.writeUInt16LE(45,I+g.ZIP64VEM),r.writeUInt16LE(45,I+g.ZIP64VER),r.writeUInt32LE(0,I+g.ZIP64DSK),r.writeUInt32LE(0,I+g.ZIP64DSKDIR),z.writeBigUInt64LE(r,t,I+g.ZIP64SUB),z.writeBigUInt64LE(r,o,I+g.ZIP64TOT),z.writeBigUInt64LE(r,n,I+g.ZIP64SIZB),z.writeBigUInt64LE(r,c,I+g.ZIP64OFF);let C=c+n;return I+=g.ZIP64HDR,r.writeUInt32LE(g.END64SIG,I),r.writeUInt32LE(0,I+g.END64START),z.writeBigUInt64LE(r,C,I+g.END64OFF),r.writeUInt32LE(1,I+g.END64NUMDISKS),I+=g.END64HDR,r.writeUInt32LE(g.ENDSIG,I),r.writeUInt32LE(0,I+4),r.writeUInt16LE(Math.min(t,g.EF_ZIP64_OR_16),I+g.ENDSUB),r.writeUInt16LE(Math.min(o,g.EF_ZIP64_OR_16),I+g.ENDTOT),r.writeUInt32LE(Math.min(n,g.EF_ZIP64_OR_32),I+g.ENDSIZ),r.writeUInt32LE(Math.min(c,g.EF_ZIP64_OR_32),I+g.ENDOFF),r.writeUInt16LE(a,I+g.ENDCOM),r.fill(" ",I+g.ENDHDR),r},toJSON:function(){let r=function(I,C){let S=I.toString(16).toUpperCase();for(;S.length<C;)S="0"+S;return"0x"+S};return{diskEntries:t,totalEntries:o,size:n+" bytes",offset:r(c,4),commentLength:a}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var re=H(ne=>{ne.EntryHeader=Ne();ne.MainHeader=_e()});var Ce=H((dt,ye)=>{ye.exports=function(t){var o=j("zlib"),n={chunkSize:(parseInt(t.length/1024)+1)*1024};return{deflate:function(){return o.deflateRawSync(t,n)},deflateAsync:function(c){var a=o.createDeflateRaw(n),d=[],r=0;a.on("data",function(I){d.push(I),r+=I.length}),a.on("end",function(){var I=Buffer.alloc(r),C=0;I.fill(0);for(var S=0;S<d.length;S++){var _=d[S];_.copy(I,C),C+=_.length}c&&c(I)}),a.end(t)}}}});var pe=H((It,Se)=>{var Ve=+(process?.versions?.node??"").split(".")[0]||0,je=b();Se.exports=function(t,o){var n=j("zlib");let c=o>0?o:1,a=Ve>=15?{maxOutputLength:c}:{};return{inflate:function(){return n.inflateRawSync(t,a)},inflateAsync:function(d){var r=n.createInflateRaw(a),I=[],C=0,S=!1;let _=function(y){S||(S=!0,r.destroy(),d&&d(Buffer.alloc(0),y))};r.on("error",function(y){_(y)}),r.on("data",function(y){if(!S){if(C+=y.length,C>c)return _(je.MAX_OUTPUT_EXCEEDED());I.push(y)}}),r.on("end",function(){if(!S){S=!0;var y=Buffer.alloc(C),p=0;y.fill(0);for(var O=0;O<I.length;O++){var i=I[O];i.copy(y,p),p+=i.length}d&&d(y)}}),r.end(t)}}}});var Re=H((ht,Fe)=>{"use strict";var{randomFillSync:Oe}=j("crypto"),Xe=b(),qe=new Uint32Array(256).map((t,o)=>{for(let n=0;n<8;n++)(o&1)!==0?o=o>>>1^3988292384:o>>>=1;return o>>>0}),Ae=(t,o)=>Math.imul(t,o)>>>0,Te=(t,o)=>qe[(t^o)&255]^t>>>8,Y=()=>typeof Oe=="function"?Oe(Buffer.alloc(12)):Y.node();Y.node=()=>{let t=Buffer.alloc(12),o=t.length;for(let n=0;n<o;n++)t[n]=Math.random()*256&255;return t};var $={genSalt:Y};function Q(t){let o=Buffer.isBuffer(t)?t:Buffer.from(t);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let n=0;n<o.length;n++)this.updateKeys(o[n])}Q.prototype.updateKeys=function(t){let o=this.keys;return o[0]=Te(o[0],t),o[1]+=o[0]&255,o[1]=Ae(o[1],134775813)+1,o[2]=Te(o[2],o[1]>>>24),t};Q.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return Ae(t,t^1)>>8&255};function We(t){let o=new Q(t);return function(n){let c=Buffer.alloc(n.length),a=0;for(let d of n)c[a++]=o.updateKeys(d^o.next());return c}}function Ke(t){let o=new Q(t);return function(n,c,a=0){c||(c=Buffer.alloc(n.length));for(let d of n){let r=o.next();c[a++]=d^r,o.updateKeys(d)}return c}}function be(t,o,n){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let c=We(n),a=c(t.slice(0,12)),d=(o.flags&8)===8?o.timeHighByte:o.crc>>>24;if(a[11]!==d)throw Xe.WRONG_PASSWORD();return c(t.slice(12))}function Ye(t){Buffer.isBuffer(t)&&t.length>=12?$.genSalt=function(){return t.slice(0,12)}:t==="node"?$.genSalt=Y.node:$.genSalt=Y}function Je(t,o,n,c=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let a=Ke(n),d=$.genSalt();d[11]=o.crc>>>24&255,c&&(d[10]=o.crc>>>16&255);let r=Buffer.alloc(t.length+12);return a(d,r),a(t,r,12)}Fe.exports={decrypt:be,encrypt:Je,_salter:Ye}});var Ue=H(k=>{k.Deflater=Ce();k.Inflater=pe();k.ZipCrypto=Re()});var oe=H((Lt,we)=>{var U=W(),$e=re(),M=U.Constants,ie=Ue();we.exports=function(t,o){var n=new $e.EntryHeader,c=Buffer.alloc(0),a=Buffer.alloc(0),d=!1,r=null,I=Buffer.alloc(0),C=Buffer.alloc(0),S=!0;let _=t,y=typeof _.decoder=="object"?_.decoder:U.decoder;S=y.hasOwnProperty("efs")?y.efs:!1;function p(){if(!o||!(o instanceof Uint8Array))return Buffer.alloc(0);C=n.loadLocalHeaderFromBinary(o);let e=n.realDataOffset,u=e+n.compressedSize;if(e<0||u<e||u>o.length)throw U.Errors.INVALID_LOC();return o.slice(e,u)}function O(e){let u=n.flags_desc||n.localHeader.flags_desc?n.crc:n.localHeader.crc;return U.crc32(e)===u}function i(e,u,m){if(typeof u>"u"&&typeof e=="string"&&(m=e,e=void 0),d)return e&&u&&u(Buffer.alloc(0),U.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var D;try{if(D=p(),D.length===0)return e&&u&&u(D),D;if(n.encrypted){if(typeof m!="string"&&!Buffer.isBuffer(m))throw U.Errors.INVALID_PASS_PARAM();D=ie.ZipCrypto.decrypt(D,n,m)}}catch(T){if(e&&u)return u(Buffer.alloc(0),T),Buffer.alloc(0);throw T}var L;switch(n.method){case U.Constants.STORED:if(L=Buffer.alloc(D.length),D.copy(L),O(L))return e&&u&&u(L),L;throw e&&u&&u(L,U.Errors.BAD_CRC()),U.Errors.BAD_CRC();case U.Constants.DEFLATED:var N=new ie.Inflater(D,n.size);if(e)N.inflateAsync(function(T,A){u&&(A?u(Buffer.alloc(0),A):O(T)?u(T):u(T,U.Errors.BAD_CRC()))});else{if(L=N.inflate(),!O(L))throw U.Errors.BAD_CRC(`"${y.decode(c)}"`);return L}break;default:throw e&&u&&u(Buffer.alloc(0),U.Errors.UNKNOWN_METHOD()),U.Errors.UNKNOWN_METHOD()}}function s(e,u){if((!r||!r.length)&&Buffer.isBuffer(o))return e&&u&&u(p()),p();if(r.length&&!d){var m;switch(n.method){case U.Constants.STORED:return n.compressedSize=n.size,m=Buffer.alloc(r.length),r.copy(m),e&&u&&u(m),m;default:case U.Constants.DEFLATED:var D=new ie.Deflater(r);if(e)D.deflateAsync(function(N){m=Buffer.alloc(N.length),n.compressedSize=N.length,N.copy(m),u&&u(m)});else{var L=D.deflate();return n.compressedSize=L.length,L}D=null;break}}else if(e&&u)u(Buffer.alloc(0));else return Buffer.alloc(0)}function f(e,u){return U.readBigUInt64LE(e,u)}function l(e){try{for(var u=0,m,D,L;u+4<e.length;)m=e.readUInt16LE(u),u+=2,D=e.readUInt16LE(u),u+=2,L=e.slice(u,u+D),u+=D,M.ID_ZIP64===m&&E(L)}catch{throw U.Errors.EXTRA_FIELD_PARSE_ERROR()}}function E(e){var u,m,D,L;e.length>=M.EF_ZIP64_SCOMP&&(u=f(e,M.EF_ZIP64_SUNCOMP),n.size===M.EF_ZIP64_OR_32&&(n.size=u)),e.length>=M.EF_ZIP64_RHO&&(m=f(e,M.EF_ZIP64_SCOMP),n.compressedSize===M.EF_ZIP64_OR_32&&(n.compressedSize=m)),e.length>=M.EF_ZIP64_DSN&&(D=f(e,M.EF_ZIP64_RHO),n.offset===M.EF_ZIP64_OR_32&&(n.offset=D)),e.length>=M.EF_ZIP64_DSN+4&&(L=e.readUInt32LE(M.EF_ZIP64_DSN),n.diskNumStart===M.EF_ZIP64_OR_16&&(n.diskNumStart=L))}return{get entryName(){return y.decode(c)},get rawEntryName(){return c},set entryName(e){c=U.toBuffer(e,y.encode);var u=c[c.length-1];d=u===47||u===92,n.fileNameLength=c.length},get efs(){return typeof S=="function"?S(this.entryName):S},get extra(){return I},set extra(e){I=e,n.extraLength=e.length,l(e)},get comment(){return y.decode(a)},set comment(e){if(a=U.toBuffer(e,y.encode),n.commentLength=a.length,a.length>65535)throw U.Errors.COMMENT_TOO_LONG()},get name(){let e=y.decode(c);return d?e.replace(/[/\\]$/,"").split("/").pop():e.split("/").pop()},get isDirectory(){return d},getCompressedData:function(){return s(!1,null)},getCompressedDataAsync:function(e){s(!0,e)},setData:function(e){r=U.toBuffer(e,U.decoder.encode),!d&&r.length?(n.size=r.length,n.method=U.Constants.DEFLATED,n.crc=U.crc32(e),n.changed=!0):n.method=U.Constants.STORED},getData:function(e){return n.changed?r:i(!1,null,e)},getDataAsync:function(e,u){n.changed?e(r):i(!0,e,u)},set attr(e){n.attr=e},get attr(){return n.attr},set header(e){n.loadFromBinary(e)},get header(){return n},packCentralHeader:function(){n.flags_efs=this.efs,n.extraLength=I.length;var e=n.centralHeaderToBinary(),u=U.Constants.CENHDR;return c.copy(e,u),u+=c.length,I.copy(e,u),u+=n.extraLength,a.copy(e,u),e},packLocalHeader:function(){let e=0;n.flags_efs=this.efs,n.extraLocalLength=C.length;let u=n.localHeaderToBinary(),m=Buffer.alloc(u.length+c.length+n.extraLocalLength);return u.copy(m,e),e+=u.length,c.copy(m,e),e+=c.length,C.copy(m,e),e+=C.length,m},toJSON:function(){let e=function(u){return"<"+(u&&u.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:n.toJSON(),compressedData:e(o),data:e(r)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Ze=H((Dt,Be)=>{var xe=oe(),Qe=re(),P=W();Be.exports=function(t,o){var n=[],c=Object.create(null),a=Buffer.alloc(0),d=new Qe.MainHeader,r=!1,I=null;let C=new Set,S=o,{noSort:_,decoder:y}=S;t?i(S.readEntries):r=!0;function p(){let f=new Set;for(let l of Object.keys(c)){let E=l.split("/");if(E.pop(),!!E.length)for(let e=0;e<E.length;e++){let u=E.slice(0,e+1).join("/")+"/";f.add(u)}}for(let l of f)if(!(l in c)){let E=new xe(S);E.entryName=l,E.attr=16,E.temporary=!0,n.push(E),c[E.entryName]=E,C.add(E)}}function O(){if(r=!0,c=Object.create(null),d.diskEntries>(t.length-d.offset)/P.Constants.CENHDR)throw P.Errors.DISK_ENTRY_TOO_LARGE();n=new Array(d.diskEntries);for(var f=d.offset,l=0;l<n.length;l++){var E=f,e=new xe(S,t);if(e.header=t.slice(E,E+=P.Constants.CENHDR),e.entryName=t.slice(E,E+=e.header.fileNameLength),e.header.extraLength&&(e.extra=t.slice(E,E+=e.header.extraLength)),e.header.commentLength&&(e.comment=t.slice(E,E+e.header.commentLength)),f+=e.header.centralHeaderSize,e.entryName in c)throw P.Errors.DUPLICATE_ENTRY(`"${e.entryName}"`);n[l]=e,c[e.entryName]=e}C.clear(),p()}function i(f){var l=t.length-P.Constants.ENDHDR,E=Math.max(0,l-65535),e=E,u=t.length,m=-1,D=0;for(typeof S.trailingSpace=="boolean"&&S.trailingSpace&&(E=0),l;l>=e;l--)if(t[l]===80){if(t.readUInt32LE(l)===P.Constants.ENDSIG){m=l,D=l,u=l+P.Constants.ENDHDR,e=l-P.Constants.END64HDR;continue}if(t.readUInt32LE(l)===P.Constants.END64SIG){e=E;continue}if(t.readUInt32LE(l)===P.Constants.ZIP64SIG){m=l,u=l+P.readBigUInt64LE(t,l+P.Constants.ZIP64SIZE)+P.Constants.ZIP64LEAD;break}}if(m==-1)throw P.Errors.INVALID_FORMAT();d.loadFromBinary(t.slice(m,u)),d.commentLength&&(a=t.slice(D+P.Constants.ENDHDR)),f&&O()}function s(){n.length>1&&!_&&(n=n.map(f=>({entry:f,key:f.entryName.toLowerCase()})).sort((f,l)=>f.key.localeCompare(l.key)).map(f=>f.entry))}return{get entries(){return r||O(),n.filter(f=>!C.has(f))},get comment(){return y.decode(a)},set comment(f){a=P.toBuffer(f,y.encode),d.commentLength=a.length},getEntryCount:function(){return r?n.length:d.diskEntries},forEach:function(f){this.entries.forEach(f)},getEntry:function(f){return r||O(),c[f]||null},setEntry:function(f){r||O(),n.push(f),c[f.entryName]=f,d.totalEntries=n.length},deleteFile:function(f,l=!0){r||O();let E=c[f];this.getEntryChildren(E,l).map(u=>u.entryName).forEach(this.deleteEntry)},deleteEntry:function(f){r||O();let l=c[f],E=n.indexOf(l);E>=0&&(n.splice(E,1),delete c[f],d.totalEntries=n.length)},getEntryChildren:function(f,l=!0){if(r||O(),typeof f=="object")if(f.isDirectory&&l){let E=[],e=f.entryName;for(let u of n)u.entryName.startsWith(e)&&E.push(u);return E}else return[f];return[]},getChildCount:function(f){if(f&&f.isDirectory){let l=this.getEntryChildren(f);return l.includes(f)?l.length-1:l.length}return 0},compressToBuffer:function(){r||O(),s();let f=[],l=[],E=0,e=0;d.size=0,d.offset=0;let u=0;for(let L of this.entries){let N=L.getCompressedData();L.header.offset=e;let T=L.packLocalHeader(),A=T.length+N.length;e+=A,f.push(T),f.push(N);let F=L.packCentralHeader();l.push(F),d.size+=F.length,E+=A+F.length,u++}E+=d.mainHeaderSize,d.offset=e,d.totalEntries=u,e=0;let m=Buffer.alloc(E);for(let L of f)L.copy(m,e),e+=L.length;for(let L of l)L.copy(m,e),e+=L.length;let D=d.toBinary();return a&&a.copy(D,D.length-a.length),D.copy(m,e),t=m,r=!1,m},toAsyncBuffer:function(f,l,E,e){try{r||O(),s();let u=[],m=[],D=0,L=0,N=0;d.size=0,d.offset=0;let T=function(A){if(A.length>0){let F=A.shift(),Z=F.entryName+F.extra.toString();E&&E(Z),F.getCompressedDataAsync(function(v){e&&e(Z),F.header.offset=L;let V=F.packLocalHeader(),J=V.length+v.length;L+=J,u.push(V),u.push(v);let K=F.packCentralHeader();m.push(K),d.size+=K.length,D+=J+K.length,N++,T(A)})}else{D+=d.mainHeaderSize,d.offset=L,d.totalEntries=N,L=0;let F=Buffer.alloc(D);u.forEach(function(v){v.copy(F,L),L+=v.length}),m.forEach(function(v){v.copy(F,L),L+=v.length});let Z=d.toBinary();a&&a.copy(Z,Z.length-a.length),Z.copy(F,L),t=F,r=!1,f(F)}};T(Array.from(this.entries))}catch(u){l(u)}}}}});var rt=H((Nt,He)=>{var B=W(),x=j("path"),ke=oe(),et=Ze(),X=(...t)=>B.findLast(t,o=>typeof o=="boolean"),ve=(...t)=>B.findLast(t,o=>typeof o=="string"),tt=(...t)=>B.findLast(t,o=>typeof o=="function"),nt={noSort:!1,readEntries:!1,method:B.Constants.NONE,fs:null};He.exports=function(t,o){let n=null,c=Object.assign(Object.create(null),nt);t&&typeof t=="object"&&(t instanceof Uint8Array||(Object.assign(c,t),t=c.input?c.input:void 0,c.input&&delete c.input),Buffer.isBuffer(t)&&(n=t,c.method=B.Constants.BUFFER,t=void 0)),Object.assign(c,o);let a=new B(c),d=i=>{i.filter(s=>s.attr).sort((s,f)=>f.path.length-s.path.length).forEach(s=>a.fs.chmodSync(s.path,s.attr))};if((typeof c.decoder!="object"||typeof c.decoder.encode!="function"||typeof c.decoder.decode!="function")&&(c.decoder=B.decoder),t&&typeof t=="string")if(a.fs.existsSync(t))c.method=B.Constants.FILE,c.filename=t,n=a.fs.readFileSync(t);else throw B.Errors.INVALID_FILENAME();let r=new et(n,c),{canonical:I,sanitize:C,zipnamefix:S}=B;function _(i){if(i&&r){var s;if(typeof i=="string"&&(s=r.getEntry(x.posix.normalize(i))),typeof i=="object"&&typeof i.entryName<"u"&&typeof i.header<"u"&&(s=r.getEntry(i.entryName)),s)return s}return null}function y(i){let{join:s,normalize:f,sep:l}=x.posix;return s(x.isAbsolute(i)?"/":".",f(l+i.split("\\").join(l)+l))}function p(i){return i instanceof RegExp?(function(s){return function(f){return s.test(f)}})(i):typeof i!="function"?()=>!0:i}let O=(i,s)=>{let f=s.slice(-1);return f=f===a.sep?a.sep:"",x.relative(i,s)+f};return{readFile:function(i,s){var f=_(i);return f&&f.getData(s)||null},childCount:function(i){let s=_(i);if(s)return r.getChildCount(s)},readFileAsync:function(i,s){var f=_(i);f?f.getDataAsync(s):s(null,"getEntry failed for:"+i)},readAsText:function(i,s){var f=_(i);if(f){var l=f.getData();if(l&&l.length)return l.toString(s||"utf8")}return""},readAsTextAsync:function(i,s,f){var l=_(i);l?l.getDataAsync(function(E,e){if(e){s(E,e);return}E&&E.length?s(E.toString(f||"utf8")):s("")}):s("")},deleteFile:function(i,s=!0){var f=_(i);f&&r.deleteFile(f.entryName,s)},deleteEntry:function(i){var s=_(i);s&&r.deleteEntry(s.entryName)},addZipComment:function(i){r.comment=i},getZipComment:function(){return r.comment||""},addZipEntryComment:function(i,s){var f=_(i);f&&(f.comment=s)},getZipEntryComment:function(i){var s=_(i);return s&&s.comment||""},updateFile:function(i,s){var f=_(i);f&&f.setData(s)},addLocalFile:function(i,s,f,l){if(a.fs.existsSync(i)){s=s?y(s):"";let E=x.win32.basename(x.win32.normalize(i));s+=f||E;let e=a.fs.statSync(i),u=e.isFile()?a.fs.readFileSync(i):Buffer.alloc(0);e.isDirectory()&&(s+=a.sep),this.addFile(s,u,l,e)}else throw B.Errors.FILE_NOT_FOUND(i)},addLocalFileAsync:function(i,s){i=typeof i=="object"?i:{localPath:i};let f=x.resolve(i.localPath),{comment:l}=i,{zipPath:E,zipName:e}=i,u=this;a.fs.stat(f,function(m,D){if(m)return s(m,!1);E=E?y(E):"";let L=x.win32.basename(x.win32.normalize(f));if(E+=e||L,D.isFile())a.fs.readFile(f,function(N,T){return N?s(N,!1):(u.addFile(E,T,l,D),setImmediate(s,void 0,!0))});else if(D.isDirectory())return E+=a.sep,u.addFile(E,Buffer.alloc(0),l,D),setImmediate(s,void 0,!0)})},addLocalFolder:function(i,s,f){if(f=p(f),s=s?y(s):"",i=x.normalize(i),a.fs.existsSync(i)){let l=a.findFiles(i),E=this;if(l.length)for(let e of l){let u=x.join(s,O(i,e));f(u)&&E.addLocalFile(e,x.dirname(u))}}else throw B.Errors.FILE_NOT_FOUND(i)},addLocalFolderAsync:function(i,s,f,l){l=p(l),f=f?y(f):"",i=x.normalize(i);var E=this;a.fs.open(i,"r",function(e){if(e&&e.code==="ENOENT")s(void 0,B.Errors.FILE_NOT_FOUND(i));else if(e)s(void 0,e);else{var u=a.findFiles(i),m=-1,D=function(){if(m+=1,m<u.length){var L=u[m],N=O(i,L).split("\\").join("/");N=N.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),l(N)?a.fs.stat(L,function(T,A){T&&s(void 0,T),A.isFile()?a.fs.readFile(L,function(F,Z){F?s(void 0,F):(E.addFile(f+N,Z,"",A),D())}):(E.addFile(f+N+"/",Buffer.alloc(0),"",A),D())}):process.nextTick(()=>{D()})}else s(!0,void 0)};D()}})},addLocalFolderAsync2:function(i,s){let f=this;i=typeof i=="object"?i:{localPath:i};let l=x.resolve(i.localPath),{zipPath:E,filter:e,namefix:u}=i;e instanceof RegExp?e=(function(L){return function(N){return L.test(N)}})(e):typeof e!="function"&&(e=function(){return!0}),E=E?y(E):"",u==="latin1"&&(u=L=>L.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof u!="function"&&(u=L=>L);let m=L=>x.join(E,u(O(l,L))),D=L=>x.win32.basename(x.win32.normalize(u(L)));a.fs.open(l,"r",function(L){L&&L.code==="ENOENT"?s(B.Errors.FILE_NOT_FOUND(l),!1):L?s(L,!1):a.findFilesAsync(l,function(N,T){if(N)return s(N,!1);if(T=T.filter(A=>e(m(A))),!T.length)return s(void 0,!0);setImmediate(T.reverse().reduce(function(A,F){return function(Z,v){if(Z||v===!1)return setImmediate(A,Z,!1);f.addLocalFileAsync({localPath:F,zipPath:x.dirname(m(F)),zipName:D(F)},A)}},s))})})},addLocalFolderPromise:function(i,s){return new Promise((f,l)=>{this.addLocalFolderAsync2(Object.assign({localPath:i},s),(E,e)=>{if(E)return l(E);e&&f(this)})})},addFile:function(i,s,f,l){i=S(i);let E=_(i),e=E!=null;e||(E=new ke(c),E.entryName=i),E.comment=f||"";let u=typeof l=="object"&&l instanceof a.fs.Stats;u&&(E.header.time=l.mtime);var m=E.isDirectory?16:0;let D=E.isDirectory?16384:32768;return u?D|=4095&l.mode:typeof l=="number"?D|=4095&l:D|=E.isDirectory?493:420,m=(m|D<<16)>>>0,E.attr=m,E.setData(s),e||r.setEntry(E),E},getEntries:function(i){return r.password=i,r?r.entries:[]},getEntry:function(i){return _(i)},getEntryCount:function(){return r.getEntryCount()},forEach:function(i){return r.forEach(i)},extractEntryTo:function(i,s,f,l,E,e){l=X(!1,l),E=X(!1,E),f=X(!0,f),e=ve(E,e);var u=_(i);if(!u)throw B.Errors.NO_ENTRY();var m=I(u.entryName),D=C(s,e&&!u.isDirectory?I(e):f?m:x.basename(m));if(u.isDirectory){var L=r.getEntryChildren(u);return L.forEach(function(A){if(A.isDirectory)return;var F=A.getData();if(!F)throw B.Errors.CANT_EXTRACT_FILE();var Z=I(f?A.entryName:A.entryName.substring(u.entryName.length)),v=C(s,Z);a.assertPathSafe(s,v);let V=E?A.header.fileAttr:void 0;a.writeFileTo(v,F,l,V)}),!0}var N=u.getData(r.password);if(!N)throw B.Errors.CANT_EXTRACT_FILE();if(a.assertPathSafe(s,D),a.fs.existsSync(D)&&!l)throw B.Errors.CANT_OVERRIDE();let T=E?i.header.fileAttr:void 0;return a.writeFileTo(D,N,l,T),!0},test:function(i){if(!r)return!1;for(var s of r.entries)try{if(s.isDirectory)continue;var f=s.getData(i);if(!f)return!1}catch{return!1}return!0},extractAllTo:function(i,s,f,l){if(f=X(!1,f),l=ve(f,l),s=X(!1,s),!r)throw B.Errors.NO_ZIP();let E=[];r.entries.forEach(function(e){var u=C(i,I(e.entryName));if(a.assertPathSafe(i,u),e.isDirectory){a.makeDir(u),f&&E.push({path:u,attr:e.header.fileAttr});return}var m=e.getData(l);if(!m)throw B.Errors.CANT_EXTRACT_FILE();let D=f?e.header.fileAttr:void 0;a.writeFileTo(u,m,s,D);try{a.fs.utimesSync(u,e.header.time,e.header.time)}catch{}}),d(E)},extractAllToAsync:function(i,s,f,l){if(l=tt(s,f,l),f=X(!1,f),s=X(!1,s),!l)return new Promise((N,T)=>{this.extractAllToAsync(i,s,f,function(A){A?T(A):N(this)})});if(!r){l(B.Errors.NO_ZIP());return}i=x.resolve(i);let E=N=>C(i,x.normalize(I(N.entryName))),e=(N,T)=>new Error(N+': "'+T+'"'),u=[],m=[];r.entries.forEach(N=>{N.isDirectory?u.push(N):m.push(N)});let D=[];for(let N of u){let T=E(N),A=f?N.header.fileAttr:void 0;try{a.assertPathSafe(i,T),a.makeDir(T)}catch{l(e("Unable to create folder",T));continue}A&&D.push({path:T,attr:A});try{a.fs.utimesSync(T,N.header.time,N.header.time)}catch{}}let L=N=>{if(!N)try{d(D)}catch(T){return l(e("Unable to set folder permissions",T.path||""))}l(N)};m.reverse().reduce(function(N,T){return function(A){if(A)N(A);else{let F=x.normalize(I(T.entryName)),Z=C(i,F);try{a.assertPathSafe(i,Z)}catch(v){return N(v)}T.getDataAsync(function(v,V){if(V)N(V);else if(!v)N(B.Errors.CANT_EXTRACT_FILE());else{let J=f?T.header.fileAttr:void 0;a.writeFileToAsync(Z,v,s,J,function(K){if(!K)return N(e("Unable to write file",Z));a.fs.utimes(Z,T.header.time,T.header.time,function(){N()})})}})}}},L)()},writeZip:function(i,s){if(arguments.length===1&&typeof i=="function"&&(s=i,i=""),!i&&c.filename&&(i=c.filename),!!i){var f=r.compressToBuffer();if(f){var l=a.writeFileTo(i,f,!0);typeof s=="function"&&s(l?null:new Error("failed"),"")}}},writeZipPromise:function(i,s){let{overwrite:f,perm:l}=Object.assign({overwrite:!0},s);return new Promise((E,e)=>{!i&&c.filename&&(i=c.filename),i||e("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(u=>{let m=D=>D?E(D):e("ADM-ZIP: Wasn't able to write zip file");a.writeFileToAsync(i,u,f,l,m)},e)})},toBufferPromise:function(){return new Promise((i,s)=>{r.toAsyncBuffer(i,s)})},toBuffer:function(i,s,f,l){return typeof i=="function"?(r.toAsyncBuffer(i,s,f,l),null):r.compressToBuffer()}}}});export default rt();
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{c as t}from"./chunk-4YCO7S4K.js";import{a as i}from"./chunk-TEGB7JRM.js";import"./chunk-TMUK2DD3.js";async function l(){let e=await Promise.all(i.map(async n=>await t(n.id)?n.id:null));return new Set(e.filter(n=>n!==null))}export{l as installedExtensionIds};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{p as l}from"./chunk-G2D6BKOS.js";import{d as a}from"./chunk-EOYBXOCV.js";import"./chunk-TMUK2DD3.js";var i={loadPreferences:a,loadShell:()=>import("./launch-WBUFRVQ7.js")};async function p(e=i){let o=e.loadShell();o.catch(()=>{});let{prefs:t,warning:r}=await e.loadPreferences(),n=l(t.theme),{launchShell:s}=await o;await s({prefs:t,palette:n,...r===void 0?{}:{warning:r}})}export{p as bootShell};
|