@automagik/genie 0.260201.2240
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/.github/workflows/publish.yml +26 -0
- package/.worktrees/.metadata.json +3 -0
- package/README.md +532 -0
- package/bun.lock +101 -0
- package/dist/claudio.js +76 -0
- package/dist/genie.js +201 -0
- package/dist/term.js +136 -0
- package/install.sh +351 -0
- package/package.json +37 -0
- package/scripts/version.ts +48 -0
- package/src/claudio.ts +128 -0
- package/src/commands/launch.ts +245 -0
- package/src/commands/models.ts +43 -0
- package/src/commands/profiles.ts +95 -0
- package/src/commands/setup.ts +5 -0
- package/src/genie-commands/hooks.ts +317 -0
- package/src/genie-commands/install.ts +351 -0
- package/src/genie-commands/setup.ts +282 -0
- package/src/genie-commands/shortcuts.ts +62 -0
- package/src/genie-commands/update.ts +228 -0
- package/src/genie.ts +106 -0
- package/src/lib/api-client.ts +109 -0
- package/src/lib/claude-settings.ts +252 -0
- package/src/lib/config.ts +109 -0
- package/src/lib/genie-config.ts +164 -0
- package/src/lib/hook-manager.ts +130 -0
- package/src/lib/hook-script.ts +256 -0
- package/src/lib/hooks/compose.ts +72 -0
- package/src/lib/hooks/index.ts +163 -0
- package/src/lib/hooks/presets/audited.ts +191 -0
- package/src/lib/hooks/presets/collaborative.ts +143 -0
- package/src/lib/hooks/presets/sandboxed.ts +153 -0
- package/src/lib/hooks/presets/supervised.ts +66 -0
- package/src/lib/hooks/utils/escape.ts +46 -0
- package/src/lib/log-reader.ts +213 -0
- package/src/lib/picker.ts +62 -0
- package/src/lib/session-metadata.ts +58 -0
- package/src/lib/system-detect.ts +185 -0
- package/src/lib/tmux.ts +410 -0
- package/src/lib/version.ts +15 -0
- package/src/lib/wizard.ts +104 -0
- package/src/lib/worktree.ts +362 -0
- package/src/term-commands/attach.ts +23 -0
- package/src/term-commands/exec.ts +34 -0
- package/src/term-commands/hook.ts +42 -0
- package/src/term-commands/ls.ts +33 -0
- package/src/term-commands/new.ts +73 -0
- package/src/term-commands/pane.ts +81 -0
- package/src/term-commands/read.ts +70 -0
- package/src/term-commands/rm.ts +47 -0
- package/src/term-commands/send.ts +34 -0
- package/src/term-commands/shortcuts.ts +355 -0
- package/src/term-commands/split.ts +87 -0
- package/src/term-commands/status.ts +116 -0
- package/src/term-commands/window.ts +72 -0
- package/src/term.ts +192 -0
- package/src/types/config.ts +17 -0
- package/src/types/genie-config.ts +104 -0
- package/tsconfig.json +17 -0
package/dist/claudio.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// @bun
|
|
3
|
+
var W6=Object.create;var{getPrototypeOf:H6,defineProperty:e2,getOwnPropertyNames:_6}=Object;var G6=Object.prototype.hasOwnProperty;var LD=(D,F,B)=>{B=D!=null?W6(H6(D)):{};let E=F||!D||!D.__esModule?e2(B,"default",{value:D,enumerable:!0}):B;for(let $ of _6(D))if(!G6.call(E,$))e2(E,$,{get:()=>D[$],enumerable:!0});return E};var h=(D,F)=>()=>(F||D((F={exports:{}}).exports,F),F.exports);var C6=(D,F)=>{for(var B in F)e2(D,B,{get:F[B],enumerable:!0,configurable:!0,set:(E)=>F[B]=()=>E})};var KD=import.meta.require;var W2=h((R6)=>{class D0 extends Error{constructor(D,F,B){super(B);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=F,this.exitCode=D,this.nestedError=void 0}}class Y3 extends D0{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}R6.CommanderError=D0;R6.InvalidArgumentError=Y3});var b2=h((U6)=>{var{InvalidArgumentError:j6}=W2();class W3{constructor(D,F){switch(this.description=F||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,D[0]){case"<":this.required=!0,this._name=D.slice(1,-1);break;case"[":this.required=!1,this._name=D.slice(1,-1);break;default:this.required=!0,this._name=D;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue(D,F){if(F===this.defaultValue||!Array.isArray(F))return[D];return F.concat(D)}default(D,F){return this.defaultValue=D,this.defaultValueDescription=F,this}argParser(D){return this.parseArg=D,this}choices(D){return this.argChoices=D.slice(),this.parseArg=(F,B)=>{if(!this.argChoices.includes(F))throw new j6(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(F,B);return F},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function z6(D){let F=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+F+">":"["+F+"]"}U6.Argument=W3;U6.humanReadableArgName=z6});var F0=h((N6)=>{var{humanReadableArgName:K6}=b2();class H3{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(D){let F=D.commands.filter((E)=>!E._hidden),B=D._getHelpCommand();if(B&&!B._hidden)F.push(B);if(this.sortSubcommands)F.sort((E,$)=>{return E.name().localeCompare($.name())});return F}compareOptions(D,F){let B=(E)=>{return E.short?E.short.replace(/^-/,""):E.long.replace(/^--/,"")};return B(D).localeCompare(B(F))}visibleOptions(D){let F=D.options.filter((E)=>!E.hidden),B=D._getHelpOption();if(B&&!B.hidden){let E=B.short&&D._findOption(B.short),$=B.long&&D._findOption(B.long);if(!E&&!$)F.push(B);else if(B.long&&!$)F.push(D.createOption(B.long,B.description));else if(B.short&&!E)F.push(D.createOption(B.short,B.description))}if(this.sortOptions)F.sort(this.compareOptions);return F}visibleGlobalOptions(D){if(!this.showGlobalOptions)return[];let F=[];for(let B=D.parent;B;B=B.parent){let E=B.options.filter(($)=>!$.hidden);F.push(...E)}if(this.sortOptions)F.sort(this.compareOptions);return F}visibleArguments(D){if(D._argsDescription)D.registeredArguments.forEach((F)=>{F.description=F.description||D._argsDescription[F.name()]||""});if(D.registeredArguments.find((F)=>F.description))return D.registeredArguments;return[]}subcommandTerm(D){let F=D.registeredArguments.map((B)=>K6(B)).join(" ");return D._name+(D._aliases[0]?"|"+D._aliases[0]:"")+(D.options.length?" [options]":"")+(F?" "+F:"")}optionTerm(D){return D.flags}argumentTerm(D){return D.name()}longestSubcommandTermLength(D,F){return F.visibleCommands(D).reduce((B,E)=>{return Math.max(B,F.subcommandTerm(E).length)},0)}longestOptionTermLength(D,F){return F.visibleOptions(D).reduce((B,E)=>{return Math.max(B,F.optionTerm(E).length)},0)}longestGlobalOptionTermLength(D,F){return F.visibleGlobalOptions(D).reduce((B,E)=>{return Math.max(B,F.optionTerm(E).length)},0)}longestArgumentTermLength(D,F){return F.visibleArguments(D).reduce((B,E)=>{return Math.max(B,F.argumentTerm(E).length)},0)}commandUsage(D){let F=D._name;if(D._aliases[0])F=F+"|"+D._aliases[0];let B="";for(let E=D.parent;E;E=E.parent)B=E.name()+" "+B;return B+F+" "+D.usage()}commandDescription(D){return D.description()}subcommandDescription(D){return D.summary()||D.description()}optionDescription(D){let F=[];if(D.argChoices)F.push(`choices: ${D.argChoices.map((B)=>JSON.stringify(B)).join(", ")}`);if(D.defaultValue!==void 0){if(D.required||D.optional||D.isBoolean()&&typeof D.defaultValue==="boolean")F.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`)}if(D.presetArg!==void 0&&D.optional)F.push(`preset: ${JSON.stringify(D.presetArg)}`);if(D.envVar!==void 0)F.push(`env: ${D.envVar}`);if(F.length>0)return`${D.description} (${F.join(", ")})`;return D.description}argumentDescription(D){let F=[];if(D.argChoices)F.push(`choices: ${D.argChoices.map((B)=>JSON.stringify(B)).join(", ")}`);if(D.defaultValue!==void 0)F.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`);if(F.length>0){let B=`(${F.join(", ")})`;if(D.description)return`${D.description} ${B}`;return B}return D.description}formatHelp(D,F){let B=F.padWidth(D,F),E=F.helpWidth||80,$=2,q=2;function X(R,I){if(I){let b=`${R.padEnd(B+2)}${I}`;return F.wrap(b,E-2,B+2)}return R}function J(R){return R.join(`
|
|
4
|
+
`).replace(/^/gm," ".repeat(2))}let Q=[`Usage: ${F.commandUsage(D)}`,""],Y=F.commandDescription(D);if(Y.length>0)Q=Q.concat([F.wrap(Y,E,0),""]);let W=F.visibleArguments(D).map((R)=>{return X(F.argumentTerm(R),F.argumentDescription(R))});if(W.length>0)Q=Q.concat(["Arguments:",J(W),""]);let C=F.visibleOptions(D).map((R)=>{return X(F.optionTerm(R),F.optionDescription(R))});if(C.length>0)Q=Q.concat(["Options:",J(C),""]);if(this.showGlobalOptions){let R=F.visibleGlobalOptions(D).map((I)=>{return X(F.optionTerm(I),F.optionDescription(I))});if(R.length>0)Q=Q.concat(["Global Options:",J(R),""])}let U=F.visibleCommands(D).map((R)=>{return X(F.subcommandTerm(R),F.subcommandDescription(R))});if(U.length>0)Q=Q.concat(["Commands:",J(U),""]);return Q.join(`
|
|
5
|
+
`)}padWidth(D,F){return Math.max(F.longestOptionTermLength(D,F),F.longestGlobalOptionTermLength(D,F),F.longestSubcommandTermLength(D,F),F.longestArgumentTermLength(D,F))}wrap(D,F,B,E=40){let q=new RegExp(`[\\n][${" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF"}]+`);if(D.match(q))return D;let X=F-B;if(X<E)return D;let J=D.slice(0,B),Q=D.slice(B).replace(`\r
|
|
6
|
+
`,`
|
|
7
|
+
`),Y=" ".repeat(B),C=`\\s${"\u200B"}`,U=new RegExp(`
|
|
8
|
+
|.{1,${X-1}}([${C}]|$)|[^${C}]+?([${C}]|$)`,"g"),R=Q.match(U)||[];return J+R.map((I,b)=>{if(I===`
|
|
9
|
+
`)return"";return(b>0?Y:"")+I.trimEnd()}).join(`
|
|
10
|
+
`)}}N6.Help=H3});var B0=h((I6)=>{var{InvalidArgumentError:O6}=W2();class _3{constructor(D,F){this.flags=D,this.description=F||"",this.required=D.includes("<"),this.optional=D.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(D),this.mandatory=!1;let B=S6(D);if(this.short=B.shortFlag,this.long=B.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(D,F){return this.defaultValue=D,this.defaultValueDescription=F,this}preset(D){return this.presetArg=D,this}conflicts(D){return this.conflictsWith=this.conflictsWith.concat(D),this}implies(D){let F=D;if(typeof D==="string")F={[D]:!0};return this.implied=Object.assign(this.implied||{},F),this}env(D){return this.envVar=D,this}argParser(D){return this.parseArg=D,this}makeOptionMandatory(D=!0){return this.mandatory=!!D,this}hideHelp(D=!0){return this.hidden=!!D,this}_concatValue(D,F){if(F===this.defaultValue||!Array.isArray(F))return[D];return F.concat(D)}choices(D){return this.argChoices=D.slice(),this.parseArg=(F,B)=>{if(!this.argChoices.includes(F))throw new O6(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(F,B);return F},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return w6(this.name().replace(/^no-/,""))}is(D){return this.short===D||this.long===D}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class G3{constructor(D){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,D.forEach((F)=>{if(F.negate)this.negativeOptions.set(F.attributeName(),F);else this.positiveOptions.set(F.attributeName(),F)}),this.negativeOptions.forEach((F,B)=>{if(this.positiveOptions.has(B))this.dualOptions.add(B)})}valueFromOption(D,F){let B=F.attributeName();if(!this.dualOptions.has(B))return!0;let E=this.negativeOptions.get(B).presetArg,$=E!==void 0?E:!1;return F.negate===($===D)}}function w6(D){return D.split("-").reduce((F,B)=>{return F+B[0].toUpperCase()+B.slice(1)})}function S6(D){let F,B,E=D.split(/[ |,]+/);if(E.length>1&&!/^[[<]/.test(E[1]))F=E.shift();if(B=E.shift(),!F&&/^-[^-]$/.test(B))F=B,B=void 0;return{shortFlag:F,longFlag:B}}I6.Option=_3;I6.DualOptions=G3});var C3=h((f6)=>{function T6(D,F){if(Math.abs(D.length-F.length)>3)return Math.max(D.length,F.length);let B=[];for(let E=0;E<=D.length;E++)B[E]=[E];for(let E=0;E<=F.length;E++)B[0][E]=E;for(let E=1;E<=F.length;E++)for(let $=1;$<=D.length;$++){let q=1;if(D[$-1]===F[E-1])q=0;else q=1;if(B[$][E]=Math.min(B[$-1][E]+1,B[$][E-1]+1,B[$-1][E-1]+q),$>1&&E>1&&D[$-1]===F[E-2]&&D[$-2]===F[E-1])B[$][E]=Math.min(B[$][E],B[$-2][E-2]+1)}return B[D.length][F.length]}function k6(D,F){if(!F||F.length===0)return"";F=Array.from(new Set(F));let B=D.startsWith("--");if(B)D=D.slice(2),F=F.map((X)=>X.slice(2));let E=[],$=3,q=0.4;if(F.forEach((X)=>{if(X.length<=1)return;let J=T6(D,X),Q=Math.max(D.length,X.length);if((Q-J)/Q>q){if(J<$)$=J,E=[X];else if(J===$)E.push(X)}}),E.sort((X,J)=>X.localeCompare(J)),B)E=E.map((X)=>`--${X}`);if(E.length>1)return`
|
|
11
|
+
(Did you mean one of ${E.join(", ")}?)`;if(E.length===1)return`
|
|
12
|
+
(Did you mean ${E[0]}?)`;return""}f6.suggestSimilar=k6});var j3=h((m6)=>{var Z6=KD("events").EventEmitter,E0=KD("child_process"),RD=KD("path"),$0=KD("fs"),y=KD("process"),{Argument:x6,humanReadableArgName:y6}=b2(),{CommanderError:q0}=W2(),{Help:h6}=F0(),{Option:R3,DualOptions:g6}=B0(),{suggestSimilar:M3}=C3();class X0 extends Z6{constructor(D){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=D||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:(F)=>y.stdout.write(F),writeErr:(F)=>y.stderr.write(F),getOutHelpWidth:()=>y.stdout.isTTY?y.stdout.columns:void 0,getErrHelpWidth:()=>y.stderr.isTTY?y.stderr.columns:void 0,outputError:(F,B)=>B(F)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(D){return this._outputConfiguration=D._outputConfiguration,this._helpOption=D._helpOption,this._helpCommand=D._helpCommand,this._helpConfiguration=D._helpConfiguration,this._exitCallback=D._exitCallback,this._storeOptionsAsProperties=D._storeOptionsAsProperties,this._combineFlagAndOptionalValue=D._combineFlagAndOptionalValue,this._allowExcessArguments=D._allowExcessArguments,this._enablePositionalOptions=D._enablePositionalOptions,this._showHelpAfterError=D._showHelpAfterError,this._showSuggestionAfterError=D._showSuggestionAfterError,this}_getCommandAndAncestors(){let D=[];for(let F=this;F;F=F.parent)D.push(F);return D}command(D,F,B){let E=F,$=B;if(typeof E==="object"&&E!==null)$=E,E=null;$=$||{};let[,q,X]=D.match(/([^ ]+) *(.*)/),J=this.createCommand(q);if(E)J.description(E),J._executableHandler=!0;if($.isDefault)this._defaultCommandName=J._name;if(J._hidden=!!($.noHelp||$.hidden),J._executableFile=$.executableFile||null,X)J.arguments(X);if(this._registerCommand(J),J.parent=this,J.copyInheritedSettings(this),E)return this;return J}createCommand(D){return new X0(D)}createHelp(){return Object.assign(new h6,this.configureHelp())}configureHelp(D){if(D===void 0)return this._helpConfiguration;return this._helpConfiguration=D,this}configureOutput(D){if(D===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,D),this}showHelpAfterError(D=!0){if(typeof D!=="string")D=!!D;return this._showHelpAfterError=D,this}showSuggestionAfterError(D=!0){return this._showSuggestionAfterError=!!D,this}addCommand(D,F){if(!D._name)throw Error(`Command passed to .addCommand() must have a name
|
|
13
|
+
- specify the name in Command constructor or using .name()`);if(F=F||{},F.isDefault)this._defaultCommandName=D._name;if(F.noHelp||F.hidden)D._hidden=!0;return this._registerCommand(D),D.parent=this,D._checkForBrokenPassThrough(),this}createArgument(D,F){return new x6(D,F)}argument(D,F,B,E){let $=this.createArgument(D,F);if(typeof B==="function")$.default(E).argParser(B);else $.default(B);return this.addArgument($),this}arguments(D){return D.trim().split(/ +/).forEach((F)=>{this.argument(F)}),this}addArgument(D){let F=this.registeredArguments.slice(-1)[0];if(F&&F.variadic)throw Error(`only the last argument can be variadic '${F.name()}'`);if(D.required&&D.defaultValue!==void 0&&D.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${D.name()}'`);return this.registeredArguments.push(D),this}helpCommand(D,F){if(typeof D==="boolean")return this._addImplicitHelpCommand=D,this;D=D??"help [command]";let[,B,E]=D.match(/([^ ]+) *(.*)/),$=F??"display help for command",q=this.createCommand(B);if(q.helpOption(!1),E)q.arguments(E);if($)q.description($);return this._addImplicitHelpCommand=!0,this._helpCommand=q,this}addHelpCommand(D,F){if(typeof D!=="object")return this.helpCommand(D,F),this;return this._addImplicitHelpCommand=!0,this._helpCommand=D,this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(D,F){let B=["preSubcommand","preAction","postAction"];if(!B.includes(D))throw Error(`Unexpected value for event passed to hook : '${D}'.
|
|
14
|
+
Expecting one of '${B.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycleHooks[D].push(F);else this._lifeCycleHooks[D]=[F];return this}exitOverride(D){if(D)this._exitCallback=D;else this._exitCallback=(F)=>{if(F.code!=="commander.executeSubCommandAsync")throw F};return this}_exit(D,F,B){if(this._exitCallback)this._exitCallback(new q0(D,F,B));y.exit(D)}action(D){let F=(B)=>{let E=this.registeredArguments.length,$=B.slice(0,E);if(this._storeOptionsAsProperties)$[E]=this;else $[E]=this.opts();return $.push(this),D.apply(this,$)};return this._actionHandler=F,this}createOption(D,F){return new R3(D,F)}_callParseArg(D,F,B,E){try{return D.parseArg(F,B)}catch($){if($.code==="commander.invalidArgument"){let q=`${E} ${$.message}`;this.error(q,{exitCode:$.exitCode,code:$.code})}throw $}}_registerOption(D){let F=D.short&&this._findOption(D.short)||D.long&&this._findOption(D.long);if(F){let B=D.long&&this._findOption(D.long)?D.long:D.short;throw Error(`Cannot add option '${D.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${B}'
|
|
15
|
+
- already used by option '${F.flags}'`)}this.options.push(D)}_registerCommand(D){let F=(E)=>{return[E.name()].concat(E.aliases())},B=F(D).find((E)=>this._findCommand(E));if(B){let E=F(this._findCommand(B)).join("|"),$=F(D).join("|");throw Error(`cannot add command '${$}' as already have command '${E}'`)}this.commands.push(D)}addOption(D){this._registerOption(D);let F=D.name(),B=D.attributeName();if(D.negate){let $=D.long.replace(/^--no-/,"--");if(!this._findOption($))this.setOptionValueWithSource(B,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(B,D.defaultValue,"default");let E=($,q,X)=>{if($==null&&D.presetArg!==void 0)$=D.presetArg;let J=this.getOptionValue(B);if($!==null&&D.parseArg)$=this._callParseArg(D,$,J,q);else if($!==null&&D.variadic)$=D._concatValue($,J);if($==null)if(D.negate)$=!1;else if(D.isBoolean()||D.optional)$=!0;else $="";this.setOptionValueWithSource(B,$,X)};if(this.on("option:"+F,($)=>{let q=`error: option '${D.flags}' argument '${$}' is invalid.`;E($,q,"cli")}),D.envVar)this.on("optionEnv:"+F,($)=>{let q=`error: option '${D.flags}' value '${$}' from env '${D.envVar}' is invalid.`;E($,q,"env")});return this}_optionEx(D,F,B,E,$){if(typeof F==="object"&&F instanceof R3)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let q=this.createOption(F,B);if(q.makeOptionMandatory(!!D.mandatory),typeof E==="function")q.default($).argParser(E);else if(E instanceof RegExp){let X=E;E=(J,Q)=>{let Y=X.exec(J);return Y?Y[0]:Q},q.default($).argParser(E)}else q.default(E);return this.addOption(q)}option(D,F,B,E){return this._optionEx({},D,F,B,E)}requiredOption(D,F,B,E){return this._optionEx({mandatory:!0},D,F,B,E)}combineFlagAndOptionalValue(D=!0){return this._combineFlagAndOptionalValue=!!D,this}allowUnknownOption(D=!0){return this._allowUnknownOption=!!D,this}allowExcessArguments(D=!0){return this._allowExcessArguments=!!D,this}enablePositionalOptions(D=!0){return this._enablePositionalOptions=!!D,this}passThroughOptions(D=!0){return this._passThroughOptions=!!D,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(D=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!D,this}getOptionValue(D){if(this._storeOptionsAsProperties)return this[D];return this._optionValues[D]}setOptionValue(D,F){return this.setOptionValueWithSource(D,F,void 0)}setOptionValueWithSource(D,F,B){if(this._storeOptionsAsProperties)this[D]=F;else this._optionValues[D]=F;return this._optionValueSources[D]=B,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let F;return this._getCommandAndAncestors().forEach((B)=>{if(B.getOptionValueSource(D)!==void 0)F=B.getOptionValueSource(D)}),F}_prepareUserArgs(D,F){if(D!==void 0&&!Array.isArray(D))throw Error("first parameter to parse must be array or undefined");if(F=F||{},D===void 0&&F.from===void 0){if(y.versions?.electron)F.from="electron";let E=y.execArgv??[];if(E.includes("-e")||E.includes("--eval")||E.includes("-p")||E.includes("--print"))F.from="eval"}if(D===void 0)D=y.argv;this.rawArgs=D.slice();let B;switch(F.from){case void 0:case"node":this._scriptPath=D[1],B=D.slice(2);break;case"electron":if(y.defaultApp)this._scriptPath=D[1],B=D.slice(2);else B=D.slice(1);break;case"user":B=D.slice(0);break;case"eval":B=D.slice(1);break;default:throw Error(`unexpected parse option { from: '${F.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",B}parse(D,F){let B=this._prepareUserArgs(D,F);return this._parseCommand([],B),this}async parseAsync(D,F){let B=this._prepareUserArgs(D,F);return await this._parseCommand([],B),this}_executeSubCommand(D,F){F=F.slice();let B=!1,E=[".js",".ts",".tsx",".mjs",".cjs"];function $(Y,W){let C=RD.resolve(Y,W);if($0.existsSync(C))return C;if(E.includes(RD.extname(W)))return;let U=E.find((R)=>$0.existsSync(`${C}${R}`));if(U)return`${C}${U}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let q=D._executableFile||`${this._name}-${D._name}`,X=this._executableDir||"";if(this._scriptPath){let Y;try{Y=$0.realpathSync(this._scriptPath)}catch(W){Y=this._scriptPath}X=RD.resolve(RD.dirname(Y),X)}if(X){let Y=$(X,q);if(!Y&&!D._executableFile&&this._scriptPath){let W=RD.basename(this._scriptPath,RD.extname(this._scriptPath));if(W!==this._name)Y=$(X,`${W}-${D._name}`)}q=Y||q}B=E.includes(RD.extname(q));let J;if(y.platform!=="win32")if(B)F.unshift(q),F=A3(y.execArgv).concat(F),J=E0.spawn(y.argv[0],F,{stdio:"inherit"});else J=E0.spawn(q,F,{stdio:"inherit"});else F.unshift(q),F=A3(y.execArgv).concat(F),J=E0.spawn(y.execPath,F,{stdio:"inherit"});if(!J.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((W)=>{y.on(W,()=>{if(J.killed===!1&&J.exitCode===null)J.kill(W)})});let Q=this._exitCallback;J.on("close",(Y)=>{if(Y=Y??1,!Q)y.exit(Y);else Q(new q0(Y,"commander.executeSubCommandAsync","(close)"))}),J.on("error",(Y)=>{if(Y.code==="ENOENT"){let W=X?`searched for local subcommand relative to directory '${X}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",C=`'${q}' does not exist
|
|
16
|
+
- if '${D._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
17
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
18
|
+
- ${W}`;throw Error(C)}else if(Y.code==="EACCES")throw Error(`'${q}' not executable`);if(!Q)y.exit(1);else{let W=new q0(1,"commander.executeSubCommandAsync","(error)");W.nestedError=Y,Q(W)}}),this.runningCommand=J}_dispatchSubcommand(D,F,B){let E=this._findCommand(D);if(!E)this.help({error:!0});let $;return $=this._chainOrCallSubCommandHook($,E,"preSubcommand"),$=this._chainOrCall($,()=>{if(E._executableHandler)this._executeSubCommand(E,F.concat(B));else return E._parseCommand(F,B)}),$}_dispatchHelpCommand(D){if(!D)this.help();let F=this._findCommand(D);if(F&&!F._executableHandler)F.help();return this._dispatchSubcommand(D,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((D,F)=>{if(D.required&&this.args[F]==null)this.missingArgument(D.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let D=(B,E,$)=>{let q=E;if(E!==null&&B.parseArg){let X=`error: command-argument value '${E}' is invalid for argument '${B.name()}'.`;q=this._callParseArg(B,E,$,X)}return q};this._checkNumberOfArguments();let F=[];this.registeredArguments.forEach((B,E)=>{let $=B.defaultValue;if(B.variadic){if(E<this.args.length){if($=this.args.slice(E),B.parseArg)$=$.reduce((q,X)=>{return D(B,X,q)},B.defaultValue)}else if($===void 0)$=[]}else if(E<this.args.length){if($=this.args[E],B.parseArg)$=D(B,$,B.defaultValue)}F[E]=$}),this.processedArgs=F}_chainOrCall(D,F){if(D&&D.then&&typeof D.then==="function")return D.then(()=>F());return F()}_chainOrCallHooks(D,F){let B=D,E=[];if(this._getCommandAndAncestors().reverse().filter(($)=>$._lifeCycleHooks[F]!==void 0).forEach(($)=>{$._lifeCycleHooks[F].forEach((q)=>{E.push({hookedCommand:$,callback:q})})}),F==="postAction")E.reverse();return E.forEach(($)=>{B=this._chainOrCall(B,()=>{return $.callback($.hookedCommand,this)})}),B}_chainOrCallSubCommandHook(D,F,B){let E=D;if(this._lifeCycleHooks[B]!==void 0)this._lifeCycleHooks[B].forEach(($)=>{E=this._chainOrCall(E,()=>{return $(this,F)})});return E}_parseCommand(D,F){let B=this.parseOptions(F);if(this._parseOptionsEnv(),this._parseOptionsImplied(),D=D.concat(B.operands),F=B.unknown,this.args=D.concat(F),D&&this._findCommand(D[0]))return this._dispatchSubcommand(D[0],D.slice(1),F);if(this._getHelpCommand()&&D[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(D[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(F),this._dispatchSubcommand(this._defaultCommandName,D,F);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(B.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let E=()=>{if(B.unknown.length>0)this.unknownOption(B.unknown[0])},$=`command:${this.name()}`;if(this._actionHandler){E(),this._processArguments();let q;if(q=this._chainOrCallHooks(q,"preAction"),q=this._chainOrCall(q,()=>this._actionHandler(this.processedArgs)),this.parent)q=this._chainOrCall(q,()=>{this.parent.emit($,D,F)});return q=this._chainOrCallHooks(q,"postAction"),q}if(this.parent&&this.parent.listenerCount($))E(),this._processArguments(),this.parent.emit($,D,F);else if(D.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",D,F);if(this.listenerCount("command:*"))this.emit("command:*",D,F);else if(this.commands.length)this.unknownCommand();else E(),this._processArguments()}else if(this.commands.length)E(),this.help({error:!0});else E(),this._processArguments()}_findCommand(D){if(!D)return;return this.commands.find((F)=>F._name===D||F._aliases.includes(D))}_findOption(D){return this.options.find((F)=>F.is(D))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((D)=>{D.options.forEach((F)=>{if(F.mandatory&&D.getOptionValue(F.attributeName())===void 0)D.missingMandatoryOptionValue(F)})})}_checkForConflictingLocalOptions(){let D=this.options.filter((B)=>{let E=B.attributeName();if(this.getOptionValue(E)===void 0)return!1;return this.getOptionValueSource(E)!=="default"});D.filter((B)=>B.conflictsWith.length>0).forEach((B)=>{let E=D.find(($)=>B.conflictsWith.includes($.attributeName()));if(E)this._conflictingOption(B,E)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let F=[],B=[],E=F,$=D.slice();function q(J){return J.length>1&&J[0]==="-"}let X=null;while($.length){let J=$.shift();if(J==="--"){if(E===B)E.push(J);E.push(...$);break}if(X&&!q(J)){this.emit(`option:${X.name()}`,J);continue}if(X=null,q(J)){let Q=this._findOption(J);if(Q){if(Q.required){let Y=$.shift();if(Y===void 0)this.optionMissingArgument(Q);this.emit(`option:${Q.name()}`,Y)}else if(Q.optional){let Y=null;if($.length>0&&!q($[0]))Y=$.shift();this.emit(`option:${Q.name()}`,Y)}else this.emit(`option:${Q.name()}`);X=Q.variadic?Q:null;continue}}if(J.length>2&&J[0]==="-"&&J[1]!=="-"){let Q=this._findOption(`-${J[1]}`);if(Q){if(Q.required||Q.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${Q.name()}`,J.slice(2));else this.emit(`option:${Q.name()}`),$.unshift(`-${J.slice(2)}`);continue}}if(/^--[^=]+=/.test(J)){let Q=J.indexOf("="),Y=this._findOption(J.slice(0,Q));if(Y&&(Y.required||Y.optional)){this.emit(`option:${Y.name()}`,J.slice(Q+1));continue}}if(q(J))E=B;if((this._enablePositionalOptions||this._passThroughOptions)&&F.length===0&&B.length===0){if(this._findCommand(J)){if(F.push(J),$.length>0)B.push(...$);break}else if(this._getHelpCommand()&&J===this._getHelpCommand().name()){if(F.push(J),$.length>0)F.push(...$);break}else if(this._defaultCommandName){if(B.push(J),$.length>0)B.push(...$);break}}if(this._passThroughOptions){if(E.push(J),$.length>0)E.push(...$);break}E.push(J)}return{operands:F,unknown:B}}opts(){if(this._storeOptionsAsProperties){let D={},F=this.options.length;for(let B=0;B<F;B++){let E=this.options[B].attributeName();D[E]=E===this._versionOptionName?this._version:this[E]}return D}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((D,F)=>Object.assign(D,F.opts()),{})}error(D,F){if(this._outputConfiguration.outputError(`${D}
|
|
19
|
+
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
20
|
+
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
|
|
21
|
+
`),this.outputHelp({error:!0});let B=F||{},E=B.exitCode||1,$=B.code||"commander.error";this._exit(E,$,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in y.env){let F=D.attributeName();if(this.getOptionValue(F)===void 0||["default","config","env"].includes(this.getOptionValueSource(F)))if(D.required||D.optional)this.emit(`optionEnv:${D.name()}`,y.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new g6(this.options),F=(B)=>{return this.getOptionValue(B)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(B))};this.options.filter((B)=>B.implied!==void 0&&F(B.attributeName())&&D.valueFromOption(this.getOptionValue(B.attributeName()),B)).forEach((B)=>{Object.keys(B.implied).filter((E)=>!F(E)).forEach((E)=>{this.setOptionValueWithSource(E,B.implied[E],"implied")})})}missingArgument(D){let F=`error: missing required argument '${D}'`;this.error(F,{code:"commander.missingArgument"})}optionMissingArgument(D){let F=`error: option '${D.flags}' argument missing`;this.error(F,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(D){let F=`error: required option '${D.flags}' not specified`;this.error(F,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(D,F){let B=(q)=>{let X=q.attributeName(),J=this.getOptionValue(X),Q=this.options.find((W)=>W.negate&&X===W.attributeName()),Y=this.options.find((W)=>!W.negate&&X===W.attributeName());if(Q&&(Q.presetArg===void 0&&J===!1||Q.presetArg!==void 0&&J===Q.presetArg))return Q;return Y||q},E=(q)=>{let X=B(q),J=X.attributeName();if(this.getOptionValueSource(J)==="env")return`environment variable '${X.envVar}'`;return`option '${X.flags}'`},$=`error: ${E(D)} cannot be used with ${E(F)}`;this.error($,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let F="";if(D.startsWith("--")&&this._showSuggestionAfterError){let E=[],$=this;do{let q=$.createHelp().visibleOptions($).filter((X)=>X.long).map((X)=>X.long);E=E.concat(q),$=$.parent}while($&&!$._enablePositionalOptions);F=M3(D,E)}let B=`error: unknown option '${D}'${F}`;this.error(B,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let F=this.registeredArguments.length,B=F===1?"":"s",$=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${F} argument${B} but got ${D.length}.`;this.error($,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],F="";if(this._showSuggestionAfterError){let E=[];this.createHelp().visibleCommands(this).forEach(($)=>{if(E.push($.name()),$.alias())E.push($.alias())}),F=M3(D,E)}let B=`error: unknown command '${D}'${F}`;this.error(B,{code:"commander.unknownCommand"})}version(D,F,B){if(D===void 0)return this._version;this._version=D,F=F||"-V, --version",B=B||"output the version number";let E=this.createOption(F,B);return this._versionOptionName=E.attributeName(),this._registerOption(E),this.on("option:"+E.name(),()=>{this._outputConfiguration.writeOut(`${D}
|
|
22
|
+
`),this._exit(0,"commander.version",D)}),this}description(D,F){if(D===void 0&&F===void 0)return this._description;if(this._description=D,F)this._argsDescription=F;return this}summary(D){if(D===void 0)return this._summary;return this._summary=D,this}alias(D){if(D===void 0)return this._aliases[0];let F=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)F=this.commands[this.commands.length-1];if(D===F._name)throw Error("Command alias can't be the same as its name");let B=this.parent?._findCommand(D);if(B){let E=[B.name()].concat(B.aliases()).join("|");throw Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${E}'`)}return F._aliases.push(D),this}aliases(D){if(D===void 0)return this._aliases;return D.forEach((F)=>this.alias(F)),this}usage(D){if(D===void 0){if(this._usage)return this._usage;let F=this.registeredArguments.map((B)=>{return y6(B)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?F:[]).join(" ")}return this._usage=D,this}name(D){if(D===void 0)return this._name;return this._name=D,this}nameFromFilename(D){return this._name=RD.basename(D,RD.extname(D)),this}executableDir(D){if(D===void 0)return this._executableDir;return this._executableDir=D,this}helpInformation(D){let F=this.createHelp();if(F.helpWidth===void 0)F.helpWidth=D&&D.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return F.formatHelp(this,F)}_getHelpContext(D){D=D||{};let F={error:!!D.error},B;if(F.error)B=(E)=>this._outputConfiguration.writeErr(E);else B=(E)=>this._outputConfiguration.writeOut(E);return F.write=D.write||B,F.command=this,F}outputHelp(D){let F;if(typeof D==="function")F=D,D=void 0;let B=this._getHelpContext(D);this._getCommandAndAncestors().reverse().forEach(($)=>$.emit("beforeAllHelp",B)),this.emit("beforeHelp",B);let E=this.helpInformation(B);if(F){if(E=F(E),typeof E!=="string"&&!Buffer.isBuffer(E))throw Error("outputHelp callback must return a string or a Buffer")}if(B.write(E),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",B),this._getCommandAndAncestors().forEach(($)=>$.emit("afterAllHelp",B))}helpOption(D,F){if(typeof D==="boolean"){if(D)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return D=D??"-h, --help",F=F??"display help for command",this._helpOption=this.createOption(D,F),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(D){return this._helpOption=D,this}help(D){this.outputHelp(D);let F=y.exitCode||0;if(F===0&&D&&typeof D!=="function"&&D.error)F=1;this._exit(F,"commander.help","(outputHelp)")}addHelpText(D,F){let B=["beforeAll","before","after","afterAll"];if(!B.includes(D))throw Error(`Unexpected value for position to addHelpText.
|
|
23
|
+
Expecting one of '${B.join("', '")}'`);let E=`${D}Help`;return this.on(E,($)=>{let q;if(typeof F==="function")q=F({error:$.error,command:$.command});else q=F;if(q)$.write(`${q}
|
|
24
|
+
`)}),this}_outputHelpIfRequested(D){let F=this._getHelpOption();if(F&&D.find((E)=>F.is(E)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function A3(D){return D.map((F)=>{if(!F.startsWith("--inspect"))return F;let B,E="127.0.0.1",$="9229",q;if((q=F.match(/^(--inspect(-brk)?)$/))!==null)B=q[1];else if((q=F.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(B=q[1],/^\d+$/.test(q[3]))$=q[3];else E=q[3];else if((q=F.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)B=q[1],E=q[3],$=q[4];if(B&&$!=="0")return`${B}=${E}:${parseInt($)+1}`;return F})}m6.Command=X0});var L3=h((c6)=>{var{Argument:z3}=b2(),{Command:J0}=j3(),{CommanderError:p6,InvalidArgumentError:U3}=W2(),{Help:d6}=F0(),{Option:V3}=B0();c6.program=new J0;c6.createCommand=(D)=>new J0(D);c6.createOption=(D,F)=>new V3(D,F);c6.createArgument=(D,F)=>new z3(D,F);c6.Command=J0;c6.Option=V3;c6.Argument=z3;c6.Help=d6;c6.CommanderError=p6;c6.InvalidArgumentError=U3;c6.InvalidOptionArgumentError=U3});var _2=h((j7,S3)=>{var J1=KD("tty"),Q1=J1?.WriteStream?.prototype?.hasColors?.()??!1,u=(D,F)=>{if(!Q1)return($)=>$;let B=`\x1B[${D}m`,E=`\x1B[${F}m`;return($)=>{let q=$+"",X=q.indexOf(E);if(X===-1)return B+q+E;let J=B,Q=0,W=(F===22?E:"")+B;while(X!==-1)J+=q.slice(Q,X)+W,Q=X+E.length,X=q.indexOf(E,Q);return J+=q.slice(Q)+E,J}},K={};K.reset=u(0,0);K.bold=u(1,22);K.dim=u(2,22);K.italic=u(3,23);K.underline=u(4,24);K.overline=u(53,55);K.inverse=u(7,27);K.hidden=u(8,28);K.strikethrough=u(9,29);K.black=u(30,39);K.red=u(31,39);K.green=u(32,39);K.yellow=u(33,39);K.blue=u(34,39);K.magenta=u(35,39);K.cyan=u(36,39);K.white=u(37,39);K.gray=u(90,39);K.bgBlack=u(40,49);K.bgRed=u(41,49);K.bgGreen=u(42,49);K.bgYellow=u(43,49);K.bgBlue=u(44,49);K.bgMagenta=u(45,49);K.bgCyan=u(46,49);K.bgWhite=u(47,49);K.bgGray=u(100,49);K.redBright=u(91,39);K.greenBright=u(92,39);K.yellowBright=u(93,39);K.blueBright=u(94,39);K.magentaBright=u(95,39);K.cyanBright=u(96,39);K.whiteBright=u(97,39);K.bgRedBright=u(101,49);K.bgGreenBright=u(102,49);K.bgYellowBright=u(103,49);K.bgBlueBright=u(104,49);K.bgMagentaBright=u(105,49);K.bgCyanBright=u(106,49);K.bgWhiteBright=u(107,49);S3.exports=K});var v3=h((y7,f3)=>{f3.exports=M1;function R1(D){let F={defaultWidth:0,output:process.stdout,tty:KD("tty")};if(!D)return F;return Object.keys(F).forEach(function(B){if(!D[B])D[B]=F[B]}),D}function M1(D){let F=R1(D);if(F.output.getWindowSize)return F.output.getWindowSize()[0]||F.defaultWidth;if(F.tty.getWindowSize)return F.tty.getWindowSize()[1]||F.defaultWidth;if(F.output.columns)return F.output.columns;if(process.env.CLI_WIDTH){let B=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(B)&&B!==0)return B}return F.defaultWidth}});var x3=h((h7,Z3)=>{Z3.exports=({onlyFirst:D=!1}={})=>{let F=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(F,D?void 0:"g")}});var M0=h((g7,y3)=>{var A1=x3();y3.exports=(D)=>typeof D==="string"?D.replace(A1(),""):D});var g3=h((m7,A0)=>{var h3=(D)=>{if(Number.isNaN(D))return!1;if(D>=4352&&(D<=4447||D===9001||D===9002||11904<=D&&D<=12871&&D!==12351||12880<=D&&D<=19903||19968<=D&&D<=42182||43360<=D&&D<=43388||44032<=D&&D<=55203||63744<=D&&D<=64255||65040<=D&&D<=65049||65072<=D&&D<=65131||65281<=D&&D<=65376||65504<=D&&D<=65510||110592<=D&&D<=110593||127488<=D&&D<=127569||131072<=D&&D<=262141))return!0;return!1};A0.exports=h3;A0.exports.default=h3});var l3=h((l7,m3)=>{m3.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var d3=h((p7,j0)=>{var j1=M0(),z1=g3(),U1=l3(),p3=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=j1(D),D.length===0)return 0;D=D.replace(U1()," ");let F=0;for(let B=0;B<D.length;B++){let E=D.codePointAt(B);if(E<=31||E>=127&&E<=159)continue;if(E>=768&&E<=879)continue;if(E>65535)B++;F+=z1(E)?2:1}return F};j0.exports=p3;j0.exports.default=p3});var n3=h((d7,c3)=>{c3.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var z0=h((c7,r3)=>{var C2=n3(),i3={};for(let D of Object.keys(C2))i3[C2[D]]=D;var M={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};r3.exports=M;for(let D of Object.keys(M)){if(!("channels"in M[D]))throw Error("missing channels property: "+D);if(!("labels"in M[D]))throw Error("missing channel labels property: "+D);if(M[D].labels.length!==M[D].channels)throw Error("channel and label counts mismatch: "+D);let{channels:F,labels:B}=M[D];delete M[D].channels,delete M[D].labels,Object.defineProperty(M[D],"channels",{value:F}),Object.defineProperty(M[D],"labels",{value:B})}M.rgb.hsl=function(D){let F=D[0]/255,B=D[1]/255,E=D[2]/255,$=Math.min(F,B,E),q=Math.max(F,B,E),X=q-$,J,Q;if(q===$)J=0;else if(F===q)J=(B-E)/X;else if(B===q)J=2+(E-F)/X;else if(E===q)J=4+(F-B)/X;if(J=Math.min(J*60,360),J<0)J+=360;let Y=($+q)/2;if(q===$)Q=0;else if(Y<=0.5)Q=X/(q+$);else Q=X/(2-q-$);return[J,Q*100,Y*100]};M.rgb.hsv=function(D){let F,B,E,$,q,X=D[0]/255,J=D[1]/255,Q=D[2]/255,Y=Math.max(X,J,Q),W=Y-Math.min(X,J,Q),C=function(U){return(Y-U)/6/W+0.5};if(W===0)$=0,q=0;else{if(q=W/Y,F=C(X),B=C(J),E=C(Q),X===Y)$=E-B;else if(J===Y)$=0.3333333333333333+F-E;else if(Q===Y)$=0.6666666666666666+B-F;if($<0)$+=1;else if($>1)$-=1}return[$*360,q*100,Y*100]};M.rgb.hwb=function(D){let F=D[0],B=D[1],E=D[2],$=M.rgb.hsl(D)[0],q=0.00392156862745098*Math.min(F,Math.min(B,E));return E=1-0.00392156862745098*Math.max(F,Math.max(B,E)),[$,q*100,E*100]};M.rgb.cmyk=function(D){let F=D[0]/255,B=D[1]/255,E=D[2]/255,$=Math.min(1-F,1-B,1-E),q=(1-F-$)/(1-$)||0,X=(1-B-$)/(1-$)||0,J=(1-E-$)/(1-$)||0;return[q*100,X*100,J*100,$*100]};function V1(D,F){return(D[0]-F[0])**2+(D[1]-F[1])**2+(D[2]-F[2])**2}M.rgb.keyword=function(D){let F=i3[D];if(F)return F;let B=1/0,E;for(let $ of Object.keys(C2)){let q=C2[$],X=V1(D,q);if(X<B)B=X,E=$}return E};M.keyword.rgb=function(D){return C2[D]};M.rgb.xyz=function(D){let F=D[0]/255,B=D[1]/255,E=D[2]/255;F=F>0.04045?((F+0.055)/1.055)**2.4:F/12.92,B=B>0.04045?((B+0.055)/1.055)**2.4:B/12.92,E=E>0.04045?((E+0.055)/1.055)**2.4:E/12.92;let $=F*0.4124+B*0.3576+E*0.1805,q=F*0.2126+B*0.7152+E*0.0722,X=F*0.0193+B*0.1192+E*0.9505;return[$*100,q*100,X*100]};M.rgb.lab=function(D){let F=M.rgb.xyz(D),B=F[0],E=F[1],$=F[2];B/=95.047,E/=100,$/=108.883,B=B>0.008856?B**0.3333333333333333:7.787*B+0.13793103448275862,E=E>0.008856?E**0.3333333333333333:7.787*E+0.13793103448275862,$=$>0.008856?$**0.3333333333333333:7.787*$+0.13793103448275862;let q=116*E-16,X=500*(B-E),J=200*(E-$);return[q,X,J]};M.hsl.rgb=function(D){let F=D[0]/360,B=D[1]/100,E=D[2]/100,$,q,X;if(B===0)return X=E*255,[X,X,X];if(E<0.5)$=E*(1+B);else $=E+B-E*B;let J=2*E-$,Q=[0,0,0];for(let Y=0;Y<3;Y++){if(q=F+0.3333333333333333*-(Y-1),q<0)q++;if(q>1)q--;if(6*q<1)X=J+($-J)*6*q;else if(2*q<1)X=$;else if(3*q<2)X=J+($-J)*(0.6666666666666666-q)*6;else X=J;Q[Y]=X*255}return Q};M.hsl.hsv=function(D){let F=D[0],B=D[1]/100,E=D[2]/100,$=B,q=Math.max(E,0.01);E*=2,B*=E<=1?E:2-E,$*=q<=1?q:2-q;let X=(E+B)/2,J=E===0?2*$/(q+$):2*B/(E+B);return[F,J*100,X*100]};M.hsv.rgb=function(D){let F=D[0]/60,B=D[1]/100,E=D[2]/100,$=Math.floor(F)%6,q=F-Math.floor(F),X=255*E*(1-B),J=255*E*(1-B*q),Q=255*E*(1-B*(1-q));switch(E*=255,$){case 0:return[E,Q,X];case 1:return[J,E,X];case 2:return[X,E,Q];case 3:return[X,J,E];case 4:return[Q,X,E];case 5:return[E,X,J]}};M.hsv.hsl=function(D){let F=D[0],B=D[1]/100,E=D[2]/100,$=Math.max(E,0.01),q,X;X=(2-B)*E;let J=(2-B)*$;return q=B*$,q/=J<=1?J:2-J,q=q||0,X/=2,[F,q*100,X*100]};M.hwb.rgb=function(D){let F=D[0]/360,B=D[1]/100,E=D[2]/100,$=B+E,q;if($>1)B/=$,E/=$;let X=Math.floor(6*F),J=1-E;if(q=6*F-X,(X&1)!==0)q=1-q;let Q=B+q*(J-B),Y,W,C;switch(X){default:case 6:case 0:Y=J,W=Q,C=B;break;case 1:Y=Q,W=J,C=B;break;case 2:Y=B,W=J,C=Q;break;case 3:Y=B,W=Q,C=J;break;case 4:Y=Q,W=B,C=J;break;case 5:Y=J,W=B,C=Q;break}return[Y*255,W*255,C*255]};M.cmyk.rgb=function(D){let F=D[0]/100,B=D[1]/100,E=D[2]/100,$=D[3]/100,q=1-Math.min(1,F*(1-$)+$),X=1-Math.min(1,B*(1-$)+$),J=1-Math.min(1,E*(1-$)+$);return[q*255,X*255,J*255]};M.xyz.rgb=function(D){let F=D[0]/100,B=D[1]/100,E=D[2]/100,$,q,X;return $=F*3.2406+B*-1.5372+E*-0.4986,q=F*-0.9689+B*1.8758+E*0.0415,X=F*0.0557+B*-0.204+E*1.057,$=$>0.0031308?1.055*$**0.4166666666666667-0.055:$*12.92,q=q>0.0031308?1.055*q**0.4166666666666667-0.055:q*12.92,X=X>0.0031308?1.055*X**0.4166666666666667-0.055:X*12.92,$=Math.min(Math.max(0,$),1),q=Math.min(Math.max(0,q),1),X=Math.min(Math.max(0,X),1),[$*255,q*255,X*255]};M.xyz.lab=function(D){let F=D[0],B=D[1],E=D[2];F/=95.047,B/=100,E/=108.883,F=F>0.008856?F**0.3333333333333333:7.787*F+0.13793103448275862,B=B>0.008856?B**0.3333333333333333:7.787*B+0.13793103448275862,E=E>0.008856?E**0.3333333333333333:7.787*E+0.13793103448275862;let $=116*B-16,q=500*(F-B),X=200*(B-E);return[$,q,X]};M.lab.xyz=function(D){let F=D[0],B=D[1],E=D[2],$,q,X;q=(F+16)/116,$=B/500+q,X=q-E/200;let J=q**3,Q=$**3,Y=X**3;return q=J>0.008856?J:(q-0.13793103448275862)/7.787,$=Q>0.008856?Q:($-0.13793103448275862)/7.787,X=Y>0.008856?Y:(X-0.13793103448275862)/7.787,$*=95.047,q*=100,X*=108.883,[$,q,X]};M.lab.lch=function(D){let F=D[0],B=D[1],E=D[2],$;if($=Math.atan2(E,B)*360/2/Math.PI,$<0)$+=360;let X=Math.sqrt(B*B+E*E);return[F,X,$]};M.lch.lab=function(D){let F=D[0],B=D[1],$=D[2]/360*2*Math.PI,q=B*Math.cos($),X=B*Math.sin($);return[F,q,X]};M.rgb.ansi16=function(D,F=null){let[B,E,$]=D,q=F===null?M.rgb.hsv(D)[2]:F;if(q=Math.round(q/50),q===0)return 30;let X=30+(Math.round($/255)<<2|Math.round(E/255)<<1|Math.round(B/255));if(q===2)X+=60;return X};M.hsv.ansi16=function(D){return M.rgb.ansi16(M.hsv.rgb(D),D[2])};M.rgb.ansi256=function(D){let F=D[0],B=D[1],E=D[2];if(F===B&&B===E){if(F<8)return 16;if(F>248)return 231;return Math.round((F-8)/247*24)+232}return 16+36*Math.round(F/255*5)+6*Math.round(B/255*5)+Math.round(E/255*5)};M.ansi16.rgb=function(D){let F=D%10;if(F===0||F===7){if(D>50)F+=3.5;return F=F/10.5*255,[F,F,F]}let B=(~~(D>50)+1)*0.5,E=(F&1)*B*255,$=(F>>1&1)*B*255,q=(F>>2&1)*B*255;return[E,$,q]};M.ansi256.rgb=function(D){if(D>=232){let q=(D-232)*10+8;return[q,q,q]}D-=16;let F,B=Math.floor(D/36)/5*255,E=Math.floor((F=D%36)/6)/5*255,$=F%6/5*255;return[B,E,$]};M.rgb.hex=function(D){let B=(((Math.round(D[0])&255)<<16)+((Math.round(D[1])&255)<<8)+(Math.round(D[2])&255)).toString(16).toUpperCase();return"000000".substring(B.length)+B};M.hex.rgb=function(D){let F=D.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!F)return[0,0,0];let B=F[0];if(F[0].length===3)B=B.split("").map((J)=>{return J+J}).join("");let E=parseInt(B,16),$=E>>16&255,q=E>>8&255,X=E&255;return[$,q,X]};M.rgb.hcg=function(D){let F=D[0]/255,B=D[1]/255,E=D[2]/255,$=Math.max(Math.max(F,B),E),q=Math.min(Math.min(F,B),E),X=$-q,J,Q;if(X<1)J=q/(1-X);else J=0;if(X<=0)Q=0;else if($===F)Q=(B-E)/X%6;else if($===B)Q=2+(E-F)/X;else Q=4+(F-B)/X;return Q/=6,Q%=1,[Q*360,X*100,J*100]};M.hsl.hcg=function(D){let F=D[1]/100,B=D[2]/100,E=B<0.5?2*F*B:2*F*(1-B),$=0;if(E<1)$=(B-0.5*E)/(1-E);return[D[0],E*100,$*100]};M.hsv.hcg=function(D){let F=D[1]/100,B=D[2]/100,E=F*B,$=0;if(E<1)$=(B-E)/(1-E);return[D[0],E*100,$*100]};M.hcg.rgb=function(D){let F=D[0]/360,B=D[1]/100,E=D[2]/100;if(B===0)return[E*255,E*255,E*255];let $=[0,0,0],q=F%1*6,X=q%1,J=1-X,Q=0;switch(Math.floor(q)){case 0:$[0]=1,$[1]=X,$[2]=0;break;case 1:$[0]=J,$[1]=1,$[2]=0;break;case 2:$[0]=0,$[1]=1,$[2]=X;break;case 3:$[0]=0,$[1]=J,$[2]=1;break;case 4:$[0]=X,$[1]=0,$[2]=1;break;default:$[0]=1,$[1]=0,$[2]=J}return Q=(1-B)*E,[(B*$[0]+Q)*255,(B*$[1]+Q)*255,(B*$[2]+Q)*255]};M.hcg.hsv=function(D){let F=D[1]/100,B=D[2]/100,E=F+B*(1-F),$=0;if(E>0)$=F/E;return[D[0],$*100,E*100]};M.hcg.hsl=function(D){let F=D[1]/100,E=D[2]/100*(1-F)+0.5*F,$=0;if(E>0&&E<0.5)$=F/(2*E);else if(E>=0.5&&E<1)$=F/(2*(1-E));return[D[0],$*100,E*100]};M.hcg.hwb=function(D){let F=D[1]/100,B=D[2]/100,E=F+B*(1-F);return[D[0],(E-F)*100,(1-E)*100]};M.hwb.hcg=function(D){let F=D[1]/100,E=1-D[2]/100,$=E-F,q=0;if($<1)q=(E-$)/(1-$);return[D[0],$*100,q*100]};M.apple.rgb=function(D){return[D[0]/65535*255,D[1]/65535*255,D[2]/65535*255]};M.rgb.apple=function(D){return[D[0]/255*65535,D[1]/255*65535,D[2]/255*65535]};M.gray.rgb=function(D){return[D[0]/100*255,D[0]/100*255,D[0]/100*255]};M.gray.hsl=function(D){return[0,0,D[0]]};M.gray.hsv=M.gray.hsl;M.gray.hwb=function(D){return[0,100,D[0]]};M.gray.cmyk=function(D){return[0,0,0,D[0]]};M.gray.lab=function(D){return[D[0],0,0]};M.gray.hex=function(D){let F=Math.round(D[0]/100*255)&255,E=((F<<16)+(F<<8)+F).toString(16).toUpperCase();return"000000".substring(E.length)+E};M.rgb.gray=function(D){return[(D[0]+D[1]+D[2])/3/255*100]}});var o3=h((n7,a3)=>{var f2=z0();function L1(){let D={},F=Object.keys(f2);for(let B=F.length,E=0;E<B;E++)D[F[E]]={distance:-1,parent:null};return D}function K1(D){let F=L1(),B=[D];F[D].distance=0;while(B.length){let E=B.pop(),$=Object.keys(f2[E]);for(let q=$.length,X=0;X<q;X++){let J=$[X],Q=F[J];if(Q.distance===-1)Q.distance=F[E].distance+1,Q.parent=E,B.unshift(J)}}return F}function N1(D,F){return function(B){return F(D(B))}}function u1(D,F){let B=[F[D].parent,D],E=f2[F[D].parent][D],$=F[D].parent;while(F[$].parent)B.unshift(F[$].parent),E=N1(f2[F[$].parent][$],E),$=F[$].parent;return E.conversion=B,E}a3.exports=function(D){let F=K1(D),B={},E=Object.keys(F);for(let $=E.length,q=0;q<$;q++){let X=E[q];if(F[X].parent===null)continue;B[X]=u1(X,F)}return B}});var t3=h((i7,s3)=>{var U0=z0(),O1=o3(),cD={},w1=Object.keys(U0);function S1(D){let F=function(...B){let E=B[0];if(E===void 0||E===null)return E;if(E.length>1)B=E;return D(B)};if("conversion"in D)F.conversion=D.conversion;return F}function I1(D){let F=function(...B){let E=B[0];if(E===void 0||E===null)return E;if(E.length>1)B=E;let $=D(B);if(typeof $==="object")for(let q=$.length,X=0;X<q;X++)$[X]=Math.round($[X]);return $};if("conversion"in D)F.conversion=D.conversion;return F}w1.forEach((D)=>{cD[D]={},Object.defineProperty(cD[D],"channels",{value:U0[D].channels}),Object.defineProperty(cD[D],"labels",{value:U0[D].labels});let F=O1(D);Object.keys(F).forEach((E)=>{let $=F[E];cD[D][E]=I1($),cD[D][E].raw=S1($)})});s3.exports=cD});var $8=h((r7,E8)=>{var e3=(D,F)=>(...B)=>{return`\x1B[${D(...B)+F}m`},D8=(D,F)=>(...B)=>{let E=D(...B);return`\x1B[${38+F};5;${E}m`},F8=(D,F)=>(...B)=>{let E=D(...B);return`\x1B[${38+F};2;${E[0]};${E[1]};${E[2]}m`},v2=(D)=>D,B8=(D,F,B)=>[D,F,B],nD=(D,F,B)=>{Object.defineProperty(D,F,{get:()=>{let E=B();return Object.defineProperty(D,F,{value:E,enumerable:!0,configurable:!0}),E},enumerable:!0,configurable:!0})},V0,iD=(D,F,B,E)=>{if(V0===void 0)V0=t3();let $=E?10:0,q={};for(let[X,J]of Object.entries(V0)){let Q=X==="ansi16"?"ansi":X;if(X===F)q[Q]=D(B,$);else if(typeof J==="object")q[Q]=D(J[F],$)}return q};function P1(){let D=new Map,F={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};F.color.gray=F.color.blackBright,F.bgColor.bgGray=F.bgColor.bgBlackBright,F.color.grey=F.color.blackBright,F.bgColor.bgGrey=F.bgColor.bgBlackBright;for(let[B,E]of Object.entries(F)){for(let[$,q]of Object.entries(E))F[$]={open:`\x1B[${q[0]}m`,close:`\x1B[${q[1]}m`},E[$]=F[$],D.set(q[0],q[1]);Object.defineProperty(F,B,{value:E,enumerable:!1})}return Object.defineProperty(F,"codes",{value:D,enumerable:!1}),F.color.close="\x1B[39m",F.bgColor.close="\x1B[49m",nD(F.color,"ansi",()=>iD(e3,"ansi16",v2,!1)),nD(F.color,"ansi256",()=>iD(D8,"ansi256",v2,!1)),nD(F.color,"ansi16m",()=>iD(F8,"rgb",B8,!1)),nD(F.bgColor,"ansi",()=>iD(e3,"ansi16",v2,!0)),nD(F.bgColor,"ansi256",()=>iD(D8,"ansi256",v2,!0)),nD(F.bgColor,"ansi16m",()=>iD(F8,"rgb",B8,!0)),F}Object.defineProperty(E8,"exports",{enumerable:!0,get:P1})});var J8=h((a7,X8)=>{var R2=d3(),b1=M0(),T1=$8(),K0=new Set(["\x1B","\x9B"]),q8=(D)=>`${K0.values().next().value}[${D}m`,k1=(D)=>D.split(" ").map((F)=>R2(F)),L0=(D,F,B)=>{let E=[...F],$=!1,q=R2(b1(D[D.length-1]));for(let[X,J]of E.entries()){let Q=R2(J);if(q+Q<=B)D[D.length-1]+=J;else D.push(J),q=0;if(K0.has(J))$=!0;else if($&&J==="m"){$=!1;continue}if($)continue;if(q+=Q,q===B&&X<E.length-1)D.push(""),q=0}if(!q&&D[D.length-1].length>0&&D.length>1)D[D.length-2]+=D.pop()},f1=(D)=>{let F=D.split(" "),B=F.length;while(B>0){if(R2(F[B-1])>0)break;B--}if(B===F.length)return D;return F.slice(0,B).join(" ")+F.slice(B).join("")},v1=(D,F,B={})=>{if(B.trim!==!1&&D.trim()==="")return"";let E="",$="",q,X=k1(D),J=[""];for(let[Q,Y]of D.split(" ").entries()){if(B.trim!==!1)J[J.length-1]=J[J.length-1].trimLeft();let W=R2(J[J.length-1]);if(Q!==0){if(W>=F&&(B.wordWrap===!1||B.trim===!1))J.push(""),W=0;if(W>0||B.trim===!1)J[J.length-1]+=" ",W++}if(B.hard&&X[Q]>F){let C=F-W,U=1+Math.floor((X[Q]-C-1)/F);if(Math.floor((X[Q]-1)/F)<U)J.push("");L0(J,Y,F);continue}if(W+X[Q]>F&&W>0&&X[Q]>0){if(B.wordWrap===!1&&W<F){L0(J,Y,F);continue}J.push("")}if(W+X[Q]>F&&B.wordWrap===!1){L0(J,Y,F);continue}J[J.length-1]+=Y}if(B.trim!==!1)J=J.map(f1);E=J.join(`
|
|
25
|
+
`);for(let[Q,Y]of[...E].entries()){if($+=Y,K0.has(Y)){let C=parseFloat(/\d[^m]*/.exec(E.slice(Q,Q+4)));q=C===39?null:C}let W=T1.codes.get(Number(q));if(q&&W){if(E[Q+1]===`
|
|
26
|
+
`)$+=q8(W);else if(Y===`
|
|
27
|
+
`)$+=q8(q)}}return $};X8.exports=(D,F,B)=>{return String(D).normalize().replace(/\r\n/g,`
|
|
28
|
+
`).split(`
|
|
29
|
+
`).map((E)=>v1(E,F,B)).join(`
|
|
30
|
+
`)}});var _8=h((F9,H8)=>{var x1=KD("stream");class W8 extends x1{#B=null;constructor(D={}){super(D);this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=D.replace,this._prompt=D.prompt||null,this._hadControl=!1}#F(D,F){if(this._dest)return this._dest[D];if(this._src)return this._src[D];return F}#D(D,...F){if(typeof this._dest?.[D]==="function")this._dest[D](...F);if(typeof this._src?.[D]==="function")this._src[D](...F)}get isTTY(){if(this.#B!==null)return this.#B;return this.#F("isTTY",!1)}set isTTY(D){this.#B=D}get rows(){return this.#F("rows")}get columns(){return this.#F("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(D){this._src=D}pipe(D,F){return this._dest=D,super.pipe(D,F)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(D){if(this.muted){if(!this.replace)return!0;if(D.match(/^\u001b/)){if(D.indexOf(this._prompt)===0)D=D.slice(this._prompt.length),D=D.replace(/./g,this.replace),D=this._prompt+D;return this._hadControl=!0,this.emit("data",D)}else{if(this._prompt&&this._hadControl&&D.indexOf(this._prompt)===0)this._hadControl=!1,this.emit("data",this._prompt),D=D.slice(this._prompt.length);D=D.toString().replace(/./g,this.replace)}}this.emit("data",D)}end(D){if(this.muted)if(D&&this.replace)D=D.toString().replace(/./g,this.replace);else D=null;if(D)this.emit("data",D);this.emit("end")}destroy(...D){return this.#D("destroy",...D)}destroySoon(...D){return this.#D("destroySoon",...D)}close(...D){return this.#D("close",...D)}}H8.exports=W8});var K3=LD(L3(),1),{program:s5,createCommand:t5,createArgument:e5,createOption:D7,CommanderError:F7,InvalidArgumentError:B7,InvalidOptionArgumentError:E7,Command:N3,Argument:$7,Option:q7,Help:X7}=K3.default;var MD=(D,F=[])=>D.name==="up"||F.includes("vim")&&D.name==="k"||F.includes("emacs")&&D.ctrl&&D.name==="p",bD=(D,F=[])=>D.name==="down"||F.includes("vim")&&D.name==="j"||F.includes("emacs")&&D.ctrl&&D.name==="n",Q0=(D)=>D.name==="space",Y0=(D)=>D.name==="backspace",TD=(D)=>D.name==="tab",W0=(D)=>"1234567890".includes(D.name),DD=(D)=>D.name==="enter"||D.name==="return";class H0 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class _0 extends Error{name="CancelPromptError";message="Prompt was canceled"}class T2 extends Error{name="ExitPromptError"}class G0 extends Error{name="HookError"}class H2 extends Error{name="ValidationError"}import{AsyncResource as X1}from"async_hooks";import{AsyncLocalStorage as E1,AsyncResource as $1}from"async_hooks";var u3=new E1;function q1(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function O3(D,F){let B=q1(D);return u3.run(B,()=>{function E($){B.handleChange=()=>{B.index=0,$()},B.handleChange()}return F(E)})}function kD(){let D=u3.getStore();if(!D)throw new G0("[Inquirer] Hook functions can only be called from within a prompt");return D}function C0(){return kD().rl}function R0(D){let F=(...B)=>{let E=kD(),$=!1,q=E.handleChange;E.handleChange=()=>{$=!0};let X=D(...B);if($)q();return E.handleChange=q,X};return $1.bind(F)}function dD(D){let F=kD(),{index:B}=F,E={get(){return F.hooks[B]},set(q){F.hooks[B]=q},initialized:B in F.hooks},$=D(E);return F.index++,$}function w3(){kD().handleChange()}var fD={queue(D){let F=kD(),{index:B}=F;F.hooksEffect.push(()=>{F.hooksCleanup[B]?.();let E=D(C0());if(E!=null&&typeof E!=="function")throw new H2("useEffect return value must be a cleanup function or nothing.");F.hooksCleanup[B]=E})},run(){let D=kD();R0(()=>{D.hooksEffect.forEach((F)=>{F()}),D.hooksEffect.length=0})()},clearAll(){let D=kD();D.hooksCleanup.forEach((F)=>{F?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function v(D){return dD((F)=>{let B=X1.bind(function(q){if(F.get()!==q)F.set(q),w3()});if(F.initialized)return[F.get(),B];let E=typeof D==="function"?D():D;return F.set(E),[E,B]})}function AD(D,F){dD((B)=>{let E=B.get();if(!Array.isArray(E)||F.some((q,X)=>!Object.is(q,E[X])))fD.queue(D);B.set(F)})}var a=LD(_2(),1);import WD from"process";function Y1(){if(WD.platform!=="win32")return WD.env.TERM!=="linux";return Boolean(WD.env.WT_SESSION)||Boolean(WD.env.TERMINUS_SUBLIME)||WD.env.ConEmuTask==="{cmd::Cmder}"||WD.env.TERM_PROGRAM==="Terminus-Sublime"||WD.env.TERM_PROGRAM==="vscode"||WD.env.TERM==="xterm-256color"||WD.env.TERM==="alacritty"||WD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var I3={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},P3={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},W1={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},H1={...I3,...P3},_1={...I3,...W1},G1=Y1(),C1=G1?H1:_1,HD=C1,U7=Object.entries(P3);var b3={prefix:{idle:a.default.blue("?"),done:a.default.green(HD.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>a.default.yellow(D))},style:{answer:a.default.cyan,message:a.default.bold,error:(D)=>a.default.red(`> ${D}`),defaultAnswer:(D)=>a.default.dim(`(${D})`),help:a.default.dim,highlight:a.default.cyan,key:(D)=>a.default.cyan(a.default.bold(`<${D}>`))}};function T3(D){if(typeof D!=="object"||D===null)return!1;let F=D;while(Object.getPrototypeOf(F)!==null)F=Object.getPrototypeOf(F);return Object.getPrototypeOf(D)===F}function k3(...D){let F={};for(let B of D)for(let[E,$]of Object.entries(B)){let q=F[E];F[E]=T3(q)&&T3($)?k3(q,$):$}return F}function r(...D){let F=[b3,...D.filter((B)=>B!=null)];return k3(...F)}function FD({status:D="idle",theme:F}){let[B,E]=v(!1),[$,q]=v(0),{prefix:X,spinner:J}=r(F);if(AD(()=>{if(D==="loading"){let Y,W=-1,C=setTimeout(()=>{E(!0),Y=setInterval(()=>{W=W+1,q(W%J.frames.length)},J.interval)},300);return()=>{clearTimeout(C),clearInterval(Y)}}else E(!1)},[D]),B)return J.frames[$];return typeof X==="string"?X:X[D==="loading"?"idle":D]??X.idle}function G2(D,F){return dD((B)=>{let E=B.get();if(!E||E.dependencies.length!==F.length||E.dependencies.some(($,q)=>$!==F[q])){let $=D();return B.set({value:$,dependencies:F}),$}return E.value})}function k2(D){return v({current:D})[0]}function BD(D){let F=k2(D);F.current=D,AD((B)=>{let E=!1,$=R0((q,X)=>{if(E)return;F.current(X,B)});return B.input.on("keypress",$),()=>{E=!0,B.input.removeListener("keypress",$)}},[])}var Q8=LD(v3(),1),Y8=LD(J8(),1);function M2(D,F){return D.split(`
|
|
31
|
+
`).flatMap((B)=>Y8.default(B,F,{trim:!1,hard:!0}).split(`
|
|
32
|
+
`).map((E)=>E.trimEnd())).join(`
|
|
33
|
+
`)}function Z2(){return Q8.default({defaultWidth:80,output:C0().output})}function Z1({active:D,renderedItems:F,pageSize:B,loop:E}){let $=k2({lastPointer:D,lastActive:void 0}),{lastPointer:q,lastActive:X}=$.current,J=Math.floor(B/2),Q=F.reduce((C,U)=>C+U.length,0),Y=F.slice(0,D).reduce((C,U)=>C+U.length,0),W=Y;if(Q>B)if(E){if(W=q,X!=null&&X<D&&D-X<B)W=Math.min(J,Math.abs(D-X)===1?Math.min(q+(F[X]?.length??0),Math.max(Y,q)):q+D-X)}else{let C=F.slice(D).reduce((U,R)=>U+R.length,0);W=C<B-J?B-C:Math.min(Y,J)}return $.current.lastPointer=W,$.current.lastActive=D,W}function A2({items:D,active:F,renderItem:B,pageSize:E,loop:$=!0}){let q=Z2(),X=(V)=>(V%D.length+D.length)%D.length,J=D.map((V,O)=>{if(V==null)return[];return M2(B({item:V,index:O,isActive:O===F}),q).split(`
|
|
34
|
+
`)}),Q=J.reduce((V,O)=>V+O.length,0),Y=(V)=>J[V]??[],W=Z1({active:F,renderedItems:J,pageSize:E,loop:$}),C=Y(F).slice(0,E),U=W+C.length<=E?W:E-C.length,R=Array.from({length:E});R.splice(U,C.length,...C);let I=new Set([F]),b=U+C.length,T=X(F+1);while(b<E&&!I.has(T)&&($&&Q>E?T!==F:T>F)){let O=Y(T).slice(0,E-b);R.splice(b,O.length,...O),I.add(T),b+=O.length,T=X(T+1)}b=U-1,T=X(F-1);while(b>=0&&!I.has(T)&&($&&Q>E?T!==F:T<F)){let V=Y(T),O=V.slice(Math.max(0,V.length-b-1));R.splice(b-O.length+1,O.length,...O),I.add(T),b-=O.length,T=X(T-1)}return R.filter((V)=>typeof V==="string").join(`
|
|
35
|
+
`)}var V8=LD(_8(),1);import*as U8 from"readline";import{AsyncResource as p1}from"async_hooks";var vD=[];vD.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")vD.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")vD.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var x2=(D)=>!!D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function",N0=Symbol.for("signal-exit emitter"),u0=globalThis,y1=Object.defineProperty.bind(Object);class G8{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(u0[N0])return u0[N0];y1(u0,N0,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(D,F){this.listeners[D].push(F)}removeListener(D,F){let B=this.listeners[D],E=B.indexOf(F);if(E===-1)return;if(E===0&&B.length===1)B.length=0;else B.splice(E,1)}emit(D,F,B){if(this.emitted[D])return!1;this.emitted[D]=!0;let E=!1;for(let $ of this.listeners[D])E=$(F,B)===!0||E;if(D==="exit")E=this.emit("afterExit",F,B)||E;return E}}class w0{}var h1=(D)=>{return{onExit(F,B){return D.onExit(F,B)},load(){return D.load()},unload(){return D.unload()}}};class C8 extends w0{onExit(){return()=>{}}load(){}unload(){}}class R8 extends w0{#B=O0.platform==="win32"?"SIGINT":"SIGHUP";#F=new G8;#D;#q;#X;#$={};#E=!1;constructor(D){super();this.#D=D,this.#$={};for(let F of vD)this.#$[F]=()=>{let B=this.#D.listeners(F),{count:E}=this.#F,$=D;if(typeof $.__signal_exit_emitter__==="object"&&typeof $.__signal_exit_emitter__.count==="number")E+=$.__signal_exit_emitter__.count;if(B.length===E){this.unload();let q=this.#F.emit("exit",null,F),X=F==="SIGHUP"?this.#B:F;if(!q)D.kill(D.pid,X)}};this.#X=D.reallyExit,this.#q=D.emit}onExit(D,F){if(!x2(this.#D))return()=>{};if(this.#E===!1)this.load();let B=F?.alwaysLast?"afterExit":"exit";return this.#F.on(B,D),()=>{if(this.#F.removeListener(B,D),this.#F.listeners.exit.length===0&&this.#F.listeners.afterExit.length===0)this.unload()}}load(){if(this.#E)return;this.#E=!0,this.#F.count+=1;for(let D of vD)try{let F=this.#$[D];if(F)this.#D.on(D,F)}catch(F){}this.#D.emit=(D,...F)=>{return this.#Q(D,...F)},this.#D.reallyExit=(D)=>{return this.#J(D)}}unload(){if(!this.#E)return;this.#E=!1,vD.forEach((D)=>{let F=this.#$[D];if(!F)throw Error("Listener not defined for signal: "+D);try{this.#D.removeListener(D,F)}catch(B){}}),this.#D.emit=this.#q,this.#D.reallyExit=this.#X,this.#F.count-=1}#J(D){if(!x2(this.#D))return 0;return this.#D.exitCode=D||0,this.#F.emit("exit",this.#D.exitCode,null),this.#X.call(this.#D,this.#D.exitCode)}#Q(D,...F){let B=this.#q;if(D==="exit"&&x2(this.#D)){if(typeof F[0]==="number")this.#D.exitCode=F[0];let E=B.call(this.#D,D,...F);return this.#F.emit("exit",this.#D.exitCode,null),E}else return B.call(this.#D,D,...F)}}var O0=globalThis.process,{onExit:M8,load:$9,unload:q9}=h1(x2(O0)?new R8(O0):new C8);import{stripVTControlCharacters as m1}from"util";var g1="\x1B[G",y2="\x1B[?25l",j8="\x1B[?25h",S0=(D=1)=>D>0?`\x1B[${D}A`:"",I0=(D=1)=>D>0?`\x1B[${D}B`:"",P0=(D,F)=>{if(typeof F==="number"&&!Number.isNaN(F))return`\x1B[${F+1};${D+1}H`;return`\x1B[${D+1}G`},A8="\x1B[2K",b0=(D)=>D>0?(A8+S0(1)).repeat(D-1)+A8+g1:"";var z8=(D)=>D.split(`
|
|
36
|
+
`).length,l1=(D)=>D.split(`
|
|
37
|
+
`).pop()??"";class h2{height=0;extraLinesUnderPrompt=0;cursorPos;rl;constructor(D){this.rl=D,this.cursorPos=D.getCursorPos()}write(D){this.rl.output.unmute(),this.rl.output.write(D),this.rl.output.mute()}render(D,F=""){let B=l1(D),E=m1(B),$=E;if(this.rl.line.length>0)$=$.slice(0,-this.rl.line.length);this.rl.setPrompt($),this.cursorPos=this.rl.getCursorPos();let q=Z2();if(D=M2(D,q),F=M2(F,q),E.length%q===0)D+=`
|
|
38
|
+
`;let X=D+(F?`
|
|
39
|
+
`+F:""),Q=Math.floor(E.length/q)-this.cursorPos.rows+(F?z8(F):0);if(Q>0)X+=S0(Q);X+=P0(this.cursorPos.cols),this.write(I0(this.extraLinesUnderPrompt)+b0(this.height)+X),this.extraLinesUnderPrompt=Q,this.height=z8(X)}checkCursorPos(){let D=this.rl.getCursorPos();if(D.cols!==this.cursorPos.cols)this.write(P0(D.cols)),this.cursorPos=D}done({clearContent:D}){this.rl.setPrompt("");let F=I0(this.extraLinesUnderPrompt);F+=D?b0(this.height):`
|
|
40
|
+
`,F+=j8,this.write(F),this.rl.close()}}class T0 extends Promise{static withResolver(){let D,F;return{promise:new Promise((E,$)=>{D=E,F=$}),resolve:D,reject:F}}}function d1(){let D=Error.prepareStackTrace,F=[];try{Error.prepareStackTrace=(B,E)=>{let $=E.slice(1);return F=$,$},Error().stack}catch{return F}return Error.prepareStackTrace=D,F}function ED(D){let F=d1();return(E,$={})=>{let{input:q=process.stdin,signal:X}=$,J=new Set,Q=new V8.default;Q.pipe($.output??process.stdout);let Y=U8.createInterface({terminal:!0,input:q,output:Q}),W=new h2(Y),{promise:C,resolve:U,reject:R}=T0.withResolver(),I=()=>R(new _0);if(X){let V=()=>R(new H0({cause:X.reason}));if(X.aborted)return V(),Object.assign(C,{cancel:I});X.addEventListener("abort",V),J.add(()=>X.removeEventListener("abort",V))}J.add(M8((V,O)=>{R(new T2(`User force closed the prompt with ${V} ${O}`))}));let b=()=>R(new T2("User force closed the prompt with SIGINT"));Y.on("SIGINT",b),J.add(()=>Y.removeListener("SIGINT",b));let T=()=>W.checkCursorPos();return Y.input.on("keypress",T),J.add(()=>Y.input.removeListener("keypress",T)),O3(Y,(V)=>{let O=p1.bind(()=>fD.clearAll());return Y.on("close",O),J.add(()=>Y.removeListener("close",O)),V(()=>{try{let Z=D(E,(VD)=>{setImmediate(()=>U(VD))});if(Z===void 0){let VD=F[1]?.getFileName();throw Error(`Prompt functions must return a string.
|
|
41
|
+
at ${VD}`)}let[i,c]=typeof Z==="string"?[Z]:Z;W.render(i,c),fD.run()}catch(Z){R(Z)}}),Object.assign(C.then((Z)=>{return fD.clearAll(),Z},(Z)=>{throw fD.clearAll(),Z}).finally(()=>{J.forEach((Z)=>Z()),W.done({clearContent:Boolean($.clearPromptOnDone)}),Q.end()}).then(()=>C),{cancel:I})})}}var L8=LD(_2(),1);class o{separator=L8.default.dim(Array.from({length:15}).join(HD.line));type="separator";constructor(D){if(D)this.separator=D}static isSeparator(D){return Boolean(D&&typeof D==="object"&&"type"in D&&D.type==="separator")}}var ZD=LD(_2(),1);var c1={icon:{checked:ZD.default.green(HD.circleFilled),unchecked:HD.circle,cursor:HD.pointer},style:{disabledChoice:(D)=>ZD.default.dim(`- ${D}`),renderSelectedChoices:(D)=>D.map((F)=>F.short).join(", "),description:(D)=>ZD.default.cyan(D),keysHelpTip:(D)=>D.map(([F,B])=>`${ZD.default.bold(F)} ${ZD.default.dim(B)}`).join(ZD.default.dim(" \u2022 "))},helpMode:"always",keybindings:[]};function ND(D){return!o.isSeparator(D)&&!D.disabled}function k0(D){return ND(D)&&D.checked}function f0(D){return ND(D)?{...D,checked:!D.checked}:D}function n1(D){return function(F){return ND(F)?{...F,checked:D}:F}}function i1(D){return D.map((F)=>{if(o.isSeparator(F))return F;if(typeof F==="string")return{value:F,name:F,short:F,checkedName:F,disabled:!1,checked:!1};let B=F.name??String(F.value),E={value:F.value,name:B,short:F.short??B,checkedName:F.checkedName??B,disabled:F.disabled??!1,checked:F.checked??!1};if(F.description)E.description=F.description;return E})}var r1=ED((D,F)=>{let{instructions:B,pageSize:E=7,loop:$=!0,required:q,validate:X=()=>!0}=D,J={all:"a",invert:"i",...D.shortcuts},Q=r(c1,D.theme),{keybindings:Y}=Q,[W,C]=v("idle"),U=FD({status:W,theme:Q}),[R,I]=v(i1(D.choices)),b=G2(()=>{let P=R.findIndex(ND),L=R.findLastIndex(ND);if(P===-1)throw new H2("[checkbox prompt] No selectable choices. All choices are disabled.");return{first:P,last:L}},[R]),[T,V]=v(b.first),[O,Z]=v();BD(async(P)=>{if(DD(P)){let L=R.filter(k0),k=await X([...L]);if(q&&!R.some(k0))Z("At least one choice must be selected");else if(k===!0)C("done"),F(L.map((g)=>g.value));else Z(k||"You must select a valid value")}else if(MD(P,Y)||bD(P,Y)){if($||MD(P,Y)&&T!==b.first||bD(P,Y)&&T!==b.last){let L=MD(P,Y)?-1:1,k=T;do k=(k+L+R.length)%R.length;while(!ND(R[k]));V(k)}}else if(Q0(P))Z(void 0),I(R.map((L,k)=>k===T?f0(L):L));else if(P.name===J.all){let L=R.some((k)=>ND(k)&&!k.checked);I(R.map(n1(L)))}else if(P.name===J.invert)I(R.map(f0));else if(W0(P)){let L=Number(P.name)-1,k=-1,g=R.findIndex((YD)=>{if(o.isSeparator(YD))return!1;return k++,k===L}),e=R[g];if(e&&ND(e))V(g),I(R.map((YD,Y2)=>Y2===g?f0(YD):YD))}});let i=Q.style.message(D.message,W),c,VD=A2({items:R,active:T,renderItem({item:P,isActive:L}){if(o.isSeparator(P))return` ${P.separator}`;if(P.disabled){let Y2=typeof P.disabled==="string"?P.disabled:"(disabled)";return Q.style.disabledChoice(`${P.name} ${Y2}`)}if(L)c=P.description;let k=P.checked?Q.icon.checked:Q.icon.unchecked,g=P.checked?P.checkedName:P.name,e=L?Q.style.highlight:(Y2)=>Y2,YD=L?Q.icon.cursor:" ";return e(`${YD}${k} ${g}`)},pageSize:E,loop:$});if(W==="done"){let P=R.filter(k0),L=Q.style.answer(Q.style.renderSelectedChoices(P,R));return[U,i,L].filter(Boolean).join(" ")}let pD;if(Q.helpMode!=="never"&&B!==!1)if(typeof B==="string")pD=B;else{let P=[["\u2191\u2193","navigate"],["space","select"]];if(J.all)P.push([J.all,"all"]);if(J.invert)P.push([J.invert,"invert"]);P.push(["\u23CE","submit"]),pD=Q.style.keysHelpTip(P)}return`${[[U,i].filter(Boolean).join(" "),VD," ",c?Q.style.description(c):"",O?Q.style.error(O):"",pD].filter(Boolean).join(`
|
|
42
|
+
`).trimEnd()}${y2}`});function K8(D,F){let B=F!==!1;if(/^(y|yes)/i.test(D))B=!0;else if(/^(n|no)/i.test(D))B=!1;return B}function N8(D){return D?"Yes":"No"}var v0=ED((D,F)=>{let{transformer:B=N8}=D,[E,$]=v("idle"),[q,X]=v(""),J=r(D.theme),Q=FD({status:E,theme:J});BD((U,R)=>{if(E!=="idle")return;if(DD(U)){let I=K8(q,D.default);X(B(I)),$("done"),F(I)}else if(TD(U)){let I=N8(!K8(q,D.default));R.clearLine(0),R.write(I),X(I)}else X(R.line)});let Y=q,W="";if(E==="done")Y=J.style.answer(q);else W=` ${J.style.defaultAnswer(D.default===!1?"y/N":"Y/n")}`;let C=J.style.message(D.message,E);return`${Q} ${C}${W} ${Y}`});var a1={validationFailureMode:"keep"},Z0=ED((D,F)=>{let{prefill:B="tab"}=D,E=r(a1,D.theme),[$,q]=v("idle"),[X="",J]=v(D.default),[Q,Y]=v(),[W,C]=v(""),U=FD({status:$,theme:E});async function R(O){let{required:Z,pattern:i,patternError:c="Invalid input"}=D;if(Z&&!O)return"You must provide a value";if(i&&!i.test(O))return c;if(typeof D.validate==="function")return await D.validate(O)||"You must provide a valid value";return!0}BD(async(O,Z)=>{if($!=="idle")return;if(DD(O)){let i=W||X;q("loading");let c=await R(i);if(c===!0)C(i),q("done"),F(i);else{if(E.validationFailureMode==="clear")C("");else Z.write(W);Y(c),q("idle")}}else if(Y0(O)&&!W)J(void 0);else if(TD(O)&&!W)J(void 0),Z.clearLine(0),Z.write(X),C(X);else C(Z.line),Y(void 0)}),AD((O)=>{if(B==="editable"&&X)O.write(X),C(X)},[]);let I=E.style.message(D.message,$),b=W;if(typeof D.transformer==="function")b=D.transformer(W,{isFinal:$==="done"});else if($==="done")b=E.style.answer(W);let T;if(X&&$!=="done"&&!W)T=E.style.defaultAnswer(X);let V="";if(Q)V=E.style.error(Q);return[[U,I,T,b].filter((O)=>O!==void 0).join(" "),V]});var x0=ED((D,F)=>{let{validate:B=()=>!0}=D,E=r(D.theme),[$,q]=v("idle"),[X,J]=v(),[Q,Y]=v(""),W=FD({status:$,theme:E});BD(async(b,T)=>{if($!=="idle")return;if(DD(b)){let V=Q;q("loading");let O=await B(V);if(O===!0)Y(V),q("done"),F(V);else T.write(Q),J(O||"You must provide a valid value"),q("idle")}else Y(T.line),J(void 0)});let C=E.style.message(D.message,$),U="",R;if(D.mask)U=(typeof D.mask==="string"?D.mask:"*").repeat(Q.length);else if($!=="done")R=`${E.style.help("[input is masked]")}${y2}`;if($==="done")U=E.style.answer(U);let I="";if(X)I=E.style.error(X);return[[W,C,D.mask?U:R].join(" "),I]});var xD=LD(_2(),1);var o1={icon:{cursor:HD.pointer},style:{disabled:(D)=>xD.default.dim(`- ${D}`),searchTerm:(D)=>xD.default.cyan(D),description:(D)=>xD.default.cyan(D),keysHelpTip:(D)=>D.map(([F,B])=>`${xD.default.bold(F)} ${xD.default.dim(B)}`).join(xD.default.dim(" \u2022 "))},helpMode:"always"};function y0(D){return!o.isSeparator(D)&&!D.disabled}function s1(D){return D.map((F)=>{if(o.isSeparator(F))return F;if(typeof F==="string")return{value:F,name:F,short:F,disabled:!1};let B=F.name??String(F.value),E={value:F.value,name:B,short:F.short??B,disabled:F.disabled??!1};if(F.description)E.description=F.description;return E})}var h0=ED((D,F)=>{let{pageSize:B=7,validate:E=()=>!0}=D,$=r(o1,D.theme),[q,X]=v("loading"),[J,Q]=v(""),[Y,W]=v([]),[C,U]=v(),R=FD({status:q,theme:$}),I=G2(()=>{let L=Y.findIndex(y0),k=Y.findLastIndex(y0);return{first:L,last:k}},[Y]),[b=I.first,T]=v();AD(()=>{let L=new AbortController;return X("loading"),U(void 0),(async()=>{try{let g=await D.source(J||void 0,{signal:L.signal});if(!L.signal.aborted)T(void 0),U(void 0),W(s1(g)),X("idle")}catch(g){if(!L.signal.aborted&&g instanceof Error)U(g.message)}})(),()=>{L.abort()}},[J]);let V=Y[b];BD(async(L,k)=>{if(DD(L))if(V){X("loading");let g=await E(V.value);if(X("idle"),g===!0)X("done"),F(V.value);else if(V.name===J)U(g||"You must provide a valid value");else k.write(V.name),Q(V.name)}else k.write(J);else if(TD(L)&&V)k.clearLine(0),k.write(V.name),Q(V.name);else if(q!=="loading"&&(MD(L)||bD(L))){if(k.clearLine(0),MD(L)&&b!==I.first||bD(L)&&b!==I.last){let g=MD(L)?-1:1,e=b;do e=(e+g+Y.length)%Y.length;while(!y0(Y[e]));T(e)}}else Q(k.line)});let O=$.style.message(D.message,q),Z;if($.helpMode!=="never")if(D.instructions){let{pager:L,navigation:k}=D.instructions;Z=$.style.help(Y.length>B?L:k)}else Z=$.style.keysHelpTip([["\u2191\u2193","navigate"],["\u23CE","select"]]);let i=A2({items:Y,active:b,renderItem({item:L,isActive:k}){if(o.isSeparator(L))return` ${L.separator}`;if(L.disabled){let YD=typeof L.disabled==="string"?L.disabled:"(disabled)";return $.style.disabled(`${L.name} ${YD}`)}let g=k?$.style.highlight:(YD)=>YD,e=k?$.icon.cursor:" ";return g(`${e} ${L.name}`)},pageSize:B,loop:!1}),c;if(C)c=$.style.error(C);else if(Y.length===0&&J!==""&&q==="idle")c=$.style.error("No results found");let VD;if(q==="done"&&V)return[R,O,$.style.answer(V.short)].filter(Boolean).join(" ").trimEnd();else VD=$.style.searchTerm(J);let pD=V?.description,Q3=[R,O,VD].filter(Boolean).join(" ").trimEnd(),P=[c??i," ",pD?$.style.description(pD):"",Z].filter(Boolean).join(`
|
|
43
|
+
`).trimEnd();return[Q3,P]});async function j2(D,F){try{try{new URL(D)}catch{return{success:!1,error:"invalid_url",message:`Invalid URL format: ${D}`}}let B=await fetch(`${D}/v1/models`,{method:"GET",headers:{Authorization:`Bearer ${F}`,"Content-Type":"application/json"}});if(B.status===401||B.status===403)return{success:!1,error:"auth_failure",message:"Authentication failed. Check your API key."};if(!B.ok)return{success:!1,error:"unknown",message:`Server returned ${B.status}: ${B.statusText}`};let $=(await B.json()).data||[];return{success:!0,modelCount:$.length,models:$}}catch(B){if(B.cause?.code==="ECONNREFUSED"||B.message?.includes("ECONNREFUSED"))return{success:!1,error:"network_error",message:`Connection refused. Is the server running at ${D}?`};if(B.cause?.code==="ENOTFOUND"||B.message?.includes("ENOTFOUND"))return{success:!1,error:"network_error",message:`Could not resolve hostname. Check the URL: ${D}`};if(B.name==="AbortError"||B.message?.includes("timeout"))return{success:!1,error:"network_error",message:"Connection timed out. Check your network and the server URL."};return{success:!1,error:"network_error",message:`Network error: ${B.message||"Unknown error"}`}}}import{existsSync as c0,mkdirSync as Y5,readFileSync as W5,writeFileSync as H5,unlinkSync as P4}from"fs";import{homedir as _5}from"os";import{join as Z8}from"path";var f={};C6(f,{void:()=>vF,util:()=>S,unknown:()=>kF,union:()=>hF,undefined:()=>PF,tuple:()=>lF,transformer:()=>tF,symbol:()=>IF,string:()=>k8,strictObject:()=>yF,setErrorMap:()=>DF,set:()=>cF,record:()=>pF,quotelessJson:()=>t1,promise:()=>sF,preprocess:()=>F5,pipeline:()=>B5,ostring:()=>E5,optional:()=>eF,onumber:()=>$5,oboolean:()=>q5,objectUtil:()=>g0,object:()=>xF,number:()=>f8,nullable:()=>D5,null:()=>bF,never:()=>fF,nativeEnum:()=>oF,nan:()=>OF,map:()=>dF,makeIssue:()=>z2,literal:()=>rF,lazy:()=>iF,late:()=>NF,isValid:()=>uD,isDirty:()=>m2,isAsync:()=>aD,isAborted:()=>g2,intersection:()=>mF,instanceof:()=>uF,getParsedType:()=>_D,getErrorMap:()=>rD,function:()=>nF,enum:()=>aF,effect:()=>tF,discriminatedUnion:()=>gF,defaultErrorMap:()=>jD,datetimeRegex:()=>P8,date:()=>SF,custom:()=>T8,coerce:()=>X5,boolean:()=>v8,bigint:()=>wF,array:()=>ZF,any:()=>TF,addIssueToContext:()=>G,ZodVoid:()=>V2,ZodUnknown:()=>OD,ZodUnion:()=>F2,ZodUndefined:()=>eD,ZodType:()=>w,ZodTuple:()=>CD,ZodTransformer:()=>QD,ZodSymbol:()=>U2,ZodString:()=>$D,ZodSet:()=>mD,ZodSchema:()=>w,ZodRecord:()=>L2,ZodReadonly:()=>Q2,ZodPromise:()=>lD,ZodPipeline:()=>u2,ZodParsedType:()=>_,ZodOptional:()=>XD,ZodObject:()=>x,ZodNumber:()=>wD,ZodNullable:()=>UD,ZodNull:()=>D2,ZodNever:()=>GD,ZodNativeEnum:()=>q2,ZodNaN:()=>N2,ZodMap:()=>K2,ZodLiteral:()=>$2,ZodLazy:()=>E2,ZodIssueCode:()=>H,ZodIntersection:()=>B2,ZodFunction:()=>sD,ZodFirstPartyTypeKind:()=>z,ZodError:()=>n,ZodEnum:()=>ID,ZodEffects:()=>QD,ZodDiscriminatedUnion:()=>l2,ZodDefault:()=>X2,ZodDate:()=>hD,ZodCatch:()=>J2,ZodBranded:()=>p2,ZodBoolean:()=>tD,ZodBigInt:()=>SD,ZodArray:()=>qD,ZodAny:()=>gD,Schema:()=>w,ParseStatus:()=>m,OK:()=>p,NEVER:()=>J5,INVALID:()=>j,EMPTY_PATH:()=>FF,DIRTY:()=>yD,BRAND:()=>KF});var S;(function(D){D.assertEqual=($)=>{};function F($){}D.assertIs=F;function B($){throw Error()}D.assertNever=B,D.arrayToEnum=($)=>{let q={};for(let X of $)q[X]=X;return q},D.getValidEnumValues=($)=>{let q=D.objectKeys($).filter((J)=>typeof $[$[J]]!=="number"),X={};for(let J of q)X[J]=$[J];return D.objectValues(X)},D.objectValues=($)=>{return D.objectKeys($).map(function(q){return $[q]})},D.objectKeys=typeof Object.keys==="function"?($)=>Object.keys($):($)=>{let q=[];for(let X in $)if(Object.prototype.hasOwnProperty.call($,X))q.push(X);return q},D.find=($,q)=>{for(let X of $)if(q(X))return X;return},D.isInteger=typeof Number.isInteger==="function"?($)=>Number.isInteger($):($)=>typeof $==="number"&&Number.isFinite($)&&Math.floor($)===$;function E($,q=" | "){return $.map((X)=>typeof X==="string"?`'${X}'`:X).join(q)}D.joinValues=E,D.jsonStringifyReplacer=($,q)=>{if(typeof q==="bigint")return q.toString();return q}})(S||(S={}));var g0;(function(D){D.mergeShapes=(F,B)=>{return{...F,...B}}})(g0||(g0={}));var _=S.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_D=(D)=>{switch(typeof D){case"undefined":return _.undefined;case"string":return _.string;case"number":return Number.isNaN(D)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":if(Array.isArray(D))return _.array;if(D===null)return _.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return _.promise;if(typeof Map<"u"&&D instanceof Map)return _.map;if(typeof Set<"u"&&D instanceof Set)return _.set;if(typeof Date<"u"&&D instanceof Date)return _.date;return _.object;default:return _.unknown}};var H=S.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),t1=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")};class n extends Error{get errors(){return this.issues}constructor(D){super();this.issues=[],this.addIssue=(B)=>{this.issues=[...this.issues,B]},this.addIssues=(B=[])=>{this.issues=[...this.issues,...B]};let F=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,F);else this.__proto__=F;this.name="ZodError",this.issues=D}format(D){let F=D||function($){return $.message},B={_errors:[]},E=($)=>{for(let q of $.issues)if(q.code==="invalid_union")q.unionErrors.map(E);else if(q.code==="invalid_return_type")E(q.returnTypeError);else if(q.code==="invalid_arguments")E(q.argumentsError);else if(q.path.length===0)B._errors.push(F(q));else{let X=B,J=0;while(J<q.path.length){let Q=q.path[J];if(J!==q.path.length-1)X[Q]=X[Q]||{_errors:[]};else X[Q]=X[Q]||{_errors:[]},X[Q]._errors.push(F(q));X=X[Q],J++}}};return E(this),B}static assert(D){if(!(D instanceof n))throw Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,S.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(D=(F)=>F.message){let F={},B=[];for(let E of this.issues)if(E.path.length>0){let $=E.path[0];F[$]=F[$]||[],F[$].push(D(E))}else B.push(D(E));return{formErrors:B,fieldErrors:F}}get formErrors(){return this.flatten()}}n.create=(D)=>{return new n(D)};var e1=(D,F)=>{let B;switch(D.code){case H.invalid_type:if(D.received===_.undefined)B="Required";else B=`Expected ${D.expected}, received ${D.received}`;break;case H.invalid_literal:B=`Invalid literal value, expected ${JSON.stringify(D.expected,S.jsonStringifyReplacer)}`;break;case H.unrecognized_keys:B=`Unrecognized key(s) in object: ${S.joinValues(D.keys,", ")}`;break;case H.invalid_union:B="Invalid input";break;case H.invalid_union_discriminator:B=`Invalid discriminator value. Expected ${S.joinValues(D.options)}`;break;case H.invalid_enum_value:B=`Invalid enum value. Expected ${S.joinValues(D.options)}, received '${D.received}'`;break;case H.invalid_arguments:B="Invalid function arguments";break;case H.invalid_return_type:B="Invalid function return type";break;case H.invalid_date:B="Invalid date";break;case H.invalid_string:if(typeof D.validation==="object")if("includes"in D.validation){if(B=`Invalid input: must include "${D.validation.includes}"`,typeof D.validation.position==="number")B=`${B} at one or more positions greater than or equal to ${D.validation.position}`}else if("startsWith"in D.validation)B=`Invalid input: must start with "${D.validation.startsWith}"`;else if("endsWith"in D.validation)B=`Invalid input: must end with "${D.validation.endsWith}"`;else S.assertNever(D.validation);else if(D.validation!=="regex")B=`Invalid ${D.validation}`;else B="Invalid";break;case H.too_small:if(D.type==="array")B=`Array must contain ${D.exact?"exactly":D.inclusive?"at least":"more than"} ${D.minimum} element(s)`;else if(D.type==="string")B=`String must contain ${D.exact?"exactly":D.inclusive?"at least":"over"} ${D.minimum} character(s)`;else if(D.type==="number")B=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="bigint")B=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="date")B=`Date must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(D.minimum))}`;else B="Invalid input";break;case H.too_big:if(D.type==="array")B=`Array must contain ${D.exact?"exactly":D.inclusive?"at most":"less than"} ${D.maximum} element(s)`;else if(D.type==="string")B=`String must contain ${D.exact?"exactly":D.inclusive?"at most":"under"} ${D.maximum} character(s)`;else if(D.type==="number")B=`Number must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="bigint")B=`BigInt must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="date")B=`Date must be ${D.exact?"exactly":D.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(D.maximum))}`;else B="Invalid input";break;case H.custom:B="Invalid input";break;case H.invalid_intersection_types:B="Intersection results could not be merged";break;case H.not_multiple_of:B=`Number must be a multiple of ${D.multipleOf}`;break;case H.not_finite:B="Number must be finite";break;default:B=F.defaultError,S.assertNever(D)}return{message:B}},jD=e1;var u8=jD;function DF(D){u8=D}function rD(){return u8}var z2=(D)=>{let{data:F,path:B,errorMaps:E,issueData:$}=D,q=[...B,...$.path||[]],X={...$,path:q};if($.message!==void 0)return{...$,path:q,message:$.message};let J="",Q=E.filter((Y)=>!!Y).slice().reverse();for(let Y of Q)J=Y(X,{data:F,defaultError:J}).message;return{...$,path:q,message:J}},FF=[];function G(D,F){let B=rD(),E=z2({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,B,B===jD?void 0:jD].filter(($)=>!!$)});D.common.issues.push(E)}class m{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(D,F){let B=[];for(let E of F){if(E.status==="aborted")return j;if(E.status==="dirty")D.dirty();B.push(E.value)}return{status:D.value,value:B}}static async mergeObjectAsync(D,F){let B=[];for(let E of F){let $=await E.key,q=await E.value;B.push({key:$,value:q})}return m.mergeObjectSync(D,B)}static mergeObjectSync(D,F){let B={};for(let E of F){let{key:$,value:q}=E;if($.status==="aborted")return j;if(q.status==="aborted")return j;if($.status==="dirty")D.dirty();if(q.status==="dirty")D.dirty();if($.value!=="__proto__"&&(typeof q.value<"u"||E.alwaysSet))B[$.value]=q.value}return{status:D.value,value:B}}}var j=Object.freeze({status:"aborted"}),yD=(D)=>({status:"dirty",value:D}),p=(D)=>({status:"valid",value:D}),g2=(D)=>D.status==="aborted",m2=(D)=>D.status==="dirty",uD=(D)=>D.status==="valid",aD=(D)=>typeof Promise<"u"&&D instanceof Promise;var A;(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(A||(A={}));class JD{constructor(D,F,B,E){this._cachedPath=[],this.parent=D,this.data=F,this._path=B,this._key=E}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var O8=(D,F)=>{if(uD(F))return{success:!0,data:F.value};else{if(!D.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let B=new n(D.common.issues);return this._error=B,this._error}}}};function N(D){if(!D)return{};let{errorMap:F,invalid_type_error:B,required_error:E,description:$}=D;if(F&&(B||E))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(F)return{errorMap:F,description:$};return{errorMap:(X,J)=>{let{message:Q}=D;if(X.code==="invalid_enum_value")return{message:Q??J.defaultError};if(typeof J.data>"u")return{message:Q??E??J.defaultError};if(X.code!=="invalid_type")return{message:J.defaultError};return{message:Q??B??J.defaultError}},description:$}}class w{get description(){return this._def.description}_getType(D){return _D(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:_D(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new m,ctx:{common:D.parent.common,data:D.data,parsedType:_D(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(aD(F))throw Error("Synchronous parse encountered promise.");return F}_parseAsync(D){let F=this._parse(D);return Promise.resolve(F)}parse(D,F){let B=this.safeParse(D,F);if(B.success)return B.data;throw B.error}safeParse(D,F){let B={common:{issues:[],async:F?.async??!1,contextualErrorMap:F?.errorMap},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:_D(D)},E=this._parseSync({data:D,path:B.path,parent:B});return O8(B,E)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:_D(D)};if(!this["~standard"].async)try{let B=this._parseSync({data:D,path:[],parent:F});return uD(B)?{value:B.value}:{issues:F.common.issues}}catch(B){if(B?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;F.common={issues:[],async:!0}}return this._parseAsync({data:D,path:[],parent:F}).then((B)=>uD(B)?{value:B.value}:{issues:F.common.issues})}async parseAsync(D,F){let B=await this.safeParseAsync(D,F);if(B.success)return B.data;throw B.error}async safeParseAsync(D,F){let B={common:{issues:[],contextualErrorMap:F?.errorMap,async:!0},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:_D(D)},E=this._parse({data:D,path:B.path,parent:B}),$=await(aD(E)?E:Promise.resolve(E));return O8(B,$)}refine(D,F){let B=(E)=>{if(typeof F==="string"||typeof F>"u")return{message:F};else if(typeof F==="function")return F(E);else return F};return this._refinement((E,$)=>{let q=D(E),X=()=>$.addIssue({code:H.custom,...B(E)});if(typeof Promise<"u"&&q instanceof Promise)return q.then((J)=>{if(!J)return X(),!1;else return!0});if(!q)return X(),!1;else return!0})}refinement(D,F){return this._refinement((B,E)=>{if(!D(B))return E.addIssue(typeof F==="function"?F(B,E):F),!1;else return!0})}_refinement(D){return new QD({schema:this,typeName:z.ZodEffects,effect:{type:"refinement",refinement:D}})}superRefine(D){return this._refinement(D)}constructor(D){this.spa=this.safeParseAsync,this._def=D,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(F)=>this["~validate"](F)}}optional(){return XD.create(this,this._def)}nullable(){return UD.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qD.create(this)}promise(){return lD.create(this,this._def)}or(D){return F2.create([this,D],this._def)}and(D){return B2.create(this,D,this._def)}transform(D){return new QD({...N(this._def),schema:this,typeName:z.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new X2({...N(this._def),innerType:this,defaultValue:F,typeName:z.ZodDefault})}brand(){return new p2({typeName:z.ZodBranded,type:this,...N(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new J2({...N(this._def),innerType:this,catchValue:F,typeName:z.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return u2.create(this,D)}readonly(){return Q2.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var BF=/^c[^\s-]{8,}$/i,EF=/^[0-9a-z]+$/,$F=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qF=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,XF=/^[a-z0-9_-]{21}$/i,JF=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,QF=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,YF=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,WF="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",m0,HF=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_F=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,GF=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,CF=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,RF=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,MF=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,S8="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",AF=new RegExp(`^${S8}$`);function I8(D){let F="[0-5]\\d";if(D.precision)F=`${F}\\.\\d{${D.precision}}`;else if(D.precision==null)F=`${F}(\\.\\d+)?`;let B=D.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${F})${B}`}function jF(D){return new RegExp(`^${I8(D)}$`)}function P8(D){let F=`${S8}T${I8(D)}`,B=[];if(B.push(D.local?"Z?":"Z"),D.offset)B.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${B.join("|")})`,new RegExp(`^${F}$`)}function zF(D,F){if((F==="v4"||!F)&&HF.test(D))return!0;if((F==="v6"||!F)&&GF.test(D))return!0;return!1}function UF(D,F){if(!JF.test(D))return!1;try{let[B]=D.split(".");if(!B)return!1;let E=B.replace(/-/g,"+").replace(/_/g,"/").padEnd(B.length+(4-B.length%4)%4,"="),$=JSON.parse(atob(E));if(typeof $!=="object"||$===null)return!1;if("typ"in $&&$?.typ!=="JWT")return!1;if(!$.alg)return!1;if(F&&$.alg!==F)return!1;return!0}catch{return!1}}function VF(D,F){if((F==="v4"||!F)&&_F.test(D))return!0;if((F==="v6"||!F)&&CF.test(D))return!0;return!1}class $D extends w{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==_.string){let $=this._getOrReturnCtx(D);return G($,{code:H.invalid_type,expected:_.string,received:$.parsedType}),j}let B=new m,E=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(D.data.length<$.value)E=this._getOrReturnCtx(D,E),G(E,{code:H.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),B.dirty()}else if($.kind==="max"){if(D.data.length>$.value)E=this._getOrReturnCtx(D,E),G(E,{code:H.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),B.dirty()}else if($.kind==="length"){let q=D.data.length>$.value,X=D.data.length<$.value;if(q||X){if(E=this._getOrReturnCtx(D,E),q)G(E,{code:H.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});else if(X)G(E,{code:H.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});B.dirty()}}else if($.kind==="email"){if(!YF.test(D.data))E=this._getOrReturnCtx(D,E),G(E,{validation:"email",code:H.invalid_string,message:$.message}),B.dirty()}else if($.kind==="emoji"){if(!m0)m0=new RegExp(WF,"u");if(!m0.test(D.data))E=this._getOrReturnCtx(D,E),G(E,{validation:"emoji",code:H.invalid_string,message:$.message}),B.dirty()}else if($.kind==="uuid"){if(!qF.test(D.data))E=this._getOrReturnCtx(D,E),G(E,{validation:"uuid",code:H.invalid_string,message:$.message}),B.dirty()}else if($.kind==="nanoid"){if(!XF.test(D.data))E=this._getOrReturnCtx(D,E),G(E,{validation:"nanoid",code:H.invalid_string,message:$.message}),B.dirty()}else if($.kind==="cuid"){if(!BF.test(D.data))E=this._getOrReturnCtx(D,E),G(E,{validation:"cuid",code:H.invalid_string,message:$.message}),B.dirty()}else if($.kind==="cuid2"){if(!EF.test(D.data))E=this._getOrReturnCtx(D,E),G(E,{validation:"cuid2",code:H.invalid_string,message:$.message}),B.dirty()}else if($.kind==="ulid"){if(!$F.test(D.data))E=this._getOrReturnCtx(D,E),G(E,{validation:"ulid",code:H.invalid_string,message:$.message}),B.dirty()}else if($.kind==="url")try{new URL(D.data)}catch{E=this._getOrReturnCtx(D,E),G(E,{validation:"url",code:H.invalid_string,message:$.message}),B.dirty()}else if($.kind==="regex"){if($.regex.lastIndex=0,!$.regex.test(D.data))E=this._getOrReturnCtx(D,E),G(E,{validation:"regex",code:H.invalid_string,message:$.message}),B.dirty()}else if($.kind==="trim")D.data=D.data.trim();else if($.kind==="includes"){if(!D.data.includes($.value,$.position))E=this._getOrReturnCtx(D,E),G(E,{code:H.invalid_string,validation:{includes:$.value,position:$.position},message:$.message}),B.dirty()}else if($.kind==="toLowerCase")D.data=D.data.toLowerCase();else if($.kind==="toUpperCase")D.data=D.data.toUpperCase();else if($.kind==="startsWith"){if(!D.data.startsWith($.value))E=this._getOrReturnCtx(D,E),G(E,{code:H.invalid_string,validation:{startsWith:$.value},message:$.message}),B.dirty()}else if($.kind==="endsWith"){if(!D.data.endsWith($.value))E=this._getOrReturnCtx(D,E),G(E,{code:H.invalid_string,validation:{endsWith:$.value},message:$.message}),B.dirty()}else if($.kind==="datetime"){if(!P8($).test(D.data))E=this._getOrReturnCtx(D,E),G(E,{code:H.invalid_string,validation:"datetime",message:$.message}),B.dirty()}else if($.kind==="date"){if(!AF.test(D.data))E=this._getOrReturnCtx(D,E),G(E,{code:H.invalid_string,validation:"date",message:$.message}),B.dirty()}else if($.kind==="time"){if(!jF($).test(D.data))E=this._getOrReturnCtx(D,E),G(E,{code:H.invalid_string,validation:"time",message:$.message}),B.dirty()}else if($.kind==="duration"){if(!QF.test(D.data))E=this._getOrReturnCtx(D,E),G(E,{validation:"duration",code:H.invalid_string,message:$.message}),B.dirty()}else if($.kind==="ip"){if(!zF(D.data,$.version))E=this._getOrReturnCtx(D,E),G(E,{validation:"ip",code:H.invalid_string,message:$.message}),B.dirty()}else if($.kind==="jwt"){if(!UF(D.data,$.alg))E=this._getOrReturnCtx(D,E),G(E,{validation:"jwt",code:H.invalid_string,message:$.message}),B.dirty()}else if($.kind==="cidr"){if(!VF(D.data,$.version))E=this._getOrReturnCtx(D,E),G(E,{validation:"cidr",code:H.invalid_string,message:$.message}),B.dirty()}else if($.kind==="base64"){if(!RF.test(D.data))E=this._getOrReturnCtx(D,E),G(E,{validation:"base64",code:H.invalid_string,message:$.message}),B.dirty()}else if($.kind==="base64url"){if(!MF.test(D.data))E=this._getOrReturnCtx(D,E),G(E,{validation:"base64url",code:H.invalid_string,message:$.message}),B.dirty()}else S.assertNever($);return{status:B.value,value:D.data}}_regex(D,F,B){return this.refinement((E)=>D.test(E),{validation:F,code:H.invalid_string,...A.errToObj(B)})}_addCheck(D){return new $D({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",...A.errToObj(D)})}url(D){return this._addCheck({kind:"url",...A.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",...A.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",...A.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",...A.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",...A.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",...A.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",...A.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",...A.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",...A.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",...A.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",...A.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",...A.errToObj(D)})}datetime(D){if(typeof D==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:D});return this._addCheck({kind:"datetime",precision:typeof D?.precision>"u"?null:D?.precision,offset:D?.offset??!1,local:D?.local??!1,...A.errToObj(D?.message)})}date(D){return this._addCheck({kind:"date",message:D})}time(D){if(typeof D==="string")return this._addCheck({kind:"time",precision:null,message:D});return this._addCheck({kind:"time",precision:typeof D?.precision>"u"?null:D?.precision,...A.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",...A.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,...A.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,...A.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,...A.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,...A.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,...A.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,...A.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,...A.errToObj(F)})}nonempty(D){return this.min(1,A.errToObj(D))}trim(){return new $D({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new $D({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new $D({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((D)=>D.kind==="datetime")}get isDate(){return!!this._def.checks.find((D)=>D.kind==="date")}get isTime(){return!!this._def.checks.find((D)=>D.kind==="time")}get isDuration(){return!!this._def.checks.find((D)=>D.kind==="duration")}get isEmail(){return!!this._def.checks.find((D)=>D.kind==="email")}get isURL(){return!!this._def.checks.find((D)=>D.kind==="url")}get isEmoji(){return!!this._def.checks.find((D)=>D.kind==="emoji")}get isUUID(){return!!this._def.checks.find((D)=>D.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((D)=>D.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((D)=>D.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((D)=>D.kind==="cuid2")}get isULID(){return!!this._def.checks.find((D)=>D.kind==="ulid")}get isIP(){return!!this._def.checks.find((D)=>D.kind==="ip")}get isCIDR(){return!!this._def.checks.find((D)=>D.kind==="cidr")}get isBase64(){return!!this._def.checks.find((D)=>D.kind==="base64")}get isBase64url(){return!!this._def.checks.find((D)=>D.kind==="base64url")}get minLength(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxLength(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}}$D.create=(D)=>{return new $D({checks:[],typeName:z.ZodString,coerce:D?.coerce??!1,...N(D)})};function LF(D,F){let B=(D.toString().split(".")[1]||"").length,E=(F.toString().split(".")[1]||"").length,$=B>E?B:E,q=Number.parseInt(D.toFixed($).replace(".","")),X=Number.parseInt(F.toFixed($).replace(".",""));return q%X/10**$}class wD extends w{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(D){if(this._def.coerce)D.data=Number(D.data);if(this._getType(D)!==_.number){let $=this._getOrReturnCtx(D);return G($,{code:H.invalid_type,expected:_.number,received:$.parsedType}),j}let B=void 0,E=new m;for(let $ of this._def.checks)if($.kind==="int"){if(!S.isInteger(D.data))B=this._getOrReturnCtx(D,B),G(B,{code:H.invalid_type,expected:"integer",received:"float",message:$.message}),E.dirty()}else if($.kind==="min"){if($.inclusive?D.data<$.value:D.data<=$.value)B=this._getOrReturnCtx(D,B),G(B,{code:H.too_small,minimum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),E.dirty()}else if($.kind==="max"){if($.inclusive?D.data>$.value:D.data>=$.value)B=this._getOrReturnCtx(D,B),G(B,{code:H.too_big,maximum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),E.dirty()}else if($.kind==="multipleOf"){if(LF(D.data,$.value)!==0)B=this._getOrReturnCtx(D,B),G(B,{code:H.not_multiple_of,multipleOf:$.value,message:$.message}),E.dirty()}else if($.kind==="finite"){if(!Number.isFinite(D.data))B=this._getOrReturnCtx(D,B),G(B,{code:H.not_finite,message:$.message}),E.dirty()}else S.assertNever($);return{status:E.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,A.toString(F))}gt(D,F){return this.setLimit("min",D,!1,A.toString(F))}lte(D,F){return this.setLimit("max",D,!0,A.toString(F))}lt(D,F){return this.setLimit("max",D,!1,A.toString(F))}setLimit(D,F,B,E){return new wD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:B,message:A.toString(E)}]})}_addCheck(D){return new wD({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:A.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:A.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:A.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.toString(D)})}get minValue(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxValue(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}get isInt(){return!!this._def.checks.find((D)=>D.kind==="int"||D.kind==="multipleOf"&&S.isInteger(D.value))}get isFinite(){let D=null,F=null;for(let B of this._def.checks)if(B.kind==="finite"||B.kind==="int"||B.kind==="multipleOf")return!0;else if(B.kind==="min"){if(F===null||B.value>F)F=B.value}else if(B.kind==="max"){if(D===null||B.value<D)D=B.value}return Number.isFinite(F)&&Number.isFinite(D)}}wD.create=(D)=>{return new wD({checks:[],typeName:z.ZodNumber,coerce:D?.coerce||!1,...N(D)})};class SD extends w{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(D){if(this._def.coerce)try{D.data=BigInt(D.data)}catch{return this._getInvalidInput(D)}if(this._getType(D)!==_.bigint)return this._getInvalidInput(D);let B=void 0,E=new m;for(let $ of this._def.checks)if($.kind==="min"){if($.inclusive?D.data<$.value:D.data<=$.value)B=this._getOrReturnCtx(D,B),G(B,{code:H.too_small,type:"bigint",minimum:$.value,inclusive:$.inclusive,message:$.message}),E.dirty()}else if($.kind==="max"){if($.inclusive?D.data>$.value:D.data>=$.value)B=this._getOrReturnCtx(D,B),G(B,{code:H.too_big,type:"bigint",maximum:$.value,inclusive:$.inclusive,message:$.message}),E.dirty()}else if($.kind==="multipleOf"){if(D.data%$.value!==BigInt(0))B=this._getOrReturnCtx(D,B),G(B,{code:H.not_multiple_of,multipleOf:$.value,message:$.message}),E.dirty()}else S.assertNever($);return{status:E.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return G(F,{code:H.invalid_type,expected:_.bigint,received:F.parsedType}),j}gte(D,F){return this.setLimit("min",D,!0,A.toString(F))}gt(D,F){return this.setLimit("min",D,!1,A.toString(F))}lte(D,F){return this.setLimit("max",D,!0,A.toString(F))}lt(D,F){return this.setLimit("max",D,!1,A.toString(F))}setLimit(D,F,B,E){return new SD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:B,message:A.toString(E)}]})}_addCheck(D){return new SD({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:A.toString(F)})}get minValue(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxValue(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}}SD.create=(D)=>{return new SD({checks:[],typeName:z.ZodBigInt,coerce:D?.coerce??!1,...N(D)})};class tD extends w{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==_.boolean){let B=this._getOrReturnCtx(D);return G(B,{code:H.invalid_type,expected:_.boolean,received:B.parsedType}),j}return p(D.data)}}tD.create=(D)=>{return new tD({typeName:z.ZodBoolean,coerce:D?.coerce||!1,...N(D)})};class hD extends w{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==_.date){let $=this._getOrReturnCtx(D);return G($,{code:H.invalid_type,expected:_.date,received:$.parsedType}),j}if(Number.isNaN(D.data.getTime())){let $=this._getOrReturnCtx(D);return G($,{code:H.invalid_date}),j}let B=new m,E=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(D.data.getTime()<$.value)E=this._getOrReturnCtx(D,E),G(E,{code:H.too_small,message:$.message,inclusive:!0,exact:!1,minimum:$.value,type:"date"}),B.dirty()}else if($.kind==="max"){if(D.data.getTime()>$.value)E=this._getOrReturnCtx(D,E),G(E,{code:H.too_big,message:$.message,inclusive:!0,exact:!1,maximum:$.value,type:"date"}),B.dirty()}else S.assertNever($);return{status:B.value,value:new Date(D.data.getTime())}}_addCheck(D){return new hD({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:A.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:A.toString(F)})}get minDate(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D!=null?new Date(D):null}get maxDate(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D!=null?new Date(D):null}}hD.create=(D)=>{return new hD({checks:[],coerce:D?.coerce||!1,typeName:z.ZodDate,...N(D)})};class U2 extends w{_parse(D){if(this._getType(D)!==_.symbol){let B=this._getOrReturnCtx(D);return G(B,{code:H.invalid_type,expected:_.symbol,received:B.parsedType}),j}return p(D.data)}}U2.create=(D)=>{return new U2({typeName:z.ZodSymbol,...N(D)})};class eD extends w{_parse(D){if(this._getType(D)!==_.undefined){let B=this._getOrReturnCtx(D);return G(B,{code:H.invalid_type,expected:_.undefined,received:B.parsedType}),j}return p(D.data)}}eD.create=(D)=>{return new eD({typeName:z.ZodUndefined,...N(D)})};class D2 extends w{_parse(D){if(this._getType(D)!==_.null){let B=this._getOrReturnCtx(D);return G(B,{code:H.invalid_type,expected:_.null,received:B.parsedType}),j}return p(D.data)}}D2.create=(D)=>{return new D2({typeName:z.ZodNull,...N(D)})};class gD extends w{constructor(){super(...arguments);this._any=!0}_parse(D){return p(D.data)}}gD.create=(D)=>{return new gD({typeName:z.ZodAny,...N(D)})};class OD extends w{constructor(){super(...arguments);this._unknown=!0}_parse(D){return p(D.data)}}OD.create=(D)=>{return new OD({typeName:z.ZodUnknown,...N(D)})};class GD extends w{_parse(D){let F=this._getOrReturnCtx(D);return G(F,{code:H.invalid_type,expected:_.never,received:F.parsedType}),j}}GD.create=(D)=>{return new GD({typeName:z.ZodNever,...N(D)})};class V2 extends w{_parse(D){if(this._getType(D)!==_.undefined){let B=this._getOrReturnCtx(D);return G(B,{code:H.invalid_type,expected:_.void,received:B.parsedType}),j}return p(D.data)}}V2.create=(D)=>{return new V2({typeName:z.ZodVoid,...N(D)})};class qD extends w{_parse(D){let{ctx:F,status:B}=this._processInputParams(D),E=this._def;if(F.parsedType!==_.array)return G(F,{code:H.invalid_type,expected:_.array,received:F.parsedType}),j;if(E.exactLength!==null){let q=F.data.length>E.exactLength.value,X=F.data.length<E.exactLength.value;if(q||X)G(F,{code:q?H.too_big:H.too_small,minimum:X?E.exactLength.value:void 0,maximum:q?E.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:E.exactLength.message}),B.dirty()}if(E.minLength!==null){if(F.data.length<E.minLength.value)G(F,{code:H.too_small,minimum:E.minLength.value,type:"array",inclusive:!0,exact:!1,message:E.minLength.message}),B.dirty()}if(E.maxLength!==null){if(F.data.length>E.maxLength.value)G(F,{code:H.too_big,maximum:E.maxLength.value,type:"array",inclusive:!0,exact:!1,message:E.maxLength.message}),B.dirty()}if(F.common.async)return Promise.all([...F.data].map((q,X)=>{return E.type._parseAsync(new JD(F,q,F.path,X))})).then((q)=>{return m.mergeArray(B,q)});let $=[...F.data].map((q,X)=>{return E.type._parseSync(new JD(F,q,F.path,X))});return m.mergeArray(B,$)}get element(){return this._def.type}min(D,F){return new qD({...this._def,minLength:{value:D,message:A.toString(F)}})}max(D,F){return new qD({...this._def,maxLength:{value:D,message:A.toString(F)}})}length(D,F){return new qD({...this._def,exactLength:{value:D,message:A.toString(F)}})}nonempty(D){return this.min(1,D)}}qD.create=(D,F)=>{return new qD({type:D,minLength:null,maxLength:null,exactLength:null,typeName:z.ZodArray,...N(F)})};function oD(D){if(D instanceof x){let F={};for(let B in D.shape){let E=D.shape[B];F[B]=XD.create(oD(E))}return new x({...D._def,shape:()=>F})}else if(D instanceof qD)return new qD({...D._def,type:oD(D.element)});else if(D instanceof XD)return XD.create(oD(D.unwrap()));else if(D instanceof UD)return UD.create(oD(D.unwrap()));else if(D instanceof CD)return CD.create(D.items.map((F)=>oD(F)));else return D}class x extends w{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let D=this._def.shape(),F=S.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==_.object){let Q=this._getOrReturnCtx(D);return G(Q,{code:H.invalid_type,expected:_.object,received:Q.parsedType}),j}let{status:B,ctx:E}=this._processInputParams(D),{shape:$,keys:q}=this._getCached(),X=[];if(!(this._def.catchall instanceof GD&&this._def.unknownKeys==="strip")){for(let Q in E.data)if(!q.includes(Q))X.push(Q)}let J=[];for(let Q of q){let Y=$[Q],W=E.data[Q];J.push({key:{status:"valid",value:Q},value:Y._parse(new JD(E,W,E.path,Q)),alwaysSet:Q in E.data})}if(this._def.catchall instanceof GD){let Q=this._def.unknownKeys;if(Q==="passthrough")for(let Y of X)J.push({key:{status:"valid",value:Y},value:{status:"valid",value:E.data[Y]}});else if(Q==="strict"){if(X.length>0)G(E,{code:H.unrecognized_keys,keys:X}),B.dirty()}else if(Q==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let Q=this._def.catchall;for(let Y of X){let W=E.data[Y];J.push({key:{status:"valid",value:Y},value:Q._parse(new JD(E,W,E.path,Y)),alwaysSet:Y in E.data})}}if(E.common.async)return Promise.resolve().then(async()=>{let Q=[];for(let Y of J){let W=await Y.key,C=await Y.value;Q.push({key:W,value:C,alwaysSet:Y.alwaysSet})}return Q}).then((Q)=>{return m.mergeObjectSync(B,Q)});else return m.mergeObjectSync(B,J)}get shape(){return this._def.shape()}strict(D){return A.errToObj,new x({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,B)=>{let E=this._def.errorMap?.(F,B).message??B.defaultError;if(F.code==="unrecognized_keys")return{message:A.errToObj(D).message??E};return{message:E}}}:{}})}strip(){return new x({...this._def,unknownKeys:"strip"})}passthrough(){return new x({...this._def,unknownKeys:"passthrough"})}extend(D){return new x({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new x({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:z.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new x({...this._def,catchall:D})}pick(D){let F={};for(let B of S.objectKeys(D))if(D[B]&&this.shape[B])F[B]=this.shape[B];return new x({...this._def,shape:()=>F})}omit(D){let F={};for(let B of S.objectKeys(this.shape))if(!D[B])F[B]=this.shape[B];return new x({...this._def,shape:()=>F})}deepPartial(){return oD(this)}partial(D){let F={};for(let B of S.objectKeys(this.shape)){let E=this.shape[B];if(D&&!D[B])F[B]=E;else F[B]=E.optional()}return new x({...this._def,shape:()=>F})}required(D){let F={};for(let B of S.objectKeys(this.shape))if(D&&!D[B])F[B]=this.shape[B];else{let $=this.shape[B];while($ instanceof XD)$=$._def.innerType;F[B]=$}return new x({...this._def,shape:()=>F})}keyof(){return b8(S.objectKeys(this.shape))}}x.create=(D,F)=>{return new x({shape:()=>D,unknownKeys:"strip",catchall:GD.create(),typeName:z.ZodObject,...N(F)})};x.strictCreate=(D,F)=>{return new x({shape:()=>D,unknownKeys:"strict",catchall:GD.create(),typeName:z.ZodObject,...N(F)})};x.lazycreate=(D,F)=>{return new x({shape:D,unknownKeys:"strip",catchall:GD.create(),typeName:z.ZodObject,...N(F)})};class F2 extends w{_parse(D){let{ctx:F}=this._processInputParams(D),B=this._def.options;function E($){for(let X of $)if(X.result.status==="valid")return X.result;for(let X of $)if(X.result.status==="dirty")return F.common.issues.push(...X.ctx.common.issues),X.result;let q=$.map((X)=>new n(X.ctx.common.issues));return G(F,{code:H.invalid_union,unionErrors:q}),j}if(F.common.async)return Promise.all(B.map(async($)=>{let q={...F,common:{...F.common,issues:[]},parent:null};return{result:await $._parseAsync({data:F.data,path:F.path,parent:q}),ctx:q}})).then(E);else{let $=void 0,q=[];for(let J of B){let Q={...F,common:{...F.common,issues:[]},parent:null},Y=J._parseSync({data:F.data,path:F.path,parent:Q});if(Y.status==="valid")return Y;else if(Y.status==="dirty"&&!$)$={result:Y,ctx:Q};if(Q.common.issues.length)q.push(Q.common.issues)}if($)return F.common.issues.push(...$.ctx.common.issues),$.result;let X=q.map((J)=>new n(J));return G(F,{code:H.invalid_union,unionErrors:X}),j}}get options(){return this._def.options}}F2.create=(D,F)=>{return new F2({options:D,typeName:z.ZodUnion,...N(F)})};var zD=(D)=>{if(D instanceof E2)return zD(D.schema);else if(D instanceof QD)return zD(D.innerType());else if(D instanceof $2)return[D.value];else if(D instanceof ID)return D.options;else if(D instanceof q2)return S.objectValues(D.enum);else if(D instanceof X2)return zD(D._def.innerType);else if(D instanceof eD)return[void 0];else if(D instanceof D2)return[null];else if(D instanceof XD)return[void 0,...zD(D.unwrap())];else if(D instanceof UD)return[null,...zD(D.unwrap())];else if(D instanceof p2)return zD(D.unwrap());else if(D instanceof Q2)return zD(D.unwrap());else if(D instanceof J2)return zD(D._def.innerType);else return[]};class l2 extends w{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==_.object)return G(F,{code:H.invalid_type,expected:_.object,received:F.parsedType}),j;let B=this.discriminator,E=F.data[B],$=this.optionsMap.get(E);if(!$)return G(F,{code:H.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[B]}),j;if(F.common.async)return $._parseAsync({data:F.data,path:F.path,parent:F});else return $._parseSync({data:F.data,path:F.path,parent:F})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(D,F,B){let E=new Map;for(let $ of F){let q=zD($.shape[D]);if(!q.length)throw Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let X of q){if(E.has(X))throw Error(`Discriminator property ${String(D)} has duplicate value ${String(X)}`);E.set(X,$)}}return new l2({typeName:z.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:E,...N(B)})}}function l0(D,F){let B=_D(D),E=_D(F);if(D===F)return{valid:!0,data:D};else if(B===_.object&&E===_.object){let $=S.objectKeys(F),q=S.objectKeys(D).filter((J)=>$.indexOf(J)!==-1),X={...D,...F};for(let J of q){let Q=l0(D[J],F[J]);if(!Q.valid)return{valid:!1};X[J]=Q.data}return{valid:!0,data:X}}else if(B===_.array&&E===_.array){if(D.length!==F.length)return{valid:!1};let $=[];for(let q=0;q<D.length;q++){let X=D[q],J=F[q],Q=l0(X,J);if(!Q.valid)return{valid:!1};$.push(Q.data)}return{valid:!0,data:$}}else if(B===_.date&&E===_.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}class B2 extends w{_parse(D){let{status:F,ctx:B}=this._processInputParams(D),E=($,q)=>{if(g2($)||g2(q))return j;let X=l0($.value,q.value);if(!X.valid)return G(B,{code:H.invalid_intersection_types}),j;if(m2($)||m2(q))F.dirty();return{status:F.value,value:X.data}};if(B.common.async)return Promise.all([this._def.left._parseAsync({data:B.data,path:B.path,parent:B}),this._def.right._parseAsync({data:B.data,path:B.path,parent:B})]).then(([$,q])=>E($,q));else return E(this._def.left._parseSync({data:B.data,path:B.path,parent:B}),this._def.right._parseSync({data:B.data,path:B.path,parent:B}))}}B2.create=(D,F,B)=>{return new B2({left:D,right:F,typeName:z.ZodIntersection,...N(B)})};class CD extends w{_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==_.array)return G(B,{code:H.invalid_type,expected:_.array,received:B.parsedType}),j;if(B.data.length<this._def.items.length)return G(B,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),j;if(!this._def.rest&&B.data.length>this._def.items.length)G(B,{code:H.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let $=[...B.data].map((q,X)=>{let J=this._def.items[X]||this._def.rest;if(!J)return null;return J._parse(new JD(B,q,B.path,X))}).filter((q)=>!!q);if(B.common.async)return Promise.all($).then((q)=>{return m.mergeArray(F,q)});else return m.mergeArray(F,$)}get items(){return this._def.items}rest(D){return new CD({...this._def,rest:D})}}CD.create=(D,F)=>{if(!Array.isArray(D))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new CD({items:D,typeName:z.ZodTuple,rest:null,...N(F)})};class L2 extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==_.object)return G(B,{code:H.invalid_type,expected:_.object,received:B.parsedType}),j;let E=[],$=this._def.keyType,q=this._def.valueType;for(let X in B.data)E.push({key:$._parse(new JD(B,X,B.path,X)),value:q._parse(new JD(B,B.data[X],B.path,X)),alwaysSet:X in B.data});if(B.common.async)return m.mergeObjectAsync(F,E);else return m.mergeObjectSync(F,E)}get element(){return this._def.valueType}static create(D,F,B){if(F instanceof w)return new L2({keyType:D,valueType:F,typeName:z.ZodRecord,...N(B)});return new L2({keyType:$D.create(),valueType:D,typeName:z.ZodRecord,...N(F)})}}class K2 extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==_.map)return G(B,{code:H.invalid_type,expected:_.map,received:B.parsedType}),j;let E=this._def.keyType,$=this._def.valueType,q=[...B.data.entries()].map(([X,J],Q)=>{return{key:E._parse(new JD(B,X,B.path,[Q,"key"])),value:$._parse(new JD(B,J,B.path,[Q,"value"]))}});if(B.common.async){let X=new Map;return Promise.resolve().then(async()=>{for(let J of q){let Q=await J.key,Y=await J.value;if(Q.status==="aborted"||Y.status==="aborted")return j;if(Q.status==="dirty"||Y.status==="dirty")F.dirty();X.set(Q.value,Y.value)}return{status:F.value,value:X}})}else{let X=new Map;for(let J of q){let{key:Q,value:Y}=J;if(Q.status==="aborted"||Y.status==="aborted")return j;if(Q.status==="dirty"||Y.status==="dirty")F.dirty();X.set(Q.value,Y.value)}return{status:F.value,value:X}}}}K2.create=(D,F,B)=>{return new K2({valueType:F,keyType:D,typeName:z.ZodMap,...N(B)})};class mD extends w{_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==_.set)return G(B,{code:H.invalid_type,expected:_.set,received:B.parsedType}),j;let E=this._def;if(E.minSize!==null){if(B.data.size<E.minSize.value)G(B,{code:H.too_small,minimum:E.minSize.value,type:"set",inclusive:!0,exact:!1,message:E.minSize.message}),F.dirty()}if(E.maxSize!==null){if(B.data.size>E.maxSize.value)G(B,{code:H.too_big,maximum:E.maxSize.value,type:"set",inclusive:!0,exact:!1,message:E.maxSize.message}),F.dirty()}let $=this._def.valueType;function q(J){let Q=new Set;for(let Y of J){if(Y.status==="aborted")return j;if(Y.status==="dirty")F.dirty();Q.add(Y.value)}return{status:F.value,value:Q}}let X=[...B.data.values()].map((J,Q)=>$._parse(new JD(B,J,B.path,Q)));if(B.common.async)return Promise.all(X).then((J)=>q(J));else return q(X)}min(D,F){return new mD({...this._def,minSize:{value:D,message:A.toString(F)}})}max(D,F){return new mD({...this._def,maxSize:{value:D,message:A.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}}mD.create=(D,F)=>{return new mD({valueType:D,minSize:null,maxSize:null,typeName:z.ZodSet,...N(F)})};class sD extends w{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==_.function)return G(F,{code:H.invalid_type,expected:_.function,received:F.parsedType}),j;function B(X,J){return z2({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,rD(),jD].filter((Q)=>!!Q),issueData:{code:H.invalid_arguments,argumentsError:J}})}function E(X,J){return z2({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,rD(),jD].filter((Q)=>!!Q),issueData:{code:H.invalid_return_type,returnTypeError:J}})}let $={errorMap:F.common.contextualErrorMap},q=F.data;if(this._def.returns instanceof lD){let X=this;return p(async function(...J){let Q=new n([]),Y=await X._def.args.parseAsync(J,$).catch((U)=>{throw Q.addIssue(B(J,U)),Q}),W=await Reflect.apply(q,this,Y);return await X._def.returns._def.type.parseAsync(W,$).catch((U)=>{throw Q.addIssue(E(W,U)),Q})})}else{let X=this;return p(function(...J){let Q=X._def.args.safeParse(J,$);if(!Q.success)throw new n([B(J,Q.error)]);let Y=Reflect.apply(q,this,Q.data),W=X._def.returns.safeParse(Y,$);if(!W.success)throw new n([E(Y,W.error)]);return W.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new sD({...this._def,args:CD.create(D).rest(OD.create())})}returns(D){return new sD({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,B){return new sD({args:D?D:CD.create([]).rest(OD.create()),returns:F||OD.create(),typeName:z.ZodFunction,...N(B)})}}class E2 extends w{get schema(){return this._def.getter()}_parse(D){let{ctx:F}=this._processInputParams(D);return this._def.getter()._parse({data:F.data,path:F.path,parent:F})}}E2.create=(D,F)=>{return new E2({getter:D,typeName:z.ZodLazy,...N(F)})};class $2 extends w{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return G(F,{received:F.data,code:H.invalid_literal,expected:this._def.value}),j}return{status:"valid",value:D.data}}get value(){return this._def.value}}$2.create=(D,F)=>{return new $2({value:D,typeName:z.ZodLiteral,...N(F)})};function b8(D,F){return new ID({values:D,typeName:z.ZodEnum,...N(F)})}class ID extends w{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),B=this._def.values;return G(F,{expected:S.joinValues(B),received:F.parsedType,code:H.invalid_type}),j}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(D.data)){let F=this._getOrReturnCtx(D),B=this._def.values;return G(F,{received:F.data,code:H.invalid_enum_value,options:B}),j}return p(D.data)}get options(){return this._def.values}get enum(){let D={};for(let F of this._def.values)D[F]=F;return D}get Values(){let D={};for(let F of this._def.values)D[F]=F;return D}get Enum(){let D={};for(let F of this._def.values)D[F]=F;return D}extract(D,F=this._def){return ID.create(D,{...this._def,...F})}exclude(D,F=this._def){return ID.create(this.options.filter((B)=>!D.includes(B)),{...this._def,...F})}}ID.create=b8;class q2 extends w{_parse(D){let F=S.getValidEnumValues(this._def.values),B=this._getOrReturnCtx(D);if(B.parsedType!==_.string&&B.parsedType!==_.number){let E=S.objectValues(F);return G(B,{expected:S.joinValues(E),received:B.parsedType,code:H.invalid_type}),j}if(!this._cache)this._cache=new Set(S.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let E=S.objectValues(F);return G(B,{received:B.data,code:H.invalid_enum_value,options:E}),j}return p(D.data)}get enum(){return this._def.values}}q2.create=(D,F)=>{return new q2({values:D,typeName:z.ZodNativeEnum,...N(F)})};class lD extends w{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==_.promise&&F.common.async===!1)return G(F,{code:H.invalid_type,expected:_.promise,received:F.parsedType}),j;let B=F.parsedType===_.promise?F.data:Promise.resolve(F.data);return p(B.then((E)=>{return this._def.type.parseAsync(E,{path:F.path,errorMap:F.common.contextualErrorMap})}))}}lD.create=(D,F)=>{return new lD({type:D,typeName:z.ZodPromise,...N(F)})};class QD extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(D){let{status:F,ctx:B}=this._processInputParams(D),E=this._def.effect||null,$={addIssue:(q)=>{if(G(B,q),q.fatal)F.abort();else F.dirty()},get path(){return B.path}};if($.addIssue=$.addIssue.bind($),E.type==="preprocess"){let q=E.transform(B.data,$);if(B.common.async)return Promise.resolve(q).then(async(X)=>{if(F.value==="aborted")return j;let J=await this._def.schema._parseAsync({data:X,path:B.path,parent:B});if(J.status==="aborted")return j;if(J.status==="dirty")return yD(J.value);if(F.value==="dirty")return yD(J.value);return J});else{if(F.value==="aborted")return j;let X=this._def.schema._parseSync({data:q,path:B.path,parent:B});if(X.status==="aborted")return j;if(X.status==="dirty")return yD(X.value);if(F.value==="dirty")return yD(X.value);return X}}if(E.type==="refinement"){let q=(X)=>{let J=E.refinement(X,$);if(B.common.async)return Promise.resolve(J);if(J instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return X};if(B.common.async===!1){let X=this._def.schema._parseSync({data:B.data,path:B.path,parent:B});if(X.status==="aborted")return j;if(X.status==="dirty")F.dirty();return q(X.value),{status:F.value,value:X.value}}else return this._def.schema._parseAsync({data:B.data,path:B.path,parent:B}).then((X)=>{if(X.status==="aborted")return j;if(X.status==="dirty")F.dirty();return q(X.value).then(()=>{return{status:F.value,value:X.value}})})}if(E.type==="transform")if(B.common.async===!1){let q=this._def.schema._parseSync({data:B.data,path:B.path,parent:B});if(!uD(q))return j;let X=E.transform(q.value,$);if(X instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:X}}else return this._def.schema._parseAsync({data:B.data,path:B.path,parent:B}).then((q)=>{if(!uD(q))return j;return Promise.resolve(E.transform(q.value,$)).then((X)=>({status:F.value,value:X}))});S.assertNever(E)}}QD.create=(D,F,B)=>{return new QD({schema:D,typeName:z.ZodEffects,effect:F,...N(B)})};QD.createWithPreprocess=(D,F,B)=>{return new QD({schema:F,effect:{type:"preprocess",transform:D},typeName:z.ZodEffects,...N(B)})};class XD extends w{_parse(D){if(this._getType(D)===_.undefined)return p(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}XD.create=(D,F)=>{return new XD({innerType:D,typeName:z.ZodOptional,...N(F)})};class UD extends w{_parse(D){if(this._getType(D)===_.null)return p(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}UD.create=(D,F)=>{return new UD({innerType:D,typeName:z.ZodNullable,...N(F)})};class X2 extends w{_parse(D){let{ctx:F}=this._processInputParams(D),B=F.data;if(F.parsedType===_.undefined)B=this._def.defaultValue();return this._def.innerType._parse({data:B,path:F.path,parent:F})}removeDefault(){return this._def.innerType}}X2.create=(D,F)=>{return new X2({innerType:D,typeName:z.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...N(F)})};class J2 extends w{_parse(D){let{ctx:F}=this._processInputParams(D),B={...F,common:{...F.common,issues:[]}},E=this._def.innerType._parse({data:B.data,path:B.path,parent:{...B}});if(aD(E))return E.then(($)=>{return{status:"valid",value:$.status==="valid"?$.value:this._def.catchValue({get error(){return new n(B.common.issues)},input:B.data})}});else return{status:"valid",value:E.status==="valid"?E.value:this._def.catchValue({get error(){return new n(B.common.issues)},input:B.data})}}removeCatch(){return this._def.innerType}}J2.create=(D,F)=>{return new J2({innerType:D,typeName:z.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...N(F)})};class N2 extends w{_parse(D){if(this._getType(D)!==_.nan){let B=this._getOrReturnCtx(D);return G(B,{code:H.invalid_type,expected:_.nan,received:B.parsedType}),j}return{status:"valid",value:D.data}}}N2.create=(D)=>{return new N2({typeName:z.ZodNaN,...N(D)})};var KF=Symbol("zod_brand");class p2 extends w{_parse(D){let{ctx:F}=this._processInputParams(D),B=F.data;return this._def.type._parse({data:B,path:F.path,parent:F})}unwrap(){return this._def.type}}class u2 extends w{_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.common.async)return(async()=>{let $=await this._def.in._parseAsync({data:B.data,path:B.path,parent:B});if($.status==="aborted")return j;if($.status==="dirty")return F.dirty(),yD($.value);else return this._def.out._parseAsync({data:$.value,path:B.path,parent:B})})();else{let E=this._def.in._parseSync({data:B.data,path:B.path,parent:B});if(E.status==="aborted")return j;if(E.status==="dirty")return F.dirty(),{status:"dirty",value:E.value};else return this._def.out._parseSync({data:E.value,path:B.path,parent:B})}}static create(D,F){return new u2({in:D,out:F,typeName:z.ZodPipeline})}}class Q2 extends w{_parse(D){let F=this._def.innerType._parse(D),B=(E)=>{if(uD(E))E.value=Object.freeze(E.value);return E};return aD(F)?F.then((E)=>B(E)):B(F)}unwrap(){return this._def.innerType}}Q2.create=(D,F)=>{return new Q2({innerType:D,typeName:z.ZodReadonly,...N(F)})};function w8(D,F){let B=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof B==="string"?{message:B}:B}function T8(D,F={},B){if(D)return gD.create().superRefine((E,$)=>{let q=D(E);if(q instanceof Promise)return q.then((X)=>{if(!X){let J=w8(F,E),Q=J.fatal??B??!0;$.addIssue({code:"custom",...J,fatal:Q})}});if(!q){let X=w8(F,E),J=X.fatal??B??!0;$.addIssue({code:"custom",...X,fatal:J})}return});return gD.create()}var NF={object:x.lazycreate},z;(function(D){D.ZodString="ZodString",D.ZodNumber="ZodNumber",D.ZodNaN="ZodNaN",D.ZodBigInt="ZodBigInt",D.ZodBoolean="ZodBoolean",D.ZodDate="ZodDate",D.ZodSymbol="ZodSymbol",D.ZodUndefined="ZodUndefined",D.ZodNull="ZodNull",D.ZodAny="ZodAny",D.ZodUnknown="ZodUnknown",D.ZodNever="ZodNever",D.ZodVoid="ZodVoid",D.ZodArray="ZodArray",D.ZodObject="ZodObject",D.ZodUnion="ZodUnion",D.ZodDiscriminatedUnion="ZodDiscriminatedUnion",D.ZodIntersection="ZodIntersection",D.ZodTuple="ZodTuple",D.ZodRecord="ZodRecord",D.ZodMap="ZodMap",D.ZodSet="ZodSet",D.ZodFunction="ZodFunction",D.ZodLazy="ZodLazy",D.ZodLiteral="ZodLiteral",D.ZodEnum="ZodEnum",D.ZodEffects="ZodEffects",D.ZodNativeEnum="ZodNativeEnum",D.ZodOptional="ZodOptional",D.ZodNullable="ZodNullable",D.ZodDefault="ZodDefault",D.ZodCatch="ZodCatch",D.ZodPromise="ZodPromise",D.ZodBranded="ZodBranded",D.ZodPipeline="ZodPipeline",D.ZodReadonly="ZodReadonly"})(z||(z={}));var uF=(D,F={message:`Input not instance of ${D.name}`})=>T8((B)=>B instanceof D,F),k8=$D.create,f8=wD.create,OF=N2.create,wF=SD.create,v8=tD.create,SF=hD.create,IF=U2.create,PF=eD.create,bF=D2.create,TF=gD.create,kF=OD.create,fF=GD.create,vF=V2.create,ZF=qD.create,xF=x.create,yF=x.strictCreate,hF=F2.create,gF=l2.create,mF=B2.create,lF=CD.create,pF=L2.create,dF=K2.create,cF=mD.create,nF=sD.create,iF=E2.create,rF=$2.create,aF=ID.create,oF=q2.create,sF=lD.create,tF=QD.create,eF=XD.create,D5=UD.create,F5=QD.createWithPreprocess,B5=u2.create,E5=()=>k8().optional(),$5=()=>f8().optional(),q5=()=>v8().optional(),X5={string:(D)=>$D.create({...D,coerce:!0}),number:(D)=>wD.create({...D,coerce:!0}),boolean:(D)=>tD.create({...D,coerce:!0}),bigint:(D)=>SD.create({...D,coerce:!0}),date:(D)=>hD.create({...D,coerce:!0})};var J5=j;var Q5=f.object({opus:f.string(),sonnet:f.string(),haiku:f.string()}),p0=f.object({apiUrl:f.string().url(),apiKey:f.string().min(1),defaultProfile:f.string().optional(),profiles:f.record(Q5)});var d0=Z8(_5(),".claudio"),d2=Z8(d0,"config.json");function s(){return c0(d2)}async function t(){if(!c0(d2))throw Error('Config file not found. Run "claudio setup" first.');try{let D=W5(d2,"utf-8"),F=JSON.parse(D);return p0.parse(F)}catch(D){throw Error(`Failed to load config: ${D.message}`)}}async function O2(D){if(!c0(d0))Y5(d0,{recursive:!0});try{let F=p0.parse(D),B=JSON.stringify(F,null,2);H5(d2,B,"utf-8")}catch(F){throw Error(`Failed to save config: ${F.message}`)}}function x8(){return"http://10.114.1.119:8317"}async function y8(){return(await t()).defaultProfile}async function h8(D){let F=await t();if(!F.profiles[D])throw Error(`Profile "${D}" not found`);F.defaultProfile=D,await O2(F)}async function g8(D){let F=await t();if(!F.profiles[D])throw Error(`Profile "${D}" not found`);if(delete F.profiles[D],F.defaultProfile===D)F.defaultProfile=void 0;await O2(F)}async function m8(){let D=await t();return Object.entries(D.profiles).map(([F,B])=>({name:F,profile:B,isDefault:D.defaultProfile===F}))}async function n0(D){return(await t()).profiles[D]}async function i0(D){let{message:F,models:B}=D,E=B.map((q)=>q.id);return await h0({message:F,source:async(q)=>{let X=(q||"").toLowerCase();return E.filter((Q)=>Q.toLowerCase().includes(X)).map((Q)=>({name:Q,value:Q}))}})}async function r0(D){let F=await i0({message:"Select OPUS model:",models:D}),B=await i0({message:"Select SONNET model:",models:D}),E=await i0({message:"Select HAIKU model:",models:D});return{opus:F,sonnet:B,haiku:E}}async function c2(D,F){return Z0({message:D,default:F})}async function l8(D,F=!1){return v0({message:D,default:F})}async function p8(){console.log(`
|
|
44
|
+
\uD83D\uDD27 Claudio Setup
|
|
45
|
+
`);let D=x8(),F=await c2("API URL",D),B=await x0({message:"API Key:",mask:"*"});if(!B)console.error(`
|
|
46
|
+
\u274C API key is required`),process.exit(1);process.stdout.write(`
|
|
47
|
+
Testing connection... `);let E=await j2(F,B);if(!E.success)console.log("\u274C"),console.error(`
|
|
48
|
+
\u274C ${E.message}`),process.exit(1);console.log(`\u2713 Connected (${E.modelCount} models available)`),console.log(`
|
|
49
|
+
Create your first profile:
|
|
50
|
+
`);let $=await c2("Profile name","main");if(!$)console.error(`
|
|
51
|
+
\u274C Profile name is required`),process.exit(1);let q=E.models,{opus:X,sonnet:J,haiku:Q}=await r0(q),Y={opus:X,sonnet:J,haiku:Q},W={[$]:Y};await O2({apiUrl:F,apiKey:B,defaultProfile:$,profiles:W}),console.log(`
|
|
52
|
+
\u2713 Profile "${$}" created and set as default`),console.log("\nRun `claudio` to launch, or `claudio profiles add` to create more.")}async function d8(){if(!s())console.error("\u274C No config found. Run `claudio setup` first."),process.exit(1);let D=await t();process.stdout.write("Fetching models... ");let F=await j2(D.apiUrl,D.apiKey);if(!F.success)console.log("\u274C"),console.error(`
|
|
53
|
+
\u274C ${F.message}`),process.exit(1);console.log(`\u2713 (${F.modelCount} models)`),console.log("");let B=await c2("Profile name");if(!B)console.error(`
|
|
54
|
+
\u274C Profile name is required`),process.exit(1);if(D.profiles[B])console.error(`
|
|
55
|
+
\u274C Profile "${B}" already exists`),process.exit(1);let{opus:E,sonnet:$,haiku:q}=await r0(F.models);D.profiles[B]={opus:E,sonnet:$,haiku:q},await O2(D),console.log(`
|
|
56
|
+
\u2713 Profile "${B}" created`)}async function c8(){await p8()}import{spawn as D6}from"child_process";import{existsSync as Z5,readFileSync as x5,writeFileSync as y5}from"fs";import{join as F6}from"path";import{existsSync as a0,mkdirSync as z5,readFileSync as U5,writeFileSync as V5}from"fs";import{homedir as L5}from"os";import{join as n8}from"path";var G5=f.object({allowedPaths:f.array(f.string()).default(["~/projects","/tmp"])}),C5=f.object({logPath:f.string().default("~/.genie/audit.log")}),R5=f.object({alwaysAsk:f.array(f.string()).default(["Write","Edit"])}),M5=f.object({sessionName:f.string().default("genie"),windowName:f.string().default("shell")}),A5=f.object({enabled:f.array(f.enum(["collaborative","supervised","sandboxed","audited"])).default([]),collaborative:M5.optional(),supervised:R5.optional(),sandboxed:G5.optional(),audited:C5.optional()}),j5=f.object({name:f.string().default("genie"),defaultWindow:f.string().default("shell")}),w2=f.object({hooks:A5.default({}),session:j5.default({})}),r4=[{name:"collaborative",title:"Collaborative",what:"All terminal commands run through tmux",why:"You can watch AI work in real-time",how:"Bash commands \u2192 term exec genie:shell",recommended:!0},{name:"supervised",title:"Supervised",what:"File changes require your approval",why:"Prevents accidental overwrites",how:"Write/Edit tools always ask permission"},{name:"sandboxed",title:"Sandboxed",what:"Restrict file access to specific directories",why:"Protects sensitive areas of your system",how:"Operations outside sandbox are blocked"},{name:"audited",title:"Audited",what:"Log all AI tool usage to a file",why:"Review what the AI did after a session",how:"Every tool call \u2192 ~/.genie/audit.log"}];var n2=n8(L5(),".genie"),S2=n8(n2,"config.json");function i8(){return n2}function EB(){return S2}function o0(){return a0(S2)}function s0(){if(!a0(n2))z5(n2,{recursive:!0})}async function i2(){if(!a0(S2))return w2.parse({});try{let D=U5(S2,"utf-8"),F=JSON.parse(D);return w2.parse(F)}catch(D){return console.warn(`Warning: Invalid genie config, using defaults: ${D.message}`),w2.parse({})}}async function $B(D){s0();try{let F=w2.parse(D),B=JSON.stringify(F,null,2);V5(S2,B,"utf-8")}catch(F){throw Error(`Failed to save genie config: ${F.message}`)}}function r8(D){let F=[];for(let B of D.hooks.enabled)switch(B){case"collaborative":{let E=D.hooks.collaborative||{},$=E.sessionName||"genie",q=E.windowName||"shell";F.push(`Collaborative: Bash \u2192 term exec ${$}:${q}`);break}case"supervised":{let $=(D.hooks.supervised||{}).alwaysAsk||["Write","Edit"];F.push(`Supervised: ${$.join(", ")} require approval`);break}case"sandboxed":{let $=(D.hooks.sandboxed||{}).allowedPaths||["~/projects","/tmp"];F.push(`Sandboxed: Restricted to ${$.join(", ")}`);break}case"audited":{let $=(D.hooks.audited||{}).logPath||"~/.genie/audit.log";F.push(`Audited: Logging to ${$}`);break}}return F}function t0(D){return D.hooks.enabled.length>0}function a8(D){let F=["collaborative","supervised","sandboxed","audited"];return D.split(",").map((E)=>E.trim().toLowerCase()).filter((E)=>F.includes(E))}import{exec as S5}from"child_process";import{promisify as I5}from"util";var l=[];for(let D=0;D<256;++D)l.push((D+256).toString(16).slice(1));function o8(D,F=0){return(l[D[F+0]]+l[D[F+1]]+l[D[F+2]]+l[D[F+3]]+"-"+l[D[F+4]]+l[D[F+5]]+"-"+l[D[F+6]]+l[D[F+7]]+"-"+l[D[F+8]]+l[D[F+9]]+"-"+l[D[F+10]]+l[D[F+11]]+l[D[F+12]]+l[D[F+13]]+l[D[F+14]]+l[D[F+15]]).toLowerCase()}import{randomFillSync as u5}from"crypto";var a2=new Uint8Array(256),r2=a2.length;function e0(){if(r2>a2.length-16)u5(a2),r2=0;return a2.slice(r2,r2+=16)}import{randomUUID as O5}from"crypto";var D3={randomUUID:O5};function w5(D,F,B){if(D3.randomUUID&&!F&&!D)return D3.randomUUID();D=D||{};let E=D.random??D.rng?.()??e0();if(E.length<16)throw Error("Random bytes length must be >= 16");if(E[6]=E[6]&15|64,E[8]=E[8]&63|128,F){if(B=B||0,B<0||B+16>F.length)throw RangeError(`UUID byte range ${B}:${B+15} is out of buffer bounds`);for(let $=0;$<16;++$)F[B+$]=E[$];return F}return o8(E)}var F3=w5;var P5=I5(S5),b5={type:"bash"};async function d(D){try{let{stdout:F}=await P5(`tmux ${D}`);return F.trim()}catch(F){throw Error(`Failed to execute tmux command: ${F.message}`)}}async function T5(){try{let F=await d("list-sessions -F '#{session_id}:#{session_name}:#{?session_attached,1,0}:#{session_windows}'");if(!F)return[];return F.split(`
|
|
57
|
+
`).map((B)=>{let[E,$,q,X]=B.split(":");return{id:E,name:$,attached:q==="1",windows:parseInt(X,10)}})}catch(D){if(D.message.includes("no server running"))return[];throw D}}async function $3(D){try{return(await T5()).find((B)=>B.name===D)||null}catch(F){return null}}async function q3(D){try{let B=await d(`list-windows -t '${D}' -F '#{window_id}:#{window_name}:#{?window_active,1,0}'`);if(!B)return[];return B.split(`
|
|
58
|
+
`).map((E)=>{let[$,q,X]=E.split(":");return{id:$,name:q,active:X==="1",sessionId:D}})}catch(F){if(F.message.includes("no server running")||F.message.includes("session not found"))return[];throw F}}async function s2(D){try{let B=await d(`list-panes -t '${D}' -F '#{pane_id}:#{pane_title}:#{?pane_active,1,0}'`);if(!B)return[];return B.split(`
|
|
59
|
+
`).map((E)=>{let[$,q,X]=E.split(":");return{id:$,windowId:D,title:q,active:X==="1"}})}catch(F){if(F.message.includes("no server running")||F.message.includes("window not found"))return[];throw F}}async function k5(D,F=200,B=!1){try{return await d(`capture-pane -p ${B?"-e":""} -t '${D}' -S -${F} -E -`)}catch(E){if(E.message.includes("no server running")||E.message.includes("pane not found"))return"";throw E}}async function s8(D){return await d(`new-session -d -s "${D}" -e LC_ALL=C.UTF-8 -e LANG=C.UTF-8`),$3(D)}async function t8(D,F){let B=await d(`new-window -t '${D}' -n '${F}'`);return(await q3(D)).find(($)=>$.name===F)||null}async function nB(D){await d(`kill-session -t '${D}'`)}async function iB(D){await d(`kill-window -t '${D}'`)}async function rB(D){await d(`kill-pane -t '${D}'`)}async function aB(D,F="vertical",B){let E="split-window";if(F==="horizontal")E+=" -h";else E+=" -v";if(E+=` -t '${D}'`,B!==void 0&&B>0&&B<100)E+=` -p ${B}`;await d(E);let $=await d(`display-message -p -t '${D}' '#{window_id}'`),q=await s2($);return q.length>0?q[q.length-1]:null}var B3=new Map,E3="TMUX_MCP_START",o2="TMUX_MCP_DONE_";async function X3(D,F,B,E){let $=F3(),q;if(B||E)q=F;else{let X=f5();q=`echo "${E3}"; ${F}; echo "${X}"`}if(B3.set($,{id:$,paneId:D,command:F,status:"pending",startTime:new Date,rawMode:B||E}),E)if(["Up","Down","Left","Right","Escape","Tab","Enter","Space","BSpace","Delete","Home","End","PageUp","PageDown","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"].includes(q))await d(`send-keys -t '${D}' ${q}`);else for(let J of q)await d(`send-keys -t '${D}' '${J.replace(/'/g,"'\\''")}'`);else await d(`send-keys -t '${D}' '${q.replace(/'/g,"'\\''")}' Enter`);return $}async function oB(D){let F=B3.get(D);if(!F)return null;if(F.status!=="pending")return F;let B=await k5(F.paneId,1000);if(F.rawMode)return F.result="Status tracking unavailable for rawMode commands. Use capture-pane to monitor interactive apps instead.",F;let E=B.lastIndexOf(E3),$=B.lastIndexOf(o2);if(E===-1||$===-1||$<=E)return F.result="Command output could not be captured properly",F;let q=B.substring($).split(`
|
|
60
|
+
`)[0],X=new RegExp(`${o2}(\\d+)`),J=q.match(X);if(J){let Q=parseInt(J[1],10);F.status=Q===0?"completed":"error",F.exitCode=Q;let Y=E+E3.length,W=B.substring(Y,$).trim();F.result=W.substring(W.indexOf(`
|
|
61
|
+
`)+1).trim(),B3.set(D,F)}return F}function f5(){return b5.type==="fish"?`${o2}$status`:`${o2}$?`}async function e8(D,F){await d(`rename-window -t '${D}' '${F}'`)}var I2="genie";function B6(){let D=F6(process.cwd(),"AGENTS.md");if(Z5(D))return x5(D,"utf-8");return null}function h5(){let D=B6();if(D)return["--system-prompt",D];return[]}function g5(){let D=B6();if(D)return`claude --system-prompt '${D.replace(/'/g,"'\\''")}'`;return"claude"}async function m5(D){if(D.noHooks){console.log("\x1B[33m\u26A0\uFE0F Hooks disabled via --no-hooks\x1B[0m");return}if(D.hooks){let F=a8(D.hooks);if(F.length>0)console.log(`\x1B[36m\uD83E\uDE9D Using hooks: ${F.join(", ")}\x1B[0m`);return}if(o0()){let F=await i2();if(t0(F)){let B=r8(F);console.log("\x1B[36m\uD83E\uDE9D Active hooks:\x1B[0m");for(let E of B)console.log(` ${E}`)}}}async function l5(){if(!o0())return null;let D=await i2();if(!t0(D))return null;s0();let F=F6(i8(),"hooks-env.sh"),B=`# Genie hooks environment
|
|
62
|
+
# Generated by claudio launch
|
|
63
|
+
# This file indicates hooks are configured in ~/.genie/config.json
|
|
64
|
+
export GENIE_HOOKS_ENABLED="${D.hooks.enabled.join(",")}"
|
|
65
|
+
`;return y5(F,B,"utf-8"),F}async function t2(D,F={}){let B=await t(),E=B.profiles[D];if(!E)console.error(`\u274C Profile "${D}" not found`),console.log(`
|
|
66
|
+
Available profiles: ${Object.keys(B.profiles).join(", ")}`),process.exit(1);await m5(F);let $=await l5(),q=!!process.env.TMUX,X=["export LC_ALL=C.UTF-8","export LANG=C.UTF-8",`export ANTHROPIC_BASE_URL="${B.apiUrl}"`,`export ANTHROPIC_AUTH_TOKEN="${B.apiKey}"`,`export ANTHROPIC_DEFAULT_OPUS_MODEL="${E.opus}"`,`export ANTHROPIC_DEFAULT_SONNET_MODEL="${E.sonnet}"`,`export ANTHROPIC_DEFAULT_HAIKU_MODEL="${E.haiku}"`];if($)X.push(`source "${$}"`);X.push(g5());let J=X.join("; ");if(q){console.log(`\uD83D\uDE80 Launching "${D}"...`),process.env.LC_ALL="C.UTF-8",process.env.LANG="C.UTF-8",process.env.ANTHROPIC_BASE_URL=B.apiUrl,process.env.ANTHROPIC_AUTH_TOKEN=B.apiKey,process.env.ANTHROPIC_DEFAULT_OPUS_MODEL=E.opus,process.env.ANTHROPIC_DEFAULT_SONNET_MODEL=E.sonnet,process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL=E.haiku;let Q=D6("claude",h5(),{stdio:"inherit",env:process.env});Q.on("error",(Y)=>{console.error(`\u274C Failed to launch: ${Y.message}`),process.exit(1)}),Q.on("exit",(Y)=>{process.exit(Y||0)})}else{let Q=await $3(I2);if(Q){console.log(`\uD83D\uDE80 Adding "${D}" to session "${I2}"...`);let W=await t8(Q.id,D);if(!W)console.error("\u274C Failed to create window"),process.exit(1);let C=await s2(W.id);await X3(C[0].id,J)}else{if(console.log(`\uD83D\uDE80 Creating session "${I2}" with "${D}"...`),Q=await s8(I2),!Q)console.error("\u274C Failed to create tmux session"),process.exit(1);let W=await q3(Q.id);await e8(W[0].id,D);let C=await s2(W[0].id);await X3(C[0].id,J)}console.log("\u2705 Ready"),console.log(`
|
|
67
|
+
Attaching to session...`);let Y=D6("tmux",["attach","-t",I2],{stdio:"inherit"});Y.on("error",(W)=>{console.error(`\u274C Failed to attach: ${W.message}`),process.exit(1)}),Y.on("exit",(W)=>{process.exit(W||0)})}}async function J3(D={}){if(!s())console.error("\u274C No config found. Run `claudio setup` first."),process.exit(1);let F=await y8();if(!F)console.error("\u274C No default profile set."),console.log("\nRun `claudio setup` to configure, or use `claudio <profile>` to launch a specific profile."),process.exit(1);await t2(F,D)}async function E6(){if(!s())console.error("\u274C No config found. Run `claudio setup` first."),process.exit(1);let D=await m8();if(D.length===0){console.log("No profiles configured."),console.log("Run `claudio profiles add` to create one.");return}console.log(`
|
|
68
|
+
Profiles:
|
|
69
|
+
`);for(let{name:F,profile:B,isDefault:E}of D)console.log(` ${F}${E?" *":""}`),console.log(` opus: ${B.opus}`),console.log(` sonnet: ${B.sonnet}`),console.log(` haiku: ${B.haiku}`),console.log("");console.log("(* = default)")}async function $6(){await d8()}async function q6(D){if(!s())console.error("\u274C No config found. Run `claudio setup` first."),process.exit(1);if(!await n0(D))console.error(`\u274C Profile "${D}" not found`),process.exit(1);if(!await l8(`Delete profile "${D}"?`)){console.log("Cancelled.");return}await g8(D),console.log(`\u2713 Profile "${D}" deleted`)}async function X6(D){if(!s())console.error("\u274C No config found. Run `claudio setup` first."),process.exit(1);try{await h8(D),console.log(`\u2713 Default profile set to "${D}"`)}catch(F){console.error(`\u274C ${F.message}`),process.exit(1)}}async function J6(D){if(!s())console.error("\u274C No config found. Run `claudio setup` first."),process.exit(1);let F=await n0(D);if(!F)console.error(`\u274C Profile "${D}" not found`),process.exit(1);console.log(`
|
|
70
|
+
Profile: ${D}
|
|
71
|
+
`),console.log(` opus: ${F.opus}`),console.log(` sonnet: ${F.sonnet}`),console.log(` haiku: ${F.haiku}`)}async function Q6(){if(!s())console.error("\u274C No config found. Run `claudio setup` first."),process.exit(1);let D=await t();process.stdout.write("Fetching models... ");let F=await j2(D.apiUrl,D.apiKey);if(!F.success)console.log("\u274C"),console.error(`
|
|
72
|
+
\u274C ${F.message}`),process.exit(1);console.log(`\u2713
|
|
73
|
+
`),console.log(`Available models (${F.modelCount}):
|
|
74
|
+
`);for(let B of F.models)console.log(` ${B.id}`)}async function Y6(){if(!s())console.error("\u274C No config found. Run `claudio setup` first."),process.exit(1);let D=await t(),F=Object.keys(D.profiles).length;console.log(`
|
|
75
|
+
Claudio Config
|
|
76
|
+
`),console.log(` API URL: ${D.apiUrl}`),console.log(` API Key: ${D.apiKey.slice(0,8)}...${D.apiKey.slice(-4)}`),console.log(` Default Profile: ${D.defaultProfile||"(none)"}`),console.log(` Profiles: ${F}`)}var PD=new N3;PD.name("claudio").description("Launch Claude Code with custom LLM router profiles").version("0.2.0").option("--hooks <presets>","Override hooks (comma-separated: collaborative,supervised,sandboxed,audited)").option("--no-hooks","Disable all hooks");PD.command("setup").description("First-time setup wizard").action(async()=>{await c8()});PD.command("launch [profile]").description("Launch Claude Code with optional profile").option("--hooks <presets>","Override hooks (comma-separated)").option("--no-hooks","Disable all hooks").action(async(D,F)=>{let B={hooks:F.hooks,noHooks:F.noHooks};if(D)await t2(D,B);else await J3(B)});var P2=PD.command("profiles").description("Manage profiles");P2.command("list",{isDefault:!0}).description("List all profiles (* = default)").action(async()=>{await E6()});P2.command("add").description("Add new profile (interactive picker)").action(async()=>{await $6()});P2.command("rm <name>").description("Delete profile").action(async(D)=>{await q6(D)});P2.command("default <name>").description("Set default profile").action(async(D)=>{await X6(D)});P2.command("show <name>").description("Show profile details").action(async(D)=>{await J6(D)});PD.command("models").description("List available models from router").action(async()=>{await Q6()});PD.command("config").description("Show current config (URL, default profile)").action(async()=>{await Y6()});PD.action(async(D,F)=>{let B=F.args,E={hooks:D.hooks,noHooks:D.hooks===!1};if(B.length===0){await J3(E);return}let $=B[0];await t2($,E)});PD.parse();
|