@abruncloud/cli 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abrun.js +122 -2
- package/package.json +6 -43
- package/README.md +0 -210
- package/dist/abrun.js +0 -200
- package/dist/index.js +0 -26
package/dist/abrun.js
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import{createRequire as JJ}from"node:module";var AJ=Object.create;var{getPrototypeOf:$J,defineProperty:o6,getOwnPropertyNames:fJ}=Object;var PJ=Object.prototype.hasOwnProperty;function BJ(D){return this[D]}var GJ,zJ,B0=(D,R,A)=>{var $=D!=null&&typeof D==="object";if($){var f=R?GJ??=new WeakMap:zJ??=new WeakMap,P=f.get(D);if(P)return P}A=D!=null?AJ($J(D)):{};let B=R||!D||!D.__esModule?o6(A,"default",{value:D,enumerable:!0}):A;for(let G of fJ(D))if(!PJ.call(B,G))o6(B,G,{get:BJ.bind(D,G),enumerable:!0});if($)f.set(D,B);return B};var q=(D,R)=>()=>(R||D((R={exports:{}}).exports,R),R.exports);var p=JJ(import.meta.url);var XR=q((HJ)=>{class ef extends Error{constructor(D,R,A){super(A);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=R,this.exitCode=D,this.nestedError=void 0}}class c6 extends ef{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}HJ.CommanderError=ef;HJ.InvalidArgumentError=c6});var uA=q((OJ)=>{var{InvalidArgumentError:XJ}=XR();class t6{constructor(D,R){switch(this.description=R||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,D[0]){case"<":this.required=!0,this._name=D.slice(1,-1);break;case"[":this.required=!1,this._name=D.slice(1,-1);break;default:this.required=!0,this._name=D;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(D,R){if(R===this.defaultValue||!Array.isArray(R))return[D];return R.push(D),R}default(D,R){return this.defaultValue=D,this.defaultValueDescription=R,this}argParser(D){return this.parseArg=D,this}choices(D){return this.argChoices=D.slice(),this.parseArg=(R,A)=>{if(!this.argChoices.includes(R))throw new XJ(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(R,A);return R},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function TJ(D){let R=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+R+">":"["+R+"]"}OJ.Argument=t6;OJ.humanReadableArgName=TJ});var D2=q((UJ)=>{var{humanReadableArgName:_J}=uA();class e6{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(D){this.helpWidth=this.helpWidth??D.helpWidth??80}visibleCommands(D){let R=D.commands.filter(($)=>!$._hidden),A=D._getHelpCommand();if(A&&!A._hidden)R.push(A);if(this.sortSubcommands)R.sort(($,f)=>{return $.name().localeCompare(f.name())});return R}compareOptions(D,R){let A=($)=>{return $.short?$.short.replace(/^-/,""):$.long.replace(/^--/,"")};return A(D).localeCompare(A(R))}visibleOptions(D){let R=D.options.filter(($)=>!$.hidden),A=D._getHelpOption();if(A&&!A.hidden){let $=A.short&&D._findOption(A.short),f=A.long&&D._findOption(A.long);if(!$&&!f)R.push(A);else if(A.long&&!f)R.push(D.createOption(A.long,A.description));else if(A.short&&!$)R.push(D.createOption(A.short,A.description))}if(this.sortOptions)R.sort(this.compareOptions);return R}visibleGlobalOptions(D){if(!this.showGlobalOptions)return[];let R=[];for(let A=D.parent;A;A=A.parent){let $=A.options.filter((f)=>!f.hidden);R.push(...$)}if(this.sortOptions)R.sort(this.compareOptions);return R}visibleArguments(D){if(D._argsDescription)D.registeredArguments.forEach((R)=>{R.description=R.description||D._argsDescription[R.name()]||""});if(D.registeredArguments.find((R)=>R.description))return D.registeredArguments;return[]}subcommandTerm(D){let R=D.registeredArguments.map((A)=>_J(A)).join(" ");return D._name+(D._aliases[0]?"|"+D._aliases[0]:"")+(D.options.length?" [options]":"")+(R?" "+R:"")}optionTerm(D){return D.flags}argumentTerm(D){return D.name()}longestSubcommandTermLength(D,R){return R.visibleCommands(D).reduce((A,$)=>{return Math.max(A,this.displayWidth(R.styleSubcommandTerm(R.subcommandTerm($))))},0)}longestOptionTermLength(D,R){return R.visibleOptions(D).reduce((A,$)=>{return Math.max(A,this.displayWidth(R.styleOptionTerm(R.optionTerm($))))},0)}longestGlobalOptionTermLength(D,R){return R.visibleGlobalOptions(D).reduce((A,$)=>{return Math.max(A,this.displayWidth(R.styleOptionTerm(R.optionTerm($))))},0)}longestArgumentTermLength(D,R){return R.visibleArguments(D).reduce((A,$)=>{return Math.max(A,this.displayWidth(R.styleArgumentTerm(R.argumentTerm($))))},0)}commandUsage(D){let R=D._name;if(D._aliases[0])R=R+"|"+D._aliases[0];let A="";for(let $=D.parent;$;$=$.parent)A=$.name()+" "+A;return A+R+" "+D.usage()}commandDescription(D){return D.description()}subcommandDescription(D){return D.summary()||D.description()}optionDescription(D){let R=[];if(D.argChoices)R.push(`choices: ${D.argChoices.map((A)=>JSON.stringify(A)).join(", ")}`);if(D.defaultValue!==void 0){if(D.required||D.optional||D.isBoolean()&&typeof D.defaultValue==="boolean")R.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`)}if(D.presetArg!==void 0&&D.optional)R.push(`preset: ${JSON.stringify(D.presetArg)}`);if(D.envVar!==void 0)R.push(`env: ${D.envVar}`);if(R.length>0){let A=`(${R.join(", ")})`;if(D.description)return`${D.description} ${A}`;return A}return D.description}argumentDescription(D){let R=[];if(D.argChoices)R.push(`choices: ${D.argChoices.map((A)=>JSON.stringify(A)).join(", ")}`);if(D.defaultValue!==void 0)R.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`);if(R.length>0){let A=`(${R.join(", ")})`;if(D.description)return`${D.description} ${A}`;return A}return D.description}formatItemList(D,R,A){if(R.length===0)return[];return[A.styleTitle(D),...R,""]}groupItems(D,R,A){let $=new Map;return D.forEach((f)=>{let P=A(f);if(!$.has(P))$.set(P,[])}),R.forEach((f)=>{let P=A(f);if(!$.has(P))$.set(P,[]);$.get(P).push(f)}),$}formatHelp(D,R){let A=R.padWidth(D,R),$=R.helpWidth??80;function f(Z,H){return R.formatItem(Z,A,H,R)}let P=[`${R.styleTitle("Usage:")} ${R.styleUsage(R.commandUsage(D))}`,""],B=R.commandDescription(D);if(B.length>0)P=P.concat([R.boxWrap(R.styleCommandDescription(B),$),""]);let G=R.visibleArguments(D).map((Z)=>{return f(R.styleArgumentTerm(R.argumentTerm(Z)),R.styleArgumentDescription(R.argumentDescription(Z)))});if(P=P.concat(this.formatItemList("Arguments:",G,R)),this.groupItems(D.options,R.visibleOptions(D),(Z)=>Z.helpGroupHeading??"Options:").forEach((Z,H)=>{let M=Z.map((T)=>{return f(R.styleOptionTerm(R.optionTerm(T)),R.styleOptionDescription(R.optionDescription(T)))});P=P.concat(this.formatItemList(H,M,R))}),R.showGlobalOptions){let Z=R.visibleGlobalOptions(D).map((H)=>{return f(R.styleOptionTerm(R.optionTerm(H)),R.styleOptionDescription(R.optionDescription(H)))});P=P.concat(this.formatItemList("Global Options:",Z,R))}return this.groupItems(D.commands,R.visibleCommands(D),(Z)=>Z.helpGroup()||"Commands:").forEach((Z,H)=>{let M=Z.map((T)=>{return f(R.styleSubcommandTerm(R.subcommandTerm(T)),R.styleSubcommandDescription(R.subcommandDescription(T)))});P=P.concat(this.formatItemList(H,M,R))}),P.join(`
|
|
2
|
-
`)}displayWidth(D){return D4(D).length}styleTitle(D){return D}styleUsage(D){return D.split(" ").map((R)=>{if(R==="[options]")return this.styleOptionText(R);if(R==="[command]")return this.styleSubcommandText(R);if(R[0]==="["||R[0]==="<")return this.styleArgumentText(R);return this.styleCommandText(R)}).join(" ")}styleCommandDescription(D){return this.styleDescriptionText(D)}styleOptionDescription(D){return this.styleDescriptionText(D)}styleSubcommandDescription(D){return this.styleDescriptionText(D)}styleArgumentDescription(D){return this.styleDescriptionText(D)}styleDescriptionText(D){return D}styleOptionTerm(D){return this.styleOptionText(D)}styleSubcommandTerm(D){return D.split(" ").map((R)=>{if(R==="[options]")return this.styleOptionText(R);if(R[0]==="["||R[0]==="<")return this.styleArgumentText(R);return this.styleSubcommandText(R)}).join(" ")}styleArgumentTerm(D){return this.styleArgumentText(D)}styleOptionText(D){return D}styleArgumentText(D){return D}styleSubcommandText(D){return D}styleCommandText(D){return D}padWidth(D,R){return Math.max(R.longestOptionTermLength(D,R),R.longestGlobalOptionTermLength(D,R),R.longestSubcommandTermLength(D,R),R.longestArgumentTermLength(D,R))}preformatted(D){return/\n[^\S\r\n]/.test(D)}formatItem(D,R,A,$){let P=" ".repeat(2);if(!A)return P+D;let B=D.padEnd(R+D.length-$.displayWidth(D)),G=2,J=(this.helpWidth??80)-R-G-2,Z;if(J<this.minWidthToWrap||$.preformatted(A))Z=A;else Z=$.boxWrap(A,J).replace(/\n/g,`
|
|
3
|
-
`+" ".repeat(R+G));return P+B+" ".repeat(G)+Z.replace(/\n/g,`
|
|
4
|
-
${P}`)}boxWrap(D,R){if(R<this.minWidthToWrap)return D;let A=D.split(/\r\n|\n/),$=/[\s]*[^\s]+/g,f=[];return A.forEach((P)=>{let B=P.match($);if(B===null){f.push("");return}let G=[B.shift()],z=this.displayWidth(G[0]);B.forEach((J)=>{let Z=this.displayWidth(J);if(z+Z<=R){G.push(J),z+=Z;return}f.push(G.join(""));let H=J.trimStart();G=[H],z=this.displayWidth(H)}),f.push(G.join(""))}),f.join(`
|
|
5
|
-
`)}}function D4(D){let R=/\x1b\[\d*(;\d*)*m/g;return D.replace(R,"")}UJ.Help=e6;UJ.stripColor=D4});var R2=q((LJ)=>{var{InvalidArgumentError:wJ}=XR();class A4{constructor(D,R){this.flags=D,this.description=R||"",this.required=D.includes("<"),this.optional=D.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(D),this.mandatory=!1;let A=CJ(D);if(this.short=A.shortFlag,this.long=A.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(D,R){return this.defaultValue=D,this.defaultValueDescription=R,this}preset(D){return this.presetArg=D,this}conflicts(D){return this.conflictsWith=this.conflictsWith.concat(D),this}implies(D){let R=D;if(typeof D==="string")R={[D]:!0};return this.implied=Object.assign(this.implied||{},R),this}env(D){return this.envVar=D,this}argParser(D){return this.parseArg=D,this}makeOptionMandatory(D=!0){return this.mandatory=!!D,this}hideHelp(D=!0){return this.hidden=!!D,this}_collectValue(D,R){if(R===this.defaultValue||!Array.isArray(R))return[D];return R.push(D),R}choices(D){return this.argChoices=D.slice(),this.parseArg=(R,A)=>{if(!this.argChoices.includes(R))throw new wJ(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(R,A);return R},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return R4(this.name().replace(/^no-/,""));return R4(this.name())}helpGroup(D){return this.helpGroupHeading=D,this}is(D){return this.short===D||this.long===D}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class $4{constructor(D){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,D.forEach((R)=>{if(R.negate)this.negativeOptions.set(R.attributeName(),R);else this.positiveOptions.set(R.attributeName(),R)}),this.negativeOptions.forEach((R,A)=>{if(this.positiveOptions.has(A))this.dualOptions.add(A)})}valueFromOption(D,R){let A=R.attributeName();if(!this.dualOptions.has(A))return!0;let $=this.negativeOptions.get(A).presetArg,f=$!==void 0?$:!1;return R.negate===(f===D)}}function R4(D){return D.split("-").reduce((R,A)=>{return R+A[0].toUpperCase()+A.slice(1)})}function CJ(D){let R,A,$=/^-[^-]$/,f=/^--[^-]/,P=D.split(/[ |,]+/).concat("guard");if($.test(P[0]))R=P.shift();if(f.test(P[0]))A=P.shift();if(!R&&$.test(P[0]))R=P.shift();if(!R&&f.test(P[0]))R=A,A=P.shift();if(P[0].startsWith("-")){let B=P[0],G=`option creation failed due to '${B}' in option flags '${D}'`;if(/^-[^-][^-]/.test(B))throw Error(`${G}
|
|
6
|
-
- a short flag is a single dash and a single character
|
|
7
|
-
- either use a single dash and a single character (for a short flag)
|
|
8
|
-
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if($.test(B))throw Error(`${G}
|
|
9
|
-
- too many short flags`);if(f.test(B))throw Error(`${G}
|
|
10
|
-
- too many long flags`);throw Error(`${G}
|
|
11
|
-
- unrecognised flag format`)}if(R===void 0&&A===void 0)throw Error(`option creation failed due to no flags found in '${D}'.`);return{shortFlag:R,longFlag:A}}LJ.Option=A4;LJ.DualOptions=$4});var f4=q((WJ)=>{function IJ(D,R){if(Math.abs(D.length-R.length)>3)return Math.max(D.length,R.length);let A=[];for(let $=0;$<=D.length;$++)A[$]=[$];for(let $=0;$<=R.length;$++)A[0][$]=$;for(let $=1;$<=R.length;$++)for(let f=1;f<=D.length;f++){let P=1;if(D[f-1]===R[$-1])P=0;else P=1;if(A[f][$]=Math.min(A[f-1][$]+1,A[f][$-1]+1,A[f-1][$-1]+P),f>1&&$>1&&D[f-1]===R[$-2]&&D[f-2]===R[$-1])A[f][$]=Math.min(A[f][$],A[f-2][$-2]+1)}return A[D.length][R.length]}function KJ(D,R){if(!R||R.length===0)return"";R=Array.from(new Set(R));let A=D.startsWith("--");if(A)D=D.slice(2),R=R.map((B)=>B.slice(2));let $=[],f=3,P=0.4;if(R.forEach((B)=>{if(B.length<=1)return;let G=IJ(D,B),z=Math.max(D.length,B.length);if((z-G)/z>P){if(G<f)f=G,$=[B];else if(G===f)$.push(B)}}),$.sort((B,G)=>B.localeCompare(G)),A)$=$.map((B)=>`--${B}`);if($.length>1)return`
|
|
12
|
-
(Did you mean one of ${$.join(", ")}?)`;if($.length===1)return`
|
|
13
|
-
(Did you mean ${$[0]}?)`;return""}WJ.suggestSimilar=KJ});var z4=q((mJ)=>{var SJ=p("node:events").EventEmitter,A2=p("node:child_process"),s0=p("node:path"),EA=p("node:fs"),h=p("node:process"),{Argument:bJ,humanReadableArgName:uJ}=uA(),{CommanderError:$2}=XR(),{Help:EJ,stripColor:yJ}=D2(),{Option:P4,DualOptions:gJ}=R2(),{suggestSimilar:B4}=f4();class P2 extends SJ{constructor(D){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=D||"",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:(R)=>h.stdout.write(R),writeErr:(R)=>h.stderr.write(R),outputError:(R,A)=>A(R),getOutHelpWidth:()=>h.stdout.isTTY?h.stdout.columns:void 0,getErrHelpWidth:()=>h.stderr.isTTY?h.stderr.columns:void 0,getOutHasColors:()=>f2()??(h.stdout.isTTY&&h.stdout.hasColors?.()),getErrHasColors:()=>f2()??(h.stderr.isTTY&&h.stderr.hasColors?.()),stripColor:(R)=>yJ(R)},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(D){return this._outputConfiguration=D._outputConfiguration,this._helpOption=D._helpOption,this._helpCommand=D._helpCommand,this._helpConfiguration=D._helpConfiguration,this._exitCallback=D._exitCallback,this._storeOptionsAsProperties=D._storeOptionsAsProperties,this._combineFlagAndOptionalValue=D._combineFlagAndOptionalValue,this._allowExcessArguments=D._allowExcessArguments,this._enablePositionalOptions=D._enablePositionalOptions,this._showHelpAfterError=D._showHelpAfterError,this._showSuggestionAfterError=D._showSuggestionAfterError,this}_getCommandAndAncestors(){let D=[];for(let R=this;R;R=R.parent)D.push(R);return D}command(D,R,A){let $=R,f=A;if(typeof $==="object"&&$!==null)f=$,$=null;f=f||{};let[,P,B]=D.match(/([^ ]+) *(.*)/),G=this.createCommand(P);if($)G.description($),G._executableHandler=!0;if(f.isDefault)this._defaultCommandName=G._name;if(G._hidden=!!(f.noHelp||f.hidden),G._executableFile=f.executableFile||null,B)G.arguments(B);if(this._registerCommand(G),G.parent=this,G.copyInheritedSettings(this),$)return this;return G}createCommand(D){return new P2(D)}createHelp(){return Object.assign(new EJ,this.configureHelp())}configureHelp(D){if(D===void 0)return this._helpConfiguration;return this._helpConfiguration=D,this}configureOutput(D){if(D===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...D},this}showHelpAfterError(D=!0){if(typeof D!=="string")D=!!D;return this._showHelpAfterError=D,this}showSuggestionAfterError(D=!0){return this._showSuggestionAfterError=!!D,this}addCommand(D,R){if(!D._name)throw Error(`Command passed to .addCommand() must have a name
|
|
14
|
-
- specify the name in Command constructor or using .name()`);if(R=R||{},R.isDefault)this._defaultCommandName=D._name;if(R.noHelp||R.hidden)D._hidden=!0;return this._registerCommand(D),D.parent=this,D._checkForBrokenPassThrough(),this}createArgument(D,R){return new bJ(D,R)}argument(D,R,A,$){let f=this.createArgument(D,R);if(typeof A==="function")f.default($).argParser(A);else f.default(A);return this.addArgument(f),this}arguments(D){return D.trim().split(/ +/).forEach((R)=>{this.argument(R)}),this}addArgument(D){let R=this.registeredArguments.slice(-1)[0];if(R?.variadic)throw Error(`only the last argument can be variadic '${R.name()}'`);if(D.required&&D.defaultValue!==void 0&&D.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${D.name()}'`);return this.registeredArguments.push(D),this}helpCommand(D,R){if(typeof D==="boolean"){if(this._addImplicitHelpCommand=D,D&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let A=D??"help [command]",[,$,f]=A.match(/([^ ]+) *(.*)/),P=R??"display help for command",B=this.createCommand($);if(B.helpOption(!1),f)B.arguments(f);if(P)B.description(P);if(this._addImplicitHelpCommand=!0,this._helpCommand=B,D||R)this._initCommandGroup(B);return this}addHelpCommand(D,R){if(typeof D!=="object")return this.helpCommand(D,R),this;return this._addImplicitHelpCommand=!0,this._helpCommand=D,this._initCommandGroup(D),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(D,R){let A=["preSubcommand","preAction","postAction"];if(!A.includes(D))throw Error(`Unexpected value for event passed to hook : '${D}'.
|
|
15
|
-
Expecting one of '${A.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycleHooks[D].push(R);else this._lifeCycleHooks[D]=[R];return this}exitOverride(D){if(D)this._exitCallback=D;else this._exitCallback=(R)=>{if(R.code!=="commander.executeSubCommandAsync")throw R};return this}_exit(D,R,A){if(this._exitCallback)this._exitCallback(new $2(D,R,A));h.exit(D)}action(D){let R=(A)=>{let $=this.registeredArguments.length,f=A.slice(0,$);if(this._storeOptionsAsProperties)f[$]=this;else f[$]=this.opts();return f.push(this),D.apply(this,f)};return this._actionHandler=R,this}createOption(D,R){return new P4(D,R)}_callParseArg(D,R,A,$){try{return D.parseArg(R,A)}catch(f){if(f.code==="commander.invalidArgument"){let P=`${$} ${f.message}`;this.error(P,{exitCode:f.exitCode,code:f.code})}throw f}}_registerOption(D){let R=D.short&&this._findOption(D.short)||D.long&&this._findOption(D.long);if(R){let A=D.long&&this._findOption(D.long)?D.long:D.short;throw Error(`Cannot add option '${D.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${A}'
|
|
16
|
-
- already used by option '${R.flags}'`)}this._initOptionGroup(D),this.options.push(D)}_registerCommand(D){let R=($)=>{return[$.name()].concat($.aliases())},A=R(D).find(($)=>this._findCommand($));if(A){let $=R(this._findCommand(A)).join("|"),f=R(D).join("|");throw Error(`cannot add command '${f}' as already have command '${$}'`)}this._initCommandGroup(D),this.commands.push(D)}addOption(D){this._registerOption(D);let R=D.name(),A=D.attributeName();if(D.negate){let f=D.long.replace(/^--no-/,"--");if(!this._findOption(f))this.setOptionValueWithSource(A,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(A,D.defaultValue,"default");let $=(f,P,B)=>{if(f==null&&D.presetArg!==void 0)f=D.presetArg;let G=this.getOptionValue(A);if(f!==null&&D.parseArg)f=this._callParseArg(D,f,G,P);else if(f!==null&&D.variadic)f=D._collectValue(f,G);if(f==null)if(D.negate)f=!1;else if(D.isBoolean()||D.optional)f=!0;else f="";this.setOptionValueWithSource(A,f,B)};if(this.on("option:"+R,(f)=>{let P=`error: option '${D.flags}' argument '${f}' is invalid.`;$(f,P,"cli")}),D.envVar)this.on("optionEnv:"+R,(f)=>{let P=`error: option '${D.flags}' value '${f}' from env '${D.envVar}' is invalid.`;$(f,P,"env")});return this}_optionEx(D,R,A,$,f){if(typeof R==="object"&&R instanceof P4)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let P=this.createOption(R,A);if(P.makeOptionMandatory(!!D.mandatory),typeof $==="function")P.default(f).argParser($);else if($ instanceof RegExp){let B=$;$=(G,z)=>{let J=B.exec(G);return J?J[0]:z},P.default(f).argParser($)}else P.default($);return this.addOption(P)}option(D,R,A,$){return this._optionEx({},D,R,A,$)}requiredOption(D,R,A,$){return this._optionEx({mandatory:!0},D,R,A,$)}combineFlagAndOptionalValue(D=!0){return this._combineFlagAndOptionalValue=!!D,this}allowUnknownOption(D=!0){return this._allowUnknownOption=!!D,this}allowExcessArguments(D=!0){return this._allowExcessArguments=!!D,this}enablePositionalOptions(D=!0){return this._enablePositionalOptions=!!D,this}passThroughOptions(D=!0){return this._passThroughOptions=!!D,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(D=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!D,this}getOptionValue(D){if(this._storeOptionsAsProperties)return this[D];return this._optionValues[D]}setOptionValue(D,R){return this.setOptionValueWithSource(D,R,void 0)}setOptionValueWithSource(D,R,A){if(this._storeOptionsAsProperties)this[D]=R;else this._optionValues[D]=R;return this._optionValueSources[D]=A,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let R;return this._getCommandAndAncestors().forEach((A)=>{if(A.getOptionValueSource(D)!==void 0)R=A.getOptionValueSource(D)}),R}_prepareUserArgs(D,R){if(D!==void 0&&!Array.isArray(D))throw Error("first parameter to parse must be array or undefined");if(R=R||{},D===void 0&&R.from===void 0){if(h.versions?.electron)R.from="electron";let $=h.execArgv??[];if($.includes("-e")||$.includes("--eval")||$.includes("-p")||$.includes("--print"))R.from="eval"}if(D===void 0)D=h.argv;this.rawArgs=D.slice();let A;switch(R.from){case void 0:case"node":this._scriptPath=D[1],A=D.slice(2);break;case"electron":if(h.defaultApp)this._scriptPath=D[1],A=D.slice(2);else A=D.slice(1);break;case"user":A=D.slice(0);break;case"eval":A=D.slice(1);break;default:throw Error(`unexpected parse option { from: '${R.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",A}parse(D,R){this._prepareForParse();let A=this._prepareUserArgs(D,R);return this._parseCommand([],A),this}async parseAsync(D,R){this._prepareForParse();let A=this._prepareUserArgs(D,R);return await this._parseCommand([],A),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
17
|
-
- 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(D,R,A){if(EA.existsSync(D))return;let $=R?`searched for local subcommand relative to directory '${R}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",f=`'${D}' does not exist
|
|
18
|
-
- if '${A}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
19
|
-
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
20
|
-
- ${$}`;throw Error(f)}_executeSubCommand(D,R){R=R.slice();let A=!1,$=[".js",".ts",".tsx",".mjs",".cjs"];function f(J,Z){let H=s0.resolve(J,Z);if(EA.existsSync(H))return H;if($.includes(s0.extname(Z)))return;let M=$.find((T)=>EA.existsSync(`${H}${T}`));if(M)return`${H}${M}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let P=D._executableFile||`${this._name}-${D._name}`,B=this._executableDir||"";if(this._scriptPath){let J;try{J=EA.realpathSync(this._scriptPath)}catch{J=this._scriptPath}B=s0.resolve(s0.dirname(J),B)}if(B){let J=f(B,P);if(!J&&!D._executableFile&&this._scriptPath){let Z=s0.basename(this._scriptPath,s0.extname(this._scriptPath));if(Z!==this._name)J=f(B,`${Z}-${D._name}`)}P=J||P}A=$.includes(s0.extname(P));let G;if(h.platform!=="win32")if(A)R.unshift(P),R=G4(h.execArgv).concat(R),G=A2.spawn(h.argv[0],R,{stdio:"inherit"});else G=A2.spawn(P,R,{stdio:"inherit"});else this._checkForMissingExecutable(P,B,D._name),R.unshift(P),R=G4(h.execArgv).concat(R),G=A2.spawn(h.execPath,R,{stdio:"inherit"});if(!G.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((Z)=>{h.on(Z,()=>{if(G.killed===!1&&G.exitCode===null)G.kill(Z)})});let z=this._exitCallback;G.on("close",(J)=>{if(J=J??1,!z)h.exit(J);else z(new $2(J,"commander.executeSubCommandAsync","(close)"))}),G.on("error",(J)=>{if(J.code==="ENOENT")this._checkForMissingExecutable(P,B,D._name);else if(J.code==="EACCES")throw Error(`'${P}' not executable`);if(!z)h.exit(1);else{let Z=new $2(1,"commander.executeSubCommandAsync","(error)");Z.nestedError=J,z(Z)}}),this.runningCommand=G}_dispatchSubcommand(D,R,A){let $=this._findCommand(D);if(!$)this.help({error:!0});$._prepareForParse();let f;return f=this._chainOrCallSubCommandHook(f,$,"preSubcommand"),f=this._chainOrCall(f,()=>{if($._executableHandler)this._executeSubCommand($,R.concat(A));else return $._parseCommand(R,A)}),f}_dispatchHelpCommand(D){if(!D)this.help();let R=this._findCommand(D);if(R&&!R._executableHandler)R.help();return this._dispatchSubcommand(D,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((D,R)=>{if(D.required&&this.args[R]==null)this.missingArgument(D.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let D=(A,$,f)=>{let P=$;if($!==null&&A.parseArg){let B=`error: command-argument value '${$}' is invalid for argument '${A.name()}'.`;P=this._callParseArg(A,$,f,B)}return P};this._checkNumberOfArguments();let R=[];this.registeredArguments.forEach((A,$)=>{let f=A.defaultValue;if(A.variadic){if($<this.args.length){if(f=this.args.slice($),A.parseArg)f=f.reduce((P,B)=>{return D(A,B,P)},A.defaultValue)}else if(f===void 0)f=[]}else if($<this.args.length){if(f=this.args[$],A.parseArg)f=D(A,f,A.defaultValue)}R[$]=f}),this.processedArgs=R}_chainOrCall(D,R){if(D?.then&&typeof D.then==="function")return D.then(()=>R());return R()}_chainOrCallHooks(D,R){let A=D,$=[];if(this._getCommandAndAncestors().reverse().filter((f)=>f._lifeCycleHooks[R]!==void 0).forEach((f)=>{f._lifeCycleHooks[R].forEach((P)=>{$.push({hookedCommand:f,callback:P})})}),R==="postAction")$.reverse();return $.forEach((f)=>{A=this._chainOrCall(A,()=>{return f.callback(f.hookedCommand,this)})}),A}_chainOrCallSubCommandHook(D,R,A){let $=D;if(this._lifeCycleHooks[A]!==void 0)this._lifeCycleHooks[A].forEach((f)=>{$=this._chainOrCall($,()=>{return f(this,R)})});return $}_parseCommand(D,R){let A=this.parseOptions(R);if(this._parseOptionsEnv(),this._parseOptionsImplied(),D=D.concat(A.operands),R=A.unknown,this.args=D.concat(R),D&&this._findCommand(D[0]))return this._dispatchSubcommand(D[0],D.slice(1),R);if(this._getHelpCommand()&&D[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(D[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(R),this._dispatchSubcommand(this._defaultCommandName,D,R);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(A.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let $=()=>{if(A.unknown.length>0)this.unknownOption(A.unknown[0])},f=`command:${this.name()}`;if(this._actionHandler){$(),this._processArguments();let P;if(P=this._chainOrCallHooks(P,"preAction"),P=this._chainOrCall(P,()=>this._actionHandler(this.processedArgs)),this.parent)P=this._chainOrCall(P,()=>{this.parent.emit(f,D,R)});return P=this._chainOrCallHooks(P,"postAction"),P}if(this.parent?.listenerCount(f))$(),this._processArguments(),this.parent.emit(f,D,R);else if(D.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",D,R);if(this.listenerCount("command:*"))this.emit("command:*",D,R);else if(this.commands.length)this.unknownCommand();else $(),this._processArguments()}else if(this.commands.length)$(),this.help({error:!0});else $(),this._processArguments()}_findCommand(D){if(!D)return;return this.commands.find((R)=>R._name===D||R._aliases.includes(D))}_findOption(D){return this.options.find((R)=>R.is(D))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((D)=>{D.options.forEach((R)=>{if(R.mandatory&&D.getOptionValue(R.attributeName())===void 0)D.missingMandatoryOptionValue(R)})})}_checkForConflictingLocalOptions(){let D=this.options.filter((A)=>{let $=A.attributeName();if(this.getOptionValue($)===void 0)return!1;return this.getOptionValueSource($)!=="default"});D.filter((A)=>A.conflictsWith.length>0).forEach((A)=>{let $=D.find((f)=>A.conflictsWith.includes(f.attributeName()));if($)this._conflictingOption(A,$)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let R=[],A=[],$=R;function f(J){return J.length>1&&J[0]==="-"}let P=(J)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(J))return!1;return!this._getCommandAndAncestors().some((Z)=>Z.options.map((H)=>H.short).some((H)=>/^-\d$/.test(H)))},B=null,G=null,z=0;while(z<D.length||G){let J=G??D[z++];if(G=null,J==="--"){if($===A)$.push(J);$.push(...D.slice(z));break}if(B&&(!f(J)||P(J))){this.emit(`option:${B.name()}`,J);continue}if(B=null,f(J)){let Z=this._findOption(J);if(Z){if(Z.required){let H=D[z++];if(H===void 0)this.optionMissingArgument(Z);this.emit(`option:${Z.name()}`,H)}else if(Z.optional){let H=null;if(z<D.length&&(!f(D[z])||P(D[z])))H=D[z++];this.emit(`option:${Z.name()}`,H)}else this.emit(`option:${Z.name()}`);B=Z.variadic?Z:null;continue}}if(J.length>2&&J[0]==="-"&&J[1]!=="-"){let Z=this._findOption(`-${J[1]}`);if(Z){if(Z.required||Z.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${Z.name()}`,J.slice(2));else this.emit(`option:${Z.name()}`),G=`-${J.slice(2)}`;continue}}if(/^--[^=]+=/.test(J)){let Z=J.indexOf("="),H=this._findOption(J.slice(0,Z));if(H&&(H.required||H.optional)){this.emit(`option:${H.name()}`,J.slice(Z+1));continue}}if($===R&&f(J)&&!(this.commands.length===0&&P(J)))$=A;if((this._enablePositionalOptions||this._passThroughOptions)&&R.length===0&&A.length===0){if(this._findCommand(J)){R.push(J),A.push(...D.slice(z));break}else if(this._getHelpCommand()&&J===this._getHelpCommand().name()){R.push(J,...D.slice(z));break}else if(this._defaultCommandName){A.push(J,...D.slice(z));break}}if(this._passThroughOptions){$.push(J,...D.slice(z));break}$.push(J)}return{operands:R,unknown:A}}opts(){if(this._storeOptionsAsProperties){let D={},R=this.options.length;for(let A=0;A<R;A++){let $=this.options[A].attributeName();D[$]=$===this._versionOptionName?this._version:this[$]}return D}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((D,R)=>Object.assign(D,R.opts()),{})}error(D,R){if(this._outputConfiguration.outputError(`${D}
|
|
21
|
-
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
22
|
-
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
|
|
23
|
-
`),this.outputHelp({error:!0});let A=R||{},$=A.exitCode||1,f=A.code||"commander.error";this._exit($,f,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in h.env){let R=D.attributeName();if(this.getOptionValue(R)===void 0||["default","config","env"].includes(this.getOptionValueSource(R)))if(D.required||D.optional)this.emit(`optionEnv:${D.name()}`,h.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new gJ(this.options),R=(A)=>{return this.getOptionValue(A)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(A))};this.options.filter((A)=>A.implied!==void 0&&R(A.attributeName())&&D.valueFromOption(this.getOptionValue(A.attributeName()),A)).forEach((A)=>{Object.keys(A.implied).filter(($)=>!R($)).forEach(($)=>{this.setOptionValueWithSource($,A.implied[$],"implied")})})}missingArgument(D){let R=`error: missing required argument '${D}'`;this.error(R,{code:"commander.missingArgument"})}optionMissingArgument(D){let R=`error: option '${D.flags}' argument missing`;this.error(R,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(D){let R=`error: required option '${D.flags}' not specified`;this.error(R,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(D,R){let A=(P)=>{let B=P.attributeName(),G=this.getOptionValue(B),z=this.options.find((Z)=>Z.negate&&B===Z.attributeName()),J=this.options.find((Z)=>!Z.negate&&B===Z.attributeName());if(z&&(z.presetArg===void 0&&G===!1||z.presetArg!==void 0&&G===z.presetArg))return z;return J||P},$=(P)=>{let B=A(P),G=B.attributeName();if(this.getOptionValueSource(G)==="env")return`environment variable '${B.envVar}'`;return`option '${B.flags}'`},f=`error: ${$(D)} cannot be used with ${$(R)}`;this.error(f,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let R="";if(D.startsWith("--")&&this._showSuggestionAfterError){let $=[],f=this;do{let P=f.createHelp().visibleOptions(f).filter((B)=>B.long).map((B)=>B.long);$=$.concat(P),f=f.parent}while(f&&!f._enablePositionalOptions);R=B4(D,$)}let A=`error: unknown option '${D}'${R}`;this.error(A,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let R=this.registeredArguments.length,A=R===1?"":"s",f=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${R} argument${A} but got ${D.length}.`;this.error(f,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],R="";if(this._showSuggestionAfterError){let $=[];this.createHelp().visibleCommands(this).forEach((f)=>{if($.push(f.name()),f.alias())$.push(f.alias())}),R=B4(D,$)}let A=`error: unknown command '${D}'${R}`;this.error(A,{code:"commander.unknownCommand"})}version(D,R,A){if(D===void 0)return this._version;this._version=D,R=R||"-V, --version",A=A||"output the version number";let $=this.createOption(R,A);return this._versionOptionName=$.attributeName(),this._registerOption($),this.on("option:"+$.name(),()=>{this._outputConfiguration.writeOut(`${D}
|
|
24
|
-
`),this._exit(0,"commander.version",D)}),this}description(D,R){if(D===void 0&&R===void 0)return this._description;if(this._description=D,R)this._argsDescription=R;return this}summary(D){if(D===void 0)return this._summary;return this._summary=D,this}alias(D){if(D===void 0)return this._aliases[0];let R=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)R=this.commands[this.commands.length-1];if(D===R._name)throw Error("Command alias can't be the same as its name");let A=this.parent?._findCommand(D);if(A){let $=[A.name()].concat(A.aliases()).join("|");throw Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${$}'`)}return R._aliases.push(D),this}aliases(D){if(D===void 0)return this._aliases;return D.forEach((R)=>this.alias(R)),this}usage(D){if(D===void 0){if(this._usage)return this._usage;let R=this.registeredArguments.map((A)=>{return uJ(A)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?R:[]).join(" ")}return this._usage=D,this}name(D){if(D===void 0)return this._name;return this._name=D,this}helpGroup(D){if(D===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=D,this}commandsGroup(D){if(D===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=D,this}optionsGroup(D){if(D===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=D,this}_initOptionGroup(D){if(this._defaultOptionGroup&&!D.helpGroupHeading)D.helpGroup(this._defaultOptionGroup)}_initCommandGroup(D){if(this._defaultCommandGroup&&!D.helpGroup())D.helpGroup(this._defaultCommandGroup)}nameFromFilename(D){return this._name=s0.basename(D,s0.extname(D)),this}executableDir(D){if(D===void 0)return this._executableDir;return this._executableDir=D,this}helpInformation(D){let R=this.createHelp(),A=this._getOutputContext(D);R.prepareContext({error:A.error,helpWidth:A.helpWidth,outputHasColors:A.hasColors});let $=R.formatHelp(this,R);if(A.hasColors)return $;return this._outputConfiguration.stripColor($)}_getOutputContext(D){D=D||{};let R=!!D.error,A,$,f;if(R)A=(B)=>this._outputConfiguration.writeErr(B),$=this._outputConfiguration.getErrHasColors(),f=this._outputConfiguration.getErrHelpWidth();else A=(B)=>this._outputConfiguration.writeOut(B),$=this._outputConfiguration.getOutHasColors(),f=this._outputConfiguration.getOutHelpWidth();return{error:R,write:(B)=>{if(!$)B=this._outputConfiguration.stripColor(B);return A(B)},hasColors:$,helpWidth:f}}outputHelp(D){let R;if(typeof D==="function")R=D,D=void 0;let A=this._getOutputContext(D),$={error:A.error,write:A.write,command:this};this._getCommandAndAncestors().reverse().forEach((P)=>P.emit("beforeAllHelp",$)),this.emit("beforeHelp",$);let f=this.helpInformation({error:A.error});if(R){if(f=R(f),typeof f!=="string"&&!Buffer.isBuffer(f))throw Error("outputHelp callback must return a string or a Buffer")}if(A.write(f),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",$),this._getCommandAndAncestors().forEach((P)=>P.emit("afterAllHelp",$))}helpOption(D,R){if(typeof D==="boolean"){if(D){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(D??"-h, --help",R??"display help for command"),D||R)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(D){return this._helpOption=D,this._initOptionGroup(D),this}help(D){this.outputHelp(D);let R=Number(h.exitCode??0);if(R===0&&D&&typeof D!=="function"&&D.error)R=1;this._exit(R,"commander.help","(outputHelp)")}addHelpText(D,R){let A=["beforeAll","before","after","afterAll"];if(!A.includes(D))throw Error(`Unexpected value for position to addHelpText.
|
|
25
|
-
Expecting one of '${A.join("', '")}'`);let $=`${D}Help`;return this.on($,(f)=>{let P;if(typeof R==="function")P=R({error:f.error,command:f.command});else P=R;if(P)f.write(`${P}
|
|
26
|
-
`)}),this}_outputHelpIfRequested(D){let R=this._getHelpOption();if(R&&D.find(($)=>R.is($)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function G4(D){return D.map((R)=>{if(!R.startsWith("--inspect"))return R;let A,$="127.0.0.1",f="9229",P;if((P=R.match(/^(--inspect(-brk)?)$/))!==null)A=P[1];else if((P=R.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(A=P[1],/^\d+$/.test(P[3]))f=P[3];else $=P[3];else if((P=R.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)A=P[1],$=P[3],f=P[4];if(A&&f!=="0")return`${A}=${$}:${parseInt(f)+1}`;return R})}function f2(){if(h.env.NO_COLOR||h.env.FORCE_COLOR==="0"||h.env.FORCE_COLOR==="false")return!1;if(h.env.FORCE_COLOR||h.env.CLICOLOR_FORCE!==void 0)return!0;return}mJ.Command=P2;mJ.useColor=f2});var M4=q((vJ)=>{var{Argument:J4}=uA(),{Command:B2}=z4(),{CommanderError:pJ,InvalidArgumentError:H4}=XR(),{Help:hJ}=D2(),{Option:Z4}=R2();vJ.program=new B2;vJ.createCommand=(D)=>new B2(D);vJ.createOption=(D,R)=>new Z4(D,R);vJ.createArgument=(D,R)=>new J4(D,R);vJ.Command=B2;vJ.Option=Z4;vJ.Argument=J4;vJ.Help=hJ;vJ.CommanderError=pJ;vJ.InvalidArgumentError=H4;vJ.InvalidOptionArgumentError=H4});var mA=q((LN,z2)=>{var gA=process||{},O4=gA.argv||[],yA=gA.env||{},DH=!(!!yA.NO_COLOR||O4.includes("--no-color"))&&(!!yA.FORCE_COLOR||O4.includes("--color")||gA.platform==="win32"||(gA.stdout||{}).isTTY&&yA.TERM!=="dumb"||!!yA.CI),RH=(D,R,A=D)=>($)=>{let f=""+$,P=f.indexOf(R,D.length);return~P?D+AH(f,R,A,P)+R:D+f+R},AH=(D,R,A,$)=>{let f="",P=0;do f+=D.substring(P,$)+A,P=$+R.length,$=D.indexOf(R,P);while(~$);return f+D.substring(P)},Q4=(D=DH)=>{let R=D?RH:()=>String;return{isColorSupported:D,reset:R("\x1B[0m","\x1B[0m"),bold:R("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:R("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:R("\x1B[3m","\x1B[23m"),underline:R("\x1B[4m","\x1B[24m"),inverse:R("\x1B[7m","\x1B[27m"),hidden:R("\x1B[8m","\x1B[28m"),strikethrough:R("\x1B[9m","\x1B[29m"),black:R("\x1B[30m","\x1B[39m"),red:R("\x1B[31m","\x1B[39m"),green:R("\x1B[32m","\x1B[39m"),yellow:R("\x1B[33m","\x1B[39m"),blue:R("\x1B[34m","\x1B[39m"),magenta:R("\x1B[35m","\x1B[39m"),cyan:R("\x1B[36m","\x1B[39m"),white:R("\x1B[37m","\x1B[39m"),gray:R("\x1B[90m","\x1B[39m"),bgBlack:R("\x1B[40m","\x1B[49m"),bgRed:R("\x1B[41m","\x1B[49m"),bgGreen:R("\x1B[42m","\x1B[49m"),bgYellow:R("\x1B[43m","\x1B[49m"),bgBlue:R("\x1B[44m","\x1B[49m"),bgMagenta:R("\x1B[45m","\x1B[49m"),bgCyan:R("\x1B[46m","\x1B[49m"),bgWhite:R("\x1B[47m","\x1B[49m"),blackBright:R("\x1B[90m","\x1B[39m"),redBright:R("\x1B[91m","\x1B[39m"),greenBright:R("\x1B[92m","\x1B[39m"),yellowBright:R("\x1B[93m","\x1B[39m"),blueBright:R("\x1B[94m","\x1B[39m"),magentaBright:R("\x1B[95m","\x1B[39m"),cyanBright:R("\x1B[96m","\x1B[39m"),whiteBright:R("\x1B[97m","\x1B[39m"),bgBlackBright:R("\x1B[100m","\x1B[49m"),bgRedBright:R("\x1B[101m","\x1B[49m"),bgGreenBright:R("\x1B[102m","\x1B[49m"),bgYellowBright:R("\x1B[103m","\x1B[49m"),bgBlueBright:R("\x1B[104m","\x1B[49m"),bgMagentaBright:R("\x1B[105m","\x1B[49m"),bgCyanBright:R("\x1B[106m","\x1B[49m"),bgWhiteBright:R("\x1B[107m","\x1B[49m")}};z2.exports=Q4();z2.exports.createColors=Q4});var p4=q((IV,n4)=>{n4.exports=wH;function qH(D){let R={defaultWidth:0,output:process.stdout,tty:p("tty")};if(!D)return R;return Object.keys(R).forEach(function(A){if(!D[A])D[A]=R[A]}),D}function wH(D){let R=qH(D);if(R.output.getWindowSize)return R.output.getWindowSize()[0]||R.defaultWidth;if(R.tty.getWindowSize)return R.tty.getWindowSize()[1]||R.defaultWidth;if(R.output.columns)return R.output.columns;if(process.env.CLI_WIDTH){let A=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(A)&&A!==0)return A}return R.defaultWidth}});var P9=q((hV,f9)=>{var mH=p("stream");class $9 extends mH{#D=null;constructor(D={}){super(D);this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=D.replace,this._prompt=D.prompt||null,this._hadControl=!1}#A(D,R){if(this._dest)return this._dest[D];if(this._src)return this._src[D];return R}#R(D,...R){if(typeof this._dest?.[D]==="function")this._dest[D](...R);if(typeof this._src?.[D]==="function")this._src[D](...R)}get isTTY(){if(this.#D!==null)return this.#D;return this.#A("isTTY",!1)}set isTTY(D){this.#D=D}get rows(){return this.#A("rows")}get columns(){return this.#A("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(D){this._src=D}pipe(D,R){return this._dest=D,super.pipe(D,R)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(D){if(this.muted){if(!this.replace)return!0;if(D.match(/^\u001b/)){if(D.indexOf(this._prompt)===0)D=D.slice(this._prompt.length),D=D.replace(/./g,this.replace),D=this._prompt+D;return this._hadControl=!0,this.emit("data",D)}else{if(this._prompt&&this._hadControl&&D.indexOf(this._prompt)===0)this._hadControl=!1,this.emit("data",this._prompt),D=D.slice(this._prompt.length);D=D.toString().replace(/./g,this.replace)}}this.emit("data",D)}end(D){if(this.muted)if(D&&this.replace)D=D.toString().replace(/./g,this.replace);else D=null;if(D)this.emit("data",D);this.emit("end")}destroy(...D){return this.#R("destroy",...D)}destroySoon(...D){return this.#R("destroySoon",...D)}close(...D){return this.#R("close",...D)}}f9.exports=$9});var m=q((BZ)=>{var A3=Symbol.for("yaml.alias"),U9=Symbol.for("yaml.document"),D$=Symbol.for("yaml.map"),F9=Symbol.for("yaml.pair"),$3=Symbol.for("yaml.scalar"),R$=Symbol.for("yaml.seq"),fD=Symbol.for("yaml.node.type"),eH=(D)=>!!D&&typeof D==="object"&&D[fD]===A3,DZ=(D)=>!!D&&typeof D==="object"&&D[fD]===U9,RZ=(D)=>!!D&&typeof D==="object"&&D[fD]===D$,AZ=(D)=>!!D&&typeof D==="object"&&D[fD]===F9,q9=(D)=>!!D&&typeof D==="object"&&D[fD]===$3,$Z=(D)=>!!D&&typeof D==="object"&&D[fD]===R$;function w9(D){if(D&&typeof D==="object")switch(D[fD]){case D$:case R$:return!0}return!1}function fZ(D){if(D&&typeof D==="object")switch(D[fD]){case A3:case D$:case $3:case R$:return!0}return!1}var PZ=(D)=>(q9(D)||w9(D))&&!!D.anchor;BZ.ALIAS=A3;BZ.DOC=U9;BZ.MAP=D$;BZ.NODE_TYPE=fD;BZ.PAIR=F9;BZ.SCALAR=$3;BZ.SEQ=R$;BZ.hasAnchor=PZ;BZ.isAlias=eH;BZ.isCollection=w9;BZ.isDocument=DZ;BZ.isMap=RZ;BZ.isNode=fZ;BZ.isPair=AZ;BZ.isScalar=q9;BZ.isSeq=$Z});var WR=q((CZ)=>{var t=m(),Z0=Symbol("break visit"),C9=Symbol("skip children"),x0=Symbol("remove node");function A$(D,R){let A=L9(R);if(t.isDocument(D)){if(W1(null,D.contents,A,Object.freeze([D]))===x0)D.contents=null}else W1(null,D,A,Object.freeze([]))}A$.BREAK=Z0;A$.SKIP=C9;A$.REMOVE=x0;function W1(D,R,A,$){let f=N9(D,R,A,$);if(t.isNode(f)||t.isPair(f))return V9(D,$,f),W1(D,f,A,$);if(typeof f!=="symbol"){if(t.isCollection(R)){$=Object.freeze($.concat(R));for(let P=0;P<R.items.length;++P){let B=W1(P,R.items[P],A,$);if(typeof B==="number")P=B-1;else if(B===Z0)return Z0;else if(B===x0)R.items.splice(P,1),P-=1}}else if(t.isPair(R)){$=Object.freeze($.concat(R));let P=W1("key",R.key,A,$);if(P===Z0)return Z0;else if(P===x0)R.key=null;let B=W1("value",R.value,A,$);if(B===Z0)return Z0;else if(B===x0)R.value=null}}return f}async function $$(D,R){let A=L9(R);if(t.isDocument(D)){if(await j1(null,D.contents,A,Object.freeze([D]))===x0)D.contents=null}else await j1(null,D,A,Object.freeze([]))}$$.BREAK=Z0;$$.SKIP=C9;$$.REMOVE=x0;async function j1(D,R,A,$){let f=await N9(D,R,A,$);if(t.isNode(f)||t.isPair(f))return V9(D,$,f),j1(D,f,A,$);if(typeof f!=="symbol"){if(t.isCollection(R)){$=Object.freeze($.concat(R));for(let P=0;P<R.items.length;++P){let B=await j1(P,R.items[P],A,$);if(typeof B==="number")P=B-1;else if(B===Z0)return Z0;else if(B===x0)R.items.splice(P,1),P-=1}}else if(t.isPair(R)){$=Object.freeze($.concat(R));let P=await j1("key",R.key,A,$);if(P===Z0)return Z0;else if(P===x0)R.key=null;let B=await j1("value",R.value,A,$);if(B===Z0)return Z0;else if(B===x0)R.value=null}}return f}function L9(D){if(typeof D==="object"&&(D.Collection||D.Node||D.Value))return Object.assign({Alias:D.Node,Map:D.Node,Scalar:D.Node,Seq:D.Node},D.Value&&{Map:D.Value,Scalar:D.Value,Seq:D.Value},D.Collection&&{Map:D.Collection,Seq:D.Collection},D);return D}function N9(D,R,A,$){if(typeof A==="function")return A(D,R,$);if(t.isMap(R))return A.Map?.(D,R,$);if(t.isSeq(R))return A.Seq?.(D,R,$);if(t.isPair(R))return A.Pair?.(D,R,$);if(t.isScalar(R))return A.Scalar?.(D,R,$);if(t.isAlias(R))return A.Alias?.(D,R,$);return}function V9(D,R,A){let $=R[R.length-1];if(t.isCollection($))$.items[D]=A;else if(t.isPair($))if(D==="key")$.key=A;else $.value=A;else if(t.isDocument($))$.contents=A;else{let f=t.isAlias($)?"alias":"scalar";throw Error(`Cannot replace node with ${f} parent`)}}CZ.visit=A$;CZ.visitAsync=$$});var f3=q((WZ)=>{var I9=m(),VZ=WR(),IZ={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},KZ=(D)=>D.replace(/[!,[\]{}]/g,(R)=>IZ[R]);class U0{constructor(D,R){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},U0.defaultYaml,D),this.tags=Object.assign({},U0.defaultTags,R)}clone(){let D=new U0(this.yaml,this.tags);return D.docStart=this.docStart,D}atDocument(){let D=new U0(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:U0.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},U0.defaultTags);break}return D}add(D,R){if(this.atNextDocument)this.yaml={explicit:U0.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},U0.defaultTags),this.atNextDocument=!1;let A=D.trim().split(/[ \t]+/),$=A.shift();switch($){case"%TAG":{if(A.length!==2){if(R(0,"%TAG directive should contain exactly two parts"),A.length<2)return!1}let[f,P]=A;return this.tags[f]=P,!0}case"%YAML":{if(this.yaml.explicit=!0,A.length!==1)return R(0,"%YAML directive should contain exactly one part"),!1;let[f]=A;if(f==="1.1"||f==="1.2")return this.yaml.version=f,!0;else{let P=/^\d+\.\d+$/.test(f);return R(6,`Unsupported YAML version ${f}`,P),!1}}default:return R(0,`Unknown directive ${$}`,!0),!1}}tagName(D,R){if(D==="!")return"!";if(D[0]!=="!")return R(`Not a valid tag: ${D}`),null;if(D[1]==="<"){let P=D.slice(2,-1);if(P==="!"||P==="!!")return R(`Verbatim tags aren't resolved, so ${D} is invalid.`),null;if(D[D.length-1]!==">")R("Verbatim tags must end with a >");return P}let[,A,$]=D.match(/^(.*!)([^!]*)$/s);if(!$)R(`The ${D} tag has no suffix`);let f=this.tags[A];if(f)try{return f+decodeURIComponent($)}catch(P){return R(String(P)),null}if(A==="!")return D;return R(`Could not resolve tag: ${D}`),null}tagString(D){for(let[R,A]of Object.entries(this.tags))if(D.startsWith(A))return R+KZ(D.substring(A.length));return D[0]==="!"?D:`!<${D}>`}toString(D){let R=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],A=Object.entries(this.tags),$;if(D&&A.length>0&&I9.isNode(D.contents)){let f={};VZ.visit(D.contents,(P,B)=>{if(I9.isNode(B)&&B.tag)f[B.tag]=!0}),$=Object.keys(f)}else $=[];for(let[f,P]of A){if(f==="!!"&&P==="tag:yaml.org,2002:")continue;if(!D||$.some((B)=>B.startsWith(P)))R.push(`%TAG ${f} ${P}`)}return R.join(`
|
|
27
|
-
`)}}U0.defaultYaml={explicit:!1,version:"1.2"};U0.defaultTags={"!!":"tag:yaml.org,2002:"};WZ.Directives=U0});var f$=q((EZ)=>{var K9=m(),SZ=WR();function bZ(D){if(/[\x00-\x19\s,[\]{}]/.test(D)){let A=`Anchor must not contain whitespace or control characters: ${JSON.stringify(D)}`;throw Error(A)}return!0}function W9(D){let R=new Set;return SZ.visit(D,{Value(A,$){if($.anchor)R.add($.anchor)}}),R}function j9(D,R){for(let A=1;;++A){let $=`${D}${A}`;if(!R.has($))return $}}function uZ(D,R){let A=[],$=new Map,f=null;return{onAnchor:(P)=>{A.push(P),f??(f=W9(D));let B=j9(R,f);return f.add(B),B},setAnchors:()=>{for(let P of A){let B=$.get(P);if(typeof B==="object"&&B.anchor&&(K9.isScalar(B.node)||K9.isCollection(B.node)))B.node.anchor=B.anchor;else{let G=Error("Failed to resolve repeated object (this should not happen)");throw G.source=P,G}}},sourceObjects:$}}EZ.anchorIsValid=bZ;EZ.anchorNames=W9;EZ.createNodeAnchors=uZ;EZ.findNewAnchor=j9});var P3=q((nZ)=>{function jR(D,R,A,$){if($&&typeof $==="object")if(Array.isArray($))for(let f=0,P=$.length;f<P;++f){let B=$[f],G=jR(D,$,String(f),B);if(G===void 0)delete $[f];else if(G!==B)$[f]=G}else if($ instanceof Map)for(let f of Array.from($.keys())){let P=$.get(f),B=jR(D,$,f,P);if(B===void 0)$.delete(f);else if(B!==P)$.set(f,B)}else if($ instanceof Set)for(let f of Array.from($)){let P=jR(D,$,f,f);if(P===void 0)$.delete(f);else if(P!==f)$.delete(f),$.add(P)}else for(let[f,P]of Object.entries($)){let B=jR(D,$,f,P);if(B===void 0)delete $[f];else if(B!==P)$[f]=B}return D.call(R,A,$)}nZ.applyReviver=jR});var FD=q((vZ)=>{var hZ=m();function S9(D,R,A){if(Array.isArray(D))return D.map(($,f)=>S9($,String(f),A));if(D&&typeof D.toJSON==="function"){if(!A||!hZ.hasAnchor(D))return D.toJSON(R,A);let $={aliasCount:0,count:1,res:void 0};A.anchors.set(D,$),A.onCreate=(P)=>{$.res=P,delete A.onCreate};let f=D.toJSON(R,A);if(A.onCreate)A.onCreate(f);return f}if(typeof D==="bigint"&&!A?.keep)return Number(D);return D}vZ.toJS=S9});var P$=q((iZ)=>{var dZ=P3(),b9=m(),kZ=FD();class u9{constructor(D){Object.defineProperty(this,b9.NODE_TYPE,{value:D})}clone(){let D=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)D.range=this.range.slice();return D}toJS(D,{mapAsMap:R,maxAliasCount:A,onAnchor:$,reviver:f}={}){if(!b9.isDocument(D))throw TypeError("A document argument is required");let P={anchors:new Map,doc:D,keep:!0,mapAsMap:R===!0,mapKeyWarned:!1,maxAliasCount:typeof A==="number"?A:100},B=kZ.toJS(this,"",P);if(typeof $==="function")for(let{count:G,res:z}of P.anchors.values())$(z,G);return typeof f==="function"?dZ.applyReviver(f,{"":B},"",B):B}}iZ.NodeBase=u9});var SR=q((tZ)=>{var rZ=f$(),sZ=WR(),S1=m(),oZ=P$(),cZ=FD();class E9 extends oZ.NodeBase{constructor(D){super(S1.ALIAS);this.source=D,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(D,R){let A;if(R?.aliasResolveCache)A=R.aliasResolveCache;else if(A=[],sZ.visit(D,{Node:(f,P)=>{if(S1.isAlias(P)||S1.hasAnchor(P))A.push(P)}}),R)R.aliasResolveCache=A;let $=void 0;for(let f of A){if(f===this)break;if(f.anchor===this.source)$=f}return $}toJSON(D,R){if(!R)return{source:this.source};let{anchors:A,doc:$,maxAliasCount:f}=R,P=this.resolve($,R);if(!P){let G=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(G)}let B=A.get(P);if(!B)cZ.toJS(P,null,R),B=A.get(P);if(B?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(f>=0){if(B.count+=1,B.aliasCount===0)B.aliasCount=B$($,P,A);if(B.count*B.aliasCount>f)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return B.res}toString(D,R,A){let $=`*${this.source}`;if(D){if(rZ.anchorIsValid(this.source),D.options.verifyAliasOrder&&!D.anchors.has(this.source)){let f=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(f)}if(D.implicitKey)return`${$} `}return $}}function B$(D,R,A){if(S1.isAlias(R)){let $=R.resolve(D),f=A&&$&&A.get($);return f?f.count*f.aliasCount:0}else if(S1.isCollection(R)){let $=0;for(let f of R.items){let P=B$(D,f,A);if(P>$)$=P}return $}else if(S1.isPair(R)){let $=B$(D,R.key,A),f=B$(D,R.value,A);return Math.max($,f)}return 1}tZ.Alias=E9});var o=q((fM)=>{var DM=m(),RM=P$(),AM=FD(),$M=(D)=>!D||typeof D!=="function"&&typeof D!=="object";class tD extends RM.NodeBase{constructor(D){super(DM.SCALAR);this.value=D}toJSON(D,R){return R?.keep?this.value:AM.toJS(this.value,D,R)}toString(){return String(this.value)}}tD.BLOCK_FOLDED="BLOCK_FOLDED";tD.BLOCK_LITERAL="BLOCK_LITERAL";tD.PLAIN="PLAIN";tD.QUOTE_DOUBLE="QUOTE_DOUBLE";tD.QUOTE_SINGLE="QUOTE_SINGLE";fM.Scalar=tD;fM.isScalarValue=$M});var bR=q((ZM)=>{var GM=SR(),eD=m(),y9=o(),zM="tag:yaml.org,2002:";function JM(D,R,A){if(R){let $=A.filter((P)=>P.tag===R),f=$.find((P)=>!P.format)??$[0];if(!f)throw Error(`Tag ${R} not found`);return f}return A.find(($)=>$.identify?.(D)&&!$.format)}function HM(D,R,A){if(eD.isDocument(D))D=D.contents;if(eD.isNode(D))return D;if(eD.isPair(D)){let H=A.schema[eD.MAP].createNode?.(A.schema,null,A);return H.items.push(D),H}if(D instanceof String||D instanceof Number||D instanceof Boolean||typeof BigInt<"u"&&D instanceof BigInt)D=D.valueOf();let{aliasDuplicateObjects:$,onAnchor:f,onTagObj:P,schema:B,sourceObjects:G}=A,z=void 0;if($&&D&&typeof D==="object")if(z=G.get(D),z)return z.anchor??(z.anchor=f(D)),new GM.Alias(z.anchor);else z={anchor:null,node:null},G.set(D,z);if(R?.startsWith("!!"))R=zM+R.slice(2);let J=JM(D,R,B.tags);if(!J){if(D&&typeof D.toJSON==="function")D=D.toJSON();if(!D||typeof D!=="object"){let H=new y9.Scalar(D);if(z)z.node=H;return H}J=D instanceof Map?B[eD.MAP]:(Symbol.iterator in Object(D))?B[eD.SEQ]:B[eD.MAP]}if(P)P(J),delete A.onTagObj;let Z=J?.createNode?J.createNode(A.schema,D,A):typeof J?.nodeClass?.from==="function"?J.nodeClass.from(A.schema,D,A):new y9.Scalar(D);if(R)Z.tag=R;else if(!J.default)Z.tag=J.tag;if(z)z.node=Z;return Z}ZM.createNode=HM});var G$=q((OM)=>{var XM=bR(),n0=m(),TM=P$();function B3(D,R,A){let $=A;for(let f=R.length-1;f>=0;--f){let P=R[f];if(typeof P==="number"&&Number.isInteger(P)&&P>=0){let B=[];B[P]=$,$=B}else $=new Map([[P,$]])}return XM.createNode($,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:D,sourceObjects:new Map})}var g9=(D)=>D==null||typeof D==="object"&&!!D[Symbol.iterator]().next().done;class m9 extends TM.NodeBase{constructor(D,R){super(D);Object.defineProperty(this,"schema",{value:R,configurable:!0,enumerable:!1,writable:!0})}clone(D){let R=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(D)R.schema=D;if(R.items=R.items.map((A)=>n0.isNode(A)||n0.isPair(A)?A.clone(D):A),this.range)R.range=this.range.slice();return R}addIn(D,R){if(g9(D))this.add(R);else{let[A,...$]=D,f=this.get(A,!0);if(n0.isCollection(f))f.addIn($,R);else if(f===void 0&&this.schema)this.set(A,B3(this.schema,$,R));else throw Error(`Expected YAML collection at ${A}. Remaining path: ${$}`)}}deleteIn(D){let[R,...A]=D;if(A.length===0)return this.delete(R);let $=this.get(R,!0);if(n0.isCollection($))return $.deleteIn(A);else throw Error(`Expected YAML collection at ${R}. Remaining path: ${A}`)}getIn(D,R){let[A,...$]=D,f=this.get(A,!0);if($.length===0)return!R&&n0.isScalar(f)?f.value:f;else return n0.isCollection(f)?f.getIn($,R):void 0}hasAllNullValues(D){return this.items.every((R)=>{if(!n0.isPair(R))return!1;let A=R.value;return A==null||D&&n0.isScalar(A)&&A.value==null&&!A.commentBefore&&!A.comment&&!A.tag})}hasIn(D){let[R,...A]=D;if(A.length===0)return this.has(R);let $=this.get(R,!0);return n0.isCollection($)?$.hasIn(A):!1}setIn(D,R){let[A,...$]=D;if($.length===0)this.set(A,R);else{let f=this.get(A,!0);if(n0.isCollection(f))f.setIn($,R);else if(f===void 0&&this.schema)this.set(A,B3(this.schema,$,R));else throw Error(`Expected YAML collection at ${A}. Remaining path: ${$}`)}}}OM.Collection=m9;OM.collectionFromPath=B3;OM.isEmptyPath=g9});var uR=q((qM)=>{var UM=(D)=>D.replace(/^(?!$)(?: $)?/gm,"#");function G3(D,R){if(/^\n+$/.test(D))return D.substring(1);return R?D.replace(/^(?! *$)/gm,R):D}var FM=(D,R,A)=>D.endsWith(`
|
|
28
|
-
`)?G3(A,R):A.includes(`
|
|
29
|
-
`)?`
|
|
30
|
-
`+G3(A,R):(D.endsWith(" ")?"":" ")+A;qM.indentComment=G3;qM.lineComment=FM;qM.stringifyComment=UM});var n9=q((VM)=>{function NM(D,R,A="flow",{indentAtStart:$,lineWidth:f=80,minContentWidth:P=20,onFold:B,onOverflow:G}={}){if(!f||f<0)return D;if(f<P)P=0;let z=Math.max(1+P,1+f-R.length);if(D.length<=z)return D;let J=[],Z={},H=f-R.length;if(typeof $==="number")if($>f-Math.max(2,P))J.push(0);else H=f-$;let M=void 0,T=void 0,Q=!1,X=-1,O=-1,U=-1;if(A==="block"){if(X=x9(D,X,R.length),X!==-1)H=X+z}for(let w;w=D[X+=1];){if(A==="quoted"&&w==="\\"){switch(O=X,D[X+1]){case"x":X+=3;break;case"u":X+=5;break;case"U":X+=9;break;default:X+=1}U=X}if(w===`
|
|
31
|
-
`){if(A==="block")X=x9(D,X,R.length);H=X+R.length+z,M=void 0}else{if(w===" "&&T&&T!==" "&&T!==`
|
|
32
|
-
`&&T!=="\t"){let V=D[X+1];if(V&&V!==" "&&V!==`
|
|
33
|
-
`&&V!=="\t")M=X}if(X>=H)if(M)J.push(M),H=M+z,M=void 0;else if(A==="quoted"){while(T===" "||T==="\t")T=w,w=D[X+=1],Q=!0;let V=X>U+1?X-2:O-1;if(Z[V])return D;J.push(V),Z[V]=!0,H=V+z,M=void 0}else Q=!0}T=w}if(Q&&G)G();if(J.length===0)return D;if(B)B();let F=D.slice(0,J[0]);for(let w=0;w<J.length;++w){let V=J[w],I=J[w+1]||D.length;if(V===0)F=`
|
|
34
|
-
${R}${D.slice(0,I)}`;else{if(A==="quoted"&&Z[V])F+=`${D[V]}\\`;F+=`
|
|
35
|
-
${R}${D.slice(V+1,I)}`}}return F}function x9(D,R,A){let $=R,f=R+1,P=D[f];while(P===" "||P==="\t")if(R<f+A)P=D[++R];else{do P=D[++R];while(P&&P!==`
|
|
36
|
-
`);$=R,f=R+1,P=D[f]}return $}VM.FOLD_BLOCK="block";VM.FOLD_FLOW="flow";VM.FOLD_QUOTED="quoted";VM.foldFlowLines=NM});var yR=q((EM)=>{var K0=o(),qD=n9(),J$=(D,R)=>({indentAtStart:R?D.indent.length:D.indentAtStart,lineWidth:D.options.lineWidth,minContentWidth:D.options.minContentWidth}),H$=(D)=>/^(%|---|\.\.\.)/m.test(D);function SM(D,R,A){if(!R||R<0)return!1;let $=R-A,f=D.length;if(f<=$)return!1;for(let P=0,B=0;P<f;++P)if(D[P]===`
|
|
37
|
-
`){if(P-B>$)return!0;if(B=P+1,f-B<=$)return!1}return!0}function ER(D,R){let A=JSON.stringify(D);if(R.options.doubleQuotedAsJSON)return A;let{implicitKey:$}=R,f=R.options.doubleQuotedMinMultiLineLength,P=R.indent||(H$(D)?" ":""),B="",G=0;for(let z=0,J=A[z];J;J=A[++z]){if(J===" "&&A[z+1]==="\\"&&A[z+2]==="n")B+=A.slice(G,z)+"\\ ",z+=1,G=z,J="\\";if(J==="\\")switch(A[z+1]){case"u":{B+=A.slice(G,z);let Z=A.substr(z+2,4);switch(Z){case"0000":B+="\\0";break;case"0007":B+="\\a";break;case"000b":B+="\\v";break;case"001b":B+="\\e";break;case"0085":B+="\\N";break;case"00a0":B+="\\_";break;case"2028":B+="\\L";break;case"2029":B+="\\P";break;default:if(Z.substr(0,2)==="00")B+="\\x"+Z.substr(2);else B+=A.substr(z,6)}z+=5,G=z+1}break;case"n":if($||A[z+2]==='"'||A.length<f)z+=1;else{B+=A.slice(G,z)+`
|
|
38
|
-
|
|
39
|
-
`;while(A[z+2]==="\\"&&A[z+3]==="n"&&A[z+4]!=='"')B+=`
|
|
40
|
-
`,z+=2;if(B+=P,A[z+2]===" ")B+="\\";z+=1,G=z+1}break;default:z+=1}}return B=G?B+A.slice(G):A,$?B:qD.foldFlowLines(B,P,qD.FOLD_QUOTED,J$(R,!1))}function z3(D,R){if(R.options.singleQuote===!1||R.implicitKey&&D.includes(`
|
|
41
|
-
`)||/[ \t]\n|\n[ \t]/.test(D))return ER(D,R);let A=R.indent||(H$(D)?" ":""),$="'"+D.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
42
|
-
${A}`)+"'";return R.implicitKey?$:qD.foldFlowLines($,A,qD.FOLD_FLOW,J$(R,!1))}function b1(D,R){let{singleQuote:A}=R.options,$;if(A===!1)$=ER;else{let f=D.includes('"'),P=D.includes("'");if(f&&!P)$=z3;else if(P&&!f)$=ER;else $=A?z3:ER}return $(D,R)}var J3;try{J3=new RegExp(`(^|(?<!
|
|
43
|
-
))
|
|
44
|
-
+(?!
|
|
45
|
-
|$)`,"g")}catch{J3=/\n+(?!\n|$)/g}function z$({comment:D,type:R,value:A},$,f,P){let{blockQuote:B,commentString:G,lineWidth:z}=$.options;if(!B||/\n[\t ]+$/.test(A))return b1(A,$);let J=$.indent||($.forceBlockIndent||H$(A)?" ":""),Z=B==="literal"?!0:B==="folded"||R===K0.Scalar.BLOCK_FOLDED?!1:R===K0.Scalar.BLOCK_LITERAL?!0:!SM(A,z,J.length);if(!A)return Z?`|
|
|
46
|
-
`:`>
|
|
47
|
-
`;let H,M;for(M=A.length;M>0;--M){let I=A[M-1];if(I!==`
|
|
48
|
-
`&&I!=="\t"&&I!==" ")break}let T=A.substring(M),Q=T.indexOf(`
|
|
49
|
-
`);if(Q===-1)H="-";else if(A===T||Q!==T.length-1){if(H="+",P)P()}else H="";if(T){if(A=A.slice(0,-T.length),T[T.length-1]===`
|
|
50
|
-
`)T=T.slice(0,-1);T=T.replace(J3,`$&${J}`)}let X=!1,O,U=-1;for(O=0;O<A.length;++O){let I=A[O];if(I===" ")X=!0;else if(I===`
|
|
51
|
-
`)U=O;else break}let F=A.substring(0,U<O?U+1:O);if(F)A=A.substring(F.length),F=F.replace(/\n+/g,`$&${J}`);let V=(X?J?"2":"1":"")+H;if(D){if(V+=" "+G(D.replace(/ ?[\r\n]+/g," ")),f)f()}if(!Z){let I=A.replace(/\n+/g,`
|
|
52
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${J}`),j=!1,u=J$($,!0);if(B!=="folded"&&R!==K0.Scalar.BLOCK_FOLDED)u.onOverflow=()=>{j=!0};let L=qD.foldFlowLines(`${F}${I}${T}`,J,qD.FOLD_BLOCK,u);if(!j)return`>${V}
|
|
53
|
-
${J}${L}`}return A=A.replace(/\n+/g,`$&${J}`),`|${V}
|
|
54
|
-
${J}${F}${A}${T}`}function bM(D,R,A,$){let{type:f,value:P}=D,{actualString:B,implicitKey:G,indent:z,indentStep:J,inFlow:Z}=R;if(G&&P.includes(`
|
|
55
|
-
`)||Z&&/[[\]{},]/.test(P))return b1(P,R);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(P))return G||Z||!P.includes(`
|
|
56
|
-
`)?b1(P,R):z$(D,R,A,$);if(!G&&!Z&&f!==K0.Scalar.PLAIN&&P.includes(`
|
|
57
|
-
`))return z$(D,R,A,$);if(H$(P)){if(z==="")return R.forceBlockIndent=!0,z$(D,R,A,$);else if(G&&z===J)return b1(P,R)}let H=P.replace(/\n+/g,`$&
|
|
58
|
-
${z}`);if(B){let M=(X)=>X.default&&X.tag!=="tag:yaml.org,2002:str"&&X.test?.test(H),{compat:T,tags:Q}=R.doc.schema;if(Q.some(M)||T?.some(M))return b1(P,R)}return G?H:qD.foldFlowLines(H,z,qD.FOLD_FLOW,J$(R,!1))}function uM(D,R,A,$){let{implicitKey:f,inFlow:P}=R,B=typeof D.value==="string"?D:Object.assign({},D,{value:String(D.value)}),{type:G}=D;if(G!==K0.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(B.value))G=K0.Scalar.QUOTE_DOUBLE}let z=(Z)=>{switch(Z){case K0.Scalar.BLOCK_FOLDED:case K0.Scalar.BLOCK_LITERAL:return f||P?b1(B.value,R):z$(B,R,A,$);case K0.Scalar.QUOTE_DOUBLE:return ER(B.value,R);case K0.Scalar.QUOTE_SINGLE:return z3(B.value,R);case K0.Scalar.PLAIN:return bM(B,R,A,$);default:return null}},J=z(G);if(J===null){let{defaultKeyType:Z,defaultStringType:H}=R.options,M=f&&Z||H;if(J=z(M),J===null)throw Error(`Unsupported default string type ${M}`)}return J}EM.stringifyString=uM});var gR=q((lM)=>{var gM=f$(),wD=m(),mM=uR(),xM=yR();function nM(D,R){let A=Object.assign({blockQuote:!0,commentString:mM.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},D.schema.toStringOptions,R),$;switch(A.collectionStyle){case"block":$=!1;break;case"flow":$=!0;break;default:$=null}return{anchors:new Set,doc:D,flowCollectionPadding:A.flowCollectionPadding?" ":"",indent:"",indentStep:typeof A.indent==="number"?" ".repeat(A.indent):" ",inFlow:$,options:A}}function pM(D,R){if(R.tag){let f=D.filter((P)=>P.tag===R.tag);if(f.length>0)return f.find((P)=>P.format===R.format)??f[0]}let A=void 0,$;if(wD.isScalar(R)){$=R.value;let f=D.filter((P)=>P.identify?.($));if(f.length>1){let P=f.filter((B)=>B.test);if(P.length>0)f=P}A=f.find((P)=>P.format===R.format)??f.find((P)=>!P.format)}else $=R,A=D.find((f)=>f.nodeClass&&$ instanceof f.nodeClass);if(!A){let f=$?.constructor?.name??($===null?"null":typeof $);throw Error(`Tag not resolved for ${f} value`)}return A}function hM(D,R,{anchors:A,doc:$}){if(!$.directives)return"";let f=[],P=(wD.isScalar(D)||wD.isCollection(D))&&D.anchor;if(P&&gM.anchorIsValid(P))A.add(P),f.push(`&${P}`);let B=D.tag??(R.default?null:R.tag);if(B)f.push($.directives.tagString(B));return f.join(" ")}function vM(D,R,A,$){if(wD.isPair(D))return D.toString(R,A,$);if(wD.isAlias(D)){if(R.doc.directives)return D.toString(R);if(R.resolvedAliases?.has(D))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(R.resolvedAliases)R.resolvedAliases.add(D);else R.resolvedAliases=new Set([D]);D=D.resolve(R.doc)}}let f=void 0,P=wD.isNode(D)?D:R.doc.createNode(D,{onTagObj:(z)=>f=z});f??(f=pM(R.doc.schema.tags,P));let B=hM(P,f,R);if(B.length>0)R.indentAtStart=(R.indentAtStart??0)+B.length+1;let G=typeof f.stringify==="function"?f.stringify(P,R,A,$):wD.isScalar(P)?xM.stringifyString(P,R,A,$):P.toString(R,A,$);if(!B)return G;return wD.isScalar(P)||G[0]==="{"||G[0]==="["?`${B} ${G}`:`${B}
|
|
59
|
-
${R.indent}${G}`}lM.createStringifyContext=nM;lM.stringify=vM});var v9=q((aM)=>{var PD=m(),p9=o(),h9=gR(),mR=uR();function iM({key:D,value:R},A,$,f){let{allNullValues:P,doc:B,indent:G,indentStep:z,options:{commentString:J,indentSeq:Z,simpleKeys:H}}=A,M=PD.isNode(D)&&D.comment||null;if(H){if(M)throw Error("With simple keys, key nodes cannot have comments");if(PD.isCollection(D)||!PD.isNode(D)&&typeof D==="object")throw Error("With simple keys, collection cannot be used as a key value")}let T=!H&&(!D||M&&R==null&&!A.inFlow||PD.isCollection(D)||(PD.isScalar(D)?D.type===p9.Scalar.BLOCK_FOLDED||D.type===p9.Scalar.BLOCK_LITERAL:typeof D==="object"));A=Object.assign({},A,{allNullValues:!1,implicitKey:!T&&(H||!P),indent:G+z});let Q=!1,X=!1,O=h9.stringify(D,A,()=>Q=!0,()=>X=!0);if(!T&&!A.inFlow&&O.length>1024){if(H)throw Error("With simple keys, single line scalar must not span more than 1024 characters");T=!0}if(A.inFlow){if(P||R==null){if(Q&&$)$();return O===""?"?":T?`? ${O}`:O}}else if(P&&!H||R==null&&T){if(O=`? ${O}`,M&&!Q)O+=mR.lineComment(O,A.indent,J(M));else if(X&&f)f();return O}if(Q)M=null;if(T){if(M)O+=mR.lineComment(O,A.indent,J(M));O=`? ${O}
|
|
60
|
-
${G}:`}else if(O=`${O}:`,M)O+=mR.lineComment(O,A.indent,J(M));let U,F,w;if(PD.isNode(R))U=!!R.spaceBefore,F=R.commentBefore,w=R.comment;else if(U=!1,F=null,w=null,R&&typeof R==="object")R=B.createNode(R);if(A.implicitKey=!1,!T&&!M&&PD.isScalar(R))A.indentAtStart=O.length+1;if(X=!1,!Z&&z.length>=2&&!A.inFlow&&!T&&PD.isSeq(R)&&!R.flow&&!R.tag&&!R.anchor)A.indent=A.indent.substring(2);let V=!1,I=h9.stringify(R,A,()=>V=!0,()=>X=!0),j=" ";if(M||U||F){if(j=U?`
|
|
61
|
-
`:"",F){let u=J(F);j+=`
|
|
62
|
-
${mR.indentComment(u,A.indent)}`}if(I===""&&!A.inFlow){if(j===`
|
|
63
|
-
`&&w)j=`
|
|
64
|
-
|
|
65
|
-
`}else j+=`
|
|
66
|
-
${A.indent}`}else if(!T&&PD.isCollection(R)){let u=I[0],L=I.indexOf(`
|
|
67
|
-
`),S=L!==-1,l=A.inFlow??R.flow??R.items.length===0;if(S||!l){let d=!1;if(S&&(u==="&"||u==="!")){let g=I.indexOf(" ");if(u==="&"&&g!==-1&&g<L&&I[g+1]==="!")g=I.indexOf(" ",g+1);if(g===-1||L<g)d=!0}if(!d)j=`
|
|
68
|
-
${A.indent}`}}else if(I===""||I[0]===`
|
|
69
|
-
`)j="";if(O+=j+I,A.inFlow){if(V&&$)$()}else if(w&&!V)O+=mR.lineComment(O,A.indent,J(w));else if(X&&f)f();return O}aM.stringifyPair=iM});var H3=q((cM)=>{var l9=p("process");function sM(D,...R){if(D==="debug")console.log(...R)}function oM(D,R){if(D==="debug"||D==="warn")if(typeof l9.emitWarning==="function")l9.emitWarning(R);else console.warn(R)}cM.debug=sM;cM.warn=oM});var X$=q((RX)=>{var xR=m(),d9=o(),Z$="<<",M$={identify:(D)=>D===Z$||typeof D==="symbol"&&D.description===Z$,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new d9.Scalar(Symbol(Z$)),{addToJSMap:k9}),stringify:()=>Z$},DX=(D,R)=>(M$.identify(R)||xR.isScalar(R)&&(!R.type||R.type===d9.Scalar.PLAIN)&&M$.identify(R.value))&&D?.doc.schema.tags.some((A)=>A.tag===M$.tag&&A.default);function k9(D,R,A){if(A=D&&xR.isAlias(A)?A.resolve(D.doc):A,xR.isSeq(A))for(let $ of A.items)Z3(D,R,$);else if(Array.isArray(A))for(let $ of A)Z3(D,R,$);else Z3(D,R,A)}function Z3(D,R,A){let $=D&&xR.isAlias(A)?A.resolve(D.doc):A;if(!xR.isMap($))throw Error("Merge sources must be maps or map aliases");let f=$.toJSON(null,D,Map);for(let[P,B]of f)if(R instanceof Map){if(!R.has(P))R.set(P,B)}else if(R instanceof Set)R.add(P);else if(!Object.prototype.hasOwnProperty.call(R,P))Object.defineProperty(R,P,{value:B,writable:!0,enumerable:!0,configurable:!0});return R}RX.addMergeToJSMap=k9;RX.isMergeKey=DX;RX.merge=M$});var X3=q((JX)=>{var PX=H3(),i9=X$(),BX=gR(),a9=m(),M3=FD();function GX(D,R,{key:A,value:$}){if(a9.isNode(A)&&A.addToJSMap)A.addToJSMap(D,R,$);else if(i9.isMergeKey(D,A))i9.addMergeToJSMap(D,R,$);else{let f=M3.toJS(A,"",D);if(R instanceof Map)R.set(f,M3.toJS($,f,D));else if(R instanceof Set)R.add(f);else{let P=zX(A,f,D),B=M3.toJS($,P,D);if(P in R)Object.defineProperty(R,P,{value:B,writable:!0,enumerable:!0,configurable:!0});else R[P]=B}}return R}function zX(D,R,A){if(R===null)return"";if(typeof R!=="object")return String(R);if(a9.isNode(D)&&A?.doc){let $=BX.createStringifyContext(A.doc,{});$.anchors=new Set;for(let P of A.anchors.keys())$.anchors.add(P.anchor);$.inFlow=!0,$.inStringifyKey=!0;let f=D.toString($);if(!A.mapKeyWarned){let P=JSON.stringify(f);if(P.length>40)P=P.substring(0,36)+'..."';PX.warn(A.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${P}. Set mapAsMap: true to use object keys.`),A.mapKeyWarned=!0}return f}return JSON.stringify(R)}JX.addPairToJSMap=GX});var CD=q((TX)=>{var r9=bR(),ZX=v9(),MX=X3(),T$=m();function XX(D,R,A){let $=r9.createNode(D,void 0,A),f=r9.createNode(R,void 0,A);return new O$($,f)}class O${constructor(D,R=null){Object.defineProperty(this,T$.NODE_TYPE,{value:T$.PAIR}),this.key=D,this.value=R}clone(D){let{key:R,value:A}=this;if(T$.isNode(R))R=R.clone(D);if(T$.isNode(A))A=A.clone(D);return new O$(R,A)}toJSON(D,R){let A=R?.mapAsMap?new Map:{};return MX.addPairToJSMap(R,A,this)}toString(D,R,A){return D?.doc?ZX.stringifyPair(this,D,R,A):JSON.stringify(this)}}TX.Pair=O$;TX.createPair=XX});var T3=q((FX)=>{var D1=m(),s9=gR(),Q$=uR();function YX(D,R,A){return(R.inFlow??D.flow?UX:_X)(D,R,A)}function _X({comment:D,items:R},A,{blockItemPrefix:$,flowChars:f,itemIndent:P,onChompKeep:B,onComment:G}){let{indent:z,options:{commentString:J}}=A,Z=Object.assign({},A,{indent:P,type:null}),H=!1,M=[];for(let Q=0;Q<R.length;++Q){let X=R[Q],O=null;if(D1.isNode(X)){if(!H&&X.spaceBefore)M.push("");if(Y$(A,M,X.commentBefore,H),X.comment)O=X.comment}else if(D1.isPair(X)){let F=D1.isNode(X.key)?X.key:null;if(F){if(!H&&F.spaceBefore)M.push("");Y$(A,M,F.commentBefore,H)}}H=!1;let U=s9.stringify(X,Z,()=>O=null,()=>H=!0);if(O)U+=Q$.lineComment(U,P,J(O));if(H&&O)H=!1;M.push($+U)}let T;if(M.length===0)T=f.start+f.end;else{T=M[0];for(let Q=1;Q<M.length;++Q){let X=M[Q];T+=X?`
|
|
70
|
-
${z}${X}`:`
|
|
71
|
-
`}}if(D){if(T+=`
|
|
72
|
-
`+Q$.indentComment(J(D),z),G)G()}else if(H&&B)B();return T}function UX({items:D},R,{flowChars:A,itemIndent:$}){let{indent:f,indentStep:P,flowCollectionPadding:B,options:{commentString:G}}=R;$+=P;let z=Object.assign({},R,{indent:$,inFlow:!0,type:null}),J=!1,Z=0,H=[];for(let Q=0;Q<D.length;++Q){let X=D[Q],O=null;if(D1.isNode(X)){if(X.spaceBefore)H.push("");if(Y$(R,H,X.commentBefore,!1),X.comment)O=X.comment}else if(D1.isPair(X)){let F=D1.isNode(X.key)?X.key:null;if(F){if(F.spaceBefore)H.push("");if(Y$(R,H,F.commentBefore,!1),F.comment)J=!0}let w=D1.isNode(X.value)?X.value:null;if(w){if(w.comment)O=w.comment;if(w.commentBefore)J=!0}else if(X.value==null&&F?.comment)O=F.comment}if(O)J=!0;let U=s9.stringify(X,z,()=>O=null);if(J||(J=H.length>Z||U.includes(`
|
|
73
|
-
`)),Q<D.length-1)U+=",";else if(R.options.trailingComma){if(R.options.lineWidth>0)J||(J=H.reduce((F,w)=>F+w.length+2,2)+(U.length+2)>R.options.lineWidth);if(J)U+=","}if(O)U+=Q$.lineComment(U,$,G(O));H.push(U),Z=H.length}let{start:M,end:T}=A;if(H.length===0)return M+T;else{if(!J){let Q=H.reduce((X,O)=>X+O.length+2,2);J=R.options.lineWidth>0&&Q>R.options.lineWidth}if(J){let Q=M;for(let X of H)Q+=X?`
|
|
74
|
-
${P}${f}${X}`:`
|
|
75
|
-
`;return`${Q}
|
|
76
|
-
${f}${T}`}else return`${M}${B}${H.join(" ")}${B}${T}`}}function Y$({indent:D,options:{commentString:R}},A,$,f){if($&&f)$=$.replace(/^\n+/,"");if($){let P=Q$.indentComment(R($),D);A.push(P.trimStart())}}FX.stringifyCollection=YX});var ND=q((VX)=>{var wX=T3(),CX=X3(),LX=G$(),LD=m(),_$=CD(),NX=o();function nR(D,R){let A=LD.isScalar(R)?R.value:R;for(let $ of D)if(LD.isPair($)){if($.key===R||$.key===A)return $;if(LD.isScalar($.key)&&$.key.value===A)return $}return}class o9 extends LX.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(D){super(LD.MAP,D);this.items=[]}static from(D,R,A){let{keepUndefined:$,replacer:f}=A,P=new this(D),B=(G,z)=>{if(typeof f==="function")z=f.call(R,G,z);else if(Array.isArray(f)&&!f.includes(G))return;if(z!==void 0||$)P.items.push(_$.createPair(G,z,A))};if(R instanceof Map)for(let[G,z]of R)B(G,z);else if(R&&typeof R==="object")for(let G of Object.keys(R))B(G,R[G]);if(typeof D.sortMapEntries==="function")P.items.sort(D.sortMapEntries);return P}add(D,R){let A;if(LD.isPair(D))A=D;else if(!D||typeof D!=="object"||!("key"in D))A=new _$.Pair(D,D?.value);else A=new _$.Pair(D.key,D.value);let $=nR(this.items,A.key),f=this.schema?.sortMapEntries;if($){if(!R)throw Error(`Key ${A.key} already set`);if(LD.isScalar($.value)&&NX.isScalarValue(A.value))$.value.value=A.value;else $.value=A.value}else if(f){let P=this.items.findIndex((B)=>f(A,B)<0);if(P===-1)this.items.push(A);else this.items.splice(P,0,A)}else this.items.push(A)}delete(D){let R=nR(this.items,D);if(!R)return!1;return this.items.splice(this.items.indexOf(R),1).length>0}get(D,R){let $=nR(this.items,D)?.value;return(!R&&LD.isScalar($)?$.value:$)??void 0}has(D){return!!nR(this.items,D)}set(D,R){this.add(new _$.Pair(D,R),!0)}toJSON(D,R,A){let $=A?new A:R?.mapAsMap?new Map:{};if(R?.onCreate)R.onCreate($);for(let f of this.items)CX.addPairToJSMap(R,$,f);return $}toString(D,R,A){if(!D)return JSON.stringify(this);for(let $ of this.items)if(!LD.isPair($))throw Error(`Map items must all be pairs; found ${JSON.stringify($)} instead`);if(!D.allNullValues&&this.hasAllNullValues(!1))D=Object.assign({},D,{allNullValues:!0});return wX.stringifyCollection(this,D,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:D.indent||"",onChompKeep:A,onComment:R})}}VX.YAMLMap=o9;VX.findPair=nR});var u1=q((SX)=>{var WX=m(),c9=ND(),jX={collection:"map",default:!0,nodeClass:c9.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(D,R){if(!WX.isMap(D))R("Expected a mapping for this tag");return D},createNode:(D,R,A)=>c9.YAMLMap.from(D,R,A)};SX.map=jX});var VD=q((xX)=>{var uX=bR(),EX=T3(),yX=G$(),F$=m(),gX=o(),mX=FD();class t9 extends yX.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(D){super(F$.SEQ,D);this.items=[]}add(D){this.items.push(D)}delete(D){let R=U$(D);if(typeof R!=="number")return!1;return this.items.splice(R,1).length>0}get(D,R){let A=U$(D);if(typeof A!=="number")return;let $=this.items[A];return!R&&F$.isScalar($)?$.value:$}has(D){let R=U$(D);return typeof R==="number"&&R<this.items.length}set(D,R){let A=U$(D);if(typeof A!=="number")throw Error(`Expected a valid index, not ${D}.`);let $=this.items[A];if(F$.isScalar($)&&gX.isScalarValue(R))$.value=R;else this.items[A]=R}toJSON(D,R){let A=[];if(R?.onCreate)R.onCreate(A);let $=0;for(let f of this.items)A.push(mX.toJS(f,String($++),R));return A}toString(D,R,A){if(!D)return JSON.stringify(this);return EX.stringifyCollection(this,D,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(D.indent||"")+" ",onChompKeep:A,onComment:R})}static from(D,R,A){let{replacer:$}=A,f=new this(D);if(R&&Symbol.iterator in Object(R)){let P=0;for(let B of R){if(typeof $==="function"){let G=R instanceof Set?B:String(P++);B=$.call(R,G,B)}f.items.push(uX.createNode(B,void 0,A))}}return f}}function U$(D){let R=F$.isScalar(D)?D.value:D;if(R&&typeof R==="string")R=Number(R);return typeof R==="number"&&Number.isInteger(R)&&R>=0?R:null}xX.YAMLSeq=t9});var E1=q((vX)=>{var pX=m(),e9=VD(),hX={collection:"seq",default:!0,nodeClass:e9.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(D,R){if(!pX.isSeq(D))R("Expected a sequence for this tag");return D},createNode:(D,R,A)=>e9.YAMLSeq.from(D,R,A)};vX.seq=hX});var pR=q((iX)=>{var dX=yR(),kX={identify:(D)=>typeof D==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(D)=>D,stringify(D,R,A,$){return R=Object.assign({actualString:!0},R),dX.stringifyString(D,R,A,$)}};iX.string=kX});var q$=q((rX)=>{var D8=o(),R8={identify:(D)=>D==null,createNode:()=>new D8.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new D8.Scalar(null),stringify:({source:D},R)=>typeof D==="string"&&R8.test.test(D)?D:R.options.nullStr};rX.nullTag=R8});var O3=q((cX)=>{var oX=o(),A8={identify:(D)=>typeof D==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:(D)=>new oX.Scalar(D[0]==="t"||D[0]==="T"),stringify({source:D,value:R},A){if(D&&A8.test.test(D)){let $=D[0]==="t"||D[0]==="T";if(R===$)return D}return R?A.options.trueStr:A.options.falseStr}};cX.boolTag=A8});var y1=q((DT)=>{function eX({format:D,minFractionDigits:R,tag:A,value:$}){if(typeof $==="bigint")return String($);let f=typeof $==="number"?$:Number($);if(!isFinite(f))return isNaN(f)?".nan":f<0?"-.inf":".inf";let P=Object.is($,-0)?"-0":JSON.stringify($);if(!D&&R&&(!A||A==="tag:yaml.org,2002:float")&&/^\d/.test(P)){let B=P.indexOf(".");if(B<0)B=P.length,P+=".";let G=R-(P.length-B-1);while(G-- >0)P+="0"}return P}DT.stringifyNumber=eX});var Y3=q((BT)=>{var AT=o(),Q3=y1(),$T={identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(D)=>D.slice(-3).toLowerCase()==="nan"?NaN:D[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Q3.stringifyNumber},fT={identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:(D)=>parseFloat(D),stringify(D){let R=Number(D.value);return isFinite(R)?R.toExponential():Q3.stringifyNumber(D)}},PT={identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(D){let R=new AT.Scalar(parseFloat(D)),A=D.indexOf(".");if(A!==-1&&D[D.length-1]==="0")R.minFractionDigits=D.length-A-1;return R},stringify:Q3.stringifyNumber};BT.float=PT;BT.floatExp=fT;BT.floatNaN=$T});var U3=q((XT)=>{var $8=y1(),w$=(D)=>typeof D==="bigint"||Number.isInteger(D),_3=(D,R,A,{intAsBigInt:$})=>$?BigInt(D):parseInt(D.substring(R),A);function f8(D,R,A){let{value:$}=D;if(w$($)&&$>=0)return A+$.toString(R);return $8.stringifyNumber(D)}var HT={identify:(D)=>w$(D)&&D>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(D,R,A)=>_3(D,2,8,A),stringify:(D)=>f8(D,8,"0o")},ZT={identify:w$,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(D,R,A)=>_3(D,0,10,A),stringify:$8.stringifyNumber},MT={identify:(D)=>w$(D)&&D>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(D,R,A)=>_3(D,2,16,A),stringify:(D)=>f8(D,16,"0x")};XT.int=ZT;XT.intHex=MT;XT.intOct=HT});var P8=q((CT)=>{var YT=u1(),_T=q$(),UT=E1(),FT=pR(),qT=O3(),F3=Y3(),q3=U3(),wT=[YT.map,UT.seq,FT.string,_T.nullTag,qT.boolTag,q3.intOct,q3.int,q3.intHex,F3.floatNaN,F3.floatExp,F3.float];CT.schema=wT});var G8=q((ST)=>{var NT=o(),VT=u1(),IT=E1();function B8(D){return typeof D==="bigint"||Number.isInteger(D)}var C$=({value:D})=>JSON.stringify(D),KT=[{identify:(D)=>typeof D==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(D)=>D,stringify:C$},{identify:(D)=>D==null,createNode:()=>new NT.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:C$},{identify:(D)=>typeof D==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:(D)=>D==="true",stringify:C$},{identify:B8,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(D,R,{intAsBigInt:A})=>A?BigInt(D):parseInt(D,10),stringify:({value:D})=>B8(D)?D.toString():JSON.stringify(D)},{identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:(D)=>parseFloat(D),stringify:C$}],WT={default:!0,tag:"",test:/^/,resolve(D,R){return R(`Unresolved plain scalar ${JSON.stringify(D)}`),D}},jT=[VT.map,IT.seq].concat(KT,WT);ST.schema=jT});var C3=q((yT)=>{var hR=p("buffer"),w3=o(),uT=yR(),ET={identify:(D)=>D instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(D,R){if(typeof hR.Buffer==="function")return hR.Buffer.from(D,"base64");else if(typeof atob==="function"){let A=atob(D.replace(/[\n\r]/g,"")),$=new Uint8Array(A.length);for(let f=0;f<A.length;++f)$[f]=A.charCodeAt(f);return $}else return R("This environment does not support reading binary tags; either Buffer or atob is required"),D},stringify({comment:D,type:R,value:A},$,f,P){if(!A)return"";let B=A,G;if(typeof hR.Buffer==="function")G=B instanceof hR.Buffer?B.toString("base64"):hR.Buffer.from(B.buffer).toString("base64");else if(typeof btoa==="function"){let z="";for(let J=0;J<B.length;++J)z+=String.fromCharCode(B[J]);G=btoa(z)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(R??(R=w3.Scalar.BLOCK_LITERAL),R!==w3.Scalar.QUOTE_DOUBLE){let z=Math.max($.options.lineWidth-$.indent.length,$.options.minContentWidth),J=Math.ceil(G.length/z),Z=Array(J);for(let H=0,M=0;H<J;++H,M+=z)Z[H]=G.substr(M,z);G=Z.join(R===w3.Scalar.BLOCK_LITERAL?`
|
|
77
|
-
`:" ")}return uT.stringifyString({comment:D,type:R,value:G},$,f,P)}};yT.binary=ET});var N$=q((pT)=>{var L$=m(),L3=CD(),mT=o(),xT=VD();function z8(D,R){if(L$.isSeq(D))for(let A=0;A<D.items.length;++A){let $=D.items[A];if(L$.isPair($))continue;else if(L$.isMap($)){if($.items.length>1)R("Each pair must have its own sequence indicator");let f=$.items[0]||new L3.Pair(new mT.Scalar(null));if($.commentBefore)f.key.commentBefore=f.key.commentBefore?`${$.commentBefore}
|
|
78
|
-
${f.key.commentBefore}`:$.commentBefore;if($.comment){let P=f.value??f.key;P.comment=P.comment?`${$.comment}
|
|
79
|
-
${P.comment}`:$.comment}$=f}D.items[A]=L$.isPair($)?$:new L3.Pair($)}else R("Expected a sequence for this tag");return D}function J8(D,R,A){let{replacer:$}=A,f=new xT.YAMLSeq(D);f.tag="tag:yaml.org,2002:pairs";let P=0;if(R&&Symbol.iterator in Object(R))for(let B of R){if(typeof $==="function")B=$.call(R,String(P++),B);let G,z;if(Array.isArray(B))if(B.length===2)G=B[0],z=B[1];else throw TypeError(`Expected [key, value] tuple: ${B}`);else if(B&&B instanceof Object){let J=Object.keys(B);if(J.length===1)G=J[0],z=B[G];else throw TypeError(`Expected tuple with one key, not ${J.length} keys`)}else G=B;f.items.push(L3.createPair(G,z,A))}return f}var nT={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:z8,createNode:J8};pT.createPairs=J8;pT.pairs=nT;pT.resolvePairs=z8});var V3=q((iT)=>{var H8=m(),N3=FD(),vR=ND(),dT=VD(),Z8=N$();class R1 extends dT.YAMLSeq{constructor(){super();this.add=vR.YAMLMap.prototype.add.bind(this),this.delete=vR.YAMLMap.prototype.delete.bind(this),this.get=vR.YAMLMap.prototype.get.bind(this),this.has=vR.YAMLMap.prototype.has.bind(this),this.set=vR.YAMLMap.prototype.set.bind(this),this.tag=R1.tag}toJSON(D,R){if(!R)return super.toJSON(D);let A=new Map;if(R?.onCreate)R.onCreate(A);for(let $ of this.items){let f,P;if(H8.isPair($))f=N3.toJS($.key,"",R),P=N3.toJS($.value,f,R);else f=N3.toJS($,"",R);if(A.has(f))throw Error("Ordered maps must not include duplicate keys");A.set(f,P)}return A}static from(D,R,A){let $=Z8.createPairs(D,R,A),f=new this;return f.items=$.items,f}}R1.tag="tag:yaml.org,2002:omap";var kT={collection:"seq",identify:(D)=>D instanceof Map,nodeClass:R1,default:!1,tag:"tag:yaml.org,2002:omap",resolve(D,R){let A=Z8.resolvePairs(D,R),$=[];for(let{key:f}of A.items)if(H8.isScalar(f))if($.includes(f.value))R(`Ordered maps must not include duplicate keys: ${f.value}`);else $.push(f.value);return Object.assign(new R1,A)},createNode:(D,R,A)=>R1.from(D,R,A)};iT.YAMLOMap=R1;iT.omap=kT});var Q8=q((sT)=>{var M8=o();function X8({value:D,source:R},A){if(R&&(D?T8:O8).test.test(R))return R;return D?A.options.trueStr:A.options.falseStr}var T8={identify:(D)=>D===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new M8.Scalar(!0),stringify:X8},O8={identify:(D)=>D===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new M8.Scalar(!1),stringify:X8};sT.falseTag=O8;sT.trueTag=T8});var Y8=q((AO)=>{var tT=o(),I3=y1(),eT={identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(D)=>D.slice(-3).toLowerCase()==="nan"?NaN:D[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:I3.stringifyNumber},DO={identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(D)=>parseFloat(D.replace(/_/g,"")),stringify(D){let R=Number(D.value);return isFinite(R)?R.toExponential():I3.stringifyNumber(D)}},RO={identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(D){let R=new tT.Scalar(parseFloat(D.replace(/_/g,""))),A=D.indexOf(".");if(A!==-1){let $=D.substring(A+1).replace(/_/g,"");if($[$.length-1]==="0")R.minFractionDigits=$.length}return R},stringify:I3.stringifyNumber};AO.float=RO;AO.floatExp=DO;AO.floatNaN=eT});var U8=q((HO)=>{var _8=y1(),lR=(D)=>typeof D==="bigint"||Number.isInteger(D);function V$(D,R,A,{intAsBigInt:$}){let f=D[0];if(f==="-"||f==="+")R+=1;if(D=D.substring(R).replace(/_/g,""),$){switch(A){case 2:D=`0b${D}`;break;case 8:D=`0o${D}`;break;case 16:D=`0x${D}`;break}let B=BigInt(D);return f==="-"?BigInt(-1)*B:B}let P=parseInt(D,A);return f==="-"?-1*P:P}function K3(D,R,A){let{value:$}=D;if(lR($)){let f=$.toString(R);return $<0?"-"+A+f.substr(1):A+f}return _8.stringifyNumber(D)}var BO={identify:lR,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(D,R,A)=>V$(D,2,2,A),stringify:(D)=>K3(D,2,"0b")},GO={identify:lR,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(D,R,A)=>V$(D,1,8,A),stringify:(D)=>K3(D,8,"0")},zO={identify:lR,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(D,R,A)=>V$(D,0,10,A),stringify:_8.stringifyNumber},JO={identify:lR,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(D,R,A)=>V$(D,2,16,A),stringify:(D)=>K3(D,16,"0x")};HO.int=zO;HO.intBin=BO;HO.intHex=JO;HO.intOct=GO});var W3=q((QO)=>{var W$=m(),I$=CD(),K$=ND();class A1 extends K$.YAMLMap{constructor(D){super(D);this.tag=A1.tag}add(D){let R;if(W$.isPair(D))R=D;else if(D&&typeof D==="object"&&"key"in D&&"value"in D&&D.value===null)R=new I$.Pair(D.key,null);else R=new I$.Pair(D,null);if(!K$.findPair(this.items,R.key))this.items.push(R)}get(D,R){let A=K$.findPair(this.items,D);return!R&&W$.isPair(A)?W$.isScalar(A.key)?A.key.value:A.key:A}set(D,R){if(typeof R!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof R}`);let A=K$.findPair(this.items,D);if(A&&!R)this.items.splice(this.items.indexOf(A),1);else if(!A&&R)this.items.push(new I$.Pair(D))}toJSON(D,R){return super.toJSON(D,R,Set)}toString(D,R,A){if(!D)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},D,{allNullValues:!0}),R,A);else throw Error("Set items must all have null values")}static from(D,R,A){let{replacer:$}=A,f=new this(D);if(R&&Symbol.iterator in Object(R))for(let P of R){if(typeof $==="function")P=$.call(R,P,P);f.items.push(I$.createPair(P,null,A))}return f}}A1.tag="tag:yaml.org,2002:set";var OO={collection:"map",identify:(D)=>D instanceof Set,nodeClass:A1,default:!1,tag:"tag:yaml.org,2002:set",createNode:(D,R,A)=>A1.from(D,R,A),resolve(D,R){if(W$.isMap(D))if(D.hasAllNullValues(!0))return Object.assign(new A1,D);else R("Set items must all have null values");else R("Expected a mapping for this tag");return D}};QO.YAMLSet=A1;QO.set=OO});var S3=q((wO)=>{var UO=y1();function j3(D,R){let A=D[0],$=A==="-"||A==="+"?D.substring(1):D,f=(B)=>R?BigInt(B):Number(B),P=$.replace(/_/g,"").split(":").reduce((B,G)=>B*f(60)+f(G),f(0));return A==="-"?f(-1)*P:P}function F8(D){let{value:R}=D,A=(B)=>B;if(typeof R==="bigint")A=(B)=>BigInt(B);else if(isNaN(R)||!isFinite(R))return UO.stringifyNumber(D);let $="";if(R<0)$="-",R*=A(-1);let f=A(60),P=[R%f];if(R<60)P.unshift(0);else if(R=(R-P[0])/f,P.unshift(R%f),R>=60)R=(R-P[0])/f,P.unshift(R);return $+P.map((B)=>String(B).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var FO={identify:(D)=>typeof D==="bigint"||Number.isInteger(D),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(D,R,{intAsBigInt:A})=>j3(D,A),stringify:F8},qO={identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(D)=>j3(D,!1),stringify:F8},q8={identify:(D)=>D 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(D){let R=D.match(q8.test);if(!R)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,A,$,f,P,B,G]=R.map(Number),z=R[7]?Number((R[7]+"00").substr(1,3)):0,J=Date.UTC(A,$-1,f,P||0,B||0,G||0,z),Z=R[8];if(Z&&Z!=="Z"){let H=j3(Z,!1);if(Math.abs(H)<30)H*=60;J-=60000*H}return new Date(J)},stringify:({value:D})=>D?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};wO.floatTime=qO;wO.intTime=FO;wO.timestamp=q8});var C8=q((gO)=>{var VO=u1(),IO=q$(),KO=E1(),WO=pR(),jO=C3(),w8=Q8(),b3=Y8(),j$=U8(),SO=X$(),bO=V3(),uO=N$(),EO=W3(),u3=S3(),yO=[VO.map,KO.seq,WO.string,IO.nullTag,w8.trueTag,w8.falseTag,j$.intBin,j$.intOct,j$.int,j$.intHex,b3.floatNaN,b3.floatExp,b3.float,jO.binary,SO.merge,bO.omap,uO.pairs,EO.set,u3.intTime,u3.floatTime,u3.timestamp];gO.schema=yO});var u8=q((kO)=>{var I8=u1(),xO=q$(),K8=E1(),nO=pR(),pO=O3(),E3=Y3(),y3=U3(),hO=P8(),vO=G8(),W8=C3(),dR=X$(),j8=V3(),S8=N$(),L8=C8(),b8=W3(),S$=S3(),N8=new Map([["core",hO.schema],["failsafe",[I8.map,K8.seq,nO.string]],["json",vO.schema],["yaml11",L8.schema],["yaml-1.1",L8.schema]]),V8={binary:W8.binary,bool:pO.boolTag,float:E3.float,floatExp:E3.floatExp,floatNaN:E3.floatNaN,floatTime:S$.floatTime,int:y3.int,intHex:y3.intHex,intOct:y3.intOct,intTime:S$.intTime,map:I8.map,merge:dR.merge,null:xO.nullTag,omap:j8.omap,pairs:S8.pairs,seq:K8.seq,set:b8.set,timestamp:S$.timestamp},lO={"tag:yaml.org,2002:binary":W8.binary,"tag:yaml.org,2002:merge":dR.merge,"tag:yaml.org,2002:omap":j8.omap,"tag:yaml.org,2002:pairs":S8.pairs,"tag:yaml.org,2002:set":b8.set,"tag:yaml.org,2002:timestamp":S$.timestamp};function dO(D,R,A){let $=N8.get(R);if($&&!D)return A&&!$.includes(dR.merge)?$.concat(dR.merge):$.slice();let f=$;if(!f)if(Array.isArray(D))f=[];else{let P=Array.from(N8.keys()).filter((B)=>B!=="yaml11").map((B)=>JSON.stringify(B)).join(", ");throw Error(`Unknown schema "${R}"; use one of ${P} or define customTags array`)}if(Array.isArray(D))for(let P of D)f=f.concat(P);else if(typeof D==="function")f=D(f.slice());if(A)f=f.concat(dR.merge);return f.reduce((P,B)=>{let G=typeof B==="string"?V8[B]:B;if(!G){let z=JSON.stringify(B),J=Object.keys(V8).map((Z)=>JSON.stringify(Z)).join(", ");throw Error(`Unknown custom tag ${z}; use one of ${J}`)}if(!P.includes(G))P.push(G);return P},[])}kO.coreKnownTags=lO;kO.getTags=dO});var x3=q((tO)=>{var g3=m(),rO=u1(),sO=E1(),oO=pR(),b$=u8(),cO=(D,R)=>D.key<R.key?-1:D.key>R.key?1:0;class m3{constructor({compat:D,customTags:R,merge:A,resolveKnownTags:$,schema:f,sortMapEntries:P,toStringDefaults:B}){this.compat=Array.isArray(D)?b$.getTags(D,"compat"):D?b$.getTags(null,D):null,this.name=typeof f==="string"&&f||"core",this.knownTags=$?b$.coreKnownTags:{},this.tags=b$.getTags(R,this.name,A),this.toStringOptions=B??null,Object.defineProperty(this,g3.MAP,{value:rO.map}),Object.defineProperty(this,g3.SCALAR,{value:oO.string}),Object.defineProperty(this,g3.SEQ,{value:sO.seq}),this.sortMapEntries=typeof P==="function"?P:P===!0?cO:null}clone(){let D=Object.create(m3.prototype,Object.getOwnPropertyDescriptors(this));return D.tags=this.tags.slice(),D}}tO.Schema=m3});var E8=q((AQ)=>{var DQ=m(),n3=gR(),kR=uR();function RQ(D,R){let A=[],$=R.directives===!0;if(R.directives!==!1&&D.directives){let z=D.directives.toString(D);if(z)A.push(z),$=!0;else if(D.directives.docStart)$=!0}if($)A.push("---");let f=n3.createStringifyContext(D,R),{commentString:P}=f.options;if(D.commentBefore){if(A.length!==1)A.unshift("");let z=P(D.commentBefore);A.unshift(kR.indentComment(z,""))}let B=!1,G=null;if(D.contents){if(DQ.isNode(D.contents)){if(D.contents.spaceBefore&&$)A.push("");if(D.contents.commentBefore){let Z=P(D.contents.commentBefore);A.push(kR.indentComment(Z,""))}f.forceBlockIndent=!!D.comment,G=D.contents.comment}let z=G?void 0:()=>B=!0,J=n3.stringify(D.contents,f,()=>G=null,z);if(G)J+=kR.lineComment(J,"",P(G));if((J[0]==="|"||J[0]===">")&&A[A.length-1]==="---")A[A.length-1]=`--- ${J}`;else A.push(J)}else A.push(n3.stringify(D.contents,f));if(D.directives?.docEnd)if(D.comment){let z=P(D.comment);if(z.includes(`
|
|
80
|
-
`))A.push("..."),A.push(kR.indentComment(z,""));else A.push(`... ${z}`)}else A.push("...");else{let z=D.comment;if(z&&B)z=z.replace(/^\n+/,"");if(z){if((!B||G)&&A[A.length-1]!=="")A.push("");A.push(kR.indentComment(P(z),""))}}return A.join(`
|
|
81
|
-
`)+`
|
|
82
|
-
`}AQ.stringifyDocument=RQ});var iR=q((ZQ)=>{var fQ=SR(),g1=G$(),F0=m(),PQ=CD(),BQ=FD(),GQ=x3(),zQ=E8(),p3=f$(),JQ=P3(),HQ=bR(),h3=f3();class v3{constructor(D,R,A){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,F0.NODE_TYPE,{value:F0.DOC});let $=null;if(typeof R==="function"||Array.isArray(R))$=R;else if(A===void 0&&R)A=R,R=void 0;let f=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},A);this.options=f;let{version:P}=f;if(A?._directives){if(this.directives=A._directives.atDocument(),this.directives.yaml.explicit)P=this.directives.yaml.version}else this.directives=new h3.Directives({version:P});this.setSchema(P,A),this.contents=D===void 0?null:this.createNode(D,$,A)}clone(){let D=Object.create(v3.prototype,{[F0.NODE_TYPE]:{value:F0.DOC}});if(D.commentBefore=this.commentBefore,D.comment=this.comment,D.errors=this.errors.slice(),D.warnings=this.warnings.slice(),D.options=Object.assign({},this.options),this.directives)D.directives=this.directives.clone();if(D.schema=this.schema.clone(),D.contents=F0.isNode(this.contents)?this.contents.clone(D.schema):this.contents,this.range)D.range=this.range.slice();return D}add(D){if(m1(this.contents))this.contents.add(D)}addIn(D,R){if(m1(this.contents))this.contents.addIn(D,R)}createAlias(D,R){if(!D.anchor){let A=p3.anchorNames(this);D.anchor=!R||A.has(R)?p3.findNewAnchor(R||"a",A):R}return new fQ.Alias(D.anchor)}createNode(D,R,A){let $=void 0;if(typeof R==="function")D=R.call({"":D},"",D),$=R;else if(Array.isArray(R)){let X=(U)=>typeof U==="number"||U instanceof String||U instanceof Number,O=R.filter(X).map(String);if(O.length>0)R=R.concat(O);$=R}else if(A===void 0&&R)A=R,R=void 0;let{aliasDuplicateObjects:f,anchorPrefix:P,flow:B,keepUndefined:G,onTagObj:z,tag:J}=A??{},{onAnchor:Z,setAnchors:H,sourceObjects:M}=p3.createNodeAnchors(this,P||"a"),T={aliasDuplicateObjects:f??!0,keepUndefined:G??!1,onAnchor:Z,onTagObj:z,replacer:$,schema:this.schema,sourceObjects:M},Q=HQ.createNode(D,J,T);if(B&&F0.isCollection(Q))Q.flow=!0;return H(),Q}createPair(D,R,A={}){let $=this.createNode(D,null,A),f=this.createNode(R,null,A);return new PQ.Pair($,f)}delete(D){return m1(this.contents)?this.contents.delete(D):!1}deleteIn(D){if(g1.isEmptyPath(D)){if(this.contents==null)return!1;return this.contents=null,!0}return m1(this.contents)?this.contents.deleteIn(D):!1}get(D,R){return F0.isCollection(this.contents)?this.contents.get(D,R):void 0}getIn(D,R){if(g1.isEmptyPath(D))return!R&&F0.isScalar(this.contents)?this.contents.value:this.contents;return F0.isCollection(this.contents)?this.contents.getIn(D,R):void 0}has(D){return F0.isCollection(this.contents)?this.contents.has(D):!1}hasIn(D){if(g1.isEmptyPath(D))return this.contents!==void 0;return F0.isCollection(this.contents)?this.contents.hasIn(D):!1}set(D,R){if(this.contents==null)this.contents=g1.collectionFromPath(this.schema,[D],R);else if(m1(this.contents))this.contents.set(D,R)}setIn(D,R){if(g1.isEmptyPath(D))this.contents=R;else if(this.contents==null)this.contents=g1.collectionFromPath(this.schema,Array.from(D),R);else if(m1(this.contents))this.contents.setIn(D,R)}setSchema(D,R={}){if(typeof D==="number")D=String(D);let A;switch(D){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new h3.Directives({version:"1.1"});A={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=D;else this.directives=new h3.Directives({version:D});A={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;A=null;break;default:{let $=JSON.stringify(D);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${$}`)}}if(R.schema instanceof Object)this.schema=R.schema;else if(A)this.schema=new GQ.Schema(Object.assign(A,R));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:D,jsonArg:R,mapAsMap:A,maxAliasCount:$,onAnchor:f,reviver:P}={}){let B={anchors:new Map,doc:this,keep:!D,mapAsMap:A===!0,mapKeyWarned:!1,maxAliasCount:typeof $==="number"?$:100},G=BQ.toJS(this.contents,R??"",B);if(typeof f==="function")for(let{count:z,res:J}of B.anchors.values())f(J,z);return typeof P==="function"?JQ.applyReviver(P,{"":G},"",G):G}toJSON(D,R){return this.toJS({json:!0,jsonArg:D,mapAsMap:!1,onAnchor:R})}toString(D={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in D&&(!Number.isInteger(D.indent)||Number(D.indent)<=0)){let R=JSON.stringify(D.indent);throw Error(`"indent" option must be a positive integer, not ${R}`)}return zQ.stringifyDocument(this,D)}}function m1(D){if(F0.isCollection(D))return!0;throw Error("Expected a YAML collection as document contents")}ZQ.Document=v3});var aR=q((TQ)=>{class u$ extends Error{constructor(D,R,A,$){super();this.name=D,this.code=A,this.message=$,this.pos=R}}class y8 extends u${constructor(D,R,A){super("YAMLParseError",D,R,A)}}class g8 extends u${constructor(D,R,A){super("YAMLWarning",D,R,A)}}var XQ=(D,R)=>(A)=>{if(A.pos[0]===-1)return;A.linePos=A.pos.map((G)=>R.linePos(G));let{line:$,col:f}=A.linePos[0];A.message+=` at line ${$}, column ${f}`;let P=f-1,B=D.substring(R.lineStarts[$-1],R.lineStarts[$]).replace(/[\n\r]+$/,"");if(P>=60&&B.length>80){let G=Math.min(P-39,B.length-79);B="…"+B.substring(G),P-=G-1}if(B.length>80)B=B.substring(0,79)+"…";if($>1&&/^ *$/.test(B.substring(0,P))){let G=D.substring(R.lineStarts[$-2],R.lineStarts[$-1]);if(G.length>80)G=G.substring(0,79)+`…
|
|
83
|
-
`;B=G+B}if(/[^ ]/.test(B)){let G=1,z=A.linePos[1];if(z?.line===$&&z.col>f)G=Math.max(1,Math.min(z.col-f,80-P));let J=" ".repeat(P)+"^".repeat(G);A.message+=`:
|
|
84
|
-
|
|
85
|
-
${B}
|
|
86
|
-
${J}
|
|
87
|
-
`}};TQ.YAMLError=u$;TQ.YAMLParseError=y8;TQ.YAMLWarning=g8;TQ.prettifyError=XQ});var rR=q((FQ)=>{function UQ(D,{flow:R,indicator:A,next:$,offset:f,onError:P,parentIndent:B,startOnNewline:G}){let z=!1,J=G,Z=G,H="",M="",T=!1,Q=!1,X=null,O=null,U=null,F=null,w=null,V=null,I=null;for(let L of D){if(Q){if(L.type!=="space"&&L.type!=="newline"&&L.type!=="comma")P(L.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");Q=!1}if(X){if(J&&L.type!=="comment"&&L.type!=="newline")P(X,"TAB_AS_INDENT","Tabs are not allowed as indentation");X=null}switch(L.type){case"space":if(!R&&(A!=="doc-start"||$?.type!=="flow-collection")&&L.source.includes("\t"))X=L;Z=!0;break;case"comment":{if(!Z)P(L,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let S=L.source.substring(1)||" ";if(!H)H=S;else H+=M+S;M="",J=!1;break}case"newline":if(J){if(H)H+=L.source;else if(!V||A!=="seq-item-ind")z=!0}else M+=L.source;if(J=!0,T=!0,O||U)F=L;Z=!0;break;case"anchor":if(O)P(L,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(L.source.endsWith(":"))P(L.offset+L.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);O=L,I??(I=L.offset),J=!1,Z=!1,Q=!0;break;case"tag":{if(U)P(L,"MULTIPLE_TAGS","A node can have at most one tag");U=L,I??(I=L.offset),J=!1,Z=!1,Q=!0;break}case A:if(O||U)P(L,"BAD_PROP_ORDER",`Anchors and tags must be after the ${L.source} indicator`);if(V)P(L,"UNEXPECTED_TOKEN",`Unexpected ${L.source} in ${R??"collection"}`);V=L,J=A==="seq-item-ind"||A==="explicit-key-ind",Z=!1;break;case"comma":if(R){if(w)P(L,"UNEXPECTED_TOKEN",`Unexpected , in ${R}`);w=L,J=!1,Z=!1;break}default:P(L,"UNEXPECTED_TOKEN",`Unexpected ${L.type} token`),J=!1,Z=!1}}let j=D[D.length-1],u=j?j.offset+j.source.length:f;if(Q&&$&&$.type!=="space"&&$.type!=="newline"&&$.type!=="comma"&&($.type!=="scalar"||$.source!==""))P($.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(X&&(J&&X.indent<=B||$?.type==="block-map"||$?.type==="block-seq"))P(X,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:w,found:V,spaceBefore:z,comment:H,hasNewline:T,anchor:O,tag:U,newlineAfterProp:F,end:u,start:I??u}}FQ.resolveProps=UQ});var E$=q((wQ)=>{function l3(D){if(!D)return null;switch(D.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(D.source.includes(`
|
|
88
|
-
`))return!0;if(D.end){for(let R of D.end)if(R.type==="newline")return!0}return!1;case"flow-collection":for(let R of D.items){for(let A of R.start)if(A.type==="newline")return!0;if(R.sep){for(let A of R.sep)if(A.type==="newline")return!0}if(l3(R.key)||l3(R.value))return!0}return!1;default:return!0}}wQ.containsNewline=l3});var d3=q((VQ)=>{var LQ=E$();function NQ(D,R,A){if(R?.type==="flow-collection"){let $=R.end[0];if($.indent===D&&($.source==="]"||$.source==="}")&&LQ.containsNewline(R))A($,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}VQ.flowIndentCheck=NQ});var k3=q((WQ)=>{var m8=m();function KQ(D,R,A){let{uniqueKeys:$}=D.options;if($===!1)return!1;let f=typeof $==="function"?$:(P,B)=>P===B||m8.isScalar(P)&&m8.isScalar(B)&&P.value===B.value;return R.some((P)=>f(P.key,A))}WQ.mapIncludes=KQ});var v8=q((yQ)=>{var x8=CD(),SQ=ND(),n8=rR(),bQ=E$(),p8=d3(),uQ=k3(),h8="All mapping items must start at the same column";function EQ({composeNode:D,composeEmptyNode:R},A,$,f,P){let G=new(P?.nodeClass??SQ.YAMLMap)(A.schema);if(A.atRoot)A.atRoot=!1;let z=$.offset,J=null;for(let Z of $.items){let{start:H,key:M,sep:T,value:Q}=Z,X=n8.resolveProps(H,{indicator:"explicit-key-ind",next:M??T?.[0],offset:z,onError:f,parentIndent:$.indent,startOnNewline:!0}),O=!X.found;if(O){if(M){if(M.type==="block-seq")f(z,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in M&&M.indent!==$.indent)f(z,"BAD_INDENT",h8)}if(!X.anchor&&!X.tag&&!T){if(J=X.end,X.comment)if(G.comment)G.comment+=`
|
|
89
|
-
`+X.comment;else G.comment=X.comment;continue}if(X.newlineAfterProp||bQ.containsNewline(M))f(M??H[H.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(X.found?.indent!==$.indent)f(z,"BAD_INDENT",h8);A.atKey=!0;let U=X.end,F=M?D(A,M,X,f):R(A,U,H,null,X,f);if(A.schema.compat)p8.flowIndentCheck($.indent,M,f);if(A.atKey=!1,uQ.mapIncludes(A,G.items,F))f(U,"DUPLICATE_KEY","Map keys must be unique");let w=n8.resolveProps(T??[],{indicator:"map-value-ind",next:Q,offset:F.range[2],onError:f,parentIndent:$.indent,startOnNewline:!M||M.type==="block-scalar"});if(z=w.end,w.found){if(O){if(Q?.type==="block-map"&&!w.hasNewline)f(z,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(A.options.strict&&X.start<w.found.offset-1024)f(F.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let V=Q?D(A,Q,w,f):R(A,z,T,null,w,f);if(A.schema.compat)p8.flowIndentCheck($.indent,Q,f);z=V.range[2];let I=new x8.Pair(F,V);if(A.options.keepSourceTokens)I.srcToken=Z;G.items.push(I)}else{if(O)f(F.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(w.comment)if(F.comment)F.comment+=`
|
|
90
|
-
`+w.comment;else F.comment=w.comment;let V=new x8.Pair(F);if(A.options.keepSourceTokens)V.srcToken=Z;G.items.push(V)}}if(J&&J<z)f(J,"IMPOSSIBLE","Map comment with trailing content");return G.range=[$.offset,z,J??z],G}yQ.resolveBlockMap=EQ});var l8=q((hQ)=>{var mQ=VD(),xQ=rR(),nQ=d3();function pQ({composeNode:D,composeEmptyNode:R},A,$,f,P){let G=new(P?.nodeClass??mQ.YAMLSeq)(A.schema);if(A.atRoot)A.atRoot=!1;if(A.atKey)A.atKey=!1;let z=$.offset,J=null;for(let{start:Z,value:H}of $.items){let M=xQ.resolveProps(Z,{indicator:"seq-item-ind",next:H,offset:z,onError:f,parentIndent:$.indent,startOnNewline:!0});if(!M.found)if(M.anchor||M.tag||H)if(H?.type==="block-seq")f(M.end,"BAD_INDENT","All sequence items must start at the same column");else f(z,"MISSING_CHAR","Sequence item without - indicator");else{if(J=M.end,M.comment)G.comment=M.comment;continue}let T=H?D(A,H,M,f):R(A,M.end,Z,null,M,f);if(A.schema.compat)nQ.flowIndentCheck($.indent,H,f);z=T.range[2],G.items.push(T)}return G.range=[$.offset,z,J??z],G}hQ.resolveBlockSeq=pQ});var x1=q((dQ)=>{function lQ(D,R,A,$){let f="";if(D){let P=!1,B="";for(let G of D){let{source:z,type:J}=G;switch(J){case"space":P=!0;break;case"comment":{if(A&&!P)$(G,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let Z=z.substring(1)||" ";if(!f)f=Z;else f+=B+Z;B="";break}case"newline":if(f)B+=z;P=!0;break;default:$(G,"UNEXPECTED_TOKEN",`Unexpected ${J} at node end`)}R+=z.length}}return{comment:f,offset:R}}dQ.resolveEnd=lQ});var i8=q((eQ)=>{var iQ=m(),aQ=CD(),d8=ND(),rQ=VD(),sQ=x1(),k8=rR(),oQ=E$(),cQ=k3(),i3="Block collections are not allowed within flow collections",a3=(D)=>D&&(D.type==="block-map"||D.type==="block-seq");function tQ({composeNode:D,composeEmptyNode:R},A,$,f,P){let B=$.start.source==="{",G=B?"flow map":"flow sequence",J=new(P?.nodeClass??(B?d8.YAMLMap:rQ.YAMLSeq))(A.schema);J.flow=!0;let Z=A.atRoot;if(Z)A.atRoot=!1;if(A.atKey)A.atKey=!1;let H=$.offset+$.start.source.length;for(let O=0;O<$.items.length;++O){let U=$.items[O],{start:F,key:w,sep:V,value:I}=U,j=k8.resolveProps(F,{flow:G,indicator:"explicit-key-ind",next:w??V?.[0],offset:H,onError:f,parentIndent:$.indent,startOnNewline:!1});if(!j.found){if(!j.anchor&&!j.tag&&!V&&!I){if(O===0&&j.comma)f(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${G}`);else if(O<$.items.length-1)f(j.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${G}`);if(j.comment)if(J.comment)J.comment+=`
|
|
91
|
-
`+j.comment;else J.comment=j.comment;H=j.end;continue}if(!B&&A.options.strict&&oQ.containsNewline(w))f(w,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(O===0){if(j.comma)f(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${G}`)}else{if(!j.comma)f(j.start,"MISSING_CHAR",`Missing , between ${G} items`);if(j.comment){let u="";D:for(let L of F)switch(L.type){case"comma":case"space":break;case"comment":u=L.source.substring(1);break D;default:break D}if(u){let L=J.items[J.items.length-1];if(iQ.isPair(L))L=L.value??L.key;if(L.comment)L.comment+=`
|
|
92
|
-
`+u;else L.comment=u;j.comment=j.comment.substring(u.length+1)}}}if(!B&&!V&&!j.found){let u=I?D(A,I,j,f):R(A,j.end,V,null,j,f);if(J.items.push(u),H=u.range[2],a3(I))f(u.range,"BLOCK_IN_FLOW",i3)}else{A.atKey=!0;let u=j.end,L=w?D(A,w,j,f):R(A,u,F,null,j,f);if(a3(w))f(L.range,"BLOCK_IN_FLOW",i3);A.atKey=!1;let S=k8.resolveProps(V??[],{flow:G,indicator:"map-value-ind",next:I,offset:L.range[2],onError:f,parentIndent:$.indent,startOnNewline:!1});if(S.found){if(!B&&!j.found&&A.options.strict){if(V)for(let g of V){if(g===S.found)break;if(g.type==="newline"){f(g,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(j.start<S.found.offset-1024)f(S.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(I)if("source"in I&&I.source?.[0]===":")f(I,"MISSING_CHAR",`Missing space after : in ${G}`);else f(S.start,"MISSING_CHAR",`Missing , or : between ${G} items`);let l=I?D(A,I,S,f):S.found?R(A,S.end,V,null,S,f):null;if(l){if(a3(I))f(l.range,"BLOCK_IN_FLOW",i3)}else if(S.comment)if(L.comment)L.comment+=`
|
|
93
|
-
`+S.comment;else L.comment=S.comment;let d=new aQ.Pair(L,l);if(A.options.keepSourceTokens)d.srcToken=U;if(B){let g=J;if(cQ.mapIncludes(A,g.items,L))f(u,"DUPLICATE_KEY","Map keys must be unique");g.items.push(d)}else{let g=new d8.YAMLMap(A.schema);g.flow=!0,g.items.push(d);let Y0=(l??L).range;g.range=[L.range[0],Y0[1],Y0[2]],J.items.push(g)}H=l?l.range[2]:S.end}}let M=B?"}":"]",[T,...Q]=$.end,X=H;if(T?.source===M)X=T.offset+T.source.length;else{let O=G[0].toUpperCase()+G.substring(1),U=Z?`${O} must end with a ${M}`:`${O} in block collection must be sufficiently indented and end with a ${M}`;if(f(H,Z?"MISSING_CHAR":"BAD_INDENT",U),T&&T.source.length!==1)Q.unshift(T)}if(Q.length>0){let O=sQ.resolveEnd(Q,X,A.options.strict,f);if(O.comment)if(J.comment)J.comment+=`
|
|
94
|
-
`+O.comment;else J.comment=O.comment;J.range=[$.offset,X,O.offset]}else J.range=[$.offset,X,X];return J}eQ.resolveFlowCollection=tQ});var a8=q((JY)=>{var RY=m(),AY=o(),$Y=ND(),fY=VD(),PY=v8(),BY=l8(),GY=i8();function r3(D,R,A,$,f,P){let B=A.type==="block-map"?PY.resolveBlockMap(D,R,A,$,P):A.type==="block-seq"?BY.resolveBlockSeq(D,R,A,$,P):GY.resolveFlowCollection(D,R,A,$,P),G=B.constructor;if(f==="!"||f===G.tagName)return B.tag=G.tagName,B;if(f)B.tag=f;return B}function zY(D,R,A,$,f){let P=$.tag,B=!P?null:R.directives.tagName(P.source,(M)=>f(P,"TAG_RESOLVE_FAILED",M));if(A.type==="block-seq"){let{anchor:M,newlineAfterProp:T}=$,Q=M&&P?M.offset>P.offset?M:P:M??P;if(Q&&(!T||T.offset<Q.offset))f(Q,"MISSING_CHAR","Missing newline after block sequence props")}let G=A.type==="block-map"?"map":A.type==="block-seq"?"seq":A.start.source==="{"?"map":"seq";if(!P||!B||B==="!"||B===$Y.YAMLMap.tagName&&G==="map"||B===fY.YAMLSeq.tagName&&G==="seq")return r3(D,R,A,f,B);let z=R.schema.tags.find((M)=>M.tag===B&&M.collection===G);if(!z){let M=R.schema.knownTags[B];if(M?.collection===G)R.schema.tags.push(Object.assign({},M,{default:!1})),z=M;else{if(M)f(P,"BAD_COLLECTION_TYPE",`${M.tag} used for ${G} collection, but expects ${M.collection??"scalar"}`,!0);else f(P,"TAG_RESOLVE_FAILED",`Unresolved tag: ${B}`,!0);return r3(D,R,A,f,B)}}let J=r3(D,R,A,f,B,z),Z=z.resolve?.(J,(M)=>f(P,"TAG_RESOLVE_FAILED",M),R.options)??J,H=RY.isNode(Z)?Z:new AY.Scalar(Z);if(H.range=J.range,H.tag=B,z?.format)H.format=z.format;return H}JY.composeCollection=zY});var o3=q((TY)=>{var s3=o();function ZY(D,R,A){let $=R.offset,f=MY(R,D.options.strict,A);if(!f)return{value:"",type:null,comment:"",range:[$,$,$]};let P=f.mode===">"?s3.Scalar.BLOCK_FOLDED:s3.Scalar.BLOCK_LITERAL,B=R.source?XY(R.source):[],G=B.length;for(let X=B.length-1;X>=0;--X){let O=B[X][1];if(O===""||O==="\r")G=X;else break}if(G===0){let X=f.chomp==="+"&&B.length>0?`
|
|
95
|
-
`.repeat(Math.max(1,B.length-1)):"",O=$+f.length;if(R.source)O+=R.source.length;return{value:X,type:P,comment:f.comment,range:[$,O,O]}}let z=R.indent+f.indent,J=R.offset+f.length,Z=0;for(let X=0;X<G;++X){let[O,U]=B[X];if(U===""||U==="\r"){if(f.indent===0&&O.length>z)z=O.length}else{if(O.length<z)A(J+O.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(f.indent===0)z=O.length;if(Z=X,z===0&&!D.atRoot)A(J,"BAD_INDENT","Block scalar values in collections must be indented");break}J+=O.length+U.length+1}for(let X=B.length-1;X>=G;--X)if(B[X][0].length>z)G=X+1;let H="",M="",T=!1;for(let X=0;X<Z;++X)H+=B[X][0].slice(z)+`
|
|
96
|
-
`;for(let X=Z;X<G;++X){let[O,U]=B[X];J+=O.length+U.length+1;let F=U[U.length-1]==="\r";if(F)U=U.slice(0,-1);if(U&&O.length<z){let V=`Block scalar lines must not be less indented than their ${f.indent?"explicit indentation indicator":"first line"}`;A(J-U.length-(F?2:1),"BAD_INDENT",V),O=""}if(P===s3.Scalar.BLOCK_LITERAL)H+=M+O.slice(z)+U,M=`
|
|
97
|
-
`;else if(O.length>z||U[0]==="\t"){if(M===" ")M=`
|
|
98
|
-
`;else if(!T&&M===`
|
|
99
|
-
`)M=`
|
|
100
|
-
|
|
101
|
-
`;H+=M+O.slice(z)+U,M=`
|
|
102
|
-
`,T=!0}else if(U==="")if(M===`
|
|
103
|
-
`)H+=`
|
|
104
|
-
`;else M=`
|
|
105
|
-
`;else H+=M+U,M=" ",T=!1}switch(f.chomp){case"-":break;case"+":for(let X=G;X<B.length;++X)H+=`
|
|
106
|
-
`+B[X][0].slice(z);if(H[H.length-1]!==`
|
|
107
|
-
`)H+=`
|
|
108
|
-
`;break;default:H+=`
|
|
109
|
-
`}let Q=$+f.length+R.source.length;return{value:H,type:P,comment:f.comment,range:[$,Q,Q]}}function MY({offset:D,props:R},A,$){if(R[0].type!=="block-scalar-header")return $(R[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:f}=R[0],P=f[0],B=0,G="",z=-1;for(let M=1;M<f.length;++M){let T=f[M];if(!G&&(T==="-"||T==="+"))G=T;else{let Q=Number(T);if(!B&&Q)B=Q;else if(z===-1)z=D+M}}if(z!==-1)$(z,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${f}`);let J=!1,Z="",H=f.length;for(let M=1;M<R.length;++M){let T=R[M];switch(T.type){case"space":J=!0;case"newline":H+=T.source.length;break;case"comment":if(A&&!J)$(T,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");H+=T.source.length,Z=T.source.substring(1);break;case"error":$(T,"UNEXPECTED_TOKEN",T.message),H+=T.source.length;break;default:{let Q=`Unexpected token in block scalar header: ${T.type}`;$(T,"UNEXPECTED_TOKEN",Q);let X=T.source;if(X&&typeof X==="string")H+=X.length}}}return{mode:P,indent:B,chomp:G,comment:Z,length:H}}function XY(D){let R=D.split(/\n( *)/),A=R[0],$=A.match(/^( *)/),P=[$?.[1]?[$[1],A.slice($[1].length)]:["",A]];for(let B=1;B<R.length;B+=2)P.push([R[B],R[B+1]]);return P}TY.resolveBlockScalar=ZY});var t3=q((LY)=>{var c3=o(),QY=x1();function YY(D,R,A){let{offset:$,type:f,source:P,end:B}=D,G,z,J=(M,T,Q)=>A($+M,T,Q);switch(f){case"scalar":G=c3.Scalar.PLAIN,z=_Y(P,J);break;case"single-quoted-scalar":G=c3.Scalar.QUOTE_SINGLE,z=UY(P,J);break;case"double-quoted-scalar":G=c3.Scalar.QUOTE_DOUBLE,z=FY(P,J);break;default:return A(D,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${f}`),{value:"",type:null,comment:"",range:[$,$+P.length,$+P.length]}}let Z=$+P.length,H=QY.resolveEnd(B,Z,R,A);return{value:z,type:G,comment:H.comment,range:[$,Z,H.offset]}}function _Y(D,R){let A="";switch(D[0]){case"\t":A="a tab character";break;case",":A="flow indicator character ,";break;case"%":A="directive indicator character %";break;case"|":case">":{A=`block scalar indicator ${D[0]}`;break}case"@":case"`":{A=`reserved character ${D[0]}`;break}}if(A)R(0,"BAD_SCALAR_START",`Plain value cannot start with ${A}`);return r8(D)}function UY(D,R){if(D[D.length-1]!=="'"||D.length===1)R(D.length,"MISSING_CHAR","Missing closing 'quote");return r8(D.slice(1,-1)).replace(/''/g,"'")}function r8(D){let R,A;try{R=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
110
|
-
`,"sy"),A=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
111
|
-
`,"sy")}catch{R=/(.*?)[ \t]*\r?\n/sy,A=/[ \t]*(.*?)[ \t]*\r?\n/sy}let $=R.exec(D);if(!$)return D;let f=$[1],P=" ",B=R.lastIndex;A.lastIndex=B;while($=A.exec(D)){if($[1]==="")if(P===`
|
|
112
|
-
`)f+=P;else P=`
|
|
113
|
-
`;else f+=P+$[1],P=" ";B=A.lastIndex}let G=/[ \t]*(.*)/sy;return G.lastIndex=B,$=G.exec(D),f+P+($?.[1]??"")}function FY(D,R){let A="";for(let $=1;$<D.length-1;++$){let f=D[$];if(f==="\r"&&D[$+1]===`
|
|
114
|
-
`)continue;if(f===`
|
|
115
|
-
`){let{fold:P,offset:B}=qY(D,$);A+=P,$=B}else if(f==="\\"){let P=D[++$],B=wY[P];if(B)A+=B;else if(P===`
|
|
116
|
-
`){P=D[$+1];while(P===" "||P==="\t")P=D[++$+1]}else if(P==="\r"&&D[$+1]===`
|
|
117
|
-
`){P=D[++$+1];while(P===" "||P==="\t")P=D[++$+1]}else if(P==="x"||P==="u"||P==="U"){let G={x:2,u:4,U:8}[P];A+=CY(D,$+1,G,R),$+=G}else{let G=D.substr($-1,2);R($-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${G}`),A+=G}}else if(f===" "||f==="\t"){let P=$,B=D[$+1];while(B===" "||B==="\t")B=D[++$+1];if(B!==`
|
|
118
|
-
`&&!(B==="\r"&&D[$+2]===`
|
|
119
|
-
`))A+=$>P?D.slice(P,$+1):f}else A+=f}if(D[D.length-1]!=='"'||D.length===1)R(D.length,"MISSING_CHAR",'Missing closing "quote');return A}function qY(D,R){let A="",$=D[R+1];while($===" "||$==="\t"||$===`
|
|
120
|
-
`||$==="\r"){if($==="\r"&&D[R+2]!==`
|
|
121
|
-
`)break;if($===`
|
|
122
|
-
`)A+=`
|
|
123
|
-
`;R+=1,$=D[R+1]}if(!A)A=" ";return{fold:A,offset:R}}var wY={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
124
|
-
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function CY(D,R,A,$){let f=D.substr(R,A),B=f.length===A&&/^[0-9a-fA-F]+$/.test(f)?parseInt(f,16):NaN;if(isNaN(B)){let G=D.substr(R-2,A+2);return $(R-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${G}`),G}return String.fromCodePoint(B)}LY.resolveFlowScalar=YY});var o8=q((SY)=>{var $1=m(),s8=o(),VY=o3(),IY=t3();function KY(D,R,A,$){let{value:f,type:P,comment:B,range:G}=R.type==="block-scalar"?VY.resolveBlockScalar(D,R,$):IY.resolveFlowScalar(R,D.options.strict,$),z=A?D.directives.tagName(A.source,(H)=>$(A,"TAG_RESOLVE_FAILED",H)):null,J;if(D.options.stringKeys&&D.atKey)J=D.schema[$1.SCALAR];else if(z)J=WY(D.schema,f,z,A,$);else if(R.type==="scalar")J=jY(D,f,R,$);else J=D.schema[$1.SCALAR];let Z;try{let H=J.resolve(f,(M)=>$(A??R,"TAG_RESOLVE_FAILED",M),D.options);Z=$1.isScalar(H)?H:new s8.Scalar(H)}catch(H){let M=H instanceof Error?H.message:String(H);$(A??R,"TAG_RESOLVE_FAILED",M),Z=new s8.Scalar(f)}if(Z.range=G,Z.source=f,P)Z.type=P;if(z)Z.tag=z;if(J.format)Z.format=J.format;if(B)Z.comment=B;return Z}function WY(D,R,A,$,f){if(A==="!")return D[$1.SCALAR];let P=[];for(let G of D.tags)if(!G.collection&&G.tag===A)if(G.default&&G.test)P.push(G);else return G;for(let G of P)if(G.test?.test(R))return G;let B=D.knownTags[A];if(B&&!B.collection)return D.tags.push(Object.assign({},B,{default:!1,test:void 0})),B;return f($,"TAG_RESOLVE_FAILED",`Unresolved tag: ${A}`,A!=="tag:yaml.org,2002:str"),D[$1.SCALAR]}function jY({atKey:D,directives:R,schema:A},$,f,P){let B=A.tags.find((G)=>(G.default===!0||D&&G.default==="key")&&G.test?.test($))||A[$1.SCALAR];if(A.compat){let G=A.compat.find((z)=>z.default&&z.test?.test($))??A[$1.SCALAR];if(B.tag!==G.tag){let z=R.tagString(B.tag),J=R.tagString(G.tag),Z=`Value may be parsed as either ${z} or ${J}`;P(f,"TAG_RESOLVE_FAILED",Z,!0)}}return B}SY.composeScalar=KY});var c8=q((EY)=>{function uY(D,R,A){if(R){A??(A=R.length);for(let $=A-1;$>=0;--$){let f=R[$];switch(f.type){case"space":case"comment":case"newline":D-=f.source.length;continue}f=R[++$];while(f?.type==="space")D+=f.source.length,f=R[++$];break}}return D}EY.emptyScalarPosition=uY});var DB=q((lY)=>{var gY=SR(),mY=m(),xY=a8(),t8=o8(),nY=x1(),pY=c8(),hY={composeNode:e8,composeEmptyNode:e3};function e8(D,R,A,$){let f=D.atKey,{spaceBefore:P,comment:B,anchor:G,tag:z}=A,J,Z=!0;switch(R.type){case"alias":if(J=vY(D,R,$),G||z)$(R,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(J=t8.composeScalar(D,R,z,$),G)J.anchor=G.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(J=xY.composeCollection(hY,D,R,A,$),G)J.anchor=G.source.substring(1)}catch(H){let M=H instanceof Error?H.message:String(H);$(R,"RESOURCE_EXHAUSTION",M)}break;default:{let H=R.type==="error"?R.message:`Unsupported token (type: ${R.type})`;$(R,"UNEXPECTED_TOKEN",H),Z=!1}}if(J??(J=e3(D,R.offset,void 0,null,A,$)),G&&J.anchor==="")$(G,"BAD_ALIAS","Anchor cannot be an empty string");if(f&&D.options.stringKeys&&(!mY.isScalar(J)||typeof J.value!=="string"||J.tag&&J.tag!=="tag:yaml.org,2002:str"))$(z??R,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(P)J.spaceBefore=!0;if(B)if(R.type==="scalar"&&R.source==="")J.comment=B;else J.commentBefore=B;if(D.options.keepSourceTokens&&Z)J.srcToken=R;return J}function e3(D,R,A,$,{spaceBefore:f,comment:P,anchor:B,tag:G,end:z},J){let Z={type:"scalar",offset:pY.emptyScalarPosition(R,A,$),indent:-1,source:""},H=t8.composeScalar(D,Z,G,J);if(B){if(H.anchor=B.source.substring(1),H.anchor==="")J(B,"BAD_ALIAS","Anchor cannot be an empty string")}if(f)H.spaceBefore=!0;if(P)H.comment=P,H.range[2]=z;return H}function vY({options:D},{offset:R,source:A,end:$},f){let P=new gY.Alias(A.substring(1));if(P.source==="")f(R,"BAD_ALIAS","Alias cannot be an empty string");if(P.source.endsWith(":"))f(R+A.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let B=R+A.length,G=nY.resolveEnd($,B,D.strict,f);if(P.range=[R,B,G.offset],G.comment)P.comment=G.comment;return P}lY.composeEmptyNode=e3;lY.composeNode=e8});var AB=q((oY)=>{var iY=iR(),RB=DB(),aY=x1(),rY=rR();function sY(D,R,{offset:A,start:$,value:f,end:P},B){let G=Object.assign({_directives:R},D),z=new iY.Document(void 0,G),J={atKey:!1,atRoot:!0,directives:z.directives,options:z.options,schema:z.schema},Z=rY.resolveProps($,{indicator:"doc-start",next:f??P?.[0],offset:A,onError:B,parentIndent:0,startOnNewline:!0});if(Z.found){if(z.directives.docStart=!0,f&&(f.type==="block-map"||f.type==="block-seq")&&!Z.hasNewline)B(Z.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}z.contents=f?RB.composeNode(J,f,Z,B):RB.composeEmptyNode(J,Z.end,$,null,Z,B);let H=z.contents.range[2],M=aY.resolveEnd(P,H,!1,B);if(M.comment)z.comment=M.comment;return z.range=[A,H,M.offset],z}oY.composeDoc=sY});var DP=q(($_)=>{var tY=p("process"),eY=f3(),D_=iR(),sR=aR(),$B=m(),R_=AB(),A_=x1();function oR(D){if(typeof D==="number")return[D,D+1];if(Array.isArray(D))return D.length===2?D:[D[0],D[1]];let{offset:R,source:A}=D;return[R,R+(typeof A==="string"?A.length:1)]}function fB(D){let R="",A=!1,$=!1;for(let f=0;f<D.length;++f){let P=D[f];switch(P[0]){case"#":R+=(R===""?"":$?`
|
|
125
|
-
|
|
126
|
-
`:`
|
|
127
|
-
`)+(P.substring(1)||" "),A=!0,$=!1;break;case"%":if(D[f+1]?.[0]!=="#")f+=1;A=!1;break;default:if(!A)$=!0;A=!1}}return{comment:R,afterEmptyLine:$}}class PB{constructor(D={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(R,A,$,f)=>{let P=oR(R);if(f)this.warnings.push(new sR.YAMLWarning(P,A,$));else this.errors.push(new sR.YAMLParseError(P,A,$))},this.directives=new eY.Directives({version:D.version||"1.2"}),this.options=D}decorate(D,R){let{comment:A,afterEmptyLine:$}=fB(this.prelude);if(A){let f=D.contents;if(R)D.comment=D.comment?`${D.comment}
|
|
128
|
-
${A}`:A;else if($||D.directives.docStart||!f)D.commentBefore=A;else if($B.isCollection(f)&&!f.flow&&f.items.length>0){let P=f.items[0];if($B.isPair(P))P=P.key;let B=P.commentBefore;P.commentBefore=B?`${A}
|
|
129
|
-
${B}`:A}else{let P=f.commentBefore;f.commentBefore=P?`${A}
|
|
130
|
-
${P}`:A}}if(R)Array.prototype.push.apply(D.errors,this.errors),Array.prototype.push.apply(D.warnings,this.warnings);else D.errors=this.errors,D.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:fB(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(D,R=!1,A=-1){for(let $ of D)yield*this.next($);yield*this.end(R,A)}*next(D){if(tY.env.LOG_STREAM)console.dir(D,{depth:null});switch(D.type){case"directive":this.directives.add(D.source,(R,A,$)=>{let f=oR(D);f[0]+=R,this.onError(f,"BAD_DIRECTIVE",A,$)}),this.prelude.push(D.source),this.atDirectives=!0;break;case"document":{let R=R_.composeDoc(this.options,this.directives,D,this.onError);if(this.atDirectives&&!R.directives.docStart)this.onError(D,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(R,!1),this.doc)yield this.doc;this.doc=R,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(D.source);break;case"error":{let R=D.source?`${D.message}: ${JSON.stringify(D.source)}`:D.message,A=new sR.YAMLParseError(oR(D),"UNEXPECTED_TOKEN",R);if(this.atDirectives||!this.doc)this.errors.push(A);else this.doc.errors.push(A);break}case"doc-end":{if(!this.doc){this.errors.push(new sR.YAMLParseError(oR(D),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let R=A_.resolveEnd(D.end,D.offset+D.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),R.comment){let A=this.doc.comment;this.doc.comment=A?`${A}
|
|
131
|
-
${R.comment}`:R.comment}this.doc.range[2]=R.offset;break}default:this.errors.push(new sR.YAMLParseError(oR(D),"UNEXPECTED_TOKEN",`Unsupported token ${D.type}`))}}*end(D=!1,R=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(D){let A=Object.assign({_directives:this.directives},this.options),$=new D_.Document(void 0,A);if(this.atDirectives)this.onError(R,"MISSING_CHAR","Missing directives-end indicator line");$.range=[0,R,R],this.decorate($,!1),yield $}}}$_.Composer=PB});var zB=q((M_)=>{var P_=o3(),B_=t3(),G_=aR(),BB=yR();function z_(D,R=!0,A){if(D){let $=(f,P,B)=>{let G=typeof f==="number"?f:Array.isArray(f)?f[0]:f.offset;if(A)A(G,P,B);else throw new G_.YAMLParseError([G,G+1],P,B)};switch(D.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return B_.resolveFlowScalar(D,R,$);case"block-scalar":return P_.resolveBlockScalar({options:{strict:R}},D,$)}}return null}function J_(D,R){let{implicitKey:A=!1,indent:$,inFlow:f=!1,offset:P=-1,type:B="PLAIN"}=R,G=BB.stringifyString({type:B,value:D},{implicitKey:A,indent:$>0?" ".repeat($):"",inFlow:f,options:{blockQuote:!0,lineWidth:-1}}),z=R.end??[{type:"newline",offset:-1,indent:$,source:`
|
|
132
|
-
`}];switch(G[0]){case"|":case">":{let J=G.indexOf(`
|
|
133
|
-
`),Z=G.substring(0,J),H=G.substring(J+1)+`
|
|
134
|
-
`,M=[{type:"block-scalar-header",offset:P,indent:$,source:Z}];if(!GB(M,z))M.push({type:"newline",offset:-1,indent:$,source:`
|
|
135
|
-
`});return{type:"block-scalar",offset:P,indent:$,props:M,source:H}}case'"':return{type:"double-quoted-scalar",offset:P,indent:$,source:G,end:z};case"'":return{type:"single-quoted-scalar",offset:P,indent:$,source:G,end:z};default:return{type:"scalar",offset:P,indent:$,source:G,end:z}}}function H_(D,R,A={}){let{afterKey:$=!1,implicitKey:f=!1,inFlow:P=!1,type:B}=A,G="indent"in D?D.indent:null;if($&&typeof G==="number")G+=2;if(!B)switch(D.type){case"single-quoted-scalar":B="QUOTE_SINGLE";break;case"double-quoted-scalar":B="QUOTE_DOUBLE";break;case"block-scalar":{let J=D.props[0];if(J.type!=="block-scalar-header")throw Error("Invalid block scalar header");B=J.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:B="PLAIN"}let z=BB.stringifyString({type:B,value:R},{implicitKey:f||G===null,indent:G!==null&&G>0?" ".repeat(G):"",inFlow:P,options:{blockQuote:!0,lineWidth:-1}});switch(z[0]){case"|":case">":Z_(D,z);break;case'"':RP(D,z,"double-quoted-scalar");break;case"'":RP(D,z,"single-quoted-scalar");break;default:RP(D,z,"scalar")}}function Z_(D,R){let A=R.indexOf(`
|
|
136
|
-
`),$=R.substring(0,A),f=R.substring(A+1)+`
|
|
137
|
-
`;if(D.type==="block-scalar"){let P=D.props[0];if(P.type!=="block-scalar-header")throw Error("Invalid block scalar header");P.source=$,D.source=f}else{let{offset:P}=D,B="indent"in D?D.indent:-1,G=[{type:"block-scalar-header",offset:P,indent:B,source:$}];if(!GB(G,"end"in D?D.end:void 0))G.push({type:"newline",offset:-1,indent:B,source:`
|
|
138
|
-
`});for(let z of Object.keys(D))if(z!=="type"&&z!=="offset")delete D[z];Object.assign(D,{type:"block-scalar",indent:B,props:G,source:f})}}function GB(D,R){if(R)for(let A of R)switch(A.type){case"space":case"comment":D.push(A);break;case"newline":return D.push(A),!0}return!1}function RP(D,R,A){switch(D.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":D.type=A,D.source=R;break;case"block-scalar":{let $=D.props.slice(1),f=R.length;if(D.props[0].type==="block-scalar-header")f-=D.props[0].source.length;for(let P of $)P.offset+=f;delete D.props,Object.assign(D,{type:A,source:R,end:$});break}case"block-map":case"block-seq":{let f={type:"newline",offset:D.offset+R.length,indent:D.indent,source:`
|
|
139
|
-
`};delete D.items,Object.assign(D,{type:A,source:R,end:[f]});break}default:{let $="indent"in D?D.indent:-1,f="end"in D&&Array.isArray(D.end)?D.end.filter((P)=>P.type==="space"||P.type==="comment"||P.type==="newline"):[];for(let P of Object.keys(D))if(P!=="type"&&P!=="offset")delete D[P];Object.assign(D,{type:A,indent:$,source:R,end:f})}}}M_.createScalarToken=J_;M_.resolveAsScalar=z_;M_.setScalarValue=H_});var JB=q((Y_)=>{var Q_=(D)=>("type"in D)?g$(D):y$(D);function g$(D){switch(D.type){case"block-scalar":{let R="";for(let A of D.props)R+=g$(A);return R+D.source}case"block-map":case"block-seq":{let R="";for(let A of D.items)R+=y$(A);return R}case"flow-collection":{let R=D.start.source;for(let A of D.items)R+=y$(A);for(let A of D.end)R+=A.source;return R}case"document":{let R=y$(D);if(D.end)for(let A of D.end)R+=A.source;return R}default:{let R=D.source;if("end"in D&&D.end)for(let A of D.end)R+=A.source;return R}}}function y$({start:D,key:R,sep:A,value:$}){let f="";for(let P of D)f+=P.source;if(R)f+=g$(R);if(A)for(let P of A)f+=P.source;if($)f+=g$($);return f}Y_.stringify=Q_});var MB=q((F_)=>{var AP=Symbol("break visit"),U_=Symbol("skip children"),HB=Symbol("remove item");function f1(D,R){if("type"in D&&D.type==="document")D={start:D.start,value:D.value};ZB(Object.freeze([]),D,R)}f1.BREAK=AP;f1.SKIP=U_;f1.REMOVE=HB;f1.itemAtPath=(D,R)=>{let A=D;for(let[$,f]of R){let P=A?.[$];if(P&&"items"in P)A=P.items[f];else return}return A};f1.parentCollection=(D,R)=>{let A=f1.itemAtPath(D,R.slice(0,-1)),$=R[R.length-1][0],f=A?.[$];if(f&&"items"in f)return f;throw Error("Parent collection not found")};function ZB(D,R,A){let $=A(R,D);if(typeof $==="symbol")return $;for(let f of["key","value"]){let P=R[f];if(P&&"items"in P){for(let B=0;B<P.items.length;++B){let G=ZB(Object.freeze(D.concat([[f,B]])),P.items[B],A);if(typeof G==="number")B=G-1;else if(G===AP)return AP;else if(G===HB)P.items.splice(B,1),B-=1}if(typeof $==="function"&&f==="key")$=$(R,D)}}return typeof $==="function"?$(R,D):$}F_.visit=f1});var m$=q((K_)=>{var $P=zB(),w_=JB(),C_=MB(),fP="\uFEFF",PP="\x02",BP="\x18",GP="\x1F",L_=(D)=>!!D&&("items"in D),N_=(D)=>!!D&&(D.type==="scalar"||D.type==="single-quoted-scalar"||D.type==="double-quoted-scalar"||D.type==="block-scalar");function V_(D){switch(D){case fP:return"<BOM>";case PP:return"<DOC>";case BP:return"<FLOW_END>";case GP:return"<SCALAR>";default:return JSON.stringify(D)}}function I_(D){switch(D){case fP:return"byte-order-mark";case PP:return"doc-mode";case BP:return"flow-error-end";case GP:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
140
|
-
`:case`\r
|
|
141
|
-
`: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(D[0]){case" ":case"\t":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}K_.createScalarToken=$P.createScalarToken;K_.resolveAsScalar=$P.resolveAsScalar;K_.setScalarValue=$P.setScalarValue;K_.stringify=w_.stringify;K_.visit=C_.visit;K_.BOM=fP;K_.DOCUMENT=PP;K_.FLOW_END=BP;K_.SCALAR=GP;K_.isCollection=L_;K_.isScalar=N_;K_.prettyToken=V_;K_.tokenType=I_});var JP=q((d_)=>{var cR=m$();function W0(D){switch(D){case void 0:case" ":case`
|
|
142
|
-
`:case"\r":case"\t":return!0;default:return!1}}var XB=new Set("0123456789ABCDEFabcdef"),v_=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),x$=new Set(",[]{}"),l_=new Set(` ,[]{}
|
|
143
|
-
\r `),zP=(D)=>!D||l_.has(D);class TB{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(D,R=!1){if(D){if(typeof D!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+D:D,this.lineEndPos=null}this.atEnd=!R;let A=this.next??"stream";while(A&&(R||this.hasChars(1)))A=yield*this.parseNext(A)}atLineEnd(){let D=this.pos,R=this.buffer[D];while(R===" "||R==="\t")R=this.buffer[++D];if(!R||R==="#"||R===`
|
|
144
|
-
`)return!0;if(R==="\r")return this.buffer[D+1]===`
|
|
145
|
-
`;return!1}charAt(D){return this.buffer[this.pos+D]}continueScalar(D){let R=this.buffer[D];if(this.indentNext>0){let A=0;while(R===" ")R=this.buffer[++A+D];if(R==="\r"){let $=this.buffer[A+D+1];if($===`
|
|
146
|
-
`||!$&&!this.atEnd)return D+A+1}return R===`
|
|
147
|
-
`||A>=this.indentNext||!R&&!this.atEnd?D+A:-1}if(R==="-"||R==="."){let A=this.buffer.substr(D,3);if((A==="---"||A==="...")&&W0(this.buffer[D+3]))return-1}return D}getLine(){let D=this.lineEndPos;if(typeof D!=="number"||D!==-1&&D<this.pos)D=this.buffer.indexOf(`
|
|
148
|
-
`,this.pos),this.lineEndPos=D;if(D===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[D-1]==="\r")D-=1;return this.buffer.substring(this.pos,D)}hasChars(D){return this.pos+D<=this.buffer.length}setNext(D){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=D,null}peek(D){return this.buffer.substr(this.pos,D)}*parseNext(D){switch(D){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 D=this.getLine();if(D===null)return this.setNext("stream");if(D[0]===cR.BOM)yield*this.pushCount(1),D=D.substring(1);if(D[0]==="%"){let R=D.length,A=D.indexOf("#");while(A!==-1){let f=D[A-1];if(f===" "||f==="\t"){R=A-1;break}else A=D.indexOf("#",A+1)}while(!0){let f=D[R-1];if(f===" "||f==="\t")R-=1;else break}let $=(yield*this.pushCount(R))+(yield*this.pushSpaces(!0));return yield*this.pushCount(D.length-$),this.pushNewline(),"stream"}if(this.atLineEnd()){let R=yield*this.pushSpaces(!0);return yield*this.pushCount(D.length-R),yield*this.pushNewline(),"stream"}return yield cR.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let D=this.charAt(0);if(!D&&!this.atEnd)return this.setNext("line-start");if(D==="-"||D==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let R=this.peek(3);if((R==="---"||R==="...")&&W0(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,R==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!W0(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[D,R]=this.peek(2);if(!R&&!this.atEnd)return this.setNext("block-start");if((D==="-"||D==="?"||D===":")&&W0(R)){let A=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=A,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let D=this.getLine();if(D===null)return this.setNext("doc");let R=yield*this.pushIndicators();switch(D[R]){case"#":yield*this.pushCount(D.length-R);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(zP),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return R+=yield*this.parseBlockScalarHeader(),R+=yield*this.pushSpaces(!0),yield*this.pushCount(D.length-R),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let D,R,A=-1;do{if(D=yield*this.pushNewline(),D>0)R=yield*this.pushSpaces(!1),this.indentValue=A=R;else R=0;R+=yield*this.pushSpaces(!0)}while(D+R>0);let $=this.getLine();if($===null)return this.setNext("flow");if(A!==-1&&A<this.indentNext&&$[0]!=="#"||A===0&&($.startsWith("---")||$.startsWith("..."))&&W0($[3])){if(!(A===this.indentNext-1&&this.flowLevel===1&&($[0]==="]"||$[0]==="}")))return this.flowLevel=0,yield cR.FLOW_END,yield*this.parseLineStart()}let f=0;while($[f]===",")f+=yield*this.pushCount(1),f+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(f+=yield*this.pushIndicators(),$[f]){case void 0:return"flow";case"#":return yield*this.pushCount($.length-f),"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(zP),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let P=this.charAt(1);if(this.flowKey||W0(P)||P===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let D=this.charAt(0),R=this.buffer.indexOf(D,this.pos+1);if(D==="'")while(R!==-1&&this.buffer[R+1]==="'")R=this.buffer.indexOf("'",R+2);else while(R!==-1){let f=0;while(this.buffer[R-1-f]==="\\")f+=1;if(f%2===0)break;R=this.buffer.indexOf('"',R+1)}let A=this.buffer.substring(0,R),$=A.indexOf(`
|
|
149
|
-
`,this.pos);if($!==-1){while($!==-1){let f=this.continueScalar($+1);if(f===-1)break;$=A.indexOf(`
|
|
150
|
-
`,f)}if($!==-1)R=$-(A[$-1]==="\r"?2:1)}if(R===-1){if(!this.atEnd)return this.setNext("quoted-scalar");R=this.buffer.length}return yield*this.pushToIndex(R+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let D=this.pos;while(!0){let R=this.buffer[++D];if(R==="+")this.blockScalarKeep=!0;else if(R>"0"&&R<="9")this.blockScalarIndent=Number(R)-1;else if(R!=="-")break}return yield*this.pushUntil((R)=>W0(R)||R==="#")}*parseBlockScalar(){let D=this.pos-1,R=0,A;D:for(let f=this.pos;A=this.buffer[f];++f)switch(A){case" ":R+=1;break;case`
|
|
151
|
-
`:D=f,R=0;break;case"\r":{let P=this.buffer[f+1];if(!P&&!this.atEnd)return this.setNext("block-scalar");if(P===`
|
|
152
|
-
`)break}default:break D}if(!A&&!this.atEnd)return this.setNext("block-scalar");if(R>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=R;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let f=this.continueScalar(D+1);if(f===-1)break;D=this.buffer.indexOf(`
|
|
153
|
-
`,f)}while(D!==-1);if(D===-1){if(!this.atEnd)return this.setNext("block-scalar");D=this.buffer.length}}let $=D+1;A=this.buffer[$];while(A===" ")A=this.buffer[++$];if(A==="\t"){while(A==="\t"||A===" "||A==="\r"||A===`
|
|
154
|
-
`)A=this.buffer[++$];D=$-1}else if(!this.blockScalarKeep)do{let f=D-1,P=this.buffer[f];if(P==="\r")P=this.buffer[--f];let B=f;while(P===" ")P=this.buffer[--f];if(P===`
|
|
155
|
-
`&&f>=this.pos&&f+1+R>B)D=f;else break}while(!0);return yield cR.SCALAR,yield*this.pushToIndex(D+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let D=this.flowLevel>0,R=this.pos-1,A=this.pos-1,$;while($=this.buffer[++A])if($===":"){let f=this.buffer[A+1];if(W0(f)||D&&x$.has(f))break;R=A}else if(W0($)){let f=this.buffer[A+1];if($==="\r")if(f===`
|
|
156
|
-
`)A+=1,$=`
|
|
157
|
-
`,f=this.buffer[A+1];else R=A;if(f==="#"||D&&x$.has(f))break;if($===`
|
|
158
|
-
`){let P=this.continueScalar(A+1);if(P===-1)break;A=Math.max(A,P-2)}}else{if(D&&x$.has($))break;R=A}if(!$&&!this.atEnd)return this.setNext("plain-scalar");return yield cR.SCALAR,yield*this.pushToIndex(R+1,!0),D?"flow":"doc"}*pushCount(D){if(D>0)return yield this.buffer.substr(this.pos,D),this.pos+=D,D;return 0}*pushToIndex(D,R){let A=this.buffer.slice(this.pos,D);if(A)return yield A,this.pos+=A.length,A.length;else if(R)yield"";return 0}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(zP))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let D=this.flowLevel>0,R=this.charAt(1);if(W0(R)||D&&x$.has(R)){if(!D)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;return(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}}return 0}*pushTag(){if(this.charAt(1)==="<"){let D=this.pos+2,R=this.buffer[D];while(!W0(R)&&R!==">")R=this.buffer[++D];return yield*this.pushToIndex(R===">"?D+1:D,!1)}else{let D=this.pos+1,R=this.buffer[D];while(R)if(v_.has(R))R=this.buffer[++D];else if(R==="%"&&XB.has(this.buffer[D+1])&&XB.has(this.buffer[D+2]))R=this.buffer[D+=3];else break;return yield*this.pushToIndex(D,!1)}}*pushNewline(){let D=this.buffer[this.pos];if(D===`
|
|
159
|
-
`)return yield*this.pushCount(1);else if(D==="\r"&&this.charAt(1)===`
|
|
160
|
-
`)return yield*this.pushCount(2);else return 0}*pushSpaces(D){let R=this.pos-1,A;do A=this.buffer[++R];while(A===" "||D&&A==="\t");let $=R-this.pos;if($>0)yield this.buffer.substr(this.pos,$),this.pos=R;return $}*pushUntil(D){let R=this.pos,A=this.buffer[R];while(!D(A))A=this.buffer[++R];return yield*this.pushToIndex(R,!1)}}d_.Lexer=TB});var HP=q((i_)=>{class OB{constructor(){this.lineStarts=[],this.addNewLine=(D)=>this.lineStarts.push(D),this.linePos=(D)=>{let R=0,A=this.lineStarts.length;while(R<A){let f=R+A>>1;if(this.lineStarts[f]<D)R=f+1;else A=f}if(this.lineStarts[R]===D)return{line:R+1,col:1};if(R===0)return{line:0,col:D};let $=this.lineStarts[R-1];return{line:R,col:D-$+1}}}}i_.LineCounter=OB});var ZP=q((o_)=>{var r_=p("process"),QB=m$(),s_=JP();function ID(D,R){for(let A=0;A<D.length;++A)if(D[A].type===R)return!0;return!1}function YB(D){for(let R=0;R<D.length;++R)switch(D[R].type){case"space":case"comment":case"newline":break;default:return R}return-1}function UB(D){switch(D?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function n$(D){switch(D.type){case"document":return D.start;case"block-map":{let R=D.items[D.items.length-1];return R.sep??R.start}case"block-seq":return D.items[D.items.length-1].start;default:return[]}}function n1(D){if(D.length===0)return[];let R=D.length;D:while(--R>=0)switch(D[R].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break D}while(D[++R]?.type==="space");return D.splice(R,D.length)}function _B(D){if(D.start.type==="flow-seq-start"){for(let R of D.items)if(R.sep&&!R.value&&!ID(R.start,"explicit-key-ind")&&!ID(R.sep,"map-value-ind")){if(R.key)R.value=R.key;if(delete R.key,UB(R.value))if(R.value.end)Array.prototype.push.apply(R.value.end,R.sep);else R.value.end=R.sep;else Array.prototype.push.apply(R.start,R.sep);delete R.sep}}}class FB{constructor(D){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new s_.Lexer,this.onNewLine=D}*parse(D,R=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let A of this.lexer.lex(D,R))yield*this.next(A);if(!R)yield*this.end()}*next(D){if(this.source=D,r_.env.LOG_TOKENS)console.log("|",QB.prettyToken(D));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=D.length;return}let R=QB.tokenType(D);if(!R){let A=`Not a YAML token: ${D}`;yield*this.pop({type:"error",offset:this.offset,message:A,source:D}),this.offset+=D.length}else if(R==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=R,yield*this.step(),R){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+D.length);break;case"space":if(this.atNewLine&&D[0]===" ")this.indent+=D.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=D.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=D.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let D=this.peek(1);if(this.type==="doc-end"&&D?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!D)return yield*this.stream();switch(D.type){case"document":return yield*this.document(D);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(D);case"block-scalar":return yield*this.blockScalar(D);case"block-map":return yield*this.blockMap(D);case"block-seq":return yield*this.blockSequence(D);case"flow-collection":return yield*this.flowCollection(D);case"doc-end":return yield*this.documentEnd(D)}yield*this.pop()}peek(D){return this.stack[this.stack.length-D]}*pop(D){let R=D??this.stack.pop();if(!R)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield R;else{let A=this.peek(1);if(R.type==="block-scalar")R.indent="indent"in A?A.indent:0;else if(R.type==="flow-collection"&&A.type==="document")R.indent=0;if(R.type==="flow-collection")_B(R);switch(A.type){case"document":A.value=R;break;case"block-scalar":A.props.push(R);break;case"block-map":{let $=A.items[A.items.length-1];if($.value){A.items.push({start:[],key:R,sep:[]}),this.onKeyLine=!0;return}else if($.sep)$.value=R;else{Object.assign($,{key:R,sep:[]}),this.onKeyLine=!$.explicitKey;return}break}case"block-seq":{let $=A.items[A.items.length-1];if($.value)A.items.push({start:[],value:R});else $.value=R;break}case"flow-collection":{let $=A.items[A.items.length-1];if(!$||$.value)A.items.push({start:[],key:R,sep:[]});else if($.sep)$.value=R;else Object.assign($,{key:R,sep:[]});return}default:yield*this.pop(),yield*this.pop(R)}if((A.type==="document"||A.type==="block-map"||A.type==="block-seq")&&(R.type==="block-map"||R.type==="block-seq")){let $=R.items[R.items.length-1];if($&&!$.sep&&!$.value&&$.start.length>0&&YB($.start)===-1&&(R.indent===0||$.start.every((f)=>f.type!=="comment"||f.indent<R.indent))){if(A.type==="document")A.end=$.start;else A.items.push({start:$.start});R.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 D={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")D.start.push(this.sourceToken);this.stack.push(D);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(D){if(D.value)return yield*this.lineEnd(D);switch(this.type){case"doc-start":{if(YB(D.start)!==-1)yield*this.pop(),yield*this.step();else D.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":D.start.push(this.sourceToken);return}let R=this.startBlockValue(D);if(R)this.stack.push(R);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(D){if(this.type==="map-value-ind"){let R=n$(this.peek(2)),A=n1(R),$;if(D.end)$=D.end,$.push(this.sourceToken),delete D.end;else $=[this.sourceToken];let f={type:"block-map",offset:D.offset,indent:D.indent,items:[{start:A,key:D,sep:$}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=f}else yield*this.lineEnd(D)}*blockScalar(D){switch(this.type){case"space":case"comment":case"newline":D.props.push(this.sourceToken);return;case"scalar":if(D.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let R=this.source.indexOf(`
|
|
161
|
-
`)+1;while(R!==0)this.onNewLine(this.offset+R),R=this.source.indexOf(`
|
|
162
|
-
`,R)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(D){let R=D.items[D.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,R.value){let A="end"in R.value?R.value.end:void 0;if((Array.isArray(A)?A[A.length-1]:void 0)?.type==="comment")A?.push(this.sourceToken);else D.items.push({start:[this.sourceToken]})}else if(R.sep)R.sep.push(this.sourceToken);else R.start.push(this.sourceToken);return;case"space":case"comment":if(R.value)D.items.push({start:[this.sourceToken]});else if(R.sep)R.sep.push(this.sourceToken);else{if(this.atIndentedComment(R.start,D.indent)){let $=D.items[D.items.length-2]?.value?.end;if(Array.isArray($)){Array.prototype.push.apply($,R.start),$.push(this.sourceToken),D.items.pop();return}}R.start.push(this.sourceToken)}return}if(this.indent>=D.indent){let A=!this.onKeyLine&&this.indent===D.indent,$=A&&(R.sep||R.explicitKey)&&this.type!=="seq-item-ind",f=[];if($&&R.sep&&!R.value){let P=[];for(let B=0;B<R.sep.length;++B){let G=R.sep[B];switch(G.type){case"newline":P.push(B);break;case"space":break;case"comment":if(G.indent>D.indent)P.length=0;break;default:P.length=0}}if(P.length>=2)f=R.sep.splice(P[1])}switch(this.type){case"anchor":case"tag":if($||R.value)f.push(this.sourceToken),D.items.push({start:f}),this.onKeyLine=!0;else if(R.sep)R.sep.push(this.sourceToken);else R.start.push(this.sourceToken);return;case"explicit-key-ind":if(!R.sep&&!R.explicitKey)R.start.push(this.sourceToken),R.explicitKey=!0;else if($||R.value)f.push(this.sourceToken),D.items.push({start:f,explicitKey:!0});else 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(R.explicitKey)if(!R.sep)if(ID(R.start,"newline"))Object.assign(R,{key:null,sep:[this.sourceToken]});else{let P=n1(R.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:P,key:null,sep:[this.sourceToken]}]})}else if(R.value)D.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ID(R.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:f,key:null,sep:[this.sourceToken]}]});else if(UB(R.key)&&!ID(R.sep,"newline")){let P=n1(R.start),B=R.key,G=R.sep;G.push(this.sourceToken),delete R.key,delete R.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:P,key:B,sep:G}]})}else if(f.length>0)R.sep=R.sep.concat(f,this.sourceToken);else R.sep.push(this.sourceToken);else if(!R.sep)Object.assign(R,{key:null,sep:[this.sourceToken]});else if(R.value||$)D.items.push({start:f,key:null,sep:[this.sourceToken]});else if(ID(R.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else R.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let P=this.flowScalar(this.type);if($||R.value)D.items.push({start:f,key:P,sep:[]}),this.onKeyLine=!0;else if(R.sep)this.stack.push(P);else Object.assign(R,{key:P,sep:[]}),this.onKeyLine=!0;return}default:{let P=this.startBlockValue(D);if(P){if(P.type==="block-seq"){if(!R.explicitKey&&R.sep&&!ID(R.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 if(A)D.items.push({start:f});this.stack.push(P);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(D){let R=D.items[D.items.length-1];switch(this.type){case"newline":if(R.value){let A="end"in R.value?R.value.end:void 0;if((Array.isArray(A)?A[A.length-1]:void 0)?.type==="comment")A?.push(this.sourceToken);else D.items.push({start:[this.sourceToken]})}else R.start.push(this.sourceToken);return;case"space":case"comment":if(R.value)D.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(R.start,D.indent)){let $=D.items[D.items.length-2]?.value?.end;if(Array.isArray($)){Array.prototype.push.apply($,R.start),$.push(this.sourceToken),D.items.pop();return}}R.start.push(this.sourceToken)}return;case"anchor":case"tag":if(R.value||this.indent<=D.indent)break;R.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==D.indent)break;if(R.value||ID(R.start,"seq-item-ind"))D.items.push({start:[this.sourceToken]});else R.start.push(this.sourceToken);return}if(this.indent>D.indent){let A=this.startBlockValue(D);if(A){this.stack.push(A);return}}yield*this.pop(),yield*this.step()}*flowCollection(D){let R=D.items[D.items.length-1];if(this.type==="flow-error-end"){let A;do yield*this.pop(),A=this.peek(1);while(A?.type==="flow-collection")}else if(D.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!R||R.sep)D.items.push({start:[this.sourceToken]});else R.start.push(this.sourceToken);return;case"map-value-ind":if(!R||R.value)D.items.push({start:[],key:null,sep:[this.sourceToken]});else if(R.sep)R.sep.push(this.sourceToken);else Object.assign(R,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!R||R.value)D.items.push({start:[this.sourceToken]});else if(R.sep)R.sep.push(this.sourceToken);else R.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let $=this.flowScalar(this.type);if(!R||R.value)D.items.push({start:[],key:$,sep:[]});else if(R.sep)this.stack.push($);else Object.assign(R,{key:$,sep:[]});return}case"flow-map-end":case"flow-seq-end":D.end.push(this.sourceToken);return}let A=this.startBlockValue(D);if(A)this.stack.push(A);else yield*this.pop(),yield*this.step()}else{let A=this.peek(2);if(A.type==="block-map"&&(this.type==="map-value-ind"&&A.indent===D.indent||this.type==="newline"&&!A.items[A.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&A.type!=="flow-collection"){let $=n$(A),f=n1($);_B(D);let P=D.end.splice(1,D.end.length);P.push(this.sourceToken);let B={type:"block-map",offset:D.offset,indent:D.indent,items:[{start:f,key:D,sep:P}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=B}else yield*this.lineEnd(D)}}flowScalar(D){if(this.onNewLine){let R=this.source.indexOf(`
|
|
163
|
-
`)+1;while(R!==0)this.onNewLine(this.offset+R),R=this.source.indexOf(`
|
|
164
|
-
`,R)+1}return{type:D,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(D){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 R=n$(D),A=n1(R);return A.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:A,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let R=n$(D),A=n1(R);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:A,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(D,R){if(this.type!=="comment")return!1;if(this.indent<=R)return!1;return D.every((A)=>A.type==="newline"||A.type==="space")}*documentEnd(D){if(this.type!=="doc-mode"){if(D.end)D.end.push(this.sourceToken);else D.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(D){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;case"space":case"comment":default:if(D.end)D.end.push(this.sourceToken);else D.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}o_.Parser=FB});var NB=q((PU)=>{var qB=DP(),t_=iR(),tR=aR(),e_=H3(),DU=m(),RU=HP(),wB=ZP();function CB(D){let R=D.prettyErrors!==!1;return{lineCounter:D.lineCounter||R&&new RU.LineCounter||null,prettyErrors:R}}function AU(D,R={}){let{lineCounter:A,prettyErrors:$}=CB(R),f=new wB.Parser(A?.addNewLine),P=new qB.Composer(R),B=Array.from(P.compose(f.parse(D)));if($&&A)for(let G of B)G.errors.forEach(tR.prettifyError(D,A)),G.warnings.forEach(tR.prettifyError(D,A));if(B.length>0)return B;return Object.assign([],{empty:!0},P.streamInfo())}function LB(D,R={}){let{lineCounter:A,prettyErrors:$}=CB(R),f=new wB.Parser(A?.addNewLine),P=new qB.Composer(R),B=null;for(let G of P.compose(f.parse(D),!0,D.length))if(!B)B=G;else if(B.options.logLevel!=="silent"){B.errors.push(new tR.YAMLParseError(G.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if($&&A)B.errors.forEach(tR.prettifyError(D,A)),B.warnings.forEach(tR.prettifyError(D,A));return B}function $U(D,R,A){let $=void 0;if(typeof R==="function")$=R;else if(A===void 0&&R&&typeof R==="object")A=R;let f=LB(D,A);if(!f)return null;if(f.warnings.forEach((P)=>e_.warn(f.options.logLevel,P)),f.errors.length>0)if(f.options.logLevel!=="silent")throw f.errors[0];else f.errors=[];return f.toJS(Object.assign({reviver:$},A))}function fU(D,R,A){let $=null;if(typeof R==="function"||Array.isArray(R))$=R;else if(A===void 0&&R)A=R;if(typeof A==="string")A=A.length;if(typeof A==="number"){let f=Math.round(A);A=f<1?void 0:f>8?{indent:8}:{indent:f}}if(D===void 0){let{keepUndefined:f}=A??R??{};if(!f)return}if(DU.isDocument(D)&&!$)return D.toString(A);return new t_.Document(D,$,A).toString(A)}PU.parse=$U;PU.parseAllDocuments=AU;PU.parseDocument=LB;PU.stringify=fU});var IB=q((wU)=>{var HU=DP(),ZU=iR(),MU=x3(),MP=aR(),XU=SR(),KD=m(),TU=CD(),OU=o(),QU=ND(),YU=VD(),_U=m$(),UU=JP(),FU=HP(),qU=ZP(),p$=NB(),VB=WR();wU.Composer=HU.Composer;wU.Document=ZU.Document;wU.Schema=MU.Schema;wU.YAMLError=MP.YAMLError;wU.YAMLParseError=MP.YAMLParseError;wU.YAMLWarning=MP.YAMLWarning;wU.Alias=XU.Alias;wU.isAlias=KD.isAlias;wU.isCollection=KD.isCollection;wU.isDocument=KD.isDocument;wU.isMap=KD.isMap;wU.isNode=KD.isNode;wU.isPair=KD.isPair;wU.isScalar=KD.isScalar;wU.isSeq=KD.isSeq;wU.Pair=TU.Pair;wU.Scalar=OU.Scalar;wU.YAMLMap=QU.YAMLMap;wU.YAMLSeq=YU.YAMLSeq;wU.CST=_U;wU.Lexer=UU.Lexer;wU.LineCounter=FU.LineCounter;wU.Parser=qU.Parser;wU.parse=p$.parse;wU.parseAllDocuments=p$.parseAllDocuments;wU.parseDocument=p$.parseDocument;wU.stringify=p$.stringify;wU.visit=VB.visit;wU.visitAsync=VB.visitAsync});var UG=q((CS,If)=>{function HG(D){return Array.isArray(D)?D:[D]}var Ow=void 0,L6="",zG=" ",C6="\\",Qw=/^\s+$/,Yw=/(?:[^\\]|^)\\$/,_w=/^\\!/,Uw=/^\\#/,Fw=/\r?\n/g,qw=/^\.{0,2}\/|^\.{1,2}$/,ww=/\/$/,t1="/",ZG="node-ignore";if(typeof Symbol<"u")ZG=Symbol.for("node-ignore");var MG=ZG,e1=(D,R,A)=>{return Object.defineProperty(D,R,{value:A}),A},Cw=/([0-z])-([0-z])/g,XG=()=>!1,Lw=(D)=>D.replace(Cw,(R,A,$)=>A.charCodeAt(0)<=$.charCodeAt(0)?R:L6),Nw=(D)=>{let{length:R}=D;return D.slice(0,R-R%2)},Vw=[[/^\uFEFF/,()=>L6],[/((?:\\\\)*?)(\\?\s+)$/,(D,R,A)=>R+(A.indexOf("\\")===0?zG:L6)],[/(\\+?)\s/g,(D,R)=>{let{length:A}=R;return R.slice(0,A-A%2)+zG}],[/[\\$.|*+(){^]/g,(D)=>`\\${D}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return!/\/(?!$)/.test(this)?"(?:^|\\/)":"^"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(D,R,A)=>R+6<A.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(D,R,A)=>{let $=A.replace(/\\\*/g,"[^\\/]*");return R+$}],[/\\\\\\(?=[$.|*+(){^])/g,()=>C6],[/\\\\/g,()=>C6],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(D,R,A,$,f)=>R===C6?`\\[${A}${Nw($)}${f}`:f==="]"?$.length%2===0?`[${Lw(A)}${$}]`:"[]":"[]"],[/(?:[^*])$/,(D)=>/\/$/.test(D)?`${D}$`:`${D}(?=$|\\/$)`]],Iw=/(^|\\\/)?\\\*$/,CA="regex",Nf="checkRegex",JG="_",Kw={[CA](D,R){return`${R?`${R}[^/]+`:"[^/]*"}(?=$|\\/$)`},[Nf](D,R){return`${R?`${R}[^/]*`:"[^/]*"}(?=$|\\/$)`}},Ww=(D)=>Vw.reduce((R,[A,$])=>R.replace(A,$.bind(D)),D),Vf=(D)=>typeof D==="string",jw=(D)=>D&&Vf(D)&&!Qw.test(D)&&!Yw.test(D)&&D.indexOf("#")!==0,Sw=(D)=>D.split(Fw).filter(Boolean);class TG{constructor(D,R,A,$,f,P){this.pattern=D,this.mark=R,this.negative=f,e1(this,"body",A),e1(this,"ignoreCase",$),e1(this,"regexPrefix",P)}get regex(){let D=JG+CA;if(this[D])return this[D];return this._make(CA,D)}get checkRegex(){let D=JG+Nf;if(this[D])return this[D];return this._make(Nf,D)}_make(D,R){let A=this.regexPrefix.replace(Iw,Kw[D]),$=this.ignoreCase?new RegExp(A,"i"):new RegExp(A);return e1(this,R,$)}}var bw=({pattern:D,mark:R},A)=>{let $=!1,f=D;if(f.indexOf("!")===0)$=!0,f=f.substr(1);f=f.replace(_w,"!").replace(Uw,"#");let P=Ww(f);return new TG(D,R,f,A,$,P)};class OG{constructor(D){this._ignoreCase=D,this._rules=[]}_add(D){if(D&&D[MG]){this._rules=this._rules.concat(D._rules._rules),this._added=!0;return}if(Vf(D))D={pattern:D};if(jw(D.pattern)){let R=bw(D,this._ignoreCase);this._added=!0,this._rules.push(R)}}add(D){return this._added=!1,HG(Vf(D)?Sw(D):D).forEach(this._add,this),this._added}test(D,R,A){let $=!1,f=!1,P;this._rules.forEach((G)=>{let{negative:z}=G;if(f===z&&$!==f||z&&!$&&!f&&!R)return;if(!G[A].test(D))return;$=!z,f=z,P=z?Ow:G});let B={ignored:$,unignored:f};if(P)B.rule=P;return B}}var uw=(D,R)=>{throw new R(D)},MD=(D,R,A)=>{if(!Vf(D))return A(`path must be a string, but got \`${R}\``,TypeError);if(!D)return A("path must not be empty",TypeError);if(MD.isNotRelative(D))return A(`path should be a \`path.relative()\`d string, but got "${R}"`,RangeError);return!0},QG=(D)=>qw.test(D);MD.isNotRelative=QG;MD.convert=(D)=>D;class YG{constructor({ignorecase:D=!0,ignoreCase:R=D,allowRelativePaths:A=!1}={}){e1(this,MG,!0),this._rules=new OG(R),this._strictPathCheck=!A,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(D){if(this._rules.add(D))this._initCache();return this}addPattern(D){return this.add(D)}_test(D,R,A,$){let f=D&&MD.convert(D);return MD(f,D,this._strictPathCheck?uw:XG),this._t(f,R,A,$)}checkIgnore(D){if(!ww.test(D))return this.test(D);let R=D.split(t1).filter(Boolean);if(R.pop(),R.length){let A=this._t(R.join(t1)+t1,this._testCache,!0,R);if(A.ignored)return A}return this._rules.test(D,!1,Nf)}_t(D,R,A,$){if(D in R)return R[D];if(!$)$=D.split(t1).filter(Boolean);if($.pop(),!$.length)return R[D]=this._rules.test(D,A,CA);let f=this._t($.join(t1)+t1,R,A,$);return R[D]=f.ignored?f:this._rules.test(D,A,CA)}ignores(D){return this._test(D,this._ignoreCache,!1).ignored}createFilter(){return(D)=>!this.ignores(D)}filter(D){return HG(D).filter(this.createFilter())}test(D){return this._test(D,this._testCache,!0)}}var N6=(D)=>new YG(D),Ew=(D)=>MD(D&&MD.convert(D),D,XG),_G=()=>{let D=(A)=>/^\\\\\?\\/.test(A)||/["<>|\u0000-\u001F]+/u.test(A)?A:A.replace(/\\/g,"/");MD.convert=D;let R=/^[a-z]:\//i;MD.isNotRelative=(A)=>R.test(A)||QG(A)};if(typeof process<"u"&&process.platform==="win32")_G();If.exports=N6;N6.default=N6;If.exports.isPathValid=Ew;e1(If.exports,Symbol.for("setupWindows"),_G)});var TD=q((xb,Jz)=>{var Gz=["nodebuffer","arraybuffer","fragments"],zz=typeof Blob<"u";if(zz)Gz.push("blob");Jz.exports={BINARY_TYPES:Gz,CLOSE_TIMEOUT:30000,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:zz,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var NA=q((nb,gf)=>{var{EMPTY_BUFFER:UC}=TD(),b6=Buffer[Symbol.species];function FC(D,R){if(D.length===0)return UC;if(D.length===1)return D[0];let A=Buffer.allocUnsafe(R),$=0;for(let f=0;f<D.length;f++){let P=D[f];A.set(P,$),$+=P.length}if($<R)return new b6(A.buffer,A.byteOffset,$);return A}function Hz(D,R,A,$,f){for(let P=0;P<f;P++)A[$+P]=D[P]^R[P&3]}function Zz(D,R){for(let A=0;A<D.length;A++)D[A]^=R[A&3]}function qC(D){if(D.length===D.buffer.byteLength)return D.buffer;return D.buffer.slice(D.byteOffset,D.byteOffset+D.length)}function u6(D){if(u6.readOnly=!0,Buffer.isBuffer(D))return D;let R;if(D instanceof ArrayBuffer)R=new b6(D);else if(ArrayBuffer.isView(D))R=new b6(D.buffer,D.byteOffset,D.byteLength);else R=Buffer.from(D),u6.readOnly=!1;return R}gf.exports={concat:FC,mask:Hz,toArrayBuffer:qC,toBuffer:u6,unmask:Zz};if(!process.env.WS_NO_BUFFER_UTIL)try{let D=(()=>{throw new Error("Cannot require module "+"bufferutil");})();gf.exports.mask=function(R,A,$,f,P){if(P<48)Hz(R,A,$,f,P);else D.mask(R,A,$,f,P)},gf.exports.unmask=function(R,A){if(R.length<32)Zz(R,A);else D.unmask(R,A)}}catch(D){}});var Oz=q((pb,Tz)=>{var Mz=Symbol("kDone"),E6=Symbol("kRun");class Xz{constructor(D){this[Mz]=()=>{this.pending--,this[E6]()},this.concurrency=D||1/0,this.jobs=[],this.pending=0}add(D){this.jobs.push(D),this[E6]()}[E6](){if(this.pending===this.concurrency)return;if(this.jobs.length){let D=this.jobs.shift();this.pending++,D(this[Mz])}}}Tz.exports=Xz});var fR=q((hb,Fz)=>{var VA=p("zlib"),Qz=NA(),wC=Oz(),{kStatusCode:Yz}=TD(),CC=Buffer[Symbol.species],LC=Buffer.from([0,0,255,255]),xf=Symbol("permessage-deflate"),OD=Symbol("total-length"),AR=Symbol("callback"),pD=Symbol("buffers"),$R=Symbol("error"),mf;class _z{constructor(D){if(this._options=D||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!mf){let R=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;mf=new wC(R)}}static get extensionName(){return"permessage-deflate"}offer(){let D={};if(this._options.serverNoContextTakeover)D.server_no_context_takeover=!0;if(this._options.clientNoContextTakeover)D.client_no_context_takeover=!0;if(this._options.serverMaxWindowBits)D.server_max_window_bits=this._options.serverMaxWindowBits;if(this._options.clientMaxWindowBits)D.client_max_window_bits=this._options.clientMaxWindowBits;else if(this._options.clientMaxWindowBits==null)D.client_max_window_bits=!0;return D}accept(D){return D=this.normalizeParams(D),this.params=this._isServer?this.acceptAsServer(D):this.acceptAsClient(D),this.params}cleanup(){if(this._inflate)this._inflate.close(),this._inflate=null;if(this._deflate){let D=this._deflate[AR];if(this._deflate.close(),this._deflate=null,D)D(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(D){let R=this._options,A=D.find(($)=>{if(R.serverNoContextTakeover===!1&&$.server_no_context_takeover||$.server_max_window_bits&&(R.serverMaxWindowBits===!1||typeof R.serverMaxWindowBits==="number"&&R.serverMaxWindowBits>$.server_max_window_bits)||typeof R.clientMaxWindowBits==="number"&&!$.client_max_window_bits)return!1;return!0});if(!A)throw Error("None of the extension offers can be accepted");if(R.serverNoContextTakeover)A.server_no_context_takeover=!0;if(R.clientNoContextTakeover)A.client_no_context_takeover=!0;if(typeof R.serverMaxWindowBits==="number")A.server_max_window_bits=R.serverMaxWindowBits;if(typeof R.clientMaxWindowBits==="number")A.client_max_window_bits=R.clientMaxWindowBits;else if(A.client_max_window_bits===!0||R.clientMaxWindowBits===!1)delete A.client_max_window_bits;return A}acceptAsClient(D){let R=D[0];if(this._options.clientNoContextTakeover===!1&&R.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(!R.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number")R.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==="number"&&R.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"');return R}normalizeParams(D){return D.forEach((R)=>{Object.keys(R).forEach((A)=>{let $=R[A];if($.length>1)throw Error(`Parameter "${A}" must have only a single value`);if($=$[0],A==="client_max_window_bits"){if($!==!0){let f=+$;if(!Number.isInteger(f)||f<8||f>15)throw TypeError(`Invalid value for parameter "${A}": ${$}`);$=f}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${A}": ${$}`)}else if(A==="server_max_window_bits"){let f=+$;if(!Number.isInteger(f)||f<8||f>15)throw TypeError(`Invalid value for parameter "${A}": ${$}`);$=f}else if(A==="client_no_context_takeover"||A==="server_no_context_takeover"){if($!==!0)throw TypeError(`Invalid value for parameter "${A}": ${$}`)}else throw Error(`Unknown parameter "${A}"`);R[A]=$})}),D}decompress(D,R,A){mf.add(($)=>{this._decompress(D,R,(f,P)=>{$(),A(f,P)})})}compress(D,R,A){mf.add(($)=>{this._compress(D,R,(f,P)=>{$(),A(f,P)})})}_decompress(D,R,A){let $=this._isServer?"client":"server";if(!this._inflate){let f=`${$}_max_window_bits`,P=typeof this.params[f]!=="number"?VA.Z_DEFAULT_WINDOWBITS:this.params[f];this._inflate=VA.createInflateRaw({...this._options.zlibInflateOptions,windowBits:P}),this._inflate[xf]=this,this._inflate[OD]=0,this._inflate[pD]=[],this._inflate.on("error",VC),this._inflate.on("data",Uz)}if(this._inflate[AR]=A,this._inflate.write(D),R)this._inflate.write(LC);this._inflate.flush(()=>{let f=this._inflate[$R];if(f){this._inflate.close(),this._inflate=null,A(f);return}let P=Qz.concat(this._inflate[pD],this._inflate[OD]);if(this._inflate._readableState.endEmitted)this._inflate.close(),this._inflate=null;else if(this._inflate[OD]=0,this._inflate[pD]=[],R&&this.params[`${$}_no_context_takeover`])this._inflate.reset();A(null,P)})}_compress(D,R,A){let $=this._isServer?"server":"client";if(!this._deflate){let f=`${$}_max_window_bits`,P=typeof this.params[f]!=="number"?VA.Z_DEFAULT_WINDOWBITS:this.params[f];this._deflate=VA.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:P}),this._deflate[OD]=0,this._deflate[pD]=[],this._deflate.on("data",NC)}this._deflate[AR]=A,this._deflate.write(D),this._deflate.flush(VA.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let f=Qz.concat(this._deflate[pD],this._deflate[OD]);if(R)f=new CC(f.buffer,f.byteOffset,f.length-4);if(this._deflate[AR]=null,this._deflate[OD]=0,this._deflate[pD]=[],R&&this.params[`${$}_no_context_takeover`])this._deflate.reset();A(null,f)})}}Fz.exports=_z;function NC(D){this[pD].push(D),this[OD]+=D.length}function Uz(D){if(this[OD]+=D.length,this[xf]._maxPayload<1||this[OD]<=this[xf]._maxPayload){this[pD].push(D);return}this[$R]=RangeError("Max payload size exceeded"),this[$R].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[$R][Yz]=1009,this.removeListener("data",Uz),this.reset()}function VC(D){if(this[xf]._inflate=null,this[$R]){this[AR](this[$R]);return}D[Yz]=1007,this[AR](D)}});var PR=q((vb,nf)=>{var{isUtf8:qz}=p("buffer"),{hasBlob:IC}=TD(),KC=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function WC(D){return D>=1000&&D<=1014&&D!==1004&&D!==1005&&D!==1006||D>=3000&&D<=4999}function y6(D){let R=D.length,A=0;while(A<R)if((D[A]&128)===0)A++;else if((D[A]&224)===192){if(A+1===R||(D[A+1]&192)!==128||(D[A]&254)===192)return!1;A+=2}else if((D[A]&240)===224){if(A+2>=R||(D[A+1]&192)!==128||(D[A+2]&192)!==128||D[A]===224&&(D[A+1]&224)===128||D[A]===237&&(D[A+1]&224)===160)return!1;A+=3}else if((D[A]&248)===240){if(A+3>=R||(D[A+1]&192)!==128||(D[A+2]&192)!==128||(D[A+3]&192)!==128||D[A]===240&&(D[A+1]&240)===128||D[A]===244&&D[A+1]>143||D[A]>244)return!1;A+=4}else return!1;return!0}function jC(D){return IC&&typeof D==="object"&&typeof D.arrayBuffer==="function"&&typeof D.type==="string"&&typeof D.stream==="function"&&(D[Symbol.toStringTag]==="Blob"||D[Symbol.toStringTag]==="File")}nf.exports={isBlob:jC,isValidStatusCode:WC,isValidUTF8:y6,tokenChars:KC};if(qz)nf.exports.isValidUTF8=function(D){return D.length<24?y6(D):qz(D)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let D=(()=>{throw new Error("Cannot require module "+"utf-8-validate");})();nf.exports.isValidUTF8=function(R){return R.length<32?y6(R):D(R)}}catch(D){}});var m6=q((lb,Vz)=>{var{Writable:SC}=p("stream"),wz=fR(),{BINARY_TYPES:bC,EMPTY_BUFFER:Cz,kStatusCode:uC,kWebSocket:EC}=TD(),{concat:g6,toArrayBuffer:yC,unmask:gC}=NA(),{isValidStatusCode:mC,isValidUTF8:Lz}=PR(),pf=Buffer[Symbol.species];class Nz extends SC{constructor(D={}){super();this._allowSynchronousEvents=D.allowSynchronousEvents!==void 0?D.allowSynchronousEvents:!0,this._binaryType=D.binaryType||bC[0],this._extensions=D.extensions||{},this._isServer=!!D.isServer,this._maxPayload=D.maxPayload|0,this._skipUTF8Validation=!!D.skipUTF8Validation,this[EC]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(D,R,A){if(this._opcode===8&&this._state==0)return A();this._bufferedBytes+=D.length,this._buffers.push(D),this.startLoop(A)}consume(D){if(this._bufferedBytes-=D,D===this._buffers[0].length)return this._buffers.shift();if(D<this._buffers[0].length){let A=this._buffers[0];return this._buffers[0]=new pf(A.buffer,A.byteOffset+D,A.length-D),new pf(A.buffer,A.byteOffset,D)}let R=Buffer.allocUnsafe(D);do{let A=this._buffers[0],$=R.length-D;if(D>=A.length)R.set(this._buffers.shift(),$);else R.set(new Uint8Array(A.buffer,A.byteOffset,D),$),this._buffers[0]=new pf(A.buffer,A.byteOffset+D,A.length-D);D-=A.length}while(D>0);return R}startLoop(D){this._loop=!0;do switch(this._state){case 0:this.getInfo(D);break;case 1:this.getPayloadLength16(D);break;case 2:this.getPayloadLength64(D);break;case 3:this.getMask();break;case 4:this.getData(D);break;case 5:case 6:this._loop=!1;return}while(this._loop);if(!this._errored)D()}getInfo(D){if(this._bufferedBytes<2){this._loop=!1;return}let R=this.consume(2);if((R[0]&48)!==0){let $=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");D($);return}let A=(R[0]&64)===64;if(A&&!this._extensions[wz.extensionName]){let $=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");D($);return}if(this._fin=(R[0]&128)===128,this._opcode=R[0]&15,this._payloadLength=R[1]&127,this._opcode===0){if(A){let $=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");D($);return}if(!this._fragmented){let $=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");D($);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let $=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");D($);return}this._compressed=A}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let $=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");D($);return}if(A){let $=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");D($);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let $=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");D($);return}}else{let $=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");D($);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;if(this._masked=(R[1]&128)===128,this._isServer){if(!this._masked){let $=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");D($);return}}else if(this._masked){let $=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");D($);return}if(this._payloadLength===126)this._state=1;else if(this._payloadLength===127)this._state=2;else this.haveLength(D)}getPayloadLength16(D){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(D)}getPayloadLength64(D){if(this._bufferedBytes<8){this._loop=!1;return}let R=this.consume(8),A=R.readUInt32BE(0);if(A>Math.pow(2,21)-1){let $=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");D($);return}this._payloadLength=A*Math.pow(2,32)+R.readUInt32BE(4),this.haveLength(D)}haveLength(D){if(this._payloadLength&&this._opcode<8){if(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){let R=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");D(R);return}}if(this._masked)this._state=3;else this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(D){let R=Cz;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}if(R=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0)gC(R,this._mask)}if(this._opcode>7){this.controlMessage(R,D);return}if(this._compressed){this._state=5,this.decompress(R,D);return}if(R.length)this._messageLength=this._totalPayloadLength,this._fragments.push(R);this.dataMessage(D)}decompress(D,R){this._extensions[wz.extensionName].decompress(D,this._fin,($,f)=>{if($)return R($);if(f.length){if(this._messageLength+=f.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let P=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");R(P);return}this._fragments.push(f)}if(this.dataMessage(R),this._state===0)this.startLoop(R)})}dataMessage(D){if(!this._fin){this._state=0;return}let R=this._messageLength,A=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let $;if(this._binaryType==="nodebuffer")$=g6(A,R);else if(this._binaryType==="arraybuffer")$=yC(g6(A,R));else if(this._binaryType==="blob")$=new Blob(A);else $=A;if(this._allowSynchronousEvents)this.emit("message",$,!0),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",$,!0),this._state=0,this.startLoop(D)})}else{let $=g6(A,R);if(!this._skipUTF8Validation&&!Lz($)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");D(f);return}if(this._state===5||this._allowSynchronousEvents)this.emit("message",$,!1),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",$,!1),this._state=0,this.startLoop(D)})}}controlMessage(D,R){if(this._opcode===8){if(D.length===0)this._loop=!1,this.emit("conclude",1005,Cz),this.end();else{let A=D.readUInt16BE(0);if(!mC(A)){let f=this.createError(RangeError,`invalid status code ${A}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");R(f);return}let $=new pf(D.buffer,D.byteOffset+2,D.length-2);if(!this._skipUTF8Validation&&!Lz($)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");R(f);return}this._loop=!1,this.emit("conclude",A,$),this.end()}this._state=0;return}if(this._allowSynchronousEvents)this.emit(this._opcode===9?"ping":"pong",D),this._state=0;else this._state=6,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",D),this._state=0,this.startLoop(R)})}createError(D,R,A,$,f){this._loop=!1,this._errored=!0;let P=new D(A?`Invalid WebSocket frame: ${R}`:R);return Error.captureStackTrace(P,this.createError),P.code=f,P[uC]=$,P}}Vz.exports=Nz});var n6=q((kb,Wz)=>{var{Duplex:db}=p("stream"),{randomFillSync:xC}=p("crypto"),Iz=fR(),{EMPTY_BUFFER:nC,kWebSocket:pC,NOOP:hC}=TD(),{isBlob:BR,isValidStatusCode:vC}=PR(),{mask:Kz,toBuffer:F1}=NA(),C0=Symbol("kByteLength"),lC=Buffer.alloc(4),q1,GR=8192,y0=0,dC=1,kC=2;class hD{constructor(D,R,A){if(this._extensions=R||{},A)this._generateMask=A,this._maskBuffer=Buffer.alloc(4);this._socket=D,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=y0,this.onerror=hC,this[pC]=void 0}static frame(D,R){let A,$=!1,f=2,P=!1;if(R.mask){if(A=R.maskBuffer||lC,R.generateMask)R.generateMask(A);else{if(GR===8192){if(q1===void 0)q1=Buffer.alloc(8192);xC(q1,0,8192),GR=0}A[0]=q1[GR++],A[1]=q1[GR++],A[2]=q1[GR++],A[3]=q1[GR++]}P=(A[0]|A[1]|A[2]|A[3])===0,f=6}let B;if(typeof D==="string")if((!R.mask||P)&&R[C0]!==void 0)B=R[C0];else D=Buffer.from(D),B=D.length;else B=D.length,$=R.mask&&R.readOnly&&!P;let G=B;if(B>=65536)f+=8,G=127;else if(B>125)f+=2,G=126;let z=Buffer.allocUnsafe($?B+f:f);if(z[0]=R.fin?R.opcode|128:R.opcode,R.rsv1)z[0]|=64;if(z[1]=G,G===126)z.writeUInt16BE(B,2);else if(G===127)z[2]=z[3]=0,z.writeUIntBE(B,4,6);if(!R.mask)return[z,D];if(z[1]|=128,z[f-4]=A[0],z[f-3]=A[1],z[f-2]=A[2],z[f-1]=A[3],P)return[z,D];if($)return Kz(D,A,z,f,B),[z];return Kz(D,A,D,0,B),[z,D]}close(D,R,A,$){let f;if(D===void 0)f=nC;else if(typeof D!=="number"||!vC(D))throw TypeError("First argument must be a valid error code number");else if(R===void 0||!R.length)f=Buffer.allocUnsafe(2),f.writeUInt16BE(D,0);else{let B=Buffer.byteLength(R);if(B>123)throw RangeError("The message must not be greater than 123 bytes");if(f=Buffer.allocUnsafe(2+B),f.writeUInt16BE(D,0),typeof R==="string")f.write(R,2);else f.set(R,2)}let P={[C0]:f.length,fin:!0,generateMask:this._generateMask,mask:A,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==y0)this.enqueue([this.dispatch,f,!1,P,$]);else this.sendFrame(hD.frame(f,P),$)}ping(D,R,A){let $,f;if(typeof D==="string")$=Buffer.byteLength(D),f=!1;else if(BR(D))$=D.size,f=!1;else D=F1(D),$=D.length,f=F1.readOnly;if($>125)throw RangeError("The data size must not be greater than 125 bytes");let P={[C0]:$,fin:!0,generateMask:this._generateMask,mask:R,maskBuffer:this._maskBuffer,opcode:9,readOnly:f,rsv1:!1};if(BR(D))if(this._state!==y0)this.enqueue([this.getBlobData,D,!1,P,A]);else this.getBlobData(D,!1,P,A);else if(this._state!==y0)this.enqueue([this.dispatch,D,!1,P,A]);else this.sendFrame(hD.frame(D,P),A)}pong(D,R,A){let $,f;if(typeof D==="string")$=Buffer.byteLength(D),f=!1;else if(BR(D))$=D.size,f=!1;else D=F1(D),$=D.length,f=F1.readOnly;if($>125)throw RangeError("The data size must not be greater than 125 bytes");let P={[C0]:$,fin:!0,generateMask:this._generateMask,mask:R,maskBuffer:this._maskBuffer,opcode:10,readOnly:f,rsv1:!1};if(BR(D))if(this._state!==y0)this.enqueue([this.getBlobData,D,!1,P,A]);else this.getBlobData(D,!1,P,A);else if(this._state!==y0)this.enqueue([this.dispatch,D,!1,P,A]);else this.sendFrame(hD.frame(D,P),A)}send(D,R,A){let $=this._extensions[Iz.extensionName],f=R.binary?2:1,P=R.compress,B,G;if(typeof D==="string")B=Buffer.byteLength(D),G=!1;else if(BR(D))B=D.size,G=!1;else D=F1(D),B=D.length,G=F1.readOnly;if(this._firstFragment){if(this._firstFragment=!1,P&&$&&$.params[$._isServer?"server_no_context_takeover":"client_no_context_takeover"])P=B>=$._threshold;this._compress=P}else P=!1,f=0;if(R.fin)this._firstFragment=!0;let z={[C0]:B,fin:R.fin,generateMask:this._generateMask,mask:R.mask,maskBuffer:this._maskBuffer,opcode:f,readOnly:G,rsv1:P};if(BR(D))if(this._state!==y0)this.enqueue([this.getBlobData,D,this._compress,z,A]);else this.getBlobData(D,this._compress,z,A);else if(this._state!==y0)this.enqueue([this.dispatch,D,this._compress,z,A]);else this.dispatch(D,this._compress,z,A)}getBlobData(D,R,A,$){this._bufferedBytes+=A[C0],this._state=kC,D.arrayBuffer().then((f)=>{if(this._socket.destroyed){let B=Error("The socket was closed while the blob was being read");process.nextTick(x6,this,B,$);return}this._bufferedBytes-=A[C0];let P=F1(f);if(!R)this._state=y0,this.sendFrame(hD.frame(P,A),$),this.dequeue();else this.dispatch(P,R,A,$)}).catch((f)=>{process.nextTick(iC,this,f,$)})}dispatch(D,R,A,$){if(!R){this.sendFrame(hD.frame(D,A),$);return}let f=this._extensions[Iz.extensionName];this._bufferedBytes+=A[C0],this._state=dC,f.compress(D,A.fin,(P,B)=>{if(this._socket.destroyed){let G=Error("The socket was closed while data was being compressed");x6(this,G,$);return}this._bufferedBytes-=A[C0],this._state=y0,A.readOnly=!1,this.sendFrame(hD.frame(B,A),$),this.dequeue()})}dequeue(){while(this._state===y0&&this._queue.length){let D=this._queue.shift();this._bufferedBytes-=D[3][C0],Reflect.apply(D[0],this,D.slice(1))}}enqueue(D){this._bufferedBytes+=D[3][C0],this._queue.push(D)}sendFrame(D,R){if(D.length===2)this._socket.cork(),this._socket.write(D[0]),this._socket.write(D[1],R),this._socket.uncork();else this._socket.write(D[0],R)}}Wz.exports=hD;function x6(D,R,A){if(typeof A==="function")A(R);for(let $=0;$<D._queue.length;$++){let f=D._queue[$],P=f[f.length-1];if(typeof P==="function")P(R)}}function iC(D,R,A){x6(D,R,A),D.onerror(R)}});var xz=q((ib,mz)=>{var{kForOnEventAttribute:IA,kListener:p6}=TD(),jz=Symbol("kCode"),Sz=Symbol("kData"),bz=Symbol("kError"),uz=Symbol("kMessage"),Ez=Symbol("kReason"),zR=Symbol("kTarget"),yz=Symbol("kType"),gz=Symbol("kWasClean");class vD{constructor(D){this[zR]=null,this[yz]=D}get target(){return this[zR]}get type(){return this[yz]}}Object.defineProperty(vD.prototype,"target",{enumerable:!0});Object.defineProperty(vD.prototype,"type",{enumerable:!0});class JR extends vD{constructor(D,R={}){super(D);this[jz]=R.code===void 0?0:R.code,this[Ez]=R.reason===void 0?"":R.reason,this[gz]=R.wasClean===void 0?!1:R.wasClean}get code(){return this[jz]}get reason(){return this[Ez]}get wasClean(){return this[gz]}}Object.defineProperty(JR.prototype,"code",{enumerable:!0});Object.defineProperty(JR.prototype,"reason",{enumerable:!0});Object.defineProperty(JR.prototype,"wasClean",{enumerable:!0});class KA extends vD{constructor(D,R={}){super(D);this[bz]=R.error===void 0?null:R.error,this[uz]=R.message===void 0?"":R.message}get error(){return this[bz]}get message(){return this[uz]}}Object.defineProperty(KA.prototype,"error",{enumerable:!0});Object.defineProperty(KA.prototype,"message",{enumerable:!0});class vf extends vD{constructor(D,R={}){super(D);this[Sz]=R.data===void 0?null:R.data}get data(){return this[Sz]}}Object.defineProperty(vf.prototype,"data",{enumerable:!0});var aC={addEventListener(D,R,A={}){for(let f of this.listeners(D))if(!A[IA]&&f[p6]===R&&!f[IA])return;let $;if(D==="message")$=function(P,B){let G=new vf("message",{data:B?P:P.toString()});G[zR]=this,hf(R,this,G)};else if(D==="close")$=function(P,B){let G=new JR("close",{code:P,reason:B.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});G[zR]=this,hf(R,this,G)};else if(D==="error")$=function(P){let B=new KA("error",{error:P,message:P.message});B[zR]=this,hf(R,this,B)};else if(D==="open")$=function(){let P=new vD("open");P[zR]=this,hf(R,this,P)};else return;if($[IA]=!!A[IA],$[p6]=R,A.once)this.once(D,$);else this.on(D,$)},removeEventListener(D,R){for(let A of this.listeners(D))if(A[p6]===R&&!A[IA]){this.removeListener(D,A);break}}};mz.exports={CloseEvent:JR,ErrorEvent:KA,Event:vD,EventTarget:aC,MessageEvent:vf};function hf(D,R,A){if(typeof D==="object"&&D.handleEvent)D.handleEvent.call(D,A);else D.call(R,A)}});var lf=q((ab,nz)=>{var{tokenChars:WA}=PR();function r0(D,R,A){if(D[R]===void 0)D[R]=[A];else D[R].push(A)}function rC(D){let R=Object.create(null),A=Object.create(null),$=!1,f=!1,P=!1,B,G,z=-1,J=-1,Z=-1,H=0;for(;H<D.length;H++)if(J=D.charCodeAt(H),B===void 0)if(Z===-1&&WA[J]===1){if(z===-1)z=H}else if(H!==0&&(J===32||J===9)){if(Z===-1&&z!==-1)Z=H}else if(J===59||J===44){if(z===-1)throw SyntaxError(`Unexpected character at index ${H}`);if(Z===-1)Z=H;let T=D.slice(z,Z);if(J===44)r0(R,T,A),A=Object.create(null);else B=T;z=Z=-1}else throw SyntaxError(`Unexpected character at index ${H}`);else if(G===void 0)if(Z===-1&&WA[J]===1){if(z===-1)z=H}else if(J===32||J===9){if(Z===-1&&z!==-1)Z=H}else if(J===59||J===44){if(z===-1)throw SyntaxError(`Unexpected character at index ${H}`);if(Z===-1)Z=H;if(r0(A,D.slice(z,Z),!0),J===44)r0(R,B,A),A=Object.create(null),B=void 0;z=Z=-1}else if(J===61&&z!==-1&&Z===-1)G=D.slice(z,H),z=Z=-1;else throw SyntaxError(`Unexpected character at index ${H}`);else if(f){if(WA[J]!==1)throw SyntaxError(`Unexpected character at index ${H}`);if(z===-1)z=H;else if(!$)$=!0;f=!1}else if(P)if(WA[J]===1){if(z===-1)z=H}else if(J===34&&z!==-1)P=!1,Z=H;else if(J===92)f=!0;else throw SyntaxError(`Unexpected character at index ${H}`);else if(J===34&&D.charCodeAt(H-1)===61)P=!0;else if(Z===-1&&WA[J]===1){if(z===-1)z=H}else if(z!==-1&&(J===32||J===9)){if(Z===-1)Z=H}else if(J===59||J===44){if(z===-1)throw SyntaxError(`Unexpected character at index ${H}`);if(Z===-1)Z=H;let T=D.slice(z,Z);if($)T=T.replace(/\\/g,""),$=!1;if(r0(A,G,T),J===44)r0(R,B,A),A=Object.create(null),B=void 0;G=void 0,z=Z=-1}else throw SyntaxError(`Unexpected character at index ${H}`);if(z===-1||P||J===32||J===9)throw SyntaxError("Unexpected end of input");if(Z===-1)Z=H;let M=D.slice(z,Z);if(B===void 0)r0(R,M,A);else{if(G===void 0)r0(A,M,!0);else if($)r0(A,G,M.replace(/\\/g,""));else r0(A,G,M);r0(R,B,A)}return R}function sC(D){return Object.keys(D).map((R)=>{let A=D[R];if(!Array.isArray(A))A=[A];return A.map(($)=>{return[R].concat(Object.keys($).map((f)=>{let P=$[f];if(!Array.isArray(P))P=[P];return P.map((B)=>B===!0?f:`${f}=${B}`).join("; ")})).join("; ")}).join(", ")}).join(", ")}nz.exports={format:sC,parse:rC}});var rf=q((ob,cz)=>{var oC=p("events"),cC=p("https"),tC=p("http"),vz=p("net"),eC=p("tls"),{randomBytes:DL,createHash:RL}=p("crypto"),{Duplex:rb,Readable:sb}=p("stream"),{URL:h6}=p("url"),lD=fR(),AL=m6(),$L=n6(),{isBlob:fL}=PR(),{BINARY_TYPES:pz,CLOSE_TIMEOUT:PL,EMPTY_BUFFER:df,GUID:BL,kForOnEventAttribute:v6,kListener:GL,kStatusCode:zL,kWebSocket:P0,NOOP:lz}=TD(),{EventTarget:{addEventListener:JL,removeEventListener:HL}}=xz(),{format:ZL,parse:ML}=lf(),{toBuffer:XL}=NA(),dz=Symbol("kAborted"),l6=[8,13],QD=["CONNECTING","OPEN","CLOSING","CLOSED"],TL=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class E extends oC{constructor(D,R,A){super();if(this._binaryType=pz[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=df,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=E.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,D!==null){if(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,R===void 0)R=[];else if(!Array.isArray(R))if(typeof R==="object"&&R!==null)A=R,R=[];else R=[R];kz(this,D,R,A)}else this._autoPong=A.autoPong,this._closeTimeout=A.closeTimeout,this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(D){if(!pz.includes(D))return;if(this._binaryType=D,this._receiver)this._receiver._binaryType=D}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(D,R,A){let $=new AL({allowSynchronousEvents:A.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:A.maxPayload,skipUTF8Validation:A.skipUTF8Validation}),f=new $L(D,this._extensions,A.generateMask);if(this._receiver=$,this._sender=f,this._socket=D,$[P0]=this,f[P0]=this,D[P0]=this,$.on("conclude",YL),$.on("drain",_L),$.on("error",UL),$.on("message",FL),$.on("ping",qL),$.on("pong",wL),f.onerror=CL,D.setTimeout)D.setTimeout(0);if(D.setNoDelay)D.setNoDelay();if(R.length>0)D.unshift(R);D.on("close",rz),D.on("data",af),D.on("end",sz),D.on("error",oz),this._readyState=E.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=E.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[lD.extensionName])this._extensions[lD.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=E.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(D,R){if(this.readyState===E.CLOSED)return;if(this.readyState===E.CONNECTING){Q0(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===E.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted))this._socket.end();return}this._readyState=E.CLOSING,this._sender.close(D,R,!this._isServer,(A)=>{if(A)return;if(this._closeFrameSent=!0,this._closeFrameReceived||this._receiver._writableState.errorEmitted)this._socket.end()}),az(this)}pause(){if(this.readyState===E.CONNECTING||this.readyState===E.CLOSED)return;this._paused=!0,this._socket.pause()}ping(D,R,A){if(this.readyState===E.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof D==="function")A=D,D=R=void 0;else if(typeof R==="function")A=R,R=void 0;if(typeof D==="number")D=D.toString();if(this.readyState!==E.OPEN){d6(this,D,A);return}if(R===void 0)R=!this._isServer;this._sender.ping(D||df,R,A)}pong(D,R,A){if(this.readyState===E.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof D==="function")A=D,D=R=void 0;else if(typeof R==="function")A=R,R=void 0;if(typeof D==="number")D=D.toString();if(this.readyState!==E.OPEN){d6(this,D,A);return}if(R===void 0)R=!this._isServer;this._sender.pong(D||df,R,A)}resume(){if(this.readyState===E.CONNECTING||this.readyState===E.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send(D,R,A){if(this.readyState===E.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof R==="function")A=R,R={};if(typeof D==="number")D=D.toString();if(this.readyState!==E.OPEN){d6(this,D,A);return}let $={binary:typeof D!=="string",mask:!this._isServer,compress:!0,fin:!0,...R};if(!this._extensions[lD.extensionName])$.compress=!1;this._sender.send(D||df,$,A)}terminate(){if(this.readyState===E.CLOSED)return;if(this.readyState===E.CONNECTING){Q0(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=E.CLOSING,this._socket.destroy()}}Object.defineProperty(E,"CONNECTING",{enumerable:!0,value:QD.indexOf("CONNECTING")});Object.defineProperty(E.prototype,"CONNECTING",{enumerable:!0,value:QD.indexOf("CONNECTING")});Object.defineProperty(E,"OPEN",{enumerable:!0,value:QD.indexOf("OPEN")});Object.defineProperty(E.prototype,"OPEN",{enumerable:!0,value:QD.indexOf("OPEN")});Object.defineProperty(E,"CLOSING",{enumerable:!0,value:QD.indexOf("CLOSING")});Object.defineProperty(E.prototype,"CLOSING",{enumerable:!0,value:QD.indexOf("CLOSING")});Object.defineProperty(E,"CLOSED",{enumerable:!0,value:QD.indexOf("CLOSED")});Object.defineProperty(E.prototype,"CLOSED",{enumerable:!0,value:QD.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((D)=>{Object.defineProperty(E.prototype,D,{enumerable:!0})});["open","error","close","message"].forEach((D)=>{Object.defineProperty(E.prototype,`on${D}`,{enumerable:!0,get(){for(let R of this.listeners(D))if(R[v6])return R[GL];return null},set(R){for(let A of this.listeners(D))if(A[v6]){this.removeListener(D,A);break}if(typeof R!=="function")return;this.addEventListener(D,R,{[v6]:!0})}})});E.prototype.addEventListener=JL;E.prototype.removeEventListener=HL;cz.exports=E;function kz(D,R,A,$){let f={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:PL,protocolVersion:l6[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...$,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(D._autoPong=f.autoPong,D._closeTimeout=f.closeTimeout,!l6.includes(f.protocolVersion))throw RangeError(`Unsupported protocol version: ${f.protocolVersion} (supported versions: ${l6.join(", ")})`);let P;if(R instanceof h6)P=R;else try{P=new h6(R)}catch{throw SyntaxError(`Invalid URL: ${R}`)}if(P.protocol==="http:")P.protocol="ws:";else if(P.protocol==="https:")P.protocol="wss:";D._url=P.href;let B=P.protocol==="wss:",G=P.protocol==="ws+unix:",z;if(P.protocol!=="ws:"&&!B&&!G)z=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(G&&!P.pathname)z="The URL's pathname is empty";else if(P.hash)z="The URL contains a fragment identifier";if(z){let X=SyntaxError(z);if(D._redirects===0)throw X;else{kf(D,X);return}}let J=B?443:80,Z=DL(16).toString("base64"),H=B?cC.request:tC.request,M=new Set,T;if(f.createConnection=f.createConnection||(B?QL:OL),f.defaultPort=f.defaultPort||J,f.port=P.port||J,f.host=P.hostname.startsWith("[")?P.hostname.slice(1,-1):P.hostname,f.headers={...f.headers,"Sec-WebSocket-Version":f.protocolVersion,"Sec-WebSocket-Key":Z,Connection:"Upgrade",Upgrade:"websocket"},f.path=P.pathname+P.search,f.timeout=f.handshakeTimeout,f.perMessageDeflate)T=new lD({...f.perMessageDeflate,isServer:!1,maxPayload:f.maxPayload}),f.headers["Sec-WebSocket-Extensions"]=ZL({[lD.extensionName]:T.offer()});if(A.length){for(let X of A){if(typeof X!=="string"||!TL.test(X)||M.has(X))throw SyntaxError("An invalid or duplicated subprotocol was specified");M.add(X)}f.headers["Sec-WebSocket-Protocol"]=A.join(",")}if(f.origin)if(f.protocolVersion<13)f.headers["Sec-WebSocket-Origin"]=f.origin;else f.headers.Origin=f.origin;if(P.username||P.password)f.auth=`${P.username}:${P.password}`;if(G){let X=f.path.split(":");f.socketPath=X[0],f.path=X[1]}let Q;if(f.followRedirects){if(D._redirects===0){D._originalIpc=G,D._originalSecure=B,D._originalHostOrSocketPath=G?f.socketPath:P.host;let X=$&&$.headers;if($={...$,headers:{}},X)for(let[O,U]of Object.entries(X))$.headers[O.toLowerCase()]=U}else if(D.listenerCount("redirect")===0){let X=G?D._originalIpc?f.socketPath===D._originalHostOrSocketPath:!1:D._originalIpc?!1:P.host===D._originalHostOrSocketPath;if(!X||D._originalSecure&&!B){if(delete f.headers.authorization,delete f.headers.cookie,!X)delete f.headers.host;f.auth=void 0}}if(f.auth&&!$.headers.authorization)$.headers.authorization="Basic "+Buffer.from(f.auth).toString("base64");if(Q=D._req=H(f),D._redirects)D.emit("redirect",D.url,Q)}else Q=D._req=H(f);if(f.timeout)Q.on("timeout",()=>{Q0(D,Q,"Opening handshake has timed out")});if(Q.on("error",(X)=>{if(Q===null||Q[dz])return;Q=D._req=null,kf(D,X)}),Q.on("response",(X)=>{let O=X.headers.location,U=X.statusCode;if(O&&f.followRedirects&&U>=300&&U<400){if(++D._redirects>f.maxRedirects){Q0(D,Q,"Maximum redirects exceeded");return}Q.abort();let F;try{F=new h6(O,R)}catch(w){let V=SyntaxError(`Invalid URL: ${O}`);kf(D,V);return}kz(D,F,A,$)}else if(!D.emit("unexpected-response",Q,X))Q0(D,Q,`Unexpected server response: ${X.statusCode}`)}),Q.on("upgrade",(X,O,U)=>{if(D.emit("upgrade",X),D.readyState!==E.CONNECTING)return;Q=D._req=null;let F=X.headers.upgrade;if(F===void 0||F.toLowerCase()!=="websocket"){Q0(D,O,"Invalid Upgrade header");return}let w=RL("sha1").update(Z+BL).digest("base64");if(X.headers["sec-websocket-accept"]!==w){Q0(D,O,"Invalid Sec-WebSocket-Accept header");return}let V=X.headers["sec-websocket-protocol"],I;if(V!==void 0){if(!M.size)I="Server sent a subprotocol but none was requested";else if(!M.has(V))I="Server sent an invalid subprotocol"}else if(M.size)I="Server sent no subprotocol";if(I){Q0(D,O,I);return}if(V)D._protocol=V;let j=X.headers["sec-websocket-extensions"];if(j!==void 0){if(!T){Q0(D,O,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let u;try{u=ML(j)}catch(S){Q0(D,O,"Invalid Sec-WebSocket-Extensions header");return}let L=Object.keys(u);if(L.length!==1||L[0]!==lD.extensionName){Q0(D,O,"Server indicated an extension that was not requested");return}try{T.accept(u[lD.extensionName])}catch(S){Q0(D,O,"Invalid Sec-WebSocket-Extensions header");return}D._extensions[lD.extensionName]=T}D.setSocket(O,U,{allowSynchronousEvents:f.allowSynchronousEvents,generateMask:f.generateMask,maxPayload:f.maxPayload,skipUTF8Validation:f.skipUTF8Validation})}),f.finishRequest)f.finishRequest(Q,D);else Q.end()}function kf(D,R){D._readyState=E.CLOSING,D._errorEmitted=!0,D.emit("error",R),D.emitClose()}function OL(D){return D.path=D.socketPath,vz.connect(D)}function QL(D){if(D.path=void 0,!D.servername&&D.servername!=="")D.servername=vz.isIP(D.host)?"":D.host;return eC.connect(D)}function Q0(D,R,A){D._readyState=E.CLOSING;let $=Error(A);if(Error.captureStackTrace($,Q0),R.setHeader){if(R[dz]=!0,R.abort(),R.socket&&!R.socket.destroyed)R.socket.destroy();process.nextTick(kf,D,$)}else R.destroy($),R.once("error",D.emit.bind(D,"error")),R.once("close",D.emitClose.bind(D))}function d6(D,R,A){if(R){let $=fL(R)?R.size:XL(R).length;if(D._socket)D._sender._bufferedBytes+=$;else D._bufferedAmount+=$}if(A){let $=Error(`WebSocket is not open: readyState ${D.readyState} (${QD[D.readyState]})`);process.nextTick(A,$)}}function YL(D,R){let A=this[P0];if(A._closeFrameReceived=!0,A._closeMessage=R,A._closeCode=D,A._socket[P0]===void 0)return;if(A._socket.removeListener("data",af),process.nextTick(iz,A._socket),D===1005)A.close();else A.close(D,R)}function _L(){let D=this[P0];if(!D.isPaused)D._socket.resume()}function UL(D){let R=this[P0];if(R._socket[P0]!==void 0)R._socket.removeListener("data",af),process.nextTick(iz,R._socket),R.close(D[zL]);if(!R._errorEmitted)R._errorEmitted=!0,R.emit("error",D)}function hz(){this[P0].emitClose()}function FL(D,R){this[P0].emit("message",D,R)}function qL(D){let R=this[P0];if(R._autoPong)R.pong(D,!this._isServer,lz);R.emit("ping",D)}function wL(D){this[P0].emit("pong",D)}function iz(D){D.resume()}function CL(D){let R=this[P0];if(R.readyState===E.CLOSED)return;if(R.readyState===E.OPEN)R._readyState=E.CLOSING,az(R);if(this._socket.end(),!R._errorEmitted)R._errorEmitted=!0,R.emit("error",D)}function az(D){D._closeTimer=setTimeout(D._socket.destroy.bind(D._socket),D._closeTimeout)}function rz(){let D=this[P0];if(this.removeListener("close",rz),this.removeListener("data",af),this.removeListener("end",sz),D._readyState=E.CLOSING,!this._readableState.endEmitted&&!D._closeFrameReceived&&!D._receiver._writableState.errorEmitted&&this._readableState.length!==0){let R=this.read(this._readableState.length);D._receiver.write(R)}if(D._receiver.end(),this[P0]=void 0,clearTimeout(D._closeTimer),D._receiver._writableState.finished||D._receiver._writableState.errorEmitted)D.emitClose();else D._receiver.on("error",hz),D._receiver.on("finish",hz)}function af(D){if(!this[P0]._receiver.write(D))this.pause()}function sz(){let D=this[P0];D._readyState=E.CLOSING,D._receiver.end(),this.end()}function oz(){let D=this[P0];if(this.removeListener("error",oz),this.on("error",lz),D)D._readyState=E.CLOSING,this.destroy()}});var R7=q((tb,D7)=>{var cb=rf(),{Duplex:LL}=p("stream");function tz(D){D.emit("close")}function NL(){if(!this.destroyed&&this._writableState.finished)this.destroy()}function ez(D){if(this.removeListener("error",ez),this.destroy(),this.listenerCount("error")===0)this.emit("error",D)}function VL(D,R){let A=!0,$=new LL({...R,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return D.on("message",function(P,B){let G=!B&&$._readableState.objectMode?P.toString():P;if(!$.push(G))D.pause()}),D.once("error",function(P){if($.destroyed)return;A=!1,$.destroy(P)}),D.once("close",function(){if($.destroyed)return;$.push(null)}),$._destroy=function(f,P){if(D.readyState===D.CLOSED){P(f),process.nextTick(tz,$);return}let B=!1;if(D.once("error",function(z){B=!0,P(z)}),D.once("close",function(){if(!B)P(f);process.nextTick(tz,$)}),A)D.terminate()},$._final=function(f){if(D.readyState===D.CONNECTING){D.once("open",function(){$._final(f)});return}if(D._socket===null)return;if(D._socket._writableState.finished){if(f(),$._readableState.endEmitted)$.destroy()}else D._socket.once("finish",function(){f()}),D.close()},$._read=function(){if(D.isPaused)D.resume()},$._write=function(f,P,B){if(D.readyState===D.CONNECTING){D.once("open",function(){$._write(f,P,B)});return}D.send(f,B)},$.on("end",NL),$.on("error",ez),$}D7.exports=VL});var k6=q((eb,A7)=>{var{tokenChars:IL}=PR();function KL(D){let R=new Set,A=-1,$=-1,f=0;for(f;f<D.length;f++){let B=D.charCodeAt(f);if($===-1&&IL[B]===1){if(A===-1)A=f}else if(f!==0&&(B===32||B===9)){if($===-1&&A!==-1)$=f}else if(B===44){if(A===-1)throw SyntaxError(`Unexpected character at index ${f}`);if($===-1)$=f;let G=D.slice(A,$);if(R.has(G))throw SyntaxError(`The "${G}" subprotocol is duplicated`);R.add(G),A=$=-1}else throw SyntaxError(`Unexpected character at index ${f}`)}if(A===-1||$!==-1)throw SyntaxError("Unexpected end of input");let P=D.slice(A,f);if(R.has(P))throw SyntaxError(`The "${P}" subprotocol is duplicated`);return R.add(P),R}A7.exports={parse:KL}});var G7=q((Ru,B7)=>{var WL=p("events"),sf=p("http"),{Duplex:Du}=p("stream"),{createHash:jL}=p("crypto"),$7=lf(),w1=fR(),SL=k6(),bL=rf(),{CLOSE_TIMEOUT:uL,GUID:EL,kWebSocket:yL}=TD(),gL=/^[+/0-9A-Za-z]{22}==$/;class P7 extends WL{constructor(D,R){super();if(D={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:uL,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:bL,...D},D.port==null&&!D.server&&!D.noServer||D.port!=null&&(D.server||D.noServer)||D.server&&D.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(D.port!=null)this._server=sf.createServer((A,$)=>{let f=sf.STATUS_CODES[426];$.writeHead(426,{"Content-Length":f.length,"Content-Type":"text/plain"}),$.end(f)}),this._server.listen(D.port,D.host,D.backlog,R);else if(D.server)this._server=D.server;if(this._server){let A=this.emit.bind(this,"connection");this._removeListeners=mL(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:($,f,P)=>{this.handleUpgrade($,f,P,A)}})}if(D.perMessageDeflate===!0)D.perMessageDeflate={};if(D.clientTracking)this.clients=new Set,this._shouldEmitClose=!1;this.options=D,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');if(!this._server)return null;return this._server.address()}close(D){if(this._state===2){if(D)this.once("close",()=>{D(Error("The server is not running"))});process.nextTick(jA,this);return}if(D)this.once("close",D);if(this._state===1)return;if(this._state=1,this.options.noServer||this.options.server){if(this._server)this._removeListeners(),this._removeListeners=this._server=null;if(this.clients)if(!this.clients.size)process.nextTick(jA,this);else this._shouldEmitClose=!0;else process.nextTick(jA,this)}else{let R=this._server;this._removeListeners(),this._removeListeners=this._server=null,R.close(()=>{jA(this)})}}shouldHandle(D){if(this.options.path){let R=D.url.indexOf("?");if((R!==-1?D.url.slice(0,R):D.url)!==this.options.path)return!1}return!0}handleUpgrade(D,R,A,$){R.on("error",f7);let f=D.headers["sec-websocket-key"],P=D.headers.upgrade,B=+D.headers["sec-websocket-version"];if(D.method!=="GET"){C1(this,D,R,405,"Invalid HTTP method");return}if(P===void 0||P.toLowerCase()!=="websocket"){C1(this,D,R,400,"Invalid Upgrade header");return}if(f===void 0||!gL.test(f)){C1(this,D,R,400,"Missing or invalid Sec-WebSocket-Key header");return}if(B!==13&&B!==8){C1(this,D,R,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(D)){SA(R,400);return}let G=D.headers["sec-websocket-protocol"],z=new Set;if(G!==void 0)try{z=SL.parse(G)}catch(H){C1(this,D,R,400,"Invalid Sec-WebSocket-Protocol header");return}let J=D.headers["sec-websocket-extensions"],Z={};if(this.options.perMessageDeflate&&J!==void 0){let H=new w1({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let M=$7.parse(J);if(M[w1.extensionName])H.accept(M[w1.extensionName]),Z[w1.extensionName]=H}catch(M){C1(this,D,R,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let H={origin:D.headers[`${B===8?"sec-websocket-origin":"origin"}`],secure:!!(D.socket.authorized||D.socket.encrypted),req:D};if(this.options.verifyClient.length===2){this.options.verifyClient(H,(M,T,Q,X)=>{if(!M)return SA(R,T||401,Q,X);this.completeUpgrade(Z,f,z,D,R,A,$)});return}if(!this.options.verifyClient(H))return SA(R,401)}this.completeUpgrade(Z,f,z,D,R,A,$)}completeUpgrade(D,R,A,$,f,P,B){if(!f.readable||!f.writable)return f.destroy();if(f[yL])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return SA(f,503);let z=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${jL("sha1").update(R+EL).digest("base64")}`],J=new this.options.WebSocket(null,void 0,this.options);if(A.size){let Z=this.options.handleProtocols?this.options.handleProtocols(A,$):A.values().next().value;if(Z)z.push(`Sec-WebSocket-Protocol: ${Z}`),J._protocol=Z}if(D[w1.extensionName]){let Z=D[w1.extensionName].params,H=$7.format({[w1.extensionName]:[Z]});z.push(`Sec-WebSocket-Extensions: ${H}`),J._extensions=D}if(this.emit("headers",z,$),f.write(z.concat(`\r
|
|
165
|
-
`).join(`\r
|
|
166
|
-
`)),f.removeListener("error",f7),J.setSocket(f,P,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients)this.clients.add(J),J.on("close",()=>{if(this.clients.delete(J),this._shouldEmitClose&&!this.clients.size)process.nextTick(jA,this)});B(J,$)}}B7.exports=P7;function mL(D,R){for(let A of Object.keys(R))D.on(A,R[A]);return function(){for(let $ of Object.keys(R))D.removeListener($,R[$])}}function jA(D){D._state=2,D.emit("close")}function f7(){this.destroy()}function SA(D,R,A,$){A=A||sf.STATUS_CODES[R],$={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(A),...$},D.once("finish",D.destroy),D.end(`HTTP/1.1 ${R} ${sf.STATUS_CODES[R]}\r
|
|
167
|
-
`+Object.keys($).map((f)=>`${f}: ${$[f]}`).join(`\r
|
|
168
|
-
`)+`\r
|
|
169
|
-
\r
|
|
170
|
-
`+A)}function C1(D,R,A,$,f,P){if(D.listenerCount("wsClientError")){let B=Error(f);Error.captureStackTrace(B,C1),D.emit("wsClientError",B,A,R)}else SA(A,$,f,P)}});var X4=B0(M4(),1),{program:TN,createCommand:ON,createArgument:QN,createOption:YN,CommanderError:_N,InvalidArgumentError:T4,InvalidOptionArgumentError:UN,Command:G2,Argument:FN,Option:qN,Help:wN}=X4.default;var a=B0(mA(),1);function W(D,R=!1){if(R){console.log(JSON.stringify(D,null,2));return}if(Array.isArray(D)){if(D.length===0){console.log(a.default.dim("No results"));return}console.table(D);return}console.log(D)}function o0(D){for(let[R,A]of Object.entries(D))console.log(`${a.default.cyan(R)}: ${F4(A)}`)}function YD(D){let R=Object.entries(D).filter(([,$])=>$!==""),A=R.reduce(($,[f])=>Math.max($,f.length),0);for(let[$,f]of R)console.log(`${a.default.dim($.padEnd(A," "))} ${F4(f)}`)}function s(D,R){if(R.length===0){console.log(a.default.dim("No results"));return}let A=D.map((f,P)=>{let B=R.reduce((G,z)=>{return Math.max(G,H2(f.render(z),f.width).length)},0);return Math.max(D[P].header.length,f.width??B)}),$=D.map((f,P)=>_4(f.header.toUpperCase(),A[P])).join(" ");console.log(a.default.bold($));for(let f of R)console.log(D.map((P,B)=>_4(H2(P.render(f),D[B].width),A[B])).join(" "))}function Z2(D){pA("App"),o0({id:D.id,name:D.name,status:D.status,endpoint:D.url??"",defaultDomain:D.defaultDomain,plan:D.plan??"",bundle:D.bundle??""})}function M2(D){pA("Deployment"),o0({id:D.id,status:D.status,method:D.method,trigger:D.trigger,message:D.message??"",createdAt:D.createdAt,updatedAt:D.updatedAt})}function TR(D){s([{header:"Kind",width:24,render:(R)=>R.kind},{header:"Effective",width:20,render:(R)=>R.effectiveAt},{header:"Age",width:6,render:(R)=>H0(R.createdAt)},{header:"Data",width:52,render:(R)=>q4(R.data)},{header:"ID",width:8,render:(R)=>String(R.id)}],D)}function OR(D){YD({id:D.id,kind:D.kind,effectiveAt:D.effectiveAt,userId:D.userId??"",data:q4(D.data),createdAt:D.createdAt})}function QR(D){s([{header:"Time",width:24,render:(R)=>L0(R,"time","timestamp","createdAt")},{header:"Source",width:20,render:(R)=>L0(R,"pod","source")},{header:"Container",width:16,render:(R)=>L0(R,"container")},{header:"Message",width:96,render:(R)=>L0(R,"message","line")}],D)}function X2(D){s([{header:"Key",render:(R)=>R.key},{header:"Value",width:36,render:(R)=>R.value},{header:"Updated",width:20,render:(R)=>R.updatedAt??""}],D)}function T2(D){pA("Domain"),o0({hostname:D.hostname,verification:D.verificationStatus,tlsEnabled:D.tlsEnabled,tlsStatus:D.tlsStatus,forceHttps:D.forceHttps})}function dD(D){pA("Disk"),o0({id:D.id,name:D.name,size:D.size,mounted:D.mounted,mountPath:D.mountPath??""})}function O2(D){s([{header:"Name",width:18,render:(R)=>R.name??""},{header:"Mounted",width:8,render:(R)=>R.mounted?"yes":"no"},{header:"Size",width:6,render:(R)=>`${R.size}G`},{header:"Mount Path",width:28,render:(R)=>R.mountPath??""},{header:"Age",width:6,render:(R)=>H0(R.createdAt)}],D)}function Q2(D,R){let A=D.publicAccess&&D.publicPort?`${D.host??""}:${D.publicPort}`:D.publicAccess?"pending":"",$={id:D.id,name:D.name,engine:D.engine,status:D.status,plan:D.plan??"",bundle:D.bundle??"",user:L0(D,"username"),host:D.host,port:D.port,database:D.databaseName,published:w4(D,"publicAccess"),publicAddress:A,version:D.version,error:L0(D,"statusMessage","statusReason","lastError")};if(YD($),R?.password)console.log(),console.log(a.default.bold("password")),console.log(a.default.yellow(R.password))}function Y2(D,R,A){console.log(`Database credentials for ${D}`),console.log(),YD({user:R.username,password:A?.reveal?R.password:"********",host:R.host,port:R.port,database:R.databaseName})}function _2(D,R){s([{header:"Project",width:22,render:()=>D},{header:"Name",width:22,render:(A)=>A.name??""},{header:"Engine",width:8,render:(A)=>A.engine??""},{header:"Status",width:12,render:(A)=>A.status??""},{header:"Plan",width:12,render:(A)=>A.plan??""},{header:"Bundle",width:12,render:(A)=>A.bundle??""},{header:"Public",width:24,render:(A)=>A.publicAccess&&A.publicPort?`${A.host??""}:${A.publicPort}`:w4(A,"publicAccess")?"pending":""},{header:"Age",width:6,render:(A)=>H0(A.createdAt)}],R)}function U2(D){s([{header:"Name",width:16,render:(R)=>R.name??""},{header:"CPU",width:6,render:(R)=>String(N1(R,"cpuMilli")??"")},{header:"Memory",width:8,render:(R)=>String(N1(R,"memoryMb")??"")},{header:"Disk",width:6,render:(R)=>String(N1(R,"diskGb")??"")},{header:"Price",width:8,render:(R)=>String(R.priceHourly??"")}],D)}function F2(D){s([{header:"Engine",width:12,render:(R)=>R.engine},{header:"Versions",width:32,render:(R)=>R.versions.join(", ")}],D)}function q2(D){YD({name:D.name,cpu:N1(D,"cpuMilli")??"",memory:N1(D,"memoryMb")??"",disk:N1(D,"diskGb")??""})}function w2(D){s([{header:"Name",width:16,render:(R)=>R.name??""},{header:"Backup GB",width:8,render:(R)=>String(R.backupStorageGb??"")},{header:"Daily",width:10,render:(R)=>R.dailyBackupRetentionDays?`${R.dailyBackupRetentionDays}d`:""},{header:"Metrics",width:8,render:(R)=>R.metricsRetentionDays?`${R.metricsRetentionDays}d`:""},{header:"Public",width:6,render:(R)=>R.publicAccess===void 0?"":R.publicAccess?"yes":"no"},{header:"Price",width:8,render:(R)=>String(R.priceHourly??"")}],D)}function C2(D){YD({name:D.name,priceHourly:D.priceHourly,priceMonthly:D.priceMonthly,backupStorageGb:D.backupStorageGb,dailyBackupRetention:`${D.dailyBackupRetentionDays??0}d`,weeklyBackupRetention:`${D.weeklyBackupRetentionDays??0}d`,manualBackupsPerHour:D.manualBackupsPerHour,metricsRetention:`${D.metricsRetentionDays}d`,publicExposure:D.publicAccess,databasePlugins:D.databasePlugins,databaseCustomConfig:D.databaseCustomConfig})}function xA(D){YD({id:D.id,status:D.status,storageKey:D.storageKey??"",sizeBytes:D.sizeBytes??"",startedAt:D.startedAt??"",completedAt:D.completedAt??"",expiresAt:D.expiresAt??"",error:D.errorMessage??""})}function L2(D){s([{header:"Status",width:10,render:(R)=>R.status??""},{header:"Size",width:12,render:(R)=>String(R.sizeBytes??"")},{header:"Expires",width:8,render:(R)=>hA(R.expiresAt)},{header:"Age",width:6,render:(R)=>H0(R.createdAt)},{header:"ID",width:8,render:(R)=>String(R.id)}],D)}function N2(D){let R=D;YD({connections:R.connections,qps:R.qps??"",readQps:R.readQps??"",writeQps:R.writeQps??"",slowQueriesQps:R.slowQueriesQps??"",cpuUsageCores:R.cpuUsageCores??"",memoryUsageBytes:R.memoryUsageBytes??"",storageBytes:R.storageBytes??"",storageUsedBytes:R.storageUsedBytes??"",window:R.window,measuredAt:R.measuredAt})}function nA(D,R){let A=L0(D,"status"),$=L0(D,"prefix"),f=L0(D,"lastUsedAt"),P={id:D.id,name:D.name,prefix:$,access:C4(D,R?.projectLabel),expiresAt:D.expiresAt??""};if(A&&A!=="active")P.status=A;if(f)P.lastUsedAt=f;if(YD(P),R?.plaintextToken)console.log(),console.log(a.default.bold("token")),console.log(a.default.yellow(R.plaintextToken))}function V2(D,R){s([{header:"Name",width:22,render:(A)=>A.name??""},{header:"Status",width:10,render:(A)=>L0(A,"status")||(A.revokedAt?"revoked":"active")},{header:"Access",width:34,render:(A)=>C4(A,R?.projectLabel)},{header:"Expires",width:8,render:(A)=>hA(A.expiresAt)},{header:"Last Used",width:9,render:(A)=>H0(L0(A,"lastUsedAt")||A.lastUsedAt)},{header:"Age",width:6,render:(A)=>H0(A.createdAt)},{header:"ID",width:18,render:(A)=>String(A.id)}],D)}function U4(D){let R=D.indexOf("=");if(R<=0)throw Error(`Invalid env entry: ${D}. Expected KEY=VALUE`);return{key:D.slice(0,R),value:D.slice(R+1)}}function I2(D){if(typeof D==="object"&&D!==null){let R=D;if(typeof R.status==="number"){let $=R.status?`Request failed (${R.status}${R.statusText?` ${R.statusText}`:""})`:"Request failed",f=R.error??R.data,P=J2(f);if(P)return`${$}: ${P}`;return $}let A=D;if(A.response?.data){let $=A.response.status?`Request failed (${A.response.status})`:"Request failed",f=J2(A.response.data);if(f)return`${$}: ${f}`}if(A.message){let $=Y4(D);if($)return`${A.message}: ${$}`;return A.message}}if(D instanceof Error){let R=Y4(D);if(R)return`${D.message}: ${R}`;return D.message}if(typeof D==="string")return D;return String(D)}function J2(D){if(typeof D==="string"&&D)return D;if(typeof D!=="object"||D===null)return D==null?"":String(D);if("error"in D){let R=D.error,A=J2(R);if(A)return A}if("message"in D&&typeof D.message==="string")return D.message;if("code"in D&&typeof D.code==="string")return D.code;return JSON.stringify(D)}function Y4(D){if(typeof D!=="object"||D===null||!("cause"in D))return"";let R=D.cause;if(typeof R==="string")return R;if(typeof R!=="object"||R===null)return"";let A=R;return[A.syscall,A.code,A.address,A.port].filter(Boolean).join(" ")||A.message||""}function K2(D){let R=D.split(/\r?\n/),[A="",...$]=R;console.error(a.default.red(`Error: ${A}`));for(let f of $)console.error(a.default.red(` ${f}`))}function pA(D){console.log(a.default.bold(a.default.magenta(D))),console.log(a.default.dim("-".repeat(D.length)))}function F4(D){if(D==null)return"";if(typeof D==="boolean")return D?a.default.green("yes"):a.default.dim("no");if(typeof D==="number")return a.default.yellow(String(D));if(typeof D==="string")return $H(D);return JSON.stringify(D)}function $H(D){let R=D.toLowerCase();if(["ready","active","approved","healthy","running","mounted","verified","available"].includes(R))return a.default.green(D);if(["pending","building","provisioning","mounting","unmounting","expanding"].includes(R))return a.default.yellow(D);if(["failed","denied","revoked","expired","cancelled","error","frozen"].includes(R))return a.default.red(D);return D}function H0(D){if(!D)return"";let R=new Date(D).getTime();if(!Number.isFinite(R))return"";let A=Math.max(0,Math.floor((Date.now()-R)/1000));if(A<60)return`${A}s`;let $=Math.floor(A/60);if($<60)return`${$}m`;let f=Math.floor($/60);if(f<24)return`${f}h`;let P=Math.floor(f/24);if(P<30)return`${P}d`;let B=Math.floor(P/30);if(B<12)return`${B}mo`;return`${Math.floor(P/365)}y`}function hA(D){if(!D)return"never";let R=new Date(D).getTime();if(!Number.isFinite(R))return"";let A=Math.max(0,Math.floor((R-Date.now())/1000));if(A<60)return`${A}s`;let $=Math.floor(A/60);if($<60)return`${$}m`;let f=Math.floor($/60);if(f<24)return`${f}h`;let P=Math.floor(f/24);if(P<30)return`${P}d`;let B=Math.floor(P/30);if(B<12)return`${B}mo`;return`${Math.floor(P/365)}y`}function H2(D,R){if(!R||D.length<=R)return D;if(R<=1)return D.slice(0,R);return`${D.slice(0,R-1)}…`}function _4(D,R){return D.padEnd(R," ")}function q4(D){if(Object.keys(D).length===0)return"";return H2(JSON.stringify(D),52)}function N1(D,...R){let A=D;for(let $ of R)if(typeof A[$]==="number")return A[$];return}function L0(D,...R){let A=D;for(let $ of R)if(typeof A[$]==="string")return A[$];return""}function w4(D,...R){let A=D;for(let $ of R)if(typeof A[$]==="boolean")return A[$];return}function C4(D,R){return(D.projectAccess??[]).map(($)=>`${R?.($.projectId)??`#${$.projectId}`}:${$.role}`).join(", ")}function _(D){return D}function _D(D){return(R)=>{if(D.includes(R))return R;throw new T4(`Invalid value "${R}". Expected one of: ${D.join(", ")}`)}}async function fH(D,R){let A=-1,$=async()=>{A+=1;let f=R[A];if(!f)return;await Promise.resolve(f(D,$))};await $()}class vA{raw;state;constructor(D,R){this.raw=D??new G2,this.state=R??{argDefs:[],middlewares:[]}}name(D){return this.raw.name(D),this}description(D){return this.raw.description(D),this}alias(D){return this.raw.alias(D),this}option(D,R,A,$){if(A){let f=A;this.raw.option(D,R??"",f,$)}else if(R!==void 0)this.raw.option(D,R);else this.raw.option(D);return this}argument(D,R,A){return this.raw.argument(D,R,A),this.state.argDefs.push(PH(D)),this}onions(D){return this.state.middlewares=[...D],this.raw.action(async(...R)=>{let A=R.at(-1);if(!(A instanceof G2))throw Error("Unable to resolve command context");let $=this.getOptions(A),f=this.getArgs(R.slice(0,-1)),P=this.createContext(A,$,f);try{await fH(P,this.state.middlewares)}catch(B){P.abort(I2(B))}}),this}command(D){let R=this.raw.command(D);return new vA(R)}parse(D){try{this.raw.parse(D)}catch(R){K2(I2(R)),process.exit(1)}return this}unwrap(){return this.raw}getOptions(D){let R=D.optsWithGlobals;if(typeof R==="function")return R.call(D);return D.opts()}getArgs(D){return this.state.argDefs.reduce((R,A,$)=>{let f=D[$];if(f!==void 0)R[A.key]=f;return R},{})}createContext(D,R,A){return{argv:R,options:R,args:A,command:D,abort($){K2($??"Aborted"),process.exit(1)}}}}function PH(D){let R=D.trim();if(R.startsWith("<")&&R.endsWith(">"))return{key:R.slice(1,-1),required:!0};if(R.startsWith("[")&&R.endsWith("]"))return{key:R.slice(1,-1),required:!1};throw Error(`Unsupported argument spec: ${D}`)}function _0(D){if(D===void 0)return;let R=typeof D==="number"?D:Number(D);if(!Number.isInteger(R)||R<0)throw Error("Tail must be a non-negative integer.");return R}function lA(D){let R=typeof D==="number"?D:Number(D);if(!Number.isInteger(R)||R<1||R>65535)throw Error("Port must be an integer between 1 and 65535.");return R}function YR(D,R){return D.id===R||D.label===R||D.email===R}function _R(D,R){return String(D.id)===R||D.slug===R||D.name===R}function L4(D,R){return String(D.id)===R||D.name===R}function N4(D,R){return String(D.id)===R||D.name===R}function V4(D,R){return String(D.id)===R||D.name===R}function dA(D,R){return(D.name??"").toLowerCase()===R.toLowerCase()}function kA(D,R){return(D.name??"").toLowerCase()===R.toLowerCase()}function I4(D,R){return String(D.id)===R||D.name===R||D.prefix===R}function kD(D,R,A){let $=R?D.find((f)=>(f.name??"").toLowerCase()===R.toLowerCase()):(A?D.find((f)=>(f.name??"").toLowerCase()===A.toLowerCase()):void 0)||D[0];if(!$)throw Error(R?`App plan not found: ${R}`:"No app plan available.");return $}function iD(D,R,A){let $=R?D.find((f)=>(f.name??"").toLowerCase()===R.toLowerCase()):(A?D.find((f)=>(f.name??"").toLowerCase()===A.toLowerCase()):void 0)||D[0];if(!$)throw Error(R?`App bundle not found: ${R}`:"No app bundle available.");return $}function UD(D,R,A){let $=(R?D.find((f)=>dA(f,R)):void 0)||(A?D.find((f)=>dA(f,A)):void 0)||D[0];if(!$)throw Error("No database plan available.");return $}function V1(D,R,A){let $=(R?D.find((f)=>kA(f,R)):void 0)||(A?D.find((f)=>kA(f,A)):void 0)||D[0];if(!$)throw Error("No database bundle available.");return $}function K4(D){return D.plan}function W4(D){return D.bundle}var K=_(async(D,R)=>{let A=process.env.ABRUN_TOKEN??D.options.token;if(A){D.auth={id:process.env.ABRUN_TOKEN?"env":"flag",label:process.env.ABRUN_TOKEN?"env":"flag",email:process.env.ABRUN_TOKEN?"env-token":"flag-token",token:A,endpoint:D.endpoint},D.token=A,await R();return}let $=D.options.auth?D.state.auths.find((f)=>YR(f,D.options.auth)):D.state.currentAuthId?D.state.auths.find((f)=>f.id===D.state.currentAuthId):void 0;if(!$)D.abort("No active auth. Run `abrun login` first or set ABRUN_TOKEN.");D.auth=$,D.token=$.token,D.endpoint=D.options.endpoint??$.endpoint??D.endpoint,await R()});var j4;((P)=>{P.Json="application/json";P.JsonApi="application/vnd.api+json";P.FormData="multipart/form-data";P.UrlEncoded="application/x-www-form-urlencoded";P.Text="text/plain"})(j4||={});class W2{baseUrl="https://api.abr.run";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...D)=>fetch(...D);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(D={}){Object.assign(this,D)}setSecurityData=(D)=>{this.securityData=D};encodeQueryParam(D,R){return`${encodeURIComponent(D)}=${encodeURIComponent(typeof R==="number"?R:`${R}`)}`}addQueryParam(D,R){return this.encodeQueryParam(R,D[R])}addArrayQueryParam(D,R){return D[R].map(($)=>this.encodeQueryParam(R,$)).join("&")}toQueryString(D){let R=D||{};return Object.keys(R).filter(($)=>typeof R[$]<"u").map(($)=>Array.isArray(R[$])?this.addArrayQueryParam(R,$):this.addQueryParam(R,$)).join("&")}addQueryParams(D){let R=this.toQueryString(D);return R?`?${R}`:""}contentFormatters={["application/json"]:(D)=>D!==null&&(typeof D==="object"||typeof D==="string")?JSON.stringify(D):D,["application/vnd.api+json"]:(D)=>D!==null&&(typeof D==="object"||typeof D==="string")?JSON.stringify(D):D,["text/plain"]:(D)=>D!==null&&typeof D!=="string"?JSON.stringify(D):D,["multipart/form-data"]:(D)=>{if(D instanceof FormData)return D;return Object.keys(D||{}).reduce((R,A)=>{let $=D[A];return R.append(A,$ instanceof Blob?$:typeof $==="object"&&$!==null?JSON.stringify($):`${$}`),R},new FormData)},["application/x-www-form-urlencoded"]:(D)=>this.toQueryString(D)};mergeRequestParams(D,R){return{...this.baseApiParams,...D,...R||{},headers:{...this.baseApiParams.headers||{},...D.headers||{},...R&&R.headers||{}}}}createAbortSignal=(D)=>{if(this.abortControllers.has(D)){let A=this.abortControllers.get(D);if(A)return A.signal;return}let R=new AbortController;return this.abortControllers.set(D,R),R.signal};abortRequest=(D)=>{let R=this.abortControllers.get(D);if(R)R.abort(),this.abortControllers.delete(D)};request=async({body:D,secure:R,path:A,type:$,query:f,format:P,baseUrl:B,cancelToken:G,...z})=>{let J=(typeof R==="boolean"?R:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},Z=this.mergeRequestParams(z,J),H=f&&this.toQueryString(f),M=this.contentFormatters[$||"application/json"],T=P||Z.format;return this.customFetch(`${B||this.baseUrl||""}${A}${H?`?${H}`:""}`,{...Z,headers:{...Z.headers||{},...$&&$!=="multipart/form-data"?{"Content-Type":$}:{}},signal:(G?this.createAbortSignal(G):Z.signal)||null,body:typeof D>"u"||D===null?null:M(D)}).then(async(Q)=>{let X=Q;X.data=null,X.error=null;let O=T?Q.clone():Q,U=!T?X:await O[T]().then((F)=>{if(X.ok)X.data=F;else X.error=F;return X}).catch((F)=>{return X.error=F,X});if(G)this.abortControllers.delete(G);if(!Q.ok)throw U;return U.data})}}class j2{http;constructor(D){this.http=D}appPlansBundlesList=({planName:D},R={})=>this.http.request({path:`/v1/app-plans/${D}/bundles`,method:"GET",secure:!0,format:"json",...R});appPlansDetail=({planName:D},R={})=>this.http.request({path:`/v1/app-plans/${D}`,method:"GET",secure:!0,format:"json",...R});appPlansList=(D={})=>this.http.request({path:"/v1/app-plans",method:"GET",secure:!0,format:"json",...D});appsAnalyticsBreakdownList=({appId:D,...R},A={})=>this.http.request({path:`/v1/apps/${D}/analytics/breakdown`,method:"GET",query:R,secure:!0,format:"json",...A});appsAnalyticsFilterValuesList=({appId:D,...R},A={})=>this.http.request({path:`/v1/apps/${D}/analytics/filter-values`,method:"GET",query:R,secure:!0,format:"json",...A});appsAnalyticsList=({appId:D,...R},A={})=>this.http.request({path:`/v1/apps/${D}/analytics`,method:"GET",query:R,secure:!0,format:"json",...A});appsAnalyticsSeriesList=({appId:D,...R},A={})=>this.http.request({path:`/v1/apps/${D}/analytics/series`,method:"GET",query:R,secure:!0,format:"json",...A});appsApplyCreate=({appId:D},R={})=>this.http.request({path:`/v1/apps/${D}/apply`,method:"POST",secure:!0,format:"json",...R});appsAvailabilityList=(D,R={})=>this.http.request({path:"/v1/apps/availability",method:"GET",query:D,secure:!0,format:"json",...R});appsConsoleList=({appId:D,...R},A={})=>this.http.request({path:`/v1/apps/${D}/console`,method:"GET",query:R,secure:!0,...A});appsConsoleSessionCreate=({appId:D,...R},A={})=>this.http.request({path:`/v1/apps/${D}/console/session`,method:"POST",query:R,secure:!0,format:"json",...A});appsCreate=(D,R={})=>this.http.request({path:"/v1/apps",method:"POST",body:D,secure:!0,type:"application/json",format:"json",...R});appsDelete=({appId:D},R={})=>this.http.request({path:`/v1/apps/${D}`,method:"DELETE",secure:!0,format:"json",...R});appsDeployCreate=({appId:D},R,A={})=>this.http.request({path:`/v1/apps/${D}/deploy`,method:"POST",body:R,secure:!0,type:"application/json",format:"json",...A});appsDeploymentsCancelCreate=({appId:D,deploymentId:R},A={})=>this.http.request({path:`/v1/apps/${D}/deployments/${R}/cancel`,method:"POST",secure:!0,format:"json",...A});appsDeploymentsDetail=({appId:D,deploymentId:R},A={})=>this.http.request({path:`/v1/apps/${D}/deployments/${R}`,method:"GET",secure:!0,format:"json",...A});appsDeploymentsList=({appId:D,...R},A={})=>this.http.request({path:`/v1/apps/${D}/deployments`,method:"GET",query:R,secure:!0,format:"json",...A});appsDeploymentsLogsList=({appId:D,deploymentId:R,...A},$={})=>this.http.request({path:`/v1/apps/${D}/deployments/${R}/logs`,method:"GET",query:A,secure:!0,format:"json",...$});appsDeploymentsRollbackCreate=({appId:D,deploymentId:R},A={})=>this.http.request({path:`/v1/apps/${D}/deployments/${R}/rollback`,method:"POST",secure:!0,format:"json",...A});appsDetail=({appId:D},R={})=>this.http.request({path:`/v1/apps/${D}`,method:"GET",secure:!0,format:"json",...R});appsDisksCreate=({appId:D},R,A={})=>this.http.request({path:`/v1/apps/${D}/disks`,method:"POST",body:R,secure:!0,type:"application/json",format:"json",...A});appsDisksDelete=({appId:D,diskId:R},A={})=>this.http.request({path:`/v1/apps/${D}/disks/${R}`,method:"DELETE",secure:!0,...A});appsDisksDetail=({appId:D,diskId:R},A={})=>this.http.request({path:`/v1/apps/${D}/disks/${R}`,method:"GET",secure:!0,format:"json",...A});appsDisksExpandCreate=({appId:D,diskId:R},A,$={})=>this.http.request({path:`/v1/apps/${D}/disks/${R}/expand`,method:"POST",body:A,secure:!0,type:"application/json",format:"json",...$});appsDisksList=({appId:D},R={})=>this.http.request({path:`/v1/apps/${D}/disks`,method:"GET",secure:!0,format:"json",...R});appsDisksMountCreate=({appId:D,diskId:R},A,$={})=>this.http.request({path:`/v1/apps/${D}/disks/${R}/mount`,method:"POST",body:A,secure:!0,type:"application/json",format:"json",...$});appsDisksPartialUpdate=({appId:D,diskId:R},A,$={})=>this.http.request({path:`/v1/apps/${D}/disks/${R}`,method:"PATCH",body:A,secure:!0,type:"application/json",format:"json",...$});appsDisksUnmountCreate=({appId:D,diskId:R},A={})=>this.http.request({path:`/v1/apps/${D}/disks/${R}/unmount`,method:"POST",secure:!0,format:"json",...A});appsDomainsAvailabilityList=({appId:D,...R},A={})=>this.http.request({path:`/v1/apps/${D}/domains/availability`,method:"GET",query:R,secure:!0,format:"json",...A});appsDomainsCreate=({appId:D},R,A={})=>this.http.request({path:`/v1/apps/${D}/domains`,method:"POST",body:R,secure:!0,type:"application/json",format:"json",...A});appsDomainsDelete=({appId:D,domainId:R},A={})=>this.http.request({path:`/v1/apps/${D}/domains/${R}`,method:"DELETE",secure:!0,...A});appsDomainsDetail=({appId:D,domainId:R},A={})=>this.http.request({path:`/v1/apps/${D}/domains/${R}`,method:"GET",secure:!0,format:"json",...A});appsDomainsList=({appId:D},R={})=>this.http.request({path:`/v1/apps/${D}/domains`,method:"GET",secure:!0,format:"json",...R});appsDomainsPartialUpdate=({appId:D,domainId:R},A,$={})=>this.http.request({path:`/v1/apps/${D}/domains/${R}`,method:"PATCH",body:A,secure:!0,type:"application/json",format:"json",...$});appsDomainsVerifyCreate=({appId:D,domainId:R},A={})=>this.http.request({path:`/v1/apps/${D}/domains/${R}/verify`,method:"POST",secure:!0,format:"json",...A});appsEnvList=({appId:D},R={})=>this.http.request({path:`/v1/apps/${D}/env`,method:"GET",secure:!0,format:"json",...R});appsEnvUpdate=({appId:D},R,A={})=>this.http.request({path:`/v1/apps/${D}/env`,method:"PUT",body:R,secure:!0,type:"application/json",format:"json",...A});appsEventsList=({appId:D,...R},A={})=>this.http.request({path:`/v1/apps/${D}/events`,method:"GET",query:R,secure:!0,format:"json",...A});appsGitSourceDelete=({appId:D},R={})=>this.http.request({path:`/v1/apps/${D}/git-source`,method:"DELETE",secure:!0,...R});appsGitSourceList=({appId:D},R={})=>this.http.request({path:`/v1/apps/${D}/git-source`,method:"GET",secure:!0,format:"json",...R});appsGitSourceUpdate=({appId:D},R,A={})=>this.http.request({path:`/v1/apps/${D}/git-source`,method:"PUT",body:R,secure:!0,type:"application/json",format:"json",...A});appsList=(D={})=>this.http.request({path:"/v1/apps",method:"GET",secure:!0,format:"json",...D});appsLogsList=({appId:D,...R},A={})=>this.http.request({path:`/v1/apps/${D}/logs`,method:"GET",query:R,secure:!0,format:"json",...A});appsPartialUpdate=({appId:D},R,A={})=>this.http.request({path:`/v1/apps/${D}`,method:"PATCH",body:R,secure:!0,type:"application/json",format:"json",...A});appsResizeCreate=({appId:D},R,A={})=>this.http.request({path:`/v1/apps/${D}/resize`,method:"POST",body:R,secure:!0,type:"application/json",format:"json",...A});appsRestartCreate=({appId:D},R={})=>this.http.request({path:`/v1/apps/${D}/restart`,method:"POST",secure:!0,format:"json",...R});appsStartCreate=({appId:D},R={})=>this.http.request({path:`/v1/apps/${D}/start`,method:"POST",secure:!0,format:"json",...R});appsStopCreate=({appId:D},R={})=>this.http.request({path:`/v1/apps/${D}/stop`,method:"POST",secure:!0,format:"json",...R});appsUploadCreate=({appId:D},R,A={})=>this.http.request({path:`/v1/apps/${D}/upload`,method:"POST",body:R,secure:!0,type:"application/json",format:"json",...A});appsUsageDetail=({appId:D,metric:R},A={})=>this.http.request({path:`/v1/apps/${D}/usage/${R}`,method:"GET",secure:!0,format:"json",...A});appsUsageList=({appId:D},R={})=>this.http.request({path:`/v1/apps/${D}/usage`,method:"GET",secure:!0,format:"json",...R});authApiTokensCreate=(D,R={})=>this.http.request({path:"/v1/auth/api-tokens",method:"POST",body:D,secure:!0,type:"application/json",format:"json",...R});authApiTokensDelete=({tokenId:D},R={})=>this.http.request({path:`/v1/auth/api-tokens/${D}`,method:"DELETE",secure:!0,...R});authApiTokensList=(D,R={})=>this.http.request({path:"/v1/auth/api-tokens",method:"GET",query:D,secure:!0,format:"json",...R});authCliLoginDecisionCreate=({browserCode:D},R,A={})=>this.http.request({path:`/v1/auth/cli-login/${D}`,method:"POST",body:R,secure:!0,type:"application/json",format:"json",...A});authCliLoginPromptDetail=({browserCode:D},R={})=>this.http.request({path:`/v1/auth/cli-login/${D}`,method:"GET",secure:!0,format:"json",...R});authCliLoginStartOrPoll=(D,R={})=>this.http.request({path:"/v1/auth/cli-login",method:"POST",body:D,type:"application/json",format:"json",...R});authLoginCreate=(D,R={})=>this.http.request({path:"/v1/auth/login",method:"POST",body:D,type:"application/json",format:"json",...R});authLogoutAllCreate=(D,R={})=>this.http.request({path:"/v1/auth/logout-all",method:"POST",body:D,secure:!0,type:"application/json",...R});authLogoutCreate=(D={})=>this.http.request({path:"/v1/auth/logout",method:"POST",secure:!0,...D});authMeList=(D={})=>this.http.request({path:"/v1/auth/me",method:"GET",secure:!0,format:"json",...D});authMePartialUpdate=(D,R={})=>this.http.request({path:"/v1/auth/me",method:"PATCH",body:D,secure:!0,type:"application/json",format:"json",...R});authPasswordChangeCreate=(D,R={})=>this.http.request({path:"/v1/auth/password/change",method:"POST",body:D,secure:!0,type:"application/json",...R});authPasswordForgotCreate=(D,R={})=>this.http.request({path:"/v1/auth/password/forgot",method:"POST",body:D,type:"application/json",format:"json",...R});authPasswordResetCreate=(D,R={})=>this.http.request({path:"/v1/auth/password/reset",method:"POST",body:D,type:"application/json",format:"json",...R});authResendVerificationCreate=(D={})=>this.http.request({path:"/v1/auth/resend-verification",method:"POST",secure:!0,format:"json",...D});authSessionsDelete=({sessionId:D},R={})=>this.http.request({path:`/v1/auth/sessions/${D}`,method:"DELETE",secure:!0,...R});authSessionsList=(D={})=>this.http.request({path:"/v1/auth/sessions",method:"GET",secure:!0,format:"json",...D});authSignupCreate=(D,R={})=>this.http.request({path:"/v1/auth/signup",method:"POST",body:D,type:"application/json",format:"json",...R});authVerifyEmailCreate=(D,R={})=>this.http.request({path:"/v1/auth/verify-email",method:"POST",body:D,type:"application/json",format:"json",...R});databaseBackupsDownloadUrlCreate=({backupId:D},R,A={})=>this.http.request({path:`/v1/database-backups/${D}/download-url`,method:"POST",body:R,secure:!0,type:"application/json",format:"json",...A});databaseEnginesList=(D={})=>this.http.request({path:"/v1/database-engines",method:"GET",secure:!0,format:"json",...D});databasePlansBundlesList=({planName:D},R={})=>this.http.request({path:`/v1/database-plans/${D}/bundles`,method:"GET",secure:!0,format:"json",...R});databasePlansDetail=({planName:D},R={})=>this.http.request({path:`/v1/database-plans/${D}`,method:"GET",secure:!0,format:"json",...R});databasePlansList=(D={})=>this.http.request({path:"/v1/database-plans",method:"GET",secure:!0,format:"json",...D});databasesAvailabilityList=(D,R={})=>this.http.request({path:"/v1/databases/availability",method:"GET",query:D,secure:!0,format:"json",...R});databasesBackupsCreate=({databaseId:D},R={})=>this.http.request({path:`/v1/databases/${D}/backups`,method:"POST",secure:!0,format:"json",...R});databasesBackupsDetail=({databaseId:D,backupId:R},A={})=>this.http.request({path:`/v1/databases/${D}/backups/${R}`,method:"GET",secure:!0,format:"json",...A});databasesBackupsList=({databaseId:D},R={})=>this.http.request({path:`/v1/databases/${D}/backups`,method:"GET",secure:!0,format:"json",...R});databasesCreate=(D,R={})=>this.http.request({path:"/v1/databases",method:"POST",body:D,secure:!0,type:"application/json",format:"json",...R});databasesCredentialsList=({databaseId:D},R={})=>this.http.request({path:`/v1/databases/${D}/credentials`,method:"GET",secure:!0,format:"json",...R});databasesDelete=({databaseId:D},R={})=>this.http.request({path:`/v1/databases/${D}`,method:"DELETE",secure:!0,format:"json",...R});databasesDetail=({databaseId:D},R={})=>this.http.request({path:`/v1/databases/${D}`,method:"GET",secure:!0,format:"json",...R});databasesEventsList=({databaseId:D,...R},A={})=>this.http.request({path:`/v1/databases/${D}/events`,method:"GET",query:R,secure:!0,format:"json",...A});databasesList=(D={})=>this.http.request({path:"/v1/databases",method:"GET",secure:!0,format:"json",...D});databasesLogsList=({databaseId:D,...R},A={})=>this.http.request({path:`/v1/databases/${D}/logs`,method:"GET",query:R,secure:!0,format:"json",...A});databasesPartialUpdate=({databaseId:D},R,A={})=>this.http.request({path:`/v1/databases/${D}`,method:"PATCH",body:R,secure:!0,type:"application/json",format:"json",...A});databasesResizeCreate=({databaseId:D},R,A={})=>this.http.request({path:`/v1/databases/${D}/resize`,method:"POST",body:R,secure:!0,type:"application/json",format:"json",...A});databasesStartCreate=({databaseId:D},R={})=>this.http.request({path:`/v1/databases/${D}/start`,method:"POST",secure:!0,format:"json",...R});databasesStopCreate=({databaseId:D},R={})=>this.http.request({path:`/v1/databases/${D}/stop`,method:"POST",secure:!0,format:"json",...R});databasesUsageDetail=({databaseId:D,metric:R},A={})=>this.http.request({path:`/v1/databases/${D}/usage/${R}`,method:"GET",secure:!0,format:"json",...A});databasesUsageList=({databaseId:D},R={})=>this.http.request({path:`/v1/databases/${D}/usage`,method:"GET",secure:!0,format:"json",...R});healthList=(D={})=>this.http.request({path:"/v1/health",method:"GET",format:"json",...D});integrationsGitDelete=({integrationId:D},R={})=>this.http.request({path:`/v1/integrations/git/${D}`,method:"DELETE",secure:!0,...R});integrationsGitList=(D={})=>this.http.request({path:"/v1/integrations/git",method:"GET",secure:!0,format:"json",...D});integrationsGitOauthCallbackList=({provider:D},R={})=>this.http.request({path:`/v1/integrations/git/${D}/oauth/callback`,method:"GET",secure:!0,format:"json",...R});integrationsGitOauthStartCreate=({provider:D},R={})=>this.http.request({path:`/v1/integrations/git/${D}/oauth/start`,method:"POST",secure:!0,format:"json",...R});invitesAcceptCreate=({token:D},R={})=>this.http.request({path:`/v1/invites/${D}/accept`,method:"POST",secure:!0,format:"json",...R});invitesDeclineCreate=({token:D},R={})=>this.http.request({path:`/v1/invites/${D}/decline`,method:"POST",secure:!0,format:"json",...R});invitesDetail=({token:D},R={})=>this.http.request({path:`/v1/invites/${D}`,method:"GET",secure:!0,format:"json",...R});notificationPreferencesList=(D={})=>this.http.request({path:"/v1/notification-preferences",method:"GET",secure:!0,format:"json",...D});notificationPreferencesUpdate=(D,R={})=>this.http.request({path:"/v1/notification-preferences",method:"PUT",body:D,secure:!0,type:"application/json",format:"json",...R});notificationsList=(D,R={})=>this.http.request({path:"/v1/notifications",method:"GET",query:D,secure:!0,format:"json",...R});notificationsPartialUpdate=({notificationId:D},R={})=>this.http.request({path:`/v1/notifications/${D}`,method:"PATCH",secure:!0,format:"json",...R});notificationsReadAllCreate=(D={})=>this.http.request({path:"/v1/notifications/read-all",method:"POST",secure:!0,...D});paymentsProvidersList=(D={})=>this.http.request({path:"/v1/payments/providers",method:"GET",secure:!0,format:"json",...D});projectsAvailabilityList=(D,R={})=>this.http.request({path:"/v1/projects/availability",method:"GET",query:D,secure:!0,format:"json",...R});projectsCreate=(D,R={})=>this.http.request({path:"/v1/projects",method:"POST",body:D,secure:!0,type:"application/json",format:"json",...R});projectsDelete=({projectId:D},R={})=>this.http.request({path:`/v1/projects/${D}`,method:"DELETE",secure:!0,format:"json",...R});projectsDetail=({projectId:D},R={})=>this.http.request({path:`/v1/projects/${D}`,method:"GET",secure:!0,format:"json",...R});projectsEventsList=({projectId:D,...R},A={})=>this.http.request({path:`/v1/projects/${D}/events`,method:"GET",query:R,secure:!0,format:"json",...A});projectsInvitesCreate=({projectId:D},R,A={})=>this.http.request({path:`/v1/projects/${D}/invites`,method:"POST",body:R,secure:!0,type:"application/json",format:"json",...A});projectsInvitesDelete=({projectId:D,inviteId:R},A={})=>this.http.request({path:`/v1/projects/${D}/invites/${R}`,method:"DELETE",secure:!0,...A});projectsInvitesList=({projectId:D},R={})=>this.http.request({path:`/v1/projects/${D}/invites`,method:"GET",secure:!0,format:"json",...R});projectsList=(D={})=>this.http.request({path:"/v1/projects",method:"GET",secure:!0,format:"json",...D});projectsMembersDelete=({projectId:D,userId:R},A={})=>this.http.request({path:`/v1/projects/${D}/members/${R}`,method:"DELETE",secure:!0,...A});projectsMembersList=({projectId:D},R={})=>this.http.request({path:`/v1/projects/${D}/members`,method:"GET",secure:!0,format:"json",...R});projectsMembersPartialUpdate=({projectId:D,userId:R},A,$={})=>this.http.request({path:`/v1/projects/${D}/members/${R}`,method:"PATCH",body:A,secure:!0,type:"application/json",format:"json",...$});projectsNotificationRoutesList=({projectId:D},R={})=>this.http.request({path:`/v1/projects/${D}/notification-routes`,method:"GET",secure:!0,format:"json",...R});projectsNotificationRoutesUpdate=({projectId:D},R,A={})=>this.http.request({path:`/v1/projects/${D}/notification-routes`,method:"PUT",body:R,secure:!0,type:"application/json",format:"json",...A});projectsPartialUpdate=({projectId:D},R,A={})=>this.http.request({path:`/v1/projects/${D}`,method:"PATCH",body:R,secure:!0,type:"application/json",format:"json",...A});projectsWalletList=({projectId:D},R={})=>this.http.request({path:`/v1/projects/${D}/wallet`,method:"GET",secure:!0,format:"json",...R});projectsWalletPaymentsCreate=({projectId:D},R,A={})=>this.http.request({path:`/v1/projects/${D}/wallet/payments`,method:"POST",body:R,secure:!0,type:"application/json",format:"json",...A});projectsWalletPaymentsDetail=({projectId:D,paymentId:R},A={})=>this.http.request({path:`/v1/projects/${D}/wallet/payments/${R}`,method:"GET",secure:!0,format:"json",...A});projectsWalletPaymentsList=({projectId:D},R={})=>this.http.request({path:`/v1/projects/${D}/wallet/payments`,method:"GET",secure:!0,format:"json",...R});projectsWalletTransactionsList=({projectId:D,...R},A={})=>this.http.request({path:`/v1/projects/${D}/wallet/transactions`,method:"GET",query:R,secure:!0,format:"json",...A});registriesCreate=(D,R={})=>this.http.request({path:"/v1/registries",method:"POST",body:D,secure:!0,type:"application/json",format:"json",...R});registriesDelete=({registryId:D},R={})=>this.http.request({path:`/v1/registries/${D}`,method:"DELETE",secure:!0,...R});registriesDetail=({registryId:D},R={})=>this.http.request({path:`/v1/registries/${D}`,method:"GET",secure:!0,format:"json",...R});registriesList=(D={})=>this.http.request({path:"/v1/registries",method:"GET",secure:!0,format:"json",...D});registriesPartialUpdate=({registryId:D},R,A={})=>this.http.request({path:`/v1/registries/${D}`,method:"PATCH",body:R,secure:!0,type:"application/json",format:"json",...A});registriesRepositoriesList=({registryId:D,...R},A={})=>this.http.request({path:`/v1/registries/${D}/repositories`,method:"GET",query:R,secure:!0,format:"json",...A});registriesRepositoriesTagsList=({registryId:D,repository:R,...A},$={})=>this.http.request({path:`/v1/registries/${D}/repositories/${R}/tags`,method:"GET",query:A,secure:!0,format:"json",...$});registriesValidateCreate=({registryId:D},R,A={})=>this.http.request({path:`/v1/registries/${D}/validate`,method:"POST",body:R,secure:!0,type:"application/json",format:"json",...A});webhooksGitCreate=({provider:D},R={})=>this.http.request({path:`/v1/webhooks/git/${D}`,method:"POST",...R});webhooksPaymentsCreate=({provider:D},R={})=>this.http.request({path:`/v1/webhooks/payments/${D}`,method:"POST",...R})}import{createRequire as BH}from"node:module";var GH="https://api.abr.run",zH=BH(import.meta.url),JH=zH("../package.json"),S2=JH.version||"dev",UR=`abrun-cli/${S2}`;function b2(){return process.env.ABRUN_ENDPOINT?.trim()||GH}function aD(D){let R=D.project?{"x-project-id":String(D.project.id)}:void 0,$=new W2((()=>({baseUrl:D.endpoint??b2(),baseApiParams:{secure:!0,headers:{"User-Agent":UR}},securityWorker:(f)=>{let P={...R??{}};if(f)P.Authorization=`Bearer ${f}`;return{headers:P}}}))());return $.setSecurityData(D.token??null),{http:$,api:new j2($)}}function iA(D,R,A){let $=new URL(R,D);$.protocol=$.protocol==="https:"?"wss:":"ws:";for(let[f,P]of Object.entries(A??{}))if(P!==void 0)$.searchParams.set(f,String(P));return $.toString()}function c0(D){return new Promise((R)=>setTimeout(R,D))}var Y=_(async(D,R)=>{D.client=aD({endpoint:D.endpoint,token:D.token??D.options.token,project:D.project}),await R()});var D0=_(async(D)=>{D.command.help()});var FR=(D,R=[])=>D.name==="up"||R.includes("vim")&&D.name==="k"||R.includes("emacs")&&D.ctrl&&D.name==="p",aA=(D,R=[])=>D.name==="down"||R.includes("vim")&&D.name==="j"||R.includes("emacs")&&D.ctrl&&D.name==="n";var qR=(D)=>D.name==="backspace",wR=(D)=>D.name==="tab",u2=(D)=>"1234567890".includes(D.name),t0=(D)=>D.name==="enter"||D.name==="return";class E2 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class y2 extends Error{name="CancelPromptError";message="Prompt was canceled"}class rA extends Error{name="ExitPromptError"}class g2 extends Error{name="HookError"}class CR extends Error{name="ValidationError"}import{AsyncResource as XH}from"node:async_hooks";import{AsyncLocalStorage as HH,AsyncResource as ZH}from"node:async_hooks";var S4=new HH;function MH(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function b4(D,R){let A=MH(D);return S4.run(A,()=>{function $(f){A.handleChange=()=>{A.index=0,f()},A.handleChange()}return R($)})}function rD(){let D=S4.getStore();if(!D)throw new g2("[Inquirer] Hook functions can only be called from within a prompt");return D}function m2(){return rD().rl}function x2(D){let R=(...A)=>{let $=rD(),f=!1,P=$.handleChange;$.handleChange=()=>{f=!0};let B=D(...A);if(f)P();return $.handleChange=P,B};return ZH.bind(R)}function I1(D){let R=rD(),{index:A}=R,$={get(){return R.hooks[A]},set(P){R.hooks[A]=P},initialized:A in R.hooks},f=D($);return R.index++,f}function u4(){rD().handleChange()}var sD={queue(D){let R=rD(),{index:A}=R;R.hooksEffect.push(()=>{R.hooksCleanup[A]?.();let $=D(m2());if($!=null&&typeof $!=="function")throw new CR("useEffect return value must be a cleanup function or nothing.");R.hooksCleanup[A]=$})},run(){let D=rD();x2(()=>{D.hooksEffect.forEach((R)=>{R()}),D.hooksEffect.length=0})()},clearAll(){let D=rD();D.hooksCleanup.forEach((R)=>{R?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function TH(D){return typeof D==="function"}function i(D){return I1((R)=>{let A=XH.bind(function(P){if(R.get()!==P)R.set(P),u4()});if(R.initialized)return[R.get(),A];let $=TH(D)?D():D;return R.set($),[$,A]})}function e0(D,R){I1((A)=>{let $=A.get();if(!Array.isArray($)||R.some((P,B)=>!Object.is(P,$[B])))sD.queue(D);A.set(R)})}import{styleText as V0}from"node:util";import N0 from"node:process";function OH(){if(!N0.platform.startsWith("win"))return N0.env.TERM!=="linux";return Boolean(N0.env.CI)||Boolean(N0.env.WT_SESSION)||Boolean(N0.env.TERMINUS_SUBLIME)||N0.env.ConEmuTask==="{cmd::Cmder}"||N0.env.TERM_PROGRAM==="Terminus-Sublime"||N0.env.TERM_PROGRAM==="vscode"||N0.env.TERM==="xterm-256color"||N0.env.TERM==="alacritty"||N0.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var E4={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"█",squareDarkShade:"▓",squareMediumShade:"▒",squareLightShade:"░",squareTop:"▀",squareBottom:"▄",squareLeft:"▌",squareRight:"▐",squareCenter:"■",bullet:"●",dot:"․",ellipsis:"…",pointerSmall:"›",triangleUp:"▲",triangleUpSmall:"▴",triangleDown:"▼",triangleDownSmall:"▾",triangleLeftSmall:"◂",triangleRightSmall:"▸",home:"⌂",heart:"♥",musicNote:"♪",musicNoteBeamed:"♫",arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",arrowLeftRight:"↔",arrowUpDown:"↕",almostEqual:"≈",notEqual:"≠",lessOrEqual:"≤",greaterOrEqual:"≥",identical:"≡",infinity:"∞",subscriptZero:"₀",subscriptOne:"₁",subscriptTwo:"₂",subscriptThree:"₃",subscriptFour:"₄",subscriptFive:"₅",subscriptSix:"₆",subscriptSeven:"₇",subscriptEight:"₈",subscriptNine:"₉",oneHalf:"½",oneThird:"⅓",oneQuarter:"¼",oneFifth:"⅕",oneSixth:"⅙",oneEighth:"⅛",twoThirds:"⅔",twoFifths:"⅖",threeQuarters:"¾",threeFifths:"⅗",threeEighths:"⅜",fourFifths:"⅘",fiveSixths:"⅚",fiveEighths:"⅝",sevenEighths:"⅞",line:"─",lineBold:"━",lineDouble:"═",lineDashed0:"┄",lineDashed1:"┅",lineDashed2:"┈",lineDashed3:"┉",lineDashed4:"╌",lineDashed5:"╍",lineDashed6:"╴",lineDashed7:"╶",lineDashed8:"╸",lineDashed9:"╺",lineDashed10:"╼",lineDashed11:"╾",lineDashed12:"−",lineDashed13:"–",lineDashed14:"‐",lineDashed15:"⁃",lineVertical:"│",lineVerticalBold:"┃",lineVerticalDouble:"║",lineVerticalDashed0:"┆",lineVerticalDashed1:"┇",lineVerticalDashed2:"┊",lineVerticalDashed3:"┋",lineVerticalDashed4:"╎",lineVerticalDashed5:"╏",lineVerticalDashed6:"╵",lineVerticalDashed7:"╷",lineVerticalDashed8:"╹",lineVerticalDashed9:"╻",lineVerticalDashed10:"╽",lineVerticalDashed11:"╿",lineDownLeft:"┐",lineDownLeftArc:"╮",lineDownBoldLeftBold:"┓",lineDownBoldLeft:"┒",lineDownLeftBold:"┑",lineDownDoubleLeftDouble:"╗",lineDownDoubleLeft:"╖",lineDownLeftDouble:"╕",lineDownRight:"┌",lineDownRightArc:"╭",lineDownBoldRightBold:"┏",lineDownBoldRight:"┎",lineDownRightBold:"┍",lineDownDoubleRightDouble:"╔",lineDownDoubleRight:"╓",lineDownRightDouble:"╒",lineUpLeft:"┘",lineUpLeftArc:"╯",lineUpBoldLeftBold:"┛",lineUpBoldLeft:"┚",lineUpLeftBold:"┙",lineUpDoubleLeftDouble:"╝",lineUpDoubleLeft:"╜",lineUpLeftDouble:"╛",lineUpRight:"└",lineUpRightArc:"╰",lineUpBoldRightBold:"┗",lineUpBoldRight:"┖",lineUpRightBold:"┕",lineUpDoubleRightDouble:"╚",lineUpDoubleRight:"╙",lineUpRightDouble:"╘",lineUpDownLeft:"┤",lineUpBoldDownBoldLeftBold:"┫",lineUpBoldDownBoldLeft:"┨",lineUpDownLeftBold:"┥",lineUpBoldDownLeftBold:"┩",lineUpDownBoldLeftBold:"┪",lineUpDownBoldLeft:"┧",lineUpBoldDownLeft:"┦",lineUpDoubleDownDoubleLeftDouble:"╣",lineUpDoubleDownDoubleLeft:"╢",lineUpDownLeftDouble:"╡",lineUpDownRight:"├",lineUpBoldDownBoldRightBold:"┣",lineUpBoldDownBoldRight:"┠",lineUpDownRightBold:"┝",lineUpBoldDownRightBold:"┡",lineUpDownBoldRightBold:"┢",lineUpDownBoldRight:"┟",lineUpBoldDownRight:"┞",lineUpDoubleDownDoubleRightDouble:"╠",lineUpDoubleDownDoubleRight:"╟",lineUpDownRightDouble:"╞",lineDownLeftRight:"┬",lineDownBoldLeftBoldRightBold:"┳",lineDownLeftBoldRightBold:"┯",lineDownBoldLeftRight:"┰",lineDownBoldLeftBoldRight:"┱",lineDownBoldLeftRightBold:"┲",lineDownLeftRightBold:"┮",lineDownLeftBoldRight:"┭",lineDownDoubleLeftDoubleRightDouble:"╦",lineDownDoubleLeftRight:"╥",lineDownLeftDoubleRightDouble:"╤",lineUpLeftRight:"┴",lineUpBoldLeftBoldRightBold:"┻",lineUpLeftBoldRightBold:"┷",lineUpBoldLeftRight:"┸",lineUpBoldLeftBoldRight:"┹",lineUpBoldLeftRightBold:"┺",lineUpLeftRightBold:"┶",lineUpLeftBoldRight:"┵",lineUpDoubleLeftDoubleRightDouble:"╩",lineUpDoubleLeftRight:"╨",lineUpLeftDoubleRightDouble:"╧",lineUpDownLeftRight:"┼",lineUpBoldDownBoldLeftBoldRightBold:"╋",lineUpDownBoldLeftBoldRightBold:"╈",lineUpBoldDownLeftBoldRightBold:"╇",lineUpBoldDownBoldLeftRightBold:"╊",lineUpBoldDownBoldLeftBoldRight:"╉",lineUpBoldDownLeftRight:"╀",lineUpDownBoldLeftRight:"╁",lineUpDownLeftBoldRight:"┽",lineUpDownLeftRightBold:"┾",lineUpBoldDownBoldLeftRight:"╂",lineUpDownLeftBoldRightBold:"┿",lineUpBoldDownLeftBoldRight:"╃",lineUpBoldDownLeftRightBold:"╄",lineUpDownBoldLeftBoldRight:"╅",lineUpDownBoldLeftRightBold:"╆",lineUpDoubleDownDoubleLeftDoubleRightDouble:"╬",lineUpDoubleDownDoubleLeftRight:"╫",lineUpDownLeftDoubleRightDouble:"╪",lineCross:"╳",lineBackslash:"╲",lineSlash:"╱"},y4={tick:"✔",info:"ℹ",warning:"⚠",cross:"✘",squareSmall:"◻",squareSmallFilled:"◼",circle:"◯",circleFilled:"◉",circleDotted:"◌",circleDouble:"◎",circleCircle:"ⓞ",circleCross:"ⓧ",circlePipe:"Ⓘ",radioOn:"◉",radioOff:"◯",checkboxOn:"☒",checkboxOff:"☐",checkboxCircleOn:"ⓧ",checkboxCircleOff:"Ⓘ",pointer:"❯",triangleUpOutline:"△",triangleLeft:"◀",triangleRight:"▶",lozenge:"◆",lozengeOutline:"◇",hamburger:"☰",smiley:"㋡",mustache:"෴",star:"★",play:"▶",nodejs:"⬢",oneSeventh:"⅐",oneNinth:"⅑",oneTenth:"⅒"},QH={tick:"√",info:"i",warning:"‼",cross:"×",squareSmall:"□",squareSmallFilled:"■",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(○)",circleCross:"(×)",circlePipe:"(│)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[×]",checkboxOff:"[ ]",checkboxCircleOn:"(×)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"∆",triangleLeft:"◄",triangleRight:"►",lozenge:"♦",lozengeOutline:"◊",hamburger:"≡",smiley:"☺",mustache:"┌─┐",star:"✶",play:"►",nodejs:"♦",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},YH={...E4,...y4},_H={...E4,...QH},UH=OH(),FH=UH?YH:_H,K1=FH,zV=Object.entries(y4);var g4={prefix:{idle:V0("blue","?"),done:V0("green",K1.tick)},spinner:{interval:80,frames:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"].map((D)=>V0("yellow",D))},style:{answer:(D)=>V0("cyan",D),message:(D)=>V0("bold",D),error:(D)=>V0("red",`> ${D}`),defaultAnswer:(D)=>V0("dim",`(${D})`),help:(D)=>V0("dim",D),highlight:(D)=>V0("cyan",D),key:(D)=>V0("cyan",V0("bold",`<${D}>`))}};function m4(D){if(typeof D!=="object"||D===null)return!1;let R=D;while(Object.getPrototypeOf(R)!==null)R=Object.getPrototypeOf(R);return Object.getPrototypeOf(D)===R}function x4(...D){let R={};for(let A of D)for(let[$,f]of Object.entries(A)){let P=R[$];R[$]=m4(P)&&m4(f)?x4(P,f):f}return R}function I0(...D){let R=[g4,...D.filter((A)=>A!=null)];return x4(...R)}function DD({status:D="idle",theme:R}){let[A,$]=i(!1),[f,P]=i(0),{prefix:B,spinner:G}=I0(R);if(e0(()=>{if(D==="loading"){let J,Z=-1,H=setTimeout(()=>{$(!0),J=setInterval(()=>{Z=Z+1,P(Z%G.frames.length)},G.interval)},300);return()=>{clearTimeout(H),clearInterval(J)}}else $(!1)},[D]),A)return G.frames[f];return typeof B==="string"?B:B[D==="loading"?"idle":D]??B.idle}function LR(D,R){return I1((A)=>{let $=A.get();if(!$||$.dependencies.length!==R.length||$.dependencies.some((f,P)=>f!==R[P])){let f=D();return A.set({value:f,dependencies:R}),f}return $.value})}function oD(D){return i({current:D})[0]}function RD(D){let R=oD(D);R.current=D,e0((A)=>{let $=!1,f=x2((P,B)=>{if($)return;R.current(B,A)});return A.input.on("keypress",f),()=>{$=!0,A.input.removeListener("keypress",f)}},[])}var A9=B0(p4(),1);var h4=(()=>{let D=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return(R)=>{let A=0;D.lastIndex=0;while(D.test(R))A+=1;return R.length-A}})(),v4=(D)=>{return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510},l4=(D)=>{return D===8987||D===9001||D>=12272&&D<=12287||D>=12289&&D<=12350||D>=12441&&D<=12543||D>=12549&&D<=12591||D>=12593&&D<=12686||D>=12688&&D<=12771||D>=12783&&D<=12830||D>=12832&&D<=12871||D>=12880&&D<=19903||D>=65040&&D<=65049||D>=65072&&D<=65106||D>=65108&&D<=65126||D>=65128&&D<=65131||D>=127488&&D<=127490||D>=127504&&D<=127547||D>=127552&&D<=127560||D>=131072&&D<=196605||D>=196608&&D<=262141};var CH=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,LH=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,d4=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,NH=/\t{1,1000}/y,k4=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,VH=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,IH=/\p{M}+/gu,KH={limit:1/0,ellipsis:""},i4=(D,R={},A={})=>{let $=R.limit??1/0,f=R.ellipsis??"",P=R?.ellipsisWidth??(f?i4(f,KH,A).width:0),B=0,G=A.controlWidth??0,z=A.tabWidth??8,J=A.emojiWidth??2,Z=2,H=A.regularWidth??1,M=A.wideWidth??2,T=[[VH,H],[CH,0],[LH,G],[NH,z],[k4,J],[d4,M]],Q=0,X=0,O=D.length,U=0,F=!1,w=O,V=Math.max(0,$-P),I=0,j=0,u=0,L=0;D:while(!0){if(j>I||X>=O&&X>Q){let S=D.slice(I,j)||D.slice(Q,X);U=0;for(let l of S.replaceAll(IH,"")){let d=l.codePointAt(0)||0;if(v4(d))L=2;else if(l4(d))L=M;else L=H;if(u+L>V)w=Math.min(w,Math.max(I,Q)+U);if(u+L>$){F=!0;break D}U+=l.length,u+=L}I=j=0}if(X>=O)break D;for(let S=0,l=T.length;S<l;S++){let[d,g]=T[S];if(d.lastIndex=X,d.test(D)){if(U=d===d4?h4(D.slice(X,d.lastIndex)):d===k4?1:d.lastIndex-X,L=U*g,u+L>V)w=Math.min(w,X+Math.floor((V-u)/g));if(u+L>$){F=!0;break D}u+=L,I=Q,j=X,X=Q=d.lastIndex;continue D}}X+=1}return{width:F?V:u,index:F?w:O,truncated:F,ellipsed:F&&$>=P}},a4=i4;var WH={limit:1/0,ellipsis:"",ellipsisWidth:0},jH=(D,R={})=>{return a4(D,WH,R).width},AD=jH;var sA="\x1B",t4="",SH=39,p2="\x07",e4="[",bH="]",D9="m",h2=`${bH}8;;`,r4=new RegExp(`(?:\\${e4}(?<code>\\d+)m|\\${h2}(?<uri>.*)${p2})`,"y"),s4=(D)=>{if(D>=30&&D<=37)return 39;if(D>=90&&D<=97)return 39;if(D>=40&&D<=47)return 49;if(D>=100&&D<=107)return 49;if(D===1||D===2)return 22;if(D===3)return 23;if(D===4)return 24;if(D===7)return 27;if(D===8)return 28;if(D===9)return 29;if(D===0)return 0;return},o4=(D)=>`${sA}${e4}${D}${D9}`,c4=(D)=>`${sA}${h2}${D}${p2}`,n2=(D,R,A)=>{let $=R[Symbol.iterator](),f=!1,P=!1,B=D.at(-1),G=B===void 0?0:AD(B),z=$.next(),J=$.next(),Z=0;while(!z.done){let H=z.value,M=AD(H);if(G+M<=A)D[D.length-1]+=H;else D.push(H),G=0;if(H===sA||H===t4)f=!0,P=R.startsWith(h2,Z+1);if(f){if(P){if(H===p2)f=!1,P=!1}else if(H===D9)f=!1}else if(G+=M,G===A&&!J.done)D.push(""),G=0;z=J,J=$.next(),Z+=H.length}if(B=D.at(-1),!G&&B!==void 0&&B.length&&D.length>1)D[D.length-2]+=D.pop()},uH=(D)=>{let R=D.split(" "),A=R.length;while(A){if(AD(R[A-1]))break;A--}if(A===R.length)return D;return R.slice(0,A).join(" ")+R.slice(A).join("")},EH=(D,R,A={})=>{if(A.trim!==!1&&D.trim()==="")return"";let $="",f,P,B=D.split(" "),G=[""],z=0;for(let H=0;H<B.length;H++){let M=B[H];if(A.trim!==!1){let Q=G.at(-1)??"",X=Q.trimStart();if(Q.length!==X.length)G[G.length-1]=X,z=AD(X)}if(H!==0){if(z>=R&&(A.wordWrap===!1||A.trim===!1))G.push(""),z=0;if(z||A.trim===!1)G[G.length-1]+=" ",z++}let T=AD(M);if(A.hard&&T>R){let Q=R-z,X=1+Math.floor((T-Q-1)/R);if(Math.floor((T-1)/R)<X)G.push("");n2(G,M,R),z=AD(G.at(-1)??"");continue}if(z+T>R&&z&&T){if(A.wordWrap===!1&&z<R){n2(G,M,R),z=AD(G.at(-1)??"");continue}G.push(""),z=0}if(z+T>R&&A.wordWrap===!1){n2(G,M,R),z=AD(G.at(-1)??"");continue}G[G.length-1]+=M,z+=T}if(A.trim!==!1)G=G.map((H)=>uH(H));let J=G.join(`
|
|
171
|
-
`),Z=!1;for(let H=0;H<J.length;H++){let M=J[H];if($+=M,!Z){if(Z=M>="\uD800"&&M<="\uDBFF",Z)continue}else Z=!1;if(M===sA||M===t4){r4.lastIndex=H+1;let Q=r4.exec(J)?.groups;if(Q?.code!==void 0){let X=Number.parseFloat(Q.code);f=X===SH?void 0:X}else if(Q?.uri!==void 0)P=Q.uri.length===0?void 0:Q.uri}if(J[H+1]===`
|
|
172
|
-
`){if(P)$+=c4("");let T=f?s4(f):void 0;if(f&&T)$+=o4(T)}else if(M===`
|
|
173
|
-
`){if(f&&s4(f))$+=o4(f);if(P)$+=c4(P)}}return $},yH=/\r?\n/;function R9(D,R,A){return String(D).normalize().split(yH).map(($)=>EH($,R,A)).join(`
|
|
174
|
-
`)}function NR(D,R){return D.split(`
|
|
175
|
-
`).flatMap((A)=>R9(A,R,{trim:!1,hard:!0}).split(`
|
|
176
|
-
`).map(($)=>$.trimEnd())).join(`
|
|
177
|
-
`)}function oA(){return A9.default({defaultWidth:80,output:m2().output})}function gH({active:D,renderedItems:R,pageSize:A,loop:$}){let f=oD({lastPointer:D,lastActive:void 0}),{lastPointer:P,lastActive:B}=f.current,G=Math.floor(A/2),z=R.reduce((H,M)=>H+M.length,0),J=R.slice(0,D).reduce((H,M)=>H+M.length,0),Z=J;if(z>A)if($){if(Z=P,B!=null&&B<D&&D-B<A)Z=Math.min(G,Math.abs(D-B)===1?Math.min(P+(R[B]?.length??0),Math.max(J,P)):P+D-B)}else{let H=R.slice(D).reduce((M,T)=>M+T.length,0);Z=H<A-G?A-H:Math.min(J,G)}return f.current.lastPointer=Z,f.current.lastActive=D,Z}function v2({items:D,active:R,renderItem:A,pageSize:$,loop:f=!0}){let P=oA(),B=(U)=>(U%D.length+D.length)%D.length,G=D.map((U,F)=>{if(U==null)return[];return NR(A({item:U,index:F,isActive:F===R}),P).split(`
|
|
178
|
-
`)}),z=G.reduce((U,F)=>U+F.length,0),J=(U)=>G[U]??[],Z=gH({active:R,renderedItems:G,pageSize:$,loop:f}),H=J(R).slice(0,$),M=Z+H.length<=$?Z:$-H.length,T=Array.from({length:$});T.splice(M,H.length,...H);let Q=new Set([R]),X=M+H.length,O=B(R+1);while(X<$&&!Q.has(O)&&(f&&z>$?O!==R:O>R)){let F=J(O).slice(0,$-X);T.splice(X,F.length,...F),Q.add(O),X+=F.length,O=B(O+1)}X=M-1,O=B(R-1);while(X>=0&&!Q.has(O)&&(f&&z>$?O!==R:O<R)){let U=J(O),F=U.slice(Math.max(0,U.length-X-1));T.splice(X-F.length+1,F.length,...F),Q.add(O),X-=F.length,O=B(O-1)}return T.filter((U)=>typeof U==="string").join(`
|
|
179
|
-
`)}var T9=B0(P9(),1);import*as X9 from"node:readline";import{AsyncResource as lH}from"node:async_hooks";var cD=[];cD.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")cD.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")cD.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var cA=(D)=>!!D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function",l2=Symbol.for("signal-exit emitter"),d2=globalThis,xH=Object.defineProperty.bind(Object);class B9{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(d2[l2])return d2[l2];xH(d2,l2,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(D,R){this.listeners[D].push(R)}removeListener(D,R){let A=this.listeners[D],$=A.indexOf(R);if($===-1)return;if($===0&&A.length===1)A.length=0;else A.splice($,1)}emit(D,R,A){if(this.emitted[D])return!1;this.emitted[D]=!0;let $=!1;for(let f of this.listeners[D])$=f(R,A)===!0||$;if(D==="exit")$=this.emit("afterExit",R,A)||$;return $}}class i2{}var nH=(D)=>{return{onExit(R,A){return D.onExit(R,A)},load(){return D.load()},unload(){return D.unload()}}};class G9 extends i2{onExit(){return()=>{}}load(){}unload(){}}class z9 extends i2{#D=k2.platform==="win32"?"SIGINT":"SIGHUP";#A=new B9;#R;#B;#P;#$={};#f=!1;constructor(D){super();this.#R=D,this.#$={};for(let R of cD)this.#$[R]=()=>{let A=this.#R.listeners(R),{count:$}=this.#A,f=D;if(typeof f.__signal_exit_emitter__==="object"&&typeof f.__signal_exit_emitter__.count==="number")$+=f.__signal_exit_emitter__.count;if(A.length===$){this.unload();let P=this.#A.emit("exit",null,R),B=R==="SIGHUP"?this.#D:R;if(!P)D.kill(D.pid,B)}};this.#P=D.reallyExit,this.#B=D.emit}onExit(D,R){if(!cA(this.#R))return()=>{};if(this.#f===!1)this.load();let A=R?.alwaysLast?"afterExit":"exit";return this.#A.on(A,D),()=>{if(this.#A.removeListener(A,D),this.#A.listeners.exit.length===0&&this.#A.listeners.afterExit.length===0)this.unload()}}load(){if(this.#f)return;this.#f=!0,this.#A.count+=1;for(let D of cD)try{let R=this.#$[D];if(R)this.#R.on(D,R)}catch(R){}this.#R.emit=(D,...R)=>{return this.#z(D,...R)},this.#R.reallyExit=(D)=>{return this.#G(D)}}unload(){if(!this.#f)return;this.#f=!1,cD.forEach((D)=>{let R=this.#$[D];if(!R)throw Error("Listener not defined for signal: "+D);try{this.#R.removeListener(D,R)}catch(A){}}),this.#R.emit=this.#B,this.#R.reallyExit=this.#P,this.#A.count-=1}#G(D){if(!cA(this.#R))return 0;return this.#R.exitCode=D||0,this.#A.emit("exit",this.#R.exitCode,null),this.#P.call(this.#R,this.#R.exitCode)}#z(D,...R){let A=this.#B;if(D==="exit"&&cA(this.#R)){if(typeof R[0]==="number")this.#R.exitCode=R[0];let $=A.call(this.#R,D,...R);return this.#A.emit("exit",this.#R.exitCode,null),$}else return A.call(this.#R,D,...R)}}var k2=globalThis.process,{onExit:J9,load:dV,unload:kV}=nH(cA(k2)?new z9(k2):new G9);import{stripVTControlCharacters as hH}from"node:util";var pH="\x1B[G",tA="\x1B[?25l",Z9="\x1B[?25h",a2=(D=1)=>D>0?`\x1B[${D}A`:"",r2=(D=1)=>D>0?`\x1B[${D}B`:"",s2=(D,R)=>{if(typeof R==="number"&&!Number.isNaN(R))return`\x1B[${R+1};${D+1}H`;return`\x1B[${D+1}G`},H9="\x1B[2K",o2=(D)=>D>0?(H9+a2(1)).repeat(D-1)+H9+pH:"";var M9=(D)=>D.split(`
|
|
180
|
-
`).length,vH=(D)=>D.split(`
|
|
181
|
-
`).pop()??"";class eA{height=0;extraLinesUnderPrompt=0;cursorPos;rl;constructor(D){this.rl=D,this.cursorPos=D.getCursorPos()}write(D){this.rl.output.unmute(),this.rl.output.write(D),this.rl.output.mute()}render(D,R=""){let A=vH(D),$=hH(A),f=$;if(this.rl.line.length>0)f=f.slice(0,-this.rl.line.length);this.rl.setPrompt(f),this.cursorPos=this.rl.getCursorPos();let P=oA();if(D=NR(D,P),R=NR(R,P),$.length%P===0)D+=`
|
|
182
|
-
`;let B=D+(R?`
|
|
183
|
-
`+R:""),z=Math.floor($.length/P)-this.cursorPos.rows+(R?M9(R):0);if(z>0)B+=a2(z);B+=s2(this.cursorPos.cols),this.write(r2(this.extraLinesUnderPrompt)+o2(this.height)+B),this.extraLinesUnderPrompt=z,this.height=M9(B)}checkCursorPos(){let D=this.rl.getCursorPos();if(D.cols!==this.cursorPos.cols)this.write(s2(D.cols)),this.cursorPos=D}done({clearContent:D}){this.rl.setPrompt("");let R=r2(this.extraLinesUnderPrompt);R+=D?o2(this.height):`
|
|
184
|
-
`,R+=Z9,this.write(R),this.rl.close()}}class c2 extends Promise{static withResolver(){let D,R;return{promise:new Promise(($,f)=>{D=$,R=f}),resolve:D,reject:R}}}import dH from"node:path";var kH=globalThis.setImmediate;function iH(){let D=Error.prepareStackTrace,R=[];try{Error.prepareStackTrace=(A,$)=>{let f=$.slice(1);return R=f,f},Error().stack}catch{return R}return Error.prepareStackTrace=D,R}function $D(D){let R=iH();return($,f={})=>{let{input:P=process.stdin,signal:B}=f,G=new Set,z=new T9.default;z.pipe(f.output??process.stdout),z.mute();let J=X9.createInterface({terminal:!0,input:P,output:z}),Z=new eA(J),{promise:H,resolve:M,reject:T}=c2.withResolver(),Q=()=>T(new y2);if(B){let O=()=>T(new E2({cause:B.reason}));if(B.aborted)return O(),Object.assign(H,{cancel:Q});B.addEventListener("abort",O),G.add(()=>B.removeEventListener("abort",O))}G.add(J9((O,U)=>{T(new rA(`User force closed the prompt with ${O} ${U}`))}));let X=()=>T(new rA("User force closed the prompt with SIGINT"));return J.on("SIGINT",X),G.add(()=>J.removeListener("SIGINT",X)),b4(J,(O)=>{let U=lH.bind(()=>sD.clearAll());J.on("close",U),G.add(()=>J.removeListener("close",U));let F=()=>{let w=()=>Z.checkCursorPos();J.input.on("keypress",w),G.add(()=>J.input.removeListener("keypress",w));let V=null;O(()=>{let I=!1;try{let j=D($,(S)=>{if(I)M(S);else V={value:S}});if(j===void 0){let S=R[1]?.getFileName();if(S&&!S.startsWith("file://"))S=dH.resolve(S);throw Error(`Prompt functions must return a string.
|
|
185
|
-
at ${S}`)}let[u,L]=typeof j==="string"?[j]:j;Z.render(u,L),sD.run()}catch(j){T(j)}if(I=!0,V!==null){let{value:j}=V;V=null,M(j)}})};if("readableFlowing"in P)kH(F);else F();return Object.assign(H.then((w)=>{return sD.clearAll(),w},(w)=>{throw sD.clearAll(),w}).finally(()=>{G.forEach((w)=>w()),Z.done({clearContent:Boolean(f.clearPromptOnDone)}),z.end()}).then(()=>H),{cancel:Q})})}}import{styleText as aH}from"node:util";class m0{separator=aH("dim",Array.from({length:15}).join(K1.line));type="separator";constructor(D){if(D)this.separator=D}static isSeparator(D){return Boolean(D&&typeof D==="object"&&"type"in D&&D.type==="separator")}}function O9(D,R){let A=R!==!1;if(/^(y|yes)/i.test(D))A=!0;else if(/^(n|no)/i.test(D))A=!1;return A}function Q9(D){return D?"Yes":"No"}var t2=$D((D,R)=>{let{transformer:A=Q9}=D,[$,f]=i("idle"),[P,B]=i(""),G=I0(D.theme),z=DD({status:$,theme:G});RD((M,T)=>{if($!=="idle")return;if(t0(M)){let Q=O9(P,D.default);B(A(Q)),f("done"),R(Q)}else if(wR(M)){let Q=Q9(!O9(P,D.default));T.clearLine(0),T.write(Q),B(Q)}else B(T.line)});let J=P,Z="";if($==="done")J=G.style.answer(P);else Z=` ${G.style.defaultAnswer(D.default===!1?"y/N":"Y/n")}`;let H=G.style.message(D.message,$);return`${z} ${H}${Z} ${J}`});var rH={validationFailureMode:"keep"},VR=$D((D,R)=>{let{prefill:A="tab"}=D,$=I0(rH,D.theme),[f,P]=i("idle"),[B,G]=i(String(D.default??"")),[z,J]=i(),[Z,H]=i(""),M=DD({status:f,theme:$});async function T(F){let{required:w,pattern:V,patternError:I="Invalid input"}=D;if(w&&!F)return"You must provide a value";if(V&&!V.test(F))return I;if(typeof D.validate==="function")return await D.validate(F)||"You must provide a valid value";return!0}RD(async(F,w)=>{if(f!=="idle")return;if(t0(F)){let V=Z||B;P("loading");let I=await T(V);if(I===!0)H(V),P("done"),R(V);else{if($.validationFailureMode==="clear")H("");else w.write(Z);J(I),P("idle")}}else if(qR(F)&&!Z)G("");else if(wR(F)&&!Z)G(""),w.clearLine(0),w.write(B),H(B);else H(w.line),J(void 0)}),e0((F)=>{if(A==="editable"&&B)F.write(B),H(B)},[]);let Q=$.style.message(D.message,f),X=Z;if(typeof D.transformer==="function")X=D.transformer(Z,{isFinal:f==="done"});else if(f==="done")X=$.style.answer(Z);let O;if(B&&f!=="done"&&!Z)O=$.style.defaultAnswer(B);let U="";if(z)U=$.style.error(z);return[[M,Q,O,X].filter((F)=>F!==void 0).join(" "),U]});var sH={style:{maskedText:"[input is masked]"}},e2=$D((D,R)=>{let{validate:A=()=>!0}=D,$=I0(sH,D.theme),[f,P]=i("idle"),[B,G]=i(),[z,J]=i(""),Z=DD({status:f,theme:$});RD(async(X,O)=>{if(f!=="idle")return;if(t0(X)){let U=z;P("loading");let F=await A(U);if(F===!0)J(U),P("done"),R(U);else O.write(z),G(F||"You must provide a valid value"),P("idle")}else J(O.line),G(void 0)});let H=$.style.message(D.message,f),M="",T;if(D.mask)M=(typeof D.mask==="string"?D.mask:"*").repeat(z.length);else if(f!=="done")T=`${$.style.help($.style.maskedText)}${tA}`;if(f==="done")M=$.style.answer(M);let Q="";if(B)Q=$.style.error(B);return[[Z,H,D.mask?M:T].join(" "),Q]});import{styleText as IR}from"node:util";var oH={icon:{cursor:K1.pointer},style:{disabled:(D)=>IR("dim",D),description:(D)=>IR("cyan",D),keysHelpTip:(D)=>D.map(([R,A])=>`${IR("bold",R)} ${IR("dim",A)}`).join(IR("dim"," • "))},i18n:{disabledError:"This option is disabled and cannot be selected."},indexMode:"hidden",keybindings:[]};function D3(D){return!m0.isSeparator(D)&&!D.disabled}function R3(D){return!m0.isSeparator(D)}function cH(D){return D.map((R)=>{if(m0.isSeparator(R))return R;if(typeof R!=="object"||R===null||!("value"in R)){let f=String(R);return{value:R,name:f,short:f,disabled:!1}}let A=R.name??String(R.value),$={value:R.value,name:A,short:R.short??A,disabled:R.disabled??!1};if(R.description)$.description=R.description;return $})}var KR=$D((D,R)=>{let{loop:A=!0,pageSize:$=7}=D,f=I0(oH,D.theme),{keybindings:P}=f,[B,G]=i("idle"),z=DD({status:B,theme:f}),J=oD(),Z=!P.includes("vim"),H=LR(()=>cH(D.choices),[D.choices]),M=LR(()=>{let S=H.findIndex(R3),l=H.findLastIndex(R3);if(S===-1)throw new CR("[select prompt] No selectable choices. All choices are disabled.");return{first:S,last:l}},[H]),T=LR(()=>{if(!("default"in D))return-1;return H.findIndex((S)=>D3(S)&&S.value===D.default)},[D.default,H]),[Q,X]=i(T===-1?M.first:T),O=H[Q];if(O==null||m0.isSeparator(O))throw Error("Active index does not point to a choice");let[U,F]=i();RD((S,l)=>{if(clearTimeout(J.current),U)F(void 0);if(t0(S))if(O.disabled)F(f.i18n.disabledError);else G("done"),R(O.value);else if(FR(S,P)||aA(S,P)){if(l.clearLine(0),A||FR(S,P)&&Q!==M.first||aA(S,P)&&Q!==M.last){let d=FR(S,P)?-1:1,g=Q;do g=(g+d+H.length)%H.length;while(!R3(H[g]));X(g)}}else if(u2(S)&&!Number.isNaN(Number(l.line))){let d=Number(l.line)-1,g=-1,Y0=H.findIndex((MR)=>{if(m0.isSeparator(MR))return!1;return g++,g===d}),tf=H[Y0];if(tf!=null&&D3(tf))X(Y0);J.current=setTimeout(()=>{l.clearLine(0)},700)}else if(qR(S))l.clearLine(0);else if(Z){let d=l.line.toLowerCase(),g=H.findIndex((Y0)=>{if(m0.isSeparator(Y0)||!D3(Y0))return!1;return Y0.name.toLowerCase().startsWith(d)});if(g!==-1)X(g);J.current=setTimeout(()=>{l.clearLine(0)},700)}}),e0(()=>()=>{clearTimeout(J.current)},[]);let w=f.style.message(D.message,B),V=f.style.keysHelpTip([["↑↓","navigate"],["⏎","select"]]),I=0,j=v2({items:H,active:Q,renderItem({item:S,isActive:l,index:d}){if(m0.isSeparator(S))return I++,` ${S.separator}`;let g=l?f.icon.cursor:" ",Y0=f.indexMode==="number"?`${d+1-I}. `:"";if(S.disabled){let MR=typeof S.disabled==="string"?S.disabled:"(disabled)",RJ=l?f.icon.cursor:"-";return f.style.disabled(`${RJ} ${Y0}${S.name} ${MR}`)}return(l?f.style.highlight:(MR)=>MR)(`${g} ${Y0}${S.name}`)},pageSize:$,loop:A});if(B==="done")return[z,w,f.style.answer(O.short)].filter(Boolean).join(" ");let{description:u}=O;return`${[[z,w].filter(Boolean).join(" "),j," ",u?f.style.description(u):"",U?f.style.error(U):"",V].filter(Boolean).join(`
|
|
186
|
-
`).trimEnd()}${tA}`});function Y9(D){if(D==="table"||D==="json"||D==="yaml")return D;throw Error("Output must be one of: table, json, yaml.")}function _9(D){if(D.json)D.output="json";if(D.output??="table",D.json=D.output==="json",D.color===!1)process.env.NO_COLOR=process.env.NO_COLOR??"1"}function tH(D){if(D.output)return D.output;return D.json?"json":"table"}function C(D){return tH(D)==="json"}var XP=B0(IB(),1);import{mkdir as tU,readFile as eU,rm as qW,writeFile as DF}from"node:fs/promises";import RF from"node:os";import KB from"node:path";var AF={version:1,currentProjectByAuthId:{},auths:[]};function WB(){return KB.join(RF.homedir(),".abrun","config.yaml")}async function jB(){try{let D=await eU(WB(),"utf8"),R=XP.default.parse(D);return{version:1,currentProjectByAuthId:R?.currentProjectByAuthId??{},auths:R?.auths??[],currentAuthId:R?.currentAuthId}}catch(D){if(D.code==="ENOENT")return structuredClone(AF);throw D}}async function p0(D){let R=WB();await tU(KB.dirname(R),{recursive:!0}),await DF(R,XP.default.stringify(D),"utf8")}var b=_(async(D,R)=>{let A=await D.client.api.projectsList(),$=D.options.project&&A.find((P)=>_R(P,D.options.project))||(D.auth&&D.state.currentProjectByAuthId[D.auth.id]?A.find((P)=>_R(P,D.state.currentProjectByAuthId[D.auth.id])):void 0);if(!$&&A.length===1)$=A[0];if(!$&&A.length>1&&process.stdout.isTTY&&!C(D.options)){let P=await KR({message:"Select project",choices:A.map((B)=>({value:String(B.id),name:`${B.name} (${B.slug}, #${B.id})`}))});$=A.find((B)=>String(B.id)===P)}if(!$)D.abort("No project available for the selected auth.");let f=$;D.project=f,D.state.currentProjectByAuthId[D.auth.id]=String(f.id),await p0(D.state),await R()});var N=_(async(D,R)=>{_9(D.options),D.state=await jB(),D.endpoint=D.options.endpoint??b2(),await R()});var x=_(async(D,R)=>{let $=((await D.client.api.appsList()).items??[]).find((f)=>L4(f,D.args.app));if(!$)D.abort(`App not found: ${D.args.app}`);D.app=$,await R()});async function h0(D,R,A,$,f){if(A.length===0)throw Error("No available options.");if(!process.stdout.isTTY||C(D.options))D.abort($);if(A.length===1&&!f?.forcePromptSingle)return A[0].value;return KR({message:R,choices:A})}async function p1(D,R,A){if(!process.stdout.isTTY||C(D.options))D.abort(A);return t2({message:R,default:!1})}async function SB(D,R,A){if(!process.stdout.isTTY||C(D.options))D.abort(A);let $=await VR({message:R,validate:(f)=>{let P=Number(f);return Number.isInteger(P)&&P>=1&&P<=65535?!0:"Port must be an integer between 1 and 65535."}});return Number($)}async function bB(D,R){let A=await h0(D,"Select app plan",R.map(($)=>({value:$.name??"",name:`${$.name??""} (${$.cpuMilli??0}m CPU / ${$.memoryMb??0}Mi / ${$.diskGb??0}Gi)`})),"App plan is required. Use --plan or run in an interactive terminal.",{forcePromptSingle:!0});return kD(R,A)}async function uB(D,R){let A=await h0(D,"Select app bundle",R.map(($)=>({value:$.name??"",name:`${$.name??""} (${$.backupStorageGb??0}Gi backup, ${$.priceHourly??0}/hour)`})),"App bundle is required. Use --bundle or run in an interactive terminal.",{forcePromptSingle:!0});return iD(R,A)}async function TP(D,R){let A=await h0(D,"Select database plan",R.map(($)=>({value:$.name??"",name:`${$.name??""} (${$.cpuMilli??0}m CPU / ${$.memoryMb??0}Mi / ${$.diskGb??0}Gi)`})),"Database plan is required. Use --plan or run in an interactive terminal.");return UD(R,A)}async function OP(D,R){let A=await h0(D,"Select database bundle",R.map(($)=>({value:$.name??"",name:`${$.name??""} (${$.publicAccess?"public":"private"}, plugins: ${$.databasePlugins?"yes":"no"})`})),"Database bundle is required. Use --bundle or run in an interactive terminal.");return V1(R,A)}var EB=_(async(D,R)=>{let A=await D.client.api.appPlansList(),$=D.options.plan?.trim()||await h0(D,"Select app plan",A.map((J)=>({value:J.name??"",name:J.name??""})),"App plan is required. Use --plan or run in an interactive terminal.",{forcePromptSingle:!0}),f=kD(A,$),P=await D.client.api.appPlansBundlesList({planName:f.name}),B=D.options.bundle?.trim()||await h0(D,"Select app bundle",P.map((J)=>({value:J.name??"",name:J.name??""})),"App bundle is required. Use --bundle or run in an interactive terminal.",{forcePromptSingle:!0}),G=iD(P,B),z=D.options.port??await SB(D,"App runtime port","App port is required. Use --port or run in an interactive terminal.");D.plan=f,D.bundle=G,D.app=await D.client.api.appsCreate({name:D.args.name,plan:f.name,bundle:G.name,port:z,securityProfile:D.options.securityProfile}),await R()}),yB=_(async(D)=>{if(C(D.options)){W(D.app,!0);return}console.log(`Created app ${D.app.name} (${D.app.status})`)});var gB=_(async(D)=>{await D.client.api.appsDelete({appId:D.app.id}),console.log(`Removed app ${D.app.name}`)});import{rm as SG}from"node:fs/promises";import HC from"node:path";import{mkdtemp as Bw}from"node:fs/promises";import Gw from"node:os";import c5 from"node:path";import PF from"events";import M0 from"fs";import{EventEmitter as H6}from"node:events";import Y5 from"node:stream";import{StringDecoder as BF}from"node:string_decoder";import F5 from"node:path";import s1 from"node:fs";import{dirname as UF,parse as FF}from"path";import{EventEmitter as KF}from"events";import kP from"assert";import{Buffer as O1}from"buffer";import*as hB from"zlib";import WF from"zlib";import{posix as v1}from"node:path";import{basename as Aq}from"node:path";import Xf from"fs";import k0 from"fs";import rB from"path";import{win32 as Xq}from"node:path";import R5 from"path";import y5 from"node:fs";import jq from"node:assert";import{randomBytes as g5}from"node:crypto";import n from"node:fs";import e from"node:path";import m5 from"fs";import Cf from"node:fs";import OA from"node:path";import O0 from"node:fs";import mq from"node:fs/promises";import Qf from"node:path";import{join as r5}from"node:path";import T0 from"node:fs";import o5 from"node:path";var $F=Object.defineProperty,fF=(D,R)=>{for(var A in R)$F(D,A,{get:R[A],enumerable:!0})},mB=typeof process=="object"&&process?process:{stdout:null,stderr:null},GF=(D)=>!!D&&typeof D=="object"&&(D instanceof _1||D instanceof Y5||zF(D)||JF(D)),zF=(D)=>!!D&&typeof D=="object"&&D instanceof H6&&typeof D.pipe=="function"&&D.pipe!==Y5.Writable.prototype.pipe,JF=(D)=>!!D&&typeof D=="object"&&D instanceof H6&&typeof D.write=="function"&&typeof D.end=="function",BD=Symbol("EOF"),GD=Symbol("maybeEmitEnd"),WD=Symbol("emittedEnd"),h$=Symbol("emittingEnd"),eR=Symbol("emittedError"),v$=Symbol("closed"),xB=Symbol("read"),l$=Symbol("flush"),nB=Symbol("flushChunk"),j0=Symbol("encoding"),h1=Symbol("decoder"),R0=Symbol("flowing"),DA=Symbol("paused"),i1=Symbol("resume"),A0=Symbol("buffer"),z0=Symbol("pipes"),$0=Symbol("bufferLength"),QP=Symbol("bufferPush"),d$=Symbol("bufferShift"),G0=Symbol("objectMode"),r=Symbol("destroyed"),YP=Symbol("error"),_P=Symbol("emitData"),pB=Symbol("emitEnd"),UP=Symbol("emitEnd2"),v0=Symbol("async"),FP=Symbol("abort"),k$=Symbol("aborted"),RA=Symbol("signal"),P1=Symbol("dataListeners"),X0=Symbol("discarded"),AA=(D)=>Promise.resolve().then(D),HF=(D)=>D(),ZF=(D)=>D==="end"||D==="finish"||D==="prefinish",MF=(D)=>D instanceof ArrayBuffer||!!D&&typeof D=="object"&&D.constructor&&D.constructor.name==="ArrayBuffer"&&D.byteLength>=0,XF=(D)=>!Buffer.isBuffer(D)&&ArrayBuffer.isView(D),_5=class{src;dest;opts;ondrain;constructor(D,R,A){this.src=D,this.dest=R,this.opts=A,this.ondrain=()=>D[i1](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(D){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},TF=class extends _5{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(D,R,A){super(D,R,A),this.proxyErrors=($)=>this.dest.emit("error",$),D.on("error",this.proxyErrors)}},OF=(D)=>!!D.objectMode,QF=(D)=>!D.objectMode&&!!D.encoding&&D.encoding!=="buffer",_1=class extends H6{[R0]=!1;[DA]=!1;[z0]=[];[A0]=[];[G0];[j0];[v0];[h1];[BD]=!1;[WD]=!1;[h$]=!1;[v$]=!1;[eR]=null;[$0]=0;[r]=!1;[RA];[k$]=!1;[P1]=0;[X0]=!1;writable=!0;readable=!0;constructor(...D){let R=D[0]||{};if(super(),R.objectMode&&typeof R.encoding=="string")throw TypeError("Encoding and objectMode may not be used together");OF(R)?(this[G0]=!0,this[j0]=null):QF(R)?(this[j0]=R.encoding,this[G0]=!1):(this[G0]=!1,this[j0]=null),this[v0]=!!R.async,this[h1]=this[j0]?new BF(this[j0]):null,R&&R.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[A0]}),R&&R.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[z0]});let{signal:A}=R;A&&(this[RA]=A,A.aborted?this[FP]():A.addEventListener("abort",()=>this[FP]()))}get bufferLength(){return this[$0]}get encoding(){return this[j0]}set encoding(D){throw Error("Encoding must be set at instantiation time")}setEncoding(D){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[G0]}set objectMode(D){throw Error("objectMode must be set at instantiation time")}get async(){return this[v0]}set async(D){this[v0]=this[v0]||!!D}[FP](){this[k$]=!0,this.emit("abort",this[RA]?.reason),this.destroy(this[RA]?.reason)}get aborted(){return this[k$]}set aborted(D){}write(D,R,A){if(this[k$])return!1;if(this[BD])throw Error("write after end");if(this[r])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof R=="function"&&(A=R,R="utf8"),R||(R="utf8");let $=this[v0]?AA:HF;if(!this[G0]&&!Buffer.isBuffer(D)){if(XF(D))D=Buffer.from(D.buffer,D.byteOffset,D.byteLength);else if(MF(D))D=Buffer.from(D);else if(typeof D!="string")throw Error("Non-contiguous data written to non-objectMode stream")}return this[G0]?(this[R0]&&this[$0]!==0&&this[l$](!0),this[R0]?this.emit("data",D):this[QP](D),this[$0]!==0&&this.emit("readable"),A&&$(A),this[R0]):D.length?(typeof D=="string"&&!(R===this[j0]&&!this[h1]?.lastNeed)&&(D=Buffer.from(D,R)),Buffer.isBuffer(D)&&this[j0]&&(D=this[h1].write(D)),this[R0]&&this[$0]!==0&&this[l$](!0),this[R0]?this.emit("data",D):this[QP](D),this[$0]!==0&&this.emit("readable"),A&&$(A),this[R0]):(this[$0]!==0&&this.emit("readable"),A&&$(A),this[R0])}read(D){if(this[r])return null;if(this[X0]=!1,this[$0]===0||D===0||D&&D>this[$0])return this[GD](),null;this[G0]&&(D=null),this[A0].length>1&&!this[G0]&&(this[A0]=[this[j0]?this[A0].join(""):Buffer.concat(this[A0],this[$0])]);let R=this[xB](D||null,this[A0][0]);return this[GD](),R}[xB](D,R){if(this[G0])this[d$]();else{let A=R;D===A.length||D===null?this[d$]():typeof A=="string"?(this[A0][0]=A.slice(D),R=A.slice(0,D),this[$0]-=D):(this[A0][0]=A.subarray(D),R=A.subarray(0,D),this[$0]-=D)}return this.emit("data",R),!this[A0].length&&!this[BD]&&this.emit("drain"),R}end(D,R,A){return typeof D=="function"&&(A=D,D=void 0),typeof R=="function"&&(A=R,R="utf8"),D!==void 0&&this.write(D,R),A&&this.once("end",A),this[BD]=!0,this.writable=!1,(this[R0]||!this[DA])&&this[GD](),this}[i1](){this[r]||(!this[P1]&&!this[z0].length&&(this[X0]=!0),this[DA]=!1,this[R0]=!0,this.emit("resume"),this[A0].length?this[l$]():this[BD]?this[GD]():this.emit("drain"))}resume(){return this[i1]()}pause(){this[R0]=!1,this[DA]=!0,this[X0]=!1}get destroyed(){return this[r]}get flowing(){return this[R0]}get paused(){return this[DA]}[QP](D){this[G0]?this[$0]+=1:this[$0]+=D.length,this[A0].push(D)}[d$](){return this[G0]?this[$0]-=1:this[$0]-=this[A0][0].length,this[A0].shift()}[l$](D=!1){do;while(this[nB](this[d$]())&&this[A0].length);!D&&!this[A0].length&&!this[BD]&&this.emit("drain")}[nB](D){return this.emit("data",D),this[R0]}pipe(D,R){if(this[r])return D;this[X0]=!1;let A=this[WD];return R=R||{},D===mB.stdout||D===mB.stderr?R.end=!1:R.end=R.end!==!1,R.proxyErrors=!!R.proxyErrors,A?R.end&&D.end():(this[z0].push(R.proxyErrors?new TF(this,D,R):new _5(this,D,R)),this[v0]?AA(()=>this[i1]()):this[i1]()),D}unpipe(D){let R=this[z0].find((A)=>A.dest===D);R&&(this[z0].length===1?(this[R0]&&this[P1]===0&&(this[R0]=!1),this[z0]=[]):this[z0].splice(this[z0].indexOf(R),1),R.unpipe())}addListener(D,R){return this.on(D,R)}on(D,R){let A=super.on(D,R);if(D==="data")this[X0]=!1,this[P1]++,!this[z0].length&&!this[R0]&&this[i1]();else if(D==="readable"&&this[$0]!==0)super.emit("readable");else if(ZF(D)&&this[WD])super.emit(D),this.removeAllListeners(D);else if(D==="error"&&this[eR]){let $=R;this[v0]?AA(()=>$.call(this,this[eR])):$.call(this,this[eR])}return A}removeListener(D,R){return this.off(D,R)}off(D,R){let A=super.off(D,R);return D==="data"&&(this[P1]=this.listeners("data").length,this[P1]===0&&!this[X0]&&!this[z0].length&&(this[R0]=!1)),A}removeAllListeners(D){let R=super.removeAllListeners(D);return(D==="data"||D===void 0)&&(this[P1]=0,!this[X0]&&!this[z0].length&&(this[R0]=!1)),R}get emittedEnd(){return this[WD]}[GD](){!this[h$]&&!this[WD]&&!this[r]&&this[A0].length===0&&this[BD]&&(this[h$]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[v$]&&this.emit("close"),this[h$]=!1)}emit(D,...R){let A=R[0];if(D!=="error"&&D!=="close"&&D!==r&&this[r])return!1;if(D==="data")return!this[G0]&&!A?!1:this[v0]?(AA(()=>this[_P](A)),!0):this[_P](A);if(D==="end")return this[pB]();if(D==="close"){if(this[v$]=!0,!this[WD]&&!this[r])return!1;let f=super.emit("close");return this.removeAllListeners("close"),f}else if(D==="error"){this[eR]=A,super.emit(YP,A);let f=!this[RA]||this.listeners("error").length?super.emit("error",A):!1;return this[GD](),f}else if(D==="resume"){let f=super.emit("resume");return this[GD](),f}else if(D==="finish"||D==="prefinish"){let f=super.emit(D);return this.removeAllListeners(D),f}let $=super.emit(D,...R);return this[GD](),$}[_P](D){for(let A of this[z0])A.dest.write(D)===!1&&this.pause();let R=this[X0]?!1:super.emit("data",D);return this[GD](),R}[pB](){return this[WD]?!1:(this[WD]=!0,this.readable=!1,this[v0]?(AA(()=>this[UP]()),!0):this[UP]())}[UP](){if(this[h1]){let R=this[h1].end();if(R){for(let A of this[z0])A.dest.write(R);this[X0]||super.emit("data",R)}}for(let R of this[z0])R.end();let D=super.emit("end");return this.removeAllListeners("end"),D}async collect(){let D=Object.assign([],{dataLength:0});this[G0]||(D.dataLength=0);let R=this.promise();return this.on("data",(A)=>{D.push(A),this[G0]||(D.dataLength+=A.length)}),await R,D}async concat(){if(this[G0])throw Error("cannot concat in objectMode");let D=await this.collect();return this[j0]?D.join(""):Buffer.concat(D,D.dataLength)}async promise(){return new Promise((D,R)=>{this.on(r,()=>R(Error("stream destroyed"))),this.on("error",(A)=>R(A)),this.on("end",()=>D())})}[Symbol.asyncIterator](){this[X0]=!1;let D=!1,R=async()=>(this.pause(),D=!0,{value:void 0,done:!0});return{next:()=>{if(D)return R();let A=this.read();if(A!==null)return Promise.resolve({done:!1,value:A});if(this[BD])return R();let $,f,P=(J)=>{this.off("data",B),this.off("end",G),this.off(r,z),R(),f(J)},B=(J)=>{this.off("error",P),this.off("end",G),this.off(r,z),this.pause(),$({value:J,done:!!this[BD]})},G=()=>{this.off("error",P),this.off("data",B),this.off(r,z),R(),$({done:!0,value:void 0})},z=()=>P(Error("stream destroyed"));return new Promise((J,Z)=>{f=Z,$=J,this.once(r,z),this.once("error",P),this.once("end",G),this.once("data",B)})},throw:R,return:R,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[X0]=!1;let D=!1,R=()=>(this.pause(),this.off(YP,R),this.off(r,R),this.off("end",R),D=!0,{done:!0,value:void 0}),A=()=>{if(D)return R();let $=this.read();return $===null?R():{done:!1,value:$}};return this.once("end",R),this.once(YP,R),this.once(r,R),{next:A,throw:R,return:R,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(D){if(this[r])return D?this.emit("error",D):this.emit(r),this;this[r]=!0,this[X0]=!0,this[A0].length=0,this[$0]=0;let R=this;return typeof R.close=="function"&&!this[v$]&&R.close(),D?this.emit("error",D):this.emit(r),this}static get isStream(){return GF}},YF=M0.writev,xD=Symbol("_autoClose"),E0=Symbol("_close"),$A=Symbol("_ended"),v=Symbol("_fd"),qP=Symbol("_finished"),ZD=Symbol("_flags"),wP=Symbol("_flush"),lP=Symbol("_handleChunk"),dP=Symbol("_makeBuf"),XA=Symbol("_mode"),i$=Symbol("_needDrain"),o1=Symbol("_onerror"),c1=Symbol("_onopen"),CP=Symbol("_onread"),a1=Symbol("_onwrite"),nD=Symbol("_open"),u0=Symbol("_path"),uD=Symbol("_pos"),l0=Symbol("_queue"),r1=Symbol("_read"),LP=Symbol("_readSize"),HD=Symbol("_reading"),fA=Symbol("_remain"),NP=Symbol("_size"),Rf=Symbol("_write"),B1=Symbol("_writing"),Af=Symbol("_defaultFlag"),T1=Symbol("_errored"),Z6=class extends _1{[T1]=!1;[v];[u0];[LP];[HD]=!1;[NP];[fA];[xD];constructor(D,R){if(R=R||{},super(R),this.readable=!0,this.writable=!1,typeof D!="string")throw TypeError("path must be a string");this[T1]=!1,this[v]=typeof R.fd=="number"?R.fd:void 0,this[u0]=D,this[LP]=R.readSize||16777216,this[HD]=!1,this[NP]=typeof R.size=="number"?R.size:1/0,this[fA]=this[NP],this[xD]=typeof R.autoClose=="boolean"?R.autoClose:!0,typeof this[v]=="number"?this[r1]():this[nD]()}get fd(){return this[v]}get path(){return this[u0]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[nD](){M0.open(this[u0],"r",(D,R)=>this[c1](D,R))}[c1](D,R){D?this[o1](D):(this[v]=R,this.emit("open",R),this[r1]())}[dP](){return Buffer.allocUnsafe(Math.min(this[LP],this[fA]))}[r1](){if(!this[HD]){this[HD]=!0;let D=this[dP]();if(D.length===0)return process.nextTick(()=>this[CP](null,0,D));M0.read(this[v],D,0,D.length,null,(R,A,$)=>this[CP](R,A,$))}}[CP](D,R,A){this[HD]=!1,D?this[o1](D):this[lP](R,A)&&this[r1]()}[E0](){if(this[xD]&&typeof this[v]=="number"){let D=this[v];this[v]=void 0,M0.close(D,(R)=>R?this.emit("error",R):this.emit("close"))}}[o1](D){this[HD]=!0,this[E0](),this.emit("error",D)}[lP](D,R){let A=!1;return this[fA]-=D,D>0&&(A=super.write(D<R.length?R.subarray(0,D):R)),(D===0||this[fA]<=0)&&(A=!1,this[E0](),super.end()),A}emit(D,...R){switch(D){case"prefinish":case"finish":return!1;case"drain":return typeof this[v]=="number"&&this[r1](),!1;case"error":return this[T1]?!1:(this[T1]=!0,super.emit(D,...R));default:return super.emit(D,...R)}}},_F=class extends Z6{[nD](){let D=!0;try{this[c1](null,M0.openSync(this[u0],"r")),D=!1}finally{D&&this[E0]()}}[r1](){let D=!0;try{if(!this[HD]){this[HD]=!0;do{let R=this[dP](),A=R.length===0?0:M0.readSync(this[v],R,0,R.length,null);if(!this[lP](A,R))break}while(!0);this[HD]=!1}D=!1}finally{D&&this[E0]()}}[E0](){if(this[xD]&&typeof this[v]=="number"){let D=this[v];this[v]=void 0,M0.closeSync(D),this.emit("close")}}},Yf=class extends PF{readable=!1;writable=!0;[T1]=!1;[B1]=!1;[$A]=!1;[l0]=[];[i$]=!1;[u0];[XA];[xD];[v];[Af];[ZD];[qP]=!1;[uD];constructor(D,R){R=R||{},super(R),this[u0]=D,this[v]=typeof R.fd=="number"?R.fd:void 0,this[XA]=R.mode===void 0?438:R.mode,this[uD]=typeof R.start=="number"?R.start:void 0,this[xD]=typeof R.autoClose=="boolean"?R.autoClose:!0;let A=this[uD]!==void 0?"r+":"w";this[Af]=R.flags===void 0,this[ZD]=R.flags===void 0?A:R.flags,this[v]===void 0&&this[nD]()}emit(D,...R){if(D==="error"){if(this[T1])return!1;this[T1]=!0}return super.emit(D,...R)}get fd(){return this[v]}get path(){return this[u0]}[o1](D){this[E0](),this[B1]=!0,this.emit("error",D)}[nD](){M0.open(this[u0],this[ZD],this[XA],(D,R)=>this[c1](D,R))}[c1](D,R){this[Af]&&this[ZD]==="r+"&&D&&D.code==="ENOENT"?(this[ZD]="w",this[nD]()):D?this[o1](D):(this[v]=R,this.emit("open",R),this[B1]||this[wP]())}end(D,R){return D&&this.write(D,R),this[$A]=!0,!this[B1]&&!this[l0].length&&typeof this[v]=="number"&&this[a1](null,0),this}write(D,R){return typeof D=="string"&&(D=Buffer.from(D,R)),this[$A]?(this.emit("error",Error("write() after end()")),!1):this[v]===void 0||this[B1]||this[l0].length?(this[l0].push(D),this[i$]=!0,!1):(this[B1]=!0,this[Rf](D),!0)}[Rf](D){M0.write(this[v],D,0,D.length,this[uD],(R,A)=>this[a1](R,A))}[a1](D,R){D?this[o1](D):(this[uD]!==void 0&&typeof R=="number"&&(this[uD]+=R),this[l0].length?this[wP]():(this[B1]=!1,this[$A]&&!this[qP]?(this[qP]=!0,this[E0](),this.emit("finish")):this[i$]&&(this[i$]=!1,this.emit("drain"))))}[wP](){if(this[l0].length===0)this[$A]&&this[a1](null,0);else if(this[l0].length===1)this[Rf](this[l0].pop());else{let D=this[l0];this[l0]=[],YF(this[v],D,this[uD],(R,A)=>this[a1](R,A))}}[E0](){if(this[xD]&&typeof this[v]=="number"){let D=this[v];this[v]=void 0,M0.close(D,(R)=>R?this.emit("error",R):this.emit("close"))}}},U5=class extends Yf{[nD](){let D;if(this[Af]&&this[ZD]==="r+")try{D=M0.openSync(this[u0],this[ZD],this[XA])}catch(R){if(R?.code==="ENOENT")return this[ZD]="w",this[nD]();throw R}else D=M0.openSync(this[u0],this[ZD],this[XA]);this[c1](null,D)}[E0](){if(this[xD]&&typeof this[v]=="number"){let D=this[v];this[v]=void 0,M0.closeSync(D),this.emit("close")}}[Rf](D){let R=!0;try{this[a1](null,M0.writeSync(this[v],D,0,D.length,this[uD])),R=!1}finally{if(R)try{this[E0]()}catch{}}}},qF=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),wF=(D)=>!!D.sync&&!!D.file,CF=(D)=>!D.sync&&!!D.file,LF=(D)=>!!D.sync&&!D.file,NF=(D)=>!D.sync&&!D.file,VF=(D)=>!!D.file,IF=(D)=>{return qF.get(D)||D},M6=(D={})=>{if(!D)return{};let R={};for(let[A,$]of Object.entries(D)){let f=IF(A);R[f]=$}return R.chmod===void 0&&R.noChmod===!1&&(R.chmod=!0),delete R.noChmod,R},wA=(D,R,A,$,f)=>Object.assign((P=[],B,G)=>{Array.isArray(P)&&(B=P,P={}),typeof B=="function"&&(G=B,B=void 0),B=B?Array.from(B):[];let z=M6(P);if(f?.(z,B),wF(z)){if(typeof G=="function")throw TypeError("callback not supported for sync tar functions");return D(z,B)}else if(CF(z)){let J=R(z,B);return G?J.then(()=>G(),G):J}else if(LF(z)){if(typeof G=="function")throw TypeError("callback not supported for sync tar functions");return A(z,B)}else if(NF(z)){if(typeof G=="function")throw TypeError("callback only supported with file option");return $(z,B)}throw Error("impossible options??")},{syncFile:D,asyncFile:R,syncNoFile:A,asyncNoFile:$,validate:f}),jF=WF.constants||{ZLIB_VERNUM:4736},a0=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},jF)),SF=O1.concat,vB=Object.getOwnPropertyDescriptor(O1,"concat"),bF=(D)=>D,VP=vB?.writable===!0||vB?.set!==void 0?(D)=>{O1.concat=D?bF:SF}:(D)=>{},Q1=Symbol("_superWrite"),a$=class extends Error{code;errno;constructor(D,R){super("zlib: "+D.message,{cause:D}),this.code=D.code,this.errno=D.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+D.message,Error.captureStackTrace(this,R??this.constructor)}get name(){return"ZlibError"}},IP=Symbol("flushFlag"),X6=class extends _1{#D=!1;#A=!1;#R;#B;#P;#$;#f;get sawError(){return this.#D}get handle(){return this.#$}get flushFlag(){return this.#R}constructor(D,R){if(!D||typeof D!="object")throw TypeError("invalid options for ZlibBase constructor");if(super(D),this.#R=D.flush??0,this.#B=D.finishFlush??0,this.#P=D.fullFlushFlag??0,typeof hB[R]!="function")throw TypeError("Compression method not supported: "+R);try{this.#$=new hB[R](D)}catch(A){throw new a$(A,this.constructor)}this.#f=(A)=>{this.#D||(this.#D=!0,this.close(),this.emit("error",A))},this.#$?.on("error",(A)=>this.#f(new a$(A))),this.once("end",()=>this.close)}close(){this.#$&&(this.#$.close(),this.#$=void 0,this.emit("close"))}reset(){if(!this.#D)return kP(this.#$,"zlib binding closed"),this.#$.reset?.()}flush(D){this.ended||(typeof D!="number"&&(D=this.#P),this.write(Object.assign(O1.alloc(0),{[IP]:D})))}end(D,R,A){return typeof D=="function"&&(A=D,R=void 0,D=void 0),typeof R=="function"&&(A=R,R=void 0),D&&(R?this.write(D,R):this.write(D)),this.flush(this.#B),this.#A=!0,super.end(A)}get ended(){return this.#A}[Q1](D){return super.write(D)}write(D,R,A){if(typeof R=="function"&&(A=R,R="utf8"),typeof D=="string"&&(D=O1.from(D,R)),this.#D)return;kP(this.#$,"zlib binding closed");let $=this.#$._handle,f=$.close;$.close=()=>{};let P=this.#$.close;this.#$.close=()=>{},VP(!0);let B;try{let z=typeof D[IP]=="number"?D[IP]:this.#R;B=this.#$._processChunk(D,z),VP(!1)}catch(z){VP(!1),this.#f(new a$(z,this.write))}finally{this.#$&&(this.#$._handle=$,$.close=f,this.#$.close=P,this.#$.removeAllListeners("error"))}this.#$&&this.#$.on("error",(z)=>this.#f(new a$(z,this.write)));let G;if(B)if(Array.isArray(B)&&B.length>0){let z=B[0];G=this[Q1](O1.from(z));for(let J=1;J<B.length;J++)G=this[Q1](B[J])}else G=this[Q1](O1.from(B));return A&&A(),G}},q5=class extends X6{#D;#A;constructor(D,R){D=D||{},D.flush=D.flush||a0.Z_NO_FLUSH,D.finishFlush=D.finishFlush||a0.Z_FINISH,D.fullFlushFlag=a0.Z_FULL_FLUSH,super(D,R),this.#D=D.level,this.#A=D.strategy}params(D,R){if(!this.sawError){if(!this.handle)throw Error("cannot switch params when binding is closed");if(!this.handle.params)throw Error("not supported in this implementation");if(this.#D!==D||this.#A!==R){this.flush(a0.Z_SYNC_FLUSH),kP(this.handle,"zlib binding closed");let A=this.handle.flush;this.handle.flush=($,f)=>{typeof $=="function"&&(f=$,$=this.flushFlag),this.flush($),f?.()};try{this.handle.params(D,R)}finally{this.handle.flush=A}this.handle&&(this.#D=D,this.#A=R)}}}},uF=class extends q5{#D;constructor(D){super(D,"Gzip"),this.#D=D&&!!D.portable}[Q1](D){return this.#D?(this.#D=!1,D[9]=255,super[Q1](D)):super[Q1](D)}},EF=class extends q5{constructor(D){super(D,"Unzip")}},w5=class extends X6{constructor(D,R){D=D||{},D.flush=D.flush||a0.BROTLI_OPERATION_PROCESS,D.finishFlush=D.finishFlush||a0.BROTLI_OPERATION_FINISH,D.fullFlushFlag=a0.BROTLI_OPERATION_FLUSH,super(D,R)}},yF=class extends w5{constructor(D){super(D,"BrotliCompress")}},gF=class extends w5{constructor(D){super(D,"BrotliDecompress")}},C5=class extends X6{constructor(D,R){D=D||{},D.flush=D.flush||a0.ZSTD_e_continue,D.finishFlush=D.finishFlush||a0.ZSTD_e_end,D.fullFlushFlag=a0.ZSTD_e_flush,super(D,R)}},mF=class extends C5{constructor(D){super(D,"ZstdCompress")}},xF=class extends C5{constructor(D){super(D,"ZstdDecompress")}},nF=(D,R)=>{if(Number.isSafeInteger(D))D<0?hF(D,R):pF(D,R);else throw Error("cannot encode number outside of javascript safe integer range");return R},pF=(D,R)=>{R[0]=128;for(var A=R.length;A>1;A--)R[A-1]=D&255,D=Math.floor(D/256)},hF=(D,R)=>{R[0]=255;var A=!1;D=D*-1;for(var $=R.length;$>1;$--){var f=D&255;D=Math.floor(D/256),A?R[$-1]=L5(f):f===0?R[$-1]=0:(A=!0,R[$-1]=N5(f))}},vF=(D)=>{let R=D[0],A=R===128?dF(D.subarray(1,D.length)):R===255?lF(D):null;if(A===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(A))throw Error("parsed number outside of javascript safe integer range");return A},lF=(D)=>{for(var R=D.length,A=0,$=!1,f=R-1;f>-1;f--){var P=Number(D[f]),B;$?B=L5(P):P===0?B=P:($=!0,B=N5(P)),B!==0&&(A-=B*Math.pow(256,R-f-1))}return A},dF=(D)=>{for(var R=D.length,A=0,$=R-1;$>-1;$--){var f=Number(D[$]);f!==0&&(A+=f*Math.pow(256,R-$-1))}return A},L5=(D)=>(255^D)&255,N5=(D)=>(255^D)+1&255,kF={};fF(kF,{code:()=>T6,isCode:()=>$f,isName:()=>iF,name:()=>_f});var $f=(D)=>_f.has(D),iF=(D)=>T6.has(D),_f=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),T6=new Map(Array.from(_f).map((D)=>[D[1],D[0]])),Y1=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#D="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(D,R=0,A,$){Buffer.isBuffer(D)?this.decode(D,R||0,A,$):D&&this.#A(D)}decode(D,R,A,$){if(R||(R=0),!D||!(D.length>=R+512))throw Error("need 512 bytes for header");this.path=A?.path??G1(D,R,100),this.mode=A?.mode??$?.mode??ED(D,R+100,8),this.uid=A?.uid??$?.uid??ED(D,R+108,8),this.gid=A?.gid??$?.gid??ED(D,R+116,8),this.size=A?.size??$?.size??ED(D,R+124,12),this.mtime=A?.mtime??$?.mtime??KP(D,R+136,12),this.cksum=ED(D,R+148,12),$&&this.#A($,!0),A&&this.#A(A);let f=G1(D,R+156,1);if($f(f)&&(this.#D=f||"0"),this.#D==="0"&&this.path.slice(-1)==="/"&&(this.#D="5"),this.#D==="5"&&(this.size=0),this.linkpath=G1(D,R+157,100),D.subarray(R+257,R+265).toString()==="ustar\x0000")if(this.uname=A?.uname??$?.uname??G1(D,R+265,32),this.gname=A?.gname??$?.gname??G1(D,R+297,32),this.devmaj=A?.devmaj??$?.devmaj??ED(D,R+329,8)??0,this.devmin=A?.devmin??$?.devmin??ED(D,R+337,8)??0,D[R+475]!==0){let B=G1(D,R+345,155);this.path=B+"/"+this.path}else{let B=G1(D,R+345,130);B&&(this.path=B+"/"+this.path),this.atime=A?.atime??$?.atime??KP(D,R+476,12),this.ctime=A?.ctime??$?.ctime??KP(D,R+488,12)}let P=256;for(let B=R;B<R+148;B++)P+=D[B];for(let B=R+156;B<R+512;B++)P+=D[B];this.cksumValid=P===this.cksum,this.cksum===void 0&&P===256&&(this.nullBlock=!0)}#A(D,R=!1){Object.assign(this,Object.fromEntries(Object.entries(D).filter(([A,$])=>!($==null||A==="path"&&R||A==="linkpath"&&R||A==="global"))))}encode(D,R=0){if(D||(D=this.block=Buffer.alloc(512)),this.#D==="Unsupported"&&(this.#D="0"),!(D.length>=R+512))throw Error("need 512 bytes for header");let A=this.ctime||this.atime?130:155,$=aF(this.path||"",A),f=$[0],P=$[1];this.needPax=!!$[2],this.needPax=z1(D,R,100,f)||this.needPax,this.needPax=yD(D,R+100,8,this.mode)||this.needPax,this.needPax=yD(D,R+108,8,this.uid)||this.needPax,this.needPax=yD(D,R+116,8,this.gid)||this.needPax,this.needPax=yD(D,R+124,12,this.size)||this.needPax,this.needPax=WP(D,R+136,12,this.mtime)||this.needPax,D[R+156]=Number(this.#D.codePointAt(0)),this.needPax=z1(D,R+157,100,this.linkpath)||this.needPax,D.write("ustar\x0000",R+257,8),this.needPax=z1(D,R+265,32,this.uname)||this.needPax,this.needPax=z1(D,R+297,32,this.gname)||this.needPax,this.needPax=yD(D,R+329,8,this.devmaj)||this.needPax,this.needPax=yD(D,R+337,8,this.devmin)||this.needPax,this.needPax=z1(D,R+345,A,P)||this.needPax,D[R+475]!==0?this.needPax=z1(D,R+345,155,P)||this.needPax:(this.needPax=z1(D,R+345,130,P)||this.needPax,this.needPax=WP(D,R+476,12,this.atime)||this.needPax,this.needPax=WP(D,R+488,12,this.ctime)||this.needPax);let B=256;for(let G=R;G<R+148;G++)B+=D[G];for(let G=R+156;G<R+512;G++)B+=D[G];return this.cksum=B,yD(D,R+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#D==="Unsupported"?this.#D:_f.get(this.#D)}get typeKey(){return this.#D}set type(D){let R=String(T6.get(D));if($f(R)||R==="Unsupported")this.#D=R;else if($f(D))this.#D=D;else throw TypeError("invalid entry type: "+D)}},aF=(D,R)=>{let A=D,$="",f,P=v1.parse(D).root||".";if(Buffer.byteLength(A)<100)f=[A,$,!1];else{$=v1.dirname(A),A=v1.basename(A);do Buffer.byteLength(A)<=100&&Buffer.byteLength($)<=R?f=[A,$,!1]:Buffer.byteLength(A)>100&&Buffer.byteLength($)<=R?f=[A.slice(0,99),$,!0]:(A=v1.join(v1.basename($),A),$=v1.dirname($));while($!==P&&f===void 0);f||(f=[D.slice(0,99),"",!0])}return f},G1=(D,R,A)=>D.subarray(R,R+A).toString("utf8").replace(/\0.*/,""),KP=(D,R,A)=>rF(ED(D,R,A)),rF=(D)=>D===void 0?void 0:new Date(D*1000),ED=(D,R,A)=>Number(D[R])&128?vF(D.subarray(R,R+A)):oF(D,R,A),sF=(D)=>isNaN(D)?void 0:D,oF=(D,R,A)=>sF(parseInt(D.subarray(R,R+A).toString("utf8").replace(/\0.*$/,"").trim(),8)),cF={12:8589934591,8:2097151},yD=(D,R,A,$)=>$===void 0?!1:$>cF[A]||$<0?(nF($,D.subarray(R,R+A)),!0):(tF(D,R,A,$),!1),tF=(D,R,A,$)=>D.write(eF($,A),R,A,"ascii"),eF=(D,R)=>Dq(Math.floor(D).toString(8),R),Dq=(D,R)=>(D.length===R-1?D:Array(R-D.length-1).join("0")+D+" ")+"\x00",WP=(D,R,A,$)=>$===void 0?!1:yD(D,R,A,$.getTime()/1000),Rq=Array(156).join("\x00"),z1=(D,R,A,$)=>$===void 0?!1:(D.write($+Rq,R,A,"utf8"),$.length!==Buffer.byteLength($)||$.length>A),Mf=class D{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(R,A=!1){this.atime=R.atime,this.charset=R.charset,this.comment=R.comment,this.ctime=R.ctime,this.dev=R.dev,this.gid=R.gid,this.global=A,this.gname=R.gname,this.ino=R.ino,this.linkpath=R.linkpath,this.mtime=R.mtime,this.nlink=R.nlink,this.path=R.path,this.size=R.size,this.uid=R.uid,this.uname=R.uname}encode(){let R=this.encodeBody();if(R==="")return Buffer.allocUnsafe(0);let A=Buffer.byteLength(R),$=512*Math.ceil(1+A/512),f=Buffer.allocUnsafe($);for(let P=0;P<512;P++)f[P]=0;new Y1({path:("PaxHeader/"+Aq(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:A,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(f),f.write(R,512,A,"utf8");for(let P=A+512;P<f.length;P++)f[P]=0;return f}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(R){if(this[R]===void 0)return"";let A=this[R],$=A instanceof Date?A.getTime()/1000:A,f=" "+(R==="dev"||R==="ino"||R==="nlink"?"SCHILY.":"")+R+"="+$+`
|
|
187
|
-
`,P=Buffer.byteLength(f),B=Math.floor(Math.log(P)/Math.log(10))+1;return P+B>=Math.pow(10,B)&&(B+=1),B+P+f}static parse(R,A,$=!1){return new D($q(fq(R),A),$)}},$q=(D,R)=>R?Object.assign({},R,D):D,fq=(D)=>D.replace(/\n$/,"").split(`
|
|
188
|
-
`).reduce(Pq,Object.create(null)),Pq=(D,R)=>{let A=parseInt(R,10);if(A!==Buffer.byteLength(R)+1)return D;R=R.slice((A+" ").length);let $=R.split("="),f=$.shift();if(!f)return D;let P=f.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),B=$.join("=");return D[P]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(P)?new Date(Number(B)*1000):/^[0-9]+$/.test(B)?+B:B,D},Bq=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,y=Bq!=="win32"?(D)=>D:(D)=>D&&D.replaceAll(/\\/g,"/"),V5=class extends _1{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(D,R,A){switch(super({}),this.pause(),this.extended=R,this.globalExtended=A,this.header=D,this.remain=D.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=D.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!D.path)throw Error("no path provided for tar.ReadEntry");this.path=y(D.path),this.mode=D.mode,this.mode&&(this.mode=this.mode&4095),this.uid=D.uid,this.gid=D.gid,this.uname=D.uname,this.gname=D.gname,this.size=this.remain,this.mtime=D.mtime,this.atime=D.atime,this.ctime=D.ctime,this.linkpath=D.linkpath?y(D.linkpath):void 0,this.uname=D.uname,this.gname=D.gname,R&&this.#D(R),A&&this.#D(A,!0)}write(D){let R=D.length;if(R>this.blockRemain)throw Error("writing more to entry than is appropriate");let A=this.remain,$=this.blockRemain;return this.remain=Math.max(0,A-R),this.blockRemain=Math.max(0,$-R),this.ignore?!0:A>=R?super.write(D):super.write(D.subarray(0,A))}#D(D,R=!1){D.path&&(D.path=y(D.path)),D.linkpath&&(D.linkpath=y(D.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(D).filter(([A,$])=>!($==null||A==="path"&&R))))}},Uf=(D,R,A,$={})=>{D.file&&($.file=D.file),D.cwd&&($.cwd=D.cwd),$.code=A instanceof Error&&A.code||R,$.tarCode=R,!D.strict&&$.recoverable!==!1?(A instanceof Error&&($=Object.assign(A,$),A=A.message),D.emit("warn",R,A,$)):A instanceof Error?D.emit("error",Object.assign(A,$)):D.emit("error",Object.assign(Error(`${R}: ${A}`),$))},Gq=1048576,iP=Buffer.from([31,139]),aP=Buffer.from([40,181,47,253]),zq=Math.max(iP.length,aP.length),q0=Symbol("state"),J1=Symbol("writeEntry"),zD=Symbol("readEntry"),jP=Symbol("nextEntry"),lB=Symbol("processEntry"),d0=Symbol("extendedHeader"),PA=Symbol("globalExtendedHeader"),jD=Symbol("meta"),dB=Symbol("emitMeta"),k=Symbol("buffer"),JD=Symbol("queue"),SD=Symbol("ended"),SP=Symbol("emittedEnd"),H1=Symbol("emit"),c=Symbol("unzip"),r$=Symbol("consumeChunk"),s$=Symbol("consumeChunkSub"),bP=Symbol("consumeBody"),kB=Symbol("consumeMeta"),iB=Symbol("consumeHeader"),BA=Symbol("consuming"),uP=Symbol("bufferConcat"),o$=Symbol("maybeEnd"),l1=Symbol("writing"),bD=Symbol("aborted"),c$=Symbol("onDone"),Z1=Symbol("sawValidEntry"),t$=Symbol("sawNullBlock"),e$=Symbol("sawEOF"),aB=Symbol("closeStream"),Jq=()=>!0,qA=class extends KF{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[JD]=[];[k];[zD];[J1];[q0]="begin";[jD]="";[d0];[PA];[SD]=!1;[c];[bD]=!1;[Z1];[t$]=!1;[e$]=!1;[l1]=!1;[BA]=!1;[SP]=!1;constructor(D={}){super(),this.file=D.file||"",this.on(c$,()=>{(this[q0]==="begin"||this[Z1]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),D.ondone?this.on(c$,D.ondone):this.on(c$,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!D.strict,this.maxMetaEntrySize=D.maxMetaEntrySize||Gq,this.filter=typeof D.filter=="function"?D.filter:Jq;let R=D.file&&(D.file.endsWith(".tar.br")||D.file.endsWith(".tbr"));this.brotli=!(D.gzip||D.zstd)&&D.brotli!==void 0?D.brotli:R?void 0:!1;let A=D.file&&(D.file.endsWith(".tar.zst")||D.file.endsWith(".tzst"));this.zstd=!(D.gzip||D.brotli)&&D.zstd!==void 0?D.zstd:A?!0:void 0,this.on("end",()=>this[aB]()),typeof D.onwarn=="function"&&this.on("warn",D.onwarn),typeof D.onReadEntry=="function"&&this.on("entry",D.onReadEntry)}warn(D,R,A={}){Uf(this,D,R,A)}[iB](D,R){this[Z1]===void 0&&(this[Z1]=!1);let A;try{A=new Y1(D,R,this[d0],this[PA])}catch($){return this.warn("TAR_ENTRY_INVALID",$)}if(A.nullBlock)this[t$]?(this[e$]=!0,this[q0]==="begin"&&(this[q0]="header"),this[H1]("eof")):(this[t$]=!0,this[H1]("nullBlock"));else if(this[t$]=!1,!A.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:A});else if(!A.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:A});else{let $=A.type;if(/^(Symbolic)?Link$/.test($)&&!A.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:A});else if(!/^(Symbolic)?Link$/.test($)&&!/^(Global)?ExtendedHeader$/.test($)&&A.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:A});else{let f=this[J1]=new V5(A,this[d0],this[PA]);if(!this[Z1])if(f.remain){let P=()=>{f.invalid||(this[Z1]=!0)};f.on("end",P)}else this[Z1]=!0;f.meta?f.size>this.maxMetaEntrySize?(f.ignore=!0,this[H1]("ignoredEntry",f),this[q0]="ignore",f.resume()):f.size>0&&(this[jD]="",f.on("data",(P)=>this[jD]+=P),this[q0]="meta"):(this[d0]=void 0,f.ignore=f.ignore||!this.filter(f.path,f),f.ignore?(this[H1]("ignoredEntry",f),this[q0]=f.remain?"ignore":"header",f.resume()):(f.remain?this[q0]="body":(this[q0]="header",f.end()),this[zD]?this[JD].push(f):(this[JD].push(f),this[jP]())))}}}[aB](){queueMicrotask(()=>this.emit("close"))}[lB](D){let R=!0;if(!D)this[zD]=void 0,R=!1;else if(Array.isArray(D)){let[A,...$]=D;this.emit(A,...$)}else this[zD]=D,this.emit("entry",D),D.emittedEnd||(D.on("end",()=>this[jP]()),R=!1);return R}[jP](){do;while(this[lB](this[JD].shift()));if(this[JD].length===0){let D=this[zD];!D||D.flowing||D.size===D.remain?this[l1]||this.emit("drain"):D.once("drain",()=>this.emit("drain"))}}[bP](D,R){let A=this[J1];if(!A)throw Error("attempt to consume body without entry??");let $=A.blockRemain??0,f=$>=D.length&&R===0?D:D.subarray(R,R+$);return A.write(f),A.blockRemain||(this[q0]="header",this[J1]=void 0,A.end()),f.length}[kB](D,R){let A=this[J1],$=this[bP](D,R);return!this[J1]&&A&&this[dB](A),$}[H1](D,R,A){this[JD].length===0&&!this[zD]?this.emit(D,R,A):this[JD].push([D,R,A])}[dB](D){switch(this[H1]("meta",this[jD]),D.type){case"ExtendedHeader":case"OldExtendedHeader":this[d0]=Mf.parse(this[jD],this[d0],!1);break;case"GlobalExtendedHeader":this[PA]=Mf.parse(this[jD],this[PA],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let R=this[d0]??Object.create(null);this[d0]=R,R.path=this[jD].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let R=this[d0]||Object.create(null);this[d0]=R,R.linkpath=this[jD].replace(/\0.*/,"");break}default:throw Error("unknown meta: "+D.type)}}abort(D){this[bD]=!0,this.emit("abort",D),this.warn("TAR_ABORT",D,{recoverable:!1})}write(D,R,A){if(typeof R=="function"&&(A=R,R=void 0),typeof D=="string"&&(D=Buffer.from(D,typeof R=="string"?R:"utf8")),this[bD])return A?.(),!1;if((this[c]===void 0||this.brotli===void 0&&this[c]===!1)&&D){if(this[k]&&(D=Buffer.concat([this[k],D]),this[k]=void 0),D.length<zq)return this[k]=D,A?.(),!0;for(let B=0;this[c]===void 0&&B<iP.length;B++)D[B]!==iP[B]&&(this[c]=!1);let f=!1;if(this[c]===!1&&this.zstd!==!1){f=!0;for(let B=0;B<aP.length;B++)if(D[B]!==aP[B]){f=!1;break}}let P=this.brotli===void 0&&!f;if(this[c]===!1&&P)if(D.length<512)if(this[SD])this.brotli=!0;else return this[k]=D,A?.(),!0;else try{new Y1(D.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[c]===void 0||this[c]===!1&&(this.brotli||f)){let B=this[SD];this[SD]=!1,this[c]=this[c]===void 0?new EF({}):f?new xF({}):new gF({}),this[c].on("data",(z)=>this[r$](z)),this[c].on("error",(z)=>this.abort(z)),this[c].on("end",()=>{this[SD]=!0,this[r$]()}),this[l1]=!0;let G=!!this[c][B?"end":"write"](D);return this[l1]=!1,A?.(),G}}this[l1]=!0,this[c]?this[c].write(D):this[r$](D),this[l1]=!1;let $=this[JD].length>0?!1:this[zD]?this[zD].flowing:!0;return!$&&this[JD].length===0&&this[zD]?.once("drain",()=>this.emit("drain")),A?.(),$}[uP](D){D&&!this[bD]&&(this[k]=this[k]?Buffer.concat([this[k],D]):D)}[o$](){if(this[SD]&&!this[SP]&&!this[bD]&&!this[BA]){this[SP]=!0;let D=this[J1];if(D&&D.blockRemain){let R=this[k]?this[k].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${D.blockRemain} more bytes, only ${R} available)`,{entry:D}),this[k]&&D.write(this[k]),D.end()}this[H1](c$)}}[r$](D){if(this[BA]&&D)this[uP](D);else if(!D&&!this[k])this[o$]();else if(D){if(this[BA]=!0,this[k]){this[uP](D);let R=this[k];this[k]=void 0,this[s$](R)}else this[s$](D);for(;this[k]&&this[k]?.length>=512&&!this[bD]&&!this[e$];){let R=this[k];this[k]=void 0,this[s$](R)}this[BA]=!1}(!this[k]||this[SD])&&this[o$]()}[s$](D){let R=0,A=D.length;for(;R+512<=A&&!this[bD]&&!this[e$];)switch(this[q0]){case"begin":case"header":this[iB](D,R),R+=512;break;case"ignore":case"body":R+=this[bP](D,R);break;case"meta":R+=this[kB](D,R);break;default:throw Error("invalid state: "+this[q0])}R<A&&(this[k]=this[k]?Buffer.concat([D.subarray(R),this[k]]):D.subarray(R))}end(D,R,A){return typeof D=="function"&&(A=D,R=void 0,D=void 0),typeof R=="function"&&(A=R,R=void 0),typeof D=="string"&&(D=Buffer.from(D,R)),A&&this.once("finish",A),this[bD]||(this[c]?(D&&this[c].write(D),this[c].end()):(this[SD]=!0,(this.brotli===void 0||this.zstd===void 0)&&(D=D||Buffer.alloc(0)),D&&this.write(D),this[o$]())),this}},TA=(D)=>{let R=D.length-1,A=-1;for(;R>-1&&D.charAt(R)==="/";)A=R,R--;return A===-1?D:D.slice(0,A)},Hq=(D)=>{let R=D.onReadEntry;D.onReadEntry=R?(A)=>{R(A),A.resume()}:(A)=>A.resume()},I5=(D,R)=>{let A=new Map(R.map((P)=>[TA(P),!0])),$=D.filter,f=(P,B="")=>{let G=B||FF(P).root||".",z;if(P===G)z=!1;else{let J=A.get(P);z=J!==void 0?J:f(UF(P),G)}return A.set(P,z),z};D.filter=$?(P,B)=>$(P,B)&&f(TA(P)):(P)=>f(TA(P))},Zq=(D)=>{let R=new qA(D),A=D.file,$;try{$=s1.openSync(A,"r");let f=s1.fstatSync($),P=D.maxReadSize||16777216;if(f.size<P){let B=Buffer.allocUnsafe(f.size),G=s1.readSync($,B,0,f.size,0);R.end(G===B.byteLength?B:B.subarray(0,G))}else{let B=0,G=Buffer.allocUnsafe(P);for(;B<f.size;){let z=s1.readSync($,G,0,P,B);if(z===0)break;B+=z,R.write(G.subarray(0,z))}R.end()}}finally{if(typeof $=="number")try{s1.closeSync($)}catch{}}},Mq=(D,R)=>{let A=new qA(D),$=D.maxReadSize||16777216,f=D.file;return new Promise((P,B)=>{A.on("error",B),A.on("end",P),s1.stat(f,(G,z)=>{if(G)B(G);else{let J=new Z6(f,{readSize:$,size:z.size});J.on("error",B),J.pipe(A)}})})},Ff=wA(Zq,Mq,(D)=>new qA(D),(D)=>new qA(D),(D,R)=>{R?.length&&I5(D,R),D.noResume||Hq(D)}),K5=(D,R,A)=>(D&=4095,A&&(D=(D|384)&-19),R&&(D&256&&(D|=64),D&32&&(D|=8),D&4&&(D|=1)),D),{isAbsolute:Tq,parse:sB}=Xq,O6=(D)=>{let R="",A=sB(D);for(;Tq(D)||A.root;){let $=D.charAt(0)==="/"&&D.slice(0,4)!=="//?/"?"/":A.root;D=D.slice($.length),R+=$,A=sB(D)}return[R,D]},qf=["|","<",">","?",":"],Q6=qf.map((D)=>String.fromCodePoint(61440+Number(D.codePointAt(0)))),Oq=new Map(qf.map((D,R)=>[D,Q6[R]])),Qq=new Map(Q6.map((D,R)=>[D,qf[R]])),oB=(D)=>qf.reduce((R,A)=>R.split(A).join(Oq.get(A)),D),Yq=(D)=>Q6.reduce((R,A)=>R.split(A).join(Qq.get(A)),D),W5=(D,R)=>R?(D=y(D).replace(/^\.(\/|$)/,""),TA(R)+"/"+D):y(D),_q=16777216,cB=Symbol("process"),tB=Symbol("file"),eB=Symbol("directory"),rP=Symbol("symlink"),D5=Symbol("hardlink"),GA=Symbol("header"),ff=Symbol("read"),sP=Symbol("lstat"),Pf=Symbol("onlstat"),oP=Symbol("onread"),cP=Symbol("onreadlink"),tP=Symbol("openfile"),eP=Symbol("onopenfile"),gD=Symbol("close"),Tf=Symbol("mode"),D6=Symbol("awaitDrain"),EP=Symbol("ondrain"),i0=Symbol("prefix"),j5=class extends _1{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#D=!1;constructor(D,R={}){let A=M6(R);super(),this.path=y(D),this.portable=!!A.portable,this.maxReadSize=A.maxReadSize||_q,this.linkCache=A.linkCache||new Map,this.statCache=A.statCache||new Map,this.preservePaths=!!A.preservePaths,this.cwd=y(A.cwd||process.cwd()),this.strict=!!A.strict,this.noPax=!!A.noPax,this.noMtime=!!A.noMtime,this.mtime=A.mtime,this.prefix=A.prefix?y(A.prefix):void 0,this.onWriteEntry=A.onWriteEntry,typeof A.onwarn=="function"&&this.on("warn",A.onwarn);let $=!1;if(!this.preservePaths){let[P,B]=O6(this.path);P&&typeof B=="string"&&(this.path=B,$=P)}this.win32=!!A.win32||process.platform==="win32",this.win32&&(this.path=Yq(this.path.replaceAll(/\\/g,"/")),D=D.replaceAll(/\\/g,"/")),this.absolute=y(A.absolute||rB.resolve(this.cwd,D)),this.path===""&&(this.path="./"),$&&this.warn("TAR_ENTRY_INFO",`stripping ${$} from absolute path`,{entry:this,path:$+this.path});let f=this.statCache.get(this.absolute);f?this[Pf](f):this[sP]()}warn(D,R,A={}){return Uf(this,D,R,A)}emit(D,...R){return D==="error"&&(this.#D=!0),super.emit(D,...R)}[sP](){k0.lstat(this.absolute,(D,R)=>{if(D)return this.emit("error",D);this[Pf](R)})}[Pf](D){this.statCache.set(this.absolute,D),this.stat=D,D.isFile()||(D.size=0),this.type=qq(D),this.emit("stat",D),this[cB]()}[cB](){switch(this.type){case"File":return this[tB]();case"Directory":return this[eB]();case"SymbolicLink":return this[rP]();default:return this.end()}}[Tf](D){return K5(D,this.type==="Directory",this.portable)}[i0](D){return W5(D,this.prefix)}[GA](){if(!this.stat)throw Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new Y1({path:this[i0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[i0](this.linkpath):this.linkpath,mode:this[Tf](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new Mf({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[i0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[i0](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let D=this.header?.block;if(!D)throw Error("failed to encode header");super.write(D)}[eB](){if(!this.stat)throw Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[GA](),this.end()}[rP](){k0.readlink(this.absolute,(D,R)=>{if(D)return this.emit("error",D);this[cP](R)})}[cP](D){this.linkpath=y(D),this[GA](),this.end()}[D5](D){if(!this.stat)throw Error("cannot create link entry without stat");this.type="Link",this.linkpath=y(rB.relative(this.cwd,D)),this.stat.size=0,this[GA](),this.end()}[tB](){if(!this.stat)throw Error("cannot create file entry without stat");if(this.stat.nlink>1){let D=`${this.stat.dev}:${this.stat.ino}`,R=this.linkCache.get(D);if(R?.indexOf(this.cwd)===0)return this[D5](R);this.linkCache.set(D,this.absolute)}if(this[GA](),this.stat.size===0)return this.end();this[tP]()}[tP](){k0.open(this.absolute,"r",(D,R)=>{if(D)return this.emit("error",D);this[eP](R)})}[eP](D){if(this.fd=D,this.#D)return this[gD]();if(!this.stat)throw Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let R=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(R),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[ff]()}[ff](){let{fd:D,buf:R,offset:A,length:$,pos:f}=this;if(D===void 0||R===void 0)throw Error("cannot read file without first opening");k0.read(D,R,A,$,f,(P,B)=>{if(P)return this[gD](()=>this.emit("error",P));this[oP](B)})}[gD](D=()=>{}){this.fd!==void 0&&k0.close(this.fd,D)}[oP](D){if(D<=0&&this.remain>0){let A=Object.assign(Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[gD](()=>this.emit("error",A))}if(D>this.remain){let A=Object.assign(Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[gD](()=>this.emit("error",A))}if(!this.buf)throw Error("should have created buffer prior to reading");if(D===this.remain)for(let A=D;A<this.length&&D<this.blockRemain;A++)this.buf[A+this.offset]=0,D++,this.remain++;let R=this.offset===0&&D===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+D);this.write(R)?this[EP]():this[D6](()=>this[EP]())}[D6](D){this.once("drain",D)}write(D,R,A){if(typeof R=="function"&&(A=R,R=void 0),typeof D=="string"&&(D=Buffer.from(D,typeof R=="string"?R:"utf8")),this.blockRemain<D.length){let $=Object.assign(Error("writing more data than expected"),{path:this.absolute});return this.emit("error",$)}return this.remain-=D.length,this.blockRemain-=D.length,this.pos+=D.length,this.offset+=D.length,super.write(D,null,A)}[EP](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[gD]((D)=>D?this.emit("error",D):this.end());if(!this.buf)throw Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[ff]()}},Uq=class extends j5{sync=!0;[sP](){this[Pf](k0.lstatSync(this.absolute))}[rP](){this[cP](k0.readlinkSync(this.absolute))}[tP](){this[eP](k0.openSync(this.absolute,"r"))}[ff](){let D=!0;try{let{fd:R,buf:A,offset:$,length:f,pos:P}=this;if(R===void 0||A===void 0)throw Error("fd and buf must be set in READ method");let B=k0.readSync(R,A,$,f,P);this[oP](B),D=!1}finally{if(D)try{this[gD](()=>{})}catch{}}}[D6](D){D()}[gD](D=()=>{}){this.fd!==void 0&&k0.closeSync(this.fd),D()}},Fq=class extends _1{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(D,R,A={}){return Uf(this,D,R,A)}constructor(D,R={}){let A=M6(R);super(),this.preservePaths=!!A.preservePaths,this.portable=!!A.portable,this.strict=!!A.strict,this.noPax=!!A.noPax,this.noMtime=!!A.noMtime,this.onWriteEntry=A.onWriteEntry,this.readEntry=D;let{type:$}=D;if($==="Unsupported")throw Error("writing entry that should be ignored");this.type=$,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=A.prefix,this.path=y(D.path),this.mode=D.mode!==void 0?this[Tf](D.mode):void 0,this.uid=this.portable?void 0:D.uid,this.gid=this.portable?void 0:D.gid,this.uname=this.portable?void 0:D.uname,this.gname=this.portable?void 0:D.gname,this.size=D.size,this.mtime=this.noMtime?void 0:A.mtime||D.mtime,this.atime=this.portable?void 0:D.atime,this.ctime=this.portable?void 0:D.ctime,this.linkpath=D.linkpath!==void 0?y(D.linkpath):void 0,typeof A.onwarn=="function"&&this.on("warn",A.onwarn);let f=!1;if(!this.preservePaths){let[B,G]=O6(this.path);B&&typeof G=="string"&&(this.path=G,f=B)}this.remain=D.size,this.blockRemain=D.startBlockSize,this.onWriteEntry?.(this),this.header=new Y1({path:this[i0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[i0](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),f&&this.warn("TAR_ENTRY_INFO",`stripping ${f} from absolute path`,{entry:this,path:f+this.path}),this.header.encode()&&!this.noPax&&super.write(new Mf({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[i0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[i0](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let P=this.header?.block;if(!P)throw Error("failed to encode header");super.write(P),D.pipe(this)}[i0](D){return W5(D,this.prefix)}[Tf](D){return K5(D,this.type==="Directory",this.portable)}write(D,R,A){typeof R=="function"&&(A=R,R=void 0),typeof D=="string"&&(D=Buffer.from(D,typeof R=="string"?R:"utf8"));let $=D.length;if($>this.blockRemain)throw Error("writing more to entry than is appropriate");return this.blockRemain-=$,super.write(D,A)}end(D,R,A){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof D=="function"&&(A=D,R=void 0,D=void 0),typeof R=="function"&&(A=R,R=void 0),typeof D=="string"&&(D=Buffer.from(D,R??"utf8")),A&&this.once("finish",A),D?super.end(D,A):super.end(A),this}},qq=(D)=>D.isFile()?"File":D.isDirectory()?"Directory":D.isSymbolicLink()?"SymbolicLink":"Unsupported",wq=class D{tail;head;length=0;static create(R=[]){return new D(R)}constructor(R=[]){for(let A of R)this.push(A)}*[Symbol.iterator](){for(let R=this.head;R;R=R.next)yield R.value}removeNode(R){if(R.list!==this)throw Error("removing node which does not belong to this list");let{next:A,prev:$}=R;return A&&(A.prev=$),$&&($.next=A),R===this.head&&(this.head=A),R===this.tail&&(this.tail=$),this.length--,R.next=void 0,R.prev=void 0,R.list=void 0,A}unshiftNode(R){if(R===this.head)return;R.list&&R.list.removeNode(R);let A=this.head;R.list=this,R.next=A,A&&(A.prev=R),this.head=R,this.tail||(this.tail=R),this.length++}pushNode(R){if(R===this.tail)return;R.list&&R.list.removeNode(R);let A=this.tail;R.list=this,R.prev=A,A&&(A.next=R),this.tail=R,this.head||(this.head=R),this.length++}push(...R){for(let A=0,$=R.length;A<$;A++)Lq(this,R[A]);return this.length}unshift(...R){for(var A=0,$=R.length;A<$;A++)Nq(this,R[A]);return this.length}pop(){if(!this.tail)return;let R=this.tail.value,A=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,A.list=void 0,this.length--,R}shift(){if(!this.head)return;let R=this.head.value,A=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,A.list=void 0,this.length--,R}forEach(R,A){A=A||this;for(let $=this.head,f=0;$;f++)R.call(A,$.value,f,this),$=$.next}forEachReverse(R,A){A=A||this;for(let $=this.tail,f=this.length-1;$;f--)R.call(A,$.value,f,this),$=$.prev}get(R){let A=0,$=this.head;for(;$&&A<R;A++)$=$.next;if(A===R&&$)return $.value}getReverse(R){let A=0,$=this.tail;for(;$&&A<R;A++)$=$.prev;if(A===R&&$)return $.value}map(R,A){A=A||this;let $=new D;for(let f=this.head;f;)$.push(R.call(A,f.value,this)),f=f.next;return $}mapReverse(R,A){A=A||this;var $=new D;for(let f=this.tail;f;)$.push(R.call(A,f.value,this)),f=f.prev;return $}reduce(R,A){let $,f=this.head;if(arguments.length>1)$=A;else if(this.head)f=this.head.next,$=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var P=0;f;P++)$=R($,f.value,P),f=f.next;return $}reduceReverse(R,A){let $,f=this.tail;if(arguments.length>1)$=A;else if(this.tail)f=this.tail.prev,$=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(let P=this.length-1;f;P--)$=R($,f.value,P),f=f.prev;return $}toArray(){let R=Array(this.length);for(let A=0,$=this.head;$;A++)R[A]=$.value,$=$.next;return R}toArrayReverse(){let R=Array(this.length);for(let A=0,$=this.tail;$;A++)R[A]=$.value,$=$.prev;return R}slice(R=0,A=this.length){A<0&&(A+=this.length),R<0&&(R+=this.length);let $=new D;if(A<R||A<0)return $;R<0&&(R=0),A>this.length&&(A=this.length);let f=this.head,P=0;for(P=0;f&&P<R;P++)f=f.next;for(;f&&P<A;P++,f=f.next)$.push(f.value);return $}sliceReverse(R=0,A=this.length){A<0&&(A+=this.length),R<0&&(R+=this.length);let $=new D;if(A<R||A<0)return $;R<0&&(R=0),A>this.length&&(A=this.length);let f=this.length,P=this.tail;for(;P&&f>A;f--)P=P.prev;for(;P&&f>R;f--,P=P.prev)$.push(P.value);return $}splice(R,A=0,...$){R>this.length&&(R=this.length-1),R<0&&(R=this.length+R);let f=this.head;for(let B=0;f&&B<R;B++)f=f.next;let P=[];for(let B=0;f&&B<A;B++)P.push(f.value),f=this.removeNode(f);f?f!==this.tail&&(f=f.prev):f=this.tail;for(let B of $)f=Cq(this,f,B);return P}reverse(){let R=this.head,A=this.tail;for(let $=R;$;$=$.prev){let f=$.prev;$.prev=$.next,$.next=f}return this.head=A,this.tail=R,this}};function Cq(D,R,A){let $=R,f=R?R.next:D.head,P=new Y6(A,$,f,D);return P.next===void 0&&(D.tail=P),P.prev===void 0&&(D.head=P),D.length++,P}function Lq(D,R){D.tail=new Y6(R,D.tail,void 0,D),D.head||(D.head=D.tail),D.length++}function Nq(D,R){D.head=new Y6(R,void 0,D.head,D),D.tail||(D.tail=D.head),D.length++}var Y6=class{list;next;prev;value;constructor(D,R,A,$){this.list=$,this.value=D,R?(R.next=this,this.prev=R):this.prev=void 0,A?(A.prev=this,this.next=A):this.next=void 0}},A5=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(D,R){this.path=D||"./",this.absolute=R}},$5=Buffer.alloc(1024),Bf=Symbol("onStat"),zA=Symbol("ended"),S0=Symbol("queue"),M1=Symbol("current"),X1=Symbol("process"),JA=Symbol("processing"),yP=Symbol("processJob"),b0=Symbol("jobs"),gP=Symbol("jobDone"),Gf=Symbol("addFSEntry"),f5=Symbol("addTarEntry"),R6=Symbol("stat"),A6=Symbol("readdir"),zf=Symbol("onreaddir"),Jf=Symbol("pipe"),P5=Symbol("entry"),mP=Symbol("entryOpt"),Hf=Symbol("writeEntryClass"),S5=Symbol("write"),xP=Symbol("ondrain"),wf=class extends _1{sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[Hf];onWriteEntry;[S0];[b0]=0;[JA]=!1;[zA]=!1;constructor(D={}){if(super(),this.opt=D,this.file=D.file||"",this.cwd=D.cwd||process.cwd(),this.maxReadSize=D.maxReadSize,this.preservePaths=!!D.preservePaths,this.strict=!!D.strict,this.noPax=!!D.noPax,this.prefix=y(D.prefix||""),this.linkCache=D.linkCache||new Map,this.statCache=D.statCache||new Map,this.readdirCache=D.readdirCache||new Map,this.onWriteEntry=D.onWriteEntry,this[Hf]=j5,typeof D.onwarn=="function"&&this.on("warn",D.onwarn),this.portable=!!D.portable,D.gzip||D.brotli||D.zstd){if((D.gzip?1:0)+(D.brotli?1:0)+(D.zstd?1:0)>1)throw TypeError("gzip, brotli, zstd are mutually exclusive");if(D.gzip&&(typeof D.gzip!="object"&&(D.gzip={}),this.portable&&(D.gzip.portable=!0),this.zip=new uF(D.gzip)),D.brotli&&(typeof D.brotli!="object"&&(D.brotli={}),this.zip=new yF(D.brotli)),D.zstd&&(typeof D.zstd!="object"&&(D.zstd={}),this.zip=new mF(D.zstd)),!this.zip)throw Error("impossible");let R=this.zip;R.on("data",(A)=>super.write(A)),R.on("end",()=>super.end()),R.on("drain",()=>this[xP]()),this.on("resume",()=>R.resume())}else this.on("drain",this[xP]);this.noDirRecurse=!!D.noDirRecurse,this.follow=!!D.follow,this.noMtime=!!D.noMtime,D.mtime&&(this.mtime=D.mtime),this.filter=typeof D.filter=="function"?D.filter:()=>!0,this[S0]=new wq,this[b0]=0,this.jobs=Number(D.jobs)||4,this[JA]=!1,this[zA]=!1}[S5](D){return super.write(D)}add(D){return this.write(D),this}end(D,R,A){return typeof D=="function"&&(A=D,D=void 0),typeof R=="function"&&(A=R,R=void 0),D&&this.add(D),this[zA]=!0,this[X1](),A&&A(),this}write(D){if(this[zA])throw Error("write after end");return D instanceof V5?this[f5](D):this[Gf](D),this.flowing}[f5](D){let R=y(R5.resolve(this.cwd,D.path));if(!this.filter(D.path,D))D.resume();else{let A=new A5(D.path,R);A.entry=new Fq(D,this[mP](A)),A.entry.on("end",()=>this[gP](A)),this[b0]+=1,this[S0].push(A)}this[X1]()}[Gf](D){let R=y(R5.resolve(this.cwd,D));this[S0].push(new A5(D,R)),this[X1]()}[R6](D){D.pending=!0,this[b0]+=1;let R=this.follow?"stat":"lstat";Xf[R](D.absolute,(A,$)=>{D.pending=!1,this[b0]-=1,A?this.emit("error",A):this[Bf](D,$)})}[Bf](D,R){this.statCache.set(D.absolute,R),D.stat=R,this.filter(D.path,R)?R.isFile()&&R.nlink>1&&D===this[M1]&&!this.linkCache.get(`${R.dev}:${R.ino}`)&&!this.sync&&this[yP](D):D.ignore=!0,this[X1]()}[A6](D){D.pending=!0,this[b0]+=1,Xf.readdir(D.absolute,(R,A)=>{if(D.pending=!1,this[b0]-=1,R)return this.emit("error",R);this[zf](D,A)})}[zf](D,R){this.readdirCache.set(D.absolute,R),D.readdir=R,this[X1]()}[X1](){if(!this[JA]){this[JA]=!0;for(let D=this[S0].head;D&&this[b0]<this.jobs;D=D.next)if(this[yP](D.value),D.value.ignore){let R=D.next;this[S0].removeNode(D),D.next=R}this[JA]=!1,this[zA]&&this[S0].length===0&&this[b0]===0&&(this.zip?this.zip.end($5):(super.write($5),super.end()))}}get[M1](){return this[S0]&&this[S0].head&&this[S0].head.value}[gP](D){this[S0].shift(),this[b0]-=1,this[X1]()}[yP](D){if(!D.pending){if(D.entry){D===this[M1]&&!D.piped&&this[Jf](D);return}if(!D.stat){let R=this.statCache.get(D.absolute);R?this[Bf](D,R):this[R6](D)}if(D.stat&&!D.ignore){if(!this.noDirRecurse&&D.stat.isDirectory()&&!D.readdir){let R=this.readdirCache.get(D.absolute);if(R?this[zf](D,R):this[A6](D),!D.readdir)return}if(D.entry=this[P5](D),!D.entry){D.ignore=!0;return}D===this[M1]&&!D.piped&&this[Jf](D)}}}[mP](D){return{onwarn:(R,A,$)=>this.warn(R,A,$),noPax:this.noPax,cwd:this.cwd,absolute:D.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[P5](D){this[b0]+=1;try{return new this[Hf](D.path,this[mP](D)).on("end",()=>this[gP](D)).on("error",(R)=>this.emit("error",R))}catch(R){this.emit("error",R)}}[xP](){this[M1]&&this[M1].entry&&this[M1].entry.resume()}[Jf](D){D.piped=!0,D.readdir&&D.readdir.forEach(($)=>{let f=D.path,P=f==="./"?"":f.replace(/\/*$/,"/");this[Gf](P+$)});let R=D.entry,A=this.zip;if(!R)throw Error("cannot pipe without source");A?R.on("data",($)=>{A.write($)||R.pause()}):R.on("data",($)=>{super.write($)||R.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(D,R,A={}){Uf(this,D,R,A)}},_6=class extends wf{sync=!0;constructor(D){super(D),this[Hf]=Uq}pause(){}resume(){}[R6](D){let R=this.follow?"statSync":"lstatSync";this[Bf](D,Xf[R](D.absolute))}[A6](D){this[zf](D,Xf.readdirSync(D.absolute))}[Jf](D){let R=D.entry,A=this.zip;if(D.readdir&&D.readdir.forEach(($)=>{let f=D.path,P=f==="./"?"":f.replace(/\/*$/,"/");this[Gf](P+$)}),!R)throw Error("Cannot pipe without source");A?R.on("data",($)=>{A.write($)}):R.on("data",($)=>{super[S5]($)})}},Vq=(D,R)=>{let A=new _6(D),$=new U5(D.file,{mode:D.mode||438});A.pipe($),b5(A,R)},Iq=(D,R)=>{let A=new wf(D),$=new Yf(D.file,{mode:D.mode||438});A.pipe($);let f=new Promise((P,B)=>{$.on("error",B),$.on("close",P),A.on("error",B)});return u5(A,R).catch((P)=>A.emit("error",P)),f},b5=(D,R)=>{R.forEach((A)=>{A.charAt(0)==="@"?Ff({file:F5.resolve(D.cwd,A.slice(1)),sync:!0,noResume:!0,onReadEntry:($)=>D.add($)}):D.add(A)}),D.end()},u5=async(D,R)=>{for(let A of R)A.charAt(0)==="@"?await Ff({file:F5.resolve(String(D.cwd),A.slice(1)),noResume:!0,onReadEntry:($)=>{D.add($)}}):D.add(A);D.end()},Kq=(D,R)=>{let A=new _6(D);return b5(A,R),A},Wq=(D,R)=>{let A=new wf(D);return u5(A,R).catch(($)=>A.emit("error",$)),A},E5=wA(Vq,Iq,Kq,Wq,(D,R)=>{if(!R?.length)throw TypeError("no paths specified to add to archive")}),Sq=process.env.__FAKE_PLATFORM__||process.platform,x5=Sq==="win32",{O_CREAT:n5,O_NOFOLLOW:B5,O_TRUNC:p5,O_WRONLY:h5}=m5.constants,v5=Number(process.env.__FAKE_FS_O_FILENAME__)||m5.constants.UV_FS_O_FILEMAP||0,bq=x5&&!!v5,uq=524288,Eq=v5|p5|n5|h5,G5=!x5&&typeof B5=="number"?B5|p5|n5|h5:null,l5=G5!==null?()=>G5:bq?(D)=>D<uq?Eq:"w":()=>"w",$6=(D,R,A)=>{try{return Cf.lchownSync(D,R,A)}catch($){if($?.code!=="ENOENT")throw $}},Of=(D,R,A,$)=>{Cf.lchown(D,R,A,(f)=>{$(f&&f?.code!=="ENOENT"?f:null)})},yq=(D,R,A,$,f)=>{if(R.isDirectory())d5(OA.resolve(D,R.name),A,$,(P)=>{if(P)return f(P);let B=OA.resolve(D,R.name);Of(B,A,$,f)});else{let P=OA.resolve(D,R.name);Of(P,A,$,f)}},d5=(D,R,A,$)=>{Cf.readdir(D,{withFileTypes:!0},(f,P)=>{if(f){if(f.code==="ENOENT")return $();if(f.code!=="ENOTDIR"&&f.code!=="ENOTSUP")return $(f)}if(f||!P.length)return Of(D,R,A,$);let B=P.length,G=null,z=(J)=>{if(!G){if(J)return $(G=J);if(--B===0)return Of(D,R,A,$)}};for(let J of P)yq(D,J,R,A,z)})},gq=(D,R,A,$)=>{R.isDirectory()&&k5(OA.resolve(D,R.name),A,$),$6(OA.resolve(D,R.name),A,$)},k5=(D,R,A)=>{let $;try{$=Cf.readdirSync(D,{withFileTypes:!0})}catch(f){let P=f;if(P?.code==="ENOENT")return;if(P?.code==="ENOTDIR"||P?.code==="ENOTSUP")return $6(D,R,A);throw P}for(let f of $)gq(D,f,R,A);return $6(D,R,A)},i5=class extends Error{path;code;syscall="chdir";constructor(D,R){super(`${R}: Cannot cd into '${D}'`),this.path=D,this.code=R}get name(){return"CwdError"}},Lf=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(D,R){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=D,this.path=R}get name(){return"SymlinkError"}},xq=(D,R)=>{O0.stat(D,(A,$)=>{(A||!$.isDirectory())&&(A=new i5(D,A?.code||"ENOTDIR")),R(A)})},nq=(D,R,A)=>{D=y(D);let $=R.umask??18,f=R.mode|448,P=(f&$)!==0,B=R.uid,G=R.gid,z=typeof B=="number"&&typeof G=="number"&&(B!==R.processUid||G!==R.processGid),J=R.preserve,Z=R.unlink,H=y(R.cwd),M=(Q,X)=>{Q?A(Q):X&&z?d5(X,B,G,(O)=>M(O)):P?O0.chmod(D,f,A):A()};if(D===H)return xq(D,M);if(J)return mq.mkdir(D,{mode:f,recursive:!0}).then((Q)=>M(null,Q??void 0),M);let T=y(Qf.relative(H,D)).split("/");f6(H,T,f,Z,H,void 0,M)},f6=(D,R,A,$,f,P,B)=>{if(R.length===0)return B(null,P);let G=R.shift(),z=y(Qf.resolve(D+"/"+G));O0.mkdir(z,A,a5(z,R,A,$,f,P,B))},a5=(D,R,A,$,f,P,B)=>(G)=>{G?O0.lstat(D,(z,J)=>{if(z)z.path=z.path&&y(z.path),B(z);else if(J.isDirectory())f6(D,R,A,$,f,P,B);else if($)O0.unlink(D,(Z)=>{if(Z)return B(Z);O0.mkdir(D,A,a5(D,R,A,$,f,P,B))});else{if(J.isSymbolicLink())return B(new Lf(D,D+"/"+R.join("/")));B(G)}}):(P=P||D,f6(D,R,A,$,f,P,B))},pq=(D)=>{let R=!1,A;try{R=O0.statSync(D).isDirectory()}catch($){A=$?.code}finally{if(!R)throw new i5(D,A??"ENOTDIR")}},hq=(D,R)=>{D=y(D);let A=R.umask??18,$=R.mode|448,f=($&A)!==0,P=R.uid,B=R.gid,G=typeof P=="number"&&typeof B=="number"&&(P!==R.processUid||B!==R.processGid),z=R.preserve,J=R.unlink,Z=y(R.cwd),H=(Q)=>{Q&&G&&k5(Q,P,B),f&&O0.chmodSync(D,$)};if(D===Z)return pq(Z),H();if(z)return H(O0.mkdirSync(D,{mode:$,recursive:!0})??void 0);let M=y(Qf.relative(Z,D)).split("/"),T;for(let Q=M.shift(),X=Z;Q&&(X+="/"+Q);Q=M.shift()){X=y(Qf.resolve(X));try{O0.mkdirSync(X,$),T=T||X}catch{let O=O0.lstatSync(X);if(O.isDirectory())continue;if(J){O0.unlinkSync(X),O0.mkdirSync(X,$),T=T||X;continue}else if(O.isSymbolicLink())return new Lf(X,X+"/"+M.join("/"))}}return H(T)},nP=Object.create(null),z5=1e4,d1=new Set,vq=(D)=>{d1.has(D)?d1.delete(D):nP[D]=D.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),d1.add(D);let R=nP[D],A=d1.size-z5;if(A>z5/10){for(let $ of d1)if(d1.delete($),delete nP[$],--A<=0)break}return R},lq=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,dq=lq==="win32",kq=(D)=>D.split("/").slice(0,-1).reduce((R,A)=>{let $=R.at(-1);return $!==void 0&&(A=r5($,A)),R.push(A||"/"),R},[]),iq=class{#D=new Map;#A=new Map;#R=new Set;reserve(D,R){D=dq?["win32 parallelization disabled"]:D.map(($)=>TA(r5(vq($))));let A=new Set(D.map(($)=>kq($)).reduce(($,f)=>$.concat(f)));this.#A.set(R,{dirs:A,paths:D});for(let $ of D){let f=this.#D.get($);f?f.push(R):this.#D.set($,[R])}for(let $ of A){let f=this.#D.get($);if(!f)this.#D.set($,[new Set([R])]);else{let P=f.at(-1);P instanceof Set?P.add(R):f.push(new Set([R]))}}return this.#P(R)}#B(D){let R=this.#A.get(D);if(!R)throw Error("function does not have any path reservations");return{paths:R.paths.map((A)=>this.#D.get(A)),dirs:[...R.dirs].map((A)=>this.#D.get(A))}}check(D){let{paths:R,dirs:A}=this.#B(D);return R.every(($)=>$&&$[0]===D)&&A.every(($)=>$&&$[0]instanceof Set&&$[0].has(D))}#P(D){return this.#R.has(D)||!this.check(D)?!1:(this.#R.add(D),D(()=>this.#$(D)),!0)}#$(D){if(!this.#R.has(D))return!1;let R=this.#A.get(D);if(!R)throw Error("invalid reservation");let{paths:A,dirs:$}=R,f=new Set;for(let P of A){let B=this.#D.get(P);if(!B||B?.[0]!==D)continue;let G=B[1];if(!G){this.#D.delete(P);continue}if(B.shift(),typeof G=="function")f.add(G);else for(let z of G)f.add(z)}for(let P of $){let B=this.#D.get(P),G=B?.[0];if(!(!B||!(G instanceof Set)))if(G.size===1&&B.length===1){this.#D.delete(P);continue}else if(G.size===1){B.shift();let z=B[0];typeof z=="function"&&f.add(z)}else G.delete(D)}return this.#R.delete(D),f.forEach((P)=>this.#P(P)),!0}},aq=()=>process.umask(),J5=Symbol("onEntry"),P6=Symbol("checkFs"),H5=Symbol("checkFs2"),B6=Symbol("isReusable"),w0=Symbol("makeFs"),G6=Symbol("file"),z6=Symbol("directory"),Zf=Symbol("link"),Z5=Symbol("symlink"),M5=Symbol("hardlink"),MA=Symbol("ensureNoSymlink"),X5=Symbol("unsupported"),T5=Symbol("checkPath"),pP=Symbol("stripAbsolutePath"),mD=Symbol("mkdir"),f0=Symbol("onError"),Df=Symbol("pending"),O5=Symbol("pend"),k1=Symbol("unpend"),hP=Symbol("ended"),vP=Symbol("maybeClose"),J6=Symbol("skip"),QA=Symbol("doChown"),YA=Symbol("uid"),_A=Symbol("gid"),UA=Symbol("checkedCwd"),rq=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,FA=rq==="win32",sq=1024,oq=(D,R)=>{if(!FA)return n.unlink(D,R);let A=D+".DELETE."+g5(16).toString("hex");n.rename(D,A,($)=>{if($)return R($);n.unlink(A,R)})},cq=(D)=>{if(!FA)return n.unlinkSync(D);let R=D+".DELETE."+g5(16).toString("hex");n.renameSync(D,R),n.unlinkSync(R)},Q5=(D,R,A)=>D!==void 0&&D===D>>>0?D:R!==void 0&&R===R>>>0?R:A,U6=class extends qA{[hP]=!1;[UA]=!1;[Df]=0;reservations=new iq;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(D={}){if(D.ondone=()=>{this[hP]=!0,this[vP]()},super(D),this.transform=D.transform,this.chmod=!!D.chmod,typeof D.uid=="number"||typeof D.gid=="number"){if(typeof D.uid!="number"||typeof D.gid!="number")throw TypeError("cannot set owner without number uid and gid");if(D.preserveOwner)throw TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=D.uid,this.gid=D.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=D.preserveOwner===void 0&&typeof D.uid!="number"?!!(process.getuid&&process.getuid()===0):!!D.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof D.maxDepth=="number"?D.maxDepth:sq,this.forceChown=D.forceChown===!0,this.win32=!!D.win32||FA,this.newer=!!D.newer,this.keep=!!D.keep,this.noMtime=!!D.noMtime,this.preservePaths=!!D.preservePaths,this.unlink=!!D.unlink,this.cwd=y(e.resolve(D.cwd||process.cwd())),this.strip=Number(D.strip)||0,this.processUmask=this.chmod?typeof D.processUmask=="number"?D.processUmask:aq():0,this.umask=typeof D.umask=="number"?D.umask:this.processUmask,this.dmode=D.dmode||511&~this.umask,this.fmode=D.fmode||438&~this.umask,this.on("entry",(R)=>this[J5](R))}warn(D,R,A={}){return(D==="TAR_BAD_ARCHIVE"||D==="TAR_ABORT")&&(A.recoverable=!1),super.warn(D,R,A)}[vP](){this[hP]&&this[Df]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[pP](D,R){let A=D[R],{type:$}=D;if(!A||this.preservePaths)return!0;let[f,P]=O6(A),B=P.replaceAll(/\\/g,"/").split("/");if(B.includes("..")||FA&&/^[a-z]:\.\.$/i.test(B[0]??"")){if(R==="path"||$==="Link")return this.warn("TAR_ENTRY_ERROR",`${R} contains '..'`,{entry:D,[R]:A}),!1;let G=e.posix.dirname(D.path),z=e.posix.normalize(e.posix.join(G,B.join("/")));if(z.startsWith("../")||z==="..")return this.warn("TAR_ENTRY_ERROR",`${R} escapes extraction directory`,{entry:D,[R]:A}),!1}return f&&(D[R]=String(P),this.warn("TAR_ENTRY_INFO",`stripping ${f} from absolute ${R}`,{entry:D,[R]:A})),!0}[T5](D){let R=y(D.path),A=R.split("/");if(this.strip){if(A.length<this.strip)return!1;if(D.type==="Link"){let $=y(String(D.linkpath)).split("/");if($.length>=this.strip)D.linkpath=$.slice(this.strip).join("/");else return!1}A.splice(0,this.strip),D.path=A.join("/")}if(isFinite(this.maxDepth)&&A.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:D,path:R,depth:A.length,maxDepth:this.maxDepth}),!1;if(!this[pP](D,"path")||!this[pP](D,"linkpath"))return!1;if(D.absolute=e.isAbsolute(D.path)?y(e.resolve(D.path)):y(e.resolve(this.cwd,D.path)),!this.preservePaths&&typeof D.absolute=="string"&&D.absolute.indexOf(this.cwd+"/")!==0&&D.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:D,path:y(D.path),resolvedPath:D.absolute,cwd:this.cwd}),!1;if(D.absolute===this.cwd&&D.type!=="Directory"&&D.type!=="GNUDumpDir")return!1;if(this.win32){let{root:$}=e.win32.parse(String(D.absolute));D.absolute=$+oB(String(D.absolute).slice($.length));let{root:f}=e.win32.parse(D.path);D.path=f+oB(D.path.slice(f.length))}return!0}[J5](D){if(!this[T5](D))return D.resume();switch(jq.equal(typeof D.absolute,"string"),D.type){case"Directory":case"GNUDumpDir":D.mode&&(D.mode=D.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[P6](D);default:return this[X5](D)}}[f0](D,R){D.name==="CwdError"?this.emit("error",D):(this.warn("TAR_ENTRY_ERROR",D,{entry:R}),this[k1](),R.resume())}[mD](D,R,A){nq(y(D),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:R},A)}[QA](D){return this.forceChown||this.preserveOwner&&(typeof D.uid=="number"&&D.uid!==this.processUid||typeof D.gid=="number"&&D.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[YA](D){return Q5(this.uid,D.uid,this.processUid)}[_A](D){return Q5(this.gid,D.gid,this.processGid)}[G6](D,R){let A=typeof D.mode=="number"?D.mode&4095:this.fmode,$=new Yf(String(D.absolute),{flags:l5(D.size),mode:A,autoClose:!1});$.on("error",(G)=>{$.fd&&n.close($.fd,()=>{}),$.write=()=>!0,this[f0](G,D),R()});let f=1,P=(G)=>{if(G){$.fd&&n.close($.fd,()=>{}),this[f0](G,D),R();return}--f===0&&$.fd!==void 0&&n.close($.fd,(z)=>{z?this[f0](z,D):this[k1](),R()})};$.on("finish",()=>{let G=String(D.absolute),z=$.fd;if(typeof z=="number"&&D.mtime&&!this.noMtime){f++;let J=D.atime||new Date,Z=D.mtime;n.futimes(z,J,Z,(H)=>H?n.utimes(G,J,Z,(M)=>P(M&&H)):P())}if(typeof z=="number"&&this[QA](D)){f++;let J=this[YA](D),Z=this[_A](D);typeof J=="number"&&typeof Z=="number"&&n.fchown(z,J,Z,(H)=>H?n.chown(G,J,Z,(M)=>P(M&&H)):P())}P()});let B=this.transform&&this.transform(D)||D;B!==D&&(B.on("error",(G)=>{this[f0](G,D),R()}),D.pipe(B)),B.pipe($)}[z6](D,R){let A=typeof D.mode=="number"?D.mode&4095:this.dmode;this[mD](String(D.absolute),A,($)=>{if($){this[f0]($,D),R();return}let f=1,P=()=>{--f===0&&(R(),this[k1](),D.resume())};D.mtime&&!this.noMtime&&(f++,n.utimes(String(D.absolute),D.atime||new Date,D.mtime,P)),this[QA](D)&&(f++,n.chown(String(D.absolute),Number(this[YA](D)),Number(this[_A](D)),P)),P()})}[X5](D){D.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${D.type}`,{entry:D}),D.resume()}[Z5](D,R){let A=y(e.relative(this.cwd,e.resolve(e.dirname(String(D.absolute)),String(D.linkpath)))).split("/");this[MA](D,this.cwd,A,()=>this[Zf](D,String(D.linkpath),"symlink",R),($)=>{this[f0]($,D),R()})}[M5](D,R){let A=y(e.resolve(this.cwd,String(D.linkpath))),$=y(String(D.linkpath)).split("/");this[MA](D,this.cwd,$,()=>this[Zf](D,A,"link",R),(f)=>{this[f0](f,D),R()})}[MA](D,R,A,$,f){let P=A.shift();if(this.preservePaths||P===void 0)return $();let B=e.resolve(R,P);n.lstat(B,(G,z)=>{if(G)return $();if(z?.isSymbolicLink())return f(new Lf(B,e.resolve(B,A.join("/"))));this[MA](D,B,A,$,f)})}[O5](){this[Df]++}[k1](){this[Df]--,this[vP]()}[J6](D){this[k1](),D.resume()}[B6](D,R){return D.type==="File"&&!this.unlink&&R.isFile()&&R.nlink<=1&&!FA}[P6](D){this[O5]();let R=[D.path];D.linkpath&&R.push(D.linkpath),this.reservations.reserve(R,(A)=>this[H5](D,A))}[H5](D,R){let A=(B)=>{R(B)},$=()=>{this[mD](this.cwd,this.dmode,(B)=>{if(B){this[f0](B,D),A();return}this[UA]=!0,f()})},f=()=>{if(D.absolute!==this.cwd){let B=y(e.dirname(String(D.absolute)));if(B!==this.cwd)return this[mD](B,this.dmode,(G)=>{if(G){this[f0](G,D),A();return}P()})}P()},P=()=>{n.lstat(String(D.absolute),(B,G)=>{if(G&&(this.keep||this.newer&&G.mtime>(D.mtime??G.mtime))){this[J6](D),A();return}if(B||this[B6](D,G))return this[w0](null,D,A);if(G.isDirectory()){if(D.type==="Directory"){let z=this.chmod&&D.mode&&(G.mode&4095)!==D.mode,J=(Z)=>this[w0](Z??null,D,A);return z?n.chmod(String(D.absolute),Number(D.mode),J):J()}if(D.absolute!==this.cwd)return n.rmdir(String(D.absolute),(z)=>this[w0](z??null,D,A))}if(D.absolute===this.cwd)return this[w0](null,D,A);oq(String(D.absolute),(z)=>this[w0](z??null,D,A))})};this[UA]?f():$()}[w0](D,R,A){if(D){this[f0](D,R),A();return}switch(R.type){case"File":case"OldFile":case"ContiguousFile":return this[G6](R,A);case"Link":return this[M5](R,A);case"SymbolicLink":return this[Z5](R,A);case"Directory":case"GNUDumpDir":return this[z6](R,A)}}[Zf](D,R,A,$){n[A](R,String(D.absolute),(f)=>{f?this[f0](f,D):(this[k1](),D.resume()),$()})}},HA=(D)=>{try{return[null,D()]}catch(R){return[R,null]}},s5=class extends U6{sync=!0;[w0](D,R){return super[w0](D,R,()=>{})}[P6](D){if(!this[UA]){let f=this[mD](this.cwd,this.dmode);if(f)return this[f0](f,D);this[UA]=!0}if(D.absolute!==this.cwd){let f=y(e.dirname(String(D.absolute)));if(f!==this.cwd){let P=this[mD](f,this.dmode);if(P)return this[f0](P,D)}}let[R,A]=HA(()=>n.lstatSync(String(D.absolute)));if(A&&(this.keep||this.newer&&A.mtime>(D.mtime??A.mtime)))return this[J6](D);if(R||this[B6](D,A))return this[w0](null,D);if(A.isDirectory()){if(D.type==="Directory"){let P=this.chmod&&D.mode&&(A.mode&4095)!==D.mode,[B]=P?HA(()=>{n.chmodSync(String(D.absolute),Number(D.mode))}):[];return this[w0](B,D)}let[f]=HA(()=>n.rmdirSync(String(D.absolute)));this[w0](f,D)}let[$]=D.absolute===this.cwd?[]:HA(()=>cq(String(D.absolute)));this[w0]($,D)}[G6](D,R){let A=typeof D.mode=="number"?D.mode&4095:this.fmode,$=(B)=>{let G;try{n.closeSync(f)}catch(z){G=z}(B||G)&&this[f0](B||G,D),R()},f;try{f=n.openSync(String(D.absolute),l5(D.size),A)}catch(B){return $(B)}let P=this.transform&&this.transform(D)||D;P!==D&&(P.on("error",(B)=>this[f0](B,D)),D.pipe(P)),P.on("data",(B)=>{try{n.writeSync(f,B,0,B.length)}catch(G){$(G)}}),P.on("end",()=>{let B=null;if(D.mtime&&!this.noMtime){let G=D.atime||new Date,z=D.mtime;try{n.futimesSync(f,G,z)}catch(J){try{n.utimesSync(String(D.absolute),G,z)}catch{B=J}}}if(this[QA](D)){let G=this[YA](D),z=this[_A](D);try{n.fchownSync(f,Number(G),Number(z))}catch(J){try{n.chownSync(String(D.absolute),Number(G),Number(z))}catch{B=B||J}}}$(B)})}[z6](D,R){let A=typeof D.mode=="number"?D.mode&4095:this.dmode,$=this[mD](String(D.absolute),A);if($){this[f0]($,D),R();return}if(D.mtime&&!this.noMtime)try{n.utimesSync(String(D.absolute),D.atime||new Date,D.mtime)}catch{}if(this[QA](D))try{n.chownSync(String(D.absolute),Number(this[YA](D)),Number(this[_A](D)))}catch{}R(),D.resume()}[mD](D,R){try{return hq(y(D),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:R})}catch(A){return A}}[MA](D,R,A,$,f){if(this.preservePaths||A.length===0)return $();let P=R;for(let B of A){P=e.resolve(P,B);let[G,z]=HA(()=>n.lstatSync(P));if(G)return $();if(z.isSymbolicLink())return f(new Lf(P,e.resolve(R,A.join("/"))))}$()}[Zf](D,R,A,$){let f=`${A}Sync`;try{n[f](R,String(D.absolute)),$(),D.resume()}catch(P){return this[f0](P,D)}}},tq=(D)=>{let R=new s5(D),A=D.file,$=y5.statSync(A),f=D.maxReadSize||16777216;new _F(A,{readSize:f,size:$.size}).pipe(R)},eq=(D,R)=>{let A=new U6(D),$=D.maxReadSize||16777216,f=D.file;return new Promise((P,B)=>{A.on("error",B),A.on("close",P),y5.stat(f,(G,z)=>{if(G)B(G);else{let J=new Z6(f,{readSize:$,size:z.size});J.on("error",B),J.pipe(A)}})})},Kj=wA(tq,eq,(D)=>new s5(D),(D)=>new U6(D),(D,R)=>{R?.length&&I5(D,R)}),Dw=(D,R)=>{let A=new _6(D),$=!0,f,P;try{try{f=T0.openSync(D.file,"r+")}catch(z){if(z?.code==="ENOENT")f=T0.openSync(D.file,"w+");else throw z}let B=T0.fstatSync(f),G=Buffer.alloc(512);D:for(P=0;P<B.size;P+=512){for(let Z=0,H=0;Z<512;Z+=H){if(H=T0.readSync(f,G,Z,G.length-Z,P+Z),P===0&&G[0]===31&&G[1]===139)throw Error("cannot append to compressed archives");if(!H)break D}let z=new Y1(G);if(!z.cksumValid)break;let J=512*Math.ceil((z.size||0)/512);if(P+J+512>B.size)break;P+=J,D.mtimeCache&&z.mtime&&D.mtimeCache.set(String(z.path),z.mtime)}$=!1,Rw(D,A,P,f,R)}finally{if($)try{T0.closeSync(f)}catch{}}},Rw=(D,R,A,$,f)=>{let P=new U5(D.file,{fd:$,start:A});R.pipe(P),$w(R,f)},Aw=(D,R)=>{R=Array.from(R);let A=new wf(D),$=(f,P,B)=>{let G=(M,T)=>{M?T0.close(f,(Q)=>B(M)):B(null,T)},z=0;if(P===0)return G(null,0);let J=0,Z=Buffer.alloc(512),H=(M,T)=>{if(M||T===void 0)return G(M);if(J+=T,J<512&&T)return T0.read(f,Z,J,Z.length-J,z+J,H);if(z===0&&Z[0]===31&&Z[1]===139)return G(Error("cannot append to compressed archives"));if(J<512)return G(null,z);let Q=new Y1(Z);if(!Q.cksumValid)return G(null,z);let X=512*Math.ceil((Q.size??0)/512);if(z+X+512>P||(z+=X+512,z>=P))return G(null,z);D.mtimeCache&&Q.mtime&&D.mtimeCache.set(String(Q.path),Q.mtime),J=0,T0.read(f,Z,0,512,z,H)};T0.read(f,Z,0,512,z,H)};return new Promise((f,P)=>{A.on("error",P);let B="r+",G=(z,J)=>{if(z&&z.code==="ENOENT"&&B==="r+")return B="w+",T0.open(D.file,B,G);if(z||!J)return P(z);T0.fstat(J,(Z,H)=>{if(Z)return T0.close(J,()=>P(Z));$(J,H.size,(M,T)=>{if(M)return P(M);let Q=new Yf(D.file,{fd:J,start:T});A.pipe(Q),Q.on("error",P),Q.on("close",f),fw(A,R)})})};T0.open(D.file,B,G)})},$w=(D,R)=>{R.forEach((A)=>{A.charAt(0)==="@"?Ff({file:o5.resolve(D.cwd,A.slice(1)),sync:!0,noResume:!0,onReadEntry:($)=>D.add($)}):D.add(A)}),D.end()},fw=async(D,R)=>{for(let A of R)A.charAt(0)==="@"?await Ff({file:o5.resolve(String(D.cwd),A.slice(1)),noResume:!0,onReadEntry:($)=>D.add($)}):D.add(A);D.end()},ZA=wA(Dw,Aw,()=>{throw TypeError("file is required")},()=>{throw TypeError("file is required")},(D,R)=>{if(!VF(D))throw TypeError("file is required");if(D.gzip||D.brotli||D.zstd||D.file.endsWith(".br")||D.file.endsWith(".tbr"))throw TypeError("cannot append to compressed archives");if(!R?.length)throw TypeError("no paths specified to add/replace")}),Sj=wA(ZA.syncFile,ZA.asyncFile,ZA.syncNoFile,ZA.asyncNoFile,(D,R=[])=>{ZA.validate?.(D,R),Pw(D)}),Pw=(D)=>{let R=D.filter;D.mtimeCache||(D.mtimeCache=new Map),D.filter=R?(A,$)=>R(A,$)&&!((D.mtimeCache?.get(A)??$.mtime??0)>($.mtime??0)):(A,$)=>!((D.mtimeCache?.get(A)??$.mtime??0)>($.mtime??0))};async function t5(D,R){if(R.length===0)return;let A=c5.join(await Bw(c5.join(Gw.tmpdir(),"abrun-cli-deploy-")),"source.tar.gz");return await E5({gzip:!0,cwd:D,file:A,portable:!0},R.map(($)=>$.path)),A}import{readFile as zw}from"node:fs/promises";async function q6(D){let R=new AbortController;D.deployState.activeController=R;let A=Symbol("deploy-create");try{return R.signal.addEventListener("abort",()=>D.client.http.abortRequest(A),{once:!0}),await D.client.api.appsDeployCreate({appId:D.app.id},Jw(D),{cancelToken:A})}finally{if(D.deployState.activeController===R)D.deployState.activeController=null}}async function DG(D,R){let A=Date.now()+8000,$;while(Date.now()<A)try{return await q6(D)}catch(f){if(f.status!==409)throw f;$=f,await R(250)}throw $??Error("Deployment could not be created after source upload")}async function RG(D,R,A,$,f){let P=0,B="";if(A){let J=await zw(A);P=J.byteLength,B=J.toString("base64")}f(e5(0,P));let G=new AbortController;D.deployState.activeController=G;let z=Symbol("deploy-upload");try{G.signal.addEventListener("abort",()=>D.client.http.abortRequest(z),{once:!0});let J=await D.client.api.appsUploadCreate({appId:D.app.id},{kind:"cli",manifest:PG(D.manifestEntries),manifestHash:"",archiveBase64:B,message:$},{cancelToken:z});return f(e5(P,P)),{uploadedFiles:R.files.length,uploadedBytes:P,commitSha:typeof J==="object"&&J!==null?String(J.commit??""):void 0}}finally{if(D.deployState.activeController===G)D.deployState.activeController=null}}async function AG(D,R){let A=new AbortController;R.activeController=A;let $=Symbol("deployment-detail");try{return A.signal.addEventListener("abort",()=>D.client.http.abortRequest($),{once:!0}),await D.client.api.appsDeploymentsDetail({appId:D.appId,deploymentId:D.deploymentId},{cancelToken:$})}finally{if(R.activeController===A)R.activeController=null}}async function $G(D,R){let A=new AbortController;R.activeController=A;let $=Symbol("deployment-logs");try{return A.signal.addEventListener("abort",()=>D.client.http.abortRequest($),{once:!0}),await D.client.api.appsDeploymentsLogsList({appId:D.appId,deploymentId:D.deploymentId,offset:D.offset,limit:D.limit??100},{cancelToken:$})}finally{if(R.activeController===A)R.activeController=null}}async function fG(D){let R=Symbol("deployment-cancel"),A=setTimeout(()=>D.client.http.abortRequest(R),5000);try{await D.client.api.appsDeploymentsCancelCreate({appId:D.appId,deploymentId:D.deploymentId},{cancelToken:R}).catch(()=>{return})}finally{clearTimeout(A)}}function Jw(D){let R=Zw(D);if(D.options.image?.trim())return{method:"image",image:D.options.image.trim(),port:D.options.port,message:R};return{method:"cli",port:D.options.port,message:R,...Hw(D),source:{kind:"cli",manifest:PG(D.manifestEntries),...Mw(D)}}}function Hw(D){let R={},A=D.options.rootDirectory?.trim();if(A)R.rootDirectory=A;let $=D.options.dockerfilePath?.trim();if($)R.dockerfilePath=$;return R}function Zw(D){return D.options.message?.trim()||D.localGit.commitMessage}function Mw(D){let R={};if(D.localGit.commitSha)R.gitCommit=D.localGit.commitSha;if(D.localGit.commitMessage)R.commitMessage=D.localGit.commitMessage;if(D.localGit.authorName)R.authorName=D.localGit.authorName;if(D.localGit.authorEmail)R.authorEmail=D.localGit.authorEmail;return R}function PG(D){return D.map((R)=>({path:R.path,sha256:R.sha256,size:R.size??R.sizeBytes??0}))}function e5(D,R){if(R>0)return`${Math.min(100,Math.max(0,Math.round(D/R*100)))}% ${F6(D)} / ${F6(R)}`;return F6(D)}function F6(D){if(!Number.isFinite(D)||D<=0)return"0 B";let R=["B","KiB","MiB","GiB","TiB"],A=D,$=0;while(A>=1024&&$<R.length-1)A/=1024,$+=1;let f=A>=10||$===0?0:1;return`${A.toFixed(f)} ${R[$]}`}function BG(D,R=[]){let A=null;if(typeof D==="object"&&D!==null){let $=D;if($.status===409)A=$.error??$.data}if(!A)return null;if(typeof A==="object"&&A!==null&&"error"in A)A=A.error;if(typeof A==="object"&&A!==null&&"status"in A&&A.status==="sync_required"&&"requiredFiles"in A&&Array.isArray(A.requiredFiles)&&A.requiredFiles.length>0){let $=A.requiredFiles,f=new Set($.map((G)=>G.trim()).filter(Boolean)),P=new Map(R.map((G)=>[G.path,G])),B=[...f].map((G)=>P.get(G)??{path:G});return{code:"FilesMissing",message:"Source upload required before deployment.",details:{files:B,summary:{added:B.length,changed:0}}}}if(typeof A==="object"&&A!==null&&"code"in A&&A.code==="FilesMissing"&&"details"in A&&typeof A.details==="object"&&A.details!==null){let $=A.details,f=A;return{code:"FilesMissing",message:typeof f.message==="string"?f.message:"Source upload required before deployment.",details:{files:Array.isArray($.files)?$.files:[],summary:typeof $.summary==="object"&&$.summary!==null?{added:Number($.summary.added||0),changed:Number($.summary.changed||0)}:{added:0,changed:0}}}}return null}import{execFile as Xw}from"node:child_process";import{promisify as Tw}from"node:util";var w6=Tw(Xw);async function GG(D){try{await w6("git",["rev-parse","--is-inside-work-tree"],{cwd:D});let R=(await w6("git",["rev-parse","HEAD"],{cwd:D})).stdout.trim(),{stdout:A}=await w6("git",["show","-s","--format=%s%n%an%n%ae","HEAD"],{cwd:D}),[$,f,P]=A.split(`
|
|
189
|
-
`);return{commitSha:R||void 0,commitMessage:$?.trim()||void 0,authorName:f?.trim()||void 0,authorEmail:P?.trim()||void 0}}catch{return{}}}var V6=B0(UG(),1);import{createHash as yw}from"node:crypto";import{readdir as gw,readFile as FG,stat as mw}from"node:fs/promises";import U1 from"node:path";var xw=V6.default().add([".git",".git/",".abrun",".abrun/","node_modules","node_modules/",".bun",".bun/",".next",".next/",".nuxt",".nuxt/",".svelte-kit",".svelte-kit/",".turbo",".turbo/",".cache",".cache/",".parcel-cache",".parcel-cache/",".vercel",".vercel/","dist","dist/","build","build/","coverage","coverage/","__pycache__","__pycache__/",".pytest_cache",".pytest_cache/",".mypy_cache",".mypy_cache/",".venv",".venv/","venv","venv/","target","target/",".gradle",".gradle/","out","out/",".DS_Store",".env",".env.*","*.pyc","*.pyo","*.class"]);async function qG(D){let R=[];return await wG(D,"",[],R),R.sort((A,$)=>A.path.localeCompare($.path))}async function nw(D,R){let A=V6.default();if(!R)A.add([".git",".git/",".abrun",".abrun/"]);for(let $ of[".gitignore",".abrunignore"])try{let f=await FG(U1.join(D,R,$),"utf8");A.add(f)}catch{continue}return{baseDir:CG(R),matcher:A}}async function wG(D,R,A,$){let f=R?U1.join(D,R):D,P=[...A,await nw(D,R)],B=await gw(f,{withFileTypes:!0});for(let G of B){let z=CG(R?U1.join(R,G.name):G.name);if(pw(z,G.isDirectory(),P))continue;let J=U1.join(D,z),Z=await mw(J);if(G.isSymbolicLink())throw Error(`Symlinks are not supported for CLI deploy: ${z}`);if(Z.isDirectory()){await wG(D,z,P,$);continue}if(!Z.isFile())continue;let H=await FG(J);$.push({path:z,sha256:yw("sha256").update(H).digest("hex"),size:H.byteLength,sizeBytes:H.byteLength})}}function pw(D,R,A){let $=R?`${D}/`:D;if(xw.ignores($))return!0;let f=!1;for(let P of A){let B=hw(P.baseDir,$);if(B===null)continue;let G=P.matcher.test(B);if(G.ignored)f=!0;if(G.unignored)f=!1}return f}function hw(D,R){if(!D)return R;let A=U1.posix.relative(D,R);if(!A||A===".."||A.startsWith("../"))return null;return A}function CG(D){return D.split(U1.sep).join(U1.posix.sep)}var vw=["ready","degraded","failed","cancelled"];function Kf(D){return vw.includes(D??"")}function LA(D){return D.status==="ready"}function Wf(D,R){return D.result?.url?.trim()||R?.trim()||""}function lw(D){let R=D.errorMessage?.trim()||D.result?.message?.trim();if(R)return R;if(D.status==="degraded")return"App did not become healthy";if(D.status==="cancelled")return"Deployment cancelled";return"Deployment failed"}function jf(D,R="<app>"){let A=D.id??0,$=D.status??"unknown",f=dw(R);return[$==="degraded"?"Deployment applied, but the app did not become healthy.":$==="cancelled"?"Deployment was cancelled.":"Deployment failed.",`Reason: ${lw(D)}`,"Next steps:",` View logs: abrun app logs ${f} --tail 100`,` Roll back: abrun app deployment rollback ${f} ${A}`,` Redeploy: abrun deploy ${f}`].join(`
|
|
190
|
-
`)}function dw(D){if(!D||D==="<app>")return"<app>";if(/^[A-Za-z0-9._:@/-]+$/.test(D))return D;return`'${D.replaceAll("'","'\\''")}'`}async function Sf(D){let R=D.timeoutMs??900000,A=D.sleepMs??2000,$=D.now??Date.now,f=$()+R,P=D.initial,B=P.status??"pending";while(!Kf(P.status)){if(D.shouldAbort?.())return P;if($()>=f)throw Error(`Deployment timed out after ${kw(R)}`);await D.onPoll?.(P),P=await D.fetch(P);let G=P.status??"pending";if(B!==G)await D.onStatusChange?.(B,G,P);if(B=G,!Kf(P.status))await D.sleep(A)}return await D.onPoll?.(P),P}function kw(D){let R=Math.ceil(D/1000);if(R<60)return`${R}s`;return`${Math.ceil(R/60)}m`}function LG(){return{aborted:!1,deploymentId:null,activeController:null,logController:null,cancellationRequested:!1}}function I6(D,R){let A=null,$=process.stdin,f=Boolean($&&$.isTTY&&typeof $.setRawMode==="function"),P=f?Boolean($.isRaw):!1,B=f?$.isPaused():!0,G=()=>{if(D.aborted)process.exit(130);D.aborted=!0,D.activeController?.abort(),D.logController?.abort(),R?.(),A=setTimeout(()=>{process.exit(130)},2000),A.unref?.()},z=()=>{G()},J=(Z)=>{if(Z.toString().includes("\x03"))G()};if(D.signalHandler=z,process.on("SIGINT",z),f)$.setRawMode(!0),$.resume(),$.on("data",J);return()=>{if(D.signalHandler)process.removeListener("SIGINT",D.signalHandler),D.signalHandler=void 0;if(f){if($.removeListener("data",J),$.setRawMode(P),B)$.pause()}if(A)clearTimeout(A),A=null}}function bf(D){if(D.aborted)throw Error("Deployment cancelled by user")}function K6(D){return D instanceof Error&&(D.name==="AbortError"||/aborted|cancelled/i.test(D.message))}var XD=B0(mA(),1),NG=["Syncing source","Building image","Pushing image","Deploying","Waiting for app","Ready"],iw=new RegExp(String.raw`\u001b\[[0-9;?]*[ -/]*[@-~]`,"g");function VG(D,R,A,$){if(D)return AC();console.log(`${XD.default.bold("App")}: ${A}`);let f=aw(),P=new IG({write:(z)=>f.write(z),flush:()=>f.flush()}),B="",G="Syncing source";return{completeScan(z){P.detail("Syncing source",R?`${z} files checked`:"Image deploy")},showUploadRequired(z){P.detail("Syncing source",BC(z))},startPackaging(z){P.detail("Syncing source",`Packaging ${z} changed files`)},completePackaging(){},startUploading(){P.detail("Syncing source","Uploading source")},updateUploading(z,J){B=J},completeUploading(z,J,Z){let H=[`${z} files`,J];if(Z)H.push(`commit ${GC(Z)}`);if(B)H.push(B);P.detail("Syncing source",`Uploaded ${H.join(", ")}`),B=""},startDeploying(){P.detail("Syncing source","Creating deployment")},completeDeploying(){P.detail("Syncing source","Deployment accepted")},updatePhase(z){let J=KG(z);if(!J)return;G=J,P.phase(J,z==="ready"?"Rollout ready":void 0)},printLog(z,J){let Z=ow(z,J,$);if(!Z)return;P.detail(Z.phase,Z.message,Z.kind)},showBuildActivity(z){P.detail("Building image",z)},note(z){P.detail("Ready",z)},finish(z){if(z==="ready"){G="Ready",P.phase("Ready","Rollout ready","success"),P.flush();return}let J=z==="degraded"?"Waiting for app":G;P.detail(J,sw(z),"failure"),P.flush()}}}class IG{writer;printedPhases=new Set;lastDetailByPhase=new Map;constructor(D){this.writer=D}phase(D,R,A="phase"){this.ensurePhase(D,R,A)}detail(D,R,A="detail"){let $=R.trim();if(!$)return;if(this.ensurePhase(D),this.lastDetailByPhase.get(D)===$)return;this.lastDetailByPhase.set(D,$),this.writer.write({phase:D,message:$,kind:A})}flush(){this.writer.flush?.()}ensurePhase(D,R,A="phase"){let $=NG.indexOf(D);for(let f=0;f<=$;f+=1){let P=NG[f];if(this.printedPhases.has(P))continue;this.printedPhases.add(P),this.writer.write({phase:P,message:P===D?R:void 0,kind:P==="Ready"?"success":A})}}}function aw(){let D=!1,R=0,A=()=>{if(!D)return;process.stdout.write(`
|
|
191
|
-
`),D=!1,R=0};return{write($){if($.kind==="progress"){let f=` ${WG($.phase).padEnd(7," ")} ${$.message??""}`,P=R>f.length?" ".repeat(R-f.length):"";process.stdout.write(`\r${XD.default.dim(f)}${P}`),D=!0,R=f.length;return}A(),rw($)},flush:A}}function rw(D){if(D.kind==="detail"){console.log(` ${XD.default.dim(WG(D.phase).padEnd(7," "))} ${D.message??""}`);return}let R=D.kind==="failure"?XD.default.red("x"):D.kind==="success"?XD.default.green("✓"):XD.default.cyan("•"),A=D.message?XD.default.dim(` — ${D.message}`):"";console.log(`${R} ${XD.default.bold(D.phase)}${A}`)}function KG(D){switch(D){case"queued":return"Syncing source";case"building":return"Building image";case"deploying":return"Deploying";case"pulling":case"starting":return"Waiting for app";case"ready":return"Ready";case"degraded":case"failed":case"cancelled":return"Waiting for app";default:return null}}function sw(D){switch(D){case"queued":return"Syncing source";case"building":return"Building image";case"deploying":return"Deploying";case"pulling":return"Waiting for app";case"starting":return"Waiting for app";case"ready":return"Ready";case"degraded":return"Degraded";case"failed":return"Failed";case"cancelled":return"Cancelled";default:return"Deploying"}}function ow(D,R,A){let $=fC(D);if(PC($))return null;let f=$C($);if(!f)return null;let P=cw(f);if(P)return P;if(tw(f))return{phase:DC(f),message:f};if(A||RC(f))return{phase:KG(R)??"Deploying",message:f};return null}function cw(D){if(/^selected dockerfile builder$/i.test(D))return{phase:"Building image",message:"Preparing build"};if(/^running dockerfile build with buildkit$/i.test(D))return{phase:"Building image",message:"Running BuildKit"};if(/^building and pushing image\b/i.test(D))return{phase:"Pushing image",message:D};if(/^runtime apply accepted\b/i.test(D))return{phase:"Deploying",message:"Runtime applied"};if(/^pulling image$/i.test(D))return{phase:"Waiting for app",message:"Pulling image"};if(/^starting app$/i.test(D))return{phase:"Waiting for app",message:"Starting app"};if(/^deployment is ready$/i.test(D))return{phase:"Ready",message:"Rollout ready",kind:"success"};if(ew(D))return{phase:"Pushing image",message:D,kind:"progress"};if(/\b(push|pushing|pushed|layer already exists|mounted from|digest:|writing image|naming to docker\.io)\b/i.test(D))return{phase:"Pushing image",message:D};if(/\b(cache hit|cached|cache miss|importing cache|exporting cache|using cache)\b/i.test(D))return{phase:"Building image",message:D};return null}function tw(D){return/^#\d+\s+/i.test(D)}function ew(D){return/^[a-f0-9]{12,64}\s+Pushing\s+\[[=>\s]+]\s+\S+/i.test(D)}function DC(D){if(/\b(push|pushing|pushed|exporting to image|exporting manifest|exporting config|naming to|digest:)\b/i.test(D))return"Pushing image";return"Building image"}function RC(D){if(/^Prepared managed source workspace\b/i.test(D)||/^Packages$/i.test(D)||/^Steps$/i.test(D)||/^Deploy$/i.test(D)||/^install$/i.test(D)||/^[╭╰│─-]+$/u.test(D)||/^\$ /.test(D)||/^>\s+/i.test(D)||/docker-image:\/\//i.test(D)||/^node\s+[│|]/i.test(D)||/^yarn\s+[│|]/i.test(D)||/^▸\s+/u.test(D))return!1;return!0}function WG(D){switch(D){case"Syncing source":return"source";case"Building image":return"build";case"Pushing image":return"push";case"Deploying":return"deploy";case"Waiting for app":return"rollout";case"Ready":return"ready"}}function AC(){return{completeScan(){},showUploadRequired(){},startPackaging(){},completePackaging(){},startUploading(){},updateUploading(){},completeUploading(){},startDeploying(){},completeDeploying(){},updatePhase(){},printLog(){},showBuildActivity(){},note(){},finish(){}}}function $C(D){return D.replace(/\r/g,`
|
|
192
|
-
`).split(`
|
|
193
|
-
`).map((A)=>A.trim()).filter(Boolean).at(-1)?.trim()??""}function fC(D){return D.replace(iw,"")}function PC(D){return/^[╭╰│─\s]+$/u.test(D.trim())}function BC(D){let R=D.summary.added??0,A=D.summary.changed??0,$=D.files.length;if($===0)return"Source is up to date";let f=[];if(R>0)f.push(`${R} added`);if(A>0)f.push(`${A} changed`);let P=R+A;if($>P)f.push(`${$-P} removed`);return`${$} changed files (${f.join(", ")})`}function GC(D){return D.trim().slice(0,7)}async function DR(D,R,A){let $=await D.client.http.request({path:R,method:"GET",query:zC(A),secure:!0,format:void 0,headers:{Accept:"text/event-stream"}});if(!$.ok||!$.body)throw Error(`Failed to open log stream (${$.status} ${$.statusText})`);await JC($,(f)=>{let P=jG(f);console.log(P.message??P.line??"")})}async function uf(D,R){let A=new Set,$=!0;for(;;){let P=[...(await D.list()).items??[]].filter((B)=>B.id!==void 0&&B.id!==null).sort((B,G)=>(B.createdAt??"").localeCompare(G.createdAt??""));for(let B of P){if(D.since&&B.createdAt&&B.createdAt<D.since)continue;let G=Number(B.id);if(Number.isFinite(G)&&!A.has(G)){if(!$)D.onEvent(B);A.add(G)}}$=!1,await c0(R?.intervalMs??2000)}}function Ef(D){return(Array.isArray(D)?D:Array.isArray(D?.items)?D.items:[]).map(jG)}function jG(D){let R=D;return{time:R.time??R.timestamp??R.createdAt,message:R.message??R.line??"",pod:R.pod??R.source??"",container:R.container??""}}function zC(D){return Object.fromEntries(Object.entries(D).filter(([,R])=>R!==void 0&&R!==!1).map(([R,A])=>[R,typeof A==="boolean"?String(A):A]))}async function JC(D,R){let A=new TextDecoder,$=D.body.getReader(),f="";for(;;){let{done:P,value:B}=await $.read();if(P)break;f+=A.decode(B,{stream:!0});let G=f.indexOf(`
|
|
194
|
-
|
|
195
|
-
`);while(G>=0){let z=f.slice(0,G);f=f.slice(G+2);let J=z.split(`
|
|
196
|
-
`).filter((Z)=>Z.startsWith("data:")).map((Z)=>Z.slice(5).trim());if(J.length>0)R(JSON.parse(J.join(`
|
|
197
|
-
`)));G=f.indexOf(`
|
|
198
|
-
|
|
199
|
-
`)}}}var W6=_(async(D)=>{let R=LG();R.disposeSignal=I6(R);let A=D.options.image?"":QC(D.args.path),$=Object.assign(D,{deployState:R,manifestEntries:[],appDiff:{files:[],summary:{added:0,changed:0}},localGit:{},archivePath:void 0,deployment:void 0,ui:VG(C(D.options),A,D.app.name,D.options.verbose===!0)});try{if(!D.options.image)await ZC($,A);else $.ui.completeScan(0);await MC($,A);let f=$.deployment;$.deployState.deploymentId=f.id??null,$.deployState.disposeSignal?.(),$.deployState.disposeSignal=I6($.deployState,async()=>{if(!$.deployState.cancellationRequested)$.deployState.cancellationRequested=!0,await fG({client:$.client,appId:$.app.id,deploymentId:f.id})}),await XC($)}finally{if($.archivePath)await SG($.archivePath,{force:!0}).catch(()=>{return});R.disposeSignal?.(),R.disposeSignal=void 0}});async function ZC(D,R){D.manifestEntries=await qG(R),D.localGit=await GG(R),bf(D.deployState),D.ui.completeScan(D.manifestEntries.length)}async function MC(D,R){if(D.options.port!==void 0&&(!Number.isFinite(D.options.port)||D.options.port<=0))throw Error("Deploy port must be a positive number");try{D.deployment=await q6(D),D.ui.startDeploying(D.app.name),D.ui.completeDeploying();return}catch(A){if(D.deployState.aborted&&K6(A))throw Error("Deployment cancelled by user");let $=BG(A,D.manifestEntries);if(!$)throw A;D.appDiff=$.details,D.ui.showUploadRequired(D.appDiff),D.ui.startPackaging(D.appDiff.files.length),D.archivePath=await t5(R,D.appDiff.files),bf(D.deployState),D.ui.completePackaging(D.appDiff.files.length),D.ui.startUploading(D.app.name);let f=await RG(D,D.appDiff,D.archivePath,D.options.message??D.localGit.commitMessage,(P)=>D.ui.updateUploading(D.app.name,P));bf(D.deployState),D.ui.completeUploading(f.uploadedFiles,YC(f.uploadedBytes),f.commitSha),D.ui.startDeploying(D.app.name),D.deployment=await DG(D,c0),D.ui.completeDeploying()}finally{if(D.archivePath)await SG(D.archivePath,{force:!0}).catch(()=>{return}),D.archivePath=void 0}}async function XC(D){let R=D.deployment;D.ui.updatePhase(R.status??"pending");let A=0,$=R;try{$=await Sf({initial:R,sleep:c0,shouldAbort:()=>D.deployState.aborted,onPoll:async(f)=>{if(TC(D,f))A=await OC(D,f,A)},onStatusChange:(f,P)=>{if(!C(D.options))_C(D,f,P);D.ui.updatePhase(P)},fetch:async(f)=>{try{return await AG({client:D.client,appId:D.app.id,deploymentId:f.id},D.deployState)}catch(P){if(D.deployState.aborted&&K6(P))return f;throw P}}})}finally{D.deployState.activeController?.abort(),D.deployState.activeController=null,D.deployState.logController?.abort(),D.deployState.logController=null}if(D.deployState.aborted)throw Error("Deployment cancelled by user");if(C(D.options))W($,!0);else{D.ui.finish($.status??"pending");let f=Wf($,D.app.url);if(LA($)&&f)D.ui.note(`URL: ${f}`)}if(!LA($))throw Error(jf($,D.app.name));if(D.options.logs===!0&&!C(D.options))console.log("Following app logs"),await DR(D,`/v1/apps/${D.app.id}/logs`,{lines:10,stream:!0})}function TC(D,R){return!C(D.options)&&!Kf(R.status)}async function OC(D,R,A){let f=(await $G({client:D.client,appId:D.app.id,deploymentId:R.id,offset:A,limit:100},D.deployState)).items??[];for(let P of f)D.ui.printLog(P.message??P.line??"",R.status??"pending");return A+f.length}function QC(D){return HC.resolve(process.cwd(),D??".")}function YC(D){if(!Number.isFinite(D)||D<=0)return"0 B";let R=["B","KiB","MiB","GiB","TiB"],A=D,$=0;while(A>=1024&&$<R.length-1)A/=1024,$+=1;let f=A>=10||$===0?0:1;return`${A.toFixed(f)} ${R[$]}`}function _C(D,R,A){if(R==="building"&&["deploying","pulling","starting","ready","degraded"].includes(A)){D.ui.note("Build completed");return}if(R==="pulling"&&["starting","ready","degraded"].includes(A))D.ui.note("Image pulled")}var bG=_(async(D)=>{let A=(await D.client.api.appsDeploymentsList({appId:D.app.id})).items??[];if(C(D.options)){W(A,!0);return}s([{header:"Status",width:12,render:($)=>$.status??""},{header:"Method",width:8,render:($)=>$.method??""},{header:"Trigger",width:10,render:($)=>$.trigger??""},{header:"Message",width:28,render:($)=>$.message??""},{header:"Age",width:6,render:($)=>H0($.createdAt)},{header:"ID",width:9,render:($)=>String($.id)}],A)}),uG=_(async(D)=>{let R=Number(D.args.deployment),A=await D.client.api.appsDeploymentsDetail({appId:D.app.id,deploymentId:R});if(C(D.options)){W(A,!0);return}M2(A)}),EG=_(async(D)=>{let R=Number(D.args.deployment);await D.client.api.appsDeploymentsCancelCreate({appId:D.app.id,deploymentId:R}),console.log(`Cancelled deployment ${R}`)}),yG=_(async(D)=>{let R=Number(D.args.deployment),A=await D.client.api.appsDeploymentsRollbackCreate({appId:D.app.id,deploymentId:R});if(C(D.options)){W(A,!0);return}console.log(`Rollback deployment ${A.id} created from deployment ${A.source?.rollbackFromDeploymentID}`)}),gG=_(async(D)=>{let R=Number(D.args.deployment),A=await D.client.api.appsDeploymentsLogsList({appId:D.app.id,deploymentId:R});W(A,C(D.options))}),mG=_(async(D)=>{let R=Number(D.args.deployment),A=await D.client.api.appsDeploymentsDetail({appId:D.app.id,deploymentId:R}),$=await Sf({initial:A,sleep:c0,fetch:async()=>await D.client.api.appsDeploymentsDetail({appId:D.app.id,deploymentId:R}),onStatusChange:(f,P)=>{if(!C(D.options))console.log(`Status: ${P}`)}});if(C(D.options)){W($,!0);return}if(LA($)){console.log("Ready");let f=Wf($,D.app.url);if(f)console.log(`URL: ${f}`);return}D.abort(jf($,D.app.name))});var RR=_(async(D,R)=>{let $=((await D.client.api.appsDisksList({appId:D.app.id})).items??[]).find((f)=>N4(f,D.args.disk));if(!$)D.abort(`Disk not found: ${D.args.disk}`);D.disk=$,await R()}),xG=_(async(D)=>{let A=(await D.client.api.appsDisksList({appId:D.app.id})).items??[];if(C(D.options)){W(A,!0);return}O2(A)}),nG=_(async(D)=>{let R=await D.client.api.appsDisksDetail({appId:D.app.id,diskId:D.disk.id});if(C(D.options)){W(R,!0);return}dD(R)}),pG=_(async(D)=>{if(!Number.isFinite(D.options.size)||D.options.size<=0)D.abort("Disk size must be a positive number");let R=await D.client.api.appsDisksCreate({appId:D.app.id},{name:D.args.name,size:D.options.size});if(C(D.options)){W(R,!0);return}dD(R)}),hG=_(async(D)=>{let R=await D.client.api.appsDisksMountCreate({appId:D.app.id,diskId:D.disk.id},{mountPath:D.args.mountPath});if(C(D.options)){W(R,!0);return}dD(R)}),vG=_(async(D)=>{let R=await D.client.api.appsDisksUnmountCreate({appId:D.app.id,diskId:D.disk.id});if(C(D.options)){W(R,!0);return}dD(R)}),lG=_(async(D)=>{if(!Number.isFinite(D.options.size)||D.options.size<=0)D.abort("Disk size must be a positive number");let R=await D.client.api.appsDisksExpandCreate({appId:D.app.id,diskId:D.disk.id},{size:D.options.size});if(C(D.options)){W(R,!0);return}dD(R)}),dG=_(async(D)=>{if(await D.client.api.appsDisksDelete({appId:D.app.id,diskId:D.disk.id}),C(D.options)){W({deleted:!0,id:D.disk.id,name:D.disk.name},!0);return}console.log(`Deleted disk ${D.disk.name}`)});var kG=_(async(D)=>{let R=await D.client.api.appsDomainsList({appId:D.app.id});if(C(D.options)){W(R,!0);return}s([{header:"Hostname",width:36,render:(A)=>A.hostname??""},{header:"Verify",width:12,render:(A)=>A.verificationStatus??""},{header:"TLS",width:12,render:(A)=>A.tlsStatus??""},{header:"TLS On",width:8,render:(A)=>A.tlsEnabled?"yes":"no"},{header:"HTTPS",width:8,render:(A)=>A.forceHttps?"yes":"no"},{header:"Age",width:6,render:(A)=>H0(A.createdAt)}],R)}),iG=_(async(D,R)=>{D.domain=await D.client.api.appsDomainsCreate({appId:D.app.id},{hostname:D.args.hostname,tlsEnabled:D.options.tlsMode==="disabled"?!1:!0,forceHttps:D.options.forceHttps}),await R()}),aG=_(async(D)=>{if(C(D.options)){W(D.domain,!0);return}T2(D.domain)}),rG=_(async(D)=>{let A=(await D.client.api.appsDomainsList({appId:D.app.id})).find(($)=>$.hostname===D.args.hostname);if(!A)D.abort(`Domain not found: ${D.args.hostname}`);await D.client.api.appsDomainsDelete({appId:D.app.id,domainId:A.id}),console.log(`Removed domain ${A.hostname}`)}),sG=_(async(D)=>{let A=(await D.client.api.appsDomainsList({appId:D.app.id})).find((f)=>f.hostname===D.args.hostname);if(!A)D.abort(`Domain not found: ${D.args.hostname}`);let $=await D.client.api.appsDomainsVerifyCreate({appId:D.app.id,domainId:A.id});W($,C(D.options))}),oG=_(async(D)=>{let R=await D.client.api.appsDomainsAvailabilityList({appId:D.app.id,hostname:D.args.hostname});W(R,C(D.options))});var cG=_(async(D)=>{let R=j6(await D.client.api.appsEnvList({appId:D.app.id}));if(C(D.options)){W(R,!0);return}X2(R)}),tG=_(async(D)=>{let R=U4(D.args.entry),$=[...j6(await D.client.api.appsEnvList({appId:D.app.id})).filter((f)=>yf(f)!==R.key),{name:R.key,value:R.value}];await D.client.api.appsEnvUpdate({appId:D.app.id},{items:$}),await D.client.api.appsApplyCreate({appId:D.app.id}),console.log(`Updated ${R.key}`)}),eG=_(async(D)=>{let A=j6(await D.client.api.appsEnvList({appId:D.app.id})).filter(($)=>yf($)!==D.args.key).map(($)=>({name:yf($),value:Dz($)}));await D.client.api.appsEnvUpdate({appId:D.app.id},{items:A}),await D.client.api.appsApplyCreate({appId:D.app.id}),console.log(`Removed ${D.args.key}`)});function j6(D){return(Array.isArray(D)?D:Array.isArray(D?.items)?D.items:[]).map((A)=>{let $=A;return{key:yf($),value:Dz($),updatedAt:$.updatedAt??""}})}function yf(D){return D.name??D.key??""}function Dz(D){return D.value??""}var Rz=_(async(D)=>{await D.client.api.appsStartCreate({appId:D.app.id}),console.log(`Started app ${D.app.name}`)}),Az=_(async(D)=>{await D.client.api.appsStopCreate({appId:D.app.id}),console.log(`Stopped app ${D.app.name}`)}),$z=_(async(D)=>{await D.client.api.appsRestartCreate({appId:D.app.id}),console.log(`Restarted app ${D.app.name}`)});var fz=_(async(D)=>{if(C(D.options)){W(D.app,!0);return}Z2(D.app)});var S6=_(async(D)=>{let A=(await D.client.api.appsList()).items??[];if(C(D.options)){W(A,!0);return}s([{header:"Project",width:22,render:()=>D.project.name},{header:"Name",width:22,render:($)=>$.name??""},{header:"Status",width:12,render:($)=>$.status??""},{header:"Plan",width:12,render:($)=>$.plan??""},{header:"Bundle",width:12,render:($)=>$.bundle??""},{header:"Age",width:6,render:($)=>H0($.createdAt)},{header:"URL",width:36,render:($)=>$.url??""}],A)});var Pz=_(async(D)=>{let R=_0(D.options.tail)??10,A={since:D.options.since,lines:R,filter:D.options.filter,previous:D.options.previous,stream:D.options.follow};if(D.options.follow&&!C(D.options)){await DR(D,`/v1/apps/${D.app.id}/logs`,A);return}let $=await D.client.api.appsLogsList({appId:D.app.id,...A});if(C(D.options)){W($,!0);return}QR(Ef($))}),Bz=_(async(D)=>{if(D.options.watch){await uf({list:()=>D.client.api.appsEventsList({appId:D.app.id,limit:50,offset:0}),since:D.options.since,onEvent:(f)=>{OR(f),console.log()}});return}let R=_0(D.options.tail)??10,$=(await D.client.api.appsEventsList({appId:D.app.id,limit:R,offset:0})).items??[];if(C(D.options)){W($,!0);return}TR($)});var xL=B0(R7(),1),nL=B0(lf(),1),pL=B0(fR(),1),hL=B0(m6(),1),vL=B0(n6(),1),lL=B0(k6(),1),z7=B0(rf(),1),dL=B0(G7(),1);var g0=z7.default;var J7=_(async(D)=>{if(D.token.startsWith("abr_"))D.abort("App shell requires session authentication. Run `abrun login --email <email>` and try again.");let R=iA(D.endpoint,`/v1/apps/${D.app.id}/console`,{command:"shell"});await new Promise((A,$)=>{let f=new g0(R,{headers:{Authorization:`Bearer ${D.token}`,"User-Agent":UR,"x-project-id":String(D.project.id)}}),P=process.stdin,B=process.stdout,G=P.isTTY?P.isRaw:void 0,z=!1,J=!1,Z=()=>{if(P.off("data",M),P.off("end",T),B.off("resize",Q),f.off("open",U),f.off("message",F),f.off("error",X),f.off("close",O),P.isTTY)P.pause(),P.setRawMode(G??!1)},H=(w,V=0)=>{if(J)return;if(J=!0,Z(),w){$(w);return}process.exitCode=V,A()},M=(w)=>{if(f.readyState===g0.OPEN)f.send(w,{binary:!0})},T=()=>{if(f.readyState===g0.OPEN)f.send(JSON.stringify({type:"close"}))},Q=()=>{if(!P.isTTY||f.readyState!==g0.OPEN||!z)return;f.send(JSON.stringify({type:"resize",cols:B.columns,rows:B.rows}))},X=(w)=>{H(w)},O=()=>{H()},U=()=>{if(z=!0,P.on("data",M),P.on("end",T),P.isTTY)P.resume(),P.setRawMode(!0);if(B.isTTY)B.on("resize",Q),Q()},F=(w,V)=>{if(V){let j=Array.isArray(w)?Buffer.concat(w.map((u)=>Buffer.isBuffer(u)?u:Buffer.from(u))):Buffer.isBuffer(w)?w:Buffer.from(w);B.write(j);return}let I=JSON.parse(String(w));if(I.type==="ready")return;if(I.type==="started"){if(z=!0,P.isTTY)P.resume(),P.setRawMode(!0),Q();return}if(I.type==="error"){H(Error(I.message));return}if(I.type==="exit"){if(f.readyState===g0.OPEN)f.close();H(void 0,I.exitCode??(I.succeeded?0:1))}};f.on("open",U),f.on("message",F),f.on("error",X),f.on("close",O)})});var H7=_(async(D)=>{let R=D.options.plan!==void 0||D.options.bundle!==void 0,A=D.options.defaultDomain!==void 0||D.options.securityProfile!==void 0;if(R)D.abort("Use `abrun app resize` for plan and bundle changes.");if(!A)D.abort("Nothing to update. Use --security-profile.");if(D.options.defaultDomain!==void 0)D.abort("Updating default domains is not implemented by the public API.");let $=await D.client.api.appsPartialUpdate({appId:D.app.id},{buildConfig:D.app.buildConfig,image:D.app.image,name:D.app.name,port:D.app.port,runtimeConfig:D.app.runtimeConfig,securityProfile:D.options.securityProfile});if(C(D.options)){W($,!0);return}console.log(`Updated app ${$.name} (${$.status})`)}),Z7=_(async(D)=>{let R=await D.client.api.appPlansList(),A=D.options.plan!==void 0||D.options.bundle===void 0&&await p1(D,"Change app plan?","Use --plan and/or --bundle, or run in an interactive terminal."),$=A?await kL(D,R):kD(R,void 0,K4(D.app)),f=await D.client.api.appPlansBundlesList({planName:$.name}),P=D.options.bundle!==void 0||D.options.plan===void 0&&await p1(D,"Change app bundle?","Use --plan and/or --bundle, or run in an interactive terminal."),B=P?await iL(D,f):iD(f,void 0,W4(D.app));if(!A&&!P)D.abort("Nothing to resize.");let G=await D.client.api.appsResizeCreate({appId:D.app.id},{plan:$.name,bundle:B.name});if(C(D.options)){W(G,!0);return}console.log(`Resized app ${G.name} (${G.status})`)});async function kL(D,R){return D.options.plan?.trim()?kD(R,D.options.plan.trim()):bB(D,R)}async function iL(D,R){return D.options.bundle?.trim()?iD(R,D.options.bundle.trim()):uB(D,R)}function M7(D){let R=D.command("app").description("Manage apps").onions([D0]);D.command("apps").description("List apps").onions([N,K,Y,b,Y,S6]),D.command("deploy").description("Deploy source or an image to an app").argument("<app>").argument("[path]").option("--image <image>","Deploy an image instead of source").option("--port <port>","Update runtime port for this deploy",(B)=>Number(B)).option("--root-directory <path>","Override Docker build context directory").option("--dockerfile-path <path>","Override Dockerfile path").option("--message <message>","Deployment message").option("--logs","Follow app logs after a successful deploy").option("--verbose","Print raw build and rollout logs").onions([N,K,Y,b,Y,x,W6]),R.command("list").alias("ls").description("List apps").onions([N,K,Y,b,Y,S6]),R.command("inspect").alias("get").description("Inspect one app").argument("<app>").onions([N,K,Y,b,Y,x,fz]),R.command("events").description("List app events").argument("<app>").option("--watch","Watch app events continuously").option("--tail <count>","Number of recent events to fetch",_0).option("--since <value>","Only include events since an ISO timestamp or relative value like 5h").onions([N,K,Y,b,Y,x,Bz]),R.command("logs").description("Fetch app runtime logs").argument("<app>").option("--tail <count>","Number of recent log lines to fetch",_0).option("--since <value>","Only include logs since an ISO timestamp or relative value like 5h").option("--filter <pattern>","Filter log messages with a regular expression").option("--previous","Fetch previous crashed container logs").option("--follow","Stream logs continuously").onions([N,K,Y,b,Y,x,Pz]),R.command("create").description("Create an app").argument("<name>").option("--plan <name>","Plan name").option("--bundle <name>","Bundle name").option("--port <port>","Runtime port",lA).option("--security-profile <profile>","Runtime security profile",_D(["restricted","compatible"])).onions([N,K,Y,b,Y,EB,yB]),R.command("update").description("Update app settings").argument("<app>").option("--default-domain <hostname>","Set app default domain").option("--security-profile <profile>","Runtime security profile",_D(["restricted","compatible"])).onions([N,K,Y,b,Y,x,H7]),R.command("resize").description("Resize an app plan or bundle").argument("<app>").option("--plan <name>","Plan name").option("--bundle <name>","Bundle name").onions([N,K,Y,b,Y,x,Z7]),R.command("delete").alias("rm").description("Delete an app").argument("<app>").onions([N,K,Y,b,Y,x,gB]),R.command("start").description("Start an app").argument("<app>").onions([N,K,Y,b,Y,x,Rz]),R.command("stop").description("Stop an app").argument("<app>").onions([N,K,Y,b,Y,x,Az]),R.command("restart").description("Restart an app").argument("<app>").onions([N,K,Y,b,Y,x,$z]),R.command("shell").alias("exec").description("Open an interactive shell in an app").argument("<app>").onions([N,K,Y,b,Y,x,J7]),R.command("deploy").description("Deploy source or an image").argument("<app>").argument("[path]").option("--image <image>","Deploy an image instead of source").option("--port <port>","Update runtime port for this deploy",(B)=>Number(B)).option("--root-directory <path>","Override Docker build context directory").option("--dockerfile-path <path>","Override Dockerfile path").option("--message <message>","Deployment message").option("--logs","Follow app logs after a successful deploy").option("--verbose","Print raw build and rollout logs").onions([N,K,Y,b,Y,x,W6]);let A=R.command("disk").description("Manage app disks").onions([D0]);A.command("list").alias("ls").description("List disks").argument("<app>").onions([N,K,Y,b,Y,x,xG]),A.command("inspect").alias("get").description("Inspect one disk").argument("<app>").argument("<disk>").onions([N,K,Y,b,Y,x,RR,nG]),A.command("create").description("Create a disk").argument("<app>").argument("<name>").option("--size <size>","Disk size in GB",(B)=>Number(B)).onions([N,K,Y,b,Y,x,pG]),A.command("mount").description("Mount a disk").argument("<app>").argument("<disk>").argument("<mountPath>").onions([N,K,Y,b,Y,x,RR,hG]),A.command("unmount").description("Unmount a disk").argument("<app>").argument("<disk>").onions([N,K,Y,b,Y,x,RR,vG]),A.command("expand").description("Expand a disk").argument("<app>").argument("<disk>").option("--size <size>","New disk size in GB",(B)=>Number(B)).onions([N,K,Y,b,Y,x,RR,lG]),A.command("delete").alias("rm").description("Delete a disk").argument("<app>").argument("<disk>").onions([N,K,Y,b,Y,x,RR,dG]);let $=R.command("env").description("Manage app environment variables").onions([D0]);$.command("list").alias("ls").description("List env vars").argument("<app>").onions([N,K,Y,b,Y,x,cG]),$.command("set").description("Set an env var").argument("<app>").argument("<entry>").onions([N,K,Y,b,Y,x,tG]),$.command("unset").description("Remove an env var").argument("<app>").argument("<key>").onions([N,K,Y,b,Y,x,eG]);let f=R.command("domain").description("Manage app domains").onions([D0]);f.command("list").alias("ls").description("List domains").argument("<app>").onions([N,K,Y,b,Y,x,kG]),f.command("add").description("Add a domain").argument("<app>").argument("<hostname>").option("--tls-mode <mode>","TLS mode",_D(["auto","manual","disabled"])).option("--force-https","Force HTTPS redirect").onions([N,K,Y,b,Y,x,iG,aG]),f.command("delete").alias("rm").description("Delete a domain").argument("<app>").argument("<hostname>").onions([N,K,Y,b,Y,x,rG]),f.command("verify").description("Verify a domain").argument("<app>").argument("<hostname>").onions([N,K,Y,b,Y,x,sG]),f.command("check").description("Check domain availability").argument("<app>").argument("<hostname>").onions([N,K,Y,b,Y,x,oG]);let P=R.command("deployment").description("Manage deployments").onions([D0]);P.command("list").alias("ls").description("List deployments").argument("<app>").onions([N,K,Y,b,Y,x,bG]),P.command("inspect").alias("get").description("Inspect one deployment").argument("<app>").argument("<deployment>").onions([N,K,Y,b,Y,x,uG]),P.command("logs").description("Fetch deployment logs").argument("<app>").argument("<deployment>").onions([N,K,Y,b,Y,x,gG]),P.command("watch").description("Watch a deployment").argument("<app>").argument("<deployment>").onions([N,K,Y,b,Y,x,mG]),P.command("cancel").description("Cancel a deployment").argument("<app>").argument("<deployment>").onions([N,K,Y,b,Y,x,EG]),P.command("rollback").description("Roll back to the last ready deployment").argument("<app>").argument("<deployment>").onions([N,K,Y,b,Y,x,yG])}import{execFile as aL}from"node:child_process";import{promisify as rL}from"node:util";var sL=rL(aL),T7=_(async(D)=>{let R=D.endpoint,A;if(D.options.token){let P=await aD({endpoint:R,token:D.options.token}).api.authMeList();A={token:D.options.token,expiresAt:"",user:P}}else if(D.options.browser){let P=await D.client.api.authCliLoginStartOrPoll({deviceName:`abrun ${S2}`}),B=eL(P,R);console.log(`Open: ${B}`),await DN(B),A=await tL(R,P)}else{let P=await oL(D),B=await cL(D);A=await D.client.api.authLoginCreate({email:P,password:B})}let $=D.options.label??A.user.email,f={id:String(A.user.id),label:$,email:A.user.email,token:A.token,endpoint:R,userId:A.user.id,expiresAt:A.expiresAt};D.state.auths=[...D.state.auths.filter((P)=>P.id!==f.id),f],D.state.currentAuthId=f.id,await p0(D.state),o0({auth:$,email:A.user.email,endpoint:R})});async function oL(D){let R=D.options.email?.trim();if(R)return R;if(!O7(D.options))D.abort("Email is required. Use --email or run in an interactive terminal.");let A=(await VR({message:"Email"})).trim();if(!A)D.abort("Email is required.");return A}async function cL(D){if(D.options.password)return D.options.password;if(!O7(D.options))D.abort("Password is required. Use --password or run in an interactive terminal.");let R=await e2({message:"Password",mask:"*"});if(!R)D.abort("Password is required.");return R}function O7(D){return Boolean(process.stdin.isTTY&&process.stdout.isTTY&&!C(D))}var Q7=_(async(D)=>{if(D.options.all){await Promise.all(D.state.auths.map((A)=>X7(A.endpoint??D.endpoint,A.token))),D.state.auths=[],D.state.currentAuthId=void 0,D.state.currentProjectByAuthId={},await p0(D.state),console.log("All local auth entries removed.");return}let R=D.state.currentAuthId?D.state.auths.find((A)=>A.id===D.state.currentAuthId):D.state.auths[0];if(!R){console.log("No saved auth.");return}if(await X7(R.endpoint??D.endpoint,R.token),D.state.auths=D.state.auths.filter((A)=>A.id!==R.id),D.state.currentAuthId===R.id)D.state.currentAuthId=D.state.auths[0]?.id;delete D.state.currentProjectByAuthId[R.id],await p0(D.state),console.log(`Removed auth ${R.label}`)}),Y7=_(async(D)=>{let R=await D.client.api.authMeList();o0({auth:D.auth.label,email:R.email,endpoint:D.endpoint,expiresIn:hA(D.auth.expiresAt)})}),_7=_(async(D)=>{if(C(D.options)){W(D.state.auths,!0);return}s([{header:"Current",width:7,render:(R)=>R.id===D.state.currentAuthId?"*":""},{header:"Auth",width:18,render:(R)=>R.label},{header:"Email",width:28,render:(R)=>R.email},{header:"Endpoint",width:36,render:(R)=>R.endpoint}],D.state.auths)}),U7=_(async(D)=>{let R=D.state.auths.find((A)=>YR(A,D.args.auth));if(!R)D.abort(`Auth not found: ${D.args.auth}`);D.state.currentAuthId=R.id,await p0(D.state),console.log(`Current auth: ${R.label}`)}),F7=_(async(D)=>{let R=D.state.auths.find((A)=>YR(A,D.args.auth));if(!R)D.abort(`Auth not found: ${D.args.auth}`);if(D.state.auths=D.state.auths.filter((A)=>A.id!==R.id),D.state.currentAuthId===R.id)D.state.currentAuthId=D.state.auths[0]?.id;delete D.state.currentProjectByAuthId[R.id],await p0(D.state),console.log(`Removed auth: ${R.label}`)});async function tL(D,R){if(!R.pollToken)throw Error("CLI login did not return a poll token.");let A=aD({endpoint:D});for(;;){let $=await A.api.authCliLoginStartOrPoll({pollToken:R.pollToken});if($.status==="allowed"&&$.token){let f=await aD({endpoint:D,token:$.token}).api.authMeList();return{token:$.token,expiresAt:"",user:f}}await c0(($.pollIntervalSeconds??R.pollIntervalSeconds??2)*1000)}}function eL(D,R){let A=D.browserURL;if(A)return A;let $=new URL(R);if($.hostname.startsWith("api."))$.hostname=$.hostname.slice(4);return $.pathname="/cli-login",$.search="",$.toString()}async function DN(D){let R=process.platform==="darwin"?"open":process.platform==="win32"?"cmd":"xdg-open",A=process.platform==="win32"?["/c","start","",D]:[D];try{await sL(R,A)}catch{console.log("Open the URL above in your browser to continue.")}}async function X7(D,R){try{await aD({endpoint:D,token:R}).api.authLogoutCreate()}catch{}}function q7(D){D.command("login").description("Login with email/password, token, or browser approval").option("--token <token>","API token").option("--email <email>","User email for password login").option("--password <password>","User password for password login").option("--label <label>","Saved auth label").option("--browser","Use browser approval flow").onions([N,Y,T7]),D.command("logout").description("Remove the current saved auth").option("--all","Remove all saved auth entries").onions([N,Q7]),D.command("whoami").description("Show the current authenticated identity").onions([N,K,Y,Y7]);let R=D.command("auth").description("Manage saved auth entries").onions([D0]);R.command("list").alias("ls").description("List saved auth entries").onions([N,_7]),R.command("use").description("Switch current auth").argument("<auth>").onions([N,U7]),R.command("remove").alias("rm").description("Remove a saved auth entry").argument("<auth>").onions([N,F7])}var w7=_(async(D,R)=>{let $=((await D.client.api.databasesBackupsList({databaseId:D.database.id})).items??[]).find((f)=>String(f.id)===D.args.backup);if(!$)D.abort(`Database backup not found: ${D.args.backup}`);D.backup=$,await R()}),C7=_(async(D)=>{let A=(await D.client.api.databasesBackupsList({databaseId:D.database.id})).items??[];if(C(D.options)){W(A,!0);return}L2(A)}),L7=_(async(D)=>{let R=await D.client.api.databasesBackupsDetail({databaseId:D.database.id,backupId:D.backup.id});if(C(D.options)){W(R,!0);return}xA(R)}),N7=_(async(D)=>{let R=await D.client.api.databasesBackupsCreate({databaseId:D.database.id});if(C(D.options)){W(R,!0);return}xA(R)});async function bA(D,R){return D.client.api.databasesDetail({databaseId:R})}async function of(D){return D.client.api.databasesList({})}async function V7(D,R){return D.client.api.databasesCreate({name:R.name,engine:R.engine,version:R.version,plan:R.plan,bundle:R.bundle,publicAccess:R.published,password:R.password,engineConfig:K7(R.configOverrides)})}async function i6(D,R,A){let $={publicAccess:A.publicAccess,engineConfig:K7(A.configOverrides)};if(A.plan!==void 0||A.bundle!==void 0)await D.client.api.databasesResizeCreate({databaseId:R},{plan:A.plan,bundle:A.bundle});if($.publicAccess===void 0&&$.engineConfig===void 0)return bA(D,R);return D.client.api.databasesPartialUpdate({databaseId:R},$)}async function L1(D){return{items:await D.client.api.databasePlansList()}}async function cf(D){return(await D.client.api.databaseEnginesList()).filter((A)=>A.name).map((A)=>({engine:A.name,versions:A.versions??[]}))}async function HR(D,R){return await D.client.api.databasePlansBundlesList({planName:R})}function I7(D,R){let A=D.find(($)=>$.engine===R);if(!A)throw Error(`Unsupported database engine: ${R}`);return A}function K7(D){if(!D?.trim())return;return JSON.parse(D)}var W7=_(async(D)=>{let R=D.options.plan?.trim();if(!R)D.abort("Database bundle list requires --plan because bundles are resolved per plan.");let A=await HR(D,R);if(C(D.options)){W(A,!0);return}w2(A)}),j7=_(async(D)=>{let R=await L1(D),A=UD(R.items??[],D.options.plan),f=(await HR(D,A.name)).find((P)=>kA(P,D.args.bundle));if(!f)D.abort(`Database bundle not found: ${D.args.bundle}`);if(C(D.options)){W(f,!0);return}C2(f)});var S7=_(async(D)=>{let R=await cf(D);if(C(D.options)){W(R,!0);return}F2(R)});var NE=_(async(D)=>{let A=(await L1(D)).items??[];if(C(D.options)){W(A,!0);return}U2(A)}),b7=_(async(D)=>{let A=(await D.client.api.databasePlansList()).find(($)=>dA($,D.args.plan));if(!A)D.abort(`Database plan not found: ${D.args.plan}`);if(C(D.options)){W(A,!0);return}q2(A)});var a6=B0(mA(),1);var r6=_(async(D)=>{let A=(await of(D)).items??[];if(C(D.options)){W(A,!0);return}_2(D.project.name,A)}),u7=_(async(D)=>{let R=await bA(D,D.database.id);if(C(D.options)){W(R,!0);return}Q2(R)}),E7=_(async(D)=>{let R=await D.client.api.databasesCredentialsList({databaseId:D.database.id});if(C(D.options)){if(!D.options.reveal&&!D.options.showPassword)D.abort("Refusing to print database credentials as JSON without --show-password.");W(R,!0);return}Y2(D.database.name,R,{reveal:D.options.reveal||D.options.showPassword})}),y7=_(async(D)=>{let R=await cf(D),A=D.options.engine?.trim()||await h0(D,"Select database engine",R.map((Z)=>({value:Z.engine,name:Z.engine})),"Database engine is required. Use --engine or run in an interactive terminal."),$=I7(R,A),f=D.options.version?.trim()||await h0(D,`Select ${A} version`,$.versions.map((Z)=>({value:Z,name:Z})),"Database version is required. Use --version or run in an interactive terminal.",{forcePromptSingle:!0}),P=await L1(D),B=D.options.plan?.trim()?UD(P.items??[],D.options.plan.trim()):await TP(D,P.items??[]),G=await HR(D,B.name),z=D.options.bundle?.trim()?V1(G,D.options.bundle.trim()):await OP(D,G),J=await V7(D,{name:D.args.name,engine:A,plan:B.name,bundle:z.name,password:D.options.password,published:D.options.publicAccess,version:f,configOverrides:D.options.config});if(C(D.options)){W(J,!0);return}console.log(`Created database ${J.database.name} (${J.database.status})`),console.log(),console.log(a6.default.bold("password")),console.log(a6.default.yellow(J.password??""))}),g7=_(async(D)=>{let R=D.options.config!==void 0||D.options.publicAccess!==void 0;if(D.options.plan!==void 0||D.options.bundle!==void 0)D.abort("Use `abrun database resize` for plan and bundle changes.");if(!R)D.abort("Nothing to update. Use --config, --public-access, or --no-public-access.");let A=await i6(D,D.database.id,{configOverrides:D.options.config,publicAccess:D.options.publicAccess});if(C(D.options)){W(A,!0);return}console.log(`Updated database ${A.name} (${A.status})`)}),m7=_(async(D)=>{let R=await L1(D),A=D.options.plan!==void 0||D.options.bundle===void 0&&await p1(D,"Change database plan?","Use --plan and/or --bundle, or run in an interactive terminal."),$=D.options.plan?.trim()?UD(R.items??[],D.options.plan.trim()):A?await TP(D,R.items??[]):UD(R.items??[],void 0,D.database.plan),f=await HR(D,$.name),P=D.options.bundle!==void 0||D.options.plan===void 0&&await p1(D,"Change database bundle?","Use --plan and/or --bundle, or run in an interactive terminal."),B=D.options.bundle?.trim()?V1(f,D.options.bundle.trim()):P?await OP(D,f):V1(f,void 0,D.database.bundle);if(!A&&!P)D.abort("Nothing to resize.");let G=await i6(D,D.database.id,{plan:$.name,bundle:B.name});if(C(D.options)){W(G,!0);return}console.log(`Resized database ${G.name} (${G.status})`)}),x7=_(async(D)=>{if(await D.client.api.databasesDelete({databaseId:D.database.id}),C(D.options)){W({deleted:!0,id:D.database.id,name:D.database.name},!0);return}console.log(`Removed database ${D.database.name}`)}),n7=_(async(D)=>{await D.client.api.databasesStartCreate({databaseId:D.database.id});let R=await bA(D,D.database.id);console.log(`Started database ${R.name} (${R.status})`)}),p7=_(async(D)=>{await D.client.api.databasesStopCreate({databaseId:D.database.id});let R=await bA(D,D.database.id);console.log(`Stopped database ${R.name} (${R.status})`)}),h7=_(async(D)=>{let R=await D.client.api.databasesUsageList({databaseId:D.database.id});if(C(D.options)){W(R,!0);return}N2(R)});var J0=_(async(D,R)=>{let $=((await of(D)).items??[]).find((f)=>V4(f,D.args.database));if(!$)D.abort(`Database not found: ${D.args.database}`);D.database=$,await R()});var v7=_(async(D)=>{let R=_0(D.options.tail)??10,A={since:D.options.since,lines:R,filter:D.options.filter,previous:D.options.previous,stream:D.options.follow};if(D.options.follow&&!C(D.options)){await DR(D,`/v1/databases/${D.database.id}/logs`,A);return}let $=await D.client.api.databasesLogsList({databaseId:D.database.id,...A});if(C(D.options)){W($,!0);return}QR(Ef($))}),l7=_(async(D)=>{if(D.options.watch){await uf({list:()=>D.client.api.databasesEventsList({databaseId:D.database.id,limit:50,offset:0}),since:D.options.since,onEvent:(f)=>{OR(f),console.log()}});return}let R=_0(D.options.tail)??10,$=(await D.client.api.databasesEventsList({databaseId:D.database.id,limit:R,offset:0})).items??[];if(C(D.options)){W($,!0);return}TR($)});import RN from"node:net";function AN(D){let R=D.host?.trim()||"127.0.0.1",A=D.port;if(A===void 0)throw Error("--port is required.");return{host:R,port:A}}function $N(D,R){return["Tunnel established","",`Database: ${D.name}`,`Engine: ${D.engine??""}`,`Local: ${R}`].join(`
|
|
200
|
-
`)}var d7=_(async(D)=>{let{host:R,port:A}=AN(D.options),$=`${R}:${A}`,f=new Set,P=RN.createServer((B)=>{f.add(B),B.on("close",()=>f.delete(B)),B.on("error",()=>f.delete(B)),B.pause();let G=iA(D.endpoint,`/v1/databases/${D.database.id}/tunnel`),z=new g0(G,{headers:{Authorization:`Bearer ${D.token}`,"User-Agent":UR,"x-project-id":String(D.project.id)}}),J=!1,Z=!1,H=()=>{if(J)return;if(J=!0,B.destroy(),z.readyState===g0.OPEN||z.readyState===g0.CONNECTING)z.close()},M=(T)=>{console.error(T),P.close(),H()};B.on("data",(T)=>{if(z.readyState===g0.OPEN)z.send(T,{binary:!0})}),B.on("end",()=>{Z=!0,H()}),B.on("error",()=>{Z=!0,H()}),B.on("close",()=>{Z=!0,H()}),z.on("open",()=>{B.resume()}),z.on("message",(T,Q)=>{if(!Q)return;let X=Array.isArray(T)?Buffer.concat(T.map((O)=>Buffer.isBuffer(O)?O:Buffer.from(O))):Buffer.isBuffer(T)?T:Buffer.from(T);B.write(X)}),z.on("error",(T)=>{if(!Z)M(`Tunnel connection failed: ${T.message}`)}),z.on("close",(T,Q)=>{if(!Z&&T!==1000){let X=Q.length>0?`: ${Q.toString()}`:"";M(`Tunnel connection closed${X}`)}H()})});await new Promise((B,G)=>{let z=!1,J=!1,Z=()=>{process.off("SIGINT",M),process.off("SIGTERM",M),P.off("error",T),P.off("close",Q),P.off("listening",X);for(let O of f)O.destroy()},H=(O)=>{if(J)return;if(J=!0,Z(),O){G(O);return}B()},M=()=>{P.close();for(let O of f)O.destroy()},T=(O)=>{H(O)},Q=()=>{if(z)H()},X=()=>{z=!0,console.log($N(D.database,$))};process.once("SIGINT",M),process.once("SIGTERM",M),P.once("error",T),P.once("close",Q),P.once("listening",X),P.listen(A,R)})});function k7(D){let R=D.command("database").description("Manage databases").onions([D0]);R.alias("db"),D.command("dbs").description("List databases").onions([N,K,Y,b,Y,r6]),R.command("credentials").description("Get database credentials").argument("<database>").option("--reveal","Show plaintext password in human output").option("--show-password","Show plaintext password in human output").onions([N,K,Y,b,Y,J0,E7]),R.command("events").description("List database events").argument("<database>").option("--watch","Watch database events continuously").option("--tail <count>","Number of recent events to fetch",_0).option("--since <value>","Only include events since an ISO timestamp or relative value like 5h").onions([N,K,Y,b,Y,J0,l7]),R.command("logs").description("Fetch database runtime logs").argument("<database>").option("--tail <count>","Number of recent log lines to fetch",_0).option("--since <value>","Only include logs since a relative value like 5h").option("--filter <pattern>","Filter log messages with a regular expression").option("--previous","Fetch previous crashed container logs").option("--follow","Stream logs continuously").onions([N,K,Y,b,Y,J0,v7]),R.command("tunnel").description("Open a local TCP tunnel to a database").argument("<database>").option("--port <port>","Local TCP port",lA).option("--host <host>","Local bind host").onions([N,K,Y,b,Y,J0,d7]),R.command("list").alias("ls").description("List databases").onions([N,K,Y,b,Y,r6]),R.command("inspect").alias("get").description("Inspect one database").argument("<database>").onions([N,K,Y,b,Y,J0,u7]),R.command("create").description("Create a database").argument("<name>").option("--engine <engine>","Database engine",_D(["mysql","postgres","redis"])).option("--plan <name>","Plan name").option("--bundle <name>","Bundle name").option("--password <password>","Primary database password").option("--public-access","Enable public database access").option("--version <version>","Database engine version").option("--config <text>","Additional config overrides text").onions([N,K,Y,b,Y,y7]),R.command("update").description("Update a database").argument("<database>").option("--config <text>","Additional config overrides text").option("--public-access","Enable public database access").option("--no-public-access","Disable public database access").onions([N,K,Y,b,Y,J0,g7]),R.command("resize").description("Resize a database plan or bundle").argument("<database>").option("--plan <name>","Plan name").option("--bundle <name>","Bundle name").onions([N,K,Y,b,Y,J0,m7]),R.command("delete").alias("rm").description("Delete a database").argument("<database>").onions([N,K,Y,b,Y,J0,x7]),R.command("start").description("Start a database").argument("<database>").onions([N,K,Y,b,Y,J0,n7]),R.command("stop").description("Stop a database").argument("<database>").onions([N,K,Y,b,Y,J0,p7]),R.command("metrics").description("Get current database metrics").argument("<database>").onions([N,K,Y,b,Y,J0,h7]),R.command("plan").description("Manage database plans").onions([D0]).command("inspect").alias("get").description("Inspect one database plan").argument("<plan>").onions([N,K,Y,b7]),R.command("engine").description("List available database engines and versions").onions([D0]).command("list").alias("ls").description("List database engines").onions([N,K,Y,S7]);let f=R.command("bundle").description("Manage database bundles").onions([D0]);f.command("list").alias("ls").description("List database bundles for a plan").option("--plan <name>","Plan name").onions([N,K,Y,W7]),f.command("inspect").alias("get").description("Inspect one database bundle").argument("<bundle>").option("--plan <name>","Plan name").onions([N,K,Y,j7]);let P=R.command("backup").description("Manage database backups").onions([D0]);P.command("list").alias("ls").description("List database backups").argument("<database>").onions([N,K,Y,b,Y,J0,C7]),P.command("inspect").alias("get").description("Inspect one database backup").argument("<database>").argument("<backup>").onions([N,K,Y,b,Y,J0,w7,L7]),P.command("create").description("Create a database backup").argument("<database>").onions([N,K,Y,b,Y,J0,N7])}var i7=_(async(D)=>{let R=(await D.client.api.projectsList()).map((A)=>({...A,current:D.state.currentProjectByAuthId[D.auth.id]===String(A.id)}));if(C(D.options)){W(R,!0);return}s([{header:"Current",width:7,render:(A)=>A.current?"*":""},{header:"Name",width:22,render:(A)=>A.name??""},{header:"Slug",width:22,render:(A)=>A.slug??""},{header:"Status",width:12,render:(A)=>A.status??""},{header:"Age",width:6,render:(A)=>H0(A.createdAt)},{header:"ID",width:8,render:(A)=>String(A.id)}],R)}),a7=_(async(D)=>{let R=(await D.client.api.projectsList()).find((A)=>_R(A,D.args.project));if(!R)D.abort(`Project not found: ${D.args.project}`);D.state.currentProjectByAuthId[D.auth.id]=String(R.id),await p0(D.state),console.log(`Current project: ${R.name} (${R.slug}, #${R.id})`)}),r7=_(async(D)=>{let R={id:D.project.id,name:D.project.name,slug:D.project.slug,status:D.project.status};if(C(D.options)){W(R,!0);return}o0(R)});function s7(D){let R=D.command("project").description("Manage current project context").onions([D0]);R.command("list").alias("ls").description("List available projects").onions([N,K,Y,i7]),R.command("use").description("Switch current project").argument("<project>","Project ID, slug, or name").onions([N,K,Y,a7]),R.command("current").description("Show current project").onions([N,K,Y,b,r7])}var s6=_(async(D,R)=>{let f=((await D.client.api.authApiTokensList({})).items??[]).find((P)=>I4(P,D.args.token));if(!f)D.abort(`Token not found: ${D.args.token}`);D.tokenInfo=f,await R()}),o7=_(async(D)=>{let[R,A]=await Promise.all([D.client.api.authApiTokensList({}),D.client.api.projectsList()]),$=R.items??[];if(!D.options.includeRevoked)$=$.filter((P)=>!P.revokedAt);let f=new Map(A.map((P)=>[P.id,P.name]));if(C(D.options)){W($,!0);return}V2($,{projectLabel:(P)=>f.get(P)??`#${P}`})}),c7=_(async(D)=>{let R=await D.client.api.projectsList(),A=D.tokenInfo,$=new Map(R.map((f)=>[f.id,f.name]));if(C(D.options)){W(A,!0);return}nA(A,{projectLabel:(f)=>$.get(f)??`#${f}`})}),t7=_(async(D)=>{let R=fN(D.options.expire),A=await D.client.api.authApiTokensCreate({name:D.args.name,expiresAt:R});if(C(D.options)){W(A,!0);return}nA(A,{plaintextToken:A.token})}),e7=_(async(D)=>{if(await D.client.api.authApiTokensDelete({tokenId:D.tokenInfo.id}),C(D.options)){W({revoked:!0,id:D.tokenInfo.id,name:D.tokenInfo.name},!0);return}console.log(`Removed token ${D.tokenInfo.name}`)});function fN(D){if(!D||D==="never")return;let R=/^(\d+)([smhdw])$/i.exec(D.trim());if(R){let $=Number(R[1]),f=R[2].toLowerCase(),P=f==="s"?1000:f==="m"?60000:f==="h"?3600000:f==="d"?86400000:604800000;return new Date(Date.now()+$*P).toISOString()}let A=new Date(D);if(Number.isFinite(A.getTime()))return A.toISOString();throw Error("Invalid expiry. Use values like 30d, 12h, 7d, never, or an ISO timestamp.")}function DJ(D){let R=D.command("token").description("Manage personal access tokens").onions([D0]);R.command("list").alias("ls").description("List tokens").option("--include-revoked","Include revoked tokens").onions([N,K,Y,o7]),R.command("get").description("Get one token").argument("<token>").onions([N,K,Y,s6,c7]),R.command("create").description("Create a token").argument("<name>").option("--for-project <project>","Project name or id to grant").option("--role <role>","Token role",_D(["read","deploy","admin","billing"])).option("--expire <value>","Expiry like 30d, 12h, never, or an ISO timestamp").onions([N,K,Y,b,t7]),R.command("remove").alias("rm").description("Remove a token").argument("<token>").onions([N,K,Y,s6,e7])}var ZR=new vA().name("abrun").description("CLI for managing apps on the abrun platform").option("--endpoint <url>","API endpoint").option("--auth <auth>","Override current auth").option("--project <project>","Override current project").option("--token <token>","Override bearer token").option("-o, --output <format>","Output format: table, json, yaml",Y9).option("--json","Render raw JSON").option("--no-color","Disable colored output").option("--debug","Print debug information");q7(ZR);s7(ZR);DJ(ZR);M7(ZR);k7(ZR);ZR.parse(process.argv.length>2?process.argv:[...process.argv,"--help"]);
|