@hippo-memo/cli 1.0.1 → 1.0.3

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/dist/index.js CHANGED
@@ -1,76 +1,172 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as ZJ}from"node:module";var tY=Object.create;var{getPrototypeOf:fJ,defineProperty:i1,getOwnPropertyNames:$J}=Object;var MJ=Object.prototype.hasOwnProperty;function YJ(f){return this[f]}var JJ,zJ,Q0=(f,$,M)=>{var Y=f!=null&&typeof f==="object";if(Y){var J=$?JJ??=new WeakMap:zJ??=new WeakMap,z=J.get(f);if(z)return z}M=f!=null?tY(fJ(f)):{};let Z=$||!f||!f.__esModule?i1(M,"default",{value:f,enumerable:!0}):M;for(let X of $J(f))if(!MJ.call(Z,X))i1(Z,X,{get:YJ.bind(f,X),enumerable:!0});if(Y)J.set(f,Z);return Z};var S=(f,$)=>()=>($||f(($={exports:{}}).exports,$),$.exports);var e=ZJ(import.meta.url);var lf=S((XJ)=>{class p0 extends Error{constructor(f,$,M){super(M);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=$,this.exitCode=f,this.nestedError=void 0}}class o1 extends p0{constructor(f){super(1,"commander.invalidArgument",f);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}XJ.CommanderError=p0;XJ.InvalidArgumentError=o1});var D0=S((WJ)=>{var{InvalidArgumentError:QJ}=lf();class s1{constructor(f,$){switch(this.description=$||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,f[0]){case"<":this.required=!0,this._name=f.slice(1,-1);break;case"[":this.required=!1,this._name=f.slice(1,-1);break;default:this.required=!0,this._name=f;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue(f,$){if($===this.defaultValue||!Array.isArray($))return[f];return $.concat(f)}default(f,$){return this.defaultValue=f,this.defaultValueDescription=$,this}argParser(f){return this.parseArg=f,this}choices(f){return this.argChoices=f.slice(),this.parseArg=($,M)=>{if(!this.argChoices.includes($))throw new QJ(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue($,M);return $},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function DJ(f){let $=f.name()+(f.variadic===!0?"...":"");return f.required?"<"+$+">":"["+$+"]"}WJ.Argument=s1;WJ.humanReadableArgName=DJ});var l0=S((BJ)=>{var{humanReadableArgName:KJ}=D0();class a1{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(f){let $=f.commands.filter((Y)=>!Y._hidden),M=f._getHelpCommand();if(M&&!M._hidden)$.push(M);if(this.sortSubcommands)$.sort((Y,J)=>{return Y.name().localeCompare(J.name())});return $}compareOptions(f,$){let M=(Y)=>{return Y.short?Y.short.replace(/^-/,""):Y.long.replace(/^--/,"")};return M(f).localeCompare(M($))}visibleOptions(f){let $=f.options.filter((Y)=>!Y.hidden),M=f._getHelpOption();if(M&&!M.hidden){let Y=M.short&&f._findOption(M.short),J=M.long&&f._findOption(M.long);if(!Y&&!J)$.push(M);else if(M.long&&!J)$.push(f.createOption(M.long,M.description));else if(M.short&&!Y)$.push(f.createOption(M.short,M.description))}if(this.sortOptions)$.sort(this.compareOptions);return $}visibleGlobalOptions(f){if(!this.showGlobalOptions)return[];let $=[];for(let M=f.parent;M;M=M.parent){let Y=M.options.filter((J)=>!J.hidden);$.push(...Y)}if(this.sortOptions)$.sort(this.compareOptions);return $}visibleArguments(f){if(f._argsDescription)f.registeredArguments.forEach(($)=>{$.description=$.description||f._argsDescription[$.name()]||""});if(f.registeredArguments.find(($)=>$.description))return f.registeredArguments;return[]}subcommandTerm(f){let $=f.registeredArguments.map((M)=>KJ(M)).join(" ");return f._name+(f._aliases[0]?"|"+f._aliases[0]:"")+(f.options.length?" [options]":"")+($?" "+$:"")}optionTerm(f){return f.flags}argumentTerm(f){return f.name()}longestSubcommandTermLength(f,$){return $.visibleCommands(f).reduce((M,Y)=>{return Math.max(M,$.subcommandTerm(Y).length)},0)}longestOptionTermLength(f,$){return $.visibleOptions(f).reduce((M,Y)=>{return Math.max(M,$.optionTerm(Y).length)},0)}longestGlobalOptionTermLength(f,$){return $.visibleGlobalOptions(f).reduce((M,Y)=>{return Math.max(M,$.optionTerm(Y).length)},0)}longestArgumentTermLength(f,$){return $.visibleArguments(f).reduce((M,Y)=>{return Math.max(M,$.argumentTerm(Y).length)},0)}commandUsage(f){let $=f._name;if(f._aliases[0])$=$+"|"+f._aliases[0];let M="";for(let Y=f.parent;Y;Y=Y.parent)M=Y.name()+" "+M;return M+$+" "+f.usage()}commandDescription(f){return f.description()}subcommandDescription(f){return f.summary()||f.description()}optionDescription(f){let $=[];if(f.argChoices)$.push(`choices: ${f.argChoices.map((M)=>JSON.stringify(M)).join(", ")}`);if(f.defaultValue!==void 0){if(f.required||f.optional||f.isBoolean()&&typeof f.defaultValue==="boolean")$.push(`default: ${f.defaultValueDescription||JSON.stringify(f.defaultValue)}`)}if(f.presetArg!==void 0&&f.optional)$.push(`preset: ${JSON.stringify(f.presetArg)}`);if(f.envVar!==void 0)$.push(`env: ${f.envVar}`);if($.length>0)return`${f.description} (${$.join(", ")})`;return f.description}argumentDescription(f){let $=[];if(f.argChoices)$.push(`choices: ${f.argChoices.map((M)=>JSON.stringify(M)).join(", ")}`);if(f.defaultValue!==void 0)$.push(`default: ${f.defaultValueDescription||JSON.stringify(f.defaultValue)}`);if($.length>0){let M=`(${$.join(", ")})`;if(f.description)return`${f.description} ${M}`;return M}return f.description}formatHelp(f,$){let M=$.padWidth(f,$),Y=$.helpWidth||80,J=2,z=2;function Z(W,H){if(H){let R=`${W.padEnd(M+2)}${H}`;return $.wrap(R,Y-2,M+2)}return W}function X(W){return W.join(`
3
- `).replace(/^/gm," ".repeat(2))}let G=[`Usage: ${$.commandUsage(f)}`,""],q=$.commandDescription(f);if(q.length>0)G=G.concat([$.wrap(q,Y,0),""]);let Q=$.visibleArguments(f).map((W)=>{return Z($.argumentTerm(W),$.argumentDescription(W))});if(Q.length>0)G=G.concat(["Arguments:",X(Q),""]);let D=$.visibleOptions(f).map((W)=>{return Z($.optionTerm(W),$.optionDescription(W))});if(D.length>0)G=G.concat(["Options:",X(D),""]);if(this.showGlobalOptions){let W=$.visibleGlobalOptions(f).map((H)=>{return Z($.optionTerm(H),$.optionDescription(H))});if(W.length>0)G=G.concat(["Global Options:",X(W),""])}let V=$.visibleCommands(f).map((W)=>{return Z($.subcommandTerm(W),$.subcommandDescription(W))});if(V.length>0)G=G.concat(["Commands:",X(V),""]);return G.join(`
4
- `)}padWidth(f,$){return Math.max($.longestOptionTermLength(f,$),$.longestGlobalOptionTermLength(f,$),$.longestSubcommandTermLength(f,$),$.longestArgumentTermLength(f,$))}wrap(f,$,M,Y=40){let z=new RegExp(`[\\n][${" \\f\\t\\v   -    \uFEFF"}]+`);if(f.match(z))return f;let Z=$-M;if(Z<Y)return f;let X=f.slice(0,M),G=f.slice(M).replace(`\r
2
+ import{createRequire as W8}from"node:module";var z8=Object.create;var{getPrototypeOf:Z8,defineProperty:b2,getOwnPropertyNames:X8}=Object;var Q8=Object.prototype.hasOwnProperty;function D8(f){return this[f]}var G8,U8,w0=(f,$,M)=>{var Y=f!=null&&typeof f==="object";if(Y){var J=$?G8??=new WeakMap:U8??=new WeakMap,z=J.get(f);if(z)return z}M=f!=null?z8(Z8(f)):{};let Z=$||!f||!f.__esModule?b2(M,"default",{value:f,enumerable:!0}):M;for(let X of X8(f))if(!Q8.call(Z,X))b2(Z,X,{get:D8.bind(f,X),enumerable:!0});if(Y)J.set(f,Z);return Z};var V=(f,$)=>()=>($||f(($={exports:{}}).exports,$),$.exports);var o=W8(import.meta.url);var j0=V((K8)=>{class z$ extends Error{constructor(f,$,M){super(M);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=$,this.exitCode=f,this.nestedError=void 0}}class _2 extends z${constructor(f){super(1,"commander.invalidArgument",f);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}K8.CommanderError=z$;K8.InvalidArgumentError=_2});var Zf=V((S8)=>{var{InvalidArgumentError:B8}=j0();class v2{constructor(f,$){switch(this.description=$||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,f[0]){case"<":this.required=!0,this._name=f.slice(1,-1);break;case"[":this.required=!1,this._name=f.slice(1,-1);break;default:this.required=!0,this._name=f;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue(f,$){if($===this.defaultValue||!Array.isArray($))return[f];return $.concat(f)}default(f,$){return this.defaultValue=f,this.defaultValueDescription=$,this}argParser(f){return this.parseArg=f,this}choices(f){return this.argChoices=f.slice(),this.parseArg=($,M)=>{if(!this.argChoices.includes($))throw new B8(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue($,M);return $},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function H8(f){let $=f.name()+(f.variadic===!0?"...":"");return f.required?"<"+$+">":"["+$+"]"}S8.Argument=v2;S8.humanReadableArgName=H8});var Z$=V((O8)=>{var{humanReadableArgName:N8}=Zf();class u2{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(f){let $=f.commands.filter((Y)=>!Y._hidden),M=f._getHelpCommand();if(M&&!M._hidden)$.push(M);if(this.sortSubcommands)$.sort((Y,J)=>{return Y.name().localeCompare(J.name())});return $}compareOptions(f,$){let M=(Y)=>{return Y.short?Y.short.replace(/^-/,""):Y.long.replace(/^--/,"")};return M(f).localeCompare(M($))}visibleOptions(f){let $=f.options.filter((Y)=>!Y.hidden),M=f._getHelpOption();if(M&&!M.hidden){let Y=M.short&&f._findOption(M.short),J=M.long&&f._findOption(M.long);if(!Y&&!J)$.push(M);else if(M.long&&!J)$.push(f.createOption(M.long,M.description));else if(M.short&&!Y)$.push(f.createOption(M.short,M.description))}if(this.sortOptions)$.sort(this.compareOptions);return $}visibleGlobalOptions(f){if(!this.showGlobalOptions)return[];let $=[];for(let M=f.parent;M;M=M.parent){let Y=M.options.filter((J)=>!J.hidden);$.push(...Y)}if(this.sortOptions)$.sort(this.compareOptions);return $}visibleArguments(f){if(f._argsDescription)f.registeredArguments.forEach(($)=>{$.description=$.description||f._argsDescription[$.name()]||""});if(f.registeredArguments.find(($)=>$.description))return f.registeredArguments;return[]}subcommandTerm(f){let $=f.registeredArguments.map((M)=>N8(M)).join(" ");return f._name+(f._aliases[0]?"|"+f._aliases[0]:"")+(f.options.length?" [options]":"")+($?" "+$:"")}optionTerm(f){return f.flags}argumentTerm(f){return f.name()}longestSubcommandTermLength(f,$){return $.visibleCommands(f).reduce((M,Y)=>{return Math.max(M,$.subcommandTerm(Y).length)},0)}longestOptionTermLength(f,$){return $.visibleOptions(f).reduce((M,Y)=>{return Math.max(M,$.optionTerm(Y).length)},0)}longestGlobalOptionTermLength(f,$){return $.visibleGlobalOptions(f).reduce((M,Y)=>{return Math.max(M,$.optionTerm(Y).length)},0)}longestArgumentTermLength(f,$){return $.visibleArguments(f).reduce((M,Y)=>{return Math.max(M,$.argumentTerm(Y).length)},0)}commandUsage(f){let $=f._name;if(f._aliases[0])$=$+"|"+f._aliases[0];let M="";for(let Y=f.parent;Y;Y=Y.parent)M=Y.name()+" "+M;return M+$+" "+f.usage()}commandDescription(f){return f.description()}subcommandDescription(f){return f.summary()||f.description()}optionDescription(f){let $=[];if(f.argChoices)$.push(`choices: ${f.argChoices.map((M)=>JSON.stringify(M)).join(", ")}`);if(f.defaultValue!==void 0){if(f.required||f.optional||f.isBoolean()&&typeof f.defaultValue==="boolean")$.push(`default: ${f.defaultValueDescription||JSON.stringify(f.defaultValue)}`)}if(f.presetArg!==void 0&&f.optional)$.push(`preset: ${JSON.stringify(f.presetArg)}`);if(f.envVar!==void 0)$.push(`env: ${f.envVar}`);if($.length>0)return`${f.description} (${$.join(", ")})`;return f.description}argumentDescription(f){let $=[];if(f.argChoices)$.push(`choices: ${f.argChoices.map((M)=>JSON.stringify(M)).join(", ")}`);if(f.defaultValue!==void 0)$.push(`default: ${f.defaultValueDescription||JSON.stringify(f.defaultValue)}`);if($.length>0){let M=`(${$.join(", ")})`;if(f.description)return`${f.description} ${M}`;return M}return f.description}formatHelp(f,$){let M=$.padWidth(f,$),Y=$.helpWidth||80,J=2,z=2;function Z(W,B){if(B){let O=`${W.padEnd(M+2)}${B}`;return $.wrap(O,Y-2,M+2)}return W}function X(W){return W.join(`
3
+ `).replace(/^/gm," ".repeat(2))}let Q=[`Usage: ${$.commandUsage(f)}`,""],D=$.commandDescription(f);if(D.length>0)Q=Q.concat([$.wrap(D,Y,0),""]);let G=$.visibleArguments(f).map((W)=>{return Z($.argumentTerm(W),$.argumentDescription(W))});if(G.length>0)Q=Q.concat(["Arguments:",X(G),""]);let U=$.visibleOptions(f).map((W)=>{return Z($.optionTerm(W),$.optionDescription(W))});if(U.length>0)Q=Q.concat(["Options:",X(U),""]);if(this.showGlobalOptions){let W=$.visibleGlobalOptions(f).map((B)=>{return Z($.optionTerm(B),$.optionDescription(B))});if(W.length>0)Q=Q.concat(["Global Options:",X(W),""])}let K=$.visibleCommands(f).map((W)=>{return Z($.subcommandTerm(W),$.subcommandDescription(W))});if(K.length>0)Q=Q.concat(["Commands:",X(K),""]);return Q.join(`
4
+ `)}padWidth(f,$){return Math.max($.longestOptionTermLength(f,$),$.longestGlobalOptionTermLength(f,$),$.longestSubcommandTermLength(f,$),$.longestArgumentTermLength(f,$))}wrap(f,$,M,Y=40){let z=new RegExp(`[\\n][${" \\f\\t\\v   -    \uFEFF"}]+`);if(f.match(z))return f;let Z=$-M;if(Z<Y)return f;let X=f.slice(0,M),Q=f.slice(M).replace(`\r
5
5
  `,`
6
- `),q=" ".repeat(M),D=`\\s${"​"}`,V=new RegExp(`
7
- |.{1,${Z-1}}([${D}]|$)|[^${D}]+?([${D}]|$)`,"g"),W=G.match(V)||[];return X+W.map((H,R)=>{if(H===`
8
- `)return"";return(R>0?q:"")+H.trimEnd()}).join(`
9
- `)}}BJ.Help=a1});var d0=S((PJ)=>{var{InvalidArgumentError:yJ}=lf();class e1{constructor(f,$){this.flags=f,this.description=$||"",this.required=f.includes("<"),this.optional=f.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(f),this.mandatory=!1;let M=FJ(f);if(this.short=M.shortFlag,this.long=M.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}default(f,$){return this.defaultValue=f,this.defaultValueDescription=$,this}preset(f){return this.presetArg=f,this}conflicts(f){return this.conflictsWith=this.conflictsWith.concat(f),this}implies(f){let $=f;if(typeof f==="string")$={[f]:!0};return this.implied=Object.assign(this.implied||{},$),this}env(f){return this.envVar=f,this}argParser(f){return this.parseArg=f,this}makeOptionMandatory(f=!0){return this.mandatory=!!f,this}hideHelp(f=!0){return this.hidden=!!f,this}_concatValue(f,$){if($===this.defaultValue||!Array.isArray($))return[f];return $.concat(f)}choices(f){return this.argChoices=f.slice(),this.parseArg=($,M)=>{if(!this.argChoices.includes($))throw new yJ(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue($,M);return $},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return SJ(this.name().replace(/^no-/,""))}is(f){return this.short===f||this.long===f}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class t1{constructor(f){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,f.forEach(($)=>{if($.negate)this.negativeOptions.set($.attributeName(),$);else this.positiveOptions.set($.attributeName(),$)}),this.negativeOptions.forEach(($,M)=>{if(this.positiveOptions.has(M))this.dualOptions.add(M)})}valueFromOption(f,$){let M=$.attributeName();if(!this.dualOptions.has(M))return!0;let Y=this.negativeOptions.get(M).presetArg,J=Y!==void 0?Y:!1;return $.negate===(J===f)}}function SJ(f){return f.split("-").reduce(($,M)=>{return $+M[0].toUpperCase()+M.slice(1)})}function FJ(f){let $,M,Y=f.split(/[ |,]+/);if(Y.length>1&&!/^[[<]/.test(Y[1]))$=Y.shift();if(M=Y.shift(),!$&&/^-[^-]$/.test(M))$=M,M=void 0;return{shortFlag:$,longFlag:M}}PJ.Option=e1;PJ.DualOptions=t1});var f$=S((LJ)=>{function jJ(f,$){if(Math.abs(f.length-$.length)>3)return Math.max(f.length,$.length);let M=[];for(let Y=0;Y<=f.length;Y++)M[Y]=[Y];for(let Y=0;Y<=$.length;Y++)M[0][Y]=Y;for(let Y=1;Y<=$.length;Y++)for(let J=1;J<=f.length;J++){let z=1;if(f[J-1]===$[Y-1])z=0;else z=1;if(M[J][Y]=Math.min(M[J-1][Y]+1,M[J][Y-1]+1,M[J-1][Y-1]+z),J>1&&Y>1&&f[J-1]===$[Y-2]&&f[J-2]===$[Y-1])M[J][Y]=Math.min(M[J][Y],M[J-2][Y-2]+1)}return M[f.length][$.length]}function RJ(f,$){if(!$||$.length===0)return"";$=Array.from(new Set($));let M=f.startsWith("--");if(M)f=f.slice(2),$=$.map((Z)=>Z.slice(2));let Y=[],J=3,z=0.4;if($.forEach((Z)=>{if(Z.length<=1)return;let X=jJ(f,Z),G=Math.max(f.length,Z.length);if((G-X)/G>z){if(X<J)J=X,Y=[Z];else if(X===J)Y.push(Z)}}),Y.sort((Z,X)=>Z.localeCompare(X)),M)Y=Y.map((Z)=>`--${Z}`);if(Y.length>1)return`
6
+ `),D=" ".repeat(M),U=`\\s${"​"}`,K=new RegExp(`
7
+ |.{1,${Z-1}}([${U}]|$)|[^${U}]+?([${U}]|$)`,"g"),W=Q.match(K)||[];return X+W.map((B,O)=>{if(B===`
8
+ `)return"";return(O>0?D:"")+B.trimEnd()}).join(`
9
+ `)}}O8.Help=u2});var X$=V((w8)=>{var{InvalidArgumentError:L8}=j0();class h2{constructor(f,$){this.flags=f,this.description=$||"",this.required=f.includes("<"),this.optional=f.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(f),this.mandatory=!1;let M=T8(f);if(this.short=M.shortFlag,this.long=M.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}default(f,$){return this.defaultValue=f,this.defaultValueDescription=$,this}preset(f){return this.presetArg=f,this}conflicts(f){return this.conflictsWith=this.conflictsWith.concat(f),this}implies(f){let $=f;if(typeof f==="string")$={[f]:!0};return this.implied=Object.assign(this.implied||{},$),this}env(f){return this.envVar=f,this}argParser(f){return this.parseArg=f,this}makeOptionMandatory(f=!0){return this.mandatory=!!f,this}hideHelp(f=!0){return this.hidden=!!f,this}_concatValue(f,$){if($===this.defaultValue||!Array.isArray($))return[f];return $.concat(f)}choices(f){return this.argChoices=f.slice(),this.parseArg=($,M)=>{if(!this.argChoices.includes($))throw new L8(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue($,M);return $},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return P8(this.name().replace(/^no-/,""))}is(f){return this.short===f||this.long===f}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class g2{constructor(f){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,f.forEach(($)=>{if($.negate)this.negativeOptions.set($.attributeName(),$);else this.positiveOptions.set($.attributeName(),$)}),this.negativeOptions.forEach(($,M)=>{if(this.positiveOptions.has(M))this.dualOptions.add(M)})}valueFromOption(f,$){let M=$.attributeName();if(!this.dualOptions.has(M))return!0;let Y=this.negativeOptions.get(M).presetArg,J=Y!==void 0?Y:!1;return $.negate===(J===f)}}function P8(f){return f.split("-").reduce(($,M)=>{return $+M[0].toUpperCase()+M.slice(1)})}function T8(f){let $,M,Y=f.split(/[ |,]+/);if(Y.length>1&&!/^[[<]/.test(Y[1]))$=Y.shift();if(M=Y.shift(),!$&&/^-[^-]$/.test(M))$=M,M=void 0;return{shortFlag:$,longFlag:M}}w8.Option=h2;w8.DualOptions=g2});var c2=V((x8)=>{function C8(f,$){if(Math.abs(f.length-$.length)>3)return Math.max(f.length,$.length);let M=[];for(let Y=0;Y<=f.length;Y++)M[Y]=[Y];for(let Y=0;Y<=$.length;Y++)M[0][Y]=Y;for(let Y=1;Y<=$.length;Y++)for(let J=1;J<=f.length;J++){let z=1;if(f[J-1]===$[Y-1])z=0;else z=1;if(M[J][Y]=Math.min(M[J-1][Y]+1,M[J][Y-1]+1,M[J-1][Y-1]+z),J>1&&Y>1&&f[J-1]===$[Y-2]&&f[J-2]===$[Y-1])M[J][Y]=Math.min(M[J][Y],M[J-2][Y-2]+1)}return M[f.length][$.length]}function E8(f,$){if(!$||$.length===0)return"";$=Array.from(new Set($));let M=f.startsWith("--");if(M)f=f.slice(2),$=$.map((Z)=>Z.slice(2));let Y=[],J=3,z=0.4;if($.forEach((Z)=>{if(Z.length<=1)return;let X=C8(f,Z),Q=Math.max(f.length,Z.length);if((Q-X)/Q>z){if(X<J)J=X,Y=[Z];else if(X===J)Y.push(Z)}}),Y.sort((Z,X)=>Z.localeCompare(X)),M)Y=Y.map((Z)=>`--${Z}`);if(Y.length>1)return`
10
10
  (Did you mean one of ${Y.join(", ")}?)`;if(Y.length===1)return`
11
- (Did you mean ${Y[0]}?)`;return""}LJ.suggestSimilar=RJ});var J$=S((CJ)=>{var NJ=e("node:events").EventEmitter,n0=e("node:child_process"),Yf=e("node:path"),i0=e("node:fs"),x=e("node:process"),{Argument:OJ,humanReadableArgName:xJ}=D0(),{CommanderError:o0}=lf(),{Help:IJ}=l0(),{Option:$$,DualOptions:kJ}=d0(),{suggestSimilar:M$}=f$();class s0 extends NJ{constructor(f){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=f||"",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._outputConfiguration={writeOut:($)=>x.stdout.write($),writeErr:($)=>x.stderr.write($),getOutHelpWidth:()=>x.stdout.isTTY?x.stdout.columns:void 0,getErrHelpWidth:()=>x.stderr.isTTY?x.stderr.columns:void 0,outputError:($,M)=>M($)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(f){return this._outputConfiguration=f._outputConfiguration,this._helpOption=f._helpOption,this._helpCommand=f._helpCommand,this._helpConfiguration=f._helpConfiguration,this._exitCallback=f._exitCallback,this._storeOptionsAsProperties=f._storeOptionsAsProperties,this._combineFlagAndOptionalValue=f._combineFlagAndOptionalValue,this._allowExcessArguments=f._allowExcessArguments,this._enablePositionalOptions=f._enablePositionalOptions,this._showHelpAfterError=f._showHelpAfterError,this._showSuggestionAfterError=f._showSuggestionAfterError,this}_getCommandAndAncestors(){let f=[];for(let $=this;$;$=$.parent)f.push($);return f}command(f,$,M){let Y=$,J=M;if(typeof Y==="object"&&Y!==null)J=Y,Y=null;J=J||{};let[,z,Z]=f.match(/([^ ]+) *(.*)/),X=this.createCommand(z);if(Y)X.description(Y),X._executableHandler=!0;if(J.isDefault)this._defaultCommandName=X._name;if(X._hidden=!!(J.noHelp||J.hidden),X._executableFile=J.executableFile||null,Z)X.arguments(Z);if(this._registerCommand(X),X.parent=this,X.copyInheritedSettings(this),Y)return this;return X}createCommand(f){return new s0(f)}createHelp(){return Object.assign(new IJ,this.configureHelp())}configureHelp(f){if(f===void 0)return this._helpConfiguration;return this._helpConfiguration=f,this}configureOutput(f){if(f===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,f),this}showHelpAfterError(f=!0){if(typeof f!=="string")f=!!f;return this._showHelpAfterError=f,this}showSuggestionAfterError(f=!0){return this._showSuggestionAfterError=!!f,this}addCommand(f,$){if(!f._name)throw Error(`Command passed to .addCommand() must have a name
12
- - specify the name in Command constructor or using .name()`);if($=$||{},$.isDefault)this._defaultCommandName=f._name;if($.noHelp||$.hidden)f._hidden=!0;return this._registerCommand(f),f.parent=this,f._checkForBrokenPassThrough(),this}createArgument(f,$){return new OJ(f,$)}argument(f,$,M,Y){let J=this.createArgument(f,$);if(typeof M==="function")J.default(Y).argParser(M);else J.default(M);return this.addArgument(J),this}arguments(f){return f.trim().split(/ +/).forEach(($)=>{this.argument($)}),this}addArgument(f){let $=this.registeredArguments.slice(-1)[0];if($&&$.variadic)throw Error(`only the last argument can be variadic '${$.name()}'`);if(f.required&&f.defaultValue!==void 0&&f.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${f.name()}'`);return this.registeredArguments.push(f),this}helpCommand(f,$){if(typeof f==="boolean")return this._addImplicitHelpCommand=f,this;f=f??"help [command]";let[,M,Y]=f.match(/([^ ]+) *(.*)/),J=$??"display help for command",z=this.createCommand(M);if(z.helpOption(!1),Y)z.arguments(Y);if(J)z.description(J);return this._addImplicitHelpCommand=!0,this._helpCommand=z,this}addHelpCommand(f,$){if(typeof f!=="object")return this.helpCommand(f,$),this;return this._addImplicitHelpCommand=!0,this._helpCommand=f,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(f,$){let M=["preSubcommand","preAction","postAction"];if(!M.includes(f))throw Error(`Unexpected value for event passed to hook : '${f}'.
13
- Expecting one of '${M.join("', '")}'`);if(this._lifeCycleHooks[f])this._lifeCycleHooks[f].push($);else this._lifeCycleHooks[f]=[$];return this}exitOverride(f){if(f)this._exitCallback=f;else this._exitCallback=($)=>{if($.code!=="commander.executeSubCommandAsync")throw $};return this}_exit(f,$,M){if(this._exitCallback)this._exitCallback(new o0(f,$,M));x.exit(f)}action(f){let $=(M)=>{let Y=this.registeredArguments.length,J=M.slice(0,Y);if(this._storeOptionsAsProperties)J[Y]=this;else J[Y]=this.opts();return J.push(this),f.apply(this,J)};return this._actionHandler=$,this}createOption(f,$){return new $$(f,$)}_callParseArg(f,$,M,Y){try{return f.parseArg($,M)}catch(J){if(J.code==="commander.invalidArgument"){let z=`${Y} ${J.message}`;this.error(z,{exitCode:J.exitCode,code:J.code})}throw J}}_registerOption(f){let $=f.short&&this._findOption(f.short)||f.long&&this._findOption(f.long);if($){let M=f.long&&this._findOption(f.long)?f.long:f.short;throw Error(`Cannot add option '${f.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${M}'
14
- - already used by option '${$.flags}'`)}this.options.push(f)}_registerCommand(f){let $=(Y)=>{return[Y.name()].concat(Y.aliases())},M=$(f).find((Y)=>this._findCommand(Y));if(M){let Y=$(this._findCommand(M)).join("|"),J=$(f).join("|");throw Error(`cannot add command '${J}' as already have command '${Y}'`)}this.commands.push(f)}addOption(f){this._registerOption(f);let $=f.name(),M=f.attributeName();if(f.negate){let J=f.long.replace(/^--no-/,"--");if(!this._findOption(J))this.setOptionValueWithSource(M,f.defaultValue===void 0?!0:f.defaultValue,"default")}else if(f.defaultValue!==void 0)this.setOptionValueWithSource(M,f.defaultValue,"default");let Y=(J,z,Z)=>{if(J==null&&f.presetArg!==void 0)J=f.presetArg;let X=this.getOptionValue(M);if(J!==null&&f.parseArg)J=this._callParseArg(f,J,X,z);else if(J!==null&&f.variadic)J=f._concatValue(J,X);if(J==null)if(f.negate)J=!1;else if(f.isBoolean()||f.optional)J=!0;else J="";this.setOptionValueWithSource(M,J,Z)};if(this.on("option:"+$,(J)=>{let z=`error: option '${f.flags}' argument '${J}' is invalid.`;Y(J,z,"cli")}),f.envVar)this.on("optionEnv:"+$,(J)=>{let z=`error: option '${f.flags}' value '${J}' from env '${f.envVar}' is invalid.`;Y(J,z,"env")});return this}_optionEx(f,$,M,Y,J){if(typeof $==="object"&&$ instanceof $$)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let z=this.createOption($,M);if(z.makeOptionMandatory(!!f.mandatory),typeof Y==="function")z.default(J).argParser(Y);else if(Y instanceof RegExp){let Z=Y;Y=(X,G)=>{let q=Z.exec(X);return q?q[0]:G},z.default(J).argParser(Y)}else z.default(Y);return this.addOption(z)}option(f,$,M,Y){return this._optionEx({},f,$,M,Y)}requiredOption(f,$,M,Y){return this._optionEx({mandatory:!0},f,$,M,Y)}combineFlagAndOptionalValue(f=!0){return this._combineFlagAndOptionalValue=!!f,this}allowUnknownOption(f=!0){return this._allowUnknownOption=!!f,this}allowExcessArguments(f=!0){return this._allowExcessArguments=!!f,this}enablePositionalOptions(f=!0){return this._enablePositionalOptions=!!f,this}passThroughOptions(f=!0){return this._passThroughOptions=!!f,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(f=!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=!!f,this}getOptionValue(f){if(this._storeOptionsAsProperties)return this[f];return this._optionValues[f]}setOptionValue(f,$){return this.setOptionValueWithSource(f,$,void 0)}setOptionValueWithSource(f,$,M){if(this._storeOptionsAsProperties)this[f]=$;else this._optionValues[f]=$;return this._optionValueSources[f]=M,this}getOptionValueSource(f){return this._optionValueSources[f]}getOptionValueSourceWithGlobals(f){let $;return this._getCommandAndAncestors().forEach((M)=>{if(M.getOptionValueSource(f)!==void 0)$=M.getOptionValueSource(f)}),$}_prepareUserArgs(f,$){if(f!==void 0&&!Array.isArray(f))throw Error("first parameter to parse must be array or undefined");if($=$||{},f===void 0&&$.from===void 0){if(x.versions?.electron)$.from="electron";let Y=x.execArgv??[];if(Y.includes("-e")||Y.includes("--eval")||Y.includes("-p")||Y.includes("--print"))$.from="eval"}if(f===void 0)f=x.argv;this.rawArgs=f.slice();let M;switch($.from){case void 0:case"node":this._scriptPath=f[1],M=f.slice(2);break;case"electron":if(x.defaultApp)this._scriptPath=f[1],M=f.slice(2);else M=f.slice(1);break;case"user":M=f.slice(0);break;case"eval":M=f.slice(1);break;default:throw Error(`unexpected parse option { from: '${$.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",M}parse(f,$){let M=this._prepareUserArgs(f,$);return this._parseCommand([],M),this}async parseAsync(f,$){let M=this._prepareUserArgs(f,$);return await this._parseCommand([],M),this}_executeSubCommand(f,$){$=$.slice();let M=!1,Y=[".js",".ts",".tsx",".mjs",".cjs"];function J(q,Q){let D=Yf.resolve(q,Q);if(i0.existsSync(D))return D;if(Y.includes(Yf.extname(Q)))return;let V=Y.find((W)=>i0.existsSync(`${D}${W}`));if(V)return`${D}${V}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let z=f._executableFile||`${this._name}-${f._name}`,Z=this._executableDir||"";if(this._scriptPath){let q;try{q=i0.realpathSync(this._scriptPath)}catch(Q){q=this._scriptPath}Z=Yf.resolve(Yf.dirname(q),Z)}if(Z){let q=J(Z,z);if(!q&&!f._executableFile&&this._scriptPath){let Q=Yf.basename(this._scriptPath,Yf.extname(this._scriptPath));if(Q!==this._name)q=J(Z,`${Q}-${f._name}`)}z=q||z}M=Y.includes(Yf.extname(z));let X;if(x.platform!=="win32")if(M)$.unshift(z),$=Y$(x.execArgv).concat($),X=n0.spawn(x.argv[0],$,{stdio:"inherit"});else X=n0.spawn(z,$,{stdio:"inherit"});else $.unshift(z),$=Y$(x.execArgv).concat($),X=n0.spawn(x.execPath,$,{stdio:"inherit"});if(!X.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((Q)=>{x.on(Q,()=>{if(X.killed===!1&&X.exitCode===null)X.kill(Q)})});let G=this._exitCallback;X.on("close",(q)=>{if(q=q??1,!G)x.exit(q);else G(new o0(q,"commander.executeSubCommandAsync","(close)"))}),X.on("error",(q)=>{if(q.code==="ENOENT"){let Q=Z?`searched for local subcommand relative to directory '${Z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",D=`'${z}' does not exist
11
+ (Did you mean ${Y[0]}?)`;return""}x8.suggestSimilar=E8});var n2=V((h8)=>{var k8=o("node:events").EventEmitter,Q$=o("node:child_process"),S1=o("node:path"),D$=o("node:fs"),k=o("node:process"),{Argument:b8,humanReadableArgName:_8}=Zf(),{CommanderError:G$}=j0(),{Help:v8}=Z$(),{Option:m2,DualOptions:u8}=X$(),{suggestSimilar:d2}=c2();class U$ extends k8{constructor(f){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=f||"",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._outputConfiguration={writeOut:($)=>k.stdout.write($),writeErr:($)=>k.stderr.write($),getOutHelpWidth:()=>k.stdout.isTTY?k.stdout.columns:void 0,getErrHelpWidth:()=>k.stderr.isTTY?k.stderr.columns:void 0,outputError:($,M)=>M($)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(f){return this._outputConfiguration=f._outputConfiguration,this._helpOption=f._helpOption,this._helpCommand=f._helpCommand,this._helpConfiguration=f._helpConfiguration,this._exitCallback=f._exitCallback,this._storeOptionsAsProperties=f._storeOptionsAsProperties,this._combineFlagAndOptionalValue=f._combineFlagAndOptionalValue,this._allowExcessArguments=f._allowExcessArguments,this._enablePositionalOptions=f._enablePositionalOptions,this._showHelpAfterError=f._showHelpAfterError,this._showSuggestionAfterError=f._showSuggestionAfterError,this}_getCommandAndAncestors(){let f=[];for(let $=this;$;$=$.parent)f.push($);return f}command(f,$,M){let Y=$,J=M;if(typeof Y==="object"&&Y!==null)J=Y,Y=null;J=J||{};let[,z,Z]=f.match(/([^ ]+) *(.*)/),X=this.createCommand(z);if(Y)X.description(Y),X._executableHandler=!0;if(J.isDefault)this._defaultCommandName=X._name;if(X._hidden=!!(J.noHelp||J.hidden),X._executableFile=J.executableFile||null,Z)X.arguments(Z);if(this._registerCommand(X),X.parent=this,X.copyInheritedSettings(this),Y)return this;return X}createCommand(f){return new U$(f)}createHelp(){return Object.assign(new v8,this.configureHelp())}configureHelp(f){if(f===void 0)return this._helpConfiguration;return this._helpConfiguration=f,this}configureOutput(f){if(f===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,f),this}showHelpAfterError(f=!0){if(typeof f!=="string")f=!!f;return this._showHelpAfterError=f,this}showSuggestionAfterError(f=!0){return this._showSuggestionAfterError=!!f,this}addCommand(f,$){if(!f._name)throw Error(`Command passed to .addCommand() must have a name
12
+ - specify the name in Command constructor or using .name()`);if($=$||{},$.isDefault)this._defaultCommandName=f._name;if($.noHelp||$.hidden)f._hidden=!0;return this._registerCommand(f),f.parent=this,f._checkForBrokenPassThrough(),this}createArgument(f,$){return new b8(f,$)}argument(f,$,M,Y){let J=this.createArgument(f,$);if(typeof M==="function")J.default(Y).argParser(M);else J.default(M);return this.addArgument(J),this}arguments(f){return f.trim().split(/ +/).forEach(($)=>{this.argument($)}),this}addArgument(f){let $=this.registeredArguments.slice(-1)[0];if($&&$.variadic)throw Error(`only the last argument can be variadic '${$.name()}'`);if(f.required&&f.defaultValue!==void 0&&f.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${f.name()}'`);return this.registeredArguments.push(f),this}helpCommand(f,$){if(typeof f==="boolean")return this._addImplicitHelpCommand=f,this;f=f??"help [command]";let[,M,Y]=f.match(/([^ ]+) *(.*)/),J=$??"display help for command",z=this.createCommand(M);if(z.helpOption(!1),Y)z.arguments(Y);if(J)z.description(J);return this._addImplicitHelpCommand=!0,this._helpCommand=z,this}addHelpCommand(f,$){if(typeof f!=="object")return this.helpCommand(f,$),this;return this._addImplicitHelpCommand=!0,this._helpCommand=f,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(f,$){let M=["preSubcommand","preAction","postAction"];if(!M.includes(f))throw Error(`Unexpected value for event passed to hook : '${f}'.
13
+ Expecting one of '${M.join("', '")}'`);if(this._lifeCycleHooks[f])this._lifeCycleHooks[f].push($);else this._lifeCycleHooks[f]=[$];return this}exitOverride(f){if(f)this._exitCallback=f;else this._exitCallback=($)=>{if($.code!=="commander.executeSubCommandAsync")throw $};return this}_exit(f,$,M){if(this._exitCallback)this._exitCallback(new G$(f,$,M));k.exit(f)}action(f){let $=(M)=>{let Y=this.registeredArguments.length,J=M.slice(0,Y);if(this._storeOptionsAsProperties)J[Y]=this;else J[Y]=this.opts();return J.push(this),f.apply(this,J)};return this._actionHandler=$,this}createOption(f,$){return new m2(f,$)}_callParseArg(f,$,M,Y){try{return f.parseArg($,M)}catch(J){if(J.code==="commander.invalidArgument"){let z=`${Y} ${J.message}`;this.error(z,{exitCode:J.exitCode,code:J.code})}throw J}}_registerOption(f){let $=f.short&&this._findOption(f.short)||f.long&&this._findOption(f.long);if($){let M=f.long&&this._findOption(f.long)?f.long:f.short;throw Error(`Cannot add option '${f.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${M}'
14
+ - already used by option '${$.flags}'`)}this.options.push(f)}_registerCommand(f){let $=(Y)=>{return[Y.name()].concat(Y.aliases())},M=$(f).find((Y)=>this._findCommand(Y));if(M){let Y=$(this._findCommand(M)).join("|"),J=$(f).join("|");throw Error(`cannot add command '${J}' as already have command '${Y}'`)}this.commands.push(f)}addOption(f){this._registerOption(f);let $=f.name(),M=f.attributeName();if(f.negate){let J=f.long.replace(/^--no-/,"--");if(!this._findOption(J))this.setOptionValueWithSource(M,f.defaultValue===void 0?!0:f.defaultValue,"default")}else if(f.defaultValue!==void 0)this.setOptionValueWithSource(M,f.defaultValue,"default");let Y=(J,z,Z)=>{if(J==null&&f.presetArg!==void 0)J=f.presetArg;let X=this.getOptionValue(M);if(J!==null&&f.parseArg)J=this._callParseArg(f,J,X,z);else if(J!==null&&f.variadic)J=f._concatValue(J,X);if(J==null)if(f.negate)J=!1;else if(f.isBoolean()||f.optional)J=!0;else J="";this.setOptionValueWithSource(M,J,Z)};if(this.on("option:"+$,(J)=>{let z=`error: option '${f.flags}' argument '${J}' is invalid.`;Y(J,z,"cli")}),f.envVar)this.on("optionEnv:"+$,(J)=>{let z=`error: option '${f.flags}' value '${J}' from env '${f.envVar}' is invalid.`;Y(J,z,"env")});return this}_optionEx(f,$,M,Y,J){if(typeof $==="object"&&$ instanceof m2)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let z=this.createOption($,M);if(z.makeOptionMandatory(!!f.mandatory),typeof Y==="function")z.default(J).argParser(Y);else if(Y instanceof RegExp){let Z=Y;Y=(X,Q)=>{let D=Z.exec(X);return D?D[0]:Q},z.default(J).argParser(Y)}else z.default(Y);return this.addOption(z)}option(f,$,M,Y){return this._optionEx({},f,$,M,Y)}requiredOption(f,$,M,Y){return this._optionEx({mandatory:!0},f,$,M,Y)}combineFlagAndOptionalValue(f=!0){return this._combineFlagAndOptionalValue=!!f,this}allowUnknownOption(f=!0){return this._allowUnknownOption=!!f,this}allowExcessArguments(f=!0){return this._allowExcessArguments=!!f,this}enablePositionalOptions(f=!0){return this._enablePositionalOptions=!!f,this}passThroughOptions(f=!0){return this._passThroughOptions=!!f,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(f=!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=!!f,this}getOptionValue(f){if(this._storeOptionsAsProperties)return this[f];return this._optionValues[f]}setOptionValue(f,$){return this.setOptionValueWithSource(f,$,void 0)}setOptionValueWithSource(f,$,M){if(this._storeOptionsAsProperties)this[f]=$;else this._optionValues[f]=$;return this._optionValueSources[f]=M,this}getOptionValueSource(f){return this._optionValueSources[f]}getOptionValueSourceWithGlobals(f){let $;return this._getCommandAndAncestors().forEach((M)=>{if(M.getOptionValueSource(f)!==void 0)$=M.getOptionValueSource(f)}),$}_prepareUserArgs(f,$){if(f!==void 0&&!Array.isArray(f))throw Error("first parameter to parse must be array or undefined");if($=$||{},f===void 0&&$.from===void 0){if(k.versions?.electron)$.from="electron";let Y=k.execArgv??[];if(Y.includes("-e")||Y.includes("--eval")||Y.includes("-p")||Y.includes("--print"))$.from="eval"}if(f===void 0)f=k.argv;this.rawArgs=f.slice();let M;switch($.from){case void 0:case"node":this._scriptPath=f[1],M=f.slice(2);break;case"electron":if(k.defaultApp)this._scriptPath=f[1],M=f.slice(2);else M=f.slice(1);break;case"user":M=f.slice(0);break;case"eval":M=f.slice(1);break;default:throw Error(`unexpected parse option { from: '${$.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",M}parse(f,$){let M=this._prepareUserArgs(f,$);return this._parseCommand([],M),this}async parseAsync(f,$){let M=this._prepareUserArgs(f,$);return await this._parseCommand([],M),this}_executeSubCommand(f,$){$=$.slice();let M=!1,Y=[".js",".ts",".tsx",".mjs",".cjs"];function J(D,G){let U=S1.resolve(D,G);if(D$.existsSync(U))return U;if(Y.includes(S1.extname(G)))return;let K=Y.find((W)=>D$.existsSync(`${U}${W}`));if(K)return`${U}${K}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let z=f._executableFile||`${this._name}-${f._name}`,Z=this._executableDir||"";if(this._scriptPath){let D;try{D=D$.realpathSync(this._scriptPath)}catch(G){D=this._scriptPath}Z=S1.resolve(S1.dirname(D),Z)}if(Z){let D=J(Z,z);if(!D&&!f._executableFile&&this._scriptPath){let G=S1.basename(this._scriptPath,S1.extname(this._scriptPath));if(G!==this._name)D=J(Z,`${G}-${f._name}`)}z=D||z}M=Y.includes(S1.extname(z));let X;if(k.platform!=="win32")if(M)$.unshift(z),$=l2(k.execArgv).concat($),X=Q$.spawn(k.argv[0],$,{stdio:"inherit"});else X=Q$.spawn(z,$,{stdio:"inherit"});else $.unshift(z),$=l2(k.execArgv).concat($),X=Q$.spawn(k.execPath,$,{stdio:"inherit"});if(!X.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((G)=>{k.on(G,()=>{if(X.killed===!1&&X.exitCode===null)X.kill(G)})});let Q=this._exitCallback;X.on("close",(D)=>{if(D=D??1,!Q)k.exit(D);else Q(new G$(D,"commander.executeSubCommandAsync","(close)"))}),X.on("error",(D)=>{if(D.code==="ENOENT"){let G=Z?`searched for local subcommand relative to directory '${Z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",U=`'${z}' does not exist
15
15
  - if '${f._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
16
16
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
- - ${Q}`;throw Error(D)}else if(q.code==="EACCES")throw Error(`'${z}' not executable`);if(!G)x.exit(1);else{let Q=new o0(1,"commander.executeSubCommandAsync","(error)");Q.nestedError=q,G(Q)}}),this.runningCommand=X}_dispatchSubcommand(f,$,M){let Y=this._findCommand(f);if(!Y)this.help({error:!0});let J;return J=this._chainOrCallSubCommandHook(J,Y,"preSubcommand"),J=this._chainOrCall(J,()=>{if(Y._executableHandler)this._executeSubCommand(Y,$.concat(M));else return Y._parseCommand($,M)}),J}_dispatchHelpCommand(f){if(!f)this.help();let $=this._findCommand(f);if($&&!$._executableHandler)$.help();return this._dispatchSubcommand(f,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((f,$)=>{if(f.required&&this.args[$]==null)this.missingArgument(f.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 f=(M,Y,J)=>{let z=Y;if(Y!==null&&M.parseArg){let Z=`error: command-argument value '${Y}' is invalid for argument '${M.name()}'.`;z=this._callParseArg(M,Y,J,Z)}return z};this._checkNumberOfArguments();let $=[];this.registeredArguments.forEach((M,Y)=>{let J=M.defaultValue;if(M.variadic){if(Y<this.args.length){if(J=this.args.slice(Y),M.parseArg)J=J.reduce((z,Z)=>{return f(M,Z,z)},M.defaultValue)}else if(J===void 0)J=[]}else if(Y<this.args.length){if(J=this.args[Y],M.parseArg)J=f(M,J,M.defaultValue)}$[Y]=J}),this.processedArgs=$}_chainOrCall(f,$){if(f&&f.then&&typeof f.then==="function")return f.then(()=>$());return $()}_chainOrCallHooks(f,$){let M=f,Y=[];if(this._getCommandAndAncestors().reverse().filter((J)=>J._lifeCycleHooks[$]!==void 0).forEach((J)=>{J._lifeCycleHooks[$].forEach((z)=>{Y.push({hookedCommand:J,callback:z})})}),$==="postAction")Y.reverse();return Y.forEach((J)=>{M=this._chainOrCall(M,()=>{return J.callback(J.hookedCommand,this)})}),M}_chainOrCallSubCommandHook(f,$,M){let Y=f;if(this._lifeCycleHooks[M]!==void 0)this._lifeCycleHooks[M].forEach((J)=>{Y=this._chainOrCall(Y,()=>{return J(this,$)})});return Y}_parseCommand(f,$){let M=this.parseOptions($);if(this._parseOptionsEnv(),this._parseOptionsImplied(),f=f.concat(M.operands),$=M.unknown,this.args=f.concat($),f&&this._findCommand(f[0]))return this._dispatchSubcommand(f[0],f.slice(1),$);if(this._getHelpCommand()&&f[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(f[1]);if(this._defaultCommandName)return this._outputHelpIfRequested($),this._dispatchSubcommand(this._defaultCommandName,f,$);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(M.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Y=()=>{if(M.unknown.length>0)this.unknownOption(M.unknown[0])},J=`command:${this.name()}`;if(this._actionHandler){Y(),this._processArguments();let z;if(z=this._chainOrCallHooks(z,"preAction"),z=this._chainOrCall(z,()=>this._actionHandler(this.processedArgs)),this.parent)z=this._chainOrCall(z,()=>{this.parent.emit(J,f,$)});return z=this._chainOrCallHooks(z,"postAction"),z}if(this.parent&&this.parent.listenerCount(J))Y(),this._processArguments(),this.parent.emit(J,f,$);else if(f.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",f,$);if(this.listenerCount("command:*"))this.emit("command:*",f,$);else if(this.commands.length)this.unknownCommand();else Y(),this._processArguments()}else if(this.commands.length)Y(),this.help({error:!0});else Y(),this._processArguments()}_findCommand(f){if(!f)return;return this.commands.find(($)=>$._name===f||$._aliases.includes(f))}_findOption(f){return this.options.find(($)=>$.is(f))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((f)=>{f.options.forEach(($)=>{if($.mandatory&&f.getOptionValue($.attributeName())===void 0)f.missingMandatoryOptionValue($)})})}_checkForConflictingLocalOptions(){let f=this.options.filter((M)=>{let Y=M.attributeName();if(this.getOptionValue(Y)===void 0)return!1;return this.getOptionValueSource(Y)!=="default"});f.filter((M)=>M.conflictsWith.length>0).forEach((M)=>{let Y=f.find((J)=>M.conflictsWith.includes(J.attributeName()));if(Y)this._conflictingOption(M,Y)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((f)=>{f._checkForConflictingLocalOptions()})}parseOptions(f){let $=[],M=[],Y=$,J=f.slice();function z(X){return X.length>1&&X[0]==="-"}let Z=null;while(J.length){let X=J.shift();if(X==="--"){if(Y===M)Y.push(X);Y.push(...J);break}if(Z&&!z(X)){this.emit(`option:${Z.name()}`,X);continue}if(Z=null,z(X)){let G=this._findOption(X);if(G){if(G.required){let q=J.shift();if(q===void 0)this.optionMissingArgument(G);this.emit(`option:${G.name()}`,q)}else if(G.optional){let q=null;if(J.length>0&&!z(J[0]))q=J.shift();this.emit(`option:${G.name()}`,q)}else this.emit(`option:${G.name()}`);Z=G.variadic?G:null;continue}}if(X.length>2&&X[0]==="-"&&X[1]!=="-"){let G=this._findOption(`-${X[1]}`);if(G){if(G.required||G.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${G.name()}`,X.slice(2));else this.emit(`option:${G.name()}`),J.unshift(`-${X.slice(2)}`);continue}}if(/^--[^=]+=/.test(X)){let G=X.indexOf("="),q=this._findOption(X.slice(0,G));if(q&&(q.required||q.optional)){this.emit(`option:${q.name()}`,X.slice(G+1));continue}}if(z(X))Y=M;if((this._enablePositionalOptions||this._passThroughOptions)&&$.length===0&&M.length===0){if(this._findCommand(X)){if($.push(X),J.length>0)M.push(...J);break}else if(this._getHelpCommand()&&X===this._getHelpCommand().name()){if($.push(X),J.length>0)$.push(...J);break}else if(this._defaultCommandName){if(M.push(X),J.length>0)M.push(...J);break}}if(this._passThroughOptions){if(Y.push(X),J.length>0)Y.push(...J);break}Y.push(X)}return{operands:$,unknown:M}}opts(){if(this._storeOptionsAsProperties){let f={},$=this.options.length;for(let M=0;M<$;M++){let Y=this.options[M].attributeName();f[Y]=Y===this._versionOptionName?this._version:this[Y]}return f}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((f,$)=>Object.assign(f,$.opts()),{})}error(f,$){if(this._outputConfiguration.outputError(`${f}
17
+ - ${G}`;throw Error(U)}else if(D.code==="EACCES")throw Error(`'${z}' not executable`);if(!Q)k.exit(1);else{let G=new G$(1,"commander.executeSubCommandAsync","(error)");G.nestedError=D,Q(G)}}),this.runningCommand=X}_dispatchSubcommand(f,$,M){let Y=this._findCommand(f);if(!Y)this.help({error:!0});let J;return J=this._chainOrCallSubCommandHook(J,Y,"preSubcommand"),J=this._chainOrCall(J,()=>{if(Y._executableHandler)this._executeSubCommand(Y,$.concat(M));else return Y._parseCommand($,M)}),J}_dispatchHelpCommand(f){if(!f)this.help();let $=this._findCommand(f);if($&&!$._executableHandler)$.help();return this._dispatchSubcommand(f,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((f,$)=>{if(f.required&&this.args[$]==null)this.missingArgument(f.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 f=(M,Y,J)=>{let z=Y;if(Y!==null&&M.parseArg){let Z=`error: command-argument value '${Y}' is invalid for argument '${M.name()}'.`;z=this._callParseArg(M,Y,J,Z)}return z};this._checkNumberOfArguments();let $=[];this.registeredArguments.forEach((M,Y)=>{let J=M.defaultValue;if(M.variadic){if(Y<this.args.length){if(J=this.args.slice(Y),M.parseArg)J=J.reduce((z,Z)=>{return f(M,Z,z)},M.defaultValue)}else if(J===void 0)J=[]}else if(Y<this.args.length){if(J=this.args[Y],M.parseArg)J=f(M,J,M.defaultValue)}$[Y]=J}),this.processedArgs=$}_chainOrCall(f,$){if(f&&f.then&&typeof f.then==="function")return f.then(()=>$());return $()}_chainOrCallHooks(f,$){let M=f,Y=[];if(this._getCommandAndAncestors().reverse().filter((J)=>J._lifeCycleHooks[$]!==void 0).forEach((J)=>{J._lifeCycleHooks[$].forEach((z)=>{Y.push({hookedCommand:J,callback:z})})}),$==="postAction")Y.reverse();return Y.forEach((J)=>{M=this._chainOrCall(M,()=>{return J.callback(J.hookedCommand,this)})}),M}_chainOrCallSubCommandHook(f,$,M){let Y=f;if(this._lifeCycleHooks[M]!==void 0)this._lifeCycleHooks[M].forEach((J)=>{Y=this._chainOrCall(Y,()=>{return J(this,$)})});return Y}_parseCommand(f,$){let M=this.parseOptions($);if(this._parseOptionsEnv(),this._parseOptionsImplied(),f=f.concat(M.operands),$=M.unknown,this.args=f.concat($),f&&this._findCommand(f[0]))return this._dispatchSubcommand(f[0],f.slice(1),$);if(this._getHelpCommand()&&f[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(f[1]);if(this._defaultCommandName)return this._outputHelpIfRequested($),this._dispatchSubcommand(this._defaultCommandName,f,$);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(M.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Y=()=>{if(M.unknown.length>0)this.unknownOption(M.unknown[0])},J=`command:${this.name()}`;if(this._actionHandler){Y(),this._processArguments();let z;if(z=this._chainOrCallHooks(z,"preAction"),z=this._chainOrCall(z,()=>this._actionHandler(this.processedArgs)),this.parent)z=this._chainOrCall(z,()=>{this.parent.emit(J,f,$)});return z=this._chainOrCallHooks(z,"postAction"),z}if(this.parent&&this.parent.listenerCount(J))Y(),this._processArguments(),this.parent.emit(J,f,$);else if(f.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",f,$);if(this.listenerCount("command:*"))this.emit("command:*",f,$);else if(this.commands.length)this.unknownCommand();else Y(),this._processArguments()}else if(this.commands.length)Y(),this.help({error:!0});else Y(),this._processArguments()}_findCommand(f){if(!f)return;return this.commands.find(($)=>$._name===f||$._aliases.includes(f))}_findOption(f){return this.options.find(($)=>$.is(f))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((f)=>{f.options.forEach(($)=>{if($.mandatory&&f.getOptionValue($.attributeName())===void 0)f.missingMandatoryOptionValue($)})})}_checkForConflictingLocalOptions(){let f=this.options.filter((M)=>{let Y=M.attributeName();if(this.getOptionValue(Y)===void 0)return!1;return this.getOptionValueSource(Y)!=="default"});f.filter((M)=>M.conflictsWith.length>0).forEach((M)=>{let Y=f.find((J)=>M.conflictsWith.includes(J.attributeName()));if(Y)this._conflictingOption(M,Y)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((f)=>{f._checkForConflictingLocalOptions()})}parseOptions(f){let $=[],M=[],Y=$,J=f.slice();function z(X){return X.length>1&&X[0]==="-"}let Z=null;while(J.length){let X=J.shift();if(X==="--"){if(Y===M)Y.push(X);Y.push(...J);break}if(Z&&!z(X)){this.emit(`option:${Z.name()}`,X);continue}if(Z=null,z(X)){let Q=this._findOption(X);if(Q){if(Q.required){let D=J.shift();if(D===void 0)this.optionMissingArgument(Q);this.emit(`option:${Q.name()}`,D)}else if(Q.optional){let D=null;if(J.length>0&&!z(J[0]))D=J.shift();this.emit(`option:${Q.name()}`,D)}else this.emit(`option:${Q.name()}`);Z=Q.variadic?Q:null;continue}}if(X.length>2&&X[0]==="-"&&X[1]!=="-"){let Q=this._findOption(`-${X[1]}`);if(Q){if(Q.required||Q.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${Q.name()}`,X.slice(2));else this.emit(`option:${Q.name()}`),J.unshift(`-${X.slice(2)}`);continue}}if(/^--[^=]+=/.test(X)){let Q=X.indexOf("="),D=this._findOption(X.slice(0,Q));if(D&&(D.required||D.optional)){this.emit(`option:${D.name()}`,X.slice(Q+1));continue}}if(z(X))Y=M;if((this._enablePositionalOptions||this._passThroughOptions)&&$.length===0&&M.length===0){if(this._findCommand(X)){if($.push(X),J.length>0)M.push(...J);break}else if(this._getHelpCommand()&&X===this._getHelpCommand().name()){if($.push(X),J.length>0)$.push(...J);break}else if(this._defaultCommandName){if(M.push(X),J.length>0)M.push(...J);break}}if(this._passThroughOptions){if(Y.push(X),J.length>0)Y.push(...J);break}Y.push(X)}return{operands:$,unknown:M}}opts(){if(this._storeOptionsAsProperties){let f={},$=this.options.length;for(let M=0;M<$;M++){let Y=this.options[M].attributeName();f[Y]=Y===this._versionOptionName?this._version:this[Y]}return f}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((f,$)=>Object.assign(f,$.opts()),{})}error(f,$){if(this._outputConfiguration.outputError(`${f}
18
18
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
19
19
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
20
- `),this.outputHelp({error:!0});let M=$||{},Y=M.exitCode||1,J=M.code||"commander.error";this._exit(Y,J,f)}_parseOptionsEnv(){this.options.forEach((f)=>{if(f.envVar&&f.envVar in x.env){let $=f.attributeName();if(this.getOptionValue($)===void 0||["default","config","env"].includes(this.getOptionValueSource($)))if(f.required||f.optional)this.emit(`optionEnv:${f.name()}`,x.env[f.envVar]);else this.emit(`optionEnv:${f.name()}`)}})}_parseOptionsImplied(){let f=new kJ(this.options),$=(M)=>{return this.getOptionValue(M)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(M))};this.options.filter((M)=>M.implied!==void 0&&$(M.attributeName())&&f.valueFromOption(this.getOptionValue(M.attributeName()),M)).forEach((M)=>{Object.keys(M.implied).filter((Y)=>!$(Y)).forEach((Y)=>{this.setOptionValueWithSource(Y,M.implied[Y],"implied")})})}missingArgument(f){let $=`error: missing required argument '${f}'`;this.error($,{code:"commander.missingArgument"})}optionMissingArgument(f){let $=`error: option '${f.flags}' argument missing`;this.error($,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(f){let $=`error: required option '${f.flags}' not specified`;this.error($,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(f,$){let M=(z)=>{let Z=z.attributeName(),X=this.getOptionValue(Z),G=this.options.find((Q)=>Q.negate&&Z===Q.attributeName()),q=this.options.find((Q)=>!Q.negate&&Z===Q.attributeName());if(G&&(G.presetArg===void 0&&X===!1||G.presetArg!==void 0&&X===G.presetArg))return G;return q||z},Y=(z)=>{let Z=M(z),X=Z.attributeName();if(this.getOptionValueSource(X)==="env")return`environment variable '${Z.envVar}'`;return`option '${Z.flags}'`},J=`error: ${Y(f)} cannot be used with ${Y($)}`;this.error(J,{code:"commander.conflictingOption"})}unknownOption(f){if(this._allowUnknownOption)return;let $="";if(f.startsWith("--")&&this._showSuggestionAfterError){let Y=[],J=this;do{let z=J.createHelp().visibleOptions(J).filter((Z)=>Z.long).map((Z)=>Z.long);Y=Y.concat(z),J=J.parent}while(J&&!J._enablePositionalOptions);$=M$(f,Y)}let M=`error: unknown option '${f}'${$}`;this.error(M,{code:"commander.unknownOption"})}_excessArguments(f){if(this._allowExcessArguments)return;let $=this.registeredArguments.length,M=$===1?"":"s",J=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${$} argument${M} but got ${f.length}.`;this.error(J,{code:"commander.excessArguments"})}unknownCommand(){let f=this.args[0],$="";if(this._showSuggestionAfterError){let Y=[];this.createHelp().visibleCommands(this).forEach((J)=>{if(Y.push(J.name()),J.alias())Y.push(J.alias())}),$=M$(f,Y)}let M=`error: unknown command '${f}'${$}`;this.error(M,{code:"commander.unknownCommand"})}version(f,$,M){if(f===void 0)return this._version;this._version=f,$=$||"-V, --version",M=M||"output the version number";let Y=this.createOption($,M);return this._versionOptionName=Y.attributeName(),this._registerOption(Y),this.on("option:"+Y.name(),()=>{this._outputConfiguration.writeOut(`${f}
21
- `),this._exit(0,"commander.version",f)}),this}description(f,$){if(f===void 0&&$===void 0)return this._description;if(this._description=f,$)this._argsDescription=$;return this}summary(f){if(f===void 0)return this._summary;return this._summary=f,this}alias(f){if(f===void 0)return this._aliases[0];let $=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)$=this.commands[this.commands.length-1];if(f===$._name)throw Error("Command alias can't be the same as its name");let M=this.parent?._findCommand(f);if(M){let Y=[M.name()].concat(M.aliases()).join("|");throw Error(`cannot add alias '${f}' to command '${this.name()}' as already have command '${Y}'`)}return $._aliases.push(f),this}aliases(f){if(f===void 0)return this._aliases;return f.forEach(($)=>this.alias($)),this}usage(f){if(f===void 0){if(this._usage)return this._usage;let $=this.registeredArguments.map((M)=>{return xJ(M)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?$:[]).join(" ")}return this._usage=f,this}name(f){if(f===void 0)return this._name;return this._name=f,this}nameFromFilename(f){return this._name=Yf.basename(f,Yf.extname(f)),this}executableDir(f){if(f===void 0)return this._executableDir;return this._executableDir=f,this}helpInformation(f){let $=this.createHelp();if($.helpWidth===void 0)$.helpWidth=f&&f.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return $.formatHelp(this,$)}_getHelpContext(f){f=f||{};let $={error:!!f.error},M;if($.error)M=(Y)=>this._outputConfiguration.writeErr(Y);else M=(Y)=>this._outputConfiguration.writeOut(Y);return $.write=f.write||M,$.command=this,$}outputHelp(f){let $;if(typeof f==="function")$=f,f=void 0;let M=this._getHelpContext(f);this._getCommandAndAncestors().reverse().forEach((J)=>J.emit("beforeAllHelp",M)),this.emit("beforeHelp",M);let Y=this.helpInformation(M);if($){if(Y=$(Y),typeof Y!=="string"&&!Buffer.isBuffer(Y))throw Error("outputHelp callback must return a string or a Buffer")}if(M.write(Y),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",M),this._getCommandAndAncestors().forEach((J)=>J.emit("afterAllHelp",M))}helpOption(f,$){if(typeof f==="boolean"){if(f)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return f=f??"-h, --help",$=$??"display help for command",this._helpOption=this.createOption(f,$),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(f){return this._helpOption=f,this}help(f){this.outputHelp(f);let $=x.exitCode||0;if($===0&&f&&typeof f!=="function"&&f.error)$=1;this._exit($,"commander.help","(outputHelp)")}addHelpText(f,$){let M=["beforeAll","before","after","afterAll"];if(!M.includes(f))throw Error(`Unexpected value for position to addHelpText.
20
+ `),this.outputHelp({error:!0});let M=$||{},Y=M.exitCode||1,J=M.code||"commander.error";this._exit(Y,J,f)}_parseOptionsEnv(){this.options.forEach((f)=>{if(f.envVar&&f.envVar in k.env){let $=f.attributeName();if(this.getOptionValue($)===void 0||["default","config","env"].includes(this.getOptionValueSource($)))if(f.required||f.optional)this.emit(`optionEnv:${f.name()}`,k.env[f.envVar]);else this.emit(`optionEnv:${f.name()}`)}})}_parseOptionsImplied(){let f=new u8(this.options),$=(M)=>{return this.getOptionValue(M)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(M))};this.options.filter((M)=>M.implied!==void 0&&$(M.attributeName())&&f.valueFromOption(this.getOptionValue(M.attributeName()),M)).forEach((M)=>{Object.keys(M.implied).filter((Y)=>!$(Y)).forEach((Y)=>{this.setOptionValueWithSource(Y,M.implied[Y],"implied")})})}missingArgument(f){let $=`error: missing required argument '${f}'`;this.error($,{code:"commander.missingArgument"})}optionMissingArgument(f){let $=`error: option '${f.flags}' argument missing`;this.error($,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(f){let $=`error: required option '${f.flags}' not specified`;this.error($,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(f,$){let M=(z)=>{let Z=z.attributeName(),X=this.getOptionValue(Z),Q=this.options.find((G)=>G.negate&&Z===G.attributeName()),D=this.options.find((G)=>!G.negate&&Z===G.attributeName());if(Q&&(Q.presetArg===void 0&&X===!1||Q.presetArg!==void 0&&X===Q.presetArg))return Q;return D||z},Y=(z)=>{let Z=M(z),X=Z.attributeName();if(this.getOptionValueSource(X)==="env")return`environment variable '${Z.envVar}'`;return`option '${Z.flags}'`},J=`error: ${Y(f)} cannot be used with ${Y($)}`;this.error(J,{code:"commander.conflictingOption"})}unknownOption(f){if(this._allowUnknownOption)return;let $="";if(f.startsWith("--")&&this._showSuggestionAfterError){let Y=[],J=this;do{let z=J.createHelp().visibleOptions(J).filter((Z)=>Z.long).map((Z)=>Z.long);Y=Y.concat(z),J=J.parent}while(J&&!J._enablePositionalOptions);$=d2(f,Y)}let M=`error: unknown option '${f}'${$}`;this.error(M,{code:"commander.unknownOption"})}_excessArguments(f){if(this._allowExcessArguments)return;let $=this.registeredArguments.length,M=$===1?"":"s",J=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${$} argument${M} but got ${f.length}.`;this.error(J,{code:"commander.excessArguments"})}unknownCommand(){let f=this.args[0],$="";if(this._showSuggestionAfterError){let Y=[];this.createHelp().visibleCommands(this).forEach((J)=>{if(Y.push(J.name()),J.alias())Y.push(J.alias())}),$=d2(f,Y)}let M=`error: unknown command '${f}'${$}`;this.error(M,{code:"commander.unknownCommand"})}version(f,$,M){if(f===void 0)return this._version;this._version=f,$=$||"-V, --version",M=M||"output the version number";let Y=this.createOption($,M);return this._versionOptionName=Y.attributeName(),this._registerOption(Y),this.on("option:"+Y.name(),()=>{this._outputConfiguration.writeOut(`${f}
21
+ `),this._exit(0,"commander.version",f)}),this}description(f,$){if(f===void 0&&$===void 0)return this._description;if(this._description=f,$)this._argsDescription=$;return this}summary(f){if(f===void 0)return this._summary;return this._summary=f,this}alias(f){if(f===void 0)return this._aliases[0];let $=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)$=this.commands[this.commands.length-1];if(f===$._name)throw Error("Command alias can't be the same as its name");let M=this.parent?._findCommand(f);if(M){let Y=[M.name()].concat(M.aliases()).join("|");throw Error(`cannot add alias '${f}' to command '${this.name()}' as already have command '${Y}'`)}return $._aliases.push(f),this}aliases(f){if(f===void 0)return this._aliases;return f.forEach(($)=>this.alias($)),this}usage(f){if(f===void 0){if(this._usage)return this._usage;let $=this.registeredArguments.map((M)=>{return _8(M)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?$:[]).join(" ")}return this._usage=f,this}name(f){if(f===void 0)return this._name;return this._name=f,this}nameFromFilename(f){return this._name=S1.basename(f,S1.extname(f)),this}executableDir(f){if(f===void 0)return this._executableDir;return this._executableDir=f,this}helpInformation(f){let $=this.createHelp();if($.helpWidth===void 0)$.helpWidth=f&&f.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return $.formatHelp(this,$)}_getHelpContext(f){f=f||{};let $={error:!!f.error},M;if($.error)M=(Y)=>this._outputConfiguration.writeErr(Y);else M=(Y)=>this._outputConfiguration.writeOut(Y);return $.write=f.write||M,$.command=this,$}outputHelp(f){let $;if(typeof f==="function")$=f,f=void 0;let M=this._getHelpContext(f);this._getCommandAndAncestors().reverse().forEach((J)=>J.emit("beforeAllHelp",M)),this.emit("beforeHelp",M);let Y=this.helpInformation(M);if($){if(Y=$(Y),typeof Y!=="string"&&!Buffer.isBuffer(Y))throw Error("outputHelp callback must return a string or a Buffer")}if(M.write(Y),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",M),this._getCommandAndAncestors().forEach((J)=>J.emit("afterAllHelp",M))}helpOption(f,$){if(typeof f==="boolean"){if(f)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return f=f??"-h, --help",$=$??"display help for command",this._helpOption=this.createOption(f,$),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(f){return this._helpOption=f,this}help(f){this.outputHelp(f);let $=k.exitCode||0;if($===0&&f&&typeof f!=="function"&&f.error)$=1;this._exit($,"commander.help","(outputHelp)")}addHelpText(f,$){let M=["beforeAll","before","after","afterAll"];if(!M.includes(f))throw Error(`Unexpected value for position to addHelpText.
22
22
  Expecting one of '${M.join("', '")}'`);let Y=`${f}Help`;return this.on(Y,(J)=>{let z;if(typeof $==="function")z=$({error:J.error,command:J.command});else z=$;if(z)J.write(`${z}
23
- `)}),this}_outputHelpIfRequested(f){let $=this._getHelpOption();if($&&f.find((Y)=>$.is(Y)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function Y$(f){return f.map(($)=>{if(!$.startsWith("--inspect"))return $;let M,Y="127.0.0.1",J="9229",z;if((z=$.match(/^(--inspect(-brk)?)$/))!==null)M=z[1];else if((z=$.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(M=z[1],/^\d+$/.test(z[3]))J=z[3];else Y=z[3];else if((z=$.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)M=z[1],Y=z[3],J=z[4];if(M&&J!=="0")return`${M}=${Y}:${parseInt(J)+1}`;return $})}CJ.Command=s0});var G$=S((EJ)=>{var{Argument:z$}=D0(),{Command:a0}=J$(),{CommanderError:vJ,InvalidArgumentError:Z$}=lf(),{Help:_J}=l0(),{Option:X$}=d0();EJ.program=new a0;EJ.createCommand=(f)=>new a0(f);EJ.createOption=(f,$)=>new X$(f,$);EJ.createArgument=(f,$)=>new z$(f,$);EJ.Command=a0;EJ.Option=X$;EJ.Argument=z$;EJ.Help=_J;EJ.CommanderError=vJ;EJ.InvalidArgumentError=Z$;EJ.InvalidOptionArgumentError=Z$});var $1=S((t0,f1)=>{(function(f,$){typeof t0=="object"&&typeof f1<"u"?f1.exports=$():typeof define=="function"&&define.amd?define($):(f=typeof globalThis<"u"?globalThis:f||self).dayjs=$()})(t0,function(){var f=1000,$=60000,M=3600000,Y="millisecond",J="second",z="minute",Z="hour",X="day",G="week",q="month",Q="quarter",D="year",V="date",W="Invalid Date",H=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,R=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,P={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(T){var K=["th","st","nd","rd"],U=T%100;return"["+T+(K[(U-20)%10]||K[U]||K[0])+"]"}},A=function(T,K,U){var y=String(T);return!y||y.length>=K?T:""+Array(K+1-y.length).join(U)+T},i={s:A,z:function(T){var K=-T.utcOffset(),U=Math.abs(K),y=Math.floor(U/60),B=U%60;return(K<=0?"+":"-")+A(y,2,"0")+":"+A(B,2,"0")},m:function T(K,U){if(K.date()<U.date())return-T(U,K);var y=12*(U.year()-K.year())+(U.month()-K.month()),B=K.clone().add(y,q),w=U-B<0,j=K.clone().add(y+(w?-1:1),q);return+(-(y+(U-B)/(w?B-j:j-B))||0)},a:function(T){return T<0?Math.ceil(T)||0:Math.floor(T)},p:function(T){return{M:q,y:D,w:G,d:X,D:V,h:Z,m:z,s:J,ms:Y,Q}[T]||String(T||"").toLowerCase().replace(/s$/,"")},u:function(T){return T===void 0}},o="en",s={};s[o]=P;var rf="$isDayjsObject",l=function(T){return T instanceof m||!(!T||!T[rf])},wf=function T(K,U,y){var B;if(!K)return o;if(typeof K=="string"){var w=K.toLowerCase();s[w]&&(B=w),U&&(s[w]=U,B=w);var j=K.split("-");if(!B&&j.length>1)return T(j[0])}else{var O=K.name;s[O]=K,B=O}return!y&&B&&(o=B),B||!y&&o},k=function(T,K){if(l(T))return T.clone();var U=typeof K=="object"?K:{};return U.date=T,U.args=arguments,new m(U)},L=i;L.l=wf,L.i=l,L.w=function(T,K){return k(T,{locale:K.$L,utc:K.$u,x:K.$x,$offset:K.$offset})};var m=function(){function T(U){this.$L=wf(U.locale,null,!0),this.parse(U),this.$x=this.$x||U.x||{},this[rf]=!0}var K=T.prototype;return K.parse=function(U){this.$d=function(y){var{date:B,utc:w}=y;if(B===null)return new Date(NaN);if(L.u(B))return new Date;if(B instanceof Date)return new Date(B);if(typeof B=="string"&&!/Z$/i.test(B)){var j=B.match(H);if(j){var O=j[2]-1||0,C=(j[7]||"0").substring(0,3);return w?new Date(Date.UTC(j[1],O,j[3]||1,j[4]||0,j[5]||0,j[6]||0,C)):new Date(j[1],O,j[3]||1,j[4]||0,j[5]||0,j[6]||0,C)}}return new Date(B)}(U),this.init()},K.init=function(){var U=this.$d;this.$y=U.getFullYear(),this.$M=U.getMonth(),this.$D=U.getDate(),this.$W=U.getDay(),this.$H=U.getHours(),this.$m=U.getMinutes(),this.$s=U.getSeconds(),this.$ms=U.getMilliseconds()},K.$utils=function(){return L},K.isValid=function(){return this.$d.toString()!==W},K.isSame=function(U,y){var B=k(U);return this.startOf(y)<=B&&B<=this.endOf(y)},K.isAfter=function(U,y){return k(U)<this.startOf(y)},K.isBefore=function(U,y){return this.endOf(y)<k(U)},K.$g=function(U,y,B){return L.u(U)?this[y]:this.set(B,U)},K.unix=function(){return Math.floor(this.valueOf()/1000)},K.valueOf=function(){return this.$d.getTime()},K.startOf=function(U,y){var B=this,w=!!L.u(y)||y,j=L.p(U),O=function(Qf,r){var zf=L.w(B.$u?Date.UTC(B.$y,r,Qf):new Date(B.$y,r,Qf),B);return w?zf:zf.endOf(X)},C=function(Qf,r){return L.w(B.toDate()[Qf].apply(B.toDate("s"),(w?[0,0,0,0]:[23,59,59,999]).slice(r)),B)},_=this.$W,E=this.$M,d=this.$D,jf="set"+(this.$u?"UTC":"");switch(j){case D:return w?O(1,0):O(31,11);case q:return w?O(1,E):O(0,E+1);case G:var qf=this.$locale().weekStart||0,cf=(_<qf?_+7:_)-qf;return O(w?d-cf:d+(6-cf),E);case X:case V:return C(jf+"Hours",0);case Z:return C(jf+"Minutes",1);case z:return C(jf+"Seconds",2);case J:return C(jf+"Milliseconds",3);default:return this.clone()}},K.endOf=function(U){return this.startOf(U,!1)},K.$set=function(U,y){var B,w=L.p(U),j="set"+(this.$u?"UTC":""),O=(B={},B[X]=j+"Date",B[V]=j+"Date",B[q]=j+"Month",B[D]=j+"FullYear",B[Z]=j+"Hours",B[z]=j+"Minutes",B[J]=j+"Seconds",B[Y]=j+"Milliseconds",B)[w],C=w===X?this.$D+(y-this.$W):y;if(w===q||w===D){var _=this.clone().set(V,1);_.$d[O](C),_.init(),this.$d=_.set(V,Math.min(this.$D,_.daysInMonth())).$d}else O&&this.$d[O](C);return this.init(),this},K.set=function(U,y){return this.clone().$set(U,y)},K.get=function(U){return this[L.p(U)]()},K.add=function(U,y){var B,w=this;U=Number(U);var j=L.p(y),O=function(E){var d=k(w);return L.w(d.date(d.date()+Math.round(E*U)),w)};if(j===q)return this.set(q,this.$M+U);if(j===D)return this.set(D,this.$y+U);if(j===X)return O(1);if(j===G)return O(7);var C=(B={},B[z]=$,B[Z]=M,B[J]=f,B)[j]||1,_=this.$d.getTime()+U*C;return L.w(_,this)},K.subtract=function(U,y){return this.add(-1*U,y)},K.format=function(U){var y=this,B=this.$locale();if(!this.isValid())return B.invalidDate||W;var w=U||"YYYY-MM-DDTHH:mm:ssZ",j=L.z(this),O=this.$H,C=this.$m,_=this.$M,E=B.weekdays,d=B.months,jf=B.meridiem,qf=function(r,zf,pf,q0){return r&&(r[zf]||r(y,w))||pf[zf].slice(0,q0)},cf=function(r){return L.s(O%12||12,r,"0")},Qf=jf||function(r,zf,pf){var q0=r<12?"AM":"PM";return pf?q0.toLowerCase():q0};return w.replace(R,function(r,zf){return zf||function(pf){switch(pf){case"YY":return String(y.$y).slice(-2);case"YYYY":return L.s(y.$y,4,"0");case"M":return _+1;case"MM":return L.s(_+1,2,"0");case"MMM":return qf(B.monthsShort,_,d,3);case"MMMM":return qf(d,_);case"D":return y.$D;case"DD":return L.s(y.$D,2,"0");case"d":return String(y.$W);case"dd":return qf(B.weekdaysMin,y.$W,E,2);case"ddd":return qf(B.weekdaysShort,y.$W,E,3);case"dddd":return E[y.$W];case"H":return String(O);case"HH":return L.s(O,2,"0");case"h":return cf(1);case"hh":return cf(2);case"a":return Qf(O,C,!0);case"A":return Qf(O,C,!1);case"m":return String(C);case"mm":return L.s(C,2,"0");case"s":return String(y.$s);case"ss":return L.s(y.$s,2,"0");case"SSS":return L.s(y.$ms,3,"0");case"Z":return j}return null}(r)||j.replace(":","")})},K.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},K.diff=function(U,y,B){var w,j=this,O=L.p(y),C=k(U),_=(C.utcOffset()-this.utcOffset())*$,E=this-C,d=function(){return L.m(j,C)};switch(O){case D:w=d()/12;break;case q:w=d();break;case Q:w=d()/3;break;case G:w=(E-_)/604800000;break;case X:w=(E-_)/86400000;break;case Z:w=E/M;break;case z:w=E/$;break;case J:w=E/f;break;default:w=E}return B?w:L.a(w)},K.daysInMonth=function(){return this.endOf(q).$D},K.$locale=function(){return s[this.$L]},K.locale=function(U,y){if(!U)return this.$L;var B=this.clone(),w=wf(U,y,!0);return w&&(B.$L=w),B},K.clone=function(){return L.w(this.$d,this)},K.toDate=function(){return new Date(this.valueOf())},K.toJSON=function(){return this.isValid()?this.toISOString():null},K.toISOString=function(){return this.$d.toISOString()},K.toString=function(){return this.$d.toUTCString()},T}(),Mf=m.prototype;return k.prototype=Mf,[["$ms",Y],["$s",J],["$m",z],["$H",Z],["$W",X],["$M",q],["$y",D],["$D",V]].forEach(function(T){Mf[T[1]]=function(K){return this.$g(K,T[0],T[1])}}),k.extend=function(T,K){return T.$i||(T(K,m,k),T.$i=!0),k},k.locale=wf,k.isDayjs=l,k.unix=function(T){return k(1000*T)},k.en=s[o],k.Ls=s,k.p={},k})});var V$=S((M1,Y1)=>{(function(f,$){typeof M1=="object"&&typeof Y1<"u"?Y1.exports=$($1()):typeof define=="function"&&define.amd?define(["dayjs"],$):(f=typeof globalThis<"u"?globalThis:f||self).dayjs_locale_zh_cn=$(f.dayjs)})(M1,function(f){function $(J){return J&&typeof J=="object"&&"default"in J?J:{default:J}}var M=$(f),Y={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(J,z){return z==="W"?J+"周":J+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(J,z){var Z=100*J+z;return Z<600?"凌晨":Z<900?"早上":Z<1100?"上午":Z<1300?"中午":Z<1800?"下午":"晚上"}};return M.default.locale(Y,null,!0),Y})});var of=S((h9,H$)=>{var aJ=Object.prototype.toString;H$.exports=function($){if($===void 0)return"undefined";if($===null)return"null";var M=typeof $;if(M==="boolean")return"boolean";if(M==="string")return"string";if(M==="number")return"number";if(M==="symbol")return"symbol";if(M==="function")return M5($)?"generatorfunction":"function";if(eJ($))return"array";if(z5($))return"buffer";if(J5($))return"arguments";if(f5($))return"date";if(tJ($))return"error";if($5($))return"regexp";switch(B$($)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(Y5($))return"generator";switch(M=aJ.call($),M){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return M.slice(8,-1).toLowerCase().replace(/\s/g,"")};function B$(f){return typeof f.constructor==="function"?f.constructor.name:null}function eJ(f){if(Array.isArray)return Array.isArray(f);return f instanceof Array}function tJ(f){return f instanceof Error||typeof f.message==="string"&&f.constructor&&typeof f.constructor.stackTraceLimit==="number"}function f5(f){if(f instanceof Date)return!0;return typeof f.toDateString==="function"&&typeof f.getDate==="function"&&typeof f.setDate==="function"}function $5(f){if(f instanceof RegExp)return!0;return typeof f.flags==="string"&&typeof f.ignoreCase==="boolean"&&typeof f.multiline==="boolean"&&typeof f.global==="boolean"}function M5(f,$){return B$(f)==="GeneratorFunction"}function Y5(f){return typeof f.throw==="function"&&typeof f.return==="function"&&typeof f.next==="function"}function J5(f){try{if(typeof f.length==="number"&&typeof f.callee==="function")return!0}catch($){if($.message.indexOf("callee")!==-1)return!0}return!1}function z5(f){if(f.constructor&&typeof f.constructor.isBuffer==="function")return f.constructor.isBuffer(f);return!1}});var S$=S((g9,y$)=>{/*!
23
+ `)}),this}_outputHelpIfRequested(f){let $=this._getHelpOption();if($&&f.find((Y)=>$.is(Y)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function l2(f){return f.map(($)=>{if(!$.startsWith("--inspect"))return $;let M,Y="127.0.0.1",J="9229",z;if((z=$.match(/^(--inspect(-brk)?)$/))!==null)M=z[1];else if((z=$.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(M=z[1],/^\d+$/.test(z[3]))J=z[3];else Y=z[3];else if((z=$.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)M=z[1],Y=z[3],J=z[4];if(M&&J!=="0")return`${M}=${Y}:${parseInt(J)+1}`;return $})}h8.Command=U$});var o2=V((d8)=>{var{Argument:r2}=Zf(),{Command:W$}=n2(),{CommanderError:c8,InvalidArgumentError:p2}=j0(),{Help:m8}=Z$(),{Option:i2}=X$();d8.program=new W$;d8.createCommand=(f)=>new W$(f);d8.createOption=(f,$)=>new i2(f,$);d8.createArgument=(f,$)=>new r2(f,$);d8.Command=W$;d8.Option=i2;d8.Argument=r2;d8.Help=m8;d8.CommanderError=c8;d8.InvalidArgumentError=p2;d8.InvalidOptionArgumentError=p2});var B$=V((V$,q$)=>{(function(f,$){typeof V$=="object"&&typeof q$<"u"?q$.exports=$():typeof define=="function"&&define.amd?define($):(f=typeof globalThis<"u"?globalThis:f||self).dayjs=$()})(V$,function(){var f=1000,$=60000,M=3600000,Y="millisecond",J="second",z="minute",Z="hour",X="day",Q="week",D="month",G="quarter",U="year",K="date",W="Invalid Date",B=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,O=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,F={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(A){var H=["th","st","nd","rd"],q=A%100;return"["+A+(H[(q-20)%10]||H[q]||H[0])+"]"}},T=function(A,H,q){var R=String(A);return!R||R.length>=H?A:""+Array(H+1-R.length).join(q)+A},c={s:T,z:function(A){var H=-A.utcOffset(),q=Math.abs(H),R=Math.floor(q/60),S=q%60;return(H<=0?"+":"-")+T(R,2,"0")+":"+T(S,2,"0")},m:function A(H,q){if(H.date()<q.date())return-A(q,H);var R=12*(q.year()-H.year())+(q.month()-H.month()),S=H.clone().add(R,D),L=q-S<0,P=H.clone().add(R+(L?-1:1),D);return+(-(R+(q-S)/(L?S-P:P-S))||0)},a:function(A){return A<0?Math.ceil(A)||0:Math.floor(A)},p:function(A){return{M:D,y:U,w:Q,d:X,D:K,h:Z,m:z,s:J,ms:Y,Q:G}[A]||String(A||"").toLowerCase().replace(/s$/,"")},u:function(A){return A===void 0}},r="en",J1={};J1[r]=F;var L0="$isDayjsObject",$1=function(A){return A instanceof p||!(!A||!A[L0])},f0=function A(H,q,R){var S;if(!H)return r;if(typeof H=="string"){var L=H.toLowerCase();J1[L]&&(S=L),q&&(J1[L]=q,S=L);var P=H.split("-");if(!S&&P.length>1)return A(P[0])}else{var C=H.name;J1[C]=H,S=C}return!R&&S&&(r=S),S||!R&&r},_=function(A,H){if($1(A))return A.clone();var q=typeof H=="object"?H:{};return q.date=A,q.args=arguments,new p(q)},w=c;w.l=f0,w.i=$1,w.w=function(A,H){return _(A,{locale:H.$L,utc:H.$u,x:H.$x,$offset:H.$offset})};var p=function(){function A(q){this.$L=f0(q.locale,null,!0),this.parse(q),this.$x=this.$x||q.x||{},this[L0]=!0}var H=A.prototype;return H.parse=function(q){this.$d=function(R){var{date:S,utc:L}=R;if(S===null)return new Date(NaN);if(w.u(S))return new Date;if(S instanceof Date)return new Date(S);if(typeof S=="string"&&!/Z$/i.test(S)){var P=S.match(B);if(P){var C=P[2]-1||0,v=(P[7]||"0").substring(0,3);return L?new Date(Date.UTC(P[1],C,P[3]||1,P[4]||0,P[5]||0,P[6]||0,v)):new Date(P[1],C,P[3]||1,P[4]||0,P[5]||0,P[6]||0,v)}}return new Date(S)}(q),this.init()},H.init=function(){var q=this.$d;this.$y=q.getFullYear(),this.$M=q.getMonth(),this.$D=q.getDate(),this.$W=q.getDay(),this.$H=q.getHours(),this.$m=q.getMinutes(),this.$s=q.getSeconds(),this.$ms=q.getMilliseconds()},H.$utils=function(){return w},H.isValid=function(){return this.$d.toString()!==W},H.isSame=function(q,R){var S=_(q);return this.startOf(R)<=S&&S<=this.endOf(R)},H.isAfter=function(q,R){return _(q)<this.startOf(R)},H.isBefore=function(q,R){return this.endOf(R)<_(q)},H.$g=function(q,R,S){return w.u(q)?this[R]:this.set(S,q)},H.unix=function(){return Math.floor(this.valueOf()/1000)},H.valueOf=function(){return this.$d.getTime()},H.startOf=function(q,R){var S=this,L=!!w.u(R)||R,P=w.p(q),C=function(u1,i){var w1=w.w(S.$u?Date.UTC(S.$y,i,u1):new Date(S.$y,i,u1),S);return L?w1:w1.endOf(X)},v=function(u1,i){return w.w(S.toDate()[u1].apply(S.toDate("s"),(L?[0,0,0,0]:[23,59,59,999]).slice(i)),S)},g=this.$W,m=this.$M,M1=this.$D,$0="set"+(this.$u?"UTC":"");switch(P){case U:return L?C(1,0):C(31,11);case D:return L?C(1,m):C(0,m+1);case Q:var v1=this.$locale().weekStart||0,P0=(g<v1?g+7:g)-v1;return C(L?M1-P0:M1+(6-P0),m);case X:case K:return v($0+"Hours",0);case Z:return v($0+"Minutes",1);case z:return v($0+"Seconds",2);case J:return v($0+"Milliseconds",3);default:return this.clone()}},H.endOf=function(q){return this.startOf(q,!1)},H.$set=function(q,R){var S,L=w.p(q),P="set"+(this.$u?"UTC":""),C=(S={},S[X]=P+"Date",S[K]=P+"Date",S[D]=P+"Month",S[U]=P+"FullYear",S[Z]=P+"Hours",S[z]=P+"Minutes",S[J]=P+"Seconds",S[Y]=P+"Milliseconds",S)[L],v=L===X?this.$D+(R-this.$W):R;if(L===D||L===U){var g=this.clone().set(K,1);g.$d[C](v),g.init(),this.$d=g.set(K,Math.min(this.$D,g.daysInMonth())).$d}else C&&this.$d[C](v);return this.init(),this},H.set=function(q,R){return this.clone().$set(q,R)},H.get=function(q){return this[w.p(q)]()},H.add=function(q,R){var S,L=this;q=Number(q);var P=w.p(R),C=function(m){var M1=_(L);return w.w(M1.date(M1.date()+Math.round(m*q)),L)};if(P===D)return this.set(D,this.$M+q);if(P===U)return this.set(U,this.$y+q);if(P===X)return C(1);if(P===Q)return C(7);var v=(S={},S[z]=$,S[Z]=M,S[J]=f,S)[P]||1,g=this.$d.getTime()+q*v;return w.w(g,this)},H.subtract=function(q,R){return this.add(-1*q,R)},H.format=function(q){var R=this,S=this.$locale();if(!this.isValid())return S.invalidDate||W;var L=q||"YYYY-MM-DDTHH:mm:ssZ",P=w.z(this),C=this.$H,v=this.$m,g=this.$M,m=S.weekdays,M1=S.months,$0=S.meridiem,v1=function(i,w1,T0,zf){return i&&(i[w1]||i(R,L))||T0[w1].slice(0,zf)},P0=function(i){return w.s(C%12||12,i,"0")},u1=$0||function(i,w1,T0){var zf=i<12?"AM":"PM";return T0?zf.toLowerCase():zf};return L.replace(O,function(i,w1){return w1||function(T0){switch(T0){case"YY":return String(R.$y).slice(-2);case"YYYY":return w.s(R.$y,4,"0");case"M":return g+1;case"MM":return w.s(g+1,2,"0");case"MMM":return v1(S.monthsShort,g,M1,3);case"MMMM":return v1(M1,g);case"D":return R.$D;case"DD":return w.s(R.$D,2,"0");case"d":return String(R.$W);case"dd":return v1(S.weekdaysMin,R.$W,m,2);case"ddd":return v1(S.weekdaysShort,R.$W,m,3);case"dddd":return m[R.$W];case"H":return String(C);case"HH":return w.s(C,2,"0");case"h":return P0(1);case"hh":return P0(2);case"a":return u1(C,v,!0);case"A":return u1(C,v,!1);case"m":return String(v);case"mm":return w.s(v,2,"0");case"s":return String(R.$s);case"ss":return w.s(R.$s,2,"0");case"SSS":return w.s(R.$ms,3,"0");case"Z":return P}return null}(i)||P.replace(":","")})},H.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},H.diff=function(q,R,S){var L,P=this,C=w.p(R),v=_(q),g=(v.utcOffset()-this.utcOffset())*$,m=this-v,M1=function(){return w.m(P,v)};switch(C){case U:L=M1()/12;break;case D:L=M1();break;case G:L=M1()/3;break;case Q:L=(m-g)/604800000;break;case X:L=(m-g)/86400000;break;case Z:L=m/M;break;case z:L=m/$;break;case J:L=m/f;break;default:L=m}return S?L:w.a(L)},H.daysInMonth=function(){return this.endOf(D).$D},H.$locale=function(){return J1[this.$L]},H.locale=function(q,R){if(!q)return this.$L;var S=this.clone(),L=f0(q,R,!0);return L&&(S.$L=L),S},H.clone=function(){return w.w(this.$d,this)},H.toDate=function(){return new Date(this.valueOf())},H.toJSON=function(){return this.isValid()?this.toISOString():null},H.toISOString=function(){return this.$d.toISOString()},H.toString=function(){return this.$d.toUTCString()},A}(),H1=p.prototype;return _.prototype=H1,[["$ms",Y],["$s",J],["$m",z],["$H",Z],["$W",X],["$M",D],["$y",U],["$D",K]].forEach(function(A){H1[A[1]]=function(H){return this.$g(H,A[0],A[1])}}),_.extend=function(A,H){return A.$i||(A(H,p,_),A.$i=!0),_},_.locale=f0,_.isDayjs=$1,_.unix=function(A){return _(1000*A)},_.en=J1[r],_.Ls=J1,_.p={},_})});var e2=V((H$,S$)=>{(function(f,$){typeof H$=="object"&&typeof S$<"u"?S$.exports=$(B$()):typeof define=="function"&&define.amd?define(["dayjs"],$):(f=typeof globalThis<"u"?globalThis:f||self).dayjs_locale_zh_cn=$(f.dayjs)})(H$,function(f){function $(J){return J&&typeof J=="object"&&"default"in J?J:{default:J}}var M=$(f),Y={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(J,z){return z==="W"?J+"周":J+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(J,z){var Z=100*J+z;return Z<600?"凌晨":Z<900?"早上":Z<1100?"上午":Z<1300?"中午":Z<1800?"下午":"晚上"}};return M.default.locale(Y,null,!0),Y})});var E0=V((sK,YM)=>{var YZ=Object.prototype.toString;YM.exports=function($){if($===void 0)return"undefined";if($===null)return"null";var M=typeof $;if(M==="boolean")return"boolean";if(M==="string")return"string";if(M==="number")return"number";if(M==="symbol")return"symbol";if(M==="function")return QZ($)?"generatorfunction":"function";if(JZ($))return"array";if(UZ($))return"buffer";if(GZ($))return"arguments";if(ZZ($))return"date";if(zZ($))return"error";if(XZ($))return"regexp";switch(MM($)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(DZ($))return"generator";switch(M=YZ.call($),M){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return M.slice(8,-1).toLowerCase().replace(/\s/g,"")};function MM(f){return typeof f.constructor==="function"?f.constructor.name:null}function JZ(f){if(Array.isArray)return Array.isArray(f);return f instanceof Array}function zZ(f){return f instanceof Error||typeof f.message==="string"&&f.constructor&&typeof f.constructor.stackTraceLimit==="number"}function ZZ(f){if(f instanceof Date)return!0;return typeof f.toDateString==="function"&&typeof f.getDate==="function"&&typeof f.setDate==="function"}function XZ(f){if(f instanceof RegExp)return!0;return typeof f.flags==="string"&&typeof f.ignoreCase==="boolean"&&typeof f.multiline==="boolean"&&typeof f.global==="boolean"}function QZ(f,$){return MM(f)==="GeneratorFunction"}function DZ(f){return typeof f.throw==="function"&&typeof f.return==="function"&&typeof f.next==="function"}function GZ(f){try{if(typeof f.length==="number"&&typeof f.callee==="function")return!0}catch($){if($.message.indexOf("callee")!==-1)return!0}return!1}function UZ(f){if(f.constructor&&typeof f.constructor.isBuffer==="function")return f.constructor.isBuffer(f);return!1}});var zM=V((aK,JM)=>{/*!
24
24
  * is-extendable <https://github.com/jonschlinkert/is-extendable>
25
25
  *
26
26
  * Copyright (c) 2015, Jon Schlinkert.
27
27
  * Licensed under the MIT License.
28
- */y$.exports=function($){return typeof $<"u"&&$!==null&&(typeof $==="object"||typeof $==="function")}});var T$=S((m9,P$)=>{var F$=S$();P$.exports=function($){if(!F$($))$={};var M=arguments.length;for(var Y=1;Y<M;Y++){var J=arguments[Y];if(F$(J))Z5($,J)}return $};function Z5(f,$){for(var M in $)if(X5($,M))f[M]=$[M]}function X5(f,$){return Object.prototype.hasOwnProperty.call(f,$)}});var R$=S((r9,j$)=>{var G5=of(),q5=T$();j$.exports=function(f,$){if(typeof $==="function")$={parse:$};var M=D5(f),Y={section_delimiter:"---",parse:V5},J=q5({},Y,$),z=J.section_delimiter,Z=M.content.split(/\r?\n/),X=null,G=w$(),q=[],Q=[];function D(A){M.content=A,X=[],q=[]}function V(A){if(Q.length)G.key=W5(Q[0],z),G.content=A,J.parse(G,X),X.push(G),G=w$(),q=[],Q=[]}for(var W=0;W<Z.length;W++){var H=Z[W],R=Q.length,P=H.trim();if(Q5(P,z)){if(P.length===3&&W!==0){if(R===0||R===2){q.push(H);continue}Q.push(P),G.data=q.join(`
29
- `),q=[];continue}if(X===null)D(q.join(`
30
- `));if(R===2)V(q.join(`
31
- `));Q.push(P);continue}q.push(H)}if(X===null)D(q.join(`
32
- `));else V(q.join(`
33
- `));return M.sections=X,M};function Q5(f,$){if(f.slice(0,$.length)!==$)return!1;if(f.charAt($.length+1)===$.slice(-1))return!1;return!0}function D5(f){if(G5(f)!=="object")f={content:f};if(typeof f.content!=="string"&&!U5(f.content))throw TypeError("expected a buffer or string");return f.content=f.content.toString(),f.sections=[],f}function W5(f,$){return f?f.slice($.length).trim():""}function w$(){return{key:"",data:"",content:""}}function V5(f){return f}function U5(f){if(f&&f.constructor&&typeof f.constructor.isBuffer==="function")return f.constructor.isBuffer(f);return!1}});var Wf=S((F5,Df)=>{function L$(f){return typeof f>"u"||f===null}function K5(f){return typeof f==="object"&&f!==null}function B5(f){if(Array.isArray(f))return f;else if(L$(f))return[];return[f]}function H5(f,$){var M,Y,J,z;if($){z=Object.keys($);for(M=0,Y=z.length;M<Y;M+=1)J=z[M],f[J]=$[J]}return f}function y5(f,$){var M="",Y;for(Y=0;Y<$;Y+=1)M+=f;return M}function S5(f){return f===0&&Number.NEGATIVE_INFINITY===1/f}F5.isNothing=L$;F5.isObject=K5;F5.toArray=B5;F5.repeat=y5;F5.isNegativeZero=S5;F5.extend=H5});var Rf=S((c9,A$)=>{function sf(f,$){if(Error.call(this),this.name="YAMLException",this.reason=f,this.mark=$,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else this.stack=Error().stack||""}sf.prototype=Object.create(Error.prototype);sf.prototype.constructor=sf;sf.prototype.toString=function($){var M=this.name+": ";if(M+=this.reason||"(unknown reason)",!$&&this.mark)M+=" "+this.mark.toString();return M};A$.exports=sf});var x$=S((p9,O$)=>{var N$=Wf();function J1(f,$,M,Y,J){this.name=f,this.buffer=$,this.position=M,this.line=Y,this.column=J}J1.prototype.getSnippet=function($,M){var Y,J,z,Z,X;if(!this.buffer)return null;$=$||4,M=M||75,Y="",J=this.position;while(J>0&&`\x00\r
28
+ */JM.exports=function($){return typeof $<"u"&&$!==null&&(typeof $==="object"||typeof $==="function")}});var QM=V((tK,XM)=>{var ZM=zM();XM.exports=function($){if(!ZM($))$={};var M=arguments.length;for(var Y=1;Y<M;Y++){var J=arguments[Y];if(ZM(J))WZ($,J)}return $};function WZ(f,$){for(var M in $)if(KZ($,M))f[M]=$[M]}function KZ(f,$){return Object.prototype.hasOwnProperty.call(f,$)}});var UM=V((eK,GM)=>{var VZ=E0(),qZ=QM();GM.exports=function(f,$){if(typeof $==="function")$={parse:$};var M=HZ(f),Y={section_delimiter:"---",parse:FZ},J=qZ({},Y,$),z=J.section_delimiter,Z=M.content.split(/\r?\n/),X=null,Q=DM(),D=[],G=[];function U(T){M.content=T,X=[],D=[]}function K(T){if(G.length)Q.key=SZ(G[0],z),Q.content=T,J.parse(Q,X),X.push(Q),Q=DM(),D=[],G=[]}for(var W=0;W<Z.length;W++){var B=Z[W],O=G.length,F=B.trim();if(BZ(F,z)){if(F.length===3&&W!==0){if(O===0||O===2){D.push(B);continue}G.push(F),Q.data=D.join(`
29
+ `),D=[];continue}if(X===null)U(D.join(`
30
+ `));if(O===2)K(D.join(`
31
+ `));G.push(F);continue}D.push(B)}if(X===null)U(D.join(`
32
+ `));else K(D.join(`
33
+ `));return M.sections=X,M};function BZ(f,$){if(f.slice(0,$.length)!==$)return!1;if(f.charAt($.length+1)===$.slice(-1))return!1;return!0}function HZ(f){if(VZ(f)!=="object")f={content:f};if(typeof f.content!=="string"&&!RZ(f.content))throw TypeError("expected a buffer or string");return f.content=f.content.toString(),f.sections=[],f}function SZ(f,$){return f?f.slice($.length).trim():""}function DM(){return{key:"",data:"",content:""}}function FZ(f){return f}function RZ(f){if(f&&f.constructor&&typeof f.constructor.isBuffer==="function")return f.constructor.isBuffer(f);return!1}});var g1=V((TZ,h1)=>{function WM(f){return typeof f>"u"||f===null}function NZ(f){return typeof f==="object"&&f!==null}function OZ(f){if(Array.isArray(f))return f;else if(WM(f))return[];return[f]}function AZ(f,$){var M,Y,J,z;if($){z=Object.keys($);for(M=0,Y=z.length;M<Y;M+=1)J=z[M],f[J]=$[J]}return f}function LZ(f,$){var M="",Y;for(Y=0;Y<$;Y+=1)M+=f;return M}function PZ(f){return f===0&&Number.NEGATIVE_INFINITY===1/f}TZ.isNothing=WM;TZ.isObject=NZ;TZ.toArray=OZ;TZ.repeat=LZ;TZ.isNegativeZero=PZ;TZ.extend=AZ});var M0=V((fV,KM)=>{function x0(f,$){if(Error.call(this),this.name="YAMLException",this.reason=f,this.mark=$,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else this.stack=Error().stack||""}x0.prototype=Object.create(Error.prototype);x0.prototype.constructor=x0;x0.prototype.toString=function($){var M=this.name+": ";if(M+=this.reason||"(unknown reason)",!$&&this.mark)M+=" "+this.mark.toString();return M};KM.exports=x0});var BM=V(($V,qM)=>{var VM=g1();function F$(f,$,M,Y,J){this.name=f,this.buffer=$,this.position=M,this.line=Y,this.column=J}F$.prototype.getSnippet=function($,M){var Y,J,z,Z,X;if(!this.buffer)return null;$=$||4,M=M||75,Y="",J=this.position;while(J>0&&`\x00\r
34
34
  …\u2028\u2029`.indexOf(this.buffer.charAt(J-1))===-1)if(J-=1,this.position-J>M/2-1){Y=" ... ",J+=5;break}z="",Z=this.position;while(Z<this.buffer.length&&`\x00\r
35
- …\u2028\u2029`.indexOf(this.buffer.charAt(Z))===-1)if(Z+=1,Z-this.position>M/2-1){z=" ... ",Z-=5;break}return X=this.buffer.slice(J,Z),N$.repeat(" ",$)+Y+X+z+`
36
- `+N$.repeat(" ",$+this.position-J+Y.length)+"^"};J1.prototype.toString=function($){var M,Y="";if(this.name)Y+='in "'+this.name+'" ';if(Y+="at line "+(this.line+1)+", column "+(this.column+1),!$){if(M=this.getSnippet(),M)Y+=`:
37
- `+M}return Y};O$.exports=J1});var v=S((l9,k$)=>{var I$=Rf(),A5=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],N5=["scalar","sequence","mapping"];function O5(f){var $={};if(f!==null)Object.keys(f).forEach(function(M){f[M].forEach(function(Y){$[String(Y)]=M})});return $}function x5(f,$){if($=$||{},Object.keys($).forEach(function(M){if(A5.indexOf(M)===-1)throw new I$('Unknown option "'+M+'" is met in definition of "'+f+'" YAML type.')}),this.tag=f,this.kind=$.kind||null,this.resolve=$.resolve||function(){return!0},this.construct=$.construct||function(M){return M},this.instanceOf=$.instanceOf||null,this.predicate=$.predicate||null,this.represent=$.represent||null,this.defaultStyle=$.defaultStyle||null,this.styleAliases=O5($.styleAliases||null),N5.indexOf(this.kind)===-1)throw new I$('Unknown kind "'+this.kind+'" is specified for "'+f+'" YAML type.')}k$.exports=x5});var Vf=S((d9,b$)=>{var C$=Wf(),B0=Rf(),I5=v();function z1(f,$,M){var Y=[];return f.include.forEach(function(J){M=z1(J,$,M)}),f[$].forEach(function(J){M.forEach(function(z,Z){if(z.tag===J.tag&&z.kind===J.kind)Y.push(Z)}),M.push(J)}),M.filter(function(J,z){return Y.indexOf(z)===-1})}function k5(){var f={scalar:{},sequence:{},mapping:{},fallback:{}},$,M;function Y(J){f[J.kind][J.tag]=f.fallback[J.tag]=J}for($=0,M=arguments.length;$<M;$+=1)arguments[$].forEach(Y);return f}function Lf(f){this.include=f.include||[],this.implicit=f.implicit||[],this.explicit=f.explicit||[],this.implicit.forEach(function($){if($.loadKind&&$.loadKind!=="scalar")throw new B0("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=z1(this,"implicit",[]),this.compiledExplicit=z1(this,"explicit",[]),this.compiledTypeMap=k5(this.compiledImplicit,this.compiledExplicit)}Lf.DEFAULT=null;Lf.create=function(){var $,M;switch(arguments.length){case 1:$=Lf.DEFAULT,M=arguments[0];break;case 2:$=arguments[0],M=arguments[1];break;default:throw new B0("Wrong number of arguments for Schema.create function")}if($=C$.toArray($),M=C$.toArray(M),!$.every(function(Y){return Y instanceof Lf}))throw new B0("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!M.every(function(Y){return Y instanceof I5}))throw new B0("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new Lf({include:$,explicit:M})};b$.exports=Lf});var _$=S((n9,v$)=>{var C5=v();v$.exports=new C5("tag:yaml.org,2002:str",{kind:"scalar",construct:function(f){return f!==null?f:""}})});var u$=S((i9,E$)=>{var b5=v();E$.exports=new b5("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(f){return f!==null?f:[]}})});var g$=S((o9,h$)=>{var v5=v();h$.exports=new v5("tag:yaml.org,2002:map",{kind:"mapping",construct:function(f){return f!==null?f:{}}})});var H0=S((s9,m$)=>{var _5=Vf();m$.exports=new _5({explicit:[_$(),u$(),g$()]})});var c$=S((a9,r$)=>{var E5=v();function u5(f){if(f===null)return!0;var $=f.length;return $===1&&f==="~"||$===4&&(f==="null"||f==="Null"||f==="NULL")}function h5(){return null}function g5(f){return f===null}r$.exports=new E5("tag:yaml.org,2002:null",{kind:"scalar",resolve:u5,construct:h5,predicate:g5,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var l$=S((e9,p$)=>{var m5=v();function r5(f){if(f===null)return!1;var $=f.length;return $===4&&(f==="true"||f==="True"||f==="TRUE")||$===5&&(f==="false"||f==="False"||f==="FALSE")}function c5(f){return f==="true"||f==="True"||f==="TRUE"}function p5(f){return Object.prototype.toString.call(f)==="[object Boolean]"}p$.exports=new m5("tag:yaml.org,2002:bool",{kind:"scalar",resolve:r5,construct:c5,predicate:p5,represent:{lowercase:function(f){return f?"true":"false"},uppercase:function(f){return f?"TRUE":"FALSE"},camelcase:function(f){return f?"True":"False"}},defaultStyle:"lowercase"})});var n$=S((t9,d$)=>{var l5=Wf(),d5=v();function n5(f){return 48<=f&&f<=57||65<=f&&f<=70||97<=f&&f<=102}function i5(f){return 48<=f&&f<=55}function o5(f){return 48<=f&&f<=57}function s5(f){if(f===null)return!1;var $=f.length,M=0,Y=!1,J;if(!$)return!1;if(J=f[M],J==="-"||J==="+")J=f[++M];if(J==="0"){if(M+1===$)return!0;if(J=f[++M],J==="b"){M++;for(;M<$;M++){if(J=f[M],J==="_")continue;if(J!=="0"&&J!=="1")return!1;Y=!0}return Y&&J!=="_"}if(J==="x"){M++;for(;M<$;M++){if(J=f[M],J==="_")continue;if(!n5(f.charCodeAt(M)))return!1;Y=!0}return Y&&J!=="_"}for(;M<$;M++){if(J=f[M],J==="_")continue;if(!i5(f.charCodeAt(M)))return!1;Y=!0}return Y&&J!=="_"}if(J==="_")return!1;for(;M<$;M++){if(J=f[M],J==="_")continue;if(J===":")break;if(!o5(f.charCodeAt(M)))return!1;Y=!0}if(!Y||J==="_")return!1;if(J!==":")return!0;return/^(:[0-5]?[0-9])+$/.test(f.slice(M))}function a5(f){var $=f,M=1,Y,J,z=[];if($.indexOf("_")!==-1)$=$.replace(/_/g,"");if(Y=$[0],Y==="-"||Y==="+"){if(Y==="-")M=-1;$=$.slice(1),Y=$[0]}if($==="0")return 0;if(Y==="0"){if($[1]==="b")return M*parseInt($.slice(2),2);if($[1]==="x")return M*parseInt($,16);return M*parseInt($,8)}if($.indexOf(":")!==-1)return $.split(":").forEach(function(Z){z.unshift(parseInt(Z,10))}),$=0,J=1,z.forEach(function(Z){$+=Z*J,J*=60}),M*$;return M*parseInt($,10)}function e5(f){return Object.prototype.toString.call(f)==="[object Number]"&&(f%1===0&&!l5.isNegativeZero(f))}d$.exports=new d5("tag:yaml.org,2002:int",{kind:"scalar",resolve:s5,construct:a5,predicate:e5,represent:{binary:function(f){return f>=0?"0b"+f.toString(2):"-0b"+f.toString(2).slice(1)},octal:function(f){return f>=0?"0"+f.toString(8):"-0"+f.toString(8).slice(1)},decimal:function(f){return f.toString(10)},hexadecimal:function(f){return f>=0?"0x"+f.toString(16).toUpperCase():"-0x"+f.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var s$=S((fZ,o$)=>{var i$=Wf(),t5=v(),fz=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function $z(f){if(f===null)return!1;if(!fz.test(f)||f[f.length-1]==="_")return!1;return!0}function Mz(f){var $,M,Y,J;if($=f.replace(/_/g,"").toLowerCase(),M=$[0]==="-"?-1:1,J=[],"+-".indexOf($[0])>=0)$=$.slice(1);if($===".inf")return M===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;else if($===".nan")return NaN;else if($.indexOf(":")>=0)return $.split(":").forEach(function(z){J.unshift(parseFloat(z,10))}),$=0,Y=1,J.forEach(function(z){$+=z*Y,Y*=60}),M*$;return M*parseFloat($,10)}var Yz=/^[-+]?[0-9]+e/;function Jz(f,$){var M;if(isNaN(f))switch($){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===f)switch($){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===f)switch($){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(i$.isNegativeZero(f))return"-0.0";return M=f.toString(10),Yz.test(M)?M.replace("e",".e"):M}function zz(f){return Object.prototype.toString.call(f)==="[object Number]"&&(f%1!==0||i$.isNegativeZero(f))}o$.exports=new t5("tag:yaml.org,2002:float",{kind:"scalar",resolve:$z,construct:Mz,predicate:zz,represent:Jz,defaultStyle:"lowercase"})});var Z1=S(($Z,a$)=>{var Zz=Vf();a$.exports=new Zz({include:[H0()],implicit:[c$(),l$(),n$(),s$()]})});var X1=S((MZ,e$)=>{var Xz=Vf();e$.exports=new Xz({include:[Z1()]})});var M2=S((YZ,$2)=>{var Gz=v(),t$=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),f2=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function qz(f){if(f===null)return!1;if(t$.exec(f)!==null)return!0;if(f2.exec(f)!==null)return!0;return!1}function Qz(f){var $,M,Y,J,z,Z,X,G=0,q=null,Q,D,V;if($=t$.exec(f),$===null)$=f2.exec(f);if($===null)throw Error("Date resolve error");if(M=+$[1],Y=+$[2]-1,J=+$[3],!$[4])return new Date(Date.UTC(M,Y,J));if(z=+$[4],Z=+$[5],X=+$[6],$[7]){G=$[7].slice(0,3);while(G.length<3)G+="0";G=+G}if($[9]){if(Q=+$[10],D=+($[11]||0),q=(Q*60+D)*60000,$[9]==="-")q=-q}if(V=new Date(Date.UTC(M,Y,J,z,Z,X,G)),q)V.setTime(V.getTime()-q);return V}function Dz(f){return f.toISOString()}$2.exports=new Gz("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:qz,construct:Qz,instanceOf:Date,represent:Dz})});var J2=S((JZ,Y2)=>{var Wz=v();function Vz(f){return f==="<<"||f===null}Y2.exports=new Wz("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Vz})});var Z2=S((zZ,z2)=>{var Uf;try{G1=e,Uf=G1("buffer").Buffer}catch(f){}var G1,Uz=v(),q1=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
38
- \r`;function Kz(f){if(f===null)return!1;var $,M,Y=0,J=f.length,z=q1;for(M=0;M<J;M++){if($=z.indexOf(f.charAt(M)),$>64)continue;if($<0)return!1;Y+=6}return Y%8===0}function Bz(f){var $,M,Y=f.replace(/[\r\n=]/g,""),J=Y.length,z=q1,Z=0,X=[];for($=0;$<J;$++){if($%4===0&&$)X.push(Z>>16&255),X.push(Z>>8&255),X.push(Z&255);Z=Z<<6|z.indexOf(Y.charAt($))}if(M=J%4*6,M===0)X.push(Z>>16&255),X.push(Z>>8&255),X.push(Z&255);else if(M===18)X.push(Z>>10&255),X.push(Z>>2&255);else if(M===12)X.push(Z>>4&255);if(Uf)return Uf.from?Uf.from(X):new Uf(X);return X}function Hz(f){var $="",M=0,Y,J,z=f.length,Z=q1;for(Y=0;Y<z;Y++){if(Y%3===0&&Y)$+=Z[M>>18&63],$+=Z[M>>12&63],$+=Z[M>>6&63],$+=Z[M&63];M=(M<<8)+f[Y]}if(J=z%3,J===0)$+=Z[M>>18&63],$+=Z[M>>12&63],$+=Z[M>>6&63],$+=Z[M&63];else if(J===2)$+=Z[M>>10&63],$+=Z[M>>4&63],$+=Z[M<<2&63],$+=Z[64];else if(J===1)$+=Z[M>>2&63],$+=Z[M<<4&63],$+=Z[64],$+=Z[64];return $}function yz(f){return Uf&&Uf.isBuffer(f)}z2.exports=new Uz("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Kz,construct:Bz,predicate:yz,represent:Hz})});var G2=S((XZ,X2)=>{var Sz=v(),Fz=Object.prototype.hasOwnProperty,Pz=Object.prototype.toString;function Tz(f){if(f===null)return!0;var $=[],M,Y,J,z,Z,X=f;for(M=0,Y=X.length;M<Y;M+=1){if(J=X[M],Z=!1,Pz.call(J)!=="[object Object]")return!1;for(z in J)if(Fz.call(J,z))if(!Z)Z=!0;else return!1;if(!Z)return!1;if($.indexOf(z)===-1)$.push(z);else return!1}return!0}function wz(f){return f!==null?f:[]}X2.exports=new Sz("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Tz,construct:wz})});var Q2=S((GZ,q2)=>{var jz=v(),Rz=Object.prototype.toString;function Lz(f){if(f===null)return!0;var $,M,Y,J,z,Z=f;z=Array(Z.length);for($=0,M=Z.length;$<M;$+=1){if(Y=Z[$],Rz.call(Y)!=="[object Object]")return!1;if(J=Object.keys(Y),J.length!==1)return!1;z[$]=[J[0],Y[J[0]]]}return!0}function Az(f){if(f===null)return[];var $,M,Y,J,z,Z=f;z=Array(Z.length);for($=0,M=Z.length;$<M;$+=1)Y=Z[$],J=Object.keys(Y),z[$]=[J[0],Y[J[0]]];return z}q2.exports=new jz("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Lz,construct:Az})});var W2=S((qZ,D2)=>{var Nz=v(),Oz=Object.prototype.hasOwnProperty;function xz(f){if(f===null)return!0;var $,M=f;for($ in M)if(Oz.call(M,$)){if(M[$]!==null)return!1}return!0}function Iz(f){return f!==null?f:{}}D2.exports=new Nz("tag:yaml.org,2002:set",{kind:"mapping",resolve:xz,construct:Iz})});var Af=S((QZ,V2)=>{var kz=Vf();V2.exports=new kz({include:[X1()],implicit:[M2(),J2()],explicit:[Z2(),G2(),Q2(),W2()]})});var K2=S((DZ,U2)=>{var Cz=v();function bz(){return!0}function vz(){return}function _z(){return""}function Ez(f){return typeof f>"u"}U2.exports=new Cz("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:bz,construct:vz,predicate:Ez,represent:_z})});var H2=S((WZ,B2)=>{var uz=v();function hz(f){if(f===null)return!1;if(f.length===0)return!1;var $=f,M=/\/([gim]*)$/.exec(f),Y="";if($[0]==="/"){if(M)Y=M[1];if(Y.length>3)return!1;if($[$.length-Y.length-1]!=="/")return!1}return!0}function gz(f){var $=f,M=/\/([gim]*)$/.exec(f),Y="";if($[0]==="/"){if(M)Y=M[1];$=$.slice(1,$.length-Y.length-1)}return new RegExp($,Y)}function mz(f){var $="/"+f.source+"/";if(f.global)$+="g";if(f.multiline)$+="m";if(f.ignoreCase)$+="i";return $}function rz(f){return Object.prototype.toString.call(f)==="[object RegExp]"}B2.exports=new uz("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:hz,construct:gz,predicate:rz,represent:mz})});var S2=S((VZ,y2)=>{var y0;try{Q1=e,y0=Q1("esprima")}catch(f){if(typeof window<"u")y0=window.esprima}var Q1,cz=v();function pz(f){if(f===null)return!1;try{var $="("+f+")",M=y0.parse($,{range:!0});if(M.type!=="Program"||M.body.length!==1||M.body[0].type!=="ExpressionStatement"||M.body[0].expression.type!=="ArrowFunctionExpression"&&M.body[0].expression.type!=="FunctionExpression")return!1;return!0}catch(Y){return!1}}function lz(f){var $="("+f+")",M=y0.parse($,{range:!0}),Y=[],J;if(M.type!=="Program"||M.body.length!==1||M.body[0].type!=="ExpressionStatement"||M.body[0].expression.type!=="ArrowFunctionExpression"&&M.body[0].expression.type!=="FunctionExpression")throw Error("Failed to resolve function");if(M.body[0].expression.params.forEach(function(z){Y.push(z.name)}),J=M.body[0].expression.body.range,M.body[0].expression.body.type==="BlockStatement")return Function(Y,$.slice(J[0]+1,J[1]-1));return Function(Y,"return "+$.slice(J[0],J[1]))}function dz(f){return f.toString()}function nz(f){return Object.prototype.toString.call(f)==="[object Function]"}y2.exports=new cz("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:pz,construct:lz,predicate:nz,represent:dz})});var af=S((KZ,P2)=>{var F2=Vf();P2.exports=F2.DEFAULT=new F2({include:[Af()],explicit:[K2(),H2(),S2()]})});var m2=S((H6,ef)=>{var Jf=Wf(),N2=Rf(),iz=x$(),O2=Af(),oz=af(),Gf=Object.prototype.hasOwnProperty,S0=1,x2=2,I2=3,F0=4,D1=1,sz=2,T2=3,az=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,ez=/[\x85\u2028\u2029]/,tz=/[,\[\]\{\}]/,k2=/^(?:!|!!|![a-z\-]+!)$/i,C2=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function w2(f){return Object.prototype.toString.call(f)}function t(f){return f===10||f===13}function Kf(f){return f===9||f===32}function c(f){return f===9||f===32||f===10||f===13}function Nf(f){return f===44||f===91||f===93||f===123||f===125}function f6(f){var $;if(48<=f&&f<=57)return f-48;if($=f|32,97<=$&&$<=102)return $-97+10;return-1}function $6(f){if(f===120)return 2;if(f===117)return 4;if(f===85)return 8;return 0}function M6(f){if(48<=f&&f<=57)return f-48;return-1}function j2(f){return f===48?"\x00":f===97?"\x07":f===98?"\b":f===116?"\t":f===9?"\t":f===110?`
39
- `:f===118?"\v":f===102?"\f":f===114?"\r":f===101?"\x1B":f===32?" ":f===34?'"':f===47?"/":f===92?"\\":f===78?"…":f===95?" ":f===76?"\u2028":f===80?"\u2029":""}function Y6(f){if(f<=65535)return String.fromCharCode(f);return String.fromCharCode((f-65536>>10)+55296,(f-65536&1023)+56320)}function b2(f,$,M){if($==="__proto__")Object.defineProperty(f,$,{configurable:!0,enumerable:!0,writable:!0,value:M});else f[$]=M}var v2=Array(256),_2=Array(256);for(Zf=0;Zf<256;Zf++)v2[Zf]=j2(Zf)?1:0,_2[Zf]=j2(Zf);var Zf;function J6(f,$){this.input=f,this.filename=$.filename||null,this.schema=$.schema||oz,this.onWarning=$.onWarning||null,this.legacy=$.legacy||!1,this.json=$.json||!1,this.listener=$.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=f.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function E2(f,$){return new N2($,new iz(f.filename,f.input,f.position,f.line,f.position-f.lineStart))}function F(f,$){throw E2(f,$)}function P0(f,$){if(f.onWarning)f.onWarning.call(null,E2(f,$))}var R2={YAML:function($,M,Y){var J,z,Z;if($.version!==null)F($,"duplication of %YAML directive");if(Y.length!==1)F($,"YAML directive accepts exactly one argument");if(J=/^([0-9]+)\.([0-9]+)$/.exec(Y[0]),J===null)F($,"ill-formed argument of the YAML directive");if(z=parseInt(J[1],10),Z=parseInt(J[2],10),z!==1)F($,"unacceptable YAML version of the document");if($.version=Y[0],$.checkLineBreaks=Z<2,Z!==1&&Z!==2)P0($,"unsupported YAML version of the document")},TAG:function($,M,Y){var J,z;if(Y.length!==2)F($,"TAG directive accepts exactly two arguments");if(J=Y[0],z=Y[1],!k2.test(J))F($,"ill-formed tag handle (first argument) of the TAG directive");if(Gf.call($.tagMap,J))F($,'there is a previously declared suffix for "'+J+'" tag handle');if(!C2.test(z))F($,"ill-formed tag prefix (second argument) of the TAG directive");$.tagMap[J]=z}};function Xf(f,$,M,Y){var J,z,Z,X;if($<M){if(X=f.input.slice($,M),Y){for(J=0,z=X.length;J<z;J+=1)if(Z=X.charCodeAt(J),!(Z===9||32<=Z&&Z<=1114111))F(f,"expected valid JSON character")}else if(az.test(X))F(f,"the stream contains non-printable characters");f.result+=X}}function L2(f,$,M,Y){var J,z,Z,X;if(!Jf.isObject(M))F(f,"cannot merge mappings; the provided source object is unacceptable");J=Object.keys(M);for(Z=0,X=J.length;Z<X;Z+=1)if(z=J[Z],!Gf.call($,z))b2($,z,M[z]),Y[z]=!0}function Of(f,$,M,Y,J,z,Z,X){var G,q;if(Array.isArray(J)){J=Array.prototype.slice.call(J);for(G=0,q=J.length;G<q;G+=1){if(Array.isArray(J[G]))F(f,"nested arrays are not supported inside keys");if(typeof J==="object"&&w2(J[G])==="[object Object]")J[G]="[object Object]"}}if(typeof J==="object"&&w2(J)==="[object Object]")J="[object Object]";if(J=String(J),$===null)$={};if(Y==="tag:yaml.org,2002:merge")if(Array.isArray(z))for(G=0,q=z.length;G<q;G+=1)L2(f,$,z[G],M);else L2(f,$,z,M);else{if(!f.json&&!Gf.call(M,J)&&Gf.call($,J))f.line=Z||f.line,f.position=X||f.position,F(f,"duplicated mapping key");b2($,J,z),delete M[J]}return $}function W1(f){var $=f.input.charCodeAt(f.position);if($===10)f.position++;else if($===13){if(f.position++,f.input.charCodeAt(f.position)===10)f.position++}else F(f,"a line break is expected");f.line+=1,f.lineStart=f.position}function b(f,$,M){var Y=0,J=f.input.charCodeAt(f.position);while(J!==0){while(Kf(J))J=f.input.charCodeAt(++f.position);if($&&J===35)do J=f.input.charCodeAt(++f.position);while(J!==10&&J!==13&&J!==0);if(t(J)){W1(f),J=f.input.charCodeAt(f.position),Y++,f.lineIndent=0;while(J===32)f.lineIndent++,J=f.input.charCodeAt(++f.position)}else break}if(M!==-1&&Y!==0&&f.lineIndent<M)P0(f,"deficient indentation");return Y}function T0(f){var $=f.position,M;if(M=f.input.charCodeAt($),(M===45||M===46)&&M===f.input.charCodeAt($+1)&&M===f.input.charCodeAt($+2)){if($+=3,M=f.input.charCodeAt($),M===0||c(M))return!0}return!1}function V1(f,$){if($===1)f.result+=" ";else if($>1)f.result+=Jf.repeat(`
40
- `,$-1)}function z6(f,$,M){var Y,J,z,Z,X,G,q,Q,D=f.kind,V=f.result,W;if(W=f.input.charCodeAt(f.position),c(W)||Nf(W)||W===35||W===38||W===42||W===33||W===124||W===62||W===39||W===34||W===37||W===64||W===96)return!1;if(W===63||W===45){if(J=f.input.charCodeAt(f.position+1),c(J)||M&&Nf(J))return!1}f.kind="scalar",f.result="",z=Z=f.position,X=!1;while(W!==0){if(W===58){if(J=f.input.charCodeAt(f.position+1),c(J)||M&&Nf(J))break}else if(W===35){if(Y=f.input.charCodeAt(f.position-1),c(Y))break}else if(f.position===f.lineStart&&T0(f)||M&&Nf(W))break;else if(t(W))if(G=f.line,q=f.lineStart,Q=f.lineIndent,b(f,!1,-1),f.lineIndent>=$){X=!0,W=f.input.charCodeAt(f.position);continue}else{f.position=Z,f.line=G,f.lineStart=q,f.lineIndent=Q;break}if(X)Xf(f,z,Z,!1),V1(f,f.line-G),z=Z=f.position,X=!1;if(!Kf(W))Z=f.position+1;W=f.input.charCodeAt(++f.position)}if(Xf(f,z,Z,!1),f.result)return!0;return f.kind=D,f.result=V,!1}function Z6(f,$){var M,Y,J;if(M=f.input.charCodeAt(f.position),M!==39)return!1;f.kind="scalar",f.result="",f.position++,Y=J=f.position;while((M=f.input.charCodeAt(f.position))!==0)if(M===39)if(Xf(f,Y,f.position,!0),M=f.input.charCodeAt(++f.position),M===39)Y=f.position,f.position++,J=f.position;else return!0;else if(t(M))Xf(f,Y,J,!0),V1(f,b(f,!1,$)),Y=J=f.position;else if(f.position===f.lineStart&&T0(f))F(f,"unexpected end of the document within a single quoted scalar");else f.position++,J=f.position;F(f,"unexpected end of the stream within a single quoted scalar")}function X6(f,$){var M,Y,J,z,Z,X;if(X=f.input.charCodeAt(f.position),X!==34)return!1;f.kind="scalar",f.result="",f.position++,M=Y=f.position;while((X=f.input.charCodeAt(f.position))!==0)if(X===34)return Xf(f,M,f.position,!0),f.position++,!0;else if(X===92){if(Xf(f,M,f.position,!0),X=f.input.charCodeAt(++f.position),t(X))b(f,!1,$);else if(X<256&&v2[X])f.result+=_2[X],f.position++;else if((Z=$6(X))>0){J=Z,z=0;for(;J>0;J--)if(X=f.input.charCodeAt(++f.position),(Z=f6(X))>=0)z=(z<<4)+Z;else F(f,"expected hexadecimal character");f.result+=Y6(z),f.position++}else F(f,"unknown escape sequence");M=Y=f.position}else if(t(X))Xf(f,M,Y,!0),V1(f,b(f,!1,$)),M=Y=f.position;else if(f.position===f.lineStart&&T0(f))F(f,"unexpected end of the document within a double quoted scalar");else f.position++,Y=f.position;F(f,"unexpected end of the stream within a double quoted scalar")}function G6(f,$){var M=!0,Y,J=f.tag,z,Z=f.anchor,X,G,q,Q,D,V={},W,H,R,P;if(P=f.input.charCodeAt(f.position),P===91)G=93,D=!1,z=[];else if(P===123)G=125,D=!0,z={};else return!1;if(f.anchor!==null)f.anchorMap[f.anchor]=z;P=f.input.charCodeAt(++f.position);while(P!==0){if(b(f,!0,$),P=f.input.charCodeAt(f.position),P===G)return f.position++,f.tag=J,f.anchor=Z,f.kind=D?"mapping":"sequence",f.result=z,!0;else if(!M)F(f,"missed comma between flow collection entries");if(H=W=R=null,q=Q=!1,P===63){if(X=f.input.charCodeAt(f.position+1),c(X))q=Q=!0,f.position++,b(f,!0,$)}if(Y=f.line,xf(f,$,S0,!1,!0),H=f.tag,W=f.result,b(f,!0,$),P=f.input.charCodeAt(f.position),(Q||f.line===Y)&&P===58)q=!0,P=f.input.charCodeAt(++f.position),b(f,!0,$),xf(f,$,S0,!1,!0),R=f.result;if(D)Of(f,z,V,H,W,R);else if(q)z.push(Of(f,null,V,H,W,R));else z.push(W);if(b(f,!0,$),P=f.input.charCodeAt(f.position),P===44)M=!0,P=f.input.charCodeAt(++f.position);else M=!1}F(f,"unexpected end of the stream within a flow collection")}function q6(f,$){var M,Y,J=D1,z=!1,Z=!1,X=$,G=0,q=!1,Q,D;if(D=f.input.charCodeAt(f.position),D===124)Y=!1;else if(D===62)Y=!0;else return!1;f.kind="scalar",f.result="";while(D!==0)if(D=f.input.charCodeAt(++f.position),D===43||D===45)if(D1===J)J=D===43?T2:sz;else F(f,"repeat of a chomping mode identifier");else if((Q=M6(D))>=0)if(Q===0)F(f,"bad explicit indentation width of a block scalar; it cannot be less than one");else if(!Z)X=$+Q-1,Z=!0;else F(f,"repeat of an indentation width identifier");else break;if(Kf(D)){do D=f.input.charCodeAt(++f.position);while(Kf(D));if(D===35)do D=f.input.charCodeAt(++f.position);while(!t(D)&&D!==0)}while(D!==0){W1(f),f.lineIndent=0,D=f.input.charCodeAt(f.position);while((!Z||f.lineIndent<X)&&D===32)f.lineIndent++,D=f.input.charCodeAt(++f.position);if(!Z&&f.lineIndent>X)X=f.lineIndent;if(t(D)){G++;continue}if(f.lineIndent<X){if(J===T2)f.result+=Jf.repeat(`
41
- `,z?1+G:G);else if(J===D1){if(z)f.result+=`
42
- `}break}if(Y)if(Kf(D))q=!0,f.result+=Jf.repeat(`
43
- `,z?1+G:G);else if(q)q=!1,f.result+=Jf.repeat(`
44
- `,G+1);else if(G===0){if(z)f.result+=" "}else f.result+=Jf.repeat(`
45
- `,G);else f.result+=Jf.repeat(`
46
- `,z?1+G:G);z=!0,Z=!0,G=0,M=f.position;while(!t(D)&&D!==0)D=f.input.charCodeAt(++f.position);Xf(f,M,f.position,!1)}return!0}function A2(f,$){var M,Y=f.tag,J=f.anchor,z=[],Z,X=!1,G;if(f.anchor!==null)f.anchorMap[f.anchor]=z;G=f.input.charCodeAt(f.position);while(G!==0){if(G!==45)break;if(Z=f.input.charCodeAt(f.position+1),!c(Z))break;if(X=!0,f.position++,b(f,!0,-1)){if(f.lineIndent<=$){z.push(null),G=f.input.charCodeAt(f.position);continue}}if(M=f.line,xf(f,$,I2,!1,!0),z.push(f.result),b(f,!0,-1),G=f.input.charCodeAt(f.position),(f.line===M||f.lineIndent>$)&&G!==0)F(f,"bad indentation of a sequence entry");else if(f.lineIndent<$)break}if(X)return f.tag=Y,f.anchor=J,f.kind="sequence",f.result=z,!0;return!1}function Q6(f,$,M){var Y,J,z,Z,X=f.tag,G=f.anchor,q={},Q={},D=null,V=null,W=null,H=!1,R=!1,P;if(f.anchor!==null)f.anchorMap[f.anchor]=q;P=f.input.charCodeAt(f.position);while(P!==0){if(Y=f.input.charCodeAt(f.position+1),z=f.line,Z=f.position,(P===63||P===58)&&c(Y)){if(P===63){if(H)Of(f,q,Q,D,V,null),D=V=W=null;R=!0,H=!0,J=!0}else if(H)H=!1,J=!0;else F(f,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");f.position+=1,P=Y}else if(xf(f,M,x2,!1,!0))if(f.line===z){P=f.input.charCodeAt(f.position);while(Kf(P))P=f.input.charCodeAt(++f.position);if(P===58){if(P=f.input.charCodeAt(++f.position),!c(P))F(f,"a whitespace character is expected after the key-value separator within a block mapping");if(H)Of(f,q,Q,D,V,null),D=V=W=null;R=!0,H=!1,J=!1,D=f.tag,V=f.result}else if(R)F(f,"can not read an implicit mapping pair; a colon is missed");else return f.tag=X,f.anchor=G,!0}else if(R)F(f,"can not read a block mapping entry; a multiline key may not be an implicit key");else return f.tag=X,f.anchor=G,!0;else break;if(f.line===z||f.lineIndent>$){if(xf(f,$,F0,!0,J))if(H)V=f.result;else W=f.result;if(!H)Of(f,q,Q,D,V,W,z,Z),D=V=W=null;b(f,!0,-1),P=f.input.charCodeAt(f.position)}if(f.lineIndent>$&&P!==0)F(f,"bad indentation of a mapping entry");else if(f.lineIndent<$)break}if(H)Of(f,q,Q,D,V,null);if(R)f.tag=X,f.anchor=G,f.kind="mapping",f.result=q;return R}function D6(f){var $,M=!1,Y=!1,J,z,Z;if(Z=f.input.charCodeAt(f.position),Z!==33)return!1;if(f.tag!==null)F(f,"duplication of a tag property");if(Z=f.input.charCodeAt(++f.position),Z===60)M=!0,Z=f.input.charCodeAt(++f.position);else if(Z===33)Y=!0,J="!!",Z=f.input.charCodeAt(++f.position);else J="!";if($=f.position,M){do Z=f.input.charCodeAt(++f.position);while(Z!==0&&Z!==62);if(f.position<f.length)z=f.input.slice($,f.position),Z=f.input.charCodeAt(++f.position);else F(f,"unexpected end of the stream within a verbatim tag")}else{while(Z!==0&&!c(Z)){if(Z===33)if(!Y){if(J=f.input.slice($-1,f.position+1),!k2.test(J))F(f,"named tag handle cannot contain such characters");Y=!0,$=f.position+1}else F(f,"tag suffix cannot contain exclamation marks");Z=f.input.charCodeAt(++f.position)}if(z=f.input.slice($,f.position),tz.test(z))F(f,"tag suffix cannot contain flow indicator characters")}if(z&&!C2.test(z))F(f,"tag name cannot contain such characters: "+z);if(M)f.tag=z;else if(Gf.call(f.tagMap,J))f.tag=f.tagMap[J]+z;else if(J==="!")f.tag="!"+z;else if(J==="!!")f.tag="tag:yaml.org,2002:"+z;else F(f,'undeclared tag handle "'+J+'"');return!0}function W6(f){var $,M;if(M=f.input.charCodeAt(f.position),M!==38)return!1;if(f.anchor!==null)F(f,"duplication of an anchor property");M=f.input.charCodeAt(++f.position),$=f.position;while(M!==0&&!c(M)&&!Nf(M))M=f.input.charCodeAt(++f.position);if(f.position===$)F(f,"name of an anchor node must contain at least one character");return f.anchor=f.input.slice($,f.position),!0}function V6(f){var $,M,Y;if(Y=f.input.charCodeAt(f.position),Y!==42)return!1;Y=f.input.charCodeAt(++f.position),$=f.position;while(Y!==0&&!c(Y)&&!Nf(Y))Y=f.input.charCodeAt(++f.position);if(f.position===$)F(f,"name of an alias node must contain at least one character");if(M=f.input.slice($,f.position),!Gf.call(f.anchorMap,M))F(f,'unidentified alias "'+M+'"');return f.result=f.anchorMap[M],b(f,!0,-1),!0}function xf(f,$,M,Y,J){var z,Z,X,G=1,q=!1,Q=!1,D,V,W,H,R;if(f.listener!==null)f.listener("open",f);if(f.tag=null,f.anchor=null,f.kind=null,f.result=null,z=Z=X=F0===M||I2===M,Y){if(b(f,!0,-1)){if(q=!0,f.lineIndent>$)G=1;else if(f.lineIndent===$)G=0;else if(f.lineIndent<$)G=-1}}if(G===1)while(D6(f)||W6(f))if(b(f,!0,-1)){if(q=!0,X=z,f.lineIndent>$)G=1;else if(f.lineIndent===$)G=0;else if(f.lineIndent<$)G=-1}else X=!1;if(X)X=q||J;if(G===1||F0===M){if(S0===M||x2===M)H=$;else H=$+1;if(R=f.position-f.lineStart,G===1)if(X&&(A2(f,R)||Q6(f,R,H))||G6(f,H))Q=!0;else{if(Z&&q6(f,H)||Z6(f,H)||X6(f,H))Q=!0;else if(V6(f)){if(Q=!0,f.tag!==null||f.anchor!==null)F(f,"alias node should not have any properties")}else if(z6(f,H,S0===M)){if(Q=!0,f.tag===null)f.tag="?"}if(f.anchor!==null)f.anchorMap[f.anchor]=f.result}else if(G===0)Q=X&&A2(f,R)}if(f.tag!==null&&f.tag!=="!")if(f.tag==="?"){if(f.result!==null&&f.kind!=="scalar")F(f,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+f.kind+'"');for(D=0,V=f.implicitTypes.length;D<V;D+=1)if(W=f.implicitTypes[D],W.resolve(f.result)){if(f.result=W.construct(f.result),f.tag=W.tag,f.anchor!==null)f.anchorMap[f.anchor]=f.result;break}}else if(Gf.call(f.typeMap[f.kind||"fallback"],f.tag)){if(W=f.typeMap[f.kind||"fallback"][f.tag],f.result!==null&&W.kind!==f.kind)F(f,"unacceptable node kind for !<"+f.tag+'> tag; it should be "'+W.kind+'", not "'+f.kind+'"');if(!W.resolve(f.result))F(f,"cannot resolve a node with !<"+f.tag+"> explicit tag");else if(f.result=W.construct(f.result),f.anchor!==null)f.anchorMap[f.anchor]=f.result}else F(f,"unknown tag !<"+f.tag+">");if(f.listener!==null)f.listener("close",f);return f.tag!==null||f.anchor!==null||Q}function U6(f){var $=f.position,M,Y,J,z=!1,Z;f.version=null,f.checkLineBreaks=f.legacy,f.tagMap={},f.anchorMap={};while((Z=f.input.charCodeAt(f.position))!==0){if(b(f,!0,-1),Z=f.input.charCodeAt(f.position),f.lineIndent>0||Z!==37)break;z=!0,Z=f.input.charCodeAt(++f.position),M=f.position;while(Z!==0&&!c(Z))Z=f.input.charCodeAt(++f.position);if(Y=f.input.slice(M,f.position),J=[],Y.length<1)F(f,"directive name must not be less than one character in length");while(Z!==0){while(Kf(Z))Z=f.input.charCodeAt(++f.position);if(Z===35){do Z=f.input.charCodeAt(++f.position);while(Z!==0&&!t(Z));break}if(t(Z))break;M=f.position;while(Z!==0&&!c(Z))Z=f.input.charCodeAt(++f.position);J.push(f.input.slice(M,f.position))}if(Z!==0)W1(f);if(Gf.call(R2,Y))R2[Y](f,Y,J);else P0(f,'unknown document directive "'+Y+'"')}if(b(f,!0,-1),f.lineIndent===0&&f.input.charCodeAt(f.position)===45&&f.input.charCodeAt(f.position+1)===45&&f.input.charCodeAt(f.position+2)===45)f.position+=3,b(f,!0,-1);else if(z)F(f,"directives end mark is expected");if(xf(f,f.lineIndent-1,F0,!1,!0),b(f,!0,-1),f.checkLineBreaks&&ez.test(f.input.slice($,f.position)))P0(f,"non-ASCII line breaks are interpreted as content");if(f.documents.push(f.result),f.position===f.lineStart&&T0(f)){if(f.input.charCodeAt(f.position)===46)f.position+=3,b(f,!0,-1);return}if(f.position<f.length-1)F(f,"end of the stream or a document separator is expected");else return}function u2(f,$){if(f=String(f),$=$||{},f.length!==0){if(f.charCodeAt(f.length-1)!==10&&f.charCodeAt(f.length-1)!==13)f+=`
47
- `;if(f.charCodeAt(0)===65279)f=f.slice(1)}var M=new J6(f,$),Y=f.indexOf("\x00");if(Y!==-1)M.position=Y,F(M,"null byte is not allowed in input");M.input+="\x00";while(M.input.charCodeAt(M.position)===32)M.lineIndent+=1,M.position+=1;while(M.position<M.length-1)U6(M);return M.documents}function h2(f,$,M){if($!==null&&typeof $==="object"&&typeof M>"u")M=$,$=null;var Y=u2(f,M);if(typeof $!=="function")return Y;for(var J=0,z=Y.length;J<z;J+=1)$(Y[J])}function g2(f,$){var M=u2(f,$);if(M.length===0)return;else if(M.length===1)return M[0];throw new N2("expected a single document in the stream, but found more")}function K6(f,$,M){if(typeof $==="object"&&$!==null&&typeof M>"u")M=$,$=null;return h2(f,$,Jf.extend({schema:O2},M))}function B6(f,$){return g2(f,Jf.extend({schema:O2},$))}H6.loadAll=h2;H6.load=g2;H6.safeLoadAll=K6;H6.safeLoad=B6});var QM=S((M8,H1)=>{var f0=Wf(),$0=Rf(),T6=af(),w6=Af(),o2=Object.prototype.toString,s2=Object.prototype.hasOwnProperty,j6=9,tf=10,R6=13,L6=32,A6=33,N6=34,a2=35,O6=37,x6=38,I6=39,k6=42,e2=44,C6=45,t2=58,b6=61,v6=62,_6=63,E6=64,fM=91,$M=93,u6=96,MM=123,h6=124,YM=125,u={};u[0]="\\0";u[7]="\\a";u[8]="\\b";u[9]="\\t";u[10]="\\n";u[11]="\\v";u[12]="\\f";u[13]="\\r";u[27]="\\e";u[34]="\\\"";u[92]="\\\\";u[133]="\\N";u[160]="\\_";u[8232]="\\L";u[8233]="\\P";var g6=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function m6(f,$){var M,Y,J,z,Z,X,G;if($===null)return{};M={},Y=Object.keys($);for(J=0,z=Y.length;J<z;J+=1){if(Z=Y[J],X=String($[Z]),Z.slice(0,2)==="!!")Z="tag:yaml.org,2002:"+Z.slice(2);if(G=f.compiledTypeMap.fallback[Z],G&&s2.call(G.styleAliases,X))X=G.styleAliases[X];M[Z]=X}return M}function r2(f){var $,M,Y;if($=f.toString(16).toUpperCase(),f<=255)M="x",Y=2;else if(f<=65535)M="u",Y=4;else if(f<=4294967295)M="U",Y=8;else throw new $0("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+M+f0.repeat("0",Y-$.length)+$}function r6(f){this.schema=f.schema||T6,this.indent=Math.max(1,f.indent||2),this.noArrayIndent=f.noArrayIndent||!1,this.skipInvalid=f.skipInvalid||!1,this.flowLevel=f0.isNothing(f.flowLevel)?-1:f.flowLevel,this.styleMap=m6(this.schema,f.styles||null),this.sortKeys=f.sortKeys||!1,this.lineWidth=f.lineWidth||80,this.noRefs=f.noRefs||!1,this.noCompatMode=f.noCompatMode||!1,this.condenseFlow=f.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function c2(f,$){var M=f0.repeat(" ",$),Y=0,J=-1,z="",Z,X=f.length;while(Y<X){if(J=f.indexOf(`
35
+ …\u2028\u2029`.indexOf(this.buffer.charAt(Z))===-1)if(Z+=1,Z-this.position>M/2-1){z=" ... ",Z-=5;break}return X=this.buffer.slice(J,Z),VM.repeat(" ",$)+Y+X+z+`
36
+ `+VM.repeat(" ",$+this.position-J+Y.length)+"^"};F$.prototype.toString=function($){var M,Y="";if(this.name)Y+='in "'+this.name+'" ';if(Y+="at line "+(this.line+1)+", column "+(this.column+1),!$){if(M=this.getSnippet(),M)Y+=`:
37
+ `+M}return Y};qM.exports=F$});var h=V((MV,SM)=>{var HM=M0(),yZ=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],kZ=["scalar","sequence","mapping"];function bZ(f){var $={};if(f!==null)Object.keys(f).forEach(function(M){f[M].forEach(function(Y){$[String(Y)]=M})});return $}function _Z(f,$){if($=$||{},Object.keys($).forEach(function(M){if(yZ.indexOf(M)===-1)throw new HM('Unknown option "'+M+'" is met in definition of "'+f+'" YAML type.')}),this.tag=f,this.kind=$.kind||null,this.resolve=$.resolve||function(){return!0},this.construct=$.construct||function(M){return M},this.instanceOf=$.instanceOf||null,this.predicate=$.predicate||null,this.represent=$.represent||null,this.defaultStyle=$.defaultStyle||null,this.styleAliases=bZ($.styleAliases||null),kZ.indexOf(this.kind)===-1)throw new HM('Unknown kind "'+this.kind+'" is specified for "'+f+'" YAML type.')}SM.exports=_Z});var c1=V((YV,RM)=>{var FM=g1(),Wf=M0(),vZ=h();function R$(f,$,M){var Y=[];return f.include.forEach(function(J){M=R$(J,$,M)}),f[$].forEach(function(J){M.forEach(function(z,Z){if(z.tag===J.tag&&z.kind===J.kind)Y.push(Z)}),M.push(J)}),M.filter(function(J,z){return Y.indexOf(z)===-1})}function uZ(){var f={scalar:{},sequence:{},mapping:{},fallback:{}},$,M;function Y(J){f[J.kind][J.tag]=f.fallback[J.tag]=J}for($=0,M=arguments.length;$<M;$+=1)arguments[$].forEach(Y);return f}function Y0(f){this.include=f.include||[],this.implicit=f.implicit||[],this.explicit=f.explicit||[],this.implicit.forEach(function($){if($.loadKind&&$.loadKind!=="scalar")throw new Wf("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=R$(this,"implicit",[]),this.compiledExplicit=R$(this,"explicit",[]),this.compiledTypeMap=uZ(this.compiledImplicit,this.compiledExplicit)}Y0.DEFAULT=null;Y0.create=function(){var $,M;switch(arguments.length){case 1:$=Y0.DEFAULT,M=arguments[0];break;case 2:$=arguments[0],M=arguments[1];break;default:throw new Wf("Wrong number of arguments for Schema.create function")}if($=FM.toArray($),M=FM.toArray(M),!$.every(function(Y){return Y instanceof Y0}))throw new Wf("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!M.every(function(Y){return Y instanceof vZ}))throw new Wf("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new Y0({include:$,explicit:M})};RM.exports=Y0});var OM=V((JV,NM)=>{var hZ=h();NM.exports=new hZ("tag:yaml.org,2002:str",{kind:"scalar",construct:function(f){return f!==null?f:""}})});var LM=V((zV,AM)=>{var gZ=h();AM.exports=new gZ("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(f){return f!==null?f:[]}})});var TM=V((ZV,PM)=>{var cZ=h();PM.exports=new cZ("tag:yaml.org,2002:map",{kind:"mapping",construct:function(f){return f!==null?f:{}}})});var Kf=V((XV,wM)=>{var mZ=c1();wM.exports=new mZ({explicit:[OM(),LM(),TM()]})});var IM=V((QV,jM)=>{var dZ=h();function lZ(f){if(f===null)return!0;var $=f.length;return $===1&&f==="~"||$===4&&(f==="null"||f==="Null"||f==="NULL")}function nZ(){return null}function rZ(f){return f===null}jM.exports=new dZ("tag:yaml.org,2002:null",{kind:"scalar",resolve:lZ,construct:nZ,predicate:rZ,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var EM=V((DV,CM)=>{var pZ=h();function iZ(f){if(f===null)return!1;var $=f.length;return $===4&&(f==="true"||f==="True"||f==="TRUE")||$===5&&(f==="false"||f==="False"||f==="FALSE")}function oZ(f){return f==="true"||f==="True"||f==="TRUE"}function sZ(f){return Object.prototype.toString.call(f)==="[object Boolean]"}CM.exports=new pZ("tag:yaml.org,2002:bool",{kind:"scalar",resolve:iZ,construct:oZ,predicate:sZ,represent:{lowercase:function(f){return f?"true":"false"},uppercase:function(f){return f?"TRUE":"FALSE"},camelcase:function(f){return f?"True":"False"}},defaultStyle:"lowercase"})});var yM=V((GV,xM)=>{var aZ=g1(),tZ=h();function eZ(f){return 48<=f&&f<=57||65<=f&&f<=70||97<=f&&f<=102}function f7(f){return 48<=f&&f<=55}function $7(f){return 48<=f&&f<=57}function M7(f){if(f===null)return!1;var $=f.length,M=0,Y=!1,J;if(!$)return!1;if(J=f[M],J==="-"||J==="+")J=f[++M];if(J==="0"){if(M+1===$)return!0;if(J=f[++M],J==="b"){M++;for(;M<$;M++){if(J=f[M],J==="_")continue;if(J!=="0"&&J!=="1")return!1;Y=!0}return Y&&J!=="_"}if(J==="x"){M++;for(;M<$;M++){if(J=f[M],J==="_")continue;if(!eZ(f.charCodeAt(M)))return!1;Y=!0}return Y&&J!=="_"}for(;M<$;M++){if(J=f[M],J==="_")continue;if(!f7(f.charCodeAt(M)))return!1;Y=!0}return Y&&J!=="_"}if(J==="_")return!1;for(;M<$;M++){if(J=f[M],J==="_")continue;if(J===":")break;if(!$7(f.charCodeAt(M)))return!1;Y=!0}if(!Y||J==="_")return!1;if(J!==":")return!0;return/^(:[0-5]?[0-9])+$/.test(f.slice(M))}function Y7(f){var $=f,M=1,Y,J,z=[];if($.indexOf("_")!==-1)$=$.replace(/_/g,"");if(Y=$[0],Y==="-"||Y==="+"){if(Y==="-")M=-1;$=$.slice(1),Y=$[0]}if($==="0")return 0;if(Y==="0"){if($[1]==="b")return M*parseInt($.slice(2),2);if($[1]==="x")return M*parseInt($,16);return M*parseInt($,8)}if($.indexOf(":")!==-1)return $.split(":").forEach(function(Z){z.unshift(parseInt(Z,10))}),$=0,J=1,z.forEach(function(Z){$+=Z*J,J*=60}),M*$;return M*parseInt($,10)}function J7(f){return Object.prototype.toString.call(f)==="[object Number]"&&(f%1===0&&!aZ.isNegativeZero(f))}xM.exports=new tZ("tag:yaml.org,2002:int",{kind:"scalar",resolve:M7,construct:Y7,predicate:J7,represent:{binary:function(f){return f>=0?"0b"+f.toString(2):"-0b"+f.toString(2).slice(1)},octal:function(f){return f>=0?"0"+f.toString(8):"-0"+f.toString(8).slice(1)},decimal:function(f){return f.toString(10)},hexadecimal:function(f){return f>=0?"0x"+f.toString(16).toUpperCase():"-0x"+f.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var _M=V((UV,bM)=>{var kM=g1(),z7=h(),Z7=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function X7(f){if(f===null)return!1;if(!Z7.test(f)||f[f.length-1]==="_")return!1;return!0}function Q7(f){var $,M,Y,J;if($=f.replace(/_/g,"").toLowerCase(),M=$[0]==="-"?-1:1,J=[],"+-".indexOf($[0])>=0)$=$.slice(1);if($===".inf")return M===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;else if($===".nan")return NaN;else if($.indexOf(":")>=0)return $.split(":").forEach(function(z){J.unshift(parseFloat(z,10))}),$=0,Y=1,J.forEach(function(z){$+=z*Y,Y*=60}),M*$;return M*parseFloat($,10)}var D7=/^[-+]?[0-9]+e/;function G7(f,$){var M;if(isNaN(f))switch($){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===f)switch($){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===f)switch($){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(kM.isNegativeZero(f))return"-0.0";return M=f.toString(10),D7.test(M)?M.replace("e",".e"):M}function U7(f){return Object.prototype.toString.call(f)==="[object Number]"&&(f%1!==0||kM.isNegativeZero(f))}bM.exports=new z7("tag:yaml.org,2002:float",{kind:"scalar",resolve:X7,construct:Q7,predicate:U7,represent:G7,defaultStyle:"lowercase"})});var N$=V((WV,vM)=>{var W7=c1();vM.exports=new W7({include:[Kf()],implicit:[IM(),EM(),yM(),_M()]})});var O$=V((KV,uM)=>{var K7=c1();uM.exports=new K7({include:[N$()]})});var mM=V((VV,cM)=>{var V7=h(),hM=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),gM=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function q7(f){if(f===null)return!1;if(hM.exec(f)!==null)return!0;if(gM.exec(f)!==null)return!0;return!1}function B7(f){var $,M,Y,J,z,Z,X,Q=0,D=null,G,U,K;if($=hM.exec(f),$===null)$=gM.exec(f);if($===null)throw Error("Date resolve error");if(M=+$[1],Y=+$[2]-1,J=+$[3],!$[4])return new Date(Date.UTC(M,Y,J));if(z=+$[4],Z=+$[5],X=+$[6],$[7]){Q=$[7].slice(0,3);while(Q.length<3)Q+="0";Q=+Q}if($[9]){if(G=+$[10],U=+($[11]||0),D=(G*60+U)*60000,$[9]==="-")D=-D}if(K=new Date(Date.UTC(M,Y,J,z,Z,X,Q)),D)K.setTime(K.getTime()-D);return K}function H7(f){return f.toISOString()}cM.exports=new V7("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:q7,construct:B7,instanceOf:Date,represent:H7})});var lM=V((qV,dM)=>{var S7=h();function F7(f){return f==="<<"||f===null}dM.exports=new S7("tag:yaml.org,2002:merge",{kind:"scalar",resolve:F7})});var rM=V((BV,nM)=>{var m1;try{A$=o,m1=A$("buffer").Buffer}catch(f){}var A$,R7=h(),L$=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
38
+ \r`;function N7(f){if(f===null)return!1;var $,M,Y=0,J=f.length,z=L$;for(M=0;M<J;M++){if($=z.indexOf(f.charAt(M)),$>64)continue;if($<0)return!1;Y+=6}return Y%8===0}function O7(f){var $,M,Y=f.replace(/[\r\n=]/g,""),J=Y.length,z=L$,Z=0,X=[];for($=0;$<J;$++){if($%4===0&&$)X.push(Z>>16&255),X.push(Z>>8&255),X.push(Z&255);Z=Z<<6|z.indexOf(Y.charAt($))}if(M=J%4*6,M===0)X.push(Z>>16&255),X.push(Z>>8&255),X.push(Z&255);else if(M===18)X.push(Z>>10&255),X.push(Z>>2&255);else if(M===12)X.push(Z>>4&255);if(m1)return m1.from?m1.from(X):new m1(X);return X}function A7(f){var $="",M=0,Y,J,z=f.length,Z=L$;for(Y=0;Y<z;Y++){if(Y%3===0&&Y)$+=Z[M>>18&63],$+=Z[M>>12&63],$+=Z[M>>6&63],$+=Z[M&63];M=(M<<8)+f[Y]}if(J=z%3,J===0)$+=Z[M>>18&63],$+=Z[M>>12&63],$+=Z[M>>6&63],$+=Z[M&63];else if(J===2)$+=Z[M>>10&63],$+=Z[M>>4&63],$+=Z[M<<2&63],$+=Z[64];else if(J===1)$+=Z[M>>2&63],$+=Z[M<<4&63],$+=Z[64],$+=Z[64];return $}function L7(f){return m1&&m1.isBuffer(f)}nM.exports=new R7("tag:yaml.org,2002:binary",{kind:"scalar",resolve:N7,construct:O7,predicate:L7,represent:A7})});var iM=V((SV,pM)=>{var P7=h(),T7=Object.prototype.hasOwnProperty,w7=Object.prototype.toString;function j7(f){if(f===null)return!0;var $=[],M,Y,J,z,Z,X=f;for(M=0,Y=X.length;M<Y;M+=1){if(J=X[M],Z=!1,w7.call(J)!=="[object Object]")return!1;for(z in J)if(T7.call(J,z))if(!Z)Z=!0;else return!1;if(!Z)return!1;if($.indexOf(z)===-1)$.push(z);else return!1}return!0}function I7(f){return f!==null?f:[]}pM.exports=new P7("tag:yaml.org,2002:omap",{kind:"sequence",resolve:j7,construct:I7})});var sM=V((FV,oM)=>{var C7=h(),E7=Object.prototype.toString;function x7(f){if(f===null)return!0;var $,M,Y,J,z,Z=f;z=Array(Z.length);for($=0,M=Z.length;$<M;$+=1){if(Y=Z[$],E7.call(Y)!=="[object Object]")return!1;if(J=Object.keys(Y),J.length!==1)return!1;z[$]=[J[0],Y[J[0]]]}return!0}function y7(f){if(f===null)return[];var $,M,Y,J,z,Z=f;z=Array(Z.length);for($=0,M=Z.length;$<M;$+=1)Y=Z[$],J=Object.keys(Y),z[$]=[J[0],Y[J[0]]];return z}oM.exports=new C7("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:x7,construct:y7})});var tM=V((RV,aM)=>{var k7=h(),b7=Object.prototype.hasOwnProperty;function _7(f){if(f===null)return!0;var $,M=f;for($ in M)if(b7.call(M,$)){if(M[$]!==null)return!1}return!0}function v7(f){return f!==null?f:{}}aM.exports=new k7("tag:yaml.org,2002:set",{kind:"mapping",resolve:_7,construct:v7})});var J0=V((NV,eM)=>{var u7=c1();eM.exports=new u7({include:[O$()],implicit:[mM(),lM()],explicit:[rM(),iM(),sM(),tM()]})});var $Y=V((OV,fY)=>{var h7=h();function g7(){return!0}function c7(){return}function m7(){return""}function d7(f){return typeof f>"u"}fY.exports=new h7("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:g7,construct:c7,predicate:d7,represent:m7})});var YY=V((AV,MY)=>{var l7=h();function n7(f){if(f===null)return!1;if(f.length===0)return!1;var $=f,M=/\/([gim]*)$/.exec(f),Y="";if($[0]==="/"){if(M)Y=M[1];if(Y.length>3)return!1;if($[$.length-Y.length-1]!=="/")return!1}return!0}function r7(f){var $=f,M=/\/([gim]*)$/.exec(f),Y="";if($[0]==="/"){if(M)Y=M[1];$=$.slice(1,$.length-Y.length-1)}return new RegExp($,Y)}function p7(f){var $="/"+f.source+"/";if(f.global)$+="g";if(f.multiline)$+="m";if(f.ignoreCase)$+="i";return $}function i7(f){return Object.prototype.toString.call(f)==="[object RegExp]"}MY.exports=new l7("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:n7,construct:r7,predicate:i7,represent:p7})});var zY=V((LV,JY)=>{var Vf;try{P$=o,Vf=P$("esprima")}catch(f){if(typeof window<"u")Vf=window.esprima}var P$,o7=h();function s7(f){if(f===null)return!1;try{var $="("+f+")",M=Vf.parse($,{range:!0});if(M.type!=="Program"||M.body.length!==1||M.body[0].type!=="ExpressionStatement"||M.body[0].expression.type!=="ArrowFunctionExpression"&&M.body[0].expression.type!=="FunctionExpression")return!1;return!0}catch(Y){return!1}}function a7(f){var $="("+f+")",M=Vf.parse($,{range:!0}),Y=[],J;if(M.type!=="Program"||M.body.length!==1||M.body[0].type!=="ExpressionStatement"||M.body[0].expression.type!=="ArrowFunctionExpression"&&M.body[0].expression.type!=="FunctionExpression")throw Error("Failed to resolve function");if(M.body[0].expression.params.forEach(function(z){Y.push(z.name)}),J=M.body[0].expression.body.range,M.body[0].expression.body.type==="BlockStatement")return Function(Y,$.slice(J[0]+1,J[1]-1));return Function(Y,"return "+$.slice(J[0],J[1]))}function t7(f){return f.toString()}function e7(f){return Object.prototype.toString.call(f)==="[object Function]"}JY.exports=new o7("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:s7,construct:a7,predicate:e7,represent:t7})});var y0=V((TV,XY)=>{var ZY=c1();XY.exports=ZY.DEFAULT=new ZY({include:[J0()],explicit:[$Y(),YY(),zY()]})});var wY=V((AX,k0)=>{var F1=g1(),VY=M0(),fX=BM(),qY=J0(),$X=y0(),C1=Object.prototype.hasOwnProperty,qf=1,BY=2,HY=3,Bf=4,T$=1,MX=2,QY=3,YX=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,JX=/[\x85\u2028\u2029]/,zX=/[,\[\]\{\}]/,SY=/^(?:!|!!|![a-z\-]+!)$/i,FY=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function DY(f){return Object.prototype.toString.call(f)}function Q1(f){return f===10||f===13}function d1(f){return f===9||f===32}function s(f){return f===9||f===32||f===10||f===13}function z0(f){return f===44||f===91||f===93||f===123||f===125}function ZX(f){var $;if(48<=f&&f<=57)return f-48;if($=f|32,97<=$&&$<=102)return $-97+10;return-1}function XX(f){if(f===120)return 2;if(f===117)return 4;if(f===85)return 8;return 0}function QX(f){if(48<=f&&f<=57)return f-48;return-1}function GY(f){return f===48?"\x00":f===97?"\x07":f===98?"\b":f===116?"\t":f===9?"\t":f===110?`
39
+ `:f===118?"\v":f===102?"\f":f===114?"\r":f===101?"\x1B":f===32?" ":f===34?'"':f===47?"/":f===92?"\\":f===78?"…":f===95?" ":f===76?"\u2028":f===80?"\u2029":""}function DX(f){if(f<=65535)return String.fromCharCode(f);return String.fromCharCode((f-65536>>10)+55296,(f-65536&1023)+56320)}function RY(f,$,M){if($==="__proto__")Object.defineProperty(f,$,{configurable:!0,enumerable:!0,writable:!0,value:M});else f[$]=M}var NY=Array(256),OY=Array(256);for(j1=0;j1<256;j1++)NY[j1]=GY(j1)?1:0,OY[j1]=GY(j1);var j1;function GX(f,$){this.input=f,this.filename=$.filename||null,this.schema=$.schema||$X,this.onWarning=$.onWarning||null,this.legacy=$.legacy||!1,this.json=$.json||!1,this.listener=$.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=f.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function AY(f,$){return new VY($,new fX(f.filename,f.input,f.position,f.line,f.position-f.lineStart))}function N(f,$){throw AY(f,$)}function Hf(f,$){if(f.onWarning)f.onWarning.call(null,AY(f,$))}var UY={YAML:function($,M,Y){var J,z,Z;if($.version!==null)N($,"duplication of %YAML directive");if(Y.length!==1)N($,"YAML directive accepts exactly one argument");if(J=/^([0-9]+)\.([0-9]+)$/.exec(Y[0]),J===null)N($,"ill-formed argument of the YAML directive");if(z=parseInt(J[1],10),Z=parseInt(J[2],10),z!==1)N($,"unacceptable YAML version of the document");if($.version=Y[0],$.checkLineBreaks=Z<2,Z!==1&&Z!==2)Hf($,"unsupported YAML version of the document")},TAG:function($,M,Y){var J,z;if(Y.length!==2)N($,"TAG directive accepts exactly two arguments");if(J=Y[0],z=Y[1],!SY.test(J))N($,"ill-formed tag handle (first argument) of the TAG directive");if(C1.call($.tagMap,J))N($,'there is a previously declared suffix for "'+J+'" tag handle');if(!FY.test(z))N($,"ill-formed tag prefix (second argument) of the TAG directive");$.tagMap[J]=z}};function I1(f,$,M,Y){var J,z,Z,X;if($<M){if(X=f.input.slice($,M),Y){for(J=0,z=X.length;J<z;J+=1)if(Z=X.charCodeAt(J),!(Z===9||32<=Z&&Z<=1114111))N(f,"expected valid JSON character")}else if(YX.test(X))N(f,"the stream contains non-printable characters");f.result+=X}}function WY(f,$,M,Y){var J,z,Z,X;if(!F1.isObject(M))N(f,"cannot merge mappings; the provided source object is unacceptable");J=Object.keys(M);for(Z=0,X=J.length;Z<X;Z+=1)if(z=J[Z],!C1.call($,z))RY($,z,M[z]),Y[z]=!0}function Z0(f,$,M,Y,J,z,Z,X){var Q,D;if(Array.isArray(J)){J=Array.prototype.slice.call(J);for(Q=0,D=J.length;Q<D;Q+=1){if(Array.isArray(J[Q]))N(f,"nested arrays are not supported inside keys");if(typeof J==="object"&&DY(J[Q])==="[object Object]")J[Q]="[object Object]"}}if(typeof J==="object"&&DY(J)==="[object Object]")J="[object Object]";if(J=String(J),$===null)$={};if(Y==="tag:yaml.org,2002:merge")if(Array.isArray(z))for(Q=0,D=z.length;Q<D;Q+=1)WY(f,$,z[Q],M);else WY(f,$,z,M);else{if(!f.json&&!C1.call(M,J)&&C1.call($,J))f.line=Z||f.line,f.position=X||f.position,N(f,"duplicated mapping key");RY($,J,z),delete M[J]}return $}function w$(f){var $=f.input.charCodeAt(f.position);if($===10)f.position++;else if($===13){if(f.position++,f.input.charCodeAt(f.position)===10)f.position++}else N(f,"a line break is expected");f.line+=1,f.lineStart=f.position}function u(f,$,M){var Y=0,J=f.input.charCodeAt(f.position);while(J!==0){while(d1(J))J=f.input.charCodeAt(++f.position);if($&&J===35)do J=f.input.charCodeAt(++f.position);while(J!==10&&J!==13&&J!==0);if(Q1(J)){w$(f),J=f.input.charCodeAt(f.position),Y++,f.lineIndent=0;while(J===32)f.lineIndent++,J=f.input.charCodeAt(++f.position)}else break}if(M!==-1&&Y!==0&&f.lineIndent<M)Hf(f,"deficient indentation");return Y}function Sf(f){var $=f.position,M;if(M=f.input.charCodeAt($),(M===45||M===46)&&M===f.input.charCodeAt($+1)&&M===f.input.charCodeAt($+2)){if($+=3,M=f.input.charCodeAt($),M===0||s(M))return!0}return!1}function j$(f,$){if($===1)f.result+=" ";else if($>1)f.result+=F1.repeat(`
40
+ `,$-1)}function UX(f,$,M){var Y,J,z,Z,X,Q,D,G,U=f.kind,K=f.result,W;if(W=f.input.charCodeAt(f.position),s(W)||z0(W)||W===35||W===38||W===42||W===33||W===124||W===62||W===39||W===34||W===37||W===64||W===96)return!1;if(W===63||W===45){if(J=f.input.charCodeAt(f.position+1),s(J)||M&&z0(J))return!1}f.kind="scalar",f.result="",z=Z=f.position,X=!1;while(W!==0){if(W===58){if(J=f.input.charCodeAt(f.position+1),s(J)||M&&z0(J))break}else if(W===35){if(Y=f.input.charCodeAt(f.position-1),s(Y))break}else if(f.position===f.lineStart&&Sf(f)||M&&z0(W))break;else if(Q1(W))if(Q=f.line,D=f.lineStart,G=f.lineIndent,u(f,!1,-1),f.lineIndent>=$){X=!0,W=f.input.charCodeAt(f.position);continue}else{f.position=Z,f.line=Q,f.lineStart=D,f.lineIndent=G;break}if(X)I1(f,z,Z,!1),j$(f,f.line-Q),z=Z=f.position,X=!1;if(!d1(W))Z=f.position+1;W=f.input.charCodeAt(++f.position)}if(I1(f,z,Z,!1),f.result)return!0;return f.kind=U,f.result=K,!1}function WX(f,$){var M,Y,J;if(M=f.input.charCodeAt(f.position),M!==39)return!1;f.kind="scalar",f.result="",f.position++,Y=J=f.position;while((M=f.input.charCodeAt(f.position))!==0)if(M===39)if(I1(f,Y,f.position,!0),M=f.input.charCodeAt(++f.position),M===39)Y=f.position,f.position++,J=f.position;else return!0;else if(Q1(M))I1(f,Y,J,!0),j$(f,u(f,!1,$)),Y=J=f.position;else if(f.position===f.lineStart&&Sf(f))N(f,"unexpected end of the document within a single quoted scalar");else f.position++,J=f.position;N(f,"unexpected end of the stream within a single quoted scalar")}function KX(f,$){var M,Y,J,z,Z,X;if(X=f.input.charCodeAt(f.position),X!==34)return!1;f.kind="scalar",f.result="",f.position++,M=Y=f.position;while((X=f.input.charCodeAt(f.position))!==0)if(X===34)return I1(f,M,f.position,!0),f.position++,!0;else if(X===92){if(I1(f,M,f.position,!0),X=f.input.charCodeAt(++f.position),Q1(X))u(f,!1,$);else if(X<256&&NY[X])f.result+=OY[X],f.position++;else if((Z=XX(X))>0){J=Z,z=0;for(;J>0;J--)if(X=f.input.charCodeAt(++f.position),(Z=ZX(X))>=0)z=(z<<4)+Z;else N(f,"expected hexadecimal character");f.result+=DX(z),f.position++}else N(f,"unknown escape sequence");M=Y=f.position}else if(Q1(X))I1(f,M,Y,!0),j$(f,u(f,!1,$)),M=Y=f.position;else if(f.position===f.lineStart&&Sf(f))N(f,"unexpected end of the document within a double quoted scalar");else f.position++,Y=f.position;N(f,"unexpected end of the stream within a double quoted scalar")}function VX(f,$){var M=!0,Y,J=f.tag,z,Z=f.anchor,X,Q,D,G,U,K={},W,B,O,F;if(F=f.input.charCodeAt(f.position),F===91)Q=93,U=!1,z=[];else if(F===123)Q=125,U=!0,z={};else return!1;if(f.anchor!==null)f.anchorMap[f.anchor]=z;F=f.input.charCodeAt(++f.position);while(F!==0){if(u(f,!0,$),F=f.input.charCodeAt(f.position),F===Q)return f.position++,f.tag=J,f.anchor=Z,f.kind=U?"mapping":"sequence",f.result=z,!0;else if(!M)N(f,"missed comma between flow collection entries");if(B=W=O=null,D=G=!1,F===63){if(X=f.input.charCodeAt(f.position+1),s(X))D=G=!0,f.position++,u(f,!0,$)}if(Y=f.line,X0(f,$,qf,!1,!0),B=f.tag,W=f.result,u(f,!0,$),F=f.input.charCodeAt(f.position),(G||f.line===Y)&&F===58)D=!0,F=f.input.charCodeAt(++f.position),u(f,!0,$),X0(f,$,qf,!1,!0),O=f.result;if(U)Z0(f,z,K,B,W,O);else if(D)z.push(Z0(f,null,K,B,W,O));else z.push(W);if(u(f,!0,$),F=f.input.charCodeAt(f.position),F===44)M=!0,F=f.input.charCodeAt(++f.position);else M=!1}N(f,"unexpected end of the stream within a flow collection")}function qX(f,$){var M,Y,J=T$,z=!1,Z=!1,X=$,Q=0,D=!1,G,U;if(U=f.input.charCodeAt(f.position),U===124)Y=!1;else if(U===62)Y=!0;else return!1;f.kind="scalar",f.result="";while(U!==0)if(U=f.input.charCodeAt(++f.position),U===43||U===45)if(T$===J)J=U===43?QY:MX;else N(f,"repeat of a chomping mode identifier");else if((G=QX(U))>=0)if(G===0)N(f,"bad explicit indentation width of a block scalar; it cannot be less than one");else if(!Z)X=$+G-1,Z=!0;else N(f,"repeat of an indentation width identifier");else break;if(d1(U)){do U=f.input.charCodeAt(++f.position);while(d1(U));if(U===35)do U=f.input.charCodeAt(++f.position);while(!Q1(U)&&U!==0)}while(U!==0){w$(f),f.lineIndent=0,U=f.input.charCodeAt(f.position);while((!Z||f.lineIndent<X)&&U===32)f.lineIndent++,U=f.input.charCodeAt(++f.position);if(!Z&&f.lineIndent>X)X=f.lineIndent;if(Q1(U)){Q++;continue}if(f.lineIndent<X){if(J===QY)f.result+=F1.repeat(`
41
+ `,z?1+Q:Q);else if(J===T$){if(z)f.result+=`
42
+ `}break}if(Y)if(d1(U))D=!0,f.result+=F1.repeat(`
43
+ `,z?1+Q:Q);else if(D)D=!1,f.result+=F1.repeat(`
44
+ `,Q+1);else if(Q===0){if(z)f.result+=" "}else f.result+=F1.repeat(`
45
+ `,Q);else f.result+=F1.repeat(`
46
+ `,z?1+Q:Q);z=!0,Z=!0,Q=0,M=f.position;while(!Q1(U)&&U!==0)U=f.input.charCodeAt(++f.position);I1(f,M,f.position,!1)}return!0}function KY(f,$){var M,Y=f.tag,J=f.anchor,z=[],Z,X=!1,Q;if(f.anchor!==null)f.anchorMap[f.anchor]=z;Q=f.input.charCodeAt(f.position);while(Q!==0){if(Q!==45)break;if(Z=f.input.charCodeAt(f.position+1),!s(Z))break;if(X=!0,f.position++,u(f,!0,-1)){if(f.lineIndent<=$){z.push(null),Q=f.input.charCodeAt(f.position);continue}}if(M=f.line,X0(f,$,HY,!1,!0),z.push(f.result),u(f,!0,-1),Q=f.input.charCodeAt(f.position),(f.line===M||f.lineIndent>$)&&Q!==0)N(f,"bad indentation of a sequence entry");else if(f.lineIndent<$)break}if(X)return f.tag=Y,f.anchor=J,f.kind="sequence",f.result=z,!0;return!1}function BX(f,$,M){var Y,J,z,Z,X=f.tag,Q=f.anchor,D={},G={},U=null,K=null,W=null,B=!1,O=!1,F;if(f.anchor!==null)f.anchorMap[f.anchor]=D;F=f.input.charCodeAt(f.position);while(F!==0){if(Y=f.input.charCodeAt(f.position+1),z=f.line,Z=f.position,(F===63||F===58)&&s(Y)){if(F===63){if(B)Z0(f,D,G,U,K,null),U=K=W=null;O=!0,B=!0,J=!0}else if(B)B=!1,J=!0;else N(f,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");f.position+=1,F=Y}else if(X0(f,M,BY,!1,!0))if(f.line===z){F=f.input.charCodeAt(f.position);while(d1(F))F=f.input.charCodeAt(++f.position);if(F===58){if(F=f.input.charCodeAt(++f.position),!s(F))N(f,"a whitespace character is expected after the key-value separator within a block mapping");if(B)Z0(f,D,G,U,K,null),U=K=W=null;O=!0,B=!1,J=!1,U=f.tag,K=f.result}else if(O)N(f,"can not read an implicit mapping pair; a colon is missed");else return f.tag=X,f.anchor=Q,!0}else if(O)N(f,"can not read a block mapping entry; a multiline key may not be an implicit key");else return f.tag=X,f.anchor=Q,!0;else break;if(f.line===z||f.lineIndent>$){if(X0(f,$,Bf,!0,J))if(B)K=f.result;else W=f.result;if(!B)Z0(f,D,G,U,K,W,z,Z),U=K=W=null;u(f,!0,-1),F=f.input.charCodeAt(f.position)}if(f.lineIndent>$&&F!==0)N(f,"bad indentation of a mapping entry");else if(f.lineIndent<$)break}if(B)Z0(f,D,G,U,K,null);if(O)f.tag=X,f.anchor=Q,f.kind="mapping",f.result=D;return O}function HX(f){var $,M=!1,Y=!1,J,z,Z;if(Z=f.input.charCodeAt(f.position),Z!==33)return!1;if(f.tag!==null)N(f,"duplication of a tag property");if(Z=f.input.charCodeAt(++f.position),Z===60)M=!0,Z=f.input.charCodeAt(++f.position);else if(Z===33)Y=!0,J="!!",Z=f.input.charCodeAt(++f.position);else J="!";if($=f.position,M){do Z=f.input.charCodeAt(++f.position);while(Z!==0&&Z!==62);if(f.position<f.length)z=f.input.slice($,f.position),Z=f.input.charCodeAt(++f.position);else N(f,"unexpected end of the stream within a verbatim tag")}else{while(Z!==0&&!s(Z)){if(Z===33)if(!Y){if(J=f.input.slice($-1,f.position+1),!SY.test(J))N(f,"named tag handle cannot contain such characters");Y=!0,$=f.position+1}else N(f,"tag suffix cannot contain exclamation marks");Z=f.input.charCodeAt(++f.position)}if(z=f.input.slice($,f.position),zX.test(z))N(f,"tag suffix cannot contain flow indicator characters")}if(z&&!FY.test(z))N(f,"tag name cannot contain such characters: "+z);if(M)f.tag=z;else if(C1.call(f.tagMap,J))f.tag=f.tagMap[J]+z;else if(J==="!")f.tag="!"+z;else if(J==="!!")f.tag="tag:yaml.org,2002:"+z;else N(f,'undeclared tag handle "'+J+'"');return!0}function SX(f){var $,M;if(M=f.input.charCodeAt(f.position),M!==38)return!1;if(f.anchor!==null)N(f,"duplication of an anchor property");M=f.input.charCodeAt(++f.position),$=f.position;while(M!==0&&!s(M)&&!z0(M))M=f.input.charCodeAt(++f.position);if(f.position===$)N(f,"name of an anchor node must contain at least one character");return f.anchor=f.input.slice($,f.position),!0}function FX(f){var $,M,Y;if(Y=f.input.charCodeAt(f.position),Y!==42)return!1;Y=f.input.charCodeAt(++f.position),$=f.position;while(Y!==0&&!s(Y)&&!z0(Y))Y=f.input.charCodeAt(++f.position);if(f.position===$)N(f,"name of an alias node must contain at least one character");if(M=f.input.slice($,f.position),!C1.call(f.anchorMap,M))N(f,'unidentified alias "'+M+'"');return f.result=f.anchorMap[M],u(f,!0,-1),!0}function X0(f,$,M,Y,J){var z,Z,X,Q=1,D=!1,G=!1,U,K,W,B,O;if(f.listener!==null)f.listener("open",f);if(f.tag=null,f.anchor=null,f.kind=null,f.result=null,z=Z=X=Bf===M||HY===M,Y){if(u(f,!0,-1)){if(D=!0,f.lineIndent>$)Q=1;else if(f.lineIndent===$)Q=0;else if(f.lineIndent<$)Q=-1}}if(Q===1)while(HX(f)||SX(f))if(u(f,!0,-1)){if(D=!0,X=z,f.lineIndent>$)Q=1;else if(f.lineIndent===$)Q=0;else if(f.lineIndent<$)Q=-1}else X=!1;if(X)X=D||J;if(Q===1||Bf===M){if(qf===M||BY===M)B=$;else B=$+1;if(O=f.position-f.lineStart,Q===1)if(X&&(KY(f,O)||BX(f,O,B))||VX(f,B))G=!0;else{if(Z&&qX(f,B)||WX(f,B)||KX(f,B))G=!0;else if(FX(f)){if(G=!0,f.tag!==null||f.anchor!==null)N(f,"alias node should not have any properties")}else if(UX(f,B,qf===M)){if(G=!0,f.tag===null)f.tag="?"}if(f.anchor!==null)f.anchorMap[f.anchor]=f.result}else if(Q===0)G=X&&KY(f,O)}if(f.tag!==null&&f.tag!=="!")if(f.tag==="?"){if(f.result!==null&&f.kind!=="scalar")N(f,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+f.kind+'"');for(U=0,K=f.implicitTypes.length;U<K;U+=1)if(W=f.implicitTypes[U],W.resolve(f.result)){if(f.result=W.construct(f.result),f.tag=W.tag,f.anchor!==null)f.anchorMap[f.anchor]=f.result;break}}else if(C1.call(f.typeMap[f.kind||"fallback"],f.tag)){if(W=f.typeMap[f.kind||"fallback"][f.tag],f.result!==null&&W.kind!==f.kind)N(f,"unacceptable node kind for !<"+f.tag+'> tag; it should be "'+W.kind+'", not "'+f.kind+'"');if(!W.resolve(f.result))N(f,"cannot resolve a node with !<"+f.tag+"> explicit tag");else if(f.result=W.construct(f.result),f.anchor!==null)f.anchorMap[f.anchor]=f.result}else N(f,"unknown tag !<"+f.tag+">");if(f.listener!==null)f.listener("close",f);return f.tag!==null||f.anchor!==null||G}function RX(f){var $=f.position,M,Y,J,z=!1,Z;f.version=null,f.checkLineBreaks=f.legacy,f.tagMap={},f.anchorMap={};while((Z=f.input.charCodeAt(f.position))!==0){if(u(f,!0,-1),Z=f.input.charCodeAt(f.position),f.lineIndent>0||Z!==37)break;z=!0,Z=f.input.charCodeAt(++f.position),M=f.position;while(Z!==0&&!s(Z))Z=f.input.charCodeAt(++f.position);if(Y=f.input.slice(M,f.position),J=[],Y.length<1)N(f,"directive name must not be less than one character in length");while(Z!==0){while(d1(Z))Z=f.input.charCodeAt(++f.position);if(Z===35){do Z=f.input.charCodeAt(++f.position);while(Z!==0&&!Q1(Z));break}if(Q1(Z))break;M=f.position;while(Z!==0&&!s(Z))Z=f.input.charCodeAt(++f.position);J.push(f.input.slice(M,f.position))}if(Z!==0)w$(f);if(C1.call(UY,Y))UY[Y](f,Y,J);else Hf(f,'unknown document directive "'+Y+'"')}if(u(f,!0,-1),f.lineIndent===0&&f.input.charCodeAt(f.position)===45&&f.input.charCodeAt(f.position+1)===45&&f.input.charCodeAt(f.position+2)===45)f.position+=3,u(f,!0,-1);else if(z)N(f,"directives end mark is expected");if(X0(f,f.lineIndent-1,Bf,!1,!0),u(f,!0,-1),f.checkLineBreaks&&JX.test(f.input.slice($,f.position)))Hf(f,"non-ASCII line breaks are interpreted as content");if(f.documents.push(f.result),f.position===f.lineStart&&Sf(f)){if(f.input.charCodeAt(f.position)===46)f.position+=3,u(f,!0,-1);return}if(f.position<f.length-1)N(f,"end of the stream or a document separator is expected");else return}function LY(f,$){if(f=String(f),$=$||{},f.length!==0){if(f.charCodeAt(f.length-1)!==10&&f.charCodeAt(f.length-1)!==13)f+=`
47
+ `;if(f.charCodeAt(0)===65279)f=f.slice(1)}var M=new GX(f,$),Y=f.indexOf("\x00");if(Y!==-1)M.position=Y,N(M,"null byte is not allowed in input");M.input+="\x00";while(M.input.charCodeAt(M.position)===32)M.lineIndent+=1,M.position+=1;while(M.position<M.length-1)RX(M);return M.documents}function PY(f,$,M){if($!==null&&typeof $==="object"&&typeof M>"u")M=$,$=null;var Y=LY(f,M);if(typeof $!=="function")return Y;for(var J=0,z=Y.length;J<z;J+=1)$(Y[J])}function TY(f,$){var M=LY(f,$);if(M.length===0)return;else if(M.length===1)return M[0];throw new VY("expected a single document in the stream, but found more")}function NX(f,$,M){if(typeof $==="object"&&$!==null&&typeof M>"u")M=$,$=null;return PY(f,$,F1.extend({schema:qY},M))}function OX(f,$){return TY(f,F1.extend({schema:qY},$))}AX.loadAll=PY;AX.load=TY;AX.safeLoadAll=NX;AX.safeLoad=OX});var sY=V((QQ,x$)=>{var _0=g1(),v0=M0(),jX=y0(),IX=J0(),bY=Object.prototype.toString,_Y=Object.prototype.hasOwnProperty,CX=9,b0=10,EX=13,xX=32,yX=33,kX=34,vY=35,bX=37,_X=38,vX=39,uX=42,uY=44,hX=45,hY=58,gX=61,cX=62,mX=63,dX=64,gY=91,cY=93,lX=96,mY=123,nX=124,dY=125,d={};d[0]="\\0";d[7]="\\a";d[8]="\\b";d[9]="\\t";d[10]="\\n";d[11]="\\v";d[12]="\\f";d[13]="\\r";d[27]="\\e";d[34]="\\\"";d[92]="\\\\";d[133]="\\N";d[160]="\\_";d[8232]="\\L";d[8233]="\\P";var rX=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function pX(f,$){var M,Y,J,z,Z,X,Q;if($===null)return{};M={},Y=Object.keys($);for(J=0,z=Y.length;J<z;J+=1){if(Z=Y[J],X=String($[Z]),Z.slice(0,2)==="!!")Z="tag:yaml.org,2002:"+Z.slice(2);if(Q=f.compiledTypeMap.fallback[Z],Q&&_Y.call(Q.styleAliases,X))X=Q.styleAliases[X];M[Z]=X}return M}function jY(f){var $,M,Y;if($=f.toString(16).toUpperCase(),f<=255)M="x",Y=2;else if(f<=65535)M="u",Y=4;else if(f<=4294967295)M="U",Y=8;else throw new v0("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+M+_0.repeat("0",Y-$.length)+$}function iX(f){this.schema=f.schema||jX,this.indent=Math.max(1,f.indent||2),this.noArrayIndent=f.noArrayIndent||!1,this.skipInvalid=f.skipInvalid||!1,this.flowLevel=_0.isNothing(f.flowLevel)?-1:f.flowLevel,this.styleMap=pX(this.schema,f.styles||null),this.sortKeys=f.sortKeys||!1,this.lineWidth=f.lineWidth||80,this.noRefs=f.noRefs||!1,this.noCompatMode=f.noCompatMode||!1,this.condenseFlow=f.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function IY(f,$){var M=_0.repeat(" ",$),Y=0,J=-1,z="",Z,X=f.length;while(Y<X){if(J=f.indexOf(`
48
48
  `,Y),J===-1)Z=f.slice(Y),Y=X;else Z=f.slice(Y,J+1),Y=J+1;if(Z.length&&Z!==`
49
- `)z+=M;z+=Z}return z}function U1(f,$){return`
50
- `+f0.repeat(" ",f.indent*$)}function c6(f,$){var M,Y,J;for(M=0,Y=f.implicitTypes.length;M<Y;M+=1)if(J=f.implicitTypes[M],J.resolve($))return!0;return!1}function B1(f){return f===L6||f===j6}function If(f){return 32<=f&&f<=126||161<=f&&f<=55295&&f!==8232&&f!==8233||57344<=f&&f<=65533&&f!==65279||65536<=f&&f<=1114111}function p6(f){return If(f)&&!B1(f)&&f!==65279&&f!==R6&&f!==tf}function p2(f,$){return If(f)&&f!==65279&&f!==e2&&f!==fM&&f!==$M&&f!==MM&&f!==YM&&f!==t2&&(f!==a2||$&&p6($))}function l6(f){return If(f)&&f!==65279&&!B1(f)&&f!==C6&&f!==_6&&f!==t2&&f!==e2&&f!==fM&&f!==$M&&f!==MM&&f!==YM&&f!==a2&&f!==x6&&f!==k6&&f!==A6&&f!==h6&&f!==b6&&f!==v6&&f!==I6&&f!==N6&&f!==O6&&f!==E6&&f!==u6}function JM(f){var $=/^\n* /;return $.test(f)}var zM=1,ZM=2,XM=3,GM=4,w0=5;function d6(f,$,M,Y,J){var z,Z,X,G=!1,q=!1,Q=Y!==-1,D=-1,V=l6(f.charCodeAt(0))&&!B1(f.charCodeAt(f.length-1));if($)for(z=0;z<f.length;z++){if(Z=f.charCodeAt(z),!If(Z))return w0;X=z>0?f.charCodeAt(z-1):null,V=V&&p2(Z,X)}else{for(z=0;z<f.length;z++){if(Z=f.charCodeAt(z),Z===tf){if(G=!0,Q)q=q||z-D-1>Y&&f[D+1]!==" ",D=z}else if(!If(Z))return w0;X=z>0?f.charCodeAt(z-1):null,V=V&&p2(Z,X)}q=q||Q&&(z-D-1>Y&&f[D+1]!==" ")}if(!G&&!q)return V&&!J(f)?zM:ZM;if(M>9&&JM(f))return w0;return q?GM:XM}function n6(f,$,M,Y){f.dump=function(){if($.length===0)return"''";if(!f.noCompatMode&&g6.indexOf($)!==-1)return"'"+$+"'";var J=f.indent*Math.max(1,M),z=f.lineWidth===-1?-1:Math.max(Math.min(f.lineWidth,40),f.lineWidth-J),Z=Y||f.flowLevel>-1&&M>=f.flowLevel;function X(G){return c6(f,G)}switch(d6($,Z,f.indent,z,X)){case zM:return $;case ZM:return"'"+$.replace(/'/g,"''")+"'";case XM:return"|"+l2($,f.indent)+d2(c2($,J));case GM:return">"+l2($,f.indent)+d2(c2(i6($,z),J));case w0:return'"'+o6($,z)+'"';default:throw new $0("impossible error: invalid scalar style")}}()}function l2(f,$){var M=JM(f)?String($):"",Y=f[f.length-1]===`
49
+ `)z+=M;z+=Z}return z}function I$(f,$){return`
50
+ `+_0.repeat(" ",f.indent*$)}function oX(f,$){var M,Y,J;for(M=0,Y=f.implicitTypes.length;M<Y;M+=1)if(J=f.implicitTypes[M],J.resolve($))return!0;return!1}function E$(f){return f===xX||f===CX}function Q0(f){return 32<=f&&f<=126||161<=f&&f<=55295&&f!==8232&&f!==8233||57344<=f&&f<=65533&&f!==65279||65536<=f&&f<=1114111}function sX(f){return Q0(f)&&!E$(f)&&f!==65279&&f!==EX&&f!==b0}function CY(f,$){return Q0(f)&&f!==65279&&f!==uY&&f!==gY&&f!==cY&&f!==mY&&f!==dY&&f!==hY&&(f!==vY||$&&sX($))}function aX(f){return Q0(f)&&f!==65279&&!E$(f)&&f!==hX&&f!==mX&&f!==hY&&f!==uY&&f!==gY&&f!==cY&&f!==mY&&f!==dY&&f!==vY&&f!==_X&&f!==uX&&f!==yX&&f!==nX&&f!==gX&&f!==cX&&f!==vX&&f!==kX&&f!==bX&&f!==dX&&f!==lX}function lY(f){var $=/^\n* /;return $.test(f)}var nY=1,rY=2,pY=3,iY=4,Ff=5;function tX(f,$,M,Y,J){var z,Z,X,Q=!1,D=!1,G=Y!==-1,U=-1,K=aX(f.charCodeAt(0))&&!E$(f.charCodeAt(f.length-1));if($)for(z=0;z<f.length;z++){if(Z=f.charCodeAt(z),!Q0(Z))return Ff;X=z>0?f.charCodeAt(z-1):null,K=K&&CY(Z,X)}else{for(z=0;z<f.length;z++){if(Z=f.charCodeAt(z),Z===b0){if(Q=!0,G)D=D||z-U-1>Y&&f[U+1]!==" ",U=z}else if(!Q0(Z))return Ff;X=z>0?f.charCodeAt(z-1):null,K=K&&CY(Z,X)}D=D||G&&(z-U-1>Y&&f[U+1]!==" ")}if(!Q&&!D)return K&&!J(f)?nY:rY;if(M>9&&lY(f))return Ff;return D?iY:pY}function eX(f,$,M,Y){f.dump=function(){if($.length===0)return"''";if(!f.noCompatMode&&rX.indexOf($)!==-1)return"'"+$+"'";var J=f.indent*Math.max(1,M),z=f.lineWidth===-1?-1:Math.max(Math.min(f.lineWidth,40),f.lineWidth-J),Z=Y||f.flowLevel>-1&&M>=f.flowLevel;function X(Q){return oX(f,Q)}switch(tX($,Z,f.indent,z,X)){case nY:return $;case rY:return"'"+$.replace(/'/g,"''")+"'";case pY:return"|"+EY($,f.indent)+xY(IY($,J));case iY:return">"+EY($,f.indent)+xY(IY(fQ($,z),J));case Ff:return'"'+$Q($,z)+'"';default:throw new v0("impossible error: invalid scalar style")}}()}function EY(f,$){var M=lY(f)?String($):"",Y=f[f.length-1]===`
51
51
  `,J=Y&&(f[f.length-2]===`
52
52
  `||f===`
53
53
  `),z=J?"+":Y?"":"-";return M+z+`
54
- `}function d2(f){return f[f.length-1]===`
55
- `?f.slice(0,-1):f}function i6(f,$){var M=/(\n+)([^\n]*)/g,Y=function(){var q=f.indexOf(`
56
- `);return q=q!==-1?q:f.length,M.lastIndex=q,n2(f.slice(0,q),$)}(),J=f[0]===`
57
- `||f[0]===" ",z,Z;while(Z=M.exec(f)){var X=Z[1],G=Z[2];z=G[0]===" ",Y+=X+(!J&&!z&&G!==""?`
58
- `:"")+n2(G,$),J=z}return Y}function n2(f,$){if(f===""||f[0]===" ")return f;var M=/ [^ ]/g,Y,J=0,z,Z=0,X=0,G="";while(Y=M.exec(f)){if(X=Y.index,X-J>$)z=Z>J?Z:X,G+=`
59
- `+f.slice(J,z),J=z+1;Z=X}if(G+=`
60
- `,f.length-J>$&&Z>J)G+=f.slice(J,Z)+`
61
- `+f.slice(Z+1);else G+=f.slice(J);return G.slice(1)}function o6(f){var $="",M,Y,J;for(var z=0;z<f.length;z++){if(M=f.charCodeAt(z),M>=55296&&M<=56319){if(Y=f.charCodeAt(z+1),Y>=56320&&Y<=57343){$+=r2((M-55296)*1024+Y-56320+65536),z++;continue}}J=u[M],$+=!J&&If(M)?f[z]:J||r2(M)}return $}function s6(f,$,M){var Y="",J=f.tag,z,Z;for(z=0,Z=M.length;z<Z;z+=1)if(Bf(f,$,M[z],!1,!1)){if(z!==0)Y+=","+(!f.condenseFlow?" ":"");Y+=f.dump}f.tag=J,f.dump="["+Y+"]"}function a6(f,$,M,Y){var J="",z=f.tag,Z,X;for(Z=0,X=M.length;Z<X;Z+=1)if(Bf(f,$+1,M[Z],!0,!0)){if(!Y||Z!==0)J+=U1(f,$);if(f.dump&&tf===f.dump.charCodeAt(0))J+="-";else J+="- ";J+=f.dump}f.tag=z,f.dump=J||"[]"}function e6(f,$,M){var Y="",J=f.tag,z=Object.keys(M),Z,X,G,q,Q;for(Z=0,X=z.length;Z<X;Z+=1){if(Q="",Z!==0)Q+=", ";if(f.condenseFlow)Q+='"';if(G=z[Z],q=M[G],!Bf(f,$,G,!1,!1))continue;if(f.dump.length>1024)Q+="? ";if(Q+=f.dump+(f.condenseFlow?'"':"")+":"+(f.condenseFlow?"":" "),!Bf(f,$,q,!1,!1))continue;Q+=f.dump,Y+=Q}f.tag=J,f.dump="{"+Y+"}"}function t6(f,$,M,Y){var J="",z=f.tag,Z=Object.keys(M),X,G,q,Q,D,V;if(f.sortKeys===!0)Z.sort();else if(typeof f.sortKeys==="function")Z.sort(f.sortKeys);else if(f.sortKeys)throw new $0("sortKeys must be a boolean or a function");for(X=0,G=Z.length;X<G;X+=1){if(V="",!Y||X!==0)V+=U1(f,$);if(q=Z[X],Q=M[q],!Bf(f,$+1,q,!0,!0,!0))continue;if(D=f.tag!==null&&f.tag!=="?"||f.dump&&f.dump.length>1024,D)if(f.dump&&tf===f.dump.charCodeAt(0))V+="?";else V+="? ";if(V+=f.dump,D)V+=U1(f,$);if(!Bf(f,$+1,Q,!0,D))continue;if(f.dump&&tf===f.dump.charCodeAt(0))V+=":";else V+=": ";V+=f.dump,J+=V}f.tag=z,f.dump=J||"{}"}function i2(f,$,M){var Y,J,z,Z,X,G;J=M?f.explicitTypes:f.implicitTypes;for(z=0,Z=J.length;z<Z;z+=1)if(X=J[z],(X.instanceOf||X.predicate)&&(!X.instanceOf||typeof $==="object"&&$ instanceof X.instanceOf)&&(!X.predicate||X.predicate($))){if(f.tag=M?X.tag:"?",X.represent){if(G=f.styleMap[X.tag]||X.defaultStyle,o2.call(X.represent)==="[object Function]")Y=X.represent($,G);else if(s2.call(X.represent,G))Y=X.represent[G]($,G);else throw new $0("!<"+X.tag+'> tag resolver accepts not "'+G+'" style');f.dump=Y}return!0}return!1}function Bf(f,$,M,Y,J,z){if(f.tag=null,f.dump=M,!i2(f,M,!1))i2(f,M,!0);var Z=o2.call(f.dump);if(Y)Y=f.flowLevel<0||f.flowLevel>$;var X=Z==="[object Object]"||Z==="[object Array]",G,q;if(X)G=f.duplicates.indexOf(M),q=G!==-1;if(f.tag!==null&&f.tag!=="?"||q||f.indent!==2&&$>0)J=!1;if(q&&f.usedDuplicates[G])f.dump="*ref_"+G;else{if(X&&q&&!f.usedDuplicates[G])f.usedDuplicates[G]=!0;if(Z==="[object Object]"){if(Y&&Object.keys(f.dump).length!==0){if(t6(f,$,f.dump,J),q)f.dump="&ref_"+G+f.dump}else if(e6(f,$,f.dump),q)f.dump="&ref_"+G+" "+f.dump}else if(Z==="[object Array]"){var Q=f.noArrayIndent&&$>0?$-1:$;if(Y&&f.dump.length!==0){if(a6(f,Q,f.dump,J),q)f.dump="&ref_"+G+f.dump}else if(s6(f,Q,f.dump),q)f.dump="&ref_"+G+" "+f.dump}else if(Z==="[object String]"){if(f.tag!=="?")n6(f,f.dump,$,z)}else{if(f.skipInvalid)return!1;throw new $0("unacceptable kind of an object to dump "+Z)}if(f.tag!==null&&f.tag!=="?")f.dump="!<"+f.tag+"> "+f.dump}return!0}function f8(f,$){var M=[],Y=[],J,z;K1(f,M,Y);for(J=0,z=Y.length;J<z;J+=1)$.duplicates.push(M[Y[J]]);$.usedDuplicates=Array(z)}function K1(f,$,M){var Y,J,z;if(f!==null&&typeof f==="object")if(J=$.indexOf(f),J!==-1){if(M.indexOf(J)===-1)M.push(J)}else if($.push(f),Array.isArray(f))for(J=0,z=f.length;J<z;J+=1)K1(f[J],$,M);else{Y=Object.keys(f);for(J=0,z=Y.length;J<z;J+=1)K1(f[Y[J]],$,M)}}function qM(f,$){$=$||{};var M=new r6($);if(!M.noRefs)f8(f,M);if(Bf(M,0,f,!0,!0))return M.dump+`
62
- `;return""}function $8(f,$){return qM(f,f0.extend({schema:w6},$))}M8.dump=qM;M8.safeDump=$8});var WM=S((z8,I)=>{var j0=m2(),DM=QM();function R0(f){return function(){throw Error("Function "+f+" is deprecated and cannot be used.")}}z8.Type=v();z8.Schema=Vf();z8.FAILSAFE_SCHEMA=H0();z8.JSON_SCHEMA=Z1();z8.CORE_SCHEMA=X1();z8.DEFAULT_SAFE_SCHEMA=Af();z8.DEFAULT_FULL_SCHEMA=af();z8.load=j0.load;z8.loadAll=j0.loadAll;z8.safeLoad=j0.safeLoad;z8.safeLoadAll=j0.safeLoadAll;z8.dump=DM.dump;z8.safeDump=DM.safeDump;z8.YAMLException=Rf();z8.MINIMAL_SCHEMA=H0();z8.SAFE_SCHEMA=Af();z8.DEFAULT_SCHEMA=af();z8.scan=R0("scan");z8.parse=R0("parse");z8.compose=R0("compose");z8.addConstructor=R0("addConstructor")});var UM=S((BZ,VM)=>{var A8=WM();VM.exports=A8});var P1=S((S1,F1)=>{var L0=UM(),y1=S1=F1.exports;y1.yaml={parse:L0.safeLoad.bind(L0),stringify:L0.safeDump.bind(L0)};y1.json={parse:JSON.parse.bind(JSON),stringify:function(f,$){let M=Object.assign({replacer:null,space:2},$);return JSON.stringify(f,M.replacer,M.space)}};y1.javascript={parse:function parse(str,options,wrap){try{if(wrap!==!1)str=`(function() {
54
+ `}function xY(f){return f[f.length-1]===`
55
+ `?f.slice(0,-1):f}function fQ(f,$){var M=/(\n+)([^\n]*)/g,Y=function(){var D=f.indexOf(`
56
+ `);return D=D!==-1?D:f.length,M.lastIndex=D,yY(f.slice(0,D),$)}(),J=f[0]===`
57
+ `||f[0]===" ",z,Z;while(Z=M.exec(f)){var X=Z[1],Q=Z[2];z=Q[0]===" ",Y+=X+(!J&&!z&&Q!==""?`
58
+ `:"")+yY(Q,$),J=z}return Y}function yY(f,$){if(f===""||f[0]===" ")return f;var M=/ [^ ]/g,Y,J=0,z,Z=0,X=0,Q="";while(Y=M.exec(f)){if(X=Y.index,X-J>$)z=Z>J?Z:X,Q+=`
59
+ `+f.slice(J,z),J=z+1;Z=X}if(Q+=`
60
+ `,f.length-J>$&&Z>J)Q+=f.slice(J,Z)+`
61
+ `+f.slice(Z+1);else Q+=f.slice(J);return Q.slice(1)}function $Q(f){var $="",M,Y,J;for(var z=0;z<f.length;z++){if(M=f.charCodeAt(z),M>=55296&&M<=56319){if(Y=f.charCodeAt(z+1),Y>=56320&&Y<=57343){$+=jY((M-55296)*1024+Y-56320+65536),z++;continue}}J=d[M],$+=!J&&Q0(M)?f[z]:J||jY(M)}return $}function MQ(f,$,M){var Y="",J=f.tag,z,Z;for(z=0,Z=M.length;z<Z;z+=1)if(l1(f,$,M[z],!1,!1)){if(z!==0)Y+=","+(!f.condenseFlow?" ":"");Y+=f.dump}f.tag=J,f.dump="["+Y+"]"}function YQ(f,$,M,Y){var J="",z=f.tag,Z,X;for(Z=0,X=M.length;Z<X;Z+=1)if(l1(f,$+1,M[Z],!0,!0)){if(!Y||Z!==0)J+=I$(f,$);if(f.dump&&b0===f.dump.charCodeAt(0))J+="-";else J+="- ";J+=f.dump}f.tag=z,f.dump=J||"[]"}function JQ(f,$,M){var Y="",J=f.tag,z=Object.keys(M),Z,X,Q,D,G;for(Z=0,X=z.length;Z<X;Z+=1){if(G="",Z!==0)G+=", ";if(f.condenseFlow)G+='"';if(Q=z[Z],D=M[Q],!l1(f,$,Q,!1,!1))continue;if(f.dump.length>1024)G+="? ";if(G+=f.dump+(f.condenseFlow?'"':"")+":"+(f.condenseFlow?"":" "),!l1(f,$,D,!1,!1))continue;G+=f.dump,Y+=G}f.tag=J,f.dump="{"+Y+"}"}function zQ(f,$,M,Y){var J="",z=f.tag,Z=Object.keys(M),X,Q,D,G,U,K;if(f.sortKeys===!0)Z.sort();else if(typeof f.sortKeys==="function")Z.sort(f.sortKeys);else if(f.sortKeys)throw new v0("sortKeys must be a boolean or a function");for(X=0,Q=Z.length;X<Q;X+=1){if(K="",!Y||X!==0)K+=I$(f,$);if(D=Z[X],G=M[D],!l1(f,$+1,D,!0,!0,!0))continue;if(U=f.tag!==null&&f.tag!=="?"||f.dump&&f.dump.length>1024,U)if(f.dump&&b0===f.dump.charCodeAt(0))K+="?";else K+="? ";if(K+=f.dump,U)K+=I$(f,$);if(!l1(f,$+1,G,!0,U))continue;if(f.dump&&b0===f.dump.charCodeAt(0))K+=":";else K+=": ";K+=f.dump,J+=K}f.tag=z,f.dump=J||"{}"}function kY(f,$,M){var Y,J,z,Z,X,Q;J=M?f.explicitTypes:f.implicitTypes;for(z=0,Z=J.length;z<Z;z+=1)if(X=J[z],(X.instanceOf||X.predicate)&&(!X.instanceOf||typeof $==="object"&&$ instanceof X.instanceOf)&&(!X.predicate||X.predicate($))){if(f.tag=M?X.tag:"?",X.represent){if(Q=f.styleMap[X.tag]||X.defaultStyle,bY.call(X.represent)==="[object Function]")Y=X.represent($,Q);else if(_Y.call(X.represent,Q))Y=X.represent[Q]($,Q);else throw new v0("!<"+X.tag+'> tag resolver accepts not "'+Q+'" style');f.dump=Y}return!0}return!1}function l1(f,$,M,Y,J,z){if(f.tag=null,f.dump=M,!kY(f,M,!1))kY(f,M,!0);var Z=bY.call(f.dump);if(Y)Y=f.flowLevel<0||f.flowLevel>$;var X=Z==="[object Object]"||Z==="[object Array]",Q,D;if(X)Q=f.duplicates.indexOf(M),D=Q!==-1;if(f.tag!==null&&f.tag!=="?"||D||f.indent!==2&&$>0)J=!1;if(D&&f.usedDuplicates[Q])f.dump="*ref_"+Q;else{if(X&&D&&!f.usedDuplicates[Q])f.usedDuplicates[Q]=!0;if(Z==="[object Object]"){if(Y&&Object.keys(f.dump).length!==0){if(zQ(f,$,f.dump,J),D)f.dump="&ref_"+Q+f.dump}else if(JQ(f,$,f.dump),D)f.dump="&ref_"+Q+" "+f.dump}else if(Z==="[object Array]"){var G=f.noArrayIndent&&$>0?$-1:$;if(Y&&f.dump.length!==0){if(YQ(f,G,f.dump,J),D)f.dump="&ref_"+Q+f.dump}else if(MQ(f,G,f.dump),D)f.dump="&ref_"+Q+" "+f.dump}else if(Z==="[object String]"){if(f.tag!=="?")eX(f,f.dump,$,z)}else{if(f.skipInvalid)return!1;throw new v0("unacceptable kind of an object to dump "+Z)}if(f.tag!==null&&f.tag!=="?")f.dump="!<"+f.tag+"> "+f.dump}return!0}function ZQ(f,$){var M=[],Y=[],J,z;C$(f,M,Y);for(J=0,z=Y.length;J<z;J+=1)$.duplicates.push(M[Y[J]]);$.usedDuplicates=Array(z)}function C$(f,$,M){var Y,J,z;if(f!==null&&typeof f==="object")if(J=$.indexOf(f),J!==-1){if(M.indexOf(J)===-1)M.push(J)}else if($.push(f),Array.isArray(f))for(J=0,z=f.length;J<z;J+=1)C$(f[J],$,M);else{Y=Object.keys(f);for(J=0,z=Y.length;J<z;J+=1)C$(f[Y[J]],$,M)}}function oY(f,$){$=$||{};var M=new iX($);if(!M.noRefs)ZQ(f,M);if(l1(M,0,f,!0,!0))return M.dump+`
62
+ `;return""}function XQ(f,$){return oY(f,_0.extend({schema:IX},$))}QQ.dump=oY;QQ.safeDump=XQ});var tY=V((UQ,b)=>{var Rf=wY(),aY=sY();function Nf(f){return function(){throw Error("Function "+f+" is deprecated and cannot be used.")}}UQ.Type=h();UQ.Schema=c1();UQ.FAILSAFE_SCHEMA=Kf();UQ.JSON_SCHEMA=N$();UQ.CORE_SCHEMA=O$();UQ.DEFAULT_SAFE_SCHEMA=J0();UQ.DEFAULT_FULL_SCHEMA=y0();UQ.load=Rf.load;UQ.loadAll=Rf.loadAll;UQ.safeLoad=Rf.safeLoad;UQ.safeLoadAll=Rf.safeLoadAll;UQ.dump=aY.dump;UQ.safeDump=aY.safeDump;UQ.YAMLException=M0();UQ.MINIMAL_SCHEMA=Kf();UQ.SAFE_SCHEMA=J0();UQ.DEFAULT_SCHEMA=y0();UQ.scan=Nf("scan");UQ.parse=Nf("parse");UQ.compose=Nf("compose");UQ.addConstructor=Nf("addConstructor")});var f4=V((wV,eY)=>{var yQ=tY();eY.exports=yQ});var _$=V((k$,b$)=>{var Of=f4(),y$=k$=b$.exports;y$.yaml={parse:Of.safeLoad.bind(Of),stringify:Of.safeDump.bind(Of)};y$.json={parse:JSON.parse.bind(JSON),stringify:function(f,$){let M=Object.assign({replacer:null,space:2},$);return JSON.stringify(f,M.replacer,M.space)}};y$.javascript={parse:function parse(str,options,wrap){try{if(wrap!==!1)str=`(function() {
63
63
  return `+str.trim()+`;
64
- }());`;return eval(str)||{}}catch(f){if(wrap!==!1&&/(unexpected|identifier)/i.test(f.message))return parse(str,options,!1);throw SyntaxError(f)}},stringify:function(){throw Error("stringifying JavaScript is not supported")}}});var BM=S((HZ,KM)=>{/*!
64
+ }());`;return eval(str)||{}}catch(f){if(wrap!==!1&&/(unexpected|identifier)/i.test(f.message))return parse(str,options,!1);throw SyntaxError(f)}},stringify:function(){throw Error("stringifying JavaScript is not supported")}}});var M4=V((jV,$4)=>{/*!
65
65
  * strip-bom-string <https://github.com/jonschlinkert/strip-bom-string>
66
66
  *
67
67
  * Copyright (c) 2015, 2017, Jon Schlinkert.
68
68
  * Released under the MIT License.
69
- */KM.exports=function(f){if(typeof f==="string"&&f.charAt(0)==="\uFEFF")return f.slice(1);return f}});var A0=S((N8)=>{var HM=BM(),yM=of();N8.define=function(f,$,M){Reflect.defineProperty(f,$,{enumerable:!1,configurable:!0,writable:!0,value:M})};N8.isBuffer=function(f){return yM(f)==="buffer"};N8.isObject=function(f){return yM(f)==="object"};N8.toBuffer=function(f){return typeof f==="string"?Buffer.from(f):f};N8.toString=function(f){if(N8.isBuffer(f))return HM(String(f));if(typeof f!=="string")throw TypeError("expected input to be a string or buffer");return HM(f)};N8.arrayify=function(f){return f?Array.isArray(f)?f:[f]:[]};N8.startsWith=function(f,$,M){if(typeof M!=="number")M=$.length;return f.slice(0,M)===$}});var M0=S((SZ,FM)=>{var v8=P1(),_8=A0();FM.exports=function(f){let $=Object.assign({},f);if($.delimiters=_8.arrayify($.delims||$.delimiters||"---"),$.delimiters.length===1)$.delimiters.push($.delimiters[0]);return $.language=($.language||$.lang||"yaml").toLowerCase(),$.engines=Object.assign({},v8,$.parsers,$.engines),$}});var T1=S((FZ,PM)=>{PM.exports=function(f,$){let M=$.engines[f]||$.engines[E8(f)];if(typeof M>"u")throw Error('gray-matter engine "'+f+'" is not registered');if(typeof M==="function")M={parse:M};return M};function E8(f){switch(f.toLowerCase()){case"js":case"javascript":return"javascript";case"coffee":case"coffeescript":case"cson":return"coffee";case"yaml":case"yml":return"yaml";default:return f}}});var w1=S((PZ,TM)=>{var u8=of(),h8=T1(),g8=M0();TM.exports=function(f,$,M){if($==null&&M==null)switch(u8(f)){case"object":$=f.data,M={};break;case"string":return f;default:throw TypeError("expected file to be a string or object")}let Y=f.content,J=g8(M);if($==null){if(!J.data)return f;$=J.data}let z=f.language||J.language,Z=h8(z,J);if(typeof Z.stringify!=="function")throw TypeError('expected "'+z+'.stringify" to be a function');$=Object.assign({},f.data,$);let X=J.delimiters[0],G=J.delimiters[1],q=Z.stringify($,M).trim(),Q="";if(q!=="{}")Q=kf(X)+kf(q)+kf(G);if(typeof f.excerpt==="string"&&f.excerpt!==""){if(Y.indexOf(f.excerpt.trim())===-1)Q+=kf(f.excerpt)+kf(G)}return Q+kf(Y)};function kf(f){return f.slice(-1)!==`
69
+ */$4.exports=function(f){if(typeof f==="string"&&f.charAt(0)==="\uFEFF")return f.slice(1);return f}});var Af=V((kQ)=>{var Y4=M4(),J4=E0();kQ.define=function(f,$,M){Reflect.defineProperty(f,$,{enumerable:!1,configurable:!0,writable:!0,value:M})};kQ.isBuffer=function(f){return J4(f)==="buffer"};kQ.isObject=function(f){return J4(f)==="object"};kQ.toBuffer=function(f){return typeof f==="string"?Buffer.from(f):f};kQ.toString=function(f){if(kQ.isBuffer(f))return Y4(String(f));if(typeof f!=="string")throw TypeError("expected input to be a string or buffer");return Y4(f)};kQ.arrayify=function(f){return f?Array.isArray(f)?f:[f]:[]};kQ.startsWith=function(f,$,M){if(typeof M!=="number")M=$.length;return f.slice(0,M)===$}});var u0=V((CV,Z4)=>{var cQ=_$(),mQ=Af();Z4.exports=function(f){let $=Object.assign({},f);if($.delimiters=mQ.arrayify($.delims||$.delimiters||"---"),$.delimiters.length===1)$.delimiters.push($.delimiters[0]);return $.language=($.language||$.lang||"yaml").toLowerCase(),$.engines=Object.assign({},cQ,$.parsers,$.engines),$}});var v$=V((EV,X4)=>{X4.exports=function(f,$){let M=$.engines[f]||$.engines[dQ(f)];if(typeof M>"u")throw Error('gray-matter engine "'+f+'" is not registered');if(typeof M==="function")M={parse:M};return M};function dQ(f){switch(f.toLowerCase()){case"js":case"javascript":return"javascript";case"coffee":case"coffeescript":case"cson":return"coffee";case"yaml":case"yml":return"yaml";default:return f}}});var u$=V((xV,Q4)=>{var lQ=E0(),nQ=v$(),rQ=u0();Q4.exports=function(f,$,M){if($==null&&M==null)switch(lQ(f)){case"object":$=f.data,M={};break;case"string":return f;default:throw TypeError("expected file to be a string or object")}let Y=f.content,J=rQ(M);if($==null){if(!J.data)return f;$=J.data}let z=f.language||J.language,Z=nQ(z,J);if(typeof Z.stringify!=="function")throw TypeError('expected "'+z+'.stringify" to be a function');$=Object.assign({},f.data,$);let X=J.delimiters[0],Q=J.delimiters[1],D=Z.stringify($,M).trim(),G="";if(D!=="{}")G=D0(X)+D0(D)+D0(Q);if(typeof f.excerpt==="string"&&f.excerpt!==""){if(Y.indexOf(f.excerpt.trim())===-1)G+=D0(f.excerpt)+D0(Q)}return G+D0(Y)};function D0(f){return f.slice(-1)!==`
70
70
  `?f+`
71
- `:f}});var jM=S((TZ,wM)=>{var m8=M0();wM.exports=function(f,$){let M=m8($);if(f.data==null)f.data={};if(typeof M.excerpt==="function")return M.excerpt(f,M);let Y=f.data.excerpt_separator||M.excerpt_separator;if(Y==null&&(M.excerpt===!1||M.excerpt==null))return f;let J=typeof M.excerpt==="string"?M.excerpt:Y||M.delimiters[0],z=f.content.indexOf(J);if(z!==-1)f.excerpt=f.content.slice(0,z);return f}});var AM=S((wZ,LM)=>{var RM=of(),r8=w1(),Cf=A0();LM.exports=function(f){if(RM(f)!=="object")f={content:f};if(RM(f.data)!=="object")f.data={};if(f.contents&&f.content==null)f.content=f.contents;return Cf.define(f,"orig",Cf.toBuffer(f.content)),Cf.define(f,"language",f.language||""),Cf.define(f,"matter",f.matter||""),Cf.define(f,"stringify",function($,M){if(M&&M.language)f.language=M.language;return r8(f,$,M)}),f.content=Cf.toString(f.content),f.isEmpty=!1,f.excerpt="",f}});var OM=S((jZ,NM)=>{var c8=T1(),p8=M0();NM.exports=function(f,$,M){let Y=p8(M),J=c8(f,Y);if(typeof J.parse!=="function")throw TypeError('expected "'+f+'.parse" to be a function');return J.parse($,Y)}});var CM=S((RZ,kM)=>{var l8=e("fs"),d8=R$(),j1=M0(),n8=w1(),xM=jM(),i8=P1(),o8=AM(),s8=OM(),IM=A0();function h(f,$){if(f==="")return{data:{},content:f,excerpt:"",orig:f};let M=o8(f),Y=h.cache[M.content];if(!$){if(Y)return M=Object.assign({},Y),M.orig=Y.orig,M;h.cache[M.content]=M}return a8(M,$)}function a8(f,$){let M=j1($),Y=M.delimiters[0],J=`
72
- `+M.delimiters[1],z=f.content;if(M.language)f.language=M.language;let Z=Y.length;if(!IM.startsWith(z,Y,Z))return xM(f,M),f;if(z.charAt(Z)===Y.slice(-1))return f;z=z.slice(Z);let X=z.length,G=h.language(z,M);if(G.name)f.language=G.name,z=z.slice(G.raw.length);let q=z.indexOf(J);if(q===-1)q=X;if(f.matter=z.slice(0,q),f.matter.replace(/^\s*#[^\n]+/gm,"").trim()==="")f.isEmpty=!0,f.empty=f.content,f.data={};else f.data=s8(f.language,f.matter,M);if(q===X)f.content="";else{if(f.content=z.slice(q+J.length),f.content[0]==="\r")f.content=f.content.slice(1);if(f.content[0]===`
73
- `)f.content=f.content.slice(1)}if(xM(f,M),M.sections===!0||typeof M.section==="function")d8(f,M.section);return f}h.engines=i8;h.stringify=function(f,$,M){if(typeof f==="string")f=h(f,M);return n8(f,$,M)};h.read=function(f,$){let M=l8.readFileSync(f,"utf8"),Y=h(M,$);return Y.path=f,Y};h.test=function(f,$){return IM.startsWith(f,j1($).delimiters[0])};h.language=function(f,$){let Y=j1($).delimiters[0];if(h.test(f))f=f.slice(Y.length);let J=f.slice(0,f.search(/\r?\n/));return{raw:J,name:J?J.trim():""}};h.cache={};h.clearCache=function(){h.cache={}};kM.exports=h});var q$=Q0(G$(),1),{program:B9,createCommand:H9,createArgument:y9,createOption:S9,CommanderError:F9,InvalidArgumentError:P9,InvalidOptionArgumentError:T9,Command:Q$,Argument:w9,Option:j9,Help:R9}=q$.default;import{access as O1,constants as x1,mkdir as Z4,readFile as I1,writeFile as aM}from"node:fs/promises";import{EOL as oM}from"node:os";import{join as _f}from"node:path";import{mkdir as dM,readdir as Y4,readFile as L1,stat as J4,unlink as nM,writeFile as vf}from"node:fs/promises";import{dirname as iM,extname as z4,join as A1}from"node:path";var W0=".memory",D$=".",df="system://boot",nf="system://index",e0="system://recent",W$=["system://agent","system://soul","system://user"];var V0="---",U0=".md";var U$=Q0($1(),1),b9=Q0(V$(),1);function oJ(f,$="YYYY-MM-DD HH:mm"){return U$.default(f).format($)}function K0(f){return oJ(f,"YYYY-MM-DD HH:mm")}var sJ=5;async function K$(f){let $=[];for(let Z of W$)try{let X=await f.getMemory(Z);if(X)$.push(`${X.content}`)}catch{}let Y=(await f.getAllMemories({includeDeleted:!1})).sort((Z,X)=>{let G=new Date(Z.updatedAt).getTime();return new Date(X.updatedAt).getTime()-G}).slice(0,sJ),J=[];if($.length>0)J.push(`# Core Memories
71
+ `:f}});var G4=V((yV,D4)=>{var pQ=u0();D4.exports=function(f,$){let M=pQ($);if(f.data==null)f.data={};if(typeof M.excerpt==="function")return M.excerpt(f,M);let Y=f.data.excerpt_separator||M.excerpt_separator;if(Y==null&&(M.excerpt===!1||M.excerpt==null))return f;let J=typeof M.excerpt==="string"?M.excerpt:Y||M.delimiters[0],z=f.content.indexOf(J);if(z!==-1)f.excerpt=f.content.slice(0,z);return f}});var K4=V((kV,W4)=>{var U4=E0(),iQ=u$(),G0=Af();W4.exports=function(f){if(U4(f)!=="object")f={content:f};if(U4(f.data)!=="object")f.data={};if(f.contents&&f.content==null)f.content=f.contents;return G0.define(f,"orig",G0.toBuffer(f.content)),G0.define(f,"language",f.language||""),G0.define(f,"matter",f.matter||""),G0.define(f,"stringify",function($,M){if(M&&M.language)f.language=M.language;return iQ(f,$,M)}),f.content=G0.toString(f.content),f.isEmpty=!1,f.excerpt="",f}});var q4=V((bV,V4)=>{var oQ=v$(),sQ=u0();V4.exports=function(f,$,M){let Y=sQ(M),J=oQ(f,Y);if(typeof J.parse!=="function")throw TypeError('expected "'+f+'.parse" to be a function');return J.parse($,Y)}});var F4=V((_V,S4)=>{var aQ=o("fs"),tQ=UM(),h$=u0(),eQ=u$(),B4=G4(),fD=_$(),$D=K4(),MD=q4(),H4=Af();function l(f,$){if(f==="")return{data:{},content:f,excerpt:"",orig:f};let M=$D(f),Y=l.cache[M.content];if(!$){if(Y)return M=Object.assign({},Y),M.orig=Y.orig,M;l.cache[M.content]=M}return YD(M,$)}function YD(f,$){let M=h$($),Y=M.delimiters[0],J=`
72
+ `+M.delimiters[1],z=f.content;if(M.language)f.language=M.language;let Z=Y.length;if(!H4.startsWith(z,Y,Z))return B4(f,M),f;if(z.charAt(Z)===Y.slice(-1))return f;z=z.slice(Z);let X=z.length,Q=l.language(z,M);if(Q.name)f.language=Q.name,z=z.slice(Q.raw.length);let D=z.indexOf(J);if(D===-1)D=X;if(f.matter=z.slice(0,D),f.matter.replace(/^\s*#[^\n]+/gm,"").trim()==="")f.isEmpty=!0,f.empty=f.content,f.data={};else f.data=MD(f.language,f.matter,M);if(D===X)f.content="";else{if(f.content=z.slice(D+J.length),f.content[0]==="\r")f.content=f.content.slice(1);if(f.content[0]===`
73
+ `)f.content=f.content.slice(1)}if(B4(f,M),M.sections===!0||typeof M.section==="function")tQ(f,M.section);return f}l.engines=fD;l.stringify=function(f,$,M){if(typeof f==="string")f=l(f,M);return eQ(f,$,M)};l.read=function(f,$){let M=aQ.readFileSync(f,"utf8"),Y=l(M,$);return Y.path=f,Y};l.test=function(f,$){return H4.startsWith(f,h$($).delimiters[0])};l.language=function(f,$){let Y=h$($).delimiters[0];if(l.test(f))f=f.slice(Y.length);let J=f.slice(0,f.search(/\r?\n/));return{raw:J,name:J?J.trim():""}};l.cache={};l.clearCache=function(){l.cache={}};S4.exports=l});var x=V((Iq,_4)=>{var{FORCE_COLOR:WD,NODE_DISABLE_COLORS:KD,TERM:VD}=process.env,j={enabled:!KD&&VD!=="dumb"&&WD!=="0",reset:E(0,0),bold:E(1,22),dim:E(2,22),italic:E(3,23),underline:E(4,24),inverse:E(7,27),hidden:E(8,28),strikethrough:E(9,29),black:E(30,39),red:E(31,39),green:E(32,39),yellow:E(33,39),blue:E(34,39),magenta:E(35,39),cyan:E(36,39),white:E(37,39),gray:E(90,39),grey:E(90,39),bgBlack:E(40,49),bgRed:E(41,49),bgGreen:E(42,49),bgYellow:E(43,49),bgBlue:E(44,49),bgMagenta:E(45,49),bgCyan:E(46,49),bgWhite:E(47,49)};function b4(f,$){let M=0,Y,J="",z="";for(;M<f.length;M++)if(Y=f[M],J+=Y.open,z+=Y.close,$.includes(Y.close))$=$.replace(Y.rgx,Y.close+Y.open);return J+$+z}function qD(f,$){let M={has:f,keys:$};return M.reset=j.reset.bind(M),M.bold=j.bold.bind(M),M.dim=j.dim.bind(M),M.italic=j.italic.bind(M),M.underline=j.underline.bind(M),M.inverse=j.inverse.bind(M),M.hidden=j.hidden.bind(M),M.strikethrough=j.strikethrough.bind(M),M.black=j.black.bind(M),M.red=j.red.bind(M),M.green=j.green.bind(M),M.yellow=j.yellow.bind(M),M.blue=j.blue.bind(M),M.magenta=j.magenta.bind(M),M.cyan=j.cyan.bind(M),M.white=j.white.bind(M),M.gray=j.gray.bind(M),M.grey=j.grey.bind(M),M.bgBlack=j.bgBlack.bind(M),M.bgRed=j.bgRed.bind(M),M.bgGreen=j.bgGreen.bind(M),M.bgYellow=j.bgYellow.bind(M),M.bgBlue=j.bgBlue.bind(M),M.bgMagenta=j.bgMagenta.bind(M),M.bgCyan=j.bgCyan.bind(M),M.bgWhite=j.bgWhite.bind(M),M}function E(f,$){let M={open:`\x1B[${f}m`,close:`\x1B[${$}m`,rgx:new RegExp(`\\x1b\\[${$}m`,"g")};return function(Y){if(this!==void 0&&this.has!==void 0)return this.has.includes(f)||(this.has.push(f),this.keys.push(M)),Y===void 0?this:j.enabled?b4(this.keys,Y+""):Y+"";return Y===void 0?qD([f],[M]):j.enabled?b4([M],Y+""):Y+""}}_4.exports=j});var u4=V((Cq,v4)=>{v4.exports=(f,$)=>{if(f.meta&&f.name!=="escape")return;if(f.ctrl){if(f.name==="a")return"first";if(f.name==="c")return"abort";if(f.name==="d")return"abort";if(f.name==="e")return"last";if(f.name==="g")return"reset"}if($){if(f.name==="j")return"down";if(f.name==="k")return"up"}if(f.name==="return")return"submit";if(f.name==="enter")return"submit";if(f.name==="backspace")return"delete";if(f.name==="delete")return"deleteForward";if(f.name==="abort")return"abort";if(f.name==="escape")return"exit";if(f.name==="tab")return"next";if(f.name==="pagedown")return"nextPage";if(f.name==="pageup")return"prevPage";if(f.name==="home")return"home";if(f.name==="end")return"end";if(f.name==="up")return"up";if(f.name==="down")return"down";if(f.name==="right")return"right";if(f.name==="left")return"left";return!1}});var Pf=V((Eq,h4)=>{h4.exports=(f)=>{let $=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),M=new RegExp($,"g");return typeof f==="string"?f.replace(M,""):f}});var y=V((xq,g4)=>{var l$={to(f,$){if(!$)return`\x1B[${f+1}G`;return`\x1B[${$+1};${f+1}H`},move(f,$){let M="";if(f<0)M+=`\x1B[${-f}D`;else if(f>0)M+=`\x1B[${f}C`;if($<0)M+=`\x1B[${-$}A`;else if($>0)M+=`\x1B[${$}B`;return M},up:(f=1)=>`\x1B[${f}A`,down:(f=1)=>`\x1B[${f}B`,forward:(f=1)=>`\x1B[${f}C`,backward:(f=1)=>`\x1B[${f}D`,nextLine:(f=1)=>"\x1B[E".repeat(f),prevLine:(f=1)=>"\x1B[F".repeat(f),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},BD={up:(f=1)=>"\x1B[S".repeat(f),down:(f=1)=>"\x1B[T".repeat(f)},HD={screen:"\x1B[2J",up:(f=1)=>"\x1B[1J".repeat(f),down:(f=1)=>"\x1B[J".repeat(f),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(f){let $="";for(let M=0;M<f;M++)$+=this.line+(M<f-1?l$.up():"");if(f)$+=l$.left;return $}};g4.exports={cursor:l$,scroll:BD,erase:HD,beep:"\x07"}});var n4=V((yq,l4)=>{function SD(f,$){var M=typeof Symbol<"u"&&f[Symbol.iterator]||f["@@iterator"];if(!M){if(Array.isArray(f)||(M=FD(f))||$&&f&&typeof f.length==="number"){if(M)f=M;var Y=0,J=function(){};return{s:J,n:function(){if(Y>=f.length)return{done:!0};return{done:!1,value:f[Y++]}},e:function(D){throw D},f:J}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
74
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var z=!0,Z=!1,X;return{s:function(){M=M.call(f)},n:function(){var D=M.next();return z=D.done,D},e:function(D){Z=!0,X=D},f:function(){try{if(!z&&M.return!=null)M.return()}finally{if(Z)throw X}}}}function FD(f,$){if(!f)return;if(typeof f==="string")return c4(f,$);var M=Object.prototype.toString.call(f).slice(8,-1);if(M==="Object"&&f.constructor)M=f.constructor.name;if(M==="Map"||M==="Set")return Array.from(f);if(M==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(M))return c4(f,$)}function c4(f,$){if($==null||$>f.length)$=f.length;for(var M=0,Y=Array($);M<$;M++)Y[M]=f[M];return Y}var RD=Pf(),d4=y(),m4=d4.erase,ND=d4.cursor,OD=(f)=>[...RD(f)].length;l4.exports=function(f,$){if(!$)return m4.line+ND.to(0);let M=0,Y=f.split(/\r?\n/);var J=SD(Y),z;try{for(J.s();!(z=J.n()).done;){let Z=z.value;M+=1+Math.floor(Math.max(OD(Z)-1,0)/$)}}catch(Z){J.e(Z)}finally{J.f()}return m4.lines(M)}});var n$=V((kq,r4)=>{var h0={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},AD={arrowUp:h0.arrowUp,arrowDown:h0.arrowDown,arrowLeft:h0.arrowLeft,arrowRight:h0.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},LD=process.platform==="win32"?AD:h0;r4.exports=LD});var i4=V((bq,p4)=>{var q0=x(),p1=n$(),r$=Object.freeze({password:{scale:1,render:(f)=>"*".repeat(f.length)},emoji:{scale:2,render:(f)=>"\uD83D\uDE03".repeat(f.length)},invisible:{scale:0,render:(f)=>""},default:{scale:1,render:(f)=>`${f}`}}),PD=(f)=>r$[f]||r$.default,g0=Object.freeze({aborted:q0.red(p1.cross),done:q0.green(p1.tick),exited:q0.yellow(p1.cross),default:q0.cyan("?")}),TD=(f,$,M)=>$?g0.aborted:M?g0.exited:f?g0.done:g0.default,wD=(f)=>q0.gray(f?p1.ellipsis:p1.pointerSmall),jD=(f,$)=>q0.gray(f?$?p1.pointerSmall:"+":p1.line);p4.exports={styles:r$,render:PD,symbols:g0,symbol:TD,delimiter:wD,item:jD}});var s4=V((_q,o4)=>{var ID=Pf();o4.exports=function(f,$){let M=String(ID(f)||"").split(/\r?\n/);if(!$)return M.length;return M.map((Y)=>Math.ceil(Y.length/$)).reduce((Y,J)=>Y+J)}});var t4=V((vq,a4)=>{a4.exports=(f,$={})=>{let M=Number.isSafeInteger(parseInt($.margin))?Array(parseInt($.margin)).fill(" ").join(""):$.margin||"",Y=$.width;return(f||"").split(/\r?\n/g).map((J)=>J.split(/\s+/g).reduce((z,Z)=>{if(Z.length+M.length>=Y||z[z.length-1].length+Z.length+1<Y)z[z.length-1]+=` ${Z}`;else z.push(`${M}${Z}`);return z},[M]).join(`
75
+ `)).join(`
76
+ `)}});var f9=V((uq,e4)=>{e4.exports=(f,$,M)=>{M=M||$;let Y=Math.min($-M,f-Math.floor(M/2));if(Y<0)Y=0;let J=Math.min(Y+M,$);return{startIndex:Y,endIndex:J}}});var z1=V((hq,$9)=>{$9.exports={action:u4(),clear:n4(),style:i4(),strip:Pf(),figures:n$(),lines:s4(),wrap:t4(),entriesToDisplay:f9()}});var R1=V((gq,z9)=>{var M9=o("readline"),CD=z1(),ED=CD.action,xD=o("events"),Y9=y(),yD=Y9.beep,kD=Y9.cursor,bD=x();class J9 extends xD{constructor(f={}){super();this.firstRender=!0,this.in=f.stdin||process.stdin,this.out=f.stdout||process.stdout,this.onRender=(f.onRender||(()=>{return})).bind(this);let $=M9.createInterface({input:this.in,escapeCodeTimeout:50});if(M9.emitKeypressEvents(this.in,$),this.in.isTTY)this.in.setRawMode(!0);let M=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,Y=(J,z)=>{let Z=ED(z,M);if(Z===!1)this._&&this._(J,z);else if(typeof this[Z]==="function")this[Z](z);else this.bell()};this.close=()=>{if(this.out.write(kD.show),this.in.removeListener("keypress",Y),this.in.isTTY)this.in.setRawMode(!1);$.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",Y)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(yD)}render(){if(this.onRender(bD),this.firstRender)this.firstRender=!1}}z9.exports=J9});var U9=V((cq,G9)=>{function Z9(f,$,M,Y,J,z,Z){try{var X=f[z](Z),Q=X.value}catch(D){M(D);return}if(X.done)$(Q);else Promise.resolve(Q).then(Y,J)}function X9(f){return function(){var $=this,M=arguments;return new Promise(function(Y,J){var z=f.apply($,M);function Z(Q){Z9(z,Y,J,Z,X,"next",Q)}function X(Q){Z9(z,Y,J,Z,X,"throw",Q)}Z(void 0)})}}var Tf=x(),_D=R1(),Q9=y(),vD=Q9.erase,c0=Q9.cursor,wf=z1(),p$=wf.style,i$=wf.clear,uD=wf.lines,hD=wf.figures;class D9 extends _D{constructor(f={}){super(f);this.transform=p$.render(f.style),this.scale=this.transform.scale,this.msg=f.message,this.initial=f.initial||"",this.validator=f.validate||(()=>!0),this.value="",this.errorMsg=f.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=i$("",this.out.columns),this.render()}set value(f){if(!f&&this.initial)this.placeholder=!0,this.rendered=Tf.gray(this.transform.render(this.initial));else this.placeholder=!1,this.rendered=this.transform.render(f);this._value=f,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
77
+ `),this.close()}validate(){var f=this;return X9(function*(){let $=yield f.validator(f.value);if(typeof $==="string")f.errorMsg=$,$=!1;f.error=!$})()}submit(){var f=this;return X9(function*(){if(f.value=f.value||f.initial,f.cursorOffset=0,f.cursor=f.rendered.length,yield f.validate(),f.error){f.red=!0,f.fire(),f.render();return}f.done=!0,f.aborted=!1,f.fire(),f.render(),f.out.write(`
78
+ `),f.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(f){if(this.placeholder)return;this.cursor=this.cursor+f,this.cursorOffset+=f}_(f,$){let M=this.value.slice(0,this.cursor),Y=this.value.slice(this.cursor);this.value=`${M}${f}${Y}`,this.red=!1,this.cursor=this.placeholder?0:M.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let f=this.value.slice(0,this.cursor-1),$=this.value.slice(this.cursor);if(this.value=`${f}${$}`,this.red=!1,this.isCursorAtStart())this.cursorOffset=0;else this.cursorOffset++,this.moveCursor(-1);this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let f=this.value.slice(0,this.cursor),$=this.value.slice(this.cursor+1);if(this.value=`${f}${$}`,this.red=!1,this.isCursorAtEnd())this.cursorOffset=0;else this.cursorOffset++;this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(c0.down(uD(this.outputError,this.out.columns)-1)+i$(this.outputError,this.out.columns));this.out.write(i$(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[p$.symbol(this.done,this.aborted),Tf.bold(this.msg),p$.delimiter(this.done),this.red?Tf.red(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
79
+ `).reduce((f,$,M)=>f+`
80
+ ${M?" ":hD.pointerSmall} ${Tf.red().italic($)}`,"");this.out.write(vD.line+c0.to(0)+this.outputText+c0.save+this.outputError+c0.restore+c0.move(this.cursorOffset,0))}}G9.exports=D9});var B9=V((mq,q9)=>{var N1=x(),gD=R1(),m0=z1(),W9=m0.style,K9=m0.clear,jf=m0.figures,cD=m0.wrap,mD=m0.entriesToDisplay,dD=y(),lD=dD.cursor;class V9 extends gD{constructor(f={}){super(f);this.msg=f.message,this.hint=f.hint||"- Use arrow-keys. Return to submit.",this.warn=f.warn||"- This option is disabled",this.cursor=f.initial||0,this.choices=f.choices.map(($,M)=>{if(typeof $==="string")$={title:$,value:M};return{title:$&&($.title||$.value||$),value:$&&($.value===void 0?M:$.value),description:$&&$.description,selected:$&&$.selected,disabled:$&&$.disabled}}),this.optionsPerPage=f.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=K9("",this.out.columns),this.render()}moveCursor(f){this.cursor=f,this.value=this.choices[f].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
81
+ `),this.close()}submit(){if(!this.selection.disabled)this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
82
+ `),this.close();else this.bell()}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){if(this.cursor===0)this.moveCursor(this.choices.length-1);else this.moveCursor(this.cursor-1);this.render()}down(){if(this.cursor===this.choices.length-1)this.moveCursor(0);else this.moveCursor(this.cursor+1);this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(f,$){if(f===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(lD.hide);else this.out.write(K9(this.outputText,this.out.columns));super.render();let f=mD(this.cursor,this.choices.length,this.optionsPerPage),$=f.startIndex,M=f.endIndex;if(this.outputText=[W9.symbol(this.done,this.aborted),N1.bold(this.msg),W9.delimiter(!1),this.done?this.selection.title:this.selection.disabled?N1.yellow(this.warn):N1.gray(this.hint)].join(" "),!this.done){this.outputText+=`
83
+ `;for(let Y=$;Y<M;Y++){let J,z,Z="",X=this.choices[Y];if(Y===$&&$>0)z=jf.arrowUp;else if(Y===M-1&&M<this.choices.length)z=jf.arrowDown;else z=" ";if(X.disabled)J=this.cursor===Y?N1.gray().underline(X.title):N1.strikethrough().gray(X.title),z=(this.cursor===Y?N1.bold().gray(jf.pointer)+" ":" ")+z;else if(J=this.cursor===Y?N1.cyan().underline(X.title):X.title,z=(this.cursor===Y?N1.cyan(jf.pointer)+" ":" ")+z,X.description&&this.cursor===Y){if(Z=` - ${X.description}`,z.length+J.length+Z.length>=this.out.columns||X.description.split(/\r?\n/).length>1)Z=`
84
+ `+cD(X.description,{margin:3,width:this.out.columns})}this.outputText+=`${z} ${J}${N1.gray(Z)}
85
+ `}}this.out.write(this.outputText)}}q9.exports=V9});var A9=V((dq,O9)=>{var If=x(),nD=R1(),F9=z1(),H9=F9.style,rD=F9.clear,R9=y(),S9=R9.cursor,pD=R9.erase;class N9 extends nD{constructor(f={}){super(f);this.msg=f.message,this.value=!!f.initial,this.active=f.active||"on",this.inactive=f.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
86
+ `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
87
+ `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(f,$){if(f===" ")this.value=!this.value;else if(f==="1")this.value=!0;else if(f==="0")this.value=!1;else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(S9.hide);else this.out.write(rD(this.outputText,this.out.columns));super.render(),this.outputText=[H9.symbol(this.done,this.aborted),If.bold(this.msg),H9.delimiter(this.done),this.value?this.inactive:If.cyan().underline(this.inactive),If.gray("/"),this.value?If.cyan().underline(this.active):this.active].join(" "),this.out.write(pD.line+S9.to(0)+this.outputText)}}O9.exports=N9});var U1=V((lq,L9)=>{class Cf{constructor({token:f,date:$,parts:M,locales:Y}){this.token=f,this.date=$||new Date,this.parts=M||[this],this.locales=Y||{}}up(){}down(){}next(){let f=this.parts.indexOf(this);return this.parts.find(($,M)=>M>f&&$ instanceof Cf)}setTo(f){}prev(){let f=[].concat(this.parts).reverse(),$=f.indexOf(this);return f.find((M,Y)=>Y>$&&M instanceof Cf)}toString(){return String(this.date)}}L9.exports=Cf});var w9=V((nq,T9)=>{var iD=U1();class P9 extends iD{constructor(f={}){super(f)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let f=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?f.toUpperCase():f}}T9.exports=P9});var C9=V((rq,I9)=>{var oD=U1(),sD=(f)=>{return f=f%10,f===1?"st":f===2?"nd":f===3?"rd":"th"};class j9 extends oD{constructor(f={}){super(f)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(f){this.date.setDate(parseInt(f.substr(-2)))}toString(){let f=this.date.getDate(),$=this.date.getDay();return this.token==="DD"?String(f).padStart(2,"0"):this.token==="Do"?f+sD(f):this.token==="d"?$+1:this.token==="ddd"?this.locales.weekdaysShort[$]:this.token==="dddd"?this.locales.weekdays[$]:f}}I9.exports=j9});var y9=V((pq,x9)=>{var aD=U1();class E9 extends aD{constructor(f={}){super(f)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(f){this.date.setHours(parseInt(f.substr(-2)))}toString(){let f=this.date.getHours();if(/h/.test(this.token))f=f%12||12;return this.token.length>1?String(f).padStart(2,"0"):f}}x9.exports=E9});var _9=V((iq,b9)=>{var tD=U1();class k9 extends tD{constructor(f={}){super(f)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(f){this.date.setMilliseconds(parseInt(f.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}b9.exports=k9});var h9=V((oq,u9)=>{var eD=U1();class v9 extends eD{constructor(f={}){super(f)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(f){this.date.setMinutes(parseInt(f.substr(-2)))}toString(){let f=this.date.getMinutes();return this.token.length>1?String(f).padStart(2,"0"):f}}u9.exports=v9});var m9=V((sq,c9)=>{var fG=U1();class g9 extends fG{constructor(f={}){super(f)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(f){f=parseInt(f.substr(-2))-1,this.date.setMonth(f<0?0:f)}toString(){let f=this.date.getMonth(),$=this.token.length;return $===2?String(f+1).padStart(2,"0"):$===3?this.locales.monthsShort[f]:$===4?this.locales.months[f]:String(f+1)}}c9.exports=g9});var n9=V((aq,l9)=>{var $G=U1();class d9 extends $G{constructor(f={}){super(f)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(f){this.date.setSeconds(parseInt(f.substr(-2)))}toString(){let f=this.date.getSeconds();return this.token.length>1?String(f).padStart(2,"0"):f}}l9.exports=d9});var i9=V((tq,p9)=>{var MG=U1();class r9 extends MG{constructor(f={}){super(f)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(f){this.date.setFullYear(f.substr(-4))}toString(){let f=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?f.substr(-2):f}}p9.exports=r9});var s9=V((eq,o9)=>{o9.exports={DatePart:U1(),Meridiem:w9(),Day:C9(),Hours:y9(),Milliseconds:_9(),Minutes:h9(),Month:m9(),Seconds:n9(),Year:i9()}});var XJ=V((f3,ZJ)=>{function a9(f,$,M,Y,J,z,Z){try{var X=f[z](Z),Q=X.value}catch(D){M(D);return}if(X.done)$(Q);else Promise.resolve(Q).then(Y,J)}function t9(f){return function(){var $=this,M=arguments;return new Promise(function(Y,J){var z=f.apply($,M);function Z(Q){a9(z,Y,J,Z,X,"next",Q)}function X(Q){a9(z,Y,J,Z,X,"throw",Q)}Z(void 0)})}}var o$=x(),YG=R1(),s$=z1(),e9=s$.style,fJ=s$.clear,JG=s$.figures,JJ=y(),zG=JJ.erase,$J=JJ.cursor,O1=s9(),MJ=O1.DatePart,ZG=O1.Meridiem,XG=O1.Day,QG=O1.Hours,DG=O1.Milliseconds,GG=O1.Minutes,UG=O1.Month,WG=O1.Seconds,KG=O1.Year,VG=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,YJ={1:({token:f})=>f.replace(/\\(.)/g,"$1"),2:(f)=>new XG(f),3:(f)=>new UG(f),4:(f)=>new KG(f),5:(f)=>new ZG(f),6:(f)=>new QG(f),7:(f)=>new GG(f),8:(f)=>new WG(f),9:(f)=>new DG(f)},qG={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class zJ extends YG{constructor(f={}){super(f);this.msg=f.message,this.cursor=0,this.typed="",this.locales=Object.assign(qG,f.locales),this._date=f.initial||new Date,this.errorMsg=f.error||"Please Enter A Valid Value",this.validator=f.validate||(()=>!0),this.mask=f.mask||"YYYY-MM-DD HH:mm:ss",this.clear=fJ("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(f){if(f)this._date.setTime(f.getTime())}set mask(f){let $;this.parts=[];while($=VG.exec(f)){let Y=$.shift(),J=$.findIndex((z)=>z!=null);this.parts.push(J in YJ?YJ[J]({token:$[J]||Y,date:this.date,parts:this.parts,locales:this.locales}):$[J]||Y)}let M=this.parts.reduce((Y,J)=>{if(typeof J==="string"&&typeof Y[Y.length-1]==="string")Y[Y.length-1]+=J;else Y.push(J);return Y},[]);this.parts.splice(0),this.parts.push(...M),this.reset()}moveCursor(f){this.typed="",this.cursor=f,this.fire()}reset(){this.moveCursor(this.parts.findIndex((f)=>f instanceof MJ)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
88
+ `),this.close()}validate(){var f=this;return t9(function*(){let $=yield f.validator(f.value);if(typeof $==="string")f.errorMsg=$,$=!1;f.error=!$})()}submit(){var f=this;return t9(function*(){if(yield f.validate(),f.error){f.color="red",f.fire(),f.render();return}f.done=!0,f.aborted=!1,f.fire(),f.render(),f.out.write(`
89
+ `),f.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let f=this.parts[this.cursor].prev();if(f==null)return this.bell();this.moveCursor(this.parts.indexOf(f)),this.render()}right(){let f=this.parts[this.cursor].next();if(f==null)return this.bell();this.moveCursor(this.parts.indexOf(f)),this.render()}next(){let f=this.parts[this.cursor].next();this.moveCursor(f?this.parts.indexOf(f):this.parts.findIndex(($)=>$ instanceof MJ)),this.render()}_(f){if(/\d/.test(f))this.typed+=f,this.parts[this.cursor].setTo(this.typed),this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write($J.hide);else this.out.write(fJ(this.outputText,this.out.columns));if(super.render(),this.outputText=[e9.symbol(this.done,this.aborted),o$.bold(this.msg),e9.delimiter(!1),this.parts.reduce((f,$,M)=>f.concat(M===this.cursor&&!this.done?o$.cyan().underline($.toString()):$),[]).join("")].join(" "),this.error)this.outputText+=this.errorMsg.split(`
90
+ `).reduce((f,$,M)=>f+`
91
+ ${M?" ":JG.pointerSmall} ${o$.red().italic($)}`,"");this.out.write(zG.line+$J.to(0)+this.outputText)}}ZJ.exports=zJ});var qJ=V(($3,VJ)=>{function QJ(f,$,M,Y,J,z,Z){try{var X=f[z](Z),Q=X.value}catch(D){M(D);return}if(X.done)$(Q);else Promise.resolve(Q).then(Y,J)}function DJ(f){return function(){var $=this,M=arguments;return new Promise(function(Y,J){var z=f.apply($,M);function Z(Q){QJ(z,Y,J,Z,X,"next",Q)}function X(Q){QJ(z,Y,J,Z,X,"throw",Q)}Z(void 0)})}}var Ef=x(),BG=R1(),WJ=y(),xf=WJ.cursor,HG=WJ.erase,yf=z1(),a$=yf.style,SG=yf.figures,GJ=yf.clear,FG=yf.lines,RG=/[0-9]/,t$=(f)=>f!==void 0,UJ=(f,$)=>{let M=Math.pow(10,$);return Math.round(f*M)/M};class KJ extends BG{constructor(f={}){super(f);this.transform=a$.render(f.style),this.msg=f.message,this.initial=t$(f.initial)?f.initial:"",this.float=!!f.float,this.round=f.round||2,this.inc=f.increment||1,this.min=t$(f.min)?f.min:-1/0,this.max=t$(f.max)?f.max:1/0,this.errorMsg=f.error||"Please Enter A Valid Value",this.validator=f.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(f){if(!f&&f!==0)this.placeholder=!0,this.rendered=Ef.gray(this.transform.render(`${this.initial}`)),this._value="";else this.placeholder=!1,this.rendered=this.transform.render(`${UJ(f,this.round)}`),this._value=UJ(f,this.round);this.fire()}get value(){return this._value}parse(f){return this.float?parseFloat(f):parseInt(f)}valid(f){return f==="-"||f==="."&&this.float||RG.test(f)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let f=this.value;this.value=f!==""?f:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
92
+ `),this.close()}validate(){var f=this;return DJ(function*(){let $=yield f.validator(f.value);if(typeof $==="string")f.errorMsg=$,$=!1;f.error=!$})()}submit(){var f=this;return DJ(function*(){if(yield f.validate(),f.error){f.color="red",f.fire(),f.render();return}let $=f.value;f.value=$!==""?$:f.initial,f.done=!0,f.aborted=!1,f.error=!1,f.fire(),f.render(),f.out.write(`
93
+ `),f.close()})()}up(){if(this.typed="",this.value==="")this.value=this.min-this.inc;if(this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value==="")this.value=this.min+this.inc;if(this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let f=this.value.toString();if(f.length===0)return this.bell();if(this.value=this.parse(f=f.slice(0,-1))||"",this.value!==""&&this.value<this.min)this.value=this.min;this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(f,$){if(!this.valid(f))return this.bell();let M=Date.now();if(M-this.lastHit>1000)this.typed="";if(this.typed+=f,this.lastHit=M,this.color="cyan",f===".")return this.fire();if(this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire(),this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(xf.down(FG(this.outputError,this.out.columns)-1)+GJ(this.outputError,this.out.columns));this.out.write(GJ(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[a$.symbol(this.done,this.aborted),Ef.bold(this.msg),a$.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Ef[this.color]().underline(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
94
+ `).reduce((f,$,M)=>f+`
95
+ ${M?" ":SG.pointerSmall} ${Ef.red().italic($)}`,"");this.out.write(HG.line+xf.to(0)+this.outputText+xf.save+this.outputError+xf.restore)}}VJ.exports=KJ});var e$=V((M3,FJ)=>{var W1=x(),NG=y(),OG=NG.cursor,AG=R1(),d0=z1(),BJ=d0.clear,E1=d0.figures,HJ=d0.style,LG=d0.wrap,PG=d0.entriesToDisplay;class SJ extends AG{constructor(f={}){super(f);if(this.msg=f.message,this.cursor=f.cursor||0,this.scrollIndex=f.cursor||0,this.hint=f.hint||"",this.warn=f.warn||"- This option is disabled -",this.minSelected=f.min,this.showMinError=!1,this.maxChoices=f.max,this.instructions=f.instructions,this.optionsPerPage=f.optionsPerPage||10,this.value=f.choices.map(($,M)=>{if(typeof $==="string")$={title:$,value:M};return{title:$&&($.title||$.value||$),description:$&&$.description,value:$&&($.value===void 0?M:$.value),selected:$&&$.selected,disabled:$&&$.disabled}}),this.clear=BJ("",this.out.columns),!f.overrideRender)this.render()}reset(){this.value.map((f)=>!f.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter((f)=>f.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
96
+ `),this.close()}submit(){let f=this.value.filter(($)=>$.selected);if(this.minSelected&&f.length<this.minSelected)this.showMinError=!0,this.render();else this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
97
+ `),this.close()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){if(this.cursor===0)this.cursor=this.value.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.value.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter((f)=>f.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let f=this.value[this.cursor];if(f.selected)f.selected=!1,this.render();else if(f.disabled||this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();else f.selected=!0,this.render()}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let f=!this.value[this.cursor].selected;this.value.filter(($)=>!$.disabled).forEach(($)=>$.selected=f),this.render()}_(f,$){if(f===" ")this.handleSpaceToggle();else if(f==="a")this.toggleAll();else return this.bell()}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
98
+ Instructions:
99
+ ${E1.arrowUp}/${E1.arrowDown}: Highlight option
100
+ ${E1.arrowLeft}/${E1.arrowRight}/[space]: Toggle selection
101
+ `+(this.maxChoices===void 0?` a: Toggle all
102
+ `:"")+" enter/return: Complete answer"}return""}renderOption(f,$,M,Y){let J=($.selected?W1.green(E1.radioOn):E1.radioOff)+" "+Y+" ",z,Z;if($.disabled)z=f===M?W1.gray().underline($.title):W1.strikethrough().gray($.title);else if(z=f===M?W1.cyan().underline($.title):$.title,f===M&&$.description){if(Z=` - ${$.description}`,J.length+z.length+Z.length>=this.out.columns||$.description.split(/\r?\n/).length>1)Z=`
103
+ `+LG($.description,{margin:J.length,width:this.out.columns})}return J+z+W1.gray(Z||"")}paginateOptions(f){if(f.length===0)return W1.red("No matches for this query.");let $=PG(this.cursor,f.length,this.optionsPerPage),M=$.startIndex,Y=$.endIndex,J,z=[];for(let Z=M;Z<Y;Z++){if(Z===M&&M>0)J=E1.arrowUp;else if(Z===Y-1&&Y<f.length)J=E1.arrowDown;else J=" ";z.push(this.renderOption(this.cursor,f[Z],Z,J))}return`
104
+ `+z.join(`
105
+ `)}renderOptions(f){if(!this.done)return this.paginateOptions(f);return""}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let f=[W1.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled)f.push(W1.yellow(this.warn));return f.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(OG.hide);super.render();let f=[HJ.symbol(this.done,this.aborted),W1.bold(this.msg),HJ.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)f+=W1.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;f+=this.renderOptions(this.value),this.out.write(this.clear+f),this.clear=BJ(f,this.out.columns)}}FJ.exports=SJ});var wJ=V((Y3,TJ)=>{function RJ(f,$,M,Y,J,z,Z){try{var X=f[z](Z),Q=X.value}catch(D){M(D);return}if(X.done)$(Q);else Promise.resolve(Q).then(Y,J)}function TG(f){return function(){var $=this,M=arguments;return new Promise(function(Y,J){var z=f.apply($,M);function Z(Q){RJ(z,Y,J,Z,X,"next",Q)}function X(Q){RJ(z,Y,J,Z,X,"throw",Q)}Z(void 0)})}}var l0=x(),wG=R1(),LJ=y(),jG=LJ.erase,NJ=LJ.cursor,n0=z1(),f2=n0.style,OJ=n0.clear,$2=n0.figures,IG=n0.wrap,CG=n0.entriesToDisplay,AJ=(f,$)=>f[$]&&(f[$].value||f[$].title||f[$]),EG=(f,$)=>f[$]&&(f[$].title||f[$].value||f[$]),xG=(f,$)=>{let M=f.findIndex((Y)=>Y.value===$||Y.title===$);return M>-1?M:void 0};class PJ extends wG{constructor(f={}){super(f);this.msg=f.message,this.suggest=f.suggest,this.choices=f.choices,this.initial=typeof f.initial==="number"?f.initial:xG(f.choices,f.initial),this.select=this.initial||f.cursor||0,this.i18n={noMatches:f.noMatches||"no matches found"},this.fallback=f.fallback||this.initial,this.clearFirst=f.clearFirst||!1,this.suggestions=[],this.input="",this.limit=f.limit||10,this.cursor=0,this.transform=f2.render(f.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=OJ("",this.out.columns),this.complete(this.render),this.render()}set fallback(f){this._fb=Number.isSafeInteger(parseInt(f))?parseInt(f):f}get fallback(){let f;if(typeof this._fb==="number")f=this.choices[this._fb];else if(typeof this._fb==="string")f={title:this._fb};return f||this._fb||{title:this.i18n.noMatches}}moveSelect(f){if(this.select=f,this.suggestions.length>0)this.value=AJ(this.suggestions,f);else this.value=this.fallback.value;this.fire()}complete(f){var $=this;return TG(function*(){let M=$.completing=$.suggest($.input,$.choices),Y=yield M;if($.completing!==M)return;$.suggestions=Y.map((z,Z,X)=>({title:EG(X,Z),value:AJ(X,Z),description:z.description})),$.completing=!1;let J=Math.max(Y.length-1,0);$.moveSelect(Math.min(J,$.select)),f&&f()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){if(this.clearFirst&&this.input.length>0)this.reset();else this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
106
+ `),this.close()}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
107
+ `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
108
+ `),this.close()}_(f,$){let M=this.input.slice(0,this.cursor),Y=this.input.slice(this.cursor);this.input=`${M}${f}${Y}`,this.cursor=M.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let f=this.input.slice(0,this.cursor-1),$=this.input.slice(this.cursor);this.input=`${f}${$}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let f=this.input.slice(0,this.cursor),$=this.input.slice(this.cursor+1);this.input=`${f}${$}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){if(this.select===0)this.moveSelect(this.suggestions.length-1);else this.moveSelect(this.select-1);this.render()}down(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}next(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(f,$,M,Y){let J,z=M?$2.arrowUp:Y?$2.arrowDown:" ",Z=$?l0.cyan().underline(f.title):f.title;if(z=($?l0.cyan($2.pointer)+" ":" ")+z,f.description){if(J=` - ${f.description}`,z.length+Z.length+J.length>=this.out.columns||f.description.split(/\r?\n/).length>1)J=`
109
+ `+IG(f.description,{margin:3,width:this.out.columns})}return z+" "+Z+l0.gray(J||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(NJ.hide);else this.out.write(OJ(this.outputText,this.out.columns));super.render();let f=CG(this.select,this.choices.length,this.limit),$=f.startIndex,M=f.endIndex;if(this.outputText=[f2.symbol(this.done,this.aborted,this.exited),l0.bold(this.msg),f2.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let Y=this.suggestions.slice($,M).map((J,z)=>this.renderOption(J,this.select===z+$,z===0&&$>0,z+$===M-1&&M<this.choices.length)).join(`
110
+ `);this.outputText+=`
111
+ `+(Y||l0.gray(this.fallback.title))}this.out.write(jG.line+NJ.to(0)+this.outputText)}}TJ.exports=PJ});var xJ=V((J3,EJ)=>{var A1=x(),yG=y(),kG=yG.cursor,bG=e$(),M2=z1(),jJ=M2.clear,IJ=M2.style,B0=M2.figures;class CJ extends bG{constructor(f={}){f.overrideRender=!0;super(f);this.inputValue="",this.clear=jJ("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){if(this.cursor===0)this.cursor=this.filteredOptions.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.filteredOptions.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter((f)=>f.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){if(this.inputValue.length)this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions()}updateFilteredOptions(){let f=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((M)=>{if(this.inputValue){if(typeof M.title==="string"){if(M.title.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}if(typeof M.value==="string"){if(M.value.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}return!1}return!0});let $=this.filteredOptions.findIndex((M)=>M===f);this.cursor=$<0?0:$,this.render()}handleSpaceToggle(){let f=this.filteredOptions[this.cursor];if(f.selected)f.selected=!1,this.render();else if(f.disabled||this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();else f.selected=!0,this.render()}handleInputChange(f){this.inputValue=this.inputValue+f,this.updateFilteredOptions()}_(f,$){if(f===" ")this.handleSpaceToggle();else this.handleInputChange(f)}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
112
+ Instructions:
113
+ ${B0.arrowUp}/${B0.arrowDown}: Highlight option
114
+ ${B0.arrowLeft}/${B0.arrowRight}/[space]: Toggle selection
115
+ [a,b,c]/delete: Filter choices
116
+ enter/return: Complete answer
117
+ `}return""}renderCurrentInput(){return`
118
+ Filtered results for: ${this.inputValue?this.inputValue:A1.gray("Enter something to filter")}
119
+ `}renderOption(f,$,M){let Y;if($.disabled)Y=f===M?A1.gray().underline($.title):A1.strikethrough().gray($.title);else Y=f===M?A1.cyan().underline($.title):$.title;return($.selected?A1.green(B0.radioOn):B0.radioOff)+" "+Y}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let f=[A1.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled)f.push(A1.yellow(this.warn));return f.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(kG.hide);super.render();let f=[IJ.symbol(this.done,this.aborted),A1.bold(this.msg),IJ.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)f+=A1.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;f+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+f),this.clear=jJ(f,this.out.columns)}}EJ.exports=CJ});var gJ=V((z3,hJ)=>{var yJ=x(),_G=R1(),_J=z1(),kJ=_J.style,vG=_J.clear,vJ=y(),uG=vJ.erase,bJ=vJ.cursor;class uJ extends _G{constructor(f={}){super(f);this.msg=f.message,this.value=f.initial,this.initialValue=!!f.initial,this.yesMsg=f.yes||"yes",this.yesOption=f.yesOption||"(Y/n)",this.noMsg=f.no||"no",this.noOption=f.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
120
+ `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
121
+ `),this.close()}_(f,$){if(f.toLowerCase()==="y")return this.value=!0,this.submit();if(f.toLowerCase()==="n")return this.value=!1,this.submit();return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(bJ.hide);else this.out.write(vG(this.outputText,this.out.columns));super.render(),this.outputText=[kJ.symbol(this.done,this.aborted),yJ.bold(this.msg),kJ.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:yJ.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(uG.line+bJ.to(0)+this.outputText)}}hJ.exports=uJ});var mJ=V((Z3,cJ)=>{cJ.exports={TextPrompt:U9(),SelectPrompt:B9(),TogglePrompt:A9(),DatePrompt:XJ(),NumberPrompt:qJ(),MultiselectPrompt:e$(),AutocompletePrompt:wJ(),AutocompleteMultiselectPrompt:xJ(),ConfirmPrompt:gJ()}});var lJ=V((dJ)=>{var a=dJ,hG=mJ(),kf=(f)=>f;function K1(f,$,M={}){return new Promise((Y,J)=>{let z=new hG[f]($),Z=M.onAbort||kf,X=M.onSubmit||kf,Q=M.onExit||kf;z.on("state",$.onState||kf),z.on("submit",(D)=>Y(X(D))),z.on("exit",(D)=>Y(Q(D))),z.on("abort",(D)=>J(Z(D)))})}a.text=(f)=>K1("TextPrompt",f);a.password=(f)=>{return f.style="password",a.text(f)};a.invisible=(f)=>{return f.style="invisible",a.text(f)};a.number=(f)=>K1("NumberPrompt",f);a.date=(f)=>K1("DatePrompt",f);a.confirm=(f)=>K1("ConfirmPrompt",f);a.list=(f)=>{let $=f.separator||",";return K1("TextPrompt",f,{onSubmit:(M)=>M.split($).map((Y)=>Y.trim())})};a.toggle=(f)=>K1("TogglePrompt",f);a.select=(f)=>K1("SelectPrompt",f);a.multiselect=(f)=>{f.choices=[].concat(f.choices||[]);let $=(M)=>M.filter((Y)=>Y.selected).map((Y)=>Y.value);return K1("MultiselectPrompt",f,{onAbort:$,onSubmit:$})};a.autocompleteMultiselect=(f)=>{f.choices=[].concat(f.choices||[]);let $=(M)=>M.filter((Y)=>Y.selected).map((Y)=>Y.value);return K1("AutocompleteMultiselectPrompt",f,{onAbort:$,onSubmit:$})};var gG=(f,$)=>Promise.resolve($.filter((M)=>M.title.slice(0,f.length).toLowerCase()===f.toLowerCase()));a.autocomplete=(f)=>{return f.suggest=f.suggest||gG,f.choices=[].concat(f.choices||[]),K1("AutocompletePrompt",f)}});var tJ=V((Q3,aJ)=>{function nJ(f,$){var M=Object.keys(f);if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(f);if($)Y=Y.filter(function(J){return Object.getOwnPropertyDescriptor(f,J).enumerable});M.push.apply(M,Y)}return M}function rJ(f){for(var $=1;$<arguments.length;$++){var M=arguments[$]!=null?arguments[$]:{};if($%2)nJ(Object(M),!0).forEach(function(Y){cG(f,Y,M[Y])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties(f,Object.getOwnPropertyDescriptors(M));else nJ(Object(M)).forEach(function(Y){Object.defineProperty(f,Y,Object.getOwnPropertyDescriptor(M,Y))})}return f}function cG(f,$,M){if($ in f)Object.defineProperty(f,$,{value:M,enumerable:!0,configurable:!0,writable:!0});else f[$]=M;return f}function mG(f,$){var M=typeof Symbol<"u"&&f[Symbol.iterator]||f["@@iterator"];if(!M){if(Array.isArray(f)||(M=dG(f))||$&&f&&typeof f.length==="number"){if(M)f=M;var Y=0,J=function(){};return{s:J,n:function(){if(Y>=f.length)return{done:!0};return{done:!1,value:f[Y++]}},e:function(D){throw D},f:J}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
122
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var z=!0,Z=!1,X;return{s:function(){M=M.call(f)},n:function(){var D=M.next();return z=D.done,D},e:function(D){Z=!0,X=D},f:function(){try{if(!z&&M.return!=null)M.return()}finally{if(Z)throw X}}}}function dG(f,$){if(!f)return;if(typeof f==="string")return pJ(f,$);var M=Object.prototype.toString.call(f).slice(8,-1);if(M==="Object"&&f.constructor)M=f.constructor.name;if(M==="Map"||M==="Set")return Array.from(f);if(M==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(M))return pJ(f,$)}function pJ(f,$){if($==null||$>f.length)$=f.length;for(var M=0,Y=Array($);M<$;M++)Y[M]=f[M];return Y}function iJ(f,$,M,Y,J,z,Z){try{var X=f[z](Z),Q=X.value}catch(D){M(D);return}if(X.done)$(Q);else Promise.resolve(Q).then(Y,J)}function oJ(f){return function(){var $=this,M=arguments;return new Promise(function(Y,J){var z=f.apply($,M);function Z(Q){iJ(z,Y,J,Z,X,"next",Q)}function X(Q){iJ(z,Y,J,Z,X,"throw",Q)}Z(void 0)})}}var Y2=lJ(),lG=["suggest","format","onState","validate","onRender","type"],sJ=()=>{};function x1(){return J2.apply(this,arguments)}function J2(){return J2=oJ(function*(f=[],{onSubmit:$=sJ,onCancel:M=sJ}={}){let Y={},J=x1._override||{};f=[].concat(f);let z,Z,X,Q,D,G,U=function(){var F=oJ(function*(T,c,r=!1){if(!r&&T.validate&&T.validate(c)!==!0)return;return T.format?yield T.format(c,Y):c});return function(c,r){return F.apply(this,arguments)}}();var K=mG(f),W;try{for(K.s();!(W=K.n()).done;){Z=W.value;var B=Z;if(Q=B.name,D=B.type,typeof D==="function")D=yield D(z,rJ({},Y),Z),Z.type=D;if(!D)continue;for(let F in Z){if(lG.includes(F))continue;let T=Z[F];Z[F]=typeof T==="function"?yield T(z,rJ({},Y),G):T}if(G=Z,typeof Z.message!=="string")throw Error("prompt message is required");var O=Z;if(Q=O.name,D=O.type,Y2[D]===void 0)throw Error(`prompt type (${D}) is not defined`);if(J[Z.name]!==void 0){if(z=yield U(Z,J[Z.name]),z!==void 0){Y[Q]=z;continue}}try{z=x1._injected?nG(x1._injected,Z.initial):yield Y2[D](Z),Y[Q]=z=yield U(Z,z,!0),X=yield $(Z,z,Y)}catch(F){X=!(yield M(Z,Y))}if(X)return Y}}catch(F){K.e(F)}finally{K.f()}return Y}),J2.apply(this,arguments)}function nG(f,$){let M=f.shift();if(M instanceof Error)throw M;return M===void 0?$:M}function rG(f){x1._injected=(x1._injected||[]).concat(f)}function pG(f){x1._override=Object.assign({},f)}aJ.exports=Object.assign(x1,{prompt:x1,prompts:Y2,inject:rG,override:pG})});var f5=V((D3,eJ)=>{eJ.exports=(f,$)=>{if(f.meta&&f.name!=="escape")return;if(f.ctrl){if(f.name==="a")return"first";if(f.name==="c")return"abort";if(f.name==="d")return"abort";if(f.name==="e")return"last";if(f.name==="g")return"reset"}if($){if(f.name==="j")return"down";if(f.name==="k")return"up"}if(f.name==="return")return"submit";if(f.name==="enter")return"submit";if(f.name==="backspace")return"delete";if(f.name==="delete")return"deleteForward";if(f.name==="abort")return"abort";if(f.name==="escape")return"exit";if(f.name==="tab")return"next";if(f.name==="pagedown")return"nextPage";if(f.name==="pageup")return"prevPage";if(f.name==="home")return"home";if(f.name==="end")return"end";if(f.name==="up")return"up";if(f.name==="down")return"down";if(f.name==="right")return"right";if(f.name==="left")return"left";return!1}});var bf=V((G3,$5)=>{$5.exports=(f)=>{let $=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),M=new RegExp($,"g");return typeof f==="string"?f.replace(M,""):f}});var J5=V((U3,Y5)=>{var iG=bf(),{erase:M5,cursor:oG}=y(),sG=(f)=>[...iG(f)].length;Y5.exports=function(f,$){if(!$)return M5.line+oG.to(0);let M=0,Y=f.split(/\r?\n/);for(let J of Y)M+=1+Math.floor(Math.max(sG(J)-1,0)/$);return M5.lines(M)}});var z2=V((W3,z5)=>{var r0={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},aG={arrowUp:r0.arrowUp,arrowDown:r0.arrowDown,arrowLeft:r0.arrowLeft,arrowRight:r0.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},tG=process.platform==="win32"?aG:r0;z5.exports=tG});var X5=V((K3,Z5)=>{var H0=x(),i1=z2(),Z2=Object.freeze({password:{scale:1,render:(f)=>"*".repeat(f.length)},emoji:{scale:2,render:(f)=>"\uD83D\uDE03".repeat(f.length)},invisible:{scale:0,render:(f)=>""},default:{scale:1,render:(f)=>`${f}`}}),eG=(f)=>Z2[f]||Z2.default,p0=Object.freeze({aborted:H0.red(i1.cross),done:H0.green(i1.tick),exited:H0.yellow(i1.cross),default:H0.cyan("?")}),fU=(f,$,M)=>$?p0.aborted:M?p0.exited:f?p0.done:p0.default,$U=(f)=>H0.gray(f?i1.ellipsis:i1.pointerSmall),MU=(f,$)=>H0.gray(f?$?i1.pointerSmall:"+":i1.line);Z5.exports={styles:Z2,render:eG,symbols:p0,symbol:fU,delimiter:$U,item:MU}});var D5=V((V3,Q5)=>{var YU=bf();Q5.exports=function(f,$){let M=String(YU(f)||"").split(/\r?\n/);if(!$)return M.length;return M.map((Y)=>Math.ceil(Y.length/$)).reduce((Y,J)=>Y+J)}});var U5=V((q3,G5)=>{G5.exports=(f,$={})=>{let M=Number.isSafeInteger(parseInt($.margin))?Array(parseInt($.margin)).fill(" ").join(""):$.margin||"",Y=$.width;return(f||"").split(/\r?\n/g).map((J)=>J.split(/\s+/g).reduce((z,Z)=>{if(Z.length+M.length>=Y||z[z.length-1].length+Z.length+1<Y)z[z.length-1]+=` ${Z}`;else z.push(`${M}${Z}`);return z},[M]).join(`
123
+ `)).join(`
124
+ `)}});var K5=V((B3,W5)=>{W5.exports=(f,$,M)=>{M=M||$;let Y=Math.min($-M,f-Math.floor(M/2));if(Y<0)Y=0;let J=Math.min(Y+M,$);return{startIndex:Y,endIndex:J}}});var Z1=V((H3,V5)=>{V5.exports={action:f5(),clear:J5(),style:X5(),strip:bf(),figures:z2(),lines:D5(),wrap:U5(),entriesToDisplay:K5()}});var L1=V((S3,H5)=>{var q5=o("readline"),{action:JU}=Z1(),zU=o("events"),{beep:ZU,cursor:XU}=y(),QU=x();class B5 extends zU{constructor(f={}){super();this.firstRender=!0,this.in=f.stdin||process.stdin,this.out=f.stdout||process.stdout,this.onRender=(f.onRender||(()=>{return})).bind(this);let $=q5.createInterface({input:this.in,escapeCodeTimeout:50});if(q5.emitKeypressEvents(this.in,$),this.in.isTTY)this.in.setRawMode(!0);let M=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,Y=(J,z)=>{let Z=JU(z,M);if(Z===!1)this._&&this._(J,z);else if(typeof this[Z]==="function")this[Z](z);else this.bell()};this.close=()=>{if(this.out.write(XU.show),this.in.removeListener("keypress",Y),this.in.isTTY)this.in.setRawMode(!1);$.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",Y)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(ZU)}render(){if(this.onRender(QU),this.firstRender)this.firstRender=!1}}H5.exports=B5});var R5=V((F3,F5)=>{var _f=x(),DU=L1(),{erase:GU,cursor:i0}=y(),{style:X2,clear:Q2,lines:UU,figures:WU}=Z1();class S5 extends DU{constructor(f={}){super(f);this.transform=X2.render(f.style),this.scale=this.transform.scale,this.msg=f.message,this.initial=f.initial||"",this.validator=f.validate||(()=>!0),this.value="",this.errorMsg=f.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=Q2("",this.out.columns),this.render()}set value(f){if(!f&&this.initial)this.placeholder=!0,this.rendered=_f.gray(this.transform.render(this.initial));else this.placeholder=!1,this.rendered=this.transform.render(f);this._value=f,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
125
+ `),this.close()}async validate(){let f=await this.validator(this.value);if(typeof f==="string")this.errorMsg=f,f=!1;this.error=!f}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
126
+ `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(f){if(this.placeholder)return;this.cursor=this.cursor+f,this.cursorOffset+=f}_(f,$){let M=this.value.slice(0,this.cursor),Y=this.value.slice(this.cursor);this.value=`${M}${f}${Y}`,this.red=!1,this.cursor=this.placeholder?0:M.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let f=this.value.slice(0,this.cursor-1),$=this.value.slice(this.cursor);if(this.value=`${f}${$}`,this.red=!1,this.isCursorAtStart())this.cursorOffset=0;else this.cursorOffset++,this.moveCursor(-1);this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let f=this.value.slice(0,this.cursor),$=this.value.slice(this.cursor+1);if(this.value=`${f}${$}`,this.red=!1,this.isCursorAtEnd())this.cursorOffset=0;else this.cursorOffset++;this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(i0.down(UU(this.outputError,this.out.columns)-1)+Q2(this.outputError,this.out.columns));this.out.write(Q2(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[X2.symbol(this.done,this.aborted),_f.bold(this.msg),X2.delimiter(this.done),this.red?_f.red(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
127
+ `).reduce((f,$,M)=>f+`
128
+ ${M?" ":WU.pointerSmall} ${_f.red().italic($)}`,"");this.out.write(GU.line+i0.to(0)+this.outputText+i0.save+this.outputError+i0.restore+i0.move(this.cursorOffset,0))}}F5.exports=S5});var P5=V((R3,L5)=>{var P1=x(),KU=L1(),{style:N5,clear:O5,figures:vf,wrap:VU,entriesToDisplay:qU}=Z1(),{cursor:BU}=y();class A5 extends KU{constructor(f={}){super(f);this.msg=f.message,this.hint=f.hint||"- Use arrow-keys. Return to submit.",this.warn=f.warn||"- This option is disabled",this.cursor=f.initial||0,this.choices=f.choices.map(($,M)=>{if(typeof $==="string")$={title:$,value:M};return{title:$&&($.title||$.value||$),value:$&&($.value===void 0?M:$.value),description:$&&$.description,selected:$&&$.selected,disabled:$&&$.disabled}}),this.optionsPerPage=f.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=O5("",this.out.columns),this.render()}moveCursor(f){this.cursor=f,this.value=this.choices[f].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
129
+ `),this.close()}submit(){if(!this.selection.disabled)this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
130
+ `),this.close();else this.bell()}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){if(this.cursor===0)this.moveCursor(this.choices.length-1);else this.moveCursor(this.cursor-1);this.render()}down(){if(this.cursor===this.choices.length-1)this.moveCursor(0);else this.moveCursor(this.cursor+1);this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(f,$){if(f===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(BU.hide);else this.out.write(O5(this.outputText,this.out.columns));super.render();let{startIndex:f,endIndex:$}=qU(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[N5.symbol(this.done,this.aborted),P1.bold(this.msg),N5.delimiter(!1),this.done?this.selection.title:this.selection.disabled?P1.yellow(this.warn):P1.gray(this.hint)].join(" "),!this.done){this.outputText+=`
131
+ `;for(let M=f;M<$;M++){let Y,J,z="",Z=this.choices[M];if(M===f&&f>0)J=vf.arrowUp;else if(M===$-1&&$<this.choices.length)J=vf.arrowDown;else J=" ";if(Z.disabled)Y=this.cursor===M?P1.gray().underline(Z.title):P1.strikethrough().gray(Z.title),J=(this.cursor===M?P1.bold().gray(vf.pointer)+" ":" ")+J;else if(Y=this.cursor===M?P1.cyan().underline(Z.title):Z.title,J=(this.cursor===M?P1.cyan(vf.pointer)+" ":" ")+J,Z.description&&this.cursor===M){if(z=` - ${Z.description}`,J.length+Y.length+z.length>=this.out.columns||Z.description.split(/\r?\n/).length>1)z=`
132
+ `+VU(Z.description,{margin:3,width:this.out.columns})}this.outputText+=`${J} ${Y}${P1.gray(z)}
133
+ `}}this.out.write(this.outputText)}}L5.exports=A5});var C5=V((N3,I5)=>{var uf=x(),HU=L1(),{style:T5,clear:SU}=Z1(),{cursor:w5,erase:FU}=y();class j5 extends HU{constructor(f={}){super(f);this.msg=f.message,this.value=!!f.initial,this.active=f.active||"on",this.inactive=f.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
134
+ `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
135
+ `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(f,$){if(f===" ")this.value=!this.value;else if(f==="1")this.value=!0;else if(f==="0")this.value=!1;else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(w5.hide);else this.out.write(SU(this.outputText,this.out.columns));super.render(),this.outputText=[T5.symbol(this.done,this.aborted),uf.bold(this.msg),T5.delimiter(this.done),this.value?this.inactive:uf.cyan().underline(this.inactive),uf.gray("/"),this.value?uf.cyan().underline(this.active):this.active].join(" "),this.out.write(FU.line+w5.to(0)+this.outputText)}}I5.exports=j5});var V1=V((O3,E5)=>{class hf{constructor({token:f,date:$,parts:M,locales:Y}){this.token=f,this.date=$||new Date,this.parts=M||[this],this.locales=Y||{}}up(){}down(){}next(){let f=this.parts.indexOf(this);return this.parts.find(($,M)=>M>f&&$ instanceof hf)}setTo(f){}prev(){let f=[].concat(this.parts).reverse(),$=f.indexOf(this);return f.find((M,Y)=>Y>$&&M instanceof hf)}toString(){return String(this.date)}}E5.exports=hf});var k5=V((A3,y5)=>{var RU=V1();class x5 extends RU{constructor(f={}){super(f)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let f=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?f.toUpperCase():f}}y5.exports=x5});var v5=V((L3,_5)=>{var NU=V1(),OU=(f)=>{return f=f%10,f===1?"st":f===2?"nd":f===3?"rd":"th"};class b5 extends NU{constructor(f={}){super(f)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(f){this.date.setDate(parseInt(f.substr(-2)))}toString(){let f=this.date.getDate(),$=this.date.getDay();return this.token==="DD"?String(f).padStart(2,"0"):this.token==="Do"?f+OU(f):this.token==="d"?$+1:this.token==="ddd"?this.locales.weekdaysShort[$]:this.token==="dddd"?this.locales.weekdays[$]:f}}_5.exports=b5});var g5=V((P3,h5)=>{var AU=V1();class u5 extends AU{constructor(f={}){super(f)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(f){this.date.setHours(parseInt(f.substr(-2)))}toString(){let f=this.date.getHours();if(/h/.test(this.token))f=f%12||12;return this.token.length>1?String(f).padStart(2,"0"):f}}h5.exports=u5});var d5=V((T3,m5)=>{var LU=V1();class c5 extends LU{constructor(f={}){super(f)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(f){this.date.setMilliseconds(parseInt(f.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}m5.exports=c5});var r5=V((w3,n5)=>{var PU=V1();class l5 extends PU{constructor(f={}){super(f)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(f){this.date.setMinutes(parseInt(f.substr(-2)))}toString(){let f=this.date.getMinutes();return this.token.length>1?String(f).padStart(2,"0"):f}}n5.exports=l5});var o5=V((j3,i5)=>{var TU=V1();class p5 extends TU{constructor(f={}){super(f)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(f){f=parseInt(f.substr(-2))-1,this.date.setMonth(f<0?0:f)}toString(){let f=this.date.getMonth(),$=this.token.length;return $===2?String(f+1).padStart(2,"0"):$===3?this.locales.monthsShort[f]:$===4?this.locales.months[f]:String(f+1)}}i5.exports=p5});var t5=V((I3,a5)=>{var wU=V1();class s5 extends wU{constructor(f={}){super(f)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(f){this.date.setSeconds(parseInt(f.substr(-2)))}toString(){let f=this.date.getSeconds();return this.token.length>1?String(f).padStart(2,"0"):f}}a5.exports=s5});var $z=V((C3,fz)=>{var jU=V1();class e5 extends jU{constructor(f={}){super(f)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(f){this.date.setFullYear(f.substr(-4))}toString(){let f=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?f.substr(-2):f}}fz.exports=e5});var Yz=V((E3,Mz)=>{Mz.exports={DatePart:V1(),Meridiem:k5(),Day:v5(),Hours:g5(),Milliseconds:d5(),Minutes:r5(),Month:o5(),Seconds:t5(),Year:$z()}});var Uz=V((x3,Gz)=>{var D2=x(),IU=L1(),{style:Jz,clear:zz,figures:CU}=Z1(),{erase:EU,cursor:Zz}=y(),{DatePart:Xz,Meridiem:xU,Day:yU,Hours:kU,Milliseconds:bU,Minutes:_U,Month:vU,Seconds:uU,Year:hU}=Yz(),gU=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,Qz={1:({token:f})=>f.replace(/\\(.)/g,"$1"),2:(f)=>new yU(f),3:(f)=>new vU(f),4:(f)=>new hU(f),5:(f)=>new xU(f),6:(f)=>new kU(f),7:(f)=>new _U(f),8:(f)=>new uU(f),9:(f)=>new bU(f)},cU={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class Dz extends IU{constructor(f={}){super(f);this.msg=f.message,this.cursor=0,this.typed="",this.locales=Object.assign(cU,f.locales),this._date=f.initial||new Date,this.errorMsg=f.error||"Please Enter A Valid Value",this.validator=f.validate||(()=>!0),this.mask=f.mask||"YYYY-MM-DD HH:mm:ss",this.clear=zz("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(f){if(f)this._date.setTime(f.getTime())}set mask(f){let $;this.parts=[];while($=gU.exec(f)){let Y=$.shift(),J=$.findIndex((z)=>z!=null);this.parts.push(J in Qz?Qz[J]({token:$[J]||Y,date:this.date,parts:this.parts,locales:this.locales}):$[J]||Y)}let M=this.parts.reduce((Y,J)=>{if(typeof J==="string"&&typeof Y[Y.length-1]==="string")Y[Y.length-1]+=J;else Y.push(J);return Y},[]);this.parts.splice(0),this.parts.push(...M),this.reset()}moveCursor(f){this.typed="",this.cursor=f,this.fire()}reset(){this.moveCursor(this.parts.findIndex((f)=>f instanceof Xz)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
136
+ `),this.close()}async validate(){let f=await this.validator(this.value);if(typeof f==="string")this.errorMsg=f,f=!1;this.error=!f}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
137
+ `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let f=this.parts[this.cursor].prev();if(f==null)return this.bell();this.moveCursor(this.parts.indexOf(f)),this.render()}right(){let f=this.parts[this.cursor].next();if(f==null)return this.bell();this.moveCursor(this.parts.indexOf(f)),this.render()}next(){let f=this.parts[this.cursor].next();this.moveCursor(f?this.parts.indexOf(f):this.parts.findIndex(($)=>$ instanceof Xz)),this.render()}_(f){if(/\d/.test(f))this.typed+=f,this.parts[this.cursor].setTo(this.typed),this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(Zz.hide);else this.out.write(zz(this.outputText,this.out.columns));if(super.render(),this.outputText=[Jz.symbol(this.done,this.aborted),D2.bold(this.msg),Jz.delimiter(!1),this.parts.reduce((f,$,M)=>f.concat(M===this.cursor&&!this.done?D2.cyan().underline($.toString()):$),[]).join("")].join(" "),this.error)this.outputText+=this.errorMsg.split(`
138
+ `).reduce((f,$,M)=>f+`
139
+ ${M?" ":CU.pointerSmall} ${D2.red().italic($)}`,"");this.out.write(EU.line+Zz.to(0)+this.outputText)}}Gz.exports=Dz});var Bz=V((y3,qz)=>{var gf=x(),mU=L1(),{cursor:cf,erase:dU}=y(),{style:G2,figures:lU,clear:Wz,lines:nU}=Z1(),rU=/[0-9]/,U2=(f)=>f!==void 0,Kz=(f,$)=>{let M=Math.pow(10,$);return Math.round(f*M)/M};class Vz extends mU{constructor(f={}){super(f);this.transform=G2.render(f.style),this.msg=f.message,this.initial=U2(f.initial)?f.initial:"",this.float=!!f.float,this.round=f.round||2,this.inc=f.increment||1,this.min=U2(f.min)?f.min:-1/0,this.max=U2(f.max)?f.max:1/0,this.errorMsg=f.error||"Please Enter A Valid Value",this.validator=f.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(f){if(!f&&f!==0)this.placeholder=!0,this.rendered=gf.gray(this.transform.render(`${this.initial}`)),this._value="";else this.placeholder=!1,this.rendered=this.transform.render(`${Kz(f,this.round)}`),this._value=Kz(f,this.round);this.fire()}get value(){return this._value}parse(f){return this.float?parseFloat(f):parseInt(f)}valid(f){return f==="-"||f==="."&&this.float||rU.test(f)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let f=this.value;this.value=f!==""?f:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
140
+ `),this.close()}async validate(){let f=await this.validator(this.value);if(typeof f==="string")this.errorMsg=f,f=!1;this.error=!f}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let f=this.value;this.value=f!==""?f:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
141
+ `),this.close()}up(){if(this.typed="",this.value==="")this.value=this.min-this.inc;if(this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value==="")this.value=this.min+this.inc;if(this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let f=this.value.toString();if(f.length===0)return this.bell();if(this.value=this.parse(f=f.slice(0,-1))||"",this.value!==""&&this.value<this.min)this.value=this.min;this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(f,$){if(!this.valid(f))return this.bell();let M=Date.now();if(M-this.lastHit>1000)this.typed="";if(this.typed+=f,this.lastHit=M,this.color="cyan",f===".")return this.fire();if(this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire(),this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(cf.down(nU(this.outputError,this.out.columns)-1)+Wz(this.outputError,this.out.columns));this.out.write(Wz(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[G2.symbol(this.done,this.aborted),gf.bold(this.msg),G2.delimiter(this.done),!this.done||!this.done&&!this.placeholder?gf[this.color]().underline(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
142
+ `).reduce((f,$,M)=>f+`
143
+ ${M?" ":lU.pointerSmall} ${gf.red().italic($)}`,"");this.out.write(dU.line+cf.to(0)+this.outputText+cf.save+this.outputError+cf.restore)}}qz.exports=Vz});var W2=V((k3,Rz)=>{var q1=x(),{cursor:pU}=y(),iU=L1(),{clear:Hz,figures:y1,style:Sz,wrap:oU,entriesToDisplay:sU}=Z1();class Fz extends iU{constructor(f={}){super(f);if(this.msg=f.message,this.cursor=f.cursor||0,this.scrollIndex=f.cursor||0,this.hint=f.hint||"",this.warn=f.warn||"- This option is disabled -",this.minSelected=f.min,this.showMinError=!1,this.maxChoices=f.max,this.instructions=f.instructions,this.optionsPerPage=f.optionsPerPage||10,this.value=f.choices.map(($,M)=>{if(typeof $==="string")$={title:$,value:M};return{title:$&&($.title||$.value||$),description:$&&$.description,value:$&&($.value===void 0?M:$.value),selected:$&&$.selected,disabled:$&&$.disabled}}),this.clear=Hz("",this.out.columns),!f.overrideRender)this.render()}reset(){this.value.map((f)=>!f.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter((f)=>f.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
144
+ `),this.close()}submit(){let f=this.value.filter(($)=>$.selected);if(this.minSelected&&f.length<this.minSelected)this.showMinError=!0,this.render();else this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
145
+ `),this.close()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){if(this.cursor===0)this.cursor=this.value.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.value.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter((f)=>f.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let f=this.value[this.cursor];if(f.selected)f.selected=!1,this.render();else if(f.disabled||this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();else f.selected=!0,this.render()}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let f=!this.value[this.cursor].selected;this.value.filter(($)=>!$.disabled).forEach(($)=>$.selected=f),this.render()}_(f,$){if(f===" ")this.handleSpaceToggle();else if(f==="a")this.toggleAll();else return this.bell()}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
146
+ Instructions:
147
+ ${y1.arrowUp}/${y1.arrowDown}: Highlight option
148
+ ${y1.arrowLeft}/${y1.arrowRight}/[space]: Toggle selection
149
+ `+(this.maxChoices===void 0?` a: Toggle all
150
+ `:"")+" enter/return: Complete answer"}return""}renderOption(f,$,M,Y){let J=($.selected?q1.green(y1.radioOn):y1.radioOff)+" "+Y+" ",z,Z;if($.disabled)z=f===M?q1.gray().underline($.title):q1.strikethrough().gray($.title);else if(z=f===M?q1.cyan().underline($.title):$.title,f===M&&$.description){if(Z=` - ${$.description}`,J.length+z.length+Z.length>=this.out.columns||$.description.split(/\r?\n/).length>1)Z=`
151
+ `+oU($.description,{margin:J.length,width:this.out.columns})}return J+z+q1.gray(Z||"")}paginateOptions(f){if(f.length===0)return q1.red("No matches for this query.");let{startIndex:$,endIndex:M}=sU(this.cursor,f.length,this.optionsPerPage),Y,J=[];for(let z=$;z<M;z++){if(z===$&&$>0)Y=y1.arrowUp;else if(z===M-1&&M<f.length)Y=y1.arrowDown;else Y=" ";J.push(this.renderOption(this.cursor,f[z],z,Y))}return`
152
+ `+J.join(`
153
+ `)}renderOptions(f){if(!this.done)return this.paginateOptions(f);return""}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let f=[q1.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled)f.push(q1.yellow(this.warn));return f.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(pU.hide);super.render();let f=[Sz.symbol(this.done,this.aborted),q1.bold(this.msg),Sz.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)f+=q1.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;f+=this.renderOptions(this.value),this.out.write(this.clear+f),this.clear=Hz(f,this.out.columns)}}Rz.exports=Fz});var Tz=V((b3,Pz)=>{var o0=x(),aU=L1(),{erase:tU,cursor:Nz}=y(),{style:K2,clear:Oz,figures:V2,wrap:eU,entriesToDisplay:fW}=Z1(),Az=(f,$)=>f[$]&&(f[$].value||f[$].title||f[$]),$W=(f,$)=>f[$]&&(f[$].title||f[$].value||f[$]),MW=(f,$)=>{let M=f.findIndex((Y)=>Y.value===$||Y.title===$);return M>-1?M:void 0};class Lz extends aU{constructor(f={}){super(f);this.msg=f.message,this.suggest=f.suggest,this.choices=f.choices,this.initial=typeof f.initial==="number"?f.initial:MW(f.choices,f.initial),this.select=this.initial||f.cursor||0,this.i18n={noMatches:f.noMatches||"no matches found"},this.fallback=f.fallback||this.initial,this.clearFirst=f.clearFirst||!1,this.suggestions=[],this.input="",this.limit=f.limit||10,this.cursor=0,this.transform=K2.render(f.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Oz("",this.out.columns),this.complete(this.render),this.render()}set fallback(f){this._fb=Number.isSafeInteger(parseInt(f))?parseInt(f):f}get fallback(){let f;if(typeof this._fb==="number")f=this.choices[this._fb];else if(typeof this._fb==="string")f={title:this._fb};return f||this._fb||{title:this.i18n.noMatches}}moveSelect(f){if(this.select=f,this.suggestions.length>0)this.value=Az(this.suggestions,f);else this.value=this.fallback.value;this.fire()}async complete(f){let $=this.completing=this.suggest(this.input,this.choices),M=await $;if(this.completing!==$)return;this.suggestions=M.map((J,z,Z)=>({title:$W(Z,z),value:Az(Z,z),description:J.description})),this.completing=!1;let Y=Math.max(M.length-1,0);this.moveSelect(Math.min(Y,this.select)),f&&f()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){if(this.clearFirst&&this.input.length>0)this.reset();else this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
154
+ `),this.close()}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
155
+ `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
156
+ `),this.close()}_(f,$){let M=this.input.slice(0,this.cursor),Y=this.input.slice(this.cursor);this.input=`${M}${f}${Y}`,this.cursor=M.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let f=this.input.slice(0,this.cursor-1),$=this.input.slice(this.cursor);this.input=`${f}${$}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let f=this.input.slice(0,this.cursor),$=this.input.slice(this.cursor+1);this.input=`${f}${$}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){if(this.select===0)this.moveSelect(this.suggestions.length-1);else this.moveSelect(this.select-1);this.render()}down(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}next(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(f,$,M,Y){let J,z=M?V2.arrowUp:Y?V2.arrowDown:" ",Z=$?o0.cyan().underline(f.title):f.title;if(z=($?o0.cyan(V2.pointer)+" ":" ")+z,f.description){if(J=` - ${f.description}`,z.length+Z.length+J.length>=this.out.columns||f.description.split(/\r?\n/).length>1)J=`
157
+ `+eU(f.description,{margin:3,width:this.out.columns})}return z+" "+Z+o0.gray(J||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(Nz.hide);else this.out.write(Oz(this.outputText,this.out.columns));super.render();let{startIndex:f,endIndex:$}=fW(this.select,this.choices.length,this.limit);if(this.outputText=[K2.symbol(this.done,this.aborted,this.exited),o0.bold(this.msg),K2.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let M=this.suggestions.slice(f,$).map((Y,J)=>this.renderOption(Y,this.select===J+f,J===0&&f>0,J+f===$-1&&$<this.choices.length)).join(`
158
+ `);this.outputText+=`
159
+ `+(M||o0.gray(this.fallback.title))}this.out.write(tU.line+Nz.to(0)+this.outputText)}}Pz.exports=Lz});var Ez=V((_3,Cz)=>{var T1=x(),{cursor:YW}=y(),JW=W2(),{clear:wz,style:jz,figures:S0}=Z1();class Iz extends JW{constructor(f={}){f.overrideRender=!0;super(f);this.inputValue="",this.clear=wz("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){if(this.cursor===0)this.cursor=this.filteredOptions.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.filteredOptions.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter((f)=>f.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){if(this.inputValue.length)this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions()}updateFilteredOptions(){let f=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((M)=>{if(this.inputValue){if(typeof M.title==="string"){if(M.title.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}if(typeof M.value==="string"){if(M.value.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}return!1}return!0});let $=this.filteredOptions.findIndex((M)=>M===f);this.cursor=$<0?0:$,this.render()}handleSpaceToggle(){let f=this.filteredOptions[this.cursor];if(f.selected)f.selected=!1,this.render();else if(f.disabled||this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();else f.selected=!0,this.render()}handleInputChange(f){this.inputValue=this.inputValue+f,this.updateFilteredOptions()}_(f,$){if(f===" ")this.handleSpaceToggle();else this.handleInputChange(f)}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
160
+ Instructions:
161
+ ${S0.arrowUp}/${S0.arrowDown}: Highlight option
162
+ ${S0.arrowLeft}/${S0.arrowRight}/[space]: Toggle selection
163
+ [a,b,c]/delete: Filter choices
164
+ enter/return: Complete answer
165
+ `}return""}renderCurrentInput(){return`
166
+ Filtered results for: ${this.inputValue?this.inputValue:T1.gray("Enter something to filter")}
167
+ `}renderOption(f,$,M){let Y;if($.disabled)Y=f===M?T1.gray().underline($.title):T1.strikethrough().gray($.title);else Y=f===M?T1.cyan().underline($.title):$.title;return($.selected?T1.green(S0.radioOn):S0.radioOff)+" "+Y}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let f=[T1.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled)f.push(T1.yellow(this.warn));return f.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(YW.hide);super.render();let f=[jz.symbol(this.done,this.aborted),T1.bold(this.msg),jz.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)f+=T1.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;f+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+f),this.clear=wz(f,this.out.columns)}}Cz.exports=Iz});var vz=V((v3,_z)=>{var xz=x(),zW=L1(),{style:yz,clear:ZW}=Z1(),{erase:XW,cursor:kz}=y();class bz extends zW{constructor(f={}){super(f);this.msg=f.message,this.value=f.initial,this.initialValue=!!f.initial,this.yesMsg=f.yes||"yes",this.yesOption=f.yesOption||"(Y/n)",this.noMsg=f.no||"no",this.noOption=f.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
168
+ `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
169
+ `),this.close()}_(f,$){if(f.toLowerCase()==="y")return this.value=!0,this.submit();if(f.toLowerCase()==="n")return this.value=!1,this.submit();return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(kz.hide);else this.out.write(ZW(this.outputText,this.out.columns));super.render(),this.outputText=[yz.symbol(this.done,this.aborted),xz.bold(this.msg),yz.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:xz.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(XW.line+kz.to(0)+this.outputText)}}_z.exports=bz});var hz=V((u3,uz)=>{uz.exports={TextPrompt:R5(),SelectPrompt:P5(),TogglePrompt:C5(),DatePrompt:Uz(),NumberPrompt:Bz(),MultiselectPrompt:W2(),AutocompletePrompt:Tz(),AutocompleteMultiselectPrompt:Ez(),ConfirmPrompt:vz()}});var cz=V((gz)=>{var t=gz,QW=hz(),mf=(f)=>f;function B1(f,$,M={}){return new Promise((Y,J)=>{let z=new QW[f]($),Z=M.onAbort||mf,X=M.onSubmit||mf,Q=M.onExit||mf;z.on("state",$.onState||mf),z.on("submit",(D)=>Y(X(D))),z.on("exit",(D)=>Y(Q(D))),z.on("abort",(D)=>J(Z(D)))})}t.text=(f)=>B1("TextPrompt",f);t.password=(f)=>{return f.style="password",t.text(f)};t.invisible=(f)=>{return f.style="invisible",t.text(f)};t.number=(f)=>B1("NumberPrompt",f);t.date=(f)=>B1("DatePrompt",f);t.confirm=(f)=>B1("ConfirmPrompt",f);t.list=(f)=>{let $=f.separator||",";return B1("TextPrompt",f,{onSubmit:(M)=>M.split($).map((Y)=>Y.trim())})};t.toggle=(f)=>B1("TogglePrompt",f);t.select=(f)=>B1("SelectPrompt",f);t.multiselect=(f)=>{f.choices=[].concat(f.choices||[]);let $=(M)=>M.filter((Y)=>Y.selected).map((Y)=>Y.value);return B1("MultiselectPrompt",f,{onAbort:$,onSubmit:$})};t.autocompleteMultiselect=(f)=>{f.choices=[].concat(f.choices||[]);let $=(M)=>M.filter((Y)=>Y.selected).map((Y)=>Y.value);return B1("AutocompleteMultiselectPrompt",f,{onAbort:$,onSubmit:$})};var DW=(f,$)=>Promise.resolve($.filter((M)=>M.title.slice(0,f.length).toLowerCase()===f.toLowerCase()));t.autocomplete=(f)=>{return f.suggest=f.suggest||DW,f.choices=[].concat(f.choices||[]),B1("AutocompletePrompt",f)}});var lz=V((g3,dz)=>{var q2=cz(),GW=["suggest","format","onState","validate","onRender","type"],mz=()=>{};async function k1(f=[],{onSubmit:$=mz,onCancel:M=mz}={}){let Y={},J=k1._override||{};f=[].concat(f);let z,Z,X,Q,D,G,U=async(K,W,B=!1)=>{if(!B&&K.validate&&K.validate(W)!==!0)return;return K.format?await K.format(W,Y):W};for(Z of f){if({name:Q,type:D}=Z,typeof D==="function")D=await D(z,{...Y},Z),Z.type=D;if(!D)continue;for(let K in Z){if(GW.includes(K))continue;let W=Z[K];Z[K]=typeof W==="function"?await W(z,{...Y},G):W}if(G=Z,typeof Z.message!=="string")throw Error("prompt message is required");if({name:Q,type:D}=Z,q2[D]===void 0)throw Error(`prompt type (${D}) is not defined`);if(J[Z.name]!==void 0){if(z=await U(Z,J[Z.name]),z!==void 0){Y[Q]=z;continue}}try{z=k1._injected?UW(k1._injected,Z.initial):await q2[D](Z),Y[Q]=z=await U(Z,z,!0),X=await $(Z,z,Y)}catch(K){X=!await M(Z,Y)}if(X)return Y}return Y}function UW(f,$){let M=f.shift();if(M instanceof Error)throw M;return M===void 0?$:M}function WW(f){k1._injected=(k1._injected||[]).concat(f)}function KW(f){k1._override=Object.assign({},f)}dz.exports=Object.assign(k1,{prompt:k1,prompts:q2,inject:WW,override:KW})});var rz=V((c3,nz)=>{function VW(f){f=(Array.isArray(f)?f:f.split(".")).map(Number);let $=0,M=process.versions.node.split(".").map(Number);for(;$<f.length;$++){if(M[$]>f[$])return!1;if(f[$]>M[$])return!0}return!1}nz.exports=VW("8.6.0")?tJ():lz()});var s2=w0(o2(),1),{program:wK,createCommand:jK,createArgument:IK,createOption:CK,CommanderError:EK,InvalidArgumentError:xK,InvalidOptionArgumentError:yK,Command:Xf,Argument:kK,Option:bK,Help:_K}=s2.default;import{access as df,constants as lf,cp as qW,mkdir as B2,readFile as s0,writeFile as oz}from"node:fs/promises";import{EOL as b1}from"node:os";import{join as e}from"node:path";import{mkdir as x4,readdir as DD,readFile as c$,stat as GD,unlink as y4,writeFile as W0}from"node:fs/promises";import{dirname as k4,extname as UD,join as m$}from"node:path";var Qf=".memory",a2=".",I0="system://boot",C0="system://index",K$="system://recent",t2=["system://agent","system://soul","system://user"];var Df="---",Gf=".md";var fM=w0(B$(),1),nK=w0(e2(),1);function $Z(f,$="YYYY-MM-DD HH:mm"){return fM.default(f).format($)}function Uf(f){return $Z(f,"YYYY-MM-DD HH:mm")}var MZ=5;async function $M(f){let $=[];for(let Z of t2)try{let X=await f.getMemory(Z);if(X)$.push(`${X.content}`)}catch{}let Y=(await f.getAllMemories({includeDeleted:!1})).sort((Z,X)=>{let Q=new Date(Z.updatedAt).getTime();return new Date(X.updatedAt).getTime()-Q}).slice(0,MZ),J=[];if($.length>0)J.push(`# Core Memories
74
170
 
75
171
  `),J.push($.join(`
76
172
 
@@ -82,25 +178,37 @@ return `+str.trim()+`;
82
178
 
83
179
  # Recently Modified Memories
84
180
 
85
- `);for(let Z of Y){let X=await f.getMemory(Z.uri);if(X){let G=K0(Z.updatedAt),q=X.priority>7?` [★${X.priority}]`:"",Q=X.disclosure?` disclosure: ${X.disclosure}
86
- `:"";J.push(`${Z.uri}${q} modified: ${G}
87
- ${Q}
88
- `)}}}let z=J.join("");return{uri:df,memoryId:df,content:z,priority:10,disclosure:"",isAlias:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),deleted:!1}}var bM=Q0(CM(),1);function N0(f){return bM.default(f,{delimiters:V0})}function Hf(f){let $=[V0],M=[["memoryId",f.memoryId],["uri",f.uri],["priority",f.priority],["isAlias",f.isAlias],["createdAt",f.createdAt],["updatedAt",f.updatedAt]];if(f.disclosure)M.push(["disclosure",f.disclosure]);if(f.targetUri)M.push(["targetUri",f.targetUri]);if(f.deleted)M.push(["deleted",!0]);for(let[Y,J]of M)if(typeof J==="string")$.push(`${Y}: "${J}"`);else if(typeof J==="boolean")$.push(`${Y}: ${J?"true":"false"}`);else $.push(`${Y}: ${J}`);return $.push(V0,""),$.join(`
89
- `)}var vM=/^([^:]+):\/\/(.+)$/;function ff(f){let $=f.match(vM);if(!$)throw Error(`Invalid URI format: ${f}`);return{domain:$[1],path:$[2]}}function $f(f){return vM.test(f)}function _M(f){return ff(f).path.split("/").filter(Boolean)}function R1(f,$){let M=ff(f),Y=ff($);if(M.domain!==Y.domain)return null;let J=_M(f),z=_M($),Z=z.length-J.length;if(Z===1){if(EM(J,z))return{isDirect:!0,parentUri:f,childUri:$}}else if(Z===-1){if(EM(z,J))return{isDirect:!0,parentUri:$,childUri:f}}return null}function EM(f,$){if(f.length>=$.length)return!1;for(let M=0;M<f.length;M++)if(f[M]!==$[M])return!1;return!0}import{webcrypto as hM}from"node:crypto";var uM="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var e8=128,yf,bf;function t8(f){if(!yf||yf.length<f)yf=Buffer.allocUnsafe(f*e8),hM.getRandomValues(yf),bf=0;else if(bf+f>yf.length)hM.getRandomValues(yf),bf=0;bf+=f}function gM(f=21){t8(f|=0);let $="";for(let M=bf-f;M<bf;M++)$+=uM[yf[M]&63];return $}var f4="mem",$4=12;function mM(){return`${f4}_${gM($4)}`}async function rM(f){let $=await f.getAllMemories({includeDeleted:!1}),M=new Map;for(let Z of $){let{domain:X}=ff(Z.uri);if(!M.has(X))M.set(X,[]);M.get(X).push(Z)}let Y=[];Y.push(`# Memory Index
181
+ `);for(let Z of Y){let X=await f.getMemory(Z.uri);if(X){let Q=Uf(Z.updatedAt),D=X.priority>7?` [★${X.priority}]`:"",G=X.disclosure?` disclosure: ${X.disclosure}
182
+ `:"";J.push(`${Z.uri}${D} modified: ${Q}
183
+ ${G}
184
+ `)}}}let z=J.join("");return{uri:I0,memoryId:I0,content:z,priority:10,disclosure:"",isAlias:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),deleted:!1}}var R4=w0(F4(),1);function Lf(f){return R4.default(f,{delimiters:Df})}function n1(f){let $=[Df],M=[["memoryId",f.memoryId],["uri",f.uri],["priority",f.priority],["isAlias",f.isAlias],["createdAt",f.createdAt],["updatedAt",f.updatedAt]];if(f.disclosure)M.push(["disclosure",f.disclosure]);if(f.targetUri)M.push(["targetUri",f.targetUri]);if(f.deleted)M.push(["deleted",!0]);for(let[Y,J]of M)if(typeof J==="string")$.push(`${Y}: "${J}"`);else if(typeof J==="boolean")$.push(`${Y}: ${J?"true":"false"}`);else $.push(`${Y}: ${J}`);return $.push(Df,""),$.join(`
185
+ `)}var N4=/^([^:]+):\/\/(.+)$/;function D1(f){let $=f.match(N4);if(!$)throw Error(`Invalid URI format: ${f}`);return{domain:$[1],path:$[2]}}function G1(f){return N4.test(f)}function O4(f){return D1(f).path.split("/").filter(Boolean)}function g$(f,$){let M=D1(f),Y=D1($);if(M.domain!==Y.domain)return null;let J=O4(f),z=O4($),Z=z.length-J.length;if(Z===1){if(A4(J,z))return{isDirect:!0,parentUri:f,childUri:$}}else if(Z===-1){if(A4(z,J))return{isDirect:!0,parentUri:$,childUri:f}}return null}function A4(f,$){if(f.length>=$.length)return!1;for(let M=0;M<f.length;M++)if(f[M]!==$[M])return!1;return!0}import{webcrypto as P4}from"node:crypto";var L4="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var JD=128,r1,U0;function zD(f){if(!r1||r1.length<f)r1=Buffer.allocUnsafe(f*JD),P4.getRandomValues(r1),U0=0;else if(U0+f>r1.length)P4.getRandomValues(r1),U0=0;U0+=f}function T4(f=21){zD(f|=0);let $="";for(let M=U0-f;M<U0;M++)$+=L4[r1[M]&63];return $}var ZD="mem",XD=12;function w4(){return`${ZD}_${T4(XD)}`}async function j4(f){let $=await f.getAllMemories({includeDeleted:!1}),M=new Map;for(let Z of $){let{domain:X}=D1(Z.uri);if(!M.has(X))M.set(X,[]);M.get(X).push(Z)}let Y=[];Y.push(`# Memory Index
90
186
  `),Y.push(`# Total entries: ${$.length}
91
187
  `),Y.push(`Legend: [ID] = Memory ID (same ID = alias), [★N] = priority
92
188
  `);let J=Array.from(M.keys()).sort();for(let Z of J){let X=M.get(Z);Y.push(`
93
189
  ## ${Z}://
94
- `);let G=new Map;for(let Q of X){let{path:D}=ff(Q.uri),V=D.split("/");if(V.length>1){let W=V[0];if(!G.has(W))G.set(W,[]);G.get(W).push(Q)}else{if(!G.has(""))G.set("",[]);G.get("").push(Q)}}let q=Array.from(G.keys()).sort();for(let Q of q){let D=G.get(Q);if(Q==="")for(let V of D){let{path:W}=ff(V.uri),H=V.priority>7?` [★${V.priority}]`:"";Y.push(`
190
+ `);let Q=new Map;for(let G of X){let{path:U}=D1(G.uri),K=U.split("/");if(K.length>1){let W=K[0];if(!Q.has(W))Q.set(W,[]);Q.get(W).push(G)}else{if(!Q.has(""))Q.set("",[]);Q.get("").push(G)}}let D=Array.from(Q.keys()).sort();for(let G of D){let U=Q.get(G);if(G==="")for(let K of U){let{path:W}=D1(K.uri),B=K.priority>7?` [★${K.priority}]`:"";Y.push(`
95
191
  ### ${W}
96
- `),Y.push(` - ${V.uri} [${V.memoryId}]${H}
192
+ `),Y.push(` - ${K.uri} [${K.memoryId}]${B}
97
193
  `)}else{Y.push(`
98
- ### ${Q}
99
- `);for(let V of D){let W=V.priority>7?` [★${V.priority}]`:"";Y.push(` - ${V.uri} [${V.memoryId}]${W}
100
- `)}}}}let z=Y.join("");return{uri:nf,memoryId:nf,content:z,priority:10,disclosure:"",isAlias:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),deleted:!1}}import{sep as cM}from"node:path";var M4="/";function n(f,$){let M=ff(f),J=M.path.split(M4).filter(Boolean).join(cM);return[$,M.domain,`${J}${U0}`].join(cM)}var pM="system://recent";async function lM(f,$){let J=10,z=$.match(/^system:\/\/recent(?:\/(\d+))?$/);if(z?.[1]){let D=Number.parseInt(z[1],10);if(Number.isNaN(D)||D<1)J=10;else if(D>1000)J=1000;else J=D}let X=(await f.getAllMemories({includeDeleted:!1})).sort((D,V)=>{let W=new Date(D.updatedAt).getTime();return new Date(V.updatedAt).getTime()-W}).slice(0,J),G=[];for(let D of X){let V=await f.getMemory(D.uri);if(V)G.push(V)}let q=[];q.push(`# Recently Modified Memories
101
- `),q.push(`# Showing: ${J} most recent entries
102
- `);for(let D of G){let V=D.priority>7?` [★${D.priority}]`:"",W=K0(D.updatedAt);if(q.push(`${D.uri}${V} modified: ${W}
103
- `),D.disclosure)q.push(`disclosure: ${D.disclosure}
104
- `)}let Q=q.join("");return{uri:pM,memoryId:pM,content:Q,priority:10,disclosure:"",isAlias:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),deleted:!1}}class N1{memoryRoot;constructor(f){let $=f.memoryRoot??D$;this.memoryRoot=A1($,W0)}async _getMemoryRaw(f){try{let $=n(f,this.memoryRoot),M=await L1($,"utf-8"),{data:Y,content:J}=N0(M);return{uri:Y.uri,memoryId:Y.memoryId,content:J,priority:Y.priority,disclosure:Y.disclosure,isAlias:Y.isAlias??!1,targetUri:Y.targetUri,createdAt:Y.createdAt,updatedAt:Y.updatedAt,deleted:Y.deleted??!1}}catch{return null}}async _targetFileExists(f){try{let $=n(f,this.memoryRoot);return await J4($),!0}catch{return!1}}async getMemory(f,$){if(!$f(f))throw Error(`Invalid URI format: ${f}. Expected format: 'domain://path/to/memory'`);if(f===df)return K$(this);if(f===nf)return rM(this);if(f===e0||f.startsWith(`${e0}/`))return lM(this,f);let M=$?.includeDeleted??!1;try{let Y=n(f,this.memoryRoot),J=await L1(Y,"utf-8"),{data:z,content:Z}=N0(J);if(!M&&(z.deleted??!1))return null;if(z.isAlias&&z.targetUri){let X=await this._getMemoryRaw(z.targetUri);return{uri:z.uri,memoryId:z.memoryId,content:X?.content??"",priority:z.priority,disclosure:z.disclosure,isAlias:!0,targetUri:z.targetUri,createdAt:z.createdAt,updatedAt:z.updatedAt,deleted:z.deleted??!1}}return{uri:z.uri,memoryId:z.memoryId,content:Z,priority:z.priority,disclosure:z.disclosure,isAlias:z.isAlias??!1,targetUri:z.targetUri,createdAt:z.createdAt,updatedAt:z.updatedAt,deleted:z.deleted??!1}}catch{return null}}async createMemory(f){if(!$f(f.uri))throw Error(`Invalid URI format: ${f.uri}. Expected format: 'domain://path/to/memory'`);let $=await this._getMemoryRaw(f.uri);if($&&!$.deleted)throw Error(`Memory already exists at URI: ${f.uri}`);let M=mM(),Y=new Date().toISOString(),J=f.uri,z=n(J,this.memoryRoot),Z=iM(z);await dM(Z,{recursive:!0});let G=Hf({memoryId:M,uri:J,priority:f.priority??5,disclosure:f.disclosure,isAlias:!1,createdAt:Y,updatedAt:Y})+f.content;return await vf(z,G,"utf-8"),{uri:J,memoryId:M,content:f.content,priority:f.priority??5,disclosure:f.disclosure,isAlias:!1,createdAt:Y,updatedAt:Y,deleted:!1}}async updateMemory(f){if(!$f(f.uri))throw Error(`Invalid URI format: ${f.uri}. Expected format: 'domain://path/to/memory'`);let $=await this._getMemoryRaw(f.uri);if(!$||$.deleted)throw Error("Memory not found");if($.isAlias&&$.targetUri){if(!await this._targetFileExists($.targetUri))throw Error("Target memory file not found");let G=await this._getMemoryRaw($.targetUri);if(G){let q=n($.targetUri,this.memoryRoot),Q=new Date().toISOString(),V=Hf({memoryId:G.memoryId,uri:G.uri,priority:G.priority,disclosure:G.disclosure,isAlias:G.isAlias,targetUri:G.targetUri,createdAt:G.createdAt,updatedAt:Q,deleted:G.deleted})+f.content;return await vf(q,V,"utf-8"),{...$,content:f.content,updatedAt:Q}}throw Error("Target memory not found")}let M=n(f.uri,this.memoryRoot),Y=new Date().toISOString(),z=Hf({memoryId:$.memoryId,uri:$.uri,priority:f.priority??$.priority,disclosure:f.disclosure??$.disclosure,isAlias:$.isAlias,targetUri:$.targetUri,createdAt:$.createdAt,updatedAt:Y,deleted:$.deleted})+f.content;return await vf(M,z,"utf-8"),{...$,content:f.content,priority:f.priority??$.priority,disclosure:f.disclosure??$.disclosure,updatedAt:Y}}async deleteMemory(f,$={}){if(!$f(f))throw Error(`Invalid URI format: ${f}. Expected format: 'domain://path/to/memory'`);let{recursive:M=!1,permanent:Y=!1}=$;if(!Y){let z=await this.getMemory(f);if(!z||z.deleted)throw Error("Memory not found");let Z=n(f,this.memoryRoot),X=new Date().toISOString(),q=Hf({memoryId:z.memoryId,uri:z.uri,priority:z.priority,disclosure:z.disclosure,isAlias:z.isAlias,targetUri:z.targetUri,createdAt:z.createdAt,updatedAt:X,deleted:!0})+z.content;if(await vf(Z,q,"utf-8"),M){let Q=await this.getAllMemories({includeDeleted:!1});for(let D of Q)if(D.uri.startsWith(`${f}/`))await this.deleteMemory(D.uri,{recursive:!0,permanent:!1})}return}let J=n(f,this.memoryRoot);if(await nM(J),M){let z=await this.getAllMemories({includeDeleted:!1});for(let Z of z)if(Z.uri.startsWith(`${f}/`)){let X=n(Z.uri,this.memoryRoot);await nM(X)}}}async restoreMemory(f){if(!$f(f))throw Error(`Invalid URI format: ${f}. Expected format: 'domain://path/to/memory'`);let $=await this._getMemoryRaw(f);if(!$)throw Error("Memory not found");if(!$.deleted)throw Error("Memory is not deleted");let M=n(f,this.memoryRoot),Y=new Date().toISOString(),z=Hf({memoryId:$.memoryId,uri:$.uri,priority:$.priority,disclosure:$.disclosure,isAlias:$.isAlias,targetUri:$.targetUri,createdAt:$.createdAt,updatedAt:Y,deleted:!1})+$.content;return await vf(M,z,"utf-8"),{...$,updatedAt:Y,deleted:!1}}async addAlias(f){if(!$f(f.newUri))throw Error(`Invalid URI format for newUri: ${f.newUri}. Expected format: 'domain://path/to/memory'`);if(!$f(f.targetUri))throw Error(`Invalid URI format for targetUri: ${f.targetUri}. Expected format: 'domain://path/to/memory'`);let $=await this.getMemory(f.targetUri);if(!$)throw Error("Target memory not found");if(await this.getMemory(f.newUri))throw Error(`Memory already exists at alias URI: ${f.newUri}`);let Y=new Date().toISOString(),J=$.memoryId,z=n(f.newUri,this.memoryRoot),Z=iM(z);await dM(Z,{recursive:!0});let X=Hf({memoryId:J,uri:f.newUri,priority:f.priority??$.priority,disclosure:f.disclosure??$.disclosure,isAlias:!0,targetUri:f.targetUri,createdAt:Y,updatedAt:Y});return await vf(z,X,"utf-8"),{uri:f.newUri,memoryId:J,content:$.content,priority:f.priority??$.priority,disclosure:f.disclosure??$.disclosure,isAlias:!0,targetUri:f.targetUri,createdAt:Y,updatedAt:Y,deleted:!1}}async searchMemory(f,$={}){let M=await this.getAllMemories({domain:$.domain,includeDeleted:!1}),Y=f.toLowerCase(),J=[],z=$.limit??10;for(let Z of M){if(J.length>=z)break;try{let X=await this.getMemory(Z.uri);if(!X||X.deleted)continue;let G=X.uri.toLowerCase().includes(Y),q=X.content.toLowerCase().includes(Y);if(G||q)J.push(X)}catch{}}return J}async getChildren(f){if(!$f(f))return[];try{let $=await this.getAllMemories({includeDeleted:!1}),M=[];for(let Y of $){let J=R1(f,Y.uri);if(J?.isDirect&&J?.parentUri===f)M.push(Y)}return M.sort((Y,J)=>J.priority-Y.priority)}catch{return[]}}async getAllMemories(f={}){let $=[],M=f.domain?A1(this.memoryRoot,f.domain):this.memoryRoot,Y=async(J)=>{try{let z=await Y4(J,{withFileTypes:!0});for(let Z of z){let X=A1(J,Z.name);if(Z.isDirectory())await Y(X);else if(z4(Z.name)===U0){let G=await L1(X,"utf-8"),{data:q,content:Q}=N0(G);if(!q.deleted||f.includeDeleted)$.push({uri:q.uri,memoryId:q.memoryId,content:Q,priority:q.priority,disclosure:q.disclosure,isAlias:q.isAlias??!1,targetUri:q.targetUri,createdAt:q.createdAt,updatedAt:q.updatedAt,deleted:q.deleted??!1})}}}catch{}};return await Y(M),$}async getRelationships(f){let{uri:$,domain:M}=f||{},Y=[],J=await this.getAllMemories({domain:M,includeDeleted:!0});if($){if(!$f($))return Y;let z=await this.getMemory($);if(!z)return Y;for(let Z of J){if(Z.uri===$)continue;let X=R1($,Z.uri);if(X)Y.push({fromUri:X.parentUri,toUri:X.childUri,type:"parent_child",weight:1});if(Z.isAlias&&Z.targetUri===$)Y.push({fromUri:Z.uri,toUri:$,type:"alias",weight:1});try{let G=await this.getMemory(Z.uri);if(G){let q=G.content.includes($),Q=z.content.includes(Z.uri);if(q||Q)Y.push({fromUri:q?Z.uri:$,toUri:q?$:Z.uri,type:"reference",weight:0.5})}}catch{}}}else{let z=J.map((X)=>X.uri),Z=new Set;for(let X of z){let G=await this.getRelationships({uri:X,domain:M});for(let q of G){let Q=`${q.fromUri}-${q.toUri}-${q.type}`;if(!Z.has(Q))Z.add(Q),Y.push(q)}}}return Y}}function O0(f){switch(f.type){case"filesystem":return new N1(f.config);case"sqlite":throw Error("SQLite adapter not implemented yet");default:throw Error(`Unknown store type: ${f.type}`)}}function x0(f){return{memoryRoot:f}}var eM=import.meta.dirname,X4=_f(eM,"../../template/system"),G4=_f(eM,"../../template/mcp/AGENTS.md"),q4={agent:"system://agent",soul:"system://soul",user:"system://user"};async function Q4(f){return I1(_f(X4,f),"utf-8")}function D4(f){return f.split(`
105
- `).find((Y)=>Y.trim()!=="")?.trim()||""}function W4(f,$){return f.split(`
106
- `).find((J)=>J.trim()!=="")?.trim()===$}async function sM(f,$){try{let M="";try{M=await I1(f,"utf-8")}catch{M=""}let Y=D4($);if(M&&W4(M,Y)){console.log("› Skipped: content already exists");return}let J=M?`${oM}${oM}`:"",z=`${$}${J}${M}`;await aM(f,z,"utf-8"),console.log(`✔ Injected: ${f}`)}catch(M){throw console.error(`✖ Failed: ${f}`,M),M}}async function V4(f){let $=_f(f,"AGENTS.md"),M=_f(f,"CLAUDE.md"),Y=!1,J=!1;try{await O1($,x1.F_OK),Y=!0}catch{}try{await O1(M,x1.F_OK),J=!0}catch{}let z=await I1(G4,"utf-8");if(J)console.log("› Found: CLAUDE.md"),await sM(M,z);else if(Y)console.log("› Found: AGENTS.md"),await sM($,z);else console.log("✔ Created: AGENTS.md"),await aM($,z,"utf-8")}async function tM(f){let $=_f(f,W0);try{await O1($,x1.F_OK),console.log(`Memory directory already exists at ${$}`)}catch{await Z4($,{recursive:!0});let M=O0({type:"filesystem",config:x0(f)});await Promise.all(Object.entries(q4).map(async([Y,J])=>{let z=await Q4(`${Y}.md`);await M.createMemory({uri:J,content:z,priority:10})})),console.log(`Initialized hippo memory at ${$}`)}console.log("◇ Checking AGENTS.md and CLAUDE.md..."),await V4(f)}import{join as sY}from"node:path";import{createServer as U4}from"http";import{Http2ServerRequest as K4}from"http2";import{Http2ServerRequest as k1}from"http2";import{Readable as fY}from"stream";import A4 from"crypto";var Sf=class extends Error{constructor(f,$){super(f,$);this.name="RequestError"}},B4=(f)=>{if(f instanceof Sf)return f;return new Sf(f.message,{cause:f})},H4=global.Request,Y0=class extends H4{constructor(f,$){if(typeof f==="object"&&hf in f)f=f[hf]();if(typeof $?.body?.getReader<"u")$.duplex??="half";super(f,$)}},y4=(f)=>{let $=[],M=f.rawHeaders;for(let Y=0;Y<M.length;Y+=2){let{[Y]:J,[Y+1]:z}=M;if(J.charCodeAt(0)!==58)$.push([J,z])}return new Headers($)},MY=Symbol("wrapBodyStream"),S4=(f,$,M,Y,J)=>{let z={method:f,headers:M,signal:J.signal};if(f==="TRACE"){z.method="GET";let Z=new Y0($,z);return Object.defineProperty(Z,"method",{get(){return"TRACE"}}),Z}if(!(f==="GET"||f==="HEAD"))if("rawBody"in Y&&Y.rawBody instanceof Buffer)z.body=new ReadableStream({start(Z){Z.enqueue(Y.rawBody),Z.close()}});else if(Y[MY]){let Z;z.body=new ReadableStream({async pull(X){try{Z||=fY.toWeb(Y).getReader();let{done:G,value:q}=await Z.read();if(G)X.close();else X.enqueue(q)}catch(G){X.error(G)}}})}else z.body=fY.toWeb(Y);return new Y0($,z)},hf=Symbol("getRequestCache"),F4=Symbol("requestCache"),I0=Symbol("incomingKey"),k0=Symbol("urlKey"),P4=Symbol("headersKey"),uf=Symbol("abortControllerKey"),T4=Symbol("getAbortController"),C0={get method(){return this[I0].method||"GET"},get url(){return this[k0]},get headers(){return this[P4]||=y4(this[I0])},[T4](){return this[hf](),this[uf]},[hf](){return this[uf]||=new AbortController,this[F4]||=S4(this.method,this[k0],this.headers,this[I0],this[uf])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach((f)=>{Object.defineProperty(C0,f,{get(){return this[hf]()[f]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach((f)=>{Object.defineProperty(C0,f,{value:function(){return this[hf]()[f]()}})});Object.setPrototypeOf(C0,Y0.prototype);var w4=(f,$)=>{let M=Object.create(C0);M[I0]=f;let Y=f.url||"";if(Y[0]!=="/"&&(Y.startsWith("http://")||Y.startsWith("https://"))){if(f instanceof k1)throw new Sf("Absolute URL for :path is not allowed in HTTP/2");try{let X=new URL(Y);M[k0]=X.href}catch(X){throw new Sf("Invalid absolute URL",{cause:X})}return M}let J=(f instanceof k1?f.authority:f.headers.host)||$;if(!J)throw new Sf("Missing host header");let z;if(f instanceof k1){if(z=f.scheme,!(z==="http"||z==="https"))throw new Sf("Unsupported scheme")}else z=f.socket&&f.socket.encrypted?"https":"http";let Z=new URL(`${z}://${J}${Y}`);if(Z.hostname.length!==J.length&&Z.hostname!==J.replace(/:\d+$/,""))throw new Sf("Invalid host header");return M[k0]=Z.href,M},$Y=Symbol("responseCache"),Ef=Symbol("getResponseCache"),Ff=Symbol("cache"),b1=global.Response,J0=class f{#$;#f;[Ef](){return delete this[Ff],this[$Y]||=new b1(this.#$,this.#f)}constructor($,M){let Y;if(this.#$=$,M instanceof f){let J=M[$Y];if(J){this.#f=J,this[Ef]();return}else this.#f=M.#f,Y=new Headers(M.#f.headers)}else this.#f=M;if(typeof $==="string"||typeof $?.getReader<"u"||$ instanceof Blob||$ instanceof Uint8Array)Y||=M?.headers||{"content-type":"text/plain; charset=UTF-8"},this[Ff]=[M?.status||200,$,Y]}get headers(){let $=this[Ff];if($){if(!($[2]instanceof Headers))$[2]=new Headers($[2]);return $[2]}return this[Ef]().headers}get status(){return this[Ff]?.[0]??this[Ef]().status}get ok(){let $=this.status;return $>=200&&$<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach((f)=>{Object.defineProperty(J0.prototype,f,{get(){return this[Ef]()[f]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach((f)=>{Object.defineProperty(J0.prototype,f,{value:function(){return this[Ef]()[f]()}})});Object.setPrototypeOf(J0,b1);Object.setPrototypeOf(J0.prototype,b1.prototype);async function j4(f){return Promise.race([f,Promise.resolve().then(()=>Promise.resolve(void 0))])}function YY(f,$,M){let Y=(X)=>{f.cancel(X).catch(()=>{})};return $.on("close",Y),$.on("error",Y),(M??f.read()).then(Z,J),f.closed.finally(()=>{$.off("close",Y),$.off("error",Y)});function J(X){if(X)$.destroy(X)}function z(){f.read().then(Z,J)}function Z({done:X,value:G}){try{if(X)$.end();else if(!$.write(G))$.once("drain",z);else return f.read().then(Z,J)}catch(q){J(q)}}}function R4(f,$){if(f.locked)throw TypeError("ReadableStream is locked.");else if($.destroyed)return;return YY(f.getReader(),$)}var JY=(f)=>{let $={};if(!(f instanceof Headers))f=new Headers(f??void 0);let M=[];for(let[Y,J]of f)if(Y==="set-cookie")M.push(J);else $[Y]=J;if(M.length>0)$["set-cookie"]=M;return $["content-type"]??="text/plain; charset=UTF-8",$},L4="x-hono-already-sent";if(typeof global.crypto>"u")global.crypto=A4;var v1=Symbol("outgoingEnded"),N4=()=>new Response(null,{status:400}),zY=(f)=>new Response(null,{status:f instanceof Error&&(f.name==="TimeoutError"||f.constructor.name==="TimeoutError")?504:500}),C1=(f,$)=>{let M=f instanceof Error?f:Error("unknown error",{cause:f});if(M.code==="ERR_STREAM_PREMATURE_CLOSE")console.info("The user aborted a request.");else{if(console.error(f),!$.headersSent)$.writeHead(500,{"Content-Type":"text/plain"});$.end(`Error: ${M.message}`),$.destroy(M)}},ZY=(f)=>{if("flushHeaders"in f&&f.writable)f.flushHeaders()},XY=async(f,$)=>{let[M,Y,J]=f[Ff];if(J instanceof Headers)J=JY(J);if(typeof Y==="string")J["Content-Length"]=Buffer.byteLength(Y);else if(Y instanceof Uint8Array)J["Content-Length"]=Y.byteLength;else if(Y instanceof Blob)J["Content-Length"]=Y.size;if($.writeHead(M,J),typeof Y==="string"||Y instanceof Uint8Array)$.end(Y);else if(Y instanceof Blob)$.end(new Uint8Array(await Y.arrayBuffer()));else ZY($),await R4(Y,$)?.catch((z)=>C1(z,$));$[v1]?.()},O4=(f)=>typeof f.then==="function",x4=async(f,$,M={})=>{if(O4(f))if(M.errorHandler)try{f=await f}catch(J){let z=await M.errorHandler(J);if(!z)return;f=z}else f=await f.catch(zY);if(Ff in f)return XY(f,$);let Y=JY(f.headers);if(f.body){let J=f.body.getReader(),z=[],Z=!1,X=void 0;if(Y["transfer-encoding"]!=="chunked"){let G=2;for(let q=0;q<G;q++){X||=J.read();let Q=await j4(X).catch((D)=>{console.error(D),Z=!0});if(!Q){if(q===1){await new Promise((D)=>setTimeout(D)),G=3;continue}break}if(X=void 0,Q.value)z.push(Q.value);if(Q.done){Z=!0;break}}if(Z&&!("content-length"in Y))Y["content-length"]=z.reduce((q,Q)=>q+Q.length,0)}if($.writeHead(f.status,Y),z.forEach((G)=>{$.write(G)}),Z)$.end();else{if(z.length===0)ZY($);await YY(J,$,X)}}else if(Y[L4]);else $.writeHead(f.status,Y),$.end();$[v1]?.()},I4=(f,$={})=>{let M=$.autoCleanupIncoming??!0;if($.overrideGlobalObjects!==!1&&global.Request!==Y0)Object.defineProperty(global,"Request",{value:Y0}),Object.defineProperty(global,"Response",{value:J0});return async(Y,J)=>{let z,Z;try{Z=w4(Y,$.hostname);let X=!M||Y.method==="GET"||Y.method==="HEAD";if(!X){if(Y[MY]=!0,Y.on("end",()=>{X=!0}),Y instanceof K4)J[v1]=()=>{if(!X)setTimeout(()=>{if(!X)setTimeout(()=>{Y.destroy(),J.destroy()})})}}if(J.on("close",()=>{if(Z[uf]){if(Y.errored)Z[uf].abort(Y.errored.toString());else if(!J.writableFinished)Z[uf].abort("Client connection prematurely closed.")}if(!X)setTimeout(()=>{if(!X)setTimeout(()=>{Y.destroy()})})}),z=f(Z,{incoming:Y,outgoing:J}),Ff in z)return XY(z,J)}catch(X){if(!z)if($.errorHandler){if(z=await $.errorHandler(Z?X:B4(X)),!z)return}else if(!Z)z=N4();else z=zY(X);else return C1(X,J)}try{return await x4(z,J,$)}catch(X){return C1(X,J)}}},k4=(f)=>{let $=f.fetch,M=I4($,{hostname:f.hostname,overrideGlobalObjects:f.overrideGlobalObjects,autoCleanupIncoming:f.autoCleanupIncoming});return(f.createServer||U4)(f.serverOptions||{},M)},GY=(f,$)=>{let M=k4(f);return M.listen(f?.port??3000,f.hostname,()=>{let Y=M.address();$&&$(Y)}),M};var qY=(f,$=b4)=>{let M=/\.([a-zA-Z0-9]+?)$/,Y=f.match(M);if(!Y)return;let J=$[Y[1]];if(J&&J.startsWith("text"))J+="; charset=utf-8";return J};var C4={aac:"audio/aac",avi:"video/x-msvideo",avif:"image/avif",av1:"video/av1",bin:"application/octet-stream",bmp:"image/bmp",css:"text/css",csv:"text/csv",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gif:"image/gif",gz:"application/gzip",htm:"text/html",html:"text/html",ico:"image/x-icon",ics:"text/calendar",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript",json:"application/json",jsonld:"application/ld+json",map:"application/json",mid:"audio/x-midi",midi:"audio/x-midi",mjs:"text/javascript",mp3:"audio/mpeg",mp4:"video/mp4",mpeg:"video/mpeg",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",opus:"audio/opus",otf:"font/otf",pdf:"application/pdf",png:"image/png",rtf:"application/rtf",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",ts:"video/mp2t",ttf:"font/ttf",txt:"text/plain",wasm:"application/wasm",webm:"video/webm",weba:"audio/webm",webmanifest:"application/manifest+json",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xml:"application/xml",zip:"application/zip","3gp":"video/3gpp","3g2":"video/3gpp2",gltf:"model/gltf+json",glb:"model/gltf-binary"},b4=C4;import{createReadStream as QY,statSync as v4,existsSync as _4}from"fs";import{join as DY}from"path";import{versions as E4}from"process";import{Readable as u4}from"stream";var h4=/^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i,E1={br:".br",zstd:".zst",gzip:".gz"},g4=Object.keys(E1),m4=()=>{let[f,$]=E4.node.split(".").map((M)=>parseInt(M));return f>=23||f===22&&$>=7||f===20&&$>=18},r4=m4(),WY=(f)=>{if(r4)return u4.toWeb(f);return new ReadableStream({start(M){f.on("data",(Y)=>{M.enqueue(Y)}),f.on("error",(Y)=>{M.error(Y)}),f.on("end",()=>{M.close()})},cancel(){f.destroy()}})},_1=(f)=>{let $;try{$=v4(f)}catch{}return $},u1=(f={root:""})=>{let $=f.root||"",M=f.path;if($!==""&&!_4($))console.error(`serveStatic: root path '${$}' is not found, are you sure it's correct?`);return async(Y,J)=>{if(Y.finalized)return J();let z;if(M)z=M;else try{if(z=decodeURIComponent(Y.req.path),/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(z))throw Error()}catch{return await f.onNotFound?.(Y.req.path,Y),J()}let Z=DY($,!M&&f.rewriteRequestPath?f.rewriteRequestPath(z,Y):z),X=_1(Z);if(X&&X.isDirectory()){let V=f.index??"index.html";Z=DY(Z,V),X=_1(Z)}if(!X)return await f.onNotFound?.(Z,Y),J();let G=qY(Z);if(Y.header("Content-Type",G||"application/octet-stream"),f.precompressed&&(!G||h4.test(G))){let V=new Set(Y.req.header("Accept-Encoding")?.split(",").map((W)=>W.trim()));for(let W of g4){if(!V.has(W))continue;let H=_1(Z+E1[W]);if(H){Y.header("Content-Encoding",W),Y.header("Vary","Accept-Encoding",{append:!0}),X=H,Z=Z+E1[W];break}}}let q,Q=X.size,D=Y.req.header("range")||"";if(Y.req.method=="HEAD"||Y.req.method=="OPTIONS")Y.header("Content-Length",Q.toString()),Y.status(200),q=Y.body(null);else if(!D)Y.header("Content-Length",Q.toString()),q=Y.body(WY(QY(Z)),200);else{Y.header("Accept-Ranges","bytes"),Y.header("Date",X.birthtime.toUTCString());let V=D.replace(/bytes=/,"").split("-",2),W=parseInt(V[0],10)||0,H=parseInt(V[1],10)||Q-1;if(Q<H-W+1)H=Q-1;let R=H-W+1,P=QY(Z,{start:W,end:H});Y.header("Content-Length",R.toString()),Y.header("Content-Range",`bytes ${W}-${H}/${X.size}`),q=Y.body(WY(P),206)}return await f.onFound?.(Z,Y),q}};var h1=(f,$,M)=>{return(Y,J)=>{let z=-1;return Z(0);async function Z(X){if(X<=z)throw Error("next() called multiple times");z=X;let G,q=!1,Q;if(f[X])Q=f[X][0][0],Y.req.routeIndex=X;else Q=X===f.length&&J||void 0;if(Q)try{G=await Q(Y,()=>Z(X+1))}catch(D){if(D instanceof Error&&$)Y.error=D,G=await $(D,Y),q=!0;else throw D}else if(Y.finalized===!1&&M)G=await M(Y);if(G&&(Y.finalized===!1||q))Y.res=G;return Y}}};var VY=Symbol();var UY=async(f,$=Object.create(null))=>{let{all:M=!1,dot:Y=!1}=$,z=(f instanceof b0?f.raw.headers:f.headers).get("Content-Type");if(z?.startsWith("multipart/form-data")||z?.startsWith("application/x-www-form-urlencoded"))return c4(f,{all:M,dot:Y});return{}};async function c4(f,$){let M=await f.formData();if(M)return p4(M,$);return{}}function p4(f,$){let M=Object.create(null);if(f.forEach((Y,J)=>{if(!($.all||J.endsWith("[]")))M[J]=Y;else l4(M,J,Y)}),$.dot)Object.entries(M).forEach(([Y,J])=>{if(Y.includes("."))d4(M,Y,J),delete M[Y]});return M}var l4=(f,$,M)=>{if(f[$]!==void 0)if(Array.isArray(f[$]))f[$].push(M);else f[$]=[f[$],M];else if(!$.endsWith("[]"))f[$]=M;else f[$]=[M]},d4=(f,$,M)=>{let Y=f,J=$.split(".");J.forEach((z,Z)=>{if(Z===J.length-1)Y[z]=M;else{if(!Y[z]||typeof Y[z]!=="object"||Array.isArray(Y[z])||Y[z]instanceof File)Y[z]=Object.create(null);Y=Y[z]}})};var m1=(f)=>{let $=f.split("/");if($[0]==="")$.shift();return $},KY=(f)=>{let{groups:$,path:M}=n4(f),Y=m1(M);return i4(Y,$)},n4=(f)=>{let $=[];return f=f.replace(/\{[^}]+\}/g,(M,Y)=>{let J=`@${Y}`;return $.push([J,M]),J}),{groups:$,path:f}},i4=(f,$)=>{for(let M=$.length-1;M>=0;M--){let[Y]=$[M];for(let J=f.length-1;J>=0;J--)if(f[J].includes(Y)){f[J]=f[J].replace(Y,$[M][1]);break}}return f},v0={},BY=(f,$)=>{if(f==="*")return"*";let M=f.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(M){let Y=`${f}#${$}`;if(!v0[Y])if(M[2])v0[Y]=$&&$[0]!==":"&&$[0]!=="*"?[Y,M[1],new RegExp(`^${M[2]}(?=/${$})`)]:[f,M[1],new RegExp(`^${M[2]}$`)];else v0[Y]=[f,M[1],!0];return v0[Y]}return null},_0=(f,$)=>{try{return $(f)}catch{return f.replace(/(?:%[0-9A-Fa-f]{2})+/g,(M)=>{try{return $(M)}catch{return M}})}},o4=(f)=>_0(f,decodeURI),r1=(f)=>{let $=f.url,M=$.indexOf("/",$.indexOf(":")+4),Y=M;for(;Y<$.length;Y++){let J=$.charCodeAt(Y);if(J===37){let z=$.indexOf("?",Y),Z=$.indexOf("#",Y),X=z===-1?Z===-1?void 0:Z:Z===-1?z:Math.min(z,Z),G=$.slice(M,X);return o4(G.includes("%25")?G.replace(/%25/g,"%2525"):G)}else if(J===63||J===35)break}return $.slice(M,Y)};var HY=(f)=>{let $=r1(f);return $.length>1&&$.at(-1)==="/"?$.slice(0,-1):$},Pf=(f,$,...M)=>{if(M.length)$=Pf($,...M);return`${f?.[0]==="/"?"":"/"}${f}${$==="/"?"":`${f?.at(-1)==="/"?"":"/"}${$?.[0]==="/"?$.slice(1):$}`}`},E0=(f)=>{if(f.charCodeAt(f.length-1)!==63||!f.includes(":"))return null;let $=f.split("/"),M=[],Y="";return $.forEach((J)=>{if(J!==""&&!/\:/.test(J))Y+="/"+J;else if(/\:/.test(J))if(/\?/.test(J)){if(M.length===0&&Y==="")M.push("/");else M.push(Y);let z=J.replace("?","");Y+="/"+z,M.push(Y)}else Y+="/"+J}),M.filter((J,z,Z)=>Z.indexOf(J)===z)},g1=(f)=>{if(!/[%+]/.test(f))return f;if(f.indexOf("+")!==-1)f=f.replace(/\+/g," ");return f.indexOf("%")!==-1?_0(f,c1):f},yY=(f,$,M)=>{let Y;if(!M&&$&&!/[%+]/.test($)){let Z=f.indexOf("?",8);if(Z===-1)return;if(!f.startsWith($,Z+1))Z=f.indexOf(`&${$}`,Z+1);while(Z!==-1){let X=f.charCodeAt(Z+$.length+1);if(X===61){let G=Z+$.length+2,q=f.indexOf("&",G);return g1(f.slice(G,q===-1?void 0:q))}else if(X==38||isNaN(X))return"";Z=f.indexOf(`&${$}`,Z+1)}if(Y=/[%+]/.test(f),!Y)return}let J={};Y??=/[%+]/.test(f);let z=f.indexOf("?",8);while(z!==-1){let Z=f.indexOf("&",z+1),X=f.indexOf("=",z);if(X>Z&&Z!==-1)X=-1;let G=f.slice(z+1,X===-1?Z===-1?void 0:Z:X);if(Y)G=g1(G);if(z=Z,G==="")continue;let q;if(X===-1)q="";else if(q=f.slice(X+1,Z===-1?void 0:Z),Y)q=g1(q);if(M){if(!(J[G]&&Array.isArray(J[G])))J[G]=[];J[G].push(q)}else J[G]??=q}return $?J[$]:J},SY=yY,FY=(f,$)=>{return yY(f,$,!0)},c1=decodeURIComponent;var PY=(f)=>_0(f,c1),b0=class{raw;#$;#f;routeIndex=0;path;bodyCache={};constructor(f,$="/",M=[[]]){this.raw=f,this.path=$,this.#f=M,this.#$={}}param(f){return f?this.#M(f):this.#z()}#M(f){let $=this.#f[0][this.routeIndex][1][f],M=this.#J($);return M&&/\%/.test(M)?PY(M):M}#z(){let f={},$=Object.keys(this.#f[0][this.routeIndex][1]);for(let M of $){let Y=this.#J(this.#f[0][this.routeIndex][1][M]);if(Y!==void 0)f[M]=/\%/.test(Y)?PY(Y):Y}return f}#J(f){return this.#f[1]?this.#f[1][f]:f}query(f){return SY(this.url,f)}queries(f){return FY(this.url,f)}header(f){if(f)return this.raw.headers.get(f)??void 0;let $={};return this.raw.headers.forEach((M,Y)=>{$[Y]=M}),$}async parseBody(f){return this.bodyCache.parsedBody??=await UY(this,f)}#Y=(f)=>{let{bodyCache:$,raw:M}=this,Y=$[f];if(Y)return Y;let J=Object.keys($)[0];if(J)return $[J].then((z)=>{if(J==="json")z=JSON.stringify(z);return new Response(z)[f]()});return $[f]=M[f]()};json(){return this.#Y("text").then((f)=>JSON.parse(f))}text(){return this.#Y("text")}arrayBuffer(){return this.#Y("arrayBuffer")}blob(){return this.#Y("blob")}formData(){return this.#Y("formData")}addValidatedData(f,$){this.#$[f]=$}valid(f){return this.#$[f]}get url(){return this.raw.url}get method(){return this.raw.method}get[VY](){return this.#f}get matchedRoutes(){return this.#f[0].map(([[,f]])=>f)}get routePath(){return this.#f[0].map(([[,f]])=>f)[this.routeIndex].path}};var TY={Stringify:1,BeforeStream:2,Stream:3},s4=(f,$)=>{let M=new String(f);return M.isEscaped=!0,M.callbacks=$,M};var p1=async(f,$,M,Y,J)=>{if(typeof f==="object"&&!(f instanceof String)){if(!(f instanceof Promise))f=f.toString();if(f instanceof Promise)f=await f}let z=f.callbacks;if(!z?.length)return Promise.resolve(f);if(J)J[0]+=f;else J=[f];let Z=Promise.all(z.map((X)=>X({phase:$,buffer:J,context:Y}))).then((X)=>Promise.all(X.filter(Boolean).map((G)=>p1(G,$,!1,Y,J))).then(()=>J[0]));if(M)return s4(await Z,z);else return Z};var a4="text/plain; charset=UTF-8",l1=(f,$)=>{return{"Content-Type":f,...$}},gf=(f,$)=>new Response(f,$),wY=class{#$;#f;env={};#M;finalized=!1;error;#z;#J;#Y;#Q;#G;#q;#X;#D;#W;constructor(f,$){if(this.#$=f,$)this.#J=$.executionCtx,this.env=$.env,this.#q=$.notFoundHandler,this.#W=$.path,this.#D=$.matchResult}get req(){return this.#f??=new b0(this.#$,this.#W,this.#D),this.#f}get event(){if(this.#J&&"respondWith"in this.#J)return this.#J;else throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#J)return this.#J;else throw Error("This context has no ExecutionContext")}get res(){return this.#Y||=gf(null,{headers:this.#X??=new Headers})}set res(f){if(this.#Y&&f){f=gf(f.body,f);for(let[$,M]of this.#Y.headers.entries()){if($==="content-type")continue;if($==="set-cookie"){let Y=this.#Y.headers.getSetCookie();f.headers.delete("set-cookie");for(let J of Y)f.headers.append("set-cookie",J)}else f.headers.set($,M)}}this.#Y=f,this.finalized=!0}render=(...f)=>{return this.#G??=($)=>this.html($),this.#G(...f)};setLayout=(f)=>this.#Q=f;getLayout=()=>this.#Q;setRenderer=(f)=>{this.#G=f};header=(f,$,M)=>{if(this.finalized)this.#Y=gf(this.#Y.body,this.#Y);let Y=this.#Y?this.#Y.headers:this.#X??=new Headers;if($===void 0)Y.delete(f);else if(M?.append)Y.append(f,$);else Y.set(f,$)};status=(f)=>{this.#z=f};set=(f,$)=>{this.#M??=new Map,this.#M.set(f,$)};get=(f)=>{return this.#M?this.#M.get(f):void 0};get var(){if(!this.#M)return{};return Object.fromEntries(this.#M)}#Z(f,$,M){let Y=this.#Y?new Headers(this.#Y.headers):this.#X??new Headers;if(typeof $==="object"&&"headers"in $){let z=$.headers instanceof Headers?$.headers:new Headers($.headers);for(let[Z,X]of z)if(Z.toLowerCase()==="set-cookie")Y.append(Z,X);else Y.set(Z,X)}if(M)for(let[z,Z]of Object.entries(M))if(typeof Z==="string")Y.set(z,Z);else{Y.delete(z);for(let X of Z)Y.append(z,X)}let J=typeof $==="number"?$:$?.status??this.#z;return gf(f,{status:J,headers:Y})}newResponse=(...f)=>this.#Z(...f);body=(f,$,M)=>this.#Z(f,$,M);#V(){return!this.#X&&!this.#z&&!this.finalized}text=(f,$,M)=>{return this.#V()&&!$&&!M?gf(f):this.#Z(f,$,l1(a4,M))};json=(f,$,M)=>{return this.#V()&&!$&&!M?Response.json(f):this.#Z(JSON.stringify(f),$,l1("application/json",M))};html=(f,$,M)=>{let Y=(J)=>this.#Z(J,$,l1("text/html; charset=UTF-8",M));return typeof f==="object"?p1(f,TY.Stringify,!1,{}).then(Y):Y(f)};redirect=(f,$)=>{let M=String(f);return this.header("Location",!/[^\x00-\xFF]/.test(M)?M:encodeURI(M)),this.newResponse(null,$??302)};notFound=()=>{return this.#q??=()=>gf(),this.#q(this)}};var N="ALL",jY="all",RY=["get","post","put","delete","options","patch"],u0="Can not add a route since the matcher is already built.",h0=class extends Error{};var LY="__COMPOSED_HANDLER";var e4=(f)=>{return f.text("404 Not Found",404)},AY=(f,$)=>{if("getResponse"in f){let M=f.getResponse();return $.newResponse(M.body,M)}return console.error(f),$.text("Internal Server Error",500)},NY=class f{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#$="/";routes=[];constructor($={}){[...RY,jY].forEach((z)=>{this[z]=(Z,...X)=>{if(typeof Z==="string")this.#$=Z;else this.#z(z,this.#$,Z);return X.forEach((G)=>{this.#z(z,this.#$,G)}),this}}),this.on=(z,Z,...X)=>{for(let G of[Z].flat()){this.#$=G;for(let q of[z].flat())X.map((Q)=>{this.#z(q.toUpperCase(),this.#$,Q)})}return this},this.use=(z,...Z)=>{if(typeof z==="string")this.#$=z;else this.#$="*",Z.unshift(z);return Z.forEach((X)=>{this.#z(N,this.#$,X)}),this};let{strict:Y,...J}=$;Object.assign(this,J),this.getPath=Y??!0?$.getPath??r1:HY}#f(){let $=new f({router:this.router,getPath:this.getPath});return $.errorHandler=this.errorHandler,$.#M=this.#M,$.routes=this.routes,$}#M=e4;errorHandler=AY;route($,M){let Y=this.basePath($);return M.routes.map((J)=>{let z;if(M.errorHandler===AY)z=J.handler;else z=async(Z,X)=>(await h1([],M.errorHandler)(Z,()=>J.handler(Z,X))).res,z[LY]=J.handler;Y.#z(J.method,J.path,z)}),this}basePath($){let M=this.#f();return M._basePath=Pf(this._basePath,$),M}onError=($)=>{return this.errorHandler=$,this};notFound=($)=>{return this.#M=$,this};mount($,M,Y){let J,z;if(Y)if(typeof Y==="function")z=Y;else if(z=Y.optionHandler,Y.replaceRequest===!1)J=(G)=>G;else J=Y.replaceRequest;let Z=z?(G)=>{let q=z(G);return Array.isArray(q)?q:[q]}:(G)=>{let q=void 0;try{q=G.executionCtx}catch{}return[G.env,q]};J||=(()=>{let G=Pf(this._basePath,$),q=G==="/"?0:G.length;return(Q)=>{let D=new URL(Q.url);return D.pathname=D.pathname.slice(q)||"/",new Request(D,Q)}})();let X=async(G,q)=>{let Q=await M(J(G.req.raw),...Z(G));if(Q)return Q;await q()};return this.#z(N,Pf($,"*"),X),this}#z($,M,Y){$=$.toUpperCase(),M=Pf(this._basePath,M);let J={basePath:this._basePath,path:M,method:$,handler:Y};this.router.add($,M,[Y,J]),this.routes.push(J)}#J($,M){if($ instanceof Error)return this.errorHandler($,M);throw $}#Y($,M,Y,J){if(J==="HEAD")return(async()=>new Response(null,await this.#Y($,M,Y,"GET")))();let z=this.getPath($,{env:Y}),Z=this.router.match(J,z),X=new wY($,{path:z,matchResult:Z,env:Y,executionCtx:M,notFoundHandler:this.#M});if(Z[0].length===1){let q;try{q=Z[0][0][0][0](X,async()=>{X.res=await this.#M(X)})}catch(Q){return this.#J(Q,X)}return q instanceof Promise?q.then((Q)=>Q||(X.finalized?X.res:this.#M(X))).catch((Q)=>this.#J(Q,X)):q??this.#M(X)}let G=h1(Z[0],this.errorHandler,this.#M);return(async()=>{try{let q=await G(X);if(!q.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return q.res}catch(q){return this.#J(q,X)}})()}fetch=($,...M)=>{return this.#Y($,M[1],M[0],$.method)};request=($,M,Y,J)=>{if($ instanceof Request)return this.fetch(M?new Request($,M):$,Y,J);return $=$.toString(),this.fetch(new Request(/^https?:\/\//.test($)?$:`http://localhost${Pf("/",$)}`,M),Y,J)};fire=()=>{addEventListener("fetch",($)=>{$.respondWith(this.#Y($.request,$,void 0,$.request.method))})}};var z0=[];function g0(f,$){let M=this.buildAllMatchers(),Y=(J,z)=>{let Z=M[J]||M[N],X=Z[2][z];if(X)return X;let G=z.match(Z[0]);if(!G)return[[],z0];let q=G.indexOf("",1);return[Z[1][q],G]};return this.match=Y,Y(f,$)}var m0="[^/]+",Z0=".*",X0="(?:|/.*)",Tf=Symbol(),t4=new Set(".\\+*[^]$()");function f9(f,$){if(f.length===1)return $.length===1?f<$?-1:1:-1;if($.length===1)return 1;if(f===Z0||f===X0)return 1;else if($===Z0||$===X0)return-1;if(f===m0)return 1;else if($===m0)return-1;return f.length===$.length?f<$?-1:1:$.length-f.length}var OY=class f{#$;#f;#M=Object.create(null);insert($,M,Y,J,z){if($.length===0){if(this.#$!==void 0)throw Tf;if(z)return;this.#$=M;return}let[Z,...X]=$,G=Z==="*"?X.length===0?["","",Z0]:["","",m0]:Z==="/*"?["","",X0]:Z.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),q;if(G){let Q=G[1],D=G[2]||m0;if(Q&&G[2]){if(D===".*")throw Tf;if(D=D.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(D))throw Tf}if(q=this.#M[D],!q){if(Object.keys(this.#M).some((V)=>V!==Z0&&V!==X0))throw Tf;if(z)return;if(q=this.#M[D]=new f,Q!=="")q.#f=J.varIndex++}if(!z&&Q!=="")Y.push([Q,q.#f])}else if(q=this.#M[Z],!q){if(Object.keys(this.#M).some((Q)=>Q.length>1&&Q!==Z0&&Q!==X0))throw Tf;if(z)return;q=this.#M[Z]=new f}q.insert(X,M,Y,J,z)}buildRegExpStr(){let M=Object.keys(this.#M).sort(f9).map((Y)=>{let J=this.#M[Y];return(typeof J.#f==="number"?`(${Y})@${J.#f}`:t4.has(Y)?`\\${Y}`:Y)+J.buildRegExpStr()});if(typeof this.#$==="number")M.unshift(`#${this.#$}`);if(M.length===0)return"";if(M.length===1)return M[0];return"(?:"+M.join("|")+")"}};var xY=class{#$={varIndex:0};#f=new OY;insert(f,$,M){let Y=[],J=[];for(let Z=0;;){let X=!1;if(f=f.replace(/\{[^}]+\}/g,(G)=>{let q=`@\\${Z}`;return J[Z]=[q,G],Z++,X=!0,q}),!X)break}let z=f.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let Z=J.length-1;Z>=0;Z--){let[X]=J[Z];for(let G=z.length-1;G>=0;G--)if(z[G].indexOf(X)!==-1){z[G]=z[G].replace(X,J[Z][1]);break}}return this.#f.insert(z,$,Y,this.#$,M),Y}buildRegExp(){let f=this.#f.buildRegExpStr();if(f==="")return[/^$/,[],[]];let $=0,M=[],Y=[];return f=f.replace(/#(\d+)|@(\d+)|\.\*\$/g,(J,z,Z)=>{if(z!==void 0)return M[++$]=Number(z),"$()";if(Z!==void 0)return Y[Number(Z)]=++$,"";return""}),[new RegExp(`^${f}`),M,Y]}};var $9=[/^$/,[],Object.create(null)],IY=Object.create(null);function kY(f){return IY[f]??=new RegExp(f==="*"?"":`^${f.replace(/\/\*$|([.\\+*[^\]$()])/g,($,M)=>M?`\\${M}`:"(?:|/.*)")}$`)}function M9(){IY=Object.create(null)}function Y9(f){let $=new xY,M=[];if(f.length===0)return $9;let Y=f.map((q)=>[!/\*|\/:/.test(q[0]),...q]).sort(([q,Q],[D,V])=>q?1:D?-1:Q.length-V.length),J=Object.create(null);for(let q=0,Q=-1,D=Y.length;q<D;q++){let[V,W,H]=Y[q];if(V)J[W]=[H.map(([P])=>[P,Object.create(null)]),z0];else Q++;let R;try{R=$.insert(W,Q,V)}catch(P){throw P===Tf?new h0(W):P}if(V)continue;M[Q]=H.map(([P,A])=>{let i=Object.create(null);A-=1;for(;A>=0;A--){let[o,s]=R[A];i[o]=s}return[P,i]})}let[z,Z,X]=$.buildRegExp();for(let q=0,Q=M.length;q<Q;q++)for(let D=0,V=M[q].length;D<V;D++){let W=M[q][D]?.[1];if(!W)continue;let H=Object.keys(W);for(let R=0,P=H.length;R<P;R++)W[H[R]]=X[W[H[R]]]}let G=[];for(let q in Z)G[q]=M[Z[q]];return[z,G,J]}function mf(f,$){if(!f)return;for(let M of Object.keys(f).sort((Y,J)=>J.length-Y.length))if(kY(M).test($))return[...f[M]];return}var r0=class{name="RegExpRouter";#$;#f;constructor(){this.#$={[N]:Object.create(null)},this.#f={[N]:Object.create(null)}}add(f,$,M){let Y=this.#$,J=this.#f;if(!Y||!J)throw Error(u0);if(!Y[f])[Y,J].forEach((X)=>{X[f]=Object.create(null),Object.keys(X[N]).forEach((G)=>{X[f][G]=[...X[N][G]]})});if($==="/*")$="*";let z=($.match(/\/:/g)||[]).length;if(/\*$/.test($)){let X=kY($);if(f===N)Object.keys(Y).forEach((G)=>{Y[G][$]||=mf(Y[G],$)||mf(Y[N],$)||[]});else Y[f][$]||=mf(Y[f],$)||mf(Y[N],$)||[];Object.keys(Y).forEach((G)=>{if(f===N||f===G)Object.keys(Y[G]).forEach((q)=>{X.test(q)&&Y[G][q].push([M,z])})}),Object.keys(J).forEach((G)=>{if(f===N||f===G)Object.keys(J[G]).forEach((q)=>X.test(q)&&J[G][q].push([M,z]))});return}let Z=E0($)||[$];for(let X=0,G=Z.length;X<G;X++){let q=Z[X];Object.keys(J).forEach((Q)=>{if(f===N||f===Q)J[Q][q]||=[...mf(Y[Q],q)||mf(Y[N],q)||[]],J[Q][q].push([M,z-G+X+1])})}}match=g0;buildAllMatchers(){let f=Object.create(null);return Object.keys(this.#f).concat(Object.keys(this.#$)).forEach(($)=>{f[$]||=this.#M($)}),this.#$=this.#f=void 0,M9(),f}#M(f){let $=[],M=f===N;if([this.#$,this.#f].forEach((Y)=>{let J=Y[f]?Object.keys(Y[f]).map((z)=>[z,Y[f][z]]):[];if(J.length!==0)M||=!0,$.push(...J);else if(f!==N)$.push(...Object.keys(Y[N]).map((z)=>[z,Y[N][z]]))}),!M)return null;else return Y9($)}};var J9=class{name="PreparedRegExpRouter";#$;#f;constructor(f,$){this.#$=f,this.#f=$}#M(f,$){let M=this.#$[f];M[1].forEach((Y)=>Y&&Y.push($)),Object.values(M[2]).forEach((Y)=>Y[0].push($))}#z(f,$,M,Y,J){let z=this.#$[f];if(!J)z[2][$][0].push([M,{}]);else Y.forEach((Z)=>{if(typeof Z==="number")z[1][Z].push([M,J]);else z[2][Z||$][0].push([M,J])})}add(f,$,M){if(!this.#$[f]){let J=this.#$[N],z={};for(let Z in J[2])z[Z]=[J[2][Z][0].slice(),z0];this.#$[f]=[J[0],J[1].map((Z)=>Array.isArray(Z)?Z.slice():0),z]}if($==="/*"||$==="*"){let J=[M,{}];if(f===N)for(let z in this.#$)this.#M(z,J);else this.#M(f,J);return}let Y=this.#f[$];if(!Y)throw Error(`Path ${$} is not registered`);for(let[J,z]of Y)if(f===N)for(let Z in this.#$)this.#z(Z,$,M,J,z);else this.#z(f,$,M,J,z)}buildAllMatchers(){return this.#$}match=g0};var d1=class{name="SmartRouter";#$=[];#f=[];constructor(f){this.#$=f.routers}add(f,$,M){if(!this.#f)throw Error(u0);this.#f.push([f,$,M])}match(f,$){if(!this.#f)throw Error("Fatal error");let M=this.#$,Y=this.#f,J=M.length,z=0,Z;for(;z<J;z++){let X=M[z];try{for(let G=0,q=Y.length;G<q;G++)X.add(...Y[G]);Z=X.match(f,$)}catch(G){if(G instanceof h0)continue;throw G}this.match=X.match.bind(X),this.#$=[X],this.#f=void 0;break}if(z===J)throw Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,Z}get activeRouter(){if(this.#f||this.#$.length!==1)throw Error("No active router has been determined yet.");return this.#$[0]}};var G0=Object.create(null),z9=(f)=>{for(let $ in f)return!0;return!1},CY=class f{#$;#f;#M;#z=0;#J=G0;constructor($,M,Y){if(this.#f=Y||Object.create(null),this.#$=[],$&&M){let J=Object.create(null);J[$]={handler:M,possibleKeys:[],score:0},this.#$=[J]}this.#M=[]}insert($,M,Y){this.#z=++this.#z;let J=this,z=KY(M),Z=[];for(let X=0,G=z.length;X<G;X++){let q=z[X],Q=z[X+1],D=BY(q,Q),V=Array.isArray(D)?D[0]:q;if(V in J.#f){if(J=J.#f[V],D)Z.push(D[1]);continue}if(J.#f[V]=new f,D)J.#M.push(D),Z.push(D[1]);J=J.#f[V]}return J.#$.push({[$]:{handler:Y,possibleKeys:Z.filter((X,G,q)=>q.indexOf(X)===G),score:this.#z}}),J}#Y($,M,Y,J,z){for(let Z=0,X=M.#$.length;Z<X;Z++){let G=M.#$[Z],q=G[Y]||G[N],Q={};if(q!==void 0){if(q.params=Object.create(null),$.push(q),J!==G0||z&&z!==G0)for(let D=0,V=q.possibleKeys.length;D<V;D++){let W=q.possibleKeys[D],H=Q[q.score];q.params[W]=z?.[W]&&!H?z[W]:J[W]??z?.[W],Q[q.score]=!0}}}}search($,M){let Y=[];this.#J=G0;let z=[this],Z=m1(M),X=[],G=Z.length,q=null;for(let Q=0;Q<G;Q++){let D=Z[Q],V=Q===G-1,W=[];for(let R=0,P=z.length;R<P;R++){let A=z[R],i=A.#f[D];if(i)if(i.#J=A.#J,V){if(i.#f["*"])this.#Y(Y,i.#f["*"],$,A.#J);this.#Y(Y,i,$,A.#J)}else W.push(i);for(let o=0,s=A.#M.length;o<s;o++){let rf=A.#M[o],l=A.#J===G0?{}:{...A.#J};if(rf==="*"){let Mf=A.#f["*"];if(Mf)this.#Y(Y,Mf,$,A.#J),Mf.#J=l,W.push(Mf);continue}let[wf,k,L]=rf;if(!D&&!(L instanceof RegExp))continue;let m=A.#f[wf];if(L instanceof RegExp){if(q===null){q=Array(G);let K=M[0]==="/"?1:0;for(let U=0;U<G;U++)q[U]=K,K+=Z[U].length+1}let Mf=M.substring(q[Q]),T=L.exec(Mf);if(T){if(l[k]=T[0],this.#Y(Y,m,$,A.#J,l),z9(m.#f)){m.#J=l;let K=T[0].match(/\//)?.length??0;(X[K]||=[]).push(m)}continue}}if(L===!0||L.test(D))if(l[k]=D,V){if(this.#Y(Y,m,$,l,A.#J),m.#f["*"])this.#Y(Y,m.#f["*"],$,l,A.#J)}else m.#J=l,W.push(m)}}let H=X.shift();z=H?W.concat(H):W}if(Y.length>1)Y.sort((Q,D)=>{return Q.score-D.score});return[Y.map(({handler:Q,params:D})=>[Q,D])]}};var n1=class{name="TrieRouter";#$;constructor(){this.#$=new CY}add(f,$,M){let Y=E0($);if(Y){for(let J=0,z=Y.length;J<z;J++)this.#$.insert(f,Y[J],M);return}this.#$.insert(f,$,M)}match(f,$){return this.#$.search(f,$)}};var p=class extends NY{constructor(f={}){super(f);this.router=f.router??new d1({routers:[new r0,new n1]})}};function g(f,$){return f.json({code:1,data:$,msg:""})}function a(f,$){return f.json({code:-1,data:null,msg:$})}function bY(f){return async($)=>{let M=await $.req.json(),Y=await f.addAlias(M);if(!Y.success)return a($,Y.error);return g($,Y.data)}}function vY(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=await f.getChildren(M);return g($,Y)}}function _Y(f){return async($)=>{let M=$.req.query("domain"),Y=await f.getAllMemories({domain:M,includeDeleted:!0});return g($,Y)}}function EY(f){return async($)=>{let M=$.req.query("uri"),Y=$.req.query("domain"),J=await f.getRelationships({uri:M,domain:Y});return g($,J)}}function uY(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=$.req.query("includeDeleted")==="true";try{let J=await f.getMemory(M,{includeDeleted:Y});if(!J)return a($,"Memory not found");return g($,J)}catch(J){return a($,J instanceof Error?J.message:String(J))}}}function hY(f){return async($)=>{let M=await $.req.json();try{let Y=await f.createMemory(M);return g($,Y)}catch(Y){return a($,Y instanceof Error?Y.message:String(Y))}}}function gY(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=await $.req.json();try{let J=await f.updateMemory({...Y,uri:M});return g($,J)}catch(J){return a($,J instanceof Error?J.message:String(J))}}}function mY(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=$.req.query("recursive")==="true",J=$.req.query("permanent")==="true";try{return await f.deleteMemory(M,{recursive:Y,permanent:J}),g($,null)}catch(z){return a($,z instanceof Error?z.message:String(z))}}}function rY(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??"");try{let Y=await f.restoreMemory(M);return g($,Y)}catch(Y){return a($,Y instanceof Error?Y.message:String(Y))}}}function cY(f){return async($)=>{let M=$.req.query("q")??"",Y=$.req.query("domain"),J=$.req.query("limit")?Number.parseInt($.req.query("limit"),10):10;if(!M)return a($,"Query parameter 'q' is required");let z=await f.searchMemory(M,{query:M,domain:Y,limit:J});return g($,z)}}function pY(f){let $=new p().basePath("/alias");return $.post("/",bY(f)),$}function lY(f){let $=new p().basePath("/children");return $.get("/:uri",vY(f)),$}function dY(f){let $=new p().basePath("/graph");return $.get("/nodes",_Y(f)),$.get("/relationships",EY(f)),$}function nY(f){let $=new p().basePath("/memories");return $.get("/:uri",uY(f)),$.post("/",hY(f)),$.put("/:uri",gY(f)),$.delete("/:uri",mY(f)),$.post("/:uri/restore",rY(f)),$}function iY(f){let $=new p().basePath("/search");return $.get("/",cY(f)),$}function oY(f,$){let M=f.basePath("/api");M.route("/",nY($)),M.route("/",iY($)),M.route("/",lY($)),M.route("/",dY($)),M.route("/",pY($))}var __dirname="/home/runner/work/hippo-memo/hippo-memo/packages/cli/src/api";function Z9(f){let $=new p,M=process.env.WEB_DIST||sY(__dirname,"../../dist");return oY($,f),$.get("/*",u1({root:M})),$.get("*",u1({path:sY(M,"index.html")})),$}async function aY(f,$){let M=Z9(f);GY({fetch:M.fetch,port:$}),console.log(`Hippo web server started on http://localhost:${$}`),console.log("Press Ctrl+C to stop")}async function eY(f,$,M){let Y=x0(f),J=O0({type:M,config:Y});await aY(J,$)}var c0=new Q$;c0.name("hippo").description("Hippo Memory Store CLI").version("1.0.0");c0.command("init").description("Initialize a new hippo memory directory").argument("[directory]","Directory to initialize",".").action(async(f)=>{await tM(f)});c0.command("web").description("Start the web server").argument("[directory]","Project directory",".").option("-p, --port <port>","Port to listen on","3000").option("-s, --store-type <type>","Store type (filesystem or sqlite)","filesystem").action(async(f,$)=>{let M=Number.parseInt($.port,10),Y=$.storeType;await eY(f,M,Y)});c0.parse();
194
+ ### ${G}
195
+ `);for(let K of U){let W=K.priority>7?` [★${K.priority}]`:"";Y.push(` - ${K.uri} [${K.memoryId}]${W}
196
+ `)}}}}let z=Y.join("");return{uri:C0,memoryId:C0,content:z,priority:10,disclosure:"",isAlias:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),deleted:!1}}import{sep as I4}from"node:path";var QD="/";function Y1(f,$){let M=D1(f),J=M.path.split(QD).filter(Boolean).join(I4);return[$,M.domain,`${J}${Gf}`].join(I4)}var C4="system://recent";async function E4(f,$){let J=10,z=$.match(/^system:\/\/recent(?:\/(\d+))?$/);if(z?.[1]){let U=Number.parseInt(z[1],10);if(Number.isNaN(U)||U<1)J=10;else if(U>1000)J=1000;else J=U}let X=(await f.getAllMemories({includeDeleted:!1})).sort((U,K)=>{let W=new Date(U.updatedAt).getTime();return new Date(K.updatedAt).getTime()-W}).slice(0,J),Q=[];for(let U of X){let K=await f.getMemory(U.uri);if(K)Q.push(K)}let D=[];D.push(`# Recently Modified Memories
197
+ `),D.push(`# Showing: ${J} most recent entries
198
+ `);for(let U of Q){let K=U.priority>7?` [★${U.priority}]`:"",W=Uf(U.updatedAt);if(D.push(`${U.uri}${K} modified: ${W}
199
+ `),U.disclosure)D.push(`disclosure: ${U.disclosure}
200
+ `)}let G=D.join("");return{uri:C4,memoryId:C4,content:G,priority:10,disclosure:"",isAlias:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),deleted:!1}}class d${memoryRoot;constructor(f){let $=f.memoryRoot??a2;this.memoryRoot=m$($,Qf)}async _getMemoryRaw(f){try{let $=Y1(f,this.memoryRoot),M=await c$($,"utf-8"),{data:Y,content:J}=Lf(M);return{uri:Y.uri,memoryId:Y.memoryId,content:J,priority:Y.priority,disclosure:Y.disclosure,isAlias:Y.isAlias??!1,targetUri:Y.targetUri,createdAt:Y.createdAt,updatedAt:Y.updatedAt,deleted:Y.deleted??!1}}catch{return null}}async _targetFileExists(f){try{let $=Y1(f,this.memoryRoot);return await GD($),!0}catch{return!1}}async getMemory(f,$){if(!G1(f))throw Error(`Invalid URI format: ${f}. Expected format: 'domain://path/to/memory'`);if(f===I0)return $M(this);if(f===C0)return j4(this);if(f===K$||f.startsWith(`${K$}/`))return E4(this,f);let M=$?.includeDeleted??!1;try{let Y=Y1(f,this.memoryRoot),J=await c$(Y,"utf-8"),{data:z,content:Z}=Lf(J);if(!M&&(z.deleted??!1))return null;if(z.isAlias&&z.targetUri){let X=await this._getMemoryRaw(z.targetUri);return{uri:z.uri,memoryId:z.memoryId,content:X?.content??"",priority:z.priority,disclosure:z.disclosure,isAlias:!0,targetUri:z.targetUri,createdAt:z.createdAt,updatedAt:z.updatedAt,deleted:z.deleted??!1}}return{uri:z.uri,memoryId:z.memoryId,content:Z,priority:z.priority,disclosure:z.disclosure,isAlias:z.isAlias??!1,targetUri:z.targetUri,createdAt:z.createdAt,updatedAt:z.updatedAt,deleted:z.deleted??!1}}catch{return null}}async createMemory(f){if(!G1(f.uri))throw Error(`Invalid URI format: ${f.uri}. Expected format: 'domain://path/to/memory'`);let $=await this._getMemoryRaw(f.uri);if($&&!$.deleted)throw Error(`Memory already exists at URI: ${f.uri}`);let M=w4(),Y=new Date().toISOString(),J=f.uri,z=Y1(J,this.memoryRoot),Z=k4(z);await x4(Z,{recursive:!0});let Q=n1({memoryId:M,uri:J,priority:f.priority??5,disclosure:f.disclosure,isAlias:!1,createdAt:Y,updatedAt:Y})+f.content;return await W0(z,Q,"utf-8"),{uri:J,memoryId:M,content:f.content,priority:f.priority??5,disclosure:f.disclosure,isAlias:!1,createdAt:Y,updatedAt:Y,deleted:!1}}async updateMemory(f){if(!G1(f.uri))throw Error(`Invalid URI format: ${f.uri}. Expected format: 'domain://path/to/memory'`);let $=await this._getMemoryRaw(f.uri);if(!$||$.deleted)throw Error("Memory not found");if($.isAlias&&$.targetUri){if(!await this._targetFileExists($.targetUri))throw Error("Target memory file not found");let Q=await this._getMemoryRaw($.targetUri);if(Q){let D=Y1($.targetUri,this.memoryRoot),G=new Date().toISOString(),K=n1({memoryId:Q.memoryId,uri:Q.uri,priority:Q.priority,disclosure:Q.disclosure,isAlias:Q.isAlias,targetUri:Q.targetUri,createdAt:Q.createdAt,updatedAt:G,deleted:Q.deleted})+f.content;return await W0(D,K,"utf-8"),{...$,content:f.content,updatedAt:G}}throw Error("Target memory not found")}let M=Y1(f.uri,this.memoryRoot),Y=new Date().toISOString(),z=n1({memoryId:$.memoryId,uri:$.uri,priority:f.priority??$.priority,disclosure:f.disclosure??$.disclosure,isAlias:$.isAlias,targetUri:$.targetUri,createdAt:$.createdAt,updatedAt:Y,deleted:$.deleted})+f.content;return await W0(M,z,"utf-8"),{...$,content:f.content,priority:f.priority??$.priority,disclosure:f.disclosure??$.disclosure,updatedAt:Y}}async deleteMemory(f,$={}){if(!G1(f))throw Error(`Invalid URI format: ${f}. Expected format: 'domain://path/to/memory'`);let{recursive:M=!1,permanent:Y=!1}=$;if(!Y){let z=await this.getMemory(f);if(!z||z.deleted)throw Error("Memory not found");let Z=Y1(f,this.memoryRoot),X=new Date().toISOString(),D=n1({memoryId:z.memoryId,uri:z.uri,priority:z.priority,disclosure:z.disclosure,isAlias:z.isAlias,targetUri:z.targetUri,createdAt:z.createdAt,updatedAt:X,deleted:!0})+z.content;if(await W0(Z,D,"utf-8"),M){let G=await this.getAllMemories({includeDeleted:!1});for(let U of G)if(U.uri.startsWith(`${f}/`))await this.deleteMemory(U.uri,{recursive:!0,permanent:!1})}return}let J=Y1(f,this.memoryRoot);if(await y4(J),M){let z=await this.getAllMemories({includeDeleted:!1});for(let Z of z)if(Z.uri.startsWith(`${f}/`)){let X=Y1(Z.uri,this.memoryRoot);await y4(X)}}}async restoreMemory(f){if(!G1(f))throw Error(`Invalid URI format: ${f}. Expected format: 'domain://path/to/memory'`);let $=await this._getMemoryRaw(f);if(!$)throw Error("Memory not found");if(!$.deleted)throw Error("Memory is not deleted");let M=Y1(f,this.memoryRoot),Y=new Date().toISOString(),z=n1({memoryId:$.memoryId,uri:$.uri,priority:$.priority,disclosure:$.disclosure,isAlias:$.isAlias,targetUri:$.targetUri,createdAt:$.createdAt,updatedAt:Y,deleted:!1})+$.content;return await W0(M,z,"utf-8"),{...$,updatedAt:Y,deleted:!1}}async addAlias(f){if(!G1(f.newUri))throw Error(`Invalid URI format for newUri: ${f.newUri}. Expected format: 'domain://path/to/memory'`);if(!G1(f.targetUri))throw Error(`Invalid URI format for targetUri: ${f.targetUri}. Expected format: 'domain://path/to/memory'`);let $=await this.getMemory(f.targetUri);if(!$)throw Error("Target memory not found");if(await this.getMemory(f.newUri))throw Error(`Memory already exists at alias URI: ${f.newUri}`);let Y=new Date().toISOString(),J=$.memoryId,z=Y1(f.newUri,this.memoryRoot),Z=k4(z);await x4(Z,{recursive:!0});let X=n1({memoryId:J,uri:f.newUri,priority:f.priority??$.priority,disclosure:f.disclosure??$.disclosure,isAlias:!0,targetUri:f.targetUri,createdAt:Y,updatedAt:Y});return await W0(z,X,"utf-8"),{uri:f.newUri,memoryId:J,content:$.content,priority:f.priority??$.priority,disclosure:f.disclosure??$.disclosure,isAlias:!0,targetUri:f.targetUri,createdAt:Y,updatedAt:Y,deleted:!1}}async searchMemory(f,$={}){let M=await this.getAllMemories({domain:$.domain,includeDeleted:!1}),Y=f.toLowerCase(),J=[],z=$.limit??10;for(let Z of M){if(J.length>=z)break;try{let X=await this.getMemory(Z.uri);if(!X||X.deleted)continue;let Q=X.uri.toLowerCase().includes(Y),D=X.content.toLowerCase().includes(Y);if(Q||D)J.push(X)}catch{}}return J}async getChildren(f){if(!G1(f))return[];try{let $=await this.getAllMemories({includeDeleted:!1}),M=[];for(let Y of $){let J=g$(f,Y.uri);if(J?.isDirect&&J?.parentUri===f)M.push(Y)}return M.sort((Y,J)=>J.priority-Y.priority)}catch{return[]}}async getAllMemories(f={}){let $=[],M=f.domain?m$(this.memoryRoot,f.domain):this.memoryRoot,Y=async(J)=>{try{let z=await DD(J,{withFileTypes:!0});for(let Z of z){let X=m$(J,Z.name);if(Z.isDirectory())await Y(X);else if(UD(Z.name)===Gf){let Q=await c$(X,"utf-8"),{data:D,content:G}=Lf(Q);if(!D.deleted||f.includeDeleted)$.push({uri:D.uri,memoryId:D.memoryId,content:G,priority:D.priority,disclosure:D.disclosure,isAlias:D.isAlias??!1,targetUri:D.targetUri,createdAt:D.createdAt,updatedAt:D.updatedAt,deleted:D.deleted??!1})}}}catch{}};return await Y(M),$}async getRelationships(f){let{uri:$,domain:M}=f||{},Y=[],J=await this.getAllMemories({domain:M,includeDeleted:!0});if($){if(!G1($))return Y;let z=await this.getMemory($);if(!z)return Y;for(let Z of J){if(Z.uri===$)continue;let X=g$($,Z.uri);if(X)Y.push({fromUri:X.parentUri,toUri:X.childUri,type:"parent_child",weight:1});if(Z.isAlias&&Z.targetUri===$)Y.push({fromUri:Z.uri,toUri:$,type:"alias",weight:1});try{let Q=await this.getMemory(Z.uri);if(Q){let D=Q.content.includes($),G=z.content.includes(Z.uri);if(D||G)Y.push({fromUri:D?Z.uri:$,toUri:D?$:Z.uri,type:"reference",weight:0.5})}}catch{}}}else{let z=J.map((X)=>X.uri),Z=new Set;for(let X of z){let Q=await this.getRelationships({uri:X,domain:M});for(let D of Q){let G=`${D.fromUri}-${D.toUri}-${D.type}`;if(!Z.has(G))Z.add(G),Y.push(D)}}}return Y}}function K0(f){switch(f.type){case"filesystem":return new d$(f.config);case"sqlite":throw Error("SQLite adapter not implemented yet");default:throw Error(`Unknown store type: ${f.type}`)}}function V0(f){return{memoryRoot:f}}var a0=w0(rz(),1),nf=import.meta.dirname,BW=e(nf,"../../template/system"),HW=e(nf,"../../template/mcp/AGENTS.md"),SW=e(nf,"../../template/skill/AGENTS.md"),FW=e(nf,"../../template/skill"),RW={agent:"system://agent",soul:"system://soul",user:"system://user"};async function NW(f){return s0(e(BW,f),"utf-8")}function H2(f){return f.split(`
201
+ `).find((Y)=>Y.trim()!=="")?.trim()||""}function S2(f,$){return f.split(`
202
+ `).find((J)=>J.trim()!=="")?.trim()===$}async function pz(f,$){try{let M="";try{M=await s0(f,"utf-8")}catch{M=""}let Y=H2($);if(M&&S2(M,Y)){console.log("› Skipped: content already exists");return}let J=M?`${b1}${b1}`:"",z=`${$}${J}${M}`;await oz(f,z,"utf-8"),console.log(`✔ Injected: ${f}`)}catch(M){throw console.error(`✖ Failed: ${f}`,M),M}}async function iz(f,$,M){let Y=e(f,"AGENTS.md"),J=e(f,"CLAUDE.md"),z=!1,Z=!1;try{await df(Y,lf.F_OK),z=!0}catch{}try{await df(J,lf.F_OK),Z=!0}catch{}let X=await s0($,"utf-8"),Q=M==="mcp"?"MCP":"Skill";if(Z){console.log("› Found: CLAUDE.md");let D=await s0(J,"utf-8"),G=H2(X);if(!S2(D,G))if((await a0.default({type:"confirm",name:"inject",message:`Inject ${Q} configuration to CLAUDE.md?`,initial:!0})).inject)await pz(J,X);else console.log("› Skipped: CLAUDE.md");else console.log("› Skipped: content already exists")}else if(z){console.log("› Found: AGENTS.md");let D=await s0(Y,"utf-8"),G=H2(X);if(!S2(D,G))if((await a0.default({type:"confirm",name:"inject",message:`Inject ${Q} configuration to AGENTS.md?`,initial:!0})).inject)await pz(Y,X);else console.log("› Skipped: AGENTS.md");else console.log("› Skipped: content already exists")}else console.log("✔ Created: AGENTS.md"),await oz(Y,X,"utf-8")}async function OW(f){let $=e(f,".claude","skills");try{await B2($,{recursive:!0})}catch{}let M=["hippo-memory"];for(let Y of M){let J=e(FW,Y),z=e($,Y),Z=e(z,"SKILL.md");try{await B2(z,{recursive:!0});let X=!1;try{await df(Z,lf.F_OK),X=!0}catch{}if(X){if(!(await a0.default({type:"confirm",name:"overwrite",message:`Skill ${Y} already exists. Overwrite?`,initial:!1})).overwrite){console.log(`› Skipped: ${Y}`);continue}}await qW(e(J,"SKILL.md"),Z),console.log(`✔ Installed skill: ${Y}`)}catch(X){console.error(`✖ Failed to install skill: ${Y}`,X)}}}async function AW(){return(await a0.default({type:"select",name:"mode",message:"选择 Claude Code 集成方式:",choices:[{title:"\uD83D\uDD0C MCP 模式 (推荐全局配置)",description:"适用于跨项目共享记忆,需要单独配置 MCP 服务器",value:"mcp"},{title:"\uD83D\uDCDC Skill 模式 (推荐项目配置)",description:"项目级技能,可提交到 Git 与团队共享",value:"skill"}],initial:1})).mode||"skill"}async function sz(f){let $=e(f,Qf);try{await df($,lf.F_OK),console.log(`Memory directory already exists at ${$}`)}catch{await B2($,{recursive:!0});let Y=K0({type:"filesystem",config:V0(f)});await Promise.all(Object.entries(RW).map(async([J,z])=>{let Z=await NW(`${J}.md`);await Y.createMemory({uri:z,content:Z,priority:10})})),console.log(`✔ Initialized hippo memory at ${$}`)}let M=await AW();if(M==="mcp")console.log(`${b1}◇ Setting up MCP integration...`),await iz(f,HW,M),console.log(`${b1}✨ Setup complete!${b1}`),console.log("\uD83D\uDCCC Next steps:"),console.log(" 1. Configure MCP server in Claude Code settings"),console.log(" 2. Run: hippo web -p 3000"),console.log("");if(M==="skill")console.log(`${b1}◇ Installing Claude Code Skills...`),await iz(f,SW,M),await OW(f),console.log(`${b1}✨ Setup complete!${b1}`),console.log("\uD83D\uDCCC Next steps:"),console.log(" 1. Skills installed in .claude/skills/"),console.log(" 2. Configuration injected to CLAUDE.md"),console.log(" 3. LLM will automatically trigger when needed"),console.log(" 4. Commit to Git to share with your team"),console.log("")}import{existsSync as LW}from"node:fs";function az(f){return f.replace(/\\r\\n/g,`
203
+ `).replace(/\\n/g,`
204
+ `)}function o1(f){let $=f||process.cwd();if(!LW($))throw Error(`目录不存在: ${$}`);return K0({type:"filesystem",config:V0($)})}async function tz(f,$,M){try{let Y=o1(M.dir),J=M.priority?Number.parseInt(M.priority,10):5;await Y.createMemory({uri:f,content:az($),priority:J,disclosure:M.disclosure}),console.log("OK")}catch(Y){console.error(Y instanceof Error?Y.message:String(Y)),process.exit(1)}}async function ez(f,$){try{let Y=await o1($.dir).getMemory(f);if(!Y)console.error("Memory not found"),process.exit(1);if(!Y.content||Y.content.trim()===""){console.log("No Content");return}console.log(Y.content)}catch(M){console.error(M instanceof Error?M.message:String(M)),process.exit(1)}}async function f6(f,$,M){try{let Y=o1(M.dir),J={uri:f,content:az($)};if(M.priority)J.priority=Number.parseInt(M.priority,10);if(M.disclosure)J.disclosure=M.disclosure;await Y.updateMemory(J),console.log("OK")}catch(Y){console.error(Y instanceof Error?Y.message:String(Y)),process.exit(1)}}async function $6(f,$){try{await o1($.dir).deleteMemory(f,{recursive:$.recursive}),console.log("OK")}catch(M){console.error(M instanceof Error?M.message:String(M)),process.exit(1)}}async function M6(f,$){try{let M=o1($.dir),Y=$.limit?Number.parseInt($.limit,10):10,J=await M.searchMemory(f,{domain:$.domain,limit:Y});if(J.length===0){console.log(`No memories found matching "${f}"`);return}let z=(X,Q,D=50)=>{if(X.length<=D)return X;let G=X.toLowerCase(),U=Q.toLowerCase(),K=G.indexOf(U);if(K===-1)return`${X.slice(0,D-3)}...`;let W=Q.length,B=K-Math.floor((D-W)/2),O=K+W+Math.ceil((D-W)/2);if(B<0)O+=-B,B=0;if(O>X.length)B-=O-X.length,O=X.length;B=Math.max(0,B);let F=X.slice(B,O);if(B>0)F=`...${F}`;if(O<X.length)F=`${F}...`;return F},Z=J.map((X)=>{let Q=[`- ${X.uri} [★${X.priority}]`,` content: ${z(X.content,f)}`];if(X.disclosure)Q.splice(1,0,` disclosure: ${X.disclosure}`);return Q.join(`
205
+ `)}).join(`
206
+
207
+ `);console.log(`Found ${J.length} memories:
208
+
209
+ ${Z}`)}catch(M){console.error(M instanceof Error?M.message:String(M)),process.exit(1)}}async function Y6(f){try{let $=o1(f.dir),M=f.limit?Number.parseInt(f.limit,10):void 0,Y=await $.getAllMemories({domain:f.domain}),J=M?Y.slice(0,M):Y;if(J.length===0){console.log("No memories found.");return}let z=(G,U=50)=>{if(G.length<=U)return G;return`${G.slice(0,U-3)}...`},Z=J.map((G)=>{let U=[`- ${G.uri} [★${G.priority}]`,` content: ${z(G.content)}`];if(G.disclosure)U.splice(1,0,` disclosure: ${G.disclosure}`);return U.join(`
210
+ `)}).join(`
211
+
212
+ `),X=Y.length,Q=J.length,D=M&&X>M?`Showing ${Q} of ${X} memories`:`Total: ${X} memories`;console.log(`${D}
213
+
214
+ ${Z}`)}catch($){console.error($ instanceof Error?$.message:String($)),process.exit(1)}}async function J6(f,$,M){try{let Y=o1(M.dir),J={newUri:f,targetUri:$};if(M.priority)J.priority=Number.parseInt(M.priority,10);if(M.disclosure)J.disclosure=M.disclosure;await Y.addAlias(J),console.log("OK")}catch(Y){console.error(Y instanceof Error?Y.message:String(Y)),process.exit(1)}}var _1=new Xf("memory").description("Memory 管理操作 (无需 init,直接使用当前目录)");_1.command("create <uri> <content>").description("创建新记忆").option("-p, --priority <number>","优先级 (1-10)","5").option("-d, --disclosure <string>","触发条件").option("--dir <directory>","项目根目录 (默认: .)",".").action(tz);_1.command("read <uri>").description("读取指定记忆").option("--dir <directory>","项目根目录 (默认: .)",".").action(ez);_1.command("update <uri> <content>").description("更新记忆内容").option("-p, --priority <number>","优先级 (1-10)").option("-d, --disclosure <string>","触发条件").option("--dir <directory>","项目根目录 (默认: .)",".").action(f6);_1.command("delete <uri>").description("删除记忆").option("-r, --recursive","递归删除子记忆").option("--permanent","永久删除(不进入回收站)").option("--dir <directory>","项目根目录 (默认: .)",".").action($6);_1.command("search <query>").description("搜索记忆").option("--domain <string>","限定域名").option("-l, --limit <number>","结果数量","10").option("--dir <directory>","项目根目录 (默认: .)",".").action(M6);_1.command("alias <newUri> <targetUri>").description("为已有记忆添加别名").option("-p, --priority <number>","别名优先级 (继承目标默认)").option("-d, --disclosure <string>","别名触发条件").option("--dir <directory>","项目根目录 (默认: .)",".").action(J6);_1.command("list").description("列出所有记忆").option("--domain <string>","限定域名").option("-l, --limit <number>","结果数量").option("--dir <directory>","项目根目录 (默认: .)",".").action(async(f)=>{await Y6(f)});var z6=_1;import{join as M8}from"node:path";import{createServer as PW}from"http";import{Http2ServerRequest as TW}from"http2";import{Http2ServerRequest as F2}from"http2";import{Readable as Z6}from"stream";import uW from"crypto";var s1=class extends Error{constructor(f,$){super(f,$);this.name="RequestError"}},wW=(f)=>{if(f instanceof s1)return f;return new s1(f.message,{cause:f})},jW=global.Request,t0=class extends jW{constructor(f,$){if(typeof f==="object"&&N0 in f)f=f[N0]();if(typeof $?.body?.getReader<"u")$.duplex??="half";super(f,$)}},IW=(f)=>{let $=[],M=f.rawHeaders;for(let Y=0;Y<M.length;Y+=2){let{[Y]:J,[Y+1]:z}=M;if(J.charCodeAt(0)!==58)$.push([J,z])}return new Headers($)},Q6=Symbol("wrapBodyStream"),CW=(f,$,M,Y,J)=>{let z={method:f,headers:M,signal:J.signal};if(f==="TRACE"){z.method="GET";let Z=new t0($,z);return Object.defineProperty(Z,"method",{get(){return"TRACE"}}),Z}if(!(f==="GET"||f==="HEAD"))if("rawBody"in Y&&Y.rawBody instanceof Buffer)z.body=new ReadableStream({start(Z){Z.enqueue(Y.rawBody),Z.close()}});else if(Y[Q6]){let Z;z.body=new ReadableStream({async pull(X){try{Z||=Z6.toWeb(Y).getReader();let{done:Q,value:D}=await Z.read();if(Q)X.close();else X.enqueue(D)}catch(Q){X.error(Q)}}})}else z.body=Z6.toWeb(Y);return new t0($,z)},N0=Symbol("getRequestCache"),EW=Symbol("requestCache"),rf=Symbol("incomingKey"),pf=Symbol("urlKey"),xW=Symbol("headersKey"),R0=Symbol("abortControllerKey"),yW=Symbol("getAbortController"),of={get method(){return this[rf].method||"GET"},get url(){return this[pf]},get headers(){return this[xW]||=IW(this[rf])},[yW](){return this[N0](),this[R0]},[N0](){return this[R0]||=new AbortController,this[EW]||=CW(this.method,this[pf],this.headers,this[rf],this[R0])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach((f)=>{Object.defineProperty(of,f,{get(){return this[N0]()[f]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach((f)=>{Object.defineProperty(of,f,{value:function(){return this[N0]()[f]()}})});Object.setPrototypeOf(of,t0.prototype);var kW=(f,$)=>{let M=Object.create(of);M[rf]=f;let Y=f.url||"";if(Y[0]!=="/"&&(Y.startsWith("http://")||Y.startsWith("https://"))){if(f instanceof F2)throw new s1("Absolute URL for :path is not allowed in HTTP/2");try{let X=new URL(Y);M[pf]=X.href}catch(X){throw new s1("Invalid absolute URL",{cause:X})}return M}let J=(f instanceof F2?f.authority:f.headers.host)||$;if(!J)throw new s1("Missing host header");let z;if(f instanceof F2){if(z=f.scheme,!(z==="http"||z==="https"))throw new s1("Unsupported scheme")}else z=f.socket&&f.socket.encrypted?"https":"http";let Z=new URL(`${z}://${J}${Y}`);if(Z.hostname.length!==J.length&&Z.hostname!==J.replace(/:\d+$/,""))throw new s1("Invalid host header");return M[pf]=Z.href,M},X6=Symbol("responseCache"),F0=Symbol("getResponseCache"),a1=Symbol("cache"),N2=global.Response,e0=class f{#$;#f;[F0](){return delete this[a1],this[X6]||=new N2(this.#$,this.#f)}constructor($,M){let Y;if(this.#$=$,M instanceof f){let J=M[X6];if(J){this.#f=J,this[F0]();return}else this.#f=M.#f,Y=new Headers(M.#f.headers)}else this.#f=M;if(typeof $==="string"||typeof $?.getReader<"u"||$ instanceof Blob||$ instanceof Uint8Array)Y||=M?.headers||{"content-type":"text/plain; charset=UTF-8"},this[a1]=[M?.status||200,$,Y]}get headers(){let $=this[a1];if($){if(!($[2]instanceof Headers))$[2]=new Headers($[2]);return $[2]}return this[F0]().headers}get status(){return this[a1]?.[0]??this[F0]().status}get ok(){let $=this.status;return $>=200&&$<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach((f)=>{Object.defineProperty(e0.prototype,f,{get(){return this[F0]()[f]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach((f)=>{Object.defineProperty(e0.prototype,f,{value:function(){return this[F0]()[f]()}})});Object.setPrototypeOf(e0,N2);Object.setPrototypeOf(e0.prototype,N2.prototype);async function bW(f){return Promise.race([f,Promise.resolve().then(()=>Promise.resolve(void 0))])}function D6(f,$,M){let Y=(X)=>{f.cancel(X).catch(()=>{})};return $.on("close",Y),$.on("error",Y),(M??f.read()).then(Z,J),f.closed.finally(()=>{$.off("close",Y),$.off("error",Y)});function J(X){if(X)$.destroy(X)}function z(){f.read().then(Z,J)}function Z({done:X,value:Q}){try{if(X)$.end();else if(!$.write(Q))$.once("drain",z);else return f.read().then(Z,J)}catch(D){J(D)}}}function _W(f,$){if(f.locked)throw TypeError("ReadableStream is locked.");else if($.destroyed)return;return D6(f.getReader(),$)}var G6=(f)=>{let $={};if(!(f instanceof Headers))f=new Headers(f??void 0);let M=[];for(let[Y,J]of f)if(Y==="set-cookie")M.push(J);else $[Y]=J;if(M.length>0)$["set-cookie"]=M;return $["content-type"]??="text/plain; charset=UTF-8",$},vW="x-hono-already-sent";if(typeof global.crypto>"u")global.crypto=uW;var O2=Symbol("outgoingEnded"),hW=()=>new Response(null,{status:400}),U6=(f)=>new Response(null,{status:f instanceof Error&&(f.name==="TimeoutError"||f.constructor.name==="TimeoutError")?504:500}),R2=(f,$)=>{let M=f instanceof Error?f:Error("unknown error",{cause:f});if(M.code==="ERR_STREAM_PREMATURE_CLOSE")console.info("The user aborted a request.");else{if(console.error(f),!$.headersSent)$.writeHead(500,{"Content-Type":"text/plain"});$.end(`Error: ${M.message}`),$.destroy(M)}},W6=(f)=>{if("flushHeaders"in f&&f.writable)f.flushHeaders()},K6=async(f,$)=>{let[M,Y,J]=f[a1];if(J instanceof Headers)J=G6(J);if(typeof Y==="string")J["Content-Length"]=Buffer.byteLength(Y);else if(Y instanceof Uint8Array)J["Content-Length"]=Y.byteLength;else if(Y instanceof Blob)J["Content-Length"]=Y.size;if($.writeHead(M,J),typeof Y==="string"||Y instanceof Uint8Array)$.end(Y);else if(Y instanceof Blob)$.end(new Uint8Array(await Y.arrayBuffer()));else W6($),await _W(Y,$)?.catch((z)=>R2(z,$));$[O2]?.()},gW=(f)=>typeof f.then==="function",cW=async(f,$,M={})=>{if(gW(f))if(M.errorHandler)try{f=await f}catch(J){let z=await M.errorHandler(J);if(!z)return;f=z}else f=await f.catch(U6);if(a1 in f)return K6(f,$);let Y=G6(f.headers);if(f.body){let J=f.body.getReader(),z=[],Z=!1,X=void 0;if(Y["transfer-encoding"]!=="chunked"){let Q=2;for(let D=0;D<Q;D++){X||=J.read();let G=await bW(X).catch((U)=>{console.error(U),Z=!0});if(!G){if(D===1){await new Promise((U)=>setTimeout(U)),Q=3;continue}break}if(X=void 0,G.value)z.push(G.value);if(G.done){Z=!0;break}}if(Z&&!("content-length"in Y))Y["content-length"]=z.reduce((D,G)=>D+G.length,0)}if($.writeHead(f.status,Y),z.forEach((Q)=>{$.write(Q)}),Z)$.end();else{if(z.length===0)W6($);await D6(J,$,X)}}else if(Y[vW]);else $.writeHead(f.status,Y),$.end();$[O2]?.()},mW=(f,$={})=>{let M=$.autoCleanupIncoming??!0;if($.overrideGlobalObjects!==!1&&global.Request!==t0)Object.defineProperty(global,"Request",{value:t0}),Object.defineProperty(global,"Response",{value:e0});return async(Y,J)=>{let z,Z;try{Z=kW(Y,$.hostname);let X=!M||Y.method==="GET"||Y.method==="HEAD";if(!X){if(Y[Q6]=!0,Y.on("end",()=>{X=!0}),Y instanceof TW)J[O2]=()=>{if(!X)setTimeout(()=>{if(!X)setTimeout(()=>{Y.destroy(),J.destroy()})})}}if(J.on("close",()=>{if(Z[R0]){if(Y.errored)Z[R0].abort(Y.errored.toString());else if(!J.writableFinished)Z[R0].abort("Client connection prematurely closed.")}if(!X)setTimeout(()=>{if(!X)setTimeout(()=>{Y.destroy()})})}),z=f(Z,{incoming:Y,outgoing:J}),a1 in z)return K6(z,J)}catch(X){if(!z)if($.errorHandler){if(z=await $.errorHandler(Z?X:wW(X)),!z)return}else if(!Z)z=hW();else z=U6(X);else return R2(X,J)}try{return await cW(z,J,$)}catch(X){return R2(X,J)}}},dW=(f)=>{let $=f.fetch,M=mW($,{hostname:f.hostname,overrideGlobalObjects:f.overrideGlobalObjects,autoCleanupIncoming:f.autoCleanupIncoming});return(f.createServer||PW)(f.serverOptions||{},M)},V6=(f,$)=>{let M=dW(f);return M.listen(f?.port??3000,f.hostname,()=>{let Y=M.address();$&&$(Y)}),M};var q6=(f,$=nW)=>{let M=/\.([a-zA-Z0-9]+?)$/,Y=f.match(M);if(!Y)return;let J=$[Y[1]];if(J&&J.startsWith("text"))J+="; charset=utf-8";return J};var lW={aac:"audio/aac",avi:"video/x-msvideo",avif:"image/avif",av1:"video/av1",bin:"application/octet-stream",bmp:"image/bmp",css:"text/css",csv:"text/csv",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gif:"image/gif",gz:"application/gzip",htm:"text/html",html:"text/html",ico:"image/x-icon",ics:"text/calendar",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript",json:"application/json",jsonld:"application/ld+json",map:"application/json",mid:"audio/x-midi",midi:"audio/x-midi",mjs:"text/javascript",mp3:"audio/mpeg",mp4:"video/mp4",mpeg:"video/mpeg",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",opus:"audio/opus",otf:"font/otf",pdf:"application/pdf",png:"image/png",rtf:"application/rtf",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",ts:"video/mp2t",ttf:"font/ttf",txt:"text/plain",wasm:"application/wasm",webm:"video/webm",weba:"audio/webm",webmanifest:"application/manifest+json",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xml:"application/xml",zip:"application/zip","3gp":"video/3gpp","3g2":"video/3gpp2",gltf:"model/gltf+json",glb:"model/gltf-binary"},nW=lW;import{createReadStream as B6,statSync as rW,existsSync as pW}from"fs";import{join as H6}from"path";import{versions as iW}from"process";import{Readable as oW}from"stream";var sW=/^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i,L2={br:".br",zstd:".zst",gzip:".gz"},aW=Object.keys(L2),tW=()=>{let[f,$]=iW.node.split(".").map((M)=>parseInt(M));return f>=23||f===22&&$>=7||f===20&&$>=18},eW=tW(),S6=(f)=>{if(eW)return oW.toWeb(f);return new ReadableStream({start(M){f.on("data",(Y)=>{M.enqueue(Y)}),f.on("error",(Y)=>{M.error(Y)}),f.on("end",()=>{M.close()})},cancel(){f.destroy()}})},A2=(f)=>{let $;try{$=rW(f)}catch{}return $},P2=(f={root:""})=>{let $=f.root||"",M=f.path;if($!==""&&!pW($))console.error(`serveStatic: root path '${$}' is not found, are you sure it's correct?`);return async(Y,J)=>{if(Y.finalized)return J();let z;if(M)z=M;else try{if(z=decodeURIComponent(Y.req.path),/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(z))throw Error()}catch{return await f.onNotFound?.(Y.req.path,Y),J()}let Z=H6($,!M&&f.rewriteRequestPath?f.rewriteRequestPath(z,Y):z),X=A2(Z);if(X&&X.isDirectory()){let K=f.index??"index.html";Z=H6(Z,K),X=A2(Z)}if(!X)return await f.onNotFound?.(Z,Y),J();let Q=q6(Z);if(Y.header("Content-Type",Q||"application/octet-stream"),f.precompressed&&(!Q||sW.test(Q))){let K=new Set(Y.req.header("Accept-Encoding")?.split(",").map((W)=>W.trim()));for(let W of aW){if(!K.has(W))continue;let B=A2(Z+L2[W]);if(B){Y.header("Content-Encoding",W),Y.header("Vary","Accept-Encoding",{append:!0}),X=B,Z=Z+L2[W];break}}}let D,G=X.size,U=Y.req.header("range")||"";if(Y.req.method=="HEAD"||Y.req.method=="OPTIONS")Y.header("Content-Length",G.toString()),Y.status(200),D=Y.body(null);else if(!U)Y.header("Content-Length",G.toString()),D=Y.body(S6(B6(Z)),200);else{Y.header("Accept-Ranges","bytes"),Y.header("Date",X.birthtime.toUTCString());let K=U.replace(/bytes=/,"").split("-",2),W=parseInt(K[0],10)||0,B=parseInt(K[1],10)||G-1;if(G<B-W+1)B=G-1;let O=B-W+1,F=B6(Z,{start:W,end:B});Y.header("Content-Length",O.toString()),Y.header("Content-Range",`bytes ${W}-${B}/${X.size}`),D=Y.body(S6(F),206)}return await f.onFound?.(Z,Y),D}};var T2=(f,$,M)=>{return(Y,J)=>{let z=-1;return Z(0);async function Z(X){if(X<=z)throw Error("next() called multiple times");z=X;let Q,D=!1,G;if(f[X])G=f[X][0][0],Y.req.routeIndex=X;else G=X===f.length&&J||void 0;if(G)try{Q=await G(Y,()=>Z(X+1))}catch(U){if(U instanceof Error&&$)Y.error=U,Q=await $(U,Y),D=!0;else throw U}else if(Y.finalized===!1&&M)Q=await M(Y);if(Q&&(Y.finalized===!1||D))Y.res=Q;return Y}}};var F6=Symbol();var R6=async(f,$=Object.create(null))=>{let{all:M=!1,dot:Y=!1}=$,z=(f instanceof sf?f.raw.headers:f.headers).get("Content-Type");if(z?.startsWith("multipart/form-data")||z?.startsWith("application/x-www-form-urlencoded"))return fK(f,{all:M,dot:Y});return{}};async function fK(f,$){let M=await f.formData();if(M)return $K(M,$);return{}}function $K(f,$){let M=Object.create(null);if(f.forEach((Y,J)=>{if(!($.all||J.endsWith("[]")))M[J]=Y;else MK(M,J,Y)}),$.dot)Object.entries(M).forEach(([Y,J])=>{if(Y.includes("."))YK(M,Y,J),delete M[Y]});return M}var MK=(f,$,M)=>{if(f[$]!==void 0)if(Array.isArray(f[$]))f[$].push(M);else f[$]=[f[$],M];else if(!$.endsWith("[]"))f[$]=M;else f[$]=[M]},YK=(f,$,M)=>{let Y=f,J=$.split(".");J.forEach((z,Z)=>{if(Z===J.length-1)Y[z]=M;else{if(!Y[z]||typeof Y[z]!=="object"||Array.isArray(Y[z])||Y[z]instanceof File)Y[z]=Object.create(null);Y=Y[z]}})};var j2=(f)=>{let $=f.split("/");if($[0]==="")$.shift();return $},N6=(f)=>{let{groups:$,path:M}=JK(f),Y=j2(M);return zK(Y,$)},JK=(f)=>{let $=[];return f=f.replace(/\{[^}]+\}/g,(M,Y)=>{let J=`@${Y}`;return $.push([J,M]),J}),{groups:$,path:f}},zK=(f,$)=>{for(let M=$.length-1;M>=0;M--){let[Y]=$[M];for(let J=f.length-1;J>=0;J--)if(f[J].includes(Y)){f[J]=f[J].replace(Y,$[M][1]);break}}return f},af={},O6=(f,$)=>{if(f==="*")return"*";let M=f.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(M){let Y=`${f}#${$}`;if(!af[Y])if(M[2])af[Y]=$&&$[0]!==":"&&$[0]!=="*"?[Y,M[1],new RegExp(`^${M[2]}(?=/${$})`)]:[f,M[1],new RegExp(`^${M[2]}$`)];else af[Y]=[f,M[1],!0];return af[Y]}return null},tf=(f,$)=>{try{return $(f)}catch{return f.replace(/(?:%[0-9A-Fa-f]{2})+/g,(M)=>{try{return $(M)}catch{return M}})}},ZK=(f)=>tf(f,decodeURI),I2=(f)=>{let $=f.url,M=$.indexOf("/",$.indexOf(":")+4),Y=M;for(;Y<$.length;Y++){let J=$.charCodeAt(Y);if(J===37){let z=$.indexOf("?",Y),Z=$.indexOf("#",Y),X=z===-1?Z===-1?void 0:Z:Z===-1?z:Math.min(z,Z),Q=$.slice(M,X);return ZK(Q.includes("%25")?Q.replace(/%25/g,"%2525"):Q)}else if(J===63||J===35)break}return $.slice(M,Y)};var A6=(f)=>{let $=I2(f);return $.length>1&&$.at(-1)==="/"?$.slice(0,-1):$},t1=(f,$,...M)=>{if(M.length)$=t1($,...M);return`${f?.[0]==="/"?"":"/"}${f}${$==="/"?"":`${f?.at(-1)==="/"?"":"/"}${$?.[0]==="/"?$.slice(1):$}`}`},ef=(f)=>{if(f.charCodeAt(f.length-1)!==63||!f.includes(":"))return null;let $=f.split("/"),M=[],Y="";return $.forEach((J)=>{if(J!==""&&!/\:/.test(J))Y+="/"+J;else if(/\:/.test(J))if(/\?/.test(J)){if(M.length===0&&Y==="")M.push("/");else M.push(Y);let z=J.replace("?","");Y+="/"+z,M.push(Y)}else Y+="/"+J}),M.filter((J,z,Z)=>Z.indexOf(J)===z)},w2=(f)=>{if(!/[%+]/.test(f))return f;if(f.indexOf("+")!==-1)f=f.replace(/\+/g," ");return f.indexOf("%")!==-1?tf(f,C2):f},L6=(f,$,M)=>{let Y;if(!M&&$&&!/[%+]/.test($)){let Z=f.indexOf("?",8);if(Z===-1)return;if(!f.startsWith($,Z+1))Z=f.indexOf(`&${$}`,Z+1);while(Z!==-1){let X=f.charCodeAt(Z+$.length+1);if(X===61){let Q=Z+$.length+2,D=f.indexOf("&",Q);return w2(f.slice(Q,D===-1?void 0:D))}else if(X==38||isNaN(X))return"";Z=f.indexOf(`&${$}`,Z+1)}if(Y=/[%+]/.test(f),!Y)return}let J={};Y??=/[%+]/.test(f);let z=f.indexOf("?",8);while(z!==-1){let Z=f.indexOf("&",z+1),X=f.indexOf("=",z);if(X>Z&&Z!==-1)X=-1;let Q=f.slice(z+1,X===-1?Z===-1?void 0:Z:X);if(Y)Q=w2(Q);if(z=Z,Q==="")continue;let D;if(X===-1)D="";else if(D=f.slice(X+1,Z===-1?void 0:Z),Y)D=w2(D);if(M){if(!(J[Q]&&Array.isArray(J[Q])))J[Q]=[];J[Q].push(D)}else J[Q]??=D}return $?J[$]:J},P6=L6,T6=(f,$)=>{return L6(f,$,!0)},C2=decodeURIComponent;var w6=(f)=>tf(f,C2),sf=class{raw;#$;#f;routeIndex=0;path;bodyCache={};constructor(f,$="/",M=[[]]){this.raw=f,this.path=$,this.#f=M,this.#$={}}param(f){return f?this.#M(f):this.#z()}#M(f){let $=this.#f[0][this.routeIndex][1][f],M=this.#J($);return M&&/\%/.test(M)?w6(M):M}#z(){let f={},$=Object.keys(this.#f[0][this.routeIndex][1]);for(let M of $){let Y=this.#J(this.#f[0][this.routeIndex][1][M]);if(Y!==void 0)f[M]=/\%/.test(Y)?w6(Y):Y}return f}#J(f){return this.#f[1]?this.#f[1][f]:f}query(f){return P6(this.url,f)}queries(f){return T6(this.url,f)}header(f){if(f)return this.raw.headers.get(f)??void 0;let $={};return this.raw.headers.forEach((M,Y)=>{$[Y]=M}),$}async parseBody(f){return this.bodyCache.parsedBody??=await R6(this,f)}#Y=(f)=>{let{bodyCache:$,raw:M}=this,Y=$[f];if(Y)return Y;let J=Object.keys($)[0];if(J)return $[J].then((z)=>{if(J==="json")z=JSON.stringify(z);return new Response(z)[f]()});return $[f]=M[f]()};json(){return this.#Y("text").then((f)=>JSON.parse(f))}text(){return this.#Y("text")}arrayBuffer(){return this.#Y("arrayBuffer")}blob(){return this.#Y("blob")}formData(){return this.#Y("formData")}addValidatedData(f,$){this.#$[f]=$}valid(f){return this.#$[f]}get url(){return this.raw.url}get method(){return this.raw.method}get[F6](){return this.#f}get matchedRoutes(){return this.#f[0].map(([[,f]])=>f)}get routePath(){return this.#f[0].map(([[,f]])=>f)[this.routeIndex].path}};var j6={Stringify:1,BeforeStream:2,Stream:3},XK=(f,$)=>{let M=new String(f);return M.isEscaped=!0,M.callbacks=$,M};var E2=async(f,$,M,Y,J)=>{if(typeof f==="object"&&!(f instanceof String)){if(!(f instanceof Promise))f=f.toString();if(f instanceof Promise)f=await f}let z=f.callbacks;if(!z?.length)return Promise.resolve(f);if(J)J[0]+=f;else J=[f];let Z=Promise.all(z.map((X)=>X({phase:$,buffer:J,context:Y}))).then((X)=>Promise.all(X.filter(Boolean).map((Q)=>E2(Q,$,!1,Y,J))).then(()=>J[0]));if(M)return XK(await Z,z);else return Z};var QK="text/plain; charset=UTF-8",x2=(f,$)=>{return{"Content-Type":f,...$}},O0=(f,$)=>new Response(f,$),I6=class{#$;#f;env={};#M;finalized=!1;error;#z;#J;#Y;#G;#Q;#D;#X;#U;#W;constructor(f,$){if(this.#$=f,$)this.#J=$.executionCtx,this.env=$.env,this.#D=$.notFoundHandler,this.#W=$.path,this.#U=$.matchResult}get req(){return this.#f??=new sf(this.#$,this.#W,this.#U),this.#f}get event(){if(this.#J&&"respondWith"in this.#J)return this.#J;else throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#J)return this.#J;else throw Error("This context has no ExecutionContext")}get res(){return this.#Y||=O0(null,{headers:this.#X??=new Headers})}set res(f){if(this.#Y&&f){f=O0(f.body,f);for(let[$,M]of this.#Y.headers.entries()){if($==="content-type")continue;if($==="set-cookie"){let Y=this.#Y.headers.getSetCookie();f.headers.delete("set-cookie");for(let J of Y)f.headers.append("set-cookie",J)}else f.headers.set($,M)}}this.#Y=f,this.finalized=!0}render=(...f)=>{return this.#Q??=($)=>this.html($),this.#Q(...f)};setLayout=(f)=>this.#G=f;getLayout=()=>this.#G;setRenderer=(f)=>{this.#Q=f};header=(f,$,M)=>{if(this.finalized)this.#Y=O0(this.#Y.body,this.#Y);let Y=this.#Y?this.#Y.headers:this.#X??=new Headers;if($===void 0)Y.delete(f);else if(M?.append)Y.append(f,$);else Y.set(f,$)};status=(f)=>{this.#z=f};set=(f,$)=>{this.#M??=new Map,this.#M.set(f,$)};get=(f)=>{return this.#M?this.#M.get(f):void 0};get var(){if(!this.#M)return{};return Object.fromEntries(this.#M)}#Z(f,$,M){let Y=this.#Y?new Headers(this.#Y.headers):this.#X??new Headers;if(typeof $==="object"&&"headers"in $){let z=$.headers instanceof Headers?$.headers:new Headers($.headers);for(let[Z,X]of z)if(Z.toLowerCase()==="set-cookie")Y.append(Z,X);else Y.set(Z,X)}if(M)for(let[z,Z]of Object.entries(M))if(typeof Z==="string")Y.set(z,Z);else{Y.delete(z);for(let X of Z)Y.append(z,X)}let J=typeof $==="number"?$:$?.status??this.#z;return O0(f,{status:J,headers:Y})}newResponse=(...f)=>this.#Z(...f);body=(f,$,M)=>this.#Z(f,$,M);#K(){return!this.#X&&!this.#z&&!this.finalized}text=(f,$,M)=>{return this.#K()&&!$&&!M?O0(f):this.#Z(f,$,x2(QK,M))};json=(f,$,M)=>{return this.#K()&&!$&&!M?Response.json(f):this.#Z(JSON.stringify(f),$,x2("application/json",M))};html=(f,$,M)=>{let Y=(J)=>this.#Z(J,$,x2("text/html; charset=UTF-8",M));return typeof f==="object"?E2(f,j6.Stringify,!1,{}).then(Y):Y(f)};redirect=(f,$)=>{let M=String(f);return this.header("Location",!/[^\x00-\xFF]/.test(M)?M:encodeURI(M)),this.newResponse(null,$??302)};notFound=()=>{return this.#D??=()=>O0(),this.#D(this)}};var I="ALL",C6="all",E6=["get","post","put","delete","options","patch"],f$="Can not add a route since the matcher is already built.",$$=class extends Error{};var x6="__COMPOSED_HANDLER";var DK=(f)=>{return f.text("404 Not Found",404)},y6=(f,$)=>{if("getResponse"in f){let M=f.getResponse();return $.newResponse(M.body,M)}return console.error(f),$.text("Internal Server Error",500)},k6=class f{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#$="/";routes=[];constructor($={}){[...E6,C6].forEach((z)=>{this[z]=(Z,...X)=>{if(typeof Z==="string")this.#$=Z;else this.#z(z,this.#$,Z);return X.forEach((Q)=>{this.#z(z,this.#$,Q)}),this}}),this.on=(z,Z,...X)=>{for(let Q of[Z].flat()){this.#$=Q;for(let D of[z].flat())X.map((G)=>{this.#z(D.toUpperCase(),this.#$,G)})}return this},this.use=(z,...Z)=>{if(typeof z==="string")this.#$=z;else this.#$="*",Z.unshift(z);return Z.forEach((X)=>{this.#z(I,this.#$,X)}),this};let{strict:Y,...J}=$;Object.assign(this,J),this.getPath=Y??!0?$.getPath??I2:A6}#f(){let $=new f({router:this.router,getPath:this.getPath});return $.errorHandler=this.errorHandler,$.#M=this.#M,$.routes=this.routes,$}#M=DK;errorHandler=y6;route($,M){let Y=this.basePath($);return M.routes.map((J)=>{let z;if(M.errorHandler===y6)z=J.handler;else z=async(Z,X)=>(await T2([],M.errorHandler)(Z,()=>J.handler(Z,X))).res,z[x6]=J.handler;Y.#z(J.method,J.path,z)}),this}basePath($){let M=this.#f();return M._basePath=t1(this._basePath,$),M}onError=($)=>{return this.errorHandler=$,this};notFound=($)=>{return this.#M=$,this};mount($,M,Y){let J,z;if(Y)if(typeof Y==="function")z=Y;else if(z=Y.optionHandler,Y.replaceRequest===!1)J=(Q)=>Q;else J=Y.replaceRequest;let Z=z?(Q)=>{let D=z(Q);return Array.isArray(D)?D:[D]}:(Q)=>{let D=void 0;try{D=Q.executionCtx}catch{}return[Q.env,D]};J||=(()=>{let Q=t1(this._basePath,$),D=Q==="/"?0:Q.length;return(G)=>{let U=new URL(G.url);return U.pathname=U.pathname.slice(D)||"/",new Request(U,G)}})();let X=async(Q,D)=>{let G=await M(J(Q.req.raw),...Z(Q));if(G)return G;await D()};return this.#z(I,t1($,"*"),X),this}#z($,M,Y){$=$.toUpperCase(),M=t1(this._basePath,M);let J={basePath:this._basePath,path:M,method:$,handler:Y};this.router.add($,M,[Y,J]),this.routes.push(J)}#J($,M){if($ instanceof Error)return this.errorHandler($,M);throw $}#Y($,M,Y,J){if(J==="HEAD")return(async()=>new Response(null,await this.#Y($,M,Y,"GET")))();let z=this.getPath($,{env:Y}),Z=this.router.match(J,z),X=new I6($,{path:z,matchResult:Z,env:Y,executionCtx:M,notFoundHandler:this.#M});if(Z[0].length===1){let D;try{D=Z[0][0][0][0](X,async()=>{X.res=await this.#M(X)})}catch(G){return this.#J(G,X)}return D instanceof Promise?D.then((G)=>G||(X.finalized?X.res:this.#M(X))).catch((G)=>this.#J(G,X)):D??this.#M(X)}let Q=T2(Z[0],this.errorHandler,this.#M);return(async()=>{try{let D=await Q(X);if(!D.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return D.res}catch(D){return this.#J(D,X)}})()}fetch=($,...M)=>{return this.#Y($,M[1],M[0],$.method)};request=($,M,Y,J)=>{if($ instanceof Request)return this.fetch(M?new Request($,M):$,Y,J);return $=$.toString(),this.fetch(new Request(/^https?:\/\//.test($)?$:`http://localhost${t1("/",$)}`,M),Y,J)};fire=()=>{addEventListener("fetch",($)=>{$.respondWith(this.#Y($.request,$,void 0,$.request.method))})}};var ff=[];function M$(f,$){let M=this.buildAllMatchers(),Y=(J,z)=>{let Z=M[J]||M[I],X=Z[2][z];if(X)return X;let Q=z.match(Z[0]);if(!Q)return[[],ff];let D=Q.indexOf("",1);return[Z[1][D],Q]};return this.match=Y,Y(f,$)}var Y$="[^/]+",$f=".*",Mf="(?:|/.*)",e1=Symbol(),GK=new Set(".\\+*[^]$()");function UK(f,$){if(f.length===1)return $.length===1?f<$?-1:1:-1;if($.length===1)return 1;if(f===$f||f===Mf)return 1;else if($===$f||$===Mf)return-1;if(f===Y$)return 1;else if($===Y$)return-1;return f.length===$.length?f<$?-1:1:$.length-f.length}var b6=class f{#$;#f;#M=Object.create(null);insert($,M,Y,J,z){if($.length===0){if(this.#$!==void 0)throw e1;if(z)return;this.#$=M;return}let[Z,...X]=$,Q=Z==="*"?X.length===0?["","",$f]:["","",Y$]:Z==="/*"?["","",Mf]:Z.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),D;if(Q){let G=Q[1],U=Q[2]||Y$;if(G&&Q[2]){if(U===".*")throw e1;if(U=U.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(U))throw e1}if(D=this.#M[U],!D){if(Object.keys(this.#M).some((K)=>K!==$f&&K!==Mf))throw e1;if(z)return;if(D=this.#M[U]=new f,G!=="")D.#f=J.varIndex++}if(!z&&G!=="")Y.push([G,D.#f])}else if(D=this.#M[Z],!D){if(Object.keys(this.#M).some((G)=>G.length>1&&G!==$f&&G!==Mf))throw e1;if(z)return;D=this.#M[Z]=new f}D.insert(X,M,Y,J,z)}buildRegExpStr(){let M=Object.keys(this.#M).sort(UK).map((Y)=>{let J=this.#M[Y];return(typeof J.#f==="number"?`(${Y})@${J.#f}`:GK.has(Y)?`\\${Y}`:Y)+J.buildRegExpStr()});if(typeof this.#$==="number")M.unshift(`#${this.#$}`);if(M.length===0)return"";if(M.length===1)return M[0];return"(?:"+M.join("|")+")"}};var _6=class{#$={varIndex:0};#f=new b6;insert(f,$,M){let Y=[],J=[];for(let Z=0;;){let X=!1;if(f=f.replace(/\{[^}]+\}/g,(Q)=>{let D=`@\\${Z}`;return J[Z]=[D,Q],Z++,X=!0,D}),!X)break}let z=f.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let Z=J.length-1;Z>=0;Z--){let[X]=J[Z];for(let Q=z.length-1;Q>=0;Q--)if(z[Q].indexOf(X)!==-1){z[Q]=z[Q].replace(X,J[Z][1]);break}}return this.#f.insert(z,$,Y,this.#$,M),Y}buildRegExp(){let f=this.#f.buildRegExpStr();if(f==="")return[/^$/,[],[]];let $=0,M=[],Y=[];return f=f.replace(/#(\d+)|@(\d+)|\.\*\$/g,(J,z,Z)=>{if(z!==void 0)return M[++$]=Number(z),"$()";if(Z!==void 0)return Y[Number(Z)]=++$,"";return""}),[new RegExp(`^${f}`),M,Y]}};var WK=[/^$/,[],Object.create(null)],v6=Object.create(null);function u6(f){return v6[f]??=new RegExp(f==="*"?"":`^${f.replace(/\/\*$|([.\\+*[^\]$()])/g,($,M)=>M?`\\${M}`:"(?:|/.*)")}$`)}function KK(){v6=Object.create(null)}function VK(f){let $=new _6,M=[];if(f.length===0)return WK;let Y=f.map((D)=>[!/\*|\/:/.test(D[0]),...D]).sort(([D,G],[U,K])=>D?1:U?-1:G.length-K.length),J=Object.create(null);for(let D=0,G=-1,U=Y.length;D<U;D++){let[K,W,B]=Y[D];if(K)J[W]=[B.map(([F])=>[F,Object.create(null)]),ff];else G++;let O;try{O=$.insert(W,G,K)}catch(F){throw F===e1?new $$(W):F}if(K)continue;M[G]=B.map(([F,T])=>{let c=Object.create(null);T-=1;for(;T>=0;T--){let[r,J1]=O[T];c[r]=J1}return[F,c]})}let[z,Z,X]=$.buildRegExp();for(let D=0,G=M.length;D<G;D++)for(let U=0,K=M[D].length;U<K;U++){let W=M[D][U]?.[1];if(!W)continue;let B=Object.keys(W);for(let O=0,F=B.length;O<F;O++)W[B[O]]=X[W[B[O]]]}let Q=[];for(let D in Z)Q[D]=M[Z[D]];return[z,Q,J]}function A0(f,$){if(!f)return;for(let M of Object.keys(f).sort((Y,J)=>J.length-Y.length))if(u6(M).test($))return[...f[M]];return}var J$=class{name="RegExpRouter";#$;#f;constructor(){this.#$={[I]:Object.create(null)},this.#f={[I]:Object.create(null)}}add(f,$,M){let Y=this.#$,J=this.#f;if(!Y||!J)throw Error(f$);if(!Y[f])[Y,J].forEach((X)=>{X[f]=Object.create(null),Object.keys(X[I]).forEach((Q)=>{X[f][Q]=[...X[I][Q]]})});if($==="/*")$="*";let z=($.match(/\/:/g)||[]).length;if(/\*$/.test($)){let X=u6($);if(f===I)Object.keys(Y).forEach((Q)=>{Y[Q][$]||=A0(Y[Q],$)||A0(Y[I],$)||[]});else Y[f][$]||=A0(Y[f],$)||A0(Y[I],$)||[];Object.keys(Y).forEach((Q)=>{if(f===I||f===Q)Object.keys(Y[Q]).forEach((D)=>{X.test(D)&&Y[Q][D].push([M,z])})}),Object.keys(J).forEach((Q)=>{if(f===I||f===Q)Object.keys(J[Q]).forEach((D)=>X.test(D)&&J[Q][D].push([M,z]))});return}let Z=ef($)||[$];for(let X=0,Q=Z.length;X<Q;X++){let D=Z[X];Object.keys(J).forEach((G)=>{if(f===I||f===G)J[G][D]||=[...A0(Y[G],D)||A0(Y[I],D)||[]],J[G][D].push([M,z-Q+X+1])})}}match=M$;buildAllMatchers(){let f=Object.create(null);return Object.keys(this.#f).concat(Object.keys(this.#$)).forEach(($)=>{f[$]||=this.#M($)}),this.#$=this.#f=void 0,KK(),f}#M(f){let $=[],M=f===I;if([this.#$,this.#f].forEach((Y)=>{let J=Y[f]?Object.keys(Y[f]).map((z)=>[z,Y[f][z]]):[];if(J.length!==0)M||=!0,$.push(...J);else if(f!==I)$.push(...Object.keys(Y[I]).map((z)=>[z,Y[I][z]]))}),!M)return null;else return VK($)}};var qK=class{name="PreparedRegExpRouter";#$;#f;constructor(f,$){this.#$=f,this.#f=$}#M(f,$){let M=this.#$[f];M[1].forEach((Y)=>Y&&Y.push($)),Object.values(M[2]).forEach((Y)=>Y[0].push($))}#z(f,$,M,Y,J){let z=this.#$[f];if(!J)z[2][$][0].push([M,{}]);else Y.forEach((Z)=>{if(typeof Z==="number")z[1][Z].push([M,J]);else z[2][Z||$][0].push([M,J])})}add(f,$,M){if(!this.#$[f]){let J=this.#$[I],z={};for(let Z in J[2])z[Z]=[J[2][Z][0].slice(),ff];this.#$[f]=[J[0],J[1].map((Z)=>Array.isArray(Z)?Z.slice():0),z]}if($==="/*"||$==="*"){let J=[M,{}];if(f===I)for(let z in this.#$)this.#M(z,J);else this.#M(f,J);return}let Y=this.#f[$];if(!Y)throw Error(`Path ${$} is not registered`);for(let[J,z]of Y)if(f===I)for(let Z in this.#$)this.#z(Z,$,M,J,z);else this.#z(f,$,M,J,z)}buildAllMatchers(){return this.#$}match=M$};var y2=class{name="SmartRouter";#$=[];#f=[];constructor(f){this.#$=f.routers}add(f,$,M){if(!this.#f)throw Error(f$);this.#f.push([f,$,M])}match(f,$){if(!this.#f)throw Error("Fatal error");let M=this.#$,Y=this.#f,J=M.length,z=0,Z;for(;z<J;z++){let X=M[z];try{for(let Q=0,D=Y.length;Q<D;Q++)X.add(...Y[Q]);Z=X.match(f,$)}catch(Q){if(Q instanceof $$)continue;throw Q}this.match=X.match.bind(X),this.#$=[X],this.#f=void 0;break}if(z===J)throw Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,Z}get activeRouter(){if(this.#f||this.#$.length!==1)throw Error("No active router has been determined yet.");return this.#$[0]}};var Yf=Object.create(null),BK=(f)=>{for(let $ in f)return!0;return!1},h6=class f{#$;#f;#M;#z=0;#J=Yf;constructor($,M,Y){if(this.#f=Y||Object.create(null),this.#$=[],$&&M){let J=Object.create(null);J[$]={handler:M,possibleKeys:[],score:0},this.#$=[J]}this.#M=[]}insert($,M,Y){this.#z=++this.#z;let J=this,z=N6(M),Z=[];for(let X=0,Q=z.length;X<Q;X++){let D=z[X],G=z[X+1],U=O6(D,G),K=Array.isArray(U)?U[0]:D;if(K in J.#f){if(J=J.#f[K],U)Z.push(U[1]);continue}if(J.#f[K]=new f,U)J.#M.push(U),Z.push(U[1]);J=J.#f[K]}return J.#$.push({[$]:{handler:Y,possibleKeys:Z.filter((X,Q,D)=>D.indexOf(X)===Q),score:this.#z}}),J}#Y($,M,Y,J,z){for(let Z=0,X=M.#$.length;Z<X;Z++){let Q=M.#$[Z],D=Q[Y]||Q[I],G={};if(D!==void 0){if(D.params=Object.create(null),$.push(D),J!==Yf||z&&z!==Yf)for(let U=0,K=D.possibleKeys.length;U<K;U++){let W=D.possibleKeys[U],B=G[D.score];D.params[W]=z?.[W]&&!B?z[W]:J[W]??z?.[W],G[D.score]=!0}}}}search($,M){let Y=[];this.#J=Yf;let z=[this],Z=j2(M),X=[],Q=Z.length,D=null;for(let G=0;G<Q;G++){let U=Z[G],K=G===Q-1,W=[];for(let O=0,F=z.length;O<F;O++){let T=z[O],c=T.#f[U];if(c)if(c.#J=T.#J,K){if(c.#f["*"])this.#Y(Y,c.#f["*"],$,T.#J);this.#Y(Y,c,$,T.#J)}else W.push(c);for(let r=0,J1=T.#M.length;r<J1;r++){let L0=T.#M[r],$1=T.#J===Yf?{}:{...T.#J};if(L0==="*"){let H1=T.#f["*"];if(H1)this.#Y(Y,H1,$,T.#J),H1.#J=$1,W.push(H1);continue}let[f0,_,w]=L0;if(!U&&!(w instanceof RegExp))continue;let p=T.#f[f0];if(w instanceof RegExp){if(D===null){D=Array(Q);let H=M[0]==="/"?1:0;for(let q=0;q<Q;q++)D[q]=H,H+=Z[q].length+1}let H1=M.substring(D[G]),A=w.exec(H1);if(A){if($1[_]=A[0],this.#Y(Y,p,$,T.#J,$1),BK(p.#f)){p.#J=$1;let H=A[0].match(/\//)?.length??0;(X[H]||=[]).push(p)}continue}}if(w===!0||w.test(U))if($1[_]=U,K){if(this.#Y(Y,p,$,$1,T.#J),p.#f["*"])this.#Y(Y,p.#f["*"],$,$1,T.#J)}else p.#J=$1,W.push(p)}}let B=X.shift();z=B?W.concat(B):W}if(Y.length>1)Y.sort((G,U)=>{return G.score-U.score});return[Y.map(({handler:G,params:U})=>[G,U])]}};var k2=class{name="TrieRouter";#$;constructor(){this.#$=new h6}add(f,$,M){let Y=ef($);if(Y){for(let J=0,z=Y.length;J<z;J++)this.#$.insert(f,Y[J],M);return}this.#$.insert(f,$,M)}match(f,$){return this.#$.search(f,$)}};var f1=class extends k6{constructor(f={}){super(f);this.router=f.router??new y2({routers:[new J$,new k2]})}};function n(f,$){return f.json({code:1,data:$,msg:""})}function X1(f,$){return f.json({code:-1,data:null,msg:$})}function g6(f){return async($)=>{let M=await $.req.json(),Y=await f.addAlias(M);if(!Y.success)return X1($,Y.error);return n($,Y.data)}}function c6(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=await f.getChildren(M);return n($,Y)}}function m6(f){return async($)=>{let M=$.req.query("domain"),Y=await f.getAllMemories({domain:M,includeDeleted:!0});return n($,Y)}}function d6(f){return async($)=>{let M=$.req.query("uri"),Y=$.req.query("domain"),J=await f.getRelationships({uri:M,domain:Y});return n($,J)}}function l6(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=$.req.query("includeDeleted")==="true";try{let J=await f.getMemory(M,{includeDeleted:Y});if(!J)return X1($,"Memory not found");return n($,J)}catch(J){return X1($,J instanceof Error?J.message:String(J))}}}function n6(f){return async($)=>{let M=await $.req.json();try{let Y=await f.createMemory(M);return n($,Y)}catch(Y){return X1($,Y instanceof Error?Y.message:String(Y))}}}function r6(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=await $.req.json();try{let J=await f.updateMemory({...Y,uri:M});return n($,J)}catch(J){return X1($,J instanceof Error?J.message:String(J))}}}function p6(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=$.req.query("recursive")==="true",J=$.req.query("permanent")==="true";try{return await f.deleteMemory(M,{recursive:Y,permanent:J}),n($,null)}catch(z){return X1($,z instanceof Error?z.message:String(z))}}}function i6(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??"");try{let Y=await f.restoreMemory(M);return n($,Y)}catch(Y){return X1($,Y instanceof Error?Y.message:String(Y))}}}function o6(f){return async($)=>{let M=$.req.query("q")??"",Y=$.req.query("domain"),J=$.req.query("limit")?Number.parseInt($.req.query("limit"),10):10;if(!M)return X1($,"Query parameter 'q' is required");let z=await f.searchMemory(M,{query:M,domain:Y,limit:J});return n($,z)}}function s6(f){let $=new f1().basePath("/alias");return $.post("/",g6(f)),$}function a6(f){let $=new f1().basePath("/children");return $.get("/:uri",c6(f)),$}function t6(f){let $=new f1().basePath("/graph");return $.get("/nodes",m6(f)),$.get("/relationships",d6(f)),$}function e6(f){let $=new f1().basePath("/memories");return $.get("/:uri",l6(f)),$.post("/",n6(f)),$.put("/:uri",r6(f)),$.delete("/:uri",p6(f)),$.post("/:uri/restore",i6(f)),$}function f8(f){let $=new f1().basePath("/search");return $.get("/",o6(f)),$}function $8(f,$){let M=f.basePath("/api");M.route("/",e6($)),M.route("/",f8($)),M.route("/",a6($)),M.route("/",t6($)),M.route("/",s6($))}var __dirname="/home/runner/work/hippo-memo/hippo-memo/packages/cli/src/api";function HK(f){let $=new f1,M=process.env.WEB_DIST||M8(__dirname,"../../dist");return $8($,f),$.get("/*",P2({root:M})),$.get("*",P2({path:M8(M,"index.html")})),$}async function Y8(f,$){let M=HK(f);V6({fetch:M.fetch,port:$}),console.log(`Hippo web server started on http://localhost:${$}`),console.log("Press Ctrl+C to stop")}async function J8(f,$,M){let Y=V0(f),J=K0({type:M,config:Y});await Y8(J,$)}var Jf=new Xf;Jf.name("hippo").description("Hippo Memory Store CLI").version("1.0.0");Jf.command("init").description("Initialize a new hippo memory directory").argument("[directory]","Directory to initialize",".").action(async(f)=>{await sz(f)});Jf.command("web").description("Start the web server").argument("[directory]","Project directory",".").option("-p, --port <port>","Port to listen on","3000").option("-s, --store-type <type>","Store type (filesystem or sqlite)","filesystem").action(async(f,$)=>{let M=Number.parseInt($.port,10),Y=$.storeType;await J8(f,M,Y)});Jf.addCommand(z6);Jf.parse();