@stacksjs/bunpress 0.0.5
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/LICENSE.md +21 -0
- package/README.md +140 -0
- package/dist/bin/cli.js +86 -0
- package/dist/chunk-z2xpw4s7.js +322 -0
- package/dist/config.d.ts +9 -0
- package/dist/index.d.ts +3 -0
- package/dist/plugin.d.ts +0 -0
- package/dist/src/index.js +243 -0
- package/dist/toc.d.ts +65 -0
- package/dist/types.d.ts +241 -0
- package/package.json +86 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Open Web Foundation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<p align="center"><img src=".github/art/cover.jpg" alt="Social Card of this repo"></p>
|
|
2
|
+
|
|
3
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
4
|
+
[![GitHub Actions][github-actions-src]][github-actions-href]
|
|
5
|
+
[](http://commitizen.github.io/cz-cli/)
|
|
6
|
+
<!-- [![npm downloads][npm-downloads-src]][npm-downloads-href] -->
|
|
7
|
+
<!-- [![Codecov][codecov-src]][codecov-href] -->
|
|
8
|
+
|
|
9
|
+
# BunPress
|
|
10
|
+
|
|
11
|
+
**Fast, modern documentation engine powered by Bun, inspired by VitePress**
|
|
12
|
+
|
|
13
|
+
BunPress is a lightning-fast static site generator designed specifically for documentation. Built on top of Bun's blazing performance with a developer-friendly API inspired by VitePress.
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- ⚡ **Lightning Fast** - Powered by Bun runtime for incredible performance
|
|
18
|
+
- 📝 **Rich Markdown** - Enhanced markdown with containers, emojis, math, and syntax highlighting
|
|
19
|
+
- 📋 **Smart TOC** - Automatic table of contents with customization and interactive features
|
|
20
|
+
- 🛠️ **Developer Friendly** - TypeScript support, plugin system, and extensive customization options
|
|
21
|
+
- 🔍 **Advanced Search** - Local search with indexing, keyboard shortcuts, and smart ranking
|
|
22
|
+
- 🎨 **Theme System** - Complete theme customization with colors, fonts, and dark mode
|
|
23
|
+
- 📱 **Responsive Design** - Mobile-first design that works beautifully on all devices
|
|
24
|
+
- 🧭 **Navigation** - Flexible navigation with active states, nested menus, and icons
|
|
25
|
+
- 📊 **Sidebar** - Collapsible sidebar with groups, search, and smooth animations
|
|
26
|
+
- 🎯 **Multiple Layouts** - Home, documentation, and page layouts with custom templates
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
Get started with BunPress in seconds:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Install BunPress
|
|
34
|
+
bun add @stacksjs/bunpress
|
|
35
|
+
|
|
36
|
+
# Create a new documentation site
|
|
37
|
+
mkdir my-docs
|
|
38
|
+
cd my-docs
|
|
39
|
+
|
|
40
|
+
# Initialize with basic structure
|
|
41
|
+
bunx @stacksjs/bunpress init
|
|
42
|
+
|
|
43
|
+
# Start development server
|
|
44
|
+
bun run dev
|
|
45
|
+
|
|
46
|
+
# Build for production
|
|
47
|
+
bun run build
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Basic Usage
|
|
51
|
+
|
|
52
|
+
Create your first documentation page:
|
|
53
|
+
|
|
54
|
+
```markdown
|
|
55
|
+
---
|
|
56
|
+
title: Welcome
|
|
57
|
+
layout: home
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
# Welcome to My Project
|
|
61
|
+
|
|
62
|
+
This is my awesome project documentation built with BunPress!
|
|
63
|
+
|
|
64
|
+
## Quick Links
|
|
65
|
+
|
|
66
|
+
- [Getting Started](/guide/getting-started)
|
|
67
|
+
- [API Reference](/api)
|
|
68
|
+
- [Examples](/examples)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Configure your site in `bunpress.config.ts`:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
export default {
|
|
75
|
+
nav: [
|
|
76
|
+
{ text: 'Home', link: '/' },
|
|
77
|
+
{ text: 'Guide', link: '/guide' },
|
|
78
|
+
{ text: 'API', link: '/api' }
|
|
79
|
+
],
|
|
80
|
+
markdown: {
|
|
81
|
+
themeConfig: {
|
|
82
|
+
colors: {
|
|
83
|
+
primary: '#3b82f6'
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Testing
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
bun test
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Changelog
|
|
97
|
+
|
|
98
|
+
Please see our [releases](https://github.com/stackjs/bun-ts-starter/releases) page for more information on what has changed recently.
|
|
99
|
+
|
|
100
|
+
## Contributing
|
|
101
|
+
|
|
102
|
+
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
|
|
103
|
+
|
|
104
|
+
## Community
|
|
105
|
+
|
|
106
|
+
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
|
|
107
|
+
|
|
108
|
+
[Discussions on GitHub](https://github.com/stacksjs/ts-starter/discussions)
|
|
109
|
+
|
|
110
|
+
For casual chit-chat with others using this package:
|
|
111
|
+
|
|
112
|
+
[Join the Stacks Discord Server](https://discord.gg/stacksjs)
|
|
113
|
+
|
|
114
|
+
## Postcardware
|
|
115
|
+
|
|
116
|
+
“Software that is free, but hopes for a postcard.” We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.
|
|
117
|
+
|
|
118
|
+
Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎
|
|
119
|
+
|
|
120
|
+
## Sponsors
|
|
121
|
+
|
|
122
|
+
We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.
|
|
123
|
+
|
|
124
|
+
- [JetBrains](https://www.jetbrains.com/)
|
|
125
|
+
- [The Solana Foundation](https://solana.com/)
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.
|
|
130
|
+
|
|
131
|
+
Made with 💙
|
|
132
|
+
|
|
133
|
+
<!-- Badges -->
|
|
134
|
+
[npm-version-src]: https://img.shields.io/npm/v/bun-ts-starter?style=flat-square
|
|
135
|
+
[npm-version-href]: https://npmjs.com/package/bun-ts-starter
|
|
136
|
+
[github-actions-src]: https://img.shields.io/github/actions/workflow/status/stacksjs/ts-starter/ci.yml?style=flat-square&branch=main
|
|
137
|
+
[github-actions-href]: https://github.com/stacksjs/ts-starter/actions?query=workflow%3Aci
|
|
138
|
+
|
|
139
|
+
<!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/ts-starter/main?style=flat-square
|
|
140
|
+
[codecov-href]: https://codecov.io/gh/stacksjs/ts-starter -->
|
package/dist/bin/cli.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{b as M0}from"../chunk-z2xpw4s7.js";var{Glob:N0}=globalThis.Bun;import{copyFile as b6,mkdir as B0,readdir as i}from"fs/promises";import{join as R}from"path";import O0 from"process";import{EventEmitter as A0}from"events";import o from"process";import m from"process";import k from"process";import m0,{stdin as g6,stdout as _6}from"process";import z0,{stdin as n0,stdout as a0}from"process";import c0 from"readline";var{create:T0,getPrototypeOf:w0,defineProperty:t,getOwnPropertyNames:P0}=Object,b0=Object.prototype.hasOwnProperty,L=(Z,$,Q)=>{Q=Z!=null?T0(w0(Z)):{};let z=$||!Z||!Z.__esModule?t(Q,"default",{value:Z,enumerable:!0}):Q;for(let J of P0(Z))if(!b0.call(z,J))t(z,J,{get:()=>Z[J],enumerable:!0});return z},x=(Z,$)=>()=>($||Z(($={exports:{}}).exports,$),$.exports),I0=x((Z,$)=>{function Q(J){return J==null?[]:Array.isArray(J)?J:[J]}function z(J,Y,j,X){var G,q=J[Y],U=~X.string.indexOf(Y)?j==null||j===!0?"":String(j):typeof j==="boolean"?j:~X.boolean.indexOf(Y)?j==="false"?!1:j==="true"||(J._.push((G=+j,G*0===0)?G:j),!!j):(G=+j,G*0===0)?G:j;J[Y]=q==null?U:Array.isArray(q)?q.concat(U):[q,U]}$.exports=function(J,Y){J=J||[],Y=Y||{};var j,X,G,q,U,K={_:[]},H=0,V=0,F=0,T=J.length;let M=Y.alias!==void 0,S=Y.unknown!==void 0,s=Y.default!==void 0;if(Y.alias=Y.alias||{},Y.string=Q(Y.string),Y.boolean=Q(Y.boolean),M)for(j in Y.alias){X=Y.alias[j]=Q(Y.alias[j]);for(H=0;H<X.length;H++)(Y.alias[X[H]]=X.concat(j)).splice(H,1)}for(H=Y.boolean.length;H-- >0;){X=Y.alias[Y.boolean[H]]||[];for(V=X.length;V-- >0;)Y.boolean.push(X[V])}for(H=Y.string.length;H-- >0;){X=Y.alias[Y.string[H]]||[];for(V=X.length;V-- >0;)Y.string.push(X[V])}if(s){for(j in Y.default)if(q=typeof Y.default[j],X=Y.alias[j]=Y.alias[j]||[],Y[q]!==void 0){Y[q].push(j);for(H=0;H<X.length;H++)Y[q].push(X[H])}}let e=S?Object.keys(Y.alias):[];for(H=0;H<T;H++){if(G=J[H],G==="--"){K._=K._.concat(J.slice(++H));break}for(V=0;V<G.length;V++)if(G.charCodeAt(V)!==45)break;if(V===0)K._.push(G);else if(G.substring(V,V+3)==="no-"){if(q=G.substring(V+3),S&&!~e.indexOf(q))return Y.unknown(G);K[q]=!1}else{for(F=V+1;F<G.length;F++)if(G.charCodeAt(F)===61)break;q=G.substring(V,F),U=G.substring(++F)||(H+1===T||(""+J[H+1]).charCodeAt(0)===45||J[++H]),X=V===2?[q]:q;for(F=0;F<X.length;F++){if(q=X[F],S&&!~e.indexOf(q))return Y.unknown("-".repeat(V)+q);z(K,q,F+1<X.length||U,Y)}}}if(s){for(j in Y.default)if(K[j]===void 0)K[j]=Y.default[j]}if(M)for(j in K){X=Y.alias[j]||[];while(X.length>0)K[X.shift()]=K[j]}return K}}),B=x((Z,$)=>{var Q=process||{},z=Q.argv||[],J=Q.env||{},Y=!(!!J.NO_COLOR||z.includes("--no-color"))&&(!!J.FORCE_COLOR||z.includes("--color")||Q.platform==="win32"||(Q.stdout||{}).isTTY&&J.TERM!=="dumb"||!!J.CI),j=(q,U,K=q)=>(H)=>{let V=""+H,F=V.indexOf(U,q.length);return~F?q+X(V,U,K,F)+U:q+V+U},X=(q,U,K,H)=>{let V="",F=0;do V+=q.substring(F,H)+K,F=H+U.length,H=q.indexOf(U,F);while(~H);return V+q.substring(F)},G=(q=Y)=>{let U=q?j:()=>String;return{isColorSupported:q,reset:U("\x1B[0m","\x1B[0m"),bold:U("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:U("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:U("\x1B[3m","\x1B[23m"),underline:U("\x1B[4m","\x1B[24m"),inverse:U("\x1B[7m","\x1B[27m"),hidden:U("\x1B[8m","\x1B[28m"),strikethrough:U("\x1B[9m","\x1B[29m"),black:U("\x1B[30m","\x1B[39m"),red:U("\x1B[31m","\x1B[39m"),green:U("\x1B[32m","\x1B[39m"),yellow:U("\x1B[33m","\x1B[39m"),blue:U("\x1B[34m","\x1B[39m"),magenta:U("\x1B[35m","\x1B[39m"),cyan:U("\x1B[36m","\x1B[39m"),white:U("\x1B[37m","\x1B[39m"),gray:U("\x1B[90m","\x1B[39m"),bgBlack:U("\x1B[40m","\x1B[49m"),bgRed:U("\x1B[41m","\x1B[49m"),bgGreen:U("\x1B[42m","\x1B[49m"),bgYellow:U("\x1B[43m","\x1B[49m"),bgBlue:U("\x1B[44m","\x1B[49m"),bgMagenta:U("\x1B[45m","\x1B[49m"),bgCyan:U("\x1B[46m","\x1B[49m"),bgWhite:U("\x1B[47m","\x1B[49m"),blackBright:U("\x1B[90m","\x1B[39m"),redBright:U("\x1B[91m","\x1B[39m"),greenBright:U("\x1B[92m","\x1B[39m"),yellowBright:U("\x1B[93m","\x1B[39m"),blueBright:U("\x1B[94m","\x1B[39m"),magentaBright:U("\x1B[95m","\x1B[39m"),cyanBright:U("\x1B[96m","\x1B[39m"),whiteBright:U("\x1B[97m","\x1B[39m"),bgBlackBright:U("\x1B[100m","\x1B[49m"),bgRedBright:U("\x1B[101m","\x1B[49m"),bgGreenBright:U("\x1B[102m","\x1B[49m"),bgYellowBright:U("\x1B[103m","\x1B[49m"),bgBlueBright:U("\x1B[104m","\x1B[49m"),bgMagentaBright:U("\x1B[105m","\x1B[49m"),bgCyanBright:U("\x1B[106m","\x1B[49m"),bgWhiteBright:U("\x1B[107m","\x1B[49m")}};$.exports=G(),$.exports.createColors=G}),R0=x((Z,$)=>{$.exports=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g}}),E0=L(I0(),1);function G0(Z){return Z.replace(/[<[].+/,"").trim()}function C0(Z){let $=/<([^>]+)>/g,Q=/\[([^\]]+)\]/g,z=[],J=(X)=>{let G=!1,q=X[1];if(q.startsWith("..."))q=q.slice(3),G=!0;return{required:X[0].startsWith("<"),value:q,variadic:G}},Y;while(Y=$.exec(Z))z.push(J(Y));let j;while(j=Q.exec(Z))z.push(J(j));return z}function k0(Z){let $={alias:{},boolean:[]};for(let[Q,z]of Z.entries()){if(z.names.length>1)$.alias[z.names[0]]=z.names.slice(1);if(z.isBoolean)if(z.negated){if(!Z.some((Y,j)=>{return j!==Q&&Y.names.some((X)=>z.names.includes(X))&&typeof Y.required==="boolean"}))$.boolean.push(z.names[0])}else $.boolean.push(z.names[0])}return $}function Z0(Z){return Z.sort(($,Q)=>{return $.length>Q.length?-1:1})[0]}function $0(Z,$){return Z.length>=$?Z:`${Z}${" ".repeat($-Z.length)}`}function h0(Z){return Z.replace(/([a-z])-([a-z])/g,($,Q,z)=>{return Q+z.toUpperCase()})}function y0(Z,$,Q){let z=0,J=$.length,Y=Z,j;for(;z<J;++z)j=Y[$[z]],Y=Y[$[z]]=z===J-1?Q:j!=null?j:!!~$[z+1].indexOf(".")||!(+$[z+1]>-1)?{}:[]}function v0(Z,$){for(let Q of Object.keys($)){let z=$[Q];if(z.shouldTransform){if(Z[Q]=Array.prototype.concat.call([],Z[Q]),typeof z.transformFunction==="function")Z[Q]=Z[Q].map(z.transformFunction)}}}function f0(Z){let $=/([^\\/]+)$/.exec(Z);return $?$[1]:""}function K0(Z){return Z.split(".").map(($,Q)=>{return Q===0?h0($):$}).join(".")}class C extends Error{constructor(Z){super(Z);if(this.name=this.constructor.name,typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,this.constructor);else this.stack=Error(Z).stack}}function S0(){let{env:Z}=o,{TERM:$,TERM_PROGRAM:Q}=Z;if(o.platform!=="win32")return $!=="linux";return Boolean(Z.WT_SESSION)||Boolean(Z.TERMINUS_SUBLIME)||Z.ConEmuTask==="{cmd::Cmder}"||Q==="Terminus-Sublime"||Q==="vscode"||$==="xterm-256color"||$==="alacritty"||$==="rxvt-unicode"||$==="rxvt-unicode-256color"||Z.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var y="\x1B",N=`${y}[`;var w={to(Z,$){if(!$)return`${N}${Z+1}G`;return`${N}${$+1};${Z+1}H`},move(Z,$){let Q="";if(Z<0)Q+=`${N}${-Z}D`;else if(Z>0)Q+=`${N}${Z}C`;if($<0)Q+=`${N}${-$}A`;else if($>0)Q+=`${N}${$}B`;return Q},up:(Z=1)=>`${N}${Z}A`,down:(Z=1)=>`${N}${Z}B`,forward:(Z=1)=>`${N}${Z}C`,backward:(Z=1)=>`${N}${Z}D`,nextLine:(Z=1)=>`${N}E`.repeat(Z),prevLine:(Z=1)=>`${N}F`.repeat(Z),left:`${N}G`,hide:`${N}?25l`,show:`${N}?25h`,save:`${y}7`,restore:`${y}8`};var g={screen:`${N}2J`,up:(Z=1)=>`${N}1J`.repeat(Z),down:(Z=1)=>`${N}J`.repeat(Z),line:`${N}2K`,lineEnd:`${N}K`,lineStart:`${N}1K`,lines(Z){let $="";for(let Q=0;Q<Z;Q++)$+=this.line+(Q<Z-1?w.up():"");if(Z)$+=w.left;return $}},k6={screen:`${y}c`};class H0{rawName;description;name;names;isBoolean;required;config;negated;constructor(Z,$,Q){if(this.rawName=Z,this.description=$,this.config=Object.assign({},Q),Z=Z.replace(/\.\*/g,""),this.negated=!1,this.names=G0(Z).split(",").map((z)=>{let J=z.trim().replace(/^-{1,2}/,"");if(J.startsWith("no-"))this.negated=!0,J=J.replace(/^no-/,"");return K0(J)}).sort((z,J)=>z.length>J.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null)this.config.default=!0;if(Z.includes("<"))this.required=!0;else if(Z.includes("["))this.required=!1;else this.isBoolean=!0}}var y6=m.argv,g0=`${m.platform}-${m.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,_0=k.argv,u0=`${k.platform}-${k.arch} node-${k.version}`;class l{rawName;description;config;cli;options;aliasNames;name;args;commandAction;usageText;versionNumber;examples;helpCallback;globalCommand;constructor(Z,$,Q,z){if(this.rawName=Z,this.description=$,this.config=Q,this.cli=z,this.options=[],this.aliasNames=[],this.name=G0(Z),this.args=C0(Z),this.examples=[],!Q)this.config={}}usage(Z){return this.usageText=Z,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(Z,$="-v, --version"){return this.versionNumber=Z,this.option($,"Display version number"),this}example(Z){return this.examples.push(Z),this}option(Z,$,Q){let z=new H0(Z,$,Q);return this.options.push(z),this}alias(Z){return this.aliasNames.push(Z),this}action(Z){return this.commandAction=Z,this}isMatched(Z){return this.name===Z||this.aliasNames.includes(Z)}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof n}hasOption(Z){return Z=Z.split(".")[0],!!this.options.find(($)=>{return $.names.includes(Z)})}outputHelp(){let{name:Z,commands:$}=this.cli,{versionNumber:Q,options:z,helpCallback:J}=this.cli.globalCommand,Y=[{body:`${Z}${Q?`/${Q}`:""}`}];if(Y.push({title:"Usage",body:` $ ${Z} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&$.length>0){let G=Z0($.map((q)=>q.rawName));Y.push({title:"Commands",body:$.map((q)=>{return` ${$0(q.rawName,G.length)} ${q.description}`}).join(`
|
|
3
|
+
`)}),Y.push({title:"For more info, run any command with the `--help` flag",body:$.map((q)=>` $ ${Z}${q.name===""?"":` ${q.name}`} --help`).join(`
|
|
4
|
+
`)})}let X=this.isGlobalCommand?z:[...this.options,...z||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand)X=X.filter((G)=>G.name!=="version");if(X.length>0){let G=Z0(X.map((q)=>q.rawName));Y.push({title:"Options",body:X.map((q)=>{return` ${$0(q.rawName,G.length)} ${q.description} ${q.config.default===void 0?"":`(default: ${q.config.default})`}`}).join(`
|
|
5
|
+
`)})}if(this.examples.length>0)Y.push({title:"Examples",body:this.examples.map((G)=>{if(typeof G==="function")return G(Z);return G}).join(`
|
|
6
|
+
`)});if(J)Y=J(Y)||Y;console.log(Y.map((G)=>{return G.title?`${G.title}:
|
|
7
|
+
${G.body}`:G.body}).join(`
|
|
8
|
+
|
|
9
|
+
`))}outputVersion(){let{name:Z}=this.cli,{versionNumber:$}=this.cli.globalCommand;if($){let Q;if(Bun)Q=g0;else Q=u0;console.log(`${Z}/${$} ${Q}`)}}checkRequiredArgs(){let Z=this.args.filter(($)=>$.required).length;if(this.cli.args.length<Z)throw new C(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:Z,globalCommand:$}=this.cli;if(!this.config.allowUnknownOptions){for(let Q of Object.keys(Z))if(Q!=="--"&&!this.hasOption(Q)&&!$.hasOption(Q))throw new C(`Unknown option \`${Q.length>1?`--${Q}`:`-${Q}`}\``)}}checkOptionValue(){let{options:Z,globalCommand:$}=this.cli,Q=[...$.options,...this.options];for(let z of Q){let J=Z[z.name.split(".")[0]];if(z.required){let Y=Q.some((j)=>j.negated&&j.names.includes(z.name));if(J===!0||J===!1&&!Y)throw new C(`option \`${z.rawName}\` value is missing`)}}}}class n extends l{constructor(Z){super("@@global@@","",{},Z)}}var d0=l;class a extends A0{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;constructor(Z=""){super();this.name=Z,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new n(this),this.globalCommand.usage("<command> [options]")}usage(Z){return this.globalCommand.usage(Z),this}command(Z,$,Q){if(!Q)Q={};let z=new d0(Z,$||"",Q,this);return z.globalCommand=this.globalCommand,this.commands.push(z),z}option(Z,$,Q){return this.globalCommand.option(Z,$,Q),this}help(Z){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=Z,this.showHelpOnExit=!0,this}version(Z,$="-v, --version"){return this.globalCommand.version(Z,$),this.showVersionOnExit=!0,this}example(Z){return this.globalCommand.example(Z),this}outputHelp(){if(this.matchedCommand)this.matchedCommand.outputHelp();else this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:Z,options:$},Q,z){if(this.args=Z,this.options=$,Q)this.matchedCommand=Q;if(z)this.matchedCommandName=z;return this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(Z=_0,{run:$=!0}={}){if(this.rawArgs=Z,!this.name)this.name=Z[1]?f0(Z[1]):"cli";let Q=!0;for(let J of this.commands){let Y=this.mri(Z.slice(2),J),j=Y.args[0];if(J.isMatched(j)){Q=!1;let X={...Y,args:Y.args.slice(1)};this.setParsedInfo(X,J,j),this.emit(`command:${j}`,J)}}if(Q){for(let J of this.commands)if(J.name===""){Q=!1;let Y=this.mri(Z.slice(2),J);this.setParsedInfo(Y,J),this.emit("command:!",J)}}if(Q){let J=this.mri(Z.slice(2));this.setParsedInfo(J)}if(this.options.help&&this.showHelpOnExit)this.outputHelp(),$=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),$=!1,this.unsetMatchedCommand();let z={args:this.args,options:this.options};if($)this.runMatchedCommand();if(!this.matchedCommand&&this.args[0])this.emit("command:*");return z}mri(Z,$){let Q=[...this.globalCommand.options,...$?$.options:[]],z=k0(Q),J=[],Y=Z.indexOf("--");if(Y>-1)J=Z.slice(Y+1),Z=Z.slice(0,Y);let j=E0.default(Z,z);j=Object.keys(j).reduce((K,H)=>{return{...K,[K0(H)]:j[H]}},{_:[]});let X=j._,G={"--":J},q=$&&$.config.ignoreOptionDefaultValue?$.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,U=Object.create(null);for(let K of Q){if(!q&&K.config.default!==void 0)for(let H of K.names)G[H]=K.config.default;if(Array.isArray(K.config.type)){if(U[K.name]===void 0)U[K.name]=Object.create(null),U[K.name].shouldTransform=!0,U[K.name].transformFunction=K.config.type[0]}}for(let K of Object.keys(j))if(K!=="_"){let H=K.split(".");y0(G,H,j[K]),v0(G,U)}return{args:X,options:G}}runMatchedCommand(){let{args:Z,options:$,matchedCommand:Q}=this;if(!Q||!Q.commandAction)return;Q.checkUnknownOptions(),Q.checkOptionValue(),Q.checkRequiredArgs();let z=[];return Q.args.forEach((J,Y)=>{if(J.variadic)z.push(Z.slice(Y));else z.push(Z[Y])}),z.push($),Q.commandAction.apply(this,z)}}var f6=L(B(),1),x0=["up","down","left","right","space","enter","cancel"],h={actions:new Set(x0),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};function V0(Z,$){if(typeof Z==="string")return h.aliases.get(Z)===$;for(let Q of Z){if(Q===void 0)continue;if(V0(Q,$))return!0}return!1}function l0(Z,$){if(Z===$)return[];let Q=Z.split(`
|
|
10
|
+
`),z=$.split(`
|
|
11
|
+
`),J=[];for(let Y=0;Y<Math.max(Q.length,z.length);Y++)if(Q[Y]!==z[Y])J.push(Y);return J}var u6=m0.platform.startsWith("win"),Q0=Symbol("clapp:cancel");function A(Z,$){let Q=Z;if(Q.isTTY)Q.setRawMode($)}var _=L(B(),1);function p0({onlyFirst:Z=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",Z?void 0:"g")}var i0=p0();function F0(Z){if(typeof Z!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof Z}\``);return Z.replace(i0,"")}function r0(Z){return Z===161||Z===164||Z===167||Z===168||Z===170||Z===173||Z===174||Z>=176&&Z<=180||Z>=182&&Z<=186||Z>=188&&Z<=191||Z===198||Z===208||Z===215||Z===216||Z>=222&&Z<=225||Z===230||Z>=232&&Z<=234||Z===236||Z===237||Z===240||Z===242||Z===243||Z>=247&&Z<=250||Z===252||Z===254||Z===257||Z===273||Z===275||Z===283||Z===294||Z===295||Z===299||Z>=305&&Z<=307||Z===312||Z>=319&&Z<=322||Z===324||Z>=328&&Z<=331||Z===333||Z===338||Z===339||Z===358||Z===359||Z===363||Z===462||Z===464||Z===466||Z===468||Z===470||Z===472||Z===474||Z===476||Z===593||Z===609||Z===708||Z===711||Z>=713&&Z<=715||Z===717||Z===720||Z>=728&&Z<=731||Z===733||Z===735||Z>=768&&Z<=879||Z>=913&&Z<=929||Z>=931&&Z<=937||Z>=945&&Z<=961||Z>=963&&Z<=969||Z===1025||Z>=1040&&Z<=1103||Z===1105||Z===8208||Z>=8211&&Z<=8214||Z===8216||Z===8217||Z===8220||Z===8221||Z>=8224&&Z<=8226||Z>=8228&&Z<=8231||Z===8240||Z===8242||Z===8243||Z===8245||Z===8251||Z===8254||Z===8308||Z===8319||Z>=8321&&Z<=8324||Z===8364||Z===8451||Z===8453||Z===8457||Z===8467||Z===8470||Z===8481||Z===8482||Z===8486||Z===8491||Z===8531||Z===8532||Z>=8539&&Z<=8542||Z>=8544&&Z<=8555||Z>=8560&&Z<=8569||Z===8585||Z>=8592&&Z<=8601||Z===8632||Z===8633||Z===8658||Z===8660||Z===8679||Z===8704||Z===8706||Z===8707||Z===8711||Z===8712||Z===8715||Z===8719||Z===8721||Z===8725||Z===8730||Z>=8733&&Z<=8736||Z===8739||Z===8741||Z>=8743&&Z<=8748||Z===8750||Z>=8756&&Z<=8759||Z===8764||Z===8765||Z===8776||Z===8780||Z===8786||Z===8800||Z===8801||Z>=8804&&Z<=8807||Z===8810||Z===8811||Z===8814||Z===8815||Z===8834||Z===8835||Z===8838||Z===8839||Z===8853||Z===8857||Z===8869||Z===8895||Z===8978||Z>=9312&&Z<=9449||Z>=9451&&Z<=9547||Z>=9552&&Z<=9587||Z>=9600&&Z<=9615||Z>=9618&&Z<=9621||Z===9632||Z===9633||Z>=9635&&Z<=9641||Z===9650||Z===9651||Z===9654||Z===9655||Z===9660||Z===9661||Z===9664||Z===9665||Z>=9670&&Z<=9672||Z===9675||Z>=9678&&Z<=9681||Z>=9698&&Z<=9701||Z===9711||Z===9733||Z===9734||Z===9737||Z===9742||Z===9743||Z===9756||Z===9758||Z===9792||Z===9794||Z===9824||Z===9825||Z>=9827&&Z<=9829||Z>=9831&&Z<=9834||Z===9836||Z===9837||Z===9839||Z===9886||Z===9887||Z===9919||Z>=9926&&Z<=9933||Z>=9935&&Z<=9939||Z>=9941&&Z<=9953||Z===9955||Z===9960||Z===9961||Z>=9963&&Z<=9969||Z===9972||Z>=9974&&Z<=9977||Z===9979||Z===9980||Z===9982||Z===9983||Z===10045||Z>=10102&&Z<=10111||Z>=11094&&Z<=11097||Z>=12872&&Z<=12879||Z>=57344&&Z<=63743||Z>=65024&&Z<=65039||Z===65533||Z>=127232&&Z<=127242||Z>=127248&&Z<=127277||Z>=127280&&Z<=127337||Z>=127344&&Z<=127373||Z===127375||Z===127376||Z>=127387&&Z<=127404||Z>=917760&&Z<=917999||Z>=983040&&Z<=1048573||Z>=1048576&&Z<=1114109}function s0(Z){return Z===12288||Z>=65281&&Z<=65376||Z>=65504&&Z<=65510}function e0(Z){return Z>=4352&&Z<=4447||Z===8986||Z===8987||Z===9001||Z===9002||Z>=9193&&Z<=9196||Z===9200||Z===9203||Z===9725||Z===9726||Z===9748||Z===9749||Z>=9776&&Z<=9783||Z>=9800&&Z<=9811||Z===9855||Z>=9866&&Z<=9871||Z===9875||Z===9889||Z===9898||Z===9899||Z===9917||Z===9918||Z===9924||Z===9925||Z===9934||Z===9940||Z===9962||Z===9970||Z===9971||Z===9973||Z===9978||Z===9981||Z===9989||Z===9994||Z===9995||Z===10024||Z===10060||Z===10062||Z>=10067&&Z<=10069||Z===10071||Z>=10133&&Z<=10135||Z===10160||Z===10175||Z===11035||Z===11036||Z===11088||Z===11093||Z>=11904&&Z<=11929||Z>=11931&&Z<=12019||Z>=12032&&Z<=12245||Z>=12272&&Z<=12287||Z>=12289&&Z<=12350||Z>=12353&&Z<=12438||Z>=12441&&Z<=12543||Z>=12549&&Z<=12591||Z>=12593&&Z<=12686||Z>=12688&&Z<=12773||Z>=12783&&Z<=12830||Z>=12832&&Z<=12871||Z>=12880&&Z<=42124||Z>=42128&&Z<=42182||Z>=43360&&Z<=43388||Z>=44032&&Z<=55203||Z>=63744&&Z<=64255||Z>=65040&&Z<=65049||Z>=65072&&Z<=65106||Z>=65108&&Z<=65126||Z>=65128&&Z<=65131||Z>=94176&&Z<=94180||Z===94192||Z===94193||Z>=94208&&Z<=100343||Z>=100352&&Z<=101589||Z>=101631&&Z<=101640||Z>=110576&&Z<=110579||Z>=110581&&Z<=110587||Z===110589||Z===110590||Z>=110592&&Z<=110882||Z===110898||Z>=110928&&Z<=110930||Z===110933||Z>=110948&&Z<=110951||Z>=110960&&Z<=111355||Z>=119552&&Z<=119638||Z>=119648&&Z<=119670||Z===126980||Z===127183||Z===127374||Z>=127377&&Z<=127386||Z>=127488&&Z<=127490||Z>=127504&&Z<=127547||Z>=127552&&Z<=127560||Z===127568||Z===127569||Z>=127584&&Z<=127589||Z>=127744&&Z<=127776||Z>=127789&&Z<=127797||Z>=127799&&Z<=127868||Z>=127870&&Z<=127891||Z>=127904&&Z<=127946||Z>=127951&&Z<=127955||Z>=127968&&Z<=127984||Z===127988||Z>=127992&&Z<=128062||Z===128064||Z>=128066&&Z<=128252||Z>=128255&&Z<=128317||Z>=128331&&Z<=128334||Z>=128336&&Z<=128359||Z===128378||Z===128405||Z===128406||Z===128420||Z>=128507&&Z<=128591||Z>=128640&&Z<=128709||Z===128716||Z>=128720&&Z<=128722||Z>=128725&&Z<=128727||Z>=128732&&Z<=128735||Z===128747||Z===128748||Z>=128756&&Z<=128764||Z>=128992&&Z<=129003||Z===129008||Z>=129292&&Z<=129338||Z>=129340&&Z<=129349||Z>=129351&&Z<=129535||Z>=129648&&Z<=129660||Z>=129664&&Z<=129673||Z>=129679&&Z<=129734||Z>=129742&&Z<=129756||Z>=129759&&Z<=129769||Z>=129776&&Z<=129784||Z>=131072&&Z<=196605||Z>=196608&&Z<=262141}function t0(Z){if(!Number.isSafeInteger(Z))throw TypeError(`Expected a code point, got \`${typeof Z}\`.`)}function o0(Z,{ambiguousAsWide:$=!1}={}){if(t0(Z),s0(Z)||e0(Z)||$&&r0(Z))return 2;return 1}var Z6=L(R0(),1),$6=new Intl.Segmenter,Q6=/^\p{Default_Ignorable_Code_Point}$/u;function I(Z,$={}){if(typeof Z!=="string"||Z.length===0)return 0;let{ambiguousIsNarrow:Q=!0,countAnsiEscapeCodes:z=!1}=$;if(!z)Z=F0(Z);if(Z.length===0)return 0;let J=0,Y={ambiguousAsWide:!Q};for(let{segment:j}of $6.segment(Z)){let X=j.codePointAt(0);if(X<=31||X>=127&&X<=159)continue;if(X>=8203&&X<=8207||X===65279)continue;if(X>=768&&X<=879||X>=6832&&X<=6911||X>=7616&&X<=7679||X>=8400&&X<=8447||X>=65056&&X<=65071)continue;if(X>=55296&&X<=57343)continue;if(X>=65024&&X<=65039)continue;if(Q6.test(j))continue;if(Z6.default().test(j)){J+=2;continue}J+=o0(X,Y)}return J}var u=10,J0=(Z=0)=>($)=>`\x1B[${$+Z}m`,Y0=(Z=0)=>($)=>`\x1B[${38+Z};5;${$}m`,X0=(Z=0)=>($,Q,z)=>`\x1B[${38+Z};2;${$};${Q};${z}m`,D={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},x6=Object.keys(D.modifier),z6=Object.keys(D.color),J6=Object.keys(D.bgColor),l6=[...z6,...J6];function Y6(){let Z=new Map;for(let[$,Q]of Object.entries(D)){for(let[z,J]of Object.entries(Q))D[z]={open:`\x1B[${J[0]}m`,close:`\x1B[${J[1]}m`},Q[z]=D[z],Z.set(J[0],J[1]);Object.defineProperty(D,$,{value:Q,enumerable:!1})}return Object.defineProperty(D,"codes",{value:Z,enumerable:!1}),D.color.close="\x1B[39m",D.bgColor.close="\x1B[49m",D.color.ansi=J0(),D.color.ansi256=Y0(),D.color.ansi16m=X0(),D.bgColor.ansi=J0(u),D.bgColor.ansi256=Y0(u),D.bgColor.ansi16m=X0(u),Object.defineProperties(D,{rgbToAnsi256:{value:($,Q,z)=>{if($===Q&&Q===z){if($<8)return 16;if($>248)return 231;return Math.round(($-8)/247*24)+232}return 16+36*Math.round($/255*5)+6*Math.round(Q/255*5)+Math.round(z/255*5)},enumerable:!1},hexToRgb:{value:($)=>{let Q=/[a-f\d]{6}|[a-f\d]{3}/i.exec($.toString(16));if(!Q)return[0,0,0];let[z]=Q;if(z.length===3)z=[...z].map((Y)=>Y+Y).join("");let J=Number.parseInt(z,16);return[J>>16&255,J>>8&255,J&255]},enumerable:!1},hexToAnsi256:{value:($)=>D.rgbToAnsi256(...D.hexToRgb($)),enumerable:!1},ansi256ToAnsi:{value:($)=>{if($<8)return 30+$;if($<16)return 90+($-8);let Q,z,J;if($>=232)Q=(($-232)*10+8)/255,z=Q,J=Q;else{$-=16;let X=$%36;Q=Math.floor($/36)/5,z=Math.floor(X/6)/5,J=X%6/5}let Y=Math.max(Q,z,J)*2;if(Y===0)return 30;let j=30+(Math.round(J)<<2|Math.round(z)<<1|Math.round(Q));if(Y===2)j+=60;return j},enumerable:!1},rgbToAnsi:{value:($,Q,z)=>D.ansi256ToAnsi(D.rgbToAnsi256($,Q,z)),enumerable:!1},hexToAnsi:{value:($)=>D.ansi256ToAnsi(D.hexToAnsi256($)),enumerable:!1}}),D}var X6=Y6(),j6=X6,f=new Set(["\x1B","\x9B"]),U6=39,c="\x07",D0="[",q6="]",W0="m",v=`${q6}8;;`,j0=(Z)=>`${f.values().next().value}${D0}${Z}${W0}`,U0=(Z)=>`${f.values().next().value}${v}${Z}${c}`,G6=(Z)=>Z.split(" ").map(($)=>I($)),d=(Z,$,Q)=>{let z=[...$],J=!1,Y=!1,j=I(F0(Z.at(-1)));for(let[X,G]of z.entries()){let q=I(G);if(j+q<=Q)Z[Z.length-1]+=G;else Z.push(G),j=0;if(f.has(G))J=!0,Y=z.slice(X+1,X+1+v.length).join("")===v;if(J){if(Y){if(G===c)J=!1,Y=!1}else if(G===W0)J=!1;continue}if(j+=q,j===Q&&X<z.length-1)Z.push(""),j=0}if(!j&&Z.at(-1).length>0&&Z.length>1)Z[Z.length-2]+=Z.pop()},K6=(Z)=>{let $=Z.split(" "),Q=$.length;while(Q>0){if(I($[Q-1])>0)break;Q--}if(Q===$.length)return Z;return $.slice(0,Q).join(" ")+$.slice(Q).join("")},H6=(Z,$,Q={})=>{if(Q.trim!==!1&&Z.trim()==="")return"";let z="",J,Y,j=G6(Z),X=[""];for(let[K,H]of Z.split(" ").entries()){if(Q.trim!==!1)X[X.length-1]=X.at(-1).trimStart();let V=I(X.at(-1));if(K!==0){if(V>=$&&(Q.wordWrap===!1||Q.trim===!1))X.push(""),V=0;if(V>0||Q.trim===!1)X[X.length-1]+=" ",V++}if(Q.hard&&j[K]>$){let F=$-V,T=1+Math.floor((j[K]-F-1)/$);if(Math.floor((j[K]-1)/$)<T)X.push("");d(X,H,$);continue}if(V+j[K]>$&&V>0&&j[K]>0){if(Q.wordWrap===!1&&V<$){d(X,H,$);continue}X.push("")}if(V+j[K]>$&&Q.wordWrap===!1){d(X,H,$);continue}X[X.length-1]+=H}if(Q.trim!==!1)X=X.map((K)=>K6(K));let G=X.join(`
|
|
12
|
+
`),q=[...G],U=0;for(let[K,H]of q.entries()){if(z+=H,f.has(H)){let{groups:F}=new RegExp(`(?:\\${D0}(?<code>\\d+)m|\\${v}(?<uri>.*)${c})`).exec(G.slice(U))||{groups:{}};if(F.code!==void 0){let T=Number.parseFloat(F.code);J=T===U6?void 0:T}else if(F.uri!==void 0)Y=F.uri.length===0?void 0:F.uri}let V=j6.codes.get(Number(J));if(q[K+1]===`
|
|
13
|
+
`){if(Y)z+=U0("");if(J&&V)z+=j0(V)}else if(H===`
|
|
14
|
+
`){if(J&&V)z+=j0(J);if(Y)z+=U0(Y)}U+=H.length}return z};function q0(Z,$,Q){return String(Z).normalize().replaceAll(`\r
|
|
15
|
+
`,`
|
|
16
|
+
`).split(`
|
|
17
|
+
`).map((z)=>H6(z,$,Q)).join(`
|
|
18
|
+
`)}class p{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;_manualLine="";state="initial";error="";value;userInput="";constructor(Z,$=!0){let{input:Q=n0,output:z=a0,render:J,signal:Y,...j}=Z;this.opts=j,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=J.bind(this),this._track=$,this._abortSignal=Y,this.input=Q,this.output=z}unsubscribe(){this._subscribers.clear()}setSubscriber(Z,$){let Q=this._subscribers.get(Z)??[];Q.push($),this._subscribers.set(Z,Q)}on(Z,$){return this.setSubscriber(Z,{cb:$}),this}once(Z,$){return this.setSubscriber(Z,{cb:$,once:!0}),this}emit(Z,...$){let Q=this._subscribers.get(Z)??[],z=[];for(let J of Q)if(J.cb(...$),J.once)z.push(()=>Q.splice(Q.indexOf(J),1));for(let J of z)J();return this}prompt(){return new Promise((Z)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),Z(Q0);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}if(this.rl=c0.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0)this._setUserInput(this.opts.initialUserInput,!0);this.input.on("keypress",this.onKeypress),A(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(w.show),this.output.off("resize",this.render),A(this.input,!1),Z(this.value)}),this.once("cancel",()=>{this.output.write(w.show),this.output.off("resize",this.render),A(this.input,!1),Z(Q0)})})}_isActionKey(Z,$){return Z==="\t"}_setValue(Z){this.value=Z,this.emit("value",this.value)}_setUserInput(Z,$){if(this.userInput=Z??"",this.emit("userInput",this.userInput),$&&this._track&&this.rl)this.rl.write(this.userInput),this._cursor=this.rl.cursor}onKeypress(Z,$){if(this._track&&$.name!=="return"){if($.name&&this._isActionKey(Z,$))this.rl?.write(null,{ctrl:!0,name:"h"});this._cursor=this.rl?.cursor??0;let Q=$.name==="tab"||$.name==="escape"||$.name==="backspace"||$.name==="delete"||$.name==="enter"||$.name==="return"||$.name&&["up","down","left","right"].includes($.name);if(Z&&!Q&&Z.length===1&&Z>=" ")this._manualLine+=Z;else if($.name==="backspace"&&this._manualLine.length>0)this._manualLine=this._manualLine.slice(0,-1);let z=this._manualLine.length>=(this.rl?.line?.length||0)?this._manualLine:this.rl?.line;this._setUserInput(z)}if(this.state==="error")this.state="active",this.error="";if($?.name){if(!this._track&&h.aliases.has($.name))this.emit("cursor",h.aliases.get($.name));if(h.actions.has($.name))this.emit("cursor",$.name)}if(Z&&(Z.toLowerCase()==="y"||Z.toLowerCase()==="n"))this.emit("confirm",Z.toLowerCase()==="y");if(this.emit("key",Z?.toLowerCase(),$),$?.name==="return"){if(this.opts.validate){let Q=this.opts.validate(this.value);if(Q)this.error=Q instanceof Error?Q.message:Q,this.state="error"}if(this.state!=="error")this.state="submit"}if(V0([Z,$?.name,$?.sequence],"cancel"))this.state="cancel";if(this.state==="submit"||this.state==="cancel")this.emit("finalize");if(this.render(),this.state==="submit"||this.state==="cancel")this.close()}close(){if(this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
19
|
+
`),A(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.state==="cancel")setTimeout(()=>{this.unsubscribe()},10);else this.unsubscribe()}restoreCursor(){let Z=q0(this._prevFrame,z0.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
20
|
+
`).length-1;this.output.write(w.move(-999,Z*-1))}render(){let Z=q0(this._render(this)??"",z0.stdout.columns,{hard:!0,trim:!1});if(Z===this._prevFrame)return;if(this.state==="initial")this.output.write(w.hide);else{let $=l0(this._prevFrame,Z);if(this.restoreCursor(),$&&$?.length===1){let Q=$[0];this.output.write(w.move(0,Q)),this.output.write(g.lines(1));let z=Z.split(`
|
|
21
|
+
`);this.output.write(z[Q]),this._prevFrame=Z,this.output.write(w.move(0,z.length-Q-1));return}if($&&$?.length>1){let Q=$[0];this.output.write(w.move(0,Q)),this.output.write(g.down());let J=Z.split(`
|
|
22
|
+
`).slice(Q);this.output.write(J.join(`
|
|
23
|
+
`)),this._prevFrame=Z;return}this.output.write(g.down())}if(this.output.write(Z),this.state==="initial")this.state="active";this._prevFrame=Z}}function V6(Z,$){if(Z===void 0)return 0;if($.length===0)return 0;let z=$.findIndex((J)=>J.value===Z);return z!==-1?z:0}function F6(Z,$){return($.label??String($.value)).toLowerCase().includes(Z.toLowerCase())}function D6(Z,$){if(!$)return;if(Z)return $;return $[0]}class W6 extends p{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#Z=0;#Q="";#z;#$;get cursor(){return this.#Z}get userInputWithCursor(){if(!this.userInput)return _.default.inverse(_.default.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;let Z=this.userInput.slice(0,this._cursor),[$,...Q]=this.userInput.slice(this._cursor);return`${Z}${_.default.inverse($)}${Q.join("")}`}get options(){if(typeof this.#$==="function")return this.#$();return this.#$}constructor(Z){super(Z);this.#$=Z.options;let $=this.options;this.filteredOptions=[...$],this.multiple=Z.multiple===!0,this.#z=Z.filter??F6;let Q;if(Z.initialValue&&Array.isArray(Z.initialValue))if(this.multiple)Q=Z.initialValue;else Q=Z.initialValue.slice(0,1);else if(!this.multiple&&this.options.length>0)Q=[this.options[0].value];if(Q)for(let z of Q){let J=$.findIndex((Y)=>Y.value===z);if(J!==-1)this.toggleSelected(z),this.#Z=J}this.focusedValue=this.options[this.#Z]?.value,this.on("key",(z,J)=>this.#J(z,J)),this.on("userInput",(z)=>this.#Y(z))}_isActionKey(Z,$){return Z==="\t"||this.multiple&&this.isNavigating&&$.name==="space"&&Z!==void 0&&Z!==""}#J(Z,$){let Q=$.name==="up",z=$.name==="down",J=$.name==="return";if(Q||z){if(this.#Z=Math.max(0,Math.min(this.#Z+(Q?-1:1),this.filteredOptions.length-1)),this.focusedValue=this.filteredOptions[this.#Z]?.value,!this.multiple)this.selectedValues=[this.focusedValue];this.isNavigating=!0}else if(J)this.value=D6(this.multiple,this.selectedValues);else if(this.multiple)if(this.focusedValue!==void 0&&($.name==="tab"||this.isNavigating&&$.name==="space"))this.toggleSelected(this.focusedValue);else this.isNavigating=!1;else{if(this.focusedValue)this.selectedValues=[this.focusedValue];this.isNavigating=!1}}deselectAll(){this.selectedValues=[]}toggleSelected(Z){if(this.filteredOptions.length===0)return;if(this.multiple)if(this.selectedValues.includes(Z))this.selectedValues=this.selectedValues.filter(($)=>$!==Z);else this.selectedValues=[...this.selectedValues,Z];else this.selectedValues=[Z]}#Y(Z){if(Z!==this.#Q){this.#Q=Z;let $=this.options;if(Z)this.filteredOptions=$.filter((Q)=>this.#z(Z,Q));else this.filteredOptions=[...$];if(this.#Z=V6(this.focusedValue,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#Z]?.value,!this.multiple)if(this.focusedValue!==void 0)this.toggleSelected(this.focusedValue);else this.deselectAll()}}}class L6 extends p{options;cursor=0;#Z;getGroupItems(Z){return this.options.filter(($)=>$.group===Z)}isGroupSelected(Z){let $=this.getGroupItems(Z),Q=this.value;if(Q===void 0)return!1;return $.every((z)=>Q.includes(z.value))}toggleValue(){let Z=this.options[this.cursor];if(this.value===void 0)this.value=[];if(Z.group===!0){let $=Z.value,Q=this.getGroupItems($);if(this.isGroupSelected($))this.value=this.value.filter((z)=>Q.findIndex((J)=>J.value===z)===-1);else this.value=[...this.value,...Q.map((z)=>z.value)];this.value=Array.from(new Set(this.value))}else{let $=this.value.includes(Z.value);this.value=$?this.value.filter((Q)=>Q!==Z.value):[...this.value,Z.value]}}constructor(Z){super(Z,!1);let{options:$}=Z;this.#Z=Z.selectableGroups!==!1,this.options=Object.entries($).flatMap(([Q,z])=>[{value:Q,group:!0,label:Q},...z.map((J)=>({...J,group:Q}))]),this.value=[...Z.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Q})=>Q===Z.cursorAt),this.#Z?0:1),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let z=this.options[this.cursor]?.group===!0;if(!this.#Z&&z)this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let z=this.options[this.cursor]?.group===!0;if(!this.#Z&&z)this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}case"space":this.toggleValue();break}})}}var n6=L(B(),1);var a6=L(B(),1);var c6=L(B(),1),P={red:["\x1B[31m","\x1B[39m"],green:["\x1B[32m","\x1B[39m"],blue:["\x1B[34m","\x1B[39m"],yellow:["\x1B[33m","\x1B[39m"],cyan:["\x1B[36m","\x1B[39m"],magenta:["\x1B[35m","\x1B[39m"],white:["\x1B[37m","\x1B[39m"],gray:["\x1B[90m","\x1B[39m"],bgRed:["\x1B[41m","\x1B[49m"],bgGreen:["\x1B[42m","\x1B[49m"],bgBlue:["\x1B[44m","\x1B[49m"],bgYellow:["\x1B[43m","\x1B[49m"],bgCyan:["\x1B[46m","\x1B[49m"],bgMagenta:["\x1B[45m","\x1B[49m"],bold:["\x1B[1m","\x1B[22m"],italic:["\x1B[3m","\x1B[23m"],underline:["\x1B[4m","\x1B[24m"],dim:["\x1B[2m","\x1B[22m"],inverse:["\x1B[7m","\x1B[27m"],hidden:["\x1B[8m","\x1B[28m"],strikethrough:["\x1B[9m","\x1B[29m"]},b={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function M6(){return!0}function N6(){let Z={};Z.supportsColor=M6();function $(z,J=[]){let Y=z===""?[]:[...J,z],j=function(G){if(!Z.supportsColor)return G;let q="",U="";for(let K of Y)if(K in b&&b[K]in P){let H=b[K];q+=P[H][0],U=P[H][1]+U}else if(K in P)q+=P[K][0],U=P[K][1]+U;return q+G+U},X=[...Object.keys(P),...Object.keys(b)];for(let G of X)if(!(G in j))Object.defineProperty(j,G,{get(){return $(G,Y)}});return j}let Q=[...Object.keys(P),...Object.keys(b)];for(let z of Q)if(!(z in Z))Object.defineProperty(Z,z,{get(){return $(z)}});return Z}var p6=N6();var B6=S0();var W=(Z,$)=>B6?Z:$,i6=W("\u25C6","*"),r6=W("\u25A0","x"),s6=W("\u25B2","x"),e6=W("\u25C7","o"),t6=W("\u250C","T"),O6=W("\u2502","|"),o6=W("\u2514","\u2014"),Z1=W("\u25CF",">"),$1=W("\u25CB"," "),Q1=W("\u25FB","[\u2022]"),z1=W("\u25FC","[+]"),J1=W("\u25FB","[ ]"),Y1=W("\u25AA","\u2022"),X1=W("\u2500","-"),j1=W("\u256E","+"),U1=W("\u251C","+"),q1=W("\u256F","+"),G1=W("\u25CF","\u2022"),K1=W("\u25C6","*"),H1=W("\u25B2","!"),V1=W("\u25A0","x");var F1=L(B(),1);var D1=L(B(),1);var W1=L(B(),1);var L1=L(B(),1);var M1=L(B(),1);var N1=L(B(),1);var B1=L(B(),1);var O1=L(B(),1);var T1=L(B(),1),w1=L(B(),1);var P1={light:W("\u2500","-"),heavy:W("\u2501","="),block:W("\u2588","#")};var b1=L(B(),1);var I1=L(B(),1);var T6=L(B(),1);function w6(){return`${T6.default.gray(O6)} `}var R1=w6();var E1=L(B(),1);var A1=L(B(),1);var L0="0.0.5";var E=new a("bunpress"),O={outdir:"./dist",port:3000,open:!0,watch:!0,verbose:M0.verbose};async function I6(Z){let $=new N0("**/*.md"),Q=[];for await(let z of $.scan(Z))Q.push(R(Z,z));return Q}async function R6(Z,$=!1){try{await i("./docs/public");let z=new N0("**/*");for await(let J of z.scan("./docs/public")){let Y=R("./docs/public",J),j=R(Z,J);await B0(R(Z,J.split("/").slice(0,-1).join("/")),{recursive:!0}),await b6(Y,j)}}catch{if($)console.log("No public directory found, skipping static assets copy")}}async function r(Z={}){let $=Z.outdir||O.outdir,Q=Z.verbose??O.verbose;await B0($,{recursive:!0});let J=await I6("./docs");if(J.length===0)return console.log("No markdown files found in docs directory"),!1;if(Q)console.log(`Found ${J.length} markdown files:`),J.forEach((Y)=>console.log(`- ${Y}`));try{let Y=await Bun.build({entrypoints:J,outdir:$});if(!Y.success){console.error("Build failed:");for(let j of Y.logs)console.error(j);return!1}if(await R6($,Q),Q){console.log("Build successful!"),console.log("Generated files:");for(let j of Y.outputs)console.log(`- ${j.path}`)}return await E6($,J),!0}catch(Y){return console.error("Error during build:",Y),!1}}async function E6(Z,$){let z=`<!DOCTYPE html>
|
|
24
|
+
<html lang="en">
|
|
25
|
+
<head>
|
|
26
|
+
<meta charset="UTF-8">
|
|
27
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
28
|
+
<title>BunPress Documentation</title>
|
|
29
|
+
<style>
|
|
30
|
+
body {
|
|
31
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
|
32
|
+
line-height: 1.6;
|
|
33
|
+
color: #333;
|
|
34
|
+
max-width: 800px;
|
|
35
|
+
margin: 0 auto;
|
|
36
|
+
padding: 2rem;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.markdown-body {
|
|
40
|
+
padding: 1rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
a {
|
|
44
|
+
color: #1F1FE9;
|
|
45
|
+
text-decoration: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
a:hover {
|
|
49
|
+
text-decoration: underline;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
h1 {
|
|
53
|
+
border-bottom: 1px solid #eaecef;
|
|
54
|
+
padding-bottom: 0.3em;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
ul {
|
|
58
|
+
padding-left: 2rem;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
li {
|
|
62
|
+
margin-bottom: 0.5rem;
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
65
|
+
</head>
|
|
66
|
+
<body>
|
|
67
|
+
<div class="markdown-body">
|
|
68
|
+
<h1>BunPress Documentation</h1>
|
|
69
|
+
|
|
70
|
+
<p>Welcome to the BunPress documentation! BunPress is a modern documentation engine powered by Bun.</p>
|
|
71
|
+
|
|
72
|
+
<h2>Documentation Pages</h2>
|
|
73
|
+
|
|
74
|
+
<ul>
|
|
75
|
+
${$.map((J)=>{let Y=J.replace("./docs/",""),j=Y.replace(".md",".html"),X=Y.replace(".md","").replace(/\.([^.]+)$/,""),G=X.charAt(0).toUpperCase()+X.slice(1).replace(/-/g," ");return`<li><a href="${j}">${G}</a></li>`}).join(`
|
|
76
|
+
`)}
|
|
77
|
+
</ul>
|
|
78
|
+
|
|
79
|
+
<h2>About BunPress</h2>
|
|
80
|
+
|
|
81
|
+
<p>BunPress is a documentation engine that converts Markdown files to HTML. It offers full customization of the generated HTML, including custom CSS, scripts, and templates.</p>
|
|
82
|
+
|
|
83
|
+
<p>Visit the <a href="https://github.com/stacksjs/bunpress">GitHub repository</a> to learn more.</p>
|
|
84
|
+
</div>
|
|
85
|
+
</body>
|
|
86
|
+
</html>`;await Bun.write(R(Z,"index.html"),z)}E.command("build","Build the documentation site").option("--outdir <outdir>","Output directory",{default:O.outdir}).option("--config <config>","Path to config file").option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z)=>{if(!await r(Z))O0.exit(1);console.log("Documentation built successfully!")});E.command("dev","Build and serve documentation using Bun's HTML server").option("--port <port>","Port to listen on",{default:O.port}).option("--outdir <outdir>","Output directory",{default:O.outdir}).option("--open","Open in browser",{default:O.open}).option("--watch","Watch for changes",{default:O.watch}).option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z)=>{console.log("dev",Z);let $=Z.outdir||O.outdir,Q=Z.port||O.port,z=Z.verbose??O.verbose,J=Z.watch??O.watch;if(console.log("Building documentation..."),!await r({...Z,verbose:z}))console.error("Failed to build documentation"),O0.exit(1);console.log(`Documentation built successfully in ${$}`),console.log(`Starting Bun's HTML server at http://localhost:${Q}`);let j=Bun.serve({port:Q,async fetch(X){let q=new URL(X.url).pathname,U=`${$}${q}`;try{let M=Bun.file(U);if(await M.exists())return new Response(M)}catch{}let K=`${$}/docs${q}`;try{let M=Bun.file(K);if(await M.exists())return new Response(M)}catch{}let H=`${$}/docs${q}`;if(!H.endsWith(".html"))H+=".html";try{let M=Bun.file(H);if(await M.exists())return new Response(M,{headers:{"Content-Type":"text/html"}})}catch{}let V=`${$}${q}`;if(!V.endsWith(".html"))V+=".html";try{let M=Bun.file(V);if(await M.exists())return new Response(M,{headers:{"Content-Type":"text/html"}})}catch{}let F=`${$}/docs/index.html`;try{let M=Bun.file(F);if(await M.exists())return new Response(M,{headers:{"Content-Type":"text/html"}})}catch{}let T=`${$}/index.html`;try{let M=Bun.file(T);if(await M.exists())return new Response(M,{headers:{"Content-Type":"text/html"}})}catch{}return new Response("Not Found",{status:404})}});if(console.log(`Server running at http://localhost:${j.port}`),Z.open){let X=`http://localhost:${Q}`;setTimeout(()=>Bun.spawn(["open",X]),500)}if(J)console.log("Watching for changes in docs directory..."),(async()=>{try{let G=await i("./docs",{recursive:!0}),q=null,U=()=>{if(q)clearTimeout(q);q=setTimeout(async()=>{console.log("File changed, rebuilding..."),await r({...Z,verbose:!1}),console.log("Rebuild complete")},100)};setInterval(async()=>{let K=await i("./docs",{recursive:!0});if(JSON.stringify(G)!==JSON.stringify(K))G.length=0,G.push(...K),U()},1000)}catch(G){console.error("Error watching files:",G)}})();await new Promise(()=>{})});E.help();E.version(L0);E.parse();export{I6 as findMarkdownFiles,r as buildDocs};
|