forge-terminal 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +305 -24
- package/dist/chunks/adm-zip-SQKLKBDP.js +3 -0
- package/dist/chunks/available-2VX7K7W6.js +3 -0
- package/dist/chunks/boot-ODZZHFUI.js +3 -0
- package/dist/chunks/cfb-V6M2PYOD.js +13 -0
- package/dist/chunks/chunk-2WYHI73Y.js +3 -0
- package/dist/chunks/chunk-4YHKTP7I.js +3 -0
- package/dist/chunks/chunk-5PYTOHLZ.js +3 -0
- package/dist/chunks/chunk-7YQR2MVH.js +3 -0
- package/dist/chunks/chunk-DRBA23IQ.js +3 -0
- package/dist/chunks/chunk-EOYBXOCV.js +4 -0
- package/dist/chunks/chunk-FQV57RMH.js +3 -0
- package/dist/chunks/chunk-IMKI5F4I.js +4 -0
- package/dist/chunks/chunk-J7FLFHQJ.js +3 -0
- package/dist/chunks/chunk-L2WK7CJG.js +3 -0
- package/dist/chunks/chunk-LFE3WRU4.js +3 -0
- package/dist/chunks/chunk-MHFY7HF6.js +10 -0
- package/dist/chunks/chunk-PBIS2ONZ.js +3 -0
- package/dist/chunks/chunk-QVACE4IE.js +3 -0
- package/dist/chunks/chunk-TMUK2DD3.js +3 -0
- package/dist/chunks/chunk-UNVHKJW4.js +41 -0
- package/dist/chunks/chunk-V4GHQGQM.js +4 -0
- package/dist/chunks/chunk-VB665HTV.js +3 -0
- package/dist/chunks/chunk-YHK5VE5R.js +3 -0
- package/dist/chunks/colour-QV2C3R7R.js +3 -0
- package/dist/chunks/config-command-UXJY623L.js +3 -0
- package/dist/chunks/dist-J2V6ITHG.js +29 -0
- package/dist/chunks/es-T2U7NBLD.js +3 -0
- package/dist/chunks/execute-4WJCUM7J.js +3 -0
- package/dist/chunks/extensions-command-6WZV2AES.js +3 -0
- package/dist/chunks/launch-2OI4ZLBQ.js +66 -0
- package/dist/chunks/lib-TPEJ5CJJ.js +46 -0
- package/dist/chunks/lock-R6GZXCCW.js +3 -0
- package/dist/chunks/manager-H52ENJOH.js +4 -0
- package/dist/chunks/paths-XY2345OS.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-N3F4EM7E.js +4 -0
- package/dist/chunks/server-5RWSVTOM.js +73 -0
- package/dist/chunks/theme-GW7CQPUO.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 +128 -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.
|
|
44
|
+
# 0.2.0
|
|
45
45
|
|
|
46
46
|
forge photo.jpg --to webp
|
|
47
47
|
```
|
|
@@ -216,6 +216,42 @@ 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
|
+
## Boost resolution and remove background
|
|
220
|
+
|
|
221
|
+
Two image operations that need a model, so they are optional extensions rather
|
|
222
|
+
than part of the install. Both need macOS 14 or later. Nothing downloads until
|
|
223
|
+
you ask:
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
forge extensions # list: installed or not, size, licence
|
|
227
|
+
forge extensions add boost # about 15 MB; Apple Silicon only for now
|
|
228
|
+
forge extensions add remove-background # about 32 KB
|
|
229
|
+
forge extensions remove boost
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
forge photo.jpg --sharpen # photo-sharp.png (the same size, sharper)
|
|
234
|
+
forge photo.jpg --boost # photo-2x.png (2x, the default)
|
|
235
|
+
forge photo.jpg --boost 4 # photo-4x.png
|
|
236
|
+
forge photo.jpg --remove-bg # photo-cutout.png
|
|
237
|
+
forge photo.jpg --remove-bg --to webp
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Output goes beside the source unless `-o` says otherwise. Boost keeps
|
|
241
|
+
transparency, and flattens it onto `--background` only when `--to` names a
|
|
242
|
+
format that cannot carry it. A cutout must be saved in a format that holds
|
|
243
|
+
transparency (PNG, WebP, AVIF, TIFF); JPEG is refused, because flattening would
|
|
244
|
+
undo the cutout. Without the extension installed, either flag stops with
|
|
245
|
+
`extension-missing` and the install command (exit 1). Output more than 16,384
|
|
246
|
+
px on a side, or over 100 MP, is refused before anything runs.
|
|
247
|
+
|
|
248
|
+
`forge probe` lists `boost` / `remove-background` among a file's `actions` only
|
|
249
|
+
while that extension is installed, and `--json` results report `op: "boost"` or
|
|
250
|
+
`op: "remove-background"`. `forge_convert` accepts `sharpen: true`, `boost: 2 | 4` and
|
|
251
|
+
`removeBackground: true`, with the same `extension-missing` tool error.
|
|
252
|
+
|
|
253
|
+
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).
|
|
254
|
+
|
|
219
255
|
## PDF
|
|
220
256
|
|
|
221
257
|
Five page operations, one flag each: merge, split, extract, delete and
|
|
@@ -402,6 +438,8 @@ Forge can **read** a password-protected PDF — probing and `--to jpeg`/`--to
|
|
|
402
438
|
png` both work once it has the password. Page operations (`--merge`,
|
|
403
439
|
`--split`, `--extract`, `--delete`, `--rotate`) refuse an encrypted PDF
|
|
404
440
|
outright: they rewrite the file, and Forge cannot write an encrypted one.
|
|
441
|
+
`forge probe` says so: for an encrypted PDF it lists only the image formats
|
|
442
|
+
as targets and `convert` as the only action.
|
|
405
443
|
|
|
406
444
|
It cannot **remove** a password either; there is no unlock or decrypt-and-resave
|
|
407
445
|
feature, on purpose. The only libraries that can decrypt and rewrite a PDF
|
|
@@ -419,8 +457,8 @@ $ echo -n "hunter2" | forge locked-hunter2.pdf --to png --password-stdin
|
|
|
419
457
|
2.7 KB → 22.4 KB total
|
|
420
458
|
```
|
|
421
459
|
|
|
422
|
-
or leave `--password-stdin` off and Forge prompts on stderr,
|
|
423
|
-
line without echoing it back:
|
|
460
|
+
or, at a terminal, leave `--password-stdin` off and Forge prompts on stderr,
|
|
461
|
+
reading one line without echoing it back:
|
|
424
462
|
|
|
425
463
|
```
|
|
426
464
|
$ forge locked-hunter2.pdf --to jpeg
|
|
@@ -430,8 +468,8 @@ Password:
|
|
|
430
468
|
2.7 KB → 16.6 KB total
|
|
431
469
|
```
|
|
432
470
|
|
|
433
|
-
A wrong password
|
|
434
|
-
|
|
471
|
+
A wrong password is told apart from a missing one, and Forge never echoes the
|
|
472
|
+
attempt itself:
|
|
435
473
|
|
|
436
474
|
```
|
|
437
475
|
$ echo -n "wrongpass" | forge locked-hunter2.pdf --to png --password-stdin
|
|
@@ -439,9 +477,14 @@ $ echo -n "wrongpass" | forge locked-hunter2.pdf --to png --password-stdin
|
|
|
439
477
|
|
|
440
478
|
locked-hunter2.pdf is password-protected.
|
|
441
479
|
|
|
442
|
-
|
|
480
|
+
That password didn't open it. Check it and try again.
|
|
443
481
|
```
|
|
444
482
|
|
|
483
|
+
`--password-stdin` reads one line, so a pipe that stays open after sending
|
|
484
|
+
the password does not hold Forge up. Without a terminal (piped, scripted, or
|
|
485
|
+
driven by an agent) Forge never prompts: an encrypted PDF without
|
|
486
|
+
`--password-stdin` fails at once with exit 1.
|
|
487
|
+
|
|
445
488
|
### In the shell
|
|
446
489
|
|
|
447
490
|
`/pdf` needs at least one staged PDF (drop a file, then drop another to
|
|
@@ -467,15 +510,86 @@ multi-page render has a real count to report against.
|
|
|
467
510
|
|
|
468
511
|
### Not yet
|
|
469
512
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
513
|
+
PDF↔image conversion, reading a password-protected PDF (see [PDF →
|
|
514
|
+
image](#pdf--image) and [Encrypted PDFs](#encrypted-pdfs) above — including
|
|
515
|
+
in the shell), and compressing a PDF that holds images (`forge scan.pdf
|
|
516
|
+
--max-size 2mb`) all work. A PDF that is only text and layout has nothing
|
|
517
|
+
compression can shrink, and Forge says so. Still not implemented: Markdown,
|
|
518
|
+
HTML and Office conversion beyond Word. Removing a password from a PDF is not
|
|
519
|
+
planned at all — see [Encrypted PDFs](#encrypted-pdfs) for why. Separately,
|
|
520
|
+
and not specific to PDFs: the shell refuses to convert or compress several
|
|
521
|
+
staged files at once today — that's a deliberate limit while batch handling
|
|
522
|
+
through the shell is still unbuilt, not a bug.
|
|
523
|
+
|
|
524
|
+
## Colour
|
|
525
|
+
|
|
526
|
+
Two things for designers: an image's palette, and a tonal scale from one
|
|
527
|
+
colour. Both are in the shell as its fourth mode, and on the command line.
|
|
528
|
+
|
|
529
|
+
### In the shell
|
|
530
|
+
|
|
531
|
+
Press **4** (or type `/colour`). Home shows two cards, **Palette** and
|
|
532
|
+
**Scale**. Choose one with ←→ and open it with ↵. You can also drop an image
|
|
533
|
+
straight onto colour's home, or press `#` to type a colour.
|
|
534
|
+
|
|
535
|
+
- **Palette.** Drop an image, or type its path into the field at the top. The
|
|
536
|
+
photo is drawn in its own colours next to the list, with each colour's share
|
|
537
|
+
of the image.
|
|
538
|
+
- ↑↓ choose a colour; it stays lit in the photo and the rest dim.
|
|
539
|
+
- → goes inside a colour: its shades, lit where they are in the photo.
|
|
540
|
+
← comes back.
|
|
541
|
+
- `s` makes a scale from the chosen colour.
|
|
542
|
+
- **Scale.** Type a hex code. You get 50–950 with your colour at 500, and a
|
|
543
|
+
preview of the chosen step: "Aa" in white and black, with each rated
|
|
544
|
+
(AAA, AA, large, fails).
|
|
545
|
+
- ←→ choose a step.
|
|
546
|
+
- `r` makes that step the new centre and rebuilds the scale around it.
|
|
547
|
+
- `#` types a new colour.
|
|
548
|
+
|
|
549
|
+
On both screens, ↵ copies the chosen hex and `c` copies the whole set. Paste
|
|
550
|
+
it into Figma with ⌘V: you get real shapes and text layers, named
|
|
551
|
+
`blue-500` and so on. esc goes back one step, and the bar at the top shows
|
|
552
|
+
the way back. Under `NO_COLOR`, both screens are plain text with every key
|
|
553
|
+
still working.
|
|
554
|
+
|
|
555
|
+
### On the command line
|
|
556
|
+
|
|
557
|
+
```
|
|
558
|
+
$ forge palette photo.jpg
|
|
559
|
+
#B897E4 16%
|
|
560
|
+
#86B627 16%
|
|
561
|
+
#256129 14%
|
|
562
|
+
…
|
|
563
|
+
$ forge palette photo.jpg --inside F96363 # the shades one colour is made of
|
|
564
|
+
#FF665A 63%
|
|
565
|
+
#F35949 15%
|
|
566
|
+
#E58A9F 14%
|
|
567
|
+
#BE5C38 8%
|
|
568
|
+
$ forge scale 6579FD
|
|
569
|
+
50 #F4F6FF white 1.0 fails · black 19.4 AAA
|
|
570
|
+
…
|
|
571
|
+
500 #6579FD white 3.6 large · black 5.7 AA
|
|
572
|
+
…
|
|
573
|
+
950 #161B58 white 15.7 AAA · black 1.3 fails
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
- **`forge palette <image>`** gives an image's main colours, most of the image
|
|
577
|
+
first. Each one is a real pixel from the image, not an average, and the
|
|
578
|
+
percentages add up to 100. The image is probed by content, so a PDF named
|
|
579
|
+
`.png` is refused as not an image.
|
|
580
|
+
- **`forge scale <colour>`** gives 50–950 built in OKLCH, with your colour
|
|
581
|
+
exactly at 500. Each step is rated for white and black text (WCAG: AAA, AA,
|
|
582
|
+
large, fails). Ratios are rounded down, so 4.48:1 shows as `4.4 large` and
|
|
583
|
+
is never passed off as AA. Pass the colour without the `#`, or quote it (`'#6579FD'`):
|
|
584
|
+
an unquoted `#` starts a comment in the shell.
|
|
585
|
+
- **`--svg`** prints a card of swatches. Pipe it to `pbcopy` and press ⌘V in
|
|
586
|
+
Figma to get real shapes and text layers: `forge scale 6579FD --svg | pbcopy`.
|
|
587
|
+
- **`--json`** returns `palette` (`source`, `colours[]` with `hex`, `rgb`,
|
|
588
|
+
`oklch`, `share`) or `scale` (`reference`, `steps[]` with `step`, `hex`,
|
|
589
|
+
`oklch`, `white`, `black`).
|
|
590
|
+
|
|
591
|
+
On a colour terminal each row starts with a swatch. Piped, or under
|
|
592
|
+
`NO_COLOR`, the rows are plain text.
|
|
479
593
|
|
|
480
594
|
## Usage
|
|
481
595
|
|
|
@@ -589,8 +703,9 @@ deep, unless you pass `--recursive`):
|
|
|
589
703
|
$ forge photos --to webp -o ./out/
|
|
590
704
|
✓ 3 converted
|
|
591
705
|
6.2 KB → 1.9 KB · 69.6% smaller
|
|
592
|
-
|
|
593
|
-
|
|
706
|
+
out/photo1.webp
|
|
707
|
+
out/photo2.webp
|
|
708
|
+
out/photo3.webp
|
|
594
709
|
```
|
|
595
710
|
|
|
596
711
|
With `--recursive`, the source tree is recreated under the output directory
|
|
@@ -600,8 +715,10 @@ instead of being flattened:
|
|
|
600
715
|
$ forge photos --to png -o ./t/ --recursive
|
|
601
716
|
✓ 4 converted
|
|
602
717
|
8.3 KB → 1.7 KB · 80% smaller
|
|
603
|
-
|
|
604
|
-
|
|
718
|
+
t/photo1.png
|
|
719
|
+
t/photo2.png
|
|
720
|
+
t/photo3.png
|
|
721
|
+
t/sub/deeper/bottom.png
|
|
605
722
|
```
|
|
606
723
|
|
|
607
724
|
```
|
|
@@ -650,6 +767,163 @@ $ echo $?
|
|
|
650
767
|
2
|
|
651
768
|
```
|
|
652
769
|
|
|
770
|
+
## Use with AI agents
|
|
771
|
+
|
|
772
|
+
Tell an agent *"take this image and use Forge on it"* and it can: Forge is
|
|
773
|
+
local, private, and built to be driven without a person at the keyboard.
|
|
774
|
+
|
|
775
|
+
### As an MCP server
|
|
776
|
+
|
|
777
|
+
```bash
|
|
778
|
+
claude mcp add forge -- forge mcp # Claude Code
|
|
779
|
+
codex mcp add forge -- forge mcp # Codex / ChatGPT desktop's Codex
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
Claude Desktop and Cursor:
|
|
783
|
+
|
|
784
|
+
```json
|
|
785
|
+
{ "mcpServers": { "forge": { "command": "forge", "args": ["mcp"] } } }
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
Seven tools, deliberately few:
|
|
789
|
+
|
|
790
|
+
| Tool | Does |
|
|
791
|
+
| --- | --- |
|
|
792
|
+
| `forge_probe` | what files are and what Forge can do with them |
|
|
793
|
+
| `forge_formats` | the capability matrix |
|
|
794
|
+
| `forge_convert` | convert to a target format (`quality`, `dpi`, `pages`, `background`, `password`, `overwrite`; images also `sharpen`, `boost: 2 \| 4` and `removeBackground`, which need the optional extensions) |
|
|
795
|
+
| `forge_compress` | compress by `quality` or to a `maxSize` (also `dpi` for PDFs, `output`, `overwrite`; no `password`: compression refuses encrypted PDFs) |
|
|
796
|
+
| `forge_pdf` | `merge`, `split`, `extract`, `delete`, `rotate` |
|
|
797
|
+
| `forge_palette` | an image's main colours with their shares; `inside` gives one colour's shades (read-only) |
|
|
798
|
+
| `forge_scale` | a 50–950 tonal scale with the colour at 500, rated for white and black text (read-only) |
|
|
799
|
+
|
|
800
|
+
Paths must be absolute. Results come back as structured content in the
|
|
801
|
+
`--json` shape below, with a `file://` link to every output, and never as
|
|
802
|
+
file contents. Nothing is overwritten unless the call passes
|
|
803
|
+
`overwrite: true`. An encrypted PDF takes a `password` argument to
|
|
804
|
+
`forge_convert`; there is no prompt. The server speaks MCP over stdio,
|
|
805
|
+
negotiates protocol revision 2025-11-25 with current Claude Code, writes
|
|
806
|
+
nothing but protocol messages to stdout, and exits when its client closes
|
|
807
|
+
stdin.
|
|
808
|
+
|
|
809
|
+
**Limitation:** an image pasted into a chat app is not a file on disk, so a
|
|
810
|
+
path-based tool cannot see it. Agents with file access (Claude Code, Cursor,
|
|
811
|
+
Codex) are the natural fit.
|
|
812
|
+
|
|
813
|
+
### As a CLI, with the skill
|
|
814
|
+
|
|
815
|
+
[`skills/forge/SKILL.md`](skills/forge/SKILL.md) teaches an agent with a
|
|
816
|
+
shell to probe before converting, pass `--json`, read exit codes, and never
|
|
817
|
+
pass `--force` unless asked. For Claude Code, copy it to
|
|
818
|
+
`~/.claude/skills/forge/SKILL.md`. It ships in the npm package: after
|
|
819
|
+
`npm install -g forge-terminal` it is at
|
|
820
|
+
`$(npm root -g)/forge-terminal/skills/forge/SKILL.md`.
|
|
821
|
+
|
|
822
|
+
### `forge probe`
|
|
823
|
+
|
|
824
|
+
```
|
|
825
|
+
$ forge probe locked.pdf photo.png
|
|
826
|
+
locked.pdf · PDF · 2.7 KB · 3 pages · password-protected
|
|
827
|
+
converts to jpeg, png, pdf, docx
|
|
828
|
+
actions convert, split, extract, delete, rotate
|
|
829
|
+
|
|
830
|
+
photo.png · PNG · 122 KB · 2756×774
|
|
831
|
+
converts to jpeg, png, webp, avif, gif, tiff, pdf
|
|
832
|
+
actions convert
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
With `--json`:
|
|
836
|
+
|
|
837
|
+
```json
|
|
838
|
+
{"forge":"0.2.0","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":[]}
|
|
839
|
+
```
|
|
840
|
+
|
|
841
|
+
`targets` and `actions` come from the engines' own capabilities, so they are
|
|
842
|
+
always true for that file. `format` is read from the file's content, not its
|
|
843
|
+
name. `actions` lists `convert` plus what else applies: `compress`,
|
|
844
|
+
`split`, `extract`, `delete`, `rotate`; `merge` appears only when several
|
|
845
|
+
PDFs are probed together. `compress` appears when quality or size can be
|
|
846
|
+
reduced: lossy images, and PDFs that contain compressible images (a PNG has
|
|
847
|
+
only `convert`). Run it as `--quality N` or `--max-size S` without `--to`;
|
|
848
|
+
its `--json` result reports `op: "convert"`. The encrypted PDF above omits
|
|
849
|
+
`compress` and `merge`; a plain PDF with images would also list `compress`.
|
|
850
|
+
A probe has `width`/`height` for an image,
|
|
851
|
+
`pages` and `encrypted` for a PDF. Probing writes nothing. A file that cannot
|
|
852
|
+
be probed goes in `failures` and does not stop the others.
|
|
853
|
+
|
|
854
|
+
### `--json`
|
|
855
|
+
|
|
856
|
+
Every command accepts `--json`. stdout then carries exactly one JSON document
|
|
857
|
+
on one line, and nothing else: no colour, no glyphs, no progress. Every
|
|
858
|
+
document has `forge` (the version), `ok` (true only if every input
|
|
859
|
+
succeeded) and `failures`. A conversion, compression or page operation adds
|
|
860
|
+
`results`:
|
|
861
|
+
|
|
862
|
+
```jsonc
|
|
863
|
+
{
|
|
864
|
+
"forge": "0.2.0",
|
|
865
|
+
"ok": false,
|
|
866
|
+
"results": [
|
|
867
|
+
{
|
|
868
|
+
"op": "convert", // convert | merge | split | extract | delete | rotate
|
|
869
|
+
"source": "/abs/photo.heic", // = sources[0]
|
|
870
|
+
"sources": ["/abs/photo.heic"], // all of them, for a merge
|
|
871
|
+
"outputs": ["/abs/photo.webp"], // always absolute, always every file written
|
|
872
|
+
"inputBytes": 52074,
|
|
873
|
+
"outputBytes": 42684,
|
|
874
|
+
"warnings": [{ "code": "animation-flattened", "message": "…" }]
|
|
875
|
+
}
|
|
876
|
+
],
|
|
877
|
+
"failures": [
|
|
878
|
+
{
|
|
879
|
+
"path": "/abs/locked.pdf", // absent for a command-level error
|
|
880
|
+
"code": "encrypted-source", // a stable ErrorCode
|
|
881
|
+
"title": "…", "detail": "…", "hint": "…"
|
|
882
|
+
}
|
|
883
|
+
]
|
|
884
|
+
}
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
`--formats --json` returns `formats` (`id`, `label`, `extensions`, `read`,
|
|
888
|
+
`write`, `lossy`). `forge probe --json` returns `probes`. `forge palette
|
|
889
|
+
--json` returns `palette`, and `forge scale --json` returns `scale` (see
|
|
890
|
+
[Colour](#colour)). `forge config
|
|
891
|
+
--json` returns `config` and `warnings`. An argument error is a document with
|
|
892
|
+
one `invalid-arguments` failure and exit code 2. Fields are not renamed or
|
|
893
|
+
removed within a minor version; the `forge` field says which version you are
|
|
894
|
+
reading. `--help` and `--version` print text even with `--json`.
|
|
895
|
+
|
|
896
|
+
### Exit codes
|
|
897
|
+
|
|
898
|
+
| Code | Meaning |
|
|
899
|
+
| --- | --- |
|
|
900
|
+
| 0 | Every input succeeded |
|
|
901
|
+
| 1 | The command was understood, and at least one input failed or was refused |
|
|
902
|
+
| 2 | The command itself was invalid: an unknown flag, a missing argument, contradictory flags |
|
|
903
|
+
|
|
904
|
+
If the same flags could succeed on a different file, it's 1; otherwise it's 2.
|
|
905
|
+
The table is also in `forge --help`.
|
|
906
|
+
|
|
907
|
+
### No terminal, no prompt
|
|
908
|
+
|
|
909
|
+
Without a TTY, Forge never waits for input. An encrypted PDF without
|
|
910
|
+
`--password-stdin` fails at once (exit 1), and `--password-stdin` reads a
|
|
911
|
+
single line, so a pipe left open by the caller does not hold it up.
|
|
912
|
+
|
|
913
|
+
### By hand, before a release
|
|
914
|
+
|
|
915
|
+
Registering a server in a real agent config is a human step, so it is not
|
|
916
|
+
part of the test suite:
|
|
917
|
+
|
|
918
|
+
1. `npm run build && npm link`, then `claude mcp add forge -- forge mcp`. In
|
|
919
|
+
Claude Code: "convert ~/Desktop/x.heic to jpeg", "compress it to 200kb",
|
|
920
|
+
"split ~/Desktop/doc.pdf into pages". Each must succeed and name its
|
|
921
|
+
outputs. `/mcp` should show the server connected.
|
|
922
|
+
2. Repeat in Claude Desktop with the `mcpServers` snippet above, and record
|
|
923
|
+
which protocol revision it negotiates (its MCP log shows the `initialize`
|
|
924
|
+
exchange).
|
|
925
|
+
3. If either client cannot connect, read its MCP log before changing code.
|
|
926
|
+
|
|
653
927
|
## Interactive shell
|
|
654
928
|
|
|
655
929
|
Ink/React are only loaded (via a dynamic `import()`) once the TTY check
|
|
@@ -903,7 +1177,8 @@ src/
|
|
|
903
1177
|
│ ├── run.ts bounded-concurrency batch runner, emits events
|
|
904
1178
|
│ ├── output-path.ts output path resolution (the table above)
|
|
905
1179
|
│ ├── units.ts byte / percentage formatting
|
|
906
|
-
│
|
|
1180
|
+
│ ├── errors.ts ForgeError taxonomy and rendering
|
|
1181
|
+
│ └── colour/ OKLab/OKLCH, contrast, palette (k-means), scale, the Figma card
|
|
907
1182
|
│
|
|
908
1183
|
├── engines/
|
|
909
1184
|
│ ├── types.ts Engine interface (reads, writes, probe, convert)
|
|
@@ -912,9 +1187,15 @@ src/
|
|
|
912
1187
|
│
|
|
913
1188
|
├── cli/
|
|
914
1189
|
│ ├── args.ts Commander wiring → Intent
|
|
915
|
-
│ ├── execute.ts
|
|
1190
|
+
│ ├── execute.ts runIntent() → RunReport (data); execute() renders text or --json
|
|
916
1191
|
│ └── report.ts stdout formatting (success, batch, errors, --formats)
|
|
917
1192
|
│
|
|
1193
|
+
├── mcp/ the MCP server — a third front end, loaded only by `forge mcp`
|
|
1194
|
+
│ ├── server.ts createForgeServer(): seven tools; runMcpServer(): stdio
|
|
1195
|
+
│ ├── tools.ts tool handlers → the same intents and runIntent() the CLI uses
|
|
1196
|
+
│ ├── schemas.ts zod input/output schemas, vocabularies read from core/actions
|
|
1197
|
+
│ └── stdout-guard.ts stdout belongs to the protocol; stray writes go to stderr
|
|
1198
|
+
│
|
|
918
1199
|
├── shell/ the interactive shell (Ink + React) — the only place
|
|
919
1200
|
│ │ that renders to a real terminal frame by frame
|
|
920
1201
|
│ ├── App.tsx the state machine: file → target → quality →
|
|
@@ -959,7 +1240,7 @@ dynamically imports `shell/launch.js` and hands off to it instead.
|
|
|
959
1240
|
|
|
960
1241
|
```bash
|
|
961
1242
|
npm run dev # run from source with tsx, no build step
|
|
962
|
-
npm run build #
|
|
1243
|
+
npm run build # one esbuild bundle → dist/ (scripts/build.mjs)
|
|
963
1244
|
npm run typecheck # tsc --noEmit over src + tests
|
|
964
1245
|
npm run lint # biome check src tests
|
|
965
1246
|
npm run format # biome format --write src tests
|
|
@@ -976,7 +1257,7 @@ npm test # vitest run
|
|
|
976
1257
|
npm run test:watch
|
|
977
1258
|
```
|
|
978
1259
|
|
|
979
|
-
|
|
1260
|
+
1413 tests (4 skipped), all passing. Fixtures (transparent PNGs, EXIF-rotated JPEGs,
|
|
980
1261
|
animated GIFs, HEIC/AVIF samples) are generated by Sharp — or, for HEIC,
|
|
981
1262
|
`sips` — at test time, never committed as binaries; the one exception is
|
|
982
1263
|
`tests/fixtures/locked-hunter2.pdf`, a real encrypted PDF (password
|
|
@@ -1026,7 +1307,7 @@ Not yet built, in rough order:
|
|
|
1026
1307
|
`Engine` interface `image.ts` and the PDF engine already implement, so the
|
|
1027
1308
|
CLI and format menu won't need to change to support it. The PDF engine
|
|
1028
1309
|
itself now covers page operations and PDF↔image (see [PDF](#pdf) above);
|
|
1029
|
-
|
|
1310
|
+
splitting a PDF to a target size is still to come.
|
|
1030
1311
|
|
|
1031
1312
|
Explicitly out of scope for 0.1: HEIC encoding (the underlying library
|
|
1032
1313
|
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{a as i,e as t}from"./chunk-5PYTOHLZ.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{m as l}from"./chunk-V4GHQGQM.js";import{d as a}from"./chunk-EOYBXOCV.js";import"./chunk-TMUK2DD3.js";var i={loadPreferences:a,loadShell:()=>import("./launch-2OI4ZLBQ.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};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a as Mr,c as Le}from"./chunk-TMUK2DD3.js";var Ve=Le((Xe,Lr)=>{var V="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Qr(o){for(var c="",d=0,C=0,y=0,z=0,M=0,L=0,D=0,U=0;U<o.length;)d=o.charCodeAt(U++),z=d>>2,C=o.charCodeAt(U++),M=(d&3)<<4|C>>4,y=o.charCodeAt(U++),L=(C&15)<<2|y>>6,D=y&63,isNaN(C)?L=D=64:isNaN(y)&&(D=64),c+=V.charAt(z)+V.charAt(M)+V.charAt(L)+V.charAt(D);return c}function br(o){var c="",d=0,C=0,y=0,z=0,M=0,L=0,D=0;o=o.replace(/[^\w\+\/\=]/g,"");for(var U=0;U<o.length;)z=V.indexOf(o.charAt(U++)),M=V.indexOf(o.charAt(U++)),d=z<<2|M>>4,c+=String.fromCharCode(d),L=V.indexOf(o.charAt(U++)),C=(M&15)<<4|L>>2,L!==64&&(c+=String.fromCharCode(C)),D=V.indexOf(o.charAt(U++)),y=(L&3)<<6|D,D!==64&&(c+=String.fromCharCode(y));return c}var O=(function(){return typeof Buffer<"u"&&typeof process<"u"&&typeof process.versions<"u"&&!!process.versions.node})(),Nr=(function(){if(typeof Buffer<"u"){var o=!Buffer.from;if(!o)try{Buffer.from("foo","utf8")}catch{o=!0}return o?function(c,d){return d?new Buffer(c,d):new Buffer(c)}:Buffer.from.bind(Buffer)}return function(){}})();function ie(o){if(O){if(Buffer.alloc)return Buffer.alloc(o);var c=new Buffer(o);return c.fill(0),c}return typeof Uint8Array<"u"?new Uint8Array(o):new Array(o)}function re(o){return O?Buffer.allocUnsafe?Buffer.allocUnsafe(o):new Buffer(o):typeof Uint8Array<"u"?new Uint8Array(o):new Array(o)}var W=function(c){return O?Nr(c,"binary"):c.split("").map(function(d){return d.charCodeAt(0)&255})},ar=/\u0000/g,_r=/[\u0001-\u0006]/g,wr=function(o){for(var c=[],d=0;d<o[0].length;++d)c.push.apply(c,o[0][d]);return c},Ne=wr,Or=function(o,c,d){for(var C=[],y=c;y<d;y+=2)C.push(String.fromCharCode(ae(o,y)));return C.join("").replace(ar,"")},Oe=Or,Fr=function(o,c,d){for(var C=[],y=c;y<c+d;++y)C.push(("0"+o[y].toString(16)).slice(-2));return C.join("")},ze=Fr,ne=function(o){if(Array.isArray(o[0]))return[].concat.apply([],o);var c=0,d=0;for(d=0;d<o.length;++d)c+=o[d].length;var C=new Uint8Array(c);for(d=0,c=0;d<o.length;c+=o[d].length,++d)C.set(o[d],c);return C},K=ne;O&&(Or=function(o,c,d){return Buffer.isBuffer(o)?o.toString("utf16le",c,d).replace(ar,""):Oe(o,c,d)},Fr=function(o,c,d){return Buffer.isBuffer(o)?o.toString("hex",c,c+d):ze(o,c,d)},wr=function(o){return o[0].length>0&&Buffer.isBuffer(o[0][0])?Buffer.concat(o[0]):Ne(o)},W=function(o){return Nr(o,"binary")},K=function(o){return Buffer.isBuffer(o[0])?Buffer.concat(o):ne(o)});var He=function(o,c){return o[c]},ae=function(o,c){return o[c+1]*256+o[c]},je=function(o,c){var d=o[c+1]*256+o[c];return d<32768?d:(65535-d+1)*-1},ee=function(o,c){return o[c+3]*(1<<24)+(o[c+2]<<16)+(o[c+1]<<8)+o[c]},Q=function(o,c){return(o[c+3]<<24)+(o[c+2]<<16)+(o[c+1]<<8)+o[c]};function fe(o,c){var d,C,y=0;switch(o){case 1:d=He(this,this.l);break;case 2:d=(c!=="i"?ae:je)(this,this.l);break;case 4:d=Q(this,this.l);break;case 16:y=2,C=Fr(this,this.l,o)}return this.l+=o,y===0?d:C}var $e=function(o,c,d){o[d]=c&255,o[d+1]=c>>>8&255,o[d+2]=c>>>16&255,o[d+3]=c>>>24&255},Ge=function(o,c,d){o[d]=c&255,o[d+1]=c>>8&255,o[d+2]=c>>16&255,o[d+3]=c>>24&255};function Je(o,c,d){var C=0,y=0;switch(d){case"hex":for(;y<o;++y)this[this.l++]=parseInt(c.slice(2*y,2*y+2),16)||0;return this;case"utf16le":var z=this.l+o;for(y=0;y<Math.min(c.length,o);++y){var M=c.charCodeAt(y);this[this.l++]=M&255,this[this.l++]=M>>8}for(;this.l<z;)this[this.l++]=0;return this}switch(o){case 1:C=1,this[this.l]=c&255;break;case 2:C=2,this[this.l]=c&255,c>>>=8,this[this.l+1]=c&255;break;case 4:C=4,$e(this,c,this.l);break;case-4:C=4,Ge(this,c,this.l);break}return this.l+=C,this}function se(o,c){var d=Fr(this,this.l,o.length>>1);if(d!==o)throw new Error(c+"Expected "+o+" saw "+d);this.l+=o.length>>1}function J(o,c){o.l=c,o.read_shift=fe,o.chk=se,o.write_shift=Je}function j(o){var c=ie(o);return J(c,0),c}var te=(function(){var o={};o.version="1.2.1";function c(){for(var x=0,P=new Array(256),p=0;p!=256;++p)x=p,x=x&1?-306674912^x>>>1:x>>>1,x=x&1?-306674912^x>>>1:x>>>1,x=x&1?-306674912^x>>>1:x>>>1,x=x&1?-306674912^x>>>1:x>>>1,x=x&1?-306674912^x>>>1:x>>>1,x=x&1?-306674912^x>>>1:x>>>1,x=x&1?-306674912^x>>>1:x>>>1,x=x&1?-306674912^x>>>1:x>>>1,P[p]=x;return typeof Int32Array<"u"?new Int32Array(P):P}var d=c();function C(x){var P=0,p=0,A=0,I=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(A=0;A!=256;++A)I[A]=x[A];for(A=0;A!=256;++A)for(p=x[A],P=256+A;P<4096;P+=256)p=I[P]=p>>>8^x[p&255];var S=[];for(A=1;A!=16;++A)S[A-1]=typeof Int32Array<"u"?I.subarray(A*256,A*256+256):I.slice(A*256,A*256+256);return S}var y=C(d),z=y[0],M=y[1],L=y[2],D=y[3],U=y[4],X=y[5],dr=y[6],xr=y[7],gr=y[8],pr=y[9],yr=y[10],fr=y[11],mr=y[12],Cr=y[13],Ar=y[14];function sr(x,P){for(var p=P^-1,A=0,I=x.length;A<I;)p=p>>>8^d[(p^x.charCodeAt(A++))&255];return~p}function Ir(x,P){for(var p=P^-1,A=x.length-15,I=0;I<A;)p=Ar[x[I++]^p&255]^Cr[x[I++]^p>>8&255]^mr[x[I++]^p>>16&255]^fr[x[I++]^p>>>24]^yr[x[I++]]^pr[x[I++]]^gr[x[I++]]^xr[x[I++]]^dr[x[I++]]^X[x[I++]]^U[x[I++]]^D[x[I++]]^L[x[I++]]^M[x[I++]]^z[x[I++]]^d[x[I++]];for(A+=15;I<A;)p=p>>>8^d[(p^x[I++])&255];return~p}function Er(x,P){for(var p=P^-1,A=0,I=x.length,S=0,R=0;A<I;)S=x.charCodeAt(A++),S<128?p=p>>>8^d[(p^S)&255]:S<2048?(p=p>>>8^d[(p^(192|S>>6&31))&255],p=p>>>8^d[(p^(128|S&63))&255]):S>=55296&&S<57344?(S=(S&1023)+64,R=x.charCodeAt(A++)&1023,p=p>>>8^d[(p^(240|S>>8&7))&255],p=p>>>8^d[(p^(128|S>>2&63))&255],p=p>>>8^d[(p^(128|R>>6&15|(S&3)<<4))&255],p=p>>>8^d[(p^(128|R&63))&255]):(p=p>>>8^d[(p^(224|S>>12&15))&255],p=p>>>8^d[(p^(128|S>>6&63))&255],p=p>>>8^d[(p^(128|S&63))&255]);return~p}return o.table=d,o.bstr=sr,o.buf=Ir,o.str=Er,o})(),b=(function(){var c={};c.version="1.2.2";function d(r,i){for(var e=r.split("/"),t=i.split("/"),n=0,a=0,s=Math.min(e.length,t.length);n<s;++n){if(a=e[n].length-t[n].length)return a;if(e[n]!=t[n])return e[n]<t[n]?-1:1}return e.length-t.length}function C(r){if(r.charAt(r.length-1)=="/")return r.slice(0,-1).indexOf("/")===-1?r:C(r.slice(0,-1));var i=r.lastIndexOf("/");return i===-1?r:r.slice(0,i+1)}function y(r){if(r.charAt(r.length-1)=="/")return y(r.slice(0,-1));var i=r.lastIndexOf("/");return i===-1?r:r.slice(i+1)}function z(r,i){typeof i=="string"&&(i=new Date(i));var e=i.getHours();e=e<<6|i.getMinutes(),e=e<<5|i.getSeconds()>>>1,r.write_shift(2,e);var t=i.getFullYear()-1980;t=t<<4|i.getMonth()+1,t=t<<5|i.getDate(),r.write_shift(2,t)}function M(r){var i=r.read_shift(2)&65535,e=r.read_shift(2)&65535,t=new Date,n=e&31;e>>>=5;var a=e&15;e>>>=4,t.setMilliseconds(0),t.setFullYear(e+1980),t.setMonth(a-1),t.setDate(n);var s=i&31;i>>>=5;var u=i&63;return i>>>=6,t.setHours(i),t.setMinutes(u),t.setSeconds(s<<1),t}function L(r){J(r,0);for(var i={},e=0;r.l<=r.length-4;){var t=r.read_shift(2),n=r.read_shift(2),a=r.l+n,s={};t===21589&&(e=r.read_shift(1),e&1&&(s.mtime=r.read_shift(4)),n>5&&(e&2&&(s.atime=r.read_shift(4)),e&4&&(s.ctime=r.read_shift(4))),s.mtime&&(s.mt=new Date(s.mtime*1e3))),r.l=a,i[t]=s}return i}var D;function U(){return D||(D=Mr("fs"))}function X(r,i){if(r[0]==80&&r[1]==75)return Kr(r,i);if((r[0]|32)==109&&(r[1]|32)==105)return Te(r,i);if(r.length<512)throw new Error("CFB file size "+r.length+" < 512");var e=3,t=512,n=0,a=0,s=0,u=0,f=0,h=[],l=r.slice(0,512);J(l,0);var v=dr(l);switch(e=v[0],e){case 3:t=512;break;case 4:t=4096;break;case 0:if(v[1]==0)return Kr(r,i);default:throw new Error("Major Version: Expected 3 or 4 saw "+e)}t!==512&&(l=r.slice(0,t),J(l,28));var _=r.slice(0,t);xr(l,e);var g=l.read_shift(4,"i");if(e===3&&g!==0)throw new Error("# Directory Sectors: Expected 0 saw "+g);l.l+=4,s=l.read_shift(4,"i"),l.l+=4,l.chk("00100000","Mini Stream Cutoff Size: "),u=l.read_shift(4,"i"),n=l.read_shift(4,"i"),f=l.read_shift(4,"i"),a=l.read_shift(4,"i");for(var w=-1,F=0;F<109&&(w=l.read_shift(4,"i"),!(w<0));++F)h[F]=w;var m=gr(r,t);fr(f,a,m,t,h);var E=Cr(m,s,h,t);E[s].name="!Directory",n>0&&u!==R&&(E[u].name="!MiniFAT"),E[h[0]].name="!FAT",E.fat_addrs=h,E.ssz=t;var T={},k=[],N=[],ir=[];Ar(s,E,m,k,n,T,N,u),pr(N,ir,k),k.shift();var nr={FileIndex:N,FullPaths:ir};return i&&i.raw&&(nr.raw={header:_,sectors:m}),nr}function dr(r){if(r[r.l]==80&&r[r.l+1]==75)return[0,0];r.chk(zr,"Header Signature: "),r.l+=16;var i=r.read_shift(2,"u");return[r.read_shift(2,"u"),i]}function xr(r,i){var e=9;switch(r.l+=2,e=r.read_shift(2)){case 9:if(i!=3)throw new Error("Sector Shift: Expected 9 saw "+e);break;case 12:if(i!=4)throw new Error("Sector Shift: Expected 12 saw "+e);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+e)}r.chk("0600","Mini Sector Shift: "),r.chk("000000000000","Reserved: ")}function gr(r,i){for(var e=Math.ceil(r.length/i)-1,t=[],n=1;n<e;++n)t[n-1]=r.slice(n*i,(n+1)*i);return t[e-1]=r.slice(e*i),t}function pr(r,i,e){for(var t=0,n=0,a=0,s=0,u=0,f=e.length,h=[],l=[];t<f;++t)h[t]=l[t]=t,i[t]=e[t];for(;u<l.length;++u)t=l[u],n=r[t].L,a=r[t].R,s=r[t].C,h[t]===t&&(n!==-1&&h[n]!==n&&(h[t]=h[n]),a!==-1&&h[a]!==a&&(h[t]=h[a])),s!==-1&&(h[s]=t),n!==-1&&t!=h[t]&&(h[n]=h[t],l.lastIndexOf(n)<u&&l.push(n)),a!==-1&&t!=h[t]&&(h[a]=h[t],l.lastIndexOf(a)<u&&l.push(a));for(t=1;t<f;++t)h[t]===t&&(a!==-1&&h[a]!==a?h[t]=h[a]:n!==-1&&h[n]!==n&&(h[t]=h[n]));for(t=1;t<f;++t)if(r[t].type!==0){if(u=t,u!=h[u])do u=h[u],i[t]=i[u]+"/"+i[t];while(u!==0&&h[u]!==-1&&u!=h[u]);h[t]=-1}for(i[0]+="/",t=1;t<f;++t)r[t].type!==2&&(i[t]+="/")}function yr(r,i,e){for(var t=r.start,n=r.size,a=[],s=t;e&&n>0&&s>=0;)a.push(i.slice(s*S,s*S+S)),n-=S,s=Q(e,s*4);return a.length===0?j(0):K(a).slice(0,r.size)}function fr(r,i,e,t,n){var a=R;if(r===R){if(i!==0)throw new Error("DIFAT chain shorter than expected")}else if(r!==-1){var s=e[r],u=(t>>>2)-1;if(!s)return;for(var f=0;f<u&&(a=Q(s,f*4))!==R;++f)n.push(a);i>=1&&fr(Q(s,t-4),i-1,e,t,n)}}function mr(r,i,e,t,n){var a=[],s=[];n||(n=[]);var u=t-1,f=0,h=0;for(f=i;f>=0;){n[f]=!0,a[a.length]=f,s.push(r[f]);var l=e[Math.floor(f*4/t)];if(h=f*4&u,t<4+h)throw new Error("FAT boundary crossed: "+f+" 4 "+t);if(!r[l])break;f=Q(r[l],h)}return{nodes:a,data:wr([s])}}function Cr(r,i,e,t){var n=r.length,a=[],s=[],u=[],f=[],h=t-1,l=0,v=0,_=0,g=0;for(l=0;l<n;++l)if(u=[],_=l+i,_>=n&&(_-=n),!s[_]){f=[];var w=[];for(v=_;v>=0;){w[v]=!0,s[v]=!0,u[u.length]=v,f.push(r[v]);var F=e[Math.floor(v*4/t)];if(g=v*4&h,t<4+g)throw new Error("FAT boundary crossed: "+v+" 4 "+t);if(!r[F]||(v=Q(r[F],g),w[v]))break}a[_]={nodes:u,data:wr([f])}}return a}function Ar(r,i,e,t,n,a,s,u){for(var f=0,h=t.length?2:0,l=i[r].data,v=0,_=0,g;v<l.length;v+=128){var w=l.slice(v,v+128);J(w,64),_=w.read_shift(2),g=Or(w,0,_-h),t.push(g);var F={name:g,type:w.read_shift(1),color:w.read_shift(1),L:w.read_shift(4,"i"),R:w.read_shift(4,"i"),C:w.read_shift(4,"i"),clsid:w.read_shift(16),state:w.read_shift(4,"i"),start:0,size:0},m=w.read_shift(2)+w.read_shift(2)+w.read_shift(2)+w.read_shift(2);m!==0&&(F.ct=sr(w,w.l-8));var E=w.read_shift(2)+w.read_shift(2)+w.read_shift(2)+w.read_shift(2);E!==0&&(F.mt=sr(w,w.l-8)),F.start=w.read_shift(4,"i"),F.size=w.read_shift(4,"i"),F.size<0&&F.start<0&&(F.size=F.type=0,F.start=R,F.name=""),F.type===5?(f=F.start,n>0&&f!==R&&(i[f].name="!StreamData")):F.size>=4096?(F.storage="fat",i[F.start]===void 0&&(i[F.start]=mr(e,F.start,i.fat_addrs,i.ssz)),i[F.start].name=F.name,F.content=i[F.start].data.slice(0,F.size)):(F.storage="minifat",F.size<0?F.size=0:f!==R&&F.start!==R&&i[f]&&(F.content=yr(F,i[f].data,(i[u]||{}).data))),F.content&&J(F.content,0),a[g]=F,s.push(F)}}function sr(r,i){return new Date((ee(r,i+4)/1e7*Math.pow(2,32)+ee(r,i)/1e7-11644473600)*1e3)}function Ir(r,i){return U(),X(D.readFileSync(r),i)}function Er(r,i){var e=i&&i.type;switch(e||O&&Buffer.isBuffer(r)&&(e="buffer"),e||"base64"){case"file":return Ir(r,i);case"base64":return X(W(br(r)),i);case"binary":return X(W(r),i)}return X(r,i)}function x(r,i){var e=i||{},t=e.root||"Root Entry";if(r.FullPaths||(r.FullPaths=[]),r.FileIndex||(r.FileIndex=[]),r.FullPaths.length!==r.FileIndex.length)throw new Error("inconsistent CFB structure");r.FullPaths.length===0&&(r.FullPaths[0]=t+"/",r.FileIndex[0]={name:t,type:5}),e.CLSID&&(r.FileIndex[0].clsid=e.CLSID),P(r)}function P(r){var i="Sh33tJ5";if(!b.find(r,"/"+i)){var e=j(4);e[0]=55,e[1]=e[3]=50,e[2]=54,r.FileIndex.push({name:i,type:2,content:e,size:4,L:69,R:69,C:69}),r.FullPaths.push(r.FullPaths[0]+i),p(r)}}function p(r,i){x(r);for(var e=!1,t=!1,n=r.FullPaths.length-1;n>=0;--n){var a=r.FileIndex[n];switch(a.type){case 0:t?e=!0:(r.FileIndex.pop(),r.FullPaths.pop());break;case 1:case 2:case 5:t=!0,isNaN(a.R*a.L*a.C)&&(e=!0),a.R>-1&&a.L>-1&&a.R==a.L&&(e=!0);break;default:e=!0;break}}if(!(!e&&!i)){var s=new Date(1987,1,19),u=0,f=Object.create?Object.create(null):{},h=[];for(n=0;n<r.FullPaths.length;++n)f[r.FullPaths[n]]=!0,r.FileIndex[n].type!==0&&h.push([r.FullPaths[n],r.FileIndex[n]]);for(n=0;n<h.length;++n){var l=C(h[n][0]);for(t=f[l];!t;){for(;C(l)&&!f[C(l)];)l=C(l);h.push([l,{name:y(l).replace("/",""),type:1,clsid:Sr,ct:s,mt:s,content:null}]),f[l]=!0,l=C(h[n][0]),t=f[l]}}for(h.sort(function(g,w){return d(g[0],w[0])}),r.FullPaths=[],r.FileIndex=[],n=0;n<h.length;++n)r.FullPaths[n]=h[n][0],r.FileIndex[n]=h[n][1];for(n=0;n<h.length;++n){var v=r.FileIndex[n],_=r.FullPaths[n];if(v.name=y(_).replace("/",""),v.L=v.R=v.C=-(v.color=1),v.size=v.content?v.content.length:0,v.start=0,v.clsid=v.clsid||Sr,n===0)v.C=h.length>1?1:-1,v.size=0,v.type=5;else if(_.slice(-1)=="/"){for(u=n+1;u<h.length&&C(r.FullPaths[u])!=_;++u);for(v.C=u>=h.length?-1:u,u=n+1;u<h.length&&C(r.FullPaths[u])!=C(_);++u);v.R=u>=h.length?-1:u,v.type=1}else C(r.FullPaths[n+1]||"")==C(_)&&(v.R=n+1),v.type=2}}}function A(r,i){var e=i||{};if(e.fileType=="mad")return De(r,e);if(p(r),e.fileType==="zip")return Ae(r,e);var t=(function(g){for(var w=0,F=0,m=0;m<g.FileIndex.length;++m){var E=g.FileIndex[m];if(E.content){var T=E.content.length;T>0&&(T<4096?w+=T+63>>6:F+=T+511>>9)}}for(var k=g.FullPaths.length+3>>2,N=w+7>>3,ir=w+127>>7,nr=N+F+k+ir,Y=nr+127>>7,Br=Y<=109?0:Math.ceil((Y-109)/127);nr+Y+Br+127>>7>Y;)Br=++Y<=109?0:Math.ceil((Y-109)/127);var G=[1,Br,Y,ir,k,F,w,0];return g.FileIndex[0].size=w<<6,G[7]=(g.FileIndex[0].start=G[0]+G[1]+G[2]+G[3]+G[4]+G[5])+(G[6]+7>>3),G})(r),n=j(t[7]<<9),a=0,s=0;{for(a=0;a<8;++a)n.write_shift(1,he[a]);for(a=0;a<8;++a)n.write_shift(2,0);for(n.write_shift(2,62),n.write_shift(2,3),n.write_shift(2,65534),n.write_shift(2,9),n.write_shift(2,6),a=0;a<3;++a)n.write_shift(2,0);for(n.write_shift(4,0),n.write_shift(4,t[2]),n.write_shift(4,t[0]+t[1]+t[2]+t[3]-1),n.write_shift(4,0),n.write_shift(4,4096),n.write_shift(4,t[3]?t[0]+t[1]+t[2]-1:R),n.write_shift(4,t[3]),n.write_shift(-4,t[1]?t[0]-1:R),n.write_shift(4,t[1]),a=0;a<109;++a)n.write_shift(-4,a<t[2]?t[1]+a:-1)}if(t[1])for(s=0;s<t[1];++s){for(;a<236+s*127;++a)n.write_shift(-4,a<t[2]?t[1]+a:-1);n.write_shift(-4,s===t[1]-1?R:s+1)}var u=function(g){for(s+=g;a<s-1;++a)n.write_shift(-4,a+1);g&&(++a,n.write_shift(-4,R))};for(s=a=0,s+=t[1];a<s;++a)n.write_shift(-4,rr.DIFSECT);for(s+=t[2];a<s;++a)n.write_shift(-4,rr.FATSECT);u(t[3]),u(t[4]);for(var f=0,h=0,l=r.FileIndex[0];f<r.FileIndex.length;++f)l=r.FileIndex[f],l.content&&(h=l.content.length,!(h<4096)&&(l.start=s,u(h+511>>9)));for(u(t[6]+7>>3);n.l&511;)n.write_shift(-4,rr.ENDOFCHAIN);for(s=a=0,f=0;f<r.FileIndex.length;++f)l=r.FileIndex[f],l.content&&(h=l.content.length,!(!h||h>=4096)&&(l.start=s,u(h+63>>6)));for(;n.l&511;)n.write_shift(-4,rr.ENDOFCHAIN);for(a=0;a<t[4]<<2;++a){var v=r.FullPaths[a];if(!v||v.length===0){for(f=0;f<17;++f)n.write_shift(4,0);for(f=0;f<3;++f)n.write_shift(4,-1);for(f=0;f<12;++f)n.write_shift(4,0);continue}l=r.FileIndex[a],a===0&&(l.start=l.size?l.start-1:R);var _=a===0&&e.root||l.name;if(_.length>32&&(console.error("Name "+_+" will be truncated to "+_.slice(0,32)),_=_.slice(0,32)),h=2*(_.length+1),n.write_shift(64,_,"utf16le"),n.write_shift(2,h),n.write_shift(1,l.type),n.write_shift(1,l.color),n.write_shift(-4,l.L),n.write_shift(-4,l.R),n.write_shift(-4,l.C),l.clsid)n.write_shift(16,l.clsid,"hex");else for(f=0;f<4;++f)n.write_shift(4,0);n.write_shift(4,l.state||0),n.write_shift(4,0),n.write_shift(4,0),n.write_shift(4,0),n.write_shift(4,0),n.write_shift(4,l.start),n.write_shift(4,l.size),n.write_shift(4,0)}for(a=1;a<r.FileIndex.length;++a)if(l=r.FileIndex[a],l.size>=4096)if(n.l=l.start+1<<9,O&&Buffer.isBuffer(l.content))l.content.copy(n,n.l,0,l.size),n.l+=l.size+511&-512;else{for(f=0;f<l.size;++f)n.write_shift(1,l.content[f]);for(;f&511;++f)n.write_shift(1,0)}for(a=1;a<r.FileIndex.length;++a)if(l=r.FileIndex[a],l.size>0&&l.size<4096)if(O&&Buffer.isBuffer(l.content))l.content.copy(n,n.l,0,l.size),n.l+=l.size+63&-64;else{for(f=0;f<l.size;++f)n.write_shift(1,l.content[f]);for(;f&63;++f)n.write_shift(1,0)}if(O)n.l=n.length;else for(;n.l<n.length;)n.write_shift(1,0);return n}function I(r,i){var e=r.FullPaths.map(function(f){return f.toUpperCase()}),t=e.map(function(f){var h=f.split("/");return h[h.length-(f.slice(-1)=="/"?2:1)]}),n=!1;i.charCodeAt(0)===47?(n=!0,i=e[0].slice(0,-1)+i):n=i.indexOf("/")!==-1;var a=i.toUpperCase(),s=n===!0?e.indexOf(a):t.indexOf(a);if(s!==-1)return r.FileIndex[s];var u=!a.match(_r);for(a=a.replace(ar,""),u&&(a=a.replace(_r,"!")),s=0;s<e.length;++s)if((u?e[s].replace(_r,"!"):e[s]).replace(ar,"")==a||(u?t[s].replace(_r,"!"):t[s]).replace(ar,"")==a)return r.FileIndex[s];return null}var S=64,R=-2,zr="d0cf11e0a1b11ae1",he=[208,207,17,224,161,177,26,225],Sr="00000000000000000000000000000000",rr={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,ENDOFCHAIN:R,FREESECT:-1,HEADER_SIGNATURE:zr,HEADER_MINOR_VERSION:"3e00",MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:Sr,EntryTypes:["unknown","storage","stream","lockbytes","property","root"]};function le(r,i,e){U();var t=A(r,e);D.writeFileSync(i,t)}function er(r){for(var i=new Array(r.length),e=0;e<r.length;++e)i[e]=String.fromCharCode(r[e]);return i.join("")}function ue(r,i){var e=A(r,i);switch(i&&i.type||"buffer"){case"file":return U(),D.writeFileSync(i.filename,e),e;case"binary":return typeof e=="string"?e:er(e);case"base64":return Qr(typeof e=="string"?e:er(e));case"buffer":if(O)return Buffer.isBuffer(e)?e:Nr(e);case"array":return typeof e=="string"?W(e):e}return e}var tr;function oe(r){try{var i=r.InflateRaw,e=new i;if(e._processChunk(new Uint8Array([3,0]),e._finishFlushFlag),e.bytesRead)tr=r;else throw new Error("zlib does not expose bytesRead")}catch(t){console.error("cannot use native zlib: "+(t.message||t))}}function ce(r,i){if(!tr)return Wr(r,i);var e=tr.InflateRaw,t=new e,n=t._processChunk(r.slice(r.l),t._finishFlushFlag);return r.l+=t.bytesRead,n}function ve(r){return tr?tr.deflateRawSync(r):Jr(r)}var _e=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],hr=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],lr=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];function we(r){var i=(r<<1|r<<11)&139536|(r<<5|r<<15)&558144;return(i>>16|i>>8|i)&255}for(var B=typeof Uint8Array<"u",$=B?new Uint8Array(256):[],ur=0;ur<256;++ur)$[ur]=we(ur);function Fe(r,i){var e=$[r&255];return i<=8?e>>>8-i:(e=e<<8|$[r>>8&255],i<=16?e>>>16-i:(e=e<<8|$[r>>16&255],e>>>24-i))}function de(r,i){var e=i&7,t=i>>>3;return(r[t]|(e<=6?0:r[t+1]<<8))>>>e&3}function kr(r,i){var e=i&7,t=i>>>3;return(r[t]|(e<=5?0:r[t+1]<<8))>>>e&7}function xe(r,i){var e=i&7,t=i>>>3;return(r[t]|(e<=4?0:r[t+1]<<8))>>>e&15}function Hr(r,i){var e=i&7,t=i>>>3;return(r[t]|(e<=3?0:r[t+1]<<8))>>>e&31}function jr(r,i){var e=i&7,t=i>>>3;return(r[t]|(e<=1?0:r[t+1]<<8))>>>e&127}function or(r,i,e){var t=i&7,n=i>>>3,a=(1<<e)-1,s=r[n]>>>t;return e<8-t||(s|=r[n+1]<<8-t,e<16-t)||(s|=r[n+2]<<16-t,e<24-t)||(s|=r[n+3]<<24-t),s&a}function $r(r,i,e){var t=i&7,n=i>>>3;return t<=5?r[n]|=(e&7)<<t:(r[n]|=e<<t&255,r[n+1]=(e&7)>>8-t),i+3}function ge(r,i,e){var t=i&7,n=i>>>3;return e=(e&1)<<t,r[n]|=e,i+1}function q(r,i,e){var t=i&7,n=i>>>3;return e<<=t,r[n]|=e&255,e>>>=8,r[n+1]=e,i+8}function Gr(r,i,e){var t=i&7,n=i>>>3;return e<<=t,r[n]|=e&255,e>>>=8,r[n+1]=e&255,r[n+2]=e>>>8,i+16}function Rr(r,i){var e=r.length,t=2*e>i?2*e:i+5,n=0;if(e>=i)return r;if(O){var a=re(t);if(r.copy)r.copy(a);else for(;n<r.length;++n)a[n]=r[n];return a}else if(B){var s=new Uint8Array(t);if(s.set)s.set(r);else for(;n<e;++n)s[n]=r[n];return s}return r.length=t,r}function H(r){for(var i=new Array(r),e=0;e<r;++e)i[e]=0;return i}function cr(r,i,e){var t=1,n=0,a=0,s=0,u=0,f=r.length,h=B?new Uint16Array(32):H(32);for(a=0;a<32;++a)h[a]=0;for(a=f;a<e;++a)r[a]=0;f=r.length;var l=B?new Uint16Array(f):H(f);for(a=0;a<f;++a)h[n=r[a]]++,t<n&&(t=n),l[a]=0;for(h[0]=0,a=1;a<=t;++a)h[a+16]=u=u+h[a-1]<<1;for(a=0;a<f;++a)u=r[a],u!=0&&(l[a]=h[u+16]++);var v=0;for(a=0;a<f;++a)if(v=r[a],v!=0)for(u=Fe(l[a],t)>>t-v,s=(1<<t+4-v)-1;s>=0;--s)i[u|s<<v]=v&15|a<<4;return t}var Tr=B?new Uint16Array(512):H(512),Dr=B?new Uint16Array(32):H(32);if(!B){for(var Z=0;Z<512;++Z)Tr[Z]=0;for(Z=0;Z<32;++Z)Dr[Z]=0}(function(){for(var r=[],i=0;i<32;i++)r.push(5);cr(r,Dr,32);var e=[];for(i=0;i<=143;i++)e.push(8);for(;i<=255;i++)e.push(9);for(;i<=279;i++)e.push(7);for(;i<=287;i++)e.push(8);cr(e,Tr,288)})();var pe=(function(){for(var i=B?new Uint8Array(32768):[],e=0,t=0;e<lr.length-1;++e)for(;t<lr[e+1];++t)i[t]=e;for(;t<32768;++t)i[t]=29;var n=B?new Uint8Array(259):[];for(e=0,t=0;e<hr.length-1;++e)for(;t<hr[e+1];++t)n[t]=e;function a(u,f){for(var h=0;h<u.length;){var l=Math.min(65535,u.length-h),v=h+l==u.length;for(f.write_shift(1,+v),f.write_shift(2,l),f.write_shift(2,~l&65535);l-- >0;)f[f.l++]=u[h++]}return f.l}function s(u,f){for(var h=0,l=0,v=B?new Uint16Array(32768):[];l<u.length;){var _=Math.min(65535,u.length-l);if(_<10){for(h=$r(f,h,+(l+_==u.length)),h&7&&(h+=8-(h&7)),f.l=h/8|0,f.write_shift(2,_),f.write_shift(2,~_&65535);_-- >0;)f[f.l++]=u[l++];h=f.l*8;continue}h=$r(f,h,+(l+_==u.length)+2);for(var g=0;_-- >0;){var w=u[l];g=(g<<5^w)&32767;var F=-1,m=0;if((F=v[g])&&(F|=l&-32768,F>l&&(F-=32768),F<l))for(;u[F+m]==u[l+m]&&m<250;)++m;if(m>2){w=n[m],w<=22?h=q(f,h,$[w+1]>>1)-1:(q(f,h,3),h+=5,q(f,h,$[w-23]>>5),h+=3);var E=w<8?0:w-4>>2;E>0&&(Gr(f,h,m-hr[w]),h+=E),w=i[l-F],h=q(f,h,$[w]>>3),h-=3;var T=w<4?0:w-2>>1;T>0&&(Gr(f,h,l-F-lr[w]),h+=T);for(var k=0;k<m;++k)v[g]=l&32767,g=(g<<5^u[l])&32767,++l;_-=m-1}else w<=143?w=w+48:h=ge(f,h,1),h=q(f,h,$[w]),v[g]=l&32767,++l}h=q(f,h,0)-1}return f.l=(h+7)/8|0,f.l}return function(f,h){return f.length<8?a(f,h):s(f,h)}})();function Jr(r){var i=j(50+Math.floor(r.length*1.1)),e=pe(r,i);return i.slice(0,e)}var Vr=B?new Uint16Array(32768):H(32768),Xr=B?new Uint16Array(32768):H(32768),Zr=B?new Uint16Array(128):H(128),Yr=1,qr=1;function ye(r,i){var e=Hr(r,i)+257;i+=5;var t=Hr(r,i)+1;i+=5;var n=xe(r,i)+4;i+=4;for(var a=0,s=B?new Uint8Array(19):H(19),u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],f=1,h=B?new Uint8Array(8):H(8),l=B?new Uint8Array(8):H(8),v=s.length,_=0;_<n;++_)s[_e[_]]=a=kr(r,i),f<a&&(f=a),h[a]++,i+=3;var g=0;for(h[0]=0,_=1;_<=f;++_)l[_]=g=g+h[_-1]<<1;for(_=0;_<v;++_)(g=s[_])!=0&&(u[_]=l[g]++);var w=0;for(_=0;_<v;++_)if(w=s[_],w!=0){g=$[u[_]]>>8-w;for(var F=(1<<7-w)-1;F>=0;--F)Zr[g|F<<w]=w&7|_<<3}var m=[];for(f=1;m.length<e+t;)switch(g=Zr[jr(r,i)],i+=g&7,g>>>=3){case 16:for(a=3+de(r,i),i+=2,g=m[m.length-1];a-- >0;)m.push(g);break;case 17:for(a=3+kr(r,i),i+=3;a-- >0;)m.push(0);break;case 18:for(a=11+jr(r,i),i+=7;a-- >0;)m.push(0);break;default:m.push(g),f<g&&(f=g);break}var E=m.slice(0,e),T=m.slice(e);for(_=e;_<286;++_)E[_]=0;for(_=t;_<30;++_)T[_]=0;return Yr=cr(E,Vr,286),qr=cr(T,Xr,30),i}function me(r,i){if(r[0]==3&&!(r[1]&3))return[ie(i),2];for(var e=0,t=0,n=re(i||1<<18),a=0,s=n.length>>>0,u=0,f=0;(t&1)==0;){if(t=kr(r,e),e+=3,t>>>1)t>>1==1?(u=9,f=5):(e=ye(r,e),u=Yr,f=qr);else{e&7&&(e+=8-(e&7));var h=r[e>>>3]|r[(e>>>3)+1]<<8;if(e+=32,h>0)for(!i&&s<a+h&&(n=Rr(n,a+h),s=n.length);h-- >0;)n[a++]=r[e>>>3],e+=8;continue}for(;;){!i&&s<a+32767&&(n=Rr(n,a+32767),s=n.length);var l=or(r,e,u),v=t>>>1==1?Tr[l]:Vr[l];if(e+=v&15,v>>>=4,(v>>>8&255)===0)n[a++]=v;else{if(v==256)break;v-=257;var _=v<8?0:v-4>>2;_>5&&(_=0);var g=a+hr[v];_>0&&(g+=or(r,e,_),e+=_),l=or(r,e,f),v=t>>>1==1?Dr[l]:Xr[l],e+=v&15,v>>>=4;var w=v<4?0:v-2>>1,F=lr[v];for(w>0&&(F+=or(r,e,w),e+=w),!i&&s<g&&(n=Rr(n,g+100),s=n.length);a<g;)n[a]=n[a-F],++a}}}return i?[n,e+7>>>3]:[n.slice(0,a),e+7>>>3]}function Wr(r,i){var e=r.slice(r.l||0),t=me(e,i);return r.l+=t[1],t[0]}function Ur(r,i){if(r)typeof console<"u"&&console.error(i);else throw new Error(i)}function Kr(r,i){var e=r;J(e,0);var t=[],n=[],a={FileIndex:t,FullPaths:n};x(a,{root:i.root});for(var s=e.length-4;(e[s]!=80||e[s+1]!=75||e[s+2]!=5||e[s+3]!=6)&&s>=0;)--s;e.l=s+4,e.l+=4;var u=e.read_shift(2);e.l+=6;var f=e.read_shift(4);for(e.l=f,s=0;s<u;++s){e.l+=20;var h=e.read_shift(4),l=e.read_shift(4),v=e.read_shift(2),_=e.read_shift(2),g=e.read_shift(2);e.l+=8;var w=e.read_shift(4),F=L(e.slice(e.l+v,e.l+v+_));e.l+=v+_+g;var m=e.l;e.l=w+4,Ce(e,h,l,a,F),e.l=m}return a}function Ce(r,i,e,t,n){r.l+=2;var a=r.read_shift(2),s=r.read_shift(2),u=M(r);if(a&8257)throw new Error("Unsupported ZIP encryption");for(var f=r.read_shift(4),h=r.read_shift(4),l=r.read_shift(4),v=r.read_shift(2),_=r.read_shift(2),g="",w=0;w<v;++w)g+=String.fromCharCode(r[r.l++]);if(_){var F=L(r.slice(r.l,r.l+_));(F[21589]||{}).mt&&(u=F[21589].mt),((n||{})[21589]||{}).mt&&(u=n[21589].mt)}r.l+=_;var m=r.slice(r.l,r.l+h);switch(s){case 8:m=ce(r,l);break;case 0:break;default:throw new Error("Unsupported ZIP Compression method "+s)}var E=!1;a&8&&(f=r.read_shift(4),f==134695760&&(f=r.read_shift(4),E=!0),h=r.read_shift(4),l=r.read_shift(4)),h!=i&&Ur(E,"Bad compressed size: "+i+" != "+h),l!=e&&Ur(E,"Bad uncompressed size: "+e+" != "+l);var T=te.buf(m,0);f>>0!=T>>0&&Ur(E,"Bad CRC32 checksum: "+f+" != "+T),Pr(t,g,m,{unsafe:!0,mt:u})}function Ae(r,i){var e=i||{},t=[],n=[],a=j(1),s=e.compression?8:0,u=0,f=!1;f&&(u|=8);var h=0,l=0,v=0,_=0,g=r.FullPaths[0],w=g,F=r.FileIndex[0],m=[],E=0;for(h=1;h<r.FullPaths.length;++h)if(w=r.FullPaths[h].slice(g.length),F=r.FileIndex[h],!(!F.size||!F.content||w=="Sh33tJ5")){var T=v,k=j(w.length);for(l=0;l<w.length;++l)k.write_shift(1,w.charCodeAt(l)&127);k=k.slice(0,k.l),m[_]=te.buf(F.content,0);var N=F.content;s==8&&(N=ve(N)),a=j(30),a.write_shift(4,67324752),a.write_shift(2,20),a.write_shift(2,u),a.write_shift(2,s),F.mt?z(a,F.mt):a.write_shift(4,0),a.write_shift(-4,u&8?0:m[_]),a.write_shift(4,u&8?0:N.length),a.write_shift(4,u&8?0:F.content.length),a.write_shift(2,k.length),a.write_shift(2,0),v+=a.length,t.push(a),v+=k.length,t.push(k),v+=N.length,t.push(N),u&8&&(a=j(12),a.write_shift(-4,m[_]),a.write_shift(4,N.length),a.write_shift(4,F.content.length),v+=a.l,t.push(a)),a=j(46),a.write_shift(4,33639248),a.write_shift(2,0),a.write_shift(2,20),a.write_shift(2,u),a.write_shift(2,s),a.write_shift(4,0),a.write_shift(-4,m[_]),a.write_shift(4,N.length),a.write_shift(4,F.content.length),a.write_shift(2,k.length),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(4,0),a.write_shift(4,T),E+=a.l,n.push(a),E+=k.length,n.push(k),++_}return a=j(22),a.write_shift(4,101010256),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(2,_),a.write_shift(2,_),a.write_shift(4,E),a.write_shift(4,v),a.write_shift(2,0),K([K(t),K(n),a])}var vr={htm:"text/html",xml:"text/xml",gif:"image/gif",jpg:"image/jpeg",png:"image/png",mso:"application/x-mso",thmx:"application/vnd.ms-officetheme",sh33tj5:"application/octet-stream"};function Ie(r,i){if(r.ctype)return r.ctype;var e=r.name||"",t=e.match(/\.([^\.]+)$/);return t&&vr[t[1]]||i&&(t=(e=i).match(/[\.\\]([^\.\\])+$/),t&&vr[t[1]])?vr[t[1]]:"application/octet-stream"}function Ee(r){for(var i=Qr(r),e=[],t=0;t<i.length;t+=76)e.push(i.slice(t,t+76));return e.join(`\r
|
|
4
|
+
`)+`\r
|
|
5
|
+
`}function Se(r){var i=r.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF=]/g,function(h){var l=h.charCodeAt(0).toString(16).toUpperCase();return"="+(l.length==1?"0"+l:l)});i=i.replace(/ $/mg,"=20").replace(/\t$/mg,"=09"),i.charAt(0)==`
|
|
6
|
+
`&&(i="=0D"+i.slice(1)),i=i.replace(/\r(?!\n)/mg,"=0D").replace(/\n\n/mg,`
|
|
7
|
+
=0A`).replace(/([^\r\n])\n/mg,"$1=0A");for(var e=[],t=i.split(`\r
|
|
8
|
+
`),n=0;n<t.length;++n){var a=t[n];if(a.length==0){e.push("");continue}for(var s=0;s<a.length;){var u=76,f=a.slice(s,s+u);f.charAt(u-1)=="="?u--:f.charAt(u-2)=="="?u-=2:f.charAt(u-3)=="="&&(u-=3),f=a.slice(s,s+u),s+=u,s<a.length&&(f+="="),e.push(f)}}return e.join(`\r
|
|
9
|
+
`)}function ke(r){for(var i=[],e=0;e<r.length;++e){for(var t=r[e];e<=r.length&&t.charAt(t.length-1)=="=";)t=t.slice(0,t.length-1)+r[++e];i.push(t)}for(var n=0;n<i.length;++n)i[n]=i[n].replace(/[=][0-9A-Fa-f]{2}/g,function(a){return String.fromCharCode(parseInt(a.slice(1),16))});return W(i.join(`\r
|
|
10
|
+
`))}function Re(r,i,e){for(var t="",n="",a="",s,u=0;u<10;++u){var f=i[u];if(!f||f.match(/^\s*$/))break;var h=f.match(/^(.*?):\s*([^\s].*)$/);if(h)switch(h[1].toLowerCase()){case"content-location":t=h[2].trim();break;case"content-type":a=h[2].trim();break;case"content-transfer-encoding":n=h[2].trim();break}}switch(++u,n.toLowerCase()){case"base64":s=W(br(i.slice(u).join("")));break;case"quoted-printable":s=ke(i.slice(u));break;default:throw new Error("Unsupported Content-Transfer-Encoding "+n)}var l=Pr(r,t.slice(e.length),s,{unsafe:!0});a&&(l.ctype=a)}function Te(r,i){if(er(r.slice(0,13)).toLowerCase()!="mime-version:")throw new Error("Unsupported MAD header");var e=i&&i.root||"",t=(O&&Buffer.isBuffer(r)?r.toString("binary"):er(r)).split(`\r
|
|
11
|
+
`),n=0,a="";for(n=0;n<t.length;++n)if(a=t[n],!!/^Content-Location:/i.test(a)&&(a=a.slice(a.indexOf("file")),e||(e=a.slice(0,a.lastIndexOf("/")+1)),a.slice(0,e.length)!=e))for(;e.length>0&&(e=e.slice(0,e.length-1),e=e.slice(0,e.lastIndexOf("/")+1),a.slice(0,e.length)!=e););var s=(t[1]||"").match(/boundary="(.*?)"/);if(!s)throw new Error("MAD cannot find boundary");var u="--"+(s[1]||""),f=[],h=[],l={FileIndex:f,FullPaths:h};x(l);var v,_=0;for(n=0;n<t.length;++n){var g=t[n];g!==u&&g!==u+"--"||(_++&&Re(l,t.slice(v,n),e),v=n)}return l}function De(r,i){var e=i||{},t=e.boundary||"SheetJS";t="------="+t;for(var n=["MIME-Version: 1.0",'Content-Type: multipart/related; boundary="'+t.slice(2)+'"',"","",""],a=r.FullPaths[0],s=a,u=r.FileIndex[0],f=1;f<r.FullPaths.length;++f)if(s=r.FullPaths[f].slice(a.length),u=r.FileIndex[f],!(!u.size||!u.content||s=="Sh33tJ5")){s=s.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF]/g,function(m){return"_x"+m.charCodeAt(0).toString(16)+"_"}).replace(/[\u0080-\uFFFF]/g,function(m){return"_u"+m.charCodeAt(0).toString(16)+"_"});for(var h=u.content,l=O&&Buffer.isBuffer(h)?h.toString("binary"):er(h),v=0,_=Math.min(1024,l.length),g=0,w=0;w<=_;++w)(g=l.charCodeAt(w))>=32&&g<128&&++v;var F=v>=_*4/5;n.push(t),n.push("Content-Location: "+(e.root||"file:///C:/SheetJS/")+s),n.push("Content-Transfer-Encoding: "+(F?"quoted-printable":"base64")),n.push("Content-Type: "+Ie(u,s)),n.push(""),n.push(F?Se(l):Ee(l))}return n.push(t+`--\r
|
|
12
|
+
`),n.join(`\r
|
|
13
|
+
`)}function Ue(r){var i={};return x(i,r),i}function Pr(r,i,e,t){var n=t&&t.unsafe;n||x(r);var a=!n&&b.find(r,i);if(!a){var s=r.FullPaths[0];i.slice(0,s.length)==s?s=i:(s.slice(-1)!="/"&&(s+="/"),s=(s+i).replace("//","/")),a={name:y(i),type:2},r.FileIndex.push(a),r.FullPaths.push(s),n||b.utils.cfb_gc(r)}return a.content=e,a.size=e?e.length:0,t&&(t.CLSID&&(a.clsid=t.CLSID),t.mt&&(a.mt=t.mt),t.ct&&(a.ct=t.ct)),a}function Pe(r,i){x(r);var e=b.find(r,i);if(e){for(var t=0;t<r.FileIndex.length;++t)if(r.FileIndex[t]==e)return r.FileIndex.splice(t,1),r.FullPaths.splice(t,1),!0}return!1}function Be(r,i,e){x(r);var t=b.find(r,i);if(t){for(var n=0;n<r.FileIndex.length;++n)if(r.FileIndex[n]==t)return r.FileIndex[n].name=y(e),r.FullPaths[n]=e,!0}return!1}function Me(r){p(r,!0)}return c.find=I,c.read=Er,c.parse=X,c.write=ue,c.writeFile=le,c.utils={cfb_new:Ue,cfb_add:Pr,cfb_del:Pe,cfb_mov:Be,cfb_gc:Me,ReadShift:fe,CheckField:se,prep_blob:J,bconcat:K,use_zlib:oe,_deflateRaw:Jr,_inflateRaw:Wr,consts:rr},c})();typeof Mr<"u"&&typeof Lr<"u"&&typeof DO_NOT_EXPORT_CFB>"u"&&(Lr.exports=b)});export default Ve();
|