Files
claude-mem/dist/claude-mem.min.js
T
Alex Newman 5886fe7d8f feat: add publish script for claude-mem
- Implemented a CLI tool for version bumping, building, and publishing to npm.
- Added checks for uncommitted changes and current version retrieval.
- Included options for patch, minor, major, and custom version bumps.
- Integrated git commit and tagging after version update.
- Added npm publish functionality and git push after successful publish.
- Implemented error handling and user confirmations throughout the process.
2025-10-14 19:26:11 -04:00

652 lines
350 KiB
JavaScript
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env node
import{createRequire as BC}from"node:module";var uC=Object.create;var{getPrototypeOf:FC,defineProperty:wF,getOwnPropertyNames:CC}=Object;var EC=Object.prototype.hasOwnProperty;var lD=(D,u,F)=>{F=D!=null?uC(FC(D)):{};let C=u||!D||!D.__esModule?wF(F,"default",{value:D,enumerable:!0}):F;for(let E of CC(D))if(!EC.call(C,E))wF(C,E,{get:()=>D[E],enumerable:!0});return C};var y=(D,u)=>()=>(u||D((u={exports:{}}).exports,u),u.exports);var Z0=(D,u)=>{for(var F in u)wF(D,F,{get:u[F],enumerable:!0,configurable:!0,set:(C)=>u[F]=()=>C})};var E0=(D,u)=>()=>(D&&(u=D(D=0)),u);var a=BC(import.meta.url);var c0=y(($C)=>{class kF extends Error{constructor(D,u,F){super(F);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=u,this.exitCode=D,this.nestedError=void 0}}class j3 extends kF{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}$C.CommanderError=kF;$C.InvalidArgumentError=j3});var Iu=y((JC)=>{var{InvalidArgumentError:ZC}=c0();class O3{constructor(D,u){switch(this.description=u||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,D[0]){case"<":this.required=!0,this._name=D.slice(1,-1);break;case"[":this.required=!1,this._name=D.slice(1,-1);break;default:this.required=!0,this._name=D;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(D,u){if(u===this.defaultValue||!Array.isArray(u))return[D];return u.push(D),u}default(D,u){return this.defaultValue=D,this.defaultValueDescription=u,this}argParser(D){return this.parseArg=D,this}choices(D){return this.argChoices=D.slice(),this.parseArg=(u,F)=>{if(!this.argChoices.includes(u))throw new ZC(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(u,F);return u},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function YC(D){let u=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+u+">":"["+u+"]"}JC.Argument=O3;JC.humanReadableArgName=YC});var PF=y((HC)=>{var{humanReadableArgName:VC}=Iu();class T3{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(D){this.helpWidth=this.helpWidth??D.helpWidth??80}visibleCommands(D){let u=D.commands.filter((C)=>!C._hidden),F=D._getHelpCommand();if(F&&!F._hidden)u.push(F);if(this.sortSubcommands)u.sort((C,E)=>{return C.name().localeCompare(E.name())});return u}compareOptions(D,u){let F=(C)=>{return C.short?C.short.replace(/^-/,""):C.long.replace(/^--/,"")};return F(D).localeCompare(F(u))}visibleOptions(D){let u=D.options.filter((C)=>!C.hidden),F=D._getHelpOption();if(F&&!F.hidden){let C=F.short&&D._findOption(F.short),E=F.long&&D._findOption(F.long);if(!C&&!E)u.push(F);else if(F.long&&!E)u.push(D.createOption(F.long,F.description));else if(F.short&&!C)u.push(D.createOption(F.short,F.description))}if(this.sortOptions)u.sort(this.compareOptions);return u}visibleGlobalOptions(D){if(!this.showGlobalOptions)return[];let u=[];for(let F=D.parent;F;F=F.parent){let C=F.options.filter((E)=>!E.hidden);u.push(...C)}if(this.sortOptions)u.sort(this.compareOptions);return u}visibleArguments(D){if(D._argsDescription)D.registeredArguments.forEach((u)=>{u.description=u.description||D._argsDescription[u.name()]||""});if(D.registeredArguments.find((u)=>u.description))return D.registeredArguments;return[]}subcommandTerm(D){let u=D.registeredArguments.map((F)=>VC(F)).join(" ");return D._name+(D._aliases[0]?"|"+D._aliases[0]:"")+(D.options.length?" [options]":"")+(u?" "+u:"")}optionTerm(D){return D.flags}argumentTerm(D){return D.name()}longestSubcommandTermLength(D,u){return u.visibleCommands(D).reduce((F,C)=>{return Math.max(F,this.displayWidth(u.styleSubcommandTerm(u.subcommandTerm(C))))},0)}longestOptionTermLength(D,u){return u.visibleOptions(D).reduce((F,C)=>{return Math.max(F,this.displayWidth(u.styleOptionTerm(u.optionTerm(C))))},0)}longestGlobalOptionTermLength(D,u){return u.visibleGlobalOptions(D).reduce((F,C)=>{return Math.max(F,this.displayWidth(u.styleOptionTerm(u.optionTerm(C))))},0)}longestArgumentTermLength(D,u){return u.visibleArguments(D).reduce((F,C)=>{return Math.max(F,this.displayWidth(u.styleArgumentTerm(u.argumentTerm(C))))},0)}commandUsage(D){let u=D._name;if(D._aliases[0])u=u+"|"+D._aliases[0];let F="";for(let C=D.parent;C;C=C.parent)F=C.name()+" "+F;return F+u+" "+D.usage()}commandDescription(D){return D.description()}subcommandDescription(D){return D.summary()||D.description()}optionDescription(D){let u=[];if(D.argChoices)u.push(`choices: ${D.argChoices.map((F)=>JSON.stringify(F)).join(", ")}`);if(D.defaultValue!==void 0){if(D.required||D.optional||D.isBoolean()&&typeof D.defaultValue==="boolean")u.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`)}if(D.presetArg!==void 0&&D.optional)u.push(`preset: ${JSON.stringify(D.presetArg)}`);if(D.envVar!==void 0)u.push(`env: ${D.envVar}`);if(u.length>0){let F=`(${u.join(", ")})`;if(D.description)return`${D.description} ${F}`;return F}return D.description}argumentDescription(D){let u=[];if(D.argChoices)u.push(`choices: ${D.argChoices.map((F)=>JSON.stringify(F)).join(", ")}`);if(D.defaultValue!==void 0)u.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`);if(u.length>0){let F=`(${u.join(", ")})`;if(D.description)return`${D.description} ${F}`;return F}return D.description}formatItemList(D,u,F){if(u.length===0)return[];return[F.styleTitle(D),...u,""]}groupItems(D,u,F){let C=new Map;return D.forEach((E)=>{let $=F(E);if(!C.has($))C.set($,[])}),u.forEach((E)=>{let $=F(E);if(!C.has($))C.set($,[]);C.get($).push(E)}),C}formatHelp(D,u){let F=u.padWidth(D,u),C=u.helpWidth??80;function E(Y,J){return u.formatItem(Y,F,J,u)}let $=[`${u.styleTitle("Usage:")} ${u.styleUsage(u.commandUsage(D))}`,""],B=u.commandDescription(D);if(B.length>0)$=$.concat([u.boxWrap(u.styleCommandDescription(B),C),""]);let Q=u.visibleArguments(D).map((Y)=>{return E(u.styleArgumentTerm(u.argumentTerm(Y)),u.styleArgumentDescription(u.argumentDescription(Y)))});if($=$.concat(this.formatItemList("Arguments:",Q,u)),this.groupItems(D.options,u.visibleOptions(D),(Y)=>Y.helpGroupHeading??"Options:").forEach((Y,J)=>{let H=Y.map((A)=>{return E(u.styleOptionTerm(u.optionTerm(A)),u.styleOptionDescription(u.optionDescription(A)))});$=$.concat(this.formatItemList(J,H,u))}),u.showGlobalOptions){let Y=u.visibleGlobalOptions(D).map((J)=>{return E(u.styleOptionTerm(u.optionTerm(J)),u.styleOptionDescription(u.optionDescription(J)))});$=$.concat(this.formatItemList("Global Options:",Y,u))}return this.groupItems(D.commands,u.visibleCommands(D),(Y)=>Y.helpGroup()||"Commands:").forEach((Y,J)=>{let H=Y.map((A)=>{return E(u.styleSubcommandTerm(u.subcommandTerm(A)),u.styleSubcommandDescription(u.subcommandDescription(A)))});$=$.concat(this.formatItemList(J,H,u))}),$.join(`
`)}displayWidth(D){return N3(D).length}styleTitle(D){return D}styleUsage(D){return D.split(" ").map((u)=>{if(u==="[options]")return this.styleOptionText(u);if(u==="[command]")return this.styleSubcommandText(u);if(u[0]==="["||u[0]==="<")return this.styleArgumentText(u);return this.styleCommandText(u)}).join(" ")}styleCommandDescription(D){return this.styleDescriptionText(D)}styleOptionDescription(D){return this.styleDescriptionText(D)}styleSubcommandDescription(D){return this.styleDescriptionText(D)}styleArgumentDescription(D){return this.styleDescriptionText(D)}styleDescriptionText(D){return D}styleOptionTerm(D){return this.styleOptionText(D)}styleSubcommandTerm(D){return D.split(" ").map((u)=>{if(u==="[options]")return this.styleOptionText(u);if(u[0]==="["||u[0]==="<")return this.styleArgumentText(u);return this.styleSubcommandText(u)}).join(" ")}styleArgumentTerm(D){return this.styleArgumentText(D)}styleOptionText(D){return D}styleArgumentText(D){return D}styleSubcommandText(D){return D}styleCommandText(D){return D}padWidth(D,u){return Math.max(u.longestOptionTermLength(D,u),u.longestGlobalOptionTermLength(D,u),u.longestSubcommandTermLength(D,u),u.longestArgumentTermLength(D,u))}preformatted(D){return/\n[^\S\r\n]/.test(D)}formatItem(D,u,F,C){let $=" ".repeat(2);if(!F)return $+D;let B=D.padEnd(u+D.length-C.displayWidth(D)),Q=2,Z=(this.helpWidth??80)-u-Q-2,Y;if(Z<this.minWidthToWrap||C.preformatted(F))Y=F;else Y=C.boxWrap(F,Z).replace(/\n/g,`
`+" ".repeat(u+Q));return $+B+" ".repeat(Q)+Y.replace(/\n/g,`
${$}`)}boxWrap(D,u){if(u<this.minWidthToWrap)return D;let F=D.split(/\r\n|\n/),C=/[\s]*[^\s]+/g,E=[];return F.forEach(($)=>{let B=$.match(C);if(B===null){E.push("");return}let Q=[B.shift()],X=this.displayWidth(Q[0]);B.forEach((Z)=>{let Y=this.displayWidth(Z);if(X+Y<=u){Q.push(Z),X+=Y;return}E.push(Q.join(""));let J=Z.trimStart();Q=[J],X=this.displayWidth(J)}),E.push(Q.join(""))}),E.join(`
`)}}function N3(D){let u=/\x1b\[\d*(;\d*)*m/g;return D.replace(u,"")}HC.Help=T3;HC.stripColor=N3});var SF=y((WC)=>{var{InvalidArgumentError:UC}=c0();class k3{constructor(D,u){this.flags=D,this.description=u||"",this.required=D.includes("<"),this.optional=D.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(D),this.mandatory=!1;let F=_C(D);if(this.short=F.shortFlag,this.long=F.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(D,u){return this.defaultValue=D,this.defaultValueDescription=u,this}preset(D){return this.presetArg=D,this}conflicts(D){return this.conflictsWith=this.conflictsWith.concat(D),this}implies(D){let u=D;if(typeof D==="string")u={[D]:!0};return this.implied=Object.assign(this.implied||{},u),this}env(D){return this.envVar=D,this}argParser(D){return this.parseArg=D,this}makeOptionMandatory(D=!0){return this.mandatory=!!D,this}hideHelp(D=!0){return this.hidden=!!D,this}_collectValue(D,u){if(u===this.defaultValue||!Array.isArray(u))return[D];return u.push(D),u}choices(D){return this.argChoices=D.slice(),this.parseArg=(u,F)=>{if(!this.argChoices.includes(u))throw new UC(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(u,F);return u},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return w3(this.name().replace(/^no-/,""));return w3(this.name())}helpGroup(D){return this.helpGroupHeading=D,this}is(D){return this.short===D||this.long===D}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class P3{constructor(D){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,D.forEach((u)=>{if(u.negate)this.negativeOptions.set(u.attributeName(),u);else this.positiveOptions.set(u.attributeName(),u)}),this.negativeOptions.forEach((u,F)=>{if(this.positiveOptions.has(F))this.dualOptions.add(F)})}valueFromOption(D,u){let F=u.attributeName();if(!this.dualOptions.has(F))return!0;let C=this.negativeOptions.get(F).presetArg,E=C!==void 0?C:!1;return u.negate===(E===D)}}function w3(D){return D.split("-").reduce((u,F)=>{return u+F[0].toUpperCase()+F.slice(1)})}function _C(D){let u,F,C=/^-[^-]$/,E=/^--[^-]/,$=D.split(/[ |,]+/).concat("guard");if(C.test($[0]))u=$.shift();if(E.test($[0]))F=$.shift();if(!u&&C.test($[0]))u=$.shift();if(!u&&E.test($[0]))u=F,F=$.shift();if($[0].startsWith("-")){let B=$[0],Q=`option creation failed due to '${B}' in option flags '${D}'`;if(/^-[^-][^-]/.test(B))throw new Error(`${Q}
- a short flag is a single dash and a single character
- either use a single dash and a single character (for a short flag)
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(C.test(B))throw new Error(`${Q}
- too many short flags`);if(E.test(B))throw new Error(`${Q}
- too many long flags`);throw new Error(`${Q}
- unrecognised flag format`)}if(u===void 0&&F===void 0)throw new Error(`option creation failed due to no flags found in '${D}'.`);return{shortFlag:u,longFlag:F}}WC.Option=k3;WC.DualOptions=P3});var S3=y((IC)=>{function RC(D,u){if(Math.abs(D.length-u.length)>3)return Math.max(D.length,u.length);let F=[];for(let C=0;C<=D.length;C++)F[C]=[C];for(let C=0;C<=u.length;C++)F[0][C]=C;for(let C=1;C<=u.length;C++)for(let E=1;E<=D.length;E++){let $=1;if(D[E-1]===u[C-1])$=0;else $=1;if(F[E][C]=Math.min(F[E-1][C]+1,F[E][C-1]+1,F[E-1][C-1]+$),E>1&&C>1&&D[E-1]===u[C-2]&&D[E-2]===u[C-1])F[E][C]=Math.min(F[E][C],F[E-2][C-2]+1)}return F[D.length][u.length]}function MC(D,u){if(!u||u.length===0)return"";u=Array.from(new Set(u));let F=D.startsWith("--");if(F)D=D.slice(2),u=u.map((B)=>B.slice(2));let C=[],E=3,$=0.4;if(u.forEach((B)=>{if(B.length<=1)return;let Q=RC(D,B),X=Math.max(D.length,B.length);if((X-Q)/X>$){if(Q<E)E=Q,C=[B];else if(Q===E)C.push(B)}}),C.sort((B,Q)=>B.localeCompare(Q)),F)C=C.map((B)=>`--${B}`);if(C.length>1)return`
(Did you mean one of ${C.join(", ")}?)`;if(C.length===1)return`
(Did you mean ${C[0]}?)`;return""}IC.suggestSimilar=MC});var y3=y((SC)=>{var OC=a("node:events").EventEmitter,xF=a("node:child_process"),B0=a("node:path"),ju=a("node:fs"),h=a("node:process"),{Argument:TC,humanReadableArgName:NC}=Iu(),{CommanderError:bF}=c0(),{Help:wC,stripColor:kC}=PF(),{Option:x3,DualOptions:PC}=SF(),{suggestSimilar:b3}=S3();class yF extends OC{constructor(D){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=D||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(u)=>h.stdout.write(u),writeErr:(u)=>h.stderr.write(u),outputError:(u,F)=>F(u),getOutHelpWidth:()=>h.stdout.isTTY?h.stdout.columns:void 0,getErrHelpWidth:()=>h.stderr.isTTY?h.stderr.columns:void 0,getOutHasColors:()=>vF()??(h.stdout.isTTY&&h.stdout.hasColors?.()),getErrHasColors:()=>vF()??(h.stderr.isTTY&&h.stderr.hasColors?.()),stripColor:(u)=>kC(u)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(D){return this._outputConfiguration=D._outputConfiguration,this._helpOption=D._helpOption,this._helpCommand=D._helpCommand,this._helpConfiguration=D._helpConfiguration,this._exitCallback=D._exitCallback,this._storeOptionsAsProperties=D._storeOptionsAsProperties,this._combineFlagAndOptionalValue=D._combineFlagAndOptionalValue,this._allowExcessArguments=D._allowExcessArguments,this._enablePositionalOptions=D._enablePositionalOptions,this._showHelpAfterError=D._showHelpAfterError,this._showSuggestionAfterError=D._showSuggestionAfterError,this}_getCommandAndAncestors(){let D=[];for(let u=this;u;u=u.parent)D.push(u);return D}command(D,u,F){let C=u,E=F;if(typeof C==="object"&&C!==null)E=C,C=null;E=E||{};let[,$,B]=D.match(/([^ ]+) *(.*)/),Q=this.createCommand($);if(C)Q.description(C),Q._executableHandler=!0;if(E.isDefault)this._defaultCommandName=Q._name;if(Q._hidden=!!(E.noHelp||E.hidden),Q._executableFile=E.executableFile||null,B)Q.arguments(B);if(this._registerCommand(Q),Q.parent=this,Q.copyInheritedSettings(this),C)return this;return Q}createCommand(D){return new yF(D)}createHelp(){return Object.assign(new wC,this.configureHelp())}configureHelp(D){if(D===void 0)return this._helpConfiguration;return this._helpConfiguration=D,this}configureOutput(D){if(D===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...D},this}showHelpAfterError(D=!0){if(typeof D!=="string")D=!!D;return this._showHelpAfterError=D,this}showSuggestionAfterError(D=!0){return this._showSuggestionAfterError=!!D,this}addCommand(D,u){if(!D._name)throw new Error(`Command passed to .addCommand() must have a name
- specify the name in Command constructor or using .name()`);if(u=u||{},u.isDefault)this._defaultCommandName=D._name;if(u.noHelp||u.hidden)D._hidden=!0;return this._registerCommand(D),D.parent=this,D._checkForBrokenPassThrough(),this}createArgument(D,u){return new TC(D,u)}argument(D,u,F,C){let E=this.createArgument(D,u);if(typeof F==="function")E.default(C).argParser(F);else E.default(F);return this.addArgument(E),this}arguments(D){return D.trim().split(/ +/).forEach((u)=>{this.argument(u)}),this}addArgument(D){let u=this.registeredArguments.slice(-1)[0];if(u?.variadic)throw new Error(`only the last argument can be variadic '${u.name()}'`);if(D.required&&D.defaultValue!==void 0&&D.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${D.name()}'`);return this.registeredArguments.push(D),this}helpCommand(D,u){if(typeof D==="boolean"){if(this._addImplicitHelpCommand=D,D&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let F=D??"help [command]",[,C,E]=F.match(/([^ ]+) *(.*)/),$=u??"display help for command",B=this.createCommand(C);if(B.helpOption(!1),E)B.arguments(E);if($)B.description($);if(this._addImplicitHelpCommand=!0,this._helpCommand=B,D||u)this._initCommandGroup(B);return this}addHelpCommand(D,u){if(typeof D!=="object")return this.helpCommand(D,u),this;return this._addImplicitHelpCommand=!0,this._helpCommand=D,this._initCommandGroup(D),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(D,u){let F=["preSubcommand","preAction","postAction"];if(!F.includes(D))throw new Error(`Unexpected value for event passed to hook : '${D}'.
Expecting one of '${F.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycleHooks[D].push(u);else this._lifeCycleHooks[D]=[u];return this}exitOverride(D){if(D)this._exitCallback=D;else this._exitCallback=(u)=>{if(u.code!=="commander.executeSubCommandAsync")throw u};return this}_exit(D,u,F){if(this._exitCallback)this._exitCallback(new bF(D,u,F));h.exit(D)}action(D){let u=(F)=>{let C=this.registeredArguments.length,E=F.slice(0,C);if(this._storeOptionsAsProperties)E[C]=this;else E[C]=this.opts();return E.push(this),D.apply(this,E)};return this._actionHandler=u,this}createOption(D,u){return new x3(D,u)}_callParseArg(D,u,F,C){try{return D.parseArg(u,F)}catch(E){if(E.code==="commander.invalidArgument"){let $=`${C} ${E.message}`;this.error($,{exitCode:E.exitCode,code:E.code})}throw E}}_registerOption(D){let u=D.short&&this._findOption(D.short)||D.long&&this._findOption(D.long);if(u){let F=D.long&&this._findOption(D.long)?D.long:D.short;throw new Error(`Cannot add option '${D.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${F}'
- already used by option '${u.flags}'`)}this._initOptionGroup(D),this.options.push(D)}_registerCommand(D){let u=(C)=>{return[C.name()].concat(C.aliases())},F=u(D).find((C)=>this._findCommand(C));if(F){let C=u(this._findCommand(F)).join("|"),E=u(D).join("|");throw new Error(`cannot add command '${E}' as already have command '${C}'`)}this._initCommandGroup(D),this.commands.push(D)}addOption(D){this._registerOption(D);let u=D.name(),F=D.attributeName();if(D.negate){let E=D.long.replace(/^--no-/,"--");if(!this._findOption(E))this.setOptionValueWithSource(F,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(F,D.defaultValue,"default");let C=(E,$,B)=>{if(E==null&&D.presetArg!==void 0)E=D.presetArg;let Q=this.getOptionValue(F);if(E!==null&&D.parseArg)E=this._callParseArg(D,E,Q,$);else if(E!==null&&D.variadic)E=D._collectValue(E,Q);if(E==null)if(D.negate)E=!1;else if(D.isBoolean()||D.optional)E=!0;else E="";this.setOptionValueWithSource(F,E,B)};if(this.on("option:"+u,(E)=>{let $=`error: option '${D.flags}' argument '${E}' is invalid.`;C(E,$,"cli")}),D.envVar)this.on("optionEnv:"+u,(E)=>{let $=`error: option '${D.flags}' value '${E}' from env '${D.envVar}' is invalid.`;C(E,$,"env")});return this}_optionEx(D,u,F,C,E){if(typeof u==="object"&&u instanceof x3)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let $=this.createOption(u,F);if($.makeOptionMandatory(!!D.mandatory),typeof C==="function")$.default(E).argParser(C);else if(C instanceof RegExp){let B=C;C=(Q,X)=>{let Z=B.exec(Q);return Z?Z[0]:X},$.default(E).argParser(C)}else $.default(C);return this.addOption($)}option(D,u,F,C){return this._optionEx({},D,u,F,C)}requiredOption(D,u,F,C){return this._optionEx({mandatory:!0},D,u,F,C)}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 new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(D=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!D,this}getOptionValue(D){if(this._storeOptionsAsProperties)return this[D];return this._optionValues[D]}setOptionValue(D,u){return this.setOptionValueWithSource(D,u,void 0)}setOptionValueWithSource(D,u,F){if(this._storeOptionsAsProperties)this[D]=u;else this._optionValues[D]=u;return this._optionValueSources[D]=F,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let u;return this._getCommandAndAncestors().forEach((F)=>{if(F.getOptionValueSource(D)!==void 0)u=F.getOptionValueSource(D)}),u}_prepareUserArgs(D,u){if(D!==void 0&&!Array.isArray(D))throw new Error("first parameter to parse must be array or undefined");if(u=u||{},D===void 0&&u.from===void 0){if(h.versions?.electron)u.from="electron";let C=h.execArgv??[];if(C.includes("-e")||C.includes("--eval")||C.includes("-p")||C.includes("--print"))u.from="eval"}if(D===void 0)D=h.argv;this.rawArgs=D.slice();let F;switch(u.from){case void 0:case"node":this._scriptPath=D[1],F=D.slice(2);break;case"electron":if(h.defaultApp)this._scriptPath=D[1],F=D.slice(2);else F=D.slice(1);break;case"user":F=D.slice(0);break;case"eval":F=D.slice(1);break;default:throw new Error(`unexpected parse option { from: '${u.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",F}parse(D,u){this._prepareForParse();let F=this._prepareUserArgs(D,u);return this._parseCommand([],F),this}async parseAsync(D,u){this._prepareForParse();let F=this._prepareUserArgs(D,u);return await this._parseCommand([],F),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(D,u,F){if(ju.existsSync(D))return;let C=u?`searched for local subcommand relative to directory '${u}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",E=`'${D}' does not exist
- if '${F}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
- ${C}`;throw new Error(E)}_executeSubCommand(D,u){u=u.slice();let F=!1,C=[".js",".ts",".tsx",".mjs",".cjs"];function E(Z,Y){let J=B0.resolve(Z,Y);if(ju.existsSync(J))return J;if(C.includes(B0.extname(Y)))return;let H=C.find((A)=>ju.existsSync(`${J}${A}`));if(H)return`${J}${H}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let $=D._executableFile||`${this._name}-${D._name}`,B=this._executableDir||"";if(this._scriptPath){let Z;try{Z=ju.realpathSync(this._scriptPath)}catch{Z=this._scriptPath}B=B0.resolve(B0.dirname(Z),B)}if(B){let Z=E(B,$);if(!Z&&!D._executableFile&&this._scriptPath){let Y=B0.basename(this._scriptPath,B0.extname(this._scriptPath));if(Y!==this._name)Z=E(B,`${Y}-${D._name}`)}$=Z||$}F=C.includes(B0.extname($));let Q;if(h.platform!=="win32")if(F)u.unshift($),u=v3(h.execArgv).concat(u),Q=xF.spawn(h.argv[0],u,{stdio:"inherit"});else Q=xF.spawn($,u,{stdio:"inherit"});else this._checkForMissingExecutable($,B,D._name),u.unshift($),u=v3(h.execArgv).concat(u),Q=xF.spawn(h.execPath,u,{stdio:"inherit"});if(!Q.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((Y)=>{h.on(Y,()=>{if(Q.killed===!1&&Q.exitCode===null)Q.kill(Y)})});let X=this._exitCallback;Q.on("close",(Z)=>{if(Z=Z??1,!X)h.exit(Z);else X(new bF(Z,"commander.executeSubCommandAsync","(close)"))}),Q.on("error",(Z)=>{if(Z.code==="ENOENT")this._checkForMissingExecutable($,B,D._name);else if(Z.code==="EACCES")throw new Error(`'${$}' not executable`);if(!X)h.exit(1);else{let Y=new bF(1,"commander.executeSubCommandAsync","(error)");Y.nestedError=Z,X(Y)}}),this.runningCommand=Q}_dispatchSubcommand(D,u,F){let C=this._findCommand(D);if(!C)this.help({error:!0});C._prepareForParse();let E;return E=this._chainOrCallSubCommandHook(E,C,"preSubcommand"),E=this._chainOrCall(E,()=>{if(C._executableHandler)this._executeSubCommand(C,u.concat(F));else return C._parseCommand(u,F)}),E}_dispatchHelpCommand(D){if(!D)this.help();let u=this._findCommand(D);if(u&&!u._executableHandler)u.help();return this._dispatchSubcommand(D,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((D,u)=>{if(D.required&&this.args[u]==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=(F,C,E)=>{let $=C;if(C!==null&&F.parseArg){let B=`error: command-argument value '${C}' is invalid for argument '${F.name()}'.`;$=this._callParseArg(F,C,E,B)}return $};this._checkNumberOfArguments();let u=[];this.registeredArguments.forEach((F,C)=>{let E=F.defaultValue;if(F.variadic){if(C<this.args.length){if(E=this.args.slice(C),F.parseArg)E=E.reduce(($,B)=>{return D(F,B,$)},F.defaultValue)}else if(E===void 0)E=[]}else if(C<this.args.length){if(E=this.args[C],F.parseArg)E=D(F,E,F.defaultValue)}u[C]=E}),this.processedArgs=u}_chainOrCall(D,u){if(D?.then&&typeof D.then==="function")return D.then(()=>u());return u()}_chainOrCallHooks(D,u){let F=D,C=[];if(this._getCommandAndAncestors().reverse().filter((E)=>E._lifeCycleHooks[u]!==void 0).forEach((E)=>{E._lifeCycleHooks[u].forEach(($)=>{C.push({hookedCommand:E,callback:$})})}),u==="postAction")C.reverse();return C.forEach((E)=>{F=this._chainOrCall(F,()=>{return E.callback(E.hookedCommand,this)})}),F}_chainOrCallSubCommandHook(D,u,F){let C=D;if(this._lifeCycleHooks[F]!==void 0)this._lifeCycleHooks[F].forEach((E)=>{C=this._chainOrCall(C,()=>{return E(this,u)})});return C}_parseCommand(D,u){let F=this.parseOptions(u);if(this._parseOptionsEnv(),this._parseOptionsImplied(),D=D.concat(F.operands),u=F.unknown,this.args=D.concat(u),D&&this._findCommand(D[0]))return this._dispatchSubcommand(D[0],D.slice(1),u);if(this._getHelpCommand()&&D[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(D[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(u),this._dispatchSubcommand(this._defaultCommandName,D,u);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(F.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let C=()=>{if(F.unknown.length>0)this.unknownOption(F.unknown[0])},E=`command:${this.name()}`;if(this._actionHandler){C(),this._processArguments();let $;if($=this._chainOrCallHooks($,"preAction"),$=this._chainOrCall($,()=>this._actionHandler(this.processedArgs)),this.parent)$=this._chainOrCall($,()=>{this.parent.emit(E,D,u)});return $=this._chainOrCallHooks($,"postAction"),$}if(this.parent?.listenerCount(E))C(),this._processArguments(),this.parent.emit(E,D,u);else if(D.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",D,u);if(this.listenerCount("command:*"))this.emit("command:*",D,u);else if(this.commands.length)this.unknownCommand();else C(),this._processArguments()}else if(this.commands.length)C(),this.help({error:!0});else C(),this._processArguments()}_findCommand(D){if(!D)return;return this.commands.find((u)=>u._name===D||u._aliases.includes(D))}_findOption(D){return this.options.find((u)=>u.is(D))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((D)=>{D.options.forEach((u)=>{if(u.mandatory&&D.getOptionValue(u.attributeName())===void 0)D.missingMandatoryOptionValue(u)})})}_checkForConflictingLocalOptions(){let D=this.options.filter((F)=>{let C=F.attributeName();if(this.getOptionValue(C)===void 0)return!1;return this.getOptionValueSource(C)!=="default"});D.filter((F)=>F.conflictsWith.length>0).forEach((F)=>{let C=D.find((E)=>F.conflictsWith.includes(E.attributeName()));if(C)this._conflictingOption(F,C)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let u=[],F=[],C=u;function E(Z){return Z.length>1&&Z[0]==="-"}let $=(Z)=>{if(!/^-\d*\.?\d+(e[+-]?\d+)?$/.test(Z))return!1;return!this._getCommandAndAncestors().some((Y)=>Y.options.map((J)=>J.short).some((J)=>/^-\d$/.test(J)))},B=null,Q=null,X=0;while(X<D.length||Q){let Z=Q??D[X++];if(Q=null,Z==="--"){if(C===F)C.push(Z);C.push(...D.slice(X));break}if(B&&(!E(Z)||$(Z))){this.emit(`option:${B.name()}`,Z);continue}if(B=null,E(Z)){let Y=this._findOption(Z);if(Y){if(Y.required){let J=D[X++];if(J===void 0)this.optionMissingArgument(Y);this.emit(`option:${Y.name()}`,J)}else if(Y.optional){let J=null;if(X<D.length&&(!E(D[X])||$(D[X])))J=D[X++];this.emit(`option:${Y.name()}`,J)}else this.emit(`option:${Y.name()}`);B=Y.variadic?Y:null;continue}}if(Z.length>2&&Z[0]==="-"&&Z[1]!=="-"){let Y=this._findOption(`-${Z[1]}`);if(Y){if(Y.required||Y.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${Y.name()}`,Z.slice(2));else this.emit(`option:${Y.name()}`),Q=`-${Z.slice(2)}`;continue}}if(/^--[^=]+=/.test(Z)){let Y=Z.indexOf("="),J=this._findOption(Z.slice(0,Y));if(J&&(J.required||J.optional)){this.emit(`option:${J.name()}`,Z.slice(Y+1));continue}}if(C===u&&E(Z)&&!(this.commands.length===0&&$(Z)))C=F;if((this._enablePositionalOptions||this._passThroughOptions)&&u.length===0&&F.length===0){if(this._findCommand(Z)){u.push(Z),F.push(...D.slice(X));break}else if(this._getHelpCommand()&&Z===this._getHelpCommand().name()){u.push(Z,...D.slice(X));break}else if(this._defaultCommandName){F.push(Z,...D.slice(X));break}}if(this._passThroughOptions){C.push(Z,...D.slice(X));break}C.push(Z)}return{operands:u,unknown:F}}opts(){if(this._storeOptionsAsProperties){let D={},u=this.options.length;for(let F=0;F<u;F++){let C=this.options[F].attributeName();D[C]=C===this._versionOptionName?this._version:this[C]}return D}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((D,u)=>Object.assign(D,u.opts()),{})}error(D,u){if(this._outputConfiguration.outputError(`${D}
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
`),this.outputHelp({error:!0});let F=u||{},C=F.exitCode||1,E=F.code||"commander.error";this._exit(C,E,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in h.env){let u=D.attributeName();if(this.getOptionValue(u)===void 0||["default","config","env"].includes(this.getOptionValueSource(u)))if(D.required||D.optional)this.emit(`optionEnv:${D.name()}`,h.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new PC(this.options),u=(F)=>{return this.getOptionValue(F)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(F))};this.options.filter((F)=>F.implied!==void 0&&u(F.attributeName())&&D.valueFromOption(this.getOptionValue(F.attributeName()),F)).forEach((F)=>{Object.keys(F.implied).filter((C)=>!u(C)).forEach((C)=>{this.setOptionValueWithSource(C,F.implied[C],"implied")})})}missingArgument(D){let u=`error: missing required argument '${D}'`;this.error(u,{code:"commander.missingArgument"})}optionMissingArgument(D){let u=`error: option '${D.flags}' argument missing`;this.error(u,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(D){let u=`error: required option '${D.flags}' not specified`;this.error(u,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(D,u){let F=($)=>{let B=$.attributeName(),Q=this.getOptionValue(B),X=this.options.find((Y)=>Y.negate&&B===Y.attributeName()),Z=this.options.find((Y)=>!Y.negate&&B===Y.attributeName());if(X&&(X.presetArg===void 0&&Q===!1||X.presetArg!==void 0&&Q===X.presetArg))return X;return Z||$},C=($)=>{let B=F($),Q=B.attributeName();if(this.getOptionValueSource(Q)==="env")return`environment variable '${B.envVar}'`;return`option '${B.flags}'`},E=`error: ${C(D)} cannot be used with ${C(u)}`;this.error(E,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let u="";if(D.startsWith("--")&&this._showSuggestionAfterError){let C=[],E=this;do{let $=E.createHelp().visibleOptions(E).filter((B)=>B.long).map((B)=>B.long);C=C.concat($),E=E.parent}while(E&&!E._enablePositionalOptions);u=b3(D,C)}let F=`error: unknown option '${D}'${u}`;this.error(F,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let u=this.registeredArguments.length,F=u===1?"":"s",E=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${u} argument${F} but got ${D.length}.`;this.error(E,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],u="";if(this._showSuggestionAfterError){let C=[];this.createHelp().visibleCommands(this).forEach((E)=>{if(C.push(E.name()),E.alias())C.push(E.alias())}),u=b3(D,C)}let F=`error: unknown command '${D}'${u}`;this.error(F,{code:"commander.unknownCommand"})}version(D,u,F){if(D===void 0)return this._version;this._version=D,u=u||"-V, --version",F=F||"output the version number";let C=this.createOption(u,F);return this._versionOptionName=C.attributeName(),this._registerOption(C),this.on("option:"+C.name(),()=>{this._outputConfiguration.writeOut(`${D}
`),this._exit(0,"commander.version",D)}),this}description(D,u){if(D===void 0&&u===void 0)return this._description;if(this._description=D,u)this._argsDescription=u;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 u=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)u=this.commands[this.commands.length-1];if(D===u._name)throw new Error("Command alias can't be the same as its name");let F=this.parent?._findCommand(D);if(F){let C=[F.name()].concat(F.aliases()).join("|");throw new Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${C}'`)}return u._aliases.push(D),this}aliases(D){if(D===void 0)return this._aliases;return D.forEach((u)=>this.alias(u)),this}usage(D){if(D===void 0){if(this._usage)return this._usage;let u=this.registeredArguments.map((F)=>{return NC(F)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?u:[]).join(" ")}return this._usage=D,this}name(D){if(D===void 0)return this._name;return this._name=D,this}helpGroup(D){if(D===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=D,this}commandsGroup(D){if(D===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=D,this}optionsGroup(D){if(D===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=D,this}_initOptionGroup(D){if(this._defaultOptionGroup&&!D.helpGroupHeading)D.helpGroup(this._defaultOptionGroup)}_initCommandGroup(D){if(this._defaultCommandGroup&&!D.helpGroup())D.helpGroup(this._defaultCommandGroup)}nameFromFilename(D){return this._name=B0.basename(D,B0.extname(D)),this}executableDir(D){if(D===void 0)return this._executableDir;return this._executableDir=D,this}helpInformation(D){let u=this.createHelp(),F=this._getOutputContext(D);u.prepareContext({error:F.error,helpWidth:F.helpWidth,outputHasColors:F.hasColors});let C=u.formatHelp(this,u);if(F.hasColors)return C;return this._outputConfiguration.stripColor(C)}_getOutputContext(D){D=D||{};let u=!!D.error,F,C,E;if(u)F=(B)=>this._outputConfiguration.writeErr(B),C=this._outputConfiguration.getErrHasColors(),E=this._outputConfiguration.getErrHelpWidth();else F=(B)=>this._outputConfiguration.writeOut(B),C=this._outputConfiguration.getOutHasColors(),E=this._outputConfiguration.getOutHelpWidth();return{error:u,write:(B)=>{if(!C)B=this._outputConfiguration.stripColor(B);return F(B)},hasColors:C,helpWidth:E}}outputHelp(D){let u;if(typeof D==="function")u=D,D=void 0;let F=this._getOutputContext(D),C={error:F.error,write:F.write,command:this};this._getCommandAndAncestors().reverse().forEach(($)=>$.emit("beforeAllHelp",C)),this.emit("beforeHelp",C);let E=this.helpInformation({error:F.error});if(u){if(E=u(E),typeof E!=="string"&&!Buffer.isBuffer(E))throw new Error("outputHelp callback must return a string or a Buffer")}if(F.write(E),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",C),this._getCommandAndAncestors().forEach(($)=>$.emit("afterAllHelp",C))}helpOption(D,u){if(typeof D==="boolean"){if(D){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(D??"-h, --help",u??"display help for command"),D||u)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(D){return this._helpOption=D,this._initOptionGroup(D),this}help(D){this.outputHelp(D);let u=Number(h.exitCode??0);if(u===0&&D&&typeof D!=="function"&&D.error)u=1;this._exit(u,"commander.help","(outputHelp)")}addHelpText(D,u){let F=["beforeAll","before","after","afterAll"];if(!F.includes(D))throw new Error(`Unexpected value for position to addHelpText.
Expecting one of '${F.join("', '")}'`);let C=`${D}Help`;return this.on(C,(E)=>{let $;if(typeof u==="function")$=u({error:E.error,command:E.command});else $=u;if($)E.write(`${$}
`)}),this}_outputHelpIfRequested(D){let u=this._getHelpOption();if(u&&D.find((C)=>u.is(C)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function v3(D){return D.map((u)=>{if(!u.startsWith("--inspect"))return u;let F,C="127.0.0.1",E="9229",$;if(($=u.match(/^(--inspect(-brk)?)$/))!==null)F=$[1];else if(($=u.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(F=$[1],/^\d+$/.test($[3]))E=$[3];else C=$[3];else if(($=u.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)F=$[1],C=$[3],E=$[4];if(F&&E!=="0")return`${F}=${C}:${parseInt(E)+1}`;return u})}function vF(){if(h.env.NO_COLOR||h.env.FORCE_COLOR==="0"||h.env.FORCE_COLOR==="false")return!1;if(h.env.FORCE_COLOR||h.env.CLICOLOR_FORCE!==void 0)return!0;return}SC.Command=yF;SC.useColor=vF});var m3=y((fC)=>{var{Argument:f3}=Iu(),{Command:fF}=y3(),{CommanderError:vC,InvalidArgumentError:h3}=c0(),{Help:yC}=PF(),{Option:g3}=SF();fC.program=new fF;fC.createCommand=(D)=>new fF(D);fC.createOption=(D,u)=>new g3(D,u);fC.createArgument=(D,u)=>new f3(D,u);fC.Command=fF;fC.Option=g3;fC.Argument=f3;fC.Help=yC;fC.CommanderError=vC;fC.InvalidArgumentError=h3;fC.InvalidOptionArgumentError=h3});var gF=y((EQ,t3)=>{var hF={to(D,u){if(!u)return`\x1B[${D+1}G`;return`\x1B[${u+1};${D+1}H`},move(D,u){let F="";if(D<0)F+=`\x1B[${-D}D`;else if(D>0)F+=`\x1B[${D}C`;if(u<0)F+=`\x1B[${-u}A`;else if(u>0)F+=`\x1B[${u}B`;return F},up:(D=1)=>`\x1B[${D}A`,down:(D=1)=>`\x1B[${D}B`,forward:(D=1)=>`\x1B[${D}C`,backward:(D=1)=>`\x1B[${D}D`,nextLine:(D=1)=>"\x1B[E".repeat(D),prevLine:(D=1)=>"\x1B[F".repeat(D),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},u9={up:(D=1)=>"\x1B[S".repeat(D),down:(D=1)=>"\x1B[T".repeat(D)},F9={screen:"\x1B[2J",up:(D=1)=>"\x1B[1J".repeat(D),down:(D=1)=>"\x1B[J".repeat(D),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(D){let u="";for(let F=0;F<D;F++)u+=this.line+(F<D-1?hF.up():"");if(D)u+=hF.left;return u}};t3.exports={cursor:hF,scroll:u9,erase:F9,beep:"\x07"}});var cF=y((BQ,mF)=>{var Tu=process||{},e3=Tu.argv||[],Ou=Tu.env||{},C9=!(!!Ou.NO_COLOR||e3.includes("--no-color"))&&(!!Ou.FORCE_COLOR||e3.includes("--color")||Tu.platform==="win32"||(Tu.stdout||{}).isTTY&&Ou.TERM!=="dumb"||!!Ou.CI),E9=(D,u,F=D)=>(C)=>{let E=""+C,$=E.indexOf(u,D.length);return~$?D+B9(E,u,F,$)+u:D+E+u},B9=(D,u,F,C)=>{let E="",$=0;do E+=D.substring($,C)+F,$=C+u.length,C=D.indexOf(u,$);while(~C);return E+D.substring($)},D8=(D=C9)=>{let u=D?E9:()=>String;return{isColorSupported:D,reset:u("\x1B[0m","\x1B[0m"),bold:u("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:u("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:u("\x1B[3m","\x1B[23m"),underline:u("\x1B[4m","\x1B[24m"),inverse:u("\x1B[7m","\x1B[27m"),hidden:u("\x1B[8m","\x1B[28m"),strikethrough:u("\x1B[9m","\x1B[29m"),black:u("\x1B[30m","\x1B[39m"),red:u("\x1B[31m","\x1B[39m"),green:u("\x1B[32m","\x1B[39m"),yellow:u("\x1B[33m","\x1B[39m"),blue:u("\x1B[34m","\x1B[39m"),magenta:u("\x1B[35m","\x1B[39m"),cyan:u("\x1B[36m","\x1B[39m"),white:u("\x1B[37m","\x1B[39m"),gray:u("\x1B[90m","\x1B[39m"),bgBlack:u("\x1B[40m","\x1B[49m"),bgRed:u("\x1B[41m","\x1B[49m"),bgGreen:u("\x1B[42m","\x1B[49m"),bgYellow:u("\x1B[43m","\x1B[49m"),bgBlue:u("\x1B[44m","\x1B[49m"),bgMagenta:u("\x1B[45m","\x1B[49m"),bgCyan:u("\x1B[46m","\x1B[49m"),bgWhite:u("\x1B[47m","\x1B[49m"),blackBright:u("\x1B[90m","\x1B[39m"),redBright:u("\x1B[91m","\x1B[39m"),greenBright:u("\x1B[92m","\x1B[39m"),yellowBright:u("\x1B[93m","\x1B[39m"),blueBright:u("\x1B[94m","\x1B[39m"),magentaBright:u("\x1B[95m","\x1B[39m"),cyanBright:u("\x1B[96m","\x1B[39m"),whiteBright:u("\x1B[97m","\x1B[39m"),bgBlackBright:u("\x1B[100m","\x1B[49m"),bgRedBright:u("\x1B[101m","\x1B[49m"),bgGreenBright:u("\x1B[102m","\x1B[49m"),bgYellowBright:u("\x1B[103m","\x1B[49m"),bgBlueBright:u("\x1B[104m","\x1B[49m"),bgMagentaBright:u("\x1B[105m","\x1B[49m"),bgCyanBright:u("\x1B[106m","\x1B[49m"),bgWhiteBright:u("\x1B[107m","\x1B[49m")}};mF.exports=D8();mF.exports.createColors=D8});var S8=y((Q2,X2)=>{(function(D,u){typeof Q2==="object"&&typeof X2!=="undefined"?X2.exports=u():typeof define==="function"&&define.amd?define(u):(D=typeof globalThis!=="undefined"?globalThis:D||self,D.tinycolor=u())})(Q2,function(){function D(K){return D=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(V){return typeof V}:function(V){return V&&typeof Symbol=="function"&&V.constructor===Symbol&&V!==Symbol.prototype?"symbol":typeof V},D(K)}var u=/^\s+/,F=/\s+$/;function C(K,V){if(K=K?K:"",V=V||{},K instanceof C)return K;if(!(this instanceof C))return new C(K,V);var q=E(K);if(this._originalInput=K,this._r=q.r,this._g=q.g,this._b=q.b,this._a=q.a,this._roundA=Math.round(100*this._a)/100,this._format=V.format||q.format,this._gradientType=V.gradientType,this._r<1)this._r=Math.round(this._r);if(this._g<1)this._g=Math.round(this._g);if(this._b<1)this._b=Math.round(this._b);this._ok=q.ok}C.prototype={isDark:function K(){return this.getBrightness()<128},isLight:function K(){return!this.isDark()},isValid:function K(){return this._ok},getOriginalInput:function K(){return this._originalInput},getFormat:function K(){return this._format},getAlpha:function K(){return this._a},getBrightness:function K(){var V=this.toRgb();return(V.r*299+V.g*587+V.b*114)/1000},getLuminance:function K(){var V=this.toRgb(),q,_,j,L,f,g;if(q=V.r/255,_=V.g/255,j=V.b/255,q<=0.03928)L=q/12.92;else L=Math.pow((q+0.055)/1.055,2.4);if(_<=0.03928)f=_/12.92;else f=Math.pow((_+0.055)/1.055,2.4);if(j<=0.03928)g=j/12.92;else g=Math.pow((j+0.055)/1.055,2.4);return 0.2126*L+0.7152*f+0.0722*g},setAlpha:function K(V){return this._a=v(V),this._roundA=Math.round(100*this._a)/100,this},toHsv:function K(){var V=X(this._r,this._g,this._b);return{h:V.h*360,s:V.s,v:V.v,a:this._a}},toHsvString:function K(){var V=X(this._r,this._g,this._b),q=Math.round(V.h*360),_=Math.round(V.s*100),j=Math.round(V.v*100);return this._a==1?"hsv("+q+", "+_+"%, "+j+"%)":"hsva("+q+", "+_+"%, "+j+"%, "+this._roundA+")"},toHsl:function K(){var V=B(this._r,this._g,this._b);return{h:V.h*360,s:V.s,l:V.l,a:this._a}},toHslString:function K(){var V=B(this._r,this._g,this._b),q=Math.round(V.h*360),_=Math.round(V.s*100),j=Math.round(V.l*100);return this._a==1?"hsl("+q+", "+_+"%, "+j+"%)":"hsla("+q+", "+_+"%, "+j+"%, "+this._roundA+")"},toHex:function K(V){return Y(this._r,this._g,this._b,V)},toHexString:function K(V){return"#"+this.toHex(V)},toHex8:function K(V){return J(this._r,this._g,this._b,this._a,V)},toHex8String:function K(V){return"#"+this.toHex8(V)},toRgb:function K(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function K(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function K(){return{r:Math.round(w(this._r,255)*100)+"%",g:Math.round(w(this._g,255)*100)+"%",b:Math.round(w(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function K(){return this._a==1?"rgb("+Math.round(w(this._r,255)*100)+"%, "+Math.round(w(this._g,255)*100)+"%, "+Math.round(w(this._b,255)*100)+"%)":"rgba("+Math.round(w(this._r,255)*100)+"%, "+Math.round(w(this._g,255)*100)+"%, "+Math.round(w(this._b,255)*100)+"%, "+this._roundA+")"},toName:function K(){if(this._a===0)return"transparent";if(this._a<1)return!1;return N[Y(this._r,this._g,this._b,!0)]||!1},toFilter:function K(V){var q="#"+H(this._r,this._g,this._b,this._a),_=q,j=this._gradientType?"GradientType = 1, ":"";if(V){var L=C(V);_="#"+H(L._r,L._g,L._b,L._a)}return"progid:DXImageTransform.Microsoft.gradient("+j+"startColorstr="+q+",endColorstr="+_+")"},toString:function K(V){var q=!!V;V=V||this._format;var _=!1,j=this._a<1&&this._a>=0,L=!q&&j&&(V==="hex"||V==="hex6"||V==="hex3"||V==="hex4"||V==="hex8"||V==="name");if(L){if(V==="name"&&this._a===0)return this.toName();return this.toRgbString()}if(V==="rgb")_=this.toRgbString();if(V==="prgb")_=this.toPercentageRgbString();if(V==="hex"||V==="hex6")_=this.toHexString();if(V==="hex3")_=this.toHexString(!0);if(V==="hex4")_=this.toHex8String(!0);if(V==="hex8")_=this.toHex8String();if(V==="name")_=this.toName();if(V==="hsl")_=this.toHslString();if(V==="hsv")_=this.toHsvString();return _||this.toHexString()},clone:function K(){return C(this.toString())},_applyModification:function K(V,q){var _=V.apply(null,[this].concat([].slice.call(q)));return this._r=_._r,this._g=_._g,this._b=_._b,this.setAlpha(_._a),this},lighten:function K(){return this._applyModification(W,arguments)},brighten:function K(){return this._applyModification(I,arguments)},darken:function K(){return this._applyModification(T,arguments)},desaturate:function K(){return this._applyModification(A,arguments)},saturate:function K(){return this._applyModification(z,arguments)},greyscale:function K(){return this._applyModification(U,arguments)},spin:function K(){return this._applyModification(R,arguments)},_applyCombination:function K(V,q){return V.apply(null,[this].concat([].slice.call(q)))},analogous:function K(){return this._applyCombination(HD,arguments)},complement:function K(){return this._applyCombination(M,arguments)},monochromatic:function K(){return this._applyCombination(kD,arguments)},splitcomplement:function K(){return this._applyCombination(x,arguments)},triad:function K(){return this._applyCombination(k,[3])},tetrad:function K(){return this._applyCombination(k,[4])}},C.fromRatio=function(K,V){if(D(K)=="object"){var q={};for(var _ in K)if(K.hasOwnProperty(_))if(_==="a")q[_]=K[_];else q[_]=ZD(K[_]);K=q}return C(K,V)};function E(K){var V={r:0,g:0,b:0},q=1,_=null,j=null,L=null,f=!1,g=!1;if(typeof K=="string")K=g0(K);if(D(K)=="object"){if(YD(K.r)&&YD(K.g)&&YD(K.b))V=$(K.r,K.g,K.b),f=!0,g=String(K.r).substr(-1)==="%"?"prgb":"rgb";else if(YD(K.h)&&YD(K.s)&&YD(K.v))_=ZD(K.s),j=ZD(K.v),V=Z(K.h,_,j),f=!0,g="hsv";else if(YD(K.h)&&YD(K.s)&&YD(K.l))_=ZD(K.s),L=ZD(K.l),V=Q(K.h,_,L),f=!0,g="hsl";if(K.hasOwnProperty("a"))q=K.a}return q=v(q),{ok:f,format:K.format||g,r:Math.min(255,Math.max(V.r,0)),g:Math.min(255,Math.max(V.g,0)),b:Math.min(255,Math.max(V.b,0)),a:q}}function $(K,V,q){return{r:w(K,255)*255,g:w(V,255)*255,b:w(q,255)*255}}function B(K,V,q){K=w(K,255),V=w(V,255),q=w(q,255);var _=Math.max(K,V,q),j=Math.min(K,V,q),L,f,g=(_+j)/2;if(_==j)L=f=0;else{var s=_-j;switch(f=g>0.5?s/(2-_-j):s/(_+j),_){case K:L=(V-q)/s+(V<q?6:0);break;case V:L=(q-K)/s+2;break;case q:L=(K-V)/s+4;break}L/=6}return{h:L,s:f,l:g}}function Q(K,V,q){var _,j,L;K=w(K,360),V=w(V,100),q=w(q,100);function f(PD,m0,dD){if(dD<0)dD+=1;if(dD>1)dD-=1;if(dD<0.16666666666666666)return PD+(m0-PD)*6*dD;if(dD<0.5)return m0;if(dD<0.6666666666666666)return PD+(m0-PD)*(0.6666666666666666-dD)*6;return PD}if(V===0)_=j=L=q;else{var g=q<0.5?q*(1+V):q+V-q*V,s=2*q-g;_=f(s,g,K+0.3333333333333333),j=f(s,g,K),L=f(s,g,K-0.3333333333333333)}return{r:_*255,g:j*255,b:L*255}}function X(K,V,q){K=w(K,255),V=w(V,255),q=w(q,255);var _=Math.max(K,V,q),j=Math.min(K,V,q),L,f,g=_,s=_-j;if(f=_===0?0:s/_,_==j)L=0;else{switch(_){case K:L=(V-q)/s+(V<q?6:0);break;case V:L=(q-K)/s+2;break;case q:L=(K-V)/s+4;break}L/=6}return{h:L,s:f,v:g}}function Z(K,V,q){K=w(K,360)*6,V=w(V,100),q=w(q,100);var _=Math.floor(K),j=K-_,L=q*(1-V),f=q*(1-j*V),g=q*(1-(1-j)*V),s=_%6,PD=[q,f,L,L,g,q][s],m0=[g,q,q,f,L,L][s],dD=[L,L,g,q,q,f][s];return{r:PD*255,g:m0*255,b:dD*255}}function Y(K,V,q,_){var j=[o(Math.round(K).toString(16)),o(Math.round(V).toString(16)),o(Math.round(q).toString(16))];if(_&&j[0].charAt(0)==j[0].charAt(1)&&j[1].charAt(0)==j[1].charAt(1)&&j[2].charAt(0)==j[2].charAt(1))return j[0].charAt(0)+j[1].charAt(0)+j[2].charAt(0);return j.join("")}function J(K,V,q,_,j){var L=[o(Math.round(K).toString(16)),o(Math.round(V).toString(16)),o(Math.round(q).toString(16)),o(cD(_))];if(j&&L[0].charAt(0)==L[0].charAt(1)&&L[1].charAt(0)==L[1].charAt(1)&&L[2].charAt(0)==L[2].charAt(1)&&L[3].charAt(0)==L[3].charAt(1))return L[0].charAt(0)+L[1].charAt(0)+L[2].charAt(0)+L[3].charAt(0);return L.join("")}function H(K,V,q,_){var j=[o(cD(_)),o(Math.round(K).toString(16)),o(Math.round(V).toString(16)),o(Math.round(q).toString(16))];return j.join("")}C.equals=function(K,V){if(!K||!V)return!1;return C(K).toRgbString()==C(V).toRgbString()},C.random=function(){return C.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function A(K,V){V=V===0?0:V||10;var q=C(K).toHsl();return q.s-=V/100,q.s=m(q.s),C(q)}function z(K,V){V=V===0?0:V||10;var q=C(K).toHsl();return q.s+=V/100,q.s=m(q.s),C(q)}function U(K){return C(K).desaturate(100)}function W(K,V){V=V===0?0:V||10;var q=C(K).toHsl();return q.l+=V/100,q.l=m(q.l),C(q)}function I(K,V){V=V===0?0:V||10;var q=C(K).toRgb();return q.r=Math.max(0,Math.min(255,q.r-Math.round(255*-(V/100)))),q.g=Math.max(0,Math.min(255,q.g-Math.round(255*-(V/100)))),q.b=Math.max(0,Math.min(255,q.b-Math.round(255*-(V/100)))),C(q)}function T(K,V){V=V===0?0:V||10;var q=C(K).toHsl();return q.l-=V/100,q.l=m(q.l),C(q)}function R(K,V){var q=C(K).toHsl(),_=(q.h+V)%360;return q.h=_<0?360+_:_,C(q)}function M(K){var V=C(K).toHsl();return V.h=(V.h+180)%360,C(V)}function k(K,V){if(isNaN(V)||V<=0)throw new Error("Argument to polyad must be a positive number");var q=C(K).toHsl(),_=[C(K)],j=360/V;for(var L=1;L<V;L++)_.push(C({h:(q.h+L*j)%360,s:q.s,l:q.l}));return _}function x(K){var V=C(K).toHsl(),q=V.h;return[C(K),C({h:(q+72)%360,s:V.s,l:V.l}),C({h:(q+216)%360,s:V.s,l:V.l})]}function HD(K,V,q){V=V||6,q=q||30;var _=C(K).toHsl(),j=360/q,L=[C(K)];for(_.h=(_.h-(j*V>>1)+720)%360;--V;)_.h=(_.h+j)%360,L.push(C(_));return L}function kD(K,V){V=V||6;var q=C(K).toHsv(),_=q.h,j=q.s,L=q.v,f=[],g=1/V;while(V--)f.push(C({h:_,s:j,v:L})),L=(L+g)%1;return f}C.mix=function(K,V,q){q=q===0?0:q||50;var _=C(K).toRgb(),j=C(V).toRgb(),L=q/100,f={r:(j.r-_.r)*L+_.r,g:(j.g-_.g)*L+_.g,b:(j.b-_.b)*L+_.b,a:(j.a-_.a)*L+_.a};return C(f)},C.readability=function(K,V){var q=C(K),_=C(V);return(Math.max(q.getLuminance(),_.getLuminance())+0.05)/(Math.min(q.getLuminance(),_.getLuminance())+0.05)},C.isReadable=function(K,V,q){var _=C.readability(K,V),j,L;switch(L=!1,j=NF(q),j.level+j.size){case"AAsmall":case"AAAlarge":L=_>=4.5;break;case"AAlarge":L=_>=3;break;case"AAAsmall":L=_>=7;break}return L},C.mostReadable=function(K,V,q){var _=null,j=0,L,f,g,s;q=q||{},f=q.includeFallbackColors,g=q.level,s=q.size;for(var PD=0;PD<V.length;PD++)if(L=C.readability(K,V[PD]),L>j)j=L,_=C(V[PD]);if(C.isReadable(K,_,{level:g,size:s})||!f)return _;else return q.includeFallbackColors=!1,C.mostReadable(K,["#fff","#000"],q)};var G=C.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},N=C.hexNames=b(G);function b(K){var V={};for(var q in K)if(K.hasOwnProperty(q))V[K[q]]=q;return V}function v(K){if(K=parseFloat(K),isNaN(K)||K<0||K>1)K=1;return K}function w(K,V){if(mD(K))K="100%";var q=X0(K);if(K=Math.min(V,Math.max(0,parseFloat(K))),q)K=parseInt(K*V,10)/100;if(Math.abs(K-V)<0.000001)return 1;return K%V/parseFloat(V)}function m(K){return Math.min(1,Math.max(0,K))}function c(K){return parseInt(K,16)}function mD(K){return typeof K=="string"&&K.indexOf(".")!=-1&&parseFloat(K)===1}function X0(K){return typeof K==="string"&&K.indexOf("%")!=-1}function o(K){return K.length==1?"0"+K:""+K}function ZD(K){if(K<=1)K=K*100+"%";return K}function cD(K){return Math.round(parseFloat(K)*255).toString(16)}function C0(K){return c(K)/255}var $D=function(){var K="[-\\+]?\\d+%?",V="[-\\+]?\\d*\\.\\d+%?",q="(?:"+V+")|(?:"+K+")",_="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?",j="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?";return{CSS_UNIT:new RegExp(q),rgb:new RegExp("rgb"+_),rgba:new RegExp("rgba"+j),hsl:new RegExp("hsl"+_),hsla:new RegExp("hsla"+j),hsv:new RegExp("hsv"+_),hsva:new RegExp("hsva"+j),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function YD(K){return!!$D.CSS_UNIT.exec(K)}function g0(K){K=K.replace(u,"").replace(F,"").toLowerCase();var V=!1;if(G[K])K=G[K],V=!0;else if(K=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var q;if(q=$D.rgb.exec(K))return{r:q[1],g:q[2],b:q[3]};if(q=$D.rgba.exec(K))return{r:q[1],g:q[2],b:q[3],a:q[4]};if(q=$D.hsl.exec(K))return{h:q[1],s:q[2],l:q[3]};if(q=$D.hsla.exec(K))return{h:q[1],s:q[2],l:q[3],a:q[4]};if(q=$D.hsv.exec(K))return{h:q[1],s:q[2],v:q[3]};if(q=$D.hsva.exec(K))return{h:q[1],s:q[2],v:q[3],a:q[4]};if(q=$D.hex8.exec(K))return{r:c(q[1]),g:c(q[2]),b:c(q[3]),a:C0(q[4]),format:V?"name":"hex8"};if(q=$D.hex6.exec(K))return{r:c(q[1]),g:c(q[2]),b:c(q[3]),format:V?"name":"hex"};if(q=$D.hex4.exec(K))return{r:c(q[1]+""+q[1]),g:c(q[2]+""+q[2]),b:c(q[3]+""+q[3]),a:C0(q[4]+""+q[4]),format:V?"name":"hex8"};if(q=$D.hex3.exec(K))return{r:c(q[1]+""+q[1]),g:c(q[2]+""+q[2]),b:c(q[3]+""+q[3]),format:V?"name":"hex"};return!1}function NF(K){var V,q;if(K=K||{level:"AA",size:"small"},V=(K.level||"AA").toUpperCase(),q=(K.size||"small").toLowerCase(),V!=="AA"&&V!=="AAA")V="AA";if(q!=="small"&&q!=="large")q="small";return{level:V,size:q}}return C})});var g8=y((mQ,h8)=>{var a0=S8(),y8={r:256,g:256,b:256,a:1},f8={h:360,s:1,v:1,a:1};function Y2(D,u,F){let C={};for(let E in D)if(D.hasOwnProperty(E))C[E]=F===0?0:(u[E]-D[E])/F;return C}function J2(D,u,F,C){let E={};for(let $ in u)if(u.hasOwnProperty($))E[$]=D[$]*F+u[$],E[$]=E[$]<0?E[$]+C[$]:C[$]!==1?E[$]%C[$]:E[$];return E}function Z2(D,u,F){let C=D.color.toRgb(),E=u.color.toRgb(),$=Y2(C,E,F),B=[D.color];for(let Q=1;Q<F;Q++){let X=J2($,C,Q,y8);B.push(a0(X))}return B}function x8(D,u,F,C){let E=D.color.toHsv(),$=u.color.toHsv();if(E.s===0||$.s===0)return Z2(D,u,F);let B;if(typeof C==="boolean")B=C;else{let Y=E.h<$.h&&$.h-E.h<180||E.h>$.h&&E.h-$.h>180;B=C==="long"&&Y||C==="short"&&!Y}let Q=Y2(E,$,F),X=[D.color],Z;if(E.h<=$.h&&!B||E.h>=$.h&&B)Z=$.h-E.h;else if(B)Z=360-$.h+E.h;else Z=360-E.h+$.h;Q.h=Math.pow(-1,B?1:0)*Math.abs(Z)/F;for(let Y=1;Y<F;Y++){let J=J2(Q,E,Y,f8);X.push(a0(J))}return X}function b8(D,u){let F=D.length;if(u=parseInt(u,10),isNaN(u)||u<2)throw new Error("Invalid number of steps (< 2)");if(u<F)throw new Error("Number of steps cannot be inferior to number of stops");let C=[];for(let $=1;$<F;$++){let B=(u-1)*(D[$].pos-D[$-1].pos);C.push(Math.max(1,Math.round(B)))}let E=1;for(let $=F-1;$--;)E+=C[$];while(E!==u)if(E<u){let $=Math.min.apply(null,C);C[C.indexOf($)]++,E++}else{let $=Math.max.apply(null,C);C[C.indexOf($)]--,E--}return C}function v8(D,u,F,C){if(u<0||u>1)throw new Error("Position must be between 0 and 1");let E,$;for(let X=0,Z=D.length;X<Z-1;X++)if(u>=D[X].pos&&u<D[X+1].pos){E=D[X],$=D[X+1];break}if(!E)E=$=D[D.length-1];let B=Y2(E.color[F](),$.color[F](),($.pos-E.pos)*100),Q=J2(B,E.color[F](),(u-E.pos)*100,C);return a0(Q)}class fu{constructor(D){if(D.length<2)throw new Error("Invalid number of stops (< 2)");let u=D[0].pos!==void 0,F=D.length,C=-1,E=!1;if(this.stops=D.map(($,B)=>{let Q=$.pos!==void 0;if(u^Q)throw new Error("Cannot mix positionned and not posionned color stops");if(Q){let X=$.color!==void 0;if(!X&&(E||B===0||B===F-1))throw new Error("Cannot define two consecutive position-only stops");if(E=!X,$={color:X?a0($.color):null,colorLess:!X,pos:$.pos},$.pos<0||$.pos>1)throw new Error("Color stops positions must be between 0 and 1");else if($.pos<C)throw new Error("Color stops positions are not ordered");C=$.pos}else $={color:a0($.color!==void 0?$.color:$),pos:B/(F-1)};return $}),this.stops[0].pos!==0)this.stops.unshift({color:this.stops[0].color,pos:0}),F++;if(this.stops[F-1].pos!==1)this.stops.push({color:this.stops[F-1].color,pos:1})}reverse(){let D=[];return this.stops.forEach(function(u){D.push({color:u.color,pos:1-u.pos})}),new fu(D.reverse())}loop(){let D=[],u=[];return this.stops.forEach((F)=>{D.push({color:F.color,pos:F.pos/2})}),this.stops.slice(0,-1).forEach((F)=>{u.push({color:F.color,pos:1-F.pos/2})}),new fu(D.concat(u.reverse()))}rgb(D){let u=b8(this.stops,D),F=[];this.stops.forEach((C,E)=>{if(C.colorLess)C.color=Z2(this.stops[E-1],this.stops[E+1],2)[1]});for(let C=0,E=this.stops.length;C<E-1;C++){let $=Z2(this.stops[C],this.stops[C+1],u[C]);F.splice(F.length,0,...$)}return F.push(this.stops[this.stops.length-1].color),F}hsv(D,u){let F=b8(this.stops,D),C=[];this.stops.forEach((E,$)=>{if(E.colorLess)E.color=x8(this.stops[$-1],this.stops[$+1],2,u)[1]});for(let E=0,$=this.stops.length;E<$-1;E++){let B=x8(this.stops[E],this.stops[E+1],F[E],u);C.splice(C.length,0,...B)}return C.push(this.stops[this.stops.length-1].color),C}css(D,u){D=D||"linear",u=u||(D==="linear"?"to right":"ellipse at center");let F=D+"-gradient("+u;return this.stops.forEach(function(C){F+=", "+(C.colorLess?"":C.color.toRgbString()+" ")+C.pos*100+"%"}),F+=")",F}rgbAt(D){return v8(this.stops,D,"toRgb",y8)}hsvAt(D){return v8(this.stops,D,"toHsv",f8)}}h8.exports=function(D){if(arguments.length===1){if(!Array.isArray(arguments[0]))throw new Error('"stops" is not an array');D=arguments[0]}else D=Array.prototype.slice.call(arguments);return new fu(D)}});var a8=y((sQ,n8)=>{n8.exports=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g}});var i8=y((CX,zE)=>{zE.exports={single:{topLeft:"┌",top:"─",topRight:"┐",right:"│",bottomRight:"┘",bottom:"─",bottomLeft:"└",left:"│"},double:{topLeft:"╔",top:"═",topRight:"╗",right:"║",bottomRight:"╝",bottom:"═",bottomLeft:"╚",left:"║"},round:{topLeft:"╭",top:"─",topRight:"╮",right:"│",bottomRight:"╯",bottom:"─",bottomLeft:"╰",left:"│"},bold:{topLeft:"┏",top:"━",topRight:"┓",right:"┃",bottomRight:"┛",bottom:"━",bottomLeft:"┗",left:"┃"},singleDouble:{topLeft:"╓",top:"─",topRight:"╖",right:"║",bottomRight:"╜",bottom:"─",bottomLeft:"╙",left:"║"},doubleSingle:{topLeft:"╒",top:"═",topRight:"╕",right:"│",bottomRight:"╛",bottom:"═",bottomLeft:"╘",left:"│"},classic:{topLeft:"+",top:"-",topRight:"+",right:"|",bottomRight:"+",bottom:"-",bottomLeft:"+",left:"|"},arrow:{topLeft:"↘",top:"↓",topRight:"↙",right:"←",bottomRight:"↖",bottom:"↑",bottomLeft:"↗",left:"→"}}});var z2=y((EX,A2)=>{var o8=i8();A2.exports=o8;A2.exports.default=o8});var F6=y(($X,u6)=>{u6.exports=({onlyFirst:D=!1}={})=>{let u=["[\\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(u,D?void 0:"g")}});var E6=y((QX,C6)=>{var ME=F6();C6.exports=(D)=>typeof D==="string"?D.replace(ME(),""):D});var $6=y((XX,W2)=>{var B6=(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};W2.exports=B6;W2.exports.default=B6});var X6=y((ZX,Q6)=>{Q6.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 Y6=y((YX,G2)=>{var IE=E6(),jE=$6(),OE=X6(),Z6=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=IE(D),D.length===0)return 0;D=D.replace(OE()," ");let u=0;for(let F=0;F<D.length;F++){let C=D.codePointAt(F);if(C<=31||C>=127&&C<=159)continue;if(C>=768&&C<=879)continue;if(C>65535)F++;u+=jE(C)?2:1}return u};G2.exports=Z6;G2.exports.default=Z6});var K6=y((JX,J6)=>{var TE=Y6();function U0(D,u){if(!D)return D;u=u||{};let F=u.align||"center";if(F==="left")return D;let C=u.split||`
`,E=u.pad||" ",$=F!=="right"?NE:wE,B=!1;if(!Array.isArray(D))B=!0,D=String(D).split(C);let Q,X=0;return D=D.map(function(Z){return Z=String(Z),Q=TE(Z),X=Math.max(Q,X),{str:Z,width:Q}}).map(function(Z){return new Array($(X,Z.width)+1).join(E)+Z.str}),B?D.join(C):D}U0.left=function D(u){return U0(u,{align:"left"})};U0.center=function D(u){return U0(u,{align:"center"})};U0.right=function D(u){return U0(u,{align:"right"})};J6.exports=U0;function NE(D,u){return Math.floor((D-u)/2)}function wE(D,u){return D-u}});import{join as e,dirname as pu,sep as iE}from"path";import{homedir as j2}from"os";import{existsSync as s0,statSync as oE}from"fs";import{execSync as j6}from"child_process";import{fileURLToPath as sE}from"url";class P{static instance=null;_dataDirectory=null;_packageRoot=null;_claudeConfigDirectory=null;static getInstance(){if(!P.instance)P.instance=new P;return P.instance}getDataDirectory(){if(this._dataDirectory)return this._dataDirectory;return this._dataDirectory=process.env.CLAUDE_MEM_DATA_DIR||e(j2(),".claude-mem"),this._dataDirectory}getArchivesDirectory(){return e(this.getDataDirectory(),"archives")}getHooksDirectory(){return e(this.getDataDirectory(),"hooks")}getLogsDirectory(){return e(this.getDataDirectory(),"logs")}getIndexDirectory(){return this.getDataDirectory()}getIndexPath(){return e(this.getIndexDirectory(),"claude-mem-index.jsonl")}getTrashDirectory(){return e(this.getDataDirectory(),"trash")}getBackupsDirectory(){return e(this.getDataDirectory(),"backups")}getChromaDirectory(){return e(this.getDataDirectory(),"chroma")}getProjectArchiveDirectory(D){return e(this.getArchivesDirectory(),D)}getUserSettingsPath(){return e(this.getDataDirectory(),"settings.json")}getClaudeConfigDirectory(){if(this._claudeConfigDirectory)return this._claudeConfigDirectory;return this._claudeConfigDirectory=process.env.CLAUDE_CONFIG_DIR||e(j2(),".claude"),this._claudeConfigDirectory}getClaudeSettingsPath(){return e(this.getClaudeConfigDirectory(),"settings.json")}getClaudeCommandsDirectory(){return e(this.getClaudeConfigDirectory(),"commands")}getClaudeMdPath(){return e(this.getClaudeConfigDirectory(),"CLAUDE.md")}getMcpConfigPath(){return e(j2(),".claude.json")}getProjectMcpConfigPath(){return e(process.cwd(),".mcp.json")}getPackageRoot(){if(this._packageRoot)return this._packageRoot;try{let F=a.resolve("claude-mem/package.json");return this._packageRoot=pu(F),this._packageRoot}catch{}let D=sE(import.meta.url),u=pu(D);for(let F=0;F<10;F++){let C=e(u,"package.json");if(s0(C)){if(a(C).name==="claude-mem")return this._packageRoot=u,this._packageRoot}let E=pu(u);if(E===u)break;u=E}try{let F=j6("npm list -g claude-mem --json 2>/dev/null || npm list claude-mem --json 2>/dev/null",{encoding:"utf8"}),C=JSON.parse(F);if(C.dependencies?.["claude-mem"]?.resolved)return this._packageRoot=pu(C.dependencies["claude-mem"].resolved),this._packageRoot}catch{}throw new Error("Cannot locate claude-mem package root. Ensure claude-mem is properly installed.")}findPackageHookTemplatesDirectory(){let D=this.getPackageRoot(),u=e(D,"hook-templates"),F=["session-start.js","stop.js","user-prompt-submit.js","post-tool-use.js"];for(let C of F)if(!s0(e(u,C)))throw new Error(`Package hook-templates directory missing required template file: ${C}`);return u}findPackageCommandsDirectory(){let D=this.getPackageRoot(),u=e(D,"commands"),F=["save.md"];for(let C of F)if(!s0(e(u,C)))throw new Error(`Package commands directory missing required file: ${C}`);return u}ensureDirectory(D){if(!s0(D))a("fs").mkdirSync(D,{recursive:!0})}ensureDirectories(D){D.forEach((u)=>this.ensureDirectory(u))}ensureAllDataDirectories(){this.ensureDirectories([this.getDataDirectory(),this.getArchivesDirectory(),this.getHooksDirectory(),this.getLogsDirectory(),this.getTrashDirectory(),this.getBackupsDirectory(),this.getChromaDirectory()])}ensureAllClaudeDirectories(){this.ensureDirectories([this.getClaudeConfigDirectory(),this.getClaudeCommandsDirectory()])}static extractProjectName(D){let u=D.split(iE),F=["src","lib","app","project","workspace"];for(let C=u.length-1;C>=0;C--)if(F.includes(u[C])&&C>0)return u[C-1];if(u.length>1)return u[u.length-2];return"unknown-project"}static getCurrentProjectName(){try{let D=j6("git rev-parse --show-toplevel",{cwd:process.cwd(),encoding:"utf8",stdio:["pipe","pipe","ignore"]}).trim();return a("path").basename(D)}catch{return a("path").basename(process.cwd())}}static createBackupFilename(D){let u=new Date().toISOString().replace(/[:.]/g,"-").replace("T","_").slice(0,19);return`${D}.backup.${u}`}static isPathAccessible(D){return s0(D)&&oE(D).isDirectory()}}var UD=()=>{};var eD=y((_B)=>{_B.getBooleanOption=(D,u)=>{let F=!1;if(u in D&&typeof(F=D[u])!=="boolean")throw new TypeError(`Expected the "${u}" option to be a boolean`);return F};_B.cppdb=Symbol();_B.inspect=Symbol.for("nodejs.util.inspect.custom")});var S2=y((FZ,x6)=>{var P2={value:"SqliteError",writable:!0,enumerable:!1,configurable:!0};function W0(D,u){if(new.target!==W0)return new W0(D,u);if(typeof u!=="string")throw new TypeError("Expected second argument to be a string");Error.call(this,D),P2.value=""+D,Object.defineProperty(this,"message",P2),Error.captureStackTrace(this,W0),this.code=u}Object.setPrototypeOf(W0,Error);Object.setPrototypeOf(W0.prototype,Error.prototype);Object.defineProperty(W0.prototype,"name",P2);x6.exports=W0});var v6=y((CZ,b6)=>{var iu=a("path").sep||"/";b6.exports=RB;function RB(D){if(typeof D!="string"||D.length<=7||D.substring(0,7)!="file://")throw new TypeError("must pass in a file:// URI to convert to a file path");var u=decodeURI(D.substring(7)),F=u.indexOf("/"),C=u.substring(0,F),E=u.substring(F+1);if(C=="localhost")C="";if(C)C=iu+iu+C;if(E=E.replace(/^(.+)\|/,"$1:"),iu=="\\")E=E.replace(/\//g,"\\");if(/^.+\:/.test(E));else E=iu+E;return C+E}});var g6=y((tu,h6)=>{var __filename="/Users/alexnewman/Scripts/claude-mem/node_modules/bindings/bindings.js",x2=a("fs"),su=a("path"),MB=v6(),ou=su.join,IB=su.dirname,y6=x2.accessSync&&function(D){try{x2.accessSync(D)}catch(u){return!1}return!0}||x2.existsSync||su.existsSync,f6={arrow:process.env.NODE_BINDINGS_ARROW||" → ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};function jB(D){if(typeof D=="string")D={bindings:D};else if(!D)D={};if(Object.keys(f6).map(function(X){if(!(X in D))D[X]=f6[X]}),!D.module_root)D.module_root=tu.getRoot(tu.getFileName());if(su.extname(D.bindings)!=".node")D.bindings+=".node";var u=typeof __webpack_require__==="function"?__non_webpack_require__:a,F=[],C=0,E=D.try.length,$,B,Q;for(;C<E;C++){$=ou.apply(null,D.try[C].map(function(X){return D[X]||X})),F.push($);try{if(B=D.path?u.resolve($):u($),!D.path)B.path=$;return B}catch(X){if(X.code!=="MODULE_NOT_FOUND"&&X.code!=="QUALIFIED_PATH_RESOLUTION_FAILED"&&!/not find/i.test(X.message))throw X}}throw Q=new Error(`Could not locate the bindings file. Tried:
`+F.map(function(X){return D.arrow+X}).join(`
`)),Q.tries=F,Q}h6.exports=tu=jB;tu.getFileName=function D(u){var{prepareStackTrace:F,stackTraceLimit:C}=Error,E={},$;Error.stackTraceLimit=10,Error.prepareStackTrace=function(Q,X){for(var Z=0,Y=X.length;Z<Y;Z++)if($=X[Z].getFileName(),$!==__filename)if(u){if($!==u)return}else return},Error.captureStackTrace(E),E.stack,Error.prepareStackTrace=F,Error.stackTraceLimit=C;var B="file://";if($.indexOf(B)===0)$=MB($);return $};tu.getRoot=function D(u){var F=IB(u),C;while(!0){if(F===".")F=process.cwd();if(y6(ou(F,"package.json"))||y6(ou(F,"node_modules")))return F;if(C===F)throw new Error('Could not find module root given file: "'+u+'". Do you have a `package.json` file? ');C=F,F=ou(F,"..")}}});var m6=y((OB)=>{var{cppdb:aD}=eD();OB.prepare=function D(u){return this[aD].prepare(u,this,!1)};OB.exec=function D(u){return this[aD].exec(u),this};OB.close=function D(){return this[aD].close(),this};OB.loadExtension=function D(...u){return this[aD].loadExtension(...u),this};OB.defaultSafeIntegers=function D(...u){return this[aD].defaultSafeIntegers(...u),this};OB.unsafeMode=function D(...u){return this[aD].unsafeMode(...u),this};OB.getters={name:{get:function D(){return this[aD].name},enumerable:!0},open:{get:function D(){return this[aD].open},enumerable:!0},inTransaction:{get:function D(){return this[aD].inTransaction},enumerable:!0},readonly:{get:function D(){return this[aD].readonly},enumerable:!0},memory:{get:function D(){return this[aD].memory},enumerable:!0}}});var l6=y((XZ,d6)=>{var{cppdb:bB}=eD(),c6=new WeakMap;d6.exports=function D(u){if(typeof u!=="function")throw new TypeError("Expected first argument to be a function");let F=this[bB],C=vB(F,this),{apply:E}=Function.prototype,$={default:{value:eu(E,u,F,C.default)},deferred:{value:eu(E,u,F,C.deferred)},immediate:{value:eu(E,u,F,C.immediate)},exclusive:{value:eu(E,u,F,C.exclusive)},database:{value:this,enumerable:!0}};return Object.defineProperties($.default.value,$),Object.defineProperties($.deferred.value,$),Object.defineProperties($.immediate.value,$),Object.defineProperties($.exclusive.value,$),$.default.value};var vB=(D,u)=>{let F=c6.get(D);if(!F){let C={commit:D.prepare("COMMIT",u,!1),rollback:D.prepare("ROLLBACK",u,!1),savepoint:D.prepare("SAVEPOINT `\t_bs3. `",u,!1),release:D.prepare("RELEASE `\t_bs3. `",u,!1),rollbackTo:D.prepare("ROLLBACK TO `\t_bs3. `",u,!1)};c6.set(D,F={default:Object.assign({begin:D.prepare("BEGIN",u,!1)},C),deferred:Object.assign({begin:D.prepare("BEGIN DEFERRED",u,!1)},C),immediate:Object.assign({begin:D.prepare("BEGIN IMMEDIATE",u,!1)},C),exclusive:Object.assign({begin:D.prepare("BEGIN EXCLUSIVE",u,!1)},C)})}return F},eu=(D,u,F,{begin:C,commit:E,rollback:$,savepoint:B,release:Q,rollbackTo:X})=>function Z(){let Y,J,H;if(F.inTransaction)Y=B,J=Q,H=X;else Y=C,J=E,H=$;Y.run();try{let A=D.call(u,this,arguments);if(A&&typeof A.then==="function")throw new TypeError("Transaction function cannot return a promise");return J.run(),A}catch(A){if(F.inTransaction){if(H.run(),H!==$)J.run()}throw A}}});var n6=y((ZZ,p6)=>{var{getBooleanOption:yB,cppdb:fB}=eD();p6.exports=function D(u,F){if(F==null)F={};if(typeof u!=="string")throw new TypeError("Expected first argument to be a string");if(typeof F!=="object")throw new TypeError("Expected second argument to be an options object");let C=yB(F,"simple"),E=this[fB].prepare(`PRAGMA ${u}`,this,!0);return C?E.pluck().get():E.all()}});var i6=y((YZ,r6)=>{var hB=a("fs"),gB=a("path"),{promisify:mB}=a("util"),{cppdb:cB}=eD(),a6=mB(hB.access);r6.exports=async function D(u,F){if(F==null)F={};if(typeof u!=="string")throw new TypeError("Expected first argument to be a string");if(typeof F!=="object")throw new TypeError("Expected second argument to be an options object");u=u.trim();let C="attached"in F?F.attached:"main",E="progress"in F?F.progress:null;if(!u)throw new TypeError("Backup filename cannot be an empty string");if(u===":memory:")throw new TypeError('Invalid backup filename ":memory:"');if(typeof C!=="string")throw new TypeError('Expected the "attached" option to be a string');if(!C)throw new TypeError('The "attached" option cannot be an empty string');if(E!=null&&typeof E!=="function")throw new TypeError('Expected the "progress" option to be a function');await a6(gB.dirname(u)).catch(()=>{throw new TypeError("Cannot save backup because the directory does not exist")});let $=await a6(u).then(()=>!1,()=>!0);return dB(this[cB].backup(this,C,u,$),E||null)};var dB=(D,u)=>{let F=0,C=!0;return new Promise((E,$)=>{setImmediate(function B(){try{let Q=D.transfer(F);if(!Q.remainingPages){D.close(),E(Q);return}if(C)C=!1,F=100;if(u){let X=u(Q);if(X!==void 0)if(typeof X==="number"&&X===X)F=Math.max(0,Math.min(2147483647,Math.round(X)));else throw new TypeError("Expected progress callback to return a number or undefined")}setImmediate(B)}catch(Q){D.close(),$(Q)}})})}});var s6=y((JZ,o6)=>{var{cppdb:lB}=eD();o6.exports=function D(u){if(u==null)u={};if(typeof u!=="object")throw new TypeError("Expected first argument to be an options object");let F="attached"in u?u.attached:"main";if(typeof F!=="string")throw new TypeError('Expected the "attached" option to be a string');if(!F)throw new TypeError('The "attached" option cannot be an empty string');return this[lB].serialize(F)}});var e6=y((KZ,t6)=>{var{getBooleanOption:DF,cppdb:pB}=eD();t6.exports=function D(u,F,C){if(F==null)F={};if(typeof F==="function")C=F,F={};if(typeof u!=="string")throw new TypeError("Expected first argument to be a string");if(typeof C!=="function")throw new TypeError("Expected last argument to be a function");if(typeof F!=="object")throw new TypeError("Expected second argument to be an options object");if(!u)throw new TypeError("User-defined function name cannot be an empty string");let E="safeIntegers"in F?+DF(F,"safeIntegers"):2,$=DF(F,"deterministic"),B=DF(F,"directOnly"),Q=DF(F,"varargs"),X=-1;if(!Q){if(X=C.length,!Number.isInteger(X)||X<0)throw new TypeError("Expected function.length to be a positive integer");if(X>100)throw new RangeError("User-defined functions cannot have more than 100 arguments")}return this[pB].function(C,u,X,E,$,B),this}});var F1=y((qZ,u1)=>{var{getBooleanOption:uF,cppdb:nB}=eD();u1.exports=function D(u,F){if(typeof u!=="string")throw new TypeError("Expected first argument to be a string");if(typeof F!=="object"||F===null)throw new TypeError("Expected second argument to be an options object");if(!u)throw new TypeError("User-defined function name cannot be an empty string");let C="start"in F?F.start:null,E=b2(F,"step",!0),$=b2(F,"inverse",!1),B=b2(F,"result",!1),Q="safeIntegers"in F?+uF(F,"safeIntegers"):2,X=uF(F,"deterministic"),Z=uF(F,"directOnly"),Y=uF(F,"varargs"),J=-1;if(!Y){if(J=Math.max(D1(E),$?D1($):0),J>0)J-=1;if(J>100)throw new RangeError("User-defined functions cannot have more than 100 arguments")}return this[nB].aggregate(C,E,$,B,u,J,Q,X,Z),this};var b2=(D,u,F)=>{let C=u in D?D[u]:null;if(typeof C==="function")return C;if(C!=null)throw new TypeError(`Expected the "${u}" option to be a function`);if(F)throw new TypeError(`Missing required option "${u}"`);return null},D1=({length:D})=>{if(Number.isInteger(D)&&D>=0)return D;throw new TypeError("Expected function.length to be a positive integer")}});var $1=y((VZ,B1)=>{var{cppdb:aB}=eD();B1.exports=function D(u,F){if(typeof u!=="string")throw new TypeError("Expected first argument to be a string");if(!u)throw new TypeError("Virtual table module name cannot be an empty string");let C=!1;if(typeof F==="object"&&F!==null)C=!0,F=u4(E1(F,"used",u));else{if(typeof F!=="function")throw new TypeError("Expected second argument to be a function or a table definition object");F=rB(F)}return this[aB].table(F,u,C),this};function rB(D){return function u(F,C,E,...$){let B={module:F,database:C,table:E},Q=eB.call(D,B,$);if(typeof Q!=="object"||Q===null)throw new TypeError(`Virtual table module "${F}" did not return a table definition object`);return E1(Q,"returned",F)}}function E1(D,u,F){if(!uu.call(D,"rows"))throw new TypeError(`Virtual table module "${F}" ${u} a table definition without a "rows" property`);if(!uu.call(D,"columns"))throw new TypeError(`Virtual table module "${F}" ${u} a table definition without a "columns" property`);let C=D.rows;if(typeof C!=="function"||Object.getPrototypeOf(C)!==D4)throw new TypeError(`Virtual table module "${F}" ${u} a table definition with an invalid "rows" property (should be a generator function)`);let E=D.columns;if(!Array.isArray(E)||!(E=[...E]).every((Z)=>typeof Z==="string"))throw new TypeError(`Virtual table module "${F}" ${u} a table definition with an invalid "columns" property (should be an array of strings)`);if(E.length!==new Set(E).size)throw new TypeError(`Virtual table module "${F}" ${u} a table definition with duplicate column names`);if(!E.length)throw new RangeError(`Virtual table module "${F}" ${u} a table definition with zero columns`);let $;if(uu.call(D,"parameters")){if($=D.parameters,!Array.isArray($)||!($=[...$]).every((Z)=>typeof Z==="string"))throw new TypeError(`Virtual table module "${F}" ${u} a table definition with an invalid "parameters" property (should be an array of strings)`)}else $=tB(C);if($.length!==new Set($).size)throw new TypeError(`Virtual table module "${F}" ${u} a table definition with duplicate parameter names`);if($.length>32)throw new RangeError(`Virtual table module "${F}" ${u} a table definition with more than the maximum number of 32 parameters`);for(let Z of $)if(E.includes(Z))throw new TypeError(`Virtual table module "${F}" ${u} a table definition with column "${Z}" which was ambiguously defined as both a column and parameter`);let B=2;if(uu.call(D,"safeIntegers")){let Z=D.safeIntegers;if(typeof Z!=="boolean")throw new TypeError(`Virtual table module "${F}" ${u} a table definition with an invalid "safeIntegers" property (should be a boolean)`);B=+Z}let Q=!1;if(uu.call(D,"directOnly")){if(Q=D.directOnly,typeof Q!=="boolean")throw new TypeError(`Virtual table module "${F}" ${u} a table definition with an invalid "directOnly" property (should be a boolean)`)}return[`CREATE TABLE x(${[...$.map(C1).map((Z)=>`${Z} HIDDEN`),...E.map(C1)].join(", ")});`,iB(C,new Map(E.map((Z,Y)=>[Z,$.length+Y])),F),$,B,Q]}function iB(D,u,F){return function*C(...E){let $=E.map((B)=>Buffer.isBuffer(B)?Buffer.from(B):B);for(let B=0;B<u.size;++B)$.push(null);for(let B of D(...E))if(Array.isArray(B))oB(B,$,u.size,F),yield $;else if(typeof B==="object"&&B!==null)sB(B,$,u,F),yield $;else throw new TypeError(`Virtual table module "${F}" yielded something that isn't a valid row object`)}}function oB(D,u,F,C){if(D.length!==F)throw new TypeError(`Virtual table module "${C}" yielded a row with an incorrect number of columns`);let E=u.length-F;for(let $=0;$<F;++$)u[$+E]=D[$]}function sB(D,u,F,C){let E=0;for(let $ of Object.keys(D)){let B=F.get($);if(B===void 0)throw new TypeError(`Virtual table module "${C}" yielded a row with an undeclared column "${$}"`);u[B]=D[$],E+=1}if(E!==F.size)throw new TypeError(`Virtual table module "${C}" yielded a row with missing columns`)}function tB({length:D}){if(!Number.isInteger(D)||D<0)throw new TypeError("Expected function.length to be a positive integer");let u=[];for(let F=0;F<D;++F)u.push(`$${F+1}`);return u}var{hasOwnProperty:uu}=Object.prototype,{apply:eB}=Function.prototype,D4=Object.getPrototypeOf(function*(){}),C1=(D)=>`"${D.replace(/"/g,'""')}"`,u4=(D)=>()=>D});var X1=y((HZ,Q1)=>{var F4=function D(){};Q1.exports=function D(u,F){return Object.assign(new F4,this)}});var K1=y((AZ,J1)=>{var C4=a("fs"),Z1=a("path"),FF=eD(),E4=S2(),Y1;function qD(D,u){if(new.target==null)return new qD(D,u);let F;if(Buffer.isBuffer(D))F=D,D=":memory:";if(D==null)D="";if(u==null)u={};if(typeof D!=="string")throw new TypeError("Expected first argument to be a string");if(typeof u!=="object")throw new TypeError("Expected second argument to be an options object");if("readOnly"in u)throw new TypeError('Misspelled option "readOnly" should be "readonly"');if("memory"in u)throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');let C=D.trim(),E=C===""||C===":memory:",$=FF.getBooleanOption(u,"readonly"),B=FF.getBooleanOption(u,"fileMustExist"),Q="timeout"in u?u.timeout:5000,X="verbose"in u?u.verbose:null,Z="nativeBinding"in u?u.nativeBinding:null;if($&&E&&!F)throw new TypeError("In-memory/temporary databases cannot be readonly");if(!Number.isInteger(Q)||Q<0)throw new TypeError('Expected the "timeout" option to be a positive integer');if(Q>2147483647)throw new RangeError('Option "timeout" cannot be greater than 2147483647');if(X!=null&&typeof X!=="function")throw new TypeError('Expected the "verbose" option to be a function');if(Z!=null&&typeof Z!=="string"&&typeof Z!=="object")throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');let Y;if(Z==null)Y=Y1||(Y1=g6()("better_sqlite3.node"));else if(typeof Z==="string")Y=(typeof __non_webpack_require__==="function"?__non_webpack_require__:a)(Z1.resolve(Z).replace(/(\.node)?$/,".node"));else Y=Z;if(!Y.isInitialized)Y.setErrorConstructor(E4),Y.isInitialized=!0;if(!E&&!C4.existsSync(Z1.dirname(C)))throw new TypeError("Cannot open database because the directory does not exist");Object.defineProperties(this,{[FF.cppdb]:{value:new Y.Database(C,D,E,$,B,Q,X||null,F||null)},...G0.getters})}var G0=m6();qD.prototype.prepare=G0.prepare;qD.prototype.transaction=l6();qD.prototype.pragma=n6();qD.prototype.backup=i6();qD.prototype.serialize=s6();qD.prototype.function=e6();qD.prototype.aggregate=F1();qD.prototype.table=$1();qD.prototype.loadExtension=G0.loadExtension;qD.prototype.exec=G0.exec;qD.prototype.close=G0.close;qD.prototype.defaultSafeIntegers=G0.defaultSafeIntegers;qD.prototype.unsafeMode=G0.unsafeMode;qD.prototype[FF.inspect]=X1();J1.exports=qD});var q1=y((UZ,v2)=>{v2.exports=K1();v2.exports.SqliteError=S2()});var V1={};Z0(V1,{initializeDatabase:()=>f2,getDatabase:()=>_D,DatabaseManager:()=>ND,Database:()=>y2.default});import B4 from"path";import $4 from"fs";class ND{static instance;db=null;migrations=[];static getInstance(){if(!ND.instance)ND.instance=new ND;return ND.instance}registerMigration(D){this.migrations.push(D),this.migrations.sort((u,F)=>u.version-F.version)}async initialize(){if(this.db)return this.db;let D=P.getInstance().getDataDirectory();$4.mkdirSync(D,{recursive:!0});let u=B4.join(D,"claude-mem.db");return this.db=new y2.default(u),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),this.db.pragma("temp_store = memory"),this.db.pragma("mmap_size = 268435456"),this.db.pragma("cache_size = 10000"),this.initializeSchemaVersions(),await this.runMigrations(),CF=this.db,this.db}getConnection(){if(!this.db)throw new Error("Database not initialized. Call initialize() first.");return this.db}withTransaction(D){let u=this.getConnection();return u.transaction(D)(u)}close(){if(this.db)this.db.close(),this.db=null,CF=null}initializeSchemaVersions(){if(!this.db)return;this.db.exec(`
CREATE TABLE IF NOT EXISTS schema_versions (
id INTEGER PRIMARY KEY,
version INTEGER UNIQUE NOT NULL,
applied_at TEXT NOT NULL
)
`)}async runMigrations(){if(!this.db)return;let D=this.db.prepare("SELECT version FROM schema_versions ORDER BY version").all().map((F)=>F.version),u=D.length>0?Math.max(...D):0;for(let F of this.migrations)if(F.version>u)console.log(`Applying migration ${F.version}...`),this.db.transaction(()=>{F.up(this.db),this.db.prepare("INSERT INTO schema_versions (version, applied_at) VALUES (?, ?)").run(F.version,new Date().toISOString())})(),console.log(`Migration ${F.version} applied successfully`)}getCurrentVersion(){if(!this.db)return 0;return this.db.prepare("SELECT MAX(version) as version FROM schema_versions").get()?.version||0}}function _D(){if(!CF)throw new Error("Database not initialized. Call DatabaseManager.getInstance().initialize() first.");return CF}async function f2(){return await ND.getInstance().initialize()}var y2,CF=null;var rD=E0(()=>{y2=lD(q1(),1);UD()});function FD(D){let u;if(!D)u=new Date;else if(D instanceof Date)u=D;else if(typeof D==="number")u=new Date(D);else if(typeof D==="string"){if(!D.trim())u=new Date;else if(u=new Date(D),isNaN(u.getTime())){let F=D.replace(/\s+/g,"T").replace(/T+/g,"T");if(u=new Date(F),isNaN(u.getTime()))u=new Date}}else u=new Date;return{isoString:u.toISOString(),epoch:u.getTime()}}var H1={};Z0(H1,{SessionStore:()=>Fu});class Fu{db;constructor(D){this.db=D||_D()}create(D){let{isoString:u,epoch:F}=FD(D.created_at),E=this.db.prepare(`
INSERT INTO sessions (
session_id, project, created_at, created_at_epoch, source,
archive_path, archive_bytes, archive_checksum, archived_at, metadata_json
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`).run(D.session_id,D.project,u,F,D.source||"compress",D.archive_path||null,D.archive_bytes||null,D.archive_checksum||null,D.archived_at||null,D.metadata_json||null);return this.getById(E.lastInsertRowid)}upsert(D){let u=this.getBySessionId(D.session_id);if(u)return this.update(u.id,D);return this.create(D)}update(D,u){let F=this.getById(D);if(!F)throw new Error(`Session with id ${D} not found`);let{isoString:C,epoch:E}=FD(u.created_at||F.created_at);return this.db.prepare(`
UPDATE sessions SET
project = ?, created_at = ?, created_at_epoch = ?, source = ?,
archive_path = ?, archive_bytes = ?, archive_checksum = ?, archived_at = ?, metadata_json = ?
WHERE id = ?
`).run(u.project||F.project,C,E,u.source||F.source,u.archive_path!==void 0?u.archive_path:F.archive_path,u.archive_bytes!==void 0?u.archive_bytes:F.archive_bytes,u.archive_checksum!==void 0?u.archive_checksum:F.archive_checksum,u.archived_at!==void 0?u.archived_at:F.archived_at,u.metadata_json!==void 0?u.metadata_json:F.metadata_json,D),this.getById(D)}getById(D){return this.db.prepare("SELECT * FROM sessions WHERE id = ?").get(D)||null}getBySessionId(D){return this.db.prepare("SELECT * FROM sessions WHERE session_id = ?").get(D)||null}has(D){let u=this.db.prepare("SELECT 1 FROM sessions WHERE session_id = ? LIMIT 1");return Boolean(u.get(D))}getAllSessionIds(){let u=this.db.prepare("SELECT session_id FROM sessions").all();return new Set(u.map((F)=>F.session_id))}getRecentForProject(D,u=5){return this.db.prepare(`
SELECT * FROM sessions
WHERE project = ?
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(D,u)}getRecent(D=5){return this.db.prepare(`
SELECT * FROM sessions
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(D)}getBySource(D,u){let F=u?"SELECT * FROM sessions WHERE source = ? ORDER BY created_at_epoch DESC LIMIT ?":"SELECT * FROM sessions WHERE source = ? ORDER BY created_at_epoch DESC",C=this.db.prepare(F),E=u?[D,u]:[D];return C.all(...E)}count(){return this.db.prepare("SELECT COUNT(*) as count FROM sessions").get().count}countByProject(D){return this.db.prepare("SELECT COUNT(*) as count FROM sessions WHERE project = ?").get(D).count}deleteById(D){return this.db.prepare("DELETE FROM sessions WHERE id = ?").run(D).changes>0}deleteBySessionId(D){return this.db.prepare("DELETE FROM sessions WHERE session_id = ?").run(D).changes>0}}var EF=E0(()=>{rD()});var L1={};Z0(L1,{MemoryStore:()=>c2});class c2{db;constructor(D){this.db=D||_D()}create(D){let{isoString:u,epoch:F}=FD(D.created_at),E=this.db.prepare(`
INSERT INTO memories (
session_id, text, document_id, keywords, created_at, created_at_epoch,
project, archive_basename, origin, title, subtitle, facts, concepts, files_touched
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`).run(D.session_id,D.text,D.document_id||null,D.keywords||null,u,F,D.project,D.archive_basename||null,D.origin||"transcript",D.title||null,D.subtitle||null,D.facts||null,D.concepts||null,D.files_touched||null);return this.getById(E.lastInsertRowid)}createMany(D){return this.db.transaction((F)=>{let C=[];for(let E of F)C.push(this.create(E));return C})(D)}getById(D){return this.db.prepare("SELECT * FROM memories WHERE id = ?").get(D)||null}getByDocumentId(D){return this.db.prepare("SELECT * FROM memories WHERE document_id = ?").get(D)||null}hasDocumentId(D){let u=this.db.prepare("SELECT 1 FROM memories WHERE document_id = ? LIMIT 1");return Boolean(u.get(D))}getBySessionId(D){return this.db.prepare(`
SELECT * FROM memories
WHERE session_id = ?
ORDER BY created_at_epoch DESC
`).all(D)}getRecentForProject(D,u=10){return this.db.prepare(`
SELECT * FROM memories
WHERE project = ?
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(D,u)}getRecent(D=10){return this.db.prepare(`
SELECT * FROM memories
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(D)}searchByText(D,u,F=20){let C="SELECT * FROM memories WHERE text LIKE ?",E=[`%${D}%`];if(u)C+=" AND project = ?",E.push(u);return C+=" ORDER BY created_at_epoch DESC LIMIT ?",E.push(F),this.db.prepare(C).all(...E)}searchByKeywords(D,u,F=20){let C="SELECT * FROM memories WHERE keywords LIKE ?",E=[`%${D}%`];if(u)C+=" AND project = ?",E.push(u);return C+=" ORDER BY created_at_epoch DESC LIMIT ?",E.push(F),this.db.prepare(C).all(...E)}getByOrigin(D,u){let F=u?"SELECT * FROM memories WHERE origin = ? ORDER BY created_at_epoch DESC LIMIT ?":"SELECT * FROM memories WHERE origin = ? ORDER BY created_at_epoch DESC",C=this.db.prepare(F),E=u?[D,u]:[D];return C.all(...E)}getRecentForProjectByOrigin(D,u,F=10){return this.db.prepare(`
SELECT * FROM memories
WHERE project = ? AND origin = ?
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(D,u,F)}getLastNForProject(D,u=10){return this.db.prepare(`
SELECT * FROM (
SELECT * FROM memories
WHERE project = ?
ORDER BY created_at_epoch DESC
LIMIT ?
)
ORDER BY created_at_epoch ASC
`).all(D,u)}count(){return this.db.prepare("SELECT COUNT(*) as count FROM memories").get().count}countByProject(D){return this.db.prepare("SELECT COUNT(*) as count FROM memories WHERE project = ?").get(D).count}update(D,u){let F=this.getById(D);if(!F)throw new Error(`Memory with id ${D} not found`);let{isoString:C,epoch:E}=FD(u.created_at||F.created_at);return this.db.prepare(`
UPDATE memories SET
text = ?, document_id = ?, keywords = ?, created_at = ?, created_at_epoch = ?,
project = ?, archive_basename = ?, origin = ?, title = ?, subtitle = ?, facts = ?,
concepts = ?, files_touched = ?
WHERE id = ?
`).run(u.text||F.text,u.document_id!==void 0?u.document_id:F.document_id,u.keywords!==void 0?u.keywords:F.keywords,C,E,u.project||F.project,u.archive_basename!==void 0?u.archive_basename:F.archive_basename,u.origin||F.origin,u.title!==void 0?u.title:F.title,u.subtitle!==void 0?u.subtitle:F.subtitle,u.facts!==void 0?u.facts:F.facts,u.concepts!==void 0?u.concepts:F.concepts,u.files_touched!==void 0?u.files_touched:F.files_touched,D),this.getById(D)}deleteById(D){return this.db.prepare("DELETE FROM memories WHERE id = ?").run(D).changes>0}deleteBySessionId(D){return this.db.prepare("DELETE FROM memories WHERE session_id = ?").run(D).changes}getUniqueProjects(){return this.db.prepare("SELECT DISTINCT project FROM memories ORDER BY project").all().map((F)=>F.project)}}var d2=E0(()=>{rD()});var R1={};Z0(R1,{OverviewStore:()=>l2});class l2{db;constructor(D){this.db=D||_D()}create(D){let{isoString:u,epoch:F}=FD(D.created_at),E=this.db.prepare(`
INSERT INTO overviews (
session_id, content, created_at, created_at_epoch, project, origin
) VALUES (?, ?, ?, ?, ?, ?)
`).run(D.session_id,D.content,u,F,D.project,D.origin||"claude");return this.getById(E.lastInsertRowid)}upsert(D){let u=this.getBySessionId(D.session_id);if(u)return this.update(u.id,D);return this.create(D)}getById(D){return this.db.prepare("SELECT * FROM overviews WHERE id = ?").get(D)||null}getBySessionId(D){return this.db.prepare("SELECT * FROM overviews WHERE session_id = ?").get(D)||null}getRecentForProject(D,u=5){return this.db.prepare(`
SELECT * FROM overviews
WHERE project = ?
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(D,u)}getAllForProject(D){return this.db.prepare(`
SELECT * FROM overviews
WHERE project = ?
ORDER BY created_at_epoch ASC
`).all(D)}getRecent(D=5){return this.db.prepare(`
SELECT * FROM overviews
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(D)}searchByContent(D,u,F=10){let C="SELECT * FROM overviews WHERE content LIKE ?",E=[`%${D}%`];if(u)C+=" AND project = ?",E.push(u);return C+=" ORDER BY created_at_epoch DESC LIMIT ?",E.push(F),this.db.prepare(C).all(...E)}getByOrigin(D,u){let F=u?"SELECT * FROM overviews WHERE origin = ? ORDER BY created_at_epoch DESC LIMIT ?":"SELECT * FROM overviews WHERE origin = ? ORDER BY created_at_epoch DESC",C=this.db.prepare(F),E=u?[D,u]:[D];return C.all(...E)}count(){return this.db.prepare("SELECT COUNT(*) as count FROM overviews").get().count}countByProject(D){return this.db.prepare("SELECT COUNT(*) as count FROM overviews WHERE project = ?").get(D).count}update(D,u){let F=this.getById(D);if(!F)throw new Error(`Overview with id ${D} not found`);let{isoString:C,epoch:E}=FD(u.created_at||F.created_at);return this.db.prepare(`
UPDATE overviews SET
content = ?, created_at = ?, created_at_epoch = ?, project = ?, origin = ?
WHERE id = ?
`).run(u.content||F.content,C,E,u.project||F.project,u.origin||F.origin,D),this.getById(D)}deleteById(D){return this.db.prepare("DELETE FROM overviews WHERE id = ?").run(D).changes>0}deleteBySessionId(D){return this.db.prepare("DELETE FROM overviews WHERE session_id = ?").run(D).changes>0}getUniqueProjects(){return this.db.prepare("SELECT DISTINCT project FROM overviews ORDER BY project").all().map((F)=>F.project)}getByProject(D){return this.db.prepare(`
SELECT * FROM overviews
WHERE project = ?
ORDER BY created_at_epoch DESC
LIMIT 1
`).get(D)||null}upsertByProject(D){let u=this.getByProject(D.project);if(u)return this.update(u.id,D);return this.create(D)}deleteByProject(D){return this.db.prepare("DELETE FROM overviews WHERE project = ?").run(D).changes>0}}var p2=E0(()=>{rD()});var M1={};Z0(M1,{DiagnosticsStore:()=>n2});class n2{db;constructor(D){this.db=D||_D()}create(D){let{isoString:u,epoch:F}=FD(D.created_at),E=this.db.prepare(`
INSERT INTO diagnostics (
session_id, message, severity, created_at, created_at_epoch, project, origin
) VALUES (?, ?, ?, ?, ?, ?, ?)
`).run(D.session_id||null,D.message,D.severity||"warn",u,F,D.project,D.origin||"compressor");return this.getById(E.lastInsertRowid)}getById(D){return this.db.prepare("SELECT * FROM diagnostics WHERE id = ?").get(D)||null}getBySessionId(D){return this.db.prepare(`
SELECT * FROM diagnostics
WHERE session_id = ?
ORDER BY created_at_epoch DESC
`).all(D)}getRecentForProject(D,u=10){return this.db.prepare(`
SELECT * FROM diagnostics
WHERE project = ?
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(D,u)}getRecent(D=10){return this.db.prepare(`
SELECT * FROM diagnostics
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(D)}getBySeverity(D,u){let F=u?"SELECT * FROM diagnostics WHERE severity = ? ORDER BY created_at_epoch DESC LIMIT ?":"SELECT * FROM diagnostics WHERE severity = ? ORDER BY created_at_epoch DESC",C=this.db.prepare(F),E=u?[D,u]:[D];return C.all(...E)}getByOrigin(D,u){let F=u?"SELECT * FROM diagnostics WHERE origin = ? ORDER BY created_at_epoch DESC LIMIT ?":"SELECT * FROM diagnostics WHERE origin = ? ORDER BY created_at_epoch DESC",C=this.db.prepare(F),E=u?[D,u]:[D];return C.all(...E)}searchByMessage(D,u,F=20){let C="SELECT * FROM diagnostics WHERE message LIKE ?",E=[`%${D}%`];if(u)C+=" AND project = ?",E.push(u);return C+=" ORDER BY created_at_epoch DESC LIMIT ?",E.push(F),this.db.prepare(C).all(...E)}count(){return this.db.prepare("SELECT COUNT(*) as count FROM diagnostics").get().count}countByProject(D){return this.db.prepare("SELECT COUNT(*) as count FROM diagnostics WHERE project = ?").get(D).count}countBySeverity(D){return this.db.prepare("SELECT COUNT(*) as count FROM diagnostics WHERE severity = ?").get(D).count}update(D,u){let F=this.getById(D);if(!F)throw new Error(`Diagnostic with id ${D} not found`);let{isoString:C,epoch:E}=FD(u.created_at||F.created_at);return this.db.prepare(`
UPDATE diagnostics SET
message = ?, severity = ?, created_at = ?, created_at_epoch = ?, project = ?, origin = ?
WHERE id = ?
`).run(u.message||F.message,u.severity||F.severity,C,E,u.project||F.project,u.origin||F.origin,D),this.getById(D)}deleteById(D){return this.db.prepare("DELETE FROM diagnostics WHERE id = ?").run(D).changes>0}deleteBySessionId(D){return this.db.prepare("DELETE FROM diagnostics WHERE session_id = ?").run(D).changes}getUniqueProjects(){return this.db.prepare("SELECT DISTINCT project FROM diagnostics ORDER BY project").all().map((F)=>F.project)}getStats(){return this.db.prepare(`
SELECT
COUNT(*) as total,
COUNT(CASE WHEN severity = 'info' THEN 1 END) as info,
COUNT(CASE WHEN severity = 'warn' THEN 1 END) as warn,
COUNT(CASE WHEN severity = 'error' THEN 1 END) as error
FROM diagnostics
`).get()}}var a2=E0(()=>{rD()});var I1={};Z0(I1,{TranscriptEventStore:()=>r2});class r2{db;constructor(D){this.db=D||_D()}upsert(D){let{isoString:u,epoch:F}=FD(D.captured_at);return this.db.prepare(`
INSERT INTO transcript_events (
session_id,
project,
event_index,
event_type,
raw_json,
captured_at,
captured_at_epoch
) VALUES (?, ?, ?, ?, ?, ?, ?)
ON CONFLICT(session_id, event_index) DO UPDATE SET
project = excluded.project,
event_type = excluded.event_type,
raw_json = excluded.raw_json,
captured_at = excluded.captured_at,
captured_at_epoch = excluded.captured_at_epoch
`).run(D.session_id,D.project||null,D.event_index,D.event_type||null,D.raw_json,u,F),this.getBySessionAndIndex(D.session_id,D.event_index)}upsertMany(D){return this.db.transaction((F)=>{let C=[];for(let E of F)C.push(this.upsert(E));return C})(D)}getBySessionAndIndex(D,u){return this.db.prepare(`
SELECT * FROM transcript_events
WHERE session_id = ? AND event_index = ?
`).get(D,u)}getMaxEventIndex(D){return this.db.prepare(`
SELECT MAX(event_index) as max_event_index
FROM transcript_events
WHERE session_id = ?
`).get(D)?.max_event_index??-1}listBySession(D,u=200,F=0){return this.db.prepare(`
SELECT * FROM transcript_events
WHERE session_id = ?
ORDER BY event_index ASC
LIMIT ? OFFSET ?
`).all(D,u,F)}}var i2=E0(()=>{rD()});var j1={};Z0(j1,{StreamingSessionStore:()=>k0});class k0{db;constructor(D){this.db=D||_D()}create(D){let{isoString:u,epoch:F}=FD(D.started_at),E=this.db.prepare(`
INSERT INTO streaming_sessions (
claude_session_id, project, user_prompt, started_at, started_at_epoch, status
) VALUES (?, ?, ?, ?, ?, 'active')
`).run(D.claude_session_id,D.project,D.user_prompt||null,u,F);return this.getById(E.lastInsertRowid)}update(D,u){let{isoString:F,epoch:C}=FD(new Date);if(!this.getById(D))throw new Error(`Streaming session with id ${D} not found`);let $=[],B=[];if(u.sdk_session_id!==void 0)$.push("sdk_session_id = ?"),B.push(u.sdk_session_id);if(u.title!==void 0)$.push("title = ?"),B.push(u.title);if(u.subtitle!==void 0)$.push("subtitle = ?"),B.push(u.subtitle);if(u.status!==void 0)$.push("status = ?"),B.push(u.status);if(u.completed_at!==void 0){let{isoString:X,epoch:Z}=FD(u.completed_at);$.push("completed_at = ?","completed_at_epoch = ?"),B.push(X,Z)}return $.push("updated_at = ?","updated_at_epoch = ?"),B.push(F,C),B.push(D),this.db.prepare(`
UPDATE streaming_sessions
SET ${$.join(", ")}
WHERE id = ?
`).run(...B),this.getById(D)}updateByClaudeSessionId(D,u){let F=this.getByClaudeSessionId(D);if(!F)return null;return this.update(F.id,u)}getById(D){return this.db.prepare("SELECT * FROM streaming_sessions WHERE id = ?").get(D)||null}getByClaudeSessionId(D){return this.db.prepare("SELECT * FROM streaming_sessions WHERE claude_session_id = ?").get(D)||null}getBySdkSessionId(D){return this.db.prepare("SELECT * FROM streaming_sessions WHERE sdk_session_id = ?").get(D)||null}has(D){let u=this.db.prepare("SELECT 1 FROM streaming_sessions WHERE claude_session_id = ? LIMIT 1");return Boolean(u.get(D))}getActiveForProject(D){return this.db.prepare(`
SELECT * FROM streaming_sessions
WHERE project = ? AND status = 'active'
ORDER BY started_at_epoch DESC
`).all(D)}getAllActive(){return this.db.prepare(`
SELECT * FROM streaming_sessions
WHERE status = 'active'
ORDER BY started_at_epoch DESC
`).all()}getRecent(D=10){return this.db.prepare(`
SELECT * FROM streaming_sessions
ORDER BY started_at_epoch DESC
LIMIT ?
`).all(D)}markCompleted(D){return this.update(D,{status:"completed",completed_at:new Date})}markFailed(D){return this.update(D,{status:"failed",completed_at:new Date})}deleteById(D){return this.db.prepare("DELETE FROM streaming_sessions WHERE id = ?").run(D).changes>0}deleteByClaudeSessionId(D){return this.db.prepare("DELETE FROM streaming_sessions WHERE claude_session_id = ?").run(D).changes>0}cleanupOldSessions(D=30){let u=Date.now()-D*24*60*60*1000;return this.db.prepare(`
DELETE FROM streaming_sessions
WHERE status IN ('completed', 'failed')
AND completed_at_epoch < ?
`).run(u).changes}}var QF=E0(()=>{rD()});var w1={};Z0(w1,{migrations:()=>Bu,migration003:()=>N1,migration002:()=>T1,migration001:()=>O1});var O1,T1,N1,Bu;var XF=E0(()=>{O1={version:1,up:(D)=>{D.exec(`
CREATE TABLE IF NOT EXISTS sessions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT UNIQUE NOT NULL,
project TEXT NOT NULL,
created_at TEXT NOT NULL,
created_at_epoch INTEGER NOT NULL,
source TEXT NOT NULL DEFAULT 'compress',
archive_path TEXT,
archive_bytes INTEGER,
archive_checksum TEXT,
archived_at TEXT,
metadata_json TEXT
);
CREATE INDEX IF NOT EXISTS idx_sessions_project ON sessions(project);
CREATE INDEX IF NOT EXISTS idx_sessions_created_at ON sessions(created_at_epoch DESC);
CREATE INDEX IF NOT EXISTS idx_sessions_project_created ON sessions(project, created_at_epoch DESC);
`),D.exec(`
CREATE TABLE IF NOT EXISTS memories (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT NOT NULL,
text TEXT NOT NULL,
document_id TEXT UNIQUE,
keywords TEXT,
created_at TEXT NOT NULL,
created_at_epoch INTEGER NOT NULL,
project TEXT NOT NULL,
archive_basename TEXT,
origin TEXT NOT NULL DEFAULT 'transcript',
FOREIGN KEY (session_id) REFERENCES sessions(session_id) ON DELETE CASCADE
);
CREATE INDEX IF NOT EXISTS idx_memories_session ON memories(session_id);
CREATE INDEX IF NOT EXISTS idx_memories_project ON memories(project);
CREATE INDEX IF NOT EXISTS idx_memories_created_at ON memories(created_at_epoch DESC);
CREATE INDEX IF NOT EXISTS idx_memories_project_created ON memories(project, created_at_epoch DESC);
CREATE INDEX IF NOT EXISTS idx_memories_document_id ON memories(document_id);
CREATE INDEX IF NOT EXISTS idx_memories_origin ON memories(origin);
`),D.exec(`
CREATE TABLE IF NOT EXISTS overviews (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT NOT NULL,
content TEXT NOT NULL,
created_at TEXT NOT NULL,
created_at_epoch INTEGER NOT NULL,
project TEXT NOT NULL,
origin TEXT NOT NULL DEFAULT 'claude',
FOREIGN KEY (session_id) REFERENCES sessions(session_id) ON DELETE CASCADE
);
CREATE INDEX IF NOT EXISTS idx_overviews_session ON overviews(session_id);
CREATE INDEX IF NOT EXISTS idx_overviews_project ON overviews(project);
CREATE INDEX IF NOT EXISTS idx_overviews_created_at ON overviews(created_at_epoch DESC);
CREATE INDEX IF NOT EXISTS idx_overviews_project_created ON overviews(project, created_at_epoch DESC);
CREATE UNIQUE INDEX IF NOT EXISTS idx_overviews_project_latest ON overviews(project, created_at_epoch DESC);
`),D.exec(`
CREATE TABLE IF NOT EXISTS diagnostics (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT,
message TEXT NOT NULL,
severity TEXT NOT NULL DEFAULT 'info',
created_at TEXT NOT NULL,
created_at_epoch INTEGER NOT NULL,
project TEXT NOT NULL,
origin TEXT NOT NULL DEFAULT 'system',
FOREIGN KEY (session_id) REFERENCES sessions(session_id) ON DELETE SET NULL
);
CREATE INDEX IF NOT EXISTS idx_diagnostics_session ON diagnostics(session_id);
CREATE INDEX IF NOT EXISTS idx_diagnostics_project ON diagnostics(project);
CREATE INDEX IF NOT EXISTS idx_diagnostics_severity ON diagnostics(severity);
CREATE INDEX IF NOT EXISTS idx_diagnostics_created ON diagnostics(created_at_epoch DESC);
`),D.exec(`
CREATE TABLE IF NOT EXISTS transcript_events (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT NOT NULL,
project TEXT,
event_index INTEGER NOT NULL,
event_type TEXT,
raw_json TEXT NOT NULL,
captured_at TEXT NOT NULL,
captured_at_epoch INTEGER NOT NULL,
FOREIGN KEY (session_id) REFERENCES sessions(session_id) ON DELETE CASCADE,
UNIQUE(session_id, event_index)
);
CREATE INDEX IF NOT EXISTS idx_transcript_events_session ON transcript_events(session_id, event_index);
CREATE INDEX IF NOT EXISTS idx_transcript_events_project ON transcript_events(project);
CREATE INDEX IF NOT EXISTS idx_transcript_events_type ON transcript_events(event_type);
CREATE INDEX IF NOT EXISTS idx_transcript_events_captured ON transcript_events(captured_at_epoch DESC);
`),console.log("✅ Created all database tables successfully")},down:(D)=>{D.exec(`
DROP TABLE IF EXISTS transcript_events;
DROP TABLE IF EXISTS diagnostics;
DROP TABLE IF EXISTS overviews;
DROP TABLE IF EXISTS memories;
DROP TABLE IF EXISTS sessions;
`)}},T1={version:2,up:(D)=>{D.exec(`
ALTER TABLE memories ADD COLUMN title TEXT;
ALTER TABLE memories ADD COLUMN subtitle TEXT;
ALTER TABLE memories ADD COLUMN facts TEXT;
ALTER TABLE memories ADD COLUMN concepts TEXT;
ALTER TABLE memories ADD COLUMN files_touched TEXT;
`),D.exec(`
CREATE INDEX IF NOT EXISTS idx_memories_title ON memories(title);
CREATE INDEX IF NOT EXISTS idx_memories_concepts ON memories(concepts);
`),console.log("✅ Added hierarchical memory fields to memories table")},down:(D)=>{console.log("⚠️ Warning: SQLite ALTER TABLE DROP COLUMN not fully supported"),console.log("⚠️ To rollback, manually recreate the memories table")}},N1={version:3,up:(D)=>{D.exec(`
CREATE TABLE IF NOT EXISTS streaming_sessions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
claude_session_id TEXT UNIQUE NOT NULL,
sdk_session_id TEXT,
project TEXT NOT NULL,
title TEXT,
subtitle TEXT,
user_prompt TEXT,
started_at TEXT NOT NULL,
started_at_epoch INTEGER NOT NULL,
updated_at TEXT,
updated_at_epoch INTEGER,
completed_at TEXT,
completed_at_epoch INTEGER,
status TEXT NOT NULL DEFAULT 'active'
);
CREATE INDEX IF NOT EXISTS idx_streaming_sessions_claude_id ON streaming_sessions(claude_session_id);
CREATE INDEX IF NOT EXISTS idx_streaming_sessions_sdk_id ON streaming_sessions(sdk_session_id);
CREATE INDEX IF NOT EXISTS idx_streaming_sessions_project ON streaming_sessions(project);
CREATE INDEX IF NOT EXISTS idx_streaming_sessions_status ON streaming_sessions(status);
CREATE INDEX IF NOT EXISTS idx_streaming_sessions_started ON streaming_sessions(started_at_epoch DESC);
`),console.log("✅ Created streaming_sessions table for real-time session tracking")},down:(D)=>{D.exec(`
DROP TABLE IF EXISTS streaming_sessions;
`)}},Bu=[O1,T1,N1]});var c3=lD(m3(),1),{program:d$,createCommand:l$,createArgument:p$,createOption:n$,CommanderError:a$,InvalidArgumentError:r$,InvalidOptionArgumentError:i$,Command:d3,Argument:o$,Option:s$,Help:t$}=c3.default;import{readFileSync as oC,existsSync as sC}from"fs";import{join as tC,dirname as eC}from"path";import{fileURLToPath as D9}from"url";var l3="claude-mem",p3="3.9.16",n3="Memory compression system for Claude Code - persist context across sessions",a3=l3,r3=p3,i3=n3;try{let D=D9(import.meta.url),u=eC(D),F=tC(u,"..","..","package.json");if(sC(F)){let C=JSON.parse(oC(F,"utf-8"));a3=C.name||l3,r3=C.version||p3,i3=C.description||n3}}catch{}var j0=a3,o3=r3,s3=i3;import{readFileSync as au,writeFileSync as q0,existsSync as bD,mkdirSync as Du,copyFileSync as w2,statSync as uB,readdirSync as FB}from"fs";import{join as uD,dirname as k2}from"path";import{homedir as T6}from"os";import{execSync as N2}from"child_process";var JD=lD(gF(),1),J8=lD(cF(),1);import{stdin as Z8,stdout as Y8}from"node:process";import*as Y0 from"node:readline";import u8 from"node:readline";import{Writable as $9}from"node:stream";function Q9({onlyFirst:D=!1}={}){let u=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(u,D?void 0:"g")}var X9=Q9();function K8(D){if(typeof D!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(X9,"")}function q8(D){return D&&D.__esModule&&Object.prototype.hasOwnProperty.call(D,"default")?D.default:D}var V8={exports:{}};(function(D){var u={};D.exports=u,u.eastAsianWidth=function(C){var E=C.charCodeAt(0),$=C.length==2?C.charCodeAt(1):0,B=E;return 55296<=E&&E<=56319&&56320<=$&&$<=57343&&(E&=1023,$&=1023,B=E<<10|$,B+=65536),B==12288||65281<=B&&B<=65376||65504<=B&&B<=65510?"F":B==8361||65377<=B&&B<=65470||65474<=B&&B<=65479||65482<=B&&B<=65487||65490<=B&&B<=65495||65498<=B&&B<=65500||65512<=B&&B<=65518?"H":4352<=B&&B<=4447||4515<=B&&B<=4519||4602<=B&&B<=4607||9001<=B&&B<=9002||11904<=B&&B<=11929||11931<=B&&B<=12019||12032<=B&&B<=12245||12272<=B&&B<=12283||12289<=B&&B<=12350||12353<=B&&B<=12438||12441<=B&&B<=12543||12549<=B&&B<=12589||12593<=B&&B<=12686||12688<=B&&B<=12730||12736<=B&&B<=12771||12784<=B&&B<=12830||12832<=B&&B<=12871||12880<=B&&B<=13054||13056<=B&&B<=19903||19968<=B&&B<=42124||42128<=B&&B<=42182||43360<=B&&B<=43388||44032<=B&&B<=55203||55216<=B&&B<=55238||55243<=B&&B<=55291||63744<=B&&B<=64255||65040<=B&&B<=65049||65072<=B&&B<=65106||65108<=B&&B<=65126||65128<=B&&B<=65131||110592<=B&&B<=110593||127488<=B&&B<=127490||127504<=B&&B<=127546||127552<=B&&B<=127560||127568<=B&&B<=127569||131072<=B&&B<=194367||177984<=B&&B<=196605||196608<=B&&B<=262141?"W":32<=B&&B<=126||162<=B&&B<=163||165<=B&&B<=166||B==172||B==175||10214<=B&&B<=10221||10629<=B&&B<=10630?"Na":B==161||B==164||167<=B&&B<=168||B==170||173<=B&&B<=174||176<=B&&B<=180||182<=B&&B<=186||188<=B&&B<=191||B==198||B==208||215<=B&&B<=216||222<=B&&B<=225||B==230||232<=B&&B<=234||236<=B&&B<=237||B==240||242<=B&&B<=243||247<=B&&B<=250||B==252||B==254||B==257||B==273||B==275||B==283||294<=B&&B<=295||B==299||305<=B&&B<=307||B==312||319<=B&&B<=322||B==324||328<=B&&B<=331||B==333||338<=B&&B<=339||358<=B&&B<=359||B==363||B==462||B==464||B==466||B==468||B==470||B==472||B==474||B==476||B==593||B==609||B==708||B==711||713<=B&&B<=715||B==717||B==720||728<=B&&B<=731||B==733||B==735||768<=B&&B<=879||913<=B&&B<=929||931<=B&&B<=937||945<=B&&B<=961||963<=B&&B<=969||B==1025||1040<=B&&B<=1103||B==1105||B==8208||8211<=B&&B<=8214||8216<=B&&B<=8217||8220<=B&&B<=8221||8224<=B&&B<=8226||8228<=B&&B<=8231||B==8240||8242<=B&&B<=8243||B==8245||B==8251||B==8254||B==8308||B==8319||8321<=B&&B<=8324||B==8364||B==8451||B==8453||B==8457||B==8467||B==8470||8481<=B&&B<=8482||B==8486||B==8491||8531<=B&&B<=8532||8539<=B&&B<=8542||8544<=B&&B<=8555||8560<=B&&B<=8569||B==8585||8592<=B&&B<=8601||8632<=B&&B<=8633||B==8658||B==8660||B==8679||B==8704||8706<=B&&B<=8707||8711<=B&&B<=8712||B==8715||B==8719||B==8721||B==8725||B==8730||8733<=B&&B<=8736||B==8739||B==8741||8743<=B&&B<=8748||B==8750||8756<=B&&B<=8759||8764<=B&&B<=8765||B==8776||B==8780||B==8786||8800<=B&&B<=8801||8804<=B&&B<=8807||8810<=B&&B<=8811||8814<=B&&B<=8815||8834<=B&&B<=8835||8838<=B&&B<=8839||B==8853||B==8857||B==8869||B==8895||B==8978||9312<=B&&B<=9449||9451<=B&&B<=9547||9552<=B&&B<=9587||9600<=B&&B<=9615||9618<=B&&B<=9621||9632<=B&&B<=9633||9635<=B&&B<=9641||9650<=B&&B<=9651||9654<=B&&B<=9655||9660<=B&&B<=9661||9664<=B&&B<=9665||9670<=B&&B<=9672||B==9675||9678<=B&&B<=9681||9698<=B&&B<=9701||B==9711||9733<=B&&B<=9734||B==9737||9742<=B&&B<=9743||9748<=B&&B<=9749||B==9756||B==9758||B==9792||B==9794||9824<=B&&B<=9825||9827<=B&&B<=9829||9831<=B&&B<=9834||9836<=B&&B<=9837||B==9839||9886<=B&&B<=9887||9918<=B&&B<=9919||9924<=B&&B<=9933||9935<=B&&B<=9953||B==9955||9960<=B&&B<=9983||B==10045||B==10071||10102<=B&&B<=10111||11093<=B&&B<=11097||12872<=B&&B<=12879||57344<=B&&B<=63743||65024<=B&&B<=65039||B==65533||127232<=B&&B<=127242||127248<=B&&B<=127277||127280<=B&&B<=127337||127344<=B&&B<=127386||917760<=B&&B<=917999||983040<=B&&B<=1048573||1048576<=B&&B<=1114109?"A":"N"},u.characterLength=function(C){var E=this.eastAsianWidth(C);return E=="F"||E=="W"||E=="A"?2:1};function F(C){return C.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}u.length=function(C){for(var E=F(C),$=0,B=0;B<E.length;B++)$=$+this.characterLength(E[B]);return $},u.slice=function(C,E,$){textLen=u.length(C),E=E||0,$=$||1,E<0&&(E=textLen+E),$<0&&($=textLen+$);for(var B="",Q=0,X=F(C),Z=0;Z<X.length;Z++){var Y=X[Z],J=u.length(Y);if(Q>=E-(J==2?1:0))if(Q+J<=$)B+=Y;else break;Q+=J}return B}})(V8);var Z9=V8.exports,Y9=q8(Z9),J9=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\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])|\uD83C[\uDF3E\uDF73\uDF7C\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\uDF7C\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\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\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\uDF7C\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\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\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\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\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-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*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\u26A7\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-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\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[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},K9=q8(J9);function d0(D,u={}){if(typeof D!="string"||D.length===0||(u={ambiguousIsNarrow:!0,...u},D=K8(D),D.length===0))return 0;D=D.replace(K9()," ");let F=u.ambiguousIsNarrow?1:2,C=0;for(let E of D){let $=E.codePointAt(0);if($<=31||$>=127&&$<=159||$>=768&&$<=879)continue;switch(Y9.eastAsianWidth(E)){case"F":case"W":C+=2;break;case"A":C+=F;break;default:C+=1}}return C}var dF=10,F8=(D=0)=>(u)=>`\x1B[${u+D}m`,C8=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,E8=(D=0)=>(u,F,C)=>`\x1B[${38+D};2;${u};${F};${C}m`,d={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],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],gray:[90,39],grey:[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],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(d.modifier);var q9=Object.keys(d.color),V9=Object.keys(d.bgColor);[...q9];function H9(){let D=new Map;for(let[u,F]of Object.entries(d)){for(let[C,E]of Object.entries(F))d[C]={open:`\x1B[${E[0]}m`,close:`\x1B[${E[1]}m`},F[C]=d[C],D.set(E[0],E[1]);Object.defineProperty(d,u,{value:F,enumerable:!1})}return Object.defineProperty(d,"codes",{value:D,enumerable:!1}),d.color.close="\x1B[39m",d.bgColor.close="\x1B[49m",d.color.ansi=F8(),d.color.ansi256=C8(),d.color.ansi16m=E8(),d.bgColor.ansi=F8(dF),d.bgColor.ansi256=C8(dF),d.bgColor.ansi16m=E8(dF),Object.defineProperties(d,{rgbToAnsi256:{value:(u,F,C)=>u===F&&F===C?u<8?16:u>248?231:Math.round((u-8)/247*24)+232:16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(C/255*5),enumerable:!1},hexToRgb:{value:(u)=>{let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[C]=F;C.length===3&&(C=[...C].map(($)=>$+$).join(""));let E=Number.parseInt(C,16);return[E>>16&255,E>>8&255,E&255]},enumerable:!1},hexToAnsi256:{value:(u)=>d.rgbToAnsi256(...d.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value:(u)=>{if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,C,E;if(u>=232)F=((u-232)*10+8)/255,C=F,E=F;else{u-=16;let Q=u%36;F=Math.floor(u/36)/5,C=Math.floor(Q/6)/5,E=Q%6/5}let $=Math.max(F,C,E)*2;if($===0)return 30;let B=30+(Math.round(E)<<2|Math.round(C)<<1|Math.round(F));return $===2&&(B+=60),B},enumerable:!1},rgbToAnsi:{value:(u,F,C)=>d.ansi256ToAnsi(d.rgbToAnsi256(u,F,C)),enumerable:!1},hexToAnsi:{value:(u)=>d.ansi256ToAnsi(d.hexToAnsi256(u)),enumerable:!1}}),d}var A9=H9(),ku=new Set(["\x1B","›"]),z9=39,nF="\x07",H8="[",U9="]",A8="m",aF=`${U9}8;;`,B8=(D)=>`${ku.values().next().value}${H8}${D}${A8}`,$8=(D)=>`${ku.values().next().value}${aF}${D}${nF}`,_9=(D)=>D.split(" ").map((u)=>d0(u)),lF=(D,u,F)=>{let C=[...u],E=!1,$=!1,B=d0(K8(D[D.length-1]));for(let[Q,X]of C.entries()){let Z=d0(X);if(B+Z<=F?D[D.length-1]+=X:(D.push(X),B=0),ku.has(X)&&(E=!0,$=C.slice(Q+1).join("").startsWith(aF)),E){$?X===nF&&(E=!1,$=!1):X===A8&&(E=!1);continue}B+=Z,B===F&&Q<C.length-1&&(D.push(""),B=0)}!B&&D[D.length-1].length>0&&D.length>1&&(D[D.length-2]+=D.pop())},W9=(D)=>{let u=D.split(" "),F=u.length;for(;F>0&&!(d0(u[F-1])>0);)F--;return F===u.length?D:u.slice(0,F).join(" ")+u.slice(F).join("")},G9=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let C="",E,$,B=_9(D),Q=[""];for(let[Z,Y]of D.split(" ").entries()){F.trim!==!1&&(Q[Q.length-1]=Q[Q.length-1].trimStart());let J=d0(Q[Q.length-1]);if(Z!==0&&(J>=u&&(F.wordWrap===!1||F.trim===!1)&&(Q.push(""),J=0),(J>0||F.trim===!1)&&(Q[Q.length-1]+=" ",J++)),F.hard&&B[Z]>u){let H=u-J,A=1+Math.floor((B[Z]-H-1)/u);Math.floor((B[Z]-1)/u)<A&&Q.push(""),lF(Q,Y,u);continue}if(J+B[Z]>u&&J>0&&B[Z]>0){if(F.wordWrap===!1&&J<u){lF(Q,Y,u);continue}Q.push("")}if(J+B[Z]>u&&F.wordWrap===!1){lF(Q,Y,u);continue}Q[Q.length-1]+=Y}F.trim!==!1&&(Q=Q.map((Z)=>W9(Z)));let X=[...Q.join(`
`)];for(let[Z,Y]of X.entries()){if(C+=Y,ku.has(Y)){let{groups:H}=new RegExp(`(?:\\${H8}(?<code>\\d+)m|\\${aF}(?<uri>.*)${nF})`).exec(X.slice(Z).join(""))||{groups:{}};if(H.code!==void 0){let A=Number.parseFloat(H.code);E=A===z9?void 0:A}else H.uri!==void 0&&($=H.uri.length===0?void 0:H.uri)}let J=A9.codes.get(Number(E));X[Z+1]===`
`?($&&(C+=$8("")),E&&J&&(C+=B8(J))):Y===`
`&&(E&&J&&(C+=B8(E)),$&&(C+=$8($)))}return C};function Q8(D,u,F){return String(D).normalize().replace(/\r\n/g,`
`).split(`
`).map((C)=>G9(C,u,F)).join(`
`)}var L9=["up","down","left","right","space","enter","cancel"],wu={actions:new Set(L9),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function rF(D,u){if(typeof D=="string")return wu.aliases.get(D)===u;for(let F of D)if(F!==void 0&&rF(F,u))return!0;return!1}function R9(D,u){if(D===u)return;let F=D.split(`
`),C=u.split(`
`),E=[];for(let $=0;$<Math.max(F.length,C.length);$++)F[$]!==C[$]&&E.push($);return E}var M9=globalThis.process.platform.startsWith("win"),pF=Symbol("clack:cancel");function SD(D){return D===pF}function Nu(D,u){let F=D;F.isTTY&&F.setRawMode(u)}function z8({input:D=Z8,output:u=Y8,overwrite:F=!0,hideCursor:C=!0}={}){let E=Y0.createInterface({input:D,output:u,prompt:"",tabSize:1});Y0.emitKeypressEvents(D,E),D.isTTY&&D.setRawMode(!0);let $=(B,{name:Q,sequence:X})=>{let Z=String(B);if(rF([Z,Q,X],"cancel")){C&&u.write(JD.cursor.show),process.exit(0);return}if(!F)return;Y0.moveCursor(u,Q==="return"?0:-1,Q==="return"?-1:0,()=>{Y0.clearLine(u,1,()=>{D.once("keypress",$)})})};return C&&u.write(JD.cursor.hide),D.once("keypress",$),()=>{D.off("keypress",$),C&&u.write(JD.cursor.show),D.isTTY&&!M9&&D.setRawMode(!1),E.terminal=!1,E.close()}}var I9=Object.defineProperty,j9=(D,u,F)=>(u in D)?I9(D,u,{enumerable:!0,configurable:!0,writable:!0,value:F}):D[u]=F,ID=(D,u,F)=>(j9(D,typeof u!="symbol"?u+"":u,F),F);class Pu{constructor(D,u=!0){ID(this,"input"),ID(this,"output"),ID(this,"_abortSignal"),ID(this,"rl"),ID(this,"opts"),ID(this,"_render"),ID(this,"_track",!1),ID(this,"_prevFrame",""),ID(this,"_subscribers",new Map),ID(this,"_cursor",0),ID(this,"state","initial"),ID(this,"error",""),ID(this,"value");let{input:F=Z8,output:C=Y8,render:E,signal:$,...B}=D;this.opts=B,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=E.bind(this),this._track=u,this._abortSignal=$,this.input=F,this.output=C}unsubscribe(){this._subscribers.clear()}setSubscriber(D,u){let F=this._subscribers.get(D)??[];F.push(u),this._subscribers.set(D,F)}on(D,u){this.setSubscriber(D,{cb:u})}once(D,u){this.setSubscriber(D,{cb:u,once:!0})}emit(D,...u){let F=this._subscribers.get(D)??[],C=[];for(let E of F)E.cb(...u),E.once&&C.push(()=>F.splice(F.indexOf(E),1));for(let E of C)E()}prompt(){return new Promise((D,u)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),D(pF);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let F=new $9;F._write=(C,E,$)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),$()},this.input.pipe(F),this.rl=u8.createInterface({input:this.input,output:F,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),u8.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),Nu(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(JD.cursor.show),this.output.off("resize",this.render),Nu(this.input,!1),D(this.value)}),this.once("cancel",()=>{this.output.write(JD.cursor.show),this.output.off("resize",this.render),Nu(this.input,!1),D(pF)})})}onKeypress(D,u){if(this.state==="error"&&(this.state="active"),u?.name&&(!this._track&&wu.aliases.has(u.name)&&this.emit("cursor",wu.aliases.get(u.name)),wu.actions.has(u.name)&&this.emit("cursor",u.name)),D&&(D.toLowerCase()==="y"||D.toLowerCase()==="n")&&this.emit("confirm",D.toLowerCase()==="y"),D==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),D&&this.emit("key",D.toLowerCase()),u?.name==="return"){if(this.opts.validate){let F=this.opts.validate(this.value);F&&(this.error=F instanceof Error?F.message:F,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}rF([D,u?.name,u?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
`),Nu(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let D=Q8(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
`).length-1;this.output.write(JD.cursor.move(-999,D*-1))}render(){let D=Q8(this._render(this)??"",process.stdout.columns,{hard:!0});if(D!==this._prevFrame){if(this.state==="initial")this.output.write(JD.cursor.hide);else{let u=R9(this._prevFrame,D);if(this.restoreCursor(),u&&u?.length===1){let F=u[0];this.output.write(JD.cursor.move(0,F)),this.output.write(JD.erase.lines(1));let C=D.split(`
`);this.output.write(C[F]),this._prevFrame=D,this.output.write(JD.cursor.move(0,C.length-F-1));return}if(u&&u?.length>1){let F=u[0];this.output.write(JD.cursor.move(0,F)),this.output.write(JD.erase.down());let C=D.split(`
`).slice(F);this.output.write(C.join(`
`)),this._prevFrame=D;return}this.output.write(JD.erase.down())}this.output.write(D),this.state==="initial"&&(this.state="active"),this._prevFrame=D}}}class iF extends Pu{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(D){super(D,!1),this.value=!!D.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(u)=>{this.output.write(JD.cursor.move(0,-1)),this.value=u,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var O9;O9=new WeakMap;var T9=Object.defineProperty,N9=(D,u,F)=>(u in D)?T9(D,u,{enumerable:!0,configurable:!0,writable:!0,value:F}):D[u]=F,X8=(D,u,F)=>(N9(D,typeof u!="symbol"?u+"":u,F),F);class oF extends Pu{constructor(D){super(D,!1),X8(this,"options"),X8(this,"cursor",0),this.options=D.options,this.cursor=this.options.findIndex(({value:u})=>u===D.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(u)=>{switch(u){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}class sF extends Pu{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}`;let D=this.value.slice(0,this.cursor),[u,...F]=this.value.slice(this.cursor);return`${D}${J8.default.inverse(u)}${F.join("")}`}get cursor(){return this._cursor}constructor(D){super(D),this.on("finalize",()=>{this.value||(this.value=D.defaultValue)})}}var O=lD(cF(),1),Su=lD(gF(),1);import pD from"node:process";function w9(){return pD.platform!=="win32"?pD.env.TERM!=="linux":!!pD.env.CI||!!pD.env.WT_SESSION||!!pD.env.TERMINUS_SUBLIME||pD.env.ConEmuTask==="{cmd::Cmder}"||pD.env.TERM_PROGRAM==="Terminus-Sublime"||pD.env.TERM_PROGRAM==="vscode"||pD.env.TERM==="xterm-256color"||pD.env.TERM==="alacritty"||pD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var tF=w9(),t=(D,u)=>tF?D:u,k9=t("◆","*"),U8=t("■","x"),_8=t("▲","x"),u2=t("◇","o"),zQ=t("┌","T"),r=t("│","|"),l0=t("└","—"),eF=t("●",">"),D2=t("○"," "),UQ=t("◻","[•]"),_Q=t("◼","[+]"),WQ=t("◻","[ ]"),GQ=t("▪","•"),LQ=t("─","-"),RQ=t("╮","+"),MQ=t("├","+"),IQ=t("╯","+"),P9=t("●","•"),S9=t("◆","*"),x9=t("▲","!"),b9=t("■","x"),F2=(D)=>{switch(D){case"initial":case"active":return O.default.cyan(k9);case"cancel":return O.default.red(U8);case"error":return O.default.yellow(_8);case"submit":return O.default.green(u2)}},v9=(D)=>{let{cursor:u,options:F,style:C}=D,E=D.maxItems??Number.POSITIVE_INFINITY,$=Math.max(process.stdout.rows-4,0),B=Math.min($,Math.max(E,5)),Q=0;u>=Q+B-3?Q=Math.max(Math.min(u-B+3,F.length-B),0):u<Q+2&&(Q=Math.max(u-2,0));let X=B<F.length&&Q>0,Z=B<F.length&&Q+B<F.length;return F.slice(Q,Q+B).map((Y,J,H)=>{let A=J===0&&X,z=J===H.length-1&&Z;return A||z?O.default.dim("..."):C(Y,J+Q===u)})},W8=(D)=>new sF({validate:D.validate,placeholder:D.placeholder,defaultValue:D.defaultValue,initialValue:D.initialValue,render(){let u=`${O.default.gray(r)}
${F2(this.state)} ${D.message}
`,F=D.placeholder?O.default.inverse(D.placeholder[0])+O.default.dim(D.placeholder.slice(1)):O.default.inverse(O.default.hidden("_")),C=this.value?this.valueWithCursor:F;switch(this.state){case"error":return`${u.trim()}
${O.default.yellow(r)} ${C}
${O.default.yellow(l0)} ${O.default.yellow(this.error)}
`;case"submit":return`${u}${O.default.gray(r)} ${O.default.dim(this.value||D.placeholder)}`;case"cancel":return`${u}${O.default.gray(r)} ${O.default.strikethrough(O.default.dim(this.value??""))}${this.value?.trim()?`
${O.default.gray(r)}`:""}`;default:return`${u}${O.default.cyan(r)} ${C}
${O.default.cyan(l0)}
`}}}).prompt();var O0=(D)=>{let u=D.active??"Yes",F=D.inactive??"No";return new iF({active:u,inactive:F,initialValue:D.initialValue??!0,render(){let C=`${O.default.gray(r)}
${F2(this.state)} ${D.message}
`,E=this.value?u:F;switch(this.state){case"submit":return`${C}${O.default.gray(r)} ${O.default.dim(E)}`;case"cancel":return`${C}${O.default.gray(r)} ${O.default.strikethrough(O.default.dim(E))}
${O.default.gray(r)}`;default:return`${C}${O.default.cyan(r)} ${this.value?`${O.default.green(eF)} ${u}`:`${O.default.dim(D2)} ${O.default.dim(u)}`} ${O.default.dim("/")} ${this.value?`${O.default.dim(D2)} ${O.default.dim(F)}`:`${O.default.green(eF)} ${F}`}
${O.default.cyan(l0)}
`}}}).prompt()},xu=(D)=>{let u=(F,C)=>{let E=F.label??String(F.value);switch(C){case"selected":return`${O.default.dim(E)}`;case"active":return`${O.default.green(eF)} ${E} ${F.hint?O.default.dim(`(${F.hint})`):""}`;case"cancelled":return`${O.default.strikethrough(O.default.dim(E))}`;default:return`${O.default.dim(D2)} ${O.default.dim(E)}`}};return new oF({options:D.options,initialValue:D.initialValue,render(){let F=`${O.default.gray(r)}
${F2(this.state)} ${D.message}
`;switch(this.state){case"submit":return`${F}${O.default.gray(r)} ${u(this.options[this.cursor],"selected")}`;case"cancel":return`${F}${O.default.gray(r)} ${u(this.options[this.cursor],"cancelled")}
${O.default.gray(r)}`;default:return`${F}${O.default.cyan(r)} ${v9({cursor:this.cursor,options:this.options,maxItems:D.maxItems,style:(C,E)=>u(C,E?"active":"inactive")}).join(`
${O.default.cyan(r)} `)}
${O.default.cyan(l0)}
`}}}).prompt()};var T0=(D="")=>{process.stdout.write(`${O.default.gray(l0)} ${O.default.red(D)}
`)};var AD={message:(D="",{symbol:u=O.default.gray(r)}={})=>{let F=[`${O.default.gray(r)}`];if(D){let[C,...E]=D.split(`
`);F.push(`${u} ${C}`,...E.map(($)=>`${O.default.gray(r)} ${$}`))}process.stdout.write(`${F.join(`
`)}
`)},info:(D)=>{AD.message(D,{symbol:O.default.blue(P9)})},success:(D)=>{AD.message(D,{symbol:O.default.green(S9)})},step:(D)=>{AD.message(D,{symbol:O.default.green(u2)})},warn:(D)=>{AD.message(D,{symbol:O.default.yellow(x9)})},warning:(D)=>{AD.warn(D)},error:(D)=>{AD.message(D,{symbol:O.default.red(b9)})}},jQ=`${O.default.gray(r)} `;var G8=({indicator:D="dots"}={})=>{let u=tF?["◒","◐","◓","◑"]:["•","o","O","0"],F=tF?80:120,C=process.env.CI==="true",E,$,B=!1,Q="",X,Z=performance.now(),Y=(M)=>{let k=M>1?"Something went wrong":"Canceled";B&&R(k,M)},J=()=>Y(2),H=()=>Y(1),A=()=>{process.on("uncaughtExceptionMonitor",J),process.on("unhandledRejection",J),process.on("SIGINT",H),process.on("SIGTERM",H),process.on("exit",Y)},z=()=>{process.removeListener("uncaughtExceptionMonitor",J),process.removeListener("unhandledRejection",J),process.removeListener("SIGINT",H),process.removeListener("SIGTERM",H),process.removeListener("exit",Y)},U=()=>{if(X===void 0)return;C&&process.stdout.write(`
`);let M=X.split(`
`);process.stdout.write(Su.cursor.move(-999,M.length-1)),process.stdout.write(Su.erase.down(M.length))},W=(M)=>M.replace(/\.+$/,""),I=(M)=>{let k=(performance.now()-M)/1000,x=Math.floor(k/60),HD=Math.floor(k%60);return x>0?`[${x}m ${HD}s]`:`[${HD}s]`},T=(M="")=>{B=!0,E=z8(),Q=W(M),Z=performance.now(),process.stdout.write(`${O.default.gray(r)}
`);let k=0,x=0;A(),$=setInterval(()=>{if(C&&Q===X)return;U(),X=Q;let HD=O.default.magenta(u[k]);if(C)process.stdout.write(`${HD} ${Q}...`);else if(D==="timer")process.stdout.write(`${HD} ${Q} ${I(Z)}`);else{let kD=".".repeat(Math.floor(x)).slice(0,3);process.stdout.write(`${HD} ${Q}${kD}`)}k=k+1<u.length?k+1:0,x=x<u.length?x+0.125:0},F)},R=(M="",k=0)=>{B=!1,clearInterval($),U();let x=k===0?O.default.green(u2):k===1?O.default.red(U8):O.default.red(_8);Q=W(M??Q),D==="timer"?process.stdout.write(`${x} ${Q} ${I(Z)}
`):process.stdout.write(`${x} ${Q}
`),z(),E()};return{start:T,stop:R,message:(M="")=>{Q=W(M??Q)}}};var L8=(D=0)=>(u)=>`\x1B[${u+D}m`,R8=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,M8=(D=0)=>(u,F,C)=>`\x1B[${38+D};2;${u};${F};${C}m`,l={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],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],gray:[90,39],grey:[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],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},TQ=Object.keys(l.modifier),y9=Object.keys(l.color),f9=Object.keys(l.bgColor),NQ=[...y9,...f9];function h9(){let D=new Map;for(let[u,F]of Object.entries(l)){for(let[C,E]of Object.entries(F))l[C]={open:`\x1B[${E[0]}m`,close:`\x1B[${E[1]}m`},F[C]=l[C],D.set(E[0],E[1]);Object.defineProperty(l,u,{value:F,enumerable:!1})}return Object.defineProperty(l,"codes",{value:D,enumerable:!1}),l.color.close="\x1B[39m",l.bgColor.close="\x1B[49m",l.color.ansi=L8(),l.color.ansi256=R8(),l.color.ansi16m=M8(),l.bgColor.ansi=L8(10),l.bgColor.ansi256=R8(10),l.bgColor.ansi16m=M8(10),Object.defineProperties(l,{rgbToAnsi256:{value(u,F,C){if(u===F&&F===C){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(C/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[C]=F;if(C.length===3)C=[...C].map(($)=>$+$).join("");let E=Number.parseInt(C,16);return[E>>16&255,E>>8&255,E&255]},enumerable:!1},hexToAnsi256:{value:(u)=>l.rgbToAnsi256(...l.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,C,E;if(u>=232)F=((u-232)*10+8)/255,C=F,E=F;else{u-=16;let Q=u%36;F=Math.floor(u/36)/5,C=Math.floor(Q/6)/5,E=Q%6/5}let $=Math.max(F,C,E)*2;if($===0)return 30;let B=30+(Math.round(E)<<2|Math.round(C)<<1|Math.round(F));if($===2)B+=60;return B},enumerable:!1},rgbToAnsi:{value:(u,F,C)=>l.ansi256ToAnsi(l.rgbToAnsi256(u,F,C)),enumerable:!1},hexToAnsi:{value:(u)=>l.ansi256ToAnsi(l.hexToAnsi256(u)),enumerable:!1}}),l}var g9=h9(),nD=g9;import C2 from"node:process";import m9 from"node:os";import I8 from"node:tty";function xD(D,u=globalThis.Deno?globalThis.Deno.args:C2.argv){let F=D.startsWith("-")?"":D.length===1?"-":"--",C=u.indexOf(F+D),E=u.indexOf("--");return C!==-1&&(E===-1||C<E)}var{env:p}=C2,vu;if(xD("no-color")||xD("no-colors")||xD("color=false")||xD("color=never"))vu=0;else if(xD("color")||xD("colors")||xD("color=true")||xD("color=always"))vu=1;function c9(){if("FORCE_COLOR"in p){if(p.FORCE_COLOR==="true")return 1;if(p.FORCE_COLOR==="false")return 0;return p.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(p.FORCE_COLOR,10),3)}}function d9(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function l9(D,{streamIsTTY:u,sniffFlags:F=!0}={}){let C=c9();if(C!==void 0)vu=C;let E=F?vu:C;if(E===0)return 0;if(F){if(xD("color=16m")||xD("color=full")||xD("color=truecolor"))return 3;if(xD("color=256"))return 2}if("TF_BUILD"in p&&"AGENT_NAME"in p)return 1;if(D&&!u&&E===void 0)return 0;let $=E||0;if(p.TERM==="dumb")return $;if(C2.platform==="win32"){let B=m9.release().split(".");if(Number(B[0])>=10&&Number(B[2])>=10586)return Number(B[2])>=14931?3:2;return 1}if("CI"in p){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((B)=>(B in p)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((B)=>(B in p))||p.CI_NAME==="codeship")return 1;return $}if("TEAMCITY_VERSION"in p)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(p.TEAMCITY_VERSION)?1:0;if(p.COLORTERM==="truecolor")return 3;if(p.TERM==="xterm-kitty")return 3;if(p.TERM==="xterm-ghostty")return 3;if(p.TERM==="wezterm")return 3;if("TERM_PROGRAM"in p){let B=Number.parseInt((p.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(p.TERM_PROGRAM){case"iTerm.app":return B>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(p.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(p.TERM))return 1;if("COLORTERM"in p)return 1;return $}function j8(D,u={}){let F=l9(D,{streamIsTTY:D&&D.isTTY,...u});return d9(F)}var p9={stdout:j8({isTTY:I8.isatty(1)}),stderr:j8({isTTY:I8.isatty(2)})},O8=p9;function T8(D,u,F){let C=D.indexOf(u);if(C===-1)return D;let E=u.length,$=0,B="";do B+=D.slice($,C)+u+F,$=C+E,C=D.indexOf(u,$);while(C!==-1);return B+=D.slice($),B}function N8(D,u,F,C){let E=0,$="";do{let B=D[C-1]==="\r";$+=D.slice(E,B?C-1:C)+u+(B?`\r
`:`
`)+F,E=C+1,C=D.indexOf(`
`,E)}while(C!==-1);return $+=D.slice(E),$}var{stdout:w8,stderr:k8}=O8,E2=Symbol("GENERATOR"),N0=Symbol("STYLER"),p0=Symbol("IS_EMPTY"),P8=["ansi","ansi","ansi256","ansi16m"],w0=Object.create(null),n9=(D,u={})=>{if(u.level&&!(Number.isInteger(u.level)&&u.level>=0&&u.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let F=w8?w8.level:0;D.level=u.level===void 0?F:u.level};var a9=(D)=>{let u=(...F)=>F.join(" ");return n9(u,D),Object.setPrototypeOf(u,n0.prototype),u};function n0(D){return a9(D)}Object.setPrototypeOf(n0.prototype,Function.prototype);for(let[D,u]of Object.entries(nD))w0[D]={get(){let F=yu(this,$2(u.open,u.close,this[N0]),this[p0]);return Object.defineProperty(this,D,{value:F}),F}};w0.visible={get(){let D=yu(this,this[N0],!0);return Object.defineProperty(this,"visible",{value:D}),D}};var B2=(D,u,F,...C)=>{if(D==="rgb"){if(u==="ansi16m")return nD[F].ansi16m(...C);if(u==="ansi256")return nD[F].ansi256(nD.rgbToAnsi256(...C));return nD[F].ansi(nD.rgbToAnsi(...C))}if(D==="hex")return B2("rgb",u,F,...nD.hexToRgb(...C));return nD[F][D](...C)},r9=["rgb","hex","ansi256"];for(let D of r9){w0[D]={get(){let{level:F}=this;return function(...C){let E=$2(B2(D,P8[F],"color",...C),nD.color.close,this[N0]);return yu(this,E,this[p0])}}};let u="bg"+D[0].toUpperCase()+D.slice(1);w0[u]={get(){let{level:F}=this;return function(...C){let E=$2(B2(D,P8[F],"bgColor",...C),nD.bgColor.close,this[N0]);return yu(this,E,this[p0])}}}}var i9=Object.defineProperties(()=>{},{...w0,level:{enumerable:!0,get(){return this[E2].level},set(D){this[E2].level=D}}}),$2=(D,u,F)=>{let C,E;if(F===void 0)C=D,E=u;else C=F.openAll+D,E=u+F.closeAll;return{open:D,close:u,openAll:C,closeAll:E,parent:F}},yu=(D,u,F)=>{let C=(...E)=>o9(C,E.length===1?""+E[0]:E.join(" "));return Object.setPrototypeOf(C,i9),C[E2]=D,C[N0]=u,C[p0]=F,C},o9=(D,u)=>{if(D.level<=0||!u)return D[p0]?"":u;let F=D[N0];if(F===void 0)return u;let{openAll:C,closeAll:E}=F;if(u.includes("\x1B"))while(F!==void 0)u=T8(u,F.close,F.open),F=F.parent;let $=u.indexOf(`
`);if($!==-1)u=N8(u,E,C,$);return C+u+E};Object.defineProperties(n0.prototype,w0);var s9=n0(),hQ=n0({level:k8?k8.level:0});var S=s9;var K2=lD(g8(),1),KD=(...D)=>{let u,F;if(D.length===0)throw new Error("Missing gradient colors");if(!Array.isArray(D[0])){if(D.length===1)throw new Error(`Expected an array of colors, received ${JSON.stringify(D[0])}`);u=K2.default(...D)}else u=K2.default(D[0]),F=q2(D[1]);let C=(E,$)=>{return t9(E?E.toString():"",u,$??F)};return C.multiline=(E,$)=>e9(E?E.toString():"",u,$??F),C},m8=(D,u,F)=>{return u.interpolation?.toLowerCase()==="hsv"?D.hsv(F,u.hsvSpin?.toLowerCase()||!1):D.rgb(F)};function t9(D,u,F){let C=q2(F),E=Math.max(D.replace(/\s/g,"").length,u.stops.length),$=m8(u,C,E),B="";for(let Q of D)B+=Q.match(/\s/g)?Q:S.hex($.shift()?.toHex()||"#000")(Q);return B}function e9(D,u,F){let C=q2(F),E=D.split(`
`),$=Math.max(...E.map((X)=>X.length),u.stops.length),B=m8(u,C,$),Q=[];for(let X of E){let Z=B.slice(0),Y="";for(let J of X)Y+=S.hex(Z.shift()?.toHex()||"#000")(J);Q.push(Y)}return Q.join(`
`)}function q2(D){let u={interpolation:"rgb",hsvSpin:"short",...D};if(D!==void 0&&typeof D!=="object")throw new TypeError(`Expected \`options\` to be an \`object\`, got \`${typeof D}\``);if(typeof u.interpolation!=="string")throw new TypeError(`Expected \`options.interpolation\` to be \`rgb\` or \`hsv\`, got \`${typeof u.interpolation}\``);if(u.interpolation.toLowerCase()==="hsv"&&typeof u.hsvSpin!=="string")throw new TypeError(`Expected \`options.hsvSpin\` to be a \`short\` or \`long\`, got \`${typeof u.hsvSpin}\``);return u}var jD={atlas:{colors:["#feac5e","#c779d0","#4bc0c8"],options:{}},cristal:{colors:["#bdfff3","#4ac29a"],options:{}},teen:{colors:["#77a1d3","#79cbca","#e684ae"],options:{}},mind:{colors:["#473b7b","#3584a7","#30d2be"],options:{}},morning:{colors:["#ff5f6d","#ffc371"],options:{interpolation:"hsv"}},vice:{colors:["#5ee7df","#b490ca"],options:{interpolation:"hsv"}},passion:{colors:["#f43b47","#453a94"],options:{}},fruit:{colors:["#ff4e50","#f9d423"],options:{}},instagram:{colors:["#833ab4","#fd1d1d","#fcb045"],options:{}},retro:{colors:["#3f51b1","#5a55ae","#7b5fac","#8f6aae","#a86aa4","#cc6b8e","#f18271","#f3a469","#f7c978"],options:{}},summer:{colors:["#fdbb2d","#22c1c3"],options:{}},rainbow:{colors:["#ff0000","#ff0100"],options:{interpolation:"hsv",hsvSpin:"long"}},pastel:{colors:["#74ebd5","#74ecd5"],options:{interpolation:"hsv",hsvSpin:"long"}}};function OD(D){let u=(F)=>KD(...D.colors)(F,D.options);return u.multiline=(F="")=>KD(...D.colors).multiline(F,D.options),u}var V2=KD,DE=OD(jD.atlas),uE=OD(jD.cristal),FE=OD(jD.teen),CE=OD(jD.mind),EE=OD(jD.morning),BE=OD(jD.vice),$E=OD(jD.passion),QE=OD(jD.fruit),XE=OD(jD.instagram),ZE=OD(jD.retro),YE=OD(jD.summer),JE=OD(jD.rainbow),KE=OD(jD.pastel);KD.atlas=DE;KD.cristal=uE;KD.teen=FE;KD.mind=CE;KD.morning=EE;KD.vice=BE;KD.passion=$E;KD.fruit=QE;KD.instagram=XE;KD.retro=ZE;KD.summer=YE;KD.rainbow=JE;KD.pastel=KE;import du from"node:process";function H2({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}var qE=H2();function r0(D){if(typeof D!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(qE,"")}function c8(D){return D===161||D===164||D===167||D===168||D===170||D===173||D===174||D>=176&&D<=180||D>=182&&D<=186||D>=188&&D<=191||D===198||D===208||D===215||D===216||D>=222&&D<=225||D===230||D>=232&&D<=234||D===236||D===237||D===240||D===242||D===243||D>=247&&D<=250||D===252||D===254||D===257||D===273||D===275||D===283||D===294||D===295||D===299||D>=305&&D<=307||D===312||D>=319&&D<=322||D===324||D>=328&&D<=331||D===333||D===338||D===339||D===358||D===359||D===363||D===462||D===464||D===466||D===468||D===470||D===472||D===474||D===476||D===593||D===609||D===708||D===711||D>=713&&D<=715||D===717||D===720||D>=728&&D<=731||D===733||D===735||D>=768&&D<=879||D>=913&&D<=929||D>=931&&D<=937||D>=945&&D<=961||D>=963&&D<=969||D===1025||D>=1040&&D<=1103||D===1105||D===8208||D>=8211&&D<=8214||D===8216||D===8217||D===8220||D===8221||D>=8224&&D<=8226||D>=8228&&D<=8231||D===8240||D===8242||D===8243||D===8245||D===8251||D===8254||D===8308||D===8319||D>=8321&&D<=8324||D===8364||D===8451||D===8453||D===8457||D===8467||D===8470||D===8481||D===8482||D===8486||D===8491||D===8531||D===8532||D>=8539&&D<=8542||D>=8544&&D<=8555||D>=8560&&D<=8569||D===8585||D>=8592&&D<=8601||D===8632||D===8633||D===8658||D===8660||D===8679||D===8704||D===8706||D===8707||D===8711||D===8712||D===8715||D===8719||D===8721||D===8725||D===8730||D>=8733&&D<=8736||D===8739||D===8741||D>=8743&&D<=8748||D===8750||D>=8756&&D<=8759||D===8764||D===8765||D===8776||D===8780||D===8786||D===8800||D===8801||D>=8804&&D<=8807||D===8810||D===8811||D===8814||D===8815||D===8834||D===8835||D===8838||D===8839||D===8853||D===8857||D===8869||D===8895||D===8978||D>=9312&&D<=9449||D>=9451&&D<=9547||D>=9552&&D<=9587||D>=9600&&D<=9615||D>=9618&&D<=9621||D===9632||D===9633||D>=9635&&D<=9641||D===9650||D===9651||D===9654||D===9655||D===9660||D===9661||D===9664||D===9665||D>=9670&&D<=9672||D===9675||D>=9678&&D<=9681||D>=9698&&D<=9701||D===9711||D===9733||D===9734||D===9737||D===9742||D===9743||D===9756||D===9758||D===9792||D===9794||D===9824||D===9825||D>=9827&&D<=9829||D>=9831&&D<=9834||D===9836||D===9837||D===9839||D===9886||D===9887||D===9919||D>=9926&&D<=9933||D>=9935&&D<=9939||D>=9941&&D<=9953||D===9955||D===9960||D===9961||D>=9963&&D<=9969||D===9972||D>=9974&&D<=9977||D===9979||D===9980||D===9982||D===9983||D===10045||D>=10102&&D<=10111||D>=11094&&D<=11097||D>=12872&&D<=12879||D>=57344&&D<=63743||D>=65024&&D<=65039||D===65533||D>=127232&&D<=127242||D>=127248&&D<=127277||D>=127280&&D<=127337||D>=127344&&D<=127373||D===127375||D===127376||D>=127387&&D<=127404||D>=917760&&D<=917999||D>=983040&&D<=1048573||D>=1048576&&D<=1114109}function d8(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function l8(D){return D>=4352&&D<=4447||D===8986||D===8987||D===9001||D===9002||D>=9193&&D<=9196||D===9200||D===9203||D===9725||D===9726||D===9748||D===9749||D>=9776&&D<=9783||D>=9800&&D<=9811||D===9855||D>=9866&&D<=9871||D===9875||D===9889||D===9898||D===9899||D===9917||D===9918||D===9924||D===9925||D===9934||D===9940||D===9962||D===9970||D===9971||D===9973||D===9978||D===9981||D===9989||D===9994||D===9995||D===10024||D===10060||D===10062||D>=10067&&D<=10069||D===10071||D>=10133&&D<=10135||D===10160||D===10175||D===11035||D===11036||D===11088||D===11093||D>=11904&&D<=11929||D>=11931&&D<=12019||D>=12032&&D<=12245||D>=12272&&D<=12287||D>=12289&&D<=12350||D>=12353&&D<=12438||D>=12441&&D<=12543||D>=12549&&D<=12591||D>=12593&&D<=12686||D>=12688&&D<=12773||D>=12783&&D<=12830||D>=12832&&D<=12871||D>=12880&&D<=42124||D>=42128&&D<=42182||D>=43360&&D<=43388||D>=44032&&D<=55203||D>=63744&&D<=64255||D>=65040&&D<=65049||D>=65072&&D<=65106||D>=65108&&D<=65126||D>=65128&&D<=65131||D>=94176&&D<=94180||D>=94192&&D<=94198||D>=94208&&D<=101589||D>=101631&&D<=101662||D>=101760&&D<=101874||D>=110576&&D<=110579||D>=110581&&D<=110587||D===110589||D===110590||D>=110592&&D<=110882||D===110898||D>=110928&&D<=110930||D===110933||D>=110948&&D<=110951||D>=110960&&D<=111355||D>=119552&&D<=119638||D>=119648&&D<=119670||D===126980||D===127183||D===127374||D>=127377&&D<=127386||D>=127488&&D<=127490||D>=127504&&D<=127547||D>=127552&&D<=127560||D===127568||D===127569||D>=127584&&D<=127589||D>=127744&&D<=127776||D>=127789&&D<=127797||D>=127799&&D<=127868||D>=127870&&D<=127891||D>=127904&&D<=127946||D>=127951&&D<=127955||D>=127968&&D<=127984||D===127988||D>=127992&&D<=128062||D===128064||D>=128066&&D<=128252||D>=128255&&D<=128317||D>=128331&&D<=128334||D>=128336&&D<=128359||D===128378||D===128405||D===128406||D===128420||D>=128507&&D<=128591||D>=128640&&D<=128709||D===128716||D>=128720&&D<=128722||D>=128725&&D<=128728||D>=128732&&D<=128735||D===128747||D===128748||D>=128756&&D<=128764||D>=128992&&D<=129003||D===129008||D>=129292&&D<=129338||D>=129340&&D<=129349||D>=129351&&D<=129535||D>=129648&&D<=129660||D>=129664&&D<=129674||D>=129678&&D<=129734||D===129736||D>=129741&&D<=129756||D>=129759&&D<=129770||D>=129775&&D<=129784||D>=131072&&D<=196605||D>=196608&&D<=262141}function VE(D){if(!Number.isSafeInteger(D))throw new TypeError(`Expected a code point, got \`${typeof D}\`.`)}function p8(D,{ambiguousAsWide:u=!1}={}){if(VE(D),d8(D)||l8(D)||u&&c8(D))return 2;return 1}var r8=lD(a8(),1),HE=new Intl.Segmenter,AE=/^\p{Default_Ignorable_Code_Point}$/u;function zD(D,u={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:F=!0,countAnsiEscapeCodes:C=!1}=u;if(!C)D=r0(D);if(D.length===0)return 0;let E=0,$={ambiguousAsWide:!F};for(let{segment:B}of HE.segment(D)){let Q=B.codePointAt(0);if(Q<=31||Q>=127&&Q<=159)continue;if(Q>=8203&&Q<=8207||Q===65279)continue;if(Q>=768&&Q<=879||Q>=6832&&Q<=6911||Q>=7616&&Q<=7679||Q>=8400&&Q<=8447||Q>=65056&&Q<=65071)continue;if(Q>=55296&&Q<=57343)continue;if(Q>=65024&&Q<=65039)continue;if(AE.test(B))continue;if(r8.default().test(B)){E+=2;continue}E+=p8(Q,$)}return E}function hu(D){let u=0;for(let F of D.split(`
`))u=Math.max(u,zD(F));return u}var M6=lD(z2(),1);var UE=/[\p{Lu}]/u,_E=/[\p{Ll}]/u,s8=/^[\p{Lu}](?![\p{Lu}])/gu,D6=/([\p{Alpha}\p{N}_]|$)/u,U2=/[_.\- ]+/,WE=new RegExp("^"+U2.source),t8=new RegExp(U2.source+D6.source,"gu"),e8=new RegExp("\\d+"+D6.source,"gu"),GE=(D,u,F,C)=>{let E=!1,$=!1,B=!1,Q=!1;for(let X=0;X<D.length;X++){let Z=D[X];if(Q=X>2?D[X-3]==="-":!0,E&&UE.test(Z))D=D.slice(0,X)+"-"+D.slice(X),E=!1,B=$,$=!0,X++;else if($&&B&&_E.test(Z)&&(!Q||C))D=D.slice(0,X-1)+"-"+D.slice(X-1),B=$,$=!1,E=!0;else E=u(Z)===Z&&F(Z)!==Z,B=$,$=F(Z)===Z&&u(Z)!==Z}return D},LE=(D,u)=>{return s8.lastIndex=0,D.replaceAll(s8,(F)=>u(F))},RE=(D,u)=>{return t8.lastIndex=0,e8.lastIndex=0,D.replaceAll(e8,(F,C,E)=>["_","-"].includes(D.charAt(E+F.length))?F:u(F)).replaceAll(t8,(F,C)=>u(C))};function _2(D,u){if(!(typeof D==="string"||Array.isArray(D)))throw new TypeError("Expected the input to be `string | string[]`");if(u={pascalCase:!1,preserveConsecutiveUppercase:!1,...u},Array.isArray(D))D=D.map(($)=>$.trim()).filter(($)=>$.length).join("-");else D=D.trim();if(D.length===0)return"";let F=u.locale===!1?($)=>$.toLowerCase():($)=>$.toLocaleLowerCase(u.locale),C=u.locale===!1?($)=>$.toUpperCase():($)=>$.toLocaleUpperCase(u.locale);if(D.length===1){if(U2.test(D))return"";return u.pascalCase?C(D):F(D)}if(D!==F(D))D=GE(D,F,C,u.preserveConsecutiveUppercase);if(D=D.replace(WE,""),D=u.preserveConsecutiveUppercase?LE(D,F):F(D),u.pascalCase)D=C(D.charAt(0))+D.slice(1);return RE(D,C)}var M2=lD(K6(),1);var q6=(D=0)=>(u)=>`\x1B[${u+D}m`,V6=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,H6=(D=0)=>(u,F,C)=>`\x1B[${38+D};2;${u};${F};${C}m`,n={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],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],gray:[90,39],grey:[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],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},KX=Object.keys(n.modifier),kE=Object.keys(n.color),PE=Object.keys(n.bgColor),qX=[...kE,...PE];function SE(){let D=new Map;for(let[u,F]of Object.entries(n)){for(let[C,E]of Object.entries(F))n[C]={open:`\x1B[${E[0]}m`,close:`\x1B[${E[1]}m`},F[C]=n[C],D.set(E[0],E[1]);Object.defineProperty(n,u,{value:F,enumerable:!1})}return Object.defineProperty(n,"codes",{value:D,enumerable:!1}),n.color.close="\x1B[39m",n.bgColor.close="\x1B[49m",n.color.ansi=q6(),n.color.ansi256=V6(),n.color.ansi16m=H6(),n.bgColor.ansi=q6(10),n.bgColor.ansi256=V6(10),n.bgColor.ansi16m=H6(10),Object.defineProperties(n,{rgbToAnsi256:{value(u,F,C){if(u===F&&F===C){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(C/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[C]=F;if(C.length===3)C=[...C].map(($)=>$+$).join("");let E=Number.parseInt(C,16);return[E>>16&255,E>>8&255,E&255]},enumerable:!1},hexToAnsi256:{value:(u)=>n.rgbToAnsi256(...n.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,C,E;if(u>=232)F=((u-232)*10+8)/255,C=F,E=F;else{u-=16;let Q=u%36;F=Math.floor(u/36)/5,C=Math.floor(Q/6)/5,E=Q%6/5}let $=Math.max(F,C,E)*2;if($===0)return 30;let B=30+(Math.round(E)<<2|Math.round(C)<<1|Math.round(F));if($===2)B+=60;return B},enumerable:!1},rgbToAnsi:{value:(u,F,C)=>n.ansi256ToAnsi(n.rgbToAnsi256(u,F,C)),enumerable:!1},hexToAnsi:{value:(u)=>n.ansi256ToAnsi(n.hexToAnsi256(u)),enumerable:!1}}),n}var xE=SE(),A6=xE;var mu=new Set(["\x1B","›"]),bE=39,R2="\x07",_6="[",vE="]",W6="m",gu=`${vE}8;;`,z6=(D)=>`${mu.values().next().value}${_6}${D}${W6}`,U6=(D)=>`${mu.values().next().value}${gu}${D}${R2}`,yE=(D)=>D.split(" ").map((u)=>zD(u)),L2=(D,u,F)=>{let C=[...u],E=!1,$=!1,B=zD(r0(D.at(-1)));for(let[Q,X]of C.entries()){let Z=zD(X);if(B+Z<=F)D[D.length-1]+=X;else D.push(X),B=0;if(mu.has(X))E=!0,$=C.slice(Q+1,Q+1+gu.length).join("")===gu;if(E){if($){if(X===R2)E=!1,$=!1}else if(X===W6)E=!1;continue}if(B+=Z,B===F&&Q<C.length-1)D.push(""),B=0}if(!B&&D.at(-1).length>0&&D.length>1)D[D.length-2]+=D.pop()},fE=(D)=>{let u=D.split(" "),F=u.length;while(F>0){if(zD(u[F-1])>0)break;F--}if(F===u.length)return D;return u.slice(0,F).join(" ")+u.slice(F).join("")},hE=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let C="",E,$,B=yE(D),Q=[""];for(let[J,H]of D.split(" ").entries()){if(F.trim!==!1)Q[Q.length-1]=Q.at(-1).trimStart();let A=zD(Q.at(-1));if(J!==0){if(A>=u&&(F.wordWrap===!1||F.trim===!1))Q.push(""),A=0;if(A>0||F.trim===!1)Q[Q.length-1]+=" ",A++}if(F.hard&&B[J]>u){let z=u-A,U=1+Math.floor((B[J]-z-1)/u);if(Math.floor((B[J]-1)/u)<U)Q.push("");L2(Q,H,u);continue}if(A+B[J]>u&&A>0&&B[J]>0){if(F.wordWrap===!1&&A<u){L2(Q,H,u);continue}Q.push("")}if(A+B[J]>u&&F.wordWrap===!1){L2(Q,H,u);continue}Q[Q.length-1]+=H}if(F.trim!==!1)Q=Q.map((J)=>fE(J));let X=Q.join(`
`),Z=[...X],Y=0;for(let[J,H]of Z.entries()){if(C+=H,mu.has(H)){let{groups:z}=new RegExp(`(?:\\${_6}(?<code>\\d+)m|\\${gu}(?<uri>.*)${R2})`).exec(X.slice(Y))||{groups:{}};if(z.code!==void 0){let U=Number.parseFloat(z.code);E=U===bE?void 0:U}else if(z.uri!==void 0)$=z.uri.length===0?void 0:z.uri}let A=A6.codes.get(Number(E));if(Z[J+1]===`
`){if($)C+=U6("");if(E&&A)C+=z6(A)}else if(H===`
`){if(E&&A)C+=z6(E);if($)C+=U6($)}Y+=H.length}return C};function cu(D,u,F){return String(D).normalize().replaceAll(`\r
`,`
`).split(`
`).map((C)=>hE(C,u,F)).join(`
`)}var rE=lD(z2(),1),J0=`
`,TD=" ",i0="none",I6=()=>{let{env:D,stdout:u,stderr:F}=du;if(u?.columns)return u.columns;if(F?.columns)return F.columns;if(D.COLUMNS)return Number.parseInt(D.COLUMNS,10);return 80},G6=(D)=>typeof D==="number"?{top:D,right:D*3,bottom:D,left:D*3}:{top:0,right:0,bottom:0,left:0,...D},o0=(D)=>D===i0?0:2,gE=(D)=>{let u=["topLeft","topRight","bottomRight","bottomLeft","left","right","top","bottom"],F;if(D===i0){D={};for(let C of u)D[C]=""}if(typeof D==="string"){if(F=M6.default[D],!F)throw new TypeError(`Invalid border style: ${D}`)}else{if(typeof D?.vertical==="string")D.left=D.vertical,D.right=D.vertical;if(typeof D?.horizontal==="string")D.top=D.horizontal,D.bottom=D.horizontal;for(let C of u)if(D[C]===null||typeof D[C]!=="string")throw new TypeError(`Invalid border style: ${C}`);F=D}return F},mE=(D,u,F)=>{let C="",E=zD(D);switch(F){case"left":{C=D+u.slice(E);break}case"right":{C=u.slice(E)+D;break}default:{if(u=u.slice(E),u.length%2===1)u=u.slice(Math.floor(u.length/2)),C=u.slice(1)+D+u;else u=u.slice(u.length/2),C=u+D+u;break}}return C},cE=(D,{padding:u,width:F,textAlignment:C,height:E})=>{D=M2.default(D,{align:C});let $=D.split(J0),B=hu(D),Q=F-u.left-u.right;if(B>Q){let Y=[];for(let J of $){let H=cu(J,Q,{hard:!0}),z=M2.default(H,{align:C}).split(`
`),U=Math.max(...z.map((W)=>zD(W)));for(let W of z){let I;switch(C){case"center":{I=TD.repeat((Q-U)/2)+W;break}case"right":{I=TD.repeat(Q-U)+W;break}default:{I=W;break}}Y.push(I)}}$=Y}if(C==="center"&&B<Q)$=$.map((Y)=>TD.repeat((Q-B)/2)+Y);else if(C==="right"&&B<Q)$=$.map((Y)=>TD.repeat(Q-B)+Y);let X=TD.repeat(u.left),Z=TD.repeat(u.right);if($=$.map((Y)=>{let J=X+Y+Z;return J+TD.repeat(F-zD(J))}),u.top>0)$=[...Array.from({length:u.top}).fill(TD.repeat(F)),...$];if(u.bottom>0)$=[...$,...Array.from({length:u.bottom}).fill(TD.repeat(F))];if(E&&$.length>E)$=$.slice(0,E);else if(E&&$.length<E)$=[...$,...Array.from({length:E-$.length}).fill(TD.repeat(F))];return $.join(J0)},dE=(D,u,F)=>{let C=(Y)=>{let J=F.borderColor?nE(F.borderColor)(Y):Y;return F.dimBorder?S.dim(J):J},E=(Y)=>F.backgroundColor?aE(F.backgroundColor)(Y):Y,$=gE(F.borderStyle),B=I6(),Q=TD.repeat(F.margin.left);if(F.float==="center"){let Y=Math.max((B-u-o0(F.borderStyle))/2,0);Q=TD.repeat(Y)}else if(F.float==="right"){let Y=Math.max(B-u-F.margin.right-o0(F.borderStyle),0);Q=TD.repeat(Y)}let X="";if(F.margin.top)X+=J0.repeat(F.margin.top);if(F.borderStyle!==i0||F.title)X+=C(Q+$.topLeft+(F.title?mE(F.title,$.top.repeat(u),F.titleAlignment):$.top.repeat(u))+$.topRight)+J0;let Z=D.split(J0);if(X+=Z.map((Y)=>Q+C($.left)+E(Y)+C($.right)).join(J0),F.borderStyle!==i0)X+=J0+C(Q+$.bottomLeft+$.bottom.repeat(u)+$.bottomRight);if(F.margin.bottom)X+=J0.repeat(F.margin.bottom);return X},lE=(D)=>{if(D.fullscreen&&du?.stdout){let u=[du.stdout.columns,du.stdout.rows];if(typeof D.fullscreen==="function")u=D.fullscreen(...u);D.width||=u[0],D.height||=u[1]}return D.width&&=Math.max(1,D.width-o0(D.borderStyle)),D.height&&=Math.max(1,D.height-o0(D.borderStyle)),D},L6=(D,u)=>u===i0?D:` ${D} `,pE=(D,u)=>{u=lE(u);let F=u.width!==void 0,C=I6(),E=o0(u.borderStyle),$=C-u.margin.left-u.margin.right-E,B=hu(cu(D,C-E,{hard:!0,trim:!1}))+u.padding.left+u.padding.right;if(u.title&&F)u.title=u.title.slice(0,Math.max(0,u.width-2)),u.title&&=L6(u.title,u.borderStyle);else if(u.title){if(u.title=u.title.slice(0,Math.max(0,$-2)),u.title){if(u.title=L6(u.title,u.borderStyle),zD(u.title)>B)u.width=zD(u.title)}}if(u.width||=B,!F){if(u.margin.left&&u.margin.right&&u.width>$){let X=(C-u.width-E)/(u.margin.left+u.margin.right);u.margin.left=Math.max(0,Math.floor(u.margin.left*X)),u.margin.right=Math.max(0,Math.floor(u.margin.right*X))}u.width=Math.min(u.width,C-E-u.margin.left-u.margin.right)}if(u.width-(u.padding.left+u.padding.right)<=0)u.padding.left=0,u.padding.right=0;if(u.height&&u.height-(u.padding.top+u.padding.bottom)<=0)u.padding.top=0,u.padding.bottom=0;return u},I2=(D)=>D.match(/^#(?:[0-f]{3}){1,2}$/i),R6=(D)=>typeof D==="string"&&(S[D]??I2(D)),nE=(D)=>I2(D)?S.hex(D):S[D],aE=(D)=>I2(D)?S.bgHex(D):S[_2(["bg",D])];function lu(D,u){if(u={padding:0,borderStyle:"single",dimBorder:!1,textAlignment:"left",float:"left",titleAlignment:"left",...u},u.align)u.textAlignment=u.align;if(u.borderColor&&!R6(u.borderColor))throw new Error(`${u.borderColor} is not a valid borderColor`);if(u.backgroundColor&&!R6(u.backgroundColor))throw new Error(`${u.backgroundColor} is not a valid backgroundColor`);return u.padding=G6(u.padding),u.margin=G6(u.margin),u=pE(D,u),D=cE(D,u),dE(D,u.width,u)}UD();import{platform as tE,homedir as eE}from"os";import{execSync as O2}from"child_process";import{chmodSync as DB}from"fs";import{join as t0}from"path";var K0=tE()==="win32",_0={getShell:()=>{return K0?"powershell":"/bin/sh"},getHookExtension:()=>{return".js"},findExecutable:(D)=>{let u=K0?`where ${D}`:`which ${D}`;return O2(u,{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()},makeExecutable:(D)=>{if(!K0)DB(D,493)},installUv:()=>{if(K0)O2('powershell -Command "irm https://astral.sh/uv/install.ps1 | iex"',{stdio:"pipe"});else O2("curl -LsSf https://astral.sh/uv/install.sh | sh",{stdio:"pipe",shell:"/bin/sh"})},getShellConfigPaths:()=>{let D=eE();if(K0)return[t0(D,"Documents","PowerShell","Microsoft.PowerShell_profile.ps1"),t0(D,"Documents","WindowsPowerShell","Microsoft.PowerShell_profile.ps1")];return[t0(D,".bashrc"),t0(D,".zshrc"),t0(D,".bash_profile")]},getAliasDefinition:(D,u)=>{if(K0)return`function ${D} { ${u} $args }`;return`alias ${D}='${u}'`},isWindows:()=>K0,isUnix:()=>!K0};function CB(D){let u,F=0,C=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];return{start(){u=setInterval(()=>{process.stdout.write(`\r${S.cyan(C[F%C.length])} ${D}`),F++},50)},stop(E,$=!0){clearInterval(u);let B=$?S.green("✓"):S.red("✗");process.stdout.write(`\r${B} ${E}
`)}}}var O6=(D)=>new Promise((u)=>setTimeout(u,D)),e0=V2(["#ff0000","#ff4500","#ffa500","#ffff00","#00ff00","#00ffff","#0000ff","#8b00ff"]),T2=V2(["#ff006e","#fb5607","#ffbe0b","#8338ec","#3a86ff"]);function EB(){_0.installUv(),process.env.PATH=`${T6()}/.cargo/bin:${process.env.PATH}`}function BB(){return _0.findExecutable("claude")}function $B(){let D=P.getInstance();return bD(D.getHooksDirectory())}async function QB(D){let u={};if(D){let $=await O0({message:`\uD83E\uDDE0 Existing claude-mem installation detected. Your memories and data are safe!
Reinstall to update hooks and configuration?`,initialValue:!0});if(SD($)||!$)return T0("Installation cancelled"),null;u.forceReinstall=!0}else u.forceReinstall=!1;let F=await xu({message:"Select installation scope",options:[{value:"user",label:"User (Recommended)",hint:"Install for current user (~/.claude)"},{value:"project",label:"Project",hint:"Install for current project only (./.mcp.json)"},{value:"local",label:"Local",hint:"Custom local installation"}],initialValue:"user"});if(SD(F))return T0("Installation cancelled"),null;if(u.scope=F,F==="local"){let $=await W8({message:"Enter custom installation directory",placeholder:uD(process.cwd(),".claude-mem"),validate:(B)=>{if(!B)return"Path is required";if(!B.startsWith("/")&&!B.startsWith("~"))return"Please provide an absolute path"}});if(SD($))return T0("Installation cancelled"),null;u.customPath=$}u.hookTimeout=180000;let C=await O0({message:'Enable Smart Trash? This creates an alias for "rm" that moves files to ~/.claude-mem/trash instead of permanently deleting them. You can restore files anytime by typing "claude-mem restore".',initialValue:!0});if(SD(C))return T0("Installation cancelled"),null;u.enableSmartTrash=C;let E=await O0({message:'Would you like to save memories when you type "/clear" in Claude Code? When running /clear with this on, it takes about a minute to save memories before your new session starts.',initialValue:!1});if(SD(E))return T0("Installation cancelled"),null;return u.saveMemoriesOnClear=E,u}function XB(){let D=P.getInstance();D.ensureAllDataDirectories(),D.ensureAllClaudeDirectories();let u=uD(D.getDataDirectory(),"package.json");if(!bD(u))q0(u,JSON.stringify({name:"claude-mem-data",type:"module"},null,2))}function N6(D,u){if(uB(D).isDirectory()){if(!bD(u))Du(u,{recursive:!0});FB(D).forEach((E)=>{N6(uD(D,E),uD(u,E))})}else w2(D,u)}function ZB(D=180000){let u=P.getInstance(),F=u.getHooksDirectory(),C=u.findPackageHookTemplatesDirectory(),E=["session-start.js","stop.js","user-prompt-submit.js","post-tool-use.js"];for(let Z of E){let Y=uD(C,Z),J=uD(F,Z);w2(Y,J),_0.makeExecutable(J)}let $=uD(C,"shared"),B=uD(F,"shared");if(bD($))N6($,B);let Q={packageName:j0,cliCommand:j0,backend:"chroma",timeout:D};q0(uD(F,"config.json"),JSON.stringify(Q,null,2));let X={name:"claude-mem-hooks",type:"module",dependencies:{"better-sqlite3":"^11.8.0"}};q0(uD(F,"package.json"),JSON.stringify(X,null,2));try{N2("npm install --silent",{cwd:F,stdio:"pipe"})}catch(Z){}}function YB(){let u=P.getInstance().getClaudeMdPath(),F=k2(u);if(!bD(F))Du(F,{recursive:!0});let C=`
<!-- CLAUDE-MEM QUICK REFERENCE -->
## \uD83E\uDDE0 Memory System Quick Reference
### Search Your Memories (SIMPLE & POWERFUL)
- **Semantic search is king**: \`mcp__claude-mem__chroma_query_documents(["search terms"])\`
- **\uD83D\uDD12 ALWAYS include project name in query**: \`["claude-mem feature authentication"]\` not just \`["feature authentication"]\`
- **Include dates for temporal search**: \`["project-name 2025-09-09 bug fix"]\` finds memories from that date
- **Get specific memory**: \`mcp__claude-mem__chroma_get_documents(ids: ["document_id"])\`
### Search Tips That Actually Work
- **Project isolation**: Always prefix queries with project name to avoid cross-contamination
- **Temporal search**: Include dates (YYYY-MM-DD) in query text to find memories from specific times
- **Intent-based**: "implementing oauth" > "oauth implementation code function"
- **Multiple queries**: Search with different phrasings for better coverage
- **Session-specific**: Include session ID in query when you know it
### What Doesn't Work (Don't Do This!)
- ❌ Complex where filters with $and/$or - they cause errors
- ❌ Timestamp comparisons ($gte/$lt) - Chroma stores timestamps as strings
- ❌ Mixing project filters in where clause - causes "Error finding id"
### Storage
- Collection: "claude_memories"
- Archives: ~/.claude-mem/archives/
<!-- /CLAUDE-MEM QUICK REFERENCE -->`,E="";if(bD(u)){E=au(u,"utf8");let $=E.includes("<!-- CLAUDE-MEM INSTRUCTIONS -->"),B=E.includes("<!-- CLAUDE-MEM QUICK REFERENCE -->");if($||B){let Q,X;if($)Q="<!-- CLAUDE-MEM INSTRUCTIONS -->",X="<!-- /CLAUDE-MEM INSTRUCTIONS -->";else Q="<!-- CLAUDE-MEM QUICK REFERENCE -->",X="<!-- /CLAUDE-MEM QUICK REFERENCE -->";let Z=E.indexOf(Q),Y=E.indexOf(X)+X.length;if(Z!==-1&&Y!==-1)E=E.substring(0,Z)+C.trim()+E.substring(Y)}else E=E.trim()+`
`+C}else E=C.trim();q0(u,E)}function JB(D=!1){let u=`${T6()}/.cargo/bin`;if(bD(u)&&!process.env.PATH?.includes(u))process.env.PATH=`${u}:${process.env.PATH}`;if(D)try{N2("claude mcp remove claude-mem",{stdio:"pipe"})}catch(C){}let F=`claude mcp add claude-mem -- uvx chroma-mcp --client-type persistent --data-dir ${P.getInstance().getChromaDirectory()}`;N2(F,{stdio:"inherit"})}function nu(D,u,F){let C={hooks:[{type:"command",command:D,timeout:u}]};if(F)C.matcher=F;return C}function KB(D){let F=P.getInstance().getHooksDirectory(),C=bD(D)?JSON.parse(au(D,"utf8")):{hooks:{}};if(Du(k2(D),{recursive:!0}),!C.hooks)C.hooks={};["SessionStart","Stop","UserPromptSubmit","PostToolUse"].forEach(($)=>{if(C.hooks[$])C.hooks[$]=C.hooks[$].filter((B)=>!B.hooks?.some((Q)=>Q.command?.includes(j0)))}),C.hooks.SessionStart=[nu(uD(F,"session-start.js"),180)],C.hooks.Stop=[nu(uD(F,"stop.js"),60)],C.hooks.UserPromptSubmit=[nu(uD(F,"user-prompt-submit.js"),60)],C.hooks.PostToolUse=[nu(uD(F,"post-tool-use.js"),180,"*")],q0(D,JSON.stringify(C,null,2))}function qB(D){if(D.scope==="local"&&D.customPath)return uD(D.customPath,"settings.local.json");else if(D.scope==="project")return uD(process.cwd(),".claude","settings.json");else return P.getInstance().getClaudeSettingsPath()}function VB(D){let F=P.getInstance().getUserSettingsPath(),C=bD(F)?JSON.parse(au(F,"utf8")):{};C.backend="chroma",C.installed=!0,C.embedded=!0,C.saveMemoriesOnClear=D.saveMemoriesOnClear||!1,C.claudePath=BB(),q0(F,JSON.stringify(C,null,2))}function HB(){let D=_0.getShellConfigPaths(),u=_0.getAliasDefinition("rm","claude-mem trash"),F=_0.isWindows()?"# claude-mem smart trash alias":"# claude-mem smart trash alias";for(let C of D){if(!bD(C)){let B=k2(C);if(!bD(B))Du(B,{recursive:!0});q0(C,"")}let E=au(C,"utf8");if(E.includes(u))continue;let $=`
${F}
${u}
`;E+=$,q0(C,E)}}function AB(){let D=P.getInstance(),u=D.getClaudeCommandsDirectory(),F=D.findPackageCommandsDirectory();Du(u,{recursive:!0});let C=["save.md","remember.md","claude-mem.md"];for(let E of C){let $=uD(F,E),B=uD(u,E);if(bD($))w2($,B)}}async function w6(D={}){console.log(e0(`
═══════════════════════════════════════`)),console.log(e0(" CLAUDE-MEM INSTALLER ")),console.log(e0("═══════════════════════════════════════")),console.log(lu(T2(`\uD83E\uDDE0 Persistent Memory System for Claude Code
✨ Transform your Claude experience with seamless context preservation
\uD83D\uDE80 Never lose your conversation history again`),{padding:2,margin:1,borderStyle:"double",borderColor:"magenta",textAlignment:"center"})),await O6(500),EB();let u=D.user||D.project||D.local||D.force,F;if(u)F={scope:D.local?"local":D.project?"project":"user",customPath:D.path,hookTimeout:D.timeout?parseInt(D.timeout):180,forceReinstall:!!D.force,enableSmartTrash:!1,saveMemoriesOnClear:!1};else{let X=$B(),Z=await QB(X);if(!Z)process.exit(0);F=Z}console.log(T2(`
\uD83D\uDE80 Beginning Installation Process
`));let C=[{name:"Creating directory structure",fn:()=>XB()},{name:"Installing Chroma MCP server",fn:()=>JB(F.forceReinstall)},{name:"Adding CLAUDE.md instructions",fn:()=>YB()},{name:"Installing Claude commands",fn:()=>AB()},{name:"Installing memory hooks",fn:()=>ZB(F.hookTimeout)},{name:"Configuring Claude settings",fn:()=>KB(qB(F))},{name:"Configuring user settings",fn:()=>VB(F)}];if(F.enableSmartTrash)C.push({name:"Configuring Smart Trash alias",fn:()=>HB()});for(let X=0;X<C.length;X++){let Z=C[X],Y=`[${X+1}/${C.length}]`,J=CB(`${S.gray(Y)} ${Z.name}...`);J.start(),Z.fn(),J.stop(`${S.gray(Y)} ${Z.name} ${T2("completed! ✨")}`),await O6(150)}let E=e0("\uD83C\uDF89 INSTALLATION COMPLETE! \uD83C\uDF89"),$=`
${S.bold("How your new memory system works:")}
${S.green("•")} When you start Claude Code, claude-mem loads your latest memories automatically
${S.green("•")} Memories are saved automatically as you work
${S.green("•")} Ask Claude to search your memories anytime with natural language
${S.green("•")} Instructions added to ${S.cyan("~/.claude/CLAUDE.md")} teach Claude how to use the system
${S.bold("Slash Commands Available:")}
${S.cyan("/claude-mem help")} - Show all memory commands and features
${S.cyan("/save")} - Quick save of current conversation overview
${S.cyan("/remember")} - Search your saved memories
${S.bold("Quick Start:")}
${S.yellow("1.")} Restart Claude Code to activate your memory system
${S.yellow("2.")} Start using Claude normally - memories save automatically
${S.yellow("3.")} Search memories by asking: ${S.italic('"Search my memories for X"')}`,B=F.enableSmartTrash?`
${S.blue("\uD83D\uDDD1 Smart Trash Enabled:")}
${S.gray(" • rm commands now move files to ~/.claude-mem/trash")}
${S.gray(" • View trash:")} ${S.cyan("claude-mem trash view")}
${S.gray(" • Restore files:")} ${S.cyan("claude-mem restore")}
${S.gray(" • Empty trash:")} ${S.cyan("claude-mem trash empty")}
${S.yellow(" • Restart terminal for alias to activate")}`:"",Q=F.saveMemoriesOnClear?`
${S.magenta("\uD83D\uDCBE Save-on-clear enabled:")}
${S.gray(" • /clear now saves memories automatically (takes ~1 minute)")}`:"";console.log(lu(E+$+B+Q,{padding:2,margin:1,borderStyle:"double",borderColor:"green",backgroundColor:"#001122"})),console.log(e0(`
✨ Welcome to the future of persistent AI conversations! ✨
`))}UD();import{readFileSync as k6,writeFileSync as ru,existsSync as P6}from"fs";import{join as V0}from"path";import{homedir as zB}from"os";async function UB(){let D=zB(),u=[V0(D,".bashrc"),V0(D,".zshrc"),V0(D,".bash_profile")],F='alias rm="claude-mem trash"',C=["# claude-mem smart trash alias","# claude-mem trash bin alias"],E=!1;for(let $ of u){if(!P6($))continue;let B=k6($,"utf8");if(!B.includes('alias rm="claude-mem trash"'))continue;let Q=B.split(`
`),Z=Q.filter((Y,J)=>{if(Y.trim()==='alias rm="claude-mem trash"')return!1;for(let H of C)if(Y.trim()===H&&J+1<Q.length&&Q[J+1].trim()==='alias rm="claude-mem trash"')return!1;return!0}).join(`
`);if(Z!==B){let Y=$+".backup."+Date.now();ru(Y,B),ru($,Z),console.log(`✅ Removed Smart Trash alias from ${$.replace(D,"~")}`),E=!0}}return E}async function S6(D={}){console.log("\uD83D\uDD04 Uninstalling Claude Memory System hooks...");let u=[];if(D.all)u.push({name:"User",path:P.getInstance().getClaudeSettingsPath()}),u.push({name:"Project",path:V0(process.cwd(),".claude","settings.json")});else{let Z=D.project,Y=P.getInstance();u.push({name:Z?"Project":"User",path:Z?V0(process.cwd(),".claude","settings.json"):Y.getClaudeSettingsPath()})}let C=P.getInstance().getHooksDirectory(),E=V0(C,"pre-compact.js"),$=V0(C,"session-start.js"),B=V0(C,"session-end.js"),Q=0;for(let Z of u){if(!P6(Z.path)){console.log(`⏭️ No settings found at ${Z.name} location`);continue}let Y=k6(Z.path,"utf8"),J=JSON.parse(Y);if(!J.hooks){console.log(`⏭️ No hooks configured in ${Z.name} settings`);continue}let H=!1;if(J.hooks.PreCompact){let A=J.hooks.PreCompact.filter((z)=>!z.hooks?.some((U)=>U.command===E||U.command?.includes("pre-compact.js")||U.command?.includes("claude-mem")));if(A.length!==J.hooks.PreCompact.length)J.hooks.PreCompact=A.length?A:void 0,H=!0,console.log(`✅ Removed PreCompact hook from ${Z.name} settings`)}if(J.hooks.SessionStart){let A=J.hooks.SessionStart.filter((z)=>!z.hooks?.some((U)=>U.command===$||U.command?.includes("session-start.js")||U.command?.includes("claude-mem")));if(A.length!==J.hooks.SessionStart.length)J.hooks.SessionStart=A.length?A:void 0,H=!0,console.log(`✅ Removed SessionStart hook from ${Z.name} settings`)}if(J.hooks.SessionEnd){let A=J.hooks.SessionEnd.filter((z)=>!z.hooks?.some((U)=>U.command===B||U.command?.includes("session-end.js")||U.command?.includes("claude-mem")));if(A.length!==J.hooks.SessionEnd.length)J.hooks.SessionEnd=A.length?A:void 0,H=!0,console.log(`✅ Removed SessionEnd hook from ${Z.name} settings`)}if(J.hooks.PreCompact===void 0)delete J.hooks.PreCompact;if(J.hooks.SessionStart===void 0)delete J.hooks.SessionStart;if(J.hooks.SessionEnd===void 0)delete J.hooks.SessionEnd;if(!Object.keys(J.hooks).length)delete J.hooks;if(H){let A=Z.path+".backup."+Date.now();ru(A,Y),console.log(`\uD83D\uDCCB Created backup: ${A}`),ru(Z.path,JSON.stringify(J,null,2)),Q++,console.log(`✅ Updated ${Z.name} settings: ${Z.path}`)}else console.log(`️ No Claude Memory System hooks found in ${Z.name} settings`)}let X=await UB();if(console.log(""),Q>0||X){if(console.log("✨ Uninstallation complete!"),Q>0)console.log("The Claude Memory System hooks have been removed from your settings.");if(X)console.log("The Smart Trash alias has been removed from your shell configuration."),console.log("⚠️ Restart your terminal for the alias removal to take effect.");console.log(""),console.log("Note: Your compressed transcripts and archives are preserved."),console.log("To reinstall: claude-mem install")}else console.log("️ No Claude Memory System hooks or aliases were found to remove.")}UD();rD();EF();import{readFileSync as h2,existsSync as Cu,readdirSync as X4,statSync as Z4}from"fs";import{join as H0,dirname as Y4}from"path";import{execSync as J4}from"child_process";import{fileURLToPath as K4}from"url";var vZ=Y4(K4(import.meta.url));async function A1(){console.log("\uD83D\uDD0D Claude Memory System Status Check"),console.log(`=====================================
`),console.log("\uD83D\uDCC2 Runtime Hook Scripts (installed from hook-templates/):");let D=P.getInstance(),u=D.getHooksDirectory(),F=H0(u,"session-start.js"),C=H0(u,"stop.js"),E=H0(u,"user-prompt-submit.js"),$=H0(u,"post-tool-use.js"),B=(z,U)=>{if(Cu(z))console.log(`${U}: Found at ${z}`);else console.log(`${U}: Not found at ${z}`)};B(F,"session-start.js"),B(C,"stop.js"),B(E,"user-prompt-submit.js"),B($,"post-tool-use.js"),console.log(""),console.log("⚙️ Settings Configuration:");let Q=(z,U)=>{if(!Cu(U)){console.log(` ⏭️ ${z}: No settings file`);return}console.log(` \uD83D\uDCCB ${z}: ${U}`);try{let W=JSON.parse(h2(U,"utf8")),I=W.hooks?.SessionStart?.some((k)=>k.hooks?.some((x)=>x.command?.includes("session-start.js")||x.command?.includes("claude-mem"))),T=W.hooks?.Stop?.some((k)=>k.hooks?.some((x)=>x.command?.includes("stop.js")||x.command?.includes("claude-mem"))),R=W.hooks?.UserPromptSubmit?.some((k)=>k.hooks?.some((x)=>x.command?.includes("user-prompt-submit.js")||x.command?.includes("claude-mem"))),M=W.hooks?.PostToolUse?.some((k)=>k.hooks?.some((x)=>x.command?.includes("post-tool-use.js")||x.command?.includes("claude-mem")));console.log(` SessionStart: ${I?"✅":"❌"}`),console.log(` Stop: ${T?"✅":"❌"}`),console.log(` UserPromptSubmit: ${R?"✅":"❌"}`),console.log(` PostToolUse: ${M?"✅":"❌"}`)}catch(W){console.log(" ⚠️ Could not parse settings")}};Q("Global",D.getClaudeSettingsPath()),Q("Project",H0(process.cwd(),".claude","settings.json")),console.log(""),console.log("\uD83D\uDCE6 Compressed Transcripts:");let X=H0(D.getClaudeConfigDirectory(),"projects");if(Cu(X))try{let z=0,U=0,W=(I,T=0)=>{if(T>3)return;let R=X4(I);for(let M of R){let k=H0(I,M);if(Z4(k).isDirectory()&&!M.startsWith("."))W(k,T+1);else if(M.endsWith(".jsonl.compressed"))z++;else if(M.endsWith(".jsonl.archive"))U++}};W(X),console.log(` Compressed files: ${z}`),console.log(` Archive files: ${U}`)}catch(z){console.log(" ⚠️ Could not scan projects directory")}else console.log(" ️ No Claude projects directory found");console.log(""),console.log("\uD83D\uDD27 Runtime Environment:");let Z=(z,U)=>{try{let W=J4(`${z} --version`,{encoding:"utf8"}).trim();console.log(`${U}: ${W}`)}catch{console.log(`${U}: Not found`)}};Z("node","Node.js"),Z("bun","Bun"),console.log(""),console.log("\uD83E\uDDE0 Chroma Storage Status:"),console.log(" ✅ Storage backend: Chroma MCP"),console.log(` \uD83D\uDCCD Data location: ${D.getChromaDirectory()}`),console.log(" \uD83D\uDD0D Features: Vector search, semantic similarity, document storage"),console.log(""),console.log("\uD83E\uDD16 Claude Agent SDK Sessions:");try{await ND.getInstance().initialize();let W=new Fu().getAll();if(W.length===0)console.log(S.gray(" No active sessions"));else{let I=W.filter((T)=>{return(Date.now()-T.last_used_epoch)/86400000<7}).length;console.log(` \uD83D\uDCCA Total sessions: ${W.length}`),console.log(` ✅ Active (< 7 days): ${I}`),console.log(S.dim(" \uD83D\uDCA1 View details: claude-mem sessions list"))}}catch(z){console.log(S.gray(" ⚠️ Could not load session info"))}console.log(""),console.log("\uD83D\uDCCA Summary:");let Y=D.getClaudeSettingsPath(),J=H0(process.cwd(),".claude","settings.json"),H=!1,A="Not installed";try{if(Cu(Y)){let z=JSON.parse(h2(Y,"utf8"));if(z.hooks?.SessionStart||z.hooks?.Stop||z.hooks?.PostToolUse)H=!0,A="Global"}if(Cu(J)){let z=JSON.parse(h2(J,"utf8"));if(z.hooks?.SessionStart||z.hooks?.Stop||z.hooks?.PostToolUse)H=!0,A=A==="Global"?"Global + Project":"Project"}}catch{}if(H)console.log(` ✅ Claude Memory System is installed (${A})`),console.log(""),console.log("\uD83D\uDCA1 To test: Use /compact in Claude Code");else console.log(" ❌ Claude Memory System is not installed"),console.log(""),console.log("\uD83D\uDCA1 To install: claude-mem install")}UD();import{readFileSync as q4,readdirSync as V4,statSync as H4}from"fs";import{join as z1}from"path";async function A4(D,u,F){try{let $=q4(D,"utf8").split(`
`).filter((B)=>B.trim()).slice(-F);if(console.log(`\uD83D\uDCCB ${u} Logs (last ${F} lines):`),console.log(` File: ${D}`),console.log(""),$.length===0)console.log(" No log entries found");else $.forEach((B)=>{console.log(` ${B}`)});console.log("")}catch(C){console.log(`❌ Could not read ${u.toLowerCase()} log: ${D}`)}}async function U1(D={}){let u=P.getLogsDirectory(),F=parseInt(D.tail)||20;try{let E=V4(u).filter(($)=>$.startsWith("claude-mem-")&&$.endsWith(".log")).map(($)=>({name:$,path:z1(u,$),mtime:H4(z1(u,$)).mtime})).sort(($,B)=>B.mtime.getTime()-$.mtime.getTime());if(E.length===0){console.log("❌ No log files found in ~/.claude-mem/logs/");return}if(await A4(E[0].path,"Most Recent",F),D.all&&E.length>1)console.log(`\uD83D\uDCDA Found ${E.length} total log files`)}catch(C){console.log("❌ Could not read logs directory: ~/.claude-mem/logs/"),console.log(" Run a compression first to generate logs")}if(D.follow)console.log("Following logs... (Press Ctrl+C to stop)"),setInterval(()=>{},1000)}UD();import Qu from"fs";import{join as w4}from"path";function _1(D){try{let u=D instanceof Date?D:new Date(D),C=new Date().getTime()-u.getTime(),E=Math.floor(C/1000),$=Math.floor(E/60),B=Math.floor($/60),Q=Math.floor(B/24),X=Math.floor(Q/7),Z=Math.floor(Q/30);if(E<60)return"Just now";else if($<60)return $===1?"1 minute ago":`${$} minutes ago`;else if(B<24)return B===1?"1 hour ago":`${B} hours ago`;else if(Q===1)return"Yesterday";else if(Q<7)return`${Q} days ago`;else if(X===1)return"1 week ago";else if(X<4)return`${X} weeks ago`;else if(Z===1)return"1 month ago";else if(Z<12)return`${Z} months ago`;else{let Y=Math.floor(Z/12);return Y===1?"1 year ago":`${Y} years ago`}}catch(u){return"Recently"}}function $F(){let D=process.env.CLAUDE_MEM_WRAP_WIDTH;if(D){let u=parseInt(D,10);if(!Number.isNaN(u)&&u>40&&u<=200)return u}return 80}function z4(D,u){if(!D)return"";if(/^[\-=\u2014_\u2500\u2550]{5,}$/.test(D.trim()))return D;if(D.length<=u)return D;let F=D.match(/^\s*/),C=F?F[0]:"",E=D.slice(C.length),$=Math.max(10,u-C.length),B=E.split(/(\s+)/),Q=[],X="",Z=()=>{Q.push(C+X.trimEnd()),X=""};for(let Y of B){if(Y==="")continue;if(!/\s/.test(Y)&&Y.length>$){if(X.trim().length>0)Z();let J=0;while(J<Y.length){let H=Y.slice(J,J+$);Q.push(C+H),J+=$}X="";continue}if(C.length+X.length+Y.length>u)Z();X+=Y}if(X.trim().length>0||Q.length===0)Z();return Q.join(`
`)}function vD(D,u){if(!D)return"";return D.split(`
`).map((F)=>z4(F,u)).join(`
`)}function BF(D="─",u=$F()){if(!D||D.length===0)D="-";return D.repeat(u).slice(0,u)}function g2(D,u,F){let C=u!==void 0?` (${u} items)`:"",E=F?`
${F}`:"",$=$F();return vD(`${D} completed successfully${C}${E}`,$)}function m2(D,u,F){let C=F?`
\uD83D\uDCA1 ${F}`:"",E=$F();return vD(`${D} encountered an issue: ${u}${C}`,E)}var U4={NO_MEMORIES:(D)=>({message:`No previous memories found for ${D}`,suggestion:"This appears to be your first session. Memories will be created as you work."}),CONNECTION_FAILED:()=>({message:"Could not connect to memory system",suggestion:"Try restarting Claude Code or check if the MCP server is properly configured."}),SEARCH_FAILED:(D)=>({message:`Search for "${D}" didn't return any results`,suggestion:"Try using different keywords or check if memories exist for this project."}),LOAD_TIMEOUT:()=>({message:"Memory loading timed out",suggestion:"The operation is taking longer than expected. You can continue without loaded context."})};function Eu(D,...u){let F=U4[D](...u);return m2("Memory system",F.message,F.suggestion)}function W1(D){let u=typeof D==="string"?new Date(D):D,C=new Date().getTime()-u.getTime(),E=Math.floor(C/60000),$=Math.floor(C/3600000),B=Math.floor(C/86400000);if(E<1)return"just now";if(E<60)return`${E} minute${E>1?"s":""} ago`;if($<24)return`${$} hour${$>1?"s":""} ago`;if(B<7)return`${B} day${B>1?"s":""} ago`;return u.toLocaleDateString()}function _4(D){if(D.length===0)return[];return D.filter((u)=>u.type==="memory").map((u)=>{let F={summary:u.text||"",sessionId:u.session_id||""};if(u.keywords)F.keywords=u.keywords;if(u.document_id&&!u.document_id.includes("Session:"))F.location=u.document_id;return F}).filter((u)=>u.summary.length>0)}function W4(D){let u=new Map;return D.forEach((F)=>{let C=F.sessionId;if(C){if(!u.has(C))u.set(C,[]);u.get(C).push(F)}}),Array.from(u.entries()).map(([F,C])=>{let E=C.map(($,B)=>({...$,number:B+1}));return{sessionId:F,memories:E}})}function G4(D){let u=new Map;return D.forEach((F)=>{let C=F.sessionId||"unknown";if(!u.has(C))u.set(C,[]);u.get(C).push(F)}),Array.from(u.entries()).map(([F,C])=>{let E=C.map((B)=>B.timestamp).filter((B)=>B!==void 0).sort((B,Q)=>B.getTime()-Q.getTime()),$={sessionId:F,overviews:C};if(E.length>0)$.earliestTimestamp=E[0],$.timeAgo=_1(E[0]);return $})}function G1(D){let{projectName:u,memoryCount:F,lastSessionTime:C,recentObjects:E}=D,$=$F(),Q=new Date().toLocaleString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",timeZoneName:"short"});console.log(""),console.log(vD(`\uD83D\uDCC5 ${Q}`,$)),console.log(BF("─",$));let X=extractOverviews(E,10,u);console.error(`[DEBUG] recentObjects has ${E.length} items`),console.error(`[DEBUG] overviews extracted: ${X.length}`);let Z=_4(E),Y=(J,H)=>{let A=J.includes(",")||J.includes(`
`)?J.split(/[\n,]+/):[J];for(let z of A){let U=z.trim();if(!U)continue;let W=U.toLowerCase();if(!H.has(W))H.set(W,U)}};if(Z.length>0){let J=W4(Z);console.log(""),console.log(""),console.log(vD("\uD83D\uDCDA Memories",$)),J.forEach((H)=>{console.log(BF("─",$)),console.log(""),console.log(vD(`\uD83D\uDD0D ${H.sessionId}`,$));let A=new Map;H.memories.forEach((U)=>{if(console.log(""),console.log(vD(`${U.number}. ${U.summary}`,$)),U.keywords)Y(U.keywords,A)});let z=Array.from(A.values());if(z.length>0)console.log(""),console.log(vD(`\uD83C\uDFF7 ${z.join(", ")}`,$));console.log("")})}if(X.length>0){let J=G4(X);J.sort((H,A)=>{let z=H.earliestTimestamp?.getTime()||0,U=A.earliestTimestamp?.getTime()||0;return z-U}),console.log(""),console.log(vD("\uD83E\uDDE0 Overviews",$)),console.log(BF("─",$)),J.forEach((H)=>{console.log(""),console.log(vD(`\uD83D\uDD0D ${H.sessionId}`,$)),H.overviews.forEach((A,z)=>{if(console.log(""),console.log(vD(`${z+1}. ${A.content}`,$)),console.log(""),A.timeAgo)console.log(vD(`\uD83D\uDCC5 ${A.timeAgo}`,$))}),console.log(""),console.log(BF("─",$))})}else if(Z.length===0)console.log(vD(`\uD83E\uDDE0 No recent context found for ${u}`,$))}UD();import L0 from"fs";rD();EF();d2();p2();a2();i2();QF();XF();async function iD(){let{DatabaseManager:D}=await Promise.resolve().then(() => (rD(),V1)),{migrations:u}=await Promise.resolve().then(() => (XF(),w1)),F=D.getInstance();for(let Y of u)F.registerMigration(Y);let C=await F.initialize(),{SessionStore:E}=await Promise.resolve().then(() => (EF(),H1)),{MemoryStore:$}=await Promise.resolve().then(() => (d2(),L1)),{OverviewStore:B}=await Promise.resolve().then(() => (p2(),R1)),{DiagnosticsStore:Q}=await Promise.resolve().then(() => (a2(),M1)),{TranscriptEventStore:X}=await Promise.resolve().then(() => (i2(),I1)),{StreamingSessionStore:Z}=await Promise.resolve().then(() => (QF(),j1));return{sessions:new E(C),memories:new $(C),overviews:new B(C),diagnostics:new Q(C),transcriptEvents:new X(C),streamingSessions:new Z(C)}}class o2{backend="sqlite";stores;async getStores(){if(!this.stores)this.stores=await iD();return this.stores}async isAvailable(){try{return await this.getStores(),!0}catch(D){return!1}}async createSession(D){return(await this.getStores()).sessions.create(D)}async getSession(D){return(await this.getStores()).sessions.getBySessionId(D)}async hasSession(D){return(await this.getStores()).sessions.has(D)}async getAllSessionIds(){return(await this.getStores()).sessions.getAllSessionIds()}async getRecentSessions(D=5){return(await this.getStores()).sessions.getRecent(D)}async getRecentSessionsForProject(D,u=5){return(await this.getStores()).sessions.getRecentForProject(D,u)}async createMemory(D){return(await this.getStores()).memories.create(D)}async createMemories(D){(await this.getStores()).memories.createMany(D)}async getRecentMemories(D=10){return(await this.getStores()).memories.getRecent(D)}async getRecentMemoriesForProject(D,u=10){return(await this.getStores()).memories.getRecentForProject(D,u)}async hasDocumentId(D){return(await this.getStores()).memories.hasDocumentId(D)}async createOverview(D){return(await this.getStores()).overviews.create(D)}async upsertOverview(D){return(await this.getStores()).overviews.upsert(D)}async getRecentOverviews(D=5){return(await this.getStores()).overviews.getRecent(D)}async getRecentOverviewsForProject(D,u=5){return(await this.getStores()).overviews.getRecentForProject(D,u)}async createDiagnostic(D){return(await this.getStores()).diagnostics.create(D)}}class k1{backend="jsonl";pathDiscovery=P.getInstance();async isAvailable(){try{let D=this.pathDiscovery.getDataDirectory();return L0.mkdirSync(D,{recursive:!0}),!0}catch{return!1}}appendToIndex(D){let u=this.pathDiscovery.getIndexPath();L0.appendFileSync(u,JSON.stringify(D)+"\\n","utf8")}async createSession(D){let u={type:"session",session_id:D.session_id,project:D.project,timestamp:D.created_at};this.appendToIndex(u)}async getSession(){return null}async hasSession(D){return(await this.getAllSessionIds()).has(D)}async getAllSessionIds(){let D=this.pathDiscovery.getIndexPath();if(!L0.existsSync(D))return new Set;let F=L0.readFileSync(D,"utf-8").trim().split("\\n").filter((E)=>E.trim()),C=new Set;for(let E of F)try{let $=JSON.parse(E);if($.session_id)C.add($.session_id)}catch{}return C}async getRecentSessions(){return[]}async getRecentSessionsForProject(){return[]}async createMemory(D){let u={type:"memory",text:D.text,document_id:D.document_id,keywords:D.keywords,session_id:D.session_id,project:D.project,timestamp:D.created_at,archive:D.archive_basename};this.appendToIndex(u)}async createMemories(D){for(let u of D)await this.createMemory(u)}async getRecentMemories(){return[]}async getRecentMemoriesForProject(){return[]}async hasDocumentId(D){let u=this.pathDiscovery.getIndexPath();if(!L0.existsSync(u))return!1;let C=L0.readFileSync(u,"utf-8").trim().split("\\n").filter((E)=>E.trim());for(let E of C)try{let $=JSON.parse(E);if($.type==="memory"&&$.document_id===D)return!0}catch{}return!1}async createOverview(D){let u={type:"overview",content:D.content,session_id:D.session_id,project:D.project,timestamp:D.created_at};this.appendToIndex(u)}async upsertOverview(D){await this.createOverview(D)}async getRecentOverviews(){return[]}async getRecentOverviewsForProject(){return[]}async createDiagnostic(D){let u={type:"diagnostic",message:D.message,session_id:D.session_id,project:D.project,timestamp:D.created_at};this.appendToIndex(u)}}var P0=null;async function P1(){if(P0)return P0;let D=new o2;if(await D.isAvailable())return P0=D,P0;let u=new k1;if(await u.isAvailable())return P0=u,P0;throw new Error("No storage backend available")}async function S1(){let u=P.getInstance().getIndexPath();if(L0.existsSync(u)){if(!await new o2().isAvailable())return!0;try{return(await iD()).sessions.count()===0}catch{return!0}}return!1}import{readFileSync as L4,existsSync as R4}from"fs";import{join as M4}from"path";UD();class s2{pathDiscovery;constructor(){this.pathDiscovery=P.getInstance()}getConfigDir(){return this.pathDiscovery.getDataDirectory()}getIndexDir(){return this.pathDiscovery.getIndexDirectory()}getIndexPath(){return this.pathDiscovery.getIndexPath()}getArchiveDir(){return this.pathDiscovery.getArchivesDirectory()}getProjectArchiveDir(D){return this.pathDiscovery.getProjectArchiveDirectory(D)}getLogsDir(){return this.pathDiscovery.getLogsDirectory()}static ensureDirectory(D){P.getInstance().ensureDirectory(D)}static ensureDirectories(D){P.getInstance().ensureDirectories(D)}static extractProjectName(D){return P.extractProjectName(D)}static getCurrentProjectPrefix(){return P.getCurrentProjectName()}static getCurrentProjectName(){return P.getCurrentProjectName()}}class t2{static settingsPath;static cachedSettings=null;static{let D=new s2;this.settingsPath=M4(D.getConfigDir(),"settings.json")}static readSettings(){if(this.cachedSettings!==null)return this.cachedSettings;try{if(R4(this.settingsPath)){let u=L4(this.settingsPath,"utf-8"),F=JSON.parse(u);return this.cachedSettings=F,F}}catch{}let D={};return this.cachedSettings=D,D}static getSetting(D,u){return this.readSettings()[D]??u}static getClaudePath(){return this.getSetting("claudePath","claude")}static clearCache(){this.cachedSettings=null}}function $u(){return t2.getClaudePath()}function x1(){return t2.readSettings()}var S0={captureEnabled:!0,summaryEnabled:!0,sessionStartEnabled:!0,chunkTokenLimit:600,chunkOverlapTokens:200,summaryTurnLimit:20};function e2(D,u){if(typeof D==="boolean")return D;if(typeof D==="string"){let F=D.toLowerCase();if(F==="true")return!0;if(F==="false")return!1}return u}function D3(D,u){if(typeof D==="number"&&Number.isFinite(D))return D;if(typeof D==="string"){let F=Number(D);if(!Number.isNaN(F)&&Number.isFinite(F))return F}return u}function b1(){let D=x1();return{captureEnabled:e2(D.rollingCaptureEnabled,S0.captureEnabled),summaryEnabled:e2(D.rollingSummaryEnabled,S0.summaryEnabled),sessionStartEnabled:e2(D.rollingSessionStartEnabled,S0.sessionStartEnabled),chunkTokenLimit:D3(D.rollingChunkTokens,S0.chunkTokenLimit),chunkOverlapTokens:D3(D.rollingChunkOverlapTokens,S0.chunkOverlapTokens),summaryTurnLimit:D3(D.rollingSummaryTurnLimit,S0.summaryTurnLimit)}}UD();import{appendFileSync as I4,existsSync as j4,mkdirSync as O4}from"fs";import{join as T4}from"path";var ZF=null;function N4(){if(ZF)return ZF;let u=P.getInstance().getLogsDirectory();if(!j4(u))O4(u,{recursive:!0});return ZF=T4(u,"rolling-memory.log"),ZF}function YF(D,u,F={}){try{let C=N4(),E={timestamp:new Date().toISOString(),level:D,message:u,...F};I4(C,`${JSON.stringify(E)}
`,"utf8")}catch{}}function v1(D=new Date){return D.toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",timeZoneName:"short"})}function u3(D,u,F){let C=D.split(" "),E=[],$=F,B=" ".repeat(F.length);for(let Q of C){let Z=$+($!==F&&$!==B?" ":"")+Q;if(Z.length<=u)$=Z;else{if($.trim())E.push($);$=B+Q}}if($.trim())E.push($);return E.join(`
`)}function k4(D){let u=new Set;return u.add(D),u.add(D.replace(/-/g,"_")),u.add(D.replace(/_/g,"-")),(F)=>!!F&&u.has(F)}function F3(D){if(D===0)return"0 B";let u=1024,F=["B","KB","MB","GB"],C=Math.floor(Math.log(D)/Math.log(u));return parseFloat((D/Math.pow(u,C)).toFixed(1))+" "+F[C]}function C3(){let D=P.getInstance().getTrashDirectory();if(!Qu.existsSync(D))return{folderCount:0,fileCount:0,totalSize:0,isEmpty:!0};let u=Qu.readdirSync(D);if(u.length===0)return{folderCount:0,fileCount:0,totalSize:0,isEmpty:!0};let F=0,C=0,E=0;for(let $ of u){let B=w4(D,$),Q=Qu.statSync(B);if(Q.isDirectory())F++;else C++;E+=Q.size}return{folderCount:F,fileCount:C,totalSize:E,isEmpty:!1}}async function P4(D){if(!b1().sessionStartEnabled){console.log("Rolling session-start output disabled in settings."),YF("info","session-start output skipped (disabled)",{project:D});return}let F=await iD(),C=D||P.getCurrentProjectName(),$=F.overviews.getAllForProject(C).slice(-10);if($.length===0){console.log("==============================================================================="),console.log(`What's new | ${v1()}`),console.log("==============================================================================="),console.log("No previous sessions found for this project."),console.log("Start working and claude-mem will automatically capture context for future sessions."),console.log("===============================================================================");let Q=C3();if(!Q.isEmpty){let X=F3(Q.totalSize);console.log(`\uD83D\uDDD1 Trash ${Q.folderCount} folders | ${Q.fileCount} files | ${X} use \`claude-mem restore\``),console.log("===============================================================================")}return}console.log("==============================================================================="),console.log(`What's new | ${v1()}`),console.log("==============================================================================="),$.forEach((Q)=>{let X=new Date(Q.created_at),Z=X.getFullYear(),Y=String(X.getMonth()+1).padStart(2,"0"),J=String(X.getDate()).padStart(2,"0"),H=X.getHours(),A=String(X.getMinutes()).padStart(2,"0"),z=H>=12?"PM":"AM",U=H%12||12;console.log(`[${Z}-${Y}-${J} at ${U}:${A} ${z}]`);let W=F.memories.getBySessionId(Q.session_id),I=W.map((M)=>({title:M.title,subtitle:M.subtitle})).filter((M)=>M.title),T=new Set,R=new Set;if(W.forEach((M)=>{if(M.files_touched)try{let k=JSON.parse(M.files_touched);if(Array.isArray(k))k.forEach((x)=>T.add(x))}catch(k){}if(M.keywords)M.keywords.split(",").forEach((k)=>R.add(k.trim()))}),console.log(""),console.log(u3(Q.content,80,"")),T.size>0)console.log(""),console.log(u3(`- ${Array.from(T).join(", ")}`,80,""));if(R.size>0)console.log(""),console.log(u3(`Tags: ${Array.from(R).join(", ")}`,80,""));console.log("")}),console.log("===============================================================================");let B=C3();if(!B.isEmpty){let Q=F3(B.totalSize);console.log(`\uD83D\uDDD1 Trash ${B.folderCount} folders | ${B.fileCount} files | ${Q} use \`claude-mem restore\``),console.log("===============================================================================")}}async function y1(D={}){try{if(await S1())console.warn("⚠️ JSONL to SQLite migration recommended. Run: claude-mem migrate-index");let u=await P1();if(u.backend==="jsonl")return await S4(D);let F=[],C=[],E=D.project;if(!E&&D.format==="session-start")E=P.getCurrentProjectName();if(D.format==="session-start"){await P4(E);return}let $=D.format==="json"?5:3;if(E)F=await u.getRecentMemoriesForProject(E,10),C=await u.getRecentOverviewsForProject(E,$);else F=await u.getRecentMemories(10),C=await u.getRecentOverviews($);let B=F.map((X)=>({type:"memory",text:X.text,document_id:X.document_id,keywords:X.keywords,session_id:X.session_id,project:X.project,timestamp:X.created_at,archive:X.archive_basename})),Q=C.map((X)=>({type:"overview",content:X.content,session_id:X.session_id,project:X.project,timestamp:X.created_at}));if(B.length===0&&Q.length===0)return;if(D.format==="json"){let X=[...B,...Q];console.log(JSON.stringify(X))}else{let X=B.length+Q.length;console.log(g2("Context loading",X,"recent entries found")),B.forEach((Z)=>{console.log(`${Z.text} | ${Z.document_id} | ${Z.keywords}`)}),Q.forEach((Z)=>{console.log(`**Overview:** ${Z.content}`)})}if(D.format!=="json"){let X=C3();if(!X.isEmpty){let Z=F3(X.totalSize);console.log(`\uD83D\uDDD1 Trash ${X.folderCount} folders | ${X.fileCount} files | ${Z} use \`claude-mem restore\``),console.log("")}}}catch(u){let F=u instanceof Error?u.message:String(u);if(D.format==="session-start")console.log(Eu("CONNECTION_FAILED",F));else console.log(m2("Context loading",F,"Check file permissions and try again"))}}async function S4(D={}){let F=P.getInstance().getIndexPath(),C=D.project;if(!C&&D.format==="session-start")C=P.getCurrentProjectName();if(!Qu.existsSync(F)){if(D.format==="session-start")console.log(Eu("NO_MEMORIES",C||"this project"));return}let $=Qu.readFileSync(F,"utf-8").trim().split(`
`).filter((A)=>A.trim());if($.length===0){if(D.format==="session-start")console.log(Eu("NO_MEMORIES",C||"this project"));return}let B=[];for(let A of $)try{if(!A.trim().startsWith("{"))continue;let z=JSON.parse(A);B.push(z)}catch(z){continue}if(B.length===0){if(D.format==="session-start")console.log(Eu("NO_MEMORIES",C||"this project"));return}let Q=B.filter((A)=>A.type==="memory"),X=B.filter((A)=>A.type==="overview"),Z=B.filter((A)=>A.type==="session"),Y=Q,J=X,H=Z;if(C){let A=k4(C);Y=Q.filter((z)=>A(z.project)),J=X.filter((z)=>A(z.project)),H=Z.filter((z)=>A(z.project))}if(D.format==="session-start"){let A=Y.slice(-10),z=J.slice(-10),W=[...H.slice(-10),...A,...z],I="recently",T=W.map((R)=>{return R.timestamp?new Date(R.timestamp):null}).filter((R)=>R!==null).sort((R,M)=>M.getTime()-R.getTime());if(T.length>0)I=W1(T[0]);G1({projectName:C||"your project",memoryCount:A.length,lastSessionTime:I,recentObjects:W})}else if(D.format==="json"){let A=Y.slice(-10),z=J.slice(-3),U=[...A,...z];console.log(JSON.stringify(U))}else{let A=Y.slice(-10),z=J.slice(-3),U=A.length+z.length;console.log(g2("Context loading",U,"recent entries found")),A.forEach((W)=>{console.log(`${W.text} | ${W.document_id} | ${W.keywords}`)}),z.forEach((W)=>{console.log(`**Overview:** ${W.content}`)})}}import{renameSync as U$,existsSync as P7,mkdirSync as _$,statSync as W$}from"fs";import{join as G$,basename as L$}from"path";var E3=(D,u,F)=>{let C=D instanceof RegExp?f1(D,F):D,E=u instanceof RegExp?f1(u,F):u,$=C!==null&&E!=null&&x4(C,E,F);return $&&{start:$[0],end:$[1],pre:F.slice(0,$[0]),body:F.slice($[0]+C.length,$[1]),post:F.slice($[1]+E.length)}},f1=(D,u)=>{let F=u.match(D);return F?F[0]:null},x4=(D,u,F)=>{let C,E,$,B=void 0,Q,X=F.indexOf(D),Z=F.indexOf(u,X+1),Y=X;if(X>=0&&Z>0){if(D===u)return[X,Z];C=[],$=F.length;while(Y>=0&&!Q){if(Y===X)C.push(Y),X=F.indexOf(D,Y+1);else if(C.length===1){let J=C.pop();if(J!==void 0)Q=[J,Z]}else{if(E=C.pop(),E!==void 0&&E<$)$=E,B=Z;Z=F.indexOf(u,Y+1)}Y=X<Z&&X>=0?X:Z}if(C.length&&B!==void 0)Q=[$,B]}return Q};var h1="\x00SLASH"+Math.random()+"\x00",g1="\x00OPEN"+Math.random()+"\x00",$3="\x00CLOSE"+Math.random()+"\x00",m1="\x00COMMA"+Math.random()+"\x00",c1="\x00PERIOD"+Math.random()+"\x00",b4=new RegExp(h1,"g"),v4=new RegExp(g1,"g"),y4=new RegExp($3,"g"),f4=new RegExp(m1,"g"),h4=new RegExp(c1,"g"),g4=/\\\\/g,m4=/\\{/g,c4=/\\}/g,d4=/\\,/g,l4=/\\./g;function B3(D){return!isNaN(D)?parseInt(D,10):D.charCodeAt(0)}function p4(D){return D.replace(g4,h1).replace(m4,g1).replace(c4,$3).replace(d4,m1).replace(l4,c1)}function n4(D){return D.replace(b4,"\\").replace(v4,"{").replace(y4,"}").replace(f4,",").replace(h4,".")}function d1(D){if(!D)return[""];let u=[],F=E3("{","}",D);if(!F)return D.split(",");let{pre:C,body:E,post:$}=F,B=C.split(",");B[B.length-1]+="{"+E+"}";let Q=d1($);if($.length)B[B.length-1]+=Q.shift(),B.push.apply(B,Q);return u.push.apply(u,B),u}function l1(D){if(!D)return[];if(D.slice(0,2)==="{}")D="\\{\\}"+D.slice(2);return Xu(p4(D),!0).map(n4)}function a4(D){return"{"+D+"}"}function r4(D){return/^-?0\d/.test(D)}function i4(D,u){return D<=u}function o4(D,u){return D>=u}function Xu(D,u){let F=[],C=E3("{","}",D);if(!C)return[D];let E=C.pre,$=C.post.length?Xu(C.post,!1):[""];if(/\$$/.test(C.pre))for(let B=0;B<$.length;B++){let Q=E+"{"+C.body+"}"+$[B];F.push(Q)}else{let B=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(C.body),Q=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(C.body),X=B||Q,Z=C.body.indexOf(",")>=0;if(!X&&!Z){if(C.post.match(/,(?!,).*\}/))return D=C.pre+"{"+C.body+$3+C.post,Xu(D);return[D]}let Y;if(X)Y=C.body.split(/\.\./);else if(Y=d1(C.body),Y.length===1&&Y[0]!==void 0){if(Y=Xu(Y[0],!1).map(a4),Y.length===1)return $.map((H)=>C.pre+Y[0]+H)}let J;if(X&&Y[0]!==void 0&&Y[1]!==void 0){let H=B3(Y[0]),A=B3(Y[1]),z=Math.max(Y[0].length,Y[1].length),U=Y.length===3&&Y[2]!==void 0?Math.abs(B3(Y[2])):1,W=i4;if(A<H)U*=-1,W=o4;let T=Y.some(r4);J=[];for(let R=H;W(R,A);R+=U){let M;if(Q){if(M=String.fromCharCode(R),M==="\\")M=""}else if(M=String(R),T){let k=z-M.length;if(k>0){let x=new Array(k+1).join("0");if(R<0)M="-"+x+M.slice(1);else M=x+M}}J.push(M)}}else{J=[];for(let H=0;H<Y.length;H++)J.push.apply(J,Xu(Y[H],!1))}for(let H=0;H<J.length;H++)for(let A=0;A<$.length;A++){let z=E+J[H]+$[A];if(!u||X||z)F.push(z)}}return F}var Zu=(D)=>{if(typeof D!=="string")throw new TypeError("invalid pattern");if(D.length>65536)throw new TypeError("pattern is too long")};var s4={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Yu=(D)=>D.replace(/[[\]\\-]/g,"\\$&"),t4=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),p1=(D)=>D.join(""),n1=(D,u)=>{let F=u;if(D.charAt(F)!=="[")throw new Error("not in a brace expression");let C=[],E=[],$=F+1,B=!1,Q=!1,X=!1,Z=!1,Y=F,J="";D:while($<D.length){let U=D.charAt($);if((U==="!"||U==="^")&&$===F+1){Z=!0,$++;continue}if(U==="]"&&B&&!X){Y=$+1;break}if(B=!0,U==="\\"){if(!X){X=!0,$++;continue}}if(U==="["&&!X){for(let[W,[I,T,R]]of Object.entries(s4))if(D.startsWith(W,$)){if(J)return["$.",!1,D.length-F,!0];if($+=W.length,R)E.push(I);else C.push(I);Q=Q||T;continue D}}if(X=!1,J){if(U>J)C.push(Yu(J)+"-"+Yu(U));else if(U===J)C.push(Yu(U));J="",$++;continue}if(D.startsWith("-]",$+1)){C.push(Yu(U+"-")),$+=2;continue}if(D.startsWith("-",$+1)){J=U,$+=2;continue}C.push(Yu(U)),$++}if(Y<$)return["",!1,0,!1];if(!C.length&&!E.length)return["$.",!1,D.length-F,!0];if(E.length===0&&C.length===1&&/^\\?.$/.test(C[0])&&!Z){let U=C[0].length===2?C[0].slice(-1):C[0];return[t4(U),!1,Y-F,!1]}let H="["+(Z?"^":"")+p1(C)+"]",A="["+(Z?"":"^")+p1(E)+"]";return[C.length&&E.length?"("+H+"|"+A+")":C.length?H:A,Q,Y-F,!0]};var oD=(D,{windowsPathsNoEscape:u=!1}={})=>{return u?D.replace(/\[([^\/\\])\]/g,"$1"):D.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var e4=new Set(["!","?","+","*","@"]),a1=(D)=>e4.has(D),D5="(?!(?:^|/)\\.\\.?(?:$|/))",JF="(?!\\.)",u5=new Set(["[","."]),F5=new Set(["..","."]),C5=new Set("().*{}+?[]^$\\!"),E5=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Q3="[^/]",r1=Q3+"*?",i1=Q3+"+?";class QD{type;#D;#u;#B=!1;#E=[];#$;#W;#U;#Y=!1;#Q;#K;#J=!1;constructor(D,u,F={}){if(this.type=D,D)this.#u=!0;if(this.#$=u,this.#D=this.#$?this.#$.#D:this,this.#Q=this.#D===this?F:this.#D.#Q,this.#U=this.#D===this?[]:this.#D.#U,D==="!"&&!this.#D.#Y)this.#U.push(this);this.#W=this.#$?this.#$.#E.length:0}get hasMagic(){if(this.#u!==void 0)return this.#u;for(let D of this.#E){if(typeof D==="string")continue;if(D.type||D.hasMagic)return this.#u=!0}return this.#u}toString(){if(this.#K!==void 0)return this.#K;if(!this.type)return this.#K=this.#E.map((D)=>String(D)).join("");else return this.#K=this.type+"("+this.#E.map((D)=>String(D)).join("|")+")"}#X(){if(this!==this.#D)throw new Error("should only call on root");if(this.#Y)return this;this.toString(),this.#Y=!0;let D;while(D=this.#U.pop()){if(D.type!=="!")continue;let u=D,F=u.#$;while(F){for(let C=u.#W+1;!F.type&&C<F.#E.length;C++)for(let E of D.#E){if(typeof E==="string")throw new Error("string part in extglob AST??");E.copyIn(F.#E[C])}u=F,F=u.#$}}return this}push(...D){for(let u of D){if(u==="")continue;if(typeof u!=="string"&&!(u instanceof QD&&u.#$===this))throw new Error("invalid part: "+u);this.#E.push(u)}}toJSON(){let D=this.type===null?this.#E.slice().map((u)=>typeof u==="string"?u:u.toJSON()):[this.type,...this.#E.map((u)=>u.toJSON())];if(this.isStart()&&!this.type)D.unshift([]);if(this.isEnd()&&(this===this.#D||this.#D.#Y&&this.#$?.type==="!"))D.push({});return D}isStart(){if(this.#D===this)return!0;if(!this.#$?.isStart())return!1;if(this.#W===0)return!0;let D=this.#$;for(let u=0;u<this.#W;u++){let F=D.#E[u];if(!(F instanceof QD&&F.type==="!"))return!1}return!0}isEnd(){if(this.#D===this)return!0;if(this.#$?.type==="!")return!0;if(!this.#$?.isEnd())return!1;if(!this.type)return this.#$?.isEnd();let D=this.#$?this.#$.#E.length:0;return this.#W===D-1}copyIn(D){if(typeof D==="string")this.push(D);else this.push(D.clone(this))}clone(D){let u=new QD(this.type,D);for(let F of this.#E)u.copyIn(F);return u}static#F(D,u,F,C){let E=!1,$=!1,B=-1,Q=!1;if(u.type===null){let H=F,A="";while(H<D.length){let z=D.charAt(H++);if(E||z==="\\"){E=!E,A+=z;continue}if($){if(H===B+1){if(z==="^"||z==="!")Q=!0}else if(z==="]"&&!(H===B+2&&Q))$=!1;A+=z;continue}else if(z==="["){$=!0,B=H,Q=!1,A+=z;continue}if(!C.noext&&a1(z)&&D.charAt(H)==="("){u.push(A),A="";let U=new QD(z,u);H=QD.#F(D,U,H,C),u.push(U);continue}A+=z}return u.push(A),H}let X=F+1,Z=new QD(null,u),Y=[],J="";while(X<D.length){let H=D.charAt(X++);if(E||H==="\\"){E=!E,J+=H;continue}if($){if(X===B+1){if(H==="^"||H==="!")Q=!0}else if(H==="]"&&!(X===B+2&&Q))$=!1;J+=H;continue}else if(H==="["){$=!0,B=X,Q=!1,J+=H;continue}if(a1(H)&&D.charAt(X)==="("){Z.push(J),J="";let A=new QD(H,Z);Z.push(A),X=QD.#F(D,A,X,C);continue}if(H==="|"){Z.push(J),J="",Y.push(Z),Z=new QD(null,u);continue}if(H===")"){if(J===""&&u.#E.length===0)u.#J=!0;return Z.push(J),J="",u.push(...Y,Z),X}J+=H}return u.type=null,u.#u=void 0,u.#E=[D.substring(F-1)],X}static fromGlob(D,u={}){let F=new QD(null,void 0,u);return QD.#F(D,F,0,u),F}toMMPattern(){if(this!==this.#D)return this.#D.toMMPattern();let D=this.toString(),[u,F,C,E]=this.toRegExpSource();if(!(C||this.#u||this.#Q.nocase&&!this.#Q.nocaseMagicOnly&&D.toUpperCase()!==D.toLowerCase()))return F;let B=(this.#Q.nocase?"i":"")+(E?"u":"");return Object.assign(new RegExp(`^${u}$`,B),{_src:u,_glob:D})}get options(){return this.#Q}toRegExpSource(D){let u=D??!!this.#Q.dot;if(this.#D===this)this.#X();if(!this.type){let Q=this.isStart()&&this.isEnd(),X=this.#E.map((H)=>{let[A,z,U,W]=typeof H==="string"?QD.#G(H,this.#u,Q):H.toRegExpSource(D);return this.#u=this.#u||U,this.#B=this.#B||W,A}).join(""),Z="";if(this.isStart()){if(typeof this.#E[0]==="string"){if(!(this.#E.length===1&&F5.has(this.#E[0]))){let A=u5,z=u&&A.has(X.charAt(0))||X.startsWith("\\.")&&A.has(X.charAt(2))||X.startsWith("\\.\\.")&&A.has(X.charAt(4)),U=!u&&!D&&A.has(X.charAt(0));Z=z?D5:U?JF:""}}}let Y="";if(this.isEnd()&&this.#D.#Y&&this.#$?.type==="!")Y="(?:$|\\/)";return[Z+X+Y,oD(X),this.#u=!!this.#u,this.#B]}let F=this.type==="*"||this.type==="+",C=this.type==="!"?"(?:(?!(?:":"(?:",E=this.#V(u);if(this.isStart()&&this.isEnd()&&!E&&this.type!=="!"){let Q=this.toString();return this.#E=[Q],this.type=null,this.#u=void 0,[Q,oD(this.toString()),!1,!1]}let $=!F||D||u||!JF?"":this.#V(!0);if($===E)$="";if($)E=`(?:${E})(?:${$})*?`;let B="";if(this.type==="!"&&this.#J)B=(this.isStart()&&!u?JF:"")+i1;else{let Q=this.type==="!"?"))"+(this.isStart()&&!u&&!D?JF:"")+r1+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&$?")":this.type==="*"&&$?")?":`)${this.type}`;B=C+E+Q}return[B,oD(E),this.#u=!!this.#u,this.#B]}#V(D){return this.#E.map((u)=>{if(typeof u==="string")throw new Error("string type in extglob ast??");let[F,C,E,$]=u.toRegExpSource(D);return this.#B=this.#B||$,F}).filter((u)=>!(this.isStart()&&this.isEnd())||!!u).join("|")}static#G(D,u,F=!1){let C=!1,E="",$=!1;for(let B=0;B<D.length;B++){let Q=D.charAt(B);if(C){C=!1,E+=(C5.has(Q)?"\\":"")+Q;continue}if(Q==="\\"){if(B===D.length-1)E+="\\\\";else C=!0;continue}if(Q==="["){let[X,Z,Y,J]=n1(D,B);if(Y){E+=X,$=$||Z,B+=Y-1,u=u||J;continue}}if(Q==="*"){if(F&&D==="*")E+=i1;else E+=r1;u=!0;continue}if(Q==="?"){E+=Q3,u=!0;continue}E+=E5(Q)}return[E,oD(D),!!u,$]}}var x0=(D,{windowsPathsNoEscape:u=!1}={})=>{return u?D.replace(/[?*()[\]]/g,"[$&]"):D.replace(/[?*()[\]\\]/g,"\\$&")};var WD=(D,u,F={})=>{if(Zu(u),!F.nocomment&&u.charAt(0)==="#")return!1;return new fD(u,F).match(D)},B5=/^\*+([^+@!?\*\[\(]*)$/,$5=(D)=>(u)=>!u.startsWith(".")&&u.endsWith(D),Q5=(D)=>(u)=>u.endsWith(D),X5=(D)=>{return D=D.toLowerCase(),(u)=>!u.startsWith(".")&&u.toLowerCase().endsWith(D)},Z5=(D)=>{return D=D.toLowerCase(),(u)=>u.toLowerCase().endsWith(D)},Y5=/^\*+\.\*+$/,J5=(D)=>!D.startsWith(".")&&D.includes("."),K5=(D)=>D!=="."&&D!==".."&&D.includes("."),q5=/^\.\*+$/,V5=(D)=>D!=="."&&D!==".."&&D.startsWith("."),H5=/^\*+$/,A5=(D)=>D.length!==0&&!D.startsWith("."),z5=(D)=>D.length!==0&&D!=="."&&D!=="..",U5=/^\?+([^+@!?\*\[\(]*)?$/,_5=([D,u=""])=>{let F=t1([D]);if(!u)return F;return u=u.toLowerCase(),(C)=>F(C)&&C.toLowerCase().endsWith(u)},W5=([D,u=""])=>{let F=e1([D]);if(!u)return F;return u=u.toLowerCase(),(C)=>F(C)&&C.toLowerCase().endsWith(u)},G5=([D,u=""])=>{let F=e1([D]);return!u?F:(C)=>F(C)&&C.endsWith(u)},L5=([D,u=""])=>{let F=t1([D]);return!u?F:(C)=>F(C)&&C.endsWith(u)},t1=([D])=>{let u=D.length;return(F)=>F.length===u&&!F.startsWith(".")},e1=([D])=>{let u=D.length;return(F)=>F.length===u&&F!=="."&&F!==".."},D7=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",o1={win32:{sep:"\\"},posix:{sep:"/"}},R5=D7==="win32"?o1.win32.sep:o1.posix.sep;WD.sep=R5;var XD=Symbol("globstar **");WD.GLOBSTAR=XD;var M5="[^/]",I5=M5+"*?",j5="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",O5="(?:(?!(?:\\/|^)\\.).)*?",T5=(D,u={})=>(F)=>WD(F,D,u);WD.filter=T5;var yD=(D,u={})=>Object.assign({},D,u),N5=(D)=>{if(!D||typeof D!=="object"||!Object.keys(D).length)return WD;let u=WD;return Object.assign((C,E,$={})=>u(C,E,yD(D,$)),{Minimatch:class C extends u.Minimatch{constructor(E,$={}){super(E,yD(D,$))}static defaults(E){return u.defaults(yD(D,E)).Minimatch}},AST:class C extends u.AST{constructor(E,$,B={}){super(E,$,yD(D,B))}static fromGlob(E,$={}){return u.AST.fromGlob(E,yD(D,$))}},unescape:(C,E={})=>u.unescape(C,yD(D,E)),escape:(C,E={})=>u.escape(C,yD(D,E)),filter:(C,E={})=>u.filter(C,yD(D,E)),defaults:(C)=>u.defaults(yD(D,C)),makeRe:(C,E={})=>u.makeRe(C,yD(D,E)),braceExpand:(C,E={})=>u.braceExpand(C,yD(D,E)),match:(C,E,$={})=>u.match(C,E,yD(D,$)),sep:u.sep,GLOBSTAR:XD})};WD.defaults=N5;var u7=(D,u={})=>{if(Zu(D),u.nobrace||!/\{(?:(?!\{).)*\}/.test(D))return[D];return l1(D)};WD.braceExpand=u7;var w5=(D,u={})=>new fD(D,u).makeRe();WD.makeRe=w5;var k5=(D,u,F={})=>{let C=new fD(u,F);if(D=D.filter((E)=>C.match(E)),C.options.nonull&&!D.length)D.push(u);return D};WD.match=k5;var s1=/[?*]|[+@!]\(.*?\)|\[|\]/,P5=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class fD{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(D,u={}){if(Zu(D),u=u||{},this.options=u,this.pattern=D,this.platform=u.platform||D7,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!u.windowsPathsNoEscape||u.allowWindowsEscape===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!u.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!u.nonegate,this.comment=!1,this.empty=!1,this.partial=!!u.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=u.windowsNoMagicRoot!==void 0?u.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let D of this.set)for(let u of D)if(typeof u!=="string")return!0;return!1}debug(...D){}make(){let D=this.pattern,u=this.options;if(!u.nocomment&&D.charAt(0)==="#"){this.comment=!0;return}if(!D){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],u.debug)this.debug=(...E)=>console.error(...E);this.debug(this.pattern,this.globSet);let F=this.globSet.map((E)=>this.slashSplit(E));this.globParts=this.preprocess(F),this.debug(this.pattern,this.globParts);let C=this.globParts.map((E,$,B)=>{if(this.isWindows&&this.windowsNoMagicRoot){let Q=E[0]===""&&E[1]===""&&(E[2]==="?"||!s1.test(E[2]))&&!s1.test(E[3]),X=/^[a-z]:/i.test(E[0]);if(Q)return[...E.slice(0,4),...E.slice(4).map((Z)=>this.parse(Z))];else if(X)return[E[0],...E.slice(1).map((Z)=>this.parse(Z))]}return E.map((Q)=>this.parse(Q))});if(this.debug(this.pattern,C),this.set=C.filter((E)=>E.indexOf(!1)===-1),this.isWindows)for(let E=0;E<this.set.length;E++){let $=this.set[E];if($[0]===""&&$[1]===""&&this.globParts[E][2]==="?"&&typeof $[3]==="string"&&/^[a-z]:$/i.test($[3]))$[2]="?"}this.debug(this.pattern,this.set)}preprocess(D){if(this.options.noglobstar){for(let F=0;F<D.length;F++)for(let C=0;C<D[F].length;C++)if(D[F][C]==="**")D[F][C]="*"}let{optimizationLevel:u=1}=this.options;if(u>=2)D=this.firstPhasePreProcess(D),D=this.secondPhasePreProcess(D);else if(u>=1)D=this.levelOneOptimize(D);else D=this.adjascentGlobstarOptimize(D);return D}adjascentGlobstarOptimize(D){return D.map((u)=>{let F=-1;while((F=u.indexOf("**",F+1))!==-1){let C=F;while(u[C+1]==="**")C++;if(C!==F)u.splice(F,C-F)}return u})}levelOneOptimize(D){return D.map((u)=>{return u=u.reduce((F,C)=>{let E=F[F.length-1];if(C==="**"&&E==="**")return F;if(C===".."){if(E&&E!==".."&&E!=="."&&E!=="**")return F.pop(),F}return F.push(C),F},[]),u.length===0?[""]:u})}levelTwoFileOptimize(D){if(!Array.isArray(D))D=this.slashSplit(D);let u=!1;do{if(u=!1,!this.preserveMultipleSlashes){for(let C=1;C<D.length-1;C++){let E=D[C];if(C===1&&E===""&&D[0]==="")continue;if(E==="."||E==="")u=!0,D.splice(C,1),C--}if(D[0]==="."&&D.length===2&&(D[1]==="."||D[1]===""))u=!0,D.pop()}let F=0;while((F=D.indexOf("..",F+1))!==-1){let C=D[F-1];if(C&&C!=="."&&C!==".."&&C!=="**")u=!0,D.splice(F-1,2),F-=2}}while(u);return D.length===0?[""]:D}firstPhasePreProcess(D){let u=!1;do{u=!1;for(let F of D){let C=-1;while((C=F.indexOf("**",C+1))!==-1){let $=C;while(F[$+1]==="**")$++;if($>C)F.splice(C+1,$-C);let B=F[C+1],Q=F[C+2],X=F[C+3];if(B!=="..")continue;if(!Q||Q==="."||Q===".."||!X||X==="."||X==="..")continue;u=!0,F.splice(C,1);let Z=F.slice(0);Z[C]="**",D.push(Z),C--}if(!this.preserveMultipleSlashes){for(let $=1;$<F.length-1;$++){let B=F[$];if($===1&&B===""&&F[0]==="")continue;if(B==="."||B==="")u=!0,F.splice($,1),$--}if(F[0]==="."&&F.length===2&&(F[1]==="."||F[1]===""))u=!0,F.pop()}let E=0;while((E=F.indexOf("..",E+1))!==-1){let $=F[E-1];if($&&$!=="."&&$!==".."&&$!=="**"){u=!0;let Q=E===1&&F[E+1]==="**"?["."]:[];if(F.splice(E-1,2,...Q),F.length===0)F.push("");E-=2}}}}while(u);return D}secondPhasePreProcess(D){for(let u=0;u<D.length-1;u++)for(let F=u+1;F<D.length;F++){let C=this.partsMatch(D[u],D[F],!this.preserveMultipleSlashes);if(C){D[u]=[],D[F]=C;break}}return D.filter((u)=>u.length)}partsMatch(D,u,F=!1){let C=0,E=0,$=[],B="";while(C<D.length&&E<u.length)if(D[C]===u[E])$.push(B==="b"?u[E]:D[C]),C++,E++;else if(F&&D[C]==="**"&&u[E]===D[C+1])$.push(D[C]),C++;else if(F&&u[E]==="**"&&D[C]===u[E+1])$.push(u[E]),E++;else if(D[C]==="*"&&u[E]&&(this.options.dot||!u[E].startsWith("."))&&u[E]!=="**"){if(B==="b")return!1;B="a",$.push(D[C]),C++,E++}else if(u[E]==="*"&&D[C]&&(this.options.dot||!D[C].startsWith("."))&&D[C]!=="**"){if(B==="a")return!1;B="b",$.push(u[E]),C++,E++}else return!1;return D.length===u.length&&$}parseNegate(){if(this.nonegate)return;let D=this.pattern,u=!1,F=0;for(let C=0;C<D.length&&D.charAt(C)==="!";C++)u=!u,F++;if(F)this.pattern=D.slice(F);this.negate=u}matchOne(D,u,F=!1){let C=this.options;if(this.isWindows){let z=typeof D[0]==="string"&&/^[a-z]:$/i.test(D[0]),U=!z&&D[0]===""&&D[1]===""&&D[2]==="?"&&/^[a-z]:$/i.test(D[3]),W=typeof u[0]==="string"&&/^[a-z]:$/i.test(u[0]),I=!W&&u[0]===""&&u[1]===""&&u[2]==="?"&&typeof u[3]==="string"&&/^[a-z]:$/i.test(u[3]),T=U?3:z?0:void 0,R=I?3:W?0:void 0;if(typeof T==="number"&&typeof R==="number"){let[M,k]=[D[T],u[R]];if(M.toLowerCase()===k.toLowerCase()){if(u[R]=M,R>T)u=u.slice(R);else if(T>R)D=D.slice(T)}}}let{optimizationLevel:E=1}=this.options;if(E>=2)D=this.levelTwoFileOptimize(D);this.debug("matchOne",this,{file:D,pattern:u}),this.debug("matchOne",D.length,u.length);for(var $=0,B=0,Q=D.length,X=u.length;$<Q&&B<X;$++,B++){this.debug("matchOne loop");var Z=u[B],Y=D[$];if(this.debug(u,Z,Y),Z===!1)return!1;if(Z===XD){this.debug("GLOBSTAR",[u,Z,Y]);var J=$,H=B+1;if(H===X){this.debug("** at the end");for(;$<Q;$++)if(D[$]==="."||D[$]===".."||!C.dot&&D[$].charAt(0)===".")return!1;return!0}while(J<Q){var A=D[J];if(this.debug(`
globstar while`,D,J,u,H,A),this.matchOne(D.slice(J),u.slice(H),F))return this.debug("globstar found match!",J,Q,A),!0;else{if(A==="."||A===".."||!C.dot&&A.charAt(0)==="."){this.debug("dot detected!",D,J,u,H);break}this.debug("globstar swallow a segment, and continue"),J++}}if(F){if(this.debug(`
>>> no match, partial?`,D,J,u,H),J===Q)return!0}return!1}let z;if(typeof Z==="string")z=Y===Z,this.debug("string match",Z,Y,z);else z=Z.test(Y),this.debug("pattern match",Z,Y,z);if(!z)return!1}if($===Q&&B===X)return!0;else if($===Q)return F;else if(B===X)return $===Q-1&&D[$]==="";else throw new Error("wtf?")}braceExpand(){return u7(this.pattern,this.options)}parse(D){Zu(D);let u=this.options;if(D==="**")return XD;if(D==="")return"";let F,C=null;if(F=D.match(H5))C=u.dot?z5:A5;else if(F=D.match(B5))C=(u.nocase?u.dot?Z5:X5:u.dot?Q5:$5)(F[1]);else if(F=D.match(U5))C=(u.nocase?u.dot?W5:_5:u.dot?G5:L5)(F);else if(F=D.match(Y5))C=u.dot?K5:J5;else if(F=D.match(q5))C=V5;let E=QD.fromGlob(D,this.options).toMMPattern();if(C&&typeof E==="object")Reflect.defineProperty(E,"test",{value:C});return E}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let D=this.set;if(!D.length)return this.regexp=!1,this.regexp;let u=this.options,F=u.noglobstar?I5:u.dot?j5:O5,C=new Set(u.nocase?["i"]:[]),E=D.map((Q)=>{let X=Q.map((Z)=>{if(Z instanceof RegExp)for(let Y of Z.flags.split(""))C.add(Y);return typeof Z==="string"?P5(Z):Z===XD?XD:Z._src});return X.forEach((Z,Y)=>{let J=X[Y+1],H=X[Y-1];if(Z!==XD||H===XD)return;if(H===void 0)if(J!==void 0&&J!==XD)X[Y+1]="(?:\\/|"+F+"\\/)?"+J;else X[Y]=F;else if(J===void 0)X[Y-1]=H+"(?:\\/|"+F+")?";else if(J!==XD)X[Y-1]=H+"(?:\\/|\\/"+F+"\\/)"+J,X[Y+1]=XD}),X.filter((Z)=>Z!==XD).join("/")}).join("|"),[$,B]=D.length>1?["(?:",")"]:["",""];if(E="^"+$+E+B+"$",this.negate)E="^(?!"+E+").+$";try{this.regexp=new RegExp(E,[...C].join(""))}catch(Q){this.regexp=!1}return this.regexp}slashSplit(D){if(this.preserveMultipleSlashes)return D.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(D))return["",...D.split(/\/+/)];else return D.split(/\/+/)}match(D,u=this.partial){if(this.debug("match",D,this.pattern),this.comment)return!1;if(this.empty)return D==="";if(D==="/"&&u)return!0;let F=this.options;if(this.isWindows)D=D.split("\\").join("/");let C=this.slashSplit(D);this.debug(this.pattern,"split",C);let E=this.set;this.debug(this.pattern,"set",E);let $=C[C.length-1];if(!$)for(let B=C.length-2;!$&&B>=0;B--)$=C[B];for(let B=0;B<E.length;B++){let Q=E[B],X=C;if(F.matchBase&&Q.length===1)X=[$];if(this.matchOne(X,Q,u)){if(F.flipNegate)return!0;return!this.negate}}if(F.flipNegate)return!1;return this.negate}static defaults(D){return WD.defaults(D).Minimatch}}WD.AST=QD;WD.Minimatch=fD;WD.escape=x0;WD.unescape=oD;import{fileURLToPath as J$}from"node:url";var S5=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,C7=new Set,X3=typeof process==="object"&&!!process?process:{},E7=(D,u,F,C)=>{typeof X3.emitWarning==="function"?X3.emitWarning(D,u,F,C):console.error(`[${F}] ${u}: ${D}`)},KF=globalThis.AbortController,F7=globalThis.AbortSignal;if(typeof KF==="undefined"){F7=class F{onabort;_onabort=[];reason;aborted=!1;addEventListener(C,E){this._onabort.push(E)}},KF=class F{constructor(){u()}signal=new F7;abort(C){if(this.signal.aborted)return;this.signal.reason=C,this.signal.aborted=!0;for(let E of this.signal._onabort)E(C);this.signal.onabort?.(C)}};let D=X3.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",u=()=>{if(!D)return;D=!1,E7("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",u)}}var x5=(D)=>!C7.has(D),RJ=Symbol("type"),A0=(D)=>D&&D===Math.floor(D)&&D>0&&isFinite(D),B7=(D)=>!A0(D)?null:D<=Math.pow(2,8)?Uint8Array:D<=Math.pow(2,16)?Uint16Array:D<=Math.pow(2,32)?Uint32Array:D<=Number.MAX_SAFE_INTEGER?Ju:null;class Ju extends Array{constructor(D){super(D);this.fill(0)}}class b0{heap;length;static#D=!1;static create(D){let u=B7(D);if(!u)return[];b0.#D=!0;let F=new b0(D,u);return b0.#D=!1,F}constructor(D,u){if(!b0.#D)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new u(D),this.length=0}push(D){this.heap[this.length++]=D}pop(){return this.heap[--this.length]}}class Ku{#D;#u;#B;#E;#$;#W;#U;#Y;get perf(){return this.#Y}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#Q;#K;#J;#X;#F;#V;#G;#_;#H;#T;#A;#R;#j;#z;#L;#O;#q;#C;static unsafeExposeInternals(D){return{starts:D.#j,ttls:D.#z,sizes:D.#R,keyMap:D.#J,keyList:D.#X,valList:D.#F,next:D.#V,prev:D.#G,get head(){return D.#_},get tail(){return D.#H},free:D.#T,isBackgroundFetch:(u)=>D.#Z(u),backgroundFetch:(u,F,C,E)=>D.#d(u,F,C,E),moveToTail:(u)=>D.#y(u),indexes:(u)=>D.#w(u),rindexes:(u)=>D.#P(u),isStale:(u)=>D.#I(u)}}get max(){return this.#D}get maxSize(){return this.#u}get calculatedSize(){return this.#K}get size(){return this.#Q}get fetchMethod(){return this.#W}get memoMethod(){return this.#U}get dispose(){return this.#B}get onInsert(){return this.#E}get disposeAfter(){return this.#$}constructor(D){let{max:u=0,ttl:F,ttlResolution:C=1,ttlAutopurge:E,updateAgeOnGet:$,updateAgeOnHas:B,allowStale:Q,dispose:X,onInsert:Z,disposeAfter:Y,noDisposeOnSet:J,noUpdateTTL:H,maxSize:A=0,maxEntrySize:z=0,sizeCalculation:U,fetchMethod:W,memoMethod:I,noDeleteOnFetchRejection:T,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:k,ignoreFetchAbort:x,perf:HD}=D;if(HD!==void 0){if(typeof HD?.now!=="function")throw new TypeError("perf option must have a now() method if specified")}if(this.#Y=HD??S5,u!==0&&!A0(u))throw new TypeError("max option must be a nonnegative integer");let kD=u?B7(u):Array;if(!kD)throw new Error("invalid max value: "+u);if(this.#D=u,this.#u=A,this.maxEntrySize=z||this.#u,this.sizeCalculation=U,this.sizeCalculation){if(!this.#u&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw new TypeError("sizeCalculation set to non-function")}if(I!==void 0&&typeof I!=="function")throw new TypeError("memoMethod must be a function if defined");if(this.#U=I,W!==void 0&&typeof W!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#W=W,this.#O=!!W,this.#J=new Map,this.#X=new Array(u).fill(void 0),this.#F=new Array(u).fill(void 0),this.#V=new kD(u),this.#G=new kD(u),this.#_=0,this.#H=0,this.#T=b0.create(u),this.#Q=0,this.#K=0,typeof X==="function")this.#B=X;if(typeof Z==="function")this.#E=Z;if(typeof Y==="function")this.#$=Y,this.#A=[];else this.#$=void 0,this.#A=void 0;if(this.#L=!!this.#B,this.#C=!!this.#E,this.#q=!!this.#$,this.noDisposeOnSet=!!J,this.noUpdateTTL=!!H,this.noDeleteOnFetchRejection=!!T,this.allowStaleOnFetchRejection=!!M,this.allowStaleOnFetchAbort=!!k,this.ignoreFetchAbort=!!x,this.maxEntrySize!==0){if(this.#u!==0){if(!A0(this.#u))throw new TypeError("maxSize must be a positive integer if specified")}if(!A0(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#f()}if(this.allowStale=!!Q,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!$,this.updateAgeOnHas=!!B,this.ttlResolution=A0(C)||C===0?C:1,this.ttlAutopurge=!!E,this.ttl=F||0,this.ttl){if(!A0(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#S()}if(this.#D===0&&this.ttl===0&&this.#u===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#D&&!this.#u){if(x5("LRU_CACHE_UNBOUNDED"))C7.add("LRU_CACHE_UNBOUNDED"),E7("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",Ku)}}getRemainingTTL(D){return this.#J.has(D)?1/0:0}#S(){let D=new Ju(this.#D),u=new Ju(this.#D);this.#z=D,this.#j=u,this.#m=(E,$,B=this.#Y.now())=>{if(u[E]=$!==0?B:0,D[E]=$,$!==0&&this.ttlAutopurge){let Q=setTimeout(()=>{if(this.#I(E))this.#k(this.#X[E],"expire")},$+1);if(Q.unref)Q.unref()}},this.#N=(E)=>{u[E]=D[E]!==0?this.#Y.now():0},this.#M=(E,$)=>{if(D[$]){let B=D[$],Q=u[$];if(!B||!Q)return;E.ttl=B,E.start=Q,E.now=F||C();let X=E.now-Q;E.remainingTTL=B-X}};let F=0,C=()=>{let E=this.#Y.now();if(this.ttlResolution>0){F=E;let $=setTimeout(()=>F=0,this.ttlResolution);if($.unref)$.unref()}return E};this.getRemainingTTL=(E)=>{let $=this.#J.get(E);if($===void 0)return 0;let B=D[$],Q=u[$];if(!B||!Q)return 1/0;let X=(F||C())-Q;return B-X},this.#I=(E)=>{let $=u[E],B=D[E];return!!B&&!!$&&(F||C())-$>B}}#N=()=>{};#M=()=>{};#m=()=>{};#I=()=>!1;#f(){let D=new Ju(this.#D);this.#K=0,this.#R=D,this.#x=(u)=>{this.#K-=D[u],D[u]=0},this.#b=(u,F,C,E)=>{if(this.#Z(F))return 0;if(!A0(C))if(E){if(typeof E!=="function")throw new TypeError("sizeCalculation must be a function");if(C=E(F,u),!A0(C))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return C},this.#h=(u,F,C)=>{if(D[u]=F,this.#u){let E=this.#u-D[u];while(this.#K>E)this.#v(!0)}if(this.#K+=D[u],C)C.entrySize=F,C.totalCalculatedSize=this.#K}}#x=(D)=>{};#h=(D,u,F)=>{};#b=(D,u,F,C)=>{if(F||C)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#w({allowStale:D=this.allowStale}={}){if(this.#Q)for(let u=this.#H;;){if(!this.#c(u))break;if(D||!this.#I(u))yield u;if(u===this.#_)break;else u=this.#G[u]}}*#P({allowStale:D=this.allowStale}={}){if(this.#Q)for(let u=this.#_;;){if(!this.#c(u))break;if(D||!this.#I(u))yield u;if(u===this.#H)break;else u=this.#V[u]}}#c(D){return D!==void 0&&this.#J.get(this.#X[D])===D}*entries(){for(let D of this.#w())if(this.#F[D]!==void 0&&this.#X[D]!==void 0&&!this.#Z(this.#F[D]))yield[this.#X[D],this.#F[D]]}*rentries(){for(let D of this.#P())if(this.#F[D]!==void 0&&this.#X[D]!==void 0&&!this.#Z(this.#F[D]))yield[this.#X[D],this.#F[D]]}*keys(){for(let D of this.#w()){let u=this.#X[D];if(u!==void 0&&!this.#Z(this.#F[D]))yield u}}*rkeys(){for(let D of this.#P()){let u=this.#X[D];if(u!==void 0&&!this.#Z(this.#F[D]))yield u}}*values(){for(let D of this.#w())if(this.#F[D]!==void 0&&!this.#Z(this.#F[D]))yield this.#F[D]}*rvalues(){for(let D of this.#P())if(this.#F[D]!==void 0&&!this.#Z(this.#F[D]))yield this.#F[D]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(D,u={}){for(let F of this.#w()){let C=this.#F[F],E=this.#Z(C)?C.__staleWhileFetching:C;if(E===void 0)continue;if(D(E,this.#X[F],this))return this.get(this.#X[F],u)}}forEach(D,u=this){for(let F of this.#w()){let C=this.#F[F],E=this.#Z(C)?C.__staleWhileFetching:C;if(E===void 0)continue;D.call(u,E,this.#X[F],this)}}rforEach(D,u=this){for(let F of this.#P()){let C=this.#F[F],E=this.#Z(C)?C.__staleWhileFetching:C;if(E===void 0)continue;D.call(u,E,this.#X[F],this)}}purgeStale(){let D=!1;for(let u of this.#P({allowStale:!0}))if(this.#I(u))this.#k(this.#X[u],"expire"),D=!0;return D}info(D){let u=this.#J.get(D);if(u===void 0)return;let F=this.#F[u],C=this.#Z(F)?F.__staleWhileFetching:F;if(C===void 0)return;let E={value:C};if(this.#z&&this.#j){let $=this.#z[u],B=this.#j[u];if($&&B){let Q=$-(this.#Y.now()-B);E.ttl=Q,E.start=Date.now()}}if(this.#R)E.size=this.#R[u];return E}dump(){let D=[];for(let u of this.#w({allowStale:!0})){let F=this.#X[u],C=this.#F[u],E=this.#Z(C)?C.__staleWhileFetching:C;if(E===void 0||F===void 0)continue;let $={value:E};if(this.#z&&this.#j){$.ttl=this.#z[u];let B=this.#Y.now()-this.#j[u];$.start=Math.floor(Date.now()-B)}if(this.#R)$.size=this.#R[u];D.unshift([F,$])}return D}load(D){this.clear();for(let[u,F]of D){if(F.start){let C=Date.now()-F.start;F.start=this.#Y.now()-C}this.set(u,F.value,F)}}set(D,u,F={}){if(u===void 0)return this.delete(D),this;let{ttl:C=this.ttl,start:E,noDisposeOnSet:$=this.noDisposeOnSet,sizeCalculation:B=this.sizeCalculation,status:Q}=F,{noUpdateTTL:X=this.noUpdateTTL}=F,Z=this.#b(D,u,F.size||0,B);if(this.maxEntrySize&&Z>this.maxEntrySize){if(Q)Q.set="miss",Q.maxEntrySizeExceeded=!0;return this.#k(D,"set"),this}let Y=this.#Q===0?void 0:this.#J.get(D);if(Y===void 0){if(Y=this.#Q===0?this.#H:this.#T.length!==0?this.#T.pop():this.#Q===this.#D?this.#v(!1):this.#Q,this.#X[Y]=D,this.#F[Y]=u,this.#J.set(D,Y),this.#V[this.#H]=Y,this.#G[Y]=this.#H,this.#H=Y,this.#Q++,this.#h(Y,Z,Q),Q)Q.set="add";if(X=!1,this.#C)this.#E?.(u,D,"add")}else{this.#y(Y);let J=this.#F[Y];if(u!==J){if(this.#O&&this.#Z(J)){J.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:H}=J;if(H!==void 0&&!$){if(this.#L)this.#B?.(H,D,"set");if(this.#q)this.#A?.push([H,D,"set"])}}else if(!$){if(this.#L)this.#B?.(J,D,"set");if(this.#q)this.#A?.push([J,D,"set"])}if(this.#x(Y),this.#h(Y,Z,Q),this.#F[Y]=u,Q){Q.set="replace";let H=J&&this.#Z(J)?J.__staleWhileFetching:J;if(H!==void 0)Q.oldValue=H}}else if(Q)Q.set="update";if(this.#C)this.onInsert?.(u,D,u===J?"update":"replace")}if(C!==0&&!this.#z)this.#S();if(this.#z){if(!X)this.#m(Y,C,E);if(Q)this.#M(Q,Y)}if(!$&&this.#q&&this.#A){let J=this.#A,H;while(H=J?.shift())this.#$?.(...H)}return this}pop(){try{while(this.#Q){let D=this.#F[this.#_];if(this.#v(!0),this.#Z(D)){if(D.__staleWhileFetching)return D.__staleWhileFetching}else if(D!==void 0)return D}}finally{if(this.#q&&this.#A){let D=this.#A,u;while(u=D?.shift())this.#$?.(...u)}}}#v(D){let u=this.#_,F=this.#X[u],C=this.#F[u];if(this.#O&&this.#Z(C))C.__abortController.abort(new Error("evicted"));else if(this.#L||this.#q){if(this.#L)this.#B?.(C,F,"evict");if(this.#q)this.#A?.push([C,F,"evict"])}if(this.#x(u),D)this.#X[u]=void 0,this.#F[u]=void 0,this.#T.push(u);if(this.#Q===1)this.#_=this.#H=0,this.#T.length=0;else this.#_=this.#V[u];return this.#J.delete(F),this.#Q--,u}has(D,u={}){let{updateAgeOnHas:F=this.updateAgeOnHas,status:C}=u,E=this.#J.get(D);if(E!==void 0){let $=this.#F[E];if(this.#Z($)&&$.__staleWhileFetching===void 0)return!1;if(!this.#I(E)){if(F)this.#N(E);if(C)C.has="hit",this.#M(C,E);return!0}else if(C)C.has="stale",this.#M(C,E)}else if(C)C.has="miss";return!1}peek(D,u={}){let{allowStale:F=this.allowStale}=u,C=this.#J.get(D);if(C===void 0||!F&&this.#I(C))return;let E=this.#F[C];return this.#Z(E)?E.__staleWhileFetching:E}#d(D,u,F,C){let E=u===void 0?void 0:this.#F[u];if(this.#Z(E))return E;let $=new KF,{signal:B}=F;B?.addEventListener("abort",()=>$.abort(B.reason),{signal:$.signal});let Q={signal:$.signal,options:F,context:C},X=(z,U=!1)=>{let{aborted:W}=$.signal,I=F.ignoreFetchAbort&&z!==void 0;if(F.status)if(W&&!U){if(F.status.fetchAborted=!0,F.status.fetchError=$.signal.reason,I)F.status.fetchAbortIgnored=!0}else F.status.fetchResolved=!0;if(W&&!I&&!U)return Y($.signal.reason);let T=H,R=this.#F[u];if(R===H||I&&U&&R===void 0)if(z===void 0)if(T.__staleWhileFetching!==void 0)this.#F[u]=T.__staleWhileFetching;else this.#k(D,"fetch");else{if(F.status)F.status.fetchUpdated=!0;this.set(D,z,Q.options)}return z},Z=(z)=>{if(F.status)F.status.fetchRejected=!0,F.status.fetchError=z;return Y(z)},Y=(z)=>{let{aborted:U}=$.signal,W=U&&F.allowStaleOnFetchAbort,I=W||F.allowStaleOnFetchRejection,T=I||F.noDeleteOnFetchRejection,R=H;if(this.#F[u]===H){if(!T||R.__staleWhileFetching===void 0)this.#k(D,"fetch");else if(!W)this.#F[u]=R.__staleWhileFetching}if(I){if(F.status&&R.__staleWhileFetching!==void 0)F.status.returnedStale=!0;return R.__staleWhileFetching}else if(R.__returned===R)throw z},J=(z,U)=>{let W=this.#W?.(D,E,Q);if(W&&W instanceof Promise)W.then((I)=>z(I===void 0?void 0:I),U);$.signal.addEventListener("abort",()=>{if(!F.ignoreFetchAbort||F.allowStaleOnFetchAbort){if(z(void 0),F.allowStaleOnFetchAbort)z=(I)=>X(I,!0)}})};if(F.status)F.status.fetchDispatched=!0;let H=new Promise(J).then(X,Z),A=Object.assign(H,{__abortController:$,__staleWhileFetching:E,__returned:void 0});if(u===void 0)this.set(D,A,{...Q.options,status:void 0}),u=this.#J.get(D);else this.#F[u]=A;return A}#Z(D){if(!this.#O)return!1;let u=D;return!!u&&u instanceof Promise&&u.hasOwnProperty("__staleWhileFetching")&&u.__abortController instanceof KF}async fetch(D,u={}){let{allowStale:F=this.allowStale,updateAgeOnGet:C=this.updateAgeOnGet,noDeleteOnStaleGet:E=this.noDeleteOnStaleGet,ttl:$=this.ttl,noDisposeOnSet:B=this.noDisposeOnSet,size:Q=0,sizeCalculation:X=this.sizeCalculation,noUpdateTTL:Z=this.noUpdateTTL,noDeleteOnFetchRejection:Y=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:J=this.allowStaleOnFetchRejection,ignoreFetchAbort:H=this.ignoreFetchAbort,allowStaleOnFetchAbort:A=this.allowStaleOnFetchAbort,context:z,forceRefresh:U=!1,status:W,signal:I}=u;if(!this.#O){if(W)W.fetch="get";return this.get(D,{allowStale:F,updateAgeOnGet:C,noDeleteOnStaleGet:E,status:W})}let T={allowStale:F,updateAgeOnGet:C,noDeleteOnStaleGet:E,ttl:$,noDisposeOnSet:B,size:Q,sizeCalculation:X,noUpdateTTL:Z,noDeleteOnFetchRejection:Y,allowStaleOnFetchRejection:J,allowStaleOnFetchAbort:A,ignoreFetchAbort:H,status:W,signal:I},R=this.#J.get(D);if(R===void 0){if(W)W.fetch="miss";let M=this.#d(D,R,T,z);return M.__returned=M}else{let M=this.#F[R];if(this.#Z(M)){let G=F&&M.__staleWhileFetching!==void 0;if(W){if(W.fetch="inflight",G)W.returnedStale=!0}return G?M.__staleWhileFetching:M.__returned=M}let k=this.#I(R);if(!U&&!k){if(W)W.fetch="hit";if(this.#y(R),C)this.#N(R);if(W)this.#M(W,R);return M}let x=this.#d(D,R,T,z),kD=x.__staleWhileFetching!==void 0&&F;if(W){if(W.fetch=k?"stale":"refresh",kD&&k)W.returnedStale=!0}return kD?x.__staleWhileFetching:x.__returned=x}}async forceFetch(D,u={}){let F=await this.fetch(D,u);if(F===void 0)throw new Error("fetch() returned undefined");return F}memo(D,u={}){let F=this.#U;if(!F)throw new Error("no memoMethod provided to constructor");let{context:C,forceRefresh:E,...$}=u,B=this.get(D,$);if(!E&&B!==void 0)return B;let Q=F(D,B,{options:$,context:C});return this.set(D,Q,$),Q}get(D,u={}){let{allowStale:F=this.allowStale,updateAgeOnGet:C=this.updateAgeOnGet,noDeleteOnStaleGet:E=this.noDeleteOnStaleGet,status:$}=u,B=this.#J.get(D);if(B!==void 0){let Q=this.#F[B],X=this.#Z(Q);if($)this.#M($,B);if(this.#I(B)){if($)$.get="stale";if(!X){if(!E)this.#k(D,"expire");if($&&F)$.returnedStale=!0;return F?Q:void 0}else{if($&&F&&Q.__staleWhileFetching!==void 0)$.returnedStale=!0;return F?Q.__staleWhileFetching:void 0}}else{if($)$.get="hit";if(X)return Q.__staleWhileFetching;if(this.#y(B),C)this.#N(B);return Q}}else if($)$.get="miss"}#l(D,u){this.#G[u]=D,this.#V[D]=u}#y(D){if(D!==this.#H){if(D===this.#_)this.#_=this.#V[D];else this.#l(this.#G[D],this.#V[D]);this.#l(this.#H,D),this.#H=D}}delete(D){return this.#k(D,"delete")}#k(D,u){let F=!1;if(this.#Q!==0){let C=this.#J.get(D);if(C!==void 0)if(F=!0,this.#Q===1)this.#g(u);else{this.#x(C);let E=this.#F[C];if(this.#Z(E))E.__abortController.abort(new Error("deleted"));else if(this.#L||this.#q){if(this.#L)this.#B?.(E,D,u);if(this.#q)this.#A?.push([E,D,u])}if(this.#J.delete(D),this.#X[C]=void 0,this.#F[C]=void 0,C===this.#H)this.#H=this.#G[C];else if(C===this.#_)this.#_=this.#V[C];else{let $=this.#G[C];this.#V[$]=this.#V[C];let B=this.#V[C];this.#G[B]=this.#G[C]}this.#Q--,this.#T.push(C)}}if(this.#q&&this.#A?.length){let C=this.#A,E;while(E=C?.shift())this.#$?.(...E)}return F}clear(){return this.#g("delete")}#g(D){for(let u of this.#P({allowStale:!0})){let F=this.#F[u];if(this.#Z(F))F.__abortController.abort(new Error("deleted"));else{let C=this.#X[u];if(this.#L)this.#B?.(F,C,D);if(this.#q)this.#A?.push([F,C,D])}}if(this.#J.clear(),this.#F.fill(void 0),this.#X.fill(void 0),this.#z&&this.#j)this.#z.fill(0),this.#j.fill(0);if(this.#R)this.#R.fill(0);if(this.#_=0,this.#H=0,this.#T.length=0,this.#K=0,this.#Q=0,this.#q&&this.#A){let u=this.#A,F;while(F=u?.shift())this.#$?.(...F)}}}import{posix as p5,win32 as U3}from"node:path";import{fileURLToPath as n5}from"node:url";import{lstatSync as a5,readdir as r5,readdirSync as i5,readlinkSync as o5,realpathSync as s5}from"fs";import*as t5 from"node:fs";import{lstat as D$,readdir as u$,readlink as F$,realpath as C$}from"node:fs/promises";import{EventEmitter as V3}from"node:events";import Y7 from"node:stream";import{StringDecoder as b5}from"node:string_decoder";var $7=typeof process==="object"&&process?process:{stdout:null,stderr:null},v5=(D)=>!!D&&typeof D==="object"&&(D instanceof M0||D instanceof Y7||y5(D)||f5(D)),y5=(D)=>!!D&&typeof D==="object"&&D instanceof V3&&typeof D.pipe==="function"&&D.pipe!==Y7.Writable.prototype.pipe,f5=(D)=>!!D&&typeof D==="object"&&D instanceof V3&&typeof D.write==="function"&&typeof D.end==="function",$0=Symbol("EOF"),Q0=Symbol("maybeEmitEnd"),z0=Symbol("emittedEnd"),qF=Symbol("emittingEnd"),qu=Symbol("emittedError"),VF=Symbol("closed"),Q7=Symbol("read"),HF=Symbol("flush"),X7=Symbol("flushChunk"),sD=Symbol("encoding"),v0=Symbol("decoder"),CD=Symbol("flowing"),Vu=Symbol("paused"),y0=Symbol("resume"),ED=Symbol("buffer"),GD=Symbol("pipes"),BD=Symbol("bufferLength"),Z3=Symbol("bufferPush"),AF=Symbol("bufferShift"),VD=Symbol("objectMode"),DD=Symbol("destroyed"),Y3=Symbol("error"),J3=Symbol("emitData"),Z7=Symbol("emitEnd"),K3=Symbol("emitEnd2"),D0=Symbol("async"),q3=Symbol("abort"),zF=Symbol("aborted"),Hu=Symbol("signal"),R0=Symbol("dataListeners"),wD=Symbol("discarded"),Au=(D)=>Promise.resolve().then(D),h5=(D)=>D(),g5=(D)=>D==="end"||D==="finish"||D==="prefinish",m5=(D)=>D instanceof ArrayBuffer||!!D&&typeof D==="object"&&D.constructor&&D.constructor.name==="ArrayBuffer"&&D.byteLength>=0,c5=(D)=>!Buffer.isBuffer(D)&&ArrayBuffer.isView(D);class H3{src;dest;opts;ondrain;constructor(D,u,F){this.src=D,this.dest=u,this.opts=F,this.ondrain=()=>D[y0](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(D){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class J7 extends H3{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(D,u,F){super(D,u,F);this.proxyErrors=(C)=>u.emit("error",C),D.on("error",this.proxyErrors)}}var d5=(D)=>!!D.objectMode,l5=(D)=>!D.objectMode&&!!D.encoding&&D.encoding!=="buffer";class M0 extends V3{[CD]=!1;[Vu]=!1;[GD]=[];[ED]=[];[VD];[sD];[D0];[v0];[$0]=!1;[z0]=!1;[qF]=!1;[VF]=!1;[qu]=null;[BD]=0;[DD]=!1;[Hu];[zF]=!1;[R0]=0;[wD]=!1;writable=!0;readable=!0;constructor(...D){let u=D[0]||{};super();if(u.objectMode&&typeof u.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(d5(u))this[VD]=!0,this[sD]=null;else if(l5(u))this[sD]=u.encoding,this[VD]=!1;else this[VD]=!1,this[sD]=null;if(this[D0]=!!u.async,this[v0]=this[sD]?new b5(this[sD]):null,u&&u.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[ED]});if(u&&u.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[GD]});let{signal:F}=u;if(F)if(this[Hu]=F,F.aborted)this[q3]();else F.addEventListener("abort",()=>this[q3]())}get bufferLength(){return this[BD]}get encoding(){return this[sD]}set encoding(D){throw new Error("Encoding must be set at instantiation time")}setEncoding(D){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[VD]}set objectMode(D){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[D0]}set["async"](D){this[D0]=this[D0]||!!D}[q3](){this[zF]=!0,this.emit("abort",this[Hu]?.reason),this.destroy(this[Hu]?.reason)}get aborted(){return this[zF]}set aborted(D){}write(D,u,F){if(this[zF])return!1;if(this[$0])throw new Error("write after end");if(this[DD])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof u==="function")F=u,u="utf8";if(!u)u="utf8";let C=this[D0]?Au:h5;if(!this[VD]&&!Buffer.isBuffer(D)){if(c5(D))D=Buffer.from(D.buffer,D.byteOffset,D.byteLength);else if(m5(D))D=Buffer.from(D);else if(typeof D!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[VD]){if(this[CD]&&this[BD]!==0)this[HF](!0);if(this[CD])this.emit("data",D);else this[Z3](D);if(this[BD]!==0)this.emit("readable");if(F)C(F);return this[CD]}if(!D.length){if(this[BD]!==0)this.emit("readable");if(F)C(F);return this[CD]}if(typeof D==="string"&&!(u===this[sD]&&!this[v0]?.lastNeed))D=Buffer.from(D,u);if(Buffer.isBuffer(D)&&this[sD])D=this[v0].write(D);if(this[CD]&&this[BD]!==0)this[HF](!0);if(this[CD])this.emit("data",D);else this[Z3](D);if(this[BD]!==0)this.emit("readable");if(F)C(F);return this[CD]}read(D){if(this[DD])return null;if(this[wD]=!1,this[BD]===0||D===0||D&&D>this[BD])return this[Q0](),null;if(this[VD])D=null;if(this[ED].length>1&&!this[VD])this[ED]=[this[sD]?this[ED].join(""):Buffer.concat(this[ED],this[BD])];let u=this[Q7](D||null,this[ED][0]);return this[Q0](),u}[Q7](D,u){if(this[VD])this[AF]();else{let F=u;if(D===F.length||D===null)this[AF]();else if(typeof F==="string")this[ED][0]=F.slice(D),u=F.slice(0,D),this[BD]-=D;else this[ED][0]=F.subarray(D),u=F.subarray(0,D),this[BD]-=D}if(this.emit("data",u),!this[ED].length&&!this[$0])this.emit("drain");return u}end(D,u,F){if(typeof D==="function")F=D,D=void 0;if(typeof u==="function")F=u,u="utf8";if(D!==void 0)this.write(D,u);if(F)this.once("end",F);if(this[$0]=!0,this.writable=!1,this[CD]||!this[Vu])this[Q0]();return this}[y0](){if(this[DD])return;if(!this[R0]&&!this[GD].length)this[wD]=!0;if(this[Vu]=!1,this[CD]=!0,this.emit("resume"),this[ED].length)this[HF]();else if(this[$0])this[Q0]();else this.emit("drain")}resume(){return this[y0]()}pause(){this[CD]=!1,this[Vu]=!0,this[wD]=!1}get destroyed(){return this[DD]}get flowing(){return this[CD]}get paused(){return this[Vu]}[Z3](D){if(this[VD])this[BD]+=1;else this[BD]+=D.length;this[ED].push(D)}[AF](){if(this[VD])this[BD]-=1;else this[BD]-=this[ED][0].length;return this[ED].shift()}[HF](D=!1){do;while(this[X7](this[AF]())&&this[ED].length);if(!D&&!this[ED].length&&!this[$0])this.emit("drain")}[X7](D){return this.emit("data",D),this[CD]}pipe(D,u){if(this[DD])return D;this[wD]=!1;let F=this[z0];if(u=u||{},D===$7.stdout||D===$7.stderr)u.end=!1;else u.end=u.end!==!1;if(u.proxyErrors=!!u.proxyErrors,F){if(u.end)D.end()}else if(this[GD].push(!u.proxyErrors?new H3(this,D,u):new J7(this,D,u)),this[D0])Au(()=>this[y0]());else this[y0]();return D}unpipe(D){let u=this[GD].find((F)=>F.dest===D);if(u){if(this[GD].length===1){if(this[CD]&&this[R0]===0)this[CD]=!1;this[GD]=[]}else this[GD].splice(this[GD].indexOf(u),1);u.unpipe()}}addListener(D,u){return this.on(D,u)}on(D,u){let F=super.on(D,u);if(D==="data"){if(this[wD]=!1,this[R0]++,!this[GD].length&&!this[CD])this[y0]()}else if(D==="readable"&&this[BD]!==0)super.emit("readable");else if(g5(D)&&this[z0])super.emit(D),this.removeAllListeners(D);else if(D==="error"&&this[qu]){let C=u;if(this[D0])Au(()=>C.call(this,this[qu]));else C.call(this,this[qu])}return F}removeListener(D,u){return this.off(D,u)}off(D,u){let F=super.off(D,u);if(D==="data"){if(this[R0]=this.listeners("data").length,this[R0]===0&&!this[wD]&&!this[GD].length)this[CD]=!1}return F}removeAllListeners(D){let u=super.removeAllListeners(D);if(D==="data"||D===void 0){if(this[R0]=0,!this[wD]&&!this[GD].length)this[CD]=!1}return u}get emittedEnd(){return this[z0]}[Q0](){if(!this[qF]&&!this[z0]&&!this[DD]&&this[ED].length===0&&this[$0]){if(this[qF]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[VF])this.emit("close");this[qF]=!1}}emit(D,...u){let F=u[0];if(D!=="error"&&D!=="close"&&D!==DD&&this[DD])return!1;else if(D==="data")return!this[VD]&&!F?!1:this[D0]?(Au(()=>this[J3](F)),!0):this[J3](F);else if(D==="end")return this[Z7]();else if(D==="close"){if(this[VF]=!0,!this[z0]&&!this[DD])return!1;let E=super.emit("close");return this.removeAllListeners("close"),E}else if(D==="error"){this[qu]=F,super.emit(Y3,F);let E=!this[Hu]||this.listeners("error").length?super.emit("error",F):!1;return this[Q0](),E}else if(D==="resume"){let E=super.emit("resume");return this[Q0](),E}else if(D==="finish"||D==="prefinish"){let E=super.emit(D);return this.removeAllListeners(D),E}let C=super.emit(D,...u);return this[Q0](),C}[J3](D){for(let F of this[GD])if(F.dest.write(D)===!1)this.pause();let u=this[wD]?!1:super.emit("data",D);return this[Q0](),u}[Z7](){if(this[z0])return!1;return this[z0]=!0,this.readable=!1,this[D0]?(Au(()=>this[K3]()),!0):this[K3]()}[K3](){if(this[v0]){let u=this[v0].end();if(u){for(let F of this[GD])F.dest.write(u);if(!this[wD])super.emit("data",u)}}for(let u of this[GD])u.end();let D=super.emit("end");return this.removeAllListeners("end"),D}async collect(){let D=Object.assign([],{dataLength:0});if(!this[VD])D.dataLength=0;let u=this.promise();return this.on("data",(F)=>{if(D.push(F),!this[VD])D.dataLength+=F.length}),await u,D}async concat(){if(this[VD])throw new Error("cannot concat in objectMode");let D=await this.collect();return this[sD]?D.join(""):Buffer.concat(D,D.dataLength)}async promise(){return new Promise((D,u)=>{this.on(DD,()=>u(new Error("stream destroyed"))),this.on("error",(F)=>u(F)),this.on("end",()=>D())})}[Symbol.asyncIterator](){this[wD]=!1;let D=!1,u=async()=>{return this.pause(),D=!0,{value:void 0,done:!0}};return{next:()=>{if(D)return u();let C=this.read();if(C!==null)return Promise.resolve({done:!1,value:C});if(this[$0])return u();let E,$,B=(Y)=>{this.off("data",Q),this.off("end",X),this.off(DD,Z),u(),$(Y)},Q=(Y)=>{this.off("error",B),this.off("end",X),this.off(DD,Z),this.pause(),E({value:Y,done:!!this[$0]})},X=()=>{this.off("error",B),this.off("data",Q),this.off(DD,Z),u(),E({done:!0,value:void 0})},Z=()=>B(new Error("stream destroyed"));return new Promise((Y,J)=>{$=J,E=Y,this.once(DD,Z),this.once("error",B),this.once("end",X),this.once("data",Q)})},throw:u,return:u,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[wD]=!1;let D=!1,u=()=>{return this.pause(),this.off(Y3,u),this.off(DD,u),this.off("end",u),D=!0,{done:!0,value:void 0}},F=()=>{if(D)return u();let C=this.read();return C===null?u():{done:!1,value:C}};return this.once("end",u),this.once(Y3,u),this.once(DD,u),{next:F,throw:u,return:u,[Symbol.iterator](){return this}}}destroy(D){if(this[DD]){if(D)this.emit("error",D);else this.emit(DD);return this}this[DD]=!0,this[wD]=!0,this[ED].length=0,this[BD]=0;let u=this;if(typeof u.close==="function"&&!this[VF])u.close();if(D)this.emit("error",D);else this.emit(DD);return this}static get isStream(){return v5}}var e5=s5.native,Uu={lstatSync:a5,readdir:r5,readdirSync:i5,readlinkSync:o5,realpathSync:e5,promises:{lstat:D$,readdir:u$,readlink:F$,realpath:C$}},A7=(D)=>!D||D===Uu||D===t5?Uu:{...Uu,...D,promises:{...Uu.promises,...D.promises||{}}},z7=/^\\\\\?\\([a-z]:)\\?$/i,E$=(D)=>D.replace(/\//g,"\\").replace(z7,"$1\\"),B$=/[\\\/]/,gD=0,U7=1,_7=2,u0=4,W7=6,G7=8,I0=10,L7=12,hD=15,zu=~hD,A3=16,K7=32,_u=64,tD=128,UF=256,WF=512,q7=_u|tD|WF,$$=1023,z3=(D)=>D.isFile()?G7:D.isDirectory()?u0:D.isSymbolicLink()?I0:D.isCharacterDevice()?_7:D.isBlockDevice()?W7:D.isSocket()?L7:D.isFIFO()?U7:gD,V7=new Map,Wu=(D)=>{let u=V7.get(D);if(u)return u;let F=D.normalize("NFKD");return V7.set(D,F),F},H7=new Map,_F=(D)=>{let u=H7.get(D);if(u)return u;let F=Wu(D.toLowerCase());return H7.set(D,F),F};class _3 extends Ku{constructor(){super({max:256})}}class R7 extends Ku{constructor(D=16384){super({maxSize:D,sizeCalculation:(u)=>u.length+1})}}var M7=Symbol("PathScurry setAsCwd");class LD{name;root;roots;parent;nocase;isCWD=!1;#D;#u;get dev(){return this.#u}#B;get mode(){return this.#B}#E;get nlink(){return this.#E}#$;get uid(){return this.#$}#W;get gid(){return this.#W}#U;get rdev(){return this.#U}#Y;get blksize(){return this.#Y}#Q;get ino(){return this.#Q}#K;get size(){return this.#K}#J;get blocks(){return this.#J}#X;get atimeMs(){return this.#X}#F;get mtimeMs(){return this.#F}#V;get ctimeMs(){return this.#V}#G;get birthtimeMs(){return this.#G}#_;get atime(){return this.#_}#H;get mtime(){return this.#H}#T;get ctime(){return this.#T}#A;get birthtime(){return this.#A}#R;#j;#z;#L;#O;#q;#C;#S;#N;#M;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(D,u=gD,F,C,E,$,B){if(this.name=D,this.#R=E?_F(D):Wu(D),this.#C=u&$$,this.nocase=E,this.roots=C,this.root=F||this,this.#S=$,this.#z=B.fullpath,this.#O=B.relative,this.#q=B.relativePosix,this.parent=B.parent,this.parent)this.#D=this.parent.#D;else this.#D=A7(B.fs)}depth(){if(this.#j!==void 0)return this.#j;if(!this.parent)return this.#j=0;return this.#j=this.parent.depth()+1}childrenCache(){return this.#S}resolve(D){if(!D)return this;let u=this.getRootString(D),C=D.substring(u.length).split(this.splitSep);return u?this.getRoot(u).#m(C):this.#m(C)}#m(D){let u=this;for(let F of D)u=u.child(F);return u}children(){let D=this.#S.get(this);if(D)return D;let u=Object.assign([],{provisional:0});return this.#S.set(this,u),this.#C&=~A3,u}child(D,u){if(D===""||D===".")return this;if(D==="..")return this.parent||this;let F=this.children(),C=this.nocase?_F(D):Wu(D);for(let Q of F)if(Q.#R===C)return Q;let E=this.parent?this.sep:"",$=this.#z?this.#z+E+D:void 0,B=this.newChild(D,gD,{...u,parent:this,fullpath:$});if(!this.canReaddir())B.#C|=tD;return F.push(B),B}relative(){if(this.isCWD)return"";if(this.#O!==void 0)return this.#O;let D=this.name,u=this.parent;if(!u)return this.#O=this.name;let F=u.relative();return F+(!F||!u.parent?"":this.sep)+D}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#q!==void 0)return this.#q;let D=this.name,u=this.parent;if(!u)return this.#q=this.fullpathPosix();let F=u.relativePosix();return F+(!F||!u.parent?"":"/")+D}fullpath(){if(this.#z!==void 0)return this.#z;let D=this.name,u=this.parent;if(!u)return this.#z=this.name;let C=u.fullpath()+(!u.parent?"":this.sep)+D;return this.#z=C}fullpathPosix(){if(this.#L!==void 0)return this.#L;if(this.sep==="/")return this.#L=this.fullpath();if(!this.parent){let C=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(C))return this.#L=`//?/${C}`;else return this.#L=C}let D=this.parent,u=D.fullpathPosix(),F=u+(!u||!D.parent?"":"/")+this.name;return this.#L=F}isUnknown(){return(this.#C&hD)===gD}isType(D){return this[`is${D}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#C&hD)===G7}isDirectory(){return(this.#C&hD)===u0}isCharacterDevice(){return(this.#C&hD)===_7}isBlockDevice(){return(this.#C&hD)===W7}isFIFO(){return(this.#C&hD)===U7}isSocket(){return(this.#C&hD)===L7}isSymbolicLink(){return(this.#C&I0)===I0}lstatCached(){return this.#C&K7?this:void 0}readlinkCached(){return this.#N}realpathCached(){return this.#M}readdirCached(){let D=this.children();return D.slice(0,D.provisional)}canReadlink(){if(this.#N)return!0;if(!this.parent)return!1;let D=this.#C&hD;return!(D!==gD&&D!==I0||this.#C&UF||this.#C&tD)}calledReaddir(){return!!(this.#C&A3)}isENOENT(){return!!(this.#C&tD)}isNamed(D){return!this.nocase?this.#R===Wu(D):this.#R===_F(D)}async readlink(){let D=this.#N;if(D)return D;if(!this.canReadlink())return;if(!this.parent)return;try{let u=await this.#D.promises.readlink(this.fullpath()),F=(await this.parent.realpath())?.resolve(u);if(F)return this.#N=F}catch(u){this.#c(u.code);return}}readlinkSync(){let D=this.#N;if(D)return D;if(!this.canReadlink())return;if(!this.parent)return;try{let u=this.#D.readlinkSync(this.fullpath()),F=this.parent.realpathSync()?.resolve(u);if(F)return this.#N=F}catch(u){this.#c(u.code);return}}#I(D){this.#C|=A3;for(let u=D.provisional;u<D.length;u++){let F=D[u];if(F)F.#f()}}#f(){if(this.#C&tD)return;this.#C=(this.#C|tD)&zu,this.#x()}#x(){let D=this.children();D.provisional=0;for(let u of D)u.#f()}#h(){this.#C|=WF,this.#b()}#b(){if(this.#C&_u)return;let D=this.#C;if((D&hD)===u0)D&=zu;this.#C=D|_u,this.#x()}#w(D=""){if(D==="ENOTDIR"||D==="EPERM")this.#b();else if(D==="ENOENT")this.#f();else this.children().provisional=0}#P(D=""){if(D==="ENOTDIR")this.parent.#b();else if(D==="ENOENT")this.#f()}#c(D=""){let u=this.#C;if(u|=UF,D==="ENOENT")u|=tD;if(D==="EINVAL"||D==="UNKNOWN")u&=zu;if(this.#C=u,D==="ENOTDIR"&&this.parent)this.parent.#b()}#v(D,u){return this.#Z(D,u)||this.#d(D,u)}#d(D,u){let F=z3(D),C=this.newChild(D.name,F,{parent:this}),E=C.#C&hD;if(E!==u0&&E!==I0&&E!==gD)C.#C|=_u;return u.unshift(C),u.provisional++,C}#Z(D,u){for(let F=u.provisional;F<u.length;F++){let C=u[F];if((this.nocase?_F(D.name):Wu(D.name))!==C.#R)continue;return this.#l(D,C,F,u)}}#l(D,u,F,C){let E=u.name;if(u.#C=u.#C&zu|z3(D),E!==D.name)u.name=D.name;if(F!==C.provisional){if(F===C.length-1)C.pop();else C.splice(F,1);C.unshift(u)}return C.provisional++,u}async lstat(){if((this.#C&tD)===0)try{return this.#y(await this.#D.promises.lstat(this.fullpath())),this}catch(D){this.#P(D.code)}}lstatSync(){if((this.#C&tD)===0)try{return this.#y(this.#D.lstatSync(this.fullpath())),this}catch(D){this.#P(D.code)}}#y(D){let{atime:u,atimeMs:F,birthtime:C,birthtimeMs:E,blksize:$,blocks:B,ctime:Q,ctimeMs:X,dev:Z,gid:Y,ino:J,mode:H,mtime:A,mtimeMs:z,nlink:U,rdev:W,size:I,uid:T}=D;this.#_=u,this.#X=F,this.#A=C,this.#G=E,this.#Y=$,this.#J=B,this.#T=Q,this.#V=X,this.#u=Z,this.#W=Y,this.#Q=J,this.#B=H,this.#H=A,this.#F=z,this.#E=U,this.#U=W,this.#K=I,this.#$=T;let R=z3(D);if(this.#C=this.#C&zu|R|K7,R!==gD&&R!==u0&&R!==I0)this.#C|=_u}#k=[];#g=!1;#n(D){this.#g=!1;let u=this.#k.slice();this.#k.length=0,u.forEach((F)=>F(null,D))}readdirCB(D,u=!1){if(!this.canReaddir()){if(u)D(null,[]);else queueMicrotask(()=>D(null,[]));return}let F=this.children();if(this.calledReaddir()){let E=F.slice(0,F.provisional);if(u)D(null,E);else queueMicrotask(()=>D(null,E));return}if(this.#k.push(D),this.#g)return;this.#g=!0;let C=this.fullpath();this.#D.readdir(C,{withFileTypes:!0},(E,$)=>{if(E)this.#w(E.code),F.provisional=0;else{for(let B of $)this.#v(B,F);this.#I(F)}this.#n(F.slice(0,F.provisional));return})}#p;async readdir(){if(!this.canReaddir())return[];let D=this.children();if(this.calledReaddir())return D.slice(0,D.provisional);let u=this.fullpath();if(this.#p)await this.#p;else{let F=()=>{};this.#p=new Promise((C)=>F=C);try{for(let C of await this.#D.promises.readdir(u,{withFileTypes:!0}))this.#v(C,D);this.#I(D)}catch(C){this.#w(C.code),D.provisional=0}this.#p=void 0,F()}return D.slice(0,D.provisional)}readdirSync(){if(!this.canReaddir())return[];let D=this.children();if(this.calledReaddir())return D.slice(0,D.provisional);let u=this.fullpath();try{for(let F of this.#D.readdirSync(u,{withFileTypes:!0}))this.#v(F,D);this.#I(D)}catch(F){this.#w(F.code),D.provisional=0}return D.slice(0,D.provisional)}canReaddir(){if(this.#C&q7)return!1;let D=hD&this.#C;if(!(D===gD||D===u0||D===I0))return!1;return!0}shouldWalk(D,u){return(this.#C&u0)===u0&&!(this.#C&q7)&&!D.has(this)&&(!u||u(this))}async realpath(){if(this.#M)return this.#M;if((WF|UF|tD)&this.#C)return;try{let D=await this.#D.promises.realpath(this.fullpath());return this.#M=this.resolve(D)}catch(D){this.#h()}}realpathSync(){if(this.#M)return this.#M;if((WF|UF|tD)&this.#C)return;try{let D=this.#D.realpathSync(this.fullpath());return this.#M=this.resolve(D)}catch(D){this.#h()}}[M7](D){if(D===this)return;D.isCWD=!1,this.isCWD=!0;let u=new Set([]),F=[],C=this;while(C&&C.parent)u.add(C),C.#O=F.join(this.sep),C.#q=F.join("/"),C=C.parent,F.push("..");C=D;while(C&&C.parent&&!u.has(C))C.#O=void 0,C.#q=void 0,C=C.parent}}class GF extends LD{sep="\\";splitSep=B$;constructor(D,u=gD,F,C,E,$,B){super(D,u,F,C,E,$,B)}newChild(D,u=gD,F={}){return new GF(D,u,this.root,this.roots,this.nocase,this.childrenCache(),F)}getRootString(D){return U3.parse(D).root}getRoot(D){if(D=E$(D.toUpperCase()),D===this.root.name)return this.root;for(let[u,F]of Object.entries(this.roots))if(this.sameRoot(D,u))return this.roots[D]=F;return this.roots[D]=new Gu(D,this).root}sameRoot(D,u=this.root.name){return D=D.toUpperCase().replace(/\//g,"\\").replace(z7,"$1\\"),D===u}}class LF extends LD{splitSep="/";sep="/";constructor(D,u=gD,F,C,E,$,B){super(D,u,F,C,E,$,B)}getRootString(D){return D.startsWith("/")?"/":""}getRoot(D){return this.root}newChild(D,u=gD,F={}){return new LF(D,u,this.root,this.roots,this.nocase,this.childrenCache(),F)}}class W3{root;rootPath;roots;cwd;#D;#u;#B;nocase;#E;constructor(D=process.cwd(),u,F,{nocase:C,childrenCacheSize:E=16384,fs:$=Uu}={}){if(this.#E=A7($),D instanceof URL||D.startsWith("file://"))D=n5(D);let B=u.resolve(D);this.roots=Object.create(null),this.rootPath=this.parseRootPath(B),this.#D=new _3,this.#u=new _3,this.#B=new R7(E);let Q=B.substring(this.rootPath.length).split(F);if(Q.length===1&&!Q[0])Q.pop();if(C===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=C,this.root=this.newRoot(this.#E),this.roots[this.rootPath]=this.root;let X=this.root,Z=Q.length-1,Y=u.sep,J=this.rootPath,H=!1;for(let A of Q){let z=Z--;X=X.child(A,{relative:new Array(z).fill("..").join(Y),relativePosix:new Array(z).fill("..").join("/"),fullpath:J+=(H?"":Y)+A}),H=!0}this.cwd=X}depth(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.depth()}childrenCache(){return this.#B}resolve(...D){let u="";for(let E=D.length-1;E>=0;E--){let $=D[E];if(!$||$===".")continue;if(u=u?`${$}/${u}`:$,this.isAbsolute($))break}let F=this.#D.get(u);if(F!==void 0)return F;let C=this.cwd.resolve(u).fullpath();return this.#D.set(u,C),C}resolvePosix(...D){let u="";for(let E=D.length-1;E>=0;E--){let $=D[E];if(!$||$===".")continue;if(u=u?`${$}/${u}`:$,this.isAbsolute($))break}let F=this.#u.get(u);if(F!==void 0)return F;let C=this.cwd.resolve(u).fullpathPosix();return this.#u.set(u,C),C}relative(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.relative()}relativePosix(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.relativePosix()}basename(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.name}dirname(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return(D.parent||D).fullpath()}async readdir(D=this.cwd,u={withFileTypes:!0}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof LD))u=D,D=this.cwd;let{withFileTypes:F}=u;if(!D.canReaddir())return[];else{let C=await D.readdir();return F?C:C.map((E)=>E.name)}}readdirSync(D=this.cwd,u={withFileTypes:!0}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof LD))u=D,D=this.cwd;let{withFileTypes:F=!0}=u;if(!D.canReaddir())return[];else if(F)return D.readdirSync();else return D.readdirSync().map((C)=>C.name)}async lstat(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.lstat()}lstatSync(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.lstatSync()}async readlink(D=this.cwd,{withFileTypes:u}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof LD))u=D.withFileTypes,D=this.cwd;let F=await D.readlink();return u?F:F?.fullpath()}readlinkSync(D=this.cwd,{withFileTypes:u}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof LD))u=D.withFileTypes,D=this.cwd;let F=D.readlinkSync();return u?F:F?.fullpath()}async realpath(D=this.cwd,{withFileTypes:u}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof LD))u=D.withFileTypes,D=this.cwd;let F=await D.realpath();return u?F:F?.fullpath()}realpathSync(D=this.cwd,{withFileTypes:u}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof LD))u=D.withFileTypes,D=this.cwd;let F=D.realpathSync();return u?F:F?.fullpath()}async walk(D=this.cwd,u={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof LD))u=D,D=this.cwd;let{withFileTypes:F=!0,follow:C=!1,filter:E,walkFilter:$}=u,B=[];if(!E||E(D))B.push(F?D:D.fullpath());let Q=new Set,X=(Y,J)=>{Q.add(Y),Y.readdirCB((H,A)=>{if(H)return J(H);let z=A.length;if(!z)return J();let U=()=>{if(--z===0)J()};for(let W of A){if(!E||E(W))B.push(F?W:W.fullpath());if(C&&W.isSymbolicLink())W.realpath().then((I)=>I?.isUnknown()?I.lstat():I).then((I)=>I?.shouldWalk(Q,$)?X(I,U):U());else if(W.shouldWalk(Q,$))X(W,U);else U()}},!0)},Z=D;return new Promise((Y,J)=>{X(Z,(H)=>{if(H)return J(H);Y(B)})})}walkSync(D=this.cwd,u={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof LD))u=D,D=this.cwd;let{withFileTypes:F=!0,follow:C=!1,filter:E,walkFilter:$}=u,B=[];if(!E||E(D))B.push(F?D:D.fullpath());let Q=new Set([D]);for(let X of Q){let Z=X.readdirSync();for(let Y of Z){if(!E||E(Y))B.push(F?Y:Y.fullpath());let J=Y;if(Y.isSymbolicLink()){if(!(C&&(J=Y.realpathSync())))continue;if(J.isUnknown())J.lstatSync()}if(J.shouldWalk(Q,$))Q.add(J)}}return B}[Symbol.asyncIterator](){return this.iterate()}iterate(D=this.cwd,u={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof LD))u=D,D=this.cwd;return this.stream(D,u)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(D=this.cwd,u={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof LD))u=D,D=this.cwd;let{withFileTypes:F=!0,follow:C=!1,filter:E,walkFilter:$}=u;if(!E||E(D))yield F?D:D.fullpath();let B=new Set([D]);for(let Q of B){let X=Q.readdirSync();for(let Z of X){if(!E||E(Z))yield F?Z:Z.fullpath();let Y=Z;if(Z.isSymbolicLink()){if(!(C&&(Y=Z.realpathSync())))continue;if(Y.isUnknown())Y.lstatSync()}if(Y.shouldWalk(B,$))B.add(Y)}}}stream(D=this.cwd,u={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof LD))u=D,D=this.cwd;let{withFileTypes:F=!0,follow:C=!1,filter:E,walkFilter:$}=u,B=new M0({objectMode:!0});if(!E||E(D))B.write(F?D:D.fullpath());let Q=new Set,X=[D],Z=0,Y=()=>{let J=!1;while(!J){let H=X.shift();if(!H){if(Z===0)B.end();return}Z++,Q.add(H);let A=(U,W,I=!1)=>{if(U)return B.emit("error",U);if(C&&!I){let T=[];for(let R of W)if(R.isSymbolicLink())T.push(R.realpath().then((M)=>M?.isUnknown()?M.lstat():M));if(T.length){Promise.all(T).then(()=>A(null,W,!0));return}}for(let T of W)if(T&&(!E||E(T))){if(!B.write(F?T:T.fullpath()))J=!0}Z--;for(let T of W){let R=T.realpathCached()||T;if(R.shouldWalk(Q,$))X.push(R)}if(J&&!B.flowing)B.once("drain",Y);else if(!z)Y()},z=!0;H.readdirCB(A,!0),z=!1}};return Y(),B}streamSync(D=this.cwd,u={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof LD))u=D,D=this.cwd;let{withFileTypes:F=!0,follow:C=!1,filter:E,walkFilter:$}=u,B=new M0({objectMode:!0}),Q=new Set;if(!E||E(D))B.write(F?D:D.fullpath());let X=[D],Z=0,Y=()=>{let J=!1;while(!J){let H=X.shift();if(!H){if(Z===0)B.end();return}Z++,Q.add(H);let A=H.readdirSync();for(let z of A)if(!E||E(z)){if(!B.write(F?z:z.fullpath()))J=!0}Z--;for(let z of A){let U=z;if(z.isSymbolicLink()){if(!(C&&(U=z.realpathSync())))continue;if(U.isUnknown())U.lstatSync()}if(U.shouldWalk(Q,$))X.push(U)}}if(J&&!B.flowing)B.once("drain",Y)};return Y(),B}chdir(D=this.cwd){let u=this.cwd;this.cwd=typeof D==="string"?this.cwd.resolve(D):D,this.cwd[M7](u)}}class Gu extends W3{sep="\\";constructor(D=process.cwd(),u={}){let{nocase:F=!0}=u;super(D,U3,"\\",{...u,nocase:F});this.nocase=F;for(let C=this.cwd;C;C=C.parent)C.nocase=this.nocase}parseRootPath(D){return U3.parse(D).root.toUpperCase()}newRoot(D){return new GF(this.rootPath,u0,void 0,this.roots,this.nocase,this.childrenCache(),{fs:D})}isAbsolute(D){return D.startsWith("/")||D.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(D)}}class Lu extends W3{sep="/";constructor(D=process.cwd(),u={}){let{nocase:F=!1}=u;super(D,p5,"/",{...u,nocase:F});this.nocase=F}parseRootPath(D){return"/"}newRoot(D){return new LF(this.rootPath,u0,void 0,this.roots,this.nocase,this.childrenCache(),{fs:D})}isAbsolute(D){return D.startsWith("/")}}class RF extends Lu{constructor(D=process.cwd(),u={}){let{nocase:F=!0}=u;super(D,{...u,nocase:F})}}var bJ=process.platform==="win32"?GF:LF,I7=process.platform==="win32"?Gu:process.platform==="darwin"?RF:Lu;var Q$=(D)=>D.length>=1,X$=(D)=>D.length>=1;class f0{#D;#u;#B;length;#E;#$;#W;#U;#Y;#Q;#K=!0;constructor(D,u,F,C){if(!Q$(D))throw new TypeError("empty pattern list");if(!X$(u))throw new TypeError("empty glob list");if(u.length!==D.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=D.length,F<0||F>=this.length)throw new TypeError("index out of range");if(this.#D=D,this.#u=u,this.#B=F,this.#E=C,this.#B===0){if(this.isUNC()){let[E,$,B,Q,...X]=this.#D,[Z,Y,J,H,...A]=this.#u;if(X[0]==="")X.shift(),A.shift();let z=[E,$,B,Q,""].join("/"),U=[Z,Y,J,H,""].join("/");this.#D=[z,...X],this.#u=[U,...A],this.length=this.#D.length}else if(this.isDrive()||this.isAbsolute()){let[E,...$]=this.#D,[B,...Q]=this.#u;if($[0]==="")$.shift(),Q.shift();let X=E+"/",Z=B+"/";this.#D=[X,...$],this.#u=[Z,...Q],this.length=this.#D.length}}}pattern(){return this.#D[this.#B]}isString(){return typeof this.#D[this.#B]==="string"}isGlobstar(){return this.#D[this.#B]===XD}isRegExp(){return this.#D[this.#B]instanceof RegExp}globString(){return this.#W=this.#W||(this.#B===0?this.isAbsolute()?this.#u[0]+this.#u.slice(1).join("/"):this.#u.join("/"):this.#u.slice(this.#B).join("/"))}hasMore(){return this.length>this.#B+1}rest(){if(this.#$!==void 0)return this.#$;if(!this.hasMore())return this.#$=null;return this.#$=new f0(this.#D,this.#u,this.#B+1,this.#E),this.#$.#Q=this.#Q,this.#$.#Y=this.#Y,this.#$.#U=this.#U,this.#$}isUNC(){let D=this.#D;return this.#Y!==void 0?this.#Y:this.#Y=this.#E==="win32"&&this.#B===0&&D[0]===""&&D[1]===""&&typeof D[2]==="string"&&!!D[2]&&typeof D[3]==="string"&&!!D[3]}isDrive(){let D=this.#D;return this.#U!==void 0?this.#U:this.#U=this.#E==="win32"&&this.#B===0&&this.length>1&&typeof D[0]==="string"&&/^[a-z]:$/i.test(D[0])}isAbsolute(){let D=this.#D;return this.#Q!==void 0?this.#Q:this.#Q=D[0]===""&&D.length>1||this.isDrive()||this.isUNC()}root(){let D=this.#D[0];return typeof D==="string"&&this.isAbsolute()&&this.#B===0?D:""}checkFollowGlobstar(){return!(this.#B===0||!this.isGlobstar()||!this.#K)}markFollowGlobstar(){if(this.#B===0||!this.isGlobstar()||!this.#K)return!1;return this.#K=!1,!0}}var Z$=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class Ru{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(D,{nobrace:u,nocase:F,noext:C,noglobstar:E,platform:$=Z$}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=$,this.mmopts={dot:!0,nobrace:u,nocase:F,noext:C,noglobstar:E,optimizationLevel:2,platform:$,nocomment:!0,nonegate:!0};for(let B of D)this.add(B)}add(D){let u=new fD(D,this.mmopts);for(let F=0;F<u.set.length;F++){let C=u.set[F],E=u.globParts[F];if(!C||!E)throw new Error("invalid pattern object");while(C[0]==="."&&E[0]===".")C.shift(),E.shift();let $=new f0(C,E,0,this.platform),B=new fD($.globString(),this.mmopts),Q=E[E.length-1]==="**",X=$.isAbsolute();if(X)this.absolute.push(B);else this.relative.push(B);if(Q)if(X)this.absoluteChildren.push(B);else this.relativeChildren.push(B)}}ignored(D){let u=D.fullpath(),F=`${u}/`,C=D.relative()||".",E=`${C}/`;for(let $ of this.relative)if($.match(C)||$.match(E))return!0;for(let $ of this.absolute)if($.match(u)||$.match(F))return!0;return!1}childrenIgnored(D){let u=D.fullpath()+"/",F=(D.relative()||".")+"/";for(let C of this.relativeChildren)if(C.match(F))return!0;for(let C of this.absoluteChildren)if(C.match(u))return!0;return!1}}class G3{store;constructor(D=new Map){this.store=D}copy(){return new G3(new Map(this.store))}hasWalked(D,u){return this.store.get(D.fullpath())?.has(u.globString())}storeWalked(D,u){let F=D.fullpath(),C=this.store.get(F);if(C)C.add(u.globString());else this.store.set(F,new Set([u.globString()]))}}class j7{store=new Map;add(D,u,F){let C=(u?2:0)|(F?1:0),E=this.store.get(D);this.store.set(D,E===void 0?C:C&E)}entries(){return[...this.store.entries()].map(([D,u])=>[D,!!(u&2),!!(u&1)])}}class O7{store=new Map;add(D,u){if(!D.canReaddir())return;let F=this.store.get(D);if(F){if(!F.find((C)=>C.globString()===u.globString()))F.push(u)}else this.store.set(D,[u])}get(D){let u=this.store.get(D);if(!u)throw new Error("attempting to walk unknown path");return u}entries(){return this.keys().map((D)=>[D,this.store.get(D)])}keys(){return[...this.store.keys()].filter((D)=>D.canReaddir())}}class Mu{hasWalkedCache;matches=new j7;subwalks=new O7;patterns;follow;dot;opts;constructor(D,u){this.opts=D,this.follow=!!D.follow,this.dot=!!D.dot,this.hasWalkedCache=u?u.copy():new G3}processPatterns(D,u){this.patterns=u;let F=u.map((C)=>[D,C]);for(let[C,E]of F){this.hasWalkedCache.storeWalked(C,E);let $=E.root(),B=E.isAbsolute()&&this.opts.absolute!==!1;if($){C=C.resolve($==="/"&&this.opts.root!==void 0?this.opts.root:$);let Y=E.rest();if(!Y){this.matches.add(C,!0,!1);continue}else E=Y}if(C.isENOENT())continue;let Q,X,Z=!1;while(typeof(Q=E.pattern())==="string"&&(X=E.rest()))C=C.resolve(Q),E=X,Z=!0;if(Q=E.pattern(),X=E.rest(),Z){if(this.hasWalkedCache.hasWalked(C,E))continue;this.hasWalkedCache.storeWalked(C,E)}if(typeof Q==="string"){let Y=Q===".."||Q===""||Q===".";this.matches.add(C.resolve(Q),B,Y);continue}else if(Q===XD){if(!C.isSymbolicLink()||this.follow||E.checkFollowGlobstar())this.subwalks.add(C,E);let Y=X?.pattern(),J=X?.rest();if(!X||(Y===""||Y===".")&&!J)this.matches.add(C,B,Y===""||Y===".");else if(Y===".."){let H=C.parent||C;if(!J)this.matches.add(H,B,!0);else if(!this.hasWalkedCache.hasWalked(H,J))this.subwalks.add(H,J)}}else if(Q instanceof RegExp)this.subwalks.add(C,E)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new Mu(this.opts,this.hasWalkedCache)}filterEntries(D,u){let F=this.subwalks.get(D),C=this.child();for(let E of u)for(let $ of F){let B=$.isAbsolute(),Q=$.pattern(),X=$.rest();if(Q===XD)C.testGlobstar(E,$,X,B);else if(Q instanceof RegExp)C.testRegExp(E,Q,X,B);else C.testString(E,Q,X,B)}return C}testGlobstar(D,u,F,C){if(this.dot||!D.name.startsWith(".")){if(!u.hasMore())this.matches.add(D,C,!1);if(D.canReaddir()){if(this.follow||!D.isSymbolicLink())this.subwalks.add(D,u);else if(D.isSymbolicLink()){if(F&&u.checkFollowGlobstar())this.subwalks.add(D,F);else if(u.markFollowGlobstar())this.subwalks.add(D,u)}}}if(F){let E=F.pattern();if(typeof E==="string"&&E!==".."&&E!==""&&E!==".")this.testString(D,E,F.rest(),C);else if(E===".."){let $=D.parent||D;this.subwalks.add($,F)}else if(E instanceof RegExp)this.testRegExp(D,E,F.rest(),C)}}testRegExp(D,u,F,C){if(!u.test(D.name))return;if(!F)this.matches.add(D,C,!1);else this.subwalks.add(D,F)}testString(D,u,F,C){if(!D.isNamed(u))return;if(!F)this.matches.add(D,C,!1);else this.subwalks.add(D,F)}}var Y$=(D,u)=>typeof D==="string"?new Ru([D],u):Array.isArray(D)?new Ru(D,u):D;class L3{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#D=[];#u;#B;signal;maxDepth;includeChildMatches;constructor(D,u,F){if(this.patterns=D,this.path=u,this.opts=F,this.#B=!F.posix&&F.platform==="win32"?"\\":"/",this.includeChildMatches=F.includeChildMatches!==!1,F.ignore||!this.includeChildMatches){if(this.#u=Y$(F.ignore??[],F),!this.includeChildMatches&&typeof this.#u.add!=="function")throw new Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=F.maxDepth||1/0,F.signal)this.signal=F.signal,this.signal.addEventListener("abort",()=>{this.#D.length=0})}#E(D){return this.seen.has(D)||!!this.#u?.ignored?.(D)}#$(D){return!!this.#u?.childrenIgnored?.(D)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let D=void 0;while(!this.paused&&(D=this.#D.shift()))D()}onResume(D){if(this.signal?.aborted)return;if(!this.paused)D();else this.#D.push(D)}async matchCheck(D,u){if(u&&this.opts.nodir)return;let F;if(this.opts.realpath){if(F=D.realpathCached()||await D.realpath(),!F)return;D=F}let E=D.isUnknown()||this.opts.stat?await D.lstat():D;if(this.opts.follow&&this.opts.nodir&&E?.isSymbolicLink()){let $=await E.realpath();if($&&($.isUnknown()||this.opts.stat))await $.lstat()}return this.matchCheckTest(E,u)}matchCheckTest(D,u){return D&&(this.maxDepth===1/0||D.depth()<=this.maxDepth)&&(!u||D.canReaddir())&&(!this.opts.nodir||!D.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!D.isSymbolicLink()||!D.realpathCached()?.isDirectory())&&!this.#E(D)?D:void 0}matchCheckSync(D,u){if(u&&this.opts.nodir)return;let F;if(this.opts.realpath){if(F=D.realpathCached()||D.realpathSync(),!F)return;D=F}let E=D.isUnknown()||this.opts.stat?D.lstatSync():D;if(this.opts.follow&&this.opts.nodir&&E?.isSymbolicLink()){let $=E.realpathSync();if($&&($?.isUnknown()||this.opts.stat))$.lstatSync()}return this.matchCheckTest(E,u)}matchFinish(D,u){if(this.#E(D))return;if(!this.includeChildMatches&&this.#u?.add){let E=`${D.relativePosix()}/**`;this.#u.add(E)}let F=this.opts.absolute===void 0?u:this.opts.absolute;this.seen.add(D);let C=this.opts.mark&&D.isDirectory()?this.#B:"";if(this.opts.withFileTypes)this.matchEmit(D);else if(F){let E=this.opts.posix?D.fullpathPosix():D.fullpath();this.matchEmit(E+C)}else{let E=this.opts.posix?D.relativePosix():D.relative(),$=this.opts.dotRelative&&!E.startsWith(".."+this.#B)?"."+this.#B:"";this.matchEmit(!E?"."+C:$+E+C)}}async match(D,u,F){let C=await this.matchCheck(D,F);if(C)this.matchFinish(C,u)}matchSync(D,u,F){let C=this.matchCheckSync(D,F);if(C)this.matchFinish(C,u)}walkCB(D,u,F){if(this.signal?.aborted)F();this.walkCB2(D,u,new Mu(this.opts),F)}walkCB2(D,u,F,C){if(this.#$(D))return C();if(this.signal?.aborted)C();if(this.paused){this.onResume(()=>this.walkCB2(D,u,F,C));return}F.processPatterns(D,u);let E=1,$=()=>{if(--E===0)C()};for(let[B,Q,X]of F.matches.entries()){if(this.#E(B))continue;E++,this.match(B,Q,X).then(()=>$())}for(let B of F.subwalkTargets()){if(this.maxDepth!==1/0&&B.depth()>=this.maxDepth)continue;E++;let Q=B.readdirCached();if(B.calledReaddir())this.walkCB3(B,Q,F,$);else B.readdirCB((X,Z)=>this.walkCB3(B,Z,F,$),!0)}$()}walkCB3(D,u,F,C){F=F.filterEntries(D,u);let E=1,$=()=>{if(--E===0)C()};for(let[B,Q,X]of F.matches.entries()){if(this.#E(B))continue;E++,this.match(B,Q,X).then(()=>$())}for(let[B,Q]of F.subwalks.entries())E++,this.walkCB2(B,Q,F.child(),$);$()}walkCBSync(D,u,F){if(this.signal?.aborted)F();this.walkCB2Sync(D,u,new Mu(this.opts),F)}walkCB2Sync(D,u,F,C){if(this.#$(D))return C();if(this.signal?.aborted)C();if(this.paused){this.onResume(()=>this.walkCB2Sync(D,u,F,C));return}F.processPatterns(D,u);let E=1,$=()=>{if(--E===0)C()};for(let[B,Q,X]of F.matches.entries()){if(this.#E(B))continue;this.matchSync(B,Q,X)}for(let B of F.subwalkTargets()){if(this.maxDepth!==1/0&&B.depth()>=this.maxDepth)continue;E++;let Q=B.readdirSync();this.walkCB3Sync(B,Q,F,$)}$()}walkCB3Sync(D,u,F,C){F=F.filterEntries(D,u);let E=1,$=()=>{if(--E===0)C()};for(let[B,Q,X]of F.matches.entries()){if(this.#E(B))continue;this.matchSync(B,Q,X)}for(let[B,Q]of F.subwalks.entries())E++,this.walkCB2Sync(B,Q,F.child(),$);$()}}class MF extends L3{matches=new Set;constructor(D,u,F){super(D,u,F)}matchEmit(D){this.matches.add(D)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((D,u)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)u(this.signal.reason);else D(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class IF extends L3{results;constructor(D,u,F){super(D,u,F);this.results=new M0({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(D){if(this.results.write(D),!this.results.flowing)this.pause()}stream(){let D=this.path;if(D.isUnknown())D.lstat().then(()=>{this.walkCB(D,this.patterns,()=>this.results.end())});else this.walkCB(D,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var K$=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class F0{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(D,u){if(!u)throw new TypeError("glob options required");if(this.withFileTypes=!!u.withFileTypes,this.signal=u.signal,this.follow=!!u.follow,this.dot=!!u.dot,this.dotRelative=!!u.dotRelative,this.nodir=!!u.nodir,this.mark=!!u.mark,!u.cwd)this.cwd="";else if(u.cwd instanceof URL||u.cwd.startsWith("file://"))u.cwd=J$(u.cwd);if(this.cwd=u.cwd||"",this.root=u.root,this.magicalBraces=!!u.magicalBraces,this.nobrace=!!u.nobrace,this.noext=!!u.noext,this.realpath=!!u.realpath,this.absolute=u.absolute,this.includeChildMatches=u.includeChildMatches!==!1,this.noglobstar=!!u.noglobstar,this.matchBase=!!u.matchBase,this.maxDepth=typeof u.maxDepth==="number"?u.maxDepth:1/0,this.stat=!!u.stat,this.ignore=u.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof D==="string")D=[D];if(this.windowsPathsNoEscape=!!u.windowsPathsNoEscape||u.allowWindowsEscape===!1,this.windowsPathsNoEscape)D=D.map((Q)=>Q.replace(/\\/g,"/"));if(this.matchBase){if(u.noglobstar)throw new TypeError("base matching requires globstar");D=D.map((Q)=>Q.includes("/")?Q:`./**/${Q}`)}if(this.pattern=D,this.platform=u.platform||K$,this.opts={...u,platform:this.platform},u.scurry){if(this.scurry=u.scurry,u.nocase!==void 0&&u.nocase!==u.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let Q=u.platform==="win32"?Gu:u.platform==="darwin"?RF:u.platform?Lu:I7;this.scurry=new Q(this.cwd,{nocase:u.nocase,fs:u.fs})}this.nocase=this.scurry.nocase;let F=this.platform==="darwin"||this.platform==="win32",C={...u,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:F,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},E=this.pattern.map((Q)=>new fD(Q,C)),[$,B]=E.reduce((Q,X)=>{return Q[0].push(...X.set),Q[1].push(...X.globParts),Q},[[],[]]);this.patterns=$.map((Q,X)=>{let Z=B[X];if(!Z)throw new Error("invalid pattern object");return new f0(Q,Z,0,this.platform)})}async walk(){return[...await new MF(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new MF(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new IF(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new IF(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}var R3=(D,u={})=>{if(!Array.isArray(D))D=[D];for(let F of D)if(new fD(F,u).hasMagic())return!0;return!1};function OF(D,u={}){return new F0(D,u).streamSync()}function N7(D,u={}){return new F0(D,u).stream()}function w7(D,u={}){return new F0(D,u).walkSync()}async function T7(D,u={}){return new F0(D,u).walk()}function TF(D,u={}){return new F0(D,u).iterateSync()}function k7(D,u={}){return new F0(D,u).iterate()}var q$=OF,V$=Object.assign(N7,{sync:OF}),H$=TF,A$=Object.assign(k7,{sync:TF}),z$=Object.assign(w7,{stream:OF,iterate:TF}),jF=Object.assign(T7,{glob:T7,globSync:w7,sync:z$,globStream:N7,stream:V$,globStreamSync:OF,streamSync:q$,globIterate:k7,iterate:A$,globIterateSync:TF,iterateSync:H$,Glob:F0,hasMagic:R3,escape:x0,unescape:oD});jF.glob=jF;UD();async function S7(D,u={}){let F=P.getInstance().getTrashDirectory();if(!P7(F))_$(F,{recursive:!0});let C=Array.isArray(D)?D:[D];for(let E of C){let $=await jF(E),B=$.length>0?$:[E];for(let Q of B)try{if(!P7(Q)){if(!u.force){console.error(`trash: ${Q}: No such file or directory`);continue}continue}if(W$(Q).isDirectory()&&!u.recursive){if(!u.force){console.error(`trash: ${Q}: is a directory`);continue}}let Z=L$(Q),Y=Date.now(),J=G$(F,`${Z}.${Y}`);U$(Q,J),console.log(`Moved ${Z} to trash`)}catch(X){if(!u.force){let Z=X instanceof Error?X.message:String(X);console.error(`trash: ${Q}: ${Z}`)}}}}import{readdirSync as b7,statSync as v7}from"fs";import{join as y7}from"path";UD();function R$(D){let u=D.lastIndexOf(".");if(u===-1)return{name:D,timestamp:0};let F=parseInt(D.substring(u+1));if(isNaN(F))return{name:D,timestamp:0};return{name:D.substring(0,u),timestamp:F}}function x7(D){if(D===0)return"0 B";let u=1024,F=["B","KB","MB","GB"],C=Math.floor(Math.log(D)/Math.log(u));return parseFloat((D/Math.pow(u,C)).toFixed(2))+" "+F[C]}function f7(D){let u=0,F=b7(D);for(let C of F){let E=y7(D,C),$=v7(E);if($.isDirectory())u+=f7(E);else u+=$.size}return u}async function h7(){let D=P.getInstance().getTrashDirectory();try{let u=b7(D);if(u.length===0){AD.info("\uD83D\uDDD1 Trash is empty");return}let F=u.map((B)=>{let Q=y7(D,B),X=v7(Q),{name:Z,timestamp:Y}=R$(B),J=X.isDirectory()?f7(Q):X.size;return{originalName:Z,trashedName:B,size:J,trashedAt:new Date(Y),isDirectory:X.isDirectory()}});F.sort((B,Q)=>Q.trashedAt.getTime()-B.trashedAt.getTime()),console.log(`
\uD83D\uDDD1 Trash Contents
`),console.log("─".repeat(80));let C=0,E=0,$=0;for(let B of F){if(C+=B.size,B.isDirectory)E++;else $++;let Q=B.isDirectory?"\uD83D\uDCC1":"\uD83D\uDCC4",X=B.trashedAt.toLocaleString(),Z=x7(B.size);console.log(`${Q} ${B.originalName}`),console.log(` Size: ${Z} | Trashed: ${X}`),console.log(` ID: ${B.trashedName}`),console.log()}console.log("─".repeat(80)),console.log(`Total: ${E} folders, ${$} files (${x7(C)})`),console.log(`
To restore files: claude-mem restore`),console.log("To empty trash: claude-mem trash empty")}catch(u){if(u.code==="ENOENT")AD.info("\uD83D\uDDD1 Trash is empty");else AD.error("Failed to read trash directory"),console.error(u)}}import{rmSync as M$,readdirSync as I$,existsSync as j$,statSync as O$}from"fs";import{join as g7}from"path";UD();async function m7(D={}){let u=P.getInstance().getTrashDirectory();if(!j$(u)){AD.info("\uD83D\uDDD1 Trash is already empty");return}try{let F=I$(u);if(F.length===0){AD.info("\uD83D\uDDD1 Trash is already empty");return}let C=0,E=0;for(let B of F){let Q=g7(u,B);if(O$(Q).isDirectory())C++;else E++}if(!D.force){let B=await O0({message:`Permanently delete ${C} folders and ${E} files from trash?`,initialValue:!1});if(SD(B)||!B){AD.info("Cancelled - trash not emptied");return}}let $=G8();$.start("Emptying trash...");for(let B of F){let Q=g7(u,B);M$(Q,{recursive:!0,force:!0})}$.stop(`\uD83D\uDDD1 Trash emptied - permanently deleted ${C} folders and ${E} files`)}catch(F){AD.error("Failed to empty trash"),console.error(F),process.exit(1)}}import{readdirSync as T$,renameSync as N$}from"fs";import{join as c7}from"path";UD();async function d7(){let D=P.getInstance().getTrashDirectory(),u=T$(D);if(u.length===0){console.log("Trash is empty");return}let F=await xu({message:"Select file to restore:",options:u.map((C)=>({value:C,label:C}))});if(SD(F))return;N$(c7(D,F),c7(process.cwd(),F)),console.log(`Restored ${F}`)}import{query as l7}from"@anthropic-ai/claude-agent-sdk";import i from"fs";import MD from"path";import{execSync as p7}from"child_process";async function a7(D){try{if(D.update){await n7(D);return}let u=MD.join(process.cwd(),"package.json"),F="unknown",C="unknown";if(i.existsSync(u))try{let G=JSON.parse(i.readFileSync(u,"utf-8"));F=G.version||"unknown",C=G.name||MD.basename(process.cwd())}catch(G){C=MD.basename(process.cwd())}let E=[],$=D.historical||1;if(D.generate)E.push(D.generate),$=1,console.log(`\uD83C\uDFAF Generating changelog for specific version: ${D.generate}`);else if(F!=="unknown"){let G=F.split(".");if(G.length===3){let N=parseInt(G[0]),b=parseInt(G[1]),v=parseInt(G[2]);for(let w=0;w<$;w++)if(E.push(`${N}.${b}.${v}`),v===0){if(b===0)break;b--,v=9}else v--}}if(E.length===0)console.log("⚠️ Could not determine versions to search. Please check package.json"),process.exit(1);let B=MD.join(process.env.HOME||process.env.USERPROFILE||"",".claude-mem","projects"),Q=MD.join(B,`${C}-changelog.jsonl`),X=!1;if(i.existsSync(Q)){let G=i.readFileSync(Q,"utf-8").split(`
`).filter((N)=>N.trim());for(let N of G)try{if(JSON.parse(N).version===F)X=!0}catch(b){}if(!D.historical&&!D.generate&&$===1){if(X)console.log(`❌ Version ${F} already has changelog entries.`),console.log(`
\uD83D\uDCDD Workflow:`),console.log(" 1. Make your code updates"),console.log(" 2. Build and test: bun run build"),console.log(" 3. Bump version: npm version patch"),console.log(" 4. Generate changelog: claude-mem changelog"),console.log(` 5. Commit and push
`),console.log("\uD83D\uDCA1 Or use --historical 1 to regenerate this version's changelog"),process.exit(1)}}let Z=[];if(D.start&&D.end){let G=D.generate||F;Z.push({version:G,startTime:D.start,endTime:D.end}),console.log(`\uD83D\uDCC5 Using custom time range for ${G}:`),console.log(` Start: ${new Date(D.start).toLocaleString()}`),console.log(` End: ${new Date(D.end).toLocaleString()}`)}else try{let G=p7(`npm view ${C} time --json`,{encoding:"utf-8",timeout:5000}),N=JSON.parse(G),b="";if($>1){let w=E[E.length-1].split("."),m=parseInt(w[0]),c=parseInt(w[1]),mD=parseInt(w[2]);if(mD>0)b=`${m}.${c}.${mD-1}`;else if(c>0){let X0=`${m}.${c-1}.`,o=Object.keys(N).filter((ZD)=>ZD.startsWith(X0)).sort((ZD,cD)=>{let C0=parseInt(ZD.split(".")[2]||"0");return parseInt(cD.split(".")[2]||"0")-C0});if(o.length>0)b=o[0]}else if(m>0){let X0=`${m-1}.`,o=Object.keys(N).filter((ZD)=>ZD.startsWith(X0)).sort((ZD,cD)=>{let[,C0,$D]=ZD.split(".").map(Number),[,YD,g0]=cD.split(".").map(Number);if(C0!==YD)return YD-C0;return g0-$D});if(o.length>0)b=o[0]}if(D.verbose&&b&&N[b])console.log(`\uD83D\uDCCD Using ${b} as start boundary for time ranges`)}for(let v=0;v<E.length;v++){let w=E[v],m="2000-01-01T00:00:00Z";if(v===0){let mD=w.split("."),X0=parseInt(mD[0]),o=parseInt(mD[1]),ZD=parseInt(mD[2]),cD="";if(ZD>0)cD=`${X0}.${o}.${ZD-1}`;else if(o>0){let C0=`${X0}.${o-1}.`,$D=Object.keys(N).filter((YD)=>YD.startsWith(C0)).sort((YD,g0)=>{let NF=parseInt(YD.split(".")[2]||"0");return parseInt(g0.split(".")[2]||"0")-NF});if($D.length>0)cD=$D[0]}if(N[cD])m=N[cD]}else if(v<E.length-1){let mD=E[v+1];if(N[mD])m=N[mD]}else if(b&&N[b])m=N[b];let c=N[w]||new Date().toISOString();if(Z.push({version:w,startTime:m,endTime:c}),D.verbose)console.log(`\uD83D\uDCC5 Version ${w}: ${new Date(m).toLocaleString()} - ${new Date(c).toLocaleString()}`)}if($===1){let v=Z[0];if(v)console.log(`\uD83D\uDCE6 Using npm time range for ${v.version}: ${new Date(v.startTime).toLocaleString()} - ${new Date(v.endTime).toLocaleString()}`)}}catch(G){console.log("❌ Could not fetch npm publish times. Cannot proceed without time ranges."),process.exit(1)}console.log(`\uD83D\uDD0D Searching memories for versions: ${E.join(", ")}`),console.log(`\uD83D\uDCE6 Project: ${C}
`);let Y=Z.length>0?`You are helping generate a changelog by searching for memories within specific time ranges for multiple versions.
PROJECT: ${C}
VERSION TIME RANGES:
${Z.map((G)=>`- Version ${G.version}: ${new Date(G.startTime).toLocaleDateString()} to ${new Date(G.endTime).toLocaleDateString()}`).join(`
`)}
YOUR TASK:
Use mcp__claude-mem__chroma_query_documents to search for memories for each version time range.
SEARCH STRATEGY:
${Z.map((G)=>{let N=new Date(G.startTime),b=new Date(G.endTime),v=[],w=new Date(N);while(w<=b){let m=w.toISOString().split("T")[0];v.push(m),w.setDate(w.getDate()+1)}return`
Version ${G.version} (${new Date(G.startTime).toLocaleDateString()} to ${new Date(G.endTime).toLocaleDateString()}):
1. Search for memories from these dates: ${v.join(", ")}
2. Make multiple calls to mcp__claude-mem__chroma_query_documents:
- collection_name: "claude_memories"
- query_texts: Include the project name AND date in each query:
* "${C} ${v[0]} feature"
* "${C} ${v[0]} fix"
* "${C} ${v[0]} change"
* "${C} ${v[0]} improvement"
* "${C} ${v[0]} refactor"
- n_results: 50
3. The date in the query text helps semantic search find memories from that day
4. Assign memories to this version if their timestamp falls within:
- Start: ${G.startTime}
- End: ${G.endTime}`}).join(`
`)}
IMPORTANT:
- Always include project name and date in query_texts for best results
- Semantic search will naturally find memories near those dates
- Group returned memories by version based on their timestamp metadata
Return a JSON object with this structure:
{
"memories": [
{
"version": "version_number",
"text": "memory content",
"metadata": {metadata object with timestamp},
"relevance": "high/medium/low"
}
]
}
Group memories by the version they belong to based on timestamp.
Start searching now.`:"ERROR: No time ranges available. This should never happen.";if(Z.length===0)console.log("❌ No time ranges available. Cannot search memories."),process.exit(1);if(D.verbose)console.log("\uD83D\uDCDD Calling Claude to search memories...");let J=await l7({prompt:Y,options:{allowedTools:["mcp__claude-mem__chroma_query_documents","mcp__claude-mem__chroma_get_documents"],pathToClaudeCodeExecutable:$u()}}),H="";if(J&&typeof J==="object"&&Symbol.asyncIterator in J){for await(let G of J)if(G?.type==="assistant"&&G?.message?.content){let N=G.message.content;if(typeof N==="string")H+=N;else if(Array.isArray(N)){for(let b of N)if(b.type==="text"&&b.text)H+=b.text}}}let A=[];try{let G=H.match(/```json\n([\s\S]*?)\n```/)||H.match(/\{[\s\S]*\}/);if(G){let N=JSON.parse(G[1]||G[0]);if(N.memories&&Array.isArray(N.memories))A=N.memories}}catch(G){console.error("⚠️ Could not parse memory search results:",G)}if(A.length===0){console.log(`
⚠️ No version-related memories found for this version.`),console.log(" This is normal for the first release or when no changes were tracked."),console.log(" Creating a placeholder changelog entry...");let G={version:E[0],date:U,type:"Changed",description:"Initial release or minor updates",timestamp:new Date().toISOString(),generatedAt:new Date().toISOString()};if(!i.existsSync(B))i.mkdirSync(B,{recursive:!0});let N=JSON.stringify(G)+`
`;i.appendFileSync(Q,N),console.log(`✅ Created placeholder changelog entry for v${E[0]}`),await n7(D);return}console.log(`✅ Found ${A.length} version-related memories
`);let U=p7('date "+%Y-%m-%d %H:%M:%S %Z"').toString().trim().split(" ")[0],W=`Analyze these memories and generate changelog entries.
PROJECT: ${C}
DATE: ${U}
MEMORIES BY VERSION:
${E.map((G)=>{let N=A.filter((b)=>b.version===G);if(N.length===0)return`### Version ${G}
No memories found.`;return`### Version ${G} (${N.length} memories):
${N.map((b,v)=>`${v+1}. ${b.text}`).join(`
`)}`}).join(`
`)}
INSTRUCTIONS:
1. Extract concrete changes, fixes, and additions from the memories
2. Categorize each change as: Added, Changed, Fixed, Removed, Deprecated, or Security
3. Write clear, user-facing descriptions
4. Start each entry with an action verb
5. Focus on what matters to users, not internal implementation details
Return ONLY a JSON array with this structure:
[
{
"version": "3.6.1",
"type": "Added",
"description": "New feature description"
},
{
"version": "3.6.1",
"type": "Fixed",
"description": "Bug fix description"
}
]`;console.log("\uD83D\uDD04 Generating changelog entries...");let I=await l7({prompt:W,options:{allowedTools:[],pathToClaudeCodeExecutable:$u()}}),T="";if(I&&typeof I==="object"&&Symbol.asyncIterator in I){for await(let G of I)if(G?.type==="assistant"&&G?.message?.content){let N=G.message.content;if(typeof N==="string")T+=N;else if(Array.isArray(N)){for(let b of N)if(b.type==="text"&&b.text)T+=b.text}}}let R=[];try{let G=T.match(/```json\n([\s\S]*?)\n```/)||T.match(/\[[\s\S]*\]/);if(G){let N=JSON.parse(G[1]||G[0]);if(Array.isArray(N)){let b=new Date().toISOString();R=N.map((v)=>({...v,date:U,timestamp:v.timestamp||b,generatedAt:b}))}}}catch(G){console.error("⚠️ Could not parse changelog entries:",G)}if(R.length===0)console.log("⚠️ No changelog entries generated."),process.exit(1);if(!i.existsSync(B))i.mkdirSync(B,{recursive:!0});if(console.log(`
\uD83D\uDCBE Saving ${R.length} changelog entries to ${MD.basename(Q)}`),D.historical&&$>1||D.generate){let G=[];if(i.existsSync(Q)){let v=i.readFileSync(Q,"utf-8").split(`
`).filter((w)=>w.trim());for(let w of v)try{let m=JSON.parse(w);if(!E.includes(m.version))G.push(m)}catch(m){}}let b=[...G,...R].map((v)=>JSON.stringify(v)).join(`
`)+`
`;i.writeFileSync(Q,b),console.log(`\uD83D\uDD04 Regenerated entries for versions: ${E.join(", ")}`)}else{let G=R.map((N)=>JSON.stringify(N)).join(`
`)+`
`;i.appendFileSync(Q,G)}console.log(`
\uD83D\uDCDD Generating CHANGELOG.md from entries...`);let M=[];if(i.existsSync(Q)){let G=i.readFileSync(Q,"utf-8").split(`
`).filter((N)=>N.trim());for(let N of G)try{M.push(JSON.parse(N))}catch(b){}}let k=new Map;for(let G of M){if(!k.has(G.version))k.set(G.version,[]);k.get(G.version).push(G)}let x=`# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
`,HD=Array.from(k.keys()).sort((G,N)=>{let b=G.split(".").map(Number),v=N.split(".").map(Number);for(let w=0;w<3;w++)if(b[w]!==v[w])return v[w]-b[w];return 0});for(let G of HD){let N=k.get(G),b=N[0].date||U;x+=`
## [${G}] - ${b}
`;let v=["Added","Changed","Fixed","Removed","Deprecated","Security"];for(let w of v){let m=N.filter((c)=>c.type===w);if(m.length>0){x+=`### ${w}
`;for(let c of m)x+=`- ${c.description}
`;x+=`
`}}}let kD=MD.join(process.cwd(),"CHANGELOG.md");if(i.writeFileSync(kD,x),console.log(`✅ Generated CHANGELOG.md with ${M.length} total entries across ${k.size} versions!`),D.preview){if(console.log(`
\uD83D\uDCC4 Preview:
`),console.log(x.split(`
`).slice(0,30).join(`
`)),x.split(`
`).length>30)console.log(`
... (truncated for preview)`)}}catch(u){if(console.error("❌ Error generating changelog:",u instanceof Error?u.message:u),u instanceof Error&&u.stack)console.error("Stack:",u.stack);process.exit(1)}}async function n7(D){try{let u=MD.join(process.cwd(),"package.json"),F="unknown";if(i.existsSync(u))try{F=JSON.parse(i.readFileSync(u,"utf-8")).name||MD.basename(process.cwd())}catch(J){F=MD.basename(process.cwd())}let C=MD.join(process.env.HOME||process.env.USERPROFILE||"",".claude-mem","projects"),E=MD.join(C,`${F}-changelog.jsonl`);if(!i.existsSync(E))console.log("❌ No changelog entries found. Generate some first with: claude-mem changelog"),process.exit(1);console.log("\uD83D\uDCDD Updating CHANGELOG.md from JSONL entries...");let $=[],B=i.readFileSync(E,"utf-8").split(`
`).filter((J)=>J.trim());for(let J of B)try{$.push(JSON.parse(J))}catch(H){}if($.length===0)console.log("❌ No valid entries found in JSONL file"),process.exit(1);let Q=new Map;for(let J of $){if(!Q.has(J.version))Q.set(J.version,[]);Q.get(J.version).push(J)}let X=`# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
`,Z=Array.from(Q.keys()).sort((J,H)=>{let A=J.split(".").map(Number),z=H.split(".").map(Number);for(let U=0;U<3;U++)if(A[U]!==z[U])return z[U]-A[U];return 0});for(let J of Z){let H=Q.get(J),A=H[0].date;X+=`
## [${J}] - ${A}
`;let z=["Added","Changed","Fixed","Removed","Deprecated","Security"];for(let U of z){let W=H.filter((I)=>I.type===U);if(W.length>0){X+=`### ${U}
`;for(let I of W)X+=`- ${I.description}
`;X+=`
`}}}let Y=MD.join(process.cwd(),"CHANGELOG.md");if(i.writeFileSync(Y,X),console.log(`✅ Updated CHANGELOG.md with ${$.length} entries across ${Q.size} versions!`),D.preview){if(console.log(`
\uD83D\uDCC4 Preview:
`),console.log(X.split(`
`).slice(0,30).join(`
`)),X.split(`
`).length>30)console.log(`
... (truncated for preview)`)}}catch(u){console.error("❌ Error updating changelog:",u instanceof Error?u.message:u),process.exit(1)}}UD();import h0 from"fs";import w$ from"path";function k$(D){let u=D.status==="pass"?"✅":D.status==="warn"?"⚠️ ":"❌",F=D.details?`${D.name}: ${D.details}`:D.name;console.log(`${u} ${F}`)}async function r7(D={}){let u=P.getInstance(),F=[];try{let E=u.getDataDirectory();if(!h0.existsSync(E))h0.mkdirSync(E,{recursive:!0}),F.push({name:`Data directory created at ${E}`,status:"warn"});else{let $=h0.statSync(E),B=!1;try{h0.accessSync(E,h0.constants.W_OK),B=!0}catch{}F.push({name:`Data directory ${E}`,status:$.isDirectory()&&B?"pass":"fail",details:$.isDirectory()&&B?"accessible":"not writable"})}}catch(E){F.push({name:"Data directory",status:"fail",details:E?.message||String(E)})}let C;try{C=await iD();let E=C.sessions.count();F.push({name:"SQLite database",status:"pass",details:`${E} session${E===1?"":"s"} present`})}catch(E){F.push({name:"SQLite database",status:"fail",details:E?.message||String(E)})}try{let E=u.getChromaDirectory(),$=h0.existsSync(E);F.push({name:"Chroma vector store",status:$?"pass":"warn",details:$?`data dir ${w$.resolve(E)}`:"Not yet initialized"})}catch(E){F.push({name:"Chroma vector store",status:"warn",details:E?.message||"Unable to check Chroma directory"})}if(D.json)console.log(JSON.stringify({checks:F},null,2));else console.log("claude-mem doctor"),console.log("================="),F.forEach(k$);YF("info","doctor run completed",{status:F.map((E)=>E.status)})}import{spawnSync as i7}from"child_process";async function o7(D){let{id:u,project:F,session:C,date:E,title:$,subtitle:B,facts:Q,concepts:X,files:Z}=D;if(!u||!F||!C||!E)console.error("Error: All fields required: --id, --project, --session, --date"),process.exit(1);if(!$||!B||!Q)console.error("Error: Hierarchical format required: --title, --subtitle, --facts"),process.exit(1);try{let Y=await iD(),J=new Date().toISOString();if(!await Y.sessions.has(C))await Y.sessions.create({session_id:C,project:F,created_at:J,source:"save"});let A,z,U;try{A=Q?JSON.stringify(JSON.parse(Q)):void 0}catch(I){A=Q}try{z=X?JSON.stringify(JSON.parse(X)):void 0}catch(I){z=X}try{U=Z?JSON.stringify(JSON.parse(Z)):void 0}catch(I){U=Z}if(!Y.memories.hasDocumentId(u))Y.memories.create({document_id:u,text:"",keywords:"",session_id:C,project:F,created_at:J,origin:"streaming-sdk",title:$||void 0,subtitle:B||void 0,facts:A,concepts:z,files_touched:U});if(A){let I=JSON.parse(A),T=z?JSON.parse(z):[],R=U?JSON.parse(U):[];I.forEach((M,k)=>{i7("claude-mem",["chroma_add_documents","--collection_name","claude_memories","--documents",JSON.stringify([M]),"--ids",JSON.stringify([`${u}_fact_${String(k).padStart(3,"0")}`]),"--metadatas",JSON.stringify([{type:"fact",parent_id:u,fact_index:k,title:$,subtitle:B,project:F,session_id:C,created_at:J,created_at_epoch:Date.parse(J),keywords:"",concepts:JSON.stringify(T),files_touched:JSON.stringify(R),origin:"streaming-sdk"}])])}),i7("claude-mem",["chroma_add_documents","--collection_name","claude_memories","--documents",JSON.stringify([`${$}
${B}
${I.join(`
`)}`]),"--ids",JSON.stringify([u]),"--metadatas",JSON.stringify([{type:"narrative",title:$,subtitle:B,facts_count:I.length,project:F,session_id:C,created_at:J,created_at_epoch:Date.parse(J),keywords:"",concepts:JSON.stringify(T),files_touched:JSON.stringify(R),origin:"streaming-sdk"}])])}console.log(JSON.stringify({success:!0,memory_id:u,project:F,session:C,date:E,timestamp:J,hierarchical:!!($&&B&&Q)}))}catch(Y){console.error(JSON.stringify({success:!1,error:Y.message||"Unknown error storing memory"})),process.exit(1)}}async function s7(D){let{project:u,session:F,content:C}=D;if(!u||!F||!C)console.error("Error: All fields required: --project, --session, --content"),process.exit(1);try{let E=await iD(),$=new Date().toISOString();E.overviews.upsert({session_id:F,content:C,created_at:$,project:u,origin:"streaming-sdk"}),console.log(JSON.stringify({success:!0,project:u,session:F,timestamp:$}))}catch(E){console.error(JSON.stringify({success:!1,error:E.message||"Unknown error storing overview"})),process.exit(1)}}import t7 from"path";import M3 from"fs";var P$=t7.join(process.env.HOME||"",".claude-mem","sessions");async function e7(D){let{project:u,session:F,title:C,subtitle:E}=D;if(!u||!F)console.error(JSON.stringify({success:!1,error:"Missing required fields: --project, --session"})),process.exit(1);if(!C)console.error(JSON.stringify({success:!1,error:"Missing required field: --title"})),process.exit(1);try{let $=t7.join(P$,`${u}_streaming.json`);if(!M3.existsSync($))console.error(JSON.stringify({success:!1,error:`Session file not found: ${$}`})),process.exit(1);let B={};try{B=JSON.parse(M3.readFileSync($,"utf8"))}catch(Q){console.error(JSON.stringify({success:!1,error:"Failed to parse session file"})),process.exit(1)}if(B.promptTitle=C,E)B.promptSubtitle=E;B.updatedAt=new Date().toISOString(),M3.writeFileSync($,JSON.stringify(B,null,2)),console.log(JSON.stringify({success:!0,title:C,subtitle:E||null,project:u,session:F}))}catch($){console.error(JSON.stringify({success:!1,error:$.message||"Unknown error updating session metadata"})),process.exit(1)}}import{query as S$}from"@anthropic-ai/claude-agent-sdk";rD();QF();XF();async function DC(D,u){if(!D||D.trim().length===0)console.error(JSON.stringify({success:!1,error:"Prompt is required"})),process.exit(1);let F=null,C=null;if(u.sessionId)try{let $=ND.getInstance();for(let Q of Bu)$.registerMigration(Q);let B=await $.initialize();if(F=new k0(B),C=F.getByClaudeSessionId(u.sessionId),!C)console.error(JSON.stringify({success:!1,error:`Session not found: ${u.sessionId}`})),process.exit(1)}catch($){console.error(JSON.stringify({success:!1,error:`Database error: ${$.message}`})),process.exit(1)}let E=`You are a title and subtitle generator for claude-mem session metadata.
Your job is to analyze a user's request and generate:
1. A concise title (3-8 words)
2. A one-sentence subtitle (max 20 words)
TITLE GUIDELINES:
- 3-8 words maximum
- Scannable and clear
- Captures the core action or topic
- Professional and informative
- Examples:
* "Dark Mode Implementation"
* "Authentication Bug Fix"
* "API Rate Limiting Setup"
* "React Component Refactoring"
SUBTITLE GUIDELINES:
- One sentence, max 20 words
- Descriptive and specific
- Focus on the outcome or benefit
- Use active voice when possible
- Examples:
* "Adding theme toggle and dark color scheme support to the application"
* "Resolving login timeout issue affecting user session persistence"
* "Implementing request throttling to prevent API quota exhaustion"
OUTPUT FORMAT:
You must output EXACTLY two lines:
Line 1: Title only (no prefix, no quotes)
Line 2: Subtitle only (no prefix, no quotes)
EXAMPLE:
User request: "Help me add dark mode to my app"
Output:
Dark Mode Implementation
Adding theme toggle and dark color scheme support to the application
USER REQUEST:
${D}
Now generate the title and subtitle (two lines exactly):`;try{let $=await S$({prompt:E,options:{allowedTools:[],pathToClaudeCodeExecutable:$u()}}),B="";if($&&typeof $==="object"&&Symbol.asyncIterator in $){for await(let Y of $)if(Y?.type==="assistant"&&Y?.message?.content){let J=Y.message.content;if(typeof J==="string")B+=J;else if(Array.isArray(J)){for(let H of J)if(H.type==="text"&&H.text)B+=H.text}}}let Q=B.trim().split(`
`).filter((Y)=>Y.trim().length>0);if(Q.length<2)console.error(JSON.stringify({success:!1,error:"Could not generate title and subtitle",response:B})),process.exit(1);let X=Q[0].trim(),Z=Q[1].trim();if(u.save&&F&&C)try{F.update(C.id,{title:X,subtitle:Z})}catch(Y){console.error(JSON.stringify({success:!1,error:`Failed to save title: ${Y.message}`})),process.exit(1)}if(u.json)console.log(JSON.stringify({success:!0,title:X,subtitle:Z,sessionId:C?.claude_session_id},null,2));else if(u.oneline)console.log(`${X} - ${Z}`);else console.log(X),console.log(Z)}catch($){console.error(JSON.stringify({success:!1,error:$.message||"Unknown error generating title"})),process.exit(1)}}var RD=new d3;RD.name(j0).description(s3).version(o3);RD.command("install").description("Install Claude Code hooks for automatic compression").option("--user","Install for current user (default)").option("--project","Install for current project only").option("--local","Install to custom local directory").option("--path <path>","Custom installation path (with --local)").option("--timeout <ms>","Hook execution timeout in milliseconds","180000").option("--skip-mcp","Skip Chroma MCP server installation").option("--force","Force installation even if already installed").action(w6);RD.command("uninstall").description("Remove Claude Code hooks").option("--user","Remove from user settings (default)").option("--project","Remove from project settings").option("--all","Remove from both user and project settings").action(S6);RD.command("status").description("Check installation status of Claude Memory System").action(A1);RD.command("doctor").description("Run environment and pipeline diagnostics for rolling memory").option("--json","Output JSON instead of text").action(async(D)=>{try{await r7(D)}catch(u){console.error(`doctor failed: ${u.message||u}`),process.exitCode=1}});RD.command("logs").description("View claude-mem operation logs").option("--debug","Show debug logs only").option("--error","Show error logs only").option("--tail [n]","Show last n lines","50").option("--follow","Follow log output").action(U1);RD.command("load-context").description("Load compressed memories for current session").option("--project <name>","Filter by project name").option("--count <n>","Number of memories to load","10").option("--raw","Output raw JSON instead of formatted text").option("--format <type>","Output format: json, session-start, or default").action(y1);var I3=RD.command("trash").description("Manage trash bin for safe file deletion").argument("[files...]","Files to move to trash").option("-r, --recursive","Remove directories recursively").option("-R","Remove directories recursively (same as -r)").option("-f, --force","Suppress errors for nonexistent files").action(async(D,u)=>{if(!D||D.length===0){I3.outputHelp();return}if(u.R)u.recursive=!0;await S7(D,{force:u.force,recursive:u.recursive})});I3.command("view").description("View contents of trash bin").action(h7);I3.command("empty").description("Permanently delete all files in trash").option("-f, --force","Skip confirmation prompt").action(m7);RD.command("restore").description("Restore files from trash interactively").action(d7);RD.command("store-memory").description("Store a memory to all storage layers (used by SDK)").requiredOption("--id <id>","Memory ID").requiredOption("--project <project>","Project name").requiredOption("--session <session>","Session ID").requiredOption("--date <date>","Date (YYYY-MM-DD)").requiredOption("--title <title>","Memory title (3-8 words)").requiredOption("--subtitle <subtitle>","Memory subtitle (max 24 words)").requiredOption("--facts <json>","Atomic facts as JSON array").option("--concepts <json>","Concept tags as JSON array").option("--files <json>","Files touched as JSON array").action(o7);RD.command("store-overview").description("Store a session overview (used by SDK)").requiredOption("--project <project>","Project name").requiredOption("--session <session>","Session ID").requiredOption("--content <content>","Overview content").action(s7);RD.command("update-session-metadata").description("Update session title and subtitle (used by SDK)").requiredOption("--project <project>","Project name").requiredOption("--session <session>","Session ID").requiredOption("--title <title>","Session title (3-6 words)").option("--subtitle <subtitle>","Session subtitle (max 20 words)").action(e7);RD.command("changelog").description("Generate CHANGELOG.md from claude-mem memories").option("--historical <n>","Number of versions to search (default: current version only)").option("--generate <version>","Generate changelog for a specific version").option("--start <time>","Start time for memory search (ISO format)").option("--end <time>","End time for memory search (ISO format)").option("--update","Update CHANGELOG.md from JSONL entries").option("--preview","Preview the generated changelog").option("-v, --verbose","Show detailed output").action(a7);RD.command("generate-title <prompt>").description("Generate a session title and subtitle from a prompt").option("--json","Output as JSON").option("--oneline","Output as single line (title - subtitle)").option("--session-id <id>","Claude session ID to update").option("--save","Save the generated title to the database (requires --session-id)").action(DC);RD.parse();export{Bu as migrations,f2 as initializeDatabase,_D as getDatabase,k0 as StreamingSessionStore,ND as DatabaseManager};