@automagik/genie 0.260203.629 → 0.260203.711
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/.genie/tasks/agent-delegation-handover.md +85 -0
- package/dist/claudio.js +1 -1
- package/dist/genie.js +1 -1
- package/dist/term.js +54 -54
- package/package.json +1 -1
- package/plugins/automagik-genie/README.md +7 -7
- package/plugins/automagik-genie/agents/council--architect.md +225 -0
- package/plugins/automagik-genie/agents/council--benchmarker.md +252 -0
- package/plugins/automagik-genie/agents/council--deployer.md +224 -0
- package/plugins/automagik-genie/agents/council--ergonomist.md +226 -0
- package/plugins/automagik-genie/agents/council--measurer.md +240 -0
- package/plugins/automagik-genie/agents/council--operator.md +223 -0
- package/plugins/automagik-genie/agents/council--questioner.md +212 -0
- package/plugins/automagik-genie/agents/council--sentinel.md +225 -0
- package/plugins/automagik-genie/agents/council--simplifier.md +221 -0
- package/plugins/automagik-genie/agents/council--tracer.md +280 -0
- package/plugins/automagik-genie/agents/council.md +146 -0
- package/plugins/automagik-genie/agents/implementor.md +1 -1
- package/plugins/automagik-genie/references/review-criteria.md +1 -1
- package/plugins/automagik-genie/references/wish-template.md +1 -1
- package/plugins/automagik-genie/skills/council/SKILL.md +80 -0
- package/plugins/automagik-genie/skills/{forge → make}/SKILL.md +3 -3
- package/plugins/automagik-genie/skills/plan-review/SKILL.md +2 -2
- package/plugins/automagik-genie/skills/review/SKILL.md +13 -13
- package/plugins/automagik-genie/skills/wish/SKILL.md +2 -2
- package/src/lib/log-reader.ts +11 -5
- package/src/lib/orchestrator/event-monitor.ts +5 -2
- package/src/lib/version.ts +1 -1
- /package/.genie/{wishes/upgrade-brainstorm-handoff/wish.md → backlog/upgrade-brainstorm.md} +0 -0
package/dist/term.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var gF=Object.create;var{getPrototypeOf:lF,defineProperty:D3,getOwnPropertyNames:mF}=Object;var cF=Object.prototype.hasOwnProperty;var iD=(D,F,E)=>{E=D!=null?gF(lF(D)):{};let B=F||!D||!D.__esModule?D3(E,"default",{value:D,enumerable:!0}):E;for(let $ of mF(D))if(!cF.call(B,$))D3(B,$,{get:()=>D[$],enumerable:!0});return B};var c=(D,F)=>()=>(F||D((F={exports:{}}).exports,F),F.exports);var N8=(D,F)=>{for(var E in F)D3(D,E,{get:F[E],enumerable:!0,configurable:!0,set:(B)=>F[E]=()=>B})};var pF=(D,F)=>()=>(D&&(F=D(D=0)),F);var FD=import.meta.require;var i2=c((dF)=>{class F3 extends Error{constructor(D,F,E){super(E);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=F,this.exitCode=D,this.nestedError=void 0}}class S8 extends F3{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}dF.CommanderError=F3;dF.InvalidArgumentError=S8});var z0=c((oF)=>{var{InvalidArgumentError:rF}=i2();class T8{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,E)=>{if(!this.argChoices.includes(F))throw new rF(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(F,E);return F},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function aF(D){let F=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+F+">":"["+F+"]"}oF.Argument=T8;oF.humanReadableArgName=aF});var E3=c((D5)=>{var{humanReadableArgName:eF}=z0();class b8{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(D){let F=D.commands.filter((B)=>!B._hidden),E=D._getHelpCommand();if(E&&!E._hidden)F.push(E);if(this.sortSubcommands)F.sort((B,$)=>{return B.name().localeCompare($.name())});return F}compareOptions(D,F){let E=(B)=>{return B.short?B.short.replace(/^-/,""):B.long.replace(/^--/,"")};return E(D).localeCompare(E(F))}visibleOptions(D){let F=D.options.filter((B)=>!B.hidden),E=D._getHelpOption();if(E&&!E.hidden){let B=E.short&&D._findOption(E.short),$=E.long&&D._findOption(E.long);if(!B&&!$)F.push(E);else if(E.long&&!$)F.push(D.createOption(E.long,E.description));else if(E.short&&!B)F.push(D.createOption(E.short,E.description))}if(this.sortOptions)F.sort(this.compareOptions);return F}visibleGlobalOptions(D){if(!this.showGlobalOptions)return[];let F=[];for(let E=D.parent;E;E=E.parent){let B=E.options.filter(($)=>!$.hidden);F.push(...B)}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((E)=>eF(E)).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((E,B)=>{return Math.max(E,F.subcommandTerm(B).length)},0)}longestOptionTermLength(D,F){return F.visibleOptions(D).reduce((E,B)=>{return Math.max(E,F.optionTerm(B).length)},0)}longestGlobalOptionTermLength(D,F){return F.visibleGlobalOptions(D).reduce((E,B)=>{return Math.max(E,F.optionTerm(B).length)},0)}longestArgumentTermLength(D,F){return F.visibleArguments(D).reduce((E,B)=>{return Math.max(E,F.argumentTerm(B).length)},0)}commandUsage(D){let F=D._name;if(D._aliases[0])F=F+"|"+D._aliases[0];let E="";for(let B=D.parent;B;B=B.parent)E=B.name()+" "+E;return E+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((E)=>JSON.stringify(E)).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((E)=>JSON.stringify(E)).join(", ")}`);if(D.defaultValue!==void 0)F.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`);if(F.length>0){let E=`(${F.join(", ")})`;if(D.description)return`${D.description} ${E}`;return E}return D.description}formatHelp(D,F){let E=F.padWidth(D,F),B=F.helpWidth||80,$=2,X=2;function Q(U,z){if(z){let
|
|
3
|
+
var gF=Object.create;var{getPrototypeOf:lF,defineProperty:D3,getOwnPropertyNames:mF}=Object;var cF=Object.prototype.hasOwnProperty;var iD=(D,F,E)=>{E=D!=null?gF(lF(D)):{};let B=F||!D||!D.__esModule?D3(E,"default",{value:D,enumerable:!0}):E;for(let $ of mF(D))if(!cF.call(B,$))D3(B,$,{get:()=>D[$],enumerable:!0});return B};var c=(D,F)=>()=>(F||D((F={exports:{}}).exports,F),F.exports);var N8=(D,F)=>{for(var E in F)D3(D,E,{get:F[E],enumerable:!0,configurable:!0,set:(B)=>F[E]=()=>B})};var pF=(D,F)=>()=>(D&&(F=D(D=0)),F);var FD=import.meta.require;var i2=c((dF)=>{class F3 extends Error{constructor(D,F,E){super(E);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=F,this.exitCode=D,this.nestedError=void 0}}class S8 extends F3{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}dF.CommanderError=F3;dF.InvalidArgumentError=S8});var z0=c((oF)=>{var{InvalidArgumentError:rF}=i2();class T8{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,E)=>{if(!this.argChoices.includes(F))throw new rF(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(F,E);return F},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function aF(D){let F=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+F+">":"["+F+"]"}oF.Argument=T8;oF.humanReadableArgName=aF});var E3=c((D5)=>{var{humanReadableArgName:eF}=z0();class b8{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(D){let F=D.commands.filter((B)=>!B._hidden),E=D._getHelpCommand();if(E&&!E._hidden)F.push(E);if(this.sortSubcommands)F.sort((B,$)=>{return B.name().localeCompare($.name())});return F}compareOptions(D,F){let E=(B)=>{return B.short?B.short.replace(/^-/,""):B.long.replace(/^--/,"")};return E(D).localeCompare(E(F))}visibleOptions(D){let F=D.options.filter((B)=>!B.hidden),E=D._getHelpOption();if(E&&!E.hidden){let B=E.short&&D._findOption(E.short),$=E.long&&D._findOption(E.long);if(!B&&!$)F.push(E);else if(E.long&&!$)F.push(D.createOption(E.long,E.description));else if(E.short&&!B)F.push(D.createOption(E.short,E.description))}if(this.sortOptions)F.sort(this.compareOptions);return F}visibleGlobalOptions(D){if(!this.showGlobalOptions)return[];let F=[];for(let E=D.parent;E;E=E.parent){let B=E.options.filter(($)=>!$.hidden);F.push(...B)}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((E)=>eF(E)).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((E,B)=>{return Math.max(E,F.subcommandTerm(B).length)},0)}longestOptionTermLength(D,F){return F.visibleOptions(D).reduce((E,B)=>{return Math.max(E,F.optionTerm(B).length)},0)}longestGlobalOptionTermLength(D,F){return F.visibleGlobalOptions(D).reduce((E,B)=>{return Math.max(E,F.optionTerm(B).length)},0)}longestArgumentTermLength(D,F){return F.visibleArguments(D).reduce((E,B)=>{return Math.max(E,F.argumentTerm(B).length)},0)}commandUsage(D){let F=D._name;if(D._aliases[0])F=F+"|"+D._aliases[0];let E="";for(let B=D.parent;B;B=B.parent)E=B.name()+" "+E;return E+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((E)=>JSON.stringify(E)).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((E)=>JSON.stringify(E)).join(", ")}`);if(D.defaultValue!==void 0)F.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`);if(F.length>0){let E=`(${F.join(", ")})`;if(D.description)return`${D.description} ${E}`;return E}return D.description}formatHelp(D,F){let E=F.padWidth(D,F),B=F.helpWidth||80,$=2,X=2;function Q(U,z){if(z){let L=`${U.padEnd(E+2)}${z}`;return F.wrap(L,B-2,E+2)}return U}function J(U){return U.join(`
|
|
4
4
|
`).replace(/^/gm," ".repeat(2))}let Y=[`Usage: ${F.commandUsage(D)}`,""],q=F.commandDescription(D);if(q.length>0)Y=Y.concat([F.wrap(q,B,0),""]);let H=F.visibleArguments(D).map((U)=>{return Q(F.argumentTerm(U),F.argumentDescription(U))});if(H.length>0)Y=Y.concat(["Arguments:",J(H),""]);let _=F.visibleOptions(D).map((U)=>{return Q(F.optionTerm(U),F.optionDescription(U))});if(_.length>0)Y=Y.concat(["Options:",J(_),""]);if(this.showGlobalOptions){let U=F.visibleGlobalOptions(D).map((z)=>{return Q(F.optionTerm(z),F.optionDescription(z))});if(U.length>0)Y=Y.concat(["Global Options:",J(U),""])}let G=F.visibleCommands(D).map((U)=>{return Q(F.subcommandTerm(U),F.subcommandDescription(U))});if(G.length>0)Y=Y.concat(["Commands:",J(G),""]);return Y.join(`
|
|
5
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,E,B=40){let X=new RegExp(`[\\n][${" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF"}]+`);if(D.match(X))return D;let Q=F-E;if(Q<B)return D;let J=D.slice(0,E),Y=D.slice(E).replace(`\r
|
|
6
6
|
`,`
|
|
7
7
|
`),q=" ".repeat(E),_=`\\s${"\u200B"}`,G=new RegExp(`
|
|
8
|
-
|.{1,${Q-1}}([${_}]|$)|[^${_}]+?([${_}]|$)`,"g"),U=Y.match(G)||[];return J+U.map((z,
|
|
9
|
-
`)return"";return(
|
|
8
|
+
|.{1,${Q-1}}([${_}]|$)|[^${_}]+?([${_}]|$)`,"g"),U=Y.match(G)||[];return J+U.map((z,L)=>{if(z===`
|
|
9
|
+
`)return"";return(L>0?q:"")+z.trimEnd()}).join(`
|
|
10
10
|
`)}}D5.Help=b8});var B3=c((X5)=>{var{InvalidArgumentError:E5}=i2();class P8{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 E=$5(D);if(this.short=E.shortFlag,this.long=E.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,E)=>{if(!this.argChoices.includes(F))throw new E5(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(F,E);return F},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return B5(this.name().replace(/^no-/,""))}is(D){return this.short===D||this.long===D}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class f8{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,E)=>{if(this.positiveOptions.has(E))this.dualOptions.add(E)})}valueFromOption(D,F){let E=F.attributeName();if(!this.dualOptions.has(E))return!0;let B=this.negativeOptions.get(E).presetArg,$=B!==void 0?B:!1;return F.negate===($===D)}}function B5(D){return D.split("-").reduce((F,E)=>{return F+E[0].toUpperCase()+E.slice(1)})}function $5(D){let F,E,B=D.split(/[ |,]+/);if(B.length>1&&!/^[[<]/.test(B[1]))F=B.shift();if(E=B.shift(),!F&&/^-[^-]$/.test(E))F=E,E=void 0;return{shortFlag:F,longFlag:E}}X5.Option=P8;X5.DualOptions=f8});var Z8=c((H5)=>{function Y5(D,F){if(Math.abs(D.length-F.length)>3)return Math.max(D.length,F.length);let E=[];for(let B=0;B<=D.length;B++)E[B]=[B];for(let B=0;B<=F.length;B++)E[0][B]=B;for(let B=1;B<=F.length;B++)for(let $=1;$<=D.length;$++){let X=1;if(D[$-1]===F[B-1])X=0;else X=1;if(E[$][B]=Math.min(E[$-1][B]+1,E[$][B-1]+1,E[$-1][B-1]+X),$>1&&B>1&&D[$-1]===F[B-2]&&D[$-2]===F[B-1])E[$][B]=Math.min(E[$][B],E[$-2][B-2]+1)}return E[D.length][F.length]}function q5(D,F){if(!F||F.length===0)return"";F=Array.from(new Set(F));let E=D.startsWith("--");if(E)D=D.slice(2),F=F.map((Q)=>Q.slice(2));let B=[],$=3,X=0.4;if(F.forEach((Q)=>{if(Q.length<=1)return;let J=Y5(D,Q),Y=Math.max(D.length,Q.length);if((Y-J)/Y>X){if(J<$)$=J,B=[Q];else if(J===$)B.push(Q)}}),B.sort((Q,J)=>Q.localeCompare(J)),E)B=B.map((Q)=>`--${Q}`);if(B.length>1)return`
|
|
11
11
|
(Did you mean one of ${B.join(", ")}?)`;if(B.length===1)return`
|
|
12
|
-
(Did you mean ${B[0]}?)`;return""}H5.suggestSimilar=q5});var u8=c((z5)=>{var G5=FD("events").EventEmitter,$3=FD("child_process"),OD=FD("path"),X3=FD("fs"),l=FD("process"),{Argument:W5,humanReadableArgName:U5}=z0(),{CommanderError:Q3}=i2(),{Help:A5}=E3(),{Option:I8,DualOptions:C5}=B3(),{suggestSimilar:
|
|
12
|
+
(Did you mean ${B[0]}?)`;return""}H5.suggestSimilar=q5});var u8=c((z5)=>{var G5=FD("events").EventEmitter,$3=FD("child_process"),OD=FD("path"),X3=FD("fs"),l=FD("process"),{Argument:W5,humanReadableArgName:U5}=z0(),{CommanderError:Q3}=i2(),{Help:A5}=E3(),{Option:I8,DualOptions:C5}=B3(),{suggestSimilar:v8}=Z8();class J3 extends G5{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)=>l.stdout.write(F),writeErr:(F)=>l.stderr.write(F),getOutHelpWidth:()=>l.stdout.isTTY?l.stdout.columns:void 0,getErrHelpWidth:()=>l.stderr.isTTY?l.stderr.columns:void 0,outputError:(F,E)=>E(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,E){let B=F,$=E;if(typeof B==="object"&&B!==null)$=B,B=null;$=$||{};let[,X,Q]=D.match(/([^ ]+) *(.*)/),J=this.createCommand(X);if(B)J.description(B),J._executableHandler=!0;if($.isDefault)this._defaultCommandName=J._name;if(J._hidden=!!($.noHelp||$.hidden),J._executableFile=$.executableFile||null,Q)J.arguments(Q);if(this._registerCommand(J),J.parent=this,J.copyInheritedSettings(this),B)return this;return J}createCommand(D){return new J3(D)}createHelp(){return Object.assign(new A5,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
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 W5(D,F)}argument(D,F,E,B){let $=this.createArgument(D,F);if(typeof E==="function")$.default(B).argParser(E);else $.default(E);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[,E,B]=D.match(/([^ ]+) *(.*)/),$=F??"display help for command",X=this.createCommand(E);if(X.helpOption(!1),B)X.arguments(B);if($)X.description($);return this._addImplicitHelpCommand=!0,this._helpCommand=X,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 E=["preSubcommand","preAction","postAction"];if(!E.includes(D))throw Error(`Unexpected value for event passed to hook : '${D}'.
|
|
14
14
|
Expecting one of '${E.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,E){if(this._exitCallback)this._exitCallback(new Q3(D,F,E));l.exit(D)}action(D){let F=(E)=>{let B=this.registeredArguments.length,$=E.slice(0,B);if(this._storeOptionsAsProperties)$[B]=this;else $[B]=this.opts();return $.push(this),D.apply(this,$)};return this._actionHandler=F,this}createOption(D,F){return new I8(D,F)}_callParseArg(D,F,E,B){try{return D.parseArg(F,E)}catch($){if($.code==="commander.invalidArgument"){let X=`${B} ${$.message}`;this.error(X,{exitCode:$.exitCode,code:$.code})}throw $}}_registerOption(D){let F=D.short&&this._findOption(D.short)||D.long&&this._findOption(D.long);if(F){let E=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 '${E}'
|
|
15
|
-
- already used by option '${F.flags}'`)}this.options.push(D)}_registerCommand(D){let F=(B)=>{return[B.name()].concat(B.aliases())},E=F(D).find((B)=>this._findCommand(B));if(E){let B=F(this._findCommand(E)).join("|"),$=F(D).join("|");throw Error(`cannot add command '${$}' as already have command '${B}'`)}this.commands.push(D)}addOption(D){this._registerOption(D);let F=D.name(),E=D.attributeName();if(D.negate){let $=D.long.replace(/^--no-/,"--");if(!this._findOption($))this.setOptionValueWithSource(E,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(E,D.defaultValue,"default");let B=($,X,Q)=>{if($==null&&D.presetArg!==void 0)$=D.presetArg;let J=this.getOptionValue(E);if($!==null&&D.parseArg)$=this._callParseArg(D,$,J,X);else if($!==null&&D.variadic)$=D._concatValue($,J);if($==null)if(D.negate)$=!1;else if(D.isBoolean()||D.optional)$=!0;else $="";this.setOptionValueWithSource(E,$,Q)};if(this.on("option:"+F,($)=>{let X=`error: option '${D.flags}' argument '${$}' is invalid.`;B($,X,"cli")}),D.envVar)this.on("optionEnv:"+F,($)=>{let X=`error: option '${D.flags}' value '${$}' from env '${D.envVar}' is invalid.`;B($,X,"env")});return this}_optionEx(D,F,E,B,$){if(typeof F==="object"&&F instanceof I8)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let X=this.createOption(F,E);if(X.makeOptionMandatory(!!D.mandatory),typeof B==="function")X.default($).argParser(B);else if(B instanceof RegExp){let Q=B;B=(J,Y)=>{let q=Q.exec(J);return q?q[0]:Y},X.default($).argParser(B)}else X.default(B);return this.addOption(X)}option(D,F,E,B){return this._optionEx({},D,F,E,B)}requiredOption(D,F,E,B){return this._optionEx({mandatory:!0},D,F,E,B)}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,E){if(this._storeOptionsAsProperties)this[D]=F;else this._optionValues[D]=F;return this._optionValueSources[D]=E,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let F;return this._getCommandAndAncestors().forEach((E)=>{if(E.getOptionValueSource(D)!==void 0)F=E.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(l.versions?.electron)F.from="electron";let B=l.execArgv??[];if(B.includes("-e")||B.includes("--eval")||B.includes("-p")||B.includes("--print"))F.from="eval"}if(D===void 0)D=l.argv;this.rawArgs=D.slice();let E;switch(F.from){case void 0:case"node":this._scriptPath=D[1],E=D.slice(2);break;case"electron":if(l.defaultApp)this._scriptPath=D[1],E=D.slice(2);else E=D.slice(1);break;case"user":E=D.slice(0);break;case"eval":E=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",E}parse(D,F){let E=this._prepareUserArgs(D,F);return this._parseCommand([],E),this}async parseAsync(D,F){let E=this._prepareUserArgs(D,F);return await this._parseCommand([],E),this}_executeSubCommand(D,F){F=F.slice();let E=!1,B=[".js",".ts",".tsx",".mjs",".cjs"];function $(q,H){let _=OD.resolve(q,H);if(X3.existsSync(_))return _;if(B.includes(OD.extname(H)))return;let G=B.find((U)=>X3.existsSync(`${_}${U}`));if(G)return`${_}${G}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let X=D._executableFile||`${this._name}-${D._name}`,Q=this._executableDir||"";if(this._scriptPath){let q;try{q=X3.realpathSync(this._scriptPath)}catch(H){q=this._scriptPath}Q=OD.resolve(OD.dirname(q),Q)}if(Q){let q=$(Q,X);if(!q&&!D._executableFile&&this._scriptPath){let H=OD.basename(this._scriptPath,OD.extname(this._scriptPath));if(H!==this._name)q=$(Q,`${H}-${D._name}`)}X=q||X}E=B.includes(OD.extname(X));let J;if(l.platform!=="win32")if(E)F.unshift(X),F=
|
|
15
|
+
- already used by option '${F.flags}'`)}this.options.push(D)}_registerCommand(D){let F=(B)=>{return[B.name()].concat(B.aliases())},E=F(D).find((B)=>this._findCommand(B));if(E){let B=F(this._findCommand(E)).join("|"),$=F(D).join("|");throw Error(`cannot add command '${$}' as already have command '${B}'`)}this.commands.push(D)}addOption(D){this._registerOption(D);let F=D.name(),E=D.attributeName();if(D.negate){let $=D.long.replace(/^--no-/,"--");if(!this._findOption($))this.setOptionValueWithSource(E,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(E,D.defaultValue,"default");let B=($,X,Q)=>{if($==null&&D.presetArg!==void 0)$=D.presetArg;let J=this.getOptionValue(E);if($!==null&&D.parseArg)$=this._callParseArg(D,$,J,X);else if($!==null&&D.variadic)$=D._concatValue($,J);if($==null)if(D.negate)$=!1;else if(D.isBoolean()||D.optional)$=!0;else $="";this.setOptionValueWithSource(E,$,Q)};if(this.on("option:"+F,($)=>{let X=`error: option '${D.flags}' argument '${$}' is invalid.`;B($,X,"cli")}),D.envVar)this.on("optionEnv:"+F,($)=>{let X=`error: option '${D.flags}' value '${$}' from env '${D.envVar}' is invalid.`;B($,X,"env")});return this}_optionEx(D,F,E,B,$){if(typeof F==="object"&&F instanceof I8)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let X=this.createOption(F,E);if(X.makeOptionMandatory(!!D.mandatory),typeof B==="function")X.default($).argParser(B);else if(B instanceof RegExp){let Q=B;B=(J,Y)=>{let q=Q.exec(J);return q?q[0]:Y},X.default($).argParser(B)}else X.default(B);return this.addOption(X)}option(D,F,E,B){return this._optionEx({},D,F,E,B)}requiredOption(D,F,E,B){return this._optionEx({mandatory:!0},D,F,E,B)}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,E){if(this._storeOptionsAsProperties)this[D]=F;else this._optionValues[D]=F;return this._optionValueSources[D]=E,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let F;return this._getCommandAndAncestors().forEach((E)=>{if(E.getOptionValueSource(D)!==void 0)F=E.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(l.versions?.electron)F.from="electron";let B=l.execArgv??[];if(B.includes("-e")||B.includes("--eval")||B.includes("-p")||B.includes("--print"))F.from="eval"}if(D===void 0)D=l.argv;this.rawArgs=D.slice();let E;switch(F.from){case void 0:case"node":this._scriptPath=D[1],E=D.slice(2);break;case"electron":if(l.defaultApp)this._scriptPath=D[1],E=D.slice(2);else E=D.slice(1);break;case"user":E=D.slice(0);break;case"eval":E=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",E}parse(D,F){let E=this._prepareUserArgs(D,F);return this._parseCommand([],E),this}async parseAsync(D,F){let E=this._prepareUserArgs(D,F);return await this._parseCommand([],E),this}_executeSubCommand(D,F){F=F.slice();let E=!1,B=[".js",".ts",".tsx",".mjs",".cjs"];function $(q,H){let _=OD.resolve(q,H);if(X3.existsSync(_))return _;if(B.includes(OD.extname(H)))return;let G=B.find((U)=>X3.existsSync(`${_}${U}`));if(G)return`${_}${G}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let X=D._executableFile||`${this._name}-${D._name}`,Q=this._executableDir||"";if(this._scriptPath){let q;try{q=X3.realpathSync(this._scriptPath)}catch(H){q=this._scriptPath}Q=OD.resolve(OD.dirname(q),Q)}if(Q){let q=$(Q,X);if(!q&&!D._executableFile&&this._scriptPath){let H=OD.basename(this._scriptPath,OD.extname(this._scriptPath));if(H!==this._name)q=$(Q,`${H}-${D._name}`)}X=q||X}E=B.includes(OD.extname(X));let J;if(l.platform!=="win32")if(E)F.unshift(X),F=w8(l.execArgv).concat(F),J=$3.spawn(l.argv[0],F,{stdio:"inherit"});else J=$3.spawn(X,F,{stdio:"inherit"});else F.unshift(X),F=w8(l.execArgv).concat(F),J=$3.spawn(l.execPath,F,{stdio:"inherit"});if(!J.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((H)=>{l.on(H,()=>{if(J.killed===!1&&J.exitCode===null)J.kill(H)})});let Y=this._exitCallback;J.on("close",(q)=>{if(q=q??1,!Y)l.exit(q);else Y(new Q3(q,"commander.executeSubCommandAsync","(close)"))}),J.on("error",(q)=>{if(q.code==="ENOENT"){let H=Q?`searched for local subcommand relative to directory '${Q}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",_=`'${X}' does not exist
|
|
16
16
|
- if '${D._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
17
17
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
18
18
|
- ${H}`;throw Error(_)}else if(q.code==="EACCES")throw Error(`'${X}' not executable`);if(!Y)l.exit(1);else{let H=new Q3(1,"commander.executeSubCommandAsync","(error)");H.nestedError=q,Y(H)}}),this.runningCommand=J}_dispatchSubcommand(D,F,E){let B=this._findCommand(D);if(!B)this.help({error:!0});let $;return $=this._chainOrCallSubCommandHook($,B,"preSubcommand"),$=this._chainOrCall($,()=>{if(B._executableHandler)this._executeSubCommand(B,F.concat(E));else return B._parseCommand(F,E)}),$}_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=(E,B,$)=>{let X=B;if(B!==null&&E.parseArg){let Q=`error: command-argument value '${B}' is invalid for argument '${E.name()}'.`;X=this._callParseArg(E,B,$,Q)}return X};this._checkNumberOfArguments();let F=[];this.registeredArguments.forEach((E,B)=>{let $=E.defaultValue;if(E.variadic){if(B<this.args.length){if($=this.args.slice(B),E.parseArg)$=$.reduce((X,Q)=>{return D(E,Q,X)},E.defaultValue)}else if($===void 0)$=[]}else if(B<this.args.length){if($=this.args[B],E.parseArg)$=D(E,$,E.defaultValue)}F[B]=$}),this.processedArgs=F}_chainOrCall(D,F){if(D&&D.then&&typeof D.then==="function")return D.then(()=>F());return F()}_chainOrCallHooks(D,F){let E=D,B=[];if(this._getCommandAndAncestors().reverse().filter(($)=>$._lifeCycleHooks[F]!==void 0).forEach(($)=>{$._lifeCycleHooks[F].forEach((X)=>{B.push({hookedCommand:$,callback:X})})}),F==="postAction")B.reverse();return B.forEach(($)=>{E=this._chainOrCall(E,()=>{return $.callback($.hookedCommand,this)})}),E}_chainOrCallSubCommandHook(D,F,E){let B=D;if(this._lifeCycleHooks[E]!==void 0)this._lifeCycleHooks[E].forEach(($)=>{B=this._chainOrCall(B,()=>{return $(this,F)})});return B}_parseCommand(D,F){let E=this.parseOptions(F);if(this._parseOptionsEnv(),this._parseOptionsImplied(),D=D.concat(E.operands),F=E.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(E.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let B=()=>{if(E.unknown.length>0)this.unknownOption(E.unknown[0])},$=`command:${this.name()}`;if(this._actionHandler){B(),this._processArguments();let X;if(X=this._chainOrCallHooks(X,"preAction"),X=this._chainOrCall(X,()=>this._actionHandler(this.processedArgs)),this.parent)X=this._chainOrCall(X,()=>{this.parent.emit($,D,F)});return X=this._chainOrCallHooks(X,"postAction"),X}if(this.parent&&this.parent.listenerCount($))B(),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 B(),this._processArguments()}else if(this.commands.length)B(),this.help({error:!0});else B(),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((E)=>{let B=E.attributeName();if(this.getOptionValue(B)===void 0)return!1;return this.getOptionValueSource(B)!=="default"});D.filter((E)=>E.conflictsWith.length>0).forEach((E)=>{let B=D.find(($)=>E.conflictsWith.includes($.attributeName()));if(B)this._conflictingOption(E,B)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let F=[],E=[],B=F,$=D.slice();function X(J){return J.length>1&&J[0]==="-"}let Q=null;while($.length){let J=$.shift();if(J==="--"){if(B===E)B.push(J);B.push(...$);break}if(Q&&!X(J)){this.emit(`option:${Q.name()}`,J);continue}if(Q=null,X(J)){let Y=this._findOption(J);if(Y){if(Y.required){let q=$.shift();if(q===void 0)this.optionMissingArgument(Y);this.emit(`option:${Y.name()}`,q)}else if(Y.optional){let q=null;if($.length>0&&!X($[0]))q=$.shift();this.emit(`option:${Y.name()}`,q)}else this.emit(`option:${Y.name()}`);Q=Y.variadic?Y:null;continue}}if(J.length>2&&J[0]==="-"&&J[1]!=="-"){let Y=this._findOption(`-${J[1]}`);if(Y){if(Y.required||Y.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${Y.name()}`,J.slice(2));else this.emit(`option:${Y.name()}`),$.unshift(`-${J.slice(2)}`);continue}}if(/^--[^=]+=/.test(J)){let Y=J.indexOf("="),q=this._findOption(J.slice(0,Y));if(q&&(q.required||q.optional)){this.emit(`option:${q.name()}`,J.slice(Y+1));continue}}if(X(J))B=E;if((this._enablePositionalOptions||this._passThroughOptions)&&F.length===0&&E.length===0){if(this._findCommand(J)){if(F.push(J),$.length>0)E.push(...$);break}else if(this._getHelpCommand()&&J===this._getHelpCommand().name()){if(F.push(J),$.length>0)F.push(...$);break}else if(this._defaultCommandName){if(E.push(J),$.length>0)E.push(...$);break}}if(this._passThroughOptions){if(B.push(J),$.length>0)B.push(...$);break}B.push(J)}return{operands:F,unknown:E}}opts(){if(this._storeOptionsAsProperties){let D={},F=this.options.length;for(let E=0;E<F;E++){let B=this.options[E].attributeName();D[B]=B===this._versionOptionName?this._version:this[B]}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
19
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
20
20
|
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
|
|
21
|
-
`),this.outputHelp({error:!0});let E=F||{},B=E.exitCode||1,$=E.code||"commander.error";this._exit(B,$,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in l.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()}`,l.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new C5(this.options),F=(E)=>{return this.getOptionValue(E)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(E))};this.options.filter((E)=>E.implied!==void 0&&F(E.attributeName())&&D.valueFromOption(this.getOptionValue(E.attributeName()),E)).forEach((E)=>{Object.keys(E.implied).filter((B)=>!F(B)).forEach((B)=>{this.setOptionValueWithSource(B,E.implied[B],"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 E=(X)=>{let Q=X.attributeName(),J=this.getOptionValue(Q),Y=this.options.find((H)=>H.negate&&Q===H.attributeName()),q=this.options.find((H)=>!H.negate&&Q===H.attributeName());if(Y&&(Y.presetArg===void 0&&J===!1||Y.presetArg!==void 0&&J===Y.presetArg))return Y;return q||X},B=(X)=>{let Q=E(X),J=Q.attributeName();if(this.getOptionValueSource(J)==="env")return`environment variable '${Q.envVar}'`;return`option '${Q.flags}'`},$=`error: ${B(D)} cannot be used with ${B(F)}`;this.error($,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let F="";if(D.startsWith("--")&&this._showSuggestionAfterError){let B=[],$=this;do{let X=$.createHelp().visibleOptions($).filter((Q)=>Q.long).map((Q)=>Q.long);B=B.concat(X),$=$.parent}while($&&!$._enablePositionalOptions);F=
|
|
21
|
+
`),this.outputHelp({error:!0});let E=F||{},B=E.exitCode||1,$=E.code||"commander.error";this._exit(B,$,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in l.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()}`,l.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new C5(this.options),F=(E)=>{return this.getOptionValue(E)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(E))};this.options.filter((E)=>E.implied!==void 0&&F(E.attributeName())&&D.valueFromOption(this.getOptionValue(E.attributeName()),E)).forEach((E)=>{Object.keys(E.implied).filter((B)=>!F(B)).forEach((B)=>{this.setOptionValueWithSource(B,E.implied[B],"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 E=(X)=>{let Q=X.attributeName(),J=this.getOptionValue(Q),Y=this.options.find((H)=>H.negate&&Q===H.attributeName()),q=this.options.find((H)=>!H.negate&&Q===H.attributeName());if(Y&&(Y.presetArg===void 0&&J===!1||Y.presetArg!==void 0&&J===Y.presetArg))return Y;return q||X},B=(X)=>{let Q=E(X),J=Q.attributeName();if(this.getOptionValueSource(J)==="env")return`environment variable '${Q.envVar}'`;return`option '${Q.flags}'`},$=`error: ${B(D)} cannot be used with ${B(F)}`;this.error($,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let F="";if(D.startsWith("--")&&this._showSuggestionAfterError){let B=[],$=this;do{let X=$.createHelp().visibleOptions($).filter((Q)=>Q.long).map((Q)=>Q.long);B=B.concat(X),$=$.parent}while($&&!$._enablePositionalOptions);F=v8(D,B)}let E=`error: unknown option '${D}'${F}`;this.error(E,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let F=this.registeredArguments.length,E=F===1?"":"s",$=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${F} argument${E} but got ${D.length}.`;this.error($,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],F="";if(this._showSuggestionAfterError){let B=[];this.createHelp().visibleCommands(this).forEach(($)=>{if(B.push($.name()),$.alias())B.push($.alias())}),F=v8(D,B)}let E=`error: unknown command '${D}'${F}`;this.error(E,{code:"commander.unknownCommand"})}version(D,F,E){if(D===void 0)return this._version;this._version=D,F=F||"-V, --version",E=E||"output the version number";let B=this.createOption(F,E);return this._versionOptionName=B.attributeName(),this._registerOption(B),this.on("option:"+B.name(),()=>{this._outputConfiguration.writeOut(`${D}
|
|
22
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 E=this.parent?._findCommand(D);if(E){let B=[E.name()].concat(E.aliases()).join("|");throw Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${B}'`)}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((E)=>{return U5(E)});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=OD.basename(D,OD.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},E;if(F.error)E=(B)=>this._outputConfiguration.writeErr(B);else E=(B)=>this._outputConfiguration.writeOut(B);return F.write=D.write||E,F.command=this,F}outputHelp(D){let F;if(typeof D==="function")F=D,D=void 0;let E=this._getHelpContext(D);this._getCommandAndAncestors().reverse().forEach(($)=>$.emit("beforeAllHelp",E)),this.emit("beforeHelp",E);let B=this.helpInformation(E);if(F){if(B=F(B),typeof B!=="string"&&!Buffer.isBuffer(B))throw Error("outputHelp callback must return a string or a Buffer")}if(E.write(B),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",E),this._getCommandAndAncestors().forEach(($)=>$.emit("afterAllHelp",E))}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=l.exitCode||0;if(F===0&&D&&typeof D!=="function"&&D.error)F=1;this._exit(F,"commander.help","(outputHelp)")}addHelpText(D,F){let E=["beforeAll","before","after","afterAll"];if(!E.includes(D))throw Error(`Unexpected value for position to addHelpText.
|
|
23
23
|
Expecting one of '${E.join("', '")}'`);let B=`${D}Help`;return this.on(B,($)=>{let X;if(typeof F==="function")X=F({error:$.error,command:$.command});else X=F;if(X)$.write(`${X}
|
|
24
|
-
`)}),this}_outputHelpIfRequested(D){let F=this._getHelpOption();if(F&&D.find((B)=>F.is(B)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function v8(D){return D.map((F)=>{if(!F.startsWith("--inspect"))return F;let E,B="127.0.0.1",$="9229",X;if((X=F.match(/^(--inspect(-brk)?)$/))!==null)E=X[1];else if((X=F.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(E=X[1],/^\d+$/.test(X[3]))$=X[3];else B=X[3];else if((X=F.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)E=X[1],B=X[3],$=X[4];if(E&&$!=="0")return`${E}=${B}:${parseInt($)+1}`;return F})}z5.Command=J3});var h8=c((L5)=>{var{Argument:x8}=z0(),{Command:Y3}=u8(),{CommanderError:K5,InvalidArgumentError:k8}=i2(),{Help:R5}=E3(),{Option:y8}=B3();L5.program=new Y3;L5.createCommand=(D)=>new Y3(D);L5.createOption=(D,F)=>new y8(D,F);L5.createArgument=(D,F)=>new x8(D,F);L5.Command=Y3;L5.Option=y8;L5.Argument=x8;L5.Help=R5;L5.CommanderError=K5;L5.InvalidArgumentError=k8;L5.InvalidOptionArgumentError=k8});var lD={};N8(lD,{updateState:()=>PD,update:()=>w3,unregister:()=>B2,register:()=>$0,list:()=>RD,hasWorkerForTask:()=>H4,getRegistryPath:()=>U4,getElapsedTime:()=>G4,getConfigDir:()=>W4,getByState:()=>_4,get:()=>I3,findByWish:()=>Y4,findByTask:()=>LD,findBySessionId:()=>q4,findByPane:()=>v3});import{mkdir as B4,readFile as $4,writeFile as X4}from"fs/promises";import{join as _1}from"path";import{homedir as Q4}from"os";async function J4(){await B4(f3,{recursive:!0})}async function k2(){try{let D=await $4(Z3,"utf-8");return JSON.parse(D)}catch{return{workers:{},lastUpdated:new Date().toISOString()}}}async function x0(D){await J4(),D.lastUpdated=new Date().toISOString(),await X4(Z3,JSON.stringify(D,null,2))}async function $0(D){let F=await k2();F.workers[D.id]=D,await x0(F)}async function B2(D){let F=await k2();delete F.workers[D],await x0(F)}async function I3(D){return(await k2()).workers[D]||null}async function RD(){let D=await k2();return Object.values(D.workers)}async function PD(D,F){let E=await k2(),B=E.workers[D];if(B)B.state=F,B.lastStateChange=new Date().toISOString(),await x0(E)}async function w3(D,F){let E=await k2(),B=E.workers[D];if(B){if(Object.assign(B,F),F.state)B.lastStateChange=new Date().toISOString();await x0(E)}}async function v3(D){let F=await RD(),E=D.startsWith("%")?D:`%${D}`;return F.find((B)=>B.paneId===E)||null}async function LD(D){return(await RD()).find((E)=>E.taskId===D)||null}async function Y4(D){return(await RD()).filter((E)=>E.wishSlug===D)}async function q4(D){return(await RD()).find((E)=>E.claudeSessionId===D)||null}async function H4(D){return await LD(D)!==null}async function _4(D){return(await RD()).filter((E)=>E.state===D)}function G4(D){let F=new Date(D.startedAt).getTime(),E=Date.now()-F,B=Math.floor(E/60000),$=Math.floor(B/60),X;if($>0)X=`${$}h ${B%60}m`;else if(B>0)X=`${B}m`;else X="<1m";return{ms:E,formatted:X}}function W4(){return f3}function U4(){return Z3}var f3,Z3;var mD=pF(()=>{f3=_1(Q4(),".config","term"),Z3=_1(f3,"workers.json")});var c0=c((rX,N1)=>{var u4=FD("tty"),x4=u4?.WriteStream?.prototype?.hasColors?.()??!1,P=(D,F)=>{if(!x4)return($)=>$;let E=`\x1B[${D}m`,B=`\x1B[${F}m`;return($)=>{let X=$+"",Q=X.indexOf(B);if(Q===-1)return E+X+B;let J=E,Y=0,H=(F===22?B:"")+E;while(Q!==-1)J+=X.slice(Y,Q)+H,Y=Q+B.length,Q=X.indexOf(B,Y);return J+=X.slice(Y)+B,J}},b={};b.reset=P(0,0);b.bold=P(1,22);b.dim=P(2,22);b.italic=P(3,23);b.underline=P(4,24);b.overline=P(53,55);b.inverse=P(7,27);b.hidden=P(8,28);b.strikethrough=P(9,29);b.black=P(30,39);b.red=P(31,39);b.green=P(32,39);b.yellow=P(33,39);b.blue=P(34,39);b.magenta=P(35,39);b.cyan=P(36,39);b.white=P(37,39);b.gray=P(90,39);b.bgBlack=P(40,49);b.bgRed=P(41,49);b.bgGreen=P(42,49);b.bgYellow=P(43,49);b.bgBlue=P(44,49);b.bgMagenta=P(45,49);b.bgCyan=P(46,49);b.bgWhite=P(47,49);b.bgGray=P(100,49);b.redBright=P(91,39);b.greenBright=P(92,39);b.yellowBright=P(93,39);b.blueBright=P(94,39);b.magentaBright=P(95,39);b.cyanBright=P(96,39);b.whiteBright=P(97,39);b.bgRedBright=P(101,49);b.bgGreenBright=P(102,49);b.bgYellowBright=P(103,49);b.bgBlueBright=P(104,49);b.bgMagentaBright=P(105,49);b.bgCyanBright=P(106,49);b.bgWhiteBright=P(107,49);N1.exports=b});var I1=c((UQ,Z1)=>{Z1.exports=p4;function c4(D){let F={defaultWidth:0,output:process.stdout,tty:FD("tty")};if(!D)return F;return Object.keys(F).forEach(function(E){if(!D[E])D[E]=F[E]}),D}function p4(D){let F=c4(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 E=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(E)&&E!==0)return E}return F.defaultWidth}});var v1=c((AQ,w1)=>{w1.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 s3=c((CQ,u1)=>{var d4=v1();u1.exports=(D)=>typeof D==="string"?D.replace(d4(),""):D});var k1=c((zQ,t3)=>{var x1=(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};t3.exports=x1;t3.exports.default=x1});var h1=c((VQ,y1)=>{y1.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 l1=c((KQ,e3)=>{var i4=s3(),n4=k1(),r4=h1(),g1=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=i4(D),D.length===0)return 0;D=D.replace(r4()," ");let F=0;for(let E=0;E<D.length;E++){let B=D.codePointAt(E);if(B<=31||B>=127&&B<=159)continue;if(B>=768&&B<=879)continue;if(B>65535)E++;F+=n4(B)?2:1}return F};e3.exports=g1;e3.exports.default=g1});var c1=c((RQ,m1)=>{m1.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 D8=c((LQ,d1)=>{var H0=c1(),p1={};for(let D of Object.keys(H0))p1[H0[D]]=D;var K={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"]}};d1.exports=K;for(let D of Object.keys(K)){if(!("channels"in K[D]))throw Error("missing channels property: "+D);if(!("labels"in K[D]))throw Error("missing channel labels property: "+D);if(K[D].labels.length!==K[D].channels)throw Error("channel and label counts mismatch: "+D);let{channels:F,labels:E}=K[D];delete K[D].channels,delete K[D].labels,Object.defineProperty(K[D],"channels",{value:F}),Object.defineProperty(K[D],"labels",{value:E})}K.rgb.hsl=function(D){let F=D[0]/255,E=D[1]/255,B=D[2]/255,$=Math.min(F,E,B),X=Math.max(F,E,B),Q=X-$,J,Y;if(X===$)J=0;else if(F===X)J=(E-B)/Q;else if(E===X)J=2+(B-F)/Q;else if(B===X)J=4+(F-E)/Q;if(J=Math.min(J*60,360),J<0)J+=360;let q=($+X)/2;if(X===$)Y=0;else if(q<=0.5)Y=Q/(X+$);else Y=Q/(2-X-$);return[J,Y*100,q*100]};K.rgb.hsv=function(D){let F,E,B,$,X,Q=D[0]/255,J=D[1]/255,Y=D[2]/255,q=Math.max(Q,J,Y),H=q-Math.min(Q,J,Y),_=function(G){return(q-G)/6/H+0.5};if(H===0)$=0,X=0;else{if(X=H/q,F=_(Q),E=_(J),B=_(Y),Q===q)$=B-E;else if(J===q)$=0.3333333333333333+F-B;else if(Y===q)$=0.6666666666666666+E-F;if($<0)$+=1;else if($>1)$-=1}return[$*360,X*100,q*100]};K.rgb.hwb=function(D){let F=D[0],E=D[1],B=D[2],$=K.rgb.hsl(D)[0],X=0.00392156862745098*Math.min(F,Math.min(E,B));return B=1-0.00392156862745098*Math.max(F,Math.max(E,B)),[$,X*100,B*100]};K.rgb.cmyk=function(D){let F=D[0]/255,E=D[1]/255,B=D[2]/255,$=Math.min(1-F,1-E,1-B),X=(1-F-$)/(1-$)||0,Q=(1-E-$)/(1-$)||0,J=(1-B-$)/(1-$)||0;return[X*100,Q*100,J*100,$*100]};function a4(D,F){return(D[0]-F[0])**2+(D[1]-F[1])**2+(D[2]-F[2])**2}K.rgb.keyword=function(D){let F=p1[D];if(F)return F;let E=1/0,B;for(let $ of Object.keys(H0)){let X=H0[$],Q=a4(D,X);if(Q<E)E=Q,B=$}return B};K.keyword.rgb=function(D){return H0[D]};K.rgb.xyz=function(D){let F=D[0]/255,E=D[1]/255,B=D[2]/255;F=F>0.04045?((F+0.055)/1.055)**2.4:F/12.92,E=E>0.04045?((E+0.055)/1.055)**2.4:E/12.92,B=B>0.04045?((B+0.055)/1.055)**2.4:B/12.92;let $=F*0.4124+E*0.3576+B*0.1805,X=F*0.2126+E*0.7152+B*0.0722,Q=F*0.0193+E*0.1192+B*0.9505;return[$*100,X*100,Q*100]};K.rgb.lab=function(D){let F=K.rgb.xyz(D),E=F[0],B=F[1],$=F[2];E/=95.047,B/=100,$/=108.883,E=E>0.008856?E**0.3333333333333333:7.787*E+0.13793103448275862,B=B>0.008856?B**0.3333333333333333:7.787*B+0.13793103448275862,$=$>0.008856?$**0.3333333333333333:7.787*$+0.13793103448275862;let X=116*B-16,Q=500*(E-B),J=200*(B-$);return[X,Q,J]};K.hsl.rgb=function(D){let F=D[0]/360,E=D[1]/100,B=D[2]/100,$,X,Q;if(E===0)return Q=B*255,[Q,Q,Q];if(B<0.5)$=B*(1+E);else $=B+E-B*E;let J=2*B-$,Y=[0,0,0];for(let q=0;q<3;q++){if(X=F+0.3333333333333333*-(q-1),X<0)X++;if(X>1)X--;if(6*X<1)Q=J+($-J)*6*X;else if(2*X<1)Q=$;else if(3*X<2)Q=J+($-J)*(0.6666666666666666-X)*6;else Q=J;Y[q]=Q*255}return Y};K.hsl.hsv=function(D){let F=D[0],E=D[1]/100,B=D[2]/100,$=E,X=Math.max(B,0.01);B*=2,E*=B<=1?B:2-B,$*=X<=1?X:2-X;let Q=(B+E)/2,J=B===0?2*$/(X+$):2*E/(B+E);return[F,J*100,Q*100]};K.hsv.rgb=function(D){let F=D[0]/60,E=D[1]/100,B=D[2]/100,$=Math.floor(F)%6,X=F-Math.floor(F),Q=255*B*(1-E),J=255*B*(1-E*X),Y=255*B*(1-E*(1-X));switch(B*=255,$){case 0:return[B,Y,Q];case 1:return[J,B,Q];case 2:return[Q,B,Y];case 3:return[Q,J,B];case 4:return[Y,Q,B];case 5:return[B,Q,J]}};K.hsv.hsl=function(D){let F=D[0],E=D[1]/100,B=D[2]/100,$=Math.max(B,0.01),X,Q;Q=(2-E)*B;let J=(2-E)*$;return X=E*$,X/=J<=1?J:2-J,X=X||0,Q/=2,[F,X*100,Q*100]};K.hwb.rgb=function(D){let F=D[0]/360,E=D[1]/100,B=D[2]/100,$=E+B,X;if($>1)E/=$,B/=$;let Q=Math.floor(6*F),J=1-B;if(X=6*F-Q,(Q&1)!==0)X=1-X;let Y=E+X*(J-E),q,H,_;switch(Q){default:case 6:case 0:q=J,H=Y,_=E;break;case 1:q=Y,H=J,_=E;break;case 2:q=E,H=J,_=Y;break;case 3:q=E,H=Y,_=J;break;case 4:q=Y,H=E,_=J;break;case 5:q=J,H=E,_=Y;break}return[q*255,H*255,_*255]};K.cmyk.rgb=function(D){let F=D[0]/100,E=D[1]/100,B=D[2]/100,$=D[3]/100,X=1-Math.min(1,F*(1-$)+$),Q=1-Math.min(1,E*(1-$)+$),J=1-Math.min(1,B*(1-$)+$);return[X*255,Q*255,J*255]};K.xyz.rgb=function(D){let F=D[0]/100,E=D[1]/100,B=D[2]/100,$,X,Q;return $=F*3.2406+E*-1.5372+B*-0.4986,X=F*-0.9689+E*1.8758+B*0.0415,Q=F*0.0557+E*-0.204+B*1.057,$=$>0.0031308?1.055*$**0.4166666666666667-0.055:$*12.92,X=X>0.0031308?1.055*X**0.4166666666666667-0.055:X*12.92,Q=Q>0.0031308?1.055*Q**0.4166666666666667-0.055:Q*12.92,$=Math.min(Math.max(0,$),1),X=Math.min(Math.max(0,X),1),Q=Math.min(Math.max(0,Q),1),[$*255,X*255,Q*255]};K.xyz.lab=function(D){let F=D[0],E=D[1],B=D[2];F/=95.047,E/=100,B/=108.883,F=F>0.008856?F**0.3333333333333333:7.787*F+0.13793103448275862,E=E>0.008856?E**0.3333333333333333:7.787*E+0.13793103448275862,B=B>0.008856?B**0.3333333333333333:7.787*B+0.13793103448275862;let $=116*E-16,X=500*(F-E),Q=200*(E-B);return[$,X,Q]};K.lab.xyz=function(D){let F=D[0],E=D[1],B=D[2],$,X,Q;X=(F+16)/116,$=E/500+X,Q=X-B/200;let J=X**3,Y=$**3,q=Q**3;return X=J>0.008856?J:(X-0.13793103448275862)/7.787,$=Y>0.008856?Y:($-0.13793103448275862)/7.787,Q=q>0.008856?q:(Q-0.13793103448275862)/7.787,$*=95.047,X*=100,Q*=108.883,[$,X,Q]};K.lab.lch=function(D){let F=D[0],E=D[1],B=D[2],$;if($=Math.atan2(B,E)*360/2/Math.PI,$<0)$+=360;let Q=Math.sqrt(E*E+B*B);return[F,Q,$]};K.lch.lab=function(D){let F=D[0],E=D[1],$=D[2]/360*2*Math.PI,X=E*Math.cos($),Q=E*Math.sin($);return[F,X,Q]};K.rgb.ansi16=function(D,F=null){let[E,B,$]=D,X=F===null?K.rgb.hsv(D)[2]:F;if(X=Math.round(X/50),X===0)return 30;let Q=30+(Math.round($/255)<<2|Math.round(B/255)<<1|Math.round(E/255));if(X===2)Q+=60;return Q};K.hsv.ansi16=function(D){return K.rgb.ansi16(K.hsv.rgb(D),D[2])};K.rgb.ansi256=function(D){let F=D[0],E=D[1],B=D[2];if(F===E&&E===B){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(E/255*5)+Math.round(B/255*5)};K.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 E=(~~(D>50)+1)*0.5,B=(F&1)*E*255,$=(F>>1&1)*E*255,X=(F>>2&1)*E*255;return[B,$,X]};K.ansi256.rgb=function(D){if(D>=232){let X=(D-232)*10+8;return[X,X,X]}D-=16;let F,E=Math.floor(D/36)/5*255,B=Math.floor((F=D%36)/6)/5*255,$=F%6/5*255;return[E,B,$]};K.rgb.hex=function(D){let E=(((Math.round(D[0])&255)<<16)+((Math.round(D[1])&255)<<8)+(Math.round(D[2])&255)).toString(16).toUpperCase();return"000000".substring(E.length)+E};K.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 E=F[0];if(F[0].length===3)E=E.split("").map((J)=>{return J+J}).join("");let B=parseInt(E,16),$=B>>16&255,X=B>>8&255,Q=B&255;return[$,X,Q]};K.rgb.hcg=function(D){let F=D[0]/255,E=D[1]/255,B=D[2]/255,$=Math.max(Math.max(F,E),B),X=Math.min(Math.min(F,E),B),Q=$-X,J,Y;if(Q<1)J=X/(1-Q);else J=0;if(Q<=0)Y=0;else if($===F)Y=(E-B)/Q%6;else if($===E)Y=2+(B-F)/Q;else Y=4+(F-E)/Q;return Y/=6,Y%=1,[Y*360,Q*100,J*100]};K.hsl.hcg=function(D){let F=D[1]/100,E=D[2]/100,B=E<0.5?2*F*E:2*F*(1-E),$=0;if(B<1)$=(E-0.5*B)/(1-B);return[D[0],B*100,$*100]};K.hsv.hcg=function(D){let F=D[1]/100,E=D[2]/100,B=F*E,$=0;if(B<1)$=(E-B)/(1-B);return[D[0],B*100,$*100]};K.hcg.rgb=function(D){let F=D[0]/360,E=D[1]/100,B=D[2]/100;if(E===0)return[B*255,B*255,B*255];let $=[0,0,0],X=F%1*6,Q=X%1,J=1-Q,Y=0;switch(Math.floor(X)){case 0:$[0]=1,$[1]=Q,$[2]=0;break;case 1:$[0]=J,$[1]=1,$[2]=0;break;case 2:$[0]=0,$[1]=1,$[2]=Q;break;case 3:$[0]=0,$[1]=J,$[2]=1;break;case 4:$[0]=Q,$[1]=0,$[2]=1;break;default:$[0]=1,$[1]=0,$[2]=J}return Y=(1-E)*B,[(E*$[0]+Y)*255,(E*$[1]+Y)*255,(E*$[2]+Y)*255]};K.hcg.hsv=function(D){let F=D[1]/100,E=D[2]/100,B=F+E*(1-F),$=0;if(B>0)$=F/B;return[D[0],$*100,B*100]};K.hcg.hsl=function(D){let F=D[1]/100,B=D[2]/100*(1-F)+0.5*F,$=0;if(B>0&&B<0.5)$=F/(2*B);else if(B>=0.5&&B<1)$=F/(2*(1-B));return[D[0],$*100,B*100]};K.hcg.hwb=function(D){let F=D[1]/100,E=D[2]/100,B=F+E*(1-F);return[D[0],(B-F)*100,(1-B)*100]};K.hwb.hcg=function(D){let F=D[1]/100,B=1-D[2]/100,$=B-F,X=0;if($<1)X=(B-$)/(1-$);return[D[0],$*100,X*100]};K.apple.rgb=function(D){return[D[0]/65535*255,D[1]/65535*255,D[2]/65535*255]};K.rgb.apple=function(D){return[D[0]/255*65535,D[1]/255*65535,D[2]/255*65535]};K.gray.rgb=function(D){return[D[0]/100*255,D[0]/100*255,D[0]/100*255]};K.gray.hsl=function(D){return[0,0,D[0]]};K.gray.hsv=K.gray.hsl;K.gray.hwb=function(D){return[0,100,D[0]]};K.gray.cmyk=function(D){return[0,0,0,D[0]]};K.gray.lab=function(D){return[D[0],0,0]};K.gray.hex=function(D){let F=Math.round(D[0]/100*255)&255,B=((F<<16)+(F<<8)+F).toString(16).toUpperCase();return"000000".substring(B.length)+B};K.rgb.gray=function(D){return[(D[0]+D[1]+D[2])/3/255*100]}});var n1=c((jQ,i1)=>{var d0=D8();function o4(){let D={},F=Object.keys(d0);for(let E=F.length,B=0;B<E;B++)D[F[B]]={distance:-1,parent:null};return D}function s4(D){let F=o4(),E=[D];F[D].distance=0;while(E.length){let B=E.pop(),$=Object.keys(d0[B]);for(let X=$.length,Q=0;Q<X;Q++){let J=$[Q],Y=F[J];if(Y.distance===-1)Y.distance=F[B].distance+1,Y.parent=B,E.unshift(J)}}return F}function t4(D,F){return function(E){return F(D(E))}}function e4(D,F){let E=[F[D].parent,D],B=d0[F[D].parent][D],$=F[D].parent;while(F[$].parent)E.unshift(F[$].parent),B=t4(d0[F[$].parent][$],B),$=F[$].parent;return B.conversion=E,B}i1.exports=function(D){let F=s4(D),E={},B=Object.keys(F);for(let $=B.length,X=0;X<$;X++){let Q=B[X];if(F[Q].parent===null)continue;E[Q]=e4(Q,F)}return E}});var a1=c((MQ,r1)=>{var F8=D8(),DE=n1(),l2={},FE=Object.keys(F8);function EE(D){let F=function(...E){let B=E[0];if(B===void 0||B===null)return B;if(B.length>1)E=B;return D(E)};if("conversion"in D)F.conversion=D.conversion;return F}function BE(D){let F=function(...E){let B=E[0];if(B===void 0||B===null)return B;if(B.length>1)E=B;let $=D(E);if(typeof $==="object")for(let X=$.length,Q=0;Q<X;Q++)$[Q]=Math.round($[Q]);return $};if("conversion"in D)F.conversion=D.conversion;return F}FE.forEach((D)=>{l2[D]={},Object.defineProperty(l2[D],"channels",{value:F8[D].channels}),Object.defineProperty(l2[D],"labels",{value:F8[D].labels});let F=DE(D);Object.keys(F).forEach((B)=>{let $=F[B];l2[D][B]=BE($),l2[D][B].raw=EE($)})});r1.exports=l2});var FF=c((OQ,DF)=>{var o1=(D,F)=>(...E)=>{return`\x1B[${D(...E)+F}m`},s1=(D,F)=>(...E)=>{let B=D(...E);return`\x1B[${38+F};5;${B}m`},t1=(D,F)=>(...E)=>{let B=D(...E);return`\x1B[${38+F};2;${B[0]};${B[1]};${B[2]}m`},i0=(D)=>D,e1=(D,F,E)=>[D,F,E],m2=(D,F,E)=>{Object.defineProperty(D,F,{get:()=>{let B=E();return Object.defineProperty(D,F,{value:B,enumerable:!0,configurable:!0}),B},enumerable:!0,configurable:!0})},E8,c2=(D,F,E,B)=>{if(E8===void 0)E8=a1();let $=B?10:0,X={};for(let[Q,J]of Object.entries(E8)){let Y=Q==="ansi16"?"ansi":Q;if(Q===F)X[Y]=D(E,$);else if(typeof J==="object")X[Y]=D(J[F],$)}return X};function $E(){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[E,B]of Object.entries(F)){for(let[$,X]of Object.entries(B))F[$]={open:`\x1B[${X[0]}m`,close:`\x1B[${X[1]}m`},B[$]=F[$],D.set(X[0],X[1]);Object.defineProperty(F,E,{value:B,enumerable:!1})}return Object.defineProperty(F,"codes",{value:D,enumerable:!1}),F.color.close="\x1B[39m",F.bgColor.close="\x1B[49m",m2(F.color,"ansi",()=>c2(o1,"ansi16",i0,!1)),m2(F.color,"ansi256",()=>c2(s1,"ansi256",i0,!1)),m2(F.color,"ansi16m",()=>c2(t1,"rgb",e1,!1)),m2(F.bgColor,"ansi",()=>c2(o1,"ansi16",i0,!0)),m2(F.bgColor,"ansi256",()=>c2(s1,"ansi256",i0,!0)),m2(F.bgColor,"ansi16m",()=>c2(t1,"rgb",e1,!0)),F}Object.defineProperty(DF,"exports",{enumerable:!0,get:$E})});var $F=c((NQ,BF)=>{var _0=l1(),XE=s3(),QE=FF(),$8=new Set(["\x1B","\x9B"]),EF=(D)=>`${$8.values().next().value}[${D}m`,JE=(D)=>D.split(" ").map((F)=>_0(F)),B8=(D,F,E)=>{let B=[...F],$=!1,X=_0(XE(D[D.length-1]));for(let[Q,J]of B.entries()){let Y=_0(J);if(X+Y<=E)D[D.length-1]+=J;else D.push(J),X=0;if($8.has(J))$=!0;else if($&&J==="m"){$=!1;continue}if($)continue;if(X+=Y,X===E&&Q<B.length-1)D.push(""),X=0}if(!X&&D[D.length-1].length>0&&D.length>1)D[D.length-2]+=D.pop()},YE=(D)=>{let F=D.split(" "),E=F.length;while(E>0){if(_0(F[E-1])>0)break;E--}if(E===F.length)return D;return F.slice(0,E).join(" ")+F.slice(E).join("")},qE=(D,F,E={})=>{if(E.trim!==!1&&D.trim()==="")return"";let B="",$="",X,Q=JE(D),J=[""];for(let[Y,q]of D.split(" ").entries()){if(E.trim!==!1)J[J.length-1]=J[J.length-1].trimLeft();let H=_0(J[J.length-1]);if(Y!==0){if(H>=F&&(E.wordWrap===!1||E.trim===!1))J.push(""),H=0;if(H>0||E.trim===!1)J[J.length-1]+=" ",H++}if(E.hard&&Q[Y]>F){let _=F-H,G=1+Math.floor((Q[Y]-_-1)/F);if(Math.floor((Q[Y]-1)/F)<G)J.push("");B8(J,q,F);continue}if(H+Q[Y]>F&&H>0&&Q[Y]>0){if(E.wordWrap===!1&&H<F){B8(J,q,F);continue}J.push("")}if(H+Q[Y]>F&&E.wordWrap===!1){B8(J,q,F);continue}J[J.length-1]+=q}if(E.trim!==!1)J=J.map(YE);B=J.join(`
|
|
24
|
+
`)}),this}_outputHelpIfRequested(D){let F=this._getHelpOption();if(F&&D.find((B)=>F.is(B)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function w8(D){return D.map((F)=>{if(!F.startsWith("--inspect"))return F;let E,B="127.0.0.1",$="9229",X;if((X=F.match(/^(--inspect(-brk)?)$/))!==null)E=X[1];else if((X=F.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(E=X[1],/^\d+$/.test(X[3]))$=X[3];else B=X[3];else if((X=F.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)E=X[1],B=X[3],$=X[4];if(E&&$!=="0")return`${E}=${B}:${parseInt($)+1}`;return F})}z5.Command=J3});var h8=c((L5)=>{var{Argument:x8}=z0(),{Command:Y3}=u8(),{CommanderError:K5,InvalidArgumentError:k8}=i2(),{Help:R5}=E3(),{Option:y8}=B3();L5.program=new Y3;L5.createCommand=(D)=>new Y3(D);L5.createOption=(D,F)=>new y8(D,F);L5.createArgument=(D,F)=>new x8(D,F);L5.Command=Y3;L5.Option=y8;L5.Argument=x8;L5.Help=R5;L5.CommanderError=K5;L5.InvalidArgumentError=k8;L5.InvalidOptionArgumentError=k8});var lD={};N8(lD,{updateState:()=>PD,update:()=>v3,unregister:()=>B2,register:()=>$0,list:()=>RD,hasWorkerForTask:()=>H4,getRegistryPath:()=>U4,getElapsedTime:()=>G4,getConfigDir:()=>W4,getByState:()=>_4,get:()=>I3,findByWish:()=>Y4,findByTask:()=>LD,findBySessionId:()=>q4,findByPane:()=>w3});import{mkdir as B4,readFile as $4,writeFile as X4}from"fs/promises";import{join as _1}from"path";import{homedir as Q4}from"os";async function J4(){await B4(f3,{recursive:!0})}async function k2(){try{let D=await $4(Z3,"utf-8");return JSON.parse(D)}catch{return{workers:{},lastUpdated:new Date().toISOString()}}}async function x0(D){await J4(),D.lastUpdated=new Date().toISOString(),await X4(Z3,JSON.stringify(D,null,2))}async function $0(D){let F=await k2();F.workers[D.id]=D,await x0(F)}async function B2(D){let F=await k2();delete F.workers[D],await x0(F)}async function I3(D){return(await k2()).workers[D]||null}async function RD(){let D=await k2();return Object.values(D.workers)}async function PD(D,F){let E=await k2(),B=E.workers[D];if(B)B.state=F,B.lastStateChange=new Date().toISOString(),await x0(E)}async function v3(D,F){let E=await k2(),B=E.workers[D];if(B){if(Object.assign(B,F),F.state)B.lastStateChange=new Date().toISOString();await x0(E)}}async function w3(D){let F=await RD(),E=D.startsWith("%")?D:`%${D}`;return F.find((B)=>B.paneId===E)||null}async function LD(D){return(await RD()).find((E)=>E.taskId===D)||null}async function Y4(D){return(await RD()).filter((E)=>E.wishSlug===D)}async function q4(D){return(await RD()).find((E)=>E.claudeSessionId===D)||null}async function H4(D){return await LD(D)!==null}async function _4(D){return(await RD()).filter((E)=>E.state===D)}function G4(D){let F=new Date(D.startedAt).getTime(),E=Date.now()-F,B=Math.floor(E/60000),$=Math.floor(B/60),X;if($>0)X=`${$}h ${B%60}m`;else if(B>0)X=`${B}m`;else X="<1m";return{ms:E,formatted:X}}function W4(){return f3}function U4(){return Z3}var f3,Z3;var mD=pF(()=>{f3=_1(Q4(),".config","term"),Z3=_1(f3,"workers.json")});var c0=c((rX,N1)=>{var u4=FD("tty"),x4=u4?.WriteStream?.prototype?.hasColors?.()??!1,P=(D,F)=>{if(!x4)return($)=>$;let E=`\x1B[${D}m`,B=`\x1B[${F}m`;return($)=>{let X=$+"",Q=X.indexOf(B);if(Q===-1)return E+X+B;let J=E,Y=0,H=(F===22?B:"")+E;while(Q!==-1)J+=X.slice(Y,Q)+H,Y=Q+B.length,Q=X.indexOf(B,Y);return J+=X.slice(Y)+B,J}},b={};b.reset=P(0,0);b.bold=P(1,22);b.dim=P(2,22);b.italic=P(3,23);b.underline=P(4,24);b.overline=P(53,55);b.inverse=P(7,27);b.hidden=P(8,28);b.strikethrough=P(9,29);b.black=P(30,39);b.red=P(31,39);b.green=P(32,39);b.yellow=P(33,39);b.blue=P(34,39);b.magenta=P(35,39);b.cyan=P(36,39);b.white=P(37,39);b.gray=P(90,39);b.bgBlack=P(40,49);b.bgRed=P(41,49);b.bgGreen=P(42,49);b.bgYellow=P(43,49);b.bgBlue=P(44,49);b.bgMagenta=P(45,49);b.bgCyan=P(46,49);b.bgWhite=P(47,49);b.bgGray=P(100,49);b.redBright=P(91,39);b.greenBright=P(92,39);b.yellowBright=P(93,39);b.blueBright=P(94,39);b.magentaBright=P(95,39);b.cyanBright=P(96,39);b.whiteBright=P(97,39);b.bgRedBright=P(101,49);b.bgGreenBright=P(102,49);b.bgYellowBright=P(103,49);b.bgBlueBright=P(104,49);b.bgMagentaBright=P(105,49);b.bgCyanBright=P(106,49);b.bgWhiteBright=P(107,49);N1.exports=b});var I1=c((UQ,Z1)=>{Z1.exports=p4;function c4(D){let F={defaultWidth:0,output:process.stdout,tty:FD("tty")};if(!D)return F;return Object.keys(F).forEach(function(E){if(!D[E])D[E]=F[E]}),D}function p4(D){let F=c4(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 E=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(E)&&E!==0)return E}return F.defaultWidth}});var w1=c((AQ,v1)=>{v1.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 s3=c((CQ,u1)=>{var d4=w1();u1.exports=(D)=>typeof D==="string"?D.replace(d4(),""):D});var k1=c((zQ,t3)=>{var x1=(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};t3.exports=x1;t3.exports.default=x1});var h1=c((VQ,y1)=>{y1.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 l1=c((KQ,e3)=>{var i4=s3(),n4=k1(),r4=h1(),g1=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=i4(D),D.length===0)return 0;D=D.replace(r4()," ");let F=0;for(let E=0;E<D.length;E++){let B=D.codePointAt(E);if(B<=31||B>=127&&B<=159)continue;if(B>=768&&B<=879)continue;if(B>65535)E++;F+=n4(B)?2:1}return F};e3.exports=g1;e3.exports.default=g1});var c1=c((RQ,m1)=>{m1.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 D8=c((LQ,d1)=>{var H0=c1(),p1={};for(let D of Object.keys(H0))p1[H0[D]]=D;var R={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"]}};d1.exports=R;for(let D of Object.keys(R)){if(!("channels"in R[D]))throw Error("missing channels property: "+D);if(!("labels"in R[D]))throw Error("missing channel labels property: "+D);if(R[D].labels.length!==R[D].channels)throw Error("channel and label counts mismatch: "+D);let{channels:F,labels:E}=R[D];delete R[D].channels,delete R[D].labels,Object.defineProperty(R[D],"channels",{value:F}),Object.defineProperty(R[D],"labels",{value:E})}R.rgb.hsl=function(D){let F=D[0]/255,E=D[1]/255,B=D[2]/255,$=Math.min(F,E,B),X=Math.max(F,E,B),Q=X-$,J,Y;if(X===$)J=0;else if(F===X)J=(E-B)/Q;else if(E===X)J=2+(B-F)/Q;else if(B===X)J=4+(F-E)/Q;if(J=Math.min(J*60,360),J<0)J+=360;let q=($+X)/2;if(X===$)Y=0;else if(q<=0.5)Y=Q/(X+$);else Y=Q/(2-X-$);return[J,Y*100,q*100]};R.rgb.hsv=function(D){let F,E,B,$,X,Q=D[0]/255,J=D[1]/255,Y=D[2]/255,q=Math.max(Q,J,Y),H=q-Math.min(Q,J,Y),_=function(G){return(q-G)/6/H+0.5};if(H===0)$=0,X=0;else{if(X=H/q,F=_(Q),E=_(J),B=_(Y),Q===q)$=B-E;else if(J===q)$=0.3333333333333333+F-B;else if(Y===q)$=0.6666666666666666+E-F;if($<0)$+=1;else if($>1)$-=1}return[$*360,X*100,q*100]};R.rgb.hwb=function(D){let F=D[0],E=D[1],B=D[2],$=R.rgb.hsl(D)[0],X=0.00392156862745098*Math.min(F,Math.min(E,B));return B=1-0.00392156862745098*Math.max(F,Math.max(E,B)),[$,X*100,B*100]};R.rgb.cmyk=function(D){let F=D[0]/255,E=D[1]/255,B=D[2]/255,$=Math.min(1-F,1-E,1-B),X=(1-F-$)/(1-$)||0,Q=(1-E-$)/(1-$)||0,J=(1-B-$)/(1-$)||0;return[X*100,Q*100,J*100,$*100]};function a4(D,F){return(D[0]-F[0])**2+(D[1]-F[1])**2+(D[2]-F[2])**2}R.rgb.keyword=function(D){let F=p1[D];if(F)return F;let E=1/0,B;for(let $ of Object.keys(H0)){let X=H0[$],Q=a4(D,X);if(Q<E)E=Q,B=$}return B};R.keyword.rgb=function(D){return H0[D]};R.rgb.xyz=function(D){let F=D[0]/255,E=D[1]/255,B=D[2]/255;F=F>0.04045?((F+0.055)/1.055)**2.4:F/12.92,E=E>0.04045?((E+0.055)/1.055)**2.4:E/12.92,B=B>0.04045?((B+0.055)/1.055)**2.4:B/12.92;let $=F*0.4124+E*0.3576+B*0.1805,X=F*0.2126+E*0.7152+B*0.0722,Q=F*0.0193+E*0.1192+B*0.9505;return[$*100,X*100,Q*100]};R.rgb.lab=function(D){let F=R.rgb.xyz(D),E=F[0],B=F[1],$=F[2];E/=95.047,B/=100,$/=108.883,E=E>0.008856?E**0.3333333333333333:7.787*E+0.13793103448275862,B=B>0.008856?B**0.3333333333333333:7.787*B+0.13793103448275862,$=$>0.008856?$**0.3333333333333333:7.787*$+0.13793103448275862;let X=116*B-16,Q=500*(E-B),J=200*(B-$);return[X,Q,J]};R.hsl.rgb=function(D){let F=D[0]/360,E=D[1]/100,B=D[2]/100,$,X,Q;if(E===0)return Q=B*255,[Q,Q,Q];if(B<0.5)$=B*(1+E);else $=B+E-B*E;let J=2*B-$,Y=[0,0,0];for(let q=0;q<3;q++){if(X=F+0.3333333333333333*-(q-1),X<0)X++;if(X>1)X--;if(6*X<1)Q=J+($-J)*6*X;else if(2*X<1)Q=$;else if(3*X<2)Q=J+($-J)*(0.6666666666666666-X)*6;else Q=J;Y[q]=Q*255}return Y};R.hsl.hsv=function(D){let F=D[0],E=D[1]/100,B=D[2]/100,$=E,X=Math.max(B,0.01);B*=2,E*=B<=1?B:2-B,$*=X<=1?X:2-X;let Q=(B+E)/2,J=B===0?2*$/(X+$):2*E/(B+E);return[F,J*100,Q*100]};R.hsv.rgb=function(D){let F=D[0]/60,E=D[1]/100,B=D[2]/100,$=Math.floor(F)%6,X=F-Math.floor(F),Q=255*B*(1-E),J=255*B*(1-E*X),Y=255*B*(1-E*(1-X));switch(B*=255,$){case 0:return[B,Y,Q];case 1:return[J,B,Q];case 2:return[Q,B,Y];case 3:return[Q,J,B];case 4:return[Y,Q,B];case 5:return[B,Q,J]}};R.hsv.hsl=function(D){let F=D[0],E=D[1]/100,B=D[2]/100,$=Math.max(B,0.01),X,Q;Q=(2-E)*B;let J=(2-E)*$;return X=E*$,X/=J<=1?J:2-J,X=X||0,Q/=2,[F,X*100,Q*100]};R.hwb.rgb=function(D){let F=D[0]/360,E=D[1]/100,B=D[2]/100,$=E+B,X;if($>1)E/=$,B/=$;let Q=Math.floor(6*F),J=1-B;if(X=6*F-Q,(Q&1)!==0)X=1-X;let Y=E+X*(J-E),q,H,_;switch(Q){default:case 6:case 0:q=J,H=Y,_=E;break;case 1:q=Y,H=J,_=E;break;case 2:q=E,H=J,_=Y;break;case 3:q=E,H=Y,_=J;break;case 4:q=Y,H=E,_=J;break;case 5:q=J,H=E,_=Y;break}return[q*255,H*255,_*255]};R.cmyk.rgb=function(D){let F=D[0]/100,E=D[1]/100,B=D[2]/100,$=D[3]/100,X=1-Math.min(1,F*(1-$)+$),Q=1-Math.min(1,E*(1-$)+$),J=1-Math.min(1,B*(1-$)+$);return[X*255,Q*255,J*255]};R.xyz.rgb=function(D){let F=D[0]/100,E=D[1]/100,B=D[2]/100,$,X,Q;return $=F*3.2406+E*-1.5372+B*-0.4986,X=F*-0.9689+E*1.8758+B*0.0415,Q=F*0.0557+E*-0.204+B*1.057,$=$>0.0031308?1.055*$**0.4166666666666667-0.055:$*12.92,X=X>0.0031308?1.055*X**0.4166666666666667-0.055:X*12.92,Q=Q>0.0031308?1.055*Q**0.4166666666666667-0.055:Q*12.92,$=Math.min(Math.max(0,$),1),X=Math.min(Math.max(0,X),1),Q=Math.min(Math.max(0,Q),1),[$*255,X*255,Q*255]};R.xyz.lab=function(D){let F=D[0],E=D[1],B=D[2];F/=95.047,E/=100,B/=108.883,F=F>0.008856?F**0.3333333333333333:7.787*F+0.13793103448275862,E=E>0.008856?E**0.3333333333333333:7.787*E+0.13793103448275862,B=B>0.008856?B**0.3333333333333333:7.787*B+0.13793103448275862;let $=116*E-16,X=500*(F-E),Q=200*(E-B);return[$,X,Q]};R.lab.xyz=function(D){let F=D[0],E=D[1],B=D[2],$,X,Q;X=(F+16)/116,$=E/500+X,Q=X-B/200;let J=X**3,Y=$**3,q=Q**3;return X=J>0.008856?J:(X-0.13793103448275862)/7.787,$=Y>0.008856?Y:($-0.13793103448275862)/7.787,Q=q>0.008856?q:(Q-0.13793103448275862)/7.787,$*=95.047,X*=100,Q*=108.883,[$,X,Q]};R.lab.lch=function(D){let F=D[0],E=D[1],B=D[2],$;if($=Math.atan2(B,E)*360/2/Math.PI,$<0)$+=360;let Q=Math.sqrt(E*E+B*B);return[F,Q,$]};R.lch.lab=function(D){let F=D[0],E=D[1],$=D[2]/360*2*Math.PI,X=E*Math.cos($),Q=E*Math.sin($);return[F,X,Q]};R.rgb.ansi16=function(D,F=null){let[E,B,$]=D,X=F===null?R.rgb.hsv(D)[2]:F;if(X=Math.round(X/50),X===0)return 30;let Q=30+(Math.round($/255)<<2|Math.round(B/255)<<1|Math.round(E/255));if(X===2)Q+=60;return Q};R.hsv.ansi16=function(D){return R.rgb.ansi16(R.hsv.rgb(D),D[2])};R.rgb.ansi256=function(D){let F=D[0],E=D[1],B=D[2];if(F===E&&E===B){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(E/255*5)+Math.round(B/255*5)};R.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 E=(~~(D>50)+1)*0.5,B=(F&1)*E*255,$=(F>>1&1)*E*255,X=(F>>2&1)*E*255;return[B,$,X]};R.ansi256.rgb=function(D){if(D>=232){let X=(D-232)*10+8;return[X,X,X]}D-=16;let F,E=Math.floor(D/36)/5*255,B=Math.floor((F=D%36)/6)/5*255,$=F%6/5*255;return[E,B,$]};R.rgb.hex=function(D){let E=(((Math.round(D[0])&255)<<16)+((Math.round(D[1])&255)<<8)+(Math.round(D[2])&255)).toString(16).toUpperCase();return"000000".substring(E.length)+E};R.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 E=F[0];if(F[0].length===3)E=E.split("").map((J)=>{return J+J}).join("");let B=parseInt(E,16),$=B>>16&255,X=B>>8&255,Q=B&255;return[$,X,Q]};R.rgb.hcg=function(D){let F=D[0]/255,E=D[1]/255,B=D[2]/255,$=Math.max(Math.max(F,E),B),X=Math.min(Math.min(F,E),B),Q=$-X,J,Y;if(Q<1)J=X/(1-Q);else J=0;if(Q<=0)Y=0;else if($===F)Y=(E-B)/Q%6;else if($===E)Y=2+(B-F)/Q;else Y=4+(F-E)/Q;return Y/=6,Y%=1,[Y*360,Q*100,J*100]};R.hsl.hcg=function(D){let F=D[1]/100,E=D[2]/100,B=E<0.5?2*F*E:2*F*(1-E),$=0;if(B<1)$=(E-0.5*B)/(1-B);return[D[0],B*100,$*100]};R.hsv.hcg=function(D){let F=D[1]/100,E=D[2]/100,B=F*E,$=0;if(B<1)$=(E-B)/(1-B);return[D[0],B*100,$*100]};R.hcg.rgb=function(D){let F=D[0]/360,E=D[1]/100,B=D[2]/100;if(E===0)return[B*255,B*255,B*255];let $=[0,0,0],X=F%1*6,Q=X%1,J=1-Q,Y=0;switch(Math.floor(X)){case 0:$[0]=1,$[1]=Q,$[2]=0;break;case 1:$[0]=J,$[1]=1,$[2]=0;break;case 2:$[0]=0,$[1]=1,$[2]=Q;break;case 3:$[0]=0,$[1]=J,$[2]=1;break;case 4:$[0]=Q,$[1]=0,$[2]=1;break;default:$[0]=1,$[1]=0,$[2]=J}return Y=(1-E)*B,[(E*$[0]+Y)*255,(E*$[1]+Y)*255,(E*$[2]+Y)*255]};R.hcg.hsv=function(D){let F=D[1]/100,E=D[2]/100,B=F+E*(1-F),$=0;if(B>0)$=F/B;return[D[0],$*100,B*100]};R.hcg.hsl=function(D){let F=D[1]/100,B=D[2]/100*(1-F)+0.5*F,$=0;if(B>0&&B<0.5)$=F/(2*B);else if(B>=0.5&&B<1)$=F/(2*(1-B));return[D[0],$*100,B*100]};R.hcg.hwb=function(D){let F=D[1]/100,E=D[2]/100,B=F+E*(1-F);return[D[0],(B-F)*100,(1-B)*100]};R.hwb.hcg=function(D){let F=D[1]/100,B=1-D[2]/100,$=B-F,X=0;if($<1)X=(B-$)/(1-$);return[D[0],$*100,X*100]};R.apple.rgb=function(D){return[D[0]/65535*255,D[1]/65535*255,D[2]/65535*255]};R.rgb.apple=function(D){return[D[0]/255*65535,D[1]/255*65535,D[2]/255*65535]};R.gray.rgb=function(D){return[D[0]/100*255,D[0]/100*255,D[0]/100*255]};R.gray.hsl=function(D){return[0,0,D[0]]};R.gray.hsv=R.gray.hsl;R.gray.hwb=function(D){return[0,100,D[0]]};R.gray.cmyk=function(D){return[0,0,0,D[0]]};R.gray.lab=function(D){return[D[0],0,0]};R.gray.hex=function(D){let F=Math.round(D[0]/100*255)&255,B=((F<<16)+(F<<8)+F).toString(16).toUpperCase();return"000000".substring(B.length)+B};R.rgb.gray=function(D){return[(D[0]+D[1]+D[2])/3/255*100]}});var n1=c((jQ,i1)=>{var d0=D8();function o4(){let D={},F=Object.keys(d0);for(let E=F.length,B=0;B<E;B++)D[F[B]]={distance:-1,parent:null};return D}function s4(D){let F=o4(),E=[D];F[D].distance=0;while(E.length){let B=E.pop(),$=Object.keys(d0[B]);for(let X=$.length,Q=0;Q<X;Q++){let J=$[Q],Y=F[J];if(Y.distance===-1)Y.distance=F[B].distance+1,Y.parent=B,E.unshift(J)}}return F}function t4(D,F){return function(E){return F(D(E))}}function e4(D,F){let E=[F[D].parent,D],B=d0[F[D].parent][D],$=F[D].parent;while(F[$].parent)E.unshift(F[$].parent),B=t4(d0[F[$].parent][$],B),$=F[$].parent;return B.conversion=E,B}i1.exports=function(D){let F=s4(D),E={},B=Object.keys(F);for(let $=B.length,X=0;X<$;X++){let Q=B[X];if(F[Q].parent===null)continue;E[Q]=e4(Q,F)}return E}});var a1=c((MQ,r1)=>{var F8=D8(),DE=n1(),l2={},FE=Object.keys(F8);function EE(D){let F=function(...E){let B=E[0];if(B===void 0||B===null)return B;if(B.length>1)E=B;return D(E)};if("conversion"in D)F.conversion=D.conversion;return F}function BE(D){let F=function(...E){let B=E[0];if(B===void 0||B===null)return B;if(B.length>1)E=B;let $=D(E);if(typeof $==="object")for(let X=$.length,Q=0;Q<X;Q++)$[Q]=Math.round($[Q]);return $};if("conversion"in D)F.conversion=D.conversion;return F}FE.forEach((D)=>{l2[D]={},Object.defineProperty(l2[D],"channels",{value:F8[D].channels}),Object.defineProperty(l2[D],"labels",{value:F8[D].labels});let F=DE(D);Object.keys(F).forEach((B)=>{let $=F[B];l2[D][B]=BE($),l2[D][B].raw=EE($)})});r1.exports=l2});var FF=c((OQ,DF)=>{var o1=(D,F)=>(...E)=>{return`\x1B[${D(...E)+F}m`},s1=(D,F)=>(...E)=>{let B=D(...E);return`\x1B[${38+F};5;${B}m`},t1=(D,F)=>(...E)=>{let B=D(...E);return`\x1B[${38+F};2;${B[0]};${B[1]};${B[2]}m`},i0=(D)=>D,e1=(D,F,E)=>[D,F,E],m2=(D,F,E)=>{Object.defineProperty(D,F,{get:()=>{let B=E();return Object.defineProperty(D,F,{value:B,enumerable:!0,configurable:!0}),B},enumerable:!0,configurable:!0})},E8,c2=(D,F,E,B)=>{if(E8===void 0)E8=a1();let $=B?10:0,X={};for(let[Q,J]of Object.entries(E8)){let Y=Q==="ansi16"?"ansi":Q;if(Q===F)X[Y]=D(E,$);else if(typeof J==="object")X[Y]=D(J[F],$)}return X};function $E(){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[E,B]of Object.entries(F)){for(let[$,X]of Object.entries(B))F[$]={open:`\x1B[${X[0]}m`,close:`\x1B[${X[1]}m`},B[$]=F[$],D.set(X[0],X[1]);Object.defineProperty(F,E,{value:B,enumerable:!1})}return Object.defineProperty(F,"codes",{value:D,enumerable:!1}),F.color.close="\x1B[39m",F.bgColor.close="\x1B[49m",m2(F.color,"ansi",()=>c2(o1,"ansi16",i0,!1)),m2(F.color,"ansi256",()=>c2(s1,"ansi256",i0,!1)),m2(F.color,"ansi16m",()=>c2(t1,"rgb",e1,!1)),m2(F.bgColor,"ansi",()=>c2(o1,"ansi16",i0,!0)),m2(F.bgColor,"ansi256",()=>c2(s1,"ansi256",i0,!0)),m2(F.bgColor,"ansi16m",()=>c2(t1,"rgb",e1,!0)),F}Object.defineProperty(DF,"exports",{enumerable:!0,get:$E})});var $F=c((NQ,BF)=>{var _0=l1(),XE=s3(),QE=FF(),$8=new Set(["\x1B","\x9B"]),EF=(D)=>`${$8.values().next().value}[${D}m`,JE=(D)=>D.split(" ").map((F)=>_0(F)),B8=(D,F,E)=>{let B=[...F],$=!1,X=_0(XE(D[D.length-1]));for(let[Q,J]of B.entries()){let Y=_0(J);if(X+Y<=E)D[D.length-1]+=J;else D.push(J),X=0;if($8.has(J))$=!0;else if($&&J==="m"){$=!1;continue}if($)continue;if(X+=Y,X===E&&Q<B.length-1)D.push(""),X=0}if(!X&&D[D.length-1].length>0&&D.length>1)D[D.length-2]+=D.pop()},YE=(D)=>{let F=D.split(" "),E=F.length;while(E>0){if(_0(F[E-1])>0)break;E--}if(E===F.length)return D;return F.slice(0,E).join(" ")+F.slice(E).join("")},qE=(D,F,E={})=>{if(E.trim!==!1&&D.trim()==="")return"";let B="",$="",X,Q=JE(D),J=[""];for(let[Y,q]of D.split(" ").entries()){if(E.trim!==!1)J[J.length-1]=J[J.length-1].trimLeft();let H=_0(J[J.length-1]);if(Y!==0){if(H>=F&&(E.wordWrap===!1||E.trim===!1))J.push(""),H=0;if(H>0||E.trim===!1)J[J.length-1]+=" ",H++}if(E.hard&&Q[Y]>F){let _=F-H,G=1+Math.floor((Q[Y]-_-1)/F);if(Math.floor((Q[Y]-1)/F)<G)J.push("");B8(J,q,F);continue}if(H+Q[Y]>F&&H>0&&Q[Y]>0){if(E.wordWrap===!1&&H<F){B8(J,q,F);continue}J.push("")}if(H+Q[Y]>F&&E.wordWrap===!1){B8(J,q,F);continue}J[J.length-1]+=q}if(E.trim!==!1)J=J.map(YE);B=J.join(`
|
|
25
25
|
`);for(let[Y,q]of[...B].entries()){if($+=q,$8.has(q)){let _=parseFloat(/\d[^m]*/.exec(B.slice(Y,Y+4)));X=_===39?null:_}let H=QE.codes.get(Number(X));if(X&&H){if(B[Y+1]===`
|
|
26
26
|
`)$+=EF(H);else if(q===`
|
|
27
27
|
`)$+=EF(X)}}return $};BF.exports=(D,F,E)=>{return String(D).normalize().replace(/\r\n/g,`
|
|
28
28
|
`).split(`
|
|
29
29
|
`).map((B)=>qE(B,F,E)).join(`
|
|
30
|
-
`)}});var qF=c((ZQ,YF)=>{var _E=FD("stream");class JF extends _E{#E=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.#E!==null)return this.#E;return this.#F("isTTY",!1)}set isTTY(D){this.#E=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)}}YF.exports=JF});var g8=iD(h8(),1),{program:HB,createCommand:_B,createArgument:GB,createOption:WB,CommanderError:UB,InvalidArgumentError:AB,InvalidOptionArgumentError:CB,Command:l8,Argument:zB,Option:VB,Help:KB}=g8.default;var m8="0.260203.
|
|
31
|
-
`).map((E)=>{let[B,$,X,Q]=E.split(":");return{id:B,name:$,attached:X==="1",windows:parseInt(Q,10)}})}catch(D){if(D.message.includes("no server running"))return[];throw D}}async function
|
|
30
|
+
`)}});var qF=c((ZQ,YF)=>{var _E=FD("stream");class JF extends _E{#E=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.#E!==null)return this.#E;return this.#F("isTTY",!1)}set isTTY(D){this.#E=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)}}YF.exports=JF});var g8=iD(h8(),1),{program:HB,createCommand:_B,createArgument:GB,createOption:WB,CommanderError:UB,InvalidArgumentError:AB,InvalidOptionArgumentError:CB,Command:l8,Argument:zB,Option:VB,Help:KB}=g8.default;var m8="0.260203.0711";import{join as X7}from"path";var r=[];for(let D=0;D<256;++D)r.push((D+256).toString(16).slice(1));function c8(D,F=0){return(r[D[F+0]]+r[D[F+1]]+r[D[F+2]]+r[D[F+3]]+"-"+r[D[F+4]]+r[D[F+5]]+"-"+r[D[F+6]]+r[D[F+7]]+"-"+r[D[F+8]]+r[D[F+9]]+"-"+r[D[F+10]]+r[D[F+11]]+r[D[F+12]]+r[D[F+13]]+r[D[F+14]]+r[D[F+15]]).toLowerCase()}import{randomFillSync as v5}from"crypto";var K0=new Uint8Array(256),V0=K0.length;function q3(){if(V0>K0.length-16)v5(K0),V0=0;return K0.slice(V0,V0+=16)}import{randomUUID as w5}from"crypto";var H3={randomUUID:w5};function u5(D,F,E){if(H3.randomUUID&&!F&&!D)return H3.randomUUID();D=D||{};let B=D.random??D.rng?.()??q3();if(B.length<16)throw Error("Random bytes length must be >= 16");if(B[6]=B[6]&15|64,B[8]=B[8]&63|128,F){if(E=E||0,E<0||E+16>F.length)throw RangeError(`UUID byte range ${E}:${E+15} is out of buffer bounds`);for(let $=0;$<16;++$)F[E+$]=B[$];return F}return c8(B)}var R0=u5;import{exec as x5}from"child_process";import{promisify as k5}from"util";import{join as y5}from"path";import{mkdirSync as h5,existsSync as g5}from"fs";import{homedir as l5}from"os";var m5=k5(x5);function c5(){let D=y5(l5(),".genie","logs","tmux");if(!g5(D))h5(D,{recursive:!0});return D}function p5(D){return D.filter((F)=>!/^-v+$/.test(F))}function d5(){return process.env.GENIE_TMUX_DEBUG==="1"}async function p8(D){let F=typeof D==="string"?D.split(/\s+/).filter(Boolean):D,E=p5(F),B=d5(),$={};if(B)E=["-v",...E],$.cwd=c5();let X=`tmux ${E.join(" ")}`,{stdout:Q}=await m5(X,$);return Q.trim()}var i5={type:"bash"};async function O(D){try{return await p8(D)}catch(F){throw Error(`Failed to execute tmux command: ${F.message}`)}}async function W3(){try{let F=await O("list-sessions -F '#{session_id}:#{session_name}:#{?session_attached,1,0}:#{session_windows}'");if(!F)return[];return F.split(`
|
|
31
|
+
`).map((E)=>{let[B,$,X,Q]=E.split(":");return{id:B,name:$,attached:X==="1",windows:parseInt(Q,10)}})}catch(D){if(D.message.includes("no server running"))return[];throw D}}async function w(D){try{return(await W3()).find((E)=>E.name===D)||null}catch(F){return null}}async function x(D){try{let E=await O(`list-windows -t '${D}' -F '#{window_id}:#{window_name}:#{?window_active,1,0}'`);if(!E)return[];return E.split(`
|
|
32
32
|
`).map((B)=>{let[$,X,Q]=B.split(":");return{id:$,name:X,active:Q==="1",sessionId:D}})}catch(F){if(F.message.includes("no server running")||F.message.includes("session not found"))return[];throw F}}async function h(D){try{let E=await O(`list-panes -t '${D}' -F '#{pane_id}:#{pane_title}:#{?pane_active,1,0}'`);if(!E)return[];return E.split(`
|
|
33
|
-
`).map((B)=>{let[$,X,Q]=B.split(":");return{id:$,windowId:D,title:X,active:Q==="1"}})}catch(F){if(F.message.includes("no server running")||F.message.includes("window not found"))return[];throw F}}async function p(D,F=200,E=!1){try{return await O(`capture-pane -p ${E?"-e":""} -t '${D}' -S -${F} -E -`)}catch(B){if(B.message.includes("no server running")||B.message.includes("pane not found"))return"";throw B}}async function nD(D){return await O(`new-session -d -s "${D}" -e LC_ALL=C.UTF-8 -e LANG=C.UTF-8`),
|
|
33
|
+
`).map((B)=>{let[$,X,Q]=B.split(":");return{id:$,windowId:D,title:X,active:Q==="1"}})}catch(F){if(F.message.includes("no server running")||F.message.includes("window not found"))return[];throw F}}async function p(D,F=200,E=!1){try{return await O(`capture-pane -p ${E?"-e":""} -t '${D}' -S -${F} -E -`)}catch(B){if(B.message.includes("no server running")||B.message.includes("pane not found"))return"";throw B}}async function nD(D){return await O(`new-session -d -s "${D}" -e LC_ALL=C.UTF-8 -e LANG=C.UTF-8`),w(D)}async function j0(D,F){let E=await O(`new-window -t '${D}' -n '${F}'`);return(await x(D)).find(($)=>$.name===F)||null}async function M0(D){await O(`kill-session -t '${D}'`)}async function d8(D){await O(`kill-window -t '${D}'`)}async function W2(D){await O(`kill-pane -t '${D}'`)}function n5(D){return D.replace(/'/g,"'\\''")}async function U2(D,F="vertical",E,B){let $="split-window";if(F==="horizontal")$+=" -h";else $+=" -v";if(B)$+=` -c '${n5(B)}'`;if(E!==void 0&&E>0&&E<100)$+=` -p ${E}`;$+=` -t '${D}'`,$+=" -P -F '#{pane_id}'";let X=(await O($)).trim(),Q=await O(`display-message -p -t '${X}' '#{window_id}'`);return{id:X,windowId:Q.trim(),active:!1,title:""}}var _3=new Map,G3="TMUX_MCP_START",L0="TMUX_MCP_DONE_";async function QD(D,F,E,B){let $=R0(),X;if(E||B)X=F;else{let Q=r5();X=`echo "${G3}"; ${F}; echo "${Q}"`}if(_3.set($,{id:$,paneId:D,command:F,status:"pending",startTime:new Date,rawMode:E||B}),B)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(X))await O(`send-keys -t '${D}' ${X}`);else for(let J of X)await O(`send-keys -t '${D}' '${J.replace(/'/g,"'\\''")}'`);else await O(`send-keys -t '${D}' '${X.replace(/'/g,"'\\''")}' Enter`);return $}async function i8(D){let F=_3.get(D);if(!F)return null;if(F.status!=="pending")return F;let E=await p(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 B=E.lastIndexOf(G3),$=E.lastIndexOf(L0);if(B===-1||$===-1||$<=B)return F.result="Command output could not be captured properly",F;let X=E.substring($).split(`
|
|
34
34
|
`)[0],Q=new RegExp(`${L0}(\\d+)`),J=X.match(Q);if(J){let Y=parseInt(J[1],10);F.status=Y===0?"completed":"error",F.exitCode=Y;let q=B+G3.length,H=E.substring(q,$).trim();F.result=H.substring(H.indexOf(`
|
|
35
35
|
`)+1).trim(),_3.set(D,F)}return F}function r5(){return i5.type==="fish"?`${L0}$status`:`${L0}$?`}async function n8(D,F,E=120000){let B=R0().substring(0,8),$=`/tmp/genie-${B}.out`,X=`/tmp/genie-${B}.exit`,Q=`genie-${B}`,Y=`{ ${F.replace(/'/g,"'\\''")}; } 2>&1 | tee ${$}; echo \${PIPESTATUS[0]} > ${X}; tmux wait-for -S ${Q}`;await O(`send-keys -t '${D}' '${Y.replace(/'/g,"'\\''")}' Enter`);try{await Promise.race([O(`wait-for ${Q}`),new Promise((_,G)=>setTimeout(()=>G(Error("Command timed out")),E))])}catch(_){if(_.message==="Command timed out"){try{await O(`wait-for -S ${Q}`)}catch{}return{output:"",exitCode:124}}throw _}let q="",H=0;try{let{readFile:_,unlink:G}=await import("fs/promises");q=await _($,"utf-8"),q=q.trim();let U=await _(X,"utf-8");H=parseInt(U.trim(),10)||0,await G($).catch(()=>{}),await G(X).catch(()=>{})}catch(_){console.error("Failed to read command output:",_)}return{output:q,exitCode:H}}var{$:ND}=globalThis.Bun;import{mkdir as r8,rm as a8,access as U3,readFile as a5,writeFile as o5}from"fs/promises";import{join as A2,basename as s5}from"path";function O0(D){return D.replace(/\//g,"-").replace(/\\/g,"-").replace(/[^a-zA-Z0-9-_.]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function t5(D){let F=D.match(/^(\d+)([hdwm])$/i);if(!F)throw Error(`Invalid timeframe format: ${D}. Use format like 7d, 2w, 1m, 24h`);let E=parseInt(F[1],10),B=F[2].toLowerCase();return E*{h:3600000,d:86400000,w:604800000,m:2592000000}[B]}class C2{baseDir;repoPath;metadataPath;constructor(D){this.baseDir=D.baseDir,this.repoPath=D.repoPath,this.metadataPath=A2(this.baseDir,".metadata.json")}async loadMetadata(){try{let D=await a5(this.metadataPath,"utf-8");return JSON.parse(D)}catch{return{worktrees:{}}}}async saveMetadata(D){await r8(this.baseDir,{recursive:!0}),await o5(this.metadataPath,JSON.stringify(D,null,2))}async createWorktree(D,F=!1,E){let B=O0(D),$=A2(this.baseDir,B);await r8(this.baseDir,{recursive:!0});try{throw await U3($),Error(`Worktree already exists at ${$}`)}catch(J){if(J.code!=="ENOENT")throw J}if(F)if(E)await ND`git -C ${this.repoPath} worktree add -b ${D} ${$} ${E}`.quiet();else await ND`git -C ${this.repoPath} worktree add -b ${D} ${$}`.quiet();else{if(!await this.branchExists(D))throw Error(`Branch '${D}' does not exist. Use -b to create a new branch.`);await ND`git -C ${this.repoPath} worktree add ${$} ${D}`.quiet()}let X=await this.loadMetadata();X.worktrees[B]={branch:D,createdAt:new Date().toISOString()},await this.saveMetadata(X);let Q=await this.getCommitHash($);return{path:$,branch:D,commitHash:Q,createdAt:new Date}}async removeWorktree(D){let F=O0(D),E=A2(this.baseDir,F);try{await ND`git -C ${this.repoPath} worktree remove ${E} --force`.quiet()}catch{try{await a8(E,{recursive:!0,force:!0})}catch{}}try{await U3(E),await a8(E,{recursive:!0,force:!0})}catch{}let B=await this.loadMetadata();delete B.worktrees[F],await this.saveMetadata(B)}async listWorktrees(){let F=(await ND`git -C ${this.repoPath} worktree list --porcelain`.quiet()).stdout.toString(),E=[],B={};for(let Q of F.split(`
|
|
36
|
-
`))if(Q.startsWith("worktree ")){if(B.path)E.push(B);B={path:Q.slice(9)}}else if(Q.startsWith("HEAD "))B.commitHash=Q.slice(5);else if(Q.startsWith("branch "))B.branch=Q.slice(7).replace("refs/heads/","");if(B.path)E.push(B);let $=E.filter((Q)=>Q.path.startsWith(this.baseDir)),X=await this.loadMetadata();for(let Q of $){let J=s5(Q.path),Y=X.worktrees[J];if(Y)Q.createdAt=new Date(Y.createdAt);Q.size=await this.getDiskUsage(Q.path)}return $}async cleanup(D,F=!1){let E=t5(D),B=Date.now(),$=await this.listWorktrees(),X=[];for(let Q of $)if(Q.createdAt){if(B-Q.createdAt.getTime()>E)X.push(Q)}if(!F)for(let Q of X)await this.removeWorktree(Q.branch);return X}async prune(){await ND`git -C ${this.repoPath} worktree prune`.quiet()}async getDiskUsage(D){try{let E=(await ND`du -sb ${D}`.quiet()).stdout.toString().trim(),B=parseInt(E.split("\t")[0],10);return isNaN(B)?0:B}catch{return 0}}getWorktreePath(D){let F=O0(D);return A2(this.baseDir,F)}async worktreeExists(D){let F=O0(D),E=A2(this.baseDir,F);try{return await U3(E),!0}catch{return!1}}async branchExists(D){try{return await ND`git -C ${this.repoPath} rev-parse --verify ${D}`.quiet(),!0}catch{return!1}}async getCommitHash(D){return(await ND`git -C ${D} rev-parse HEAD`.quiet()).stdout.toString().trim()}}function z2(D){let F=D?.baseDir||A2(process.cwd(),".worktrees"),E=D?.repoPath||process.cwd();return new C2({baseDir:F,repoPath:E})}import{mkdir as e5,readFile as D7,writeFile as F7,access as E7}from"fs/promises";import{join as o8}from"path";import{homedir as B7}from"os";var s8=o8(B7(),".config","term"),A3=o8(s8,"sessions.json");async function $7(){await e5(s8,{recursive:!0})}async function C3(){try{await E7(A3);let D=await D7(A3,"utf-8");return JSON.parse(D)}catch{return{sessions:{}}}}async function t8(D){await $7(),await F7(A3,JSON.stringify(D,null,2))}async function e8(D,F){let E=await C3();E.sessions[D]={...F,createdAt:new Date().toISOString()},await t8(E)}async function D6(D){return(await C3()).sessions[D]||null}async function F6(D){let F=await C3();delete F.sessions[D],await t8(F)}async function E6(D,F={}){try{if(await
|
|
37
|
-
To attach: term attach ${D}`)}catch(E){console.error(`\u274C Error creating session: ${E.message}`),process.exit(1)}}async function B6(D={}){try{let F=await W3();if(D.json){console.log(JSON.stringify(F,null,2));return}if(F.length===0){console.log("No tmux sessions found");return}console.log("SESSION ID\t\tNAME\t\t\tWINDOWS\t\tATTACHED"),console.log("\u2500".repeat(80));for(let E of F){let B=E.attached?"yes":"no";console.log(`${E.id} ${E.name} ${E.windows} ${B}`)}}catch(F){console.error(`Error listing sessions: ${F.message}`),process.exit(1)}}import{exec as Y7}from"child_process";import{promisify as q7}from"util";var H7=q7(Y7);async function $6(D){try{if(!await
|
|
36
|
+
`))if(Q.startsWith("worktree ")){if(B.path)E.push(B);B={path:Q.slice(9)}}else if(Q.startsWith("HEAD "))B.commitHash=Q.slice(5);else if(Q.startsWith("branch "))B.branch=Q.slice(7).replace("refs/heads/","");if(B.path)E.push(B);let $=E.filter((Q)=>Q.path.startsWith(this.baseDir)),X=await this.loadMetadata();for(let Q of $){let J=s5(Q.path),Y=X.worktrees[J];if(Y)Q.createdAt=new Date(Y.createdAt);Q.size=await this.getDiskUsage(Q.path)}return $}async cleanup(D,F=!1){let E=t5(D),B=Date.now(),$=await this.listWorktrees(),X=[];for(let Q of $)if(Q.createdAt){if(B-Q.createdAt.getTime()>E)X.push(Q)}if(!F)for(let Q of X)await this.removeWorktree(Q.branch);return X}async prune(){await ND`git -C ${this.repoPath} worktree prune`.quiet()}async getDiskUsage(D){try{let E=(await ND`du -sb ${D}`.quiet()).stdout.toString().trim(),B=parseInt(E.split("\t")[0],10);return isNaN(B)?0:B}catch{return 0}}getWorktreePath(D){let F=O0(D);return A2(this.baseDir,F)}async worktreeExists(D){let F=O0(D),E=A2(this.baseDir,F);try{return await U3(E),!0}catch{return!1}}async branchExists(D){try{return await ND`git -C ${this.repoPath} rev-parse --verify ${D}`.quiet(),!0}catch{return!1}}async getCommitHash(D){return(await ND`git -C ${D} rev-parse HEAD`.quiet()).stdout.toString().trim()}}function z2(D){let F=D?.baseDir||A2(process.cwd(),".worktrees"),E=D?.repoPath||process.cwd();return new C2({baseDir:F,repoPath:E})}import{mkdir as e5,readFile as D7,writeFile as F7,access as E7}from"fs/promises";import{join as o8}from"path";import{homedir as B7}from"os";var s8=o8(B7(),".config","term"),A3=o8(s8,"sessions.json");async function $7(){await e5(s8,{recursive:!0})}async function C3(){try{await E7(A3);let D=await D7(A3,"utf-8");return JSON.parse(D)}catch{return{sessions:{}}}}async function t8(D){await $7(),await F7(A3,JSON.stringify(D,null,2))}async function e8(D,F){let E=await C3();E.sessions[D]={...F,createdAt:new Date().toISOString()},await t8(E)}async function D6(D){return(await C3()).sessions[D]||null}async function F6(D){let F=await C3();delete F.sessions[D],await t8(F)}async function E6(D,F={}){try{if(await w(D))console.error(`\u274C Session "${D}" already exists`),process.exit(1);let B=F.workspace||process.cwd(),$;if(F.worktree){if(!F.workspace)console.error("\u274C --worktree requires --workspace"),process.exit(1);let Q=z2({baseDir:X7(F.workspace,".worktrees"),repoPath:F.workspace});if(await Q.worktreeExists(D))console.error(`\u274C Worktree for "${D}" already exists`),process.exit(1);let Y=await Q.createWorktree(D,!0);$=Y.path,B=Y.path,console.log(`\u2705 Worktree created at ${$}`)}if(!await nD(D))console.error(`\u274C Failed to create session "${D}"`),process.exit(1);if(await O(`send-keys -t '${D}' 'cd ${B}' Enter`),$)await e8(D,{worktreePath:$,workspace:F.workspace});if(console.log(`\u2705 Session "${D}" created`),B!==process.cwd())console.log(` Working directory: ${B}`);console.log(`
|
|
37
|
+
To attach: term attach ${D}`)}catch(E){console.error(`\u274C Error creating session: ${E.message}`),process.exit(1)}}async function B6(D={}){try{let F=await W3();if(D.json){console.log(JSON.stringify(F,null,2));return}if(F.length===0){console.log("No tmux sessions found");return}console.log("SESSION ID\t\tNAME\t\t\tWINDOWS\t\tATTACHED"),console.log("\u2500".repeat(80));for(let E of F){let B=E.attached?"yes":"no";console.log(`${E.id} ${E.name} ${E.windows} ${B}`)}}catch(F){console.error(`Error listing sessions: ${F.message}`),process.exit(1)}}import{exec as Y7}from"child_process";import{promisify as q7}from"util";var H7=q7(Y7);async function $6(D){try{if(!await w(D))console.error(`\u274C Session "${D}" not found`),process.exit(1);console.log(`\uD83D\uDCCE Attaching to session "${D}"...`),await H7(`tmux attach -t "${D}"`)}catch(F){console.error(`\u274C Error attaching to session: ${F.message}`),process.exit(1)}}import{join as G7}from"path";async function X6(D,F={}){try{let E=await w(D);if(!E)console.error(`\u274C Session "${D}" not found`),process.exit(1);let B=await D6(D);if(await M0(E.id),B?.worktreePath&&B?.workspace&&!F.keepWorktree)await z2({baseDir:G7(B.workspace,".worktrees"),repoPath:B.workspace}).removeWorktree(D),console.log(`\u2705 Session "${D}" and worktree removed`);else if(B?.worktreePath&&F.keepWorktree)console.log(`\u2705 Session "${D}" removed (worktree kept at ${B.worktreePath})`);else console.log(`\u2705 Session "${D}" removed`);if(B)await F6(D)}catch(E){console.error(`\u274C Error removing session: ${E.message}`),process.exit(1)}}function n2(D){let E=D.split(`
|
|
38
38
|
`).filter((B)=>{let $=B.trim();if($.match(/^TMUX_MCP_START$/))return!1;if($.match(/^TMUX_MCP_DONE_\d+$/))return!1;if($.includes("TMUX_MCP_START"))return!1;if($.includes("TMUX_MCP_DONE_"))return!1;if(B.includes('echo "TMUX_MCP_START"'))return!1;if(B.includes('echo "TMUX_MCP_DONE_'))return!1;if(B.includes("-bash:"))return!1;if(B.includes("warning: setlocale:"))return!1;if(B.includes("cannot change locale"))return!1;if($==="or directory")return!1;return!0});while(E.length>0&&E[0].trim()==="")E.shift();while(E.length>0&&E[E.length-1].trim()==="")E.pop();return E.join(`
|
|
39
|
-
`)}async function Q6(D,F={}){let E=await
|
|
39
|
+
`)}async function Q6(D,F={}){let E=await w(D);if(!E)throw Error(`Session "${D}" not found`);let B=await x(E.id);if(!B||B.length===0)throw Error(`No windows found in session "${D}"`);let $=B.find((H)=>H.active)||B[0],X=await h($.id);if(!X||X.length===0)throw Error(`No panes found in session "${D}"`);let J=(X.find((H)=>H.active)||X[0]).id;if(F.range){let H=F.range.split(":");if(H.length===2)F.from=parseInt(H[0],10),F.to=parseInt(H[1],10)}if(F.all){let H=await p(J,1e4);return n2(H)}if(F.from!==void 0&&F.to!==void 0){let H=await p(J,1e4),U=n2(H).split(`
|
|
40
40
|
`).slice(F.from,F.to+1).join(`
|
|
41
|
-
`);if(F.reverse)return
|
|
41
|
+
`);if(F.reverse)return U.split(`
|
|
42
42
|
`).reverse().join(`
|
|
43
|
-
`);return
|
|
44
|
-
`);try{let
|
|
45
|
-
`);return
|
|
46
|
-
`)}catch(
|
|
43
|
+
`);return U}if(F.search||F.grep){let H=F.search||F.grep,_=await p(J,1e4),U=n2(_).split(`
|
|
44
|
+
`);try{let z=new RegExp(H,"i"),L=U.filter((V)=>z.test(V));if(F.reverse)return L.reverse().join(`
|
|
45
|
+
`);return L.join(`
|
|
46
|
+
`)}catch(z){throw Error(`Invalid regex pattern: ${z.message}`)}}let Y=F.lines||100,q=await p(J,Y);if(q=n2(q),F.reverse)q=q.split(`
|
|
47
47
|
`).reverse().join(`
|
|
48
|
-
`);return
|
|
49
|
-
`),
|
|
50
|
-
`),U=G.length>0?G.length-1:0;_.slice(U).forEach((R)=>{if(R&&R!==G[G.length-1])F(R)}),Q=H}}catch(q){clearInterval(Y),J=!1}},500);return()=>{J=!1,clearInterval(Y)}}import{existsSync as f0,mkdirSync as Z9,readFileSync as R6,writeFileSync as I9}from"fs";import{homedir as L6}from"os";import{join as j6}from"path";var w={};N8(w,{void:()=>t7,util:()=>Z,unknown:()=>o7,union:()=>E9,undefined:()=>n7,tuple:()=>X9,transformer:()=>A9,symbol:()=>i7,string:()=>C6,strictObject:()=>F9,setErrorMap:()=>z7,set:()=>Y9,record:()=>Q9,quotelessJson:()=>A7,promise:()=>U9,preprocess:()=>V9,pipeline:()=>K9,ostring:()=>R9,optional:()=>C9,onumber:()=>L9,oboolean:()=>j9,objectUtil:()=>z3,object:()=>D9,number:()=>z6,nullable:()=>z9,null:()=>r7,never:()=>s7,nativeEnum:()=>W9,nan:()=>c7,map:()=>J9,makeIssue:()=>r2,literal:()=>_9,lazy:()=>H9,late:()=>l7,isValid:()=>xD,isDirty:()=>S0,isAsync:()=>K2,isAborted:()=>N0,intersection:()=>$9,instanceof:()=>m7,getParsedType:()=>AD,getErrorMap:()=>V2,function:()=>q9,enum:()=>G9,effect:()=>A9,discriminatedUnion:()=>B9,defaultErrorMap:()=>SD,datetimeRegex:()=>W6,date:()=>d7,custom:()=>A6,coerce:()=>M9,boolean:()=>V6,bigint:()=>p7,array:()=>e7,any:()=>a7,addIssueToContext:()=>C,ZodVoid:()=>o2,ZodUnknown:()=>kD,ZodUnion:()=>N2,ZodUndefined:()=>M2,ZodType:()=>f,ZodTuple:()=>zD,ZodTransformer:()=>_D,ZodSymbol:()=>a2,ZodString:()=>JD,ZodSet:()=>sD,ZodSchema:()=>f,ZodRecord:()=>s2,ZodReadonly:()=>I2,ZodPromise:()=>tD,ZodPipeline:()=>D0,ZodParsedType:()=>A,ZodOptional:()=>qD,ZodObject:()=>g,ZodNumber:()=>yD,ZodNullable:()=>bD,ZodNull:()=>O2,ZodNever:()=>CD,ZodNativeEnum:()=>P2,ZodNaN:()=>e2,ZodMap:()=>t2,ZodLiteral:()=>b2,ZodLazy:()=>T2,ZodIssueCode:()=>W,ZodIntersection:()=>S2,ZodFunction:()=>L2,ZodFirstPartyTypeKind:()=>S,ZodError:()=>e,ZodEnum:()=>gD,ZodEffects:()=>_D,ZodDiscriminatedUnion:()=>T0,ZodDefault:()=>f2,ZodDate:()=>aD,ZodCatch:()=>Z2,ZodBranded:()=>b0,ZodBoolean:()=>j2,ZodBigInt:()=>hD,ZodArray:()=>YD,ZodAny:()=>oD,Schema:()=>f,ParseStatus:()=>a,OK:()=>o,NEVER:()=>O9,INVALID:()=>N,EMPTY_PATH:()=>V7,DIRTY:()=>rD,BRAND:()=>g7});var Z;(function(D){D.assertEqual=($)=>{};function F($){}D.assertIs=F;function E($){throw Error()}D.assertNever=E,D.arrayToEnum=($)=>{let X={};for(let Q of $)X[Q]=Q;return X},D.getValidEnumValues=($)=>{let X=D.objectKeys($).filter((J)=>typeof $[$[J]]!=="number"),Q={};for(let J of X)Q[J]=$[J];return D.objectValues(Q)},D.objectValues=($)=>{return D.objectKeys($).map(function(X){return $[X]})},D.objectKeys=typeof Object.keys==="function"?($)=>Object.keys($):($)=>{let X=[];for(let Q in $)if(Object.prototype.hasOwnProperty.call($,Q))X.push(Q);return X},D.find=($,X)=>{for(let Q of $)if(X(Q))return Q;return},D.isInteger=typeof Number.isInteger==="function"?($)=>Number.isInteger($):($)=>typeof $==="number"&&Number.isFinite($)&&Math.floor($)===$;function B($,X=" | "){return $.map((Q)=>typeof Q==="string"?`'${Q}'`:Q).join(X)}D.joinValues=B,D.jsonStringifyReplacer=($,X)=>{if(typeof X==="bigint")return X.toString();return X}})(Z||(Z={}));var z3;(function(D){D.mergeShapes=(F,E)=>{return{...F,...E}}})(z3||(z3={}));var A=Z.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),AD=(D)=>{switch(typeof D){case"undefined":return A.undefined;case"string":return A.string;case"number":return Number.isNaN(D)?A.nan:A.number;case"boolean":return A.boolean;case"function":return A.function;case"bigint":return A.bigint;case"symbol":return A.symbol;case"object":if(Array.isArray(D))return A.array;if(D===null)return A.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return A.promise;if(typeof Map<"u"&&D instanceof Map)return A.map;if(typeof Set<"u"&&D instanceof Set)return A.set;if(typeof Date<"u"&&D instanceof Date)return A.date;return A.object;default:return A.unknown}};var W=Z.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"]),A7=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")};class e extends Error{get errors(){return this.issues}constructor(D){super();this.issues=[],this.addIssue=(E)=>{this.issues=[...this.issues,E]},this.addIssues=(E=[])=>{this.issues=[...this.issues,...E]};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},E={_errors:[]},B=($)=>{for(let X of $.issues)if(X.code==="invalid_union")X.unionErrors.map(B);else if(X.code==="invalid_return_type")B(X.returnTypeError);else if(X.code==="invalid_arguments")B(X.argumentsError);else if(X.path.length===0)E._errors.push(F(X));else{let Q=E,J=0;while(J<X.path.length){let Y=X.path[J];if(J!==X.path.length-1)Q[Y]=Q[Y]||{_errors:[]};else Q[Y]=Q[Y]||{_errors:[]},Q[Y]._errors.push(F(X));Q=Q[Y],J++}}};return B(this),E}static assert(D){if(!(D instanceof e))throw Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Z.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(D=(F)=>F.message){let F={},E=[];for(let B of this.issues)if(B.path.length>0){let $=B.path[0];F[$]=F[$]||[],F[$].push(D(B))}else E.push(D(B));return{formErrors:E,fieldErrors:F}}get formErrors(){return this.flatten()}}e.create=(D)=>{return new e(D)};var C7=(D,F)=>{let E;switch(D.code){case W.invalid_type:if(D.received===A.undefined)E="Required";else E=`Expected ${D.expected}, received ${D.received}`;break;case W.invalid_literal:E=`Invalid literal value, expected ${JSON.stringify(D.expected,Z.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:E=`Unrecognized key(s) in object: ${Z.joinValues(D.keys,", ")}`;break;case W.invalid_union:E="Invalid input";break;case W.invalid_union_discriminator:E=`Invalid discriminator value. Expected ${Z.joinValues(D.options)}`;break;case W.invalid_enum_value:E=`Invalid enum value. Expected ${Z.joinValues(D.options)}, received '${D.received}'`;break;case W.invalid_arguments:E="Invalid function arguments";break;case W.invalid_return_type:E="Invalid function return type";break;case W.invalid_date:E="Invalid date";break;case W.invalid_string:if(typeof D.validation==="object")if("includes"in D.validation){if(E=`Invalid input: must include "${D.validation.includes}"`,typeof D.validation.position==="number")E=`${E} at one or more positions greater than or equal to ${D.validation.position}`}else if("startsWith"in D.validation)E=`Invalid input: must start with "${D.validation.startsWith}"`;else if("endsWith"in D.validation)E=`Invalid input: must end with "${D.validation.endsWith}"`;else Z.assertNever(D.validation);else if(D.validation!=="regex")E=`Invalid ${D.validation}`;else E="Invalid";break;case W.too_small:if(D.type==="array")E=`Array must contain ${D.exact?"exactly":D.inclusive?"at least":"more than"} ${D.minimum} element(s)`;else if(D.type==="string")E=`String must contain ${D.exact?"exactly":D.inclusive?"at least":"over"} ${D.minimum} character(s)`;else if(D.type==="number")E=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="bigint")E=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="date")E=`Date must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(D.minimum))}`;else E="Invalid input";break;case W.too_big:if(D.type==="array")E=`Array must contain ${D.exact?"exactly":D.inclusive?"at most":"less than"} ${D.maximum} element(s)`;else if(D.type==="string")E=`String must contain ${D.exact?"exactly":D.inclusive?"at most":"under"} ${D.maximum} character(s)`;else if(D.type==="number")E=`Number must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="bigint")E=`BigInt must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="date")E=`Date must be ${D.exact?"exactly":D.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(D.maximum))}`;else E="Invalid input";break;case W.custom:E="Invalid input";break;case W.invalid_intersection_types:E="Intersection results could not be merged";break;case W.not_multiple_of:E=`Number must be a multiple of ${D.multipleOf}`;break;case W.not_finite:E="Number must be finite";break;default:E=F.defaultError,Z.assertNever(D)}return{message:E}},SD=C7;var Y6=SD;function z7(D){Y6=D}function V2(){return Y6}var r2=(D)=>{let{data:F,path:E,errorMaps:B,issueData:$}=D,X=[...E,...$.path||[]],Q={...$,path:X};if($.message!==void 0)return{...$,path:X,message:$.message};let J="",Y=B.filter((q)=>!!q).slice().reverse();for(let q of Y)J=q(Q,{data:F,defaultError:J}).message;return{...$,path:X,message:J}},V7=[];function C(D,F){let E=V2(),B=r2({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,E,E===SD?void 0:SD].filter(($)=>!!$)});D.common.issues.push(B)}class a{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 E=[];for(let B of F){if(B.status==="aborted")return N;if(B.status==="dirty")D.dirty();E.push(B.value)}return{status:D.value,value:E}}static async mergeObjectAsync(D,F){let E=[];for(let B of F){let $=await B.key,X=await B.value;E.push({key:$,value:X})}return a.mergeObjectSync(D,E)}static mergeObjectSync(D,F){let E={};for(let B of F){let{key:$,value:X}=B;if($.status==="aborted")return N;if(X.status==="aborted")return N;if($.status==="dirty")D.dirty();if(X.status==="dirty")D.dirty();if($.value!=="__proto__"&&(typeof X.value<"u"||B.alwaysSet))E[$.value]=X.value}return{status:D.value,value:E}}}var N=Object.freeze({status:"aborted"}),rD=(D)=>({status:"dirty",value:D}),o=(D)=>({status:"valid",value:D}),N0=(D)=>D.status==="aborted",S0=(D)=>D.status==="dirty",xD=(D)=>D.status==="valid",K2=(D)=>typeof Promise<"u"&&D instanceof Promise;var V;(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(V||(V={}));class HD{constructor(D,F,E,B){this._cachedPath=[],this.parent=D,this.data=F,this._path=E,this._key=B}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 q6=(D,F)=>{if(xD(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 E=new e(D.common.issues);return this._error=E,this._error}}}};function T(D){if(!D)return{};let{errorMap:F,invalid_type_error:E,required_error:B,description:$}=D;if(F&&(E||B))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:(Q,J)=>{let{message:Y}=D;if(Q.code==="invalid_enum_value")return{message:Y??J.defaultError};if(typeof J.data>"u")return{message:Y??B??J.defaultError};if(Q.code!=="invalid_type")return{message:J.defaultError};return{message:Y??E??J.defaultError}},description:$}}class f{get description(){return this._def.description}_getType(D){return AD(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:AD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new a,ctx:{common:D.parent.common,data:D.data,parsedType:AD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(K2(F))throw Error("Synchronous parse encountered promise.");return F}_parseAsync(D){let F=this._parse(D);return Promise.resolve(F)}parse(D,F){let E=this.safeParse(D,F);if(E.success)return E.data;throw E.error}safeParse(D,F){let E={common:{issues:[],async:F?.async??!1,contextualErrorMap:F?.errorMap},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:AD(D)},B=this._parseSync({data:D,path:E.path,parent:E});return q6(E,B)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:AD(D)};if(!this["~standard"].async)try{let E=this._parseSync({data:D,path:[],parent:F});return xD(E)?{value:E.value}:{issues:F.common.issues}}catch(E){if(E?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;F.common={issues:[],async:!0}}return this._parseAsync({data:D,path:[],parent:F}).then((E)=>xD(E)?{value:E.value}:{issues:F.common.issues})}async parseAsync(D,F){let E=await this.safeParseAsync(D,F);if(E.success)return E.data;throw E.error}async safeParseAsync(D,F){let E={common:{issues:[],contextualErrorMap:F?.errorMap,async:!0},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:AD(D)},B=this._parse({data:D,path:E.path,parent:E}),$=await(K2(B)?B:Promise.resolve(B));return q6(E,$)}refine(D,F){let E=(B)=>{if(typeof F==="string"||typeof F>"u")return{message:F};else if(typeof F==="function")return F(B);else return F};return this._refinement((B,$)=>{let X=D(B),Q=()=>$.addIssue({code:W.custom,...E(B)});if(typeof Promise<"u"&&X instanceof Promise)return X.then((J)=>{if(!J)return Q(),!1;else return!0});if(!X)return Q(),!1;else return!0})}refinement(D,F){return this._refinement((E,B)=>{if(!D(E))return B.addIssue(typeof F==="function"?F(E,B):F),!1;else return!0})}_refinement(D){return new _D({schema:this,typeName:S.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 qD.create(this,this._def)}nullable(){return bD.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return YD.create(this)}promise(){return tD.create(this,this._def)}or(D){return N2.create([this,D],this._def)}and(D){return S2.create(this,D,this._def)}transform(D){return new _D({...T(this._def),schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new f2({...T(this._def),innerType:this,defaultValue:F,typeName:S.ZodDefault})}brand(){return new b0({typeName:S.ZodBranded,type:this,...T(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new Z2({...T(this._def),innerType:this,catchValue:F,typeName:S.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return D0.create(this,D)}readonly(){return I2.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var K7=/^c[^\s-]{8,}$/i,R7=/^[0-9a-z]+$/,L7=/^[0-9A-HJKMNP-TV-Z]{26}$/i,j7=/^[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,M7=/^[a-z0-9_-]{21}$/i,O7=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,N7=/^[-+]?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)?)??$/,S7=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,T7="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",V3,b7=/^(?:(?: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])$/,P7=/^(?:(?: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])$/,f7=/^(([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]))$/,Z7=/^(([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])$/,I7=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,w7=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_6="((\\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])))",v7=new RegExp(`^${_6}$`);function G6(D){let F="[0-5]\\d";if(D.precision)F=`${F}\\.\\d{${D.precision}}`;else if(D.precision==null)F=`${F}(\\.\\d+)?`;let E=D.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${F})${E}`}function u7(D){return new RegExp(`^${G6(D)}$`)}function W6(D){let F=`${_6}T${G6(D)}`,E=[];if(E.push(D.local?"Z?":"Z"),D.offset)E.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${E.join("|")})`,new RegExp(`^${F}$`)}function x7(D,F){if((F==="v4"||!F)&&b7.test(D))return!0;if((F==="v6"||!F)&&f7.test(D))return!0;return!1}function k7(D,F){if(!O7.test(D))return!1;try{let[E]=D.split(".");if(!E)return!1;let B=E.replace(/-/g,"+").replace(/_/g,"/").padEnd(E.length+(4-E.length%4)%4,"="),$=JSON.parse(atob(B));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 y7(D,F){if((F==="v4"||!F)&&P7.test(D))return!0;if((F==="v6"||!F)&&Z7.test(D))return!0;return!1}class JD extends f{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==A.string){let $=this._getOrReturnCtx(D);return C($,{code:W.invalid_type,expected:A.string,received:$.parsedType}),N}let E=new a,B=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(D.data.length<$.value)B=this._getOrReturnCtx(D,B),C(B,{code:W.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),E.dirty()}else if($.kind==="max"){if(D.data.length>$.value)B=this._getOrReturnCtx(D,B),C(B,{code:W.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),E.dirty()}else if($.kind==="length"){let X=D.data.length>$.value,Q=D.data.length<$.value;if(X||Q){if(B=this._getOrReturnCtx(D,B),X)C(B,{code:W.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});else if(Q)C(B,{code:W.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});E.dirty()}}else if($.kind==="email"){if(!S7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"email",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="emoji"){if(!V3)V3=new RegExp(T7,"u");if(!V3.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"emoji",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="uuid"){if(!j7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"uuid",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="nanoid"){if(!M7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"nanoid",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="cuid"){if(!K7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"cuid",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="cuid2"){if(!R7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"cuid2",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="ulid"){if(!L7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"ulid",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="url")try{new URL(D.data)}catch{B=this._getOrReturnCtx(D,B),C(B,{validation:"url",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="regex"){if($.regex.lastIndex=0,!$.regex.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"regex",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="trim")D.data=D.data.trim();else if($.kind==="includes"){if(!D.data.includes($.value,$.position))B=this._getOrReturnCtx(D,B),C(B,{code:W.invalid_string,validation:{includes:$.value,position:$.position},message:$.message}),E.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))B=this._getOrReturnCtx(D,B),C(B,{code:W.invalid_string,validation:{startsWith:$.value},message:$.message}),E.dirty()}else if($.kind==="endsWith"){if(!D.data.endsWith($.value))B=this._getOrReturnCtx(D,B),C(B,{code:W.invalid_string,validation:{endsWith:$.value},message:$.message}),E.dirty()}else if($.kind==="datetime"){if(!W6($).test(D.data))B=this._getOrReturnCtx(D,B),C(B,{code:W.invalid_string,validation:"datetime",message:$.message}),E.dirty()}else if($.kind==="date"){if(!v7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{code:W.invalid_string,validation:"date",message:$.message}),E.dirty()}else if($.kind==="time"){if(!u7($).test(D.data))B=this._getOrReturnCtx(D,B),C(B,{code:W.invalid_string,validation:"time",message:$.message}),E.dirty()}else if($.kind==="duration"){if(!N7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"duration",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="ip"){if(!x7(D.data,$.version))B=this._getOrReturnCtx(D,B),C(B,{validation:"ip",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="jwt"){if(!k7(D.data,$.alg))B=this._getOrReturnCtx(D,B),C(B,{validation:"jwt",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="cidr"){if(!y7(D.data,$.version))B=this._getOrReturnCtx(D,B),C(B,{validation:"cidr",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="base64"){if(!I7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"base64",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="base64url"){if(!w7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"base64url",code:W.invalid_string,message:$.message}),E.dirty()}else Z.assertNever($);return{status:E.value,value:D.data}}_regex(D,F,E){return this.refinement((B)=>D.test(B),{validation:F,code:W.invalid_string,...V.errToObj(E)})}_addCheck(D){return new JD({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",...V.errToObj(D)})}url(D){return this._addCheck({kind:"url",...V.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",...V.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",...V.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",...V.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",...V.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",...V.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",...V.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",...V.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",...V.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",...V.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",...V.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",...V.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,...V.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,...V.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",...V.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,...V.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,...V.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,...V.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,...V.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,...V.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,...V.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,...V.errToObj(F)})}nonempty(D){return this.min(1,V.errToObj(D))}trim(){return new JD({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new JD({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new JD({...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}}JD.create=(D)=>{return new JD({checks:[],typeName:S.ZodString,coerce:D?.coerce??!1,...T(D)})};function h7(D,F){let E=(D.toString().split(".")[1]||"").length,B=(F.toString().split(".")[1]||"").length,$=E>B?E:B,X=Number.parseInt(D.toFixed($).replace(".","")),Q=Number.parseInt(F.toFixed($).replace(".",""));return X%Q/10**$}class yD extends f{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)!==A.number){let $=this._getOrReturnCtx(D);return C($,{code:W.invalid_type,expected:A.number,received:$.parsedType}),N}let E=void 0,B=new a;for(let $ of this._def.checks)if($.kind==="int"){if(!Z.isInteger(D.data))E=this._getOrReturnCtx(D,E),C(E,{code:W.invalid_type,expected:"integer",received:"float",message:$.message}),B.dirty()}else if($.kind==="min"){if($.inclusive?D.data<$.value:D.data<=$.value)E=this._getOrReturnCtx(D,E),C(E,{code:W.too_small,minimum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),B.dirty()}else if($.kind==="max"){if($.inclusive?D.data>$.value:D.data>=$.value)E=this._getOrReturnCtx(D,E),C(E,{code:W.too_big,maximum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),B.dirty()}else if($.kind==="multipleOf"){if(h7(D.data,$.value)!==0)E=this._getOrReturnCtx(D,E),C(E,{code:W.not_multiple_of,multipleOf:$.value,message:$.message}),B.dirty()}else if($.kind==="finite"){if(!Number.isFinite(D.data))E=this._getOrReturnCtx(D,E),C(E,{code:W.not_finite,message:$.message}),B.dirty()}else Z.assertNever($);return{status:B.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,V.toString(F))}gt(D,F){return this.setLimit("min",D,!1,V.toString(F))}lte(D,F){return this.setLimit("max",D,!0,V.toString(F))}lt(D,F){return this.setLimit("max",D,!1,V.toString(F))}setLimit(D,F,E,B){return new yD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:E,message:V.toString(B)}]})}_addCheck(D){return new yD({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:V.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:V.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:V.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.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"&&Z.isInteger(D.value))}get isFinite(){let D=null,F=null;for(let E of this._def.checks)if(E.kind==="finite"||E.kind==="int"||E.kind==="multipleOf")return!0;else if(E.kind==="min"){if(F===null||E.value>F)F=E.value}else if(E.kind==="max"){if(D===null||E.value<D)D=E.value}return Number.isFinite(F)&&Number.isFinite(D)}}yD.create=(D)=>{return new yD({checks:[],typeName:S.ZodNumber,coerce:D?.coerce||!1,...T(D)})};class hD extends f{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)!==A.bigint)return this._getInvalidInput(D);let E=void 0,B=new a;for(let $ of this._def.checks)if($.kind==="min"){if($.inclusive?D.data<$.value:D.data<=$.value)E=this._getOrReturnCtx(D,E),C(E,{code:W.too_small,type:"bigint",minimum:$.value,inclusive:$.inclusive,message:$.message}),B.dirty()}else if($.kind==="max"){if($.inclusive?D.data>$.value:D.data>=$.value)E=this._getOrReturnCtx(D,E),C(E,{code:W.too_big,type:"bigint",maximum:$.value,inclusive:$.inclusive,message:$.message}),B.dirty()}else if($.kind==="multipleOf"){if(D.data%$.value!==BigInt(0))E=this._getOrReturnCtx(D,E),C(E,{code:W.not_multiple_of,multipleOf:$.value,message:$.message}),B.dirty()}else Z.assertNever($);return{status:B.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return C(F,{code:W.invalid_type,expected:A.bigint,received:F.parsedType}),N}gte(D,F){return this.setLimit("min",D,!0,V.toString(F))}gt(D,F){return this.setLimit("min",D,!1,V.toString(F))}lte(D,F){return this.setLimit("max",D,!0,V.toString(F))}lt(D,F){return this.setLimit("max",D,!1,V.toString(F))}setLimit(D,F,E,B){return new hD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:E,message:V.toString(B)}]})}_addCheck(D){return new hD({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:V.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}}hD.create=(D)=>{return new hD({checks:[],typeName:S.ZodBigInt,coerce:D?.coerce??!1,...T(D)})};class j2 extends f{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==A.boolean){let E=this._getOrReturnCtx(D);return C(E,{code:W.invalid_type,expected:A.boolean,received:E.parsedType}),N}return o(D.data)}}j2.create=(D)=>{return new j2({typeName:S.ZodBoolean,coerce:D?.coerce||!1,...T(D)})};class aD extends f{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==A.date){let $=this._getOrReturnCtx(D);return C($,{code:W.invalid_type,expected:A.date,received:$.parsedType}),N}if(Number.isNaN(D.data.getTime())){let $=this._getOrReturnCtx(D);return C($,{code:W.invalid_date}),N}let E=new a,B=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(D.data.getTime()<$.value)B=this._getOrReturnCtx(D,B),C(B,{code:W.too_small,message:$.message,inclusive:!0,exact:!1,minimum:$.value,type:"date"}),E.dirty()}else if($.kind==="max"){if(D.data.getTime()>$.value)B=this._getOrReturnCtx(D,B),C(B,{code:W.too_big,message:$.message,inclusive:!0,exact:!1,maximum:$.value,type:"date"}),E.dirty()}else Z.assertNever($);return{status:E.value,value:new Date(D.data.getTime())}}_addCheck(D){return new aD({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:V.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:V.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}}aD.create=(D)=>{return new aD({checks:[],coerce:D?.coerce||!1,typeName:S.ZodDate,...T(D)})};class a2 extends f{_parse(D){if(this._getType(D)!==A.symbol){let E=this._getOrReturnCtx(D);return C(E,{code:W.invalid_type,expected:A.symbol,received:E.parsedType}),N}return o(D.data)}}a2.create=(D)=>{return new a2({typeName:S.ZodSymbol,...T(D)})};class M2 extends f{_parse(D){if(this._getType(D)!==A.undefined){let E=this._getOrReturnCtx(D);return C(E,{code:W.invalid_type,expected:A.undefined,received:E.parsedType}),N}return o(D.data)}}M2.create=(D)=>{return new M2({typeName:S.ZodUndefined,...T(D)})};class O2 extends f{_parse(D){if(this._getType(D)!==A.null){let E=this._getOrReturnCtx(D);return C(E,{code:W.invalid_type,expected:A.null,received:E.parsedType}),N}return o(D.data)}}O2.create=(D)=>{return new O2({typeName:S.ZodNull,...T(D)})};class oD extends f{constructor(){super(...arguments);this._any=!0}_parse(D){return o(D.data)}}oD.create=(D)=>{return new oD({typeName:S.ZodAny,...T(D)})};class kD extends f{constructor(){super(...arguments);this._unknown=!0}_parse(D){return o(D.data)}}kD.create=(D)=>{return new kD({typeName:S.ZodUnknown,...T(D)})};class CD extends f{_parse(D){let F=this._getOrReturnCtx(D);return C(F,{code:W.invalid_type,expected:A.never,received:F.parsedType}),N}}CD.create=(D)=>{return new CD({typeName:S.ZodNever,...T(D)})};class o2 extends f{_parse(D){if(this._getType(D)!==A.undefined){let E=this._getOrReturnCtx(D);return C(E,{code:W.invalid_type,expected:A.void,received:E.parsedType}),N}return o(D.data)}}o2.create=(D)=>{return new o2({typeName:S.ZodVoid,...T(D)})};class YD extends f{_parse(D){let{ctx:F,status:E}=this._processInputParams(D),B=this._def;if(F.parsedType!==A.array)return C(F,{code:W.invalid_type,expected:A.array,received:F.parsedType}),N;if(B.exactLength!==null){let X=F.data.length>B.exactLength.value,Q=F.data.length<B.exactLength.value;if(X||Q)C(F,{code:X?W.too_big:W.too_small,minimum:Q?B.exactLength.value:void 0,maximum:X?B.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:B.exactLength.message}),E.dirty()}if(B.minLength!==null){if(F.data.length<B.minLength.value)C(F,{code:W.too_small,minimum:B.minLength.value,type:"array",inclusive:!0,exact:!1,message:B.minLength.message}),E.dirty()}if(B.maxLength!==null){if(F.data.length>B.maxLength.value)C(F,{code:W.too_big,maximum:B.maxLength.value,type:"array",inclusive:!0,exact:!1,message:B.maxLength.message}),E.dirty()}if(F.common.async)return Promise.all([...F.data].map((X,Q)=>{return B.type._parseAsync(new HD(F,X,F.path,Q))})).then((X)=>{return a.mergeArray(E,X)});let $=[...F.data].map((X,Q)=>{return B.type._parseSync(new HD(F,X,F.path,Q))});return a.mergeArray(E,$)}get element(){return this._def.type}min(D,F){return new YD({...this._def,minLength:{value:D,message:V.toString(F)}})}max(D,F){return new YD({...this._def,maxLength:{value:D,message:V.toString(F)}})}length(D,F){return new YD({...this._def,exactLength:{value:D,message:V.toString(F)}})}nonempty(D){return this.min(1,D)}}YD.create=(D,F)=>{return new YD({type:D,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray,...T(F)})};function R2(D){if(D instanceof g){let F={};for(let E in D.shape){let B=D.shape[E];F[E]=qD.create(R2(B))}return new g({...D._def,shape:()=>F})}else if(D instanceof YD)return new YD({...D._def,type:R2(D.element)});else if(D instanceof qD)return qD.create(R2(D.unwrap()));else if(D instanceof bD)return bD.create(R2(D.unwrap()));else if(D instanceof zD)return zD.create(D.items.map((F)=>R2(F)));else return D}class g extends f{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=Z.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==A.object){let Y=this._getOrReturnCtx(D);return C(Y,{code:W.invalid_type,expected:A.object,received:Y.parsedType}),N}let{status:E,ctx:B}=this._processInputParams(D),{shape:$,keys:X}=this._getCached(),Q=[];if(!(this._def.catchall instanceof CD&&this._def.unknownKeys==="strip")){for(let Y in B.data)if(!X.includes(Y))Q.push(Y)}let J=[];for(let Y of X){let q=$[Y],H=B.data[Y];J.push({key:{status:"valid",value:Y},value:q._parse(new HD(B,H,B.path,Y)),alwaysSet:Y in B.data})}if(this._def.catchall instanceof CD){let Y=this._def.unknownKeys;if(Y==="passthrough")for(let q of Q)J.push({key:{status:"valid",value:q},value:{status:"valid",value:B.data[q]}});else if(Y==="strict"){if(Q.length>0)C(B,{code:W.unrecognized_keys,keys:Q}),E.dirty()}else if(Y==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let Y=this._def.catchall;for(let q of Q){let H=B.data[q];J.push({key:{status:"valid",value:q},value:Y._parse(new HD(B,H,B.path,q)),alwaysSet:q in B.data})}}if(B.common.async)return Promise.resolve().then(async()=>{let Y=[];for(let q of J){let H=await q.key,_=await q.value;Y.push({key:H,value:_,alwaysSet:q.alwaysSet})}return Y}).then((Y)=>{return a.mergeObjectSync(E,Y)});else return a.mergeObjectSync(E,J)}get shape(){return this._def.shape()}strict(D){return V.errToObj,new g({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,E)=>{let B=this._def.errorMap?.(F,E).message??E.defaultError;if(F.code==="unrecognized_keys")return{message:V.errToObj(D).message??B};return{message:B}}}:{}})}strip(){return new g({...this._def,unknownKeys:"strip"})}passthrough(){return new g({...this._def,unknownKeys:"passthrough"})}extend(D){return new g({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new g({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:S.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new g({...this._def,catchall:D})}pick(D){let F={};for(let E of Z.objectKeys(D))if(D[E]&&this.shape[E])F[E]=this.shape[E];return new g({...this._def,shape:()=>F})}omit(D){let F={};for(let E of Z.objectKeys(this.shape))if(!D[E])F[E]=this.shape[E];return new g({...this._def,shape:()=>F})}deepPartial(){return R2(this)}partial(D){let F={};for(let E of Z.objectKeys(this.shape)){let B=this.shape[E];if(D&&!D[E])F[E]=B;else F[E]=B.optional()}return new g({...this._def,shape:()=>F})}required(D){let F={};for(let E of Z.objectKeys(this.shape))if(D&&!D[E])F[E]=this.shape[E];else{let $=this.shape[E];while($ instanceof qD)$=$._def.innerType;F[E]=$}return new g({...this._def,shape:()=>F})}keyof(){return U6(Z.objectKeys(this.shape))}}g.create=(D,F)=>{return new g({shape:()=>D,unknownKeys:"strip",catchall:CD.create(),typeName:S.ZodObject,...T(F)})};g.strictCreate=(D,F)=>{return new g({shape:()=>D,unknownKeys:"strict",catchall:CD.create(),typeName:S.ZodObject,...T(F)})};g.lazycreate=(D,F)=>{return new g({shape:D,unknownKeys:"strip",catchall:CD.create(),typeName:S.ZodObject,...T(F)})};class N2 extends f{_parse(D){let{ctx:F}=this._processInputParams(D),E=this._def.options;function B($){for(let Q of $)if(Q.result.status==="valid")return Q.result;for(let Q of $)if(Q.result.status==="dirty")return F.common.issues.push(...Q.ctx.common.issues),Q.result;let X=$.map((Q)=>new e(Q.ctx.common.issues));return C(F,{code:W.invalid_union,unionErrors:X}),N}if(F.common.async)return Promise.all(E.map(async($)=>{let X={...F,common:{...F.common,issues:[]},parent:null};return{result:await $._parseAsync({data:F.data,path:F.path,parent:X}),ctx:X}})).then(B);else{let $=void 0,X=[];for(let J of E){let Y={...F,common:{...F.common,issues:[]},parent:null},q=J._parseSync({data:F.data,path:F.path,parent:Y});if(q.status==="valid")return q;else if(q.status==="dirty"&&!$)$={result:q,ctx:Y};if(Y.common.issues.length)X.push(Y.common.issues)}if($)return F.common.issues.push(...$.ctx.common.issues),$.result;let Q=X.map((J)=>new e(J));return C(F,{code:W.invalid_union,unionErrors:Q}),N}}get options(){return this._def.options}}N2.create=(D,F)=>{return new N2({options:D,typeName:S.ZodUnion,...T(F)})};var TD=(D)=>{if(D instanceof T2)return TD(D.schema);else if(D instanceof _D)return TD(D.innerType());else if(D instanceof b2)return[D.value];else if(D instanceof gD)return D.options;else if(D instanceof P2)return Z.objectValues(D.enum);else if(D instanceof f2)return TD(D._def.innerType);else if(D instanceof M2)return[void 0];else if(D instanceof O2)return[null];else if(D instanceof qD)return[void 0,...TD(D.unwrap())];else if(D instanceof bD)return[null,...TD(D.unwrap())];else if(D instanceof b0)return TD(D.unwrap());else if(D instanceof I2)return TD(D.unwrap());else if(D instanceof Z2)return TD(D._def.innerType);else return[]};class T0 extends f{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==A.object)return C(F,{code:W.invalid_type,expected:A.object,received:F.parsedType}),N;let E=this.discriminator,B=F.data[E],$=this.optionsMap.get(B);if(!$)return C(F,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[E]}),N;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,E){let B=new Map;for(let $ of F){let X=TD($.shape[D]);if(!X.length)throw Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let Q of X){if(B.has(Q))throw Error(`Discriminator property ${String(D)} has duplicate value ${String(Q)}`);B.set(Q,$)}}return new T0({typeName:S.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:B,...T(E)})}}function K3(D,F){let E=AD(D),B=AD(F);if(D===F)return{valid:!0,data:D};else if(E===A.object&&B===A.object){let $=Z.objectKeys(F),X=Z.objectKeys(D).filter((J)=>$.indexOf(J)!==-1),Q={...D,...F};for(let J of X){let Y=K3(D[J],F[J]);if(!Y.valid)return{valid:!1};Q[J]=Y.data}return{valid:!0,data:Q}}else if(E===A.array&&B===A.array){if(D.length!==F.length)return{valid:!1};let $=[];for(let X=0;X<D.length;X++){let Q=D[X],J=F[X],Y=K3(Q,J);if(!Y.valid)return{valid:!1};$.push(Y.data)}return{valid:!0,data:$}}else if(E===A.date&&B===A.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}class S2 extends f{_parse(D){let{status:F,ctx:E}=this._processInputParams(D),B=($,X)=>{if(N0($)||N0(X))return N;let Q=K3($.value,X.value);if(!Q.valid)return C(E,{code:W.invalid_intersection_types}),N;if(S0($)||S0(X))F.dirty();return{status:F.value,value:Q.data}};if(E.common.async)return Promise.all([this._def.left._parseAsync({data:E.data,path:E.path,parent:E}),this._def.right._parseAsync({data:E.data,path:E.path,parent:E})]).then(([$,X])=>B($,X));else return B(this._def.left._parseSync({data:E.data,path:E.path,parent:E}),this._def.right._parseSync({data:E.data,path:E.path,parent:E}))}}S2.create=(D,F,E)=>{return new S2({left:D,right:F,typeName:S.ZodIntersection,...T(E)})};class zD extends f{_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==A.array)return C(E,{code:W.invalid_type,expected:A.array,received:E.parsedType}),N;if(E.data.length<this._def.items.length)return C(E,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),N;if(!this._def.rest&&E.data.length>this._def.items.length)C(E,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let $=[...E.data].map((X,Q)=>{let J=this._def.items[Q]||this._def.rest;if(!J)return null;return J._parse(new HD(E,X,E.path,Q))}).filter((X)=>!!X);if(E.common.async)return Promise.all($).then((X)=>{return a.mergeArray(F,X)});else return a.mergeArray(F,$)}get items(){return this._def.items}rest(D){return new zD({...this._def,rest:D})}}zD.create=(D,F)=>{if(!Array.isArray(D))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new zD({items:D,typeName:S.ZodTuple,rest:null,...T(F)})};class s2 extends f{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==A.object)return C(E,{code:W.invalid_type,expected:A.object,received:E.parsedType}),N;let B=[],$=this._def.keyType,X=this._def.valueType;for(let Q in E.data)B.push({key:$._parse(new HD(E,Q,E.path,Q)),value:X._parse(new HD(E,E.data[Q],E.path,Q)),alwaysSet:Q in E.data});if(E.common.async)return a.mergeObjectAsync(F,B);else return a.mergeObjectSync(F,B)}get element(){return this._def.valueType}static create(D,F,E){if(F instanceof f)return new s2({keyType:D,valueType:F,typeName:S.ZodRecord,...T(E)});return new s2({keyType:JD.create(),valueType:D,typeName:S.ZodRecord,...T(F)})}}class t2 extends f{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==A.map)return C(E,{code:W.invalid_type,expected:A.map,received:E.parsedType}),N;let B=this._def.keyType,$=this._def.valueType,X=[...E.data.entries()].map(([Q,J],Y)=>{return{key:B._parse(new HD(E,Q,E.path,[Y,"key"])),value:$._parse(new HD(E,J,E.path,[Y,"value"]))}});if(E.common.async){let Q=new Map;return Promise.resolve().then(async()=>{for(let J of X){let Y=await J.key,q=await J.value;if(Y.status==="aborted"||q.status==="aborted")return N;if(Y.status==="dirty"||q.status==="dirty")F.dirty();Q.set(Y.value,q.value)}return{status:F.value,value:Q}})}else{let Q=new Map;for(let J of X){let{key:Y,value:q}=J;if(Y.status==="aborted"||q.status==="aborted")return N;if(Y.status==="dirty"||q.status==="dirty")F.dirty();Q.set(Y.value,q.value)}return{status:F.value,value:Q}}}}t2.create=(D,F,E)=>{return new t2({valueType:F,keyType:D,typeName:S.ZodMap,...T(E)})};class sD extends f{_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==A.set)return C(E,{code:W.invalid_type,expected:A.set,received:E.parsedType}),N;let B=this._def;if(B.minSize!==null){if(E.data.size<B.minSize.value)C(E,{code:W.too_small,minimum:B.minSize.value,type:"set",inclusive:!0,exact:!1,message:B.minSize.message}),F.dirty()}if(B.maxSize!==null){if(E.data.size>B.maxSize.value)C(E,{code:W.too_big,maximum:B.maxSize.value,type:"set",inclusive:!0,exact:!1,message:B.maxSize.message}),F.dirty()}let $=this._def.valueType;function X(J){let Y=new Set;for(let q of J){if(q.status==="aborted")return N;if(q.status==="dirty")F.dirty();Y.add(q.value)}return{status:F.value,value:Y}}let Q=[...E.data.values()].map((J,Y)=>$._parse(new HD(E,J,E.path,Y)));if(E.common.async)return Promise.all(Q).then((J)=>X(J));else return X(Q)}min(D,F){return new sD({...this._def,minSize:{value:D,message:V.toString(F)}})}max(D,F){return new sD({...this._def,maxSize:{value:D,message:V.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}}sD.create=(D,F)=>{return new sD({valueType:D,minSize:null,maxSize:null,typeName:S.ZodSet,...T(F)})};class L2 extends f{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==A.function)return C(F,{code:W.invalid_type,expected:A.function,received:F.parsedType}),N;function E(Q,J){return r2({data:Q,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,V2(),SD].filter((Y)=>!!Y),issueData:{code:W.invalid_arguments,argumentsError:J}})}function B(Q,J){return r2({data:Q,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,V2(),SD].filter((Y)=>!!Y),issueData:{code:W.invalid_return_type,returnTypeError:J}})}let $={errorMap:F.common.contextualErrorMap},X=F.data;if(this._def.returns instanceof tD){let Q=this;return o(async function(...J){let Y=new e([]),q=await Q._def.args.parseAsync(J,$).catch((G)=>{throw Y.addIssue(E(J,G)),Y}),H=await Reflect.apply(X,this,q);return await Q._def.returns._def.type.parseAsync(H,$).catch((G)=>{throw Y.addIssue(B(H,G)),Y})})}else{let Q=this;return o(function(...J){let Y=Q._def.args.safeParse(J,$);if(!Y.success)throw new e([E(J,Y.error)]);let q=Reflect.apply(X,this,Y.data),H=Q._def.returns.safeParse(q,$);if(!H.success)throw new e([B(q,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new L2({...this._def,args:zD.create(D).rest(kD.create())})}returns(D){return new L2({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,E){return new L2({args:D?D:zD.create([]).rest(kD.create()),returns:F||kD.create(),typeName:S.ZodFunction,...T(E)})}}class T2 extends f{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})}}T2.create=(D,F)=>{return new T2({getter:D,typeName:S.ZodLazy,...T(F)})};class b2 extends f{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return C(F,{received:F.data,code:W.invalid_literal,expected:this._def.value}),N}return{status:"valid",value:D.data}}get value(){return this._def.value}}b2.create=(D,F)=>{return new b2({value:D,typeName:S.ZodLiteral,...T(F)})};function U6(D,F){return new gD({values:D,typeName:S.ZodEnum,...T(F)})}class gD extends f{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),E=this._def.values;return C(F,{expected:Z.joinValues(E),received:F.parsedType,code:W.invalid_type}),N}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(D.data)){let F=this._getOrReturnCtx(D),E=this._def.values;return C(F,{received:F.data,code:W.invalid_enum_value,options:E}),N}return o(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 gD.create(D,{...this._def,...F})}exclude(D,F=this._def){return gD.create(this.options.filter((E)=>!D.includes(E)),{...this._def,...F})}}gD.create=U6;class P2 extends f{_parse(D){let F=Z.getValidEnumValues(this._def.values),E=this._getOrReturnCtx(D);if(E.parsedType!==A.string&&E.parsedType!==A.number){let B=Z.objectValues(F);return C(E,{expected:Z.joinValues(B),received:E.parsedType,code:W.invalid_type}),N}if(!this._cache)this._cache=new Set(Z.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let B=Z.objectValues(F);return C(E,{received:E.data,code:W.invalid_enum_value,options:B}),N}return o(D.data)}get enum(){return this._def.values}}P2.create=(D,F)=>{return new P2({values:D,typeName:S.ZodNativeEnum,...T(F)})};class tD extends f{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==A.promise&&F.common.async===!1)return C(F,{code:W.invalid_type,expected:A.promise,received:F.parsedType}),N;let E=F.parsedType===A.promise?F.data:Promise.resolve(F.data);return o(E.then((B)=>{return this._def.type.parseAsync(B,{path:F.path,errorMap:F.common.contextualErrorMap})}))}}tD.create=(D,F)=>{return new tD({type:D,typeName:S.ZodPromise,...T(F)})};class _D extends f{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(D){let{status:F,ctx:E}=this._processInputParams(D),B=this._def.effect||null,$={addIssue:(X)=>{if(C(E,X),X.fatal)F.abort();else F.dirty()},get path(){return E.path}};if($.addIssue=$.addIssue.bind($),B.type==="preprocess"){let X=B.transform(E.data,$);if(E.common.async)return Promise.resolve(X).then(async(Q)=>{if(F.value==="aborted")return N;let J=await this._def.schema._parseAsync({data:Q,path:E.path,parent:E});if(J.status==="aborted")return N;if(J.status==="dirty")return rD(J.value);if(F.value==="dirty")return rD(J.value);return J});else{if(F.value==="aborted")return N;let Q=this._def.schema._parseSync({data:X,path:E.path,parent:E});if(Q.status==="aborted")return N;if(Q.status==="dirty")return rD(Q.value);if(F.value==="dirty")return rD(Q.value);return Q}}if(B.type==="refinement"){let X=(Q)=>{let J=B.refinement(Q,$);if(E.common.async)return Promise.resolve(J);if(J instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Q};if(E.common.async===!1){let Q=this._def.schema._parseSync({data:E.data,path:E.path,parent:E});if(Q.status==="aborted")return N;if(Q.status==="dirty")F.dirty();return X(Q.value),{status:F.value,value:Q.value}}else return this._def.schema._parseAsync({data:E.data,path:E.path,parent:E}).then((Q)=>{if(Q.status==="aborted")return N;if(Q.status==="dirty")F.dirty();return X(Q.value).then(()=>{return{status:F.value,value:Q.value}})})}if(B.type==="transform")if(E.common.async===!1){let X=this._def.schema._parseSync({data:E.data,path:E.path,parent:E});if(!xD(X))return N;let Q=B.transform(X.value,$);if(Q instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:Q}}else return this._def.schema._parseAsync({data:E.data,path:E.path,parent:E}).then((X)=>{if(!xD(X))return N;return Promise.resolve(B.transform(X.value,$)).then((Q)=>({status:F.value,value:Q}))});Z.assertNever(B)}}_D.create=(D,F,E)=>{return new _D({schema:D,typeName:S.ZodEffects,effect:F,...T(E)})};_D.createWithPreprocess=(D,F,E)=>{return new _D({schema:F,effect:{type:"preprocess",transform:D},typeName:S.ZodEffects,...T(E)})};class qD extends f{_parse(D){if(this._getType(D)===A.undefined)return o(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}qD.create=(D,F)=>{return new qD({innerType:D,typeName:S.ZodOptional,...T(F)})};class bD extends f{_parse(D){if(this._getType(D)===A.null)return o(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}bD.create=(D,F)=>{return new bD({innerType:D,typeName:S.ZodNullable,...T(F)})};class f2 extends f{_parse(D){let{ctx:F}=this._processInputParams(D),E=F.data;if(F.parsedType===A.undefined)E=this._def.defaultValue();return this._def.innerType._parse({data:E,path:F.path,parent:F})}removeDefault(){return this._def.innerType}}f2.create=(D,F)=>{return new f2({innerType:D,typeName:S.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...T(F)})};class Z2 extends f{_parse(D){let{ctx:F}=this._processInputParams(D),E={...F,common:{...F.common,issues:[]}},B=this._def.innerType._parse({data:E.data,path:E.path,parent:{...E}});if(K2(B))return B.then(($)=>{return{status:"valid",value:$.status==="valid"?$.value:this._def.catchValue({get error(){return new e(E.common.issues)},input:E.data})}});else return{status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new e(E.common.issues)},input:E.data})}}removeCatch(){return this._def.innerType}}Z2.create=(D,F)=>{return new Z2({innerType:D,typeName:S.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...T(F)})};class e2 extends f{_parse(D){if(this._getType(D)!==A.nan){let E=this._getOrReturnCtx(D);return C(E,{code:W.invalid_type,expected:A.nan,received:E.parsedType}),N}return{status:"valid",value:D.data}}}e2.create=(D)=>{return new e2({typeName:S.ZodNaN,...T(D)})};var g7=Symbol("zod_brand");class b0 extends f{_parse(D){let{ctx:F}=this._processInputParams(D),E=F.data;return this._def.type._parse({data:E,path:F.path,parent:F})}unwrap(){return this._def.type}}class D0 extends f{_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.common.async)return(async()=>{let $=await this._def.in._parseAsync({data:E.data,path:E.path,parent:E});if($.status==="aborted")return N;if($.status==="dirty")return F.dirty(),rD($.value);else return this._def.out._parseAsync({data:$.value,path:E.path,parent:E})})();else{let B=this._def.in._parseSync({data:E.data,path:E.path,parent:E});if(B.status==="aborted")return N;if(B.status==="dirty")return F.dirty(),{status:"dirty",value:B.value};else return this._def.out._parseSync({data:B.value,path:E.path,parent:E})}}static create(D,F){return new D0({in:D,out:F,typeName:S.ZodPipeline})}}class I2 extends f{_parse(D){let F=this._def.innerType._parse(D),E=(B)=>{if(xD(B))B.value=Object.freeze(B.value);return B};return K2(F)?F.then((B)=>E(B)):E(F)}unwrap(){return this._def.innerType}}I2.create=(D,F)=>{return new I2({innerType:D,typeName:S.ZodReadonly,...T(F)})};function H6(D,F){let E=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof E==="string"?{message:E}:E}function A6(D,F={},E){if(D)return oD.create().superRefine((B,$)=>{let X=D(B);if(X instanceof Promise)return X.then((Q)=>{if(!Q){let J=H6(F,B),Y=J.fatal??E??!0;$.addIssue({code:"custom",...J,fatal:Y})}});if(!X){let Q=H6(F,B),J=Q.fatal??E??!0;$.addIssue({code:"custom",...Q,fatal:J})}return});return oD.create()}var l7={object:g.lazycreate},S;(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"})(S||(S={}));var m7=(D,F={message:`Input not instance of ${D.name}`})=>A6((E)=>E instanceof D,F),C6=JD.create,z6=yD.create,c7=e2.create,p7=hD.create,V6=j2.create,d7=aD.create,i7=a2.create,n7=M2.create,r7=O2.create,a7=oD.create,o7=kD.create,s7=CD.create,t7=o2.create,e7=YD.create,D9=g.create,F9=g.strictCreate,E9=N2.create,B9=T0.create,$9=S2.create,X9=zD.create,Q9=s2.create,J9=t2.create,Y9=sD.create,q9=L2.create,H9=T2.create,_9=b2.create,G9=gD.create,W9=P2.create,U9=tD.create,A9=_D.create,C9=qD.create,z9=bD.create,V9=_D.createWithPreprocess,K9=D0.create,R9=()=>C6().optional(),L9=()=>z6().optional(),j9=()=>V6().optional(),M9={string:(D)=>JD.create({...D,coerce:!0}),number:(D)=>yD.create({...D,coerce:!0}),boolean:(D)=>j2.create({...D,coerce:!0}),bigint:(D)=>hD.create({...D,coerce:!0}),date:(D)=>aD.create({...D,coerce:!0})};var O9=N;var N9=w.object({name:w.string().default("genie"),defaultWindow:w.string().default("shell"),autoCreate:w.boolean().default(!0)}),S9=w.object({execTimeout:w.number().default(120000),readLines:w.number().default(100),worktreeBase:w.string().default(".worktrees")}),T9=w.object({tmuxDebug:w.boolean().default(!1),verbose:w.boolean().default(!1)}),b9=w.object({preference:w.enum(["auto","zsh","bash","fish"]).default("auto")}),P9=w.object({tmuxInstalled:w.boolean().default(!1),shellInstalled:w.boolean().default(!1)}),f9=w.object({enabled:w.boolean().default(!1)}),GD=w.object({version:w.number().default(2),session:N9.default({}),terminal:S9.default({}),logging:T9.default({}),shell:b9.default({}),shortcuts:P9.default({}),claudio:f9.optional(),installMethod:w.enum(["source","npm","bun"]).optional(),setupComplete:w.boolean().default(!1),lastSetupAt:w.string().optional()}),K6=w.object({session:w.object({name:w.string().default("genie"),defaultWindow:w.string().default("shell")}).default({}),logging:w.object({tmuxDebug:w.boolean().default(!1)}).default({}),installMethod:w.enum(["source","npm","bun"]).optional()});var P0=j6(L6(),".genie"),eD=j6(P0,"config.json"),R3=2;function m$(){return P0}function c$(){return eD}function w9(){return f0(eD)}function v9(){if(!f0(P0))Z9(P0,{recursive:!0})}function M6(D){let F=K6.safeParse(D);if(F.success){let E=F.data;return GD.parse({version:R3,session:{name:E.session.name,defaultWindow:E.session.defaultWindow,autoCreate:!0},terminal:{execTimeout:120000,readLines:100,worktreeBase:".worktrees"},logging:{tmuxDebug:E.logging.tmuxDebug,verbose:!1},shell:{preference:"auto"},shortcuts:{tmuxInstalled:!1,shellInstalled:!1},installMethod:E.installMethod,setupComplete:!1})}return GD.parse({})}async function O6(){if(!f0(eD))return GD.parse({});try{let D=R6(eD,"utf-8"),F=JSON.parse(D);if(!F.version||F.version<R3){let E=M6(F);return await Z0(E),E}return GD.parse(F)}catch(D){return console.warn(`Warning: Invalid genie config, using defaults: ${D.message}`),GD.parse({})}}async function Z0(D){v9();try{let F=GD.parse(D),E=JSON.stringify(F,null,2);I9(eD,E,"utf-8")}catch(F){throw Error(`Failed to save genie config: ${F.message}`)}}function u9(){return GD.parse({})}function N6(){if(!f0(eD))return GD.parse({});try{let D=R6(eD,"utf-8"),F=JSON.parse(D);if(!F.version||F.version<R3)return M6(F);return GD.parse(F)}catch{return GD.parse({})}}function p$(D){let F=L6();if(D.startsWith(F+"/"))return"~"+D.slice(F.length);if(D===F)return"~";return D}function I0(){return N6().terminal}function d$(){if(!w9())return!1;return N6().setupComplete??!1}async function i$(){let D=await O6();D.setupComplete=!0,D.lastSetupAt=new Date().toISOString(),await Z0(D)}async function n$(){let D=u9();await Z0(D)}async function r$(D){let F=await O6();F.shortcuts={...F.shortcuts,...D},await Z0(F)}async function S6(D,F){try{let B=I0().readLines,$={lines:F.lines?parseInt(F.lines,10):B,from:F.from?parseInt(F.from,10):void 0,to:F.to?parseInt(F.to,10):void 0,range:F.range,search:F.search,grep:F.grep,follow:F.follow,all:F.all,reverse:F.reverse};if(F.follow){console.log(`Following session "${D}" (Ctrl+C to stop)...`),console.log("");let Q=await J6(D,(J)=>{console.log(J)});process.on("SIGINT",()=>{Q(),console.log(`
|
|
48
|
+
`);return q}async function J6(D,F){let E=await w(D);if(!E)throw Error(`Session "${D}" not found`);let B=await x(E.id);if(!B||B.length===0)throw Error(`No windows found in session "${D}"`);let $=B.find((_)=>_.active)||B[0],X=await h($.id);if(!X||X.length===0)throw Error(`No panes found in session "${D}"`);let J=(X.find((_)=>_.active)||X[0]).id,Y="",q=!0,H=setInterval(async()=>{if(!q){clearInterval(H);return}try{let _=await p(J,100),G=n2(_);if(G!==Y){let U=G.split(`
|
|
49
|
+
`),z=Y.split(`
|
|
50
|
+
`),L=z.length>0?z.length-1:0;U.slice(L).forEach((j)=>{if(j&&j!==z[z.length-1])F(j)}),Y=G}}catch(_){clearInterval(H),q=!1}},500);return()=>{q=!1,clearInterval(H)}}import{existsSync as f0,mkdirSync as Z9,readFileSync as R6,writeFileSync as I9}from"fs";import{homedir as L6}from"os";import{join as j6}from"path";var v={};N8(v,{void:()=>t7,util:()=>Z,unknown:()=>o7,union:()=>E9,undefined:()=>n7,tuple:()=>X9,transformer:()=>A9,symbol:()=>i7,string:()=>C6,strictObject:()=>F9,setErrorMap:()=>z7,set:()=>Y9,record:()=>Q9,quotelessJson:()=>A7,promise:()=>U9,preprocess:()=>V9,pipeline:()=>K9,ostring:()=>R9,optional:()=>C9,onumber:()=>L9,oboolean:()=>j9,objectUtil:()=>z3,object:()=>D9,number:()=>z6,nullable:()=>z9,null:()=>r7,never:()=>s7,nativeEnum:()=>W9,nan:()=>c7,map:()=>J9,makeIssue:()=>r2,literal:()=>_9,lazy:()=>H9,late:()=>l7,isValid:()=>xD,isDirty:()=>S0,isAsync:()=>K2,isAborted:()=>N0,intersection:()=>$9,instanceof:()=>m7,getParsedType:()=>AD,getErrorMap:()=>V2,function:()=>q9,enum:()=>G9,effect:()=>A9,discriminatedUnion:()=>B9,defaultErrorMap:()=>SD,datetimeRegex:()=>W6,date:()=>d7,custom:()=>A6,coerce:()=>M9,boolean:()=>V6,bigint:()=>p7,array:()=>e7,any:()=>a7,addIssueToContext:()=>C,ZodVoid:()=>o2,ZodUnknown:()=>kD,ZodUnion:()=>N2,ZodUndefined:()=>M2,ZodType:()=>f,ZodTuple:()=>zD,ZodTransformer:()=>_D,ZodSymbol:()=>a2,ZodString:()=>JD,ZodSet:()=>sD,ZodSchema:()=>f,ZodRecord:()=>s2,ZodReadonly:()=>I2,ZodPromise:()=>tD,ZodPipeline:()=>D0,ZodParsedType:()=>A,ZodOptional:()=>qD,ZodObject:()=>g,ZodNumber:()=>yD,ZodNullable:()=>bD,ZodNull:()=>O2,ZodNever:()=>CD,ZodNativeEnum:()=>P2,ZodNaN:()=>e2,ZodMap:()=>t2,ZodLiteral:()=>b2,ZodLazy:()=>T2,ZodIssueCode:()=>W,ZodIntersection:()=>S2,ZodFunction:()=>L2,ZodFirstPartyTypeKind:()=>S,ZodError:()=>e,ZodEnum:()=>gD,ZodEffects:()=>_D,ZodDiscriminatedUnion:()=>T0,ZodDefault:()=>f2,ZodDate:()=>aD,ZodCatch:()=>Z2,ZodBranded:()=>b0,ZodBoolean:()=>j2,ZodBigInt:()=>hD,ZodArray:()=>YD,ZodAny:()=>oD,Schema:()=>f,ParseStatus:()=>a,OK:()=>o,NEVER:()=>O9,INVALID:()=>N,EMPTY_PATH:()=>V7,DIRTY:()=>rD,BRAND:()=>g7});var Z;(function(D){D.assertEqual=($)=>{};function F($){}D.assertIs=F;function E($){throw Error()}D.assertNever=E,D.arrayToEnum=($)=>{let X={};for(let Q of $)X[Q]=Q;return X},D.getValidEnumValues=($)=>{let X=D.objectKeys($).filter((J)=>typeof $[$[J]]!=="number"),Q={};for(let J of X)Q[J]=$[J];return D.objectValues(Q)},D.objectValues=($)=>{return D.objectKeys($).map(function(X){return $[X]})},D.objectKeys=typeof Object.keys==="function"?($)=>Object.keys($):($)=>{let X=[];for(let Q in $)if(Object.prototype.hasOwnProperty.call($,Q))X.push(Q);return X},D.find=($,X)=>{for(let Q of $)if(X(Q))return Q;return},D.isInteger=typeof Number.isInteger==="function"?($)=>Number.isInteger($):($)=>typeof $==="number"&&Number.isFinite($)&&Math.floor($)===$;function B($,X=" | "){return $.map((Q)=>typeof Q==="string"?`'${Q}'`:Q).join(X)}D.joinValues=B,D.jsonStringifyReplacer=($,X)=>{if(typeof X==="bigint")return X.toString();return X}})(Z||(Z={}));var z3;(function(D){D.mergeShapes=(F,E)=>{return{...F,...E}}})(z3||(z3={}));var A=Z.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),AD=(D)=>{switch(typeof D){case"undefined":return A.undefined;case"string":return A.string;case"number":return Number.isNaN(D)?A.nan:A.number;case"boolean":return A.boolean;case"function":return A.function;case"bigint":return A.bigint;case"symbol":return A.symbol;case"object":if(Array.isArray(D))return A.array;if(D===null)return A.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return A.promise;if(typeof Map<"u"&&D instanceof Map)return A.map;if(typeof Set<"u"&&D instanceof Set)return A.set;if(typeof Date<"u"&&D instanceof Date)return A.date;return A.object;default:return A.unknown}};var W=Z.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"]),A7=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")};class e extends Error{get errors(){return this.issues}constructor(D){super();this.issues=[],this.addIssue=(E)=>{this.issues=[...this.issues,E]},this.addIssues=(E=[])=>{this.issues=[...this.issues,...E]};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},E={_errors:[]},B=($)=>{for(let X of $.issues)if(X.code==="invalid_union")X.unionErrors.map(B);else if(X.code==="invalid_return_type")B(X.returnTypeError);else if(X.code==="invalid_arguments")B(X.argumentsError);else if(X.path.length===0)E._errors.push(F(X));else{let Q=E,J=0;while(J<X.path.length){let Y=X.path[J];if(J!==X.path.length-1)Q[Y]=Q[Y]||{_errors:[]};else Q[Y]=Q[Y]||{_errors:[]},Q[Y]._errors.push(F(X));Q=Q[Y],J++}}};return B(this),E}static assert(D){if(!(D instanceof e))throw Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Z.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(D=(F)=>F.message){let F={},E=[];for(let B of this.issues)if(B.path.length>0){let $=B.path[0];F[$]=F[$]||[],F[$].push(D(B))}else E.push(D(B));return{formErrors:E,fieldErrors:F}}get formErrors(){return this.flatten()}}e.create=(D)=>{return new e(D)};var C7=(D,F)=>{let E;switch(D.code){case W.invalid_type:if(D.received===A.undefined)E="Required";else E=`Expected ${D.expected}, received ${D.received}`;break;case W.invalid_literal:E=`Invalid literal value, expected ${JSON.stringify(D.expected,Z.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:E=`Unrecognized key(s) in object: ${Z.joinValues(D.keys,", ")}`;break;case W.invalid_union:E="Invalid input";break;case W.invalid_union_discriminator:E=`Invalid discriminator value. Expected ${Z.joinValues(D.options)}`;break;case W.invalid_enum_value:E=`Invalid enum value. Expected ${Z.joinValues(D.options)}, received '${D.received}'`;break;case W.invalid_arguments:E="Invalid function arguments";break;case W.invalid_return_type:E="Invalid function return type";break;case W.invalid_date:E="Invalid date";break;case W.invalid_string:if(typeof D.validation==="object")if("includes"in D.validation){if(E=`Invalid input: must include "${D.validation.includes}"`,typeof D.validation.position==="number")E=`${E} at one or more positions greater than or equal to ${D.validation.position}`}else if("startsWith"in D.validation)E=`Invalid input: must start with "${D.validation.startsWith}"`;else if("endsWith"in D.validation)E=`Invalid input: must end with "${D.validation.endsWith}"`;else Z.assertNever(D.validation);else if(D.validation!=="regex")E=`Invalid ${D.validation}`;else E="Invalid";break;case W.too_small:if(D.type==="array")E=`Array must contain ${D.exact?"exactly":D.inclusive?"at least":"more than"} ${D.minimum} element(s)`;else if(D.type==="string")E=`String must contain ${D.exact?"exactly":D.inclusive?"at least":"over"} ${D.minimum} character(s)`;else if(D.type==="number")E=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="bigint")E=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="date")E=`Date must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(D.minimum))}`;else E="Invalid input";break;case W.too_big:if(D.type==="array")E=`Array must contain ${D.exact?"exactly":D.inclusive?"at most":"less than"} ${D.maximum} element(s)`;else if(D.type==="string")E=`String must contain ${D.exact?"exactly":D.inclusive?"at most":"under"} ${D.maximum} character(s)`;else if(D.type==="number")E=`Number must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="bigint")E=`BigInt must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="date")E=`Date must be ${D.exact?"exactly":D.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(D.maximum))}`;else E="Invalid input";break;case W.custom:E="Invalid input";break;case W.invalid_intersection_types:E="Intersection results could not be merged";break;case W.not_multiple_of:E=`Number must be a multiple of ${D.multipleOf}`;break;case W.not_finite:E="Number must be finite";break;default:E=F.defaultError,Z.assertNever(D)}return{message:E}},SD=C7;var Y6=SD;function z7(D){Y6=D}function V2(){return Y6}var r2=(D)=>{let{data:F,path:E,errorMaps:B,issueData:$}=D,X=[...E,...$.path||[]],Q={...$,path:X};if($.message!==void 0)return{...$,path:X,message:$.message};let J="",Y=B.filter((q)=>!!q).slice().reverse();for(let q of Y)J=q(Q,{data:F,defaultError:J}).message;return{...$,path:X,message:J}},V7=[];function C(D,F){let E=V2(),B=r2({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,E,E===SD?void 0:SD].filter(($)=>!!$)});D.common.issues.push(B)}class a{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 E=[];for(let B of F){if(B.status==="aborted")return N;if(B.status==="dirty")D.dirty();E.push(B.value)}return{status:D.value,value:E}}static async mergeObjectAsync(D,F){let E=[];for(let B of F){let $=await B.key,X=await B.value;E.push({key:$,value:X})}return a.mergeObjectSync(D,E)}static mergeObjectSync(D,F){let E={};for(let B of F){let{key:$,value:X}=B;if($.status==="aborted")return N;if(X.status==="aborted")return N;if($.status==="dirty")D.dirty();if(X.status==="dirty")D.dirty();if($.value!=="__proto__"&&(typeof X.value<"u"||B.alwaysSet))E[$.value]=X.value}return{status:D.value,value:E}}}var N=Object.freeze({status:"aborted"}),rD=(D)=>({status:"dirty",value:D}),o=(D)=>({status:"valid",value:D}),N0=(D)=>D.status==="aborted",S0=(D)=>D.status==="dirty",xD=(D)=>D.status==="valid",K2=(D)=>typeof Promise<"u"&&D instanceof Promise;var K;(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(K||(K={}));class HD{constructor(D,F,E,B){this._cachedPath=[],this.parent=D,this.data=F,this._path=E,this._key=B}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 q6=(D,F)=>{if(xD(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 E=new e(D.common.issues);return this._error=E,this._error}}}};function T(D){if(!D)return{};let{errorMap:F,invalid_type_error:E,required_error:B,description:$}=D;if(F&&(E||B))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:(Q,J)=>{let{message:Y}=D;if(Q.code==="invalid_enum_value")return{message:Y??J.defaultError};if(typeof J.data>"u")return{message:Y??B??J.defaultError};if(Q.code!=="invalid_type")return{message:J.defaultError};return{message:Y??E??J.defaultError}},description:$}}class f{get description(){return this._def.description}_getType(D){return AD(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:AD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new a,ctx:{common:D.parent.common,data:D.data,parsedType:AD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(K2(F))throw Error("Synchronous parse encountered promise.");return F}_parseAsync(D){let F=this._parse(D);return Promise.resolve(F)}parse(D,F){let E=this.safeParse(D,F);if(E.success)return E.data;throw E.error}safeParse(D,F){let E={common:{issues:[],async:F?.async??!1,contextualErrorMap:F?.errorMap},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:AD(D)},B=this._parseSync({data:D,path:E.path,parent:E});return q6(E,B)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:AD(D)};if(!this["~standard"].async)try{let E=this._parseSync({data:D,path:[],parent:F});return xD(E)?{value:E.value}:{issues:F.common.issues}}catch(E){if(E?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;F.common={issues:[],async:!0}}return this._parseAsync({data:D,path:[],parent:F}).then((E)=>xD(E)?{value:E.value}:{issues:F.common.issues})}async parseAsync(D,F){let E=await this.safeParseAsync(D,F);if(E.success)return E.data;throw E.error}async safeParseAsync(D,F){let E={common:{issues:[],contextualErrorMap:F?.errorMap,async:!0},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:AD(D)},B=this._parse({data:D,path:E.path,parent:E}),$=await(K2(B)?B:Promise.resolve(B));return q6(E,$)}refine(D,F){let E=(B)=>{if(typeof F==="string"||typeof F>"u")return{message:F};else if(typeof F==="function")return F(B);else return F};return this._refinement((B,$)=>{let X=D(B),Q=()=>$.addIssue({code:W.custom,...E(B)});if(typeof Promise<"u"&&X instanceof Promise)return X.then((J)=>{if(!J)return Q(),!1;else return!0});if(!X)return Q(),!1;else return!0})}refinement(D,F){return this._refinement((E,B)=>{if(!D(E))return B.addIssue(typeof F==="function"?F(E,B):F),!1;else return!0})}_refinement(D){return new _D({schema:this,typeName:S.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 qD.create(this,this._def)}nullable(){return bD.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return YD.create(this)}promise(){return tD.create(this,this._def)}or(D){return N2.create([this,D],this._def)}and(D){return S2.create(this,D,this._def)}transform(D){return new _D({...T(this._def),schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new f2({...T(this._def),innerType:this,defaultValue:F,typeName:S.ZodDefault})}brand(){return new b0({typeName:S.ZodBranded,type:this,...T(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new Z2({...T(this._def),innerType:this,catchValue:F,typeName:S.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return D0.create(this,D)}readonly(){return I2.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var K7=/^c[^\s-]{8,}$/i,R7=/^[0-9a-z]+$/,L7=/^[0-9A-HJKMNP-TV-Z]{26}$/i,j7=/^[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,M7=/^[a-z0-9_-]{21}$/i,O7=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,N7=/^[-+]?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)?)??$/,S7=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,T7="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",V3,b7=/^(?:(?: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])$/,P7=/^(?:(?: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])$/,f7=/^(([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]))$/,Z7=/^(([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])$/,I7=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,v7=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_6="((\\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])))",w7=new RegExp(`^${_6}$`);function G6(D){let F="[0-5]\\d";if(D.precision)F=`${F}\\.\\d{${D.precision}}`;else if(D.precision==null)F=`${F}(\\.\\d+)?`;let E=D.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${F})${E}`}function u7(D){return new RegExp(`^${G6(D)}$`)}function W6(D){let F=`${_6}T${G6(D)}`,E=[];if(E.push(D.local?"Z?":"Z"),D.offset)E.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${E.join("|")})`,new RegExp(`^${F}$`)}function x7(D,F){if((F==="v4"||!F)&&b7.test(D))return!0;if((F==="v6"||!F)&&f7.test(D))return!0;return!1}function k7(D,F){if(!O7.test(D))return!1;try{let[E]=D.split(".");if(!E)return!1;let B=E.replace(/-/g,"+").replace(/_/g,"/").padEnd(E.length+(4-E.length%4)%4,"="),$=JSON.parse(atob(B));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 y7(D,F){if((F==="v4"||!F)&&P7.test(D))return!0;if((F==="v6"||!F)&&Z7.test(D))return!0;return!1}class JD extends f{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==A.string){let $=this._getOrReturnCtx(D);return C($,{code:W.invalid_type,expected:A.string,received:$.parsedType}),N}let E=new a,B=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(D.data.length<$.value)B=this._getOrReturnCtx(D,B),C(B,{code:W.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),E.dirty()}else if($.kind==="max"){if(D.data.length>$.value)B=this._getOrReturnCtx(D,B),C(B,{code:W.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),E.dirty()}else if($.kind==="length"){let X=D.data.length>$.value,Q=D.data.length<$.value;if(X||Q){if(B=this._getOrReturnCtx(D,B),X)C(B,{code:W.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});else if(Q)C(B,{code:W.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});E.dirty()}}else if($.kind==="email"){if(!S7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"email",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="emoji"){if(!V3)V3=new RegExp(T7,"u");if(!V3.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"emoji",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="uuid"){if(!j7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"uuid",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="nanoid"){if(!M7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"nanoid",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="cuid"){if(!K7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"cuid",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="cuid2"){if(!R7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"cuid2",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="ulid"){if(!L7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"ulid",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="url")try{new URL(D.data)}catch{B=this._getOrReturnCtx(D,B),C(B,{validation:"url",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="regex"){if($.regex.lastIndex=0,!$.regex.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"regex",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="trim")D.data=D.data.trim();else if($.kind==="includes"){if(!D.data.includes($.value,$.position))B=this._getOrReturnCtx(D,B),C(B,{code:W.invalid_string,validation:{includes:$.value,position:$.position},message:$.message}),E.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))B=this._getOrReturnCtx(D,B),C(B,{code:W.invalid_string,validation:{startsWith:$.value},message:$.message}),E.dirty()}else if($.kind==="endsWith"){if(!D.data.endsWith($.value))B=this._getOrReturnCtx(D,B),C(B,{code:W.invalid_string,validation:{endsWith:$.value},message:$.message}),E.dirty()}else if($.kind==="datetime"){if(!W6($).test(D.data))B=this._getOrReturnCtx(D,B),C(B,{code:W.invalid_string,validation:"datetime",message:$.message}),E.dirty()}else if($.kind==="date"){if(!w7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{code:W.invalid_string,validation:"date",message:$.message}),E.dirty()}else if($.kind==="time"){if(!u7($).test(D.data))B=this._getOrReturnCtx(D,B),C(B,{code:W.invalid_string,validation:"time",message:$.message}),E.dirty()}else if($.kind==="duration"){if(!N7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"duration",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="ip"){if(!x7(D.data,$.version))B=this._getOrReturnCtx(D,B),C(B,{validation:"ip",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="jwt"){if(!k7(D.data,$.alg))B=this._getOrReturnCtx(D,B),C(B,{validation:"jwt",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="cidr"){if(!y7(D.data,$.version))B=this._getOrReturnCtx(D,B),C(B,{validation:"cidr",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="base64"){if(!I7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"base64",code:W.invalid_string,message:$.message}),E.dirty()}else if($.kind==="base64url"){if(!v7.test(D.data))B=this._getOrReturnCtx(D,B),C(B,{validation:"base64url",code:W.invalid_string,message:$.message}),E.dirty()}else Z.assertNever($);return{status:E.value,value:D.data}}_regex(D,F,E){return this.refinement((B)=>D.test(B),{validation:F,code:W.invalid_string,...K.errToObj(E)})}_addCheck(D){return new JD({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",...K.errToObj(D)})}url(D){return this._addCheck({kind:"url",...K.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",...K.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",...K.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",...K.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",...K.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",...K.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",...K.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",...K.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",...K.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",...K.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",...K.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",...K.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,...K.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,...K.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",...K.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,...K.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,...K.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,...K.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,...K.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,...K.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,...K.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,...K.errToObj(F)})}nonempty(D){return this.min(1,K.errToObj(D))}trim(){return new JD({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new JD({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new JD({...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}}JD.create=(D)=>{return new JD({checks:[],typeName:S.ZodString,coerce:D?.coerce??!1,...T(D)})};function h7(D,F){let E=(D.toString().split(".")[1]||"").length,B=(F.toString().split(".")[1]||"").length,$=E>B?E:B,X=Number.parseInt(D.toFixed($).replace(".","")),Q=Number.parseInt(F.toFixed($).replace(".",""));return X%Q/10**$}class yD extends f{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)!==A.number){let $=this._getOrReturnCtx(D);return C($,{code:W.invalid_type,expected:A.number,received:$.parsedType}),N}let E=void 0,B=new a;for(let $ of this._def.checks)if($.kind==="int"){if(!Z.isInteger(D.data))E=this._getOrReturnCtx(D,E),C(E,{code:W.invalid_type,expected:"integer",received:"float",message:$.message}),B.dirty()}else if($.kind==="min"){if($.inclusive?D.data<$.value:D.data<=$.value)E=this._getOrReturnCtx(D,E),C(E,{code:W.too_small,minimum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),B.dirty()}else if($.kind==="max"){if($.inclusive?D.data>$.value:D.data>=$.value)E=this._getOrReturnCtx(D,E),C(E,{code:W.too_big,maximum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),B.dirty()}else if($.kind==="multipleOf"){if(h7(D.data,$.value)!==0)E=this._getOrReturnCtx(D,E),C(E,{code:W.not_multiple_of,multipleOf:$.value,message:$.message}),B.dirty()}else if($.kind==="finite"){if(!Number.isFinite(D.data))E=this._getOrReturnCtx(D,E),C(E,{code:W.not_finite,message:$.message}),B.dirty()}else Z.assertNever($);return{status:B.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,K.toString(F))}gt(D,F){return this.setLimit("min",D,!1,K.toString(F))}lte(D,F){return this.setLimit("max",D,!0,K.toString(F))}lt(D,F){return this.setLimit("max",D,!1,K.toString(F))}setLimit(D,F,E,B){return new yD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:E,message:K.toString(B)}]})}_addCheck(D){return new yD({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:K.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:K.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:K.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:K.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:K.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:K.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:K.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:K.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:K.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"&&Z.isInteger(D.value))}get isFinite(){let D=null,F=null;for(let E of this._def.checks)if(E.kind==="finite"||E.kind==="int"||E.kind==="multipleOf")return!0;else if(E.kind==="min"){if(F===null||E.value>F)F=E.value}else if(E.kind==="max"){if(D===null||E.value<D)D=E.value}return Number.isFinite(F)&&Number.isFinite(D)}}yD.create=(D)=>{return new yD({checks:[],typeName:S.ZodNumber,coerce:D?.coerce||!1,...T(D)})};class hD extends f{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)!==A.bigint)return this._getInvalidInput(D);let E=void 0,B=new a;for(let $ of this._def.checks)if($.kind==="min"){if($.inclusive?D.data<$.value:D.data<=$.value)E=this._getOrReturnCtx(D,E),C(E,{code:W.too_small,type:"bigint",minimum:$.value,inclusive:$.inclusive,message:$.message}),B.dirty()}else if($.kind==="max"){if($.inclusive?D.data>$.value:D.data>=$.value)E=this._getOrReturnCtx(D,E),C(E,{code:W.too_big,type:"bigint",maximum:$.value,inclusive:$.inclusive,message:$.message}),B.dirty()}else if($.kind==="multipleOf"){if(D.data%$.value!==BigInt(0))E=this._getOrReturnCtx(D,E),C(E,{code:W.not_multiple_of,multipleOf:$.value,message:$.message}),B.dirty()}else Z.assertNever($);return{status:B.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return C(F,{code:W.invalid_type,expected:A.bigint,received:F.parsedType}),N}gte(D,F){return this.setLimit("min",D,!0,K.toString(F))}gt(D,F){return this.setLimit("min",D,!1,K.toString(F))}lte(D,F){return this.setLimit("max",D,!0,K.toString(F))}lt(D,F){return this.setLimit("max",D,!1,K.toString(F))}setLimit(D,F,E,B){return new hD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:E,message:K.toString(B)}]})}_addCheck(D){return new hD({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:K.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:K.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:K.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:K.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:K.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}}hD.create=(D)=>{return new hD({checks:[],typeName:S.ZodBigInt,coerce:D?.coerce??!1,...T(D)})};class j2 extends f{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==A.boolean){let E=this._getOrReturnCtx(D);return C(E,{code:W.invalid_type,expected:A.boolean,received:E.parsedType}),N}return o(D.data)}}j2.create=(D)=>{return new j2({typeName:S.ZodBoolean,coerce:D?.coerce||!1,...T(D)})};class aD extends f{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==A.date){let $=this._getOrReturnCtx(D);return C($,{code:W.invalid_type,expected:A.date,received:$.parsedType}),N}if(Number.isNaN(D.data.getTime())){let $=this._getOrReturnCtx(D);return C($,{code:W.invalid_date}),N}let E=new a,B=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(D.data.getTime()<$.value)B=this._getOrReturnCtx(D,B),C(B,{code:W.too_small,message:$.message,inclusive:!0,exact:!1,minimum:$.value,type:"date"}),E.dirty()}else if($.kind==="max"){if(D.data.getTime()>$.value)B=this._getOrReturnCtx(D,B),C(B,{code:W.too_big,message:$.message,inclusive:!0,exact:!1,maximum:$.value,type:"date"}),E.dirty()}else Z.assertNever($);return{status:E.value,value:new Date(D.data.getTime())}}_addCheck(D){return new aD({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:K.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:K.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}}aD.create=(D)=>{return new aD({checks:[],coerce:D?.coerce||!1,typeName:S.ZodDate,...T(D)})};class a2 extends f{_parse(D){if(this._getType(D)!==A.symbol){let E=this._getOrReturnCtx(D);return C(E,{code:W.invalid_type,expected:A.symbol,received:E.parsedType}),N}return o(D.data)}}a2.create=(D)=>{return new a2({typeName:S.ZodSymbol,...T(D)})};class M2 extends f{_parse(D){if(this._getType(D)!==A.undefined){let E=this._getOrReturnCtx(D);return C(E,{code:W.invalid_type,expected:A.undefined,received:E.parsedType}),N}return o(D.data)}}M2.create=(D)=>{return new M2({typeName:S.ZodUndefined,...T(D)})};class O2 extends f{_parse(D){if(this._getType(D)!==A.null){let E=this._getOrReturnCtx(D);return C(E,{code:W.invalid_type,expected:A.null,received:E.parsedType}),N}return o(D.data)}}O2.create=(D)=>{return new O2({typeName:S.ZodNull,...T(D)})};class oD extends f{constructor(){super(...arguments);this._any=!0}_parse(D){return o(D.data)}}oD.create=(D)=>{return new oD({typeName:S.ZodAny,...T(D)})};class kD extends f{constructor(){super(...arguments);this._unknown=!0}_parse(D){return o(D.data)}}kD.create=(D)=>{return new kD({typeName:S.ZodUnknown,...T(D)})};class CD extends f{_parse(D){let F=this._getOrReturnCtx(D);return C(F,{code:W.invalid_type,expected:A.never,received:F.parsedType}),N}}CD.create=(D)=>{return new CD({typeName:S.ZodNever,...T(D)})};class o2 extends f{_parse(D){if(this._getType(D)!==A.undefined){let E=this._getOrReturnCtx(D);return C(E,{code:W.invalid_type,expected:A.void,received:E.parsedType}),N}return o(D.data)}}o2.create=(D)=>{return new o2({typeName:S.ZodVoid,...T(D)})};class YD extends f{_parse(D){let{ctx:F,status:E}=this._processInputParams(D),B=this._def;if(F.parsedType!==A.array)return C(F,{code:W.invalid_type,expected:A.array,received:F.parsedType}),N;if(B.exactLength!==null){let X=F.data.length>B.exactLength.value,Q=F.data.length<B.exactLength.value;if(X||Q)C(F,{code:X?W.too_big:W.too_small,minimum:Q?B.exactLength.value:void 0,maximum:X?B.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:B.exactLength.message}),E.dirty()}if(B.minLength!==null){if(F.data.length<B.minLength.value)C(F,{code:W.too_small,minimum:B.minLength.value,type:"array",inclusive:!0,exact:!1,message:B.minLength.message}),E.dirty()}if(B.maxLength!==null){if(F.data.length>B.maxLength.value)C(F,{code:W.too_big,maximum:B.maxLength.value,type:"array",inclusive:!0,exact:!1,message:B.maxLength.message}),E.dirty()}if(F.common.async)return Promise.all([...F.data].map((X,Q)=>{return B.type._parseAsync(new HD(F,X,F.path,Q))})).then((X)=>{return a.mergeArray(E,X)});let $=[...F.data].map((X,Q)=>{return B.type._parseSync(new HD(F,X,F.path,Q))});return a.mergeArray(E,$)}get element(){return this._def.type}min(D,F){return new YD({...this._def,minLength:{value:D,message:K.toString(F)}})}max(D,F){return new YD({...this._def,maxLength:{value:D,message:K.toString(F)}})}length(D,F){return new YD({...this._def,exactLength:{value:D,message:K.toString(F)}})}nonempty(D){return this.min(1,D)}}YD.create=(D,F)=>{return new YD({type:D,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray,...T(F)})};function R2(D){if(D instanceof g){let F={};for(let E in D.shape){let B=D.shape[E];F[E]=qD.create(R2(B))}return new g({...D._def,shape:()=>F})}else if(D instanceof YD)return new YD({...D._def,type:R2(D.element)});else if(D instanceof qD)return qD.create(R2(D.unwrap()));else if(D instanceof bD)return bD.create(R2(D.unwrap()));else if(D instanceof zD)return zD.create(D.items.map((F)=>R2(F)));else return D}class g extends f{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=Z.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==A.object){let Y=this._getOrReturnCtx(D);return C(Y,{code:W.invalid_type,expected:A.object,received:Y.parsedType}),N}let{status:E,ctx:B}=this._processInputParams(D),{shape:$,keys:X}=this._getCached(),Q=[];if(!(this._def.catchall instanceof CD&&this._def.unknownKeys==="strip")){for(let Y in B.data)if(!X.includes(Y))Q.push(Y)}let J=[];for(let Y of X){let q=$[Y],H=B.data[Y];J.push({key:{status:"valid",value:Y},value:q._parse(new HD(B,H,B.path,Y)),alwaysSet:Y in B.data})}if(this._def.catchall instanceof CD){let Y=this._def.unknownKeys;if(Y==="passthrough")for(let q of Q)J.push({key:{status:"valid",value:q},value:{status:"valid",value:B.data[q]}});else if(Y==="strict"){if(Q.length>0)C(B,{code:W.unrecognized_keys,keys:Q}),E.dirty()}else if(Y==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let Y=this._def.catchall;for(let q of Q){let H=B.data[q];J.push({key:{status:"valid",value:q},value:Y._parse(new HD(B,H,B.path,q)),alwaysSet:q in B.data})}}if(B.common.async)return Promise.resolve().then(async()=>{let Y=[];for(let q of J){let H=await q.key,_=await q.value;Y.push({key:H,value:_,alwaysSet:q.alwaysSet})}return Y}).then((Y)=>{return a.mergeObjectSync(E,Y)});else return a.mergeObjectSync(E,J)}get shape(){return this._def.shape()}strict(D){return K.errToObj,new g({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,E)=>{let B=this._def.errorMap?.(F,E).message??E.defaultError;if(F.code==="unrecognized_keys")return{message:K.errToObj(D).message??B};return{message:B}}}:{}})}strip(){return new g({...this._def,unknownKeys:"strip"})}passthrough(){return new g({...this._def,unknownKeys:"passthrough"})}extend(D){return new g({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new g({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:S.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new g({...this._def,catchall:D})}pick(D){let F={};for(let E of Z.objectKeys(D))if(D[E]&&this.shape[E])F[E]=this.shape[E];return new g({...this._def,shape:()=>F})}omit(D){let F={};for(let E of Z.objectKeys(this.shape))if(!D[E])F[E]=this.shape[E];return new g({...this._def,shape:()=>F})}deepPartial(){return R2(this)}partial(D){let F={};for(let E of Z.objectKeys(this.shape)){let B=this.shape[E];if(D&&!D[E])F[E]=B;else F[E]=B.optional()}return new g({...this._def,shape:()=>F})}required(D){let F={};for(let E of Z.objectKeys(this.shape))if(D&&!D[E])F[E]=this.shape[E];else{let $=this.shape[E];while($ instanceof qD)$=$._def.innerType;F[E]=$}return new g({...this._def,shape:()=>F})}keyof(){return U6(Z.objectKeys(this.shape))}}g.create=(D,F)=>{return new g({shape:()=>D,unknownKeys:"strip",catchall:CD.create(),typeName:S.ZodObject,...T(F)})};g.strictCreate=(D,F)=>{return new g({shape:()=>D,unknownKeys:"strict",catchall:CD.create(),typeName:S.ZodObject,...T(F)})};g.lazycreate=(D,F)=>{return new g({shape:D,unknownKeys:"strip",catchall:CD.create(),typeName:S.ZodObject,...T(F)})};class N2 extends f{_parse(D){let{ctx:F}=this._processInputParams(D),E=this._def.options;function B($){for(let Q of $)if(Q.result.status==="valid")return Q.result;for(let Q of $)if(Q.result.status==="dirty")return F.common.issues.push(...Q.ctx.common.issues),Q.result;let X=$.map((Q)=>new e(Q.ctx.common.issues));return C(F,{code:W.invalid_union,unionErrors:X}),N}if(F.common.async)return Promise.all(E.map(async($)=>{let X={...F,common:{...F.common,issues:[]},parent:null};return{result:await $._parseAsync({data:F.data,path:F.path,parent:X}),ctx:X}})).then(B);else{let $=void 0,X=[];for(let J of E){let Y={...F,common:{...F.common,issues:[]},parent:null},q=J._parseSync({data:F.data,path:F.path,parent:Y});if(q.status==="valid")return q;else if(q.status==="dirty"&&!$)$={result:q,ctx:Y};if(Y.common.issues.length)X.push(Y.common.issues)}if($)return F.common.issues.push(...$.ctx.common.issues),$.result;let Q=X.map((J)=>new e(J));return C(F,{code:W.invalid_union,unionErrors:Q}),N}}get options(){return this._def.options}}N2.create=(D,F)=>{return new N2({options:D,typeName:S.ZodUnion,...T(F)})};var TD=(D)=>{if(D instanceof T2)return TD(D.schema);else if(D instanceof _D)return TD(D.innerType());else if(D instanceof b2)return[D.value];else if(D instanceof gD)return D.options;else if(D instanceof P2)return Z.objectValues(D.enum);else if(D instanceof f2)return TD(D._def.innerType);else if(D instanceof M2)return[void 0];else if(D instanceof O2)return[null];else if(D instanceof qD)return[void 0,...TD(D.unwrap())];else if(D instanceof bD)return[null,...TD(D.unwrap())];else if(D instanceof b0)return TD(D.unwrap());else if(D instanceof I2)return TD(D.unwrap());else if(D instanceof Z2)return TD(D._def.innerType);else return[]};class T0 extends f{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==A.object)return C(F,{code:W.invalid_type,expected:A.object,received:F.parsedType}),N;let E=this.discriminator,B=F.data[E],$=this.optionsMap.get(B);if(!$)return C(F,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[E]}),N;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,E){let B=new Map;for(let $ of F){let X=TD($.shape[D]);if(!X.length)throw Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let Q of X){if(B.has(Q))throw Error(`Discriminator property ${String(D)} has duplicate value ${String(Q)}`);B.set(Q,$)}}return new T0({typeName:S.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:B,...T(E)})}}function K3(D,F){let E=AD(D),B=AD(F);if(D===F)return{valid:!0,data:D};else if(E===A.object&&B===A.object){let $=Z.objectKeys(F),X=Z.objectKeys(D).filter((J)=>$.indexOf(J)!==-1),Q={...D,...F};for(let J of X){let Y=K3(D[J],F[J]);if(!Y.valid)return{valid:!1};Q[J]=Y.data}return{valid:!0,data:Q}}else if(E===A.array&&B===A.array){if(D.length!==F.length)return{valid:!1};let $=[];for(let X=0;X<D.length;X++){let Q=D[X],J=F[X],Y=K3(Q,J);if(!Y.valid)return{valid:!1};$.push(Y.data)}return{valid:!0,data:$}}else if(E===A.date&&B===A.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}class S2 extends f{_parse(D){let{status:F,ctx:E}=this._processInputParams(D),B=($,X)=>{if(N0($)||N0(X))return N;let Q=K3($.value,X.value);if(!Q.valid)return C(E,{code:W.invalid_intersection_types}),N;if(S0($)||S0(X))F.dirty();return{status:F.value,value:Q.data}};if(E.common.async)return Promise.all([this._def.left._parseAsync({data:E.data,path:E.path,parent:E}),this._def.right._parseAsync({data:E.data,path:E.path,parent:E})]).then(([$,X])=>B($,X));else return B(this._def.left._parseSync({data:E.data,path:E.path,parent:E}),this._def.right._parseSync({data:E.data,path:E.path,parent:E}))}}S2.create=(D,F,E)=>{return new S2({left:D,right:F,typeName:S.ZodIntersection,...T(E)})};class zD extends f{_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==A.array)return C(E,{code:W.invalid_type,expected:A.array,received:E.parsedType}),N;if(E.data.length<this._def.items.length)return C(E,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),N;if(!this._def.rest&&E.data.length>this._def.items.length)C(E,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let $=[...E.data].map((X,Q)=>{let J=this._def.items[Q]||this._def.rest;if(!J)return null;return J._parse(new HD(E,X,E.path,Q))}).filter((X)=>!!X);if(E.common.async)return Promise.all($).then((X)=>{return a.mergeArray(F,X)});else return a.mergeArray(F,$)}get items(){return this._def.items}rest(D){return new zD({...this._def,rest:D})}}zD.create=(D,F)=>{if(!Array.isArray(D))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new zD({items:D,typeName:S.ZodTuple,rest:null,...T(F)})};class s2 extends f{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==A.object)return C(E,{code:W.invalid_type,expected:A.object,received:E.parsedType}),N;let B=[],$=this._def.keyType,X=this._def.valueType;for(let Q in E.data)B.push({key:$._parse(new HD(E,Q,E.path,Q)),value:X._parse(new HD(E,E.data[Q],E.path,Q)),alwaysSet:Q in E.data});if(E.common.async)return a.mergeObjectAsync(F,B);else return a.mergeObjectSync(F,B)}get element(){return this._def.valueType}static create(D,F,E){if(F instanceof f)return new s2({keyType:D,valueType:F,typeName:S.ZodRecord,...T(E)});return new s2({keyType:JD.create(),valueType:D,typeName:S.ZodRecord,...T(F)})}}class t2 extends f{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==A.map)return C(E,{code:W.invalid_type,expected:A.map,received:E.parsedType}),N;let B=this._def.keyType,$=this._def.valueType,X=[...E.data.entries()].map(([Q,J],Y)=>{return{key:B._parse(new HD(E,Q,E.path,[Y,"key"])),value:$._parse(new HD(E,J,E.path,[Y,"value"]))}});if(E.common.async){let Q=new Map;return Promise.resolve().then(async()=>{for(let J of X){let Y=await J.key,q=await J.value;if(Y.status==="aborted"||q.status==="aborted")return N;if(Y.status==="dirty"||q.status==="dirty")F.dirty();Q.set(Y.value,q.value)}return{status:F.value,value:Q}})}else{let Q=new Map;for(let J of X){let{key:Y,value:q}=J;if(Y.status==="aborted"||q.status==="aborted")return N;if(Y.status==="dirty"||q.status==="dirty")F.dirty();Q.set(Y.value,q.value)}return{status:F.value,value:Q}}}}t2.create=(D,F,E)=>{return new t2({valueType:F,keyType:D,typeName:S.ZodMap,...T(E)})};class sD extends f{_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.parsedType!==A.set)return C(E,{code:W.invalid_type,expected:A.set,received:E.parsedType}),N;let B=this._def;if(B.minSize!==null){if(E.data.size<B.minSize.value)C(E,{code:W.too_small,minimum:B.minSize.value,type:"set",inclusive:!0,exact:!1,message:B.minSize.message}),F.dirty()}if(B.maxSize!==null){if(E.data.size>B.maxSize.value)C(E,{code:W.too_big,maximum:B.maxSize.value,type:"set",inclusive:!0,exact:!1,message:B.maxSize.message}),F.dirty()}let $=this._def.valueType;function X(J){let Y=new Set;for(let q of J){if(q.status==="aborted")return N;if(q.status==="dirty")F.dirty();Y.add(q.value)}return{status:F.value,value:Y}}let Q=[...E.data.values()].map((J,Y)=>$._parse(new HD(E,J,E.path,Y)));if(E.common.async)return Promise.all(Q).then((J)=>X(J));else return X(Q)}min(D,F){return new sD({...this._def,minSize:{value:D,message:K.toString(F)}})}max(D,F){return new sD({...this._def,maxSize:{value:D,message:K.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}}sD.create=(D,F)=>{return new sD({valueType:D,minSize:null,maxSize:null,typeName:S.ZodSet,...T(F)})};class L2 extends f{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==A.function)return C(F,{code:W.invalid_type,expected:A.function,received:F.parsedType}),N;function E(Q,J){return r2({data:Q,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,V2(),SD].filter((Y)=>!!Y),issueData:{code:W.invalid_arguments,argumentsError:J}})}function B(Q,J){return r2({data:Q,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,V2(),SD].filter((Y)=>!!Y),issueData:{code:W.invalid_return_type,returnTypeError:J}})}let $={errorMap:F.common.contextualErrorMap},X=F.data;if(this._def.returns instanceof tD){let Q=this;return o(async function(...J){let Y=new e([]),q=await Q._def.args.parseAsync(J,$).catch((G)=>{throw Y.addIssue(E(J,G)),Y}),H=await Reflect.apply(X,this,q);return await Q._def.returns._def.type.parseAsync(H,$).catch((G)=>{throw Y.addIssue(B(H,G)),Y})})}else{let Q=this;return o(function(...J){let Y=Q._def.args.safeParse(J,$);if(!Y.success)throw new e([E(J,Y.error)]);let q=Reflect.apply(X,this,Y.data),H=Q._def.returns.safeParse(q,$);if(!H.success)throw new e([B(q,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new L2({...this._def,args:zD.create(D).rest(kD.create())})}returns(D){return new L2({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,E){return new L2({args:D?D:zD.create([]).rest(kD.create()),returns:F||kD.create(),typeName:S.ZodFunction,...T(E)})}}class T2 extends f{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})}}T2.create=(D,F)=>{return new T2({getter:D,typeName:S.ZodLazy,...T(F)})};class b2 extends f{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return C(F,{received:F.data,code:W.invalid_literal,expected:this._def.value}),N}return{status:"valid",value:D.data}}get value(){return this._def.value}}b2.create=(D,F)=>{return new b2({value:D,typeName:S.ZodLiteral,...T(F)})};function U6(D,F){return new gD({values:D,typeName:S.ZodEnum,...T(F)})}class gD extends f{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),E=this._def.values;return C(F,{expected:Z.joinValues(E),received:F.parsedType,code:W.invalid_type}),N}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(D.data)){let F=this._getOrReturnCtx(D),E=this._def.values;return C(F,{received:F.data,code:W.invalid_enum_value,options:E}),N}return o(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 gD.create(D,{...this._def,...F})}exclude(D,F=this._def){return gD.create(this.options.filter((E)=>!D.includes(E)),{...this._def,...F})}}gD.create=U6;class P2 extends f{_parse(D){let F=Z.getValidEnumValues(this._def.values),E=this._getOrReturnCtx(D);if(E.parsedType!==A.string&&E.parsedType!==A.number){let B=Z.objectValues(F);return C(E,{expected:Z.joinValues(B),received:E.parsedType,code:W.invalid_type}),N}if(!this._cache)this._cache=new Set(Z.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let B=Z.objectValues(F);return C(E,{received:E.data,code:W.invalid_enum_value,options:B}),N}return o(D.data)}get enum(){return this._def.values}}P2.create=(D,F)=>{return new P2({values:D,typeName:S.ZodNativeEnum,...T(F)})};class tD extends f{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==A.promise&&F.common.async===!1)return C(F,{code:W.invalid_type,expected:A.promise,received:F.parsedType}),N;let E=F.parsedType===A.promise?F.data:Promise.resolve(F.data);return o(E.then((B)=>{return this._def.type.parseAsync(B,{path:F.path,errorMap:F.common.contextualErrorMap})}))}}tD.create=(D,F)=>{return new tD({type:D,typeName:S.ZodPromise,...T(F)})};class _D extends f{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(D){let{status:F,ctx:E}=this._processInputParams(D),B=this._def.effect||null,$={addIssue:(X)=>{if(C(E,X),X.fatal)F.abort();else F.dirty()},get path(){return E.path}};if($.addIssue=$.addIssue.bind($),B.type==="preprocess"){let X=B.transform(E.data,$);if(E.common.async)return Promise.resolve(X).then(async(Q)=>{if(F.value==="aborted")return N;let J=await this._def.schema._parseAsync({data:Q,path:E.path,parent:E});if(J.status==="aborted")return N;if(J.status==="dirty")return rD(J.value);if(F.value==="dirty")return rD(J.value);return J});else{if(F.value==="aborted")return N;let Q=this._def.schema._parseSync({data:X,path:E.path,parent:E});if(Q.status==="aborted")return N;if(Q.status==="dirty")return rD(Q.value);if(F.value==="dirty")return rD(Q.value);return Q}}if(B.type==="refinement"){let X=(Q)=>{let J=B.refinement(Q,$);if(E.common.async)return Promise.resolve(J);if(J instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Q};if(E.common.async===!1){let Q=this._def.schema._parseSync({data:E.data,path:E.path,parent:E});if(Q.status==="aborted")return N;if(Q.status==="dirty")F.dirty();return X(Q.value),{status:F.value,value:Q.value}}else return this._def.schema._parseAsync({data:E.data,path:E.path,parent:E}).then((Q)=>{if(Q.status==="aborted")return N;if(Q.status==="dirty")F.dirty();return X(Q.value).then(()=>{return{status:F.value,value:Q.value}})})}if(B.type==="transform")if(E.common.async===!1){let X=this._def.schema._parseSync({data:E.data,path:E.path,parent:E});if(!xD(X))return N;let Q=B.transform(X.value,$);if(Q instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:Q}}else return this._def.schema._parseAsync({data:E.data,path:E.path,parent:E}).then((X)=>{if(!xD(X))return N;return Promise.resolve(B.transform(X.value,$)).then((Q)=>({status:F.value,value:Q}))});Z.assertNever(B)}}_D.create=(D,F,E)=>{return new _D({schema:D,typeName:S.ZodEffects,effect:F,...T(E)})};_D.createWithPreprocess=(D,F,E)=>{return new _D({schema:F,effect:{type:"preprocess",transform:D},typeName:S.ZodEffects,...T(E)})};class qD extends f{_parse(D){if(this._getType(D)===A.undefined)return o(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}qD.create=(D,F)=>{return new qD({innerType:D,typeName:S.ZodOptional,...T(F)})};class bD extends f{_parse(D){if(this._getType(D)===A.null)return o(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}bD.create=(D,F)=>{return new bD({innerType:D,typeName:S.ZodNullable,...T(F)})};class f2 extends f{_parse(D){let{ctx:F}=this._processInputParams(D),E=F.data;if(F.parsedType===A.undefined)E=this._def.defaultValue();return this._def.innerType._parse({data:E,path:F.path,parent:F})}removeDefault(){return this._def.innerType}}f2.create=(D,F)=>{return new f2({innerType:D,typeName:S.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...T(F)})};class Z2 extends f{_parse(D){let{ctx:F}=this._processInputParams(D),E={...F,common:{...F.common,issues:[]}},B=this._def.innerType._parse({data:E.data,path:E.path,parent:{...E}});if(K2(B))return B.then(($)=>{return{status:"valid",value:$.status==="valid"?$.value:this._def.catchValue({get error(){return new e(E.common.issues)},input:E.data})}});else return{status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new e(E.common.issues)},input:E.data})}}removeCatch(){return this._def.innerType}}Z2.create=(D,F)=>{return new Z2({innerType:D,typeName:S.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...T(F)})};class e2 extends f{_parse(D){if(this._getType(D)!==A.nan){let E=this._getOrReturnCtx(D);return C(E,{code:W.invalid_type,expected:A.nan,received:E.parsedType}),N}return{status:"valid",value:D.data}}}e2.create=(D)=>{return new e2({typeName:S.ZodNaN,...T(D)})};var g7=Symbol("zod_brand");class b0 extends f{_parse(D){let{ctx:F}=this._processInputParams(D),E=F.data;return this._def.type._parse({data:E,path:F.path,parent:F})}unwrap(){return this._def.type}}class D0 extends f{_parse(D){let{status:F,ctx:E}=this._processInputParams(D);if(E.common.async)return(async()=>{let $=await this._def.in._parseAsync({data:E.data,path:E.path,parent:E});if($.status==="aborted")return N;if($.status==="dirty")return F.dirty(),rD($.value);else return this._def.out._parseAsync({data:$.value,path:E.path,parent:E})})();else{let B=this._def.in._parseSync({data:E.data,path:E.path,parent:E});if(B.status==="aborted")return N;if(B.status==="dirty")return F.dirty(),{status:"dirty",value:B.value};else return this._def.out._parseSync({data:B.value,path:E.path,parent:E})}}static create(D,F){return new D0({in:D,out:F,typeName:S.ZodPipeline})}}class I2 extends f{_parse(D){let F=this._def.innerType._parse(D),E=(B)=>{if(xD(B))B.value=Object.freeze(B.value);return B};return K2(F)?F.then((B)=>E(B)):E(F)}unwrap(){return this._def.innerType}}I2.create=(D,F)=>{return new I2({innerType:D,typeName:S.ZodReadonly,...T(F)})};function H6(D,F){let E=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof E==="string"?{message:E}:E}function A6(D,F={},E){if(D)return oD.create().superRefine((B,$)=>{let X=D(B);if(X instanceof Promise)return X.then((Q)=>{if(!Q){let J=H6(F,B),Y=J.fatal??E??!0;$.addIssue({code:"custom",...J,fatal:Y})}});if(!X){let Q=H6(F,B),J=Q.fatal??E??!0;$.addIssue({code:"custom",...Q,fatal:J})}return});return oD.create()}var l7={object:g.lazycreate},S;(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"})(S||(S={}));var m7=(D,F={message:`Input not instance of ${D.name}`})=>A6((E)=>E instanceof D,F),C6=JD.create,z6=yD.create,c7=e2.create,p7=hD.create,V6=j2.create,d7=aD.create,i7=a2.create,n7=M2.create,r7=O2.create,a7=oD.create,o7=kD.create,s7=CD.create,t7=o2.create,e7=YD.create,D9=g.create,F9=g.strictCreate,E9=N2.create,B9=T0.create,$9=S2.create,X9=zD.create,Q9=s2.create,J9=t2.create,Y9=sD.create,q9=L2.create,H9=T2.create,_9=b2.create,G9=gD.create,W9=P2.create,U9=tD.create,A9=_D.create,C9=qD.create,z9=bD.create,V9=_D.createWithPreprocess,K9=D0.create,R9=()=>C6().optional(),L9=()=>z6().optional(),j9=()=>V6().optional(),M9={string:(D)=>JD.create({...D,coerce:!0}),number:(D)=>yD.create({...D,coerce:!0}),boolean:(D)=>j2.create({...D,coerce:!0}),bigint:(D)=>hD.create({...D,coerce:!0}),date:(D)=>aD.create({...D,coerce:!0})};var O9=N;var N9=v.object({name:v.string().default("genie"),defaultWindow:v.string().default("shell"),autoCreate:v.boolean().default(!0)}),S9=v.object({execTimeout:v.number().default(120000),readLines:v.number().default(100),worktreeBase:v.string().default(".worktrees")}),T9=v.object({tmuxDebug:v.boolean().default(!1),verbose:v.boolean().default(!1)}),b9=v.object({preference:v.enum(["auto","zsh","bash","fish"]).default("auto")}),P9=v.object({tmuxInstalled:v.boolean().default(!1),shellInstalled:v.boolean().default(!1)}),f9=v.object({enabled:v.boolean().default(!1)}),GD=v.object({version:v.number().default(2),session:N9.default({}),terminal:S9.default({}),logging:T9.default({}),shell:b9.default({}),shortcuts:P9.default({}),claudio:f9.optional(),installMethod:v.enum(["source","npm","bun"]).optional(),setupComplete:v.boolean().default(!1),lastSetupAt:v.string().optional()}),K6=v.object({session:v.object({name:v.string().default("genie"),defaultWindow:v.string().default("shell")}).default({}),logging:v.object({tmuxDebug:v.boolean().default(!1)}).default({}),installMethod:v.enum(["source","npm","bun"]).optional()});var P0=j6(L6(),".genie"),eD=j6(P0,"config.json"),R3=2;function m$(){return P0}function c$(){return eD}function v9(){return f0(eD)}function w9(){if(!f0(P0))Z9(P0,{recursive:!0})}function M6(D){let F=K6.safeParse(D);if(F.success){let E=F.data;return GD.parse({version:R3,session:{name:E.session.name,defaultWindow:E.session.defaultWindow,autoCreate:!0},terminal:{execTimeout:120000,readLines:100,worktreeBase:".worktrees"},logging:{tmuxDebug:E.logging.tmuxDebug,verbose:!1},shell:{preference:"auto"},shortcuts:{tmuxInstalled:!1,shellInstalled:!1},installMethod:E.installMethod,setupComplete:!1})}return GD.parse({})}async function O6(){if(!f0(eD))return GD.parse({});try{let D=R6(eD,"utf-8"),F=JSON.parse(D);if(!F.version||F.version<R3){let E=M6(F);return await Z0(E),E}return GD.parse(F)}catch(D){return console.warn(`Warning: Invalid genie config, using defaults: ${D.message}`),GD.parse({})}}async function Z0(D){w9();try{let F=GD.parse(D),E=JSON.stringify(F,null,2);I9(eD,E,"utf-8")}catch(F){throw Error(`Failed to save genie config: ${F.message}`)}}function u9(){return GD.parse({})}function N6(){if(!f0(eD))return GD.parse({});try{let D=R6(eD,"utf-8"),F=JSON.parse(D);if(!F.version||F.version<R3)return M6(F);return GD.parse(F)}catch{return GD.parse({})}}function p$(D){let F=L6();if(D.startsWith(F+"/"))return"~"+D.slice(F.length);if(D===F)return"~";return D}function I0(){return N6().terminal}function d$(){if(!v9())return!1;return N6().setupComplete??!1}async function i$(){let D=await O6();D.setupComplete=!0,D.lastSetupAt=new Date().toISOString(),await Z0(D)}async function n$(){let D=u9();await Z0(D)}async function r$(D){let F=await O6();F.shortcuts={...F.shortcuts,...D},await Z0(F)}async function S6(D,F){try{let B=I0().readLines,$={lines:F.lines?parseInt(F.lines,10):B,from:F.from?parseInt(F.from,10):void 0,to:F.to?parseInt(F.to,10):void 0,range:F.range,search:F.search,grep:F.grep,follow:F.follow,all:F.all,reverse:F.reverse};if(F.follow){console.log(`Following session "${D}" (Ctrl+C to stop)...`),console.log("");let Q=await J6(D,(J)=>{console.log(J)});process.on("SIGINT",()=>{Q(),console.log(`
|
|
51
51
|
Stopped following`),process.exit(0)}),await new Promise(()=>{});return}let X=await Q6(D,$);if(F.json){let Q=X.split(`
|
|
52
|
-
`);console.log(JSON.stringify({session:D,lineCount:Q.length,content:Q},null,2));return}console.log(X)}catch(E){console.error(`Error reading session logs: ${E.message}`),process.exit(1)}}async function T6(D,F,E={}){let[B,$]=D.includes(":")?D.split(":"):[D,"shell"];try{let X=await
|
|
52
|
+
`);console.log(JSON.stringify({session:D,lineCount:Q.length,content:Q},null,2));return}console.log(X)}catch(E){console.error(`Error reading session logs: ${E.message}`),process.exit(1)}}async function T6(D,F,E={}){let[B,$]=D.includes(":")?D.split(":"):[D,"shell"];try{let X=await w(B);if(!X){if(!E.quiet)console.error(`Session "${B}" not found, creating...`);if(X=await nD(B),!X)console.error(`Failed to create session "${B}"`),process.exit(1)}let J=(await x(X.id)).find((U)=>U.name===$);if(!J){if(!E.quiet)console.error(`Window "${$}" not found, creating...`);if(J=await j0(X.id,$),!J)console.error(`Failed to create window "${$}"`),process.exit(1)}let Y=await h(J.id);if(!Y||Y.length===0)console.error(`No panes found in window "${$}"`),process.exit(1);let q=I0(),H=E.timeout??q.execTimeout,{output:_,exitCode:G}=await n8(Y[0].id,F,H);if(_&&!E.quiet)console.log(_);process.exit(G)}catch(X){console.error(`Error: ${X.message}`),process.exit(1)}}async function b6(D,F,E={}){try{let B=await w(D);if(!B)console.error(`\u274C Session "${D}" not found`),process.exit(1);let $;if(E.pane)$=E.pane.startsWith("%")?E.pane:`%${E.pane}`;else{let J=await x(B.id);if(!J||J.length===0)console.error(`\u274C No windows found in session "${D}"`),process.exit(1);let Y=await h(J[0].id);if(!Y||Y.length===0)console.error(`\u274C No panes found in session "${D}"`),process.exit(1);$=Y[0].id}let X=E.enter!==!1,Q=F.replace(/'/g,"'\\''");if(X)await O(`send-keys -t '${$}' '${Q}' Enter`);else await O(`send-keys -t '${$}' '${Q}'`);console.log(`\u2705 Keys sent to session "${D}"${X?" (with Enter)":""}`)}catch(B){console.error(`\u274C Error sending keys: ${B.message}`),process.exit(1)}}import{join as h9}from"path";async function P6(D,F,E={}){try{let B=await w(D);if(!B)console.error(`\u274C Session "${D}" not found`),process.exit(1);let $=await x(B.id);if(!$||$.length===0)console.error(`\u274C No windows found in session "${D}"`),process.exit(1);let X=$.find((U)=>U.active)||$[0],Q=await h(X.id);if(!Q||Q.length===0)console.error(`\u274C No panes found in session "${D}"`),process.exit(1);let Y=(Q.find((U)=>U.active)||Q[0]).id,q=F==="h"?"horizontal":"vertical",H=await O(`display-message -p -t '${Y}' '#{pane_current_path}'`),_;if(E.worktree){if(!E.workspace)console.error("\u274C --worktree requires --workspace"),process.exit(1);let U=z2({baseDir:h9(E.workspace,".worktrees"),repoPath:E.workspace});if(!await U.worktreeExists(E.worktree)){let L=await U.createWorktree(E.worktree,!0);console.log(`\u2705 Worktree created at ${L.path}`)}_=U.getWorktreePath(E.worktree)}else if(E.workspace)_=E.workspace;else _=H.trim()||void 0;let G=await U2(Y,q,void 0,_);if(!G)console.error("\u274C Failed to split pane"),process.exit(1);if(_)await O(`send-keys -t '${G.id}' 'cd ${_.replace(/'/g,"'\\''")} && clear' Enter`);if(console.log(`\u2705 Pane split ${q}ly in session "${D}"`),_)console.log(` Working directory: ${_}`)}catch(B){console.error(`\u274C Error splitting pane: ${B.message}`),process.exit(1)}}async function f6(D,F){await O(`set-hook -g ${D} '${F.replace(/'/g,"'\\''")}'`)}async function Z6(D){await O(`set-hook -gu ${D}`)}async function I6(){let D=["after-bind-key","after-capture-pane","after-copy-mode","after-display-message","after-display-panes","after-kill-pane","after-list-buffers","after-list-clients","after-list-keys","after-list-panes","after-list-sessions","after-list-windows","after-load-buffer","after-lock-server","after-new-session","after-new-window","after-paste-buffer","after-pipe-pane","after-queue","after-refresh-client","after-rename-session","after-rename-window","after-resize-pane","after-resize-window","after-save-buffer","after-select-layout","after-select-pane","after-select-window","after-send-keys","after-set-buffer","after-set-environment","after-set-option","after-show-environment","after-show-messages","after-show-options","after-split-window","after-unbind-key","alert-activity","alert-bell","alert-silence","client-attached","client-detached","client-resized","client-session-changed","pane-died","pane-exited","pane-focus-in","pane-focus-out","pane-mode-changed","pane-set-clipboard","session-closed","session-created","session-renamed","session-window-changed","window-linked","window-pane-changed","window-renamed","window-unlinked"],F=[];for(let E of D)try{let B=await O(`show-hooks -g ${E}`);if(B.trim()){let $=B.trim().split(" ");if($.length>=2)F.push({event:$[0],command:$.slice(1).join(" ")})}}catch(B){continue}return F}async function v6(D,F){try{await f6(D,F),console.log(`\u2705 Hook set: ${D} \u2192 ${F}`)}catch(E){console.error(`\u274C Error setting hook: ${E.message}`),process.exit(1)}}async function w6(){try{let D=await I6();if(D.length===0){console.log("No hooks configured");return}console.log("EVENT\t\t\t\tCOMMAND"),console.log("\u2500".repeat(80));for(let F of D)console.log(`${F.event} ${F.command}`)}catch(D){console.error(`\u274C Error listing hooks: ${D.message}`),process.exit(1)}}async function u6(D){try{await Z6(D),console.log(`\u2705 Hook removed: ${D}`)}catch(F){console.error(`\u274C Error removing hook: ${F.message}`),process.exit(1)}}async function x6(D,F={}){try{let E=await w(D);if(!E)console.error(`Session "${D}" not found`),process.exit(1);let B=await x(E.id);if(F.json){console.log(JSON.stringify(B,null,2));return}if(B.length===0){console.log("No windows found");return}console.log("WINDOW ID\t\tNAME\t\t\tACTIVE"),console.log("\u2500".repeat(60));for(let $ of B){let X=$.active?"yes":"no";console.log(`${$.id} ${$.name} ${X}`)}}catch(E){console.error(`Error listing windows: ${E.message}`),process.exit(1)}}async function k6(D,F){try{let E=await w(D);if(!E)console.error(`Session "${D}" not found`),process.exit(1);let B=await j0(E.id,F);if(B)console.log(`Window created: ${B.id}`);else console.error("Failed to create window"),process.exit(1)}catch(E){console.error(`Error creating window: ${E.message}`),process.exit(1)}}async function y6(D){try{await d8(D),console.log(`Window removed: ${D}`)}catch(F){console.error(`Error removing window: ${F.message}`),process.exit(1)}}async function h6(D,F={}){try{let E=await w(D);if(!E)console.error(`Session "${D}" not found`),process.exit(1);let B=await x(E.id);if(B.length===0){if(F.json)console.log("[]");else console.log("No panes found");return}let $=[];for(let X of B){let Q=await h(X.id);for(let J of Q)$.push({id:J.id,windowId:X.id,windowName:X.name,title:J.title,active:J.active})}if(F.json){console.log(JSON.stringify($,null,2));return}if($.length===0){console.log("No panes found");return}console.log("PANE ID\t\tWINDOW\t\t\tTITLE\t\t\tACTIVE"),console.log("\u2500".repeat(80));for(let X of $){let Q=X.active?"yes":"no",J=X.title||"-";console.log(`${X.id} ${X.windowName} ${J} ${Q}`)}}catch(E){console.error(`Error listing panes: ${E.message}`),process.exit(1)}}async function g6(D){try{await W2(D),console.log(`Pane removed: ${D}`)}catch(F){console.error(`Error removing pane: ${F.message}`),process.exit(1)}}async function l6(D,F={}){try{if(F.command){await d9(F.command,F.json);return}let E=await w(D);if(!E)console.error(`Session "${D}" not found`),process.exit(1);let B=await x(E.id),$=0;for(let J of B){let Y=await h(J.id);$+=Y.length}let X="idle",Q={session:E.name,id:E.id,attached:E.attached,windows:B.length,panes:$,state:X};if(F.json){console.log(JSON.stringify(Q,null,2));return}console.log(`Session: ${Q.session}`),console.log(`ID: ${Q.id}`),console.log(`Attached: ${Q.attached?"yes":"no"}`),console.log(`Windows: ${Q.windows}`),console.log(`Panes: ${Q.panes}`),console.log(`State: ${Q.state}`)}catch(E){console.error(`Error getting status: ${E.message}`),process.exit(1)}}async function d9(D,F){try{let E=await i8(D);if(!E)console.error(`Command "${D}" not found`),process.exit(1);let B={id:E.id,paneId:E.paneId,command:E.command,status:E.status,exitCode:E.exitCode,startTime:E.startTime.toISOString(),result:E.result};if(F){console.log(JSON.stringify(B,null,2));return}if(console.log(`Command: ${B.id}`),console.log(`Status: ${B.status}`),console.log(`Exit Code: ${B.exitCode??"N/A"}`),console.log(`Start Time: ${B.startTime}`),B.result)console.log(`
|
|
53
53
|
Output:
|
|
54
54
|
${B.result}`)}catch(E){console.error(`Error getting command status: ${E.message}`),process.exit(1)}}import{homedir as m6}from"os";import{join as WD}from"path";import{existsSync as D2,readFileSync as c6,writeFileSync as n9,mkdirSync as r9,appendFileSync as L3}from"fs";import*as p6 from"readline";function d6(){return`# Warp-like keyboard shortcuts (generated by genie-cli)
|
|
55
55
|
# To use: add to ~/.tmux.conf or source this file
|
|
@@ -124,30 +124,30 @@ Commands:
|
|
|
124
124
|
term shortcuts --tmux Output tmux.conf snippet
|
|
125
125
|
term shortcuts --termux Output termux.properties snippet
|
|
126
126
|
term shortcuts --install Install to config files
|
|
127
|
-
`)}async function
|
|
128
|
-
`);let E=WD(D,".tmux.conf");if(F2(E,"generated by genie-cli"))console.log("\u2713 tmux.conf already has genie shortcuts");else if(await
|
|
129
|
-
`+d6();L3(E,Y),console.log(`\u2705 Added to ${E}`)}else console.log("\u23ED\uFE0F Skipped tmux.conf");let B=D2(WD(D,".zshrc"))?WD(D,".zshrc"):WD(D,".bashrc");if(F2(B,"generated by genie-cli"))console.log(`\u2713 ${B} already has genie shortcuts`);else if(await
|
|
130
|
-
`+a9();L3(B,Y),console.log(`\u2705 Added to ${B}`)}else console.log(`\u23ED\uFE0F Skipped ${B}`);let $=WD(D,".termux"),X=WD($,"termux.properties"),Q=D2($)||process.env.TERMUX_VERSION;if(Q)if(F2(X,"generated by genie-cli"))console.log("\u2713 termux.properties already has genie shortcuts");else if(await
|
|
127
|
+
`)}async function v2(D){let F=p6.createInterface({input:process.stdin,output:process.stdout});return new Promise((E)=>{F.question(D,(B)=>{F.close(),E(B.trim().toLowerCase())})})}function F2(D,F){if(!D2(D))return!1;return c6(D,"utf-8").includes(F)}async function s9(){let D=m6(),F="generated by genie-cli";console.log(`Installing Warp-like shortcuts...
|
|
128
|
+
`);let E=WD(D,".tmux.conf");if(F2(E,"generated by genie-cli"))console.log("\u2713 tmux.conf already has genie shortcuts");else if(await v2(`Add shortcuts to ${E}? [Y/n] `)!=="n"){let Y=`
|
|
129
|
+
`+d6();L3(E,Y),console.log(`\u2705 Added to ${E}`)}else console.log("\u23ED\uFE0F Skipped tmux.conf");let B=D2(WD(D,".zshrc"))?WD(D,".zshrc"):WD(D,".bashrc");if(F2(B,"generated by genie-cli"))console.log(`\u2713 ${B} already has genie shortcuts`);else if(await v2(`Add shell functions to ${B}? [Y/n] `)!=="n"){let Y=`
|
|
130
|
+
`+a9();L3(B,Y),console.log(`\u2705 Added to ${B}`)}else console.log(`\u23ED\uFE0F Skipped ${B}`);let $=WD(D,".termux"),X=WD($,"termux.properties"),Q=D2($)||process.env.TERMUX_VERSION;if(Q)if(F2(X,"generated by genie-cli"))console.log("\u2713 termux.properties already has genie shortcuts");else if(await v2(`Add extra keys to ${X}? [Y/n] `)!=="n"){if(!D2($))r9($,{recursive:!0});let Y=`
|
|
131
131
|
`+i6();L3(X,Y),console.log(`\u2705 Added to ${X}`),console.log(" Run: termux-reload-settings")}else console.log("\u23ED\uFE0F Skipped termux.properties");if(console.log(`
|
|
132
132
|
\u2705 Installation complete!`),console.log(`
|
|
133
133
|
Next steps:`),console.log(" 1. Reload tmux: tmux source ~/.tmux.conf"),console.log(" 2. Restart your shell or run: source ~/.bashrc"),Q)console.log(" 3. Reload Termux: termux-reload-settings")}function $X(D){return F2(D,"generated by genie-cli")}function j3(D,F){if(!D2(D))return!1;let E=c6(D,"utf-8");if(!E.includes(F))return!1;let B=E.split(`
|
|
134
134
|
`),$=[],X=!1,Q=-1;for(let Y=0;Y<B.length;Y++){let q=B[Y];if(q.includes(F)&&!X){if(X=!0,Q===-1&&$.length>0&&$[$.length-1].trim()==="")$.pop();continue}if(X){if(q.trim()===""&&Y+1<B.length&&!B[Y+1].includes("genie")){X=!1;continue}if(!(q.includes("genie")||q.includes("Ctrl+")||q.includes("split-window")||q.includes("new-window")||q.includes("stty -ixon")||q.includes("Warp-like")||q.includes("bind-key -n")||q.includes("extra-keys")||q.includes("F1=")||q.includes("bind -x")||q.startsWith("#")&&B[Y-1]?.includes("genie"))&&q.trim()!=="")X=!1,$.push(q);continue}$.push(q)}while($.length>0&&$[$.length-1].trim()==="")$.pop();let J=$.length>0?$.join(`
|
|
135
135
|
`)+`
|
|
136
136
|
`:"";return n9(D,J),!0}async function XX(){let D=m6(),F="generated by genie-cli";console.log(`Uninstalling Warp-like shortcuts...
|
|
137
|
-
`);let E=WD(D,".tmux.conf");if(!F2(E,"generated by genie-cli"))console.log("\u2713 tmux.conf has no genie shortcuts");else if(await
|
|
137
|
+
`);let E=WD(D,".tmux.conf");if(!F2(E,"generated by genie-cli"))console.log("\u2713 tmux.conf has no genie shortcuts");else if(await v2(`Remove shortcuts from ${E}? [Y/n] `)!=="n"){if(j3(E,"generated by genie-cli"))console.log(`\u2705 Removed from ${E}`)}else console.log("\u23ED\uFE0F Skipped tmux.conf");let B=WD(D,".zshrc"),$=WD(D,".bashrc");for(let Y of[B,$]){if(!D2(Y))continue;if(!F2(Y,"generated by genie-cli"))console.log(`\u2713 ${Y} has no genie shortcuts`);else if(await v2(`Remove shell functions from ${Y}? [Y/n] `)!=="n"){if(j3(Y,"generated by genie-cli"))console.log(`\u2705 Removed from ${Y}`)}else console.log(`\u23ED\uFE0F Skipped ${Y}`)}let X=WD(D,".termux"),Q=WD(X,"termux.properties"),J=D2(X)||process.env.TERMUX_VERSION;if(J)if(!F2(Q,"generated by genie-cli"))console.log("\u2713 termux.properties has no genie shortcuts");else if(await v2(`Remove extra keys from ${Q}? [Y/n] `)!=="n"){if(j3(Q,"generated by genie-cli"))console.log(`\u2705 Removed from ${Q}`),console.log(" Run: termux-reload-settings")}else console.log("\u23ED\uFE0F Skipped termux.properties");if(console.log(`
|
|
138
138
|
\u2705 Uninstallation complete!`),console.log(`
|
|
139
|
-
Next steps:`),console.log(" 1. Reload tmux: tmux source ~/.tmux.conf"),console.log(" 2. Restart your shell or run: source ~/.bashrc"),J)console.log(" 3. Reload Termux: termux-reload-settings")}async function n6(D){if(D.tmux)console.log(d6());else if(D.termux)console.log(i6());else if(D.install)await s9();else o9()}var
|
|
139
|
+
Next steps:`),console.log(" 1. Reload tmux: tmux source ~/.tmux.conf"),console.log(" 2. Restart your shell or run: source ~/.bashrc"),J)console.log(" 3. Reload Termux: termux-reload-settings")}async function n6(D){if(D.tmux)console.log(d6());else if(D.termux)console.log(i6());else if(D.install)await s9();else o9()}var w2=[{type:"bash_permission",pattern:/Allow (?:Bash|bash|command|shell).*\?\s*(?:\[([YyNn])\/([YyNn])\])?/i,extract:(D)=>({default:D[1]||"y"})},{type:"file_permission",pattern:/Allow (?:Edit|Write|Read|file|reading|writing|editing).*\?\s*(?:\[([YyNn])\/([YyNn])\])?/i,extract:(D)=>({default:D[1]||"y"})},{type:"mcp_permission",pattern:/Allow (?:MCP|mcp|tool).*\?\s*(?:\[([YyNn])\/([YyNn])\])?/i,extract:(D)=>({default:D[1]||"y"})},{type:"generic_permission",pattern:/^(?:Allow|Confirm|Approve)\s+(?:this|the|once|always)?\s*(?:\w+)?\s*\?\s*(?:\[([YyNn])\/([YyNn])\])?/im,extract:(D)=>({default:D[1]||"y"})},{type:"claude_code_yes_no",pattern:/(?:Yes|No)\s*$/m},{type:"claude_code_permission_block",pattern:/(?:Allow|Run|Execute)\s+(?:once|always)/i}],v0=[{type:"numbered_options",pattern:/\[(\d+)\]\s+(.+?)(?=\[(\d+)\]|$)/g,extract:(D)=>({number:D[1],option:D[2].trim()})},{type:"lettered_options",pattern:/\(([a-z])\)\s+(.+?)(?=\([a-z]\)|$)/gi,extract:(D)=>({letter:D[1],option:D[2].trim()})},{type:"yes_no_question",pattern:/\?\s*\[([YyNn])\/([YyNn])\]\s*$/,extract:(D)=>({default:D[1]})},{type:"claude_code_numbered_options",pattern:/(?:\u276F|>)?\s*(\d+)\.\s+(.+?)(?:\n|$)/g,extract:(D)=>({number:D[1],option:D[2].trim()})},{type:"claude_code_plan_approval",pattern:/Would you like to proceed\?/i}],r6=[{type:"error",pattern:/(?:^|\n)\s*(?:Error|ERROR|error):\s*(.+)/,extract:(D)=>({message:D[1]})},{type:"failed",pattern:/(?:^|\n)\s*(?:Failed|FAILED|failed):\s*(.+)/,extract:(D)=>({message:D[1]})},{type:"exception",pattern:/(?:^|\n)\s*(?:Exception|EXCEPTION|Uncaught|Unhandled):\s*(.+)/,extract:(D)=>({message:D[1]})},{type:"api_error",pattern:/(?:API|api)\s+(?:error|Error|ERROR):\s*(.+)/,extract:(D)=>({message:D[1]})}],a6=[{type:"checkmark",pattern:/[\u2713\u2714\u2611\uFE0E]/},{type:"success_message",pattern:/(?:Successfully|Completed|Done|Finished|Created|Updated|Saved)/i},{type:"task_complete",pattern:/(?:task|operation|process)\s+(?:complete|completed|finished|done)/i}],o6=[{type:"thinking",pattern:/(?:Thinking|thinking|Processing|processing)\.\.\./},{type:"spinner",pattern:/[\u280B\u2819\u2839\u2838\u283C\u2834\u2826\u2827\u2807\u280F\u28FE\u28FD\u28FB\u28BF\u287F\u28DF\u28EF\u28F7]/},{type:"loading",pattern:/(?:Loading|loading|Working|working)\.\.\./},{type:"claude_code_working",pattern:/[\uD83D\uDEE0\uFE0F\uD83D\uDD27\u2699\uFE0F]\s*(?:Read|Edit|Write|Bash|Glob|Grep|Task)/},{type:"claude_code_streaming",pattern:/\u258C$/},{type:"claude_code_propagating",pattern:/Propagating\u2026/}],s6=[{type:"claude_prompt",pattern:/(?:^|\n)\s*>\s*$/},{type:"claude_code_prompt",pattern:/\u276F\s*(?!\d\.)/},{type:"claude_code_input_line",pattern:/\u276F\s*.+\n\u2500+\n/},{type:"idle_indicator",pattern:/\|\s*idle\s*$/i},{type:"input_prompt",pattern:/(?:^|\n)(?:Enter|Input|Type|Provide).*:\s*$/i}],t6=[{type:"run_command",pattern:/(?:Run|Running|Executing)\s+(?:command|bash):\s*(.+)/i,extract:(D)=>({command:D[1]})},{type:"read_file",pattern:/(?:Read|Reading)\s+(?:file):\s*(.+)/i,extract:(D)=>({file:D[1]})},{type:"write_file",pattern:/(?:Write|Writing|Edit|Editing)\s+(?:file|to):\s*(.+)/i,extract:(D)=>({file:D[1]})},{type:"search",pattern:/(?:Search|Searching|Grep|Glob)(?:ing)?:\s*(.+)/i,extract:(D)=>({query:D[1]})}],e9=[{type:"claude_plan_file",pattern:/(~\/\.claude\/plans\/[\w-]+\.md|\/[^\s]+\/\.claude\/plans\/[\w-]+\.md)/,extract:(D)=>({path:D[1]})}];function ED(D){return D.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g,"")}function e6(D){let F=ED(D),E=u2(F,e9);if(E?.extracted?.path){let B=E.extracted.path;if(B.startsWith("~"))B=B.replace("~",process.env.HOME||"");return B}return null}function F0(D,F){let E=ED(D),B=[];for(let $ of F){let X=new RegExp($.pattern.source,$.pattern.flags||"g"),Q;while((Q=X.exec(E))!==null)if(B.push({type:$.type,match:Q,extracted:$.extract?$.extract(Q):void 0}),!$.pattern.flags?.includes("g"))break}return B}function E0(D,F){return F0(D,F).length>0}function u2(D,F){let E=F0(D,F);return E.length>0?E[0]:null}function BD(D,F={}){let{linesToAnalyze:E=50,minConfidence:B=0.3}=F,$=D.split(`
|
|
140
140
|
`),X=$.slice(-E).join(`
|
|
141
|
-
`),Q=ED(X),Y={timestamp:Date.now(),rawOutput:X},q=u2(Q,
|
|
142
|
-
`),G=ED(_),U=F0(G,
|
|
143
|
-
`),M=ED(j);if(E0(M,s6))return{...Y,type:"idle",confidence:0.7};let I=M.trim();if(I.endsWith(">")||I.match(/>\s*$/))return{...Y,type:"idle",detail:"prompt detected",confidence:0.65};return{...Y,type:"unknown",confidence:B}}function D1(D,F){let E=BD(D),B=BD(F);if(E.type==="permission"||E.type==="question")return{complete:!1,reason:`awaiting ${E.type}`,confidence:0.95};if(E.type==="error")return{complete:!0,reason:"error detected",confidence:0.8};if(E.type==="idle")return{complete:!0,reason:"idle prompt detected",confidence:E.confidence};if(E.type==="complete")return{complete:!0,reason:"completion marker detected",confidence:E.confidence};if(B.type==="working"&&E.type!=="working")return{complete:!0,reason:"work finished",confidence:0.6};if(E.type==="working"||E.type==="tool_use")return{complete:!1,reason:"still working",confidence:0.7};return{complete:!1,reason:"unknown state",confidence:0.3}}function F1(D){let F=ED(D),E=u2(F,
|
|
144
|
-
`),$=B.findIndex((J)=>J.match(
|
|
145
|
-
`),Y=J.match(/(?:Command|command|Bash|bash):\s*(.+)/);if(Y)X=Y[1].trim();let q=J.match(/(?:File|file|Path|path):\s*(.+)/);if(q)Q=q[1].trim()}return{type:E.type.replace("_permission",""),command:X,file:Q}}function M3(D){let F=ED(D),E=F0(F,
|
|
141
|
+
`),Q=ED(X),Y={timestamp:Date.now(),rawOutput:X},q=u2(Q,w2);if(q)return{...Y,type:"permission",detail:q.type.replace("_permission",""),confidence:0.9};let H=E0(Q,v0.filter((m)=>m.type==="claude_code_plan_approval")),_=$.slice(-15).join(`
|
|
142
|
+
`),G=ED(_),U=F0(G,v0);if(U.length>0||H){let m=U.filter((n)=>n.type==="claude_code_numbered_options"&&n.extracted?.option).map((n)=>n.extracted.option);if(m.length>=2||H)return{...Y,type:"question",options:m.length>0?m:void 0,detail:H?"plan_approval":void 0,confidence:0.85};let d=U.filter((n)=>n.extracted?.option&&n.type!=="claude_code_numbered_options").map((n)=>n.extracted.option);if(d.length>=2)return{...Y,type:"question",options:d,confidence:0.85}}let z=U.find((m)=>m.type==="yes_no_question");if(z)return{...Y,type:"question",options:["Yes","No"],detail:`default: ${z.extracted?.default||"y"}`,confidence:0.85};let L=u2(Q,r6);if(L)return{...Y,type:"error",detail:L.extracted?.message||L.match[0],confidence:0.8};let V=u2(Q,t6);if(V)return{...Y,type:"tool_use",detail:`${V.type}: ${V.extracted?.command||V.extracted?.file||V.extracted?.query||""}`,confidence:0.75};if(E0(Q,o6))return{...Y,type:"working",confidence:0.7};if(E0(Q,a6))return{...Y,type:"complete",confidence:0.6};let j=$.slice(-5).join(`
|
|
143
|
+
`),M=ED(j);if(E0(M,s6))return{...Y,type:"idle",confidence:0.7};let I=M.trim();if(I.endsWith(">")||I.match(/>\s*$/))return{...Y,type:"idle",detail:"prompt detected",confidence:0.65};return{...Y,type:"unknown",confidence:B}}function D1(D,F){let E=BD(D),B=BD(F);if(E.type==="permission"||E.type==="question")return{complete:!1,reason:`awaiting ${E.type}`,confidence:0.95};if(E.type==="error")return{complete:!0,reason:"error detected",confidence:0.8};if(E.type==="idle")return{complete:!0,reason:"idle prompt detected",confidence:E.confidence};if(E.type==="complete")return{complete:!0,reason:"completion marker detected",confidence:E.confidence};if(B.type==="working"&&E.type!=="working")return{complete:!0,reason:"work finished",confidence:0.6};if(E.type==="working"||E.type==="tool_use")return{complete:!1,reason:"still working",confidence:0.7};return{complete:!1,reason:"unknown state",confidence:0.3}}function F1(D){let F=ED(D),E=u2(F,w2);if(!E)return null;let B=F.split(`
|
|
144
|
+
`),$=B.findIndex((J)=>J.match(w2[0].pattern)||J.match(w2[1].pattern)||J.match(w2[2].pattern)),X,Q;if($>0){let J=B.slice(Math.max(0,$-5),$).join(`
|
|
145
|
+
`),Y=J.match(/(?:Command|command|Bash|bash):\s*(.+)/);if(Y)X=Y[1].trim();let q=J.match(/(?:File|file|Path|path):\s*(.+)/);if(q)Q=q[1].trim()}return{type:E.type.replace("_permission",""),command:X,file:Q}}function M3(D){let F=ED(D),E=F0(F,v0),B=[];for(let $ of E)if($.extracted?.option)B.push($.extracted.option);return B}import{EventEmitter as D4}from"events";class VD extends D4{sessionName;paneId=null;explicitPaneId=null;options;pollTimer=null;lastOutput="";lastOutputTime=Date.now();lastState=null;running=!1;constructor(D,F={}){super();this.sessionName=D,this.explicitPaneId=F.paneId||null,this.options={pollIntervalMs:F.pollIntervalMs??500,captureLines:F.captureLines??30,silenceThresholdMs:F.silenceThresholdMs??3000}}async start(){if(this.running)return;if(this.explicitPaneId)this.paneId=this.explicitPaneId.startsWith("%")?this.explicitPaneId:`%${this.explicitPaneId}`;else{let D=await w(this.sessionName);if(!D)throw Error(`Session "${this.sessionName}" not found`);let F=await x(D.id);if(!F||F.length===0)throw Error(`No windows found in session "${this.sessionName}"`);let E=F.find((X)=>X.active)||F[0],B=await h(E.id);if(!B||B.length===0)throw Error(`No panes found in session "${this.sessionName}"`);let $=B.find((X)=>X.active)||B[0];this.paneId=$.id}this.running=!0,this.lastOutputTime=Date.now(),await this.poll(),this.pollTimer=setInterval(()=>this.poll(),this.options.pollIntervalMs),this.pollTimer.unref(),this.emit("started",{sessionName:this.sessionName,paneId:this.paneId})}stop(){if(this.pollTimer)clearInterval(this.pollTimer),this.pollTimer=null;this.running=!1,this.emit("stopped")}isRunning(){return this.running}getCurrentState(){return this.lastState}getSilenceMs(){return Date.now()-this.lastOutputTime}async poll(){if(!this.paneId||!this.running)return;try{let D=await p(this.paneId,this.options.captureLines),F=Date.now();if(D!==this.lastOutput){let E=this.getNewContent(this.lastOutput,D);if(E)this.lastOutputTime=F,this.emitEvent({type:"output",output:E,timestamp:F}),this.emitEvent({type:"activity",timestamp:F});let B=BD(D);if(this.lastState&&B.type!==this.lastState.type){if(this.emitEvent({type:"state_change",state:B,timestamp:F}),B.type==="permission")this.emitEvent({type:"permission",state:B,timestamp:F});else if(B.type==="question")this.emitEvent({type:"question",state:B,timestamp:F});else if(B.type==="error")this.emitEvent({type:"error",state:B,timestamp:F});let $=D1(D,this.lastOutput);if($.complete&&$.confidence>0.6)this.emitEvent({type:"complete",state:B,timestamp:F})}this.lastState=B,this.lastOutput=D}else{let E=F-this.lastOutputTime;if(E>=this.options.silenceThresholdMs&&E%this.options.silenceThresholdMs<this.options.pollIntervalMs)this.emitEvent({type:"silence",silenceMs:E,timestamp:F})}}catch(D){this.emit("poll_error",D)}}getNewContent(D,F){if(D===F)return null;if(!D)return F;let E=D.split(`
|
|
146
146
|
`),B=F.split(`
|
|
147
147
|
`),$=E[E.length-1],X=B.lastIndexOf($);if(X>=0&&X<B.length-1)return B.slice(X+1).join(`
|
|
148
148
|
`);let Q=new Set(E),J=B.filter((Y)=>!Q.has(Y));return J.length>0?J.join(`
|
|
149
|
-
`):null}emitEvent(D){this.emit(D.type,D),this.emit("event",D)}}async function E1(D,F,E=120000){return new Promise((B,$)=>{let Q=Date.now(),J=setTimeout(()=>{H(),$(Error("Timeout waiting for silence"))},E),Y=()=>{Q=Date.now()},q=setInterval(()=>{if(Date.now()-Q>=F)H(),B()},100),H=()=>{clearTimeout(J),clearInterval(q),D.off("activity",Y)};D.on("activity",Y)})}async function B1(D,F={}){let{silenceMs:E=3000,timeoutMs:B=120000,requireIdle:$=!0}=F;return new Promise((X,Q)=>{let J=setTimeout(()=>{U(),Q(Error("Timeout waiting for completion"))},B),Y=Date.now(),q=null,H=(z)=>{if(z.state)U(),X({state:z.state,reason:"complete event"})},_=()=>{Y=Date.now()},G=(z)=>{if(z.state?.type==="permission"||z.state?.type==="question")return;if($&&z.state?.type==="idle")U(),X({state:z.state,reason:"idle state"});if(z.state?.type==="error")U(),X({state:z.state,reason:"error"})},U=()=>{if(clearTimeout(J),q)clearInterval(q);D.off("complete",H),D.off("activity",_),D.off("state_change",G)};q=setInterval(()=>{let z=Date.now()-Y,
|
|
150
|
-
Options: ${D.options.join(", ")}`;return F+=` [confidence: ${(D.confidence*100).toFixed(0)}%]`,F}function X1(D){let F=new Date(D.timestamp).toISOString().split("T")[1].split(".")[0];switch(D.type){case"output":return`[${F}] OUTPUT: ${(D.output||"").substring(0,100).replace(/\n/g,"\\n")}`;case"state_change":return`[${F}] STATE: ${D.state?.type||"unknown"}${D.state?.detail?` (${D.state.detail})`:""}`;case"silence":return`[${F}] SILENCE: ${D.silenceMs}ms`;case"activity":return`[${F}] ACTIVITY`;case"permission":return`[${F}] PERMISSION: ${D.state?.detail||"unknown"}`;case"question":return`[${F}] QUESTION: ${D.state?.options?.join(", ")||"unknown"}`;case"error":return`[${F}] ERROR: ${D.state?.detail||"unknown"}`;case"complete":return`[${F}] COMPLETE`;default:return`[${F}] ${D.type}`}}async function Q1(D,F={}){try{let E=await
|
|
149
|
+
`):null}emitEvent(D){this.emit(D.type,D),this.emit("event",D)}}async function E1(D,F,E=120000){return new Promise((B,$)=>{let Q=Date.now(),J=setTimeout(()=>{H(),$(Error("Timeout waiting for silence"))},E),Y=()=>{Q=Date.now()},q=setInterval(()=>{if(Date.now()-Q>=F)H(),B()},100),H=()=>{clearTimeout(J),clearInterval(q),D.off("activity",Y)};D.on("activity",Y)})}async function B1(D,F={}){let{silenceMs:E=3000,timeoutMs:B=120000,requireIdle:$=!0}=F;return new Promise((X,Q)=>{let J=setTimeout(()=>{U(),Q(Error("Timeout waiting for completion"))},B),Y=Date.now(),q=null,H=(z)=>{if(z.state)U(),X({state:z.state,reason:"complete event"})},_=()=>{Y=Date.now()},G=(z)=>{if(z.state?.type==="permission"||z.state?.type==="question")return;if($&&z.state?.type==="idle")U(),X({state:z.state,reason:"idle state"});if(z.state?.type==="error")U(),X({state:z.state,reason:"error"})},U=()=>{if(clearTimeout(J),q)clearInterval(q);D.off("complete",H),D.off("activity",_),D.off("state_change",G)};q=setInterval(()=>{let z=Date.now()-Y,L=D.getCurrentState();if(z>=E){if(L&&(L.type==="idle"||L.type==="complete"||L.type==="error"))U(),X({state:L,reason:`silence (${z}ms)`});else if(!$)U(),X({state:L||{type:"unknown",timestamp:Date.now(),rawOutput:"",confidence:0},reason:`silence (${z}ms) - non-idle`})}},500),D.on("complete",H),D.on("activity",_),D.on("state_change",G)})}function E2(D){let F={name:`silence-${D}ms`,totalRuns:0,avgLatencyMs:0,minLatencyMs:1/0,maxLatencyMs:0,falsePositives:0,falseNegatives:0,successRate:1};return{name:`silence-${D}ms`,description:`Detect completion when no output for ${D}ms`,metrics:F,async detect(E,B=120000){let $=Date.now();try{await E1(E,D,B);let X=Date.now()-$;return{complete:!0,state:E.getCurrentState()||void 0,reason:`silence for ${D}ms`,latencyMs:X,method:this.name}}catch(X){return{complete:!1,reason:X instanceof Error?X.message:"unknown error",latencyMs:Date.now()-$,method:this.name}}},recordResult(E,B,$){if(F.totalRuns++,F.avgLatencyMs=(F.avgLatencyMs*(F.totalRuns-1)+E)/F.totalRuns,F.minLatencyMs=Math.min(F.minLatencyMs,E),F.maxLatencyMs=Math.max(F.maxLatencyMs,E),!B)if($)F.falsePositives++;else F.falseNegatives++;F.successRate=(F.totalRuns-F.falsePositives-F.falseNegatives)/F.totalRuns}}}function w0(){let D={name:"state-detection",totalRuns:0,avgLatencyMs:0,minLatencyMs:1/0,maxLatencyMs:0,falsePositives:0,falseNegatives:0,successRate:1};return{name:"state-detection",description:"Detect completion when idle state is detected",metrics:D,async detect(F,E=120000){let B=Date.now();try{let $=await B1(F,{timeoutMs:E,requireIdle:!0,silenceMs:2000}),X=Date.now()-B;return{complete:!0,state:$.state,reason:$.reason,latencyMs:X,method:this.name}}catch($){return{complete:!1,reason:$ instanceof Error?$.message:"unknown error",latencyMs:Date.now()-B,method:this.name}}},recordResult(F,E,B){if(D.totalRuns++,D.avgLatencyMs=(D.avgLatencyMs*(D.totalRuns-1)+F)/D.totalRuns,D.minLatencyMs=Math.min(D.minLatencyMs,F),D.maxLatencyMs=Math.max(D.maxLatencyMs,F),!E)if(B)D.falsePositives++;else D.falseNegatives++;D.successRate=(D.totalRuns-D.falsePositives-D.falseNegatives)/D.totalRuns}}}function O3(D,F,E={}){let{primaryTimeoutMs:B=30000,fallbackTimeoutMs:$=90000}=E,X={name:`hybrid(${D.name},${F.name})`,totalRuns:0,avgLatencyMs:0,minLatencyMs:1/0,maxLatencyMs:0,falsePositives:0,falseNegatives:0,successRate:1};return{name:X.name,description:`Try ${D.name} first, fall back to ${F.name}`,metrics:X,async detect(Q,J=120000){let Y=Date.now(),q=await D.detect(Q,Math.min(B,J));if(q.complete)return{...q,method:this.name,reason:`primary(${q.reason})`};let H=J-(Date.now()-Y);if(H<=0)return{complete:!1,reason:"timeout after primary method",latencyMs:Date.now()-Y,method:this.name};let _=await F.detect(Q,Math.min($,H));return{..._,method:this.name,reason:`fallback(${_.reason})`,latencyMs:Date.now()-Y}},recordResult(Q,J,Y){if(X.totalRuns++,X.avgLatencyMs=(X.avgLatencyMs*(X.totalRuns-1)+Q)/X.totalRuns,X.minLatencyMs=Math.min(X.minLatencyMs,Q),X.maxLatencyMs=Math.max(X.maxLatencyMs,Q),!J)if(Y)X.falsePositives++;else X.falseNegatives++;X.successRate=(X.totalRuns-X.falsePositives-X.falseNegatives)/X.totalRuns}}}function u0(){return O3(w0(),E2(5000),{primaryTimeoutMs:30000,fallbackTimeoutMs:90000})}var B0={"silence-3s":()=>E2(3000),"silence-5s":()=>E2(5000),"silence-10s":()=>E2(1e4),"state-detection":()=>w0(),hybrid:()=>u0(),"aggressive-hybrid":()=>O3(w0(),E2(2000),{primaryTimeoutMs:1e4,fallbackTimeoutMs:30000}),"conservative-hybrid":()=>O3(w0(),E2(1e4),{primaryTimeoutMs:60000,fallbackTimeoutMs:120000})};function N3(D){if(D in B0)return B0[D]();let F=D.match(/^silence-(\d+)(ms|s)?$/);if(F){let E=parseInt(F[1],10),$=(F[2]||"ms")==="s"?E*1000:E;return E2($)}return u0()}async function x2(D,F){let E=await w(D);if(!E)console.error(`\u274C Session "${D}" not found`),process.exit(1);if(F){let X=F.startsWith("%")?F:`%${F}`;return{session:E,paneId:X}}let B=await x(E.id);if(!B||B.length===0)console.error(`\u274C No windows found in session "${D}"`),process.exit(1);let $=await h(B[0].id);if(!$||$.length===0)console.error(`\u274C No panes found in session "${D}"`),process.exit(1);return{session:E,paneId:$[0].id}}function $1(D){let F=`${D.type}`;if(D.detail)F+=` (${D.detail})`;if(D.options&&D.options.length>0)F+=`
|
|
150
|
+
Options: ${D.options.join(", ")}`;return F+=` [confidence: ${(D.confidence*100).toFixed(0)}%]`,F}function X1(D){let F=new Date(D.timestamp).toISOString().split("T")[1].split(".")[0];switch(D.type){case"output":return`[${F}] OUTPUT: ${(D.output||"").substring(0,100).replace(/\n/g,"\\n")}`;case"state_change":return`[${F}] STATE: ${D.state?.type||"unknown"}${D.state?.detail?` (${D.state.detail})`:""}`;case"silence":return`[${F}] SILENCE: ${D.silenceMs}ms`;case"activity":return`[${F}] ACTIVITY`;case"permission":return`[${F}] PERMISSION: ${D.state?.detail||"unknown"}`;case"question":return`[${F}] QUESTION: ${D.state?.options?.join(", ")||"unknown"}`;case"error":return`[${F}] ERROR: ${D.state?.detail||"unknown"}`;case"complete":return`[${F}] COMPLETE`;default:return`[${F}] ${D.type}`}}async function Q1(D,F={}){try{let E=await w(D);if(!E){if(E=await nD(D),!E)console.error(`\u274C Failed to create session "${D}"`),process.exit(1);console.log(`\u2705 Created session "${D}"`)}else console.log(`\u2139\uFE0F Session "${D}" already exists`);let B;if(F.pane)B=F.pane.startsWith("%")?F.pane:`%${F.pane}`;else{let X=await x(E.id);B=(await h(X[0].id))[0].id}let $=F.command||"claude";if(await QD(B,$,!1,!1),console.log(`\u2705 Started "${$}" in session "${D}"`),F.monitor){console.log("\u2139\uFE0F Starting event monitor...");let X=new VD(D,{pollIntervalMs:500,paneId:F.pane});X.on("event",(Q)=>{if(F.json)console.log(JSON.stringify(Q));else console.log(X1(Q))}),X.on("poll_error",(Q)=>{console.error(`\u26A0\uFE0F Poll error: ${Q.message}`)}),await X.start(),console.log("\u2705 Monitor active. Press Ctrl+C to stop."),process.on("SIGINT",()=>{X.stop(),console.log(`
|
|
151
151
|
\u2705 Monitor stopped.`),process.exit(0)}),await new Promise(()=>{})}}catch(E){console.error(`\u274C Error: ${E.message}`),process.exit(1)}}async function J1(D,F,E={}){try{let{paneId:B}=await x2(D,E.pane),$=F.replace(/'/g,"'\\''");if(await O(`send-keys -t '${B}' '${$}' Enter`),E.noWait){console.log(`\u2705 Message sent to session "${D}"`);return}let X=new VD(D,{pollIntervalMs:250,paneId:E.pane});await X.start();let Q=E.method?N3(E.method):u0(),J=E.timeout||120000;console.log(`\u2139\uFE0F Waiting for completion using "${Q.name}"...`);try{let Y=await Q.detect(X,J);if(X.stop(),E.json)console.log(JSON.stringify(Y,null,2));else if(console.log(`\u2705 Completion detected: ${Y.reason}`),console.log(` Latency: ${Y.latencyMs}ms`),Y.state)console.log(` State: ${$1(Y.state)}`);let q=await p(B,100);console.log(`
|
|
152
152
|
--- Response ---`),console.log(ED(q).trim())}catch(Y){X.stop(),console.error(`\u274C Completion detection failed: ${Y.message}`),process.exit(1)}}catch(B){console.error(`\u274C Error: ${B.message}`),process.exit(1)}}async function Y1(D,F={}){try{let{paneId:E}=await x2(D,F.pane),B=await p(E,100),$=BD(B),X=null,Q=[],J=null;if($.type==="permission")X=F1(B);else if($.type==="question"){if(Q=M3(B),$.detail==="plan_approval")J=e6(B)}if(F.json)console.log(JSON.stringify({session:D,state:$.type,detail:$.detail,confidence:$.confidence,timestamp:$.timestamp,permissionDetails:X,questionOptions:Q,planFile:J},null,2));else{if(console.log(`Session: ${D}`),console.log(`State: ${$.type}`),$.detail)console.log(`Detail: ${$.detail}`);if(console.log(`Confidence: ${($.confidence*100).toFixed(0)}%`),X){if(console.log(`
|
|
153
153
|
Permission Request:`),console.log(` Type: ${X.type}`),X.command)console.log(` Command: ${X.command}`);if(X.file)console.log(` File: ${X.file}`)}if(Q.length>0)console.log(`
|
|
@@ -157,47 +157,47 @@ Plan File: ${J}`);let q=ED(B).trim().split(`
|
|
|
157
157
|
Last output:`),q.forEach((H)=>console.log(` ${H}`))}}catch(E){console.error(`\u274C Error: ${E.message}`),process.exit(1)}}async function S3(D,F={}){try{let E=new VD(D,{pollIntervalMs:F.poll||500,paneId:F.pane});E.on("event",($)=>{if(F.json)console.log(JSON.stringify($));else console.log(X1($))}),E.on("poll_error",($)=>{console.error(`\u26A0\uFE0F Poll error: ${$.message}`)}),await E.start(),console.log(`\u2705 Watching session "${D}". Press Ctrl+C to stop.`);let B=E.getCurrentState();if(B)console.log(`Initial state: ${$1(B)}`);process.on("SIGINT",()=>{E.stop(),console.log(`
|
|
158
158
|
\u2705 Watch stopped.`),process.exit(0)}),await new Promise(()=>{})}catch(E){console.error(`\u274C Error: ${E.message}`),process.exit(1)}}async function T3(D,F={}){try{let{paneId:E}=await x2(D,F.pane),B=await p(E,50),$=BD(B);if($.type!=="permission"&&!F.auto){console.log(`\u2139\uFE0F No permission request pending (state: ${$.type})`);return}if(F.deny)await O(`send-keys -t '${E}' Down`),await KD(100);if(await O(`send-keys -t '${E}' Enter`),console.log(`\u2705 ${F.deny?"Denied":"Approved"} permission in session "${D}"`),F.auto){console.log("\u2139\uFE0F Auto-approve mode enabled. Press Ctrl+C to stop.");let X=new VD(D,{pollIntervalMs:250,paneId:F.pane});X.on("permission",async(Q)=>{try{let{paneId:J}=await x2(D,F.pane),Y=F.deny?"n":"y";await QD(J,Y,!1,!0),console.log(`\u2705 Auto-${F.deny?"denied":"approved"}: ${Q.state?.detail||"unknown"}`)}catch(J){console.error(`\u26A0\uFE0F Auto-approve failed: ${J.message}`)}}),await X.start(),process.on("SIGINT",()=>{X.stop(),console.log(`
|
|
159
159
|
\u2705 Auto-approve stopped.`),process.exit(0)}),await new Promise(()=>{})}}catch(E){console.error(`\u274C Error: ${E.message}`),process.exit(1)}}async function b3(D,F,E={}){try{let{paneId:B}=await x2(D,E.pane),$=await p(B,50),X=BD($);if(X.type!=="question"){console.log(`\u2139\uFE0F No question pending (state: ${X.type})`);return}if(F.startsWith("text:")){let Q=F.slice(5);await O(`send-keys -t '${B}' End`),await KD(100),await O(`send-keys -t '${B}' Enter`),await KD(100),await O(`send-keys -t '${B}' ${F4(Q)}`),await KD(100),await O(`send-keys -t '${B}' Enter`),console.log(`\u2705 Sent feedback: "${Q.substring(0,50)}${Q.length>50?"...":""}"`)}else if(/^\d+$/.test(F)){let Q=parseInt(F,10),Y=ED($).split(`
|
|
160
|
-
`),q=1;for(let _=0;_<Y.length;_++)if(Y[_].match(/^\s*\u276F\s*\d+\./)){let G=Y[_].match(/\u276F\s*(\d+)\./);if(G)q=parseInt(G[1],10);break}let H=Q-q;if(H>0)for(let _=0;_<H;_++)await O(`send-keys -t '${B}' Down`),await KD(50);else if(H<0)for(let _=0;_<Math.abs(H);_++)await O(`send-keys -t '${B}' Up`),await KD(50);await KD(100),await O(`send-keys -t '${B}' Enter`),console.log(`\u2705 Selected option ${Q} in session "${D}"`)}else await O(`send-keys -t '${B}' '${F}'`),console.log(`\u2705 Sent '${F}' to session "${D}"`)}catch(B){console.error(`\u274C Error: ${B.message}`),process.exit(1)}}function F4(D){return`"${D.replace(/"/g,"\\\"").replace(/\$/g,"\\$")}"`}function KD(D){return new Promise((F)=>setTimeout(F,D))}async function q1(D,F={}){let E=F.runs||1,B=F.task||'echo "Hello, World!"';console.log(`\uD83E\uDDEA Experiment: Testing "${D}" method`),console.log(` Runs: ${E}`),console.log(` Task: ${B}`),console.log("");let $=N3(D),X=[],Q=`orc-experiment-${Date.now()}`,J=await nD(Q);if(!J)console.error("\u274C Failed to create test session"),process.exit(1);try{let Y=await x(J.id),H=(await h(Y[0].id))[0].id;for(let
|
|
161
|
-
Run ${
|
|
162
|
-
--- Summary ---`),F.json)console.log(JSON.stringify(
|
|
163
|
-
\u2705 Cleaned up test session`)}}async function H1(){console.log("Available completion methods:"),console.log("");for(let D of Object.keys(B0)){let F=B0[D]();console.log(` ${D}`),console.log(` ${F.description}`),console.log("")}console.log("Custom methods:"),console.log(" silence-Xms - Silence timeout (e.g., silence-2000ms)"),console.log(" silence-Xs - Silence timeout (e.g., silence-5s)")}async function P3(D,F,E={}){try{let{paneId:B}=await x2(D,E.pane),$=E.timeout||300000;await QD(B,F,!1,!1),console.log(`\u2705 Sent task: "${F.substring(0,50)}${F.length>50?"...":""}"`);let X=new VD(D,{pollIntervalMs:250,paneId:E.pane});await X.start();let Q=Date.now();console.log(`\u2139\uFE0F Monitoring for completion...${E.autoApprove?" (auto-approve enabled)":""}`);let J=null,Y=async()=>{let _=await p(B,30),G=BD(_);if(G.type!==J){let U=((Date.now()-Q)/1000).toFixed(1);console.log(`[${U}s] State: ${G.type}${G.detail?` (${G.detail})`:""}`),J=G.type}if(G.type==="permission"&&E.autoApprove)return console.log(" \u21B3 Auto-approving permission..."),await O(`send-keys -t '${B}' Enter`),await KD(200),!1;if(G.type==="question"){if(G.detail==="plan_approval"&&E.autoApprove)return console.log(" \u21B3 Auto-approving plan..."),await O(`send-keys -t '${B}' Enter`),await KD(200),!1;console.log("\u26A0\uFE0F Question requires manual input");let U=M3(_);if(U.length>0)console.log(" Options:"),U.forEach((z,
|
|
164
|
-
`).filter((B)=>B.trim());if(E.length>0){let B=E[0].match(/^(bd-\d+)/);if(B)return V1(B[1])}return null}}async function j4(D){let{exitCode:F}=await l3(["update",D,"--status","in_progress"]);return F===0}async function A1(){try{return(await O("display-message -p '#{session_name}'")).trim()||null}catch{return null}}async function M4(D,F){let E=await import("fs/promises"),B=X2(F,R4),$=X2(B,D);try{await E.mkdir(B,{recursive:!0})}catch{}try{if((await E.stat($)).isDirectory())return console.log(`\u2139\uFE0F Worktree for ${D} already exists`),$}catch{}let X=`work/${D}`;try{try{await g3`git -C ${F} branch ${X}`.quiet()}catch{}await g3`git -C ${F} worktree add ${$} ${X}`.quiet();let Q=X2($,".genie");return await E.mkdir(Q,{recursive:!0}),await E.writeFile(X2(Q,"redirect"),X2(F,".genie")),$}catch(Q){return console.error(`\u26A0\uFE0F Failed to create worktree: ${Q.message}`),null}}async function C1(D,F){try{let E=await
|
|
160
|
+
`),q=1;for(let _=0;_<Y.length;_++)if(Y[_].match(/^\s*\u276F\s*\d+\./)){let G=Y[_].match(/\u276F\s*(\d+)\./);if(G)q=parseInt(G[1],10);break}let H=Q-q;if(H>0)for(let _=0;_<H;_++)await O(`send-keys -t '${B}' Down`),await KD(50);else if(H<0)for(let _=0;_<Math.abs(H);_++)await O(`send-keys -t '${B}' Up`),await KD(50);await KD(100),await O(`send-keys -t '${B}' Enter`),console.log(`\u2705 Selected option ${Q} in session "${D}"`)}else await O(`send-keys -t '${B}' '${F}'`),console.log(`\u2705 Sent '${F}' to session "${D}"`)}catch(B){console.error(`\u274C Error: ${B.message}`),process.exit(1)}}function F4(D){return`"${D.replace(/"/g,"\\\"").replace(/\$/g,"\\$")}"`}function KD(D){return new Promise((F)=>setTimeout(F,D))}async function q1(D,F={}){let E=F.runs||1,B=F.task||'echo "Hello, World!"';console.log(`\uD83E\uDDEA Experiment: Testing "${D}" method`),console.log(` Runs: ${E}`),console.log(` Task: ${B}`),console.log("");let $=N3(D),X=[],Q=`orc-experiment-${Date.now()}`,J=await nD(Q);if(!J)console.error("\u274C Failed to create test session"),process.exit(1);try{let Y=await x(J.id),H=(await h(Y[0].id))[0].id;for(let V=0;V<E;V++){console.log(`
|
|
161
|
+
Run ${V+1}/${E}...`),await QD(H,"clear",!1,!1),await new Promise((I)=>setTimeout(I,500));let j=new VD(Q,{pollIntervalMs:100});await j.start(),await QD(H,B,!1,!1);let M=await $.detect(j,30000);if(j.stop(),X.push({run:V+1,latencyMs:M.latencyMs,complete:M.complete,reason:M.reason}),console.log(` Complete: ${M.complete}`),console.log(` Latency: ${M.latencyMs}ms`),console.log(` Reason: ${M.reason}`),V<E-1)await new Promise((I)=>setTimeout(I,1000))}let _=X.filter((V)=>V.complete),G=_.reduce((V,j)=>V+j.latencyMs,0)/_.length||0,U=Math.min(..._.map((V)=>V.latencyMs))||0,z=Math.max(..._.map((V)=>V.latencyMs))||0,L={method:D,totalRuns:E,successfulRuns:_.length,successRate:_.length/E*100,avgLatencyMs:Math.round(G),minLatencyMs:U,maxLatencyMs:z,results:X};if(console.log(`
|
|
162
|
+
--- Summary ---`),F.json)console.log(JSON.stringify(L,null,2));else console.log(`Method: ${L.method}`),console.log(`Success Rate: ${L.successRate.toFixed(1)}%`),console.log(`Avg Latency: ${L.avgLatencyMs}ms`),console.log(`Min Latency: ${L.minLatencyMs}ms`),console.log(`Max Latency: ${L.maxLatencyMs}ms`)}finally{await M0(J.id),console.log(`
|
|
163
|
+
\u2705 Cleaned up test session`)}}async function H1(){console.log("Available completion methods:"),console.log("");for(let D of Object.keys(B0)){let F=B0[D]();console.log(` ${D}`),console.log(` ${F.description}`),console.log("")}console.log("Custom methods:"),console.log(" silence-Xms - Silence timeout (e.g., silence-2000ms)"),console.log(" silence-Xs - Silence timeout (e.g., silence-5s)")}async function P3(D,F,E={}){try{let{paneId:B}=await x2(D,E.pane),$=E.timeout||300000;await QD(B,F,!1,!1),console.log(`\u2705 Sent task: "${F.substring(0,50)}${F.length>50?"...":""}"`);let X=new VD(D,{pollIntervalMs:250,paneId:E.pane});await X.start();let Q=Date.now();console.log(`\u2139\uFE0F Monitoring for completion...${E.autoApprove?" (auto-approve enabled)":""}`);let J=null,Y=async()=>{let _=await p(B,30),G=BD(_);if(G.type!==J){let U=((Date.now()-Q)/1000).toFixed(1);console.log(`[${U}s] State: ${G.type}${G.detail?` (${G.detail})`:""}`),J=G.type}if(G.type==="permission"&&E.autoApprove)return console.log(" \u21B3 Auto-approving permission..."),await O(`send-keys -t '${B}' Enter`),await KD(200),!1;if(G.type==="question"){if(G.detail==="plan_approval"&&E.autoApprove)return console.log(" \u21B3 Auto-approving plan..."),await O(`send-keys -t '${B}' Enter`),await KD(200),!1;console.log("\u26A0\uFE0F Question requires manual input");let U=M3(_);if(U.length>0)console.log(" Options:"),U.forEach((z,L)=>console.log(` [${L+1}] ${z}`));return!0}if(G.type==="idle"){let U=((Date.now()-Q)/1000).toFixed(1);return console.log(`\u2705 Task complete (${U}s)`),!0}if(G.type==="error")return console.log("\u274C Task encountered error"),!0;return!1},q=500,H=Math.ceil($/q);for(let _=0;_<H;_++){if(await Y())break;if(Date.now()-Q>$){console.log(`\u26A0\uFE0F Timeout after ${$/1000}s`);break}await KD(q)}if(X.stop(),E.json){let _=await p(B,30),G=BD(_);console.log(JSON.stringify({session:D,state:G.type,detail:G.detail,elapsedMs:Date.now()-Q},null,2))}}catch(B){console.error(`\u274C Error: ${B.message}`),process.exit(1)}}var{$:g3}=globalThis.Bun;import{randomUUID as K4}from"crypto";mD();var{$:A4}=globalThis.Bun;var u3="gt:agent";function jD(){return process.env.TERM_USE_BEADS_REGISTRY!=="false"}async function s(D){try{let F=await A4`bd ${D}`.quiet();return{stdout:F.stdout.toString().trim(),stderr:F.stderr.toString().trim(),exitCode:0}}catch(F){return{stdout:F.stdout?.toString().trim()||"",stderr:F.stderr?.toString().trim()||"",exitCode:F.exitCode||1}}}function X0(D){if(!D)return null;try{return JSON.parse(D)}catch{return null}}async function C4(D,F){let E=`Worker: ${D}`,{stdout:B,exitCode:$}=await s(["create",`--title=${E}`,"--type=agent",`--label=${u3}`,`--label=worker:${D}`,"--json"]);if($!==0)throw Error(`Failed to create agent bead: ${B}`);let X=X0(B);if(!X?.id)throw Error("Failed to parse created agent bead");let Q=JSON.stringify({paneId:F.paneId,session:F.session,worktree:F.worktree,repoPath:F.repoPath,taskId:F.taskId,taskTitle:F.taskTitle,claudeSessionId:F.claudeSessionId,startedAt:new Date().toISOString()});return await s(["update",X.id,`--metadata=${Q}`]),X.id}async function k0(D,F){let E=await $2(D);if(E)return E.id;return C4(D,F)}async function $2(D){let{stdout:F,exitCode:E}=await s(["list",`--label=${u3}`,`--label=worker:${D}`,"--json"]);if(E!==0||!F)return null;return X0(F)?.[0]||null}async function Q0(D){let{exitCode:F}=await s(["delete",D]);if(F===0)return!0;let E=await $2(D);if(E)return{exitCode:F}=await s(["delete",E.id]),F===0;return!1}function z4(D){switch(D){case"spawning":return"spawning";case"working":return"working";case"idle":return"idle";case"permission":return"blocked";case"question":return"blocked";case"done":return"done";case"error":return"error";default:return"unknown"}}function V4(D){switch(D){case"spawning":return"spawning";case"working":return"working";case"idle":return"idle";case"blocked":return"permission";case"done":return"done";case"error":return"error";default:return"idle"}}async function DD(D,F){let E=await $2(D);if(!E)throw Error(`Agent not found for worker ${D}`);let B=z4(F),{exitCode:$,stderr:X}=await s(["agent","state",E.id,B]);if($!==0)throw Error(`Failed to set agent state: ${X}`)}async function x3(D){let F=await $2(D);if(!F)return;await s(["agent","heartbeat",F.id])}async function y0(D,F){let E=await $2(D);if(!E)throw Error(`Agent not found for worker ${D}`);let{exitCode:B,stderr:$}=await s(["slot","set",E.id,"hook",F]);if(B!==0)throw Error(`Failed to bind work: ${$}`)}async function J0(D){let F=await $2(D);if(!F)return;await s(["slot","clear",F.id,"hook"])}function G1(D,F){return{id:F.taskId,paneId:F.paneId,session:F.session,worktree:F.worktree,taskId:F.taskId,taskTitle:F.taskTitle,wishSlug:F.wishSlug,groupNumber:F.groupNumber,startedAt:F.startedAt,state:V4(D.state||"idle"),lastStateChange:new Date().toISOString(),repoPath:F.repoPath,claudeSessionId:F.claudeSessionId}}async function k3(D){let F=await $2(D);if(!F)return null;let{stdout:E,exitCode:B}=await s(["show",F.id,"--json"]);if(B!==0||!E)return null;let $=X0(E);if(!$?.metadata)return null;return G1($,$.metadata)}async function y3(){let{stdout:D,exitCode:F}=await s(["list",`--label=${u3}`,"--json"]);if(F!==0||!D)return[];let E=X0(D);if(!E)return[];let B=[];for(let $ of E)if($.metadata)B.push(G1($,$.metadata));return B}async function W1(D){let F=await y3(),E=D.startsWith("%")?D:`%${D}`;return F.find((B)=>B.paneId===E)||null}async function cD(D){return k3(D)}async function pD(){let{stdout:D,exitCode:F}=await s(["daemon","status","--json"]);if(F!==0)return{running:!1};return X0(D)||{running:!1}}async function Y0(D){let F=["daemon","start"];if(D?.autoCommit)F.push("--auto-commit");if(D?.autoPush)F.push("--auto-push");let{exitCode:E}=await s(F);return E===0}async function h3(){let{exitCode:D}=await s(["daemon","stop"]);return D===0}async function h0(D){let{exitCode:F}=await s(["worktree","remove",D]);return F===0}async function U1(D){await J0(D),await Q0(D)}async function g0(D,F){await DD(D,F),await x3(D)}import{join as X2}from"path";var dD=jD(),R4=".genie/worktrees";async function l3(D){try{return{stdout:(await g3`bd ${D}`.quiet()).stdout.toString().trim(),exitCode:0}}catch(F){return{stdout:F.stdout?.toString().trim()||"",exitCode:F.exitCode||1}}}async function V1(D){let{stdout:F,exitCode:E}=await l3(["show",D,"--json"]);if(E!==0||!F)return null;try{let B=JSON.parse(F),$=Array.isArray(B)?B[0]:B;if(!$)return null;return{id:$.id,title:$.title||$.description?.substring(0,50)||"Untitled",status:$.status,description:$.description,blockedBy:$.blockedBy||[]}}catch{return null}}async function L4(){let{stdout:D,exitCode:F}=await l3(["ready","--json"]);if(F!==0||!D)return null;try{let E=JSON.parse(D);if(Array.isArray(E)&&E.length>0){let B=E[0];return{id:B.id,title:B.title||B.description?.substring(0,50)||"Untitled",status:B.status,description:B.description,blockedBy:B.blockedBy||[]}}return null}catch{let E=D.split(`
|
|
164
|
+
`).filter((B)=>B.trim());if(E.length>0){let B=E[0].match(/^(bd-\d+)/);if(B)return V1(B[1])}return null}}async function j4(D){let{exitCode:F}=await l3(["update",D,"--status","in_progress"]);return F===0}async function A1(){try{return(await O("display-message -p '#{session_name}'")).trim()||null}catch{return null}}async function M4(D,F){let E=await import("fs/promises"),B=X2(F,R4),$=X2(B,D);try{await E.mkdir(B,{recursive:!0})}catch{}try{if((await E.stat($)).isDirectory())return console.log(`\u2139\uFE0F Worktree for ${D} already exists`),$}catch{}let X=`work/${D}`;try{try{await g3`git -C ${F} branch ${X}`.quiet()}catch{}await g3`git -C ${F} worktree add ${$} ${X}`.quiet();let Q=X2($,".genie");return await E.mkdir(Q,{recursive:!0}),await E.writeFile(X2(Q,"redirect"),X2(F,".genie")),$}catch(Q){return console.error(`\u26A0\uFE0F Failed to create worktree: ${Q.message}`),null}}async function C1(D,F){try{let E=await w(D);if(!E)return console.error(`\u274C Session "${D}" not found`),null;let B=await x(E.id);if(!B||B.length===0)return console.error(`\u274C No windows in session "${D}"`),null;let $=B.find((Y)=>Y.active)||B[0],X=await h($.id);if(!X||X.length===0)return console.error(`\u274C No panes in window "${$.name}"`),null;let Q=X.find((Y)=>Y.active)||X[0],J=await U2(Q.id,"horizontal",50,F);if(!J)return console.error("\u274C Failed to create new pane"),null;return{paneId:J.id}}catch(E){return console.error(`\u274C Error spawning worker pane: ${E.message}`),null}}function z1(D,F,E){let B=new VD(F,{pollIntervalMs:1000,paneId:E});B.on("state_change",async($)=>{if(!$.state)return;let X;switch($.state.type){case"working":case"tool_use":X="working";break;case"idle":X="idle";break;case"permission":X="permission";break;case"question":X="question";break;case"error":X="error";break;case"complete":X="done";break;default:return}try{if(dD)await g0(D,X);await PD(D,X)}catch{}}),B.on("poll_error",()=>{if(dD)U1(D).catch(()=>{});B2(D).catch(()=>{}),B.stop()}),B.start().catch(()=>{})}async function K1(D,F={}){try{let E=process.cwd();if(dD){if(!(await pD()).running)if(console.log("\uD83D\uDD04 Starting beads daemon for auto-sync..."),await Y0({autoCommit:!0}))console.log(" \u2705 Daemon started");else console.log(" \u26A0\uFE0F Daemon failed to start (non-fatal)")}let B=null;if(D==="next"){if(console.log("\uD83D\uDD0D Finding next ready issue..."),B=await L4(),!B){console.log("\u2139\uFE0F No ready issues. Run `bd ready` to see the queue.");return}console.log(`\uD83D\uDCCB Found: ${B.id} - "${B.title}"`)}else if(D==="wish")console.error("\u274C `term work wish` is not yet implemented. Coming in Phase 1.5."),process.exit(1);else if(B=await V1(D),!B)console.error(`\u274C Issue "${D}" not found. Run \`bd list\` to see issues.`),process.exit(1);let $=B.id,X=dD?await cD($):null;if(!X)X=await LD($);if(X){if(X.claudeSessionId&&F.resume!==!1){console.log(`\uD83D\uDCCB Found existing worker for ${$} with resumable session`),console.log(` Session ID: ${X.claudeSessionId}`),console.log(" Resuming previous Claude session...");let M=F.session||await A1();if(!M)console.error("\u274C Not in a tmux session. Attach to a session first or use --session."),process.exit(1);let I=X.worktree||X.repoPath;console.log("\uD83D\uDE80 Spawning worker pane...");let m=await C1(M,I);if(!m)process.exit(1);let{paneId:d}=m;if(await v3(X.id,{paneId:d,session:M,state:"spawning",lastStateChange:new Date().toISOString()}),dD)await DD(X.id,"spawning").catch(()=>{});let n=X2(X.repoPath,".genie"),C0=I.replace(/'/g,"'\\''");if(await QD(d,`cd '${C0}' && BEADS_DIR='${n}' claude --resume '${X.claudeSessionId}'`,!0,!1),dD)await DD(X.id,"working").catch(()=>{});if(await PD(X.id,"working"),z1(X.id,M,d),F.focus===!0)await O(`select-pane -t '${d}'`);console.log(`
|
|
165
165
|
\u2705 Resumed worker for ${$}`),console.log(` Pane: ${d}`),console.log(` Session: ${M}`),console.log(` Claude Session: ${X.claudeSessionId}`),console.log(`
|
|
166
|
-
Commands:`),console.log(" term workers - Check worker status"),console.log(` term approve ${$} - Approve permissions`),console.log(` term close ${$} - Close issue when done`),console.log(` term kill ${$} - Force kill worker`);return}console.error(`\u274C ${$} already has a worker (pane ${X.paneId})`),console.log(` Run \`term kill ${X.id}\` first, or work on a different issue.`),process.exit(1)}let Q=F.session||await A1();if(!Q)console.error("\u274C Not in a tmux session. Attach to a session first or use --session."),process.exit(1);if(console.log(`\uD83D\uDCDD Claiming ${$}...`),!await j4($))console.error(`\u274C Failed to claim ${$}. Check \`bd show ${$}\`.`),process.exit(1);let Y=E,q=null;if(!F.noWorktree)if(console.log(`\uD83C\uDF33 Creating worktree for ${$}...`),q=await M4($,E),q)Y=q,console.log(` Created: ${q}`);else console.log("\u26A0\uFE0F Worktree creation failed. Using shared repo.");console.log("\uD83D\uDE80 Spawning worker pane...");let H=await C1(Q,Y);if(!H)process.exit(1);let{paneId:_}=H,G=K4(),U={id:$,paneId:_,session:Q,worktree:q,taskId:$,taskTitle:B.title,startedAt:new Date().toISOString(),state:"spawning",lastStateChange:new Date().toISOString(),repoPath:E,claudeSessionId:G};if(dD)try{let M=await k0($,{paneId:_,session:Q,worktree:q,repoPath:E,taskId:$,taskTitle:B.title,claudeSessionId:G});await y0($,$),await DD($,"spawning")}catch(M){console.log(`\u26A0\uFE0F Beads registration failed: ${M.message} (non-fatal)`)}await $0(U);let
|
|
166
|
+
Commands:`),console.log(" term workers - Check worker status"),console.log(` term approve ${$} - Approve permissions`),console.log(` term close ${$} - Close issue when done`),console.log(` term kill ${$} - Force kill worker`);return}console.error(`\u274C ${$} already has a worker (pane ${X.paneId})`),console.log(` Run \`term kill ${X.id}\` first, or work on a different issue.`),process.exit(1)}let Q=F.session||await A1();if(!Q)console.error("\u274C Not in a tmux session. Attach to a session first or use --session."),process.exit(1);if(console.log(`\uD83D\uDCDD Claiming ${$}...`),!await j4($))console.error(`\u274C Failed to claim ${$}. Check \`bd show ${$}\`.`),process.exit(1);let Y=E,q=null;if(!F.noWorktree)if(console.log(`\uD83C\uDF33 Creating worktree for ${$}...`),q=await M4($,E),q)Y=q,console.log(` Created: ${q}`);else console.log("\u26A0\uFE0F Worktree creation failed. Using shared repo.");console.log("\uD83D\uDE80 Spawning worker pane...");let H=await C1(Q,Y);if(!H)process.exit(1);let{paneId:_}=H,G=K4(),U={id:$,paneId:_,session:Q,worktree:q,taskId:$,taskTitle:B.title,startedAt:new Date().toISOString(),state:"spawning",lastStateChange:new Date().toISOString(),repoPath:E,claudeSessionId:G};if(dD)try{let M=await k0($,{paneId:_,session:Q,worktree:q,repoPath:E,taskId:$,taskTitle:B.title,claudeSessionId:G});await y0($,$),await DD($,"spawning")}catch(M){console.log(`\u26A0\uFE0F Beads registration failed: ${M.message} (non-fatal)`)}await $0(U);let L=(F.prompt||`Work on beads issue ${$}: "${B.title}"
|
|
167
167
|
|
|
168
168
|
## Description
|
|
169
169
|
${B.description||"No description provided."}
|
|
170
170
|
|
|
171
|
-
When you're done, commit your changes and let me know.`).replace(/'/g,"'\\''"),
|
|
171
|
+
When you're done, commit your changes and let me know.`).replace(/'/g,"'\\''"),V=X2(E,".genie"),j=Y.replace(/'/g,"'\\''");if(await QD(_,`cd '${j}' && BEADS_DIR='${V}' claude --session-id '${G}' '${L}'`,!0,!1),console.log(` Session ID: ${G}`),dD)await DD($,"working").catch(()=>{});if(await PD($,"working"),z1($,Q,_),F.focus===!0)await O(`select-pane -t '${_}'`);if(console.log(`
|
|
172
172
|
\u2705 Worker started for ${$}`),console.log(` Pane: ${_}`),console.log(` Session: ${Q}`),q)console.log(` Worktree: ${q}`);console.log(`
|
|
173
173
|
Commands:`),console.log(" term workers - Check worker status"),console.log(` term approve ${$} - Approve permissions`),console.log(` term close ${$} - Close issue when done`),console.log(` term kill ${$} - Force kill worker`)}catch(E){console.error(`\u274C Error: ${E.message}`),process.exit(1)}}var{$:R1}=globalThis.Bun;mD();var m3=jD();async function N4(D){try{return await p(D,1),!0}catch{return!1}}async function S4(D){try{let F=await p(D,30),E=BD(F);switch(E.type){case"working":case"tool_use":return"working";case"idle":return"idle";case"permission":return"\u26A0\uFE0F perm";case"question":return"\u26A0\uFE0F question";case"error":return"\u274C error";case"complete":return"\u2705 done";default:return E.type}}catch{return"unknown"}}async function T4(){let D=[],F=[];try{let B=(await R1`bd ready --json`.quiet()).stdout.toString().trim();if(B)try{let $=JSON.parse(B);for(let X of $)D.push(`${X.id}`)}catch{let $=B.split(`
|
|
174
174
|
`).filter((X)=>X.trim());for(let X of $){let Q=X.match(/^(bd-\d+)/);if(Q)D.push(Q[1])}}}catch{}try{let B=(await R1`bd list --json`.quiet()).stdout.toString().trim();if(B)try{let $=JSON.parse(B);for(let X of $)if(X.blockedBy&&X.blockedBy.length>0)F.push(`${X.id} (blocked by ${X.blockedBy.join(", ")})`)}catch{}}catch{}return{ready:D,blocked:F}}function b4(D){let F=new Date(D).getTime(),E=Date.now()-F,B=Math.floor(E/60000),$=Math.floor(B/60);if($>0)return`${$}h ${B%60}m`;else if(B>0)return`${B}m`;return"<1m"}async function L1(D={}){try{let F=[];if(m3)try{F=await y3()}catch{F=await RD()}else F=await RD();let E=await RD(),B=new Set(F.map((q)=>q.id));for(let q of E)if(!B.has(q.id))F.push(q);let $=[];for(let q of F){let H=await N4(q.paneId),_=q.state;if(H){_=await S4(q.paneId);let G=P4(_);if(G&&G!==q.state){if(m3)await g0(q.id,G).catch(()=>{});await PD(q.id,G)}else if(m3)await x3(q.id).catch(()=>{})}else _="\uD83D\uDC80 dead";$.push({name:q.id,pane:q.paneId,task:q.taskTitle?`"${q.taskTitle.substring(0,25)}${q.taskTitle.length>25?"...":""}"`:q.taskId,state:_,time:b4(q.startedAt),alive:H})}let X=await T4(),Q=F.filter((q)=>$.find((H)=>H.name===q.id&&H.alive)).map((q)=>q.taskId),J=X.ready.filter((q)=>!Q.includes(q));if(D.json){console.log(JSON.stringify({workers:$,queue:{ready:J,blocked:X.blocked}},null,2));return}if(console.log("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"),console.log("\u2502 WORKERS \u2502"),console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2524"),console.log("\u2502 Name \u2502 Pane \u2502 Task \u2502 State \u2502Time\u2502"),console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2524"),$.length===0)console.log("\u2502 (no workers) \u2502");else for(let q of $){let H=q.name.padEnd(8).substring(0,8),_=q.pane.padEnd(8).substring(0,8),G=q.task.padEnd(25).substring(0,25),U=q.state.padEnd(8).substring(0,8),z=q.time.padStart(4).substring(0,4);console.log(`\u2502 ${H} \u2502 ${_} \u2502 ${G} \u2502 ${U} \u2502${z}\u2502`)}if(console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2518"),X.blocked.length>0)console.log(`
|
|
175
175
|
Blocked: ${X.blocked.slice(0,5).join(", ")}${X.blocked.length>5?"...":""}`);if(J.length>0)console.log(`Ready: ${J.slice(0,5).join(", ")}${J.length>5?"...":""}`);else if($.length>0)console.log(`
|
|
176
176
|
Ready: (none - all assigned or blocked)`);let Y=$.filter((q)=>!q.alive);if(Y.length>0)console.log(`
|
|
177
|
-
\u26A0\uFE0F ${Y.length} dead worker(s) detected. Run \`term kill <name>\` to clean up.`)}catch(F){console.error(`\u274C Error: ${F.message}`),process.exit(1)}}function P4(D){if(D==="working")return"working";if(D==="idle")return"idle";if(D==="\u26A0\uFE0F perm")return"permission";if(D==="\u26A0\uFE0F question")return"question";if(D==="\u274C error")return"error";if(D==="\u2705 done")return"done";return null}var{$:U0}=globalThis.Bun;var q0=(D,F=[])=>D.name==="up"||F.includes("vim")&&D.name==="k"||F.includes("emacs")&&D.ctrl&&D.name==="p",l0=(D,F=[])=>D.name==="down"||F.includes("vim")&&D.name==="j"||F.includes("emacs")&&D.ctrl&&D.name==="n";var c3=(D)=>D.name==="backspace",Q2=(D)=>D.name==="tab";var fD=(D)=>D.name==="enter"||D.name==="return";class p3 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class d3 extends Error{name="CancelPromptError";message="Prompt was canceled"}class m0 extends Error{name="ExitPromptError"}class i3 extends Error{name="HookError"}class n3 extends Error{name="ValidationError"}import{AsyncResource as v4}from"async_hooks";import{AsyncLocalStorage as Z4,AsyncResource as I4}from"async_hooks";var j1=new Z4;function w4(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function M1(D,F){let E=w4(D);return j1.run(E,()=>{function B($){E.handleChange=()=>{E.index=0,$()},E.handleChange()}return F(B)})}function J2(){let D=j1.getStore();if(!D)throw new i3("[Inquirer] Hook functions can only be called from within a prompt");return D}function r3(){return J2().rl}function a3(D){let F=(...E)=>{let B=J2(),$=!1,X=B.handleChange;B.handleChange=()=>{$=!0};let Q=D(...E);if($)X();return B.handleChange=X,Q};return I4.bind(F)}function h2(D){let F=J2(),{index:E}=F,B={get(){return F.hooks[E]},set(X){F.hooks[E]=X},initialized:E in F.hooks},$=D(B);return F.index++,$}function O1(){J2().handleChange()}var Y2={queue(D){let F=J2(),{index:E}=F;F.hooksEffect.push(()=>{F.hooksCleanup[E]?.();let B=D(r3());if(B!=null&&typeof B!=="function")throw new n3("useEffect return value must be a cleanup function or nothing.");F.hooksCleanup[E]=B})},run(){let D=J2();a3(()=>{D.hooksEffect.forEach((F)=>{F()}),D.hooksEffect.length=0})()},clearAll(){let D=J2();D.hooksCleanup.forEach((F)=>{F?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function y(D){return h2((F)=>{let E=v4.bind(function(X){if(F.get()!==X)F.set(X),O1()});if(F.initialized)return[F.get(),E];let B=typeof D==="function"?D():D;return F.set(B),[B,E]})}function ZD(D,F){h2((E)=>{let B=E.get();if(!Array.isArray(B)||F.some((X,Q)=>!Object.is(X,B[Q])))Y2.queue(D);E.set(F)})}var $D=iD(c0(),1);import MD from"process";function k4(){if(MD.platform!=="win32")return MD.env.TERM!=="linux";return Boolean(MD.env.WT_SESSION)||Boolean(MD.env.TERMINUS_SUBLIME)||MD.env.ConEmuTask==="{cmd::Cmder}"||MD.env.TERM_PROGRAM==="Terminus-Sublime"||MD.env.TERM_PROGRAM==="vscode"||MD.env.TERM==="xterm-256color"||MD.env.TERM==="alacritty"||MD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var S1={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"},T1={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"},y4={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"},h4={...S1,...T1},g4={...S1,...y4},l4=k4(),m4=l4?h4:g4,g2=m4,oX=Object.entries(T1);var b1={prefix:{idle:$D.default.blue("?"),done:$D.default.green(g2.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>$D.default.yellow(D))},style:{answer:$D.default.cyan,message:$D.default.bold,error:(D)=>$D.default.red(`> ${D}`),defaultAnswer:(D)=>$D.default.dim(`(${D})`),help:$D.default.dim,highlight:$D.default.cyan,key:(D)=>$D.default.cyan($D.default.bold(`<${D}>`))}};function P1(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 f1(...D){let F={};for(let E of D)for(let[B,$]of Object.entries(E)){let X=F[B];F[B]=P1(X)&&P1($)?f1(X,$):$}return F}function UD(...D){let F=[b1,...D.filter((E)=>E!=null)];return f1(...F)}function ID({status:D="idle",theme:F}){let[E,B]=y(!1),[$,X]=y(0),{prefix:Q,spinner:J}=UD(F);if(ZD(()=>{if(D==="loading"){let q,H=-1,_=setTimeout(()=>{B(!0),q=setInterval(()=>{H=H+1,X(H%J.frames.length)},J.interval)},300);return()=>{clearTimeout(_),clearInterval(q)}}else B(!1)},[D]),E)return J.frames[$];return typeof Q==="string"?Q:Q[D==="loading"?"idle":D]??Q.idle}function o3(D,F){return h2((E)=>{let B=E.get();if(!B||B.dependencies.length!==F.length||B.dependencies.some(($,X)=>$!==F[X])){let $=D();return E.set({value:$,dependencies:F}),$}return B.value})}function p0(D){return y({current:D})[0]}function wD(D){let F=p0(D);F.current=D,ZD((E)=>{let B=!1,$=a3((X,Q)=>{if(B)return;F.current(Q,E)});return E.input.on("keypress",$),()=>{B=!0,E.input.removeListener("keypress",$)}},[])}var XF=iD(I1(),1),QF=iD($F(),1);function G0(D,F){return D.split(`
|
|
177
|
+
\u26A0\uFE0F ${Y.length} dead worker(s) detected. Run \`term kill <name>\` to clean up.`)}catch(F){console.error(`\u274C Error: ${F.message}`),process.exit(1)}}function P4(D){if(D==="working")return"working";if(D==="idle")return"idle";if(D==="\u26A0\uFE0F perm")return"permission";if(D==="\u26A0\uFE0F question")return"question";if(D==="\u274C error")return"error";if(D==="\u2705 done")return"done";return null}var{$:U0}=globalThis.Bun;var q0=(D,F=[])=>D.name==="up"||F.includes("vim")&&D.name==="k"||F.includes("emacs")&&D.ctrl&&D.name==="p",l0=(D,F=[])=>D.name==="down"||F.includes("vim")&&D.name==="j"||F.includes("emacs")&&D.ctrl&&D.name==="n";var c3=(D)=>D.name==="backspace",Q2=(D)=>D.name==="tab";var fD=(D)=>D.name==="enter"||D.name==="return";class p3 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class d3 extends Error{name="CancelPromptError";message="Prompt was canceled"}class m0 extends Error{name="ExitPromptError"}class i3 extends Error{name="HookError"}class n3 extends Error{name="ValidationError"}import{AsyncResource as w4}from"async_hooks";import{AsyncLocalStorage as Z4,AsyncResource as I4}from"async_hooks";var j1=new Z4;function v4(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function M1(D,F){let E=v4(D);return j1.run(E,()=>{function B($){E.handleChange=()=>{E.index=0,$()},E.handleChange()}return F(B)})}function J2(){let D=j1.getStore();if(!D)throw new i3("[Inquirer] Hook functions can only be called from within a prompt");return D}function r3(){return J2().rl}function a3(D){let F=(...E)=>{let B=J2(),$=!1,X=B.handleChange;B.handleChange=()=>{$=!0};let Q=D(...E);if($)X();return B.handleChange=X,Q};return I4.bind(F)}function h2(D){let F=J2(),{index:E}=F,B={get(){return F.hooks[E]},set(X){F.hooks[E]=X},initialized:E in F.hooks},$=D(B);return F.index++,$}function O1(){J2().handleChange()}var Y2={queue(D){let F=J2(),{index:E}=F;F.hooksEffect.push(()=>{F.hooksCleanup[E]?.();let B=D(r3());if(B!=null&&typeof B!=="function")throw new n3("useEffect return value must be a cleanup function or nothing.");F.hooksCleanup[E]=B})},run(){let D=J2();a3(()=>{D.hooksEffect.forEach((F)=>{F()}),D.hooksEffect.length=0})()},clearAll(){let D=J2();D.hooksCleanup.forEach((F)=>{F?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function y(D){return h2((F)=>{let E=w4.bind(function(X){if(F.get()!==X)F.set(X),O1()});if(F.initialized)return[F.get(),E];let B=typeof D==="function"?D():D;return F.set(B),[B,E]})}function ZD(D,F){h2((E)=>{let B=E.get();if(!Array.isArray(B)||F.some((X,Q)=>!Object.is(X,B[Q])))Y2.queue(D);E.set(F)})}var $D=iD(c0(),1);import MD from"process";function k4(){if(MD.platform!=="win32")return MD.env.TERM!=="linux";return Boolean(MD.env.WT_SESSION)||Boolean(MD.env.TERMINUS_SUBLIME)||MD.env.ConEmuTask==="{cmd::Cmder}"||MD.env.TERM_PROGRAM==="Terminus-Sublime"||MD.env.TERM_PROGRAM==="vscode"||MD.env.TERM==="xterm-256color"||MD.env.TERM==="alacritty"||MD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var S1={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"},T1={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"},y4={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"},h4={...S1,...T1},g4={...S1,...y4},l4=k4(),m4=l4?h4:g4,g2=m4,oX=Object.entries(T1);var b1={prefix:{idle:$D.default.blue("?"),done:$D.default.green(g2.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>$D.default.yellow(D))},style:{answer:$D.default.cyan,message:$D.default.bold,error:(D)=>$D.default.red(`> ${D}`),defaultAnswer:(D)=>$D.default.dim(`(${D})`),help:$D.default.dim,highlight:$D.default.cyan,key:(D)=>$D.default.cyan($D.default.bold(`<${D}>`))}};function P1(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 f1(...D){let F={};for(let E of D)for(let[B,$]of Object.entries(E)){let X=F[B];F[B]=P1(X)&&P1($)?f1(X,$):$}return F}function UD(...D){let F=[b1,...D.filter((E)=>E!=null)];return f1(...F)}function ID({status:D="idle",theme:F}){let[E,B]=y(!1),[$,X]=y(0),{prefix:Q,spinner:J}=UD(F);if(ZD(()=>{if(D==="loading"){let q,H=-1,_=setTimeout(()=>{B(!0),q=setInterval(()=>{H=H+1,X(H%J.frames.length)},J.interval)},300);return()=>{clearTimeout(_),clearInterval(q)}}else B(!1)},[D]),E)return J.frames[$];return typeof Q==="string"?Q:Q[D==="loading"?"idle":D]??Q.idle}function o3(D,F){return h2((E)=>{let B=E.get();if(!B||B.dependencies.length!==F.length||B.dependencies.some(($,X)=>$!==F[X])){let $=D();return E.set({value:$,dependencies:F}),$}return B.value})}function p0(D){return y({current:D})[0]}function vD(D){let F=p0(D);F.current=D,ZD((E)=>{let B=!1,$=a3((X,Q)=>{if(B)return;F.current(Q,E)});return E.input.on("keypress",$),()=>{B=!0,E.input.removeListener("keypress",$)}},[])}var XF=iD(I1(),1),QF=iD($F(),1);function G0(D,F){return D.split(`
|
|
178
178
|
`).flatMap((E)=>QF.default(E,F,{trim:!1,hard:!0}).split(`
|
|
179
179
|
`).map((B)=>B.trimEnd())).join(`
|
|
180
180
|
`)}function n0(){return XF.default({defaultWidth:80,output:r3().output})}function HE({active:D,renderedItems:F,pageSize:E,loop:B}){let $=p0({lastPointer:D,lastActive:void 0}),{lastPointer:X,lastActive:Q}=$.current,J=Math.floor(E/2),Y=F.reduce((_,G)=>_+G.length,0),q=F.slice(0,D).reduce((_,G)=>_+G.length,0),H=q;if(Y>E)if(B){if(H=X,Q!=null&&Q<D&&D-Q<E)H=Math.min(J,Math.abs(D-Q)===1?Math.min(X+(F[Q]?.length??0),Math.max(q,X)):X+D-Q)}else{let _=F.slice(D).reduce((G,U)=>G+U.length,0);H=_<E-J?E-_:Math.min(q,J)}return $.current.lastPointer=H,$.current.lastActive=D,H}function X8({items:D,active:F,renderItem:E,pageSize:B,loop:$=!0}){let X=n0(),Q=(j)=>(j%D.length+D.length)%D.length,J=D.map((j,M)=>{if(j==null)return[];return G0(E({item:j,index:M,isActive:M===F}),X).split(`
|
|
181
|
-
`)}),Y=J.reduce((j,M)=>j+M.length,0),q=(j)=>J[j]??[],H=HE({active:F,renderedItems:J,pageSize:B,loop:$}),_=q(F).slice(0,B),G=H+_.length<=B?H:B-_.length,U=Array.from({length:B});U.splice(G,_.length,..._);let z=new Set([F]),
|
|
182
|
-
`)}var KF=iD(qF(),1);import*as VF from"readline";import{AsyncResource as zE}from"async_hooks";var q2=[];q2.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")q2.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")q2.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var r0=(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",Q8=Symbol.for("signal-exit emitter"),J8=globalThis,GE=Object.defineProperty.bind(Object);class HF{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(J8[Q8])return J8[Q8];GE(J8,Q8,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(D,F){this.listeners[D].push(F)}removeListener(D,F){let E=this.listeners[D],B=E.indexOf(F);if(B===-1)return;if(B===0&&E.length===1)E.length=0;else E.splice(B,1)}emit(D,F,E){if(this.emitted[D])return!1;this.emitted[D]=!0;let B=!1;for(let $ of this.listeners[D])B=$(F,E)===!0||B;if(D==="exit")B=this.emit("afterExit",F,E)||B;return B}}class q8{}var WE=(D)=>{return{onExit(F,E){return D.onExit(F,E)},load(){return D.load()},unload(){return D.unload()}}};class _F extends q8{onExit(){return()=>{}}load(){}unload(){}}class GF extends q8{#E=Y8.platform==="win32"?"SIGINT":"SIGHUP";#F=new HF;#D;#X;#Q;#$={};#B=!1;constructor(D){super();this.#D=D,this.#$={};for(let F of q2)this.#$[F]=()=>{let E=this.#D.listeners(F),{count:B}=this.#F,$=D;if(typeof $.__signal_exit_emitter__==="object"&&typeof $.__signal_exit_emitter__.count==="number")B+=$.__signal_exit_emitter__.count;if(E.length===B){this.unload();let X=this.#F.emit("exit",null,F),Q=F==="SIGHUP"?this.#E:F;if(!X)D.kill(D.pid,Q)}};this.#Q=D.reallyExit,this.#X=D.emit}onExit(D,F){if(!r0(this.#D))return()=>{};if(this.#B===!1)this.load();let E=F?.alwaysLast?"afterExit":"exit";return this.#F.on(E,D),()=>{if(this.#F.removeListener(E,D),this.#F.listeners.exit.length===0&&this.#F.listeners.afterExit.length===0)this.unload()}}load(){if(this.#B)return;this.#B=!0,this.#F.count+=1;for(let D of q2)try{let F=this.#$[D];if(F)this.#D.on(D,F)}catch(F){}this.#D.emit=(D,...F)=>{return this.#Y(D,...F)},this.#D.reallyExit=(D)=>{return this.#J(D)}}unload(){if(!this.#B)return;this.#B=!1,q2.forEach((D)=>{let F=this.#$[D];if(!F)throw Error("Listener not defined for signal: "+D);try{this.#D.removeListener(D,F)}catch(E){}}),this.#D.emit=this.#X,this.#D.reallyExit=this.#Q,this.#F.count-=1}#J(D){if(!r0(this.#D))return 0;return this.#D.exitCode=D||0,this.#F.emit("exit",this.#D.exitCode,null),this.#Q.call(this.#D,this.#D.exitCode)}#Y(D,...F){let E=this.#X;if(D==="exit"&&r0(this.#D)){if(typeof F[0]==="number")this.#D.exitCode=F[0];let B=E.call(this.#D,D,...F);return this.#F.emit("exit",this.#D.exitCode,null),B}else return E.call(this.#D,D,...F)}}var Y8=globalThis.process,{onExit:WF,load:
|
|
181
|
+
`)}),Y=J.reduce((j,M)=>j+M.length,0),q=(j)=>J[j]??[],H=HE({active:F,renderedItems:J,pageSize:B,loop:$}),_=q(F).slice(0,B),G=H+_.length<=B?H:B-_.length,U=Array.from({length:B});U.splice(G,_.length,..._);let z=new Set([F]),L=G+_.length,V=Q(F+1);while(L<B&&!z.has(V)&&($&&Y>B?V!==F:V>F)){let M=q(V).slice(0,B-L);U.splice(L,M.length,...M),z.add(V),L+=M.length,V=Q(V+1)}L=G-1,V=Q(F-1);while(L>=0&&!z.has(V)&&($&&Y>B?V!==F:V<F)){let j=q(V),M=j.slice(Math.max(0,j.length-L-1));U.splice(L-M.length+1,M.length,...M),z.add(V),L-=M.length,V=Q(V-1)}return U.filter((j)=>typeof j==="string").join(`
|
|
182
|
+
`)}var KF=iD(qF(),1);import*as VF from"readline";import{AsyncResource as zE}from"async_hooks";var q2=[];q2.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")q2.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")q2.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var r0=(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",Q8=Symbol.for("signal-exit emitter"),J8=globalThis,GE=Object.defineProperty.bind(Object);class HF{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(J8[Q8])return J8[Q8];GE(J8,Q8,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(D,F){this.listeners[D].push(F)}removeListener(D,F){let E=this.listeners[D],B=E.indexOf(F);if(B===-1)return;if(B===0&&E.length===1)E.length=0;else E.splice(B,1)}emit(D,F,E){if(this.emitted[D])return!1;this.emitted[D]=!0;let B=!1;for(let $ of this.listeners[D])B=$(F,E)===!0||B;if(D==="exit")B=this.emit("afterExit",F,E)||B;return B}}class q8{}var WE=(D)=>{return{onExit(F,E){return D.onExit(F,E)},load(){return D.load()},unload(){return D.unload()}}};class _F extends q8{onExit(){return()=>{}}load(){}unload(){}}class GF extends q8{#E=Y8.platform==="win32"?"SIGINT":"SIGHUP";#F=new HF;#D;#X;#Q;#$={};#B=!1;constructor(D){super();this.#D=D,this.#$={};for(let F of q2)this.#$[F]=()=>{let E=this.#D.listeners(F),{count:B}=this.#F,$=D;if(typeof $.__signal_exit_emitter__==="object"&&typeof $.__signal_exit_emitter__.count==="number")B+=$.__signal_exit_emitter__.count;if(E.length===B){this.unload();let X=this.#F.emit("exit",null,F),Q=F==="SIGHUP"?this.#E:F;if(!X)D.kill(D.pid,Q)}};this.#Q=D.reallyExit,this.#X=D.emit}onExit(D,F){if(!r0(this.#D))return()=>{};if(this.#B===!1)this.load();let E=F?.alwaysLast?"afterExit":"exit";return this.#F.on(E,D),()=>{if(this.#F.removeListener(E,D),this.#F.listeners.exit.length===0&&this.#F.listeners.afterExit.length===0)this.unload()}}load(){if(this.#B)return;this.#B=!0,this.#F.count+=1;for(let D of q2)try{let F=this.#$[D];if(F)this.#D.on(D,F)}catch(F){}this.#D.emit=(D,...F)=>{return this.#Y(D,...F)},this.#D.reallyExit=(D)=>{return this.#J(D)}}unload(){if(!this.#B)return;this.#B=!1,q2.forEach((D)=>{let F=this.#$[D];if(!F)throw Error("Listener not defined for signal: "+D);try{this.#D.removeListener(D,F)}catch(E){}}),this.#D.emit=this.#X,this.#D.reallyExit=this.#Q,this.#F.count-=1}#J(D){if(!r0(this.#D))return 0;return this.#D.exitCode=D||0,this.#F.emit("exit",this.#D.exitCode,null),this.#Q.call(this.#D,this.#D.exitCode)}#Y(D,...F){let E=this.#X;if(D==="exit"&&r0(this.#D)){if(typeof F[0]==="number")this.#D.exitCode=F[0];let B=E.call(this.#D,D,...F);return this.#F.emit("exit",this.#D.exitCode,null),B}else return E.call(this.#D,D,...F)}}var Y8=globalThis.process,{onExit:WF,load:wQ,unload:uQ}=WE(r0(Y8)?new GF(Y8):new _F);import{stripVTControlCharacters as AE}from"util";var UE="\x1B[G",AF="\x1B[?25l",CF="\x1B[?25h",H8=(D=1)=>D>0?`\x1B[${D}A`:"",_8=(D=1)=>D>0?`\x1B[${D}B`:"",G8=(D,F)=>{if(typeof F==="number"&&!Number.isNaN(F))return`\x1B[${F+1};${D+1}H`;return`\x1B[${D+1}G`},UF="\x1B[2K",W8=(D)=>D>0?(UF+H8(1)).repeat(D-1)+UF+UE:"";var zF=(D)=>D.split(`
|
|
183
183
|
`).length,CE=(D)=>D.split(`
|
|
184
184
|
`).pop()??"";class a0{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 E=CE(D),B=AE(E),$=B;if(this.rl.line.length>0)$=$.slice(0,-this.rl.line.length);this.rl.setPrompt($),this.cursorPos=this.rl.getCursorPos();let X=n0();if(D=G0(D,X),F=G0(F,X),B.length%X===0)D+=`
|
|
185
185
|
`;let Q=D+(F?`
|
|
186
186
|
`+F:""),Y=Math.floor(B.length/X)-this.cursorPos.rows+(F?zF(F):0);if(Y>0)Q+=H8(Y);Q+=G8(this.cursorPos.cols),this.write(_8(this.extraLinesUnderPrompt)+W8(this.height)+Q),this.extraLinesUnderPrompt=Y,this.height=zF(Q)}checkCursorPos(){let D=this.rl.getCursorPos();if(D.cols!==this.cursorPos.cols)this.write(G8(D.cols)),this.cursorPos=D}done({clearContent:D}){this.rl.setPrompt("");let F=_8(this.extraLinesUnderPrompt);F+=D?W8(this.height):`
|
|
187
|
-
`,F+=CF,this.write(F),this.rl.close()}}class U8 extends Promise{static withResolver(){let D,F;return{promise:new Promise((B,$)=>{D=B,F=$}),resolve:D,reject:F}}}function VE(){let D=Error.prepareStackTrace,F=[];try{Error.prepareStackTrace=(E,B)=>{let $=B.slice(1);return F=$,$},Error().stack}catch{return F}return Error.prepareStackTrace=D,F}function
|
|
188
|
-
at ${n}`)}let[m,d]=typeof I==="string"?[I]:I;H.render(m,d),Y2.run()}catch(I){U(I)}}),Object.assign(_.then((I)=>{return Y2.clearAll(),I},(I)=>{throw Y2.clearAll(),I}).finally(()=>{J.forEach((I)=>I()),H.done({clearContent:Boolean($.clearPromptOnDone)}),Y.end()}).then(()=>_),{cancel:z})})}}var RF=iD(c0(),1);class p2{separator=RF.default.dim(Array.from({length:15}).join(g2.line));type="separator";constructor(D){if(D)this.separator=D}static isSeparator(D){return Boolean(D&&typeof D==="object"&&"type"in D&&D.type==="separator")}}function LF(D,F){let E=F!==!1;if(/^(y|yes)/i.test(D))E=!0;else if(/^(n|no)/i.test(D))E=!1;return E}function jF(D){return D?"Yes":"No"}var W0=
|
|
187
|
+
`,F+=CF,this.write(F),this.rl.close()}}class U8 extends Promise{static withResolver(){let D,F;return{promise:new Promise((B,$)=>{D=B,F=$}),resolve:D,reject:F}}}function VE(){let D=Error.prepareStackTrace,F=[];try{Error.prepareStackTrace=(E,B)=>{let $=B.slice(1);return F=$,$},Error().stack}catch{return F}return Error.prepareStackTrace=D,F}function wD(D){let F=VE();return(B,$={})=>{let{input:X=process.stdin,signal:Q}=$,J=new Set,Y=new KF.default;Y.pipe($.output??process.stdout);let q=VF.createInterface({terminal:!0,input:X,output:Y}),H=new a0(q),{promise:_,resolve:G,reject:U}=U8.withResolver(),z=()=>U(new d3);if(Q){let j=()=>U(new p3({cause:Q.reason}));if(Q.aborted)return j(),Object.assign(_,{cancel:z});Q.addEventListener("abort",j),J.add(()=>Q.removeEventListener("abort",j))}J.add(WF((j,M)=>{U(new m0(`User force closed the prompt with ${j} ${M}`))}));let L=()=>U(new m0("User force closed the prompt with SIGINT"));q.on("SIGINT",L),J.add(()=>q.removeListener("SIGINT",L));let V=()=>H.checkCursorPos();return q.input.on("keypress",V),J.add(()=>q.input.removeListener("keypress",V)),M1(q,(j)=>{let M=zE.bind(()=>Y2.clearAll());return q.on("close",M),J.add(()=>q.removeListener("close",M)),j(()=>{try{let I=D(B,(n)=>{setImmediate(()=>G(n))});if(I===void 0){let n=F[1]?.getFileName();throw Error(`Prompt functions must return a string.
|
|
188
|
+
at ${n}`)}let[m,d]=typeof I==="string"?[I]:I;H.render(m,d),Y2.run()}catch(I){U(I)}}),Object.assign(_.then((I)=>{return Y2.clearAll(),I},(I)=>{throw Y2.clearAll(),I}).finally(()=>{J.forEach((I)=>I()),H.done({clearContent:Boolean($.clearPromptOnDone)}),Y.end()}).then(()=>_),{cancel:z})})}}var RF=iD(c0(),1);class p2{separator=RF.default.dim(Array.from({length:15}).join(g2.line));type="separator";constructor(D){if(D)this.separator=D}static isSeparator(D){return Boolean(D&&typeof D==="object"&&"type"in D&&D.type==="separator")}}function LF(D,F){let E=F!==!1;if(/^(y|yes)/i.test(D))E=!0;else if(/^(n|no)/i.test(D))E=!1;return E}function jF(D){return D?"Yes":"No"}var W0=wD((D,F)=>{let{transformer:E=jF}=D,[B,$]=y("idle"),[X,Q]=y(""),J=UD(D.theme),Y=ID({status:B,theme:J});vD((G,U)=>{if(B!=="idle")return;if(fD(G)){let z=LF(X,D.default);Q(E(z)),$("done"),F(z)}else if(Q2(G)){let z=jF(!LF(X,D.default));U.clearLine(0),U.write(z),Q(z)}else Q(U.line)});let q=X,H="";if(B==="done")q=J.style.answer(X);else H=` ${J.style.defaultAnswer(D.default===!1?"y/N":"Y/n")}`;let _=J.style.message(D.message,B);return`${Y} ${_}${H} ${q}`});var KE={validationFailureMode:"keep"},RE=wD((D,F)=>{let{prefill:E="tab"}=D,B=UD(KE,D.theme),[$,X]=y("idle"),[Q="",J]=y(D.default),[Y,q]=y(),[H,_]=y(""),G=ID({status:$,theme:B});async function U(M){let{required:I,pattern:m,patternError:d="Invalid input"}=D;if(I&&!M)return"You must provide a value";if(m&&!m.test(M))return d;if(typeof D.validate==="function")return await D.validate(M)||"You must provide a valid value";return!0}vD(async(M,I)=>{if($!=="idle")return;if(fD(M)){let m=H||Q;X("loading");let d=await U(m);if(d===!0)_(m),X("done"),F(m);else{if(B.validationFailureMode==="clear")_("");else I.write(H);q(d),X("idle")}}else if(c3(M)&&!H)J(void 0);else if(Q2(M)&&!H)J(void 0),I.clearLine(0),I.write(Q),_(Q);else _(I.line),q(void 0)}),ZD((M)=>{if(E==="editable"&&Q)M.write(Q),_(Q)},[]);let z=B.style.message(D.message,$),L=H;if(typeof D.transformer==="function")L=D.transformer(H,{isFinal:$==="done"});else if($==="done")L=B.style.answer(H);let V;if(Q&&$!=="done"&&!H)V=B.style.defaultAnswer(Q);let j="";if(Y)j=B.style.error(Y);return[[G,z,V,L].filter((M)=>M!==void 0).join(" "),j]});var LE=wD((D,F)=>{let{validate:E=()=>!0}=D,B=UD(D.theme),[$,X]=y("idle"),[Q,J]=y(),[Y,q]=y(""),H=ID({status:$,theme:B});vD(async(L,V)=>{if($!=="idle")return;if(fD(L)){let j=Y;X("loading");let M=await E(j);if(M===!0)q(j),X("done"),F(j);else V.write(Y),J(M||"You must provide a valid value"),X("idle")}else q(V.line),J(void 0)});let _=B.style.message(D.message,$),G="",U;if(D.mask)G=(typeof D.mask==="string"?D.mask:"*").repeat(Y.length);else if($!=="done")U=`${B.style.help("[input is masked]")}${AF}`;if($==="done")G=B.style.answer(G);let z="";if(Q)z=B.style.error(Q);return[[H,_,D.mask?G:U].join(" "),z]});var H2=iD(c0(),1);var jE={icon:{cursor:g2.pointer},style:{disabled:(D)=>H2.default.dim(`- ${D}`),searchTerm:(D)=>H2.default.cyan(D),description:(D)=>H2.default.cyan(D),keysHelpTip:(D)=>D.map(([F,E])=>`${H2.default.bold(F)} ${H2.default.dim(E)}`).join(H2.default.dim(" \u2022 "))},helpMode:"always"};function A8(D){return!p2.isSeparator(D)&&!D.disabled}function ME(D){return D.map((F)=>{if(p2.isSeparator(F))return F;if(typeof F==="string")return{value:F,name:F,short:F,disabled:!1};let E=F.name??String(F.value),B={value:F.value,name:E,short:F.short??E,disabled:F.disabled??!1};if(F.description)B.description=F.description;return B})}var C8=wD((D,F)=>{let{pageSize:E=7,validate:B=()=>!0}=D,$=UD(jE,D.theme),[X,Q]=y("loading"),[J,Y]=y(""),[q,H]=y([]),[_,G]=y(),U=ID({status:X,theme:$}),z=o3(()=>{let k=q.findIndex(A8),t=q.findLastIndex(A8);return{first:k,last:t}},[q]),[L=z.first,V]=y();ZD(()=>{let k=new AbortController;return Q("loading"),G(void 0),(async()=>{try{let XD=await D.source(J||void 0,{signal:k.signal});if(!k.signal.aborted)V(void 0),G(void 0),H(ME(XD)),Q("idle")}catch(XD){if(!k.signal.aborted&&XD instanceof Error)G(XD.message)}})(),()=>{k.abort()}},[J]);let j=q[L];vD(async(k,t)=>{if(fD(k))if(j){Q("loading");let XD=await B(j.value);if(Q("idle"),XD===!0)Q("done"),F(j.value);else if(j.name===J)G(XD||"You must provide a valid value");else t.write(j.name),Y(j.name)}else t.write(J);else if(Q2(k)&&j)t.clearLine(0),t.write(j.name),Y(j.name);else if(X!=="loading"&&(q0(k)||l0(k))){if(t.clearLine(0),q0(k)&&L!==z.first||l0(k)&&L!==z.last){let XD=q0(k)?-1:1,G2=L;do G2=(G2+XD+q.length)%q.length;while(!A8(q[G2]));V(G2)}}else Y(t.line)});let M=$.style.message(D.message,X),I;if($.helpMode!=="never")if(D.instructions){let{pager:k,navigation:t}=D.instructions;I=$.style.help(q.length>E?k:t)}else I=$.style.keysHelpTip([["\u2191\u2193","navigate"],["\u23CE","select"]]);let m=X8({items:q,active:L,renderItem({item:k,isActive:t}){if(p2.isSeparator(k))return` ${k.separator}`;if(k.disabled){let e0=typeof k.disabled==="string"?k.disabled:"(disabled)";return $.style.disabled(`${k.name} ${e0}`)}let XD=t?$.style.highlight:(e0)=>e0,G2=t?$.icon.cursor:" ";return XD(`${G2} ${k.name}`)},pageSize:E,loop:!1}),d;if(_)d=$.style.error(_);else if(q.length===0&&J!==""&&X==="idle")d=$.style.error("No results found");let n;if(X==="done"&&j)return[U,M,$.style.answer(j.short)].filter(Boolean).join(" ").trimEnd();else n=$.style.searchTerm(J);let C0=j?.description,yF=[U,M,n].filter(Boolean).join(" ").trimEnd(),hF=[d??m," ",C0?$.style.description(C0):"",I].filter(Boolean).join(`
|
|
189
189
|
`).trimEnd();return[yF,hF]});mD();import{join as MF}from"path";import{homedir as OE}from"os";var z8=jD(),NE=MF(OE(),".local","share","term","worktrees"),SE=".genie/worktrees";async function OF(D){try{return{stdout:(await U0`bd ${D}`.quiet()).stdout.toString().trim(),exitCode:0}}catch(F){return{stdout:F.stdout?.toString().trim()||"",exitCode:F.exitCode||1}}}async function TE(D){let{exitCode:F}=await OF(["close",D]);return F===0}async function bE(){let{exitCode:D}=await OF(["sync"]);return D===0}async function PE(D,F){try{let B=(await U0`git -C ${D} branch --show-current`.quiet()).stdout.toString().trim();if(B===F)return console.log(`\u26A0\uFE0F Already on branch ${F}. Skipping merge.`),!0;return console.log(` Switching to ${B}...`),await U0`git -C ${D} checkout ${B}`.quiet(),console.log(` Merging ${F}...`),await U0`git -C ${D} merge ${F} --no-edit`.quiet(),!0}catch(E){return console.error(`\u26A0\uFE0F Merge failed: ${E.message}`),!1}}async function fE(D,F){let E=MF(F,SE,D);try{return await U0`git -C ${F} worktree remove ${E} --force`.quiet(),!0}catch{}if(z8)try{if(await h0(D))return!0}catch{}try{let B=new C2({baseDir:NE,repoPath:F});if(await B.worktreeExists(D))return await B.removeWorktree(D),!0;return!0}catch(B){return console.error(`\u26A0\uFE0F Failed to remove worktree: ${B.message}`),!1}}async function ZE(D){try{return await W2(D),!0}catch{return!1}}async function NF(D,F={}){try{let E=z8?await cD(D):null;if(!E)E=await LD(D);if(!E)console.log(`\u2139\uFE0F No active worker for ${D}. Closing issue only.`);if(!F.yes){if(!await W0({message:`Close ${D}${E?` and kill worker (pane ${E.paneId})`:""}?`,default:!0})){console.log("Cancelled.");return}}if(console.log(`\uD83D\uDCDD Closing ${D}...`),!await TE(D))console.error(`\u274C Failed to close ${D}. Check \`bd show ${D}\`.`);else console.log(" \u2705 Issue closed");if(!F.noSync)if(console.log("\uD83D\uDD04 Syncing beads..."),await bE())console.log(" \u2705 Synced to git");else console.log(" \u26A0\uFE0F Sync failed (non-fatal)");if(E?.worktree&&!F.keepWorktree){if(F.merge){if(console.log("\uD83D\uDD00 Merging changes..."),await PE(E.repoPath,D))console.log(" \u2705 Merged to main")}if(console.log("\uD83C\uDF33 Removing worktree..."),await fE(D,E.repoPath))console.log(" \u2705 Worktree removed")}if(E){if(console.log("\uD83D\uDC80 Killing worker pane..."),await ZE(E.paneId),console.log(" \u2705 Pane killed"),z8)try{await J0(E.id),await DD(E.id,"done"),await Q0(E.id)}catch{}await B2(E.id),console.log(" \u2705 Worker unregistered")}console.log(`
|
|
190
|
-
\u2705 ${D} closed successfully`)}catch(E){console.error(`\u274C Error: ${E.message}`),process.exit(1)}}var{$:
|
|
191
|
-
\u26A0\uFE0F Task ${E.taskId} is still in_progress in beads.`),console.log(` Run \`bd update ${E.taskId} --status open\` to reopen,`),console.log(` or \`term work ${E.taskId}\` to start a new worker.`)}catch(E){console.error(`\u274C Error: ${E.message}`),process.exit(1)}}async function bF(D={}){try{let F=await pD();if(F.running){if(console.log("\u2139\uFE0F Daemon is already running"),F.pid)console.log(` PID: ${F.pid}`);return}if(console.log("\uD83D\uDE80 Starting beads daemon..."),await Y0({autoCommit:D.autoCommit!==!1,autoPush:D.autoPush})){console.log(" \u2705 Daemon started");let B=await pD();if(B.pid)console.log(` PID: ${B.pid}`);if(B.autoCommit)console.log(" Auto-commit: enabled");if(B.autoPush)console.log(" Auto-push: enabled")}else console.error("\u274C Failed to start daemon"),console.log(" Check `bd daemon status` for details"),process.exit(1)}catch(F){console.error(`\u274C Error: ${F.message}`),process.exit(1)}}async function PF(){try{if(!(await pD()).running){console.log("\u2139\uFE0F Daemon is not running");return}if(console.log("\uD83D\uDED1 Stopping beads daemon..."),await h3())console.log(" \u2705 Daemon stopped");else console.error("\u274C Failed to stop daemon"),process.exit(1)}catch(D){console.error(`\u274C Error: ${D.message}`),process.exit(1)}}async function fF(D={}){try{let F=await pD();if(D.json){console.log(JSON.stringify(F,null,2));return}if(console.log("Beads Daemon Status"),console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),console.log(`Running: ${F.running?"\u2705 yes":"\u274C no"}`),F.running){if(F.pid)console.log(`PID: ${F.pid}`);if(F.lastSync)console.log(`Last sync: ${F.lastSync}`);if(F.autoCommit!==void 0)console.log(`Auto-commit: ${F.autoCommit?"enabled":"disabled"}`);if(F.autoPush!==void 0)console.log(`Auto-push: ${F.autoPush?"enabled":"disabled"}`)}else console.log("\nRun `term daemon start` to start the daemon")}catch(F){console.error(`\u274C Error: ${F.message}`),process.exit(1)}}async function ZF(D={}){try{if((await pD()).running)console.log("\uD83D\uDED1 Stopping beads daemon..."),await h3(),console.log(" \u2705 Stopped");if(console.log("\uD83D\uDE80 Starting beads daemon..."),await Y0({autoCommit:D.autoCommit!==!1,autoPush:D.autoPush}))console.log(" \u2705 Daemon restarted");else console.error("\u274C Failed to restart daemon"),process.exit(1)}catch(F){console.error(`\u274C Error: ${F.message}`),process.exit(1)}}var{$:R8}=globalThis.Bun;import{randomUUID as dE}from"crypto";import{join as d2}from"path";mD();import{access as lE,readFile as V8}from"fs/promises";import{join as _2}from"path";import{homedir as IF}from"os";function mE(D){return[D,`genie-${D}`]}async function
|
|
192
|
-
`)}async function cE(D,F){try{let B=(await V8(D,"utf-8")).match(/^---\n([\s\S]*?)\n---/);if(B){let $=B[1].match(/name:\s*["']?([^"'\n]+)["']?/);if($)return $[1].trim()}}catch{}return F.replace(/-/,":")}async function s0(D){let{readdir:F}=await import("fs/promises"),E=D||process.cwd(),B=[],$=[_2(E,".claude","skills"),_2(IF(),".claude","skills")];for(let X of $)try{let Q=await F(X,{withFileTypes:!0});for(let J of Q)if(J.isDirectory()){let Y=_2(X,J.name,"SKILL.md");if(await
|
|
193
|
-
Available skills:`);for(let j of
|
|
194
|
-
No skills found in .claude/skills/ or ~/.claude/skills/`);process.exit(1)}if(console.log(`Skill: ${B.name}`),B.description)console.log(` ${B.description}`);let $=F.session||await oE();if(!$)console.error("Not in a tmux session. Attach to a session first or use --session."),process.exit(1);let X=E,Q=null,J=null;if(F.taskId){if(J=await aE(F.taskId),!J)console.error(`Issue "${F.taskId}" not found. Run \`bd list\` to see issues.`),process.exit(1);let
|
|
190
|
+
\u2705 ${D} closed successfully`)}catch(E){console.error(`\u274C Error: ${E.message}`),process.exit(1)}}var{$:vE}=globalThis.Bun;mD();import{join as SF}from"path";import{homedir as wE}from"os";var A0=jD(),uE=SF(wE(),".local","share","term","worktrees"),xE=".genie/worktrees";async function kE(D){try{return await W2(D),!0}catch{return!1}}async function yE(D,F){let E=SF(F,xE,D);try{return await vE`git -C ${F} worktree remove ${E} --force`.quiet(),!0}catch{}if(A0)try{if(await h0(D))return!0}catch{}try{let B=new C2({baseDir:uE,repoPath:F});if(await B.worktreeExists(D))return await B.removeWorktree(D),!0;return!0}catch(B){return console.error(`\u26A0\uFE0F Failed to remove worktree: ${B.message}`),!1}}async function TF(D,F={}){try{let E=await I3(D);if(!E&&A0)E=await k3(D);if(!E)E=await w3(D);if(!E&&A0)E=await W1(D);if(!E)E=await LD(D);if(!E&&A0)E=await cD(D);if(!E)console.error(`\u274C Worker "${D}" not found.`),console.log(" Run `term workers` to see active workers."),process.exit(1);if(!F.yes){if(!await W0({message:`Kill worker ${E.id} (pane ${E.paneId})?`,default:!0})){console.log("Cancelled.");return}}if(console.log(`\uD83D\uDC80 Killing worker pane ${E.paneId}...`),await kE(E.paneId))console.log(" \u2705 Pane killed");else console.log(" \u2139\uFE0F Pane already gone");if(E.worktree&&!F.keepWorktree){if(console.log("\uD83C\uDF33 Removing worktree..."),await yE(E.taskId,E.repoPath))console.log(" \u2705 Worktree removed")}if(A0)try{await J0(E.id),await DD(E.id,"error"),await Q0(E.id)}catch{}await B2(E.id),console.log(" \u2705 Worker unregistered"),console.log(`
|
|
191
|
+
\u26A0\uFE0F Task ${E.taskId} is still in_progress in beads.`),console.log(` Run \`bd update ${E.taskId} --status open\` to reopen,`),console.log(` or \`term work ${E.taskId}\` to start a new worker.`)}catch(E){console.error(`\u274C Error: ${E.message}`),process.exit(1)}}async function bF(D={}){try{let F=await pD();if(F.running){if(console.log("\u2139\uFE0F Daemon is already running"),F.pid)console.log(` PID: ${F.pid}`);return}if(console.log("\uD83D\uDE80 Starting beads daemon..."),await Y0({autoCommit:D.autoCommit!==!1,autoPush:D.autoPush})){console.log(" \u2705 Daemon started");let B=await pD();if(B.pid)console.log(` PID: ${B.pid}`);if(B.autoCommit)console.log(" Auto-commit: enabled");if(B.autoPush)console.log(" Auto-push: enabled")}else console.error("\u274C Failed to start daemon"),console.log(" Check `bd daemon status` for details"),process.exit(1)}catch(F){console.error(`\u274C Error: ${F.message}`),process.exit(1)}}async function PF(){try{if(!(await pD()).running){console.log("\u2139\uFE0F Daemon is not running");return}if(console.log("\uD83D\uDED1 Stopping beads daemon..."),await h3())console.log(" \u2705 Daemon stopped");else console.error("\u274C Failed to stop daemon"),process.exit(1)}catch(D){console.error(`\u274C Error: ${D.message}`),process.exit(1)}}async function fF(D={}){try{let F=await pD();if(D.json){console.log(JSON.stringify(F,null,2));return}if(console.log("Beads Daemon Status"),console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),console.log(`Running: ${F.running?"\u2705 yes":"\u274C no"}`),F.running){if(F.pid)console.log(`PID: ${F.pid}`);if(F.lastSync)console.log(`Last sync: ${F.lastSync}`);if(F.autoCommit!==void 0)console.log(`Auto-commit: ${F.autoCommit?"enabled":"disabled"}`);if(F.autoPush!==void 0)console.log(`Auto-push: ${F.autoPush?"enabled":"disabled"}`)}else console.log("\nRun `term daemon start` to start the daemon")}catch(F){console.error(`\u274C Error: ${F.message}`),process.exit(1)}}async function ZF(D={}){try{if((await pD()).running)console.log("\uD83D\uDED1 Stopping beads daemon..."),await h3(),console.log(" \u2705 Stopped");if(console.log("\uD83D\uDE80 Starting beads daemon..."),await Y0({autoCommit:D.autoCommit!==!1,autoPush:D.autoPush}))console.log(" \u2705 Daemon restarted");else console.error("\u274C Failed to restart daemon"),process.exit(1)}catch(F){console.error(`\u274C Error: ${F.message}`),process.exit(1)}}var{$:R8}=globalThis.Bun;import{randomUUID as dE}from"crypto";import{join as d2}from"path";mD();import{access as lE,readFile as V8}from"fs/promises";import{join as _2}from"path";import{homedir as IF}from"os";function mE(D){return[D,`genie-${D}`]}async function vF(D){try{return await lE(D),!0}catch{return!1}}async function o0(D,F){let E=mE(D),B=F||process.cwd(),$=[_2(B,".claude","skills"),_2(IF(),".claude","skills")];for(let X of $)for(let Q of E){let J=_2(X,Q),Y=_2(J,"SKILL.md");if(await vF(Y)){let q;try{let _=(await V8(Y,"utf-8")).match(/^---\n([\s\S]*?)\n---/);if(_){let G=_[1].match(/description:\s*["']?([^"'\n]+)["']?/);if(G)q=G[1]}}catch{}return{name:D,path:J,skillFile:Y,description:q}}}return null}async function wF(D,F){let E=await V8(D.skillFile,"utf-8"),B=[`You are running skill: ${D.name}`,"","## Skill Instructions","",E];if(F)B.push("","---","","## Additional Context","",F);return B.join(`
|
|
192
|
+
`)}async function cE(D,F){try{let B=(await V8(D,"utf-8")).match(/^---\n([\s\S]*?)\n---/);if(B){let $=B[1].match(/name:\s*["']?([^"'\n]+)["']?/);if($)return $[1].trim()}}catch{}return F.replace(/-/,":")}async function s0(D){let{readdir:F}=await import("fs/promises"),E=D||process.cwd(),B=[],$=[_2(E,".claude","skills"),_2(IF(),".claude","skills")];for(let X of $)try{let Q=await F(X,{withFileTypes:!0});for(let J of Q)if(J.isDirectory()){let Y=_2(X,J.name,"SKILL.md");if(await vF(Y)){let q=await cE(Y,J.name);if(!B.includes(q))B.push(q)}}}catch{}return B.sort()}var K8=jD(),iE=".genie/worktrees";async function nE(D){let F=await s0(D);if(F.length===0)return console.log("No skills found in .claude/skills/ or ~/.claude/skills/"),null;let E=[];for(let $ of F){let X=await o0($,D);if(X)E.push({name:$,info:X})}return await C8({message:"Select skill:",source:async($)=>{let X=($||"").toLowerCase();return E.filter((Q)=>Q.name.toLowerCase().includes(X)||(Q.info.description?.toLowerCase().includes(X)??!1)).map((Q)=>({name:Q.info.description?`${Q.name} - ${Q.info.description.substring(0,60)}${Q.info.description.length>60?"...":""}`:Q.name,value:Q.info}))}})}async function rE(D){try{return{stdout:(await R8`bd ${D}`.quiet()).stdout.toString().trim(),exitCode:0}}catch(F){return{stdout:F.stdout?.toString().trim()||"",exitCode:F.exitCode||1}}}async function aE(D){let{stdout:F,exitCode:E}=await rE(["show",D,"--json"]);if(E!==0||!F)return null;try{let B=JSON.parse(F),$=Array.isArray(B)?B[0]:B;if(!$)return null;return{id:$.id,title:$.title||$.description?.substring(0,50)||"Untitled",description:$.description}}catch{return null}}async function oE(){try{return(await O("display-message -p '#{session_name}'")).trim()||null}catch{return null}}async function sE(D,F){let E=await import("fs/promises"),B=d2(F,iE),$=d2(B,D);try{await E.mkdir(B,{recursive:!0})}catch{}try{if((await E.stat($)).isDirectory())return console.log(` Worktree for ${D} already exists`),$}catch{}let X=`work/${D}`;try{try{await R8`git -C ${F} branch ${X}`.quiet()}catch{}await R8`git -C ${F} worktree add ${$} ${X}`.quiet();let Q=d2($,".genie");return await E.mkdir(Q,{recursive:!0}),await E.writeFile(d2(Q,"redirect"),d2(F,".genie")),$}catch(Q){return console.error(` Failed to create worktree: ${Q.message}`),null}}async function tE(D,F){try{let E=await w(D);if(!E)return console.error(`Session "${D}" not found`),null;let B=await x(E.id);if(!B||B.length===0)return console.error(`No windows in session "${D}"`),null;let $=B.find((Y)=>Y.active)||B[0],X=await h($.id);if(!X||X.length===0)return console.error(`No panes in window "${$.name}"`),null;let Q=X.find((Y)=>Y.active)||X[0],J=await U2(Q.id,"horizontal",50,F);if(!J)return console.error("Failed to create new pane"),null;return{paneId:J.id}}catch(E){return console.error(`Error spawning worker pane: ${E.message}`),null}}async function L8(D,F={}){let E=process.cwd(),B;if(!D){if(B=await nE(E),!B)process.exit(1)}else if(B=await o0(D,E),!B){let V=await s0(E);if(console.error(`Skill "${D}" not found.`),V.length>0){console.log(`
|
|
193
|
+
Available skills:`);for(let j of V)console.log(` - ${j}`)}else console.log(`
|
|
194
|
+
No skills found in .claude/skills/ or ~/.claude/skills/`);process.exit(1)}if(console.log(`Skill: ${B.name}`),B.description)console.log(` ${B.description}`);let $=F.session||await oE();if(!$)console.error("Not in a tmux session. Attach to a session first or use --session."),process.exit(1);let X=E,Q=null,J=null;if(F.taskId){if(J=await aE(F.taskId),!J)console.error(`Issue "${F.taskId}" not found. Run \`bd list\` to see issues.`),process.exit(1);let V=K8?await cD(F.taskId):await LD(F.taskId);if(V)console.error(`${F.taskId} already has a worker (pane ${V.paneId})`),console.log(` Run \`term kill ${V.id}\` first.`),process.exit(1);if(!F.noWorktree){if(console.log(`Creating worktree for ${F.taskId}...`),Q=await sE(F.taskId,E),Q)X=Q,console.log(` Created: ${Q}`)}}console.log("Spawning Claude pane...");let Y=await tE($,X);if(!Y)process.exit(1);let{paneId:q}=Y,H=await wF(B,F.prompt);if(J){if(H+=`
|
|
195
195
|
|
|
196
196
|
---
|
|
197
197
|
|
|
198
198
|
Bound to beads issue ${J.id}: "${J.title}"`,J.description)H+=`
|
|
199
199
|
|
|
200
|
-
${J.description}`}let _=F.taskId?dE():void 0;if(F.taskId&&J){let
|
|
200
|
+
${J.description}`}let _=F.taskId?dE():void 0;if(F.taskId&&J){let V={id:F.taskId,paneId:q,session:$,worktree:Q,taskId:F.taskId,taskTitle:J.title,startedAt:new Date().toISOString(),state:"spawning",lastStateChange:new Date().toISOString(),repoPath:E,claudeSessionId:_};if(K8)try{await k0(F.taskId,{paneId:q,session:$,worktree:Q,repoPath:E,taskId:F.taskId,taskTitle:J.title,claudeSessionId:_}),await y0(F.taskId,F.taskId),await DD(F.taskId,"spawning")}catch(j){console.log(` Beads registration failed: ${j.message} (non-fatal)`)}await $0(V)}let G=H.replace(/'/g,"'\\''"),U=d2(E,".genie"),z=X.replace(/'/g,"'\\''"),L=_?`--session-id '${_}' `:"";if(await QD(q,`cd '${z}' && BEADS_DIR='${U}' claude ${L}'${G}'`,!0,!1),F.taskId){if(K8)await DD(F.taskId,"working").catch(()=>{});await PD(F.taskId,"working")}if(F.focus!==!1)await O(`select-pane -t '${q}'`);if(console.log(`
|
|
201
201
|
Spawned Claude with skill: ${D}`),console.log(` Pane: ${q}`),console.log(` Session: ${$}`),Q)console.log(` Worktree: ${Q}`);if(F.taskId){if(console.log(` Task: ${F.taskId}`),_)console.log(` Claude Session: ${_}`);console.log(`
|
|
202
202
|
Commands:`),console.log(" term workers - Check worker status"),console.log(` term approve ${F.taskId} - Approve permissions`),console.log(` term close ${F.taskId} - Close issue when done`)}}async function uF(){let D=await s0();if(D.length===0){console.log("No skills found in .claude/skills/ or ~/.claude/skills/");return}console.log(`Available skills:
|
|
203
203
|
`);for(let F of D){let E=await o0(F);if(E?.description)console.log(` ${F}`),console.log(` ${E.description}
|
|
@@ -224,4 +224,4 @@ Worker Orchestration:
|
|
|
224
224
|
term workers - List all workers and states
|
|
225
225
|
term close <bd-id> - Close issue, cleanup worker
|
|
226
226
|
term kill <worker> - Force kill a stuck worker
|
|
227
|
-
term daemon start - Start beads daemon for auto-sync`).version(m8);u.command("new <name>").description("Create a new tmux session").option("-d, --workspace <path>","Working directory for the session").option("-w, --worktree","Create git worktree in .worktrees/<name>/").action(async(D,F)=>{await E6(D,F)});u.command("ls").description("List all tmux sessions").option("--json","Output as JSON").action(async(D)=>{await B6(D)});u.command("attach <name>").description("Attach to a tmux session").action(async(D)=>{await $6(D)});u.command("rm <name>").description("Remove a tmux session").option("--keep-worktree","Keep worktree folder when removing session").action(async(D,F)=>{await X6(D,F)});u.command("read <session>").description("Read logs from a tmux session").option("-n, --lines <number>","Number of lines to read (default: 100)","100").option("--from <line>","Start line number").option("--to <line>","End line number").option("--range <range>","Line range (e.g., 100:200)").option("--search <pattern>","Search for pattern").option("--grep <pattern>","Regex search pattern").option("-f, --follow","Follow mode (live tail)").option("--all","Export entire scrollback buffer").option("--reverse","Reverse chronological (newest first)").option("--json","Output as JSON").action(async(D,F)=>{await S6(D,F)});u.command("exec <session> <command...>").description("Execute command in a tmux session").option("-q, --quiet","Suppress stdout output").option("-t, --timeout <ms>","Timeout in milliseconds (default: 120000)").action(async(D,F,E)=>{await T6(D,F.join(" "),{quiet:E.quiet,timeout:E.timeout?parseInt(E.timeout,10):void 0})});u.command("send <session> <keys>").description("Send keys to a tmux session (appends Enter by default)").option("--no-enter","Send raw keys without appending Enter").option("-p, --pane <id>","Target specific pane ID (e.g., %16)").action(async(D,F,E)=>{await b6(D,F,E)});u.command("split <session> [direction]").description("Split pane in a tmux session (h=horizontal, v=vertical)").option("-d, --workspace <path>","Working directory for the new pane").option("-w, --worktree <branch>","Create git worktree in .worktrees/<branch>/").action(async(D,F,E)=>{await P6(D,F,E)});u.command("info <session>").description("Check session state (idle/busy, pane count)").option("--command <id>","Check specific command status").option("--json","Output as JSON").action(async(D,F)=>{await l6(D,F)});var M8=u.command("window").description("Manage tmux windows");M8.command("new <session> <name>").description("Create a new window in session").action(async(D,F)=>{await k6(D,F)});M8.command("ls <session>").description("List windows in session").option("--json","Output as JSON").action(async(D,F)=>{await x6(D,F)});M8.command("rm <window-id>").description("Remove window by ID").action(async(D)=>{await y6(D)});var kF=u.command("pane").description("Manage tmux panes");kF.command("ls <session>").description("List all panes in session").option("--json","Output as JSON").action(async(D,F)=>{await h6(D,F)});kF.command("rm <pane-id>").description("Remove pane by ID").action(async(D)=>{await g6(D)});var O8=u.command("hook").description("Manage tmux hooks");O8.command("set <event> <command>").description("Set a tmux hook").action(async(D,F)=>{await w6(D,F)});O8.command("list").description("List all tmux hooks").action(async()=>{await v6()});O8.command("rm <event>").description("Remove a tmux hook").action(async(D)=>{await u6(D)});u.command("shortcuts").description("Warp-like keyboard shortcuts for tmux/Termux").option("--tmux","Output tmux.conf snippet").option("--termux","Output termux.properties snippet").option("--install","Install to config files (interactive)").action(async(D)=>{await n6(D)});u.command("spawn [skill]").description("Spawn Claude with a skill (interactive picker if no skill specified)").option("-s, --session <name>","Target tmux session").option("--no-worktree","Skip worktree creation when taskId provided").option("--no-focus","Don't focus the new pane").option("-p, --prompt <message>","Additional context for the skill").option("-t, --task-id <id>","Bind to beads issue").action(async(D,F)=>{await L8(D,F)});u.command("skills").description("List available skills").action(async()=>{await uF()});u.command("brainstorm").description("Spawn Claude with brainstorm skill (idea \u2192 design \u2192 spec)").option("-s, --session <name>","Target tmux session").option("--no-focus","Don't focus the new pane").option("-p, --prompt <message>","Additional context").action(async(D)=>{await L8("brainstorm",D)});u.command("watch <session>").description("Watch session events in real-time").option("-p, --pane <id>","Target specific pane ID (e.g., %16)").option("--json","Output events as JSON").option("--poll <ms>","Poll interval in milliseconds").action(async(D,F)=>{await S3(D,F)});u.command("run <session> <message>").description("Send task and auto-approve until idle (fire-and-forget)").option("-p, --pane <id>","Target specific pane ID (e.g., %16)").option("-a, --auto-approve","Auto-approve permissions and plans").option("-t, --timeout <ms>","Timeout in milliseconds (default: 300000)").option("--json","Output final state as JSON").action(async(D,F,E)=>{await P3(D,F,E)});u.command("create <title>").description("Create a new beads issue").option("-d, --description <text>","Issue description").option("-p, --parent <id>","Parent issue ID (creates dependency)").option("--json","Output as JSON").action(async(D,F)=>{await xF(D,F)});u.command("work <target>").description('Spawn worker bound to beads issue (target: bd-id, "next", or "wish")').option("--no-worktree","Use shared repo instead of worktree").option("-s, --session <name>","Target tmux session").option("--focus","Focus the worker pane after spawning").option("-p, --prompt <message>","Custom initial prompt").option("--no-resume","Start fresh session even if previous exists").action(async(D,F)=>{await K1(D,F)});u.command("workers").description("List all workers and their states").option("--json","Output as JSON").option("-w, --watch","Live updates (coming soon)").action(async(D)=>{if(D.watch)console.log("\u2139\uFE0F --watch mode coming in Phase 1.5");await L1(D)});u.command("close <task-id>").description("Close beads issue and cleanup worker").option("--no-sync","Skip bd sync").option("--keep-worktree","Don't remove the worktree").option("--merge","Merge worktree changes to main branch").option("-y, --yes","Skip confirmation").action(async(D,F)=>{await NF(D,F)});u.command("kill <worker>").description("Force kill a worker").option("-y, --yes","Skip confirmation").option("--keep-worktree","Don't remove the worktree").action(async(D,F)=>{await TF(D,F)});u.command("approve <worker>").description("Approve pending permission request for a worker").option("--deny","Deny instead of approve").action(async(D,F)=>{let E=await Promise.resolve().then(() => (mD(),lD)),B=await E.get(D);if(!B)B=await E.findByTask(D);if(!B)console.error(`\u274C Worker "${D}" not found. Run \`term workers\` to see workers.`),process.exit(1);await T3(B.session,{pane:B.paneId,deny:F.deny})});u.command("answer <worker> <choice>").description('Answer a question for a worker (use "text:..." for text input)').action(async(D,F)=>{let E=await Promise.resolve().then(() => (mD(),lD)),B=await E.get(D);if(!B)B=await E.findByTask(D);if(!B)console.error(`\u274C Worker "${D}" not found. Run \`term workers\` to see workers.`),process.exit(1);await b3(B.session,F,{pane:B.paneId})});var t0=u.command("daemon").description("Manage beads daemon for auto-sync");t0.command("start").description("Start beads daemon (auto-commit, auto-sync)").option("--no-auto-commit","Disable auto-commit").option("--auto-push","Enable auto-push to remote").action(async(D)=>{await bF(D)});t0.command("stop").description("Stop beads daemon").action(async()=>{await PF()});t0.command("status").description("Show daemon status").option("--json","Output as JSON").action(async(D)=>{await fF(D)});t0.command("restart").description("Restart beads daemon").option("--no-auto-commit","Disable auto-commit").option("--auto-push","Enable auto-push to remote").action(async(D)=>{await ZF(D)});var uD=u.command("orc").description("Orchestrate Claude Code sessions");uD.command("start <session>").description("Start Claude Code in a session with optional monitoring").option("-p, --pane <id>","Target specific pane ID (e.g., %16)").option("-m, --monitor","Enable real-time event monitoring").option("-c, --command <cmd>","Command to run instead of claude").option("--json","Output events as JSON").action(async(D,F)=>{await Q1(D,F)});uD.command("send <session> <message>").description("Send message to Claude and track completion").option("--pane <id>","Target specific pane ID (e.g., %16)").option("--method <name>","Completion detection method").option("-t, --timeout <ms>","Timeout in milliseconds").option("--no-wait","Send without waiting for completion").option("--json","Output as JSON").action(async(D,F,E)=>{await J1(D,F,E)});uD.command("status <session>").description("Show current Claude state and details").option("--pane <id>","Target specific pane ID (e.g., %16)").option("--json","Output as JSON").action(async(D,F)=>{await Y1(D,F)});uD.command("watch <session>").description("Watch session events in real-time").option("--pane <id>","Target specific pane ID (e.g., %16)").option("--json","Output events as JSON").option("-p, --poll <ms>","Poll interval in milliseconds").action(async(D,F)=>{await S3(D,F)});uD.command("approve <session>").description("Approve pending permission request").option("-p, --pane <id>","Specific pane ID to target").option("--auto","Auto-approve all future permissions (dangerous!)").option("--deny","Deny instead of approve").action(async(D,F)=>{await T3(D,F)});uD.command("answer <session> <choice>").description('Answer a question with the given choice (use "text:..." to send feedback)').option("-p, --pane <id>","Specific pane ID to target").action(async(D,F,E)=>{await b3(D,F,E)});uD.command("experiment <method>").description("Test a completion detection method").option("-n, --runs <number>","Number of test runs").option("--task <command>","Test command to run").option("--json","Output as JSON").action(async(D,F)=>{await q1(D,F)});uD.command("methods").description("List available completion detection methods").action(async()=>{await H1()});uD.command("run <session> <message>").description("Send task and auto-approve until idle (fire-and-forget)").option("-p, --pane <id>","Target specific pane ID (e.g., %16)").option("-a, --auto-approve","Auto-approve permissions and plans").option("-t, --timeout <ms>","Timeout in milliseconds (default: 300000)").option("--json","Output final state as JSON").action(async(D,F,E)=>{await P3(D,F,E)});u.parse();
|
|
227
|
+
term daemon start - Start beads daemon for auto-sync`).version(m8);u.command("new <name>").description("Create a new tmux session").option("-d, --workspace <path>","Working directory for the session").option("-w, --worktree","Create git worktree in .worktrees/<name>/").action(async(D,F)=>{await E6(D,F)});u.command("ls").description("List all tmux sessions").option("--json","Output as JSON").action(async(D)=>{await B6(D)});u.command("attach <name>").description("Attach to a tmux session").action(async(D)=>{await $6(D)});u.command("rm <name>").description("Remove a tmux session").option("--keep-worktree","Keep worktree folder when removing session").action(async(D,F)=>{await X6(D,F)});u.command("read <session>").description("Read logs from a tmux session").option("-n, --lines <number>","Number of lines to read (default: 100)","100").option("--from <line>","Start line number").option("--to <line>","End line number").option("--range <range>","Line range (e.g., 100:200)").option("--search <pattern>","Search for pattern").option("--grep <pattern>","Regex search pattern").option("-f, --follow","Follow mode (live tail)").option("--all","Export entire scrollback buffer").option("--reverse","Reverse chronological (newest first)").option("--json","Output as JSON").action(async(D,F)=>{await S6(D,F)});u.command("exec <session> <command...>").description("Execute command in a tmux session").option("-q, --quiet","Suppress stdout output").option("-t, --timeout <ms>","Timeout in milliseconds (default: 120000)").action(async(D,F,E)=>{await T6(D,F.join(" "),{quiet:E.quiet,timeout:E.timeout?parseInt(E.timeout,10):void 0})});u.command("send <session> <keys>").description("Send keys to a tmux session (appends Enter by default)").option("--no-enter","Send raw keys without appending Enter").option("-p, --pane <id>","Target specific pane ID (e.g., %16)").action(async(D,F,E)=>{await b6(D,F,E)});u.command("split <session> [direction]").description("Split pane in a tmux session (h=horizontal, v=vertical)").option("-d, --workspace <path>","Working directory for the new pane").option("-w, --worktree <branch>","Create git worktree in .worktrees/<branch>/").action(async(D,F,E)=>{await P6(D,F,E)});u.command("info <session>").description("Check session state (idle/busy, pane count)").option("--command <id>","Check specific command status").option("--json","Output as JSON").action(async(D,F)=>{await l6(D,F)});var M8=u.command("window").description("Manage tmux windows");M8.command("new <session> <name>").description("Create a new window in session").action(async(D,F)=>{await k6(D,F)});M8.command("ls <session>").description("List windows in session").option("--json","Output as JSON").action(async(D,F)=>{await x6(D,F)});M8.command("rm <window-id>").description("Remove window by ID").action(async(D)=>{await y6(D)});var kF=u.command("pane").description("Manage tmux panes");kF.command("ls <session>").description("List all panes in session").option("--json","Output as JSON").action(async(D,F)=>{await h6(D,F)});kF.command("rm <pane-id>").description("Remove pane by ID").action(async(D)=>{await g6(D)});var O8=u.command("hook").description("Manage tmux hooks");O8.command("set <event> <command>").description("Set a tmux hook").action(async(D,F)=>{await v6(D,F)});O8.command("list").description("List all tmux hooks").action(async()=>{await w6()});O8.command("rm <event>").description("Remove a tmux hook").action(async(D)=>{await u6(D)});u.command("shortcuts").description("Warp-like keyboard shortcuts for tmux/Termux").option("--tmux","Output tmux.conf snippet").option("--termux","Output termux.properties snippet").option("--install","Install to config files (interactive)").action(async(D)=>{await n6(D)});u.command("spawn [skill]").description("Spawn Claude with a skill (interactive picker if no skill specified)").option("-s, --session <name>","Target tmux session").option("--no-worktree","Skip worktree creation when taskId provided").option("--no-focus","Don't focus the new pane").option("-p, --prompt <message>","Additional context for the skill").option("-t, --task-id <id>","Bind to beads issue").action(async(D,F)=>{await L8(D,F)});u.command("skills").description("List available skills").action(async()=>{await uF()});u.command("brainstorm").description("Spawn Claude with brainstorm skill (idea \u2192 design \u2192 spec)").option("-s, --session <name>","Target tmux session").option("--no-focus","Don't focus the new pane").option("-p, --prompt <message>","Additional context").action(async(D)=>{await L8("brainstorm",D)});u.command("watch <session>").description("Watch session events in real-time").option("-p, --pane <id>","Target specific pane ID (e.g., %16)").option("--json","Output events as JSON").option("--poll <ms>","Poll interval in milliseconds").action(async(D,F)=>{await S3(D,F)});u.command("run <session> <message>").description("Send task and auto-approve until idle (fire-and-forget)").option("-p, --pane <id>","Target specific pane ID (e.g., %16)").option("-a, --auto-approve","Auto-approve permissions and plans").option("-t, --timeout <ms>","Timeout in milliseconds (default: 300000)").option("--json","Output final state as JSON").action(async(D,F,E)=>{await P3(D,F,E)});u.command("create <title>").description("Create a new beads issue").option("-d, --description <text>","Issue description").option("-p, --parent <id>","Parent issue ID (creates dependency)").option("--json","Output as JSON").action(async(D,F)=>{await xF(D,F)});u.command("work <target>").description('Spawn worker bound to beads issue (target: bd-id, "next", or "wish")').option("--no-worktree","Use shared repo instead of worktree").option("-s, --session <name>","Target tmux session").option("--focus","Focus the worker pane after spawning").option("-p, --prompt <message>","Custom initial prompt").option("--no-resume","Start fresh session even if previous exists").action(async(D,F)=>{await K1(D,F)});u.command("workers").description("List all workers and their states").option("--json","Output as JSON").option("-w, --watch","Live updates (coming soon)").action(async(D)=>{if(D.watch)console.log("\u2139\uFE0F --watch mode coming in Phase 1.5");await L1(D)});u.command("close <task-id>").description("Close beads issue and cleanup worker").option("--no-sync","Skip bd sync").option("--keep-worktree","Don't remove the worktree").option("--merge","Merge worktree changes to main branch").option("-y, --yes","Skip confirmation").action(async(D,F)=>{await NF(D,F)});u.command("kill <worker>").description("Force kill a worker").option("-y, --yes","Skip confirmation").option("--keep-worktree","Don't remove the worktree").action(async(D,F)=>{await TF(D,F)});u.command("approve <worker>").description("Approve pending permission request for a worker").option("--deny","Deny instead of approve").action(async(D,F)=>{let E=await Promise.resolve().then(() => (mD(),lD)),B=await E.get(D);if(!B)B=await E.findByTask(D);if(!B)console.error(`\u274C Worker "${D}" not found. Run \`term workers\` to see workers.`),process.exit(1);await T3(B.session,{pane:B.paneId,deny:F.deny})});u.command("answer <worker> <choice>").description('Answer a question for a worker (use "text:..." for text input)').action(async(D,F)=>{let E=await Promise.resolve().then(() => (mD(),lD)),B=await E.get(D);if(!B)B=await E.findByTask(D);if(!B)console.error(`\u274C Worker "${D}" not found. Run \`term workers\` to see workers.`),process.exit(1);await b3(B.session,F,{pane:B.paneId})});var t0=u.command("daemon").description("Manage beads daemon for auto-sync");t0.command("start").description("Start beads daemon (auto-commit, auto-sync)").option("--no-auto-commit","Disable auto-commit").option("--auto-push","Enable auto-push to remote").action(async(D)=>{await bF(D)});t0.command("stop").description("Stop beads daemon").action(async()=>{await PF()});t0.command("status").description("Show daemon status").option("--json","Output as JSON").action(async(D)=>{await fF(D)});t0.command("restart").description("Restart beads daemon").option("--no-auto-commit","Disable auto-commit").option("--auto-push","Enable auto-push to remote").action(async(D)=>{await ZF(D)});var uD=u.command("orc").description("Orchestrate Claude Code sessions");uD.command("start <session>").description("Start Claude Code in a session with optional monitoring").option("-p, --pane <id>","Target specific pane ID (e.g., %16)").option("-m, --monitor","Enable real-time event monitoring").option("-c, --command <cmd>","Command to run instead of claude").option("--json","Output events as JSON").action(async(D,F)=>{await Q1(D,F)});uD.command("send <session> <message>").description("Send message to Claude and track completion").option("--pane <id>","Target specific pane ID (e.g., %16)").option("--method <name>","Completion detection method").option("-t, --timeout <ms>","Timeout in milliseconds").option("--no-wait","Send without waiting for completion").option("--json","Output as JSON").action(async(D,F,E)=>{await J1(D,F,E)});uD.command("status <session>").description("Show current Claude state and details").option("--pane <id>","Target specific pane ID (e.g., %16)").option("--json","Output as JSON").action(async(D,F)=>{await Y1(D,F)});uD.command("watch <session>").description("Watch session events in real-time").option("--pane <id>","Target specific pane ID (e.g., %16)").option("--json","Output events as JSON").option("-p, --poll <ms>","Poll interval in milliseconds").action(async(D,F)=>{await S3(D,F)});uD.command("approve <session>").description("Approve pending permission request").option("-p, --pane <id>","Specific pane ID to target").option("--auto","Auto-approve all future permissions (dangerous!)").option("--deny","Deny instead of approve").action(async(D,F)=>{await T3(D,F)});uD.command("answer <session> <choice>").description('Answer a question with the given choice (use "text:..." to send feedback)').option("-p, --pane <id>","Specific pane ID to target").action(async(D,F,E)=>{await b3(D,F,E)});uD.command("experiment <method>").description("Test a completion detection method").option("-n, --runs <number>","Number of test runs").option("--task <command>","Test command to run").option("--json","Output as JSON").action(async(D,F)=>{await q1(D,F)});uD.command("methods").description("List available completion detection methods").action(async()=>{await H1()});uD.command("run <session> <message>").description("Send task and auto-approve until idle (fire-and-forget)").option("-p, --pane <id>","Target specific pane ID (e.g., %16)").option("-a, --auto-approve","Auto-approve permissions and plans").option("-t, --timeout <ms>","Timeout in milliseconds (default: 300000)").option("--json","Output final state as JSON").action(async(D,F,E)=>{await P3(D,F,E)});u.parse();
|