cueston 0.0.0-stage → 0.1.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 +223 -2
- package/dist/cli.js +261 -0
- package/package.json +43 -4
package/README.md
CHANGED
|
@@ -1,3 +1,224 @@
|
|
|
1
|
-
#
|
|
1
|
+
# cueston
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Cueston command line. Build, check, preview and publish in-app guidance (tours, tooltips,
|
|
4
|
+
banners, checklists, surveys and announcements) from your terminal or from CI.
|
|
5
|
+
|
|
6
|
+
It uses the same API as the dashboard. Your role, plan limits, approval rules and the audit log
|
|
7
|
+
apply exactly as they do there. Everything you create or edit is a draft until you publish it.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install -g cueston
|
|
13
|
+
cueston --version
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or run it without installing:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npx cueston tours list
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Node.js 20 or later.
|
|
23
|
+
|
|
24
|
+
## Sign in
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
cueston login
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This shows a short code and opens your browser. Check that the code matches, pick the workspace
|
|
31
|
+
and approve. The CLI then saves a secret API key (`Cueston CLI · <your computer>`) that acts as
|
|
32
|
+
you, with your role. Revoke it any time in **Settings → API keys**.
|
|
33
|
+
|
|
34
|
+
- On a remote machine, use `cueston login --no-browser` and open the link yourself.
|
|
35
|
+
- To use a key you already have: `cueston login --key sk_…`, or `echo "$KEY" | cueston login --with-key`.
|
|
36
|
+
- `cueston whoami` shows who you are, the workspace, your role and the API URL.
|
|
37
|
+
- `cueston logout` forgets the key on this computer. `cueston logout --revoke` also revokes it.
|
|
38
|
+
|
|
39
|
+
The key is stored in `~/.config/cueston/config.json` (or `$XDG_CONFIG_HOME/cueston/`), readable
|
|
40
|
+
only by you. Set `CUESTON_CONFIG_DIR` to use another folder.
|
|
41
|
+
|
|
42
|
+
### Which key and URL a command uses
|
|
43
|
+
|
|
44
|
+
| Setting | Order |
|
|
45
|
+
| ------- | -------------------------------------------------------------------------------------- |
|
|
46
|
+
| Key | `--key` → `CUESTON_API_KEY` → saved by `cueston login` |
|
|
47
|
+
| API URL | `--api-url` → `CUESTON_API_URL` → saved by `cueston login` → `https://app.cueston.com` |
|
|
48
|
+
|
|
49
|
+
## Guidance
|
|
50
|
+
|
|
51
|
+
Every content type has the same commands. Use the plural or singular name: `tours` or `tour`,
|
|
52
|
+
`tooltips`, `banners`, `checklists`, `surveys`, `announcements`.
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
cueston tours list # id, name, status (live, staging, draft), URL pattern
|
|
56
|
+
cueston tours list --status live
|
|
57
|
+
cueston tours get 12 # every field, as YAML (--json for JSON)
|
|
58
|
+
cueston tours create --file tour.yaml # a draft; JSON or YAML; --file - reads stdin
|
|
59
|
+
cueston tours create --name "Welcome" --url-pattern "https://app.acme.com/*"
|
|
60
|
+
cueston tours update 12 --name "Welcome v2"
|
|
61
|
+
cueston tours update 12 --data '{"steps":[{"selector":"#new","title":"New","content":"…"}]}'
|
|
62
|
+
cueston tours duplicate 12
|
|
63
|
+
cueston tours delete 12 --yes
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Field flags (`--name`, `--url-pattern`) win over `--file` and `--data`. To see every field a type
|
|
67
|
+
takes, run `cueston tools list --schema create_tour`.
|
|
68
|
+
|
|
69
|
+
### Publish, roll back, review
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
cueston tours publish 12 # to production
|
|
73
|
+
cueston tours publish 12 --env staging --note "New export step"
|
|
74
|
+
cueston tours unpublish 12
|
|
75
|
+
cueston tours versions 12
|
|
76
|
+
cueston tours rollback 12 345 # make version id 345 live again
|
|
77
|
+
cueston tours restore 12 345 # copy version 345 into the draft
|
|
78
|
+
cueston tours request-review 12 --note "Ready for launch"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
If your workspace requires approval, `publish` to production fails with `approval_required`. Use
|
|
82
|
+
`request-review` instead; a publisher approves it in Approvals or with `cueston reviews approve`.
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
cueston reviews list # pending; --status all for every request
|
|
86
|
+
cueston reviews approve 7
|
|
87
|
+
cueston reviews reject 7 --note "Shorten step 2"
|
|
88
|
+
cueston reviews cancel 7 # your own request
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Surveys
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
cueston surveys results 4 --days 90 # responses, response rate, NPS, answers
|
|
95
|
+
cueston surveys export 4 -o responses.csv
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Audiences, analytics, translations, previews, webhooks
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
cueston segments list
|
|
102
|
+
cueston segments create --file segment.yaml
|
|
103
|
+
cueston segments update 3 --description "Admins on Pro"
|
|
104
|
+
cueston segments estimate 3 # matching users from the last 30 days
|
|
105
|
+
cueston segments estimate --file rules.yaml
|
|
106
|
+
cueston segments delete 3 --yes
|
|
107
|
+
|
|
108
|
+
cueston analytics # workspace totals and top guidance, last 30 days
|
|
109
|
+
cueston analytics --days 7
|
|
110
|
+
cueston analytics item tour 12 # totals and the step funnel
|
|
111
|
+
cueston analytics issues # tooltips and steps whose element went missing
|
|
112
|
+
cueston analytics export events -o events.csv
|
|
113
|
+
|
|
114
|
+
cueston translations export --languages de,fr -o strings.csv # or --format xliff
|
|
115
|
+
cueston translations import strings.csv # shows what would change
|
|
116
|
+
cueston translations import strings.csv --apply # writes it (to drafts)
|
|
117
|
+
cueston translations auto tour 12 --to de,fr # machine-translate every step
|
|
118
|
+
|
|
119
|
+
cueston preview tour 12 --site-url https://app.acme.com/billing # a link that shows the draft
|
|
120
|
+
|
|
121
|
+
cueston webhooks list
|
|
122
|
+
cueston webhooks create --url https://example.com/hooks --events content.published
|
|
123
|
+
cueston webhooks test 5
|
|
124
|
+
cueston webhooks delete 5 --yes
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Content as code
|
|
128
|
+
|
|
129
|
+
Keep guidance in git and ship it from CI.
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
cueston pull # writes ./cueston/<type>/<id>-<name>.json
|
|
133
|
+
cueston pull content --type tours,banners
|
|
134
|
+
# edit the files, or add a new file without "id"
|
|
135
|
+
cueston push --dry-run # prints the plan
|
|
136
|
+
cueston push # creates and updates drafts
|
|
137
|
+
cueston push --publish --env staging
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
- Files hold the editable draft fields, with keys in a stable order, so they diff cleanly.
|
|
141
|
+
- A file without `"id"` creates a new draft. Its id is written back into the file.
|
|
142
|
+
- A file with an id updates that item's draft. Only fields that differ are sent. Fields a file
|
|
143
|
+
leaves out stay as they are.
|
|
144
|
+
- After saving, `push` writes back what the server stored, so running it again changes nothing.
|
|
145
|
+
- `push` exits with code 1 if any item failed. `pull --prune` removes files of deleted items.
|
|
146
|
+
|
|
147
|
+
### In CI
|
|
148
|
+
|
|
149
|
+
Create a key in **Settings → API keys** and store it as a secret. No login needed:
|
|
150
|
+
|
|
151
|
+
```yaml
|
|
152
|
+
# .github/workflows/guidance.yml
|
|
153
|
+
on:
|
|
154
|
+
push:
|
|
155
|
+
branches: [main]
|
|
156
|
+
paths: ["cueston/**"]
|
|
157
|
+
jobs:
|
|
158
|
+
ship:
|
|
159
|
+
runs-on: ubuntu-latest
|
|
160
|
+
steps:
|
|
161
|
+
- uses: actions/checkout@v4
|
|
162
|
+
- run: npx cueston push --publish
|
|
163
|
+
env:
|
|
164
|
+
CUESTON_API_KEY: ${{ secrets.CUESTON_API_KEY }}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## AI agents and MCP
|
|
168
|
+
|
|
169
|
+
Every MCP tool is also a CLI command:
|
|
170
|
+
|
|
171
|
+
```sh
|
|
172
|
+
cueston tools list
|
|
173
|
+
cueston tools list --schema validate_content
|
|
174
|
+
cueston tools call validate_content --arg type=tour --arg id=12
|
|
175
|
+
cueston tools call find_elements --arg query="export button"
|
|
176
|
+
cueston tools call debug_audience --data '{"url":"https://app.acme.com/billing","userId":"u_42"}'
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Most MCP clients connect to `https://app.cueston.com/api/mcp` directly and sign in. For a client
|
|
180
|
+
that only runs local (stdio) servers, `cueston mcp` bridges stdio to Cueston:
|
|
181
|
+
|
|
182
|
+
```json
|
|
183
|
+
{
|
|
184
|
+
"mcpServers": {
|
|
185
|
+
"cueston": {
|
|
186
|
+
"command": "npx",
|
|
187
|
+
"args": ["-y", "cueston", "mcp"],
|
|
188
|
+
"env": { "CUESTON_API_KEY": "sk_…" }
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Any endpoint
|
|
195
|
+
|
|
196
|
+
```sh
|
|
197
|
+
cueston api GET /api/tours
|
|
198
|
+
cueston api PATCH /api/tours/12 --data '{"name":"Welcome"}'
|
|
199
|
+
cueston api GET analytics/overview -q days=7 # /api is added for you
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Output and exit codes
|
|
203
|
+
|
|
204
|
+
- `--json` on any command prints one JSON document on stdout. Errors in `--json` mode are
|
|
205
|
+
`{ "error": { "message", "code", "status", "details", "hint" } }`.
|
|
206
|
+
- Without `--json`, results go to stdout and progress to stderr. Colors only on a terminal; set
|
|
207
|
+
`NO_COLOR` to turn them off.
|
|
208
|
+
- Exit codes: `0` success, `1` failure, `2` wrong arguments or flags.
|
|
209
|
+
- Rate-limited requests are retried after the time the server asks for.
|
|
210
|
+
|
|
211
|
+
## Development
|
|
212
|
+
|
|
213
|
+
```sh
|
|
214
|
+
pnpm install
|
|
215
|
+
cd packages/cli
|
|
216
|
+
npm run type-check && npm test && npm run build
|
|
217
|
+
node dist/cli.js --help
|
|
218
|
+
|
|
219
|
+
# End to end, against a running app and a key for a scratch workspace:
|
|
220
|
+
CUESTON_API_URL=http://localhost:3000 CUESTON_API_KEY=sk_… npm run e2e
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Releases: push a `cli-vX.Y.Z` tag. The release workflow publishes to npm (needs the `NPM_TOKEN`
|
|
224
|
+
repository secret).
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __cuestonCreateRequire } from "node:module";
|
|
3
|
+
const require = __cuestonCreateRequire(import.meta.url);
|
|
4
|
+
var Kl=Object.create;var Yi=Object.defineProperty;var Hl=Object.getOwnPropertyDescriptor;var Yl=Object.getOwnPropertyNames;var Wl=Object.getPrototypeOf,Jl=Object.prototype.hasOwnProperty;var Q=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var y=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var Gl=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Yl(e))!Jl.call(s,i)&&i!==t&&Yi(s,i,{get:()=>e[i],enumerable:!(n=Hl(e,i))||n.enumerable});return s};var St=(s,e,t)=>(t=s!=null?Kl(Wl(s)):{},Gl(e||!s||!s.__esModule?Yi(t,"default",{value:s,enumerable:!0}):t,s));var je=y(Rn=>{var kt=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Dn=class extends kt{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Rn.CommanderError=kt;Rn.InvalidArgumentError=Dn});var Ct=y(Bn=>{var{InvalidArgumentError:Ql}=je(),jn=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new Ql(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Xl(s){let e=s.name()+(s.variadic===!0?"...":"");return s.required?"<"+e+">":"["+e+"]"}Bn.Argument=jn;Bn.humanReadableArgName=Xl});var Vn=y(Fn=>{var{humanReadableArgName:zl}=Ct(),Un=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((i,r)=>i.name().localeCompare(r.name())),t}compareOptions(e,t){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),r=n.long&&e._findOption(n.long);!i&&!r?t.push(n):n.long&&!r?t.push(e.createOption(n.long,n.description)):n.short&&!i&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(r=>!r.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(n=>zl(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,""]}groupItems(e,t,n){let i=new Map;return e.forEach(r=>{let o=n(r);i.has(o)||i.set(o,[])}),t.forEach(r=>{let o=n(r);i.has(o)||i.set(o,[]),i.get(o).push(r)}),i}formatHelp(e,t){let n=t.padWidth(e,t),i=t.helpWidth??80;function r(u,d){return t.formatItem(u,n,d,t)}let o=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],a=t.commandDescription(e);a.length>0&&(o=o.concat([t.boxWrap(t.styleCommandDescription(a),i),""]));let l=t.visibleArguments(e).map(u=>r(t.styleArgumentTerm(t.argumentTerm(u)),t.styleArgumentDescription(t.argumentDescription(u))));if(o=o.concat(this.formatItemList("Arguments:",l,t)),this.groupItems(e.options,t.visibleOptions(e),u=>u.helpGroupHeading??"Options:").forEach((u,d)=>{let p=u.map(g=>r(t.styleOptionTerm(t.optionTerm(g)),t.styleOptionDescription(t.optionDescription(g))));o=o.concat(this.formatItemList(d,p,t))}),t.showGlobalOptions){let u=t.visibleGlobalOptions(e).map(d=>r(t.styleOptionTerm(t.optionTerm(d)),t.styleOptionDescription(t.optionDescription(d))));o=o.concat(this.formatItemList("Global Options:",u,t))}return this.groupItems(e.commands,t.visibleCommands(e),u=>u.helpGroup()||"Commands:").forEach((u,d)=>{let p=u.map(g=>r(t.styleSubcommandTerm(t.subcommandTerm(g)),t.styleSubcommandDescription(t.subcommandDescription(g))));o=o.concat(this.formatItemList(d,p,t))}),o.join(`
|
|
5
|
+
`)}displayWidth(e){return Wi(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,i){let o=" ".repeat(2);if(!n)return o+e;let a=e.padEnd(t+e.length-i.displayWidth(e)),l=2,f=(this.helpWidth??80)-t-l-2,u;return f<this.minWidthToWrap||i.preformatted(n)?u=n:u=i.boxWrap(n,f).replace(/\n/g,`
|
|
6
|
+
`+" ".repeat(t+l)),o+a+" ".repeat(l)+u.replace(/\n/g,`
|
|
7
|
+
${o}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,r=[];return n.forEach(o=>{let a=o.match(i);if(a===null){r.push("");return}let l=[a.shift()],c=this.displayWidth(l[0]);a.forEach(f=>{let u=this.displayWidth(f);if(c+u<=t){l.push(f),c+=u;return}r.push(l.join(""));let d=f.trimStart();l=[d],c=this.displayWidth(d)}),r.push(l.join(""))}),r.join(`
|
|
8
|
+
`)}};function Wi(s){let e=/\x1b\[\d*(;\d*)*m/g;return s.replace(e,"")}Fn.Help=Un;Fn.stripColor=Wi});var Wn=y(Yn=>{var{InvalidArgumentError:Zl}=je(),Kn=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=ec(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new Zl(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,n):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Ji(this.name().replace(/^no-/,"")):Ji(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Hn=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,r=i!==void 0?i:!1;return t.negate===(r===e)}};function Ji(s){return s.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function ec(s){let e,t,n=/^-[^-]$/,i=/^--[^-]/,r=s.split(/[ |,]+/).concat("guard");if(n.test(r[0])&&(e=r.shift()),i.test(r[0])&&(t=r.shift()),!e&&n.test(r[0])&&(e=r.shift()),!e&&i.test(r[0])&&(e=t,t=r.shift()),r[0].startsWith("-")){let o=r[0],a=`option creation failed due to '${o}' in option flags '${s}'`;throw/^-[^-][^-]/.test(o)?new Error(`${a}
|
|
9
|
+
- a short flag is a single dash and a single character
|
|
10
|
+
- either use a single dash and a single character (for a short flag)
|
|
11
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(o)?new Error(`${a}
|
|
12
|
+
- too many short flags`):i.test(o)?new Error(`${a}
|
|
13
|
+
- too many long flags`):new Error(`${a}
|
|
14
|
+
- unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${s}'.`);return{shortFlag:e,longFlag:t}}Yn.Option=Kn;Yn.DualOptions=Hn});var Qi=y(Gi=>{function tc(s,e){if(Math.abs(s.length-e.length)>3)return Math.max(s.length,e.length);let t=[];for(let n=0;n<=s.length;n++)t[n]=[n];for(let n=0;n<=e.length;n++)t[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=s.length;i++){let r=1;s[i-1]===e[n-1]?r=0:r=1,t[i][n]=Math.min(t[i-1][n]+1,t[i][n-1]+1,t[i-1][n-1]+r),i>1&&n>1&&s[i-1]===e[n-2]&&s[i-2]===e[n-1]&&(t[i][n]=Math.min(t[i][n],t[i-2][n-2]+1))}return t[s.length][e.length]}function nc(s,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=s.startsWith("--");t&&(s=s.slice(2),e=e.map(o=>o.slice(2)));let n=[],i=3,r=.4;return e.forEach(o=>{if(o.length<=1)return;let a=tc(s,o),l=Math.max(s.length,o.length);(l-a)/l>r&&(a<i?(i=a,n=[o]):a===i&&n.push(o))}),n.sort((o,a)=>o.localeCompare(a)),t&&(n=n.map(o=>`--${o}`)),n.length>1?`
|
|
15
|
+
(Did you mean one of ${n.join(", ")}?)`:n.length===1?`
|
|
16
|
+
(Did you mean ${n[0]}?)`:""}Gi.suggestSimilar=nc});var er=y(zn=>{var sc=Q("node:events").EventEmitter,Jn=Q("node:child_process"),X=Q("node:path"),Ot=Q("node:fs"),T=Q("node:process"),{Argument:ic,humanReadableArgName:rc}=Ct(),{CommanderError:Gn}=je(),{Help:oc,stripColor:ac}=Vn(),{Option:Xi,DualOptions:lc}=Wn(),{suggestSimilar:zi}=Qi(),Qn=class s extends sc{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:t=>T.stdout.write(t),writeErr:t=>T.stderr.write(t),outputError:(t,n)=>n(t),getOutHelpWidth:()=>T.stdout.isTTY?T.stdout.columns:void 0,getErrHelpWidth:()=>T.stderr.isTTY?T.stderr.columns:void 0,getOutHasColors:()=>Xn()??(T.stdout.isTTY&&T.stdout.hasColors?.()),getErrHasColors:()=>Xn()??(T.stderr.isTTY&&T.stderr.hasColors?.()),stripColor:t=>ac(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let i=t,r=n;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,o,a]=e.match(/([^ ]+) *(.*)/),l=this.createCommand(o);return i&&(l.description(i),l._executableHandler=!0),r.isDefault&&(this._defaultCommandName=l._name),l._hidden=!!(r.noHelp||r.hidden),l._executableFile=r.executableFile||null,a&&l.arguments(a),this._registerCommand(l),l.parent=this,l.copyInheritedSettings(this),i?this:l}createCommand(e){return new s(e)}createHelp(){return Object.assign(new oc,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
17
|
+
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new ic(e,t)}argument(e,t,n,i){let r=this.createArgument(e,t);return typeof n=="function"?r.default(i).argParser(n):r.default(n),this.addArgument(r),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,r]=n.match(/([^ ]+) *(.*)/),o=t??"display help for command",a=this.createCommand(i);return a.helpOption(!1),r&&a.arguments(r),o&&a.description(o),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
18
|
+
Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new Gn(e,t,n)),T.exit(e)}action(e){let t=n=>{let i=this.registeredArguments.length,r=n.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new Xi(e,t)}_callParseArg(e,t,n,i){try{return e.parseArg(t,n)}catch(r){if(r.code==="commander.invalidArgument"){let o=`${i} ${r.message}`;this.error(o,{exitCode:r.exitCode,code:r.code})}throw r}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
|
|
19
|
+
- already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=i=>[i.name()].concat(i.aliases()),n=t(e).find(i=>this._findCommand(i));if(n){let i=t(this._findCommand(n)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let r=e.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(r,o,a)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let l=this.getOptionValue(n);r!==null&&e.parseArg?r=this._callParseArg(e,r,l,o):r!==null&&e.variadic&&(r=e._collectValue(r,l)),r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(n,r,a)};return this.on("option:"+t,r=>{let o=`error: option '${e.flags}' argument '${r}' is invalid.`;i(r,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let o=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;i(r,o,"env")}),this}_optionEx(e,t,n,i,r){if(typeof t=="object"&&t instanceof Xi)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,n);if(o.makeOptionMandatory(!!e.mandatory),typeof i=="function")o.default(r).argParser(i);else if(i instanceof RegExp){let a=i;i=(l,c)=>{let f=a.exec(l);return f?f[0]:c},o.default(r).argParser(i)}else o.default(i);return this.addOption(o)}option(e,t,n,i){return this._optionEx({},e,t,n,i)}requiredOption(e,t,n,i){return this._optionEx({mandatory:!0},e,t,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){T.versions?.electron&&(t.from="electron");let i=T.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(t.from="eval")}e===void 0&&(e=T.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":T.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
20
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,n){if(Ot.existsSync(e))return;let i=t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",r=`'${e}' does not exist
|
|
21
|
+
- if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
22
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
23
|
+
- ${i}`;throw new Error(r)}_executeSubCommand(e,t){t=t.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function r(f,u){let d=X.resolve(f,u);if(Ot.existsSync(d))return d;if(i.includes(X.extname(u)))return;let p=i.find(g=>Ot.existsSync(`${d}${g}`));if(p)return`${d}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let f;try{f=Ot.realpathSync(this._scriptPath)}catch{f=this._scriptPath}a=X.resolve(X.dirname(f),a)}if(a){let f=r(a,o);if(!f&&!e._executableFile&&this._scriptPath){let u=X.basename(this._scriptPath,X.extname(this._scriptPath));u!==this._name&&(f=r(a,`${u}-${e._name}`))}o=f||o}n=i.includes(X.extname(o));let l;T.platform!=="win32"?n?(t.unshift(o),t=Zi(T.execArgv).concat(t),l=Jn.spawn(T.argv[0],t,{stdio:"inherit"})):l=Jn.spawn(o,t,{stdio:"inherit"}):(this._checkForMissingExecutable(o,a,e._name),t.unshift(o),t=Zi(T.execArgv).concat(t),l=Jn.spawn(T.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(u=>{T.on(u,()=>{l.killed===!1&&l.exitCode===null&&l.kill(u)})});let c=this._exitCallback;l.on("close",f=>{f=f??1,c?c(new Gn(f,"commander.executeSubCommandAsync","(close)")):T.exit(f)}),l.on("error",f=>{if(f.code==="ENOENT")this._checkForMissingExecutable(o,a,e._name);else if(f.code==="EACCES")throw new Error(`'${o}' not executable`);if(!c)T.exit(1);else{let u=new Gn(1,"commander.executeSubCommandAsync","(error)");u.nestedError=f,c(u)}}),this.runningCommand=l}_dispatchSubcommand(e,t,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let r;return r=this._chainOrCallSubCommandHook(r,i,"preSubcommand"),r=this._chainOrCall(r,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(n));else return i._parseCommand(t,n)}),r}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,r)=>{let o=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;o=this._callParseArg(n,i,r,a)}return o};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,i)=>{let r=n.defaultValue;n.variadic?i<this.args.length?(r=this.args.slice(i),n.parseArg&&(r=r.reduce((o,a)=>e(n,a,o),n.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],n.parseArg&&(r=e(n,r,n.defaultValue))),t[i]=r}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(o=>{i.push({hookedCommand:r,callback:o})})}),t==="postAction"&&i.reverse(),i.forEach(r=>{n=this._chainOrCall(n,()=>r.callback(r.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(r=>{i=this._chainOrCall(i,()=>r(this,t))}),i}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(r,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent?.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(r=>n.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],i=t;function r(f){return f.length>1&&f[0]==="-"}let o=f=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(f)?!this._getCommandAndAncestors().some(u=>u.options.map(d=>d.short).some(d=>/^-\d$/.test(d))):!1,a=null,l=null,c=0;for(;c<e.length||l;){let f=l??e[c++];if(l=null,f==="--"){i===n&&i.push(f),i.push(...e.slice(c));break}if(a&&(!r(f)||o(f))){this.emit(`option:${a.name()}`,f);continue}if(a=null,r(f)){let u=this._findOption(f);if(u){if(u.required){let d=e[c++];d===void 0&&this.optionMissingArgument(u),this.emit(`option:${u.name()}`,d)}else if(u.optional){let d=null;c<e.length&&(!r(e[c])||o(e[c]))&&(d=e[c++]),this.emit(`option:${u.name()}`,d)}else this.emit(`option:${u.name()}`);a=u.variadic?u:null;continue}}if(f.length>2&&f[0]==="-"&&f[1]!=="-"){let u=this._findOption(`-${f[1]}`);if(u){u.required||u.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${u.name()}`,f.slice(2)):(this.emit(`option:${u.name()}`),l=`-${f.slice(2)}`);continue}}if(/^--[^=]+=/.test(f)){let u=f.indexOf("="),d=this._findOption(f.slice(0,u));if(d&&(d.required||d.optional)){this.emit(`option:${d.name()}`,f.slice(u+1));continue}}if(i===t&&r(f)&&!(this.commands.length===0&&o(f))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(f)){t.push(f),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&f===this._getHelpCommand().name()){t.push(f,...e.slice(c));break}else if(this._defaultCommandName){n.push(f,...e.slice(c));break}}if(this._passThroughOptions){i.push(f,...e.slice(c));break}i.push(f)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let i=this.options[n].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
24
|
+
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
25
|
+
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
26
|
+
`),this.outputHelp({error:!0}));let n=t||{},i=n.exitCode||1,r=n.code||"commander.error";this._exit(i,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in T.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,T.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new lc(this.options),t=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let n=o=>{let a=o.attributeName(),l=this.getOptionValue(a),c=this.options.find(u=>u.negate&&a===u.attributeName()),f=this.options.find(u=>!u.negate&&a===u.attributeName());return c&&(c.presetArg===void 0&&l===!1||c.presetArg!==void 0&&l===c.presetArg)?c:f||o},i=o=>{let a=n(o),l=a.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},r=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],r=this;do{let o=r.createHelp().visibleOptions(r).filter(a=>a.long).map(a=>a.long);i=i.concat(o),r=r.parent}while(r&&!r._enablePositionalOptions);t=zi(e,i)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),t=zi(e,i)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";let i=this.createOption(t,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
27
|
+
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(n=>rc(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=X.basename(e,X.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=t.formatHelp(this,t);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let t=!!e.error,n,i,r;return t?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),r=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),r=this._outputConfiguration.getOutHelpWidth()),{error:t,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:r}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(o=>o.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let r=this.helpInformation({error:n.error});if(t&&(r=t(r),typeof r!="string"&&!Buffer.isBuffer(r)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(r),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(o=>o.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",t??"display help for command"),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(T.exitCode??0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
28
|
+
Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,r=>{let o;typeof t=="function"?o=t({error:r.error,command:r.command}):o=t,o&&r.write(`${o}
|
|
29
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Zi(s){return s.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",i="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?i=r[3]:n=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],n=r[3],i=r[4]),t&&i!=="0"?`${t}=${n}:${parseInt(i)+1}`:e})}function Xn(){if(T.env.NO_COLOR||T.env.FORCE_COLOR==="0"||T.env.FORCE_COLOR==="false")return!1;if(T.env.FORCE_COLOR||T.env.CLICOLOR_FORCE!==void 0)return!0}zn.Command=Qn;zn.useColor=Xn});var ir=y(V=>{var{Argument:tr}=Ct(),{Command:Zn}=er(),{CommanderError:cc,InvalidArgumentError:nr}=je(),{Help:uc}=Vn(),{Option:sr}=Wn();V.program=new Zn;V.createCommand=s=>new Zn(s);V.createOption=(s,e)=>new sr(s,e);V.createArgument=(s,e)=>new tr(s,e);V.Command=Zn;V.Option=sr;V.Argument=tr;V.Help=uc;V.CommanderError=cc;V.InvalidArgumentError=nr;V.InvalidOptionArgumentError=nr});var yr=y((im,ss)=>{var Nt=process||{},mr=Nt.argv||[],Tt=Nt.env||{},Cc=!(Tt.NO_COLOR||mr.includes("--no-color"))&&(!!Tt.FORCE_COLOR||mr.includes("--color")||Nt.platform==="win32"||(Nt.stdout||{}).isTTY&&Tt.TERM!=="dumb"||!!Tt.CI),Oc=(s,e,t=s)=>n=>{let i=""+n,r=i.indexOf(e,s.length);return~r?s+_c(i,e,t,r)+e:s+i+e},_c=(s,e,t,n)=>{let i="",r=0;do i+=s.substring(r,n)+t,r=n+e.length,n=s.indexOf(e,r);while(~n);return i+s.substring(r)},gr=(s=Cc)=>{let e=s?Oc:()=>String;return{isColorSupported:s,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};ss.exports=gr();ss.exports.createColors=gr});var E=y(j=>{"use strict";var is=Symbol.for("yaml.alias"),br=Symbol.for("yaml.document"),xt=Symbol.for("yaml.map"),wr=Symbol.for("yaml.pair"),rs=Symbol.for("yaml.scalar"),qt=Symbol.for("yaml.seq"),z=Symbol.for("yaml.node.type"),Ac=s=>!!s&&typeof s=="object"&&s[z]===is,$c=s=>!!s&&typeof s=="object"&&s[z]===br,Ec=s=>!!s&&typeof s=="object"&&s[z]===xt,Tc=s=>!!s&&typeof s=="object"&&s[z]===wr,vr=s=>!!s&&typeof s=="object"&&s[z]===rs,Nc=s=>!!s&&typeof s=="object"&&s[z]===qt;function Sr(s){if(s&&typeof s=="object")switch(s[z]){case xt:case qt:return!0}return!1}function xc(s){if(s&&typeof s=="object")switch(s[z]){case is:case xt:case rs:case qt:return!0}return!1}var qc=s=>(vr(s)||Sr(s))&&!!s.anchor;j.ALIAS=is;j.DOC=br;j.MAP=xt;j.NODE_TYPE=z;j.PAIR=wr;j.SCALAR=rs;j.SEQ=qt;j.hasAnchor=qc;j.isAlias=Ac;j.isCollection=Sr;j.isDocument=$c;j.isMap=Ec;j.isNode=xc;j.isPair=Tc;j.isScalar=vr;j.isSeq=Nc});var Ue=y(os=>{"use strict";var D=E(),B=Symbol("break visit"),kr=Symbol("skip children"),J=Symbol("remove node");function Pt(s,e){let t=Cr(e);D.isDocument(s)?_e(null,s.contents,t,Object.freeze([s]))===J&&(s.contents=null):_e(null,s,t,Object.freeze([]))}Pt.BREAK=B;Pt.SKIP=kr;Pt.REMOVE=J;function _e(s,e,t,n){let i=Or(s,e,t,n);if(D.isNode(i)||D.isPair(i))return _r(s,n,i),_e(s,i,t,n);if(typeof i!="symbol"){if(D.isCollection(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){let o=_e(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===B)return B;o===J&&(e.items.splice(r,1),r-=1)}}}else if(D.isPair(e)){n=Object.freeze(n.concat(e));let r=_e("key",e.key,t,n);if(r===B)return B;r===J&&(e.key=null);let o=_e("value",e.value,t,n);if(o===B)return B;o===J&&(e.value=null)}}return i}async function It(s,e){let t=Cr(e);D.isDocument(s)?await Ae(null,s.contents,t,Object.freeze([s]))===J&&(s.contents=null):await Ae(null,s,t,Object.freeze([]))}It.BREAK=B;It.SKIP=kr;It.REMOVE=J;async function Ae(s,e,t,n){let i=await Or(s,e,t,n);if(D.isNode(i)||D.isPair(i))return _r(s,n,i),Ae(s,i,t,n);if(typeof i!="symbol"){if(D.isCollection(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){let o=await Ae(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===B)return B;o===J&&(e.items.splice(r,1),r-=1)}}}else if(D.isPair(e)){n=Object.freeze(n.concat(e));let r=await Ae("key",e.key,t,n);if(r===B)return B;r===J&&(e.key=null);let o=await Ae("value",e.value,t,n);if(o===B)return B;o===J&&(e.value=null)}}return i}function Cr(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function Or(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(D.isMap(e))return t.Map?.(s,e,n);if(D.isSeq(e))return t.Seq?.(s,e,n);if(D.isPair(e))return t.Pair?.(s,e,n);if(D.isScalar(e))return t.Scalar?.(s,e,n);if(D.isAlias(e))return t.Alias?.(s,e,n)}function _r(s,e,t){let n=e[e.length-1];if(D.isCollection(n))n.items[s]=t;else if(D.isPair(n))s==="key"?n.key=t:n.value=t;else if(D.isDocument(n))n.contents=t;else{let i=D.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}os.visit=Pt;os.visitAsync=It});var as=y($r=>{"use strict";var Ar=E(),Pc=Ue(),Ic={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Lc=s=>s.replace(/[!,[\]{}]/g,e=>Ic[e]),Fe=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);let r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Lc(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&Ar.isNode(e.contents)){let r={};Pc.visit(e.contents,(o,a)=>{Ar.isNode(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(let[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
|
|
30
|
+
`)}};Fe.defaultYaml={explicit:!1,version:"1.2"};Fe.defaultTags={"!!":"tag:yaml.org,2002:"};$r.Directives=Fe});var Lt=y(Ve=>{"use strict";var Er=E(),Mc=Ue();function Dc(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function Tr(s){let e=new Set;return Mc.visit(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function Nr(s,e){for(let t=1;;++t){let n=`${s}${t}`;if(!e.has(n))return n}}function Rc(s,e){let t=[],n=new Map,i=null;return{onAnchor:r=>{t.push(r),i??(i=Tr(s));let o=Nr(e,i);return i.add(o),o},setAnchors:()=>{for(let r of t){let o=n.get(r);if(typeof o=="object"&&o.anchor&&(Er.isScalar(o.node)||Er.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:n}}Ve.anchorIsValid=Dc;Ve.anchorNames=Tr;Ve.createNodeAnchors=Rc;Ve.findNewAnchor=Nr});var ls=y(xr=>{"use strict";function Ke(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){let o=n[i],a=Ke(s,n,String(i),o);a===void 0?delete n[i]:a!==o&&(n[i]=a)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let r=n.get(i),o=Ke(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(let i of Array.from(n)){let r=Ke(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(let[i,r]of Object.entries(n)){let o=Ke(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}xr.applyReviver=Ke});var se=y(Pr=>{"use strict";var jc=E();function qr(s,e,t){if(Array.isArray(s))return s.map((n,i)=>qr(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!jc.hasAnchor(s))return s.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};let i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!t?.keep?Number(s):s}Pr.toJS=qr});var Mt=y(Lr=>{"use strict";var Bc=ls(),Ir=E(),Uc=se(),cs=class{constructor(e){Object.defineProperty(this,Ir.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!Ir.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=Uc.toJS(this,"",o);if(typeof i=="function")for(let{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?Bc.applyReviver(r,{"":a},"",a):a}};Lr.NodeBase=cs});var He=y(Mr=>{"use strict";var Fc=Lt(),Vc=Ue(),$e=E(),Kc=Mt(),Hc=se(),us=class extends Kc.NodeBase{constructor(e){super($e.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Vc.visit(e,{Node:(r,o)=>{($e.isAlias(o)||$e.hasAnchor(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let i;for(let r of n){if(r===this)break;r.anchor===this.source&&(i=r)}if(i&&t){let{anchors:r,doc:o,maxAliasCount:a}=t,l=r.get(i);if(l||(Hc.toJS(i,null,t),l=r.get(i)),l?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=Dt(o,i,r)),l.count*l.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}}return i}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(i)}return t.anchors.get(n).res}toString(e,t,n){let i=`*${this.source}`;if(e){if(Fc.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}};function Dt(s,e,t){if($e.isAlias(e)){let n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if($e.isCollection(e)){let n=0;for(let i of e.items){let r=Dt(s,i,t);r>n&&(n=r)}return n}else if($e.isPair(e)){let n=Dt(s,e.key,t),i=Dt(s,e.value,t);return Math.max(n,i)}return 1}Mr.Alias=us});var I=y(fs=>{"use strict";var Yc=E(),Wc=Mt(),Jc=se(),Gc=s=>!s||typeof s!="function"&&typeof s!="object",ie=class extends Wc.NodeBase{constructor(e){super(Yc.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:Jc.toJS(this.value,e,t)}toString(){return String(this.value)}};ie.BLOCK_FOLDED="BLOCK_FOLDED";ie.BLOCK_LITERAL="BLOCK_LITERAL";ie.PLAIN="PLAIN";ie.QUOTE_DOUBLE="QUOTE_DOUBLE";ie.QUOTE_SINGLE="QUOTE_SINGLE";fs.Scalar=ie;fs.isScalarValue=Gc});var Ye=y(Rr=>{"use strict";var Qc=He(),ge=E(),Dr=I(),Xc="tag:yaml.org,2002:";function zc(s,e,t){if(e){let n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify?.(s)&&!n.format)}function Zc(s,e,t){if(ge.isDocument(s)&&(s=s.contents),ge.isNode(s))return s;if(ge.isPair(s)){let u=t.schema[ge.MAP].createNode?.(t.schema,null,t);return u.items.push(s),u}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=t,l;if(n&&s&&typeof s=="object"){if(l=a.get(s),l)return l.anchor??(l.anchor=i(s)),new Qc.Alias(l.anchor);l={anchor:null,node:null},a.set(s,l)}e?.startsWith("!!")&&(e=Xc+e.slice(2));let c=zc(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let u=new Dr.Scalar(s);return l&&(l.node=u),u}c=s instanceof Map?o[ge.MAP]:Symbol.iterator in Object(s)?o[ge.SEQ]:o[ge.MAP]}r&&(r(c),delete t.onTagObj);let f=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,s,t):new Dr.Scalar(s);return e?f.tag=e:c.default||(f.tag=c.tag),l&&(l.node=f),f}Rr.createNode=Zc});var jt=y(Rt=>{"use strict";var eu=Ye(),G=E(),tu=Mt();function ds(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){let r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return eu.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var jr=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,hs=class extends tu.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>G.isNode(n)||G.isPair(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(jr(e))this.add(t);else{let[n,...i]=e,r=this.get(n,!0);if(G.isCollection(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,ds(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let i=this.get(t,!0);if(G.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&G.isScalar(r)?r.value:r:G.isCollection(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!G.isPair(t))return!1;let n=t.value;return n==null||e&&G.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let i=this.get(t,!0);return G.isCollection(i)?i.hasIn(n):!1}setIn(e,t){let[n,...i]=e;if(i.length===0)this.set(n,t);else{let r=this.get(n,!0);if(G.isCollection(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,ds(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Rt.Collection=hs;Rt.collectionFromPath=ds;Rt.isEmptyPath=jr});var We=y(Bt=>{"use strict";var nu=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function ps(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var su=(s,e,t)=>s.endsWith(`
|
|
31
|
+
`)?ps(t,e):t.includes(`
|
|
32
|
+
`)?`
|
|
33
|
+
`+ps(t,e):(s.endsWith(" ")?"":" ")+t;Bt.indentComment=ps;Bt.lineComment=su;Bt.stringifyComment=nu});var Ur=y(Je=>{"use strict";var iu="flow",ms="block",Ut="quoted";function ru(s,e,t="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return s;i<r&&(r=0);let l=Math.max(1+r,1+i-e.length);if(s.length<=l)return s;let c=[],f={},u=i-e.length;typeof n=="number"&&(n>i-Math.max(2,r)?c.push(0):u=i-n);let d,p,g=!1,h=-1,m=-1,w=-1;t===ms&&(h=Br(s,h,e.length),h!==-1&&(u=h+l));for(let C;C=s[h+=1];){if(t===Ut&&C==="\\"){switch(m=h,s[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}w=h}if(C===`
|
|
34
|
+
`)t===ms&&(h=Br(s,h,e.length)),u=h+e.length+l,d=void 0;else{if(C===" "&&p&&p!==" "&&p!==`
|
|
35
|
+
`&&p!==" "){let O=s[h+1];O&&O!==" "&&O!==`
|
|
36
|
+
`&&O!==" "&&(d=h)}if(h>=u)if(d)c.push(d),u=d+l,d=void 0;else if(t===Ut){for(;p===" "||p===" ";)p=C,C=s[h+=1],g=!0;let O=h>w+1?h-2:m-1;if(f[O])return s;c.push(O),f[O]=!0,u=O+l,d=void 0}else g=!0}p=C}if(g&&a&&a(),c.length===0)return s;o&&o();let v=s.slice(0,c[0]);for(let C=0;C<c.length;++C){let O=c[C],_=c[C+1]||s.length;O===0?v=`
|
|
37
|
+
${e}${s.slice(0,_)}`:(t===Ut&&f[O]&&(v+=`${s[O]}\\`),v+=`
|
|
38
|
+
${e}${s.slice(O+1,_)}`)}return v}function Br(s,e,t){let n=e,i=e+1,r=s[i];for(;r===" "||r===" ";)if(e<i+t)r=s[++e];else{do r=s[++e];while(r&&r!==`
|
|
39
|
+
`);n=e,i=e+1,r=s[i]}return n}Je.FOLD_BLOCK=ms;Je.FOLD_FLOW=iu;Je.FOLD_QUOTED=Ut;Je.foldFlowLines=ru});var Qe=y(Fr=>{"use strict";var Y=I(),re=Ur(),Vt=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),Kt=s=>/^(%|---|\.\.\.)/m.test(s);function ou(s,e,t){if(!e||e<0)return!1;let n=e-t,i=s.length;if(i<=n)return!1;for(let r=0,o=0;r<i;++r)if(s[r]===`
|
|
40
|
+
`){if(r-o>n)return!0;if(o=r+1,i-o<=n)return!1}return!0}function Ge(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(Kt(s)?" ":""),o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);let f=t.substr(l+2,4);switch(f){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:f.substr(0,2)==="00"?o+="\\x"+f.substr(2):o+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(n||t[l+2]==='"'||t.length<i)l+=1;else{for(o+=t.slice(a,l)+`
|
|
41
|
+
|
|
42
|
+
`;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)o+=`
|
|
43
|
+
`,l+=2;o+=r,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,n?o:re.foldFlowLines(o,r,re.FOLD_QUOTED,Vt(e,!1))}function gs(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
|
|
44
|
+
`)||/[ \t]\n|\n[ \t]/.test(s))return Ge(s,e);let t=e.indent||(Kt(s)?" ":""),n="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
45
|
+
${t}`)+"'";return e.implicitKey?n:re.foldFlowLines(n,t,re.FOLD_FLOW,Vt(e,!1))}function Ee(s,e){let{singleQuote:t}=e.options,n;if(t===!1)n=Ge;else{let i=s.includes('"'),r=s.includes("'");i&&!r?n=gs:r&&!i?n=Ge:n=t?gs:Ge}return n(s,e)}var ys;try{ys=new RegExp(`(^|(?<!
|
|
46
|
+
))
|
|
47
|
+
+(?!
|
|
48
|
+
|$)`,"g")}catch{ys=/\n+(?!\n|$)/g}function Ft({comment:s,type:e,value:t},n,i,r){let{blockQuote:o,commentString:a,lineWidth:l}=n.options;if(!o||/\n[\t ]+$/.test(t))return Ee(t,n);let c=n.indent||(n.forceBlockIndent||Kt(t)?" ":""),f=o==="literal"?!0:o==="folded"||e===Y.Scalar.BLOCK_FOLDED?!1:e===Y.Scalar.BLOCK_LITERAL?!0:!ou(t,l,c.length);if(!t)return f?`|
|
|
49
|
+
`:`>
|
|
50
|
+
`;let u,d;for(d=t.length;d>0;--d){let _=t[d-1];if(_!==`
|
|
51
|
+
`&&_!==" "&&_!==" ")break}let p=t.substring(d),g=p.indexOf(`
|
|
52
|
+
`);g===-1?u="-":t===p||g!==p.length-1?(u="+",r&&r()):u="",p&&(t=t.slice(0,-p.length),p[p.length-1]===`
|
|
53
|
+
`&&(p=p.slice(0,-1)),p=p.replace(ys,`$&${c}`));let h=!1,m,w=-1;for(m=0;m<t.length;++m){let _=t[m];if(_===" ")h=!0;else if(_===`
|
|
54
|
+
`)w=m;else break}let v=t.substring(0,w<m?w+1:m);v&&(t=t.substring(v.length),v=v.replace(/\n+/g,`$&${c}`));let O=(h?c?"2":"1":"")+u;if(s&&(O+=" "+a(s.replace(/ ?[\r\n]+/g," ")),i&&i()),!f){let _=t.replace(/\n+/g,`
|
|
55
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),A=!1,q=Vt(n,!0);o!=="folded"&&e!==Y.Scalar.BLOCK_FOLDED&&(q.onOverflow=()=>{A=!0});let S=re.foldFlowLines(`${v}${_}${p}`,c,re.FOLD_BLOCK,q);if(!A)return`>${O}
|
|
56
|
+
${c}${S}`}return t=t.replace(/\n+/g,`$&${c}`),`|${O}
|
|
57
|
+
${c}${v}${t}${p}`}function au(s,e,t,n){let{type:i,value:r}=s,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:f}=e;if(a&&r.includes(`
|
|
58
|
+
`)||f&&/[[\]{},]/.test(r))return Ee(r,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||f||!r.includes(`
|
|
59
|
+
`)?Ee(r,e):Ft(s,e,t,n);if(!a&&!f&&i!==Y.Scalar.PLAIN&&r.includes(`
|
|
60
|
+
`))return Ft(s,e,t,n);if(Kt(r)){if(l==="")return e.forceBlockIndent=!0,Ft(s,e,t,n);if(a&&l===c)return Ee(r,e)}let u=r.replace(/\n+/g,`$&
|
|
61
|
+
${l}`);if(o){let d=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(u),{compat:p,tags:g}=e.doc.schema;if(g.some(d)||p?.some(d))return Ee(r,e)}return a?u:re.foldFlowLines(u,l,re.FOLD_FLOW,Vt(e,!1))}function lu(s,e,t,n){let{implicitKey:i,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)}),{type:a}=s;a!==Y.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=Y.Scalar.QUOTE_DOUBLE);let l=f=>{switch(f){case Y.Scalar.BLOCK_FOLDED:case Y.Scalar.BLOCK_LITERAL:return i||r?Ee(o.value,e):Ft(o,e,t,n);case Y.Scalar.QUOTE_DOUBLE:return Ge(o.value,e);case Y.Scalar.QUOTE_SINGLE:return gs(o.value,e);case Y.Scalar.PLAIN:return au(o,e,t,n);default:return null}},c=l(a);if(c===null){let{defaultKeyType:f,defaultStringType:u}=e.options,d=i&&f||u;if(c=l(d),c===null)throw new Error(`Unsupported default string type ${d}`)}return c}Fr.stringifyString=lu});var Xe=y(bs=>{"use strict";var cu=Lt(),oe=E(),uu=We(),fu=Qe();function du(s,e){let t=Object.assign({blockQuote:!0,commentString:uu.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e),n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function hu(s,e){if(e.tag){let i=s.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)??i[0]}let t,n;if(oe.isScalar(e)){n=e.value;let i=s.filter(r=>r.identify?.(n));if(i.length>1){let r=i.filter(o=>o.test);r.length>0&&(i=r)}t=i.find(r=>r.format===e.format)??i.find(r=>!r.format)}else n=e,t=s.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!t){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return t}function pu(s,e,{anchors:t,doc:n}){if(!n.directives)return"";let i=[],r=(oe.isScalar(s)||oe.isCollection(s))&&s.anchor;r&&cu.anchorIsValid(r)&&(t.add(r),i.push(`&${r}`));let o=s.tag??(e.default?null:e.tag);return o&&i.push(n.directives.tagString(o)),i.join(" ")}function mu(s,e,t,n){if(oe.isPair(s))return s.toString(e,t,n);if(oe.isAlias(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let i,r=oe.isNode(s)?s:e.doc.createNode(s,{onTagObj:l=>i=l});i??(i=hu(e.doc.schema.tags,r));let o=pu(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof i.stringify=="function"?i.stringify(r,e,t,n):oe.isScalar(r)?fu.stringifyString(r,e,t,n):r.toString(e,t,n);return o?oe.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
62
|
+
${e.indent}${a}`:a}bs.createStringifyContext=du;bs.stringify=mu});var Yr=y(Hr=>{"use strict";var Z=E(),Vr=I(),Kr=Xe(),ze=We();function gu({key:s,value:e},t,n,i){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:f,simpleKeys:u}}=t,d=Z.isNode(s)&&s.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(Z.isCollection(s)||!Z.isNode(s)&&typeof s=="object"){let q="With simple keys, collection cannot be used as a key value";throw new Error(q)}}let p=!u&&(!s||d&&e==null&&!t.inFlow||Z.isCollection(s)||(Z.isScalar(s)?s.type===Vr.Scalar.BLOCK_FOLDED||s.type===Vr.Scalar.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!p&&(u||!r),indent:a+l});let g=!1,h=!1,m=Kr.stringify(s,t,()=>g=!0,()=>h=!0);if(!p&&!t.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(t.inFlow){if(r||e==null)return g&&n&&n(),m===""?"?":p?`? ${m}`:m}else if(r&&!u||e==null&&p)return m=`? ${m}`,d&&!g?m+=ze.lineComment(m,t.indent,c(d)):h&&i&&i(),m;g&&(d=null),p?(d&&(m+=ze.lineComment(m,t.indent,c(d))),m=`? ${m}
|
|
63
|
+
${a}:`):(m=`${m}:`,d&&(m+=ze.lineComment(m,t.indent,c(d))));let w,v,C;Z.isNode(e)?(w=!!e.spaceBefore,v=e.commentBefore,C=e.comment):(w=!1,v=null,C=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!p&&!d&&Z.isScalar(e)&&(t.indentAtStart=m.length+1),h=!1,!f&&l.length>=2&&!t.inFlow&&!p&&Z.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let O=!1,_=Kr.stringify(e,t,()=>O=!0,()=>h=!0),A=" ";if(d||w||v){if(A=w?`
|
|
64
|
+
`:"",v){let q=c(v);A+=`
|
|
65
|
+
${ze.indentComment(q,t.indent)}`}_===""&&!t.inFlow?A===`
|
|
66
|
+
`&&C&&(A=`
|
|
67
|
+
|
|
68
|
+
`):A+=`
|
|
69
|
+
${t.indent}`}else if(!p&&Z.isCollection(e)){let q=_[0],S=_.indexOf(`
|
|
70
|
+
`),L=S!==-1,te=t.inFlow??e.flow??e.items.length===0;if(L||!te){let Oe=!1;if(L&&(q==="&"||q==="!")){let M=_.indexOf(" ");q==="&"&&M!==-1&&M<S&&_[M+1]==="!"&&(M=_.indexOf(" ",M+1)),(M===-1||S<M)&&(Oe=!0)}Oe||(A=`
|
|
71
|
+
${t.indent}`)}}else(_===""||_[0]===`
|
|
72
|
+
`)&&(A="");return m+=A+_,t.inFlow?O&&n&&n():C&&!O?m+=ze.lineComment(m,t.indent,c(C)):h&&i&&i(),m}Hr.stringifyPair=gu});var vs=y(ws=>{"use strict";var Wr=Q("process");function yu(s,...e){s==="debug"&&console.log(...e)}function bu(s,e){(s==="debug"||s==="warn")&&(typeof Wr.emitWarning=="function"?Wr.emitWarning(e):console.warn(e))}ws.debug=yu;ws.warn=bu});var Gt=y(Jt=>{"use strict";var Wt=E(),Jr=I(),Ht="<<",Yt={identify:s=>s===Ht||typeof s=="symbol"&&s.description===Ht,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Jr.Scalar(Symbol(Ht)),{addToJSMap:Gr}),stringify:()=>Ht},wu=(s,e)=>(Yt.identify(e)||Wt.isScalar(e)&&(!e.type||e.type===Jr.Scalar.PLAIN)&&Yt.identify(e.value))&&s?.doc.schema.tags.some(t=>t.tag===Yt.tag&&t.default);function Gr(s,e,t){let n=Qr(s,t);if(Wt.isSeq(n))for(let i of n.items)Ss(s,e,i);else if(Array.isArray(n))for(let i of n)Ss(s,e,i);else Ss(s,e,n)}function Ss(s,e,t){let n=Qr(s,t);if(!Wt.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,s,Map);for(let[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function Qr(s,e){return s&&Wt.isAlias(e)?e.resolve(s.doc,s):e}Jt.addMergeToJSMap=Gr;Jt.isMergeKey=wu;Jt.merge=Yt});var Cs=y(Zr=>{"use strict";var vu=vs(),Xr=Gt(),Su=Xe(),zr=E(),ks=se();function ku(s,e,{key:t,value:n}){if(zr.isNode(t)&&t.addToJSMap)t.addToJSMap(s,e,n);else if(Xr.isMergeKey(s,t))Xr.addMergeToJSMap(s,e,n);else{let i=ks.toJS(t,"",s);if(e instanceof Map)e.set(i,ks.toJS(n,i,s));else if(e instanceof Set)e.add(i);else{let r=Cu(t,i,s),o=ks.toJS(n,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function Cu(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(zr.isNode(s)&&t?.doc){let n=Su.createStringifyContext(t.doc,{});n.anchors=new Set;for(let r of t.anchors.keys())n.anchors.add(r.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=s.toString(n);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),vu.warn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}Zr.addPairToJSMap=ku});var ae=y(Os=>{"use strict";var eo=Ye(),Ou=Yr(),_u=Cs(),Qt=E();function Au(s,e,t){let n=eo.createNode(s,void 0,t),i=eo.createNode(e,void 0,t);return new Xt(n,i)}var Xt=class s{constructor(e,t=null){Object.defineProperty(this,Qt.NODE_TYPE,{value:Qt.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return Qt.isNode(t)&&(t=t.clone(e)),Qt.isNode(n)&&(n=n.clone(e)),new s(t,n)}toJSON(e,t){let n=t?.mapAsMap?new Map:{};return _u.addPairToJSMap(t,n,this)}toString(e,t,n){return e?.doc?Ou.stringifyPair(this,e,t,n):JSON.stringify(this)}};Os.Pair=Xt;Os.createPair=Au});var _s=y(no=>{"use strict";var ye=E(),to=Xe(),zt=We();function $u(s,e,t){return(e.inFlow??s.flow?Tu:Eu)(s,e,t)}function Eu({comment:s,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=t,f=Object.assign({},t,{indent:r,type:null}),u=!1,d=[];for(let g=0;g<e.length;++g){let h=e[g],m=null;if(ye.isNode(h))!u&&h.spaceBefore&&d.push(""),Zt(t,d,h.commentBefore,u),h.comment&&(m=h.comment);else if(ye.isPair(h)){let v=ye.isNode(h.key)?h.key:null;v&&(!u&&v.spaceBefore&&d.push(""),Zt(t,d,v.commentBefore,u))}u=!1;let w=to.stringify(h,f,()=>m=null,()=>u=!0);m&&(w+=zt.lineComment(w,r,c(m))),u&&m&&(u=!1),d.push(n+w)}let p;if(d.length===0)p=i.start+i.end;else{p=d[0];for(let g=1;g<d.length;++g){let h=d[g];p+=h?`
|
|
73
|
+
${l}${h}`:`
|
|
74
|
+
`}}return s?(p+=`
|
|
75
|
+
`+zt.indentComment(c(s),l),a&&a()):u&&o&&o(),p}function Tu({items:s},e,{flowChars:t,itemIndent:n}){let{indent:i,indentStep:r,flowCollectionPadding:o,options:{commentString:a}}=e;n+=r;let l=Object.assign({},e,{indent:n,inFlow:!0,type:null}),c=!1,f=0,u=[];for(let g=0;g<s.length;++g){let h=s[g],m=null;if(ye.isNode(h))h.spaceBefore&&u.push(""),Zt(e,u,h.commentBefore,!1),h.comment&&(m=h.comment);else if(ye.isPair(h)){let v=ye.isNode(h.key)?h.key:null;v&&(v.spaceBefore&&u.push(""),Zt(e,u,v.commentBefore,!1),v.comment&&(c=!0));let C=ye.isNode(h.value)?h.value:null;C?(C.comment&&(m=C.comment),C.commentBefore&&(c=!0)):h.value==null&&v?.comment&&(m=v.comment)}m&&(c=!0);let w=to.stringify(h,l,()=>m=null);c||(c=u.length>f||w.includes(`
|
|
76
|
+
`)),g<s.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=u.reduce((v,C)=>v+C.length+2,2)+(w.length+2)>e.options.lineWidth)),c&&(w+=",")),m&&(w+=zt.lineComment(w,n,a(m))),u.push(w),f=u.length}let{start:d,end:p}=t;if(u.length===0)return d+p;if(!c){let g=u.reduce((h,m)=>h+m.length+2,2);c=e.options.lineWidth>0&&g>e.options.lineWidth}if(c){let g=d;for(let h of u)g+=h?`
|
|
77
|
+
${r}${i}${h}`:`
|
|
78
|
+
`;return`${g}
|
|
79
|
+
${i}${p}`}else return`${d}${o}${u.join(" ")}${o}${p}`}function Zt({indent:s,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let r=zt.indentComment(e(n),s);t.push(r.trimStart())}}no.stringifyCollection=$u});var ce=y($s=>{"use strict";var Nu=_s(),xu=Cs(),qu=jt(),le=E(),en=ae(),Pu=I();function Ze(s,e){let t=le.isScalar(e)?e.value:e;for(let n of s)if(le.isPair(n)&&(n.key===e||n.key===t||le.isScalar(n.key)&&n.key.value===t))return n}var As=class extends qu.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(le.MAP,e),this.items=[]}static from(e,t,n){let{keepUndefined:i,replacer:r}=n,o=new this(e),a=(l,c)=>{if(typeof r=="function")c=r.call(t,l,c);else if(Array.isArray(r)&&!r.includes(l))return;(c!==void 0||i)&&o.items.push(en.createPair(l,c,n))};if(t instanceof Map)for(let[l,c]of t)a(l,c);else if(t&&typeof t=="object")for(let l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;le.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new en.Pair(e,e?.value):n=new en.Pair(e.key,e.value);let i=Ze(this.items,n.key),r=this.schema?.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);le.isScalar(i.value)&&Pu.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(r){let o=this.items.findIndex(a=>r(n,a)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let t=Ze(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let i=Ze(this.items,e)?.value;return(!t&&le.isScalar(i)?i.value:i)??void 0}has(e){return!!Ze(this.items,e)}set(e,t){this.add(new en.Pair(e,t),!0)}toJSON(e,t,n){let i=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(let r of this.items)xu.addPairToJSMap(t,i,r);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!le.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Nu.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}};$s.YAMLMap=As;$s.findPair=Ze});var Te=y(io=>{"use strict";var Iu=E(),so=ce(),Lu={collection:"map",default:!0,nodeClass:so.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(s,e){return Iu.isMap(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>so.YAMLMap.from(s,e,t)};io.map=Lu});var ue=y(ro=>{"use strict";var Mu=Ye(),Du=_s(),Ru=jt(),nn=E(),ju=I(),Bu=se(),Es=class extends Ru.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(nn.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=tn(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let n=tn(e);if(typeof n!="number")return;let i=this.items[n];return!t&&nn.isScalar(i)?i.value:i}has(e){let t=tn(e);return typeof t=="number"&&t<this.items.length}set(e,t){let n=tn(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[n];nn.isScalar(i)&&ju.isScalarValue(t)?i.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let i=0;for(let r of this.items)n.push(Bu.toJS(r,String(i++),t));return n}toString(e,t,n){return e?Du.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:i}=n,r=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let a of t){if(typeof i=="function"){let l=t instanceof Set?a:String(o++);a=i.call(t,l,a)}r.items.push(Mu.createNode(a,void 0,n))}}return r}};function tn(s){let e=nn.isScalar(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}ro.YAMLSeq=Es});var Ne=y(ao=>{"use strict";var Uu=E(),oo=ue(),Fu={collection:"seq",default:!0,nodeClass:oo.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(s,e){return Uu.isSeq(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>oo.YAMLSeq.from(s,e,t)};ao.seq=Fu});var et=y(lo=>{"use strict";var Vu=Qe(),Ku={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),Vu.stringifyString(s,e,t,n)}};lo.string=Ku});var sn=y(fo=>{"use strict";var co=I(),uo={identify:s=>s==null,createNode:()=>new co.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new co.Scalar(null),stringify:({source:s},e)=>typeof s=="string"&&uo.test.test(s)?s:e.options.nullStr};fo.nullTag=uo});var Ts=y(po=>{"use strict";var Hu=I(),ho={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new Hu.Scalar(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&ho.test.test(s)){let n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};po.boolTag=ho});var xe=y(mo=>{"use strict";function Yu({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(n,-0)?"-0":JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^-?\d/.test(r)&&!r.includes("e")){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}mo.stringifyNumber=Yu});var xs=y(rn=>{"use strict";var Wu=I(),Ns=xe(),Ju={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ns.stringifyNumber},Gu={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():Ns.stringifyNumber(s)}},Qu={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){let e=new Wu.Scalar(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:Ns.stringifyNumber};rn.float=Qu;rn.floatExp=Gu;rn.floatNaN=Ju});var Ps=y(an=>{"use strict";var go=xe(),on=s=>typeof s=="bigint"||Number.isInteger(s),qs=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function yo(s,e,t){let{value:n}=s;return on(n)&&n>=0?t+n.toString(e):go.stringifyNumber(s)}var Xu={identify:s=>on(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>qs(s,2,8,t),stringify:s=>yo(s,8,"0o")},zu={identify:on,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>qs(s,0,10,t),stringify:go.stringifyNumber},Zu={identify:s=>on(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>qs(s,2,16,t),stringify:s=>yo(s,16,"0x")};an.int=zu;an.intHex=Zu;an.intOct=Xu});var wo=y(bo=>{"use strict";var ef=Te(),tf=sn(),nf=Ne(),sf=et(),rf=Ts(),Is=xs(),Ls=Ps(),of=[ef.map,nf.seq,sf.string,tf.nullTag,rf.boolTag,Ls.intOct,Ls.int,Ls.intHex,Is.floatNaN,Is.floatExp,Is.float];bo.schema=of});var ko=y(So=>{"use strict";var af=I(),lf=Te(),cf=Ne();function vo(s){return typeof s=="bigint"||Number.isInteger(s)}var ln=({value:s})=>JSON.stringify(s),uf=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:ln},{identify:s=>s==null,createNode:()=>new af.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:ln},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:s=>s==="true",stringify:ln},{identify:vo,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>vo(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:ln}],ff={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},df=[lf.map,cf.seq].concat(uf,ff);So.schema=df});var Ds=y(Co=>{"use strict";var tt=Q("buffer"),Ms=I(),hf=Qe(),pf={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof tt.Buffer=="function")return tt.Buffer.from(s,"base64");if(typeof atob=="function"){let t=atob(s.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},n,i,r){if(!t)return"";let o=t,a;if(typeof tt.Buffer=="function")a=o instanceof tt.Buffer?o.toString("base64"):tt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<o.length;++c)l+=String.fromCharCode(o[c]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Ms.Scalar.BLOCK_LITERAL),e!==Ms.Scalar.QUOTE_DOUBLE){let l=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),c=Math.ceil(a.length/l),f=new Array(c);for(let u=0,d=0;u<c;++u,d+=l)f[u]=a.substr(d,l);a=f.join(e===Ms.Scalar.BLOCK_LITERAL?`
|
|
80
|
+
`:" ")}return hf.stringifyString({comment:s,type:e,value:a},n,i,r)}};Co.binary=pf});var fn=y(un=>{"use strict";var cn=E(),Rs=ae(),mf=I(),gf=ue();function Oo(s,e){if(cn.isSeq(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!cn.isPair(n)){if(cn.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new Rs.Pair(new mf.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
|
|
81
|
+
${i.key.commentBefore}`:n.commentBefore),n.comment){let r=i.value??i.key;r.comment=r.comment?`${n.comment}
|
|
82
|
+
${r.comment}`:n.comment}n=i}s.items[t]=cn.isPair(n)?n:new Rs.Pair(n)}}else e("Expected a sequence for this tag");return s}function _o(s,e,t){let{replacer:n}=t,i=new gf.YAMLSeq(s);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;i.items.push(Rs.createPair(a,l,t))}return i}var yf={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Oo,createNode:_o};un.createPairs=_o;un.pairs=yf;un.resolvePairs=Oo});var Us=y(Bs=>{"use strict";var Ao=E(),js=se(),nt=ce(),bf=ue(),$o=fn(),be=class s extends bf.YAMLSeq{constructor(){super(),this.add=nt.YAMLMap.prototype.add.bind(this),this.delete=nt.YAMLMap.prototype.delete.bind(this),this.get=nt.YAMLMap.prototype.get.bind(this),this.has=nt.YAMLMap.prototype.has.bind(this),this.set=nt.YAMLMap.prototype.set.bind(this),this.tag=s.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let i of this.items){let r,o;if(Ao.isPair(i)?(r=js.toJS(i.key,"",t),o=js.toJS(i.value,r,t)):r=js.toJS(i,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,o)}return n}static from(e,t,n){let i=$o.createPairs(e,t,n),r=new this;return r.items=i.items,r}};be.tag="tag:yaml.org,2002:omap";var wf={collection:"seq",identify:s=>s instanceof Map,nodeClass:be,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let t=$o.resolvePairs(s,e),n=[];for(let{key:i}of t.items)Ao.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new be,t)},createNode:(s,e,t)=>be.from(s,e,t)};Bs.YAMLOMap=be;Bs.omap=wf});var qo=y(Fs=>{"use strict";var Eo=I();function To({value:s,source:e},t){return e&&(s?No:xo).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var No={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Eo.Scalar(!0),stringify:To},xo={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Eo.Scalar(!1),stringify:To};Fs.falseTag=xo;Fs.trueTag=No});var Po=y(dn=>{"use strict";var vf=I(),Vs=xe(),Sf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Vs.stringifyNumber},kf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():Vs.stringifyNumber(s)}},Cf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){let e=new vf.Scalar(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){let n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Vs.stringifyNumber};dn.float=Cf;dn.floatExp=kf;dn.floatNaN=Sf});var Lo=y(it=>{"use strict";var Io=xe(),st=s=>typeof s=="bigint"||Number.isInteger(s);function hn(s,e,t,{intAsBigInt:n}){let i=s[0];if((i==="-"||i==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let o=BigInt(s);return i==="-"?BigInt(-1)*o:o}let r=parseInt(s,t);return i==="-"?-1*r:r}function Ks(s,e,t){let{value:n}=s;if(st(n)){let i=n.toString(e);return n<0?"-"+t+i.substr(1):t+i}return Io.stringifyNumber(s)}var Of={identify:st,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>hn(s,2,2,t),stringify:s=>Ks(s,2,"0b")},_f={identify:st,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>hn(s,1,8,t),stringify:s=>Ks(s,8,"0")},Af={identify:st,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>hn(s,0,10,t),stringify:Io.stringifyNumber},$f={identify:st,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>hn(s,2,16,t),stringify:s=>Ks(s,16,"0x")};it.int=Af;it.intBin=Of;it.intHex=$f;it.intOct=_f});var Ys=y(Hs=>{"use strict";var gn=E(),pn=ae(),mn=ce(),we=class s extends mn.YAMLMap{constructor(e){super(e),this.tag=s.tag}add(e){let t;gn.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new pn.Pair(e.key,null):t=new pn.Pair(e,null),mn.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let n=mn.findPair(this.items,e);return!t&&gn.isPair(n)?gn.isScalar(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=mn.findPair(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new pn.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}static from(e,t,n){let{replacer:i}=n,r=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof i=="function"&&(o=i.call(t,o,o)),r.items.push(pn.createPair(o,null,n));return r}};we.tag="tag:yaml.org,2002:set";var Ef={collection:"map",identify:s=>s instanceof Set,nodeClass:we,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>we.from(s,e,t),resolve(s,e){if(gn.isMap(s)){if(s.hasAllNullValues(!0))return Object.assign(new we,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};Hs.YAMLSet=we;Hs.set=Ef});var Js=y(yn=>{"use strict";var Tf=xe();function Ws(s,e){let t=s[0],n=t==="-"||t==="+"?s.substring(1):s,i=o=>e?BigInt(o):Number(o),r=n.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return t==="-"?i(-1)*r:r}function Mo(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Tf.stringifyNumber(s);let n="";e<0&&(n="-",e*=t(-1));let i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),n+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Nf={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>Ws(s,t),stringify:Mo},xf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>Ws(s,!1),stringify:Mo},Do={identify:s=>s instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(s){let e=s.match(Do.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,n,i,r,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(t,n-1,i,r||0,o||0,a||0,l),f=e[8];if(f&&f!=="Z"){let u=Ws(f,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:s})=>s?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};yn.floatTime=xf;yn.intTime=Nf;yn.timestamp=Do});var Bo=y(jo=>{"use strict";var qf=Te(),Pf=sn(),If=Ne(),Lf=et(),Mf=Ds(),Ro=qo(),Gs=Po(),bn=Lo(),Df=Gt(),Rf=Us(),jf=fn(),Bf=Ys(),Qs=Js(),Uf=[qf.map,If.seq,Lf.string,Pf.nullTag,Ro.trueTag,Ro.falseTag,bn.intBin,bn.intOct,bn.int,bn.intHex,Gs.floatNaN,Gs.floatExp,Gs.float,Mf.binary,Df.merge,Rf.omap,jf.pairs,Bf.set,Qs.intTime,Qs.floatTime,Qs.timestamp];jo.schema=Uf});var Qo=y(Zs=>{"use strict";var Ko=Te(),Ff=sn(),Ho=Ne(),Vf=et(),Kf=Ts(),Xs=xs(),zs=Ps(),Hf=wo(),Yf=ko(),Yo=Ds(),rt=Gt(),Wo=Us(),Jo=fn(),Uo=Bo(),Go=Ys(),wn=Js(),Fo=new Map([["core",Hf.schema],["failsafe",[Ko.map,Ho.seq,Vf.string]],["json",Yf.schema],["yaml11",Uo.schema],["yaml-1.1",Uo.schema]]),Vo={binary:Yo.binary,bool:Kf.boolTag,float:Xs.float,floatExp:Xs.floatExp,floatNaN:Xs.floatNaN,floatTime:wn.floatTime,int:zs.int,intHex:zs.intHex,intOct:zs.intOct,intTime:wn.intTime,map:Ko.map,merge:rt.merge,null:Ff.nullTag,omap:Wo.omap,pairs:Jo.pairs,seq:Ho.seq,set:Go.set,timestamp:wn.timestamp},Wf={"tag:yaml.org,2002:binary":Yo.binary,"tag:yaml.org,2002:merge":rt.merge,"tag:yaml.org,2002:omap":Wo.omap,"tag:yaml.org,2002:pairs":Jo.pairs,"tag:yaml.org,2002:set":Go.set,"tag:yaml.org,2002:timestamp":wn.timestamp};function Jf(s,e,t){let n=Fo.get(e);if(n&&!s)return t&&!n.includes(rt.merge)?n.concat(rt.merge):n.slice();let i=n;if(!i)if(Array.isArray(s))i=[];else{let r=Array.from(Fo.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`)}if(Array.isArray(s))for(let r of s)i=i.concat(r);else typeof s=="function"&&(i=s(i.slice()));return t&&(i=i.concat(rt.merge)),i.reduce((r,o)=>{let a=typeof o=="string"?Vo[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(Vo).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}Zs.coreKnownTags=Wf;Zs.getTags=Jf});var ni=y(Xo=>{"use strict";var ei=E(),Gf=Te(),Qf=Ne(),Xf=et(),vn=Qo(),zf=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0,ti=class s{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?vn.getTags(e,"compat"):e?vn.getTags(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?vn.coreKnownTags:{},this.tags=vn.getTags(t,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,ei.MAP,{value:Gf.map}),Object.defineProperty(this,ei.SCALAR,{value:Xf.string}),Object.defineProperty(this,ei.SEQ,{value:Qf.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?zf:null}clone(){let e=Object.create(s.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Xo.Schema=ti});var Zo=y(zo=>{"use strict";var Zf=E(),si=Xe(),ot=We();function ed(s,e){let t=[],n=e.directives===!0;if(e.directives!==!1&&s.directives){let l=s.directives.toString(s);l?(t.push(l),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");let i=si.createStringifyContext(s,e),{commentString:r}=i.options;if(s.commentBefore){t.length!==1&&t.unshift("");let l=r(s.commentBefore);t.unshift(ot.indentComment(l,""))}let o=!1,a=null;if(s.contents){if(Zf.isNode(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){let f=r(s.contents.commentBefore);t.push(ot.indentComment(f,""))}i.forceBlockIndent=!!s.comment,a=s.contents.comment}let l=a?void 0:()=>o=!0,c=si.stringify(s.contents,i,()=>a=null,l);a&&(c+=ot.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(si.stringify(s.contents,i));if(s.directives?.docEnd)if(s.comment){let l=r(s.comment);l.includes(`
|
|
83
|
+
`)?(t.push("..."),t.push(ot.indentComment(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=s.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(ot.indentComment(r(l),"")))}return t.join(`
|
|
84
|
+
`)+`
|
|
85
|
+
`}zo.stringifyDocument=ed});var at=y(ea=>{"use strict";var td=He(),qe=jt(),H=E(),nd=ae(),sd=se(),id=ni(),rd=Zo(),ii=Lt(),od=ls(),ad=Ye(),ri=as(),oi=class s{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,H.NODE_TYPE,{value:H.DOC});let i=null;typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=r;let{version:o}=r;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new ri.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(s.prototype,{[H.NODE_TYPE]:{value:H.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=H.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Pe(this.contents)&&this.contents.add(e)}addIn(e,t){Pe(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=ii.anchorNames(this);e.anchor=!t||n.has(t)?ii.findNewAnchor(t||"a",n):t}return new td.Alias(e.anchor)}createNode(e,t,n){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){let m=v=>typeof v=="number"||v instanceof String||v instanceof Number,w=t.filter(m).map(String);w.length>0&&(t=t.concat(w)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:f}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:p}=ii.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:p},h=ad.createNode(e,f,g);return a&&H.isCollection(h)&&(h.flow=!0),d(),h}createPair(e,t,n={}){let i=this.createNode(e,null,n),r=this.createNode(t,null,n);return new nd.Pair(i,r)}delete(e){return Pe(this.contents)?this.contents.delete(e):!1}deleteIn(e){return qe.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Pe(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return H.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return qe.isEmptyPath(e)?!t&&H.isScalar(this.contents)?this.contents.value:this.contents:H.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return H.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return qe.isEmptyPath(e)?this.contents!==void 0:H.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=qe.collectionFromPath(this.schema,[e],t):Pe(this.contents)&&this.contents.set(e,t)}setIn(e,t){qe.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=qe.collectionFromPath(this.schema,Array.from(e),t):Pe(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ri.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new ri.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new id.Schema(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=sd.toJS(this.contents,t??"",a);if(typeof r=="function")for(let{count:c,res:f}of a.anchors.values())r(f,c);return typeof o=="function"?od.applyReviver(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return rd.stringifyDocument(this,e)}};function Pe(s){if(H.isCollection(s))return!0;throw new Error("Expected a YAML collection as document contents")}ea.Document=oi});var ut=y(ct=>{"use strict";var lt=class extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}},ai=class extends lt{constructor(e,t,n){super("YAMLParseError",e,t,n)}},li=class extends lt{constructor(e,t,n){super("YAMLWarning",e,t,n)}},ld=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:n,col:i}=t.linePos[0];t.message+=` at line ${n}, column ${i}`;let r=i-1,o=s.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){let a=Math.min(r-39,o.length-79);o="\u2026"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(o.substring(0,r))){let a=s.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
86
|
+
`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=t.linePos[1];l?.line===n&&l.col>i&&(a=Math.max(1,Math.min(l.col-i,80-r)));let c=" ".repeat(r)+"^".repeat(a);t.message+=`:
|
|
87
|
+
|
|
88
|
+
${o}
|
|
89
|
+
${c}
|
|
90
|
+
`}};ct.YAMLError=lt;ct.YAMLParseError=ai;ct.YAMLWarning=li;ct.prettifyError=ld});var ft=y(ta=>{"use strict";function cd(s,{flow:e,indicator:t,next:n,offset:i,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,f=a,u="",d="",p=!1,g=!1,h=null,m=null,w=null,v=null,C=null,O=null,_=null;for(let S of s)switch(g&&(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma"&&r(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),h&&(c&&S.type!=="comment"&&S.type!=="newline"&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),S.type){case"space":!e&&(t!=="doc-start"||n?.type!=="flow-collection")&&S.source.includes(" ")&&(h=S),f=!0;break;case"comment":{f||r(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let L=S.source.substring(1)||" ";u?u+=d+L:u=L,d="",c=!1;break}case"newline":c?u?u+=S.source:(!O||t!=="seq-item-ind")&&(l=!0):d+=S.source,c=!0,p=!0,(m||w)&&(v=S),f=!0;break;case"anchor":m&&r(S,"MULTIPLE_ANCHORS","A node can have at most one anchor"),S.source.endsWith(":")&&r(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=S,_??(_=S.offset),c=!1,f=!1,g=!0;break;case"tag":{w&&r(S,"MULTIPLE_TAGS","A node can have at most one tag"),w=S,_??(_=S.offset),c=!1,f=!1,g=!0;break}case t:(m||w)&&r(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`),O&&r(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${e??"collection"}`),O=S,c=t==="seq-item-ind"||t==="explicit-key-ind",f=!1;break;case"comma":if(e){C&&r(S,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),C=S,c=!1,f=!1;break}default:r(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),c=!1,f=!1}let A=s[s.length-1],q=A?A.offset+A.source.length:i;return g&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&r(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(c&&h.indent<=o||n?.type==="block-map"||n?.type==="block-seq")&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:C,found:O,spaceBefore:l,comment:u,hasNewline:p,anchor:m,tag:w,newlineAfterProp:v,end:q,start:_??q}}ta.resolveProps=cd});var Sn=y(na=>{"use strict";function ci(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`
|
|
91
|
+
`))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(ci(e.key)||ci(e.value))return!0}return!1;default:return!0}}na.containsNewline=ci});var ui=y(sa=>{"use strict";var ud=Sn();function fd(s,e,t){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&ud.containsNewline(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}sa.flowIndentCheck=fd});var fi=y(ra=>{"use strict";var ia=E();function dd(s,e,t){let{uniqueKeys:n}=s.options;if(n===!1)return!1;let i=typeof n=="function"?n:(r,o)=>r===o||ia.isScalar(r)&&ia.isScalar(o)&&r.value===o.value;return e.some(r=>i(r.key,t))}ra.mapIncludes=dd});var fa=y(ua=>{"use strict";var oa=ae(),hd=ce(),aa=ft(),pd=Sn(),la=ui(),md=fi(),ca="All mapping items must start at the same column";function gd({composeNode:s,composeEmptyNode:e},t,n,i,r){let o=r?.nodeClass??hd.YAMLMap,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=n.offset,c=null;for(let f of n.items){let{start:u,key:d,sep:p,value:g}=f,h=aa.resolveProps(u,{indicator:"explicit-key-ind",next:d??p?.[0],offset:l,onError:i,parentIndent:n.indent,startOnNewline:!0}),m=!h.found;if(m){if(d&&(d.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==n.indent&&i(l,"BAD_INDENT",ca)),!h.anchor&&!h.tag&&!p){c=h.end,h.comment&&(a.comment?a.comment+=`
|
|
92
|
+
`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||pd.containsNewline(d))&&i(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(l,"BAD_INDENT",ca);t.atKey=!0;let w=h.end,v=d?s(t,d,h,i):e(t,w,u,null,h,i);t.schema.compat&&la.flowIndentCheck(n.indent,d,i),t.atKey=!1,md.mapIncludes(t,a.items,v)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let C=aa.resolveProps(p??[],{indicator:"map-value-ind",next:g,offset:v.range[2],onError:i,parentIndent:n.indent,startOnNewline:!d||d.type==="block-scalar"});if(l=C.end,C.found){m&&(g?.type==="block-map"&&!C.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&h.start<C.found.offset-1024&&i(v.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let O=g?s(t,g,C,i):e(t,l,p,null,C,i);t.schema.compat&&la.flowIndentCheck(n.indent,g,i),l=O.range[2];let _=new oa.Pair(v,O);t.options.keepSourceTokens&&(_.srcToken=f),a.items.push(_)}else{m&&i(v.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),C.comment&&(v.comment?v.comment+=`
|
|
93
|
+
`+C.comment:v.comment=C.comment);let O=new oa.Pair(v);t.options.keepSourceTokens&&(O.srcToken=f),a.items.push(O)}}return c&&c<l&&i(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,l,c??l],a}ua.resolveBlockMap=gd});var ha=y(da=>{"use strict";var yd=ue(),bd=ft(),wd=ui();function vd({composeNode:s,composeEmptyNode:e},t,n,i,r){let o=r?.nodeClass??yd.YAMLSeq,a=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=n.offset,c=null;for(let{start:f,value:u}of n.items){let d=bd.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:l,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=d.end,d.comment&&(a.comment=d.comment);continue}let p=u?s(t,u,d,i):e(t,d.end,f,null,d,i);t.schema.compat&&wd.flowIndentCheck(n.indent,u,i),l=p.range[2],a.items.push(p)}return a.range=[n.offset,l,c??l],a}da.resolveBlockSeq=vd});var Ie=y(pa=>{"use strict";function Sd(s,e,t,n){let i="";if(s){let r=!1,o="";for(let a of s){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=l.substring(1)||" ";i?i+=o+f:i=f,o="";break}case"newline":i&&(o+=l),r=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:i,offset:e}}pa.resolveEnd=Sd});var ba=y(ya=>{"use strict";var kd=E(),Cd=ae(),ma=ce(),Od=ue(),_d=Ie(),ga=ft(),Ad=Sn(),$d=fi(),di="Block collections are not allowed within flow collections",hi=s=>s&&(s.type==="block-map"||s.type==="block-seq");function Ed({composeNode:s,composeEmptyNode:e},t,n,i,r){let o=n.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?ma.YAMLMap:Od.YAMLSeq),c=new l(t.schema);c.flow=!0;let f=t.atRoot;f&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let u=n.offset+n.start.source.length;for(let m=0;m<n.items.length;++m){let w=n.items[m],{start:v,key:C,sep:O,value:_}=w,A=ga.resolveProps(v,{flow:a,indicator:"explicit-key-ind",next:C??O?.[0],offset:u,onError:i,parentIndent:n.indent,startOnNewline:!1});if(!A.found){if(!A.anchor&&!A.tag&&!O&&!_){m===0&&A.comma?i(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<n.items.length-1&&i(A.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),A.comment&&(c.comment?c.comment+=`
|
|
94
|
+
`+A.comment:c.comment=A.comment),u=A.end;continue}!o&&t.options.strict&&Ad.containsNewline(C)&&i(C,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)A.comma&&i(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(A.comma||i(A.start,"MISSING_CHAR",`Missing , between ${a} items`),A.comment){let q="";e:for(let S of v)switch(S.type){case"comma":case"space":break;case"comment":q=S.source.substring(1);break e;default:break e}if(q){let S=c.items[c.items.length-1];kd.isPair(S)&&(S=S.value??S.key),S.comment?S.comment+=`
|
|
95
|
+
`+q:S.comment=q,A.comment=A.comment.substring(q.length+1)}}if(!o&&!O&&!A.found){let q=_?s(t,_,A,i):e(t,A.end,O,null,A,i);c.items.push(q),u=q.range[2],hi(_)&&i(q.range,"BLOCK_IN_FLOW",di)}else{t.atKey=!0;let q=A.end,S=C?s(t,C,A,i):e(t,q,v,null,A,i);hi(C)&&i(S.range,"BLOCK_IN_FLOW",di),t.atKey=!1;let L=ga.resolveProps(O??[],{flow:a,indicator:"map-value-ind",next:_,offset:S.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(L.found){if(!o&&!A.found&&t.options.strict){if(O)for(let M of O){if(M===L.found)break;if(M.type==="newline"){i(M,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}A.start<L.found.offset-1024&&i(L.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else _&&("source"in _&&_.source?.[0]===":"?i(_,"MISSING_CHAR",`Missing space after : in ${a}`):i(L.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let te=_?s(t,_,L,i):L.found?e(t,L.end,O,null,L,i):null;te?hi(_)&&i(te.range,"BLOCK_IN_FLOW",di):L.comment&&(S.comment?S.comment+=`
|
|
96
|
+
`+L.comment:S.comment=L.comment);let Oe=new Cd.Pair(S,te);if(t.options.keepSourceTokens&&(Oe.srcToken=w),o){let M=c;$d.mapIncludes(t,M.items,S)&&i(q,"DUPLICATE_KEY","Map keys must be unique"),M.items.push(Oe)}else{let M=new ma.YAMLMap(t.schema);M.flow=!0,M.items.push(Oe);let Hi=(te??S).range;M.range=[S.range[0],Hi[1],Hi[2]],c.items.push(M)}u=te?te.range[2]:L.end}}let d=o?"}":"]",[p,...g]=n.end,h=u;if(p?.source===d)h=p.offset+p.source.length;else{let m=a[0].toUpperCase()+a.substring(1),w=f?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;i(u,f?"MISSING_CHAR":"BAD_INDENT",w),p&&p.source.length!==1&&g.unshift(p)}if(g.length>0){let m=_d.resolveEnd(g,h,t.options.strict,i);m.comment&&(c.comment?c.comment+=`
|
|
97
|
+
`+m.comment:c.comment=m.comment),c.range=[n.offset,h,m.offset]}else c.range=[n.offset,h,h];return c}ya.resolveFlowCollection=Ed});var va=y(wa=>{"use strict";var Td=E(),Nd=I(),xd=ce(),qd=ue(),Pd=fa(),Id=ha(),Ld=ba();function pi(s,e,t,n,i,r){let o=t.type==="block-map"?Pd.resolveBlockMap(s,e,t,n,r):t.type==="block-seq"?Id.resolveBlockSeq(s,e,t,n,r):Ld.resolveFlowCollection(s,e,t,n,r),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function Md(s,e,t,n,i){let r=n.tag,o=r?e.directives.tagName(r.source,d=>i(r,"TAG_RESOLVE_FAILED",d)):null;if(t.type==="block-seq"){let{anchor:d,newlineAfterProp:p}=n,g=d&&r?d.offset>r.offset?d:r:d??r;g&&(!p||p.offset<g.offset)&&i(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===xd.YAMLMap.tagName&&a==="map"||o===qd.YAMLSeq.tagName&&a==="seq")return pi(s,e,t,i,o);let l=e.schema.tags.find(d=>d.tag===o&&d.collection===a);if(!l){let d=e.schema.knownTags[o];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),l=d;else return d?i(r,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),pi(s,e,t,i,o)}let c=pi(s,e,t,i,o,l),f=l.resolve?.(c,d=>i(r,"TAG_RESOLVE_FAILED",d),e.options)??c,u=Td.isNode(f)?f:new Nd.Scalar(f);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}wa.composeCollection=Md});var gi=y(Sa=>{"use strict";var mi=I();function Dd(s,e,t){let n=e.offset,i=Rd(e,s.options.strict,t);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let r=i.mode===">"?mi.Scalar.BLOCK_FOLDED:mi.Scalar.BLOCK_LITERAL,o=e.source?jd(e.source):[],a=o.length;for(let h=o.length-1;h>=0;--h){let m=o[h][1];if(m===""||m==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&o.length>0?`
|
|
98
|
+
`.repeat(Math.max(1,o.length-1)):"",m=n+i.length;return e.source&&(m+=e.source.length),{value:h,type:r,comment:i.comment,range:[n,m,m]}}let l=e.indent+i.indent,c=e.offset+i.length,f=0;for(let h=0;h<a;++h){let[m,w]=o[h];if(w===""||w==="\r")i.indent===0&&m.length>l&&(l=m.length);else{m.length<l&&t(c+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(l=m.length),f=h,l===0&&!s.atRoot&&t(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=m.length+w.length+1}for(let h=o.length-1;h>=a;--h)o[h][0].length>l&&(a=h+1);let u="",d="",p=!1;for(let h=0;h<f;++h)u+=o[h][0].slice(l)+`
|
|
99
|
+
`;for(let h=f;h<a;++h){let[m,w]=o[h];c+=m.length+w.length+1;let v=w[w.length-1]==="\r";if(v&&(w=w.slice(0,-1)),w&&m.length<l){let O=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;t(c-w.length-(v?2:1),"BAD_INDENT",O),m=""}r===mi.Scalar.BLOCK_LITERAL?(u+=d+m.slice(l)+w,d=`
|
|
100
|
+
`):m.length>l||w[0]===" "?(d===" "?d=`
|
|
101
|
+
`:!p&&d===`
|
|
102
|
+
`&&(d=`
|
|
103
|
+
|
|
104
|
+
`),u+=d+m.slice(l)+w,d=`
|
|
105
|
+
`,p=!0):w===""?d===`
|
|
106
|
+
`?u+=`
|
|
107
|
+
`:d=`
|
|
108
|
+
`:(u+=d+w,d=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let h=a;h<o.length;++h)u+=`
|
|
109
|
+
`+o[h][0].slice(l);u[u.length-1]!==`
|
|
110
|
+
`&&(u+=`
|
|
111
|
+
`);break;default:u+=`
|
|
112
|
+
`}let g=n+i.length+e.source.length;return{value:u,type:r,comment:i.comment,range:[n,g,g]}}function Rd({offset:s,props:e},t,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],r=i[0],o=0,a="",l=-1;for(let d=1;d<i.length;++d){let p=i[d];if(!a&&(p==="-"||p==="+"))a=p;else{let g=Number(p);!o&&g?o=g:l===-1&&(l=s+d)}}l!==-1&&n(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,f="",u=i.length;for(let d=1;d<e.length;++d){let p=e[d];switch(p.type){case"space":c=!0;case"newline":u+=p.source.length;break;case"comment":t&&!c&&n(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=p.source.length,f=p.source.substring(1);break;case"error":n(p,"UNEXPECTED_TOKEN",p.message),u+=p.source.length;break;default:{let g=`Unexpected token in block scalar header: ${p.type}`;n(p,"UNEXPECTED_TOKEN",g);let h=p.source;h&&typeof h=="string"&&(u+=h.length)}}}return{mode:r,indent:o,chomp:a,comment:f,length:u}}function jd(s){let e=s.split(/\n( *)/),t=e[0],n=t.match(/^( *)/),r=[n?.[1]?[n[1],t.slice(n[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}Sa.resolveBlockScalar=Dd});var bi=y(Ca=>{"use strict";var yi=I(),Bd=Ie();function Ud(s,e,t){let{offset:n,type:i,source:r,end:o}=s,a,l,c=(d,p,g)=>t(n+d,p,g);switch(i){case"scalar":a=yi.Scalar.PLAIN,l=Fd(r,c);break;case"single-quoted-scalar":a=yi.Scalar.QUOTE_SINGLE,l=Vd(r,c);break;case"double-quoted-scalar":a=yi.Scalar.QUOTE_DOUBLE,l=Kd(r,c);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+r.length,n+r.length]}}let f=n+r.length,u=Bd.resolveEnd(o,f,e,t);return{value:l,type:a,comment:u.comment,range:[n,f,u.offset]}}function Fd(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),ka(s)}function Vd(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),ka(s.slice(1,-1)).replace(/''/g,"'")}function ka(s){let e=/(.*?)\r?\n/sy,t=e.exec(s);if(!t)return s;let n,i;try{n=new RegExp("(?<![ ])[ ]+$"),i=new RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{n=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let r=t[1].replace(n,""),o=" ",a=e.lastIndex;for(;t=e.exec(s);){let c=t[1].replace(i,"");c===""?o===`
|
|
113
|
+
`?r+=o:o=`
|
|
114
|
+
`:(r+=o+c,o=" "),a=e.lastIndex}let l=/[ \t]*(.*)/sy;return l.lastIndex=a,t=l.exec(s),r+o+(t?.[1]??"")}function Kd(s,e){let t="";for(let n=1;n<s.length-1;++n){let i=s[n];if(!(i==="\r"&&s[n+1]===`
|
|
115
|
+
`))if(i===`
|
|
116
|
+
`){let{fold:r,offset:o}=Hd(s,n);t+=r,n=o}else if(i==="\\"){let r=s[++n],o=Yd[r];if(o)t+=o;else if(r===`
|
|
117
|
+
`)for(r=s[n+1];r===" "||r===" ";)r=s[++n+1];else if(r==="\r"&&s[n+1]===`
|
|
118
|
+
`)for(r=s[++n+1];r===" "||r===" ";)r=s[++n+1];else if(r==="x"||r==="u"||r==="U"){let a=r==="x"?2:r==="u"?4:8;t+=Wd(s,n+1,a,e),n+=a}else{let a=s.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(i===" "||i===" "){let r=n,o=s[n+1];for(;o===" "||o===" ";)o=s[++n+1];o!==`
|
|
119
|
+
`&&!(o==="\r"&&s[n+2]===`
|
|
120
|
+
`)&&(t+=n>r?s.slice(r,n+1):i)}else t+=i}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function Hd(s,e){let t="",n=s[e+1];for(;(n===" "||n===" "||n===`
|
|
121
|
+
`||n==="\r")&&!(n==="\r"&&s[e+2]!==`
|
|
122
|
+
`);)n===`
|
|
123
|
+
`&&(t+=`
|
|
124
|
+
`),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}var Yd={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
125
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Wd(s,e,t,n){let i=s.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(o)}catch{let a=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Ca.resolveFlowScalar=Ud});var Aa=y(_a=>{"use strict";var ve=E(),Oa=I(),Jd=gi(),Gd=bi();function Qd(s,e,t,n){let{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?Jd.resolveBlockScalar(s,e,n):Gd.resolveFlowScalar(e,s.options.strict,n),l=t?s.directives.tagName(t.source,u=>n(t,"TAG_RESOLVE_FAILED",u)):null,c;s.options.stringKeys&&s.atKey?c=s.schema[ve.SCALAR]:l?c=Xd(s.schema,i,l,t,n):e.type==="scalar"?c=zd(s,i,e,n):c=s.schema[ve.SCALAR];let f;try{let u=c.resolve(i,d=>n(t??e,"TAG_RESOLVE_FAILED",d),s.options);f=ve.isScalar(u)?u:new Oa.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);n(t??e,"TAG_RESOLVE_FAILED",d),f=new Oa.Scalar(i)}return f.range=a,f.source=i,r&&(f.type=r),l&&(f.tag=l),c.format&&(f.format=c.format),o&&(f.comment=o),f}function Xd(s,e,t,n,i){if(t==="!")return s[ve.SCALAR];let r=[];for(let a of s.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)r.push(a);else return a;for(let a of r)if(a.test?.test(e))return a;let o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[ve.SCALAR])}function zd({atKey:s,directives:e,schema:t},n,i,r){let o=t.tags.find(a=>(a.default===!0||s&&a.default==="key")&&a.test?.test(n))||t[ve.SCALAR];if(t.compat){let a=t.compat.find(l=>l.default&&l.test?.test(n))??t[ve.SCALAR];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),f=`Value may be parsed as either ${l} or ${c}`;r(i,"TAG_RESOLVE_FAILED",f,!0)}}return o}_a.composeScalar=Qd});var Ea=y($a=>{"use strict";function Zd(s,e,t){if(e){t??(t=e.length);for(let n=t-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":s-=i.source.length;continue}for(i=e[++n];i?.type==="space";)s+=i.source.length,i=e[++n];break}}return s}$a.emptyScalarPosition=Zd});var xa=y(vi=>{"use strict";var eh=He(),th=E(),nh=va(),Ta=Aa(),sh=Ie(),ih=Ea(),rh={composeNode:Na,composeEmptyNode:wi};function Na(s,e,t,n){let i=s.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=t,c,f=!0;switch(e.type){case"alias":c=oh(s,e,n),(a||l)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=Ta.composeScalar(s,e,l,n),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=nh.composeCollection(rh,s,e,t,n),a&&(c.anchor=a.source.substring(1))}catch(u){let d=u instanceof Error?u.message:String(u);n(e,"RESOURCE_EXHAUSTION",d)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",u),f=!1}}return c??(c=wi(s,e.offset,void 0,null,t,n)),a&&c.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&s.options.stringKeys&&(!th.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&n(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),s.options.keepSourceTokens&&f&&(c.srcToken=e),c}function wi(s,e,t,n,{spaceBefore:i,comment:r,anchor:o,tag:a,end:l},c){let f={type:"scalar",offset:ih.emptyScalarPosition(e,t,n),indent:-1,source:""},u=Ta.composeScalar(s,f,a,c);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),r&&(u.comment=r,u.range[2]=l),u}function oh({options:s},{offset:e,source:t,end:n},i){let r=new eh.Alias(t.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+t.length,a=sh.resolveEnd(n,o,s.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}vi.composeEmptyNode=wi;vi.composeNode=Na});var Ia=y(Pa=>{"use strict";var ah=at(),qa=xa(),lh=Ie(),ch=ft();function uh(s,e,{offset:t,start:n,value:i,end:r},o){let a=Object.assign({_directives:e},s),l=new ah.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},f=ch.resolveProps(n,{indicator:"doc-start",next:i??r?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});f.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?qa.composeNode(c,i,f,o):qa.composeEmptyNode(c,f.end,n,null,f,o);let u=l.contents.range[2],d=lh.resolveEnd(r,u,!1,o);return d.comment&&(l.comment=d.comment),l.range=[t,u,d.offset],l}Pa.composeDoc=uh});var ki=y(Da=>{"use strict";var fh=Q("process"),dh=as(),hh=at(),dt=ut(),La=E(),ph=Ia(),mh=Ie();function ht(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function Ma(s){let e="",t=!1,n=!1;for(let i=0;i<s.length;++i){let r=s[i];switch(r[0]){case"#":e+=(e===""?"":n?`
|
|
126
|
+
|
|
127
|
+
`:`
|
|
128
|
+
`)+(r.substring(1)||" "),t=!0,n=!1;break;case"%":s[i+1]?.[0]!=="#"&&(i+=1),t=!1;break;default:t||(n=!0),t=!1}}return{comment:e,afterEmptyLine:n}}var Si=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,i,r)=>{let o=ht(t);r?this.warnings.push(new dt.YAMLWarning(o,n,i)):this.errors.push(new dt.YAMLParseError(o,n,i))},this.directives=new dh.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:i}=Ma(this.prelude);if(n){let r=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
129
|
+
${n}`:n;else if(i||e.directives.docStart||!r)e.commentBefore=n;else if(La.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];La.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${n}
|
|
130
|
+
${a}`:n}else{let o=r.commentBefore;r.commentBefore=o?`${n}
|
|
131
|
+
${o}`:n}}if(t){for(let r=0;r<this.errors.length;++r)e.errors.push(this.errors[r]);for(let r=0;r<this.warnings.length;++r)e.warnings.push(this.warnings[r])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Ma(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let i of e)yield*this.next(i);yield*this.end(t,n)}*next(e){switch(fh.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,n,i)=>{let r=ht(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=ph.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new dt.YAMLParseError(ht(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new dt.YAMLParseError(ht(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let t=mh.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
|
|
132
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new dt.YAMLParseError(ht(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new hh.Document(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}};Da.Composer=Si});var Ba=y(kn=>{"use strict";var gh=gi(),yh=bi(),bh=ut(),Ra=Qe();function wh(s,e=!0,t){if(s){let n=(i,r,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(t)t(a,r,o);else throw new bh.YAMLParseError([a,a+1],r,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yh.resolveFlowScalar(s,e,n);case"block-scalar":return gh.resolveBlockScalar({options:{strict:e}},s,n)}}return null}function vh(s,e){let{implicitKey:t=!1,indent:n,inFlow:i=!1,offset:r=-1,type:o="PLAIN"}=e,a=Ra.stringifyString({type:o,value:s},{implicitKey:t,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:n,source:`
|
|
133
|
+
`}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
|
|
134
|
+
`),f=a.substring(0,c),u=a.substring(c+1)+`
|
|
135
|
+
`,d=[{type:"block-scalar-header",offset:r,indent:n,source:f}];return ja(d,l)||d.push({type:"newline",offset:-1,indent:n,source:`
|
|
136
|
+
`}),{type:"block-scalar",offset:r,indent:n,props:d,source:u}}case'"':return{type:"double-quoted-scalar",offset:r,indent:n,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:r,indent:n,source:a,end:l};default:return{type:"scalar",offset:r,indent:n,source:a,end:l}}}function Sh(s,e,t={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=t,a="indent"in s?s.indent:null;if(n&&typeof a=="number"&&(a+=2),!o)switch(s.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=s.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=Ra.stringifyString({type:o,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":kh(s,l);break;case'"':Ci(s,l,"double-quoted-scalar");break;case"'":Ci(s,l,"single-quoted-scalar");break;default:Ci(s,l,"scalar")}}function kh(s,e){let t=e.indexOf(`
|
|
137
|
+
`),n=e.substring(0,t),i=e.substring(t+1)+`
|
|
138
|
+
`;if(s.type==="block-scalar"){let r=s.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=n,s.source=i}else{let{offset:r}=s,o="indent"in s?s.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:n}];ja(a,"end"in s?s.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
139
|
+
`});for(let l of Object.keys(s))l!=="type"&&l!=="offset"&&delete s[l];Object.assign(s,{type:"block-scalar",indent:o,props:a,source:i})}}function ja(s,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function Ci(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{let n=s.props.slice(1),i=e.length;s.props[0].type==="block-scalar-header"&&(i-=s.props[0].source.length);for(let r of n)r.offset+=i;delete s.props,Object.assign(s,{type:t,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:s.offset+e.length,indent:s.indent,source:`
|
|
140
|
+
`};delete s.items,Object.assign(s,{type:t,source:e,end:[i]});break}default:{let n="indent"in s?s.indent:-1,i="end"in s&&Array.isArray(s.end)?s.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(s))r!=="type"&&r!=="offset"&&delete s[r];Object.assign(s,{type:t,indent:n,source:e,end:i})}}}kn.createScalarToken=vh;kn.resolveAsScalar=wh;kn.setScalarValue=Sh});var Fa=y(Ua=>{"use strict";var Ch=s=>"type"in s?On(s):Cn(s);function On(s){switch(s.type){case"block-scalar":{let e="";for(let t of s.props)e+=On(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(let t of s.items)e+=Cn(t);return e}case"flow-collection":{let e=s.start.source;for(let t of s.items)e+=Cn(t);for(let t of s.end)e+=t.source;return e}case"document":{let e=Cn(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function Cn({start:s,key:e,sep:t,value:n}){let i="";for(let r of s)i+=r.source;if(e&&(i+=On(e)),t)for(let r of t)i+=r.source;return n&&(i+=On(n)),i}Ua.stringify=Ch});var Ya=y(Ha=>{"use strict";var Oi=Symbol("break visit"),Oh=Symbol("skip children"),Va=Symbol("remove item");function Se(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),Ka(Object.freeze([]),s,e)}Se.BREAK=Oi;Se.SKIP=Oh;Se.REMOVE=Va;Se.itemAtPath=(s,e)=>{let t=s;for(let[n,i]of e){let r=t?.[n];if(r&&"items"in r)t=r.items[i];else return}return t};Se.parentCollection=(s,e)=>{let t=Se.itemAtPath(s,e.slice(0,-1)),n=e[e.length-1][0],i=t?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Ka(s,e,t){let n=t(e,s);if(typeof n=="symbol")return n;for(let i of["key","value"]){let r=e[i];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){let a=Ka(Object.freeze(s.concat([[i,o]])),r.items[o],t);if(typeof a=="number")o=a-1;else{if(a===Oi)return Oi;a===Va&&(r.items.splice(o,1),o-=1)}}typeof n=="function"&&i==="key"&&(n=n(e,s))}}return typeof n=="function"?n(e,s):n}Ha.visit=Se});var _n=y(U=>{"use strict";var _i=Ba(),_h=Fa(),Ah=Ya(),Ai="\uFEFF",$i="",Ei="",Ti="",$h=s=>!!s&&"items"in s,Eh=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function Th(s){switch(s){case Ai:return"<BOM>";case $i:return"<DOC>";case Ei:return"<FLOW_END>";case Ti:return"<SCALAR>";default:return JSON.stringify(s)}}function Nh(s){switch(s){case Ai:return"byte-order-mark";case $i:return"doc-mode";case Ei:return"flow-error-end";case Ti:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
141
|
+
`:case`\r
|
|
142
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}U.createScalarToken=_i.createScalarToken;U.resolveAsScalar=_i.resolveAsScalar;U.setScalarValue=_i.setScalarValue;U.stringify=_h.stringify;U.visit=Ah.visit;U.BOM=Ai;U.DOCUMENT=$i;U.FLOW_END=Ei;U.SCALAR=Ti;U.isCollection=$h;U.isScalar=Eh;U.prettyToken=Th;U.tokenType=Nh});var qi=y(Ja=>{"use strict";var pt=_n();function W(s){switch(s){case void 0:case" ":case`
|
|
143
|
+
`:case"\r":case" ":return!0;default:return!1}}var Wa=new Set("0123456789ABCDEFabcdef"),xh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),An=new Set(",[]{}"),qh=new Set(` ,[]{}
|
|
144
|
+
\r `),Ni=s=>!s||qh.has(s),xi=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
|
145
|
+
`?!0:t==="\r"?this.buffer[e+1]===`
|
|
146
|
+
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){let i=this.buffer[n+e+1];if(i===`
|
|
147
|
+
`||!i&&!this.atEnd)return e+n+1}return t===`
|
|
148
|
+
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&W(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
149
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===pt.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,n=e.indexOf("#");for(;n!==-1;){let r=e[n-1];if(r===" "||r===" "){t=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let r=e[t-1];if(r===" "||r===" ")t-=1;else break}let i=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield pt.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&W(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!W(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&W(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Ni),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&i[0]!=="#"||n===0&&(i.startsWith("---")||i.startsWith("..."))&&W(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield pt.FLOW_END,yield*this.parseLineStart();let r=0;for(;i[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),i[r]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-r),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Ni),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||W(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]==="\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf('"',t+1)}let n=this.buffer.substring(0,t),i=n.indexOf(`
|
|
150
|
+
`,this.pos);if(i!==-1){for(;i!==-1;){let r=this.continueScalar(i+1);if(r===-1)break;i=n.indexOf(`
|
|
151
|
+
`,r)}i!==-1&&(t=i-(n[i-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>W(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case" ":t+=1;break;case`
|
|
152
|
+
`:e=r,t=0;break;case"\r":{let o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
153
|
+
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let r=this.continueScalar(e+1);if(r===-1)break;e=this.buffer.indexOf(`
|
|
154
|
+
`,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
|
|
155
|
+
`;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let r=e-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);let a=r;for(;o===" ";)o=this.buffer[--r];if(o===`
|
|
156
|
+
`&&r>=this.pos&&r+1+t>a)e=r;else break}while(!0);return yield pt.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let r=this.buffer[n+1];if(W(r)||e&&An.has(r))break;t=n}else if(W(i)){let r=this.buffer[n+1];if(i==="\r"&&(r===`
|
|
157
|
+
`?(n+=1,i=`
|
|
158
|
+
`,r=this.buffer[n+1]):t=n),r==="#"||e&&An.has(r))break;if(i===`
|
|
159
|
+
`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&An.has(i))break;t=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield pt.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Ni),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let t=this.flowLevel>0,n=this.charAt(1);if(W(n)||t&&An.has(n)){t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!W(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(xh.has(t))t=this.buffer[++e];else if(t==="%"&&Wa.has(this.buffer[e+1])&&Wa.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
160
|
+
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
161
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};Ja.Lexer=xi});var Ii=y(Ga=>{"use strict";var Pi=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let i=this.lineStarts[t-1];return{line:t,col:e-i+1}}}};Ga.LineCounter=Pi});var Mi=y(el=>{"use strict";var Ph=Q("process"),Qa=_n(),Ih=qi();function fe(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function Xa(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Za(s){switch(s?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function $n(s){switch(s.type){case"document":return s.start;case"block-map":{let e=s.items[s.items.length-1];return e.sep??e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function Le(s){if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;s[++e]?.type==="space";);return s.splice(e,s.length)}function En(s,e){if(e.length<1e5)Array.prototype.push.apply(s,e);else for(let t=0;t<e.length;++t)s.push(e[t])}function za(s){if(s.start.type==="flow-seq-start")for(let e of s.items)e.sep&&!e.value&&!fe(e.start,"explicit-key-ind")&&!fe(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Za(e.value)?e.value.end?En(e.value.end,e.sep):e.value.end=e.sep:En(e.start,e.sep),delete e.sep)}var Li=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Ih.Lexer,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,Ph.env.LOG_TOKENS&&console.log("|",Qa.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Qa.tokenType(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&za(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Xa(i.start)===-1&&(t.indent===0||i.start.every(r=>r.type!=="comment"||r.indent<t.indent))&&(n.type==="document"?n.end=i.start:n.items.push({start:i.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Xa(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=$n(this.peek(2)),n=Le(t),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
|
|
162
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
163
|
+
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){En(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",r=[];if(i&&t.sep&&!t.value){let o=[];for(let a=0;a<t.sep.length;++a){let l=t.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):i||t.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(fe(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(Za(t.key)&&!fe(t.sep,"newline")){let o=Le(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(fe(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=Le(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||i?e.items.push({start:r,key:null,sep:[this.sourceToken]}):fe(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);i||t.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!fe(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){En(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||fe(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=$n(n),r=Le(i);za(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
164
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
165
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=$n(e),n=Le(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=$n(e),n=Le(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};el.Parser=Li});var rl=y(gt=>{"use strict";var tl=ki(),Lh=at(),mt=ut(),Mh=vs(),Dh=E(),Rh=Ii(),nl=Mi();function sl(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new Rh.LineCounter||null,prettyErrors:e}}function jh(s,e={}){let{lineCounter:t,prettyErrors:n}=sl(e),i=new nl.Parser(t?.addNewLine),r=new tl.Composer(e),o=Array.from(r.compose(i.parse(s)));if(n&&t)for(let a of o)a.errors.forEach(mt.prettifyError(s,t)),a.warnings.forEach(mt.prettifyError(s,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function il(s,e={}){let{lineCounter:t,prettyErrors:n}=sl(e),i=new nl.Parser(t?.addNewLine),r=new tl.Composer(e),o=null;for(let a of r.compose(i.parse(s),!0,s.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new mt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(mt.prettifyError(s,t)),o.warnings.forEach(mt.prettifyError(s,t))),o}function Bh(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);let i=il(s,t);if(!i)return null;if(i.warnings.forEach(r=>Mh.warn(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},t))}function Uh(s,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let i=Math.round(t);t=i<1?void 0:i>8?{indent:8}:{indent:i}}if(s===void 0){let{keepUndefined:i}=t??e??{};if(!i)return}return Dh.isDocument(s)&&!n?s.toString(t):new Lh.Document(s,n,t).toString(t)}gt.parse=Bh;gt.parseAllDocuments=jh;gt.parseDocument=il;gt.stringify=Uh});var Ri=y(N=>{"use strict";var Fh=ki(),Vh=at(),Kh=ni(),Di=ut(),Hh=He(),de=E(),Yh=ae(),Wh=I(),Jh=ce(),Gh=ue(),Qh=_n(),Xh=qi(),zh=Ii(),Zh=Mi(),Tn=rl(),ol=Ue();N.Composer=Fh.Composer;N.Document=Vh.Document;N.Schema=Kh.Schema;N.YAMLError=Di.YAMLError;N.YAMLParseError=Di.YAMLParseError;N.YAMLWarning=Di.YAMLWarning;N.Alias=Hh.Alias;N.isAlias=de.isAlias;N.isCollection=de.isCollection;N.isDocument=de.isDocument;N.isMap=de.isMap;N.isNode=de.isNode;N.isPair=de.isPair;N.isScalar=de.isScalar;N.isSeq=de.isSeq;N.Pair=Yh.Pair;N.Scalar=Wh.Scalar;N.YAMLMap=Jh.YAMLMap;N.YAMLSeq=Gh.YAMLSeq;N.CST=Qh;N.Lexer=Xh.Lexer;N.LineCounter=zh.LineCounter;N.Parser=Zh.Parser;N.parse=Tn.parse;N.parseAllDocuments=Tn.parseAllDocuments;N.parseDocument=Tn.parseDocument;N.stringify=Tn.stringify;N.visit=ol.visit;N.visitAsync=ol.visitAsync});var rr=St(ir(),1),{program:jp,createCommand:Bp,createArgument:Up,createOption:Fp,CommanderError:or,InvalidArgumentError:Vp,InvalidOptionArgumentError:Kp,Command:ar,Argument:Hp,Option:K,Help:Yp}=rr.default;import{spawn as ip}from"node:child_process";import{hostname as rp}from"node:os";var P=class extends Error{constructor(t,n,i=1){super(t);this.hint=n;this.exitCode=i;this.name="CliError"}},$=class extends P{constructor(e,t){super(e,t,2),this.name="UsageError"}},R=class extends P{constructor(t,n,i,r=[],o=null,a){super(i,a);this.status=t;this.code=n;this.details=r;this.body=o;this.name="ApiError"}};var _t="0.1.0";var lr=new Set(["GET","HEAD","PUT","DELETE"]),cr=4,fc=6e4,es=()=>`cueston-cli/${_t} node/${process.versions.node} ${process.platform}`,ur=s=>new Promise(e=>setTimeout(e,s)),ne=class{constructor(e,t,n=()=>{}){this.apiUrl=e;this.key=t;this.onRetry=n}rpcId=0;url(e,t){let n=new URL(`${this.apiUrl}${e.startsWith("/")?e:`/${e}`}`);for(let[i,r]of Object.entries(t??{}))r!=null&&r!==""&&n.searchParams.set(i,String(r));return n.toString()}requireKey(){if(!this.key)throw new P("You're not signed in.","Run `cueston login`, or set CUESTON_API_KEY (a secret key from Settings \u2192 API keys).");return this.key}async request(e,t,n={}){let i=e.toUpperCase(),r={accept:n.text?"*/*":"application/json","user-agent":es(),...n.headers};n.anonymous||(r.authorization=`Bearer ${this.requireKey()}`);let o;n.body!==void 0&&(o=typeof n.body=="string"?n.body:JSON.stringify(n.body),r["content-type"]??="application/json");let a=this.url(t,n.query);for(let l=1;;l++){let c;try{c=await fetch(a,{method:i,headers:r,body:o,signal:AbortSignal.timeout(fc)})}catch(d){let p=d?.name==="TimeoutError"?"the request timed out":dc(d);if(lr.has(i)&&l<cr){this.onRetry(`Can't reach ${this.apiUrl} (${p}); retrying\u2026`),await ur(500*2**l);continue}throw new P(`Can't reach ${this.apiUrl}: ${p}.`,"Check your connection and --api-url.")}if((c.status===429||lr.has(i)&&[502,503,504].includes(c.status))&&l<cr){let d=Number(c.headers.get("retry-after")),p=Number.isFinite(d)&&d>0?Math.min(d,30)*1e3:1e3*2**l;this.onRetry(c.status===429?`Rate limited; retrying in ${Math.round(p/1e3)}s\u2026`:`Server busy (${c.status}); retrying\u2026`),await c.body?.cancel(),await ur(p);continue}let u=await c.text();if(!c.ok)throw pc(c.status,u,i,t);if(n.text)return u;if(!u)return null;try{return JSON.parse(u)}catch{return u}}}get(e,t){return this.request("GET",e,{query:t})}post(e,t,n={}){return this.request("POST",e,{...n,body:t??{}})}patch(e,t){return this.request("PATCH",e,{body:t})}put(e,t){return this.request("PUT",e,{body:t})}delete(e,t){return this.request("DELETE",e,{query:t})}async mcp(e,t={}){let n=++this.rpcId,i=await this.request("POST","/api/mcp",{body:{jsonrpc:"2.0",id:n,method:e,params:t}});if(i?.error){let r=i.error.data;throw new R(400,`rpc_${i.error.code}`,String(i.error.message??"MCP error"),Array.isArray(r?.details)?r.details:[],i)}return i?.result}};function dc(s){let e=s?.cause;return e?.code||e?.message||s?.message||String(s)}var hc={unauthorized:"Your key was revoked or is wrong. Run `cueston login` again.",invalid_token:"Your key was revoked or is wrong. Run `cueston login` again.",secret_key_required:"Run `cueston login`, or set CUESTON_API_KEY.",publishable_key:"That's a publishable key (pk_). Use a secret key (sk_) from Settings \u2192 API keys.",approval_required:'This workspace requires review before going live. Use `request-review` instead, e.g. `cueston tours request-review <id> --note "\u2026"`.',plan_limit:"Your plan's limit is reached. Upgrade in Settings \u2192 Billing."};function pc(s,e,t="",n=""){let i=null;try{i=e?JSON.parse(e):null}catch{i=e}let r=typeof i?.code=="string"?i.code:typeof i?.error=="string"&&s<500&&i.error.match(/^[a-z_]+$/)?i.error:`http_${s}`,o=typeof i?.error_description=="string"?i.error_description:typeof i?.error=="string"?i.error:typeof i?.message=="string"?i.message:`${t} ${n} failed with HTTP ${s}`;s===403&&Array.isArray(i?.missingPermissions)&&i.missingPermissions.length&&(o+=` (needs ${i.missingPermissions.join(", ")})`),s===429&&i?.retryAfter&&(o+=` Try again in ${i.retryAfter}s.`);let a=Array.isArray(i?.details)?i.details.map(String):[],l=hc[r]??(s===404?"Check the id: it may be in another workspace or deleted.":void 0);return new R(s,r,o,a,i,l)}import{chmodSync as fr,existsSync as mc,mkdirSync as gc,readFileSync as yc,renameSync as bc,rmSync as wc,writeFileSync as vc}from"node:fs";import{homedir as Sc}from"node:os";import{join as At}from"node:path";var ts="https://app.cueston.com";function dr(s=process.env){return s.CUESTON_CONFIG_DIR?s.CUESTON_CONFIG_DIR:s.XDG_CONFIG_HOME?At(s.XDG_CONFIG_HOME,"cueston"):process.platform==="win32"&&s.APPDATA?At(s.APPDATA,"cueston"):At(s.HOME||Sc(),".config","cueston")}var Be=(s=process.env)=>At(dr(s),"config.json");function $t(s=process.env){let e=Be(s);if(!mc(e))return{};let t;try{t=JSON.parse(yc(e,"utf8"))}catch{throw new P(`Can't read ${e}: it isn't valid JSON.`,"Fix or delete the file, then run `cueston login`.")}return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function ns(s,e=process.env){let t=dr(e);gc(t,{recursive:!0,mode:448}),process.platform!=="win32"&&fr(t,448);let n=Be(e),i=`${n}.${process.pid}.tmp`;return vc(i,`${JSON.stringify(s,null,2)}
|
|
166
|
+
`,{mode:384}),process.platform!=="win32"&&fr(i,384),bc(i,n),n}function hr(s=process.env){let e=$t(s),t=e.apiUrl?{apiUrl:e.apiUrl}:{};if(Object.keys(t).length===0){wc(Be(s),{force:!0});return}ns(t,s)}function kc(s){let e;try{e=new URL(s)}catch{throw new $(`Invalid API URL: ${s}`,"Use a full URL like https://app.cueston.com.")}if(e.protocol!=="https:"&&e.protocol!=="http:")throw new $(`Invalid API URL: ${s}`,"Use an http(s) URL.");return`${e.origin}${e.pathname}`.replace(/\/+$/,"")}function pr(s,e=process.env,t=$t(e)){let n=kc(s.apiUrl||e.CUESTON_API_URL||t.apiUrl||ts);return s.key?{apiUrl:n,key:s.key.trim(),keySource:"flag"}:e.CUESTON_API_KEY?{apiUrl:n,key:e.CUESTON_API_KEY.trim(),keySource:"env"}:t.key?{apiUrl:n,key:t.key,keySource:"config"}:{apiUrl:n,key:null,keySource:null}}function Et(s){if(!s)return"(none)";let e=s.includes("_")?s.slice(0,s.indexOf("_")+1):"";return s.length<=e.length+8?`${e}\u2026`:`${e}\u2026${s.slice(-4)}`}import{createInterface as tp}from"node:readline/promises";var ji=St(yr(),1),al=St(Ri(),1),ll=(s,e=process.env)=>!!s.isTTY&&!("NO_COLOR"in e)&&e.TERM!=="dumb"&&e.FORCE_COLOR!=="0",b=ji.default.createColors(ll(process.stdout)),ee=ji.default.createColors(ll(process.stderr)),ep=s=>s==null||s===""?"\u2014":Array.isArray(s)?s.join(", "):typeof s=="object"?JSON.stringify(s):String(s).replace(/\s+/g," ");function F(s,e,t=!!process.stdout.isTTY){let n=s.map(o=>e.map(a=>{let l=ep(a.value(o)),c=a.max??60;return t&&l.length>c?`${l.slice(0,c-1)}\u2026`:l})),i=e.map((o,a)=>Math.max(o.header.length,...n.map(l=>l[a].length))),r=o=>o.map((a,l)=>l===o.length-1?a:a.padEnd(i[l])).join(" ").trimEnd();return[b.dim(r(e.map(o=>o.header.toUpperCase()))),...n.map(r)].join(`
|
|
167
|
+
`)}var he=s=>(0,al.stringify)(s,{lineWidth:0}).trimEnd(),ke=s=>JSON.stringify(s,null,2);function Ce(s,e=Date.now()){if(typeof s!="string")return"\u2014";let t=new Date(s).getTime();if(Number.isNaN(t))return"\u2014";let n=Math.round((e-t)/1e3);if(n<45)return"just now";let i=[[60,"minute"],[3600,"hour"],[86400,"day"]];if(n>=30*86400)return new Date(t).toISOString().slice(0,10);let r=Math.round(n/60),o="minute";for(let[a,l]of i)n>=a&&(r=Math.round(n/a),o=l);return`${r} ${o}${r===1?"":"s"} ago`}function cl(s){return{jsonMode:s,result(e,t){if(s||!t)process.stdout.write(`${ke(e)}
|
|
168
|
+
`);else{let n=t();n&&process.stdout.write(`${n}
|
|
169
|
+
`)}},info(e){s||process.stderr.write(`${e}
|
|
170
|
+
`)},warn(e){process.stderr.write(`${ee.yellow("!")} ${e}
|
|
171
|
+
`)}}}function k(s){let e=s.optsWithGlobals(),t=$t(),n=pr({key:e.key,apiUrl:e.apiUrl},process.env,t),i=cl(!!e.json),r=new ne(n.apiUrl,n.key,o=>i.info(o));return{options:e,auth:n,config:t,out:i,client:r}}async function yt(s,e){if(e)return!0;if(!process.stdin.isTTY||!process.stderr.isTTY)throw new $("This needs confirmation.","Pass --yes to confirm when not running in a terminal.");let t=tp({input:process.stdin,output:process.stderr});try{let n=await t.question(`${s} [y/N] `);return/^y(es)?$/i.test(n.trim())}finally{t.close()}}var pe=(s,e,t=`${e}s`)=>`${s} ${s===1?e:t}`;var ul=St(Ri(),1);import{readFileSync as np}from"node:fs";import{extname as sp}from"node:path";async function Ui(){if(process.stdin.isTTY)throw new $("Nothing on stdin.","Pipe a file in, e.g. `cat tour.json | cueston tours create --file -`.");let s=[];for await(let e of process.stdin)s.push(Buffer.from(e));return Buffer.concat(s).toString("utf8")}function Bi(s,e,t="auto"){let n=s.trim();if(!n)throw new $(`${e} is empty.`);let i=t==="json"||t==="auto"&&/^[[{]/.test(n);try{return i?JSON.parse(n):(0,ul.parse)(n)}catch(r){throw new $(`Can't parse ${e}: ${r.message.split(`
|
|
172
|
+
`)[0]}`)}}async function bt(s){if(s==="-")return Bi(await Ui(),"stdin");let e;try{e=np(s,"utf8")}catch{throw new $(`Can't read ${s}.`)}let t=sp(s).toLowerCase();return Bi(e,s,t===".json"?"json":t===".yaml"||t===".yml"?"yaml":"auto")}async function Nn(s){return s.startsWith("@")?bt(s.slice(1)):s==="-"?bt("-"):Bi(s,"--data","auto")}function Me(s,e){if(!s||typeof s!="object"||Array.isArray(s))throw new $(`${e} must be an object, like {"name": "Welcome tour"}.`);return s}async function De(s,e={}){if(s.file&&s.data)throw new $("Use --file or --data, not both.");let t={};s.file?t=Me(await bt(s.file),s.file):s.data&&(t=Me(await Nn(s.data),"--data"));let n={...t};for(let[i,r]of Object.entries(e))r!==void 0&&(n[i]=r);return n}function fl(s){let e={};for(let t of s){let n=t.indexOf("=");if(n<=0)throw new $(`Invalid --arg "${t}".`,"Use --arg key=value, e.g. --arg id=12.");let i=t.slice(0,n),r=t.slice(n+1),o=r;if(/^(-?\d+(\.\d+)?|true|false|null)$/.test(r)||/^[[{"]/.test(r))try{o=JSON.parse(r)}catch{o=r}e[i]=o}return e}var op={darwin:"macOS",win32:"Windows",linux:"Linux"},ap=()=>`${rp().replace(/\.local$/,"")} (${op[process.platform]??process.platform})`;function lp(s){let[e,t]=process.platform==="darwin"?["open",[s]]:process.platform==="win32"?["cmd",["/c","start","",s.replace(/&/g,"^&")]]:["xdg-open",[s]];try{let n=ip(e,t,{stdio:"ignore",detached:!0});return n.on("error",()=>{}),n.unref(),!0}catch{return!1}}var cp=s=>new Promise(e=>setTimeout(e,s));async function up(s,e){let t=new ne(s.auth.apiUrl,null,l=>s.out.info(l)),n=await t.request("POST","/api/cli/login",{anonymous:!0,body:{clientName:ap()}}),i=(l="")=>process.stderr.write(`${l}
|
|
173
|
+
`);i(),i(` Your code: ${ee.bold(n.userCode)}`),i(),i(` Approve this sign-in at ${ee.cyan(n.verificationUriComplete)}`),i(` and check the code matches. It expires in ${Math.round(n.expiresIn/60)} minutes.`),i();let r=!!process.stderr.isTTY&&!process.env.CI;e&&r&&lp(n.verificationUriComplete)&&i(" Opened your browser."),i(ee.dim(" Waiting for approval\u2026 (Ctrl+C to cancel)"));let o=Math.max(1,n.interval)*1e3,a=Date.now()+n.expiresIn*1e3;for(;Date.now()<a;){await cp(o);try{return await t.request("POST","/api/cli/login/token",{anonymous:!0,body:{deviceCode:n.deviceCode}})}catch(l){if(!(l instanceof R))throw l;if(l.code==="authorization_pending")continue;if(l.code==="slow_down"){o+=5e3;continue}throw l.code==="access_denied"?new P("The sign-in was denied in the browser."):l.code==="expired_token"?new P("The code expired.","Run `cueston login` again."):l}}throw new P("The code expired before it was approved.","Run `cueston login` again.")}async function dl(s,e){if(!e.startsWith("sk_"))throw new P("That isn't a secret key.",e.startsWith("pk_")?"pk_ keys are publishable. Create a secret key (sk_) in Settings \u2192 API keys.":"Secret keys start with sk_.");let t=new ne(s.auth.apiUrl,e,r=>s.out.info(r)),n=await t.get("/api/auth/me"),i=0;try{let{keys:r}=await t.get("/api/keys",{mine:!0});i=r.find(o=>o.keyPrefix===e.slice(0,12))?.id??0}catch{}return{key:e,keyId:i,keyPrefix:e.slice(0,12),workspace:{id:n.workspace.id,name:n.workspace.name},user:{email:n.user.email}}}function hl(s){s.command("login").description("Sign in: approve this terminal in your browser, or save a secret key").option("--no-browser","print the link instead of opening the browser").option("--with-key","read a secret key from stdin instead of signing in through the browser").addHelpText("after",`
|
|
174
|
+
Examples:
|
|
175
|
+
cueston login # opens the browser; approve the code shown
|
|
176
|
+
cueston login --no-browser # on a remote machine: open the link yourself
|
|
177
|
+
cueston login --key sk_\u2026 # save a key from Settings \u2192 API keys
|
|
178
|
+
echo "$KEY" | cueston login --with-key
|
|
179
|
+
|
|
180
|
+
In CI, skip login and set CUESTON_API_KEY instead.`).action(async(e,t)=>{let n=k(t),{browser:i,withKey:r}=t.opts(),o;r?o=await dl(n,(await Ui()).trim()):n.auth.keySource==="flag"?o=await dl(n,n.auth.key):o=await up(n,i!==!1);let a=ns({...n.auth.apiUrl!==ts?{apiUrl:n.auth.apiUrl}:{},key:o.key,...o.keyId?{keyId:o.keyId}:{},keyPrefix:o.keyPrefix,workspace:o.workspace,user:o.user});process.env.CUESTON_API_KEY&&n.out.warn("CUESTON_API_KEY is set in your environment; it takes precedence over the saved key."),n.out.result({user:o.user,workspace:o.workspace,apiUrl:n.auth.apiUrl,key:Et(o.key),config:a},()=>`${b.green("\u2713")} Signed in as ${b.bold(o.user.email)} to ${b.bold(o.workspace.name)}.
|
|
181
|
+
`+b.dim(` Key ${Et(o.key)} saved to ${a}. Revoke it any time in Settings \u2192 API keys.`))}),s.command("logout").description("Forget the saved key on this computer (--revoke also revokes it)").option("--revoke","revoke the key in Cueston too").action(async(e,t)=>{let n=k(t),{revoke:i}=t.opts(),r=n.config.key;if(!r){n.auth.keySource==="env"&&n.out.info("CUESTON_API_KEY is set in your environment; unset it to sign out."),n.out.result({signedOut:!1,revoked:!1},()=>"You're not signed in on this computer.");return}let o=!1;if(i){let a=new ne(n.auth.apiUrl,r),l=n.config.keyId;if(!l){let{keys:c}=await a.get("/api/keys",{mine:!0});l=c.find(f=>f.keyPrefix===r.slice(0,12))?.id}if(!l)throw new P("Couldn't find this key to revoke it.","Revoke it in Settings \u2192 API keys.");try{await a.delete(`/api/keys/${l}`),o=!0}catch(c){if(!(c instanceof R)||c.status!==401&&c.status!==404)throw c}}hr(),n.out.result({signedOut:!0,revoked:o},()=>o?`${b.green("\u2713")} Signed out and revoked the key.`:`${b.green("\u2713")} Signed out on this computer.
|
|
182
|
+
`+b.dim(" The key still works until it's revoked: `cueston logout --revoke` next time, or Settings \u2192 API keys."))}),s.command("whoami").description("Show who you're signed in as, the workspace, your role and the API URL").action(async(e,t)=>{let n=k(t),i=await n.client.get("/api/auth/me"),r=n.auth.keySource==="env"?"CUESTON_API_KEY":n.auth.keySource==="flag"?"--key":Be(),o={user:{email:i.user.email,name:i.user.name??null},workspace:{id:i.workspace.id,name:i.workspace.name,role:i.workspace.customRole?.name??i.workspace.role,plan:i.workspace.plan??null,permissions:i.workspace.permissions??[]},apiUrl:n.auth.apiUrl,key:Et(n.auth.key),keySource:n.auth.keySource};n.out.result(o,()=>[`Signed in as ${b.bold(o.user.email)}`,`${b.dim("Workspace ")} ${o.workspace.name} (${o.workspace.id}) \xB7 ${o.workspace.role}${o.workspace.plan?` \xB7 ${o.workspace.plan} plan`:""}`,`${b.dim("Can ")} ${o.workspace.permissions.join(", ")||"\u2014"}`,`${b.dim("API ")} ${o.apiUrl}`,`${b.dim("Key ")} ${o.key} (from ${r})`].join(`
|
|
183
|
+
`))})}var me=[{type:"tour",plural:"tours",children:"steps"},{type:"tooltip",plural:"tooltips"},{type:"banner",plural:"banners"},{type:"checklist",plural:"checklists",children:"items"},{type:"survey",plural:"surveys",children:"questions"},{type:"announcement",plural:"announcements"}];function fp(s){let e=s.trim().toLowerCase();return me.find(t=>t.type===e||t.plural===e)}function Re(s){let e=fp(s);if(!e)throw new $(`Unknown content type "${s}".`,`Use one of: ${me.map(t=>t.plural).join(", ")}.`);return e}function xn(s){return s?.production?"live":s?.staging?"staging":"draft"}function x(s,e="id"){let t=Number(s);if(!/^\d+$/.test(s)||!Number.isSafeInteger(t)||t<=0)throw new $(`Invalid ${e}: "${s}". Use the number from \`list\`.`);return t}var qn=()=>new K("--env <environment>","production or staging").choices(["production","staging"]).default("production");function pl(s){let e=xn(s.publication),t=s.hasUnpublishedChanges;return e!=="draft"&&(t===!0||t&&typeof t=="object"&&(t.production||t.staging))?`${e} \xB7 edited`:e}var ml=s=>typeof s=="object"&&s?s.version??null:s??null;function gl(s,e){return"isActive"in s&&(e("Ignored isActive: changes are saved as drafts. Use `publish` to go live."),delete s.isActive),s}function yl(s){return{name:s.name,urlPattern:s.urlPattern}}var bl=s=>`
|
|
184
|
+
Input: --file ${s.type}.json|.yaml (or - for stdin), --data '<json>' (or @file), and field
|
|
185
|
+
flags (--name, --url-pattern), which win over the file. Run \`cueston ${s.plural} get <id> --json\`
|
|
186
|
+
to see every field, or \`cueston tools list\` for the schema (create_${s.type}).`;function wl(s){for(let e of me){let t=s.command(e.plural).alias(e.type).description(`List, create, edit, publish and roll back ${e.plural}`);t.command("list").alias("ls").description(`List ${e.plural} with their publish status`).addOption(new K("--status <status>","only live, staging or draft items").choices(["live","staging","draft"])).action(async(n,i)=>{let r=k(i),a=(await r.client.get(`/api/${e.plural}`))[e.plural]??[];n.status&&(a=a.filter(l=>xn(l.publication)===n.status)),r.out.result(a,()=>a.length===0?`No ${e.plural} yet. Create one with \`cueston ${e.plural} create --file ${e.type}.json\`.`:F(a,[{header:"id",value:l=>l.id},{header:"name",value:l=>l.name,max:40},{header:"status",value:pl},{header:"url pattern",value:l=>l.urlPattern,max:40},{header:"updated",value:l=>Ce(l.updatedAt)}]))}),t.command("get <id>").description(`Show one ${e.type}: every field, its steps or items, and publish status`).action(async(n,i,r)=>{let o=k(r),a=(await o.client.get(`/api/${e.plural}/${x(n)}`))[e.type];o.out.result(a,()=>`${b.dim(`# ${e.type} ${a.id} \xB7 ${pl(a)}`)}
|
|
187
|
+
${he(a)}`)}),t.command("create").description(`Create a ${e.type} as a draft`).option("-f, --file <path>","JSON or YAML file with the fields (- for stdin)").option("-d, --data <json>","the fields as JSON (or @file)").option("--name <name>","name").option("--url-pattern <pattern>",'pages it shows on, e.g. "https://app.acme.com/billing*"').addHelpText("after",bl(e)).action(async(n,i)=>{let r=k(i),o=gl(await De(n,yl(n)),r.out.warn);if(Object.keys(o).length===0)throw new $("Nothing to create.","Pass --file, --data or --name.");let a=(await r.client.post(`/api/${e.plural}`,{...o,isActive:!1}))[e.type];r.out.result(a,()=>`${b.green("\u2713")} Created ${e.type} ${b.bold(String(a.id))} "${a.name}" (draft).`)}),t.command("update <id>").alias("edit").description(`Change fields of a ${e.type}'s draft (fields you leave out stay as they are)`).option("-f, --file <path>","JSON or YAML file with the fields to change (- for stdin)").option("-d, --data <json>","the fields as JSON (or @file)").option("--name <name>","name").option("--url-pattern <pattern>","pages it shows on").addHelpText("after",bl(e)).action(async(n,i,r)=>{let o=k(r),a=gl(await De(i,yl(i)),o.out.warn);if(delete a.id,Object.keys(a).length===0)throw new $("Nothing to change.","Pass --file, --data, --name or --url-pattern.");let l=(await o.client.patch(`/api/${e.plural}/${x(n)}`,a))[e.type],c=xn(l.publication)!=="draft";o.out.result(l,()=>`${b.green("\u2713")} Saved ${e.type} ${l.id} draft (${Object.keys(a).join(", ")}).`+(c?b.dim(`
|
|
188
|
+
People see the published version until you run \`cueston ${e.plural} publish ${l.id}\`.`):""))}),t.command("delete <id>").alias("rm").description(`Delete a ${e.type} with its versions and translations (can't be undone)`).option("-y, --yes","don't ask for confirmation").action(async(n,i,r)=>{let o=k(r),a=x(n),l=(await o.client.get(`/api/${e.plural}/${a}`))[e.type];if(!await yt(`Delete ${e.type} ${a} "${l.name}"? This can't be undone.`,i.yes))throw new P("Canceled.");await o.client.delete(`/api/${e.plural}/${a}`),o.out.result({type:e.type,id:a,deleted:!0},()=>`${b.green("\u2713")} Deleted ${e.type} ${a}.`)}),t.command("duplicate <id>").alias("copy").description(`Copy a ${e.type} as a new draft ("Copy of \u2026")`).action(async(n,i,r)=>{let o=k(r),a=(await o.client.post(`/api/${e.plural}/${x(n)}/duplicate`,{}))[e.type];o.out.result(a,()=>`${b.green("\u2713")} Created ${e.type} ${b.bold(String(a.id))} "${a.name}" (draft).`)}),t.command("publish <id>").description(`Publish the ${e.type}'s current draft as a new version`).addOption(qn()).option("--note <text>",'what changed, for the version history ("New export step")').action(async(n,i,r)=>{let o=k(r),a=x(n),l=await o.client.post(`/api/${e.plural}/${a}/publish`,{environment:i.env,...i.note?{note:i.note}:{}}),c=ml(l.version);o.out.result({type:e.type,id:a,environment:i.env,...l},()=>`${b.green("\u2713")} Published ${e.type} ${a} to ${i.env}${c?` (version ${c})`:""}.`+(l.versionCreated===!1?b.dim(`
|
|
189
|
+
Nothing changed since the last version; it was reused.`):""))}),t.command("unpublish <id>").description(`Stop showing the ${e.type} (the draft and versions stay)`).addOption(qn()).action(async(n,i,r)=>{let o=k(r),a=x(n),l=await o.client.post(`/api/${e.plural}/${a}/unpublish`,{environment:i.env});o.out.result({type:e.type,id:a,environment:i.env,...l},()=>`${b.green("\u2713")} Unpublished ${e.type} ${a} from ${i.env}.`)}),t.command("versions <id>").description(`Version history of a ${e.type}`).action(async(n,i,r)=>{let o=k(r),a=await o.client.get(`/api/${e.plural}/${x(n)}/versions`),l=a.versions??[];o.out.result(a,()=>l.length===0?"Never published.":F(l,[{header:"version",value:c=>c.version},{header:"id",value:c=>c.id},{header:"live in",value:c=>Array.isArray(c.environments)?c.environments.join(", "):c.environments},{header:"note",value:c=>c.note,max:40},{header:"by",value:c=>c.createdBy?.name??c.createdBy?.email??c.createdBy},{header:"created",value:c=>Ce(c.createdAt)}]))}),t.command("rollback <id> <versionId>").description("Make an earlier version live again (the draft isn't touched)").addOption(qn()).action(async(n,i,r,o)=>{let a=k(o),l=x(n),c=await a.client.post(`/api/${e.plural}/${l}/versions/${x(i,"version id")}/publish`,{environment:r.env}),f=ml(c.version);a.out.result({type:e.type,id:l,environment:r.env,...c},()=>`${b.green("\u2713")} ${e.type} ${l} now serves version ${f??i} in ${r.env}.`)}),t.command("restore <id> <versionId>").description("Copy an earlier version into the draft (publishes nothing)").action(async(n,i,r,o)=>{let a=k(o),l=x(n),c=await a.client.post(`/api/${e.plural}/${l}/versions/${x(i,"version id")}/restore`,{});a.out.result(c,()=>`${b.green("\u2713")} Restored version ${c.restoredFrom?.version??i} into the draft of ${e.type} ${l}.`)}),t.command("request-review <id>").description("Ask a publisher to review and publish the current draft").option("--note <text>","what changed and why, for the reviewer").option("--version <versionId>","ask to publish this existing version instead (a rollback)").action(async(n,i,r)=>{let o=k(r),a=x(n),l=await o.client.post(`/api/${e.plural}/${a}/publish-requests`,{...i.note?{note:i.note}:{},...i.version?{versionId:x(i.version,"version id")}:{}});o.out.result(l,()=>`${b.green("\u2713")} Review requested (request ${l.request?.id}). Publishers see it in Approvals.`)}),e.type==="survey"&&dp(t)}}function dp(s){s.command("results <id>").description("Responses, response rate, NPS and per-question answers").addOption(new K("--days <n>","7, 30 or 90").choices(["7","30","90"]).default("30")).addOption(qn()).action(async(e,t,n)=>{let i=k(n),{summary:r,survey:o}=await i.client.get(`/api/surveys/${x(e)}/responses/summary`,{days:t.days,environment:t.env});i.out.result({survey:o,summary:r},()=>{let a=r.totals??{},l=[`${b.bold(o.name)} \xB7 last ${t.days} days \xB7 ${t.env}`,`${pe(a.responses??0,"response")} (${a.completed??0} completed) from ${pe(a.viewers??0,"viewer")}`+(typeof a.responseRate=="number"?` \xB7 ${Math.round(a.responseRate*100)}% response rate`:"")];r.nps&&l.push(`NPS ${r.nps.score} (${r.nps.promoters} promoters, ${r.nps.passives} passives, ${r.nps.detractors} detractors)`);for(let c of r.questions??[])l.push("",b.dim(`# ${c.prompt??c.id}`),he(c));return l.join(`
|
|
190
|
+
`)})}),s.command("export <id>").description("Every response as CSV (to stdout, or --output)").addOption(new K("--days <n>","7, 30 or 90").choices(["7","30","90"]).default("30")).option("-o, --output <file>","write to a file").action(async(e,t,n)=>{let i=k(n),r=await i.client.request("GET",`/api/surveys/${x(e)}/responses/export`,{query:{days:t.days},text:!0});await Pn(r,t.output,i.out.info)})}async function Pn(s,e,t){if(!e){process.stdout.write(s.endsWith(`
|
|
191
|
+
`)?s:`${s}
|
|
192
|
+
`);return}let{writeFileSync:n}=await import("node:fs");n(e,s),t(`${b.green("\u2713")} Wrote ${e}.`)}import{createInterface as hp}from"node:readline";function vl(s){let e=s.command("tools").description("Call any MCP tool directly (validate_content, find_elements, list_pages\u2026)");e.command("list").alias("ls").description("List the tools your key may use").option("--schema <name>","print one tool's input schema").action(async(t,n)=>{let i=k(n),{tools:r}=await i.client.mcp("tools/list");if(t.schema){let o=r.find(a=>a.name===t.schema);if(!o)throw new $(`No tool named ${t.schema}.`,"Run `cueston tools list` to see them.");i.out.result(o,()=>`${b.bold(o.name)}: ${o.description}
|
|
193
|
+
|
|
194
|
+
${he(o.inputSchema)}`);return}i.out.result(r,()=>F(r,[{header:"name",value:o=>o.name},{header:"title",value:o=>o.title,max:50},{header:"kind",value:o=>o.annotations?.readOnlyHint?"read":o.annotations?.destructiveHint?"destructive":"write"}]))}),e.command("call <name>").description("Call a tool with arguments").option("-a, --arg <key=value>","an argument (repeatable; values like 12, true or [..] are parsed as JSON)",Sl,[]).option("-d, --data <json>","all arguments as JSON (or @file)").addHelpText("after",`
|
|
195
|
+
Examples:
|
|
196
|
+
cueston tools call validate_content --arg type=tour --arg id=12
|
|
197
|
+
cueston tools call find_elements --arg query="export button"
|
|
198
|
+
cueston tools call debug_audience --data '{"url":"https://app.acme.com/billing","userId":"u_42"}'`).action(async(t,n,i)=>{let r=k(i),o={...n.data?Me(await Nn(n.data),"--data"):{},...fl(n.arg)},a=await r.client.mcp("tools/call",{name:t,arguments:o}),l=a?.structuredContent??pp(a);if(a?.isError)throw r.out.jsonMode&&r.out.result({isError:!0,result:l}),new P(`${t} failed: ${typeof l=="string"?l:ke(l)}`);r.out.result(l,()=>typeof l=="string"?l:he(l))})}var Sl=(s,e)=>[...e,s];function pp(s){let e=(s?.content??[]).filter(t=>t?.type==="text").map(t=>t.text).join(`
|
|
199
|
+
`);try{return JSON.parse(e)}catch{return e}}function kl(s){s.command("mcp").description("Run Cueston's MCP server over stdio (for MCP clients that can't connect over HTTP)").addHelpText("after",`
|
|
200
|
+
Reads JSON-RPC messages (one per line) on stdin, sends them to <api-url>/api/mcp with your
|
|
201
|
+
key, and writes the responses to stdout. Logs go to stderr. Client config:
|
|
202
|
+
|
|
203
|
+
{ "mcpServers": { "cueston": { "command": "npx", "args": ["-y", "cueston", "mcp"],
|
|
204
|
+
"env": { "CUESTON_API_KEY": "sk_\u2026" } } } }`).action(async(e,t)=>{let n=k(t),i=n.client.requireKey(),r=`${n.auth.apiUrl}/api/mcp`,o=u=>process.stderr.write(`[cueston mcp] ${u}
|
|
205
|
+
`);o(`bridging stdio to ${r}`);let a=hp({input:process.stdin,crlfDelay:1/0}),l=Promise.resolve();a.on("line",u=>{l=l.then(()=>c(u))}),await new Promise(u=>a.on("close",()=>l.then(()=>u())));async function c(u){let d=u.trim();if(!d)return;let p;try{p=JSON.parse(d)}catch{f({jsonrpc:"2.0",id:null,error:{code:-32700,message:"Parse error"}});return}let g=(Array.isArray(p)?p:[p]).filter(h=>h&&typeof h=="object"&&"id"in h&&h.id!==null).map(h=>h.id);try{let h=await fetch(r,{method:"POST",headers:{authorization:`Bearer ${i}`,"content-type":"application/json",accept:"application/json, text/event-stream","user-agent":es()},body:d,signal:AbortSignal.timeout(12e4)}),m=await h.text();if(h.status===202||!m)return;if(!h.ok){let w=`HTTP ${h.status}`;try{w=JSON.parse(m).error??w}catch{}o(`request failed: ${w}`);for(let v of g)f({jsonrpc:"2.0",id:v,error:{code:-32603,message:w}});return}process.stdout.write(`${m.replace(/\n/g,"")}
|
|
206
|
+
`)}catch(h){let m=h?.message??String(h);o(`can't reach ${r}: ${m}`);for(let w of g)f({jsonrpc:"2.0",id:w,error:{code:-32603,message:`Can't reach Cueston: ${m}`}})}}function f(u){process.stdout.write(`${JSON.stringify(u)}
|
|
207
|
+
`)}})}function Cl(s){s.command("api <method> <path>").description("Send an authenticated request to any Cueston API endpoint and print the response").option("-d, --data <json>","request body as JSON (or @file, or - for stdin)").option("-q, --query <key=value>","query parameter (repeatable)",Sl,[]).addHelpText("after",`
|
|
208
|
+
Examples:
|
|
209
|
+
cueston api GET /api/tours
|
|
210
|
+
cueston api PATCH /api/tours/12 --data '{"name":"Welcome"}'
|
|
211
|
+
cueston api GET /api/analytics/overview -q days=7`).action(async(e,t,n,i)=>{let r=k(i),o=e.toUpperCase();if(!["GET","POST","PUT","PATCH","DELETE"].includes(o))throw new $(`Unsupported method ${e}.`,"Use GET, POST, PUT, PATCH or DELETE.");t.startsWith("/")||(t=`/${t}`),t.startsWith("/api/")||(t=`/api${t}`);let a=Object.fromEntries(n.query.map(c=>{let f=c.indexOf("=");if(f<=0)throw new $(`Invalid --query "${c}".`,"Use key=value.");return[c.slice(0,f),c.slice(f+1)]})),l=n.data?await Nn(n.data):o==="GET"||o==="DELETE"?void 0:{};try{let c=await r.client.request(o,t,{body:l,query:a});typeof c=="string"?process.stdout.write(c.endsWith(`
|
|
212
|
+
`)?c:`${c}
|
|
213
|
+
`):process.stdout.write(`${ke(c)}
|
|
214
|
+
`)}catch(c){if(c instanceof R&&c.body&&typeof c.body=="object"){process.stdout.write(`${ke(c.body)}
|
|
215
|
+
`),process.exitCode=1;return}throw c}})}import{existsSync as In,mkdirSync as mp,readdirSync as Al,readFileSync as gp,renameSync as yp,rmSync as $l,writeFileSync as bp}from"node:fs";import{join as wt,relative as vt}from"node:path";var wp=new Set(["id","isActive","createdAt","updatedAt","publication","hasUnpublishedChanges","workspaceId","userId","createdBy","updatedBy","stepCount","itemCount","questionCount","versions","publishedVersion"]),vp=new Set(["tourId","checklistId","surveyId","stepOrder","position","createdAt","updatedAt"]);function Ol(s){return JSON.stringify(Ln(s))}function Ln(s){if(Array.isArray(s))return s.map(Ln);if(s&&typeof s=="object"){let e={};for(let t of Object.keys(s).sort())e[t]=Ln(s[t]);return e}return s}function Sp(s){let e=Ln(s);if(!("id"in e))return e;let{id:t,...n}=e;return{id:t,...n}}function kp(s,e="item"){return String(s??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50).replace(/-+$/g,"")||e}var Cp=(s,e,t="item")=>`${s}-${kp(e,t)}.json`;function Fi(s,e){if(!e||s===null||typeof s!="object"||e.anyOf||e.oneOf)return s;if(Array.isArray(s))return e.items?s.map(n=>Fi(n,e.items)):s;if(!e.properties||e.additionalProperties!==void 0&&e.additionalProperties!==!1)return s;let t={};for(let[n,i]of Object.entries(s))n in e.properties&&(t[n]=Fi(i,e.properties[n]));return t}function Vi(s,e,t){let n;if(t?.properties)n=Fi(s,t);else{n={};for(let[i,r]of Object.entries(s))wp.has(i)||(n[i]=r);e.children&&Array.isArray(n[e.children])&&(n[e.children]=n[e.children].map(i=>{if(!i||typeof i!="object")return i;let r={};for(let[o,a]of Object.entries(i))vp.has(o)||(r[o]=a);return r}))}return delete n.id,delete n.isActive,n}function Op(s,e){return Object.keys(s).filter(t=>t!=="id").filter(t=>Ol(s[t])!==Ol(e[t])).sort()}function El(s,e){if(!In(s))throw new $(`${s} doesn't exist.`,"Run `cueston pull` first, or pass the folder with your content files.");let t=[];for(let i of e){let r=wt(s,i.plural);if(In(r))for(let o of Al(r).sort()){if(!o.endsWith(".json"))continue;let a=wt(r,o),l;try{l=JSON.parse(gp(a,"utf8"))}catch(f){throw new $(`Can't parse ${a}: ${f.message}`)}if(!l||typeof l!="object"||Array.isArray(l))throw new $(`${a} must contain one JSON object.`);let c=l.id;if(c!=null&&!(Number.isSafeInteger(c)&&c>0))throw new $(`${a}: "id" must be a positive number (or leave it out to create a new item).`);t.push({def:i,file:a,data:l,id:c??null})}}let n=new Map;for(let i of t){if(i.id===null)continue;let r=`${i.def.type}:${i.id}`;if(n.has(r))throw new $(`Two files have ${i.def.type} id ${i.id}: ${n.get(r)} and ${i.file}.`);n.set(r,i.file)}return t}function Tl(s,e,t,n,i){let r=wt(s,e.plural);mp(r,{recursive:!0});let o=wt(r,Cp(t,n.name,e.type)),a=`${o}.tmp`;bp(a,`${JSON.stringify(Sp({id:t,...n}),null,2)}
|
|
216
|
+
`),yp(a,o);let l=i?[i]:[];for(let c of In(r)?Al(r):[])c.startsWith(`${t}-`)&&c.endsWith(".json")&&l.push(wt(r,c));for(let c of l)c!==o&&In(c)&&$l(c);return o}async function Nl(s){let e=new Map;try{let{tools:t}=await s.mcp("tools/list");for(let n of me){let i=t.find(r=>r.name===`update_${n.type}`);i?.inputSchema?.properties&&e.set(n.type,i.inputSchema)}}catch{}return e}async function xl(s,e,t){try{return(await s.get(`/api/${e.plural}/${t}`))[e.type]}catch(n){if(n instanceof R&&n.status===404)return null;throw n}}async function ql(s,e,t,n={}){let i=await Nl(s),r={written:[],pruned:[]};for(let o of t){let a=await s.get(`/api/${o.plural}`),l=new Set;for(let c of a[o.plural]){let f=await xl(s,o,c.id);if(!f)continue;l.add(c.id);let u=Tl(e,o,c.id,Vi(f,o,i.get(o.type)));r.written.push({type:o.type,id:c.id,file:vt(process.cwd(),u)||u}),n.onItem?.(`${o.type} ${c.id} \u2192 ${vt(process.cwd(),u)||u}`)}if(n.prune)for(let c of El(e,[o]))c.id!==null&&!l.has(c.id)&&($l(c.file),r.pruned.push(vt(process.cwd(),c.file)||c.file))}return r}async function _p(s,e,t){let n=[];for(let i of e){let r=vt(process.cwd(),i.file)||i.file,o=typeof i.data.name=="string"?i.data.name:null,a=Object.keys(i.data).filter(f=>f!=="id").sort();if(i.id===null){n.push({action:"create",type:i.def.type,id:null,file:r,name:o,fields:a});continue}let l=await xl(s,i.def,i.id);if(!l){n.push({action:"missing",type:i.def.type,id:i.id,file:r,name:o,fields:[]});continue}let c=Op(i.data,Vi(l,i.def,t.get(i.def.type)));n.push({action:c.length?"update":"unchanged",type:i.def.type,id:i.id,file:r,name:o,fields:c})}return n}async function Pl(s,e,t,n={}){let i=El(e,t),r=await Nl(s),o=await _p(s,i,r);n.onPlan?.(o);let a={plan:o,applied:[],published:[],errors:[]};for(let c of o)c.action==="missing"&&a.errors.push({type:c.type,id:c.id,file:c.file,code:"not_found",message:`${c.type} ${c.id} isn't on the server (deleted, or another workspace). Remove "id" from the file to create it again.`});if(n.dryRun)return a;let l=n.environment??"production";for(let[c,f]of o.entries()){if(f.action!=="create"&&f.action!=="update")continue;let u=i[c],{def:d}=u;try{let p;if(f.action==="create"){let{id:w,...v}=u.data;p=(await s.post(`/api/${d.plural}`,{...v,isActive:!1}))[d.type]}else{let w={};for(let v of f.fields)w[v]=u.data[v];p=(await s.patch(`/api/${d.plural}/${f.id}`,w))[d.type]}let g=p.id,h=Tl(e,d,g,Vi(p,d,r.get(d.type)),u.file),m=vt(process.cwd(),h)||h;if(a.applied.push({action:f.action,type:d.type,id:g,file:m}),n.onProgress?.(`${f.action==="create"?"created":"updated"} ${d.type} ${g} (${m})`),n.publish)try{let w=await s.post(`/api/${d.plural}/${g}/publish`,{environment:l,note:"cueston push"}),v=typeof w?.version=="object"?w.version?.version??null:w?.version??null;a.published.push({type:d.type,id:g,environment:l,version:v}),n.onProgress?.(`published ${d.type} ${g} to ${l}`)}catch(w){a.errors.push(_l(d.type,g,m,w))}}catch(p){a.errors.push(_l(d.type,f.id,f.file,p))}}return a}function _l(s,e,t,n){if(n instanceof R){let i=n.details.length?`${n.message}: ${n.details.join("; ")}`:n.message;return{type:s,id:e,file:t,code:n.code,message:i}}return{type:s,id:e,file:t,code:"error",message:n?.message??String(n)}}function Il(s){return s?s.split(",").map(e=>Re(e)):me}var Ap={create:"+",update:"~",unchanged:"=",missing:"!"};function $p(s,e){let n=s.filter(r=>e||r.action!=="unchanged").map(r=>{let o=`${r.action.padEnd(9)} ${r.file}`,a=r.action==="update"?b.dim(` (${r.fields.join(", ")})`):r.action==="create"&&r.name?b.dim(` "${r.name}"`):r.action==="missing"?b.dim(" (not on the server)"):"";return`${(r.action==="create"?b.green:r.action==="update"?b.yellow:r.action==="missing"?b.red:b.dim)(Ap[r.action])} ${o}${a}`}),i=r=>s.filter(o=>o.action===r).length;return n.push(b.dim(`${i("create")} to create, ${i("update")} to update, ${i("unchanged")} unchanged`+(i("missing")?`, ${i("missing")} missing on the server`:""))),n.join(`
|
|
217
|
+
`)}function Ll(s){s.command("pull [dir]").description("Download guidance drafts as JSON files: <dir>/<type>/<id>-<name>.json").option("-t, --type <types>","only these types, e.g. tours,banners").option("--prune","delete local files whose item no longer exists").addHelpText("after",`
|
|
218
|
+
Files hold the editable draft fields (no ids or timestamps besides "id"), with keys in a stable
|
|
219
|
+
order, so they diff cleanly in git. Edit them, then \`cueston push\`.
|
|
220
|
+
|
|
221
|
+
Examples:
|
|
222
|
+
cueston pull # into ./cueston
|
|
223
|
+
cueston pull content --type tours,tooltips`).action(async(e,t,n)=>{let i=k(n),r=e??"cueston",o=await ql(i.client,r,Il(t.type),{prune:t.prune,onItem:a=>i.out.info(b.dim(` ${a}`))});i.out.result(o,()=>`${b.green("\u2713")} Pulled ${pe(o.written.length,"item")} into ${r}/.`+(o.pruned.length?` Removed ${pe(o.pruned.length,"file")}.`:""))}),s.command("push [dir]").description("Create and update drafts from local files (prints the plan first)").option("-t, --type <types>","only these types, e.g. tours,banners").option("--dry-run","only print the plan").option("--publish","publish every created or updated item afterwards").addOption(new K("--env <environment>","where --publish publishes").choices(["production","staging"]).default("production")).option("-v, --verbose","also list unchanged files").addHelpText("after",`
|
|
224
|
+
A file without "id" creates a new draft (its id is written back into the file); a file with an
|
|
225
|
+
id updates that item's draft, sending only the fields that differ. Fields a file leaves out stay
|
|
226
|
+
as they are. After saving, push writes back what the server stored, so a second push changes
|
|
227
|
+
nothing. Exit code 1 if anything failed.
|
|
228
|
+
|
|
229
|
+
Examples:
|
|
230
|
+
cueston push --dry-run
|
|
231
|
+
cueston push --publish --env staging
|
|
232
|
+
CUESTON_API_KEY=sk_\u2026 npx cueston push content --publish # in CI`).action(async(e,t,n)=>{let i=k(n),r=e??"cueston",o=await Pl(i.client,r,Il(t.type),{dryRun:t.dryRun,publish:t.publish,environment:t.env,onPlan:a=>{i.out.jsonMode||process.stderr.write(`${$p(a,!!t.verbose)}
|
|
233
|
+
`)},onProgress:a=>i.out.info(`${b.green("\u2713")} ${a}`)});for(let a of o.errors)i.out.warn(`${a.file}: ${a.message}`);i.out.result(o,()=>{if(t.dryRun)return b.dim("Dry run: nothing was changed.");let a=o.applied.length;return a===0&&o.errors.length===0?"Everything is up to date.":`${a?`${b.green("\u2713")} Saved ${pe(a,"draft")}`:"No drafts saved"}`+(o.published.length?`, published ${o.published.length} to ${t.env}`:"")+(o.errors.length?`, ${b.red(pe(o.errors.length,"error"))}`:"")+"."}),o.errors.length&&(process.exitCode=1)})}import{readFileSync as Ep}from"node:fs";import{extname as Tp}from"node:path";var Mn=()=>new K("--days <n>","7, 30 or 90").choices(["7","30","90"]).default("30"),Ki=s=>typeof s=="number"?`${Math.round(s*(s<=1?100:1))}%`:"\u2014";function Ml(s){let e=s.command("segments").alias("segment").description("Saved audiences that any guidance can target");e.command("list").alias("ls").description("List saved audiences and where they're used").action(async(n,i)=>{let r=k(i),{segments:o}=await r.client.get("/api/segments");r.out.result(o,()=>o.length===0?"No saved audiences yet.":F(o,[{header:"id",value:a=>a.id},{header:"name",value:a=>a.name,max:40},{header:"rules",value:a=>a.rules?.rules?.length??0},{header:"used by",value:a=>a.usage?.length??0},{header:"updated",value:a=>Ce(a.updatedAt)}]))}),e.command("get <id>").description("Show a saved audience with its rules").action(async(n,i,r)=>{let o=k(r),{segment:a}=await o.client.get(`/api/segments/${x(n)}`);o.out.result(a,()=>he(a))});let t=n=>n.option("-f, --file <path>","JSON or YAML with name, description and rules (- for stdin)").option("-d, --data <json>","the fields as JSON (or @file)").option("--name <name>","name").option("--description <text>","what the audience is");t(e.command("create").description("Save a new audience")).addHelpText("after",`
|
|
234
|
+
Example rules file (segment.yaml):
|
|
235
|
+
name: Admins on Pro
|
|
236
|
+
rules:
|
|
237
|
+
matchType: all
|
|
238
|
+
rules:
|
|
239
|
+
- { type: role, operator: equals, value: admin }
|
|
240
|
+
- { type: plan, operator: equals, value: pro }`).action(async(n,i)=>{let r=k(i),o=await De(n,{name:n.name,description:n.description}),{segment:a}=await r.client.post("/api/segments",o);r.out.result(a,()=>`${b.green("\u2713")} Saved audience ${b.bold(String(a.id))} "${a.name}".`)}),t(e.command("update <id>").description("Rename, describe or replace the rules of an audience")).action(async(n,i,r)=>{let o=k(r),a=await De(i,{name:i.name,description:i.description});if(Object.keys(a).length===0)throw new $("Nothing to change.");let{segment:l}=await o.client.patch(`/api/segments/${x(n)}`,a);o.out.result(l,()=>`${b.green("\u2713")} Updated audience ${l.id}.`+(a.rules?b.dim(`
|
|
241
|
+
Rules apply right away to every item that targets it (segments aren't versioned).`):""))}),e.command("delete <id>").alias("rm").description("Delete an audience (refused while guidance uses it, unless --force)").option("--force","delete even if guidance or other audiences use it").option("-y, --yes","don't ask for confirmation").action(async(n,i,r)=>{let o=k(r),a=x(n);if(!await yt(`Delete audience ${a}?`,i.yes))throw new P("Canceled.");await o.client.delete(`/api/segments/${a}`,i.force?{force:!0}:void 0),o.out.result({id:a,deleted:!0},()=>`${b.green("\u2713")} Deleted audience ${a}.`)}),e.command("estimate [id]").description("How many recently active users match a saved audience, or rules from --file").option("-f, --file <path>","rules ({ matchType, rules }) as JSON or YAML").action(async(n,i,r)=>{let o=k(r);if(!n&&!i.file)throw new $("Pass a segment id or --file with rules.");let a;if(n)({estimate:a}=await o.client.get(`/api/segments/${x(n)}/estimate`));else{let l=Me(await bt(i.file),i.file),c="matchType"in l?l:l.rules;({estimate:a}=await o.client.post("/api/segments/estimate",{rules:c}))}o.out.result(a,()=>`${a.upperBound?"Up to ":"About "}${b.bold(String(a.count))} of ${a.activeUsers} users active in the last ${a.days} days.`+(a.note?b.dim(`
|
|
242
|
+
${a.note}`):""))})}function Dl(s){let e=s.command("reviews").alias("review").description("Publish requests waiting for review (approvals)");e.command("list").alias("ls").description("List review requests (pending by default)").addOption(new K("--status <status>","which requests").choices(["pending","approved","rejected","canceled","all"]).default("pending")).action(async(t,n)=>{let i=k(n),{requests:r}=await i.client.get("/api/publish-requests",{status:t.status});i.out.result(r,()=>r.length===0?`No ${t.status==="all"?"":`${t.status} `}review requests.`:F(r,[{header:"id",value:o=>o.id},{header:"item",value:o=>`${o.contentType} ${o.contentId} "${o.contentName}"`,max:50},{header:"version",value:o=>o.version},{header:"status",value:o=>o.status},{header:"requested by",value:o=>o.requestedBy?.name??o.requestedBy?.email??o.requestedBy},{header:"note",value:o=>o.note,max:40},{header:"created",value:o=>Ce(o.createdAt)}]))}),e.command("approve <id>").description("Approve a request: the requested version goes live in production").option("--note <text>","a note for the requester").action(async(t,n,i)=>{let r=k(i),o=await r.client.post(`/api/publish-requests/${x(t)}/approve`,n.note?{note:n.note}:{});r.out.result(o,()=>`${b.green("\u2713")} Approved. ${o.request?.contentType} ${o.request?.contentId} is live (version ${o.request?.version}).`)}),e.command("reject <id>").description("Reject a request with a note saying what to change").requiredOption("--note <text>","what to change (emailed to the requester)").action(async(t,n,i)=>{let r=k(i),o=await r.client.post(`/api/publish-requests/${x(t)}/reject`,{note:n.note});r.out.result(o,()=>`${b.green("\u2713")} Rejected request ${t}. The requester gets your note by email.`)}),e.command("cancel <id>").description("Withdraw your own pending request").action(async(t,n,i)=>{let r=k(i),o=await r.client.post(`/api/publish-requests/${x(t)}/cancel`,{});r.out.result(o,()=>`${b.green("\u2713")} Canceled request ${t}.`)})}function Rl(s){let e=s.command("analytics").description("Impressions, completions, funnels and broken targets");e.command("overview",{isDefault:!0}).description("Workspace totals and the top guidance (default)").addOption(Mn()).action(async(t,n)=>{let i=k(n),r=await i.client.get("/api/analytics/overview",{days:t.days});i.out.result(r,()=>{let o=r.totals??{},a=[`${b.bold(`Last ${t.days} days`)}: ${o.impressions??0} impressions \xB7 ${o.uniqueVisitors??0} visitors \xB7 ${o.completions??0} completions \xB7 ${o.dismissals??0} dismissals`+(o.targetMissing?` \xB7 ${b.yellow(`${o.targetMissing} missing targets`)}`:"")];return r.top?.length&&a.push("",F(r.top,[{header:"type",value:l=>l.contentType},{header:"id",value:l=>l.contentId},{header:"name",value:l=>l.name,max:40},{header:"impressions",value:l=>l.impressions},{header:"completions",value:l=>l.completions},{header:"rate",value:l=>Ki(l.completionRate)}])),r.install&&!r.install.lastSeenAt&&a.push("",b.yellow("The Cueston snippet hasn't been seen on your site yet: nothing will show until it's installed.")),a.join(`
|
|
243
|
+
`)})}),e.command("item <type> <id>").description("One item's totals, and its step funnel (tours) or item completions (checklists)").addOption(Mn()).action(async(t,n,i,r)=>{let o=k(r),a=Re(t),l=await o.client.get(`/api/analytics/content/${a.type}/${x(n)}`,{days:i.days});o.out.result(l,()=>{let c=l.totals??{},f=[`${b.bold(l.content?.name??`${a.type} ${n}`)} \xB7 last ${i.days} days`,`${c.impressions??0} impressions \xB7 ${c.uniqueVisitors??0} visitors \xB7 ${c.completions??0} completions \xB7 ${c.dismissals??0} dismissals`+(c.targetMissing?` \xB7 ${b.yellow(`${c.targetMissing} missing targets`)}`:"")];return l.funnel?.length&&f.push("",F(l.funnel,[{header:"step",value:u=>u.stepIndex+1},{header:"title",value:u=>u.title,max:40},{header:"views",value:u=>u.views},{header:"drop-off",value:u=>Ki(u.dropOffRate)}])),l.checklist?.items?.length&&f.push("",F(l.checklist.items,[{header:"item",value:u=>u.title,max:40},{header:"completions",value:u=>u.completions},{header:"rate",value:u=>Ki(u.completionRate)}])),f.join(`
|
|
244
|
+
`)})}),e.command("issues").description("Tooltips and tour steps whose target element was missing (broken selectors)").addOption(Mn()).action(async(t,n)=>{let i=k(n),r=await i.client.get("/api/analytics/health",{days:t.days}),o=r.items??[];i.out.result(r,()=>o.length===0?`${b.green("\u2713")} No missing targets in the last ${t.days} days.`:F(o,[{header:"type",value:a=>a.contentType},{header:"id",value:a=>a.contentId},{header:"name",value:a=>a.name,max:30},{header:"step",value:a=>a.stepIndex===null||a.stepIndex===void 0?"\u2014":a.stepIndex+1},{header:"selector",value:a=>a.selector,max:40},{header:"visitors",value:a=>a.affectedVisitors},{header:"last seen",value:a=>Ce(a.lastSeenAt)}]))}),e.command("export <dataset>").description("Raw analytics as CSV: events, content or steps (needs analytics.export)").addOption(Mn()).option("-o, --output <file>","write to a file").action(async(t,n,i)=>{let r=k(i);if(!["events","content","steps"].includes(t))throw new $("Dataset must be events, content or steps.");let o=await r.client.request("GET","/api/analytics/export",{query:{dataset:t,days:n.days},text:!0});await Pn(o,n.output,r.out.info)})}function jl(s){let e=s.command("translations").alias("translation").description("Export, import and machine-translate guidance text");e.command("export").description("Every translatable string as CSV or XLIFF (for a translator or a TMS)").addOption(new K("--format <format>","csv or xliff").choices(["csv","xliff"]).default("csv")).option("--languages <codes>","languages to include, e.g. de,fr").option("--source <code>","source language","en").option("-o, --output <file>","write to a file").action(async(t,n)=>{let i=k(n),r=await i.client.request("GET","/api/translations/export",{query:{format:t.format,languages:t.languages,sourceLanguage:t.source},text:!0});await Pn(r,t.output,i.out.info)}),e.command("import <file>").description("Import a filled-in CSV or XLIFF file (shows what would change; --apply writes it)").addOption(new K("--format <format>","csv or xliff (default: from the file extension)").choices(["csv","xliff"])).option("--apply","write the changes (to drafts; publish to make them live)").action(async(t,n,i)=>{let r=k(i),o=n.format??([".xlf",".xliff",".xml"].includes(Tp(t).toLowerCase())?"xliff":"csv"),a;try{a=Ep(t,"utf8")}catch{throw new $(`Can't read ${t}.`)}let l=await r.client.post("/api/translations/import",{format:o,content:a,dryRun:!n.apply});r.out.result(l,()=>{let c=l.summary??{},f=[`${l.dryRun?"Would import":`${b.green("\u2713")} Imported`}: ${c.new??0} new, ${c.changed??0} changed, ${c.unchanged??0} unchanged, ${c.invalid??0} invalid (${(l.languages??[]).join(", ")}).`];for(let u of(l.errors??[]).slice(0,20))f.push(b.yellow(` row ${u.row} ${u.key} [${u.language}]: ${u.message}`));return l.dryRun&&f.push(b.dim(" Nothing was written. Run again with --apply to save these changes.")),f.join(`
|
|
245
|
+
`)})}),e.command("auto <type> <id>").description("Machine-translate an item (a tour's steps, a checklist's items) and save it").option("--to <codes>","target languages, e.g. de,fr (default: every supported language)").option("--from <code>","source language","en").action(async(t,n,i,r)=>{let o=k(r),a=Re(t),l=x(n),c=i.to?String(i.to).split(",").map(d=>d.trim()).filter(Boolean):void 0,f=[];if(a.type==="tour"||a.type==="checklist"){let d=(await o.client.get(`/api/${a.plural}/${l}`))[a.type];a.type==="checklist"&&f.push({contentType:"checklist",contentId:l});for(let p of d[a.children]??[])f.push({contentType:a.type==="tour"?"tour_step":"checklist_item",contentId:p.id})}else f.push({contentType:a.type,contentId:l});let u=[];for(let d of f)try{let p=await o.client.post("/api/translations",{...d,sourceLanguage:i.from,...c?{targetLanguages:c}:{}});u.push({...d,translatedTo:p.translatedTo??[]})}catch(p){if(p.status===400)u.push({...d,skipped:p.message});else throw p}o.out.result(u,()=>u.map(d=>d.skipped?b.dim(`- ${d.contentType} ${d.contentId}: skipped (${d.skipped})`):`${b.green("\u2713")} ${d.contentType} ${d.contentId}: ${d.translatedTo.join(", ")||"nothing new"}`).join(`
|
|
246
|
+
`))})}function Bl(s){s.command("preview <type> <id>").description("A link that shows the item's draft on your real site (only for whoever opens it)").option("--site-url <url>","the page to open (default: from the item's URL pattern or the workspace preview URL)").option("--ttl <minutes>","how long the link works (default 60)").action(async(e,t,n,i)=>{let r=k(i),o=Re(e),a=await r.client.post("/api/preview-sessions",{scope:"view",contentRefs:[{type:o.type,id:x(t)}],...n.siteUrl?{siteUrl:n.siteUrl}:{},...n.ttl?{ttlMinutes:Number(n.ttl)}:{}});r.out.result({launchUrl:a.launchUrl,expiresAt:a.session?.expiresAt},()=>a.launchUrl?`${a.launchUrl}
|
|
247
|
+
${b.dim(` Expires ${a.session?.expiresAt??"in an hour"}.`)}`:b.yellow("No page to open is known. Pass --site-url with the full URL of a page where it should show."))})}function Ul(s){let e=s.command("webhooks").alias("webhook").description("Endpoints Cueston calls when guidance changes (needs workspace.settings)");e.command("list").alias("ls").description("List endpoints and the event types you can subscribe to").action(async(t,n)=>{let i=k(n),r=await i.client.get("/api/webhooks");i.out.result(r,()=>{let o=r.webhooks??[],a=[o.length===0?"No webhooks yet.":F(o,[{header:"id",value:l=>l.id},{header:"url",value:l=>l.url,max:50},{header:"events",value:l=>l.events,max:40},{header:"active",value:l=>l.active?"yes":"no"},{header:"failures",value:l=>l.consecutiveFailures??l.failureCount??0}])];return r.eventTypes?.length&&a.push("",b.dim(`Event types: ${r.eventTypes.map(l=>l.key).join(", ")}`)),a.join(`
|
|
248
|
+
`)})}),e.command("create").description("Add an endpoint; prints its signing secret once").requiredOption("--url <url>","https endpoint").requiredOption("--events <types>","comma-separated event types (see `webhooks list`)").option("--description <text>","what it's for").action(async(t,n)=>{let i=k(n),r=await i.client.post("/api/webhooks",{url:t.url,events:String(t.events).split(",").map(o=>o.trim()).filter(Boolean),...t.description?{description:t.description}:{}});i.out.result(r,()=>`${b.green("\u2713")} Created webhook ${r.webhook.id}.
|
|
249
|
+
Signing secret (shown once): ${b.bold(r.secret)}`)}),e.command("delete <id>").alias("rm").description("Delete an endpoint and its delivery log").option("-y, --yes","don't ask for confirmation").action(async(t,n,i)=>{let r=k(i),o=x(t);if(!await yt(`Delete webhook ${o}?`,n.yes))throw new P("Canceled.");await r.client.delete(`/api/webhooks/${o}`),r.out.result({id:o,deleted:!0},()=>`${b.green("\u2713")} Deleted webhook ${o}.`)}),e.command("test <id>").description("Send a signed webhook.test event now and show the result").action(async(t,n,i)=>{let r=k(i),{delivery:o}=await r.client.post(`/api/webhooks/${x(t)}/test`,{});r.out.result(o,()=>o.status==="delivered"?`${b.green("\u2713")} Delivered (HTTP ${o.responseStatus}, ${o.durationMs} ms).`:`${b.red("\u2717")} Failed: ${o.lastError??`HTTP ${o.responseStatus}`}`),o.status!=="delivered"&&(process.exitCode=1)})}function Fl(){let s=new ar("cueston").description("Build, check, preview and publish Cueston in-app guidance from your terminal or CI.").version(_t,"-V, --version","print the version").option("--json","print machine-readable JSON").option("--key <key>","secret API key to use (default: CUESTON_API_KEY, then `cueston login`)").option("--api-url <url>","Cueston URL (default: CUESTON_API_URL, then https://app.cueston.com)").showHelpAfterError("(add --help for usage)").configureHelp({sortSubcommands:!1,showGlobalOptions:!0}).addHelpText("after",`
|
|
250
|
+
Get started:
|
|
251
|
+
cueston login sign in through your browser
|
|
252
|
+
cueston tours list see your tours and their status
|
|
253
|
+
cueston pull && cueston push keep guidance in git (content as code)
|
|
254
|
+
|
|
255
|
+
Docs: https://cueston.com/docs/cli`);hl(s),wl(s),Ml(s),Dl(s),Rl(s),jl(s),Bl(s),Ul(s),Ll(s),vl(s),kl(s),Cl(s);let e=t=>{t.exitOverride();for(let n of t.commands)e(n)};return e(s),s}function Vl(s,e){if(s instanceof or)return s.exitCode===0||s.code==="commander.helpDisplayed"||s.code==="commander.version"?0:2;if(s instanceof P){if(e)process.stdout.write(`${ke({error:{message:s.message,code:s instanceof R?s.code:s.exitCode===2?"usage":"error",...s instanceof R?{status:s.status,details:s.details}:{},...s.hint?{hint:s.hint}:{}}})}
|
|
256
|
+
`);else{if(process.stderr.write(`${ee.red("Error:")} ${s.message}
|
|
257
|
+
`),s instanceof R)for(let t of s.details.slice(0,20))process.stderr.write(` - ${t}
|
|
258
|
+
`);s.hint&&process.stderr.write(`${ee.dim(s.hint)}
|
|
259
|
+
`)}return s.exitCode}return process.stderr.write(`${ee.red("Unexpected error:")} ${s?.stack??String(s)}
|
|
260
|
+
`),1}async function Np(s){let e=Fl();if(s.length<=2){e.outputHelp();return}let t=s.includes("--json");try{await e.parseAsync(s)}catch(n){process.exitCode=Vl(n,t)}}process.on("SIGINT",()=>{process.stderr.write(`
|
|
261
|
+
`),process.exit(130)});Np(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cueston",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The Cueston command line: build, check, preview and publish in-app guidance from your terminal or CI.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://cueston.com",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/andreycretsu/cueston.git",
|
|
10
|
+
"directory": "packages/cli"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"cueston",
|
|
14
|
+
"cli",
|
|
15
|
+
"product-tours",
|
|
16
|
+
"onboarding",
|
|
17
|
+
"mcp"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"bin": {
|
|
21
|
+
"cueston": "dist/cli.js"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "node scripts/build.mjs",
|
|
32
|
+
"type-check": "tsc --noEmit -p .",
|
|
33
|
+
"test": "node ../../web/node_modules/vitest/vitest.mjs run --config vitest.config.mjs",
|
|
34
|
+
"e2e": "node scripts/e2e.mjs",
|
|
35
|
+
"prepublishOnly": "npm run type-check && npm test && npm run build"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^22.20.5",
|
|
39
|
+
"commander": "^14.0.2",
|
|
40
|
+
"esbuild": "^0.27.2",
|
|
41
|
+
"picocolors": "^1.1.1",
|
|
42
|
+
"typescript": "5.9.3",
|
|
43
|
+
"yaml": "^2.9.1"
|
|
44
|
+
}
|
|
45
|
+
}
|