diff --git a/dist/claude-mem.min.js b/dist/claude-mem.min.js index bd357a0f..7b95d281 100755 --- a/dist/claude-mem.min.js +++ b/dist/claude-mem.min.js @@ -1,32 +1,32 @@ #!/usr/bin/env bun // @bun -var a6=Object.create;var{getPrototypeOf:r6,defineProperty:c0,getOwnPropertyNames:o6}=Object;var s6=Object.prototype.hasOwnProperty;var fD=(D,u,F)=>{F=D!=null?a6(r6(D)):{};let C=u||!D||!D.__esModule?c0(F,"default",{value:D,enumerable:!0}):F;for(let B of o6(D))if(!s6.call(C,B))c0(C,B,{get:()=>D[B],enumerable:!0});return C};var l=(D,u)=>()=>(u||D((u={exports:{}}).exports,u),u.exports);var t6=(D,u)=>{for(var F in u)c0(D,F,{get:u[F],enumerable:!0,configurable:!0,set:(C)=>u[F]=()=>C})};var iD=(D,u)=>()=>(D&&(u=D(D=0)),u);var LD=import.meta.require;var Vu=l((e6)=>{class d0 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 A2 extends d0{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}e6.CommanderError=d0;e6.InvalidArgumentError=A2});var au=l((B1)=>{var{InvalidArgumentError:F1}=Vu();class H2{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 F1(`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 C1(D){let u=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+u+">":"["+u+"]"}B1.Argument=H2;B1.humanReadableArgName=C1});var l0=l((X1)=>{var{humanReadableArgName:Q1}=au();class U2{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,B)=>{return C.name().localeCompare(B.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),B=F.long&&D._findOption(F.long);if(!C&&!B)u.push(F);else if(F.long&&!B)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((B)=>!B.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)=>Q1(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((B)=>{let $=F(B);if(!C.has($))C.set($,[])}),u.forEach((B)=>{let $=F(B);if(!C.has($))C.set($,[]);C.get($).push(B)}),C}formatHelp(D,u){let F=u.padWidth(D,u),C=u.helpWidth??80;function B(J,V){return u.formatItem(J,F,V,u)}let $=[`${u.styleTitle("Usage:")} ${u.styleUsage(u.commandUsage(D))}`,""],E=u.commandDescription(D);if(E.length>0)$=$.concat([u.boxWrap(u.styleCommandDescription(E),C),""]);let Q=u.visibleArguments(D).map((J)=>{return B(u.styleArgumentTerm(u.argumentTerm(J)),u.styleArgumentDescription(u.argumentDescription(J)))});if($=$.concat(this.formatItemList("Arguments:",Q,u)),this.groupItems(D.options,u.visibleOptions(D),(J)=>J.helpGroupHeading??"Options:").forEach((J,V)=>{let A=J.map((U)=>{return B(u.styleOptionTerm(u.optionTerm(U)),u.styleOptionDescription(u.optionDescription(U)))});$=$.concat(this.formatItemList(V,A,u))}),u.showGlobalOptions){let J=u.visibleGlobalOptions(D).map((V)=>{return B(u.styleOptionTerm(u.optionTerm(V)),u.styleOptionDescription(u.optionDescription(V)))});$=$.concat(this.formatItemList("Global Options:",J,u))}return this.groupItems(D.commands,u.visibleCommands(D),(J)=>J.helpGroup()||"Commands:").forEach((J,V)=>{let A=J.map((U)=>{return B(u.styleSubcommandTerm(u.subcommandTerm(U)),u.styleSubcommandDescription(u.subcommandDescription(U)))});$=$.concat(this.formatItemList(V,A,u))}),$.join(` -`)}displayWidth(D){return z2(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 E=D.padEnd(u+D.length-C.displayWidth(D)),Q=2,Z=(this.helpWidth??80)-u-Q-2,J;if(Z{F=D!=null?$1(Q1(D)):{};let C=u||!D||!D.__esModule?d0(F,"default",{value:D,enumerable:!0}):F;for(let B of X1(D))if(!Z1.call(C,B))d0(C,B,{get:()=>D[B],enumerable:!0});return C};var l=(D,u)=>()=>(u||D((u={exports:{}}).exports,u),u.exports);var H2=(D,u)=>{for(var F in u)d0(D,F,{get:u[F],enumerable:!0,configurable:!0,set:(C)=>u[F]=()=>C})};var mD=(D,u)=>()=>(D&&(u=D(D=0)),u);var LD=import.meta.require;var Au=l((J1)=>{class l0 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 U2 extends l0{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}J1.CommanderError=l0;J1.InvalidArgumentError=U2});var ru=l((A1)=>{var{InvalidArgumentError:K1}=Au();class z2{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 K1(`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 V1(D){let u=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+u+">":"["+u+"]"}A1.Argument=z2;A1.humanReadableArgName=V1});var p0=l((G1)=>{var{humanReadableArgName:z1}=ru();class G2{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,B)=>{return C.name().localeCompare(B.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),B=F.long&&D._findOption(F.long);if(!C&&!B)u.push(F);else if(F.long&&!B)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((B)=>!B.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)=>z1(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((B)=>{let $=F(B);if(!C.has($))C.set($,[])}),u.forEach((B)=>{let $=F(B);if(!C.has($))C.set($,[]);C.get($).push(B)}),C}formatHelp(D,u){let F=u.padWidth(D,u),C=u.helpWidth??80;function B(J,V){return u.formatItem(J,F,V,u)}let $=[`${u.styleTitle("Usage:")} ${u.styleUsage(u.commandUsage(D))}`,""],E=u.commandDescription(D);if(E.length>0)$=$.concat([u.boxWrap(u.styleCommandDescription(E),C),""]);let Q=u.visibleArguments(D).map((J)=>{return B(u.styleArgumentTerm(u.argumentTerm(J)),u.styleArgumentDescription(u.argumentDescription(J)))});if($=$.concat(this.formatItemList("Arguments:",Q,u)),this.groupItems(D.options,u.visibleOptions(D),(J)=>J.helpGroupHeading??"Options:").forEach((J,V)=>{let A=J.map((U)=>{return B(u.styleOptionTerm(u.optionTerm(U)),u.styleOptionDescription(u.optionDescription(U)))});$=$.concat(this.formatItemList(V,A,u))}),u.showGlobalOptions){let J=u.visibleGlobalOptions(D).map((V)=>{return B(u.styleOptionTerm(u.optionTerm(V)),u.styleOptionDescription(u.optionDescription(V)))});$=$.concat(this.formatItemList("Global Options:",J,u))}return this.groupItems(D.commands,u.visibleCommands(D),(J)=>J.helpGroup()||"Commands:").forEach((J,V)=>{let A=J.map((U)=>{return B(u.styleSubcommandTerm(u.subcommandTerm(U)),u.styleSubcommandDescription(u.subcommandDescription(U)))});$=$.concat(this.formatItemList(V,A,u))}),$.join(` +`)}displayWidth(D){return W2(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 E=D.padEnd(u+D.length-C.displayWidth(D)),Q=2,Z=(this.helpWidth??80)-u-Q-2,J;if(Z{let E=$.match(C);if(E===null){B.push("");return}let Q=[E.shift()],X=this.displayWidth(Q[0]);E.forEach((Z)=>{let J=this.displayWidth(Z);if(X+J<=u){Q.push(Z),X+=J;return}B.push(Q.join(""));let V=Z.trimStart();Q=[V],X=this.displayWidth(V)}),B.push(Q.join(""))}),B.join(` -`)}}function z2(D){let u=/\x1b\[\d*(;\d*)*m/g;return D.replace(u,"")}X1.Help=U2;X1.stripColor=z2});var p0=l((K1)=>{var{InvalidArgumentError:q1}=Vu();class W2{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=Y1(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 q1(`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 G2(this.name().replace(/^no-/,""));return G2(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 _2{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,B=C!==void 0?C:!1;return u.negate===(B===D)}}function G2(D){return D.split("-").reduce((u,F)=>{return u+F[0].toUpperCase()+F.slice(1)})}function Y1(D){let u,F,C=/^-[^-]$/,B=/^--[^-]/,$=D.split(/[ |,]+/).concat("guard");if(C.test($[0]))u=$.shift();if(B.test($[0]))F=$.shift();if(!u&&C.test($[0]))u=$.shift();if(!u&&B.test($[0]))u=F,F=$.shift();if($[0].startsWith("-")){let E=$[0],Q=`option creation failed due to '${E}' in option flags '${D}'`;if(/^-[^-][^-]/.test(E))throw new Error(`${Q} +`)}}function W2(D){let u=/\x1b\[\d*(;\d*)*m/g;return D.replace(u,"")}G1.Help=G2;G1.stripColor=W2});var n0=l((R1)=>{var{InvalidArgumentError:j1}=Au();class j2{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=M1(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 j1(`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 _2(this.name().replace(/^no-/,""));return _2(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 M2{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,B=C!==void 0?C:!1;return u.negate===(B===D)}}function _2(D){return D.split("-").reduce((u,F)=>{return u+F[0].toUpperCase()+F.slice(1)})}function M1(D){let u,F,C=/^-[^-]$/,B=/^--[^-]/,$=D.split(/[ |,]+/).concat("guard");if(C.test($[0]))u=$.shift();if(B.test($[0]))F=$.shift();if(!u&&C.test($[0]))u=$.shift();if(!u&&B.test($[0]))u=F,F=$.shift();if($[0].startsWith("-")){let E=$[0],Q=`option creation failed due to '${E}' in option flags '${D}'`;if(/^-[^-][^-]/.test(E))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(E))throw new Error(`${Q} - too many short flags`);if(B.test(E))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}}K1.Option=W2;K1.DualOptions=_2});var j2=l((z1)=>{function H1(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 B=1;B<=D.length;B++){let $=1;if(D[B-1]===u[C-1])$=0;else $=1;if(F[B][C]=Math.min(F[B-1][C]+1,F[B][C-1]+1,F[B-1][C-1]+$),B>1&&C>1&&D[B-1]===u[C-2]&&D[B-2]===u[C-1])F[B][C]=Math.min(F[B][C],F[B-2][C-2]+1)}return F[D.length][u.length]}function U1(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((E)=>E.slice(2));let C=[],B=3,$=0.4;if(u.forEach((E)=>{if(E.length<=1)return;let Q=H1(D,E),X=Math.max(D.length,E.length);if((X-Q)/X>$){if(QE.localeCompare(Q)),F)C=C.map((E)=>`--${E}`);if(C.length>1)return` +- 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}}R1.Option=j2;R1.DualOptions=M2});var R2=l((O1)=>{function N1(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 B=1;B<=D.length;B++){let $=1;if(D[B-1]===u[C-1])$=0;else $=1;if(F[B][C]=Math.min(F[B-1][C]+1,F[B][C-1]+1,F[B-1][C-1]+$),B>1&&C>1&&D[B-1]===u[C-2]&&D[B-2]===u[C-1])F[B][C]=Math.min(F[B][C],F[B-2][C-2]+1)}return F[D.length][u.length]}function T1(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((E)=>E.slice(2));let C=[],B=3,$=0.4;if(u.forEach((E)=>{if(E.length<=1)return;let Q=N1(D,E),X=Math.max(D.length,E.length);if((X-Q)/X>$){if(QE.localeCompare(Q)),F)C=C.map((E)=>`--${E}`);if(C.length>1)return` (Did you mean one of ${C.join(", ")}?)`;if(C.length===1)return` -(Did you mean ${C[0]}?)`;return""}z1.suggestSimilar=U1});var I2=l((I1)=>{var W1=LD("events").EventEmitter,n0=LD("child_process"),yD=LD("path"),ru=LD("fs"),P=LD("process"),{Argument:_1,humanReadableArgName:j1}=au(),{CommanderError:i0}=Vu(),{Help:M1,stripColor:R1}=l0(),{Option:M2,DualOptions:L1}=p0(),{suggestSimilar:R2}=j2();class r0 extends W1{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)=>P.stdout.write(u),writeErr:(u)=>P.stderr.write(u),outputError:(u,F)=>F(u),getOutHelpWidth:()=>P.stdout.isTTY?P.stdout.columns:void 0,getErrHelpWidth:()=>P.stderr.isTTY?P.stderr.columns:void 0,getOutHasColors:()=>a0()??(P.stdout.isTTY&&P.stdout.hasColors?.()),getErrHasColors:()=>a0()??(P.stderr.isTTY&&P.stderr.hasColors?.()),stripColor:(u)=>R1(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,B=F;if(typeof C==="object"&&C!==null)B=C,C=null;B=B||{};let[,$,E]=D.match(/([^ ]+) *(.*)/),Q=this.createCommand($);if(C)Q.description(C),Q._executableHandler=!0;if(B.isDefault)this._defaultCommandName=Q._name;if(Q._hidden=!!(B.noHelp||B.hidden),Q._executableFile=B.executableFile||null,E)Q.arguments(E);if(this._registerCommand(Q),Q.parent=this,Q.copyInheritedSettings(this),C)return this;return Q}createCommand(D){return new r0(D)}createHelp(){return Object.assign(new M1,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 _1(D,u)}argument(D,u,F,C){let B=this.createArgument(D,u);if(typeof F==="function")B.default(C).argParser(F);else B.default(F);return this.addArgument(B),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,B]=F.match(/([^ ]+) *(.*)/),$=u??"display help for command",E=this.createCommand(C);if(E.helpOption(!1),B)E.arguments(B);if($)E.description($);if(this._addImplicitHelpCommand=!0,this._helpCommand=E,D||u)this._initCommandGroup(E);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 i0(D,u,F));P.exit(D)}action(D){let u=(F)=>{let C=this.registeredArguments.length,B=F.slice(0,C);if(this._storeOptionsAsProperties)B[C]=this;else B[C]=this.opts();return B.push(this),D.apply(this,B)};return this._actionHandler=u,this}createOption(D,u){return new M2(D,u)}_callParseArg(D,u,F,C){try{return D.parseArg(u,F)}catch(B){if(B.code==="commander.invalidArgument"){let $=`${C} ${B.message}`;this.error($,{exitCode:B.exitCode,code:B.code})}throw B}}_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("|"),B=u(D).join("|");throw new Error(`cannot add command '${B}' 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 B=D.long.replace(/^--no-/,"--");if(!this._findOption(B))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=(B,$,E)=>{if(B==null&&D.presetArg!==void 0)B=D.presetArg;let Q=this.getOptionValue(F);if(B!==null&&D.parseArg)B=this._callParseArg(D,B,Q,$);else if(B!==null&&D.variadic)B=D._collectValue(B,Q);if(B==null)if(D.negate)B=!1;else if(D.isBoolean()||D.optional)B=!0;else B="";this.setOptionValueWithSource(F,B,E)};if(this.on("option:"+u,(B)=>{let $=`error: option '${D.flags}' argument '${B}' is invalid.`;C(B,$,"cli")}),D.envVar)this.on("optionEnv:"+u,(B)=>{let $=`error: option '${D.flags}' value '${B}' from env '${D.envVar}' is invalid.`;C(B,$,"env")});return this}_optionEx(D,u,F,C,B){if(typeof u==="object"&&u instanceof M2)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(B).argParser(C);else if(C instanceof RegExp){let E=C;C=(Q,X)=>{let Z=E.exec(Q);return Z?Z[0]:X},$.default(B).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(P.versions?.electron)u.from="electron";let C=P.execArgv??[];if(C.includes("-e")||C.includes("--eval")||C.includes("-p")||C.includes("--print"))u.from="eval"}if(D===void 0)D=P.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(P.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(ru.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",B=`'${D}' does not exist +(Did you mean ${C[0]}?)`;return""}O1.suggestSimilar=T1});var T2=l((b1)=>{var P1=LD("events").EventEmitter,i0=LD("child_process"),yD=LD("path"),ou=LD("fs"),P=LD("process"),{Argument:k1,humanReadableArgName:S1}=ru(),{CommanderError:a0}=Au(),{Help:x1,stripColor:v1}=p0(),{Option:L2,DualOptions:f1}=n0(),{suggestSimilar:I2}=R2();class o0 extends P1{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)=>P.stdout.write(u),writeErr:(u)=>P.stderr.write(u),outputError:(u,F)=>F(u),getOutHelpWidth:()=>P.stdout.isTTY?P.stdout.columns:void 0,getErrHelpWidth:()=>P.stderr.isTTY?P.stderr.columns:void 0,getOutHasColors:()=>r0()??(P.stdout.isTTY&&P.stdout.hasColors?.()),getErrHasColors:()=>r0()??(P.stderr.isTTY&&P.stderr.hasColors?.()),stripColor:(u)=>v1(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,B=F;if(typeof C==="object"&&C!==null)B=C,C=null;B=B||{};let[,$,E]=D.match(/([^ ]+) *(.*)/),Q=this.createCommand($);if(C)Q.description(C),Q._executableHandler=!0;if(B.isDefault)this._defaultCommandName=Q._name;if(Q._hidden=!!(B.noHelp||B.hidden),Q._executableFile=B.executableFile||null,E)Q.arguments(E);if(this._registerCommand(Q),Q.parent=this,Q.copyInheritedSettings(this),C)return this;return Q}createCommand(D){return new o0(D)}createHelp(){return Object.assign(new x1,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 k1(D,u)}argument(D,u,F,C){let B=this.createArgument(D,u);if(typeof F==="function")B.default(C).argParser(F);else B.default(F);return this.addArgument(B),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,B]=F.match(/([^ ]+) *(.*)/),$=u??"display help for command",E=this.createCommand(C);if(E.helpOption(!1),B)E.arguments(B);if($)E.description($);if(this._addImplicitHelpCommand=!0,this._helpCommand=E,D||u)this._initCommandGroup(E);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 a0(D,u,F));P.exit(D)}action(D){let u=(F)=>{let C=this.registeredArguments.length,B=F.slice(0,C);if(this._storeOptionsAsProperties)B[C]=this;else B[C]=this.opts();return B.push(this),D.apply(this,B)};return this._actionHandler=u,this}createOption(D,u){return new L2(D,u)}_callParseArg(D,u,F,C){try{return D.parseArg(u,F)}catch(B){if(B.code==="commander.invalidArgument"){let $=`${C} ${B.message}`;this.error($,{exitCode:B.exitCode,code:B.code})}throw B}}_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("|"),B=u(D).join("|");throw new Error(`cannot add command '${B}' 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 B=D.long.replace(/^--no-/,"--");if(!this._findOption(B))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=(B,$,E)=>{if(B==null&&D.presetArg!==void 0)B=D.presetArg;let Q=this.getOptionValue(F);if(B!==null&&D.parseArg)B=this._callParseArg(D,B,Q,$);else if(B!==null&&D.variadic)B=D._collectValue(B,Q);if(B==null)if(D.negate)B=!1;else if(D.isBoolean()||D.optional)B=!0;else B="";this.setOptionValueWithSource(F,B,E)};if(this.on("option:"+u,(B)=>{let $=`error: option '${D.flags}' argument '${B}' is invalid.`;C(B,$,"cli")}),D.envVar)this.on("optionEnv:"+u,(B)=>{let $=`error: option '${D.flags}' value '${B}' from env '${D.envVar}' is invalid.`;C(B,$,"env")});return this}_optionEx(D,u,F,C,B){if(typeof u==="object"&&u instanceof L2)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(B).argParser(C);else if(C instanceof RegExp){let E=C;C=(Q,X)=>{let Z=E.exec(Q);return Z?Z[0]:X},$.default(B).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(P.versions?.electron)u.from="electron";let C=P.execArgv??[];if(C.includes("-e")||C.includes("--eval")||C.includes("-p")||C.includes("--print"))u.from="eval"}if(D===void 0)D=P.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(P.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(ou.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",B=`'${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(B)}_executeSubCommand(D,u){u=u.slice();let F=!1,C=[".js",".ts",".tsx",".mjs",".cjs"];function B(Z,J){let V=yD.resolve(Z,J);if(ru.existsSync(V))return V;if(C.includes(yD.extname(J)))return;let A=C.find((U)=>ru.existsSync(`${V}${U}`));if(A)return`${V}${A}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let $=D._executableFile||`${this._name}-${D._name}`,E=this._executableDir||"";if(this._scriptPath){let Z;try{Z=ru.realpathSync(this._scriptPath)}catch{Z=this._scriptPath}E=yD.resolve(yD.dirname(Z),E)}if(E){let Z=B(E,$);if(!Z&&!D._executableFile&&this._scriptPath){let J=yD.basename(this._scriptPath,yD.extname(this._scriptPath));if(J!==this._name)Z=B(E,`${J}-${D._name}`)}$=Z||$}F=C.includes(yD.extname($));let Q;if(P.platform!=="win32")if(F)u.unshift($),u=L2(P.execArgv).concat(u),Q=n0.spawn(P.argv[0],u,{stdio:"inherit"});else Q=n0.spawn($,u,{stdio:"inherit"});else this._checkForMissingExecutable($,E,D._name),u.unshift($),u=L2(P.execArgv).concat(u),Q=n0.spawn(P.execPath,u,{stdio:"inherit"});if(!Q.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((J)=>{P.on(J,()=>{if(Q.killed===!1&&Q.exitCode===null)Q.kill(J)})});let X=this._exitCallback;Q.on("close",(Z)=>{if(Z=Z??1,!X)P.exit(Z);else X(new i0(Z,"commander.executeSubCommandAsync","(close)"))}),Q.on("error",(Z)=>{if(Z.code==="ENOENT")this._checkForMissingExecutable($,E,D._name);else if(Z.code==="EACCES")throw new Error(`'${$}' not executable`);if(!X)P.exit(1);else{let J=new i0(1,"commander.executeSubCommandAsync","(error)");J.nestedError=Z,X(J)}}),this.runningCommand=Q}_dispatchSubcommand(D,u,F){let C=this._findCommand(D);if(!C)this.help({error:!0});C._prepareForParse();let B;return B=this._chainOrCallSubCommandHook(B,C,"preSubcommand"),B=this._chainOrCall(B,()=>{if(C._executableHandler)this._executeSubCommand(C,u.concat(F));else return C._parseCommand(u,F)}),B}_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,B)=>{let $=C;if(C!==null&&F.parseArg){let E=`error: command-argument value '${C}' is invalid for argument '${F.name()}'.`;$=this._callParseArg(F,C,B,E)}return $};this._checkNumberOfArguments();let u=[];this.registeredArguments.forEach((F,C)=>{let B=F.defaultValue;if(F.variadic){if(C{return D(F,E,$)},F.defaultValue)}else if(B===void 0)B=[]}else if(Cu());return u()}_chainOrCallHooks(D,u){let F=D,C=[];if(this._getCommandAndAncestors().reverse().filter((B)=>B._lifeCycleHooks[u]!==void 0).forEach((B)=>{B._lifeCycleHooks[u].forEach(($)=>{C.push({hookedCommand:B,callback:$})})}),u==="postAction")C.reverse();return C.forEach((B)=>{F=this._chainOrCall(F,()=>{return B.callback(B.hookedCommand,this)})}),F}_chainOrCallSubCommandHook(D,u,F){let C=D;if(this._lifeCycleHooks[F]!==void 0)this._lifeCycleHooks[F].forEach((B)=>{C=this._chainOrCall(C,()=>{return B(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])},B=`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(B,D,u)});return $=this._chainOrCallHooks($,"postAction"),$}if(this.parent?.listenerCount(B))C(),this._processArguments(),this.parent.emit(B,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((B)=>F.conflictsWith.includes(B.attributeName()));if(C)this._conflictingOption(F,C)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let u=[],F=[],C=u;function B(Z){return Z.length>1&&Z[0]==="-"}let $=(Z)=>{if(!/^-\d*\.?\d+(e[+-]?\d+)?$/.test(Z))return!1;return!this._getCommandAndAncestors().some((J)=>J.options.map((V)=>V.short).some((V)=>/^-\d$/.test(V)))},E=null,Q=null,X=0;while(X2&&Z[0]==="-"&&Z[1]!=="-"){let J=this._findOption(`-${Z[1]}`);if(J){if(J.required||J.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${J.name()}`,Z.slice(2));else this.emit(`option:${J.name()}`),Q=`-${Z.slice(2)}`;continue}}if(/^--[^=]+=/.test(Z)){let J=Z.indexOf("="),V=this._findOption(Z.slice(0,J));if(V&&(V.required||V.optional)){this.emit(`option:${V.name()}`,Z.slice(J+1));continue}}if(C===u&&B(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;FObject.assign(D,u.opts()),{})}error(D,u){if(this._outputConfiguration.outputError(`${D} + - ${C}`;throw new Error(B)}_executeSubCommand(D,u){u=u.slice();let F=!1,C=[".js",".ts",".tsx",".mjs",".cjs"];function B(Z,J){let V=yD.resolve(Z,J);if(ou.existsSync(V))return V;if(C.includes(yD.extname(J)))return;let A=C.find((U)=>ou.existsSync(`${V}${U}`));if(A)return`${V}${A}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let $=D._executableFile||`${this._name}-${D._name}`,E=this._executableDir||"";if(this._scriptPath){let Z;try{Z=ou.realpathSync(this._scriptPath)}catch{Z=this._scriptPath}E=yD.resolve(yD.dirname(Z),E)}if(E){let Z=B(E,$);if(!Z&&!D._executableFile&&this._scriptPath){let J=yD.basename(this._scriptPath,yD.extname(this._scriptPath));if(J!==this._name)Z=B(E,`${J}-${D._name}`)}$=Z||$}F=C.includes(yD.extname($));let Q;if(P.platform!=="win32")if(F)u.unshift($),u=N2(P.execArgv).concat(u),Q=i0.spawn(P.argv[0],u,{stdio:"inherit"});else Q=i0.spawn($,u,{stdio:"inherit"});else this._checkForMissingExecutable($,E,D._name),u.unshift($),u=N2(P.execArgv).concat(u),Q=i0.spawn(P.execPath,u,{stdio:"inherit"});if(!Q.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((J)=>{P.on(J,()=>{if(Q.killed===!1&&Q.exitCode===null)Q.kill(J)})});let X=this._exitCallback;Q.on("close",(Z)=>{if(Z=Z??1,!X)P.exit(Z);else X(new a0(Z,"commander.executeSubCommandAsync","(close)"))}),Q.on("error",(Z)=>{if(Z.code==="ENOENT")this._checkForMissingExecutable($,E,D._name);else if(Z.code==="EACCES")throw new Error(`'${$}' not executable`);if(!X)P.exit(1);else{let J=new a0(1,"commander.executeSubCommandAsync","(error)");J.nestedError=Z,X(J)}}),this.runningCommand=Q}_dispatchSubcommand(D,u,F){let C=this._findCommand(D);if(!C)this.help({error:!0});C._prepareForParse();let B;return B=this._chainOrCallSubCommandHook(B,C,"preSubcommand"),B=this._chainOrCall(B,()=>{if(C._executableHandler)this._executeSubCommand(C,u.concat(F));else return C._parseCommand(u,F)}),B}_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,B)=>{let $=C;if(C!==null&&F.parseArg){let E=`error: command-argument value '${C}' is invalid for argument '${F.name()}'.`;$=this._callParseArg(F,C,B,E)}return $};this._checkNumberOfArguments();let u=[];this.registeredArguments.forEach((F,C)=>{let B=F.defaultValue;if(F.variadic){if(C{return D(F,E,$)},F.defaultValue)}else if(B===void 0)B=[]}else if(Cu());return u()}_chainOrCallHooks(D,u){let F=D,C=[];if(this._getCommandAndAncestors().reverse().filter((B)=>B._lifeCycleHooks[u]!==void 0).forEach((B)=>{B._lifeCycleHooks[u].forEach(($)=>{C.push({hookedCommand:B,callback:$})})}),u==="postAction")C.reverse();return C.forEach((B)=>{F=this._chainOrCall(F,()=>{return B.callback(B.hookedCommand,this)})}),F}_chainOrCallSubCommandHook(D,u,F){let C=D;if(this._lifeCycleHooks[F]!==void 0)this._lifeCycleHooks[F].forEach((B)=>{C=this._chainOrCall(C,()=>{return B(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])},B=`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(B,D,u)});return $=this._chainOrCallHooks($,"postAction"),$}if(this.parent?.listenerCount(B))C(),this._processArguments(),this.parent.emit(B,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((B)=>F.conflictsWith.includes(B.attributeName()));if(C)this._conflictingOption(F,C)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let u=[],F=[],C=u;function B(Z){return Z.length>1&&Z[0]==="-"}let $=(Z)=>{if(!/^-\d*\.?\d+(e[+-]?\d+)?$/.test(Z))return!1;return!this._getCommandAndAncestors().some((J)=>J.options.map((V)=>V.short).some((V)=>/^-\d$/.test(V)))},E=null,Q=null,X=0;while(X2&&Z[0]==="-"&&Z[1]!=="-"){let J=this._findOption(`-${Z[1]}`);if(J){if(J.required||J.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${J.name()}`,Z.slice(2));else this.emit(`option:${J.name()}`),Q=`-${Z.slice(2)}`;continue}}if(/^--[^=]+=/.test(Z)){let J=Z.indexOf("="),V=this._findOption(Z.slice(0,J));if(V&&(V.required||V.optional)){this.emit(`option:${V.name()}`,Z.slice(J+1));continue}}if(C===u&&B(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;FObject.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,B=F.code||"commander.error";this._exit(C,B,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in P.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()}`,P.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new L1(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 E=$.attributeName(),Q=this.getOptionValue(E),X=this.options.find((J)=>J.negate&&E===J.attributeName()),Z=this.options.find((J)=>!J.negate&&E===J.attributeName());if(X&&(X.presetArg===void 0&&Q===!1||X.presetArg!==void 0&&Q===X.presetArg))return X;return Z||$},C=($)=>{let E=F($),Q=E.attributeName();if(this.getOptionValueSource(Q)==="env")return`environment variable '${E.envVar}'`;return`option '${E.flags}'`},B=`error: ${C(D)} cannot be used with ${C(u)}`;this.error(B,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let u="";if(D.startsWith("--")&&this._showSuggestionAfterError){let C=[],B=this;do{let $=B.createHelp().visibleOptions(B).filter((E)=>E.long).map((E)=>E.long);C=C.concat($),B=B.parent}while(B&&!B._enablePositionalOptions);u=R2(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",B=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${u} argument${F} but got ${D.length}.`;this.error(B,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],u="";if(this._showSuggestionAfterError){let C=[];this.createHelp().visibleCommands(this).forEach((B)=>{if(C.push(B.name()),B.alias())C.push(B.alias())}),u=R2(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 j1(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=yD.basename(D,yD.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,B;if(u)F=(E)=>this._outputConfiguration.writeErr(E),C=this._outputConfiguration.getErrHasColors(),B=this._outputConfiguration.getErrHelpWidth();else F=(E)=>this._outputConfiguration.writeOut(E),C=this._outputConfiguration.getOutHasColors(),B=this._outputConfiguration.getOutHelpWidth();return{error:u,write:(E)=>{if(!C)E=this._outputConfiguration.stripColor(E);return F(E)},hasColors:C,helpWidth:B}}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 B=this.helpInformation({error:F.error});if(u){if(B=u(B),typeof B!=="string"&&!Buffer.isBuffer(B))throw new Error("outputHelp callback must return a string or a Buffer")}if(F.write(B),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(P.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. +`),this.outputHelp({error:!0});let F=u||{},C=F.exitCode||1,B=F.code||"commander.error";this._exit(C,B,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in P.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()}`,P.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new f1(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 E=$.attributeName(),Q=this.getOptionValue(E),X=this.options.find((J)=>J.negate&&E===J.attributeName()),Z=this.options.find((J)=>!J.negate&&E===J.attributeName());if(X&&(X.presetArg===void 0&&Q===!1||X.presetArg!==void 0&&Q===X.presetArg))return X;return Z||$},C=($)=>{let E=F($),Q=E.attributeName();if(this.getOptionValueSource(Q)==="env")return`environment variable '${E.envVar}'`;return`option '${E.flags}'`},B=`error: ${C(D)} cannot be used with ${C(u)}`;this.error(B,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let u="";if(D.startsWith("--")&&this._showSuggestionAfterError){let C=[],B=this;do{let $=B.createHelp().visibleOptions(B).filter((E)=>E.long).map((E)=>E.long);C=C.concat($),B=B.parent}while(B&&!B._enablePositionalOptions);u=I2(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",B=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${u} argument${F} but got ${D.length}.`;this.error(B,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],u="";if(this._showSuggestionAfterError){let C=[];this.createHelp().visibleCommands(this).forEach((B)=>{if(C.push(B.name()),B.alias())C.push(B.alias())}),u=I2(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 S1(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=yD.basename(D,yD.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,B;if(u)F=(E)=>this._outputConfiguration.writeErr(E),C=this._outputConfiguration.getErrHasColors(),B=this._outputConfiguration.getErrHelpWidth();else F=(E)=>this._outputConfiguration.writeOut(E),C=this._outputConfiguration.getOutHasColors(),B=this._outputConfiguration.getOutHelpWidth();return{error:u,write:(E)=>{if(!C)E=this._outputConfiguration.stripColor(E);return F(E)},hasColors:C,helpWidth:B}}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 B=this.helpInformation({error:F.error});if(u){if(B=u(B),typeof B!=="string"&&!Buffer.isBuffer(B))throw new Error("outputHelp callback must return a string or a Buffer")}if(F.write(B),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(P.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,(B)=>{let $;if(typeof u==="function")$=u({error:B.error,command:B.command});else $=u;if($)B.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 L2(D){return D.map((u)=>{if(!u.startsWith("--inspect"))return u;let F,C="127.0.0.1",B="9229",$;if(($=u.match(/^(--inspect(-brk)?)$/))!==null)F=$[1];else if(($=u.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(F=$[1],/^\d+$/.test($[3]))B=$[3];else C=$[3];else if(($=u.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)F=$[1],C=$[3],B=$[4];if(F&&B!=="0")return`${F}=${C}:${parseInt(B)+1}`;return u})}function a0(){if(P.env.NO_COLOR||P.env.FORCE_COLOR==="0"||P.env.FORCE_COLOR==="false")return!1;if(P.env.FORCE_COLOR||P.env.CLICOLOR_FORCE!==void 0)return!0;return}I1.Command=r0;I1.useColor=a0});var w2=l((P1)=>{var{Argument:N2}=au(),{Command:o0}=I2(),{CommanderError:O1,InvalidArgumentError:T2}=Vu(),{Help:w1}=l0(),{Option:O2}=p0();P1.program=new o0;P1.createCommand=(D)=>new o0(D);P1.createOption=(D,u)=>new O2(D,u);P1.createArgument=(D,u)=>new N2(D,u);P1.Command=o0;P1.Option=O2;P1.Argument=N2;P1.Help=w1;P1.CommanderError=O1;P1.InvalidArgumentError=T2;P1.InvalidOptionArgumentError=T2});var t0=l((t4,m2)=>{var s0={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"},a1={up:(D=1)=>"\x1B[S".repeat(D),down:(D=1)=>"\x1B[T".repeat(D)},r1={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{var su=process||{},c2=su.argv||[],ou=su.env||{},o1=!(!!ou.NO_COLOR||c2.includes("--no-color"))&&(!!ou.FORCE_COLOR||c2.includes("--color")||su.platform==="win32"||(su.stdout||{}).isTTY&&ou.TERM!=="dumb"||!!ou.CI),s1=(D,u,F=D)=>(C)=>{let B=""+C,$=B.indexOf(u,D.length);return~$?D+t1(B,u,F,$)+u:D+B+u},t1=(D,u,F,C)=>{let B="",$=0;do B+=D.substring($,C)+F,$=C+u.length,C=D.indexOf(u,$);while(~C);return B+D.substring($)},d2=(D=o1)=>{let u=D?s1:()=>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")}};e0.exports=d2();e0.exports.createColors=d2});var j3=l((GF,WF)=>{(function(D,u){typeof GF==="object"&&typeof WF!=="undefined"?WF.exports=u():typeof define==="function"&&define.amd?define(u):(D=typeof globalThis!=="undefined"?globalThis:D||self,D.tinycolor=u())})(GF,function(){function D(q){return D=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(K){return typeof K}:function(K){return K&&typeof Symbol=="function"&&K.constructor===Symbol&&K!==Symbol.prototype?"symbol":typeof K},D(q)}var u=/^\s+/,F=/\s+$/;function C(q,K){if(q=q?q:"",K=K||{},q instanceof C)return q;if(!(this instanceof C))return new C(q,K);var Y=B(q);if(this._originalInput=q,this._r=Y.r,this._g=Y.g,this._b=Y.b,this._a=Y.a,this._roundA=Math.round(100*this._a)/100,this._format=K.format||Y.format,this._gradientType=K.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=Y.ok}C.prototype={isDark:function q(){return this.getBrightness()<128},isLight:function q(){return!this.isDark()},isValid:function q(){return this._ok},getOriginalInput:function q(){return this._originalInput},getFormat:function q(){return this._format},getAlpha:function q(){return this._a},getBrightness:function q(){var K=this.toRgb();return(K.r*299+K.g*587+K.b*114)/1000},getLuminance:function q(){var K=this.toRgb(),Y,H,j,_,w,k;if(Y=K.r/255,H=K.g/255,j=K.b/255,Y<=0.03928)_=Y/12.92;else _=Math.pow((Y+0.055)/1.055,2.4);if(H<=0.03928)w=H/12.92;else w=Math.pow((H+0.055)/1.055,2.4);if(j<=0.03928)k=j/12.92;else k=Math.pow((j+0.055)/1.055,2.4);return 0.2126*_+0.7152*w+0.0722*k},setAlpha:function q(K){return this._a=Y2(K),this._roundA=Math.round(100*this._a)/100,this},toHsv:function q(){var K=X(this._r,this._g,this._b);return{h:K.h*360,s:K.s,v:K.v,a:this._a}},toHsvString:function q(){var K=X(this._r,this._g,this._b),Y=Math.round(K.h*360),H=Math.round(K.s*100),j=Math.round(K.v*100);return this._a==1?"hsv("+Y+", "+H+"%, "+j+"%)":"hsva("+Y+", "+H+"%, "+j+"%, "+this._roundA+")"},toHsl:function q(){var K=E(this._r,this._g,this._b);return{h:K.h*360,s:K.s,l:K.l,a:this._a}},toHslString:function q(){var K=E(this._r,this._g,this._b),Y=Math.round(K.h*360),H=Math.round(K.s*100),j=Math.round(K.l*100);return this._a==1?"hsl("+Y+", "+H+"%, "+j+"%)":"hsla("+Y+", "+H+"%, "+j+"%, "+this._roundA+")"},toHex:function q(K){return J(this._r,this._g,this._b,K)},toHexString:function q(K){return"#"+this.toHex(K)},toHex8:function q(K){return V(this._r,this._g,this._b,this._a,K)},toHex8String:function q(K){return"#"+this.toHex8(K)},toRgb:function q(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function q(){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 q(){return{r:Math.round(x(this._r,255)*100)+"%",g:Math.round(x(this._g,255)*100)+"%",b:Math.round(x(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function q(){return this._a==1?"rgb("+Math.round(x(this._r,255)*100)+"%, "+Math.round(x(this._g,255)*100)+"%, "+Math.round(x(this._b,255)*100)+"%)":"rgba("+Math.round(x(this._r,255)*100)+"%, "+Math.round(x(this._g,255)*100)+"%, "+Math.round(x(this._b,255)*100)+"%, "+this._roundA+")"},toName:function q(){if(this._a===0)return"transparent";if(this._a<1)return!1;return q2[J(this._r,this._g,this._b,!0)]||!1},toFilter:function q(K){var Y="#"+A(this._r,this._g,this._b,this._a),H=Y,j=this._gradientType?"GradientType = 1, ":"";if(K){var _=C(K);H="#"+A(_._r,_._g,_._b,_._a)}return"progid:DXImageTransform.Microsoft.gradient("+j+"startColorstr="+Y+",endColorstr="+H+")"},toString:function q(K){var Y=!!K;K=K||this._format;var H=!1,j=this._a<1&&this._a>=0,_=!Y&&j&&(K==="hex"||K==="hex6"||K==="hex3"||K==="hex4"||K==="hex8"||K==="name");if(_){if(K==="name"&&this._a===0)return this.toName();return this.toRgbString()}if(K==="rgb")H=this.toRgbString();if(K==="prgb")H=this.toPercentageRgbString();if(K==="hex"||K==="hex6")H=this.toHexString();if(K==="hex3")H=this.toHexString(!0);if(K==="hex4")H=this.toHex8String(!0);if(K==="hex8")H=this.toHex8String();if(K==="name")H=this.toName();if(K==="hsl")H=this.toHslString();if(K==="hsv")H=this.toHsvString();return H||this.toHexString()},clone:function q(){return C(this.toString())},_applyModification:function q(K,Y){var H=K.apply(null,[this].concat([].slice.call(Y)));return this._r=H._r,this._g=H._g,this._b=H._b,this.setAlpha(H._a),this},lighten:function q(){return this._applyModification(W,arguments)},brighten:function q(){return this._applyModification(I,arguments)},darken:function q(){return this._applyModification(T,arguments)},desaturate:function q(){return this._applyModification(U,arguments)},saturate:function q(){return this._applyModification(z,arguments)},greyscale:function q(){return this._applyModification(G,arguments)},spin:function q(){return this._applyModification(R,arguments)},_applyCombination:function q(K,Y){return K.apply(null,[this].concat([].slice.call(Y)))},analogous:function q(){return this._applyCombination(ED,arguments)},complement:function q(){return this._applyCombination(L,arguments)},monochromatic:function q(){return this._applyCombination(PD,arguments)},splitcomplement:function q(){return this._applyCombination(h,arguments)},triad:function q(){return this._applyCombination(S,[3])},tetrad:function q(){return this._applyCombination(S,[4])}},C.fromRatio=function(q,K){if(D(q)=="object"){var Y={};for(var H in q)if(q.hasOwnProperty(H))if(H==="a")Y[H]=q[H];else Y[H]=Yu(q[H]);q=Y}return C(q,K)};function B(q){var K={r:0,g:0,b:0},Y=1,H=null,j=null,_=null,w=!1,k=!1;if(typeof q=="string")q=n6(q);if(D(q)=="object"){if(bD(q.r)&&bD(q.g)&&bD(q.b))K=$(q.r,q.g,q.b),w=!0,k=String(q.r).substr(-1)==="%"?"prgb":"rgb";else if(bD(q.h)&&bD(q.s)&&bD(q.v))H=Yu(q.s),j=Yu(q.v),K=Z(q.h,H,j),w=!0,k="hsv";else if(bD(q.h)&&bD(q.s)&&bD(q.l))H=Yu(q.s),_=Yu(q.l),K=Q(q.h,H,_),w=!0,k="hsl";if(q.hasOwnProperty("a"))Y=q.a}return Y=Y2(Y),{ok:w,format:q.format||k,r:Math.min(255,Math.max(K.r,0)),g:Math.min(255,Math.max(K.g,0)),b:Math.min(255,Math.max(K.b,0)),a:Y}}function $(q,K,Y){return{r:x(q,255)*255,g:x(K,255)*255,b:x(Y,255)*255}}function E(q,K,Y){q=x(q,255),K=x(K,255),Y=x(Y,255);var H=Math.max(q,K,Y),j=Math.min(q,K,Y),_,w,k=(H+j)/2;if(H==j)_=w=0;else{var m=H-j;switch(w=k>0.5?m/(2-H-j):m/(H+j),H){case q:_=(K-Y)/m+(K1)RD-=1;if(RD<0.16666666666666666)return KD+(Ku-KD)*6*RD;if(RD<0.5)return Ku;if(RD<0.6666666666666666)return KD+(Ku-KD)*(0.6666666666666666-RD)*6;return KD}if(K===0)H=j=_=Y;else{var k=Y<0.5?Y*(1+K):Y+K-Y*K,m=2*Y-k;H=w(m,k,q+0.3333333333333333),j=w(m,k,q),_=w(m,k,q-0.3333333333333333)}return{r:H*255,g:j*255,b:_*255}}function X(q,K,Y){q=x(q,255),K=x(K,255),Y=x(Y,255);var H=Math.max(q,K,Y),j=Math.min(q,K,Y),_,w,k=H,m=H-j;if(w=H===0?0:m/H,H==j)_=0;else{switch(H){case q:_=(K-Y)/m+(K>1)+720)%360;--K;)H.h=(H.h+j)%360,_.push(C(H));return _}function PD(q,K){K=K||6;var Y=C(q).toHsv(),H=Y.h,j=Y.s,_=Y.v,w=[],k=1/K;while(K--)w.push(C({h:H,s:j,v:_})),_=(_+k)%1;return w}C.mix=function(q,K,Y){Y=Y===0?0:Y||50;var H=C(q).toRgb(),j=C(K).toRgb(),_=Y/100,w={r:(j.r-H.r)*_+H.r,g:(j.g-H.g)*_+H.g,b:(j.b-H.b)*_+H.b,a:(j.a-H.a)*_+H.a};return C(w)},C.readability=function(q,K){var Y=C(q),H=C(K);return(Math.max(Y.getLuminance(),H.getLuminance())+0.05)/(Math.min(Y.getLuminance(),H.getLuminance())+0.05)},C.isReadable=function(q,K,Y){var H=C.readability(q,K),j,_;switch(_=!1,j=i6(Y),j.level+j.size){case"AAsmall":case"AAAlarge":_=H>=4.5;break;case"AAlarge":_=H>=3;break;case"AAAsmall":_=H>=7;break}return _},C.mostReadable=function(q,K,Y){var H=null,j=0,_,w,k,m;Y=Y||{},w=Y.includeFallbackColors,k=Y.level,m=Y.size;for(var KD=0;KDj)j=_,H=C(K[KD]);if(C.isReadable(q,H,{level:k,size:m})||!w)return H;else return Y.includeFallbackColors=!1,C.mostReadable(q,["#fff","#000"],Y)};var nD=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"},q2=C.hexNames=d6(nD);function d6(q){var K={};for(var Y in q)if(q.hasOwnProperty(Y))K[q[Y]]=Y;return K}function Y2(q){if(q=parseFloat(q),isNaN(q)||q<0||q>1)q=1;return q}function x(q,K){if(l6(q))q="100%";var Y=p6(q);if(q=Math.min(K,Math.max(0,parseFloat(q))),Y)q=parseInt(q*K,10)/100;if(Math.abs(q-K)<0.000001)return 1;return q%K/parseFloat(K)}function iu(q){return Math.min(1,Math.max(0,q))}function $D(q){return parseInt(q,16)}function l6(q){return typeof q=="string"&&q.indexOf(".")!=-1&&parseFloat(q)===1}function p6(q){return typeof q==="string"&&q.indexOf("%")!=-1}function jD(q){return q.length==1?"0"+q:""+q}function Yu(q){if(q<=1)q=q*100+"%";return q}function K2(q){return Math.round(parseFloat(q)*255).toString(16)}function V2(q){return $D(q)/255}var MD=function(){var q="[-\\+]?\\d+%?",K="[-\\+]?\\d*\\.\\d+%?",Y="(?:"+K+")|(?:"+q+")",H="[\\s|\\(]+("+Y+")[,|\\s]+("+Y+")[,|\\s]+("+Y+")\\s*\\)?",j="[\\s|\\(]+("+Y+")[,|\\s]+("+Y+")[,|\\s]+("+Y+")[,|\\s]+("+Y+")\\s*\\)?";return{CSS_UNIT:new RegExp(Y),rgb:new RegExp("rgb"+H),rgba:new RegExp("rgba"+j),hsl:new RegExp("hsl"+H),hsla:new RegExp("hsla"+j),hsv:new RegExp("hsv"+H),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 bD(q){return!!MD.CSS_UNIT.exec(q)}function n6(q){q=q.replace(u,"").replace(F,"").toLowerCase();var K=!1;if(nD[q])q=nD[q],K=!0;else if(q=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var Y;if(Y=MD.rgb.exec(q))return{r:Y[1],g:Y[2],b:Y[3]};if(Y=MD.rgba.exec(q))return{r:Y[1],g:Y[2],b:Y[3],a:Y[4]};if(Y=MD.hsl.exec(q))return{h:Y[1],s:Y[2],l:Y[3]};if(Y=MD.hsla.exec(q))return{h:Y[1],s:Y[2],l:Y[3],a:Y[4]};if(Y=MD.hsv.exec(q))return{h:Y[1],s:Y[2],v:Y[3]};if(Y=MD.hsva.exec(q))return{h:Y[1],s:Y[2],v:Y[3],a:Y[4]};if(Y=MD.hex8.exec(q))return{r:$D(Y[1]),g:$D(Y[2]),b:$D(Y[3]),a:V2(Y[4]),format:K?"name":"hex8"};if(Y=MD.hex6.exec(q))return{r:$D(Y[1]),g:$D(Y[2]),b:$D(Y[3]),format:K?"name":"hex"};if(Y=MD.hex4.exec(q))return{r:$D(Y[1]+""+Y[1]),g:$D(Y[2]+""+Y[2]),b:$D(Y[3]+""+Y[3]),a:V2(Y[4]+""+Y[4]),format:K?"name":"hex8"};if(Y=MD.hex3.exec(q))return{r:$D(Y[1]+""+Y[1]),g:$D(Y[2]+""+Y[2]),b:$D(Y[3]+""+Y[3]),format:K?"name":"hex"};return!1}function i6(q){var K,Y;if(q=q||{level:"AA",size:"small"},K=(q.level||"AA").toUpperCase(),Y=(q.size||"small").toLowerCase(),K!=="AA"&&K!=="AAA")K="AA";if(Y!=="small"&&Y!=="large")Y="small";return{level:K,size:Y}}return C})});var O3=l((vE,T3)=>{var Wu=j3(),I3={r:256,g:256,b:256,a:1},N3={h:360,s:1,v:1,a:1};function jF(D,u,F){let C={};for(let B in D)if(D.hasOwnProperty(B))C[B]=F===0?0:(u[B]-D[B])/F;return C}function MF(D,u,F,C){let B={};for(let $ in u)if(u.hasOwnProperty($))B[$]=D[$]*F+u[$],B[$]=B[$]<0?B[$]+C[$]:C[$]!==1?B[$]%C[$]:B[$];return B}function _F(D,u,F){let C=D.color.toRgb(),B=u.color.toRgb(),$=jF(C,B,F),E=[D.color];for(let Q=1;Q$.h&&B.h-$.h>180;E=C==="long"&&J||C==="short"&&!J}let Q=jF(B,$,F),X=[D.color],Z;if(B.h<=$.h&&!E||B.h>=$.h&&E)Z=$.h-B.h;else if(E)Z=360-$.h+B.h;else Z=360-B.h+$.h;Q.h=Math.pow(-1,E?1:0)*Math.abs(Z)/F;for(let J=1;J1)throw new Error("Position must be between 0 and 1");let B,$;for(let X=0,Z=D.length;X=D[X].pos&&u{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&&(B||E===0||E===F-1))throw new Error("Cannot define two consecutive position-only stops");if(B=!X,$={color:X?Wu($.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{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 Q0(D.concat(u.reverse()))}rgb(D){let u=R3(this.stops,D),F=[];this.stops.forEach((C,B)=>{if(C.colorLess)C.color=_F(this.stops[B-1],this.stops[B+1],2)[1]});for(let C=0,B=this.stops.length;C{if(B.colorLess)B.color=M3(this.stops[$-1],this.stops[$+1],2,u)[1]});for(let B=0,$=this.stops.length;B<$-1;B++){let E=M3(this.stops[B],this.stops[B+1],F[B],u);C.splice(C.length,0,...E)}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 L3(this.stops,D,"toRgb",I3)}hsvAt(D){return L3(this.stops,D,"toHsv",N3)}}T3.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 Q0(D)}});var b3=l((tE,J7)=>{J7.exports={single:{topLeft:"\u250C",top:"\u2500",topRight:"\u2510",right:"\u2502",bottomRight:"\u2518",bottom:"\u2500",bottomLeft:"\u2514",left:"\u2502"},double:{topLeft:"\u2554",top:"\u2550",topRight:"\u2557",right:"\u2551",bottomRight:"\u255D",bottom:"\u2550",bottomLeft:"\u255A",left:"\u2551"},round:{topLeft:"\u256D",top:"\u2500",topRight:"\u256E",right:"\u2502",bottomRight:"\u256F",bottom:"\u2500",bottomLeft:"\u2570",left:"\u2502"},bold:{topLeft:"\u250F",top:"\u2501",topRight:"\u2513",right:"\u2503",bottomRight:"\u251B",bottom:"\u2501",bottomLeft:"\u2517",left:"\u2503"},singleDouble:{topLeft:"\u2553",top:"\u2500",topRight:"\u2556",right:"\u2551",bottomRight:"\u255C",bottom:"\u2500",bottomLeft:"\u2559",left:"\u2551"},doubleSingle:{topLeft:"\u2552",top:"\u2550",topRight:"\u2555",right:"\u2502",bottomRight:"\u255B",bottom:"\u2550",bottomLeft:"\u2558",left:"\u2502"},classic:{topLeft:"+",top:"-",topRight:"+",right:"|",bottomRight:"+",bottom:"-",bottomLeft:"+",left:"|"},arrow:{topLeft:"\u2198",top:"\u2193",topRight:"\u2199",right:"\u2190",bottomRight:"\u2196",bottom:"\u2191",bottomLeft:"\u2197",left:"\u2192"}}});var OF=l((eE,TF)=>{var f3=b3();TF.exports=f3;TF.exports.default=f3});var d3=l((u5,c3)=>{c3.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 p3=l((F5,l3)=>{var U7=d3();l3.exports=(D)=>typeof D==="string"?D.replace(U7(),""):D});var i3=l((C5,kF)=>{var n3=(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};kF.exports=n3;kF.exports.default=n3});var r3=l((B5,a3)=>{a3.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 s3=l((E5,SF)=>{var z7=p3(),G7=i3(),W7=r3(),o3=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=z7(D),D.length===0)return 0;D=D.replace(W7()," ");let u=0;for(let F=0;F=127&&C<=159)continue;if(C>=768&&C<=879)continue;if(C>65535)F++;u+=G7(C)?2:1}return u};SF.exports=o3;SF.exports.default=o3});var e3=l(($5,t3)=>{var _7=s3();function aD(D,u){if(!D)return D;u=u||{};let F=u.align||"center";if(F==="left")return D;let C=u.split||` -`,B=u.pad||" ",$=F!=="right"?j7:M7,E=!1;if(!Array.isArray(D))E=!0,D=String(D).split(C);let Q,X=0;return D=D.map(function(Z){return Z=String(Z),Q=_7(Z),X=Math.max(Q,X),{str:Z,width:Q}}).map(function(Z){return new Array($(X,Z.width)+1).join(B)+Z.str}),E?D.join(C):D}aD.left=function D(u){return aD(u,{align:"left"})};aD.center=function D(u){return aD(u,{align:"center"})};aD.right=function D(u){return aD(u,{align:"right"})};t3.exports=aD;function j7(D,u){return Math.floor((D-u)/2)}function M7(D,u){return D-u}});import{join as p,dirname as V0,sep as c7}from"path";import{homedir as yF}from"os";import{existsSync as A0,statSync as d7}from"fs";import{execSync as K8}from"child_process";import{fileURLToPath as l7}from"url";class O{static instance=null;_dataDirectory=null;_packageRoot=null;_claudeConfigDirectory=null;static getInstance(){if(!O.instance)O.instance=new O;return O.instance}getDataDirectory(){if(this._dataDirectory)return this._dataDirectory;return this._dataDirectory=process.env.CLAUDE_MEM_DATA_DIR||p(yF(),".claude-mem"),this._dataDirectory}getArchivesDirectory(){return p(this.getDataDirectory(),"archives")}getLogsDirectory(){return p(this.getDataDirectory(),"logs")}getIndexDirectory(){return this.getDataDirectory()}getIndexPath(){return p(this.getIndexDirectory(),"claude-mem-index.jsonl")}getTrashDirectory(){return p(this.getDataDirectory(),"trash")}getBackupsDirectory(){return p(this.getDataDirectory(),"backups")}getChromaDirectory(){return p(this.getDataDirectory(),"chroma")}getProjectArchiveDirectory(D){return p(this.getArchivesDirectory(),D)}getUserSettingsPath(){return p(this.getDataDirectory(),"settings.json")}getClaudeConfigDirectory(){if(this._claudeConfigDirectory)return this._claudeConfigDirectory;return this._claudeConfigDirectory=process.env.CLAUDE_CONFIG_DIR||p(yF(),".claude"),this._claudeConfigDirectory}getClaudeSettingsPath(){return p(this.getClaudeConfigDirectory(),"settings.json")}getClaudeCommandsDirectory(){return p(this.getClaudeConfigDirectory(),"commands")}getClaudeMdPath(){return p(this.getClaudeConfigDirectory(),"CLAUDE.md")}getMcpConfigPath(){return p(yF(),".claude.json")}getProjectMcpConfigPath(){return p(process.cwd(),".mcp.json")}getPackageRoot(){if(this._packageRoot)return this._packageRoot;try{let F=LD.resolve("claude-mem/package.json");return this._packageRoot=V0(F),this._packageRoot}catch{}let D=l7(import.meta.url),u=V0(D);for(let F=0;F<10;F++){let C=p(u,"package.json");if(A0(C)){if(LD(C).name==="claude-mem")return this._packageRoot=u,this._packageRoot}let B=V0(u);if(B===u)break;u=B}try{let F=K8("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=V0(C.dependencies["claude-mem"].resolved),this._packageRoot}catch{}throw new Error("Cannot locate claude-mem package root. Ensure claude-mem is properly installed.")}findPackageCommandsDirectory(){let D=this.getPackageRoot(),u=p(D,"commands"),F=["save.md"];for(let C of F)if(!A0(p(u,C)))throw new Error(`Package commands directory missing required file: ${C}`);return u}ensureDirectory(D){if(!A0(D))LD("fs").mkdirSync(D,{recursive:!0})}ensureDirectories(D){D.forEach((u)=>this.ensureDirectory(u))}ensureAllDataDirectories(){this.ensureDirectories([this.getDataDirectory(),this.getArchivesDirectory(),this.getLogsDirectory(),this.getTrashDirectory(),this.getBackupsDirectory(),this.getChromaDirectory()])}ensureAllClaudeDirectories(){this.ensureDirectories([this.getClaudeConfigDirectory(),this.getClaudeCommandsDirectory()])}static extractProjectName(D){let u=D.split(c7),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=K8("git rev-parse --show-toplevel",{cwd:process.cwd(),encoding:"utf8",stdio:["pipe","pipe","ignore"]}).trim();return LD("path").basename(D)}catch{return LD("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 A0(D)&&d7(D).isDirectory()}}var HD=()=>{};import{Database as q4}from"bun:sqlite";import Y4 from"path";import K4 from"fs";class _D{db;constructor(){let D=O.getInstance().getDataDirectory();K4.mkdirSync(D,{recursive:!0});let u=Y4.join(D,"claude-mem.db");this.db=new q4(u,{create:!0,readwrite:!0}),this.db.run("PRAGMA journal_mode = WAL"),this.db.run("PRAGMA synchronous = NORMAL"),this.db.run("PRAGMA foreign_keys = ON")}getRecentSummaries(D,u=10){return this.db.query(` +`)}),this}_outputHelpIfRequested(D){let u=this._getHelpOption();if(u&&D.find((C)=>u.is(C)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function N2(D){return D.map((u)=>{if(!u.startsWith("--inspect"))return u;let F,C="127.0.0.1",B="9229",$;if(($=u.match(/^(--inspect(-brk)?)$/))!==null)F=$[1];else if(($=u.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(F=$[1],/^\d+$/.test($[3]))B=$[3];else C=$[3];else if(($=u.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)F=$[1],C=$[3],B=$[4];if(F&&B!=="0")return`${F}=${C}:${parseInt(B)+1}`;return u})}function r0(){if(P.env.NO_COLOR||P.env.FORCE_COLOR==="0"||P.env.FORCE_COLOR==="false")return!1;if(P.env.FORCE_COLOR||P.env.CLICOLOR_FORCE!==void 0)return!0;return}b1.Command=o0;b1.useColor=r0});var k2=l((c1)=>{var{Argument:O2}=ru(),{Command:s0}=T2(),{CommanderError:g1,InvalidArgumentError:w2}=Au(),{Help:m1}=p0(),{Option:P2}=n0();c1.program=new s0;c1.createCommand=(D)=>new s0(D);c1.createOption=(D,u)=>new P2(D,u);c1.createArgument=(D,u)=>new O2(D,u);c1.Command=s0;c1.Option=P2;c1.Argument=O2;c1.Help=m1;c1.CommanderError=g1;c1.InvalidArgumentError=w2;c1.InvalidOptionArgumentError=w2});var e0=l((WE,d2)=>{var t0={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"},EC={up:(D=1)=>"\x1B[S".repeat(D),down:(D=1)=>"\x1B[T".repeat(D)},$C={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{var tu=process||{},l2=tu.argv||[],su=tu.env||{},QC=!(!!su.NO_COLOR||l2.includes("--no-color"))&&(!!su.FORCE_COLOR||l2.includes("--color")||tu.platform==="win32"||(tu.stdout||{}).isTTY&&su.TERM!=="dumb"||!!su.CI),XC=(D,u,F=D)=>(C)=>{let B=""+C,$=B.indexOf(u,D.length);return~$?D+ZC(B,u,F,$)+u:D+B+u},ZC=(D,u,F,C)=>{let B="",$=0;do B+=D.substring($,C)+F,$=C+u.length,C=D.indexOf(u,$);while(~C);return B+D.substring($)},p2=(D=QC)=>{let u=D?XC:()=>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")}};DF.exports=p2();DF.exports.createColors=p2});var R3=l((WF,_F)=>{(function(D,u){typeof WF==="object"&&typeof _F!=="undefined"?_F.exports=u():typeof define==="function"&&define.amd?define(u):(D=typeof globalThis!=="undefined"?globalThis:D||self,D.tinycolor=u())})(WF,function(){function D(Y){return D=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(K){return typeof K}:function(K){return K&&typeof Symbol=="function"&&K.constructor===Symbol&&K!==Symbol.prototype?"symbol":typeof K},D(Y)}var u=/^\s+/,F=/\s+$/;function C(Y,K){if(Y=Y?Y:"",K=K||{},Y instanceof C)return Y;if(!(this instanceof C))return new C(Y,K);var q=B(Y);if(this._originalInput=Y,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=K.format||q.format,this._gradientType=K.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 Y(){return this.getBrightness()<128},isLight:function Y(){return!this.isDark()},isValid:function Y(){return this._ok},getOriginalInput:function Y(){return this._originalInput},getFormat:function Y(){return this._format},getAlpha:function Y(){return this._a},getBrightness:function Y(){var K=this.toRgb();return(K.r*299+K.g*587+K.b*114)/1000},getLuminance:function Y(){var K=this.toRgb(),q,H,j,_,w,k;if(q=K.r/255,H=K.g/255,j=K.b/255,q<=0.03928)_=q/12.92;else _=Math.pow((q+0.055)/1.055,2.4);if(H<=0.03928)w=H/12.92;else w=Math.pow((H+0.055)/1.055,2.4);if(j<=0.03928)k=j/12.92;else k=Math.pow((j+0.055)/1.055,2.4);return 0.2126*_+0.7152*w+0.0722*k},setAlpha:function Y(K){return this._a=K2(K),this._roundA=Math.round(100*this._a)/100,this},toHsv:function Y(){var K=X(this._r,this._g,this._b);return{h:K.h*360,s:K.s,v:K.v,a:this._a}},toHsvString:function Y(){var K=X(this._r,this._g,this._b),q=Math.round(K.h*360),H=Math.round(K.s*100),j=Math.round(K.v*100);return this._a==1?"hsv("+q+", "+H+"%, "+j+"%)":"hsva("+q+", "+H+"%, "+j+"%, "+this._roundA+")"},toHsl:function Y(){var K=E(this._r,this._g,this._b);return{h:K.h*360,s:K.s,l:K.l,a:this._a}},toHslString:function Y(){var K=E(this._r,this._g,this._b),q=Math.round(K.h*360),H=Math.round(K.s*100),j=Math.round(K.l*100);return this._a==1?"hsl("+q+", "+H+"%, "+j+"%)":"hsla("+q+", "+H+"%, "+j+"%, "+this._roundA+")"},toHex:function Y(K){return J(this._r,this._g,this._b,K)},toHexString:function Y(K){return"#"+this.toHex(K)},toHex8:function Y(K){return V(this._r,this._g,this._b,this._a,K)},toHex8String:function Y(K){return"#"+this.toHex8(K)},toRgb:function Y(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function Y(){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 Y(){return{r:Math.round(x(this._r,255)*100)+"%",g:Math.round(x(this._g,255)*100)+"%",b:Math.round(x(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function Y(){return this._a==1?"rgb("+Math.round(x(this._r,255)*100)+"%, "+Math.round(x(this._g,255)*100)+"%, "+Math.round(x(this._b,255)*100)+"%)":"rgba("+Math.round(x(this._r,255)*100)+"%, "+Math.round(x(this._g,255)*100)+"%, "+Math.round(x(this._b,255)*100)+"%, "+this._roundA+")"},toName:function Y(){if(this._a===0)return"transparent";if(this._a<1)return!1;return q2[J(this._r,this._g,this._b,!0)]||!1},toFilter:function Y(K){var q="#"+A(this._r,this._g,this._b,this._a),H=q,j=this._gradientType?"GradientType = 1, ":"";if(K){var _=C(K);H="#"+A(_._r,_._g,_._b,_._a)}return"progid:DXImageTransform.Microsoft.gradient("+j+"startColorstr="+q+",endColorstr="+H+")"},toString:function Y(K){var q=!!K;K=K||this._format;var H=!1,j=this._a<1&&this._a>=0,_=!q&&j&&(K==="hex"||K==="hex6"||K==="hex3"||K==="hex4"||K==="hex8"||K==="name");if(_){if(K==="name"&&this._a===0)return this.toName();return this.toRgbString()}if(K==="rgb")H=this.toRgbString();if(K==="prgb")H=this.toPercentageRgbString();if(K==="hex"||K==="hex6")H=this.toHexString();if(K==="hex3")H=this.toHexString(!0);if(K==="hex4")H=this.toHex8String(!0);if(K==="hex8")H=this.toHex8String();if(K==="name")H=this.toName();if(K==="hsl")H=this.toHslString();if(K==="hsv")H=this.toHsvString();return H||this.toHexString()},clone:function Y(){return C(this.toString())},_applyModification:function Y(K,q){var H=K.apply(null,[this].concat([].slice.call(q)));return this._r=H._r,this._g=H._g,this._b=H._b,this.setAlpha(H._a),this},lighten:function Y(){return this._applyModification(W,arguments)},brighten:function Y(){return this._applyModification(I,arguments)},darken:function Y(){return this._applyModification(O,arguments)},desaturate:function Y(){return this._applyModification(U,arguments)},saturate:function Y(){return this._applyModification(z,arguments)},greyscale:function Y(){return this._applyModification(G,arguments)},spin:function Y(){return this._applyModification(R,arguments)},_applyCombination:function Y(K,q){return K.apply(null,[this].concat([].slice.call(q)))},analogous:function Y(){return this._applyCombination(XD,arguments)},complement:function Y(){return this._applyCombination(L,arguments)},monochromatic:function Y(){return this._applyCombination(PD,arguments)},splitcomplement:function Y(){return this._applyCombination(h,arguments)},triad:function Y(){return this._applyCombination(S,[3])},tetrad:function Y(){return this._applyCombination(S,[4])}},C.fromRatio=function(Y,K){if(D(Y)=="object"){var q={};for(var H in Y)if(Y.hasOwnProperty(H))if(H==="a")q[H]=Y[H];else q[H]=Ku(Y[H]);Y=q}return C(Y,K)};function B(Y){var K={r:0,g:0,b:0},q=1,H=null,j=null,_=null,w=!1,k=!1;if(typeof Y=="string")Y=B1(Y);if(D(Y)=="object"){if(fD(Y.r)&&fD(Y.g)&&fD(Y.b))K=$(Y.r,Y.g,Y.b),w=!0,k=String(Y.r).substr(-1)==="%"?"prgb":"rgb";else if(fD(Y.h)&&fD(Y.s)&&fD(Y.v))H=Ku(Y.s),j=Ku(Y.v),K=Z(Y.h,H,j),w=!0,k="hsv";else if(fD(Y.h)&&fD(Y.s)&&fD(Y.l))H=Ku(Y.s),_=Ku(Y.l),K=Q(Y.h,H,_),w=!0,k="hsl";if(Y.hasOwnProperty("a"))q=Y.a}return q=K2(q),{ok:w,format:Y.format||k,r:Math.min(255,Math.max(K.r,0)),g:Math.min(255,Math.max(K.g,0)),b:Math.min(255,Math.max(K.b,0)),a:q}}function $(Y,K,q){return{r:x(Y,255)*255,g:x(K,255)*255,b:x(q,255)*255}}function E(Y,K,q){Y=x(Y,255),K=x(K,255),q=x(q,255);var H=Math.max(Y,K,q),j=Math.min(Y,K,q),_,w,k=(H+j)/2;if(H==j)_=w=0;else{var m=H-j;switch(w=k>0.5?m/(2-H-j):m/(H+j),H){case Y:_=(K-q)/m+(K1)RD-=1;if(RD<0.16666666666666666)return AD+(Vu-AD)*6*RD;if(RD<0.5)return Vu;if(RD<0.6666666666666666)return AD+(Vu-AD)*(0.6666666666666666-RD)*6;return AD}if(K===0)H=j=_=q;else{var k=q<0.5?q*(1+K):q+K-q*K,m=2*q-k;H=w(m,k,Y+0.3333333333333333),j=w(m,k,Y),_=w(m,k,Y-0.3333333333333333)}return{r:H*255,g:j*255,b:_*255}}function X(Y,K,q){Y=x(Y,255),K=x(K,255),q=x(q,255);var H=Math.max(Y,K,q),j=Math.min(Y,K,q),_,w,k=H,m=H-j;if(w=H===0?0:m/H,H==j)_=0;else{switch(H){case Y:_=(K-q)/m+(K>1)+720)%360;--K;)H.h=(H.h+j)%360,_.push(C(H));return _}function PD(Y,K){K=K||6;var q=C(Y).toHsv(),H=q.h,j=q.s,_=q.v,w=[],k=1/K;while(K--)w.push(C({h:H,s:j,v:_})),_=(_+k)%1;return w}C.mix=function(Y,K,q){q=q===0?0:q||50;var H=C(Y).toRgb(),j=C(K).toRgb(),_=q/100,w={r:(j.r-H.r)*_+H.r,g:(j.g-H.g)*_+H.g,b:(j.b-H.b)*_+H.b,a:(j.a-H.a)*_+H.a};return C(w)},C.readability=function(Y,K){var q=C(Y),H=C(K);return(Math.max(q.getLuminance(),H.getLuminance())+0.05)/(Math.min(q.getLuminance(),H.getLuminance())+0.05)},C.isReadable=function(Y,K,q){var H=C.readability(Y,K),j,_;switch(_=!1,j=E1(q),j.level+j.size){case"AAsmall":case"AAAlarge":_=H>=4.5;break;case"AAlarge":_=H>=3;break;case"AAAsmall":_=H>=7;break}return _},C.mostReadable=function(Y,K,q){var H=null,j=0,_,w,k,m;q=q||{},w=q.includeFallbackColors,k=q.level,m=q.size;for(var AD=0;ADj)j=_,H=C(K[AD]);if(C.isReadable(Y,H,{level:k,size:m})||!w)return H;else return q.includeFallbackColors=!1,C.mostReadable(Y,["#fff","#000"],q)};var iD=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"},q2=C.hexNames=u1(iD);function u1(Y){var K={};for(var q in Y)if(Y.hasOwnProperty(q))K[Y[q]]=q;return K}function K2(Y){if(Y=parseFloat(Y),isNaN(Y)||Y<0||Y>1)Y=1;return Y}function x(Y,K){if(F1(Y))Y="100%";var q=C1(Y);if(Y=Math.min(K,Math.max(0,parseFloat(Y))),q)Y=parseInt(Y*K,10)/100;if(Math.abs(Y-K)<0.000001)return 1;return Y%K/parseFloat(K)}function au(Y){return Math.min(1,Math.max(0,Y))}function ZD(Y){return parseInt(Y,16)}function F1(Y){return typeof Y=="string"&&Y.indexOf(".")!=-1&&parseFloat(Y)===1}function C1(Y){return typeof Y==="string"&&Y.indexOf("%")!=-1}function jD(Y){return Y.length==1?"0"+Y:""+Y}function Ku(Y){if(Y<=1)Y=Y*100+"%";return Y}function V2(Y){return Math.round(parseFloat(Y)*255).toString(16)}function A2(Y){return ZD(Y)/255}var MD=function(){var Y="[-\\+]?\\d+%?",K="[-\\+]?\\d*\\.\\d+%?",q="(?:"+K+")|(?:"+Y+")",H="[\\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"+H),rgba:new RegExp("rgba"+j),hsl:new RegExp("hsl"+H),hsla:new RegExp("hsla"+j),hsv:new RegExp("hsv"+H),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 fD(Y){return!!MD.CSS_UNIT.exec(Y)}function B1(Y){Y=Y.replace(u,"").replace(F,"").toLowerCase();var K=!1;if(iD[Y])Y=iD[Y],K=!0;else if(Y=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var q;if(q=MD.rgb.exec(Y))return{r:q[1],g:q[2],b:q[3]};if(q=MD.rgba.exec(Y))return{r:q[1],g:q[2],b:q[3],a:q[4]};if(q=MD.hsl.exec(Y))return{h:q[1],s:q[2],l:q[3]};if(q=MD.hsla.exec(Y))return{h:q[1],s:q[2],l:q[3],a:q[4]};if(q=MD.hsv.exec(Y))return{h:q[1],s:q[2],v:q[3]};if(q=MD.hsva.exec(Y))return{h:q[1],s:q[2],v:q[3],a:q[4]};if(q=MD.hex8.exec(Y))return{r:ZD(q[1]),g:ZD(q[2]),b:ZD(q[3]),a:A2(q[4]),format:K?"name":"hex8"};if(q=MD.hex6.exec(Y))return{r:ZD(q[1]),g:ZD(q[2]),b:ZD(q[3]),format:K?"name":"hex"};if(q=MD.hex4.exec(Y))return{r:ZD(q[1]+""+q[1]),g:ZD(q[2]+""+q[2]),b:ZD(q[3]+""+q[3]),a:A2(q[4]+""+q[4]),format:K?"name":"hex8"};if(q=MD.hex3.exec(Y))return{r:ZD(q[1]+""+q[1]),g:ZD(q[2]+""+q[2]),b:ZD(q[3]+""+q[3]),format:K?"name":"hex"};return!1}function E1(Y){var K,q;if(Y=Y||{level:"AA",size:"small"},K=(Y.level||"AA").toUpperCase(),q=(Y.size||"small").toLowerCase(),K!=="AA"&&K!=="AAA")K="AA";if(q!=="small"&&q!=="large")q="small";return{level:K,size:q}}return C})});var P3=l((C5,w3)=>{var _u=R3(),T3={r:256,g:256,b:256,a:1},O3={h:360,s:1,v:1,a:1};function MF(D,u,F){let C={};for(let B in D)if(D.hasOwnProperty(B))C[B]=F===0?0:(u[B]-D[B])/F;return C}function RF(D,u,F,C){let B={};for(let $ in u)if(u.hasOwnProperty($))B[$]=D[$]*F+u[$],B[$]=B[$]<0?B[$]+C[$]:C[$]!==1?B[$]%C[$]:B[$];return B}function jF(D,u,F){let C=D.color.toRgb(),B=u.color.toRgb(),$=MF(C,B,F),E=[D.color];for(let Q=1;Q$.h&&B.h-$.h>180;E=C==="long"&&J||C==="short"&&!J}let Q=MF(B,$,F),X=[D.color],Z;if(B.h<=$.h&&!E||B.h>=$.h&&E)Z=$.h-B.h;else if(E)Z=360-$.h+B.h;else Z=360-B.h+$.h;Q.h=Math.pow(-1,E?1:0)*Math.abs(Z)/F;for(let J=1;J1)throw new Error("Position must be between 0 and 1");let B,$;for(let X=0,Z=D.length;X=D[X].pos&&u{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&&(B||E===0||E===F-1))throw new Error("Cannot define two consecutive position-only stops");if(B=!X,$={color:X?_u($.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{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 X0(D.concat(u.reverse()))}rgb(D){let u=I3(this.stops,D),F=[];this.stops.forEach((C,B)=>{if(C.colorLess)C.color=jF(this.stops[B-1],this.stops[B+1],2)[1]});for(let C=0,B=this.stops.length;C{if(B.colorLess)B.color=L3(this.stops[$-1],this.stops[$+1],2,u)[1]});for(let B=0,$=this.stops.length;B<$-1;B++){let E=L3(this.stops[B],this.stops[B+1],F[B],u);C.splice(C.length,0,...E)}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 N3(this.stops,D,"toRgb",T3)}hsvAt(D){return N3(this.stops,D,"toHsv",O3)}}w3.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 X0(D)}});var y3=l((W5,_7)=>{_7.exports={single:{topLeft:"\u250C",top:"\u2500",topRight:"\u2510",right:"\u2502",bottomRight:"\u2518",bottom:"\u2500",bottomLeft:"\u2514",left:"\u2502"},double:{topLeft:"\u2554",top:"\u2550",topRight:"\u2557",right:"\u2551",bottomRight:"\u255D",bottom:"\u2550",bottomLeft:"\u255A",left:"\u2551"},round:{topLeft:"\u256D",top:"\u2500",topRight:"\u256E",right:"\u2502",bottomRight:"\u256F",bottom:"\u2500",bottomLeft:"\u2570",left:"\u2502"},bold:{topLeft:"\u250F",top:"\u2501",topRight:"\u2513",right:"\u2503",bottomRight:"\u251B",bottom:"\u2501",bottomLeft:"\u2517",left:"\u2503"},singleDouble:{topLeft:"\u2553",top:"\u2500",topRight:"\u2556",right:"\u2551",bottomRight:"\u255C",bottom:"\u2500",bottomLeft:"\u2559",left:"\u2551"},doubleSingle:{topLeft:"\u2552",top:"\u2550",topRight:"\u2555",right:"\u2502",bottomRight:"\u255B",bottom:"\u2550",bottomLeft:"\u2558",left:"\u2502"},classic:{topLeft:"+",top:"-",topRight:"+",right:"|",bottomRight:"+",bottom:"-",bottomLeft:"+",left:"|"},arrow:{topLeft:"\u2198",top:"\u2193",topRight:"\u2199",right:"\u2190",bottomRight:"\u2196",bottom:"\u2191",bottomLeft:"\u2197",left:"\u2192"}}});var wF=l((_5,OF)=>{var h3=y3();OF.exports=h3;OF.exports.default=h3});var p3=l((M5,l3)=>{l3.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 i3=l((R5,n3)=>{var T7=p3();n3.exports=(D)=>typeof D==="string"?D.replace(T7(),""):D});var r3=l((L5,SF)=>{var a3=(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};SF.exports=a3;SF.exports.default=a3});var s3=l((I5,o3)=>{o3.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 e3=l((N5,xF)=>{var O7=i3(),w7=r3(),P7=s3(),t3=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=O7(D),D.length===0)return 0;D=D.replace(P7()," ");let u=0;for(let F=0;F=127&&C<=159)continue;if(C>=768&&C<=879)continue;if(C>65535)F++;u+=w7(C)?2:1}return u};xF.exports=t3;xF.exports.default=t3});var u8=l((T5,D8)=>{var k7=e3();function aD(D,u){if(!D)return D;u=u||{};let F=u.align||"center";if(F==="left")return D;let C=u.split||` +`,B=u.pad||" ",$=F!=="right"?S7:x7,E=!1;if(!Array.isArray(D))E=!0,D=String(D).split(C);let Q,X=0;return D=D.map(function(Z){return Z=String(Z),Q=k7(Z),X=Math.max(Q,X),{str:Z,width:Q}}).map(function(Z){return new Array($(X,Z.width)+1).join(B)+Z.str}),E?D.join(C):D}aD.left=function D(u){return aD(u,{align:"left"})};aD.center=function D(u){return aD(u,{align:"center"})};aD.right=function D(u){return aD(u,{align:"right"})};D8.exports=aD;function S7(D,u){return Math.floor((D-u)/2)}function x7(D,u){return D-u}});import{join as p,dirname as A0,sep as e7}from"path";import{homedir as hF}from"os";import{existsSync as H0,statSync as D9}from"fs";import{execSync as A8}from"child_process";import{fileURLToPath as u9}from"url";class T{static instance=null;_dataDirectory=null;_packageRoot=null;_claudeConfigDirectory=null;static getInstance(){if(!T.instance)T.instance=new T;return T.instance}getDataDirectory(){if(this._dataDirectory)return this._dataDirectory;return this._dataDirectory=process.env.CLAUDE_MEM_DATA_DIR||p(hF(),".claude-mem"),this._dataDirectory}getArchivesDirectory(){return p(this.getDataDirectory(),"archives")}getLogsDirectory(){return p(this.getDataDirectory(),"logs")}getIndexDirectory(){return this.getDataDirectory()}getIndexPath(){return p(this.getIndexDirectory(),"claude-mem-index.jsonl")}getTrashDirectory(){return p(this.getDataDirectory(),"trash")}getBackupsDirectory(){return p(this.getDataDirectory(),"backups")}getChromaDirectory(){return p(this.getDataDirectory(),"chroma")}getProjectArchiveDirectory(D){return p(this.getArchivesDirectory(),D)}getUserSettingsPath(){return p(this.getDataDirectory(),"settings.json")}getClaudeConfigDirectory(){if(this._claudeConfigDirectory)return this._claudeConfigDirectory;return this._claudeConfigDirectory=process.env.CLAUDE_CONFIG_DIR||p(hF(),".claude"),this._claudeConfigDirectory}getClaudeSettingsPath(){return p(this.getClaudeConfigDirectory(),"settings.json")}getClaudeCommandsDirectory(){return p(this.getClaudeConfigDirectory(),"commands")}getClaudeMdPath(){return p(this.getClaudeConfigDirectory(),"CLAUDE.md")}getMcpConfigPath(){return p(hF(),".claude.json")}getProjectMcpConfigPath(){return p(process.cwd(),".mcp.json")}getPackageRoot(){if(this._packageRoot)return this._packageRoot;try{let F=LD.resolve("claude-mem/package.json");return this._packageRoot=A0(F),this._packageRoot}catch{}let D=u9(import.meta.url),u=A0(D);for(let F=0;F<10;F++){let C=p(u,"package.json");if(H0(C)){if(LD(C).name==="claude-mem")return this._packageRoot=u,this._packageRoot}let B=A0(u);if(B===u)break;u=B}try{let F=A8("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=A0(C.dependencies["claude-mem"].resolved),this._packageRoot}catch{}throw new Error("Cannot locate claude-mem package root. Ensure claude-mem is properly installed.")}findPackageCommandsDirectory(){let D=this.getPackageRoot(),u=p(D,"commands"),F=["save.md"];for(let C of F)if(!H0(p(u,C)))throw new Error(`Package commands directory missing required file: ${C}`);return u}ensureDirectory(D){if(!H0(D))LD("fs").mkdirSync(D,{recursive:!0})}ensureDirectories(D){D.forEach((u)=>this.ensureDirectory(u))}ensureAllDataDirectories(){this.ensureDirectories([this.getDataDirectory(),this.getArchivesDirectory(),this.getLogsDirectory(),this.getTrashDirectory(),this.getBackupsDirectory(),this.getChromaDirectory()])}ensureAllClaudeDirectories(){this.ensureDirectories([this.getClaudeConfigDirectory(),this.getClaudeCommandsDirectory()])}static extractProjectName(D){let u=D.split(e7),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=A8("git rev-parse --show-toplevel",{cwd:process.cwd(),encoding:"utf8",stdio:["pipe","pipe","ignore"]}).trim();return LD("path").basename(D)}catch{return LD("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 H0(D)&&D9(D).isDirectory()}}var FD=()=>{};import{Database as j4}from"bun:sqlite";import M4 from"path";import R4 from"fs";class $D{db;constructor(){let D=T.getInstance().getDataDirectory();R4.mkdirSync(D,{recursive:!0});let u=M4.join(D,"claude-mem.db");this.db=new j4(u,{create:!0,readwrite:!0}),this.db.run("PRAGMA journal_mode = WAL"),this.db.run("PRAGMA synchronous = NORMAL"),this.db.run("PRAGMA foreign_keys = ON")}getRecentSummaries(D,u=10){return this.db.query(` SELECT request, investigated, learned, completed, next_steps, files_read, files_edited, notes, created_at @@ -47,20 +47,6 @@ Expecting one of '${F.join("', '")}'`);let C=`${D}Help`;return this.on(C,(B)=>{l UPDATE sdk_sessions SET sdk_session_id = ? WHERE id = ? - `).run(u,D)}queueObservation(D,u,F,C){let B=Date.now();this.db.query(` - INSERT INTO observation_queue - (sdk_session_id, tool_name, tool_input, tool_output, created_at_epoch) - VALUES (?, ?, ?, ?, ?) - `).run(D,u,F,C,B)}getPendingObservations(D,u=10){return this.db.query(` - SELECT id, tool_name, tool_input, tool_output, created_at_epoch - FROM observation_queue - WHERE sdk_session_id = ? AND processed_at_epoch IS NULL - ORDER BY created_at_epoch ASC - LIMIT ? - `).all(D,u)}markObservationProcessed(D){let u=Date.now();this.db.query(` - UPDATE observation_queue - SET processed_at_epoch = ? - WHERE id = ? `).run(u,D)}storeObservation(D,u,F,C){let B=new Date,$=B.getTime();this.db.query(` INSERT INTO observations (sdk_session_id, project, text, type, created_at, created_at_epoch) @@ -78,69 +64,214 @@ Expecting one of '${F.join("', '")}'`);let C=`${D}Help`;return this.on(C,(B)=>{l UPDATE sdk_sessions SET status = 'failed', completed_at = ?, completed_at_epoch = ? WHERE id = ? - `).run(u.toISOString(),F,D)}close(){this.db.close()}}var Ju=iD(()=>{HD()});import L4 from"path";function x6(D){try{if(D.source&&D.source!=="startup")console.log(""),process.exit(0);let u=L4.basename(D.cwd),F=new _D,C=F.getRecentSummaries(u,5);if(F.close(),C.length===0)console.log(""),process.exit(0);let B=[];B.push("# Recent Session Context"),B.push(""),B.push(`Here's what happened in recent ${u} sessions:`),B.push("");for(let $ of C){if(B.push("---"),B.push(""),$.request)B.push(`**Request:** ${$.request}`);if($.completed)B.push(`**Completed:** ${$.completed}`);if($.learned)B.push(`**Learned:** ${$.learned}`);if($.next_steps)B.push(`**Next Steps:** ${$.next_steps}`);if($.files_edited)try{let E=JSON.parse($.files_edited);if(Array.isArray(E)&&E.length>0)B.push(`**Files Edited:** ${E.join(", ")}`)}catch{if($.files_edited.trim())B.push(`**Files Edited:** ${$.files_edited}`)}B.push(`**Date:** ${$.created_at.split("T")[0]}`),B.push("")}console.log(B.join(` -`)),process.exit(0)}catch(u){console.error(`[claude-mem context error: ${u.message}]`),process.exit(0)}}var v6=iD(()=>{Ju()});import I4 from"path";function b6(D){try{let{session_id:u,cwd:F,tool_name:C,tool_input:B,tool_output:$}=D;if(N4.has(C))console.log('{"continue": true, "suppressOutput": true}'),process.exit(0);let E=I4.basename(F),Q=new _D,X=Q.findActiveSDKSession(u);if(!X)Q.close(),console.log('{"continue": true, "suppressOutput": true}'),process.exit(0);let Z=X.sdk_session_id||`pending-${X.id}`;Q.queueObservation(Z,C,JSON.stringify(B),JSON.stringify($)),Q.close(),console.log('{"continue": true, "suppressOutput": true}'),process.exit(0)}catch(u){console.error(`[claude-mem save error: ${u.message}]`),console.log('{"continue": true, "suppressOutput": true}'),process.exit(0)}}var N4;var f6=iD(()=>{Ju();N4=new Set(["TodoWrite","ListMcpResourcesTool"])});import Z2 from"path";import{spawn as T4}from"child_process";import y6 from"fs";function h6(D){try{let{session_id:u,cwd:F,prompt:C}=D,B=Z2.basename(F),$=new _D;if($.findActiveSDKSession(u))$.close(),console.log('{"continue": true, "suppressOutput": true}'),process.exit(0);let Q=$.createSDKSession(u,B,C);$.close();let X=Z2.join(__dirname,"..","sdk","worker.ts"),Z=Z2.join(__dirname,"..","sdk","worker.js"),J;if(y6.existsSync(X))J=X;else if(y6.existsSync(Z))J=Z;else console.error("[claude-mem] Worker not found, skipping background processing"),console.log('{"continue": true, "suppressOutput": true}'),process.exit(0);T4("bun",[J,Q.toString()],{detached:!0,stdio:"ignore"}).unref(),console.log('{"continue": true, "suppressOutput": true}'),process.exit(0)}catch(u){console.error(`[claude-mem new error: ${u.message}]`),console.log('{"continue": true, "suppressOutput": true}'),process.exit(0)}}var __dirname="/Users/alexnewman/Scripts/claude-mem/src/hooks";var g6=iD(()=>{Ju()});function m6(D){try{let{session_id:u}=D,F=new _D,C=F.findActiveSDKSession(u);if(!C)F.close(),console.log('{"continue": true, "suppressOutput": true}'),process.exit(0);let B=C.sdk_session_id||`pending-${C.id}`;F.queueObservation(B,"FINALIZE","{}","{}"),F.close(),console.log('{"continue": true, "suppressOutput": true}'),process.exit(0)}catch(u){console.error(`[claude-mem summary error: ${u.message}]`),console.log('{"continue": true, "suppressOutput": true}'),process.exit(0)}}var c6=iD(()=>{Ju()});var pu={};t6(pu,{summaryHook:()=>m6,saveHook:()=>b6,newHook:()=>h6,contextHook:()=>x6});var nu=iD(()=>{v6();f6();g6();c6()});var P2=fD(w2(),1),{program:f4,createCommand:y4,createArgument:h4,createOption:g4,CommanderError:m4,InvalidArgumentError:c4,InvalidOptionArgumentError:d4,Command:k2,Argument:l4,Option:p4,Help:n4}=P2.default;import{readFileSync as d1,existsSync as l1}from"fs";import{join as p1,dirname as n1}from"path";import{fileURLToPath as i1}from"url";var S2="claude-mem",x2="3.9.16",v2="Memory compression system for Claude Code - persist context across sessions",b2=S2,f2=x2,y2=v2;try{let D=i1(import.meta.url),u=n1(D),F=p1(u,"..","..","package.json");if(l1(F)){let C=JSON.parse(d1(F,"utf-8"));b2=C.name||S2,f2=C.version||x2,y2=C.description||v2}}catch{}var Au=b2,h2=f2,g2=y2;import{readFileSync as Iu,writeFileSync as Cu,existsSync as kD,mkdirSync as z0,copyFileSync as i7,statSync as S5,readdirSync as x5}from"fs";import{join as Bu,dirname as mF}from"path";import{homedir as A8}from"os";import{execSync as V8}from"child_process";var s=fD(t0(),1),D3=fD(DF(),1);import{stdin as t2,stdout as e2}from"process";import*as mD from"readline";import l2 from"readline";import{Writable as e1}from"stream";function DC({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 uC=DC();function u3(D){if(typeof D!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(uC,"")}function F3(D){return D&&D.__esModule&&Object.prototype.hasOwnProperty.call(D,"default")?D.default:D}var C3={exports:{}};(function(D){var u={};D.exports=u,u.eastAsianWidth=function(C){var B=C.charCodeAt(0),$=C.length==2?C.charCodeAt(1):0,E=B;return 55296<=B&&B<=56319&&56320<=$&&$<=57343&&(B&=1023,$&=1023,E=B<<10|$,E+=65536),E==12288||65281<=E&&E<=65376||65504<=E&&E<=65510?"F":E==8361||65377<=E&&E<=65470||65474<=E&&E<=65479||65482<=E&&E<=65487||65490<=E&&E<=65495||65498<=E&&E<=65500||65512<=E&&E<=65518?"H":4352<=E&&E<=4447||4515<=E&&E<=4519||4602<=E&&E<=4607||9001<=E&&E<=9002||11904<=E&&E<=11929||11931<=E&&E<=12019||12032<=E&&E<=12245||12272<=E&&E<=12283||12289<=E&&E<=12350||12353<=E&&E<=12438||12441<=E&&E<=12543||12549<=E&&E<=12589||12593<=E&&E<=12686||12688<=E&&E<=12730||12736<=E&&E<=12771||12784<=E&&E<=12830||12832<=E&&E<=12871||12880<=E&&E<=13054||13056<=E&&E<=19903||19968<=E&&E<=42124||42128<=E&&E<=42182||43360<=E&&E<=43388||44032<=E&&E<=55203||55216<=E&&E<=55238||55243<=E&&E<=55291||63744<=E&&E<=64255||65040<=E&&E<=65049||65072<=E&&E<=65106||65108<=E&&E<=65126||65128<=E&&E<=65131||110592<=E&&E<=110593||127488<=E&&E<=127490||127504<=E&&E<=127546||127552<=E&&E<=127560||127568<=E&&E<=127569||131072<=E&&E<=194367||177984<=E&&E<=196605||196608<=E&&E<=262141?"W":32<=E&&E<=126||162<=E&&E<=163||165<=E&&E<=166||E==172||E==175||10214<=E&&E<=10221||10629<=E&&E<=10630?"Na":E==161||E==164||167<=E&&E<=168||E==170||173<=E&&E<=174||176<=E&&E<=180||182<=E&&E<=186||188<=E&&E<=191||E==198||E==208||215<=E&&E<=216||222<=E&&E<=225||E==230||232<=E&&E<=234||236<=E&&E<=237||E==240||242<=E&&E<=243||247<=E&&E<=250||E==252||E==254||E==257||E==273||E==275||E==283||294<=E&&E<=295||E==299||305<=E&&E<=307||E==312||319<=E&&E<=322||E==324||328<=E&&E<=331||E==333||338<=E&&E<=339||358<=E&&E<=359||E==363||E==462||E==464||E==466||E==468||E==470||E==472||E==474||E==476||E==593||E==609||E==708||E==711||713<=E&&E<=715||E==717||E==720||728<=E&&E<=731||E==733||E==735||768<=E&&E<=879||913<=E&&E<=929||931<=E&&E<=937||945<=E&&E<=961||963<=E&&E<=969||E==1025||1040<=E&&E<=1103||E==1105||E==8208||8211<=E&&E<=8214||8216<=E&&E<=8217||8220<=E&&E<=8221||8224<=E&&E<=8226||8228<=E&&E<=8231||E==8240||8242<=E&&E<=8243||E==8245||E==8251||E==8254||E==8308||E==8319||8321<=E&&E<=8324||E==8364||E==8451||E==8453||E==8457||E==8467||E==8470||8481<=E&&E<=8482||E==8486||E==8491||8531<=E&&E<=8532||8539<=E&&E<=8542||8544<=E&&E<=8555||8560<=E&&E<=8569||E==8585||8592<=E&&E<=8601||8632<=E&&E<=8633||E==8658||E==8660||E==8679||E==8704||8706<=E&&E<=8707||8711<=E&&E<=8712||E==8715||E==8719||E==8721||E==8725||E==8730||8733<=E&&E<=8736||E==8739||E==8741||8743<=E&&E<=8748||E==8750||8756<=E&&E<=8759||8764<=E&&E<=8765||E==8776||E==8780||E==8786||8800<=E&&E<=8801||8804<=E&&E<=8807||8810<=E&&E<=8811||8814<=E&&E<=8815||8834<=E&&E<=8835||8838<=E&&E<=8839||E==8853||E==8857||E==8869||E==8895||E==8978||9312<=E&&E<=9449||9451<=E&&E<=9547||9552<=E&&E<=9587||9600<=E&&E<=9615||9618<=E&&E<=9621||9632<=E&&E<=9633||9635<=E&&E<=9641||9650<=E&&E<=9651||9654<=E&&E<=9655||9660<=E&&E<=9661||9664<=E&&E<=9665||9670<=E&&E<=9672||E==9675||9678<=E&&E<=9681||9698<=E&&E<=9701||E==9711||9733<=E&&E<=9734||E==9737||9742<=E&&E<=9743||9748<=E&&E<=9749||E==9756||E==9758||E==9792||E==9794||9824<=E&&E<=9825||9827<=E&&E<=9829||9831<=E&&E<=9834||9836<=E&&E<=9837||E==9839||9886<=E&&E<=9887||9918<=E&&E<=9919||9924<=E&&E<=9933||9935<=E&&E<=9953||E==9955||9960<=E&&E<=9983||E==10045||E==10071||10102<=E&&E<=10111||11093<=E&&E<=11097||12872<=E&&E<=12879||57344<=E&&E<=63743||65024<=E&&E<=65039||E==65533||127232<=E&&E<=127242||127248<=E&&E<=127277||127280<=E&&E<=127337||127344<=E&&E<=127386||917760<=E&&E<=917999||983040<=E&&E<=1048573||1048576<=E&&E<=1114109?"A":"N"},u.characterLength=function(C){var B=this.eastAsianWidth(C);return B=="F"||B=="W"||B=="A"?2:1};function F(C){return C.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}u.length=function(C){for(var B=F(C),$=0,E=0;E=B-(V==2?1:0))if(Q+V<=$)E+=J;else break;Q+=V}return E}})(C3);var FC=C3.exports,CC=F3(FC),BC=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},EC=F3(BC);function Hu(D,u={}){if(typeof D!="string"||D.length===0||(u={ambiguousIsNarrow:!0,...u},D=u3(D),D.length===0))return 0;D=D.replace(EC()," ");let F=u.ambiguousIsNarrow?1:2,C=0;for(let B of D){let $=B.codePointAt(0);if($<=31||$>=127&&$<=159||$>=768&&$<=879)continue;switch(CC.eastAsianWidth(B)){case"F":case"W":C+=2;break;case"A":C+=F;break;default:C+=1}}return C}var uF=10,p2=(D=0)=>(u)=>`\x1B[${u+D}m`,n2=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,i2=(D=0)=>(u,F,C)=>`\x1B[${38+D};2;${u};${F};${C}m`,v={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(v.modifier);var $C=Object.keys(v.color),QC=Object.keys(v.bgColor);[...$C];function XC(){let D=new Map;for(let[u,F]of Object.entries(v)){for(let[C,B]of Object.entries(F))v[C]={open:`\x1B[${B[0]}m`,close:`\x1B[${B[1]}m`},F[C]=v[C],D.set(B[0],B[1]);Object.defineProperty(v,u,{value:F,enumerable:!1})}return Object.defineProperty(v,"codes",{value:D,enumerable:!1}),v.color.close="\x1B[39m",v.bgColor.close="\x1B[49m",v.color.ansi=p2(),v.color.ansi256=n2(),v.color.ansi16m=i2(),v.bgColor.ansi=p2(uF),v.bgColor.ansi256=n2(uF),v.bgColor.ansi16m=i2(uF),Object.defineProperties(v,{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 B=Number.parseInt(C,16);return[B>>16&255,B>>8&255,B&255]},enumerable:!1},hexToAnsi256:{value:(u)=>v.rgbToAnsi256(...v.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value:(u)=>{if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,C,B;if(u>=232)F=((u-232)*10+8)/255,C=F,B=F;else{u-=16;let Q=u%36;F=Math.floor(u/36)/5,C=Math.floor(Q/6)/5,B=Q%6/5}let $=Math.max(F,C,B)*2;if($===0)return 30;let E=30+(Math.round(B)<<2|Math.round(C)<<1|Math.round(F));return $===2&&(E+=60),E},enumerable:!1},rgbToAnsi:{value:(u,F,C)=>v.ansi256ToAnsi(v.rgbToAnsi256(u,F,C)),enumerable:!1},hexToAnsi:{value:(u)=>v.ansi256ToAnsi(v.hexToAnsi256(u)),enumerable:!1}}),v}var ZC=XC(),D0=new Set(["\x1B","\x9B"]),JC=39,BF="\x07",B3="[",qC="]",E3="m",EF=`${qC}8;;`,a2=(D)=>`${D0.values().next().value}${B3}${D}${E3}`,r2=(D)=>`${D0.values().next().value}${EF}${D}${BF}`,YC=(D)=>D.split(" ").map((u)=>Hu(u)),FF=(D,u,F)=>{let C=[...u],B=!1,$=!1,E=Hu(u3(D[D.length-1]));for(let[Q,X]of C.entries()){let Z=Hu(X);if(E+Z<=F?D[D.length-1]+=X:(D.push(X),E=0),D0.has(X)&&(B=!0,$=C.slice(Q+1).join("").startsWith(EF)),B){$?X===BF&&(B=!1,$=!1):X===E3&&(B=!1);continue}E+=Z,E===F&&Q0&&D.length>1&&(D[D.length-2]+=D.pop())},KC=(D)=>{let u=D.split(" "),F=u.length;for(;F>0&&!(Hu(u[F-1])>0);)F--;return F===u.length?D:u.slice(0,F).join(" ")+u.slice(F).join("")},VC=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let C="",B,$,E=YC(D),Q=[""];for(let[Z,J]of D.split(" ").entries()){F.trim!==!1&&(Q[Q.length-1]=Q[Q.length-1].trimStart());let V=Hu(Q[Q.length-1]);if(Z!==0&&(V>=u&&(F.wordWrap===!1||F.trim===!1)&&(Q.push(""),V=0),(V>0||F.trim===!1)&&(Q[Q.length-1]+=" ",V++)),F.hard&&E[Z]>u){let A=u-V,U=1+Math.floor((E[Z]-A-1)/u);Math.floor((E[Z]-1)/u)u&&V>0&&E[Z]>0){if(F.wordWrap===!1&&Vu&&F.wordWrap===!1){FF(Q,J,u);continue}Q[Q.length-1]+=J}F.trim!==!1&&(Q=Q.map((Z)=>KC(Z)));let X=[...Q.join(` -`)];for(let[Z,J]of X.entries()){if(C+=J,D0.has(J)){let{groups:A}=new RegExp(`(?:\\${B3}(?\\d+)m|\\${EF}(?.*)${BF})`).exec(X.slice(Z).join(""))||{groups:{}};if(A.code!==void 0){let U=Number.parseFloat(A.code);B=U===JC?void 0:U}else A.uri!==void 0&&($=A.uri.length===0?void 0:A.uri)}let V=ZC.codes.get(Number(B));X[Z+1]===` -`?($&&(C+=r2("")),B&&V&&(C+=a2(V))):J===` -`&&(B&&V&&(C+=a2(B)),$&&(C+=r2($)))}return C};function o2(D,u,F){return String(D).normalize().replace(/\r\n/g,` + `).run(u.toISOString(),F,D)}close(){this.db.close()}}var tD=mD(()=>{FD()});import b4 from"path";function f6(D){try{if(D.source&&D.source!=="startup")console.log(""),process.exit(0);let u=b4.basename(D.cwd),F=new $D,C=F.getRecentSummaries(u,5);if(F.close(),C.length===0)console.log(""),process.exit(0);let B=[];B.push("# Recent Session Context"),B.push(""),B.push(`Here's what happened in recent ${u} sessions:`),B.push("");for(let $ of C){if(B.push("---"),B.push(""),$.request)B.push(`**Request:** ${$.request}`);if($.completed)B.push(`**Completed:** ${$.completed}`);if($.learned)B.push(`**Learned:** ${$.learned}`);if($.next_steps)B.push(`**Next Steps:** ${$.next_steps}`);if($.files_edited)try{let E=JSON.parse($.files_edited);if(Array.isArray(E)&&E.length>0)B.push(`**Files Edited:** ${E.join(", ")}`)}catch{if($.files_edited.trim())B.push(`**Files Edited:** ${$.files_edited}`)}B.push(`**Date:** ${$.created_at.split("T")[0]}`),B.push("")}console.log(B.join(` +`)),process.exit(0)}catch(u){console.error(`[claude-mem context error: ${u.message}]`),process.exit(0)}}var b6=mD(()=>{tD()});import y4 from"net";import{join as h4}from"path";function y6(D){try{let{session_id:u,tool_name:F,tool_input:C,tool_output:B}=D;if(g4.has(F))console.log('{"continue": true, "suppressOutput": true}'),process.exit(0);let $=new $D,E=$.findActiveSDKSession(u);if($.close(),!E)console.log('{"continue": true, "suppressOutput": true}'),process.exit(0);let Q=T.getInstance().getDataDirectory(),X=h4(Q,`worker-${E.id}.sock`),Z={type:"observation",tool_name:F,tool_input:JSON.stringify(C),tool_output:JSON.stringify(B)},J=y4.connect(X,()=>{J.write(JSON.stringify(Z)+` +`),J.end()});J.on("error",(V)=>{console.error(`[claude-mem save] Socket error: ${V.message}`)}),J.on("close",()=>{console.log('{"continue": true, "suppressOutput": true}'),process.exit(0)})}catch(u){console.error(`[claude-mem save error: ${u.message}]`),console.log('{"continue": true, "suppressOutput": true}'),process.exit(0)}}var g4;var h6=mD(()=>{tD();FD();g4=new Set(["TodoWrite","ListMcpResourcesTool"])});import m4 from"path";import{spawn as c4}from"child_process";function g6(D){try{let{session_id:u,cwd:F,prompt:C}=D,B=m4.basename(F),$=new $D;if($.findActiveSDKSession(u))$.close(),console.log('{"continue": true, "suppressOutput": true}'),process.exit(0);let Q=$.createSDKSession(u,B,C);$.close(),c4("claude-mem",["worker",Q.toString()],{detached:!0,stdio:"ignore"}).unref(),console.log('{"continue": true, "suppressOutput": true}'),process.exit(0)}catch(u){console.error(`[claude-mem new error: ${u.message}]`),console.log('{"continue": true, "suppressOutput": true}'),process.exit(0)}}var m6=mD(()=>{tD()});import d4 from"net";import{join as l4}from"path";function c6(D){try{let{session_id:u}=D,F=new $D,C=F.findActiveSDKSession(u);if(F.close(),!C)console.log('{"continue": true, "suppressOutput": true}'),process.exit(0);let B=T.getInstance().getDataDirectory(),$=l4(B,`worker-${C.id}.sock`),E={type:"finalize"},Q=d4.connect($,()=>{Q.write(JSON.stringify(E)+` +`),Q.end()});Q.on("error",(X)=>{console.error(`[claude-mem summary] Socket error: ${X.message}`)}),Q.on("close",()=>{console.log('{"continue": true, "suppressOutput": true}'),process.exit(0)})}catch(u){console.error(`[claude-mem summary error: ${u.message}]`),console.log('{"continue": true, "suppressOutput": true}'),process.exit(0)}}var d6=mD(()=>{tD();FD()});var nu={};H2(nu,{summaryHook:()=>c6,saveHook:()=>y6,newHook:()=>g6,contextHook:()=>f6});var iu=mD(()=>{b6();h6();m6();d6()});function l6(D,u,F){return`You are a memory assistant for the "${D}" project. + +SESSION CONTEXT +--------------- +Session ID: ${u} +User's Goal: ${F} +Date: ${new Date().toISOString().split("T")[0]} + +YOUR ROLE +--------- +You will observe tool executions during this Claude Code session. Your job is to: + +1. Extract meaningful insights (not just raw data) +2. Store atomic observations in SQLite +3. Focus on: key decisions, patterns discovered, problems solved, technical insights + +WHAT TO CAPTURE +---------------- +\u2713 Architecture decisions (e.g., "chose PostgreSQL over MongoDB for ACID guarantees") +\u2713 Bug fixes (e.g., "fixed race condition in auth middleware by adding mutex") +\u2713 New features (e.g., "implemented JWT refresh token flow") +\u2713 Refactorings (e.g., "extracted validation logic into separate service") +\u2713 Discoveries (e.g., "found that API rate limit is 100 req/min") + +\u2717 NOT routine operations (reading files, listing directories) +\u2717 NOT work-in-progress (only completed work) +\u2717 NOT obvious facts (e.g., "TypeScript file has types") + +HOW TO STORE OBSERVATIONS +-------------------------- +When you identify something worth remembering, output your observation in this EXACT XML format: + +\`\`\`xml + + feature + Implemented JWT token refresh flow with 7-day expiry + +\`\`\` + +Valid types: decision, bugfix, feature, refactor, discovery + +Structure requirements: +- is the root element +- must be one of the 5 valid types (single word) +- contains your concise observation (one sentence preferred) +- No additional fields or nesting + +The SDK worker will parse all blocks from your response using regex and store them in SQLite. + +You can include your reasoning before or after the observation block, or just output the observation by itself. + +EXAMPLE +------- +Bad: "Read src/auth.ts file" +Good: "Implemented JWT token refresh flow with 7-day expiry" + +Wait for tool observations. Acknowledge this message briefly.`}function p6(D){return`TOOL OBSERVATION +================ +Tool: ${D.tool_name} +Time: ${new Date(D.created_at_epoch).toISOString()} + +Input: +${JSON.stringify(JSON.parse(D.tool_input),null,2)} + +Output: +${JSON.stringify(JSON.parse(D.tool_output),null,2)} + +ANALYSIS TASK +------------- +1. Does this observation contain something worth remembering? +2. If YES: Output the observation in this EXACT XML format: + + \`\`\`xml + + feature + Your concise observation here + + \`\`\` + + Requirements: + - Use one of these types: decision, bugfix, feature, refactor, discovery + - Keep text concise (one sentence preferred) + - No markdown formatting inside + - No additional XML fields + +3. If NO: Just acknowledge and wait for next observation + +Remember: Quality over quantity. Only store meaningful insights.`}function n6(D){return`SESSION ENDING +============== +The Claude Code session is finishing. + +FINAL TASK +---------- +1. Review the observations you've stored this session +2. Generate a structured summary that answers these questions: + - What did user request? + - What did you investigate? + - What did you learn? + - What did you do? + - What's next? + - Files read + - Files edited + - Notes + +3. Generate the structured summary and output it in this EXACT XML format: + +\`\`\`xml + + Implement JWT authentication system + Existing auth middleware, session management, token storage patterns + Current system uses session cookies; no JWT support; race condition in middleware + Implemented JWT token + refresh flow with 7-day expiry; fixed race condition with mutex; added token validation middleware + Add token revocation API endpoint; write integration tests + + src/auth.ts + src/middleware/session.ts + src/types/user.ts + + + src/auth.ts + src/middleware/auth.ts + src/routes/auth.ts + + Token secret stored in .env; refresh tokens use rotation strategy + +\`\`\` + +Structure requirements: +- is the root element +- All 8 child elements are REQUIRED: request, investigated, learned, completed, next_steps, files_read, files_edited, notes +- and must contain child elements (one per file) +- If no files were read/edited, use empty tags: +- Text fields can be multiple sentences but avoid markdown formatting +- Use underscores in element names: next_steps, files_read, files_edited + +The SDK worker will parse the block and extract all fields to store in SQLite. + +Generate the summary now in the required XML format.`}function a6(D){let u=[],F=/\s*([^<]+)<\/type>\s*([^<]+)<\/text>\s*<\/observation>/g,C;while((C=F.exec(D))!==null){let B=C[1].trim(),$=C[2].trim();if(!["decision","bugfix","feature","refactor","discovery"].includes(B)){console.warn(`[SDK Parser] Invalid observation type: ${B}, skipping`);continue}u.push({type:B,text:$})}return u}function r6(D){let F=/([\s\S]*?)<\/summary>/.exec(D);if(!F)return null;let C=F[1],B=qu(C,"request"),$=qu(C,"investigated"),E=qu(C,"learned"),Q=qu(C,"completed"),X=qu(C,"next_steps"),Z=qu(C,"notes"),J=i6(C,"files_read"),V=i6(C,"files_edited");if(!B||!$||!E||!Q||!X||!Z)return console.warn("[SDK Parser] Summary missing required fields"),null;return{request:B,investigated:$,learned:E,completed:Q,next_steps:X,files_read:J,files_edited:V,notes:Z}}function qu(D,u){let C=new RegExp(`<${u}>([^<]*)`).exec(D);return C?C[1].trim():null}function i6(D,u){let F=[],B=new RegExp(`<${u}>(.*?)`,"s").exec(D);if(!B)return F;let $=B[1],E=/([^<]+)<\/file>/g,Q;while((Q=E.exec($))!==null)F.push(Q[1].trim());return F}var e6={};H2(e6,{main:()=>o4});import p4 from"net";import{unlinkSync as o6,existsSync as s6}from"fs";import{join as n4}from"path";import{query as i4}from"@anthropic-ai/claude-agent-sdk";async function o4(){let D=parseInt(process.argv[2],10);if(!D)console.error("[SDK Worker] Missing session ID argument"),process.exit(1);await new t6(D).run()}class t6{sessionDbId;db;socketPath;server=null;sdkSessionId=null;project="";userPrompt="";abortController;isFinalized=!1;pendingMessages=[];constructor(D){this.sessionDbId=D,this.db=new $D,this.abortController=new AbortController;let u=T.getInstance().getDataDirectory();this.socketPath=n4(u,`worker-${D}.sock`)}async run(){try{let D=await this.loadSession();if(!D)console.error("[SDK Worker] Session not found"),process.exit(1);this.project=D.project,this.userPrompt=D.user_prompt,await this.startSocketServer(),console.error(`[SDK Worker] Socket server listening: ${this.socketPath}`),await this.runSDKAgent(),this.db.markSessionCompleted(this.sessionDbId),this.db.close(),this.cleanup()}catch(D){console.error("[SDK Worker] Error:",D.message),this.db.markSessionFailed(this.sessionDbId),this.db.close(),this.cleanup(),process.exit(1)}}async startSocketServer(){if(s6(this.socketPath))o6(this.socketPath);return new Promise((D,u)=>{this.server=p4.createServer((F)=>{let C="";F.on("data",(B)=>{C+=B.toString();let $=C.split(` +`);C=$.pop()||"";for(let E of $)if(E.trim())try{let Q=JSON.parse(E);this.handleMessage(Q)}catch(Q){console.error("[SDK Worker] Invalid message:",E)}}),F.on("error",(B)=>{console.error("[SDK Worker] Socket connection error:",B.message)})}),this.server.on("error",(F)=>{if(F.code==="EADDRINUSE")console.error(`[SDK Worker] Socket already in use: ${this.socketPath}`);u(F)}),this.server.listen(this.socketPath,()=>{D()})})}handleMessage(D){if(this.pendingMessages.push(D),D.type==="finalize")this.isFinalized=!0}async loadSession(){return this.db.db.query(` + SELECT id, sdk_session_id, project, user_prompt + FROM sdk_sessions + WHERE id = ? + LIMIT 1 + `).get(this.sessionDbId)}async runSDKAgent(){await i4({model:a4,messages:()=>this.createMessageGenerator(),disallowedTools:r4,signal:this.abortController.signal,onSystemInitMessage:(D)=>{if(D.session_id)this.sdkSessionId=D.session_id,this.db.updateSDKSessionId(this.sessionDbId,D.session_id)},onAgentMessage:(D)=>{this.handleAgentMessage(D.content)}})}async*createMessageGenerator(){let D=`session-${this.sessionDbId}`;yield{role:"user",content:l6(this.project,D,this.userPrompt)};while(!this.isFinalized){if(this.pendingMessages.length===0){await this.sleep(100);continue}while(this.pendingMessages.length>0){let F=this.pendingMessages.shift();if(F.type==="finalize"){this.isFinalized=!0;let C=await this.loadSession();if(C)yield{role:"user",content:n6(C)};break}if(F.type==="observation")yield{role:"user",content:p6({tool_name:F.tool_name,tool_input:F.tool_input,tool_output:F.tool_output})}}}}handleAgentMessage(D){let u=a6(D);for(let C of u)if(this.sdkSessionId)this.db.storeObservation(this.sdkSessionId,this.project,C.type,C.text);let F=r6(D);if(F&&this.sdkSessionId){let C={request:F.request,investigated:F.investigated,learned:F.learned,completed:F.completed,next_steps:F.next_steps,files_read:JSON.stringify(F.files_read),files_edited:JSON.stringify(F.files_edited),notes:F.notes};this.db.storeSummary(this.sdkSessionId,this.project,C)}}cleanup(){if(this.server)this.server.close();if(s6(this.socketPath))o6(this.socketPath)}sleep(D){return new Promise((u)=>setTimeout(u,D))}}var a4="claude-sonnet-4-5",r4;var D1=mD(()=>{tD();FD();r4=["Glob","Grep","ListMcpResourcesTool","WebSearch"]});var S2=bD(k2(),1),{program:EE,createCommand:$E,createArgument:QE,createOption:XE,CommanderError:ZE,InvalidArgumentError:JE,InvalidOptionArgumentError:YE,Command:x2,Argument:qE,Option:KE,Help:VE}=S2.default;import{readFileSync as DC,existsSync as uC}from"fs";import{join as FC,dirname as CC}from"path";import{fileURLToPath as BC}from"url";var v2="claude-mem",f2="3.9.16",b2="Memory compression system for Claude Code - persist context across sessions",y2=v2,h2=f2,g2=b2;try{let D=BC(import.meta.url),u=CC(D),F=FC(u,"..","..","package.json");if(uC(F)){let C=JSON.parse(DC(F,"utf-8"));y2=C.name||v2,h2=C.version||f2,g2=C.description||b2}}catch{}var Hu=y2,m2=h2,c2=g2;import{readFileSync as Nu,writeFileSync as Bu,existsSync as kD,mkdirSync as G0,copyFileSync as B9,statSync as u$,readdirSync as F$}from"fs";import{join as Eu,dirname as cF}from"path";import{homedir as U8}from"os";import{execSync as H8}from"child_process";var s=bD(e0(),1),F3=bD(uF(),1);import{stdin as D3,stdout as u3}from"process";import*as cD from"readline";import n2 from"readline";import{Writable as JC}from"stream";function YC({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 qC=YC();function C3(D){if(typeof D!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(qC,"")}function B3(D){return D&&D.__esModule&&Object.prototype.hasOwnProperty.call(D,"default")?D.default:D}var E3={exports:{}};(function(D){var u={};D.exports=u,u.eastAsianWidth=function(C){var B=C.charCodeAt(0),$=C.length==2?C.charCodeAt(1):0,E=B;return 55296<=B&&B<=56319&&56320<=$&&$<=57343&&(B&=1023,$&=1023,E=B<<10|$,E+=65536),E==12288||65281<=E&&E<=65376||65504<=E&&E<=65510?"F":E==8361||65377<=E&&E<=65470||65474<=E&&E<=65479||65482<=E&&E<=65487||65490<=E&&E<=65495||65498<=E&&E<=65500||65512<=E&&E<=65518?"H":4352<=E&&E<=4447||4515<=E&&E<=4519||4602<=E&&E<=4607||9001<=E&&E<=9002||11904<=E&&E<=11929||11931<=E&&E<=12019||12032<=E&&E<=12245||12272<=E&&E<=12283||12289<=E&&E<=12350||12353<=E&&E<=12438||12441<=E&&E<=12543||12549<=E&&E<=12589||12593<=E&&E<=12686||12688<=E&&E<=12730||12736<=E&&E<=12771||12784<=E&&E<=12830||12832<=E&&E<=12871||12880<=E&&E<=13054||13056<=E&&E<=19903||19968<=E&&E<=42124||42128<=E&&E<=42182||43360<=E&&E<=43388||44032<=E&&E<=55203||55216<=E&&E<=55238||55243<=E&&E<=55291||63744<=E&&E<=64255||65040<=E&&E<=65049||65072<=E&&E<=65106||65108<=E&&E<=65126||65128<=E&&E<=65131||110592<=E&&E<=110593||127488<=E&&E<=127490||127504<=E&&E<=127546||127552<=E&&E<=127560||127568<=E&&E<=127569||131072<=E&&E<=194367||177984<=E&&E<=196605||196608<=E&&E<=262141?"W":32<=E&&E<=126||162<=E&&E<=163||165<=E&&E<=166||E==172||E==175||10214<=E&&E<=10221||10629<=E&&E<=10630?"Na":E==161||E==164||167<=E&&E<=168||E==170||173<=E&&E<=174||176<=E&&E<=180||182<=E&&E<=186||188<=E&&E<=191||E==198||E==208||215<=E&&E<=216||222<=E&&E<=225||E==230||232<=E&&E<=234||236<=E&&E<=237||E==240||242<=E&&E<=243||247<=E&&E<=250||E==252||E==254||E==257||E==273||E==275||E==283||294<=E&&E<=295||E==299||305<=E&&E<=307||E==312||319<=E&&E<=322||E==324||328<=E&&E<=331||E==333||338<=E&&E<=339||358<=E&&E<=359||E==363||E==462||E==464||E==466||E==468||E==470||E==472||E==474||E==476||E==593||E==609||E==708||E==711||713<=E&&E<=715||E==717||E==720||728<=E&&E<=731||E==733||E==735||768<=E&&E<=879||913<=E&&E<=929||931<=E&&E<=937||945<=E&&E<=961||963<=E&&E<=969||E==1025||1040<=E&&E<=1103||E==1105||E==8208||8211<=E&&E<=8214||8216<=E&&E<=8217||8220<=E&&E<=8221||8224<=E&&E<=8226||8228<=E&&E<=8231||E==8240||8242<=E&&E<=8243||E==8245||E==8251||E==8254||E==8308||E==8319||8321<=E&&E<=8324||E==8364||E==8451||E==8453||E==8457||E==8467||E==8470||8481<=E&&E<=8482||E==8486||E==8491||8531<=E&&E<=8532||8539<=E&&E<=8542||8544<=E&&E<=8555||8560<=E&&E<=8569||E==8585||8592<=E&&E<=8601||8632<=E&&E<=8633||E==8658||E==8660||E==8679||E==8704||8706<=E&&E<=8707||8711<=E&&E<=8712||E==8715||E==8719||E==8721||E==8725||E==8730||8733<=E&&E<=8736||E==8739||E==8741||8743<=E&&E<=8748||E==8750||8756<=E&&E<=8759||8764<=E&&E<=8765||E==8776||E==8780||E==8786||8800<=E&&E<=8801||8804<=E&&E<=8807||8810<=E&&E<=8811||8814<=E&&E<=8815||8834<=E&&E<=8835||8838<=E&&E<=8839||E==8853||E==8857||E==8869||E==8895||E==8978||9312<=E&&E<=9449||9451<=E&&E<=9547||9552<=E&&E<=9587||9600<=E&&E<=9615||9618<=E&&E<=9621||9632<=E&&E<=9633||9635<=E&&E<=9641||9650<=E&&E<=9651||9654<=E&&E<=9655||9660<=E&&E<=9661||9664<=E&&E<=9665||9670<=E&&E<=9672||E==9675||9678<=E&&E<=9681||9698<=E&&E<=9701||E==9711||9733<=E&&E<=9734||E==9737||9742<=E&&E<=9743||9748<=E&&E<=9749||E==9756||E==9758||E==9792||E==9794||9824<=E&&E<=9825||9827<=E&&E<=9829||9831<=E&&E<=9834||9836<=E&&E<=9837||E==9839||9886<=E&&E<=9887||9918<=E&&E<=9919||9924<=E&&E<=9933||9935<=E&&E<=9953||E==9955||9960<=E&&E<=9983||E==10045||E==10071||10102<=E&&E<=10111||11093<=E&&E<=11097||12872<=E&&E<=12879||57344<=E&&E<=63743||65024<=E&&E<=65039||E==65533||127232<=E&&E<=127242||127248<=E&&E<=127277||127280<=E&&E<=127337||127344<=E&&E<=127386||917760<=E&&E<=917999||983040<=E&&E<=1048573||1048576<=E&&E<=1114109?"A":"N"},u.characterLength=function(C){var B=this.eastAsianWidth(C);return B=="F"||B=="W"||B=="A"?2:1};function F(C){return C.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}u.length=function(C){for(var B=F(C),$=0,E=0;E=B-(V==2?1:0))if(Q+V<=$)E+=J;else break;Q+=V}return E}})(E3);var KC=E3.exports,VC=B3(KC),AC=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},HC=B3(AC);function Uu(D,u={}){if(typeof D!="string"||D.length===0||(u={ambiguousIsNarrow:!0,...u},D=C3(D),D.length===0))return 0;D=D.replace(HC()," ");let F=u.ambiguousIsNarrow?1:2,C=0;for(let B of D){let $=B.codePointAt(0);if($<=31||$>=127&&$<=159||$>=768&&$<=879)continue;switch(VC.eastAsianWidth(B)){case"F":case"W":C+=2;break;case"A":C+=F;break;default:C+=1}}return C}var FF=10,i2=(D=0)=>(u)=>`\x1B[${u+D}m`,a2=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,r2=(D=0)=>(u,F,C)=>`\x1B[${38+D};2;${u};${F};${C}m`,v={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(v.modifier);var UC=Object.keys(v.color),zC=Object.keys(v.bgColor);[...UC];function GC(){let D=new Map;for(let[u,F]of Object.entries(v)){for(let[C,B]of Object.entries(F))v[C]={open:`\x1B[${B[0]}m`,close:`\x1B[${B[1]}m`},F[C]=v[C],D.set(B[0],B[1]);Object.defineProperty(v,u,{value:F,enumerable:!1})}return Object.defineProperty(v,"codes",{value:D,enumerable:!1}),v.color.close="\x1B[39m",v.bgColor.close="\x1B[49m",v.color.ansi=i2(),v.color.ansi256=a2(),v.color.ansi16m=r2(),v.bgColor.ansi=i2(FF),v.bgColor.ansi256=a2(FF),v.bgColor.ansi16m=r2(FF),Object.defineProperties(v,{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 B=Number.parseInt(C,16);return[B>>16&255,B>>8&255,B&255]},enumerable:!1},hexToAnsi256:{value:(u)=>v.rgbToAnsi256(...v.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value:(u)=>{if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,C,B;if(u>=232)F=((u-232)*10+8)/255,C=F,B=F;else{u-=16;let Q=u%36;F=Math.floor(u/36)/5,C=Math.floor(Q/6)/5,B=Q%6/5}let $=Math.max(F,C,B)*2;if($===0)return 30;let E=30+(Math.round(B)<<2|Math.round(C)<<1|Math.round(F));return $===2&&(E+=60),E},enumerable:!1},rgbToAnsi:{value:(u,F,C)=>v.ansi256ToAnsi(v.rgbToAnsi256(u,F,C)),enumerable:!1},hexToAnsi:{value:(u)=>v.ansi256ToAnsi(v.hexToAnsi256(u)),enumerable:!1}}),v}var WC=GC(),u0=new Set(["\x1B","\x9B"]),_C=39,EF="\x07",$3="[",jC="]",Q3="m",$F=`${jC}8;;`,o2=(D)=>`${u0.values().next().value}${$3}${D}${Q3}`,s2=(D)=>`${u0.values().next().value}${$F}${D}${EF}`,MC=(D)=>D.split(" ").map((u)=>Uu(u)),CF=(D,u,F)=>{let C=[...u],B=!1,$=!1,E=Uu(C3(D[D.length-1]));for(let[Q,X]of C.entries()){let Z=Uu(X);if(E+Z<=F?D[D.length-1]+=X:(D.push(X),E=0),u0.has(X)&&(B=!0,$=C.slice(Q+1).join("").startsWith($F)),B){$?X===EF&&(B=!1,$=!1):X===Q3&&(B=!1);continue}E+=Z,E===F&&Q0&&D.length>1&&(D[D.length-2]+=D.pop())},RC=(D)=>{let u=D.split(" "),F=u.length;for(;F>0&&!(Uu(u[F-1])>0);)F--;return F===u.length?D:u.slice(0,F).join(" ")+u.slice(F).join("")},LC=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let C="",B,$,E=MC(D),Q=[""];for(let[Z,J]of D.split(" ").entries()){F.trim!==!1&&(Q[Q.length-1]=Q[Q.length-1].trimStart());let V=Uu(Q[Q.length-1]);if(Z!==0&&(V>=u&&(F.wordWrap===!1||F.trim===!1)&&(Q.push(""),V=0),(V>0||F.trim===!1)&&(Q[Q.length-1]+=" ",V++)),F.hard&&E[Z]>u){let A=u-V,U=1+Math.floor((E[Z]-A-1)/u);Math.floor((E[Z]-1)/u)u&&V>0&&E[Z]>0){if(F.wordWrap===!1&&Vu&&F.wordWrap===!1){CF(Q,J,u);continue}Q[Q.length-1]+=J}F.trim!==!1&&(Q=Q.map((Z)=>RC(Z)));let X=[...Q.join(` +`)];for(let[Z,J]of X.entries()){if(C+=J,u0.has(J)){let{groups:A}=new RegExp(`(?:\\${$3}(?\\d+)m|\\${$F}(?.*)${EF})`).exec(X.slice(Z).join(""))||{groups:{}};if(A.code!==void 0){let U=Number.parseFloat(A.code);B=U===_C?void 0:U}else A.uri!==void 0&&($=A.uri.length===0?void 0:A.uri)}let V=WC.codes.get(Number(B));X[Z+1]===` +`?($&&(C+=s2("")),B&&V&&(C+=o2(V))):J===` +`&&(B&&V&&(C+=o2(B)),$&&(C+=s2($)))}return C};function t2(D,u,F){return String(D).normalize().replace(/\r\n/g,` `).split(` -`).map((C)=>VC(C,u,F)).join(` -`)}var AC=["up","down","left","right","space","enter","cancel"],eu={actions:new Set(AC),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function $F(D,u){if(typeof D=="string")return eu.aliases.get(D)===u;for(let F of D)if(F!==void 0&&$F(F,u))return!0;return!1}function HC(D,u){if(D===u)return;let F=D.split(` +`).map((C)=>LC(C,u,F)).join(` +`)}var IC=["up","down","left","right","space","enter","cancel"],D0={actions:new Set(IC),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function QF(D,u){if(typeof D=="string")return D0.aliases.get(D)===u;for(let F of D)if(F!==void 0&&QF(F,u))return!0;return!1}function NC(D,u){if(D===u)return;let F=D.split(` `),C=u.split(` -`),B=[];for(let $=0;${let Z=String(E);if($F([Z,Q,X],"cancel")){C&&u.write(s.cursor.show),process.exit(0);return}if(!F)return;mD.moveCursor(u,Q==="return"?0:-1,Q==="return"?-1:0,()=>{mD.clearLine(u,1,()=>{D.once("keypress",$)})})};return C&&u.write(s.cursor.hide),D.once("keypress",$),()=>{D.off("keypress",$),C&&u.write(s.cursor.show),D.isTTY&&!UC&&D.setRawMode(!1),B.terminal=!1,B.close()}}var zC=Object.defineProperty,GC=(D,u,F)=>(u in D)?zC(D,u,{enumerable:!0,configurable:!0,writable:!0,value:F}):D[u]=F,QD=(D,u,F)=>(GC(D,typeof u!="symbol"?u+"":u,F),F);class u0{constructor(D,u=!0){QD(this,"input"),QD(this,"output"),QD(this,"_abortSignal"),QD(this,"rl"),QD(this,"opts"),QD(this,"_render"),QD(this,"_track",!1),QD(this,"_prevFrame",""),QD(this,"_subscribers",new Map),QD(this,"_cursor",0),QD(this,"state","initial"),QD(this,"error",""),QD(this,"value");let{input:F=t2,output:C=e2,render:B,signal:$,...E}=D;this.opts=E,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=B.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 B of F)B.cb(...u),B.once&&C.push(()=>F.splice(F.indexOf(B),1));for(let B of C)B()}prompt(){return new Promise((D,u)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),D(CF);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let F=new e1;F._write=(C,B,$)=>{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=l2.createInterface({input:this.input,output:F,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),l2.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),tu(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(s.cursor.show),this.output.off("resize",this.render),tu(this.input,!1),D(this.value)}),this.once("cancel",()=>{this.output.write(s.cursor.show),this.output.off("resize",this.render),tu(this.input,!1),D(CF)})})}onKeypress(D,u){if(this.state==="error"&&(this.state="active"),u?.name&&(!this._track&&eu.aliases.has(u.name)&&this.emit("cursor",eu.aliases.get(u.name)),eu.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")}$F([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(` -`),tu(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let D=o2(this._prevFrame,process.stdout.columns,{hard:!0}).split(` -`).length-1;this.output.write(s.cursor.move(-999,D*-1))}render(){let D=o2(this._render(this)??"",process.stdout.columns,{hard:!0});if(D!==this._prevFrame){if(this.state==="initial")this.output.write(s.cursor.hide);else{let u=HC(this._prevFrame,D);if(this.restoreCursor(),u&&u?.length===1){let F=u[0];this.output.write(s.cursor.move(0,F)),this.output.write(s.erase.lines(1));let C=D.split(` +`),B=[];for(let $=0;${let Z=String(E);if(QF([Z,Q,X],"cancel")){C&&u.write(s.cursor.show),process.exit(0);return}if(!F)return;cD.moveCursor(u,Q==="return"?0:-1,Q==="return"?-1:0,()=>{cD.clearLine(u,1,()=>{D.once("keypress",$)})})};return C&&u.write(s.cursor.hide),D.once("keypress",$),()=>{D.off("keypress",$),C&&u.write(s.cursor.show),D.isTTY&&!TC&&D.setRawMode(!1),B.terminal=!1,B.close()}}var OC=Object.defineProperty,wC=(D,u,F)=>(u in D)?OC(D,u,{enumerable:!0,configurable:!0,writable:!0,value:F}):D[u]=F,JD=(D,u,F)=>(wC(D,typeof u!="symbol"?u+"":u,F),F);class F0{constructor(D,u=!0){JD(this,"input"),JD(this,"output"),JD(this,"_abortSignal"),JD(this,"rl"),JD(this,"opts"),JD(this,"_render"),JD(this,"_track",!1),JD(this,"_prevFrame",""),JD(this,"_subscribers",new Map),JD(this,"_cursor",0),JD(this,"state","initial"),JD(this,"error",""),JD(this,"value");let{input:F=D3,output:C=u3,render:B,signal:$,...E}=D;this.opts=E,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=B.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 B of F)B.cb(...u),B.once&&C.push(()=>F.splice(F.indexOf(B),1));for(let B of C)B()}prompt(){return new Promise((D,u)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),D(BF);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let F=new JC;F._write=(C,B,$)=>{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=n2.createInterface({input:this.input,output:F,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),n2.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),eu(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(s.cursor.show),this.output.off("resize",this.render),eu(this.input,!1),D(this.value)}),this.once("cancel",()=>{this.output.write(s.cursor.show),this.output.off("resize",this.render),eu(this.input,!1),D(BF)})})}onKeypress(D,u){if(this.state==="error"&&(this.state="active"),u?.name&&(!this._track&&D0.aliases.has(u.name)&&this.emit("cursor",D0.aliases.get(u.name)),D0.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")}QF([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(` +`),eu(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let D=t2(this._prevFrame,process.stdout.columns,{hard:!0}).split(` +`).length-1;this.output.write(s.cursor.move(-999,D*-1))}render(){let D=t2(this._render(this)??"",process.stdout.columns,{hard:!0});if(D!==this._prevFrame){if(this.state==="initial")this.output.write(s.cursor.hide);else{let u=NC(this._prevFrame,D);if(this.restoreCursor(),u&&u?.length===1){let F=u[0];this.output.write(s.cursor.move(0,F)),this.output.write(s.erase.lines(1));let C=D.split(` `);this.output.write(C[F]),this._prevFrame=D,this.output.write(s.cursor.move(0,C.length-F-1));return}if(u&&u?.length>1){let F=u[0];this.output.write(s.cursor.move(0,F)),this.output.write(s.erase.down());let C=D.split(` `).slice(F);this.output.write(C.join(` -`)),this._prevFrame=D;return}this.output.write(s.erase.down())}this.output.write(D),this.state==="initial"&&(this.state="active"),this._prevFrame=D}}}class QF extends u0{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(s.cursor.move(0,-1)),this.value=u,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var WC;WC=new WeakMap;var _C=Object.defineProperty,jC=(D,u,F)=>(u in D)?_C(D,u,{enumerable:!0,configurable:!0,writable:!0,value:F}):D[u]=F,s2=(D,u,F)=>(jC(D,typeof u!="symbol"?u+"":u,F),F);class XF extends u0{constructor(D){super(D,!1),s2(this,"options"),s2(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 ZF extends u0{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let D=this.value.slice(0,this.cursor),[u,...F]=this.value.slice(this.cursor);return`${D}${D3.default.inverse(u)}${F.join("")}`}get cursor(){return this._cursor}constructor(D){super(D),this.on("finalize",()=>{this.value||(this.value=D.defaultValue)})}}var M=fD(DF(),1),F0=fD(t0(),1);import ID from"process";function MC(){return ID.platform!=="win32"?ID.env.TERM!=="linux":!!ID.env.CI||!!ID.env.WT_SESSION||!!ID.env.TERMINUS_SUBLIME||ID.env.ConEmuTask==="{cmd::Cmder}"||ID.env.TERM_PROGRAM==="Terminus-Sublime"||ID.env.TERM_PROGRAM==="vscode"||ID.env.TERM==="xterm-256color"||ID.env.TERM==="alacritty"||ID.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var JF=MC(),c=(D,u)=>JF?D:u,RC=c("\u25C6","*"),Q3=c("\u25A0","x"),X3=c("\u25B2","x"),KF=c("\u25C7","o"),qE=c("\u250C","T"),g=c("\u2502","|"),Uu=c("\u2514","\u2014"),qF=c("\u25CF",">"),YF=c("\u25CB"," "),YE=c("\u25FB","[\u2022]"),KE=c("\u25FC","[+]"),VE=c("\u25FB","[ ]"),AE=c("\u25AA","\u2022"),HE=c("\u2500","-"),UE=c("\u256E","+"),zE=c("\u251C","+"),GE=c("\u256F","+"),LC=c("\u25CF","\u2022"),IC=c("\u25C6","*"),NC=c("\u25B2","!"),TC=c("\u25A0","x"),VF=(D)=>{switch(D){case"initial":case"active":return M.default.cyan(RC);case"cancel":return M.default.red(Q3);case"error":return M.default.yellow(X3);case"submit":return M.default.green(KF)}},OC=(D)=>{let{cursor:u,options:F,style:C}=D,B=D.maxItems??Number.POSITIVE_INFINITY,$=Math.max(process.stdout.rows-4,0),E=Math.min($,Math.max(B,5)),Q=0;u>=Q+E-3?Q=Math.max(Math.min(u-E+3,F.length-E),0):u0,Z=E{let U=V===0&&X,z=V===A.length-1&&Z;return U||z?M.default.dim("..."):C(J,V+Q===u)})},Z3=(D)=>new ZF({validate:D.validate,placeholder:D.placeholder,defaultValue:D.defaultValue,initialValue:D.initialValue,render(){let u=`${M.default.gray(g)} -${VF(this.state)} ${D.message} +`)),this._prevFrame=D;return}this.output.write(s.erase.down())}this.output.write(D),this.state==="initial"&&(this.state="active"),this._prevFrame=D}}}class XF extends F0{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(s.cursor.move(0,-1)),this.value=u,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var PC;PC=new WeakMap;var kC=Object.defineProperty,SC=(D,u,F)=>(u in D)?kC(D,u,{enumerable:!0,configurable:!0,writable:!0,value:F}):D[u]=F,e2=(D,u,F)=>(SC(D,typeof u!="symbol"?u+"":u,F),F);class ZF extends F0{constructor(D){super(D,!1),e2(this,"options"),e2(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 JF extends F0{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let D=this.value.slice(0,this.cursor),[u,...F]=this.value.slice(this.cursor);return`${D}${F3.default.inverse(u)}${F.join("")}`}get cursor(){return this._cursor}constructor(D){super(D),this.on("finalize",()=>{this.value||(this.value=D.defaultValue)})}}var M=bD(uF(),1),C0=bD(e0(),1);import ID from"process";function xC(){return ID.platform!=="win32"?ID.env.TERM!=="linux":!!ID.env.CI||!!ID.env.WT_SESSION||!!ID.env.TERMINUS_SUBLIME||ID.env.ConEmuTask==="{cmd::Cmder}"||ID.env.TERM_PROGRAM==="Terminus-Sublime"||ID.env.TERM_PROGRAM==="vscode"||ID.env.TERM==="xterm-256color"||ID.env.TERM==="alacritty"||ID.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var YF=xC(),c=(D,u)=>YF?D:u,vC=c("\u25C6","*"),Z3=c("\u25A0","x"),J3=c("\u25B2","x"),VF=c("\u25C7","o"),SE=c("\u250C","T"),g=c("\u2502","|"),zu=c("\u2514","\u2014"),qF=c("\u25CF",">"),KF=c("\u25CB"," "),xE=c("\u25FB","[\u2022]"),vE=c("\u25FC","[+]"),fE=c("\u25FB","[ ]"),bE=c("\u25AA","\u2022"),yE=c("\u2500","-"),hE=c("\u256E","+"),gE=c("\u251C","+"),mE=c("\u256F","+"),fC=c("\u25CF","\u2022"),bC=c("\u25C6","*"),yC=c("\u25B2","!"),hC=c("\u25A0","x"),AF=(D)=>{switch(D){case"initial":case"active":return M.default.cyan(vC);case"cancel":return M.default.red(Z3);case"error":return M.default.yellow(J3);case"submit":return M.default.green(VF)}},gC=(D)=>{let{cursor:u,options:F,style:C}=D,B=D.maxItems??Number.POSITIVE_INFINITY,$=Math.max(process.stdout.rows-4,0),E=Math.min($,Math.max(B,5)),Q=0;u>=Q+E-3?Q=Math.max(Math.min(u-E+3,F.length-E),0):u0,Z=E{let U=V===0&&X,z=V===A.length-1&&Z;return U||z?M.default.dim("..."):C(J,V+Q===u)})},Y3=(D)=>new JF({validate:D.validate,placeholder:D.placeholder,defaultValue:D.defaultValue,initialValue:D.initialValue,render(){let u=`${M.default.gray(g)} +${AF(this.state)} ${D.message} `,F=D.placeholder?M.default.inverse(D.placeholder[0])+M.default.dim(D.placeholder.slice(1)):M.default.inverse(M.default.hidden("_")),C=this.value?this.valueWithCursor:F;switch(this.state){case"error":return`${u.trim()} ${M.default.yellow(g)} ${C} -${M.default.yellow(Uu)} ${M.default.yellow(this.error)} +${M.default.yellow(zu)} ${M.default.yellow(this.error)} `;case"submit":return`${u}${M.default.gray(g)} ${M.default.dim(this.value||D.placeholder)}`;case"cancel":return`${u}${M.default.gray(g)} ${M.default.strikethrough(M.default.dim(this.value??""))}${this.value?.trim()?` ${M.default.gray(g)}`:""}`;default:return`${u}${M.default.cyan(g)} ${C} -${M.default.cyan(Uu)} -`}}}).prompt();var tD=(D)=>{let u=D.active??"Yes",F=D.inactive??"No";return new QF({active:u,inactive:F,initialValue:D.initialValue??!0,render(){let C=`${M.default.gray(g)} -${VF(this.state)} ${D.message} +${M.default.cyan(zu)} +`}}}).prompt();var eD=(D)=>{let u=D.active??"Yes",F=D.inactive??"No";return new XF({active:u,inactive:F,initialValue:D.initialValue??!0,render(){let C=`${M.default.gray(g)} +${AF(this.state)} ${D.message} `,B=this.value?u:F;switch(this.state){case"submit":return`${C}${M.default.gray(g)} ${M.default.dim(B)}`;case"cancel":return`${C}${M.default.gray(g)} ${M.default.strikethrough(M.default.dim(B))} -${M.default.gray(g)}`;default:return`${C}${M.default.cyan(g)} ${this.value?`${M.default.green(qF)} ${u}`:`${M.default.dim(YF)} ${M.default.dim(u)}`} ${M.default.dim("/")} ${this.value?`${M.default.dim(YF)} ${M.default.dim(F)}`:`${M.default.green(qF)} ${F}`} -${M.default.cyan(Uu)} -`}}}).prompt()},C0=(D)=>{let u=(F,C)=>{let B=F.label??String(F.value);switch(C){case"selected":return`${M.default.dim(B)}`;case"active":return`${M.default.green(qF)} ${B} ${F.hint?M.default.dim(`(${F.hint})`):""}`;case"cancelled":return`${M.default.strikethrough(M.default.dim(B))}`;default:return`${M.default.dim(YF)} ${M.default.dim(B)}`}};return new XF({options:D.options,initialValue:D.initialValue,render(){let F=`${M.default.gray(g)} -${VF(this.state)} ${D.message} +${M.default.gray(g)}`;default:return`${C}${M.default.cyan(g)} ${this.value?`${M.default.green(qF)} ${u}`:`${M.default.dim(KF)} ${M.default.dim(u)}`} ${M.default.dim("/")} ${this.value?`${M.default.dim(KF)} ${M.default.dim(F)}`:`${M.default.green(qF)} ${F}`} +${M.default.cyan(zu)} +`}}}).prompt()},B0=(D)=>{let u=(F,C)=>{let B=F.label??String(F.value);switch(C){case"selected":return`${M.default.dim(B)}`;case"active":return`${M.default.green(qF)} ${B} ${F.hint?M.default.dim(`(${F.hint})`):""}`;case"cancelled":return`${M.default.strikethrough(M.default.dim(B))}`;default:return`${M.default.dim(KF)} ${M.default.dim(B)}`}};return new ZF({options:D.options,initialValue:D.initialValue,render(){let F=`${M.default.gray(g)} +${AF(this.state)} ${D.message} `;switch(this.state){case"submit":return`${F}${M.default.gray(g)} ${u(this.options[this.cursor],"selected")}`;case"cancel":return`${F}${M.default.gray(g)} ${u(this.options[this.cursor],"cancelled")} -${M.default.gray(g)}`;default:return`${F}${M.default.cyan(g)} ${OC({cursor:this.cursor,options:this.options,maxItems:D.maxItems,style:(C,B)=>u(C,B?"active":"inactive")}).join(` +${M.default.gray(g)}`;default:return`${F}${M.default.cyan(g)} ${gC({cursor:this.cursor,options:this.options,maxItems:D.maxItems,style:(C,B)=>u(C,B?"active":"inactive")}).join(` ${M.default.cyan(g)} `)} -${M.default.cyan(Uu)} -`}}}).prompt()};var eD=(D="")=>{process.stdout.write(`${M.default.gray(Uu)} ${M.default.red(D)} +${M.default.cyan(zu)} +`}}}).prompt()};var Du=(D="")=>{process.stdout.write(`${M.default.gray(zu)} ${M.default.red(D)} `)};var DD={message:(D="",{symbol:u=M.default.gray(g)}={})=>{let F=[`${M.default.gray(g)}`];if(D){let[C,...B]=D.split(` `);F.push(`${u} ${C}`,...B.map(($)=>`${M.default.gray(g)} ${$}`))}process.stdout.write(`${F.join(` `)} -`)},info:(D)=>{DD.message(D,{symbol:M.default.blue(LC)})},success:(D)=>{DD.message(D,{symbol:M.default.green(IC)})},step:(D)=>{DD.message(D,{symbol:M.default.green(KF)})},warn:(D)=>{DD.message(D,{symbol:M.default.yellow(NC)})},warning:(D)=>{DD.warn(D)},error:(D)=>{DD.message(D,{symbol:M.default.red(TC)})}},WE=`${M.default.gray(g)} `;var J3=({indicator:D="dots"}={})=>{let u=JF?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],F=JF?80:120,C=process.env.CI==="true",B,$,E=!1,Q="",X,Z=performance.now(),J=(L)=>{let S=L>1?"Something went wrong":"Canceled";E&&R(S,L)},V=()=>J(2),A=()=>J(1),U=()=>{process.on("uncaughtExceptionMonitor",V),process.on("unhandledRejection",V),process.on("SIGINT",A),process.on("SIGTERM",A),process.on("exit",J)},z=()=>{process.removeListener("uncaughtExceptionMonitor",V),process.removeListener("unhandledRejection",V),process.removeListener("SIGINT",A),process.removeListener("SIGTERM",A),process.removeListener("exit",J)},G=()=>{if(X===void 0)return;C&&process.stdout.write(` +`)},info:(D)=>{DD.message(D,{symbol:M.default.blue(fC)})},success:(D)=>{DD.message(D,{symbol:M.default.green(bC)})},step:(D)=>{DD.message(D,{symbol:M.default.green(VF)})},warn:(D)=>{DD.message(D,{symbol:M.default.yellow(yC)})},warning:(D)=>{DD.warn(D)},error:(D)=>{DD.message(D,{symbol:M.default.red(hC)})}},cE=`${M.default.gray(g)} `;var q3=({indicator:D="dots"}={})=>{let u=YF?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],F=YF?80:120,C=process.env.CI==="true",B,$,E=!1,Q="",X,Z=performance.now(),J=(L)=>{let S=L>1?"Something went wrong":"Canceled";E&&R(S,L)},V=()=>J(2),A=()=>J(1),U=()=>{process.on("uncaughtExceptionMonitor",V),process.on("unhandledRejection",V),process.on("SIGINT",A),process.on("SIGTERM",A),process.on("exit",J)},z=()=>{process.removeListener("uncaughtExceptionMonitor",V),process.removeListener("unhandledRejection",V),process.removeListener("SIGINT",A),process.removeListener("SIGTERM",A),process.removeListener("exit",J)},G=()=>{if(X===void 0)return;C&&process.stdout.write(` `);let L=X.split(` -`);process.stdout.write(F0.cursor.move(-999,L.length-1)),process.stdout.write(F0.erase.down(L.length))},W=(L)=>L.replace(/\.+$/,""),I=(L)=>{let S=(performance.now()-L)/1000,h=Math.floor(S/60),ED=Math.floor(S%60);return h>0?`[${h}m ${ED}s]`:`[${ED}s]`},T=(L="")=>{E=!0,B=$3(),Q=W(L),Z=performance.now(),process.stdout.write(`${M.default.gray(g)} -`);let S=0,h=0;U(),$=setInterval(()=>{if(C&&Q===X)return;G(),X=Q;let ED=M.default.magenta(u[S]);if(C)process.stdout.write(`${ED} ${Q}...`);else if(D==="timer")process.stdout.write(`${ED} ${Q} ${I(Z)}`);else{let PD=".".repeat(Math.floor(h)).slice(0,3);process.stdout.write(`${ED} ${Q}${PD}`)}S=S+1{E=!1,clearInterval($),G();let h=S===0?M.default.green(KF):S===1?M.default.red(Q3):M.default.red(X3);Q=W(L??Q),D==="timer"?process.stdout.write(`${h} ${Q} ${I(Z)} +`);process.stdout.write(C0.cursor.move(-999,L.length-1)),process.stdout.write(C0.erase.down(L.length))},W=(L)=>L.replace(/\.+$/,""),I=(L)=>{let S=(performance.now()-L)/1000,h=Math.floor(S/60),XD=Math.floor(S%60);return h>0?`[${h}m ${XD}s]`:`[${XD}s]`},O=(L="")=>{E=!0,B=X3(),Q=W(L),Z=performance.now(),process.stdout.write(`${M.default.gray(g)} +`);let S=0,h=0;U(),$=setInterval(()=>{if(C&&Q===X)return;G(),X=Q;let XD=M.default.magenta(u[S]);if(C)process.stdout.write(`${XD} ${Q}...`);else if(D==="timer")process.stdout.write(`${XD} ${Q} ${I(Z)}`);else{let PD=".".repeat(Math.floor(h)).slice(0,3);process.stdout.write(`${XD} ${Q}${PD}`)}S=S+1{E=!1,clearInterval($),G();let h=S===0?M.default.green(VF):S===1?M.default.red(Z3):M.default.red(J3);Q=W(L??Q),D==="timer"?process.stdout.write(`${h} ${Q} ${I(Z)} `):process.stdout.write(`${h} ${Q} -`),z(),B()};return{start:T,stop:R,message:(L="")=>{Q=W(L??Q)}}};var q3=(D=0)=>(u)=>`\x1B[${u+D}m`,Y3=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,K3=(D=0)=>(u,F,C)=>`\x1B[${38+D};2;${u};${F};${C}m`,b={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]}},jE=Object.keys(b.modifier),wC=Object.keys(b.color),PC=Object.keys(b.bgColor),ME=[...wC,...PC];function kC(){let D=new Map;for(let[u,F]of Object.entries(b)){for(let[C,B]of Object.entries(F))b[C]={open:`\x1B[${B[0]}m`,close:`\x1B[${B[1]}m`},F[C]=b[C],D.set(B[0],B[1]);Object.defineProperty(b,u,{value:F,enumerable:!1})}return Object.defineProperty(b,"codes",{value:D,enumerable:!1}),b.color.close="\x1B[39m",b.bgColor.close="\x1B[49m",b.color.ansi=q3(),b.color.ansi256=Y3(),b.color.ansi16m=K3(),b.bgColor.ansi=q3(10),b.bgColor.ansi256=Y3(10),b.bgColor.ansi16m=K3(10),Object.defineProperties(b,{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 B=Number.parseInt(C,16);return[B>>16&255,B>>8&255,B&255]},enumerable:!1},hexToAnsi256:{value:(u)=>b.rgbToAnsi256(...b.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,C,B;if(u>=232)F=((u-232)*10+8)/255,C=F,B=F;else{u-=16;let Q=u%36;F=Math.floor(u/36)/5,C=Math.floor(Q/6)/5,B=Q%6/5}let $=Math.max(F,C,B)*2;if($===0)return 30;let E=30+(Math.round(B)<<2|Math.round(C)<<1|Math.round(F));if($===2)E+=60;return E},enumerable:!1},rgbToAnsi:{value:(u,F,C)=>b.ansi256ToAnsi(b.rgbToAnsi256(u,F,C)),enumerable:!1},hexToAnsi:{value:(u)=>b.ansi256ToAnsi(b.hexToAnsi256(u)),enumerable:!1}}),b}var SC=kC(),ND=SC;import AF from"process";import xC from"os";import V3 from"tty";function AD(D,u=globalThis.Deno?globalThis.Deno.args:AF.argv){let F=D.startsWith("-")?"":D.length===1?"-":"--",C=u.indexOf(F+D),B=u.indexOf("--");return C!==-1&&(B===-1||C=2,has16m:D>=3}}function fC(D,{streamIsTTY:u,sniffFlags:F=!0}={}){let C=vC();if(C!==void 0)E0=C;let B=F?E0:C;if(B===0)return 0;if(F){if(AD("color=16m")||AD("color=full")||AD("color=truecolor"))return 3;if(AD("color=256"))return 2}if("TF_BUILD"in f&&"AGENT_NAME"in f)return 1;if(D&&!u&&B===void 0)return 0;let $=B||0;if(f.TERM==="dumb")return $;if(AF.platform==="win32"){let E=xC.release().split(".");if(Number(E[0])>=10&&Number(E[2])>=10586)return Number(E[2])>=14931?3:2;return 1}if("CI"in f){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((E)=>(E in f)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((E)=>(E in f))||f.CI_NAME==="codeship")return 1;return $}if("TEAMCITY_VERSION"in f)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(f.TEAMCITY_VERSION)?1:0;if(f.COLORTERM==="truecolor")return 3;if(f.TERM==="xterm-kitty")return 3;if(f.TERM==="xterm-ghostty")return 3;if(f.TERM==="wezterm")return 3;if("TERM_PROGRAM"in f){let E=Number.parseInt((f.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(f.TERM_PROGRAM){case"iTerm.app":return E>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(f.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(f.TERM))return 1;if("COLORTERM"in f)return 1;return $}function A3(D,u={}){let F=fC(D,{streamIsTTY:D&&D.isTTY,...u});return bC(F)}var yC={stdout:A3({isTTY:V3.isatty(1)}),stderr:A3({isTTY:V3.isatty(2)})},H3=yC;function U3(D,u,F){let C=D.indexOf(u);if(C===-1)return D;let B=u.length,$=0,E="";do E+=D.slice($,C)+u+F,$=C+B,C=D.indexOf(u,$);while(C!==-1);return E+=D.slice($),E}function z3(D,u,F,C){let B=0,$="";do{let E=D[C-1]==="\r";$+=D.slice(B,E?C-1:C)+u+(E?`\r +`),z(),B()};return{start:O,stop:R,message:(L="")=>{Q=W(L??Q)}}};var K3=(D=0)=>(u)=>`\x1B[${u+D}m`,V3=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,A3=(D=0)=>(u,F,C)=>`\x1B[${38+D};2;${u};${F};${C}m`,f={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]}},lE=Object.keys(f.modifier),mC=Object.keys(f.color),cC=Object.keys(f.bgColor),pE=[...mC,...cC];function dC(){let D=new Map;for(let[u,F]of Object.entries(f)){for(let[C,B]of Object.entries(F))f[C]={open:`\x1B[${B[0]}m`,close:`\x1B[${B[1]}m`},F[C]=f[C],D.set(B[0],B[1]);Object.defineProperty(f,u,{value:F,enumerable:!1})}return Object.defineProperty(f,"codes",{value:D,enumerable:!1}),f.color.close="\x1B[39m",f.bgColor.close="\x1B[49m",f.color.ansi=K3(),f.color.ansi256=V3(),f.color.ansi16m=A3(),f.bgColor.ansi=K3(10),f.bgColor.ansi256=V3(10),f.bgColor.ansi16m=A3(10),Object.defineProperties(f,{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 B=Number.parseInt(C,16);return[B>>16&255,B>>8&255,B&255]},enumerable:!1},hexToAnsi256:{value:(u)=>f.rgbToAnsi256(...f.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,C,B;if(u>=232)F=((u-232)*10+8)/255,C=F,B=F;else{u-=16;let Q=u%36;F=Math.floor(u/36)/5,C=Math.floor(Q/6)/5,B=Q%6/5}let $=Math.max(F,C,B)*2;if($===0)return 30;let E=30+(Math.round(B)<<2|Math.round(C)<<1|Math.round(F));if($===2)E+=60;return E},enumerable:!1},rgbToAnsi:{value:(u,F,C)=>f.ansi256ToAnsi(f.rgbToAnsi256(u,F,C)),enumerable:!1},hexToAnsi:{value:(u)=>f.ansi256ToAnsi(f.hexToAnsi256(u)),enumerable:!1}}),f}var lC=dC(),ND=lC;import HF from"process";import pC from"os";import H3 from"tty";function UD(D,u=globalThis.Deno?globalThis.Deno.args:HF.argv){let F=D.startsWith("-")?"":D.length===1?"-":"--",C=u.indexOf(F+D),B=u.indexOf("--");return C!==-1&&(B===-1||C=2,has16m:D>=3}}function aC(D,{streamIsTTY:u,sniffFlags:F=!0}={}){let C=nC();if(C!==void 0)$0=C;let B=F?$0:C;if(B===0)return 0;if(F){if(UD("color=16m")||UD("color=full")||UD("color=truecolor"))return 3;if(UD("color=256"))return 2}if("TF_BUILD"in b&&"AGENT_NAME"in b)return 1;if(D&&!u&&B===void 0)return 0;let $=B||0;if(b.TERM==="dumb")return $;if(HF.platform==="win32"){let E=pC.release().split(".");if(Number(E[0])>=10&&Number(E[2])>=10586)return Number(E[2])>=14931?3:2;return 1}if("CI"in b){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((E)=>(E in b)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((E)=>(E in b))||b.CI_NAME==="codeship")return 1;return $}if("TEAMCITY_VERSION"in b)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(b.TEAMCITY_VERSION)?1:0;if(b.COLORTERM==="truecolor")return 3;if(b.TERM==="xterm-kitty")return 3;if(b.TERM==="xterm-ghostty")return 3;if(b.TERM==="wezterm")return 3;if("TERM_PROGRAM"in b){let E=Number.parseInt((b.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(b.TERM_PROGRAM){case"iTerm.app":return E>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(b.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(b.TERM))return 1;if("COLORTERM"in b)return 1;return $}function U3(D,u={}){let F=aC(D,{streamIsTTY:D&&D.isTTY,...u});return iC(F)}var rC={stdout:U3({isTTY:H3.isatty(1)}),stderr:U3({isTTY:H3.isatty(2)})},z3=rC;function G3(D,u,F){let C=D.indexOf(u);if(C===-1)return D;let B=u.length,$=0,E="";do E+=D.slice($,C)+u+F,$=C+B,C=D.indexOf(u,$);while(C!==-1);return E+=D.slice($),E}function W3(D,u,F,C){let B=0,$="";do{let E=D[C-1]==="\r";$+=D.slice(B,E?C-1:C)+u+(E?`\r `:` `)+F,B=C+1,C=D.indexOf(` -`,B)}while(C!==-1);return $+=D.slice(B),$}var{stdout:G3,stderr:W3}=H3,HF=Symbol("GENERATOR"),Du=Symbol("STYLER"),zu=Symbol("IS_EMPTY"),_3=["ansi","ansi","ansi256","ansi16m"],uu=Object.create(null),hC=(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=G3?G3.level:0;D.level=u.level===void 0?F:u.level};var gC=(D)=>{let u=(...F)=>F.join(" ");return hC(u,D),Object.setPrototypeOf(u,Gu.prototype),u};function Gu(D){return gC(D)}Object.setPrototypeOf(Gu.prototype,Function.prototype);for(let[D,u]of Object.entries(ND))uu[D]={get(){let F=$0(this,zF(u.open,u.close,this[Du]),this[zu]);return Object.defineProperty(this,D,{value:F}),F}};uu.visible={get(){let D=$0(this,this[Du],!0);return Object.defineProperty(this,"visible",{value:D}),D}};var UF=(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 UF("rgb",u,F,...ND.hexToRgb(...C));return ND[F][D](...C)},mC=["rgb","hex","ansi256"];for(let D of mC){uu[D]={get(){let{level:F}=this;return function(...C){let B=zF(UF(D,_3[F],"color",...C),ND.color.close,this[Du]);return $0(this,B,this[zu])}}};let u="bg"+D[0].toUpperCase()+D.slice(1);uu[u]={get(){let{level:F}=this;return function(...C){let B=zF(UF(D,_3[F],"bgColor",...C),ND.bgColor.close,this[Du]);return $0(this,B,this[zu])}}}}var cC=Object.defineProperties(()=>{},{...uu,level:{enumerable:!0,get(){return this[HF].level},set(D){this[HF].level=D}}}),zF=(D,u,F)=>{let C,B;if(F===void 0)C=D,B=u;else C=F.openAll+D,B=u+F.closeAll;return{open:D,close:u,openAll:C,closeAll:B,parent:F}},$0=(D,u,F)=>{let C=(...B)=>dC(C,B.length===1?""+B[0]:B.join(" "));return Object.setPrototypeOf(C,cC),C[HF]=D,C[Du]=u,C[zu]=F,C},dC=(D,u)=>{if(D.level<=0||!u)return D[zu]?"":u;let F=D[Du];if(F===void 0)return u;let{openAll:C,closeAll:B}=F;if(u.includes("\x1B"))while(F!==void 0)u=U3(u,F.close,F.open),F=F.parent;let $=u.indexOf(` -`);if($!==-1)u=z3(u,B,C,$);return C+u+B};Object.defineProperties(Gu.prototype,uu);var lC=Gu(),SE=Gu({level:W3?W3.level:0});var N=lC;var RF=fD(O3(),1),t=(...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=RF.default(...D)}else u=RF.default(D[0]),F=LF(D[1]);let C=(B,$)=>{return pC(B?B.toString():"",u,$??F)};return C.multiline=(B,$)=>nC(B?B.toString():"",u,$??F),C},w3=(D,u,F)=>{return u.interpolation?.toLowerCase()==="hsv"?D.hsv(F,u.hsvSpin?.toLowerCase()||!1):D.rgb(F)};function pC(D,u,F){let C=LF(F),B=Math.max(D.replace(/\s/g,"").length,u.stops.length),$=w3(u,C,B),E="";for(let Q of D)E+=Q.match(/\s/g)?Q:N.hex($.shift()?.toHex()||"#000")(Q);return E}function nC(D,u,F){let C=LF(F),B=D.split(` -`),$=Math.max(...B.map((X)=>X.length),u.stops.length),E=w3(u,C,$),Q=[];for(let X of B){let Z=E.slice(0),J="";for(let V of X)J+=N.hex(Z.shift()?.toHex()||"#000")(V);Q.push(J)}return Q.join(` -`)}function LF(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 XD={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 ZD(D){let u=(F)=>t(...D.colors)(F,D.options);return u.multiline=(F="")=>t(...D.colors).multiline(F,D.options),u}var IF=t,iC=ZD(XD.atlas),aC=ZD(XD.cristal),rC=ZD(XD.teen),oC=ZD(XD.mind),sC=ZD(XD.morning),tC=ZD(XD.vice),eC=ZD(XD.passion),D7=ZD(XD.fruit),u7=ZD(XD.instagram),F7=ZD(XD.retro),C7=ZD(XD.summer),B7=ZD(XD.rainbow),E7=ZD(XD.pastel);t.atlas=iC;t.cristal=aC;t.teen=rC;t.mind=oC;t.morning=sC;t.vice=tC;t.passion=eC;t.fruit=D7;t.instagram=u7;t.retro=F7;t.summer=C7;t.rainbow=B7;t.pastel=E7;import Y0 from"process";function NF({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 $7=NF();function _u(D){if(typeof D!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace($7,"")}function P3(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 k3(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function S3(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 Q7(D){if(!Number.isSafeInteger(D))throw new TypeError(`Expected a code point, got \`${typeof D}\`.`)}function x3(D,{ambiguousAsWide:u=!1}={}){if(Q7(D),k3(D)||S3(D)||u&&P3(D))return 2;return 1}var v3=()=>{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 X7=new Intl.Segmenter,Z7=/^\p{Default_Ignorable_Code_Point}$/u;function uD(D,u={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:F=!0,countAnsiEscapeCodes:C=!1}=u;if(!C)D=_u(D);if(D.length===0)return 0;let B=0,$={ambiguousAsWide:!F};for(let{segment:E}of X7.segment(D)){let Q=E.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(Z7.test(E))continue;if(v3().test(E)){B+=2;continue}B+=x3(Q,$)}return B}function X0(D){let u=0;for(let F of D.split(` -`))u=Math.max(u,uD(F));return u}var q8=fD(OF(),1);var q7=/[\p{Lu}]/u,Y7=/[\p{Ll}]/u,y3=/^[\p{Lu}](?![\p{Lu}])/gu,m3=/([\p{Alpha}\p{N}_]|$)/u,wF=/[_.\- ]+/,K7=new RegExp("^"+wF.source),h3=new RegExp(wF.source+m3.source,"gu"),g3=new RegExp("\\d+"+m3.source,"gu"),V7=(D,u,F,C)=>{let B=!1,$=!1,E=!1,Q=!1;for(let X=0;X2?D[X-3]==="-":!0,B&&q7.test(Z))D=D.slice(0,X)+"-"+D.slice(X),B=!1,E=$,$=!0,X++;else if($&&E&&Y7.test(Z)&&(!Q||C))D=D.slice(0,X-1)+"-"+D.slice(X-1),E=$,$=!1,B=!0;else B=u(Z)===Z&&F(Z)!==Z,E=$,$=F(Z)===Z&&u(Z)!==Z}return D},A7=(D,u)=>{return y3.lastIndex=0,D.replaceAll(y3,(F)=>u(F))},H7=(D,u)=>{return h3.lastIndex=0,g3.lastIndex=0,D.replaceAll(g3,(F,C,B)=>["_","-"].includes(D.charAt(B+F.length))?F:u(F)).replaceAll(h3,(F,C)=>u(C))};function PF(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(wF.test(D))return"";return u.pascalCase?C(D):F(D)}if(D!==F(D))D=V7(D,F,C,u.preserveConsecutiveUppercase);if(D=D.replace(K7,""),D=u.preserveConsecutiveUppercase?A7(D,F):F(D),u.pascalCase)D=C(D.charAt(0))+D.slice(1);return H7(D,C)}var bF=fD(e3(),1);var D8=(D=0)=>(u)=>`\x1B[${u+D}m`,u8=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,F8=(D=0)=>(u,F,C)=>`\x1B[${38+D};2;${u};${F};${C}m`,y={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]}},Q5=Object.keys(y.modifier),R7=Object.keys(y.color),L7=Object.keys(y.bgColor),X5=[...R7,...L7];function I7(){let D=new Map;for(let[u,F]of Object.entries(y)){for(let[C,B]of Object.entries(F))y[C]={open:`\x1B[${B[0]}m`,close:`\x1B[${B[1]}m`},F[C]=y[C],D.set(B[0],B[1]);Object.defineProperty(y,u,{value:F,enumerable:!1})}return Object.defineProperty(y,"codes",{value:D,enumerable:!1}),y.color.close="\x1B[39m",y.bgColor.close="\x1B[49m",y.color.ansi=D8(),y.color.ansi256=u8(),y.color.ansi16m=F8(),y.bgColor.ansi=D8(10),y.bgColor.ansi256=u8(10),y.bgColor.ansi16m=F8(10),Object.defineProperties(y,{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 B=Number.parseInt(C,16);return[B>>16&255,B>>8&255,B&255]},enumerable:!1},hexToAnsi256:{value:(u)=>y.rgbToAnsi256(...y.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,C,B;if(u>=232)F=((u-232)*10+8)/255,C=F,B=F;else{u-=16;let Q=u%36;F=Math.floor(u/36)/5,C=Math.floor(Q/6)/5,B=Q%6/5}let $=Math.max(F,C,B)*2;if($===0)return 30;let E=30+(Math.round(B)<<2|Math.round(C)<<1|Math.round(F));if($===2)E+=60;return E},enumerable:!1},rgbToAnsi:{value:(u,F,C)=>y.ansi256ToAnsi(y.rgbToAnsi256(u,F,C)),enumerable:!1},hexToAnsi:{value:(u)=>y.ansi256ToAnsi(y.hexToAnsi256(u)),enumerable:!1}}),y}var N7=I7(),C8=N7;var J0=new Set(["\x1B","\x9B"]),T7=39,vF="\x07",$8="[",O7="]",Q8="m",Z0=`${O7}8;;`,B8=(D)=>`${J0.values().next().value}${$8}${D}${Q8}`,E8=(D)=>`${J0.values().next().value}${Z0}${D}${vF}`,w7=(D)=>D.split(" ").map((u)=>uD(u)),xF=(D,u,F)=>{let C=[...u],B=!1,$=!1,E=uD(_u(D.at(-1)));for(let[Q,X]of C.entries()){let Z=uD(X);if(E+Z<=F)D[D.length-1]+=X;else D.push(X),E=0;if(J0.has(X))B=!0,$=C.slice(Q+1,Q+1+Z0.length).join("")===Z0;if(B){if($){if(X===vF)B=!1,$=!1}else if(X===Q8)B=!1;continue}if(E+=Z,E===F&&Q0&&D.length>1)D[D.length-2]+=D.pop()},P7=(D)=>{let u=D.split(" "),F=u.length;while(F>0){if(uD(u[F-1])>0)break;F--}if(F===u.length)return D;return u.slice(0,F).join(" ")+u.slice(F).join("")},k7=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let C="",B,$,E=w7(D),Q=[""];for(let[V,A]of D.split(" ").entries()){if(F.trim!==!1)Q[Q.length-1]=Q.at(-1).trimStart();let U=uD(Q.at(-1));if(V!==0){if(U>=u&&(F.wordWrap===!1||F.trim===!1))Q.push(""),U=0;if(U>0||F.trim===!1)Q[Q.length-1]+=" ",U++}if(F.hard&&E[V]>u){let z=u-U,G=1+Math.floor((E[V]-z-1)/u);if(Math.floor((E[V]-1)/u)u&&U>0&&E[V]>0){if(F.wordWrap===!1&&Uu&&F.wordWrap===!1){xF(Q,A,u);continue}Q[Q.length-1]+=A}if(F.trim!==!1)Q=Q.map((V)=>P7(V));let X=Q.join(` -`),Z=[...X],J=0;for(let[V,A]of Z.entries()){if(C+=A,J0.has(A)){let{groups:z}=new RegExp(`(?:\\${$8}(?\\d+)m|\\${Z0}(?.*)${vF})`).exec(X.slice(J))||{groups:{}};if(z.code!==void 0){let G=Number.parseFloat(z.code);B=G===T7?void 0:G}else if(z.uri!==void 0)$=z.uri.length===0?void 0:z.uri}let U=C8.codes.get(Number(B));if(Z[V+1]===` -`){if($)C+=E8("");if(B&&U)C+=B8(U)}else if(A===` -`){if(B&&U)C+=B8(B);if($)C+=E8($)}J+=A.length}return C};function q0(D,u,F){return String(D).normalize().replaceAll(`\r +`,B)}while(C!==-1);return $+=D.slice(B),$}var{stdout:_3,stderr:j3}=z3,UF=Symbol("GENERATOR"),uu=Symbol("STYLER"),Gu=Symbol("IS_EMPTY"),M3=["ansi","ansi","ansi256","ansi16m"],Fu=Object.create(null),oC=(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=_3?_3.level:0;D.level=u.level===void 0?F:u.level};var sC=(D)=>{let u=(...F)=>F.join(" ");return oC(u,D),Object.setPrototypeOf(u,Wu.prototype),u};function Wu(D){return sC(D)}Object.setPrototypeOf(Wu.prototype,Function.prototype);for(let[D,u]of Object.entries(ND))Fu[D]={get(){let F=Q0(this,GF(u.open,u.close,this[uu]),this[Gu]);return Object.defineProperty(this,D,{value:F}),F}};Fu.visible={get(){let D=Q0(this,this[uu],!0);return Object.defineProperty(this,"visible",{value:D}),D}};var zF=(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 zF("rgb",u,F,...ND.hexToRgb(...C));return ND[F][D](...C)},tC=["rgb","hex","ansi256"];for(let D of tC){Fu[D]={get(){let{level:F}=this;return function(...C){let B=GF(zF(D,M3[F],"color",...C),ND.color.close,this[uu]);return Q0(this,B,this[Gu])}}};let u="bg"+D[0].toUpperCase()+D.slice(1);Fu[u]={get(){let{level:F}=this;return function(...C){let B=GF(zF(D,M3[F],"bgColor",...C),ND.bgColor.close,this[uu]);return Q0(this,B,this[Gu])}}}}var eC=Object.defineProperties(()=>{},{...Fu,level:{enumerable:!0,get(){return this[UF].level},set(D){this[UF].level=D}}}),GF=(D,u,F)=>{let C,B;if(F===void 0)C=D,B=u;else C=F.openAll+D,B=u+F.closeAll;return{open:D,close:u,openAll:C,closeAll:B,parent:F}},Q0=(D,u,F)=>{let C=(...B)=>D7(C,B.length===1?""+B[0]:B.join(" "));return Object.setPrototypeOf(C,eC),C[UF]=D,C[uu]=u,C[Gu]=F,C},D7=(D,u)=>{if(D.level<=0||!u)return D[Gu]?"":u;let F=D[uu];if(F===void 0)return u;let{openAll:C,closeAll:B}=F;if(u.includes("\x1B"))while(F!==void 0)u=G3(u,F.close,F.open),F=F.parent;let $=u.indexOf(` +`);if($!==-1)u=W3(u,B,C,$);return C+u+B};Object.defineProperties(Wu.prototype,Fu);var u7=Wu(),u5=Wu({level:j3?j3.level:0});var N=u7;var LF=bD(P3(),1),t=(...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=LF.default(...D)}else u=LF.default(D[0]),F=IF(D[1]);let C=(B,$)=>{return F7(B?B.toString():"",u,$??F)};return C.multiline=(B,$)=>C7(B?B.toString():"",u,$??F),C},k3=(D,u,F)=>{return u.interpolation?.toLowerCase()==="hsv"?D.hsv(F,u.hsvSpin?.toLowerCase()||!1):D.rgb(F)};function F7(D,u,F){let C=IF(F),B=Math.max(D.replace(/\s/g,"").length,u.stops.length),$=k3(u,C,B),E="";for(let Q of D)E+=Q.match(/\s/g)?Q:N.hex($.shift()?.toHex()||"#000")(Q);return E}function C7(D,u,F){let C=IF(F),B=D.split(` +`),$=Math.max(...B.map((X)=>X.length),u.stops.length),E=k3(u,C,$),Q=[];for(let X of B){let Z=E.slice(0),J="";for(let V of X)J+=N.hex(Z.shift()?.toHex()||"#000")(V);Q.push(J)}return Q.join(` +`)}function IF(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 YD={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 qD(D){let u=(F)=>t(...D.colors)(F,D.options);return u.multiline=(F="")=>t(...D.colors).multiline(F,D.options),u}var NF=t,B7=qD(YD.atlas),E7=qD(YD.cristal),$7=qD(YD.teen),Q7=qD(YD.mind),X7=qD(YD.morning),Z7=qD(YD.vice),J7=qD(YD.passion),Y7=qD(YD.fruit),q7=qD(YD.instagram),K7=qD(YD.retro),V7=qD(YD.summer),A7=qD(YD.rainbow),H7=qD(YD.pastel);t.atlas=B7;t.cristal=E7;t.teen=$7;t.mind=Q7;t.morning=X7;t.vice=Z7;t.passion=J7;t.fruit=Y7;t.instagram=q7;t.retro=K7;t.summer=V7;t.rainbow=A7;t.pastel=H7;import K0 from"process";function TF({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 U7=TF();function ju(D){if(typeof D!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(U7,"")}function S3(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 x3(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function v3(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 z7(D){if(!Number.isSafeInteger(D))throw new TypeError(`Expected a code point, got \`${typeof D}\`.`)}function f3(D,{ambiguousAsWide:u=!1}={}){if(z7(D),x3(D)||v3(D)||u&&S3(D))return 2;return 1}var b3=()=>{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 G7=new Intl.Segmenter,W7=/^\p{Default_Ignorable_Code_Point}$/u;function uD(D,u={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:F=!0,countAnsiEscapeCodes:C=!1}=u;if(!C)D=ju(D);if(D.length===0)return 0;let B=0,$={ambiguousAsWide:!F};for(let{segment:E}of G7.segment(D)){let Q=E.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(W7.test(E))continue;if(b3().test(E)){B+=2;continue}B+=f3(Q,$)}return B}function Z0(D){let u=0;for(let F of D.split(` +`))u=Math.max(u,uD(F));return u}var K8=bD(wF(),1);var j7=/[\p{Lu}]/u,M7=/[\p{Ll}]/u,g3=/^[\p{Lu}](?![\p{Lu}])/gu,d3=/([\p{Alpha}\p{N}_]|$)/u,PF=/[_.\- ]+/,R7=new RegExp("^"+PF.source),m3=new RegExp(PF.source+d3.source,"gu"),c3=new RegExp("\\d+"+d3.source,"gu"),L7=(D,u,F,C)=>{let B=!1,$=!1,E=!1,Q=!1;for(let X=0;X2?D[X-3]==="-":!0,B&&j7.test(Z))D=D.slice(0,X)+"-"+D.slice(X),B=!1,E=$,$=!0,X++;else if($&&E&&M7.test(Z)&&(!Q||C))D=D.slice(0,X-1)+"-"+D.slice(X-1),E=$,$=!1,B=!0;else B=u(Z)===Z&&F(Z)!==Z,E=$,$=F(Z)===Z&&u(Z)!==Z}return D},I7=(D,u)=>{return g3.lastIndex=0,D.replaceAll(g3,(F)=>u(F))},N7=(D,u)=>{return m3.lastIndex=0,c3.lastIndex=0,D.replaceAll(c3,(F,C,B)=>["_","-"].includes(D.charAt(B+F.length))?F:u(F)).replaceAll(m3,(F,C)=>u(C))};function kF(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(PF.test(D))return"";return u.pascalCase?C(D):F(D)}if(D!==F(D))D=L7(D,F,C,u.preserveConsecutiveUppercase);if(D=D.replace(R7,""),D=u.preserveConsecutiveUppercase?I7(D,F):F(D),u.pascalCase)D=C(D.charAt(0))+D.slice(1);return N7(D,C)}var bF=bD(u8(),1);var F8=(D=0)=>(u)=>`\x1B[${u+D}m`,C8=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,B8=(D=0)=>(u,F,C)=>`\x1B[${38+D};2;${u};${F};${C}m`,y={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]}},O5=Object.keys(y.modifier),v7=Object.keys(y.color),f7=Object.keys(y.bgColor),w5=[...v7,...f7];function b7(){let D=new Map;for(let[u,F]of Object.entries(y)){for(let[C,B]of Object.entries(F))y[C]={open:`\x1B[${B[0]}m`,close:`\x1B[${B[1]}m`},F[C]=y[C],D.set(B[0],B[1]);Object.defineProperty(y,u,{value:F,enumerable:!1})}return Object.defineProperty(y,"codes",{value:D,enumerable:!1}),y.color.close="\x1B[39m",y.bgColor.close="\x1B[49m",y.color.ansi=F8(),y.color.ansi256=C8(),y.color.ansi16m=B8(),y.bgColor.ansi=F8(10),y.bgColor.ansi256=C8(10),y.bgColor.ansi16m=B8(10),Object.defineProperties(y,{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 B=Number.parseInt(C,16);return[B>>16&255,B>>8&255,B&255]},enumerable:!1},hexToAnsi256:{value:(u)=>y.rgbToAnsi256(...y.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,C,B;if(u>=232)F=((u-232)*10+8)/255,C=F,B=F;else{u-=16;let Q=u%36;F=Math.floor(u/36)/5,C=Math.floor(Q/6)/5,B=Q%6/5}let $=Math.max(F,C,B)*2;if($===0)return 30;let E=30+(Math.round(B)<<2|Math.round(C)<<1|Math.round(F));if($===2)E+=60;return E},enumerable:!1},rgbToAnsi:{value:(u,F,C)=>y.ansi256ToAnsi(y.rgbToAnsi256(u,F,C)),enumerable:!1},hexToAnsi:{value:(u)=>y.ansi256ToAnsi(y.hexToAnsi256(u)),enumerable:!1}}),y}var y7=b7(),E8=y7;var Y0=new Set(["\x1B","\x9B"]),h7=39,fF="\x07",X8="[",g7="]",Z8="m",J0=`${g7}8;;`,$8=(D)=>`${Y0.values().next().value}${X8}${D}${Z8}`,Q8=(D)=>`${Y0.values().next().value}${J0}${D}${fF}`,m7=(D)=>D.split(" ").map((u)=>uD(u)),vF=(D,u,F)=>{let C=[...u],B=!1,$=!1,E=uD(ju(D.at(-1)));for(let[Q,X]of C.entries()){let Z=uD(X);if(E+Z<=F)D[D.length-1]+=X;else D.push(X),E=0;if(Y0.has(X))B=!0,$=C.slice(Q+1,Q+1+J0.length).join("")===J0;if(B){if($){if(X===fF)B=!1,$=!1}else if(X===Z8)B=!1;continue}if(E+=Z,E===F&&Q0&&D.length>1)D[D.length-2]+=D.pop()},c7=(D)=>{let u=D.split(" "),F=u.length;while(F>0){if(uD(u[F-1])>0)break;F--}if(F===u.length)return D;return u.slice(0,F).join(" ")+u.slice(F).join("")},d7=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let C="",B,$,E=m7(D),Q=[""];for(let[V,A]of D.split(" ").entries()){if(F.trim!==!1)Q[Q.length-1]=Q.at(-1).trimStart();let U=uD(Q.at(-1));if(V!==0){if(U>=u&&(F.wordWrap===!1||F.trim===!1))Q.push(""),U=0;if(U>0||F.trim===!1)Q[Q.length-1]+=" ",U++}if(F.hard&&E[V]>u){let z=u-U,G=1+Math.floor((E[V]-z-1)/u);if(Math.floor((E[V]-1)/u)u&&U>0&&E[V]>0){if(F.wordWrap===!1&&Uu&&F.wordWrap===!1){vF(Q,A,u);continue}Q[Q.length-1]+=A}if(F.trim!==!1)Q=Q.map((V)=>c7(V));let X=Q.join(` +`),Z=[...X],J=0;for(let[V,A]of Z.entries()){if(C+=A,Y0.has(A)){let{groups:z}=new RegExp(`(?:\\${X8}(?\\d+)m|\\${J0}(?.*)${fF})`).exec(X.slice(J))||{groups:{}};if(z.code!==void 0){let G=Number.parseFloat(z.code);B=G===h7?void 0:G}else if(z.uri!==void 0)$=z.uri.length===0?void 0:z.uri}let U=E8.codes.get(Number(B));if(Z[V+1]===` +`){if($)C+=Q8("");if(B&&U)C+=$8(U)}else if(A===` +`){if(B&&U)C+=$8(B);if($)C+=Q8($)}J+=A.length}return C};function q0(D,u,F){return String(D).normalize().replaceAll(`\r `,` `).split(` -`).map((C)=>k7(C,u,F)).join(` -`)}var m7=fD(OF(),1),cD=` -`,JD=" ",ju="none",Y8=()=>{let{env:D,stdout:u,stderr:F}=Y0;if(u?.columns)return u.columns;if(F?.columns)return F.columns;if(D.COLUMNS)return Number.parseInt(D.COLUMNS,10);return 80},X8=(D)=>typeof D==="number"?{top:D,right:D*3,bottom:D,left:D*3}:{top:0,right:0,bottom:0,left:0,...D},Mu=(D)=>D===ju?0:2,S7=(D)=>{let u=["topLeft","topRight","bottomRight","bottomLeft","left","right","top","bottom"],F;if(D===ju){D={};for(let C of u)D[C]=""}if(typeof D==="string"){if(F=q8.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},x7=(D,u,F)=>{let C="",B=uD(D);switch(F){case"left":{C=D+u.slice(B);break}case"right":{C=u.slice(B)+D;break}default:{if(u=u.slice(B),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},v7=(D,{padding:u,width:F,textAlignment:C,height:B})=>{D=bF.default(D,{align:C});let $=D.split(cD),E=X0(D),Q=F-u.left-u.right;if(E>Q){let J=[];for(let V of $){let A=q0(V,Q,{hard:!0}),z=bF.default(A,{align:C}).split(` -`),G=Math.max(...z.map((W)=>uD(W)));for(let W of z){let I;switch(C){case"center":{I=JD.repeat((Q-G)/2)+W;break}case"right":{I=JD.repeat(Q-G)+W;break}default:{I=W;break}}J.push(I)}}$=J}if(C==="center"&&EJD.repeat((Q-E)/2)+J);else if(C==="right"&&EJD.repeat(Q-E)+J);let X=JD.repeat(u.left),Z=JD.repeat(u.right);if($=$.map((J)=>{let V=X+J+Z;return V+JD.repeat(F-uD(V))}),u.top>0)$=[...Array.from({length:u.top}).fill(JD.repeat(F)),...$];if(u.bottom>0)$=[...$,...Array.from({length:u.bottom}).fill(JD.repeat(F))];if(B&&$.length>B)$=$.slice(0,B);else if(B&&$.length{let C=(J)=>{let V=F.borderColor?h7(F.borderColor)(J):J;return F.dimBorder?N.dim(V):V},B=(J)=>F.backgroundColor?g7(F.backgroundColor)(J):J,$=S7(F.borderStyle),E=Y8(),Q=JD.repeat(F.margin.left);if(F.float==="center"){let J=Math.max((E-u-Mu(F.borderStyle))/2,0);Q=JD.repeat(J)}else if(F.float==="right"){let J=Math.max(E-u-F.margin.right-Mu(F.borderStyle),0);Q=JD.repeat(J)}let X="";if(F.margin.top)X+=cD.repeat(F.margin.top);if(F.borderStyle!==ju||F.title)X+=C(Q+$.topLeft+(F.title?x7(F.title,$.top.repeat(u),F.titleAlignment):$.top.repeat(u))+$.topRight)+cD;let Z=D.split(cD);if(X+=Z.map((J)=>Q+C($.left)+B(J)+C($.right)).join(cD),F.borderStyle!==ju)X+=cD+C(Q+$.bottomLeft+$.bottom.repeat(u)+$.bottomRight);if(F.margin.bottom)X+=cD.repeat(F.margin.bottom);return X},f7=(D)=>{if(D.fullscreen&&Y0?.stdout){let u=[Y0.stdout.columns,Y0.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-Mu(D.borderStyle)),D.height&&=Math.max(1,D.height-Mu(D.borderStyle)),D},Z8=(D,u)=>u===ju?D:` ${D} `,y7=(D,u)=>{u=f7(u);let F=u.width!==void 0,C=Y8(),B=Mu(u.borderStyle),$=C-u.margin.left-u.margin.right-B,E=X0(q0(D,C-B,{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&&=Z8(u.title,u.borderStyle);else if(u.title){if(u.title=u.title.slice(0,Math.max(0,$-2)),u.title){if(u.title=Z8(u.title,u.borderStyle),uD(u.title)>E)u.width=uD(u.title)}}if(u.width||=E,!F){if(u.margin.left&&u.margin.right&&u.width>$){let X=(C-u.width-B)/(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-B-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},fF=(D)=>D.match(/^#(?:[0-f]{3}){1,2}$/i),J8=(D)=>typeof D==="string"&&(N[D]??fF(D)),h7=(D)=>fF(D)?N.hex(D):N[D],g7=(D)=>fF(D)?N.bgHex(D):N[PF(["bg",D])];function K0(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&&!J8(u.borderColor))throw new Error(`${u.borderColor} is not a valid borderColor`);if(u.backgroundColor&&!J8(u.backgroundColor))throw new Error(`${u.backgroundColor} is not a valid backgroundColor`);return u.padding=X8(u.padding),u.margin=X8(u.margin),u=y7(D,u),D=v7(D,u),b7(D,u.width,u)}HD();import{platform as p7,homedir as n7}from"os";import{execSync as hF}from"child_process";import{join as Ru}from"path";var H0=p7()==="win32",Fu={findExecutable:(D)=>{let u=H0?`where ${D}`:`which ${D}`;return hF(u,{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()},installUv:()=>{if(H0)hF('powershell -Command "irm https://astral.sh/uv/install.ps1 | iex"',{stdio:"pipe"});else hF("curl -LsSf https://astral.sh/uv/install.sh | sh",{stdio:"pipe",shell:"/bin/sh"})},getShellConfigPaths:()=>{let D=n7();if(H0)return[Ru(D,"Documents","PowerShell","Microsoft.PowerShell_profile.ps1"),Ru(D,"Documents","WindowsPowerShell","Microsoft.PowerShell_profile.ps1")];return[Ru(D,".bashrc"),Ru(D,".zshrc"),Ru(D,".bash_profile")]},getAliasDefinition:(D,u)=>{if(H0)return`function ${D} { ${u} $args }`;return`alias ${D}='${u}'`}};function a7(D){let u,F=0,C=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];return{start(){u=setInterval(()=>{process.stdout.write(`\r${N.cyan(C[F%C.length])} ${D}`),F++},50)},stop(B,$=!0){clearInterval(u);let E=$?N.green("\u2713"):N.red("\u2717");process.stdout.write(`\r${E} ${B} -`)}}}var Lu=IF(["#ff0000","#ff4500","#ffa500","#ffff00","#00ff00","#00ffff","#0000ff","#8b00ff"]),gF=IF(["#ff006e","#fb5607","#ffbe0b","#8338ec","#3a86ff"]);function r7(){Fu.installUv(),process.env.PATH=`${A8()}/.cargo/bin:${process.env.PATH}`}function H8(){return Fu.findExecutable("claude")}function o7(){let u=O.getInstance().getClaudeSettingsPath();if(!kD(u))return!1;try{let F=JSON.parse(Iu(u,"utf8"));return!!(F.hooks?.SessionStart||F.hooks?.Stop||F.hooks?.PostToolUse)}catch{return!1}}async function s7(D){let u={};if(D){let $=await tD({message:`\uD83E\uDDE0 Existing claude-mem installation detected. Your memories and data are safe! +`).map((C)=>d7(C,u,F)).join(` +`)}var t7=bD(wF(),1),dD=` +`,KD=" ",Mu="none",V8=()=>{let{env:D,stdout:u,stderr:F}=K0;if(u?.columns)return u.columns;if(F?.columns)return F.columns;if(D.COLUMNS)return Number.parseInt(D.COLUMNS,10);return 80},J8=(D)=>typeof D==="number"?{top:D,right:D*3,bottom:D,left:D*3}:{top:0,right:0,bottom:0,left:0,...D},Ru=(D)=>D===Mu?0:2,l7=(D)=>{let u=["topLeft","topRight","bottomRight","bottomLeft","left","right","top","bottom"],F;if(D===Mu){D={};for(let C of u)D[C]=""}if(typeof D==="string"){if(F=K8.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},p7=(D,u,F)=>{let C="",B=uD(D);switch(F){case"left":{C=D+u.slice(B);break}case"right":{C=u.slice(B)+D;break}default:{if(u=u.slice(B),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},n7=(D,{padding:u,width:F,textAlignment:C,height:B})=>{D=bF.default(D,{align:C});let $=D.split(dD),E=Z0(D),Q=F-u.left-u.right;if(E>Q){let J=[];for(let V of $){let A=q0(V,Q,{hard:!0}),z=bF.default(A,{align:C}).split(` +`),G=Math.max(...z.map((W)=>uD(W)));for(let W of z){let I;switch(C){case"center":{I=KD.repeat((Q-G)/2)+W;break}case"right":{I=KD.repeat(Q-G)+W;break}default:{I=W;break}}J.push(I)}}$=J}if(C==="center"&&EKD.repeat((Q-E)/2)+J);else if(C==="right"&&EKD.repeat(Q-E)+J);let X=KD.repeat(u.left),Z=KD.repeat(u.right);if($=$.map((J)=>{let V=X+J+Z;return V+KD.repeat(F-uD(V))}),u.top>0)$=[...Array.from({length:u.top}).fill(KD.repeat(F)),...$];if(u.bottom>0)$=[...$,...Array.from({length:u.bottom}).fill(KD.repeat(F))];if(B&&$.length>B)$=$.slice(0,B);else if(B&&$.length{let C=(J)=>{let V=F.borderColor?o7(F.borderColor)(J):J;return F.dimBorder?N.dim(V):V},B=(J)=>F.backgroundColor?s7(F.backgroundColor)(J):J,$=l7(F.borderStyle),E=V8(),Q=KD.repeat(F.margin.left);if(F.float==="center"){let J=Math.max((E-u-Ru(F.borderStyle))/2,0);Q=KD.repeat(J)}else if(F.float==="right"){let J=Math.max(E-u-F.margin.right-Ru(F.borderStyle),0);Q=KD.repeat(J)}let X="";if(F.margin.top)X+=dD.repeat(F.margin.top);if(F.borderStyle!==Mu||F.title)X+=C(Q+$.topLeft+(F.title?p7(F.title,$.top.repeat(u),F.titleAlignment):$.top.repeat(u))+$.topRight)+dD;let Z=D.split(dD);if(X+=Z.map((J)=>Q+C($.left)+B(J)+C($.right)).join(dD),F.borderStyle!==Mu)X+=dD+C(Q+$.bottomLeft+$.bottom.repeat(u)+$.bottomRight);if(F.margin.bottom)X+=dD.repeat(F.margin.bottom);return X},a7=(D)=>{if(D.fullscreen&&K0?.stdout){let u=[K0.stdout.columns,K0.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-Ru(D.borderStyle)),D.height&&=Math.max(1,D.height-Ru(D.borderStyle)),D},Y8=(D,u)=>u===Mu?D:` ${D} `,r7=(D,u)=>{u=a7(u);let F=u.width!==void 0,C=V8(),B=Ru(u.borderStyle),$=C-u.margin.left-u.margin.right-B,E=Z0(q0(D,C-B,{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&&=Y8(u.title,u.borderStyle);else if(u.title){if(u.title=u.title.slice(0,Math.max(0,$-2)),u.title){if(u.title=Y8(u.title,u.borderStyle),uD(u.title)>E)u.width=uD(u.title)}}if(u.width||=E,!F){if(u.margin.left&&u.margin.right&&u.width>$){let X=(C-u.width-B)/(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-B-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},yF=(D)=>D.match(/^#(?:[0-f]{3}){1,2}$/i),q8=(D)=>typeof D==="string"&&(N[D]??yF(D)),o7=(D)=>yF(D)?N.hex(D):N[D],s7=(D)=>yF(D)?N.bgHex(D):N[kF(["bg",D])];function V0(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&&!q8(u.borderColor))throw new Error(`${u.borderColor} is not a valid borderColor`);if(u.backgroundColor&&!q8(u.backgroundColor))throw new Error(`${u.backgroundColor} is not a valid backgroundColor`);return u.padding=J8(u.padding),u.margin=J8(u.margin),u=r7(D,u),D=n7(D,u),i7(D,u.width,u)}FD();import{platform as F9,homedir as C9}from"os";import{execSync as gF}from"child_process";import{join as Lu}from"path";var U0=F9()==="win32",Cu={findExecutable:(D)=>{let u=U0?`where ${D}`:`which ${D}`;return gF(u,{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()},installUv:()=>{if(U0)gF('powershell -Command "irm https://astral.sh/uv/install.ps1 | iex"',{stdio:"pipe"});else gF("curl -LsSf https://astral.sh/uv/install.sh | sh",{stdio:"pipe",shell:"/bin/sh"})},getShellConfigPaths:()=>{let D=C9();if(U0)return[Lu(D,"Documents","PowerShell","Microsoft.PowerShell_profile.ps1"),Lu(D,"Documents","WindowsPowerShell","Microsoft.PowerShell_profile.ps1")];return[Lu(D,".bashrc"),Lu(D,".zshrc"),Lu(D,".bash_profile")]},getAliasDefinition:(D,u)=>{if(U0)return`function ${D} { ${u} $args }`;return`alias ${D}='${u}'`}};function E9(D){let u,F=0,C=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];return{start(){u=setInterval(()=>{process.stdout.write(`\r${N.cyan(C[F%C.length])} ${D}`),F++},50)},stop(B,$=!0){clearInterval(u);let E=$?N.green("\u2713"):N.red("\u2717");process.stdout.write(`\r${E} ${B} +`)}}}var Iu=NF(["#ff0000","#ff4500","#ffa500","#ffff00","#00ff00","#00ffff","#0000ff","#8b00ff"]),mF=NF(["#ff006e","#fb5607","#ffbe0b","#8338ec","#3a86ff"]);function $9(){Cu.installUv(),process.env.PATH=`${U8()}/.cargo/bin:${process.env.PATH}`}function z8(){return Cu.findExecutable("claude")}function Q9(){let u=T.getInstance().getClaudeSettingsPath();if(!kD(u))return!1;try{let F=JSON.parse(Nu(u,"utf8"));return!!(F.hooks?.SessionStart||F.hooks?.Stop||F.hooks?.PostToolUse)}catch{return!1}}async function X9(D){let u={};if(D){let $=await eD({message:`\uD83E\uDDE0 Existing claude-mem installation detected. Your memories and data are safe! -Reinstall to update hooks and configuration?`,initialValue:!0});if(VD($)||!$)return eD("Installation cancelled"),null;u.forceReinstall=!0}else u.forceReinstall=!1;let F=await C0({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(VD(F))return eD("Installation cancelled"),null;if(u.scope=F,F==="local"){let $=await Z3({message:"Enter custom installation directory",placeholder:Bu(process.cwd(),".claude-mem"),validate:(E)=>{if(!E)return"Path is required";if(!E.startsWith("/")&&!E.startsWith("~"))return"Please provide an absolute path"}});if(VD($))return eD("Installation cancelled"),null;u.customPath=$}u.hookTimeout=180000;let C=await tD({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(VD(C))return eD("Installation cancelled"),null;u.enableSmartTrash=C;let B=await tD({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(VD(B))return eD("Installation cancelled"),null;return u.saveMemoriesOnClear=B,u}function t7(){let D=O.getInstance();D.ensureAllDataDirectories(),D.ensureAllClaudeDirectories();let u=Bu(D.getDataDirectory(),"package.json");if(!kD(u))Cu(u,JSON.stringify({name:"claude-mem-data",type:"module"},null,2))}function e7(){let u=O.getInstance().getClaudeMdPath(),F=mF(u);if(!kD(F))z0(F,{recursive:!0});let C=` +Reinstall to update hooks and configuration?`,initialValue:!0});if(HD($)||!$)return Du("Installation cancelled"),null;u.forceReinstall=!0}else u.forceReinstall=!1;let F=await B0({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(HD(F))return Du("Installation cancelled"),null;if(u.scope=F,F==="local"){let $=await Y3({message:"Enter custom installation directory",placeholder:Eu(process.cwd(),".claude-mem"),validate:(E)=>{if(!E)return"Path is required";if(!E.startsWith("/")&&!E.startsWith("~"))return"Please provide an absolute path"}});if(HD($))return Du("Installation cancelled"),null;u.customPath=$}u.hookTimeout=180000;let C=await eD({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(HD(C))return Du("Installation cancelled"),null;u.enableSmartTrash=C;let B=await eD({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(HD(B))return Du("Installation cancelled"),null;return u.saveMemoriesOnClear=B,u}function Z9(){let D=T.getInstance();D.ensureAllDataDirectories(),D.ensureAllClaudeDirectories();let u=Eu(D.getDataDirectory(),"package.json");if(!kD(u))Bu(u,JSON.stringify({name:"claude-mem-data",type:"module"},null,2))}function J9(){let u=T.getInstance().getClaudeMdPath(),F=cF(u);if(!kD(F))G0(F,{recursive:!0});let C=` ## \uD83E\uDDE0 Memory System Quick Reference @@ -165,17 +296,17 @@ Reinstall to update hooks and configuration?`,initialValue:!0});if(VD($)||!$)ret ### Storage - Collection: "claude_memories" - Archives: ~/.claude-mem/archives/ -`,B="";if(kD(u)){B=Iu(u,"utf8");let $=B.includes(""),E=B.includes("");if($||E){let Q,X;if($)Q="",X="";else Q="",X="";let Z=B.indexOf(Q),J=B.indexOf(X)+X.length;if(Z!==-1&&J!==-1)B=B.substring(0,Z)+C.trim()+B.substring(J)}else B=B.trim()+` -`+C}else B=C.trim();Cu(u,B)}function D9(D=!1){let u=`${A8()}/.cargo/bin`;if(kD(u)&&!process.env.PATH?.includes(u))process.env.PATH=`${u}:${process.env.PATH}`;if(D)try{V8("claude mcp remove claude-mem",{stdio:"pipe"})}catch(C){}let F=`claude mcp add claude-mem -- uvx chroma-mcp --client-type persistent --data-dir ${O.getInstance().getChromaDirectory()}`;V8(F,{stdio:"inherit"})}function U0(D,u,F){let C={hooks:[{type:"command",command:D,timeout:u}]};if(F)C.matcher=F;return C}function u9(D){let u=kD(D)?JSON.parse(Iu(D,"utf8")):{hooks:{}};if(z0(mF(D),{recursive:!0}),!u.hooks)u.hooks={};["SessionStart","Stop","UserPromptSubmit","PostToolUse"].forEach((B)=>{if(u.hooks[B])u.hooks[B]=u.hooks[B].filter(($)=>!$.hooks?.some((E)=>E.command?.includes(Au)))});let C=H8()||Au;u.hooks.SessionStart=[U0(`${C} context`,180)],u.hooks.Stop=[U0(`${C} summary`,60)],u.hooks.UserPromptSubmit=[U0(`${C} new`,60)],u.hooks.PostToolUse=[U0(`${C} save`,180,"*")],Cu(D,JSON.stringify(u,null,2))}function F9(D){if(D.scope==="local"&&D.customPath)return Bu(D.customPath,"settings.local.json");else if(D.scope==="project")return Bu(process.cwd(),".claude","settings.json");else return O.getInstance().getClaudeSettingsPath()}function C9(D){let F=O.getInstance().getUserSettingsPath(),C=kD(F)?JSON.parse(Iu(F,"utf8")):{};C.backend="chroma",C.installed=!0,C.embedded=!0,C.saveMemoriesOnClear=D.saveMemoriesOnClear||!1,C.claudePath=H8(),Cu(F,JSON.stringify(C,null,2))}function B9(){let D=Fu.getShellConfigPaths(),u=Fu.getAliasDefinition("rm","claude-mem trash"),F=Fu.isWindows()?"# claude-mem smart trash alias":"# claude-mem smart trash alias";for(let C of D){if(!kD(C)){let E=mF(C);if(!kD(E))z0(E,{recursive:!0});Cu(C,"")}let B=Iu(C,"utf8");if(B.includes(u))continue;let $=` +`,B="";if(kD(u)){B=Nu(u,"utf8");let $=B.includes(""),E=B.includes("");if($||E){let Q,X;if($)Q="",X="";else Q="",X="";let Z=B.indexOf(Q),J=B.indexOf(X)+X.length;if(Z!==-1&&J!==-1)B=B.substring(0,Z)+C.trim()+B.substring(J)}else B=B.trim()+` +`+C}else B=C.trim();Bu(u,B)}function Y9(D=!1){let u=`${U8()}/.cargo/bin`;if(kD(u)&&!process.env.PATH?.includes(u))process.env.PATH=`${u}:${process.env.PATH}`;if(D)try{H8("claude mcp remove claude-mem",{stdio:"pipe"})}catch(C){}let F=`claude mcp add claude-mem -- uvx chroma-mcp --client-type persistent --data-dir ${T.getInstance().getChromaDirectory()}`;H8(F,{stdio:"inherit"})}function z0(D,u,F){let C={hooks:[{type:"command",command:D,timeout:u}]};if(F)C.matcher=F;return C}function q9(D){let u=kD(D)?JSON.parse(Nu(D,"utf8")):{hooks:{}};if(G0(cF(D),{recursive:!0}),!u.hooks)u.hooks={};["SessionStart","Stop","UserPromptSubmit","PostToolUse"].forEach((B)=>{if(u.hooks[B])u.hooks[B]=u.hooks[B].filter(($)=>!$.hooks?.some((E)=>E.command?.includes(Hu)))});let C=z8()||Hu;u.hooks.SessionStart=[z0(`${C} context`,180)],u.hooks.Stop=[z0(`${C} summary`,60)],u.hooks.UserPromptSubmit=[z0(`${C} new`,60)],u.hooks.PostToolUse=[z0(`${C} save`,180,"*")],Bu(D,JSON.stringify(u,null,2))}function K9(D){if(D.scope==="local"&&D.customPath)return Eu(D.customPath,"settings.local.json");else if(D.scope==="project")return Eu(process.cwd(),".claude","settings.json");else return T.getInstance().getClaudeSettingsPath()}function V9(D){let F=T.getInstance().getUserSettingsPath(),C=kD(F)?JSON.parse(Nu(F,"utf8")):{};C.backend="chroma",C.installed=!0,C.embedded=!0,C.saveMemoriesOnClear=D.saveMemoriesOnClear||!1,C.claudePath=z8(),Bu(F,JSON.stringify(C,null,2))}function A9(){let D=Cu.getShellConfigPaths(),u=Cu.getAliasDefinition("rm","claude-mem trash"),F=Cu.isWindows()?"# claude-mem smart trash alias":"# claude-mem smart trash alias";for(let C of D){if(!kD(C)){let E=cF(C);if(!kD(E))G0(E,{recursive:!0});Bu(C,"")}let B=Nu(C,"utf8");if(B.includes(u))continue;let $=` ${F} ${u} -`;B+=$,Cu(C,B)}}function E9(){let D=O.getInstance(),u=D.getClaudeCommandsDirectory(),F=D.findPackageCommandsDirectory();z0(u,{recursive:!0});let C=["save.md","remember.md","claude-mem.md"];for(let B of C){let $=Bu(F,B),E=Bu(u,B);if(kD($))i7($,E)}}async function U8(D={}){console.log(Lu(` -\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(Lu(" CLAUDE-MEM INSTALLER ")),console.log(Lu("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550")),console.log(K0(gF(`\uD83E\uDDE0 Persistent Memory System for Claude Code +`;B+=$,Bu(C,B)}}function H9(){let D=T.getInstance(),u=D.getClaudeCommandsDirectory(),F=D.findPackageCommandsDirectory();G0(u,{recursive:!0});let C=["save.md","remember.md","claude-mem.md"];for(let B of C){let $=Eu(F,B),E=Eu(u,B);if(kD($))B9($,E)}}async function G8(D={}){console.log(Iu(` +\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(Iu(" CLAUDE-MEM INSTALLER ")),console.log(Iu("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550")),console.log(V0(mF(`\uD83E\uDDE0 Persistent Memory System for Claude Code \u2728 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"})),r7();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=o7(),Z=await s7(X);if(!Z)process.exit(0);F=Z}console.log(gF(` +\uD83D\uDE80 Never lose your conversation history again`),{padding:2,margin:1,borderStyle:"double",borderColor:"magenta",textAlignment:"center"})),$9();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=Q9(),Z=await X9(X);if(!Z)process.exit(0);F=Z}console.log(mF(` \uD83D\uDE80 Beginning Installation Process -`));let C=[{name:"Creating directory structure",fn:()=>t7()},{name:"Installing Chroma MCP server",fn:()=>D9(F.forceReinstall)},{name:"Adding CLAUDE.md instructions",fn:()=>e7()},{name:"Installing Claude commands",fn:()=>E9()},{name:"Configuring Claude settings",fn:()=>u9(F9(F))},{name:"Configuring user settings",fn:()=>C9(F)}];if(F.enableSmartTrash)C.push({name:"Configuring Smart Trash alias",fn:()=>B9()});for(let X=0;XZ9()},{name:"Installing Chroma MCP server",fn:()=>Y9(F.forceReinstall)},{name:"Adding CLAUDE.md instructions",fn:()=>J9()},{name:"Installing Claude commands",fn:()=>H9()},{name:"Configuring Claude settings",fn:()=>q9(K9(F))},{name:"Configuring user settings",fn:()=>V9(F)}];if(F.enableSmartTrash)C.push({name:"Configuring Smart Trash alias",fn:()=>A9()});for(let X=0;X{if(J.trim()==='alias rm="claude-mem trash"')return!1;for(let A of C)if(J.trim()===A&&V+1!V.hooks?.some((A)=>A.command?.includes("claude-mem")));if(J.length!==E.hooks[Z].length)E.hooks[Z]=J.length?J:void 0,Q=!0,console.log(`\u2705 Removed ${Z} hook from ${B.name} settings`)}if(X.forEach((Z)=>{if(E.hooks[Z]===void 0)delete E.hooks[Z]}),!Object.keys(E.hooks).length)delete E.hooks;if(Q){let Z=B.path+".backup."+Date.now();G0(Z,$),console.log(`\uD83D\uDCCB Created backup: ${Z}`),G0(B.path,JSON.stringify(E,null,2)),F++,console.log(`\u2705 Updated ${B.name} settings: ${B.path}`)}else console.log(`\u2139\uFE0F No Claude Memory System hooks found in ${B.name} settings`)}let C=await Q9();if(console.log(""),F>0||C){if(console.log("\u2728 Uninstallation complete!"),F>0)console.log("The Claude Memory System hooks have been removed from your settings.");if(C)console.log("The Smart Trash alias has been removed from your shell configuration."),console.log("\u26A0\uFE0F 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("\u2139\uFE0F No Claude Memory System hooks or aliases were found to remove.")}HD();import{readFileSync as X9,readdirSync as Z9,statSync as J9}from"fs";import{join as _8}from"path";async function q9(D,u,F){try{let $=X9(D,"utf8").split(` -`).filter((E)=>E.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((E)=>{console.log(` ${E}`)});console.log("")}catch(C){console.log(`\u274C Could not read ${u.toLowerCase()} log: ${D}`)}}async function j8(D={}){let u=O.getLogsDirectory(),F=parseInt(D.tail)||20;try{let B=Z9(u).filter(($)=>$.startsWith("claude-mem-")&&$.endsWith(".log")).map(($)=>({name:$,path:_8(u,$),mtime:J9(_8(u,$)).mtime})).sort(($,E)=>E.mtime.getTime()-$.mtime.getTime());if(B.length===0){console.log("\u274C No log files found in ~/.claude-mem/logs/");return}if(await q9(B[0].path,"Most Recent",F),D.all&&B.length>1)console.log(`\uD83D\uDCDA Found ${B.length} total log files`)}catch(C){console.log("\u274C Could not read logs directory: ~/.claude-mem/logs/"),console.log(" Run a compression first to generate logs")}}import{renameSync as oB,existsSync as U6,mkdirSync as sB,statSync as tB}from"fs";import{join as eB,basename as D4}from"path";var cF=(D,u,F)=>{let C=D instanceof RegExp?M8(D,F):D,B=u instanceof RegExp?M8(u,F):u,$=C!==null&&B!=null&&Y9(C,B,F);return $&&{start:$[0],end:$[1],pre:F.slice(0,$[0]),body:F.slice($[0]+C.length,$[1]),post:F.slice($[1]+B.length)}},M8=(D,u)=>{let F=u.match(D);return F?F[0]:null},Y9=(D,u,F)=>{let C,B,$,E=void 0,Q,X=F.indexOf(D),Z=F.indexOf(u,X+1),J=X;if(X>=0&&Z>0){if(D===u)return[X,Z];C=[],$=F.length;while(J>=0&&!Q){if(J===X)C.push(J),X=F.indexOf(D,J+1);else if(C.length===1){let V=C.pop();if(V!==void 0)Q=[V,Z]}else{if(B=C.pop(),B!==void 0&&B<$)$=B,E=Z;Z=F.indexOf(u,J+1)}J=X=0?X:Z}if(C.length&&E!==void 0)Q=[$,E]}return Q};var R8="\x00SLASH"+Math.random()+"\x00",L8="\x00OPEN"+Math.random()+"\x00",lF="\x00CLOSE"+Math.random()+"\x00",I8="\x00COMMA"+Math.random()+"\x00",N8="\x00PERIOD"+Math.random()+"\x00",K9=new RegExp(R8,"g"),V9=new RegExp(L8,"g"),A9=new RegExp(lF,"g"),H9=new RegExp(I8,"g"),U9=new RegExp(N8,"g"),z9=/\\\\/g,G9=/\\{/g,W9=/\\}/g,_9=/\\,/g,j9=/\\./g;function dF(D){return!isNaN(D)?parseInt(D,10):D.charCodeAt(0)}function M9(D){return D.replace(z9,R8).replace(G9,L8).replace(W9,lF).replace(_9,I8).replace(j9,N8)}function R9(D){return D.replace(K9,"\\").replace(V9,"{").replace(A9,"}").replace(H9,",").replace(U9,".")}function T8(D){if(!D)return[""];let u=[],F=cF("{","}",D);if(!F)return D.split(",");let{pre:C,body:B,post:$}=F,E=C.split(",");E[E.length-1]+="{"+B+"}";let Q=T8($);if($.length)E[E.length-1]+=Q.shift(),E.push.apply(E,Q);return u.push.apply(u,E),u}function O8(D){if(!D)return[];if(D.slice(0,2)==="{}")D="\\{\\}"+D.slice(2);return Tu(M9(D),!0).map(R9)}function L9(D){return"{"+D+"}"}function I9(D){return/^-?0\d/.test(D)}function N9(D,u){return D<=u}function T9(D,u){return D>=u}function Tu(D,u){let F=[],C=cF("{","}",D);if(!C)return[D];let B=C.pre,$=C.post.length?Tu(C.post,!1):[""];if(/\$$/.test(C.pre))for(let E=0;E<$.length;E++){let Q=B+"{"+C.body+"}"+$[E];F.push(Q)}else{let E=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(C.body),Q=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(C.body),X=E||Q,Z=C.body.indexOf(",")>=0;if(!X&&!Z){if(C.post.match(/,(?!,).*\}/))return D=C.pre+"{"+C.body+lF+C.post,Tu(D);return[D]}let J;if(X)J=C.body.split(/\.\./);else if(J=T8(C.body),J.length===1&&J[0]!==void 0){if(J=Tu(J[0],!1).map(L9),J.length===1)return $.map((A)=>C.pre+J[0]+A)}let V;if(X&&J[0]!==void 0&&J[1]!==void 0){let A=dF(J[0]),U=dF(J[1]),z=Math.max(J[0].length,J[1].length),G=J.length===3&&J[2]!==void 0?Math.abs(dF(J[2])):1,W=N9;if(U0){let h=new Array(S+1).join("0");if(R<0)L="-"+h+L.slice(1);else L=h+L}}V.push(L)}}else{V=[];for(let A=0;A{if(typeof D!=="string")throw new TypeError("invalid pattern");if(D.length>65536)throw new TypeError("pattern is too long")};var O9={"[: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]},wu=(D)=>D.replace(/[[\]\\-]/g,"\\$&"),w9=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),w8=(D)=>D.join(""),P8=(D,u)=>{let F=u;if(D.charAt(F)!=="[")throw new Error("not in a brace expression");let C=[],B=[],$=F+1,E=!1,Q=!1,X=!1,Z=!1,J=F,V="";D:while($V)C.push(wu(V)+"-"+wu(G));else if(G===V)C.push(wu(G));V="",$++;continue}if(D.startsWith("-]",$+1)){C.push(wu(G+"-")),$+=2;continue}if(D.startsWith("-",$+1)){V=G,$+=2;continue}C.push(wu(G)),$++}if(J<$)return["",!1,0,!1];if(!C.length&&!B.length)return["$.",!1,D.length-F,!0];if(B.length===0&&C.length===1&&/^\\?.$/.test(C[0])&&!Z){let G=C[0].length===2?C[0].slice(-1):C[0];return[w9(G),!1,J-F,!1]}let A="["+(Z?"^":"")+w8(C)+"]",U="["+(Z?"":"^")+w8(B)+"]";return[C.length&&B.length?"("+A+"|"+U+")":C.length?A:U,Q,J-F,!0]};var TD=(D,{windowsPathsNoEscape:u=!1}={})=>{return u?D.replace(/\[([^\/\\])\]/g,"$1"):D.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var P9=new Set(["!","?","+","*","@"]),k8=(D)=>P9.has(D),k9="(?!(?:^|/)\\.\\.?(?:$|/))",W0="(?!\\.)",S9=new Set(["[","."]),x9=new Set(["..","."]),v9=new Set("().*{}+?[]^$\\!"),b9=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),pF="[^/]",S8=pF+"*?",x8=pF+"+?";class r{type;#D;#u;#E=!1;#B=[];#$;#W;#z;#J=!1;#Q;#Y;#q=!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.#z=this.#D===this?[]:this.#D.#z,D==="!"&&!this.#D.#J)this.#z.push(this);this.#W=this.#$?this.#$.#B.length:0}get hasMagic(){if(this.#u!==void 0)return this.#u;for(let D of this.#B){if(typeof D==="string")continue;if(D.type||D.hasMagic)return this.#u=!0}return this.#u}toString(){if(this.#Y!==void 0)return this.#Y;if(!this.type)return this.#Y=this.#B.map((D)=>String(D)).join("");else return this.#Y=this.type+"("+this.#B.map((D)=>String(D)).join("|")+")"}#X(){if(this!==this.#D)throw new Error("should only call on root");if(this.#J)return this;this.toString(),this.#J=!0;let D;while(D=this.#z.pop()){if(D.type!=="!")continue;let u=D,F=u.#$;while(F){for(let C=u.#W+1;!F.type&&Ctypeof u==="string"?u:u.toJSON()):[this.type,...this.#B.map((u)=>u.toJSON())];if(this.isStart()&&!this.type)D.unshift([]);if(this.isEnd()&&(this===this.#D||this.#D.#J&&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{let[U,z,G,W]=typeof A==="string"?r.#_(A,this.#u,Q):A.toRegExpSource(D);return this.#u=this.#u||G,this.#E=this.#E||W,U}).join(""),Z="";if(this.isStart()){if(typeof this.#B[0]==="string"){if(!(this.#B.length===1&&x9.has(this.#B[0]))){let U=S9,z=u&&U.has(X.charAt(0))||X.startsWith("\\.")&&U.has(X.charAt(2))||X.startsWith("\\.\\.")&&U.has(X.charAt(4)),G=!u&&!D&&U.has(X.charAt(0));Z=z?k9:G?W0:""}}}let J="";if(this.isEnd()&&this.#D.#J&&this.#$?.type==="!")J="(?:$|\\/)";return[Z+X+J,TD(X),this.#u=!!this.#u,this.#E]}let F=this.type==="*"||this.type==="+",C=this.type==="!"?"(?:(?!(?:":"(?:",B=this.#V(u);if(this.isStart()&&this.isEnd()&&!B&&this.type!=="!"){let Q=this.toString();return this.#B=[Q],this.type=null,this.#u=void 0,[Q,TD(this.toString()),!1,!1]}let $=!F||D||u||!W0?"":this.#V(!0);if($===B)$="";if($)B=`(?:${B})(?:${$})*?`;let E="";if(this.type==="!"&&this.#q)E=(this.isStart()&&!u?W0:"")+x8;else{let Q=this.type==="!"?"))"+(this.isStart()&&!u&&!D?W0:"")+S8+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&$?")":this.type==="*"&&$?")?":`)${this.type}`;E=C+B+Q}return[E,TD(B),this.#u=!!this.#u,this.#E]}#V(D){return this.#B.map((u)=>{if(typeof u==="string")throw new Error("string type in extglob ast??");let[F,C,B,$]=u.toRegExpSource(D);return this.#E=this.#E||$,F}).filter((u)=>!(this.isStart()&&this.isEnd())||!!u).join("|")}static#_(D,u,F=!1){let C=!1,B="",$=!1;for(let E=0;E{return u?D.replace(/[?*()[\]]/g,"[$&]"):D.replace(/[?*()[\]\\]/g,"\\$&")};var FD=(D,u,F={})=>{if(Ou(u),!F.nocomment&&u.charAt(0)==="#")return!1;return new zD(u,F).match(D)},f9=/^\*+([^+@!?\*\[\(]*)$/,y9=(D)=>(u)=>!u.startsWith(".")&&u.endsWith(D),h9=(D)=>(u)=>u.endsWith(D),g9=(D)=>{return D=D.toLowerCase(),(u)=>!u.startsWith(".")&&u.toLowerCase().endsWith(D)},m9=(D)=>{return D=D.toLowerCase(),(u)=>u.toLowerCase().endsWith(D)},c9=/^\*+\.\*+$/,d9=(D)=>!D.startsWith(".")&&D.includes("."),l9=(D)=>D!=="."&&D!==".."&&D.includes("."),p9=/^\.\*+$/,n9=(D)=>D!=="."&&D!==".."&&D.startsWith("."),i9=/^\*+$/,a9=(D)=>D.length!==0&&!D.startsWith("."),r9=(D)=>D.length!==0&&D!=="."&&D!=="..",o9=/^\?+([^+@!?\*\[\(]*)?$/,s9=([D,u=""])=>{let F=f8([D]);if(!u)return F;return u=u.toLowerCase(),(C)=>F(C)&&C.toLowerCase().endsWith(u)},t9=([D,u=""])=>{let F=y8([D]);if(!u)return F;return u=u.toLowerCase(),(C)=>F(C)&&C.toLowerCase().endsWith(u)},e9=([D,u=""])=>{let F=y8([D]);return!u?F:(C)=>F(C)&&C.endsWith(u)},DB=([D,u=""])=>{let F=f8([D]);return!u?F:(C)=>F(C)&&C.endsWith(u)},f8=([D])=>{let u=D.length;return(F)=>F.length===u&&!F.startsWith(".")},y8=([D])=>{let u=D.length;return(F)=>F.length===u&&F!=="."&&F!==".."},h8=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",v8={win32:{sep:"\\"},posix:{sep:"/"}},uB=h8==="win32"?v8.win32.sep:v8.posix.sep;FD.sep=uB;var o=Symbol("globstar **");FD.GLOBSTAR=o;var FB="[^/]",CB=FB+"*?",BB="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",EB="(?:(?!(?:\\/|^)\\.).)*?",$B=(D,u={})=>(F)=>FD(F,D,u);FD.filter=$B;var UD=(D,u={})=>Object.assign({},D,u),QB=(D)=>{if(!D||typeof D!=="object"||!Object.keys(D).length)return FD;let u=FD;return Object.assign((C,B,$={})=>u(C,B,UD(D,$)),{Minimatch:class C extends u.Minimatch{constructor(B,$={}){super(B,UD(D,$))}static defaults(B){return u.defaults(UD(D,B)).Minimatch}},AST:class C extends u.AST{constructor(B,$,E={}){super(B,$,UD(D,E))}static fromGlob(B,$={}){return u.AST.fromGlob(B,UD(D,$))}},unescape:(C,B={})=>u.unescape(C,UD(D,B)),escape:(C,B={})=>u.escape(C,UD(D,B)),filter:(C,B={})=>u.filter(C,UD(D,B)),defaults:(C)=>u.defaults(UD(D,C)),makeRe:(C,B={})=>u.makeRe(C,UD(D,B)),braceExpand:(C,B={})=>u.braceExpand(C,UD(D,B)),match:(C,B,$={})=>u.match(C,B,UD(D,$)),sep:u.sep,GLOBSTAR:o})};FD.defaults=QB;var g8=(D,u={})=>{if(Ou(D),u.nobrace||!/\{(?:(?!\{).)*\}/.test(D))return[D];return O8(D)};FD.braceExpand=g8;var XB=(D,u={})=>new zD(D,u).makeRe();FD.makeRe=XB;var ZB=(D,u,F={})=>{let C=new zD(u,F);if(D=D.filter((B)=>C.match(B)),C.options.nonull&&!D.length)D.push(u);return D};FD.match=ZB;var b8=/[?*]|[+@!]\(.*?\)|\[|\]/,JB=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class zD{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(D,u={}){if(Ou(D),u=u||{},this.options=u,this.pattern=D,this.platform=u.platform||h8,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=(...B)=>console.error(...B);this.debug(this.pattern,this.globSet);let F=this.globSet.map((B)=>this.slashSplit(B));this.globParts=this.preprocess(F),this.debug(this.pattern,this.globParts);let C=this.globParts.map((B,$,E)=>{if(this.isWindows&&this.windowsNoMagicRoot){let Q=B[0]===""&&B[1]===""&&(B[2]==="?"||!b8.test(B[2]))&&!b8.test(B[3]),X=/^[a-z]:/i.test(B[0]);if(Q)return[...B.slice(0,4),...B.slice(4).map((Z)=>this.parse(Z))];else if(X)return[B[0],...B.slice(1).map((Z)=>this.parse(Z))]}return B.map((Q)=>this.parse(Q))});if(this.debug(this.pattern,C),this.set=C.filter((B)=>B.indexOf(!1)===-1),this.isWindows)for(let B=0;B=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 B=F[F.length-1];if(C==="**"&&B==="**")return F;if(C===".."){if(B&&B!==".."&&B!=="."&&B!=="**")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;CC)F.splice(C+1,$-C);let E=F[C+1],Q=F[C+2],X=F[C+3];if(E!=="..")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;$u.length)}partsMatch(D,u,F=!1){let C=0,B=0,$=[],E="";while(CT)u=u.slice(R);else if(T>R)D=D.slice(T)}}}let{optimizationLevel:B=1}=this.options;if(B>=2)D=this.levelTwoFileOptimize(D);this.debug("matchOne",this,{file:D,pattern:u}),this.debug("matchOne",D.length,u.length);for(var $=0,E=0,Q=D.length,X=u.length;$!V.hooks?.some((A)=>A.command?.includes("claude-mem")));if(J.length!==E.hooks[Z].length)E.hooks[Z]=J.length?J:void 0,Q=!0,console.log(`\u2705 Removed ${Z} hook from ${B.name} settings`)}if(X.forEach((Z)=>{if(E.hooks[Z]===void 0)delete E.hooks[Z]}),!Object.keys(E.hooks).length)delete E.hooks;if(Q){let Z=B.path+".backup."+Date.now();W0(Z,$),console.log(`\uD83D\uDCCB Created backup: ${Z}`),W0(B.path,JSON.stringify(E,null,2)),F++,console.log(`\u2705 Updated ${B.name} settings: ${B.path}`)}else console.log(`\u2139\uFE0F No Claude Memory System hooks found in ${B.name} settings`)}let C=await z9();if(console.log(""),F>0||C){if(console.log("\u2728 Uninstallation complete!"),F>0)console.log("The Claude Memory System hooks have been removed from your settings.");if(C)console.log("The Smart Trash alias has been removed from your shell configuration."),console.log("\u26A0\uFE0F 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("\u2139\uFE0F No Claude Memory System hooks or aliases were found to remove.")}FD();import{readFileSync as G9,readdirSync as W9,statSync as _9}from"fs";import{join as M8}from"path";async function j9(D,u,F){try{let $=G9(D,"utf8").split(` +`).filter((E)=>E.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((E)=>{console.log(` ${E}`)});console.log("")}catch(C){console.log(`\u274C Could not read ${u.toLowerCase()} log: ${D}`)}}async function R8(D={}){let u=T.getLogsDirectory(),F=parseInt(D.tail)||20;try{let B=W9(u).filter(($)=>$.startsWith("claude-mem-")&&$.endsWith(".log")).map(($)=>({name:$,path:M8(u,$),mtime:_9(M8(u,$)).mtime})).sort(($,E)=>E.mtime.getTime()-$.mtime.getTime());if(B.length===0){console.log("\u274C No log files found in ~/.claude-mem/logs/");return}if(await j9(B[0].path,"Most Recent",F),D.all&&B.length>1)console.log(`\uD83D\uDCDA Found ${B.length} total log files`)}catch(C){console.log("\u274C Could not read logs directory: ~/.claude-mem/logs/"),console.log(" Run a compression first to generate logs")}}import{renameSync as Q4,existsSync as G6,mkdirSync as X4,statSync as Z4}from"fs";import{join as J4,basename as Y4}from"path";var dF=(D,u,F)=>{let C=D instanceof RegExp?L8(D,F):D,B=u instanceof RegExp?L8(u,F):u,$=C!==null&&B!=null&&M9(C,B,F);return $&&{start:$[0],end:$[1],pre:F.slice(0,$[0]),body:F.slice($[0]+C.length,$[1]),post:F.slice($[1]+B.length)}},L8=(D,u)=>{let F=u.match(D);return F?F[0]:null},M9=(D,u,F)=>{let C,B,$,E=void 0,Q,X=F.indexOf(D),Z=F.indexOf(u,X+1),J=X;if(X>=0&&Z>0){if(D===u)return[X,Z];C=[],$=F.length;while(J>=0&&!Q){if(J===X)C.push(J),X=F.indexOf(D,J+1);else if(C.length===1){let V=C.pop();if(V!==void 0)Q=[V,Z]}else{if(B=C.pop(),B!==void 0&&B<$)$=B,E=Z;Z=F.indexOf(u,J+1)}J=X=0?X:Z}if(C.length&&E!==void 0)Q=[$,E]}return Q};var I8="\x00SLASH"+Math.random()+"\x00",N8="\x00OPEN"+Math.random()+"\x00",pF="\x00CLOSE"+Math.random()+"\x00",T8="\x00COMMA"+Math.random()+"\x00",O8="\x00PERIOD"+Math.random()+"\x00",R9=new RegExp(I8,"g"),L9=new RegExp(N8,"g"),I9=new RegExp(pF,"g"),N9=new RegExp(T8,"g"),T9=new RegExp(O8,"g"),O9=/\\\\/g,w9=/\\{/g,P9=/\\}/g,k9=/\\,/g,S9=/\\./g;function lF(D){return!isNaN(D)?parseInt(D,10):D.charCodeAt(0)}function x9(D){return D.replace(O9,I8).replace(w9,N8).replace(P9,pF).replace(k9,T8).replace(S9,O8)}function v9(D){return D.replace(R9,"\\").replace(L9,"{").replace(I9,"}").replace(N9,",").replace(T9,".")}function w8(D){if(!D)return[""];let u=[],F=dF("{","}",D);if(!F)return D.split(",");let{pre:C,body:B,post:$}=F,E=C.split(",");E[E.length-1]+="{"+B+"}";let Q=w8($);if($.length)E[E.length-1]+=Q.shift(),E.push.apply(E,Q);return u.push.apply(u,E),u}function P8(D){if(!D)return[];if(D.slice(0,2)==="{}")D="\\{\\}"+D.slice(2);return Ou(x9(D),!0).map(v9)}function f9(D){return"{"+D+"}"}function b9(D){return/^-?0\d/.test(D)}function y9(D,u){return D<=u}function h9(D,u){return D>=u}function Ou(D,u){let F=[],C=dF("{","}",D);if(!C)return[D];let B=C.pre,$=C.post.length?Ou(C.post,!1):[""];if(/\$$/.test(C.pre))for(let E=0;E<$.length;E++){let Q=B+"{"+C.body+"}"+$[E];F.push(Q)}else{let E=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(C.body),Q=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(C.body),X=E||Q,Z=C.body.indexOf(",")>=0;if(!X&&!Z){if(C.post.match(/,(?!,).*\}/))return D=C.pre+"{"+C.body+pF+C.post,Ou(D);return[D]}let J;if(X)J=C.body.split(/\.\./);else if(J=w8(C.body),J.length===1&&J[0]!==void 0){if(J=Ou(J[0],!1).map(f9),J.length===1)return $.map((A)=>C.pre+J[0]+A)}let V;if(X&&J[0]!==void 0&&J[1]!==void 0){let A=lF(J[0]),U=lF(J[1]),z=Math.max(J[0].length,J[1].length),G=J.length===3&&J[2]!==void 0?Math.abs(lF(J[2])):1,W=y9;if(U0){let h=new Array(S+1).join("0");if(R<0)L="-"+h+L.slice(1);else L=h+L}}V.push(L)}}else{V=[];for(let A=0;A{if(typeof D!=="string")throw new TypeError("invalid pattern");if(D.length>65536)throw new TypeError("pattern is too long")};var g9={"[: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]},Pu=(D)=>D.replace(/[[\]\\-]/g,"\\$&"),m9=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),k8=(D)=>D.join(""),S8=(D,u)=>{let F=u;if(D.charAt(F)!=="[")throw new Error("not in a brace expression");let C=[],B=[],$=F+1,E=!1,Q=!1,X=!1,Z=!1,J=F,V="";D:while($V)C.push(Pu(V)+"-"+Pu(G));else if(G===V)C.push(Pu(G));V="",$++;continue}if(D.startsWith("-]",$+1)){C.push(Pu(G+"-")),$+=2;continue}if(D.startsWith("-",$+1)){V=G,$+=2;continue}C.push(Pu(G)),$++}if(J<$)return["",!1,0,!1];if(!C.length&&!B.length)return["$.",!1,D.length-F,!0];if(B.length===0&&C.length===1&&/^\\?.$/.test(C[0])&&!Z){let G=C[0].length===2?C[0].slice(-1):C[0];return[m9(G),!1,J-F,!1]}let A="["+(Z?"^":"")+k8(C)+"]",U="["+(Z?"":"^")+k8(B)+"]";return[C.length&&B.length?"("+A+"|"+U+")":C.length?A:U,Q,J-F,!0]};var TD=(D,{windowsPathsNoEscape:u=!1}={})=>{return u?D.replace(/\[([^\/\\])\]/g,"$1"):D.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var c9=new Set(["!","?","+","*","@"]),x8=(D)=>c9.has(D),d9="(?!(?:^|/)\\.\\.?(?:$|/))",_0="(?!\\.)",l9=new Set(["[","."]),p9=new Set(["..","."]),n9=new Set("().*{}+?[]^$\\!"),i9=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),nF="[^/]",v8=nF+"*?",f8=nF+"+?";class r{type;#D;#u;#E=!1;#B=[];#$;#W;#z;#J=!1;#Q;#q;#Y=!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.#z=this.#D===this?[]:this.#D.#z,D==="!"&&!this.#D.#J)this.#z.push(this);this.#W=this.#$?this.#$.#B.length:0}get hasMagic(){if(this.#u!==void 0)return this.#u;for(let D of this.#B){if(typeof D==="string")continue;if(D.type||D.hasMagic)return this.#u=!0}return this.#u}toString(){if(this.#q!==void 0)return this.#q;if(!this.type)return this.#q=this.#B.map((D)=>String(D)).join("");else return this.#q=this.type+"("+this.#B.map((D)=>String(D)).join("|")+")"}#X(){if(this!==this.#D)throw new Error("should only call on root");if(this.#J)return this;this.toString(),this.#J=!0;let D;while(D=this.#z.pop()){if(D.type!=="!")continue;let u=D,F=u.#$;while(F){for(let C=u.#W+1;!F.type&&Ctypeof u==="string"?u:u.toJSON()):[this.type,...this.#B.map((u)=>u.toJSON())];if(this.isStart()&&!this.type)D.unshift([]);if(this.isEnd()&&(this===this.#D||this.#D.#J&&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{let[U,z,G,W]=typeof A==="string"?r.#_(A,this.#u,Q):A.toRegExpSource(D);return this.#u=this.#u||G,this.#E=this.#E||W,U}).join(""),Z="";if(this.isStart()){if(typeof this.#B[0]==="string"){if(!(this.#B.length===1&&p9.has(this.#B[0]))){let U=l9,z=u&&U.has(X.charAt(0))||X.startsWith("\\.")&&U.has(X.charAt(2))||X.startsWith("\\.\\.")&&U.has(X.charAt(4)),G=!u&&!D&&U.has(X.charAt(0));Z=z?d9:G?_0:""}}}let J="";if(this.isEnd()&&this.#D.#J&&this.#$?.type==="!")J="(?:$|\\/)";return[Z+X+J,TD(X),this.#u=!!this.#u,this.#E]}let F=this.type==="*"||this.type==="+",C=this.type==="!"?"(?:(?!(?:":"(?:",B=this.#V(u);if(this.isStart()&&this.isEnd()&&!B&&this.type!=="!"){let Q=this.toString();return this.#B=[Q],this.type=null,this.#u=void 0,[Q,TD(this.toString()),!1,!1]}let $=!F||D||u||!_0?"":this.#V(!0);if($===B)$="";if($)B=`(?:${B})(?:${$})*?`;let E="";if(this.type==="!"&&this.#Y)E=(this.isStart()&&!u?_0:"")+f8;else{let Q=this.type==="!"?"))"+(this.isStart()&&!u&&!D?_0:"")+v8+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&$?")":this.type==="*"&&$?")?":`)${this.type}`;E=C+B+Q}return[E,TD(B),this.#u=!!this.#u,this.#E]}#V(D){return this.#B.map((u)=>{if(typeof u==="string")throw new Error("string type in extglob ast??");let[F,C,B,$]=u.toRegExpSource(D);return this.#E=this.#E||$,F}).filter((u)=>!(this.isStart()&&this.isEnd())||!!u).join("|")}static#_(D,u,F=!1){let C=!1,B="",$=!1;for(let E=0;E{return u?D.replace(/[?*()[\]]/g,"[$&]"):D.replace(/[?*()[\]\\]/g,"\\$&")};var CD=(D,u,F={})=>{if(wu(u),!F.nocomment&&u.charAt(0)==="#")return!1;return new GD(u,F).match(D)},a9=/^\*+([^+@!?\*\[\(]*)$/,r9=(D)=>(u)=>!u.startsWith(".")&&u.endsWith(D),o9=(D)=>(u)=>u.endsWith(D),s9=(D)=>{return D=D.toLowerCase(),(u)=>!u.startsWith(".")&&u.toLowerCase().endsWith(D)},t9=(D)=>{return D=D.toLowerCase(),(u)=>u.toLowerCase().endsWith(D)},e9=/^\*+\.\*+$/,DB=(D)=>!D.startsWith(".")&&D.includes("."),uB=(D)=>D!=="."&&D!==".."&&D.includes("."),FB=/^\.\*+$/,CB=(D)=>D!=="."&&D!==".."&&D.startsWith("."),BB=/^\*+$/,EB=(D)=>D.length!==0&&!D.startsWith("."),$B=(D)=>D.length!==0&&D!=="."&&D!=="..",QB=/^\?+([^+@!?\*\[\(]*)?$/,XB=([D,u=""])=>{let F=h8([D]);if(!u)return F;return u=u.toLowerCase(),(C)=>F(C)&&C.toLowerCase().endsWith(u)},ZB=([D,u=""])=>{let F=g8([D]);if(!u)return F;return u=u.toLowerCase(),(C)=>F(C)&&C.toLowerCase().endsWith(u)},JB=([D,u=""])=>{let F=g8([D]);return!u?F:(C)=>F(C)&&C.endsWith(u)},YB=([D,u=""])=>{let F=h8([D]);return!u?F:(C)=>F(C)&&C.endsWith(u)},h8=([D])=>{let u=D.length;return(F)=>F.length===u&&!F.startsWith(".")},g8=([D])=>{let u=D.length;return(F)=>F.length===u&&F!=="."&&F!==".."},m8=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",b8={win32:{sep:"\\"},posix:{sep:"/"}},qB=m8==="win32"?b8.win32.sep:b8.posix.sep;CD.sep=qB;var o=Symbol("globstar **");CD.GLOBSTAR=o;var KB="[^/]",VB=KB+"*?",AB="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",HB="(?:(?!(?:\\/|^)\\.).)*?",UB=(D,u={})=>(F)=>CD(F,D,u);CD.filter=UB;var zD=(D,u={})=>Object.assign({},D,u),zB=(D)=>{if(!D||typeof D!=="object"||!Object.keys(D).length)return CD;let u=CD;return Object.assign((C,B,$={})=>u(C,B,zD(D,$)),{Minimatch:class C extends u.Minimatch{constructor(B,$={}){super(B,zD(D,$))}static defaults(B){return u.defaults(zD(D,B)).Minimatch}},AST:class C extends u.AST{constructor(B,$,E={}){super(B,$,zD(D,E))}static fromGlob(B,$={}){return u.AST.fromGlob(B,zD(D,$))}},unescape:(C,B={})=>u.unescape(C,zD(D,B)),escape:(C,B={})=>u.escape(C,zD(D,B)),filter:(C,B={})=>u.filter(C,zD(D,B)),defaults:(C)=>u.defaults(zD(D,C)),makeRe:(C,B={})=>u.makeRe(C,zD(D,B)),braceExpand:(C,B={})=>u.braceExpand(C,zD(D,B)),match:(C,B,$={})=>u.match(C,B,zD(D,$)),sep:u.sep,GLOBSTAR:o})};CD.defaults=zB;var c8=(D,u={})=>{if(wu(D),u.nobrace||!/\{(?:(?!\{).)*\}/.test(D))return[D];return P8(D)};CD.braceExpand=c8;var GB=(D,u={})=>new GD(D,u).makeRe();CD.makeRe=GB;var WB=(D,u,F={})=>{let C=new GD(u,F);if(D=D.filter((B)=>C.match(B)),C.options.nonull&&!D.length)D.push(u);return D};CD.match=WB;var y8=/[?*]|[+@!]\(.*?\)|\[|\]/,_B=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class GD{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(D,u={}){if(wu(D),u=u||{},this.options=u,this.pattern=D,this.platform=u.platform||m8,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=(...B)=>console.error(...B);this.debug(this.pattern,this.globSet);let F=this.globSet.map((B)=>this.slashSplit(B));this.globParts=this.preprocess(F),this.debug(this.pattern,this.globParts);let C=this.globParts.map((B,$,E)=>{if(this.isWindows&&this.windowsNoMagicRoot){let Q=B[0]===""&&B[1]===""&&(B[2]==="?"||!y8.test(B[2]))&&!y8.test(B[3]),X=/^[a-z]:/i.test(B[0]);if(Q)return[...B.slice(0,4),...B.slice(4).map((Z)=>this.parse(Z))];else if(X)return[B[0],...B.slice(1).map((Z)=>this.parse(Z))]}return B.map((Q)=>this.parse(Q))});if(this.debug(this.pattern,C),this.set=C.filter((B)=>B.indexOf(!1)===-1),this.isWindows)for(let B=0;B=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 B=F[F.length-1];if(C==="**"&&B==="**")return F;if(C===".."){if(B&&B!==".."&&B!=="."&&B!=="**")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;CC)F.splice(C+1,$-C);let E=F[C+1],Q=F[C+2],X=F[C+3];if(E!=="..")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;$u.length)}partsMatch(D,u,F=!1){let C=0,B=0,$=[],E="";while(CO)u=u.slice(R);else if(O>R)D=D.slice(O)}}}let{optimizationLevel:B=1}=this.options;if(B>=2)D=this.levelTwoFileOptimize(D);this.debug("matchOne",this,{file:D,pattern:u}),this.debug("matchOne",D.length,u.length);for(var $=0,E=0,Q=D.length,X=u.length;$>> no match, partial?`,D,V,u,A),V===Q)return!0}return!1}let z;if(typeof Z==="string")z=J===Z,this.debug("string match",Z,J,z);else z=Z.test(J),this.debug("pattern match",Z,J,z);if(!z)return!1}if($===Q&&E===X)return!0;else if($===Q)return F;else if(E===X)return $===Q-1&&D[$]==="";else throw new Error("wtf?")}braceExpand(){return g8(this.pattern,this.options)}parse(D){Ou(D);let u=this.options;if(D==="**")return o;if(D==="")return"";let F,C=null;if(F=D.match(i9))C=u.dot?r9:a9;else if(F=D.match(f9))C=(u.nocase?u.dot?m9:g9:u.dot?h9:y9)(F[1]);else if(F=D.match(o9))C=(u.nocase?u.dot?t9:s9:u.dot?e9:DB)(F);else if(F=D.match(c9))C=u.dot?l9:d9;else if(F=D.match(p9))C=n9;let B=r.fromGlob(D,this.options).toMMPattern();if(C&&typeof B==="object")Reflect.defineProperty(B,"test",{value:C});return B}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?CB:u.dot?BB:EB,C=new Set(u.nocase?["i"]:[]),B=D.map((Q)=>{let X=Q.map((Z)=>{if(Z instanceof RegExp)for(let J of Z.flags.split(""))C.add(J);return typeof Z==="string"?JB(Z):Z===o?o:Z._src});return X.forEach((Z,J)=>{let V=X[J+1],A=X[J-1];if(Z!==o||A===o)return;if(A===void 0)if(V!==void 0&&V!==o)X[J+1]="(?:\\/|"+F+"\\/)?"+V;else X[J]=F;else if(V===void 0)X[J-1]=A+"(?:\\/|"+F+")?";else if(V!==o)X[J-1]=A+"(?:\\/|\\/"+F+"\\/)"+V,X[J+1]=o}),X.filter((Z)=>Z!==o).join("/")}).join("|"),[$,E]=D.length>1?["(?:",")"]:["",""];if(B="^"+$+B+E+"$",this.negate)B="^(?!"+B+").+$";try{this.regexp=new RegExp(B,[...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 B=this.set;this.debug(this.pattern,"set",B);let $=C[C.length-1];if(!$)for(let E=C.length-2;!$&&E>=0;E--)$=C[E];for(let E=0;E{typeof nF.emitWarning==="function"?nF.emitWarning(D,u,F,C):console.error(`[${F}] ${u}: ${D}`)},_0=globalThis.AbortController,m8=globalThis.AbortSignal;if(typeof _0==="undefined"){m8=class F{onabort;_onabort=[];reason;aborted=!1;addEventListener(C,B){this._onabort.push(B)}},_0=class F{constructor(){u()}signal=new m8;abort(C){if(this.signal.aborted)return;this.signal.reason=C,this.signal.aborted=!0;for(let B of this.signal._onabort)B(C);this.signal.onabort?.(C)}};let D=nF.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",u=()=>{if(!D)return;D=!1,d8("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 YB=(D)=>!c8.has(D),W$=Symbol("type"),dD=(D)=>D&&D===Math.floor(D)&&D>0&&isFinite(D),l8=(D)=>!dD(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?Pu:null;class Pu extends Array{constructor(D){super(D);this.fill(0)}}class $u{heap;length;static#D=!1;static create(D){let u=l8(D);if(!u)return[];$u.#D=!0;let F=new $u(D,u);return $u.#D=!1,F}constructor(D,u){if(!$u.#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;#E;#B;#$;#W;#z;#J;get perf(){return this.#J}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#Q;#Y;#q;#X;#F;#V;#_;#G;#A;#T;#H;#M;#I;#U;#j;#N;#K;#C;static unsafeExposeInternals(D){return{starts:D.#I,ttls:D.#U,sizes:D.#M,keyMap:D.#q,keyList:D.#X,valList:D.#F,next:D.#V,prev:D.#_,get head(){return D.#G},get tail(){return D.#A},free:D.#T,isBackgroundFetch:(u)=>D.#Z(u),backgroundFetch:(u,F,C,B)=>D.#d(u,F,C,B),moveToTail:(u)=>D.#f(u),indexes:(u)=>D.#w(u),rindexes:(u)=>D.#k(u),isStale:(u)=>D.#L(u)}}get max(){return this.#D}get maxSize(){return this.#u}get calculatedSize(){return this.#Y}get size(){return this.#Q}get fetchMethod(){return this.#W}get memoMethod(){return this.#z}get dispose(){return this.#E}get onInsert(){return this.#B}get disposeAfter(){return this.#$}constructor(D){let{max:u=0,ttl:F,ttlResolution:C=1,ttlAutopurge:B,updateAgeOnGet:$,updateAgeOnHas:E,allowStale:Q,dispose:X,onInsert:Z,disposeAfter:J,noDisposeOnSet:V,noUpdateTTL:A,maxSize:U=0,maxEntrySize:z=0,sizeCalculation:G,fetchMethod:W,memoMethod:I,noDeleteOnFetchRejection:T,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:L,allowStaleOnFetchAbort:S,ignoreFetchAbort:h,perf:ED}=D;if(ED!==void 0){if(typeof ED?.now!=="function")throw new TypeError("perf option must have a now() method if specified")}if(this.#J=ED??qB,u!==0&&!dD(u))throw new TypeError("max option must be a nonnegative integer");let PD=u?l8(u):Array;if(!PD)throw new Error("invalid max value: "+u);if(this.#D=u,this.#u=U,this.maxEntrySize=z||this.#u,this.sizeCalculation=G,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.#z=I,W!==void 0&&typeof W!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#W=W,this.#N=!!W,this.#q=new Map,this.#X=new Array(u).fill(void 0),this.#F=new Array(u).fill(void 0),this.#V=new PD(u),this.#_=new PD(u),this.#G=0,this.#A=0,this.#T=$u.create(u),this.#Q=0,this.#Y=0,typeof X==="function")this.#E=X;if(typeof Z==="function")this.#B=Z;if(typeof J==="function")this.#$=J,this.#H=[];else this.#$=void 0,this.#H=void 0;if(this.#j=!!this.#E,this.#C=!!this.#B,this.#K=!!this.#$,this.noDisposeOnSet=!!V,this.noUpdateTTL=!!A,this.noDeleteOnFetchRejection=!!T,this.allowStaleOnFetchRejection=!!L,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!h,this.maxEntrySize!==0){if(this.#u!==0){if(!dD(this.#u))throw new TypeError("maxSize must be a positive integer if specified")}if(!dD(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#y()}if(this.allowStale=!!Q,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!$,this.updateAgeOnHas=!!E,this.ttlResolution=dD(C)||C===0?C:1,this.ttlAutopurge=!!B,this.ttl=F||0,this.ttl){if(!dD(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(YB("LRU_CACHE_UNBOUNDED"))c8.add("LRU_CACHE_UNBOUNDED"),d8("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",ku)}}getRemainingTTL(D){return this.#q.has(D)?1/0:0}#S(){let D=new Pu(this.#D),u=new Pu(this.#D);this.#U=D,this.#I=u,this.#m=(B,$,E=this.#J.now())=>{if(u[B]=$!==0?E:0,D[B]=$,$!==0&&this.ttlAutopurge){let Q=setTimeout(()=>{if(this.#L(B))this.#P(this.#X[B],"expire")},$+1);if(Q.unref)Q.unref()}},this.#O=(B)=>{u[B]=D[B]!==0?this.#J.now():0},this.#R=(B,$)=>{if(D[$]){let E=D[$],Q=u[$];if(!E||!Q)return;B.ttl=E,B.start=Q,B.now=F||C();let X=B.now-Q;B.remainingTTL=E-X}};let F=0,C=()=>{let B=this.#J.now();if(this.ttlResolution>0){F=B;let $=setTimeout(()=>F=0,this.ttlResolution);if($.unref)$.unref()}return B};this.getRemainingTTL=(B)=>{let $=this.#q.get(B);if($===void 0)return 0;let E=D[$],Q=u[$];if(!E||!Q)return 1/0;let X=(F||C())-Q;return E-X},this.#L=(B)=>{let $=u[B],E=D[B];return!!E&&!!$&&(F||C())-$>E}}#O=()=>{};#R=()=>{};#m=()=>{};#L=()=>!1;#y(){let D=new Pu(this.#D);this.#Y=0,this.#M=D,this.#x=(u)=>{this.#Y-=D[u],D[u]=0},this.#v=(u,F,C,B)=>{if(this.#Z(F))return 0;if(!dD(C))if(B){if(typeof B!=="function")throw new TypeError("sizeCalculation must be a function");if(C=B(F,u),!dD(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 B=this.#u-D[u];while(this.#Y>B)this.#b(!0)}if(this.#Y+=D[u],C)C.entrySize=F,C.totalCalculatedSize=this.#Y}}#x=(D)=>{};#h=(D,u,F)=>{};#v=(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.#A;;){if(!this.#c(u))break;if(D||!this.#L(u))yield u;if(u===this.#G)break;else u=this.#_[u]}}*#k({allowStale:D=this.allowStale}={}){if(this.#Q)for(let u=this.#G;;){if(!this.#c(u))break;if(D||!this.#L(u))yield u;if(u===this.#A)break;else u=this.#V[u]}}#c(D){return D!==void 0&&this.#q.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.#k())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.#k()){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.#k())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],B=this.#Z(C)?C.__staleWhileFetching:C;if(B===void 0)continue;if(D(B,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],B=this.#Z(C)?C.__staleWhileFetching:C;if(B===void 0)continue;D.call(u,B,this.#X[F],this)}}rforEach(D,u=this){for(let F of this.#k()){let C=this.#F[F],B=this.#Z(C)?C.__staleWhileFetching:C;if(B===void 0)continue;D.call(u,B,this.#X[F],this)}}purgeStale(){let D=!1;for(let u of this.#k({allowStale:!0}))if(this.#L(u))this.#P(this.#X[u],"expire"),D=!0;return D}info(D){let u=this.#q.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 B={value:C};if(this.#U&&this.#I){let $=this.#U[u],E=this.#I[u];if($&&E){let Q=$-(this.#J.now()-E);B.ttl=Q,B.start=Date.now()}}if(this.#M)B.size=this.#M[u];return B}dump(){let D=[];for(let u of this.#w({allowStale:!0})){let F=this.#X[u],C=this.#F[u],B=this.#Z(C)?C.__staleWhileFetching:C;if(B===void 0||F===void 0)continue;let $={value:B};if(this.#U&&this.#I){$.ttl=this.#U[u];let E=this.#J.now()-this.#I[u];$.start=Math.floor(Date.now()-E)}if(this.#M)$.size=this.#M[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.#J.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:B,noDisposeOnSet:$=this.noDisposeOnSet,sizeCalculation:E=this.sizeCalculation,status:Q}=F,{noUpdateTTL:X=this.noUpdateTTL}=F,Z=this.#v(D,u,F.size||0,E);if(this.maxEntrySize&&Z>this.maxEntrySize){if(Q)Q.set="miss",Q.maxEntrySizeExceeded=!0;return this.#P(D,"set"),this}let J=this.#Q===0?void 0:this.#q.get(D);if(J===void 0){if(J=this.#Q===0?this.#A:this.#T.length!==0?this.#T.pop():this.#Q===this.#D?this.#b(!1):this.#Q,this.#X[J]=D,this.#F[J]=u,this.#q.set(D,J),this.#V[this.#A]=J,this.#_[J]=this.#A,this.#A=J,this.#Q++,this.#h(J,Z,Q),Q)Q.set="add";if(X=!1,this.#C)this.#B?.(u,D,"add")}else{this.#f(J);let V=this.#F[J];if(u!==V){if(this.#N&&this.#Z(V)){V.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:A}=V;if(A!==void 0&&!$){if(this.#j)this.#E?.(A,D,"set");if(this.#K)this.#H?.push([A,D,"set"])}}else if(!$){if(this.#j)this.#E?.(V,D,"set");if(this.#K)this.#H?.push([V,D,"set"])}if(this.#x(J),this.#h(J,Z,Q),this.#F[J]=u,Q){Q.set="replace";let A=V&&this.#Z(V)?V.__staleWhileFetching:V;if(A!==void 0)Q.oldValue=A}}else if(Q)Q.set="update";if(this.#C)this.onInsert?.(u,D,u===V?"update":"replace")}if(C!==0&&!this.#U)this.#S();if(this.#U){if(!X)this.#m(J,C,B);if(Q)this.#R(Q,J)}if(!$&&this.#K&&this.#H){let V=this.#H,A;while(A=V?.shift())this.#$?.(...A)}return this}pop(){try{while(this.#Q){let D=this.#F[this.#G];if(this.#b(!0),this.#Z(D)){if(D.__staleWhileFetching)return D.__staleWhileFetching}else if(D!==void 0)return D}}finally{if(this.#K&&this.#H){let D=this.#H,u;while(u=D?.shift())this.#$?.(...u)}}}#b(D){let u=this.#G,F=this.#X[u],C=this.#F[u];if(this.#N&&this.#Z(C))C.__abortController.abort(new Error("evicted"));else if(this.#j||this.#K){if(this.#j)this.#E?.(C,F,"evict");if(this.#K)this.#H?.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.#G=this.#A=0,this.#T.length=0;else this.#G=this.#V[u];return this.#q.delete(F),this.#Q--,u}has(D,u={}){let{updateAgeOnHas:F=this.updateAgeOnHas,status:C}=u,B=this.#q.get(D);if(B!==void 0){let $=this.#F[B];if(this.#Z($)&&$.__staleWhileFetching===void 0)return!1;if(!this.#L(B)){if(F)this.#O(B);if(C)C.has="hit",this.#R(C,B);return!0}else if(C)C.has="stale",this.#R(C,B)}else if(C)C.has="miss";return!1}peek(D,u={}){let{allowStale:F=this.allowStale}=u,C=this.#q.get(D);if(C===void 0||!F&&this.#L(C))return;let B=this.#F[C];return this.#Z(B)?B.__staleWhileFetching:B}#d(D,u,F,C){let B=u===void 0?void 0:this.#F[u];if(this.#Z(B))return B;let $=new _0,{signal:E}=F;E?.addEventListener("abort",()=>$.abort(E.reason),{signal:$.signal});let Q={signal:$.signal,options:F,context:C},X=(z,G=!1)=>{let{aborted:W}=$.signal,I=F.ignoreFetchAbort&&z!==void 0;if(F.status)if(W&&!G){if(F.status.fetchAborted=!0,F.status.fetchError=$.signal.reason,I)F.status.fetchAbortIgnored=!0}else F.status.fetchResolved=!0;if(W&&!I&&!G)return J($.signal.reason);let T=A,R=this.#F[u];if(R===A||I&&G&&R===void 0)if(z===void 0)if(T.__staleWhileFetching!==void 0)this.#F[u]=T.__staleWhileFetching;else this.#P(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 J(z)},J=(z)=>{let{aborted:G}=$.signal,W=G&&F.allowStaleOnFetchAbort,I=W||F.allowStaleOnFetchRejection,T=I||F.noDeleteOnFetchRejection,R=A;if(this.#F[u]===A){if(!T||R.__staleWhileFetching===void 0)this.#P(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},V=(z,G)=>{let W=this.#W?.(D,B,Q);if(W&&W instanceof Promise)W.then((I)=>z(I===void 0?void 0:I),G);$.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 A=new Promise(V).then(X,Z),U=Object.assign(A,{__abortController:$,__staleWhileFetching:B,__returned:void 0});if(u===void 0)this.set(D,U,{...Q.options,status:void 0}),u=this.#q.get(D);else this.#F[u]=U;return U}#Z(D){if(!this.#N)return!1;let u=D;return!!u&&u instanceof Promise&&u.hasOwnProperty("__staleWhileFetching")&&u.__abortController instanceof _0}async fetch(D,u={}){let{allowStale:F=this.allowStale,updateAgeOnGet:C=this.updateAgeOnGet,noDeleteOnStaleGet:B=this.noDeleteOnStaleGet,ttl:$=this.ttl,noDisposeOnSet:E=this.noDisposeOnSet,size:Q=0,sizeCalculation:X=this.sizeCalculation,noUpdateTTL:Z=this.noUpdateTTL,noDeleteOnFetchRejection:J=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:V=this.allowStaleOnFetchRejection,ignoreFetchAbort:A=this.ignoreFetchAbort,allowStaleOnFetchAbort:U=this.allowStaleOnFetchAbort,context:z,forceRefresh:G=!1,status:W,signal:I}=u;if(!this.#N){if(W)W.fetch="get";return this.get(D,{allowStale:F,updateAgeOnGet:C,noDeleteOnStaleGet:B,status:W})}let T={allowStale:F,updateAgeOnGet:C,noDeleteOnStaleGet:B,ttl:$,noDisposeOnSet:E,size:Q,sizeCalculation:X,noUpdateTTL:Z,noDeleteOnFetchRejection:J,allowStaleOnFetchRejection:V,allowStaleOnFetchAbort:U,ignoreFetchAbort:A,status:W,signal:I},R=this.#q.get(D);if(R===void 0){if(W)W.fetch="miss";let L=this.#d(D,R,T,z);return L.__returned=L}else{let L=this.#F[R];if(this.#Z(L)){let nD=F&&L.__staleWhileFetching!==void 0;if(W){if(W.fetch="inflight",nD)W.returnedStale=!0}return nD?L.__staleWhileFetching:L.__returned=L}let S=this.#L(R);if(!G&&!S){if(W)W.fetch="hit";if(this.#f(R),C)this.#O(R);if(W)this.#R(W,R);return L}let h=this.#d(D,R,T,z),PD=h.__staleWhileFetching!==void 0&&F;if(W){if(W.fetch=S?"stale":"refresh",PD&&S)W.returnedStale=!0}return PD?h.__staleWhileFetching:h.__returned=h}}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.#z;if(!F)throw new Error("no memoMethod provided to constructor");let{context:C,forceRefresh:B,...$}=u,E=this.get(D,$);if(!B&&E!==void 0)return E;let Q=F(D,E,{options:$,context:C});return this.set(D,Q,$),Q}get(D,u={}){let{allowStale:F=this.allowStale,updateAgeOnGet:C=this.updateAgeOnGet,noDeleteOnStaleGet:B=this.noDeleteOnStaleGet,status:$}=u,E=this.#q.get(D);if(E!==void 0){let Q=this.#F[E],X=this.#Z(Q);if($)this.#R($,E);if(this.#L(E)){if($)$.get="stale";if(!X){if(!B)this.#P(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.#f(E),C)this.#O(E);return Q}}else if($)$.get="miss"}#l(D,u){this.#_[u]=D,this.#V[D]=u}#f(D){if(D!==this.#A){if(D===this.#G)this.#G=this.#V[D];else this.#l(this.#_[D],this.#V[D]);this.#l(this.#A,D),this.#A=D}}delete(D){return this.#P(D,"delete")}#P(D,u){let F=!1;if(this.#Q!==0){let C=this.#q.get(D);if(C!==void 0)if(F=!0,this.#Q===1)this.#g(u);else{this.#x(C);let B=this.#F[C];if(this.#Z(B))B.__abortController.abort(new Error("deleted"));else if(this.#j||this.#K){if(this.#j)this.#E?.(B,D,u);if(this.#K)this.#H?.push([B,D,u])}if(this.#q.delete(D),this.#X[C]=void 0,this.#F[C]=void 0,C===this.#A)this.#A=this.#_[C];else if(C===this.#G)this.#G=this.#V[C];else{let $=this.#_[C];this.#V[$]=this.#V[C];let E=this.#V[C];this.#_[E]=this.#_[C]}this.#Q--,this.#T.push(C)}}if(this.#K&&this.#H?.length){let C=this.#H,B;while(B=C?.shift())this.#$?.(...B)}return F}clear(){return this.#g("delete")}#g(D){for(let u of this.#k({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.#j)this.#E?.(F,C,D);if(this.#K)this.#H?.push([F,C,D])}}if(this.#q.clear(),this.#F.fill(void 0),this.#X.fill(void 0),this.#U&&this.#I)this.#U.fill(0),this.#I.fill(0);if(this.#M)this.#M.fill(0);if(this.#G=0,this.#A=0,this.#T.length=0,this.#Y=0,this.#Q=0,this.#K&&this.#H){let u=this.#H,F;while(F=u?.shift())this.#$?.(...F)}}}import{posix as MB,win32 as F2}from"path";import{fileURLToPath as RB}from"url";import{lstatSync as LB,readdir as IB,readdirSync as NB,readlinkSync as TB,realpathSync as OB}from"fs";import*as wB from"fs";import{lstat as kB,readdir as SB,readlink as xB,realpath as vB}from"fs/promises";import{EventEmitter as tF}from"events";import r8 from"stream";import{StringDecoder as KB}from"string_decoder";var p8=typeof process==="object"&&process?process:{stdout:null,stderr:null},VB=(D)=>!!D&&typeof D==="object"&&(D instanceof oD||D instanceof r8||AB(D)||HB(D)),AB=(D)=>!!D&&typeof D==="object"&&D instanceof tF&&typeof D.pipe==="function"&&D.pipe!==r8.Writable.prototype.pipe,HB=(D)=>!!D&&typeof D==="object"&&D instanceof tF&&typeof D.write==="function"&&typeof D.end==="function",hD=Symbol("EOF"),gD=Symbol("maybeEmitEnd"),lD=Symbol("emittedEnd"),j0=Symbol("emittingEnd"),Su=Symbol("emittedError"),M0=Symbol("closed"),n8=Symbol("read"),R0=Symbol("flush"),i8=Symbol("flushChunk"),OD=Symbol("encoding"),Qu=Symbol("decoder"),n=Symbol("flowing"),xu=Symbol("paused"),Xu=Symbol("resume"),i=Symbol("buffer"),CD=Symbol("pipes"),a=Symbol("bufferLength"),iF=Symbol("bufferPush"),L0=Symbol("bufferShift"),e=Symbol("objectMode"),d=Symbol("destroyed"),aF=Symbol("error"),rF=Symbol("emitData"),a8=Symbol("emitEnd"),oF=Symbol("emitEnd2"),SD=Symbol("async"),sF=Symbol("abort"),I0=Symbol("aborted"),vu=Symbol("signal"),rD=Symbol("dataListeners"),qD=Symbol("discarded"),bu=(D)=>Promise.resolve().then(D),UB=(D)=>D(),zB=(D)=>D==="end"||D==="finish"||D==="prefinish",GB=(D)=>D instanceof ArrayBuffer||!!D&&typeof D==="object"&&D.constructor&&D.constructor.name==="ArrayBuffer"&&D.byteLength>=0,WB=(D)=>!Buffer.isBuffer(D)&&ArrayBuffer.isView(D);class eF{src;dest;opts;ondrain;constructor(D,u,F){this.src=D,this.dest=u,this.opts=F,this.ondrain=()=>D[Xu](),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 o8 extends eF{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 _B=(D)=>!!D.objectMode,jB=(D)=>!D.objectMode&&!!D.encoding&&D.encoding!=="buffer";class oD extends tF{[n]=!1;[xu]=!1;[CD]=[];[i]=[];[e];[OD];[SD];[Qu];[hD]=!1;[lD]=!1;[j0]=!1;[M0]=!1;[Su]=null;[a]=0;[d]=!1;[vu];[I0]=!1;[rD]=0;[qD]=!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(_B(u))this[e]=!0,this[OD]=null;else if(jB(u))this[OD]=u.encoding,this[e]=!1;else this[e]=!1,this[OD]=null;if(this[SD]=!!u.async,this[Qu]=this[OD]?new KB(this[OD]):null,u&&u.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[i]});if(u&&u.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[CD]});let{signal:F}=u;if(F)if(this[vu]=F,F.aborted)this[sF]();else F.addEventListener("abort",()=>this[sF]())}get bufferLength(){return this[a]}get encoding(){return this[OD]}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[e]}set objectMode(D){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[SD]}set["async"](D){this[SD]=this[SD]||!!D}[sF](){this[I0]=!0,this.emit("abort",this[vu]?.reason),this.destroy(this[vu]?.reason)}get aborted(){return this[I0]}set aborted(D){}write(D,u,F){if(this[I0])return!1;if(this[hD])throw new Error("write after end");if(this[d])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[SD]?bu:UB;if(!this[e]&&!Buffer.isBuffer(D)){if(WB(D))D=Buffer.from(D.buffer,D.byteOffset,D.byteLength);else if(GB(D))D=Buffer.from(D);else if(typeof D!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[e]){if(this[n]&&this[a]!==0)this[R0](!0);if(this[n])this.emit("data",D);else this[iF](D);if(this[a]!==0)this.emit("readable");if(F)C(F);return this[n]}if(!D.length){if(this[a]!==0)this.emit("readable");if(F)C(F);return this[n]}if(typeof D==="string"&&!(u===this[OD]&&!this[Qu]?.lastNeed))D=Buffer.from(D,u);if(Buffer.isBuffer(D)&&this[OD])D=this[Qu].write(D);if(this[n]&&this[a]!==0)this[R0](!0);if(this[n])this.emit("data",D);else this[iF](D);if(this[a]!==0)this.emit("readable");if(F)C(F);return this[n]}read(D){if(this[d])return null;if(this[qD]=!1,this[a]===0||D===0||D&&D>this[a])return this[gD](),null;if(this[e])D=null;if(this[i].length>1&&!this[e])this[i]=[this[OD]?this[i].join(""):Buffer.concat(this[i],this[a])];let u=this[n8](D||null,this[i][0]);return this[gD](),u}[n8](D,u){if(this[e])this[L0]();else{let F=u;if(D===F.length||D===null)this[L0]();else if(typeof F==="string")this[i][0]=F.slice(D),u=F.slice(0,D),this[a]-=D;else this[i][0]=F.subarray(D),u=F.subarray(0,D),this[a]-=D}if(this.emit("data",u),!this[i].length&&!this[hD])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[hD]=!0,this.writable=!1,this[n]||!this[xu])this[gD]();return this}[Xu](){if(this[d])return;if(!this[rD]&&!this[CD].length)this[qD]=!0;if(this[xu]=!1,this[n]=!0,this.emit("resume"),this[i].length)this[R0]();else if(this[hD])this[gD]();else this.emit("drain")}resume(){return this[Xu]()}pause(){this[n]=!1,this[xu]=!0,this[qD]=!1}get destroyed(){return this[d]}get flowing(){return this[n]}get paused(){return this[xu]}[iF](D){if(this[e])this[a]+=1;else this[a]+=D.length;this[i].push(D)}[L0](){if(this[e])this[a]-=1;else this[a]-=this[i][0].length;return this[i].shift()}[R0](D=!1){do;while(this[i8](this[L0]())&&this[i].length);if(!D&&!this[i].length&&!this[hD])this.emit("drain")}[i8](D){return this.emit("data",D),this[n]}pipe(D,u){if(this[d])return D;this[qD]=!1;let F=this[lD];if(u=u||{},D===p8.stdout||D===p8.stderr)u.end=!1;else u.end=u.end!==!1;if(u.proxyErrors=!!u.proxyErrors,F){if(u.end)D.end()}else if(this[CD].push(!u.proxyErrors?new eF(this,D,u):new o8(this,D,u)),this[SD])bu(()=>this[Xu]());else this[Xu]();return D}unpipe(D){let u=this[CD].find((F)=>F.dest===D);if(u){if(this[CD].length===1){if(this[n]&&this[rD]===0)this[n]=!1;this[CD]=[]}else this[CD].splice(this[CD].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[qD]=!1,this[rD]++,!this[CD].length&&!this[n])this[Xu]()}else if(D==="readable"&&this[a]!==0)super.emit("readable");else if(zB(D)&&this[lD])super.emit(D),this.removeAllListeners(D);else if(D==="error"&&this[Su]){let C=u;if(this[SD])bu(()=>C.call(this,this[Su]));else C.call(this,this[Su])}return F}removeListener(D,u){return this.off(D,u)}off(D,u){let F=super.off(D,u);if(D==="data"){if(this[rD]=this.listeners("data").length,this[rD]===0&&!this[qD]&&!this[CD].length)this[n]=!1}return F}removeAllListeners(D){let u=super.removeAllListeners(D);if(D==="data"||D===void 0){if(this[rD]=0,!this[qD]&&!this[CD].length)this[n]=!1}return u}get emittedEnd(){return this[lD]}[gD](){if(!this[j0]&&!this[lD]&&!this[d]&&this[i].length===0&&this[hD]){if(this[j0]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[M0])this.emit("close");this[j0]=!1}}emit(D,...u){let F=u[0];if(D!=="error"&&D!=="close"&&D!==d&&this[d])return!1;else if(D==="data")return!this[e]&&!F?!1:this[SD]?(bu(()=>this[rF](F)),!0):this[rF](F);else if(D==="end")return this[a8]();else if(D==="close"){if(this[M0]=!0,!this[lD]&&!this[d])return!1;let B=super.emit("close");return this.removeAllListeners("close"),B}else if(D==="error"){this[Su]=F,super.emit(aF,F);let B=!this[vu]||this.listeners("error").length?super.emit("error",F):!1;return this[gD](),B}else if(D==="resume"){let B=super.emit("resume");return this[gD](),B}else if(D==="finish"||D==="prefinish"){let B=super.emit(D);return this.removeAllListeners(D),B}let C=super.emit(D,...u);return this[gD](),C}[rF](D){for(let F of this[CD])if(F.dest.write(D)===!1)this.pause();let u=this[qD]?!1:super.emit("data",D);return this[gD](),u}[a8](){if(this[lD])return!1;return this[lD]=!0,this.readable=!1,this[SD]?(bu(()=>this[oF]()),!0):this[oF]()}[oF](){if(this[Qu]){let u=this[Qu].end();if(u){for(let F of this[CD])F.dest.write(u);if(!this[qD])super.emit("data",u)}}for(let u of this[CD])u.end();let D=super.emit("end");return this.removeAllListeners("end"),D}async collect(){let D=Object.assign([],{dataLength:0});if(!this[e])D.dataLength=0;let u=this.promise();return this.on("data",(F)=>{if(D.push(F),!this[e])D.dataLength+=F.length}),await u,D}async concat(){if(this[e])throw new Error("cannot concat in objectMode");let D=await this.collect();return this[OD]?D.join(""):Buffer.concat(D,D.dataLength)}async promise(){return new Promise((D,u)=>{this.on(d,()=>u(new Error("stream destroyed"))),this.on("error",(F)=>u(F)),this.on("end",()=>D())})}[Symbol.asyncIterator](){this[qD]=!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[hD])return u();let B,$,E=(J)=>{this.off("data",Q),this.off("end",X),this.off(d,Z),u(),$(J)},Q=(J)=>{this.off("error",E),this.off("end",X),this.off(d,Z),this.pause(),B({value:J,done:!!this[hD]})},X=()=>{this.off("error",E),this.off("data",Q),this.off(d,Z),u(),B({done:!0,value:void 0})},Z=()=>E(new Error("stream destroyed"));return new Promise((J,V)=>{$=V,B=J,this.once(d,Z),this.once("error",E),this.once("end",X),this.once("data",Q)})},throw:u,return:u,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[qD]=!1;let D=!1,u=()=>{return this.pause(),this.off(aF,u),this.off(d,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(aF,u),this.once(d,u),{next:F,throw:u,return:u,[Symbol.iterator](){return this}}}destroy(D){if(this[d]){if(D)this.emit("error",D);else this.emit(d);return this}this[d]=!0,this[qD]=!0,this[i].length=0,this[a]=0;let u=this;if(typeof u.close==="function"&&!this[M0])u.close();if(D)this.emit("error",D);else this.emit(d);return this}static get isStream(){return VB}}var PB=OB.native,yu={lstatSync:LB,readdir:IB,readdirSync:NB,readlinkSync:TB,realpathSync:PB,promises:{lstat:kB,readdir:SB,readlink:xB,realpath:vB}},u6=(D)=>!D||D===yu||D===wB?yu:{...yu,...D,promises:{...yu.promises,...D.promises||{}}},F6=/^\\\\\?\\([a-z]:)\\?$/i,bB=(D)=>D.replace(/\//g,"\\").replace(F6,"$1\\"),fB=/[\\\/]/,WD=0,C6=1,B6=2,xD=4,E6=6,$6=8,sD=10,Q6=12,GD=15,fu=~GD,D2=16,s8=32,hu=64,wD=128,N0=256,O0=512,t8=hu|wD|O0,yB=1023,u2=(D)=>D.isFile()?$6:D.isDirectory()?xD:D.isSymbolicLink()?sD:D.isCharacterDevice()?B6:D.isBlockDevice()?E6:D.isSocket()?Q6:D.isFIFO()?C6:WD,e8=new Map,gu=(D)=>{let u=e8.get(D);if(u)return u;let F=D.normalize("NFKD");return e8.set(D,F),F},D6=new Map,T0=(D)=>{let u=D6.get(D);if(u)return u;let F=gu(D.toLowerCase());return D6.set(D,F),F};class C2 extends ku{constructor(){super({max:256})}}class X6 extends ku{constructor(D=16384){super({maxSize:D,sizeCalculation:(u)=>u.length+1})}}var Z6=Symbol("PathScurry setAsCwd");class BD{name;root;roots;parent;nocase;isCWD=!1;#D;#u;get dev(){return this.#u}#E;get mode(){return this.#E}#B;get nlink(){return this.#B}#$;get uid(){return this.#$}#W;get gid(){return this.#W}#z;get rdev(){return this.#z}#J;get blksize(){return this.#J}#Q;get ino(){return this.#Q}#Y;get size(){return this.#Y}#q;get blocks(){return this.#q}#X;get atimeMs(){return this.#X}#F;get mtimeMs(){return this.#F}#V;get ctimeMs(){return this.#V}#_;get birthtimeMs(){return this.#_}#G;get atime(){return this.#G}#A;get mtime(){return this.#A}#T;get ctime(){return this.#T}#H;get birthtime(){return this.#H}#M;#I;#U;#j;#N;#K;#C;#S;#O;#R;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(D,u=WD,F,C,B,$,E){if(this.name=D,this.#M=B?T0(D):gu(D),this.#C=u&yB,this.nocase=B,this.roots=C,this.root=F||this,this.#S=$,this.#U=E.fullpath,this.#N=E.relative,this.#K=E.relativePosix,this.parent=E.parent,this.parent)this.#D=this.parent.#D;else this.#D=u6(E.fs)}depth(){if(this.#I!==void 0)return this.#I;if(!this.parent)return this.#I=0;return this.#I=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&=~D2,u}child(D,u){if(D===""||D===".")return this;if(D==="..")return this.parent||this;let F=this.children(),C=this.nocase?T0(D):gu(D);for(let Q of F)if(Q.#M===C)return Q;let B=this.parent?this.sep:"",$=this.#U?this.#U+B+D:void 0,E=this.newChild(D,WD,{...u,parent:this,fullpath:$});if(!this.canReaddir())E.#C|=wD;return F.push(E),E}relative(){if(this.isCWD)return"";if(this.#N!==void 0)return this.#N;let D=this.name,u=this.parent;if(!u)return this.#N=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.#K!==void 0)return this.#K;let D=this.name,u=this.parent;if(!u)return this.#K=this.fullpathPosix();let F=u.relativePosix();return F+(!F||!u.parent?"":"/")+D}fullpath(){if(this.#U!==void 0)return this.#U;let D=this.name,u=this.parent;if(!u)return this.#U=this.name;let C=u.fullpath()+(!u.parent?"":this.sep)+D;return this.#U=C}fullpathPosix(){if(this.#j!==void 0)return this.#j;if(this.sep==="/")return this.#j=this.fullpath();if(!this.parent){let C=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(C))return this.#j=`//?/${C}`;else return this.#j=C}let D=this.parent,u=D.fullpathPosix(),F=u+(!u||!D.parent?"":"/")+this.name;return this.#j=F}isUnknown(){return(this.#C&GD)===WD}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&GD)===$6}isDirectory(){return(this.#C&GD)===xD}isCharacterDevice(){return(this.#C&GD)===B6}isBlockDevice(){return(this.#C&GD)===E6}isFIFO(){return(this.#C&GD)===C6}isSocket(){return(this.#C&GD)===Q6}isSymbolicLink(){return(this.#C&sD)===sD}lstatCached(){return this.#C&s8?this:void 0}readlinkCached(){return this.#O}realpathCached(){return this.#R}readdirCached(){let D=this.children();return D.slice(0,D.provisional)}canReadlink(){if(this.#O)return!0;if(!this.parent)return!1;let D=this.#C&GD;return!(D!==WD&&D!==sD||this.#C&N0||this.#C&wD)}calledReaddir(){return!!(this.#C&D2)}isENOENT(){return!!(this.#C&wD)}isNamed(D){return!this.nocase?this.#M===gu(D):this.#M===T0(D)}async readlink(){let D=this.#O;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.#O=F}catch(u){this.#c(u.code);return}}readlinkSync(){let D=this.#O;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.#O=F}catch(u){this.#c(u.code);return}}#L(D){this.#C|=D2;for(let u=D.provisional;uF(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 B=F.slice(0,F.provisional);if(u)D(null,B);else queueMicrotask(()=>D(null,B));return}if(this.#P.push(D),this.#g)return;this.#g=!0;let C=this.fullpath();this.#D.readdir(C,{withFileTypes:!0},(B,$)=>{if(B)this.#w(B.code),F.provisional=0;else{for(let E of $)this.#b(E,F);this.#L(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.#b(C,D);this.#L(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.#b(F,D);this.#L(D)}catch(F){this.#w(F.code),D.provisional=0}return D.slice(0,D.provisional)}canReaddir(){if(this.#C&t8)return!1;let D=GD&this.#C;if(!(D===WD||D===xD||D===sD))return!1;return!0}shouldWalk(D,u){return(this.#C&xD)===xD&&!(this.#C&t8)&&!D.has(this)&&(!u||u(this))}async realpath(){if(this.#R)return this.#R;if((O0|N0|wD)&this.#C)return;try{let D=await this.#D.promises.realpath(this.fullpath());return this.#R=this.resolve(D)}catch(D){this.#h()}}realpathSync(){if(this.#R)return this.#R;if((O0|N0|wD)&this.#C)return;try{let D=this.#D.realpathSync(this.fullpath());return this.#R=this.resolve(D)}catch(D){this.#h()}}[Z6](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.#N=F.join(this.sep),C.#K=F.join("/"),C=C.parent,F.push("..");C=D;while(C&&C.parent&&!u.has(C))C.#N=void 0,C.#K=void 0,C=C.parent}}class w0 extends BD{sep="\\";splitSep=fB;constructor(D,u=WD,F,C,B,$,E){super(D,u,F,C,B,$,E)}newChild(D,u=WD,F={}){return new w0(D,u,this.root,this.roots,this.nocase,this.childrenCache(),F)}getRootString(D){return F2.parse(D).root}getRoot(D){if(D=bB(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 mu(D,this).root}sameRoot(D,u=this.root.name){return D=D.toUpperCase().replace(/\//g,"\\").replace(F6,"$1\\"),D===u}}class P0 extends BD{splitSep="/";sep="/";constructor(D,u=WD,F,C,B,$,E){super(D,u,F,C,B,$,E)}getRootString(D){return D.startsWith("/")?"/":""}getRoot(D){return this.root}newChild(D,u=WD,F={}){return new P0(D,u,this.root,this.roots,this.nocase,this.childrenCache(),F)}}class B2{root;rootPath;roots;cwd;#D;#u;#E;nocase;#B;constructor(D=process.cwd(),u,F,{nocase:C,childrenCacheSize:B=16384,fs:$=yu}={}){if(this.#B=u6($),D instanceof URL||D.startsWith("file://"))D=RB(D);let E=u.resolve(D);this.roots=Object.create(null),this.rootPath=this.parseRootPath(E),this.#D=new C2,this.#u=new C2,this.#E=new X6(B);let Q=E.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.#B),this.roots[this.rootPath]=this.root;let X=this.root,Z=Q.length-1,J=u.sep,V=this.rootPath,A=!1;for(let U of Q){let z=Z--;X=X.child(U,{relative:new Array(z).fill("..").join(J),relativePosix:new Array(z).fill("..").join("/"),fullpath:V+=(A?"":J)+U}),A=!0}this.cwd=X}depth(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.depth()}childrenCache(){return this.#E}resolve(...D){let u="";for(let B=D.length-1;B>=0;B--){let $=D[B];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 B=D.length-1;B>=0;B--){let $=D[B];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 BD))u=D,D=this.cwd;let{withFileTypes:F}=u;if(!D.canReaddir())return[];else{let C=await D.readdir();return F?C:C.map((B)=>B.name)}}readdirSync(D=this.cwd,u={withFileTypes:!0}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof BD))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 BD))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 BD))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 BD))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 BD))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 BD))u=D,D=this.cwd;let{withFileTypes:F=!0,follow:C=!1,filter:B,walkFilter:$}=u,E=[];if(!B||B(D))E.push(F?D:D.fullpath());let Q=new Set,X=(J,V)=>{Q.add(J),J.readdirCB((A,U)=>{if(A)return V(A);let z=U.length;if(!z)return V();let G=()=>{if(--z===0)V()};for(let W of U){if(!B||B(W))E.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,G):G());else if(W.shouldWalk(Q,$))X(W,G);else G()}},!0)},Z=D;return new Promise((J,V)=>{X(Z,(A)=>{if(A)return V(A);J(E)})})}walkSync(D=this.cwd,u={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof BD))u=D,D=this.cwd;let{withFileTypes:F=!0,follow:C=!1,filter:B,walkFilter:$}=u,E=[];if(!B||B(D))E.push(F?D:D.fullpath());let Q=new Set([D]);for(let X of Q){let Z=X.readdirSync();for(let J of Z){if(!B||B(J))E.push(F?J:J.fullpath());let V=J;if(J.isSymbolicLink()){if(!(C&&(V=J.realpathSync())))continue;if(V.isUnknown())V.lstatSync()}if(V.shouldWalk(Q,$))Q.add(V)}}return E}[Symbol.asyncIterator](){return this.iterate()}iterate(D=this.cwd,u={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof BD))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 BD))u=D,D=this.cwd;let{withFileTypes:F=!0,follow:C=!1,filter:B,walkFilter:$}=u;if(!B||B(D))yield F?D:D.fullpath();let E=new Set([D]);for(let Q of E){let X=Q.readdirSync();for(let Z of X){if(!B||B(Z))yield F?Z:Z.fullpath();let J=Z;if(Z.isSymbolicLink()){if(!(C&&(J=Z.realpathSync())))continue;if(J.isUnknown())J.lstatSync()}if(J.shouldWalk(E,$))E.add(J)}}}stream(D=this.cwd,u={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof BD))u=D,D=this.cwd;let{withFileTypes:F=!0,follow:C=!1,filter:B,walkFilter:$}=u,E=new oD({objectMode:!0});if(!B||B(D))E.write(F?D:D.fullpath());let Q=new Set,X=[D],Z=0,J=()=>{let V=!1;while(!V){let A=X.shift();if(!A){if(Z===0)E.end();return}Z++,Q.add(A);let U=(G,W,I=!1)=>{if(G)return E.emit("error",G);if(C&&!I){let T=[];for(let R of W)if(R.isSymbolicLink())T.push(R.realpath().then((L)=>L?.isUnknown()?L.lstat():L));if(T.length){Promise.all(T).then(()=>U(null,W,!0));return}}for(let T of W)if(T&&(!B||B(T))){if(!E.write(F?T:T.fullpath()))V=!0}Z--;for(let T of W){let R=T.realpathCached()||T;if(R.shouldWalk(Q,$))X.push(R)}if(V&&!E.flowing)E.once("drain",J);else if(!z)J()},z=!0;A.readdirCB(U,!0),z=!1}};return J(),E}streamSync(D=this.cwd,u={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof BD))u=D,D=this.cwd;let{withFileTypes:F=!0,follow:C=!1,filter:B,walkFilter:$}=u,E=new oD({objectMode:!0}),Q=new Set;if(!B||B(D))E.write(F?D:D.fullpath());let X=[D],Z=0,J=()=>{let V=!1;while(!V){let A=X.shift();if(!A){if(Z===0)E.end();return}Z++,Q.add(A);let U=A.readdirSync();for(let z of U)if(!B||B(z)){if(!E.write(F?z:z.fullpath()))V=!0}Z--;for(let z of U){let G=z;if(z.isSymbolicLink()){if(!(C&&(G=z.realpathSync())))continue;if(G.isUnknown())G.lstatSync()}if(G.shouldWalk(Q,$))X.push(G)}}if(V&&!E.flowing)E.once("drain",J)};return J(),E}chdir(D=this.cwd){let u=this.cwd;this.cwd=typeof D==="string"?this.cwd.resolve(D):D,this.cwd[Z6](u)}}class mu extends B2{sep="\\";constructor(D=process.cwd(),u={}){let{nocase:F=!0}=u;super(D,F2,"\\",{...u,nocase:F});this.nocase=F;for(let C=this.cwd;C;C=C.parent)C.nocase=this.nocase}parseRootPath(D){return F2.parse(D).root.toUpperCase()}newRoot(D){return new w0(this.rootPath,xD,void 0,this.roots,this.nocase,this.childrenCache(),{fs:D})}isAbsolute(D){return D.startsWith("/")||D.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(D)}}class cu extends B2{sep="/";constructor(D=process.cwd(),u={}){let{nocase:F=!1}=u;super(D,MB,"/",{...u,nocase:F});this.nocase=F}parseRootPath(D){return"/"}newRoot(D){return new P0(this.rootPath,xD,void 0,this.roots,this.nocase,this.childrenCache(),{fs:D})}isAbsolute(D){return D.startsWith("/")}}class k0 extends cu{constructor(D=process.cwd(),u={}){let{nocase:F=!0}=u;super(D,{...u,nocase:F})}}var k$=process.platform==="win32"?w0:P0,J6=process.platform==="win32"?mu:process.platform==="darwin"?k0:cu;var hB=(D)=>D.length>=1,gB=(D)=>D.length>=1;class Zu{#D;#u;#E;length;#B;#$;#W;#z;#J;#Q;#Y=!0;constructor(D,u,F,C){if(!hB(D))throw new TypeError("empty pattern list");if(!gB(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.#E=F,this.#B=C,this.#E===0){if(this.isUNC()){let[B,$,E,Q,...X]=this.#D,[Z,J,V,A,...U]=this.#u;if(X[0]==="")X.shift(),U.shift();let z=[B,$,E,Q,""].join("/"),G=[Z,J,V,A,""].join("/");this.#D=[z,...X],this.#u=[G,...U],this.length=this.#D.length}else if(this.isDrive()||this.isAbsolute()){let[B,...$]=this.#D,[E,...Q]=this.#u;if($[0]==="")$.shift(),Q.shift();let X=B+"/",Z=E+"/";this.#D=[X,...$],this.#u=[Z,...Q],this.length=this.#D.length}}}pattern(){return this.#D[this.#E]}isString(){return typeof this.#D[this.#E]==="string"}isGlobstar(){return this.#D[this.#E]===o}isRegExp(){return this.#D[this.#E]instanceof RegExp}globString(){return this.#W=this.#W||(this.#E===0?this.isAbsolute()?this.#u[0]+this.#u.slice(1).join("/"):this.#u.join("/"):this.#u.slice(this.#E).join("/"))}hasMore(){return this.length>this.#E+1}rest(){if(this.#$!==void 0)return this.#$;if(!this.hasMore())return this.#$=null;return this.#$=new Zu(this.#D,this.#u,this.#E+1,this.#B),this.#$.#Q=this.#Q,this.#$.#J=this.#J,this.#$.#z=this.#z,this.#$}isUNC(){let D=this.#D;return this.#J!==void 0?this.#J:this.#J=this.#B==="win32"&&this.#E===0&&D[0]===""&&D[1]===""&&typeof D[2]==="string"&&!!D[2]&&typeof D[3]==="string"&&!!D[3]}isDrive(){let D=this.#D;return this.#z!==void 0?this.#z:this.#z=this.#B==="win32"&&this.#E===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.#E===0?D:""}checkFollowGlobstar(){return!(this.#E===0||!this.isGlobstar()||!this.#Y)}markFollowGlobstar(){if(this.#E===0||!this.isGlobstar()||!this.#Y)return!1;return this.#Y=!1,!0}}var mB=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class du{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(D,{nobrace:u,nocase:F,noext:C,noglobstar:B,platform:$=mB}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=$,this.mmopts={dot:!0,nobrace:u,nocase:F,noext:C,noglobstar:B,optimizationLevel:2,platform:$,nocomment:!0,nonegate:!0};for(let E of D)this.add(E)}add(D){let u=new zD(D,this.mmopts);for(let F=0;F[D,!!(u&2),!!(u&1)])}}class Y6{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 lu{hasWalkedCache;matches=new q6;subwalks=new Y6;patterns;follow;dot;opts;constructor(D,u){this.opts=D,this.follow=!!D.follow,this.dot=!!D.dot,this.hasWalkedCache=u?u.copy():new E2}processPatterns(D,u){this.patterns=u;let F=u.map((C)=>[D,C]);for(let[C,B]of F){this.hasWalkedCache.storeWalked(C,B);let $=B.root(),E=B.isAbsolute()&&this.opts.absolute!==!1;if($){C=C.resolve($==="/"&&this.opts.root!==void 0?this.opts.root:$);let J=B.rest();if(!J){this.matches.add(C,!0,!1);continue}else B=J}if(C.isENOENT())continue;let Q,X,Z=!1;while(typeof(Q=B.pattern())==="string"&&(X=B.rest()))C=C.resolve(Q),B=X,Z=!0;if(Q=B.pattern(),X=B.rest(),Z){if(this.hasWalkedCache.hasWalked(C,B))continue;this.hasWalkedCache.storeWalked(C,B)}if(typeof Q==="string"){let J=Q===".."||Q===""||Q===".";this.matches.add(C.resolve(Q),E,J);continue}else if(Q===o){if(!C.isSymbolicLink()||this.follow||B.checkFollowGlobstar())this.subwalks.add(C,B);let J=X?.pattern(),V=X?.rest();if(!X||(J===""||J===".")&&!V)this.matches.add(C,E,J===""||J===".");else if(J===".."){let A=C.parent||C;if(!V)this.matches.add(A,E,!0);else if(!this.hasWalkedCache.hasWalked(A,V))this.subwalks.add(A,V)}}else if(Q instanceof RegExp)this.subwalks.add(C,B)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new lu(this.opts,this.hasWalkedCache)}filterEntries(D,u){let F=this.subwalks.get(D),C=this.child();for(let B of u)for(let $ of F){let E=$.isAbsolute(),Q=$.pattern(),X=$.rest();if(Q===o)C.testGlobstar(B,$,X,E);else if(Q instanceof RegExp)C.testRegExp(B,Q,X,E);else C.testString(B,Q,X,E)}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 B=F.pattern();if(typeof B==="string"&&B!==".."&&B!==""&&B!==".")this.testString(D,B,F.rest(),C);else if(B===".."){let $=D.parent||D;this.subwalks.add($,F)}else if(B instanceof RegExp)this.testRegExp(D,B,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 cB=(D,u)=>typeof D==="string"?new du([D],u):Array.isArray(D)?new du(D,u):D;class $2{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#D=[];#u;#E;signal;maxDepth;includeChildMatches;constructor(D,u,F){if(this.patterns=D,this.path=u,this.opts=F,this.#E=!F.posix&&F.platform==="win32"?"\\":"/",this.includeChildMatches=F.includeChildMatches!==!1,F.ignore||!this.includeChildMatches){if(this.#u=cB(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})}#B(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 B=D.isUnknown()||this.opts.stat?await D.lstat():D;if(this.opts.follow&&this.opts.nodir&&B?.isSymbolicLink()){let $=await B.realpath();if($&&($.isUnknown()||this.opts.stat))await $.lstat()}return this.matchCheckTest(B,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.#B(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 B=D.isUnknown()||this.opts.stat?D.lstatSync():D;if(this.opts.follow&&this.opts.nodir&&B?.isSymbolicLink()){let $=B.realpathSync();if($&&($?.isUnknown()||this.opts.stat))$.lstatSync()}return this.matchCheckTest(B,u)}matchFinish(D,u){if(this.#B(D))return;if(!this.includeChildMatches&&this.#u?.add){let B=`${D.relativePosix()}/**`;this.#u.add(B)}let F=this.opts.absolute===void 0?u:this.opts.absolute;this.seen.add(D);let C=this.opts.mark&&D.isDirectory()?this.#E:"";if(this.opts.withFileTypes)this.matchEmit(D);else if(F){let B=this.opts.posix?D.fullpathPosix():D.fullpath();this.matchEmit(B+C)}else{let B=this.opts.posix?D.relativePosix():D.relative(),$=this.opts.dotRelative&&!B.startsWith(".."+this.#E)?"."+this.#E:"";this.matchEmit(!B?"."+C:$+B+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 lu(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 B=1,$=()=>{if(--B===0)C()};for(let[E,Q,X]of F.matches.entries()){if(this.#B(E))continue;B++,this.match(E,Q,X).then(()=>$())}for(let E of F.subwalkTargets()){if(this.maxDepth!==1/0&&E.depth()>=this.maxDepth)continue;B++;let Q=E.readdirCached();if(E.calledReaddir())this.walkCB3(E,Q,F,$);else E.readdirCB((X,Z)=>this.walkCB3(E,Z,F,$),!0)}$()}walkCB3(D,u,F,C){F=F.filterEntries(D,u);let B=1,$=()=>{if(--B===0)C()};for(let[E,Q,X]of F.matches.entries()){if(this.#B(E))continue;B++,this.match(E,Q,X).then(()=>$())}for(let[E,Q]of F.subwalks.entries())B++,this.walkCB2(E,Q,F.child(),$);$()}walkCBSync(D,u,F){if(this.signal?.aborted)F();this.walkCB2Sync(D,u,new lu(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 B=1,$=()=>{if(--B===0)C()};for(let[E,Q,X]of F.matches.entries()){if(this.#B(E))continue;this.matchSync(E,Q,X)}for(let E of F.subwalkTargets()){if(this.maxDepth!==1/0&&E.depth()>=this.maxDepth)continue;B++;let Q=E.readdirSync();this.walkCB3Sync(E,Q,F,$)}$()}walkCB3Sync(D,u,F,C){F=F.filterEntries(D,u);let B=1,$=()=>{if(--B===0)C()};for(let[E,Q,X]of F.matches.entries()){if(this.#B(E))continue;this.matchSync(E,Q,X)}for(let[E,Q]of F.subwalks.entries())B++,this.walkCB2Sync(E,Q,F.child(),$);$()}}class S0 extends $2{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 x0 extends $2{results;constructor(D,u,F){super(D,u,F);this.results=new oD({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 lB=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class vD{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=dB(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||lB,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"?mu:u.platform==="darwin"?k0:u.platform?cu:J6;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},B=this.pattern.map((Q)=>new zD(Q,C)),[$,E]=B.reduce((Q,X)=>{return Q[0].push(...X.set),Q[1].push(...X.globParts),Q},[[],[]]);this.patterns=$.map((Q,X)=>{let Z=E[X];if(!Z)throw new Error("invalid pattern object");return new Zu(Q,Z,0,this.platform)})}async walk(){return[...await new S0(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 S0(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 x0(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 x0(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 Q2=(D,u={})=>{if(!Array.isArray(D))D=[D];for(let F of D)if(new zD(F,u).hasMagic())return!0;return!1};function b0(D,u={}){return new vD(D,u).streamSync()}function V6(D,u={}){return new vD(D,u).stream()}function A6(D,u={}){return new vD(D,u).walkSync()}async function K6(D,u={}){return new vD(D,u).walk()}function f0(D,u={}){return new vD(D,u).iterateSync()}function H6(D,u={}){return new vD(D,u).iterate()}var pB=b0,nB=Object.assign(V6,{sync:b0}),iB=f0,aB=Object.assign(H6,{sync:f0}),rB=Object.assign(A6,{stream:b0,iterate:f0}),v0=Object.assign(K6,{glob:K6,globSync:A6,sync:rB,globStream:V6,stream:nB,globStreamSync:b0,streamSync:pB,globIterate:H6,iterate:aB,globIterateSync:f0,iterateSync:iB,Glob:vD,hasMagic:Q2,escape:Eu,unescape:TD});v0.glob=v0;HD();async function z6(D,u={}){let F=O.getInstance().getTrashDirectory();if(!U6(F))sB(F,{recursive:!0});let C=Array.isArray(D)?D:[D];for(let B of C){let $=await v0(B),E=$.length>0?$:[B];for(let Q of E)try{if(!U6(Q)){if(!u.force){console.error(`trash: ${Q}: No such file or directory`);continue}continue}if(tB(Q).isDirectory()&&!u.recursive){if(!u.force){console.error(`trash: ${Q}: is a directory`);continue}}let Z=D4(Q),J=Date.now(),V=eB(F,`${Z}.${J}`);oB(Q,V),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 W6,statSync as _6}from"fs";import{join as j6}from"path";HD();function u4(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 G6(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 M6(D){let u=0,F=W6(D);for(let C of F){let B=j6(D,C),$=_6(B);if($.isDirectory())u+=M6(B);else u+=$.size}return u}async function R6(){let D=O.getInstance().getTrashDirectory();try{let u=W6(D);if(u.length===0){DD.info("\uD83D\uDDD1\uFE0F Trash is empty");return}let F=u.map((E)=>{let Q=j6(D,E),X=_6(Q),{name:Z,timestamp:J}=u4(E),V=X.isDirectory()?M6(Q):X.size;return{originalName:Z,trashedName:E,size:V,trashedAt:new Date(J),isDirectory:X.isDirectory()}});F.sort((E,Q)=>Q.trashedAt.getTime()-E.trashedAt.getTime()),console.log(` +>>> no match, partial?`,D,V,u,A),V===Q)return!0}return!1}let z;if(typeof Z==="string")z=J===Z,this.debug("string match",Z,J,z);else z=Z.test(J),this.debug("pattern match",Z,J,z);if(!z)return!1}if($===Q&&E===X)return!0;else if($===Q)return F;else if(E===X)return $===Q-1&&D[$]==="";else throw new Error("wtf?")}braceExpand(){return c8(this.pattern,this.options)}parse(D){wu(D);let u=this.options;if(D==="**")return o;if(D==="")return"";let F,C=null;if(F=D.match(BB))C=u.dot?$B:EB;else if(F=D.match(a9))C=(u.nocase?u.dot?t9:s9:u.dot?o9:r9)(F[1]);else if(F=D.match(QB))C=(u.nocase?u.dot?ZB:XB:u.dot?JB:YB)(F);else if(F=D.match(e9))C=u.dot?uB:DB;else if(F=D.match(FB))C=CB;let B=r.fromGlob(D,this.options).toMMPattern();if(C&&typeof B==="object")Reflect.defineProperty(B,"test",{value:C});return B}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?VB:u.dot?AB:HB,C=new Set(u.nocase?["i"]:[]),B=D.map((Q)=>{let X=Q.map((Z)=>{if(Z instanceof RegExp)for(let J of Z.flags.split(""))C.add(J);return typeof Z==="string"?_B(Z):Z===o?o:Z._src});return X.forEach((Z,J)=>{let V=X[J+1],A=X[J-1];if(Z!==o||A===o)return;if(A===void 0)if(V!==void 0&&V!==o)X[J+1]="(?:\\/|"+F+"\\/)?"+V;else X[J]=F;else if(V===void 0)X[J-1]=A+"(?:\\/|"+F+")?";else if(V!==o)X[J-1]=A+"(?:\\/|\\/"+F+"\\/)"+V,X[J+1]=o}),X.filter((Z)=>Z!==o).join("/")}).join("|"),[$,E]=D.length>1?["(?:",")"]:["",""];if(B="^"+$+B+E+"$",this.negate)B="^(?!"+B+").+$";try{this.regexp=new RegExp(B,[...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 B=this.set;this.debug(this.pattern,"set",B);let $=C[C.length-1];if(!$)for(let E=C.length-2;!$&&E>=0;E--)$=C[E];for(let E=0;E{typeof iF.emitWarning==="function"?iF.emitWarning(D,u,F,C):console.error(`[${F}] ${u}: ${D}`)},j0=globalThis.AbortController,d8=globalThis.AbortSignal;if(typeof j0==="undefined"){d8=class F{onabort;_onabort=[];reason;aborted=!1;addEventListener(C,B){this._onabort.push(B)}},j0=class F{constructor(){u()}signal=new d8;abort(C){if(this.signal.aborted)return;this.signal.reason=C,this.signal.aborted=!0;for(let B of this.signal._onabort)B(C);this.signal.onabort?.(C)}};let D=iF.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",u=()=>{if(!D)return;D=!1,p8("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 MB=(D)=>!l8.has(D),c$=Symbol("type"),lD=(D)=>D&&D===Math.floor(D)&&D>0&&isFinite(D),n8=(D)=>!lD(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?ku:null;class ku extends Array{constructor(D){super(D);this.fill(0)}}class Qu{heap;length;static#D=!1;static create(D){let u=n8(D);if(!u)return[];Qu.#D=!0;let F=new Qu(D,u);return Qu.#D=!1,F}constructor(D,u){if(!Qu.#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 Su{#D;#u;#E;#B;#$;#W;#z;#J;get perf(){return this.#J}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#Q;#q;#Y;#X;#F;#V;#_;#G;#A;#T;#H;#M;#I;#U;#j;#N;#K;#C;static unsafeExposeInternals(D){return{starts:D.#I,ttls:D.#U,sizes:D.#M,keyMap:D.#Y,keyList:D.#X,valList:D.#F,next:D.#V,prev:D.#_,get head(){return D.#G},get tail(){return D.#A},free:D.#T,isBackgroundFetch:(u)=>D.#Z(u),backgroundFetch:(u,F,C,B)=>D.#d(u,F,C,B),moveToTail:(u)=>D.#b(u),indexes:(u)=>D.#w(u),rindexes:(u)=>D.#k(u),isStale:(u)=>D.#L(u)}}get max(){return this.#D}get maxSize(){return this.#u}get calculatedSize(){return this.#q}get size(){return this.#Q}get fetchMethod(){return this.#W}get memoMethod(){return this.#z}get dispose(){return this.#E}get onInsert(){return this.#B}get disposeAfter(){return this.#$}constructor(D){let{max:u=0,ttl:F,ttlResolution:C=1,ttlAutopurge:B,updateAgeOnGet:$,updateAgeOnHas:E,allowStale:Q,dispose:X,onInsert:Z,disposeAfter:J,noDisposeOnSet:V,noUpdateTTL:A,maxSize:U=0,maxEntrySize:z=0,sizeCalculation:G,fetchMethod:W,memoMethod:I,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:L,allowStaleOnFetchAbort:S,ignoreFetchAbort:h,perf:XD}=D;if(XD!==void 0){if(typeof XD?.now!=="function")throw new TypeError("perf option must have a now() method if specified")}if(this.#J=XD??jB,u!==0&&!lD(u))throw new TypeError("max option must be a nonnegative integer");let PD=u?n8(u):Array;if(!PD)throw new Error("invalid max value: "+u);if(this.#D=u,this.#u=U,this.maxEntrySize=z||this.#u,this.sizeCalculation=G,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.#z=I,W!==void 0&&typeof W!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#W=W,this.#N=!!W,this.#Y=new Map,this.#X=new Array(u).fill(void 0),this.#F=new Array(u).fill(void 0),this.#V=new PD(u),this.#_=new PD(u),this.#G=0,this.#A=0,this.#T=Qu.create(u),this.#Q=0,this.#q=0,typeof X==="function")this.#E=X;if(typeof Z==="function")this.#B=Z;if(typeof J==="function")this.#$=J,this.#H=[];else this.#$=void 0,this.#H=void 0;if(this.#j=!!this.#E,this.#C=!!this.#B,this.#K=!!this.#$,this.noDisposeOnSet=!!V,this.noUpdateTTL=!!A,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!L,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!h,this.maxEntrySize!==0){if(this.#u!==0){if(!lD(this.#u))throw new TypeError("maxSize must be a positive integer if specified")}if(!lD(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#y()}if(this.allowStale=!!Q,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!$,this.updateAgeOnHas=!!E,this.ttlResolution=lD(C)||C===0?C:1,this.ttlAutopurge=!!B,this.ttl=F||0,this.ttl){if(!lD(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(MB("LRU_CACHE_UNBOUNDED"))l8.add("LRU_CACHE_UNBOUNDED"),p8("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",Su)}}getRemainingTTL(D){return this.#Y.has(D)?1/0:0}#S(){let D=new ku(this.#D),u=new ku(this.#D);this.#U=D,this.#I=u,this.#m=(B,$,E=this.#J.now())=>{if(u[B]=$!==0?E:0,D[B]=$,$!==0&&this.ttlAutopurge){let Q=setTimeout(()=>{if(this.#L(B))this.#P(this.#X[B],"expire")},$+1);if(Q.unref)Q.unref()}},this.#O=(B)=>{u[B]=D[B]!==0?this.#J.now():0},this.#R=(B,$)=>{if(D[$]){let E=D[$],Q=u[$];if(!E||!Q)return;B.ttl=E,B.start=Q,B.now=F||C();let X=B.now-Q;B.remainingTTL=E-X}};let F=0,C=()=>{let B=this.#J.now();if(this.ttlResolution>0){F=B;let $=setTimeout(()=>F=0,this.ttlResolution);if($.unref)$.unref()}return B};this.getRemainingTTL=(B)=>{let $=this.#Y.get(B);if($===void 0)return 0;let E=D[$],Q=u[$];if(!E||!Q)return 1/0;let X=(F||C())-Q;return E-X},this.#L=(B)=>{let $=u[B],E=D[B];return!!E&&!!$&&(F||C())-$>E}}#O=()=>{};#R=()=>{};#m=()=>{};#L=()=>!1;#y(){let D=new ku(this.#D);this.#q=0,this.#M=D,this.#x=(u)=>{this.#q-=D[u],D[u]=0},this.#v=(u,F,C,B)=>{if(this.#Z(F))return 0;if(!lD(C))if(B){if(typeof B!=="function")throw new TypeError("sizeCalculation must be a function");if(C=B(F,u),!lD(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 B=this.#u-D[u];while(this.#q>B)this.#f(!0)}if(this.#q+=D[u],C)C.entrySize=F,C.totalCalculatedSize=this.#q}}#x=(D)=>{};#h=(D,u,F)=>{};#v=(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.#A;;){if(!this.#c(u))break;if(D||!this.#L(u))yield u;if(u===this.#G)break;else u=this.#_[u]}}*#k({allowStale:D=this.allowStale}={}){if(this.#Q)for(let u=this.#G;;){if(!this.#c(u))break;if(D||!this.#L(u))yield u;if(u===this.#A)break;else u=this.#V[u]}}#c(D){return D!==void 0&&this.#Y.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.#k())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.#k()){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.#k())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],B=this.#Z(C)?C.__staleWhileFetching:C;if(B===void 0)continue;if(D(B,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],B=this.#Z(C)?C.__staleWhileFetching:C;if(B===void 0)continue;D.call(u,B,this.#X[F],this)}}rforEach(D,u=this){for(let F of this.#k()){let C=this.#F[F],B=this.#Z(C)?C.__staleWhileFetching:C;if(B===void 0)continue;D.call(u,B,this.#X[F],this)}}purgeStale(){let D=!1;for(let u of this.#k({allowStale:!0}))if(this.#L(u))this.#P(this.#X[u],"expire"),D=!0;return D}info(D){let u=this.#Y.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 B={value:C};if(this.#U&&this.#I){let $=this.#U[u],E=this.#I[u];if($&&E){let Q=$-(this.#J.now()-E);B.ttl=Q,B.start=Date.now()}}if(this.#M)B.size=this.#M[u];return B}dump(){let D=[];for(let u of this.#w({allowStale:!0})){let F=this.#X[u],C=this.#F[u],B=this.#Z(C)?C.__staleWhileFetching:C;if(B===void 0||F===void 0)continue;let $={value:B};if(this.#U&&this.#I){$.ttl=this.#U[u];let E=this.#J.now()-this.#I[u];$.start=Math.floor(Date.now()-E)}if(this.#M)$.size=this.#M[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.#J.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:B,noDisposeOnSet:$=this.noDisposeOnSet,sizeCalculation:E=this.sizeCalculation,status:Q}=F,{noUpdateTTL:X=this.noUpdateTTL}=F,Z=this.#v(D,u,F.size||0,E);if(this.maxEntrySize&&Z>this.maxEntrySize){if(Q)Q.set="miss",Q.maxEntrySizeExceeded=!0;return this.#P(D,"set"),this}let J=this.#Q===0?void 0:this.#Y.get(D);if(J===void 0){if(J=this.#Q===0?this.#A:this.#T.length!==0?this.#T.pop():this.#Q===this.#D?this.#f(!1):this.#Q,this.#X[J]=D,this.#F[J]=u,this.#Y.set(D,J),this.#V[this.#A]=J,this.#_[J]=this.#A,this.#A=J,this.#Q++,this.#h(J,Z,Q),Q)Q.set="add";if(X=!1,this.#C)this.#B?.(u,D,"add")}else{this.#b(J);let V=this.#F[J];if(u!==V){if(this.#N&&this.#Z(V)){V.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:A}=V;if(A!==void 0&&!$){if(this.#j)this.#E?.(A,D,"set");if(this.#K)this.#H?.push([A,D,"set"])}}else if(!$){if(this.#j)this.#E?.(V,D,"set");if(this.#K)this.#H?.push([V,D,"set"])}if(this.#x(J),this.#h(J,Z,Q),this.#F[J]=u,Q){Q.set="replace";let A=V&&this.#Z(V)?V.__staleWhileFetching:V;if(A!==void 0)Q.oldValue=A}}else if(Q)Q.set="update";if(this.#C)this.onInsert?.(u,D,u===V?"update":"replace")}if(C!==0&&!this.#U)this.#S();if(this.#U){if(!X)this.#m(J,C,B);if(Q)this.#R(Q,J)}if(!$&&this.#K&&this.#H){let V=this.#H,A;while(A=V?.shift())this.#$?.(...A)}return this}pop(){try{while(this.#Q){let D=this.#F[this.#G];if(this.#f(!0),this.#Z(D)){if(D.__staleWhileFetching)return D.__staleWhileFetching}else if(D!==void 0)return D}}finally{if(this.#K&&this.#H){let D=this.#H,u;while(u=D?.shift())this.#$?.(...u)}}}#f(D){let u=this.#G,F=this.#X[u],C=this.#F[u];if(this.#N&&this.#Z(C))C.__abortController.abort(new Error("evicted"));else if(this.#j||this.#K){if(this.#j)this.#E?.(C,F,"evict");if(this.#K)this.#H?.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.#G=this.#A=0,this.#T.length=0;else this.#G=this.#V[u];return this.#Y.delete(F),this.#Q--,u}has(D,u={}){let{updateAgeOnHas:F=this.updateAgeOnHas,status:C}=u,B=this.#Y.get(D);if(B!==void 0){let $=this.#F[B];if(this.#Z($)&&$.__staleWhileFetching===void 0)return!1;if(!this.#L(B)){if(F)this.#O(B);if(C)C.has="hit",this.#R(C,B);return!0}else if(C)C.has="stale",this.#R(C,B)}else if(C)C.has="miss";return!1}peek(D,u={}){let{allowStale:F=this.allowStale}=u,C=this.#Y.get(D);if(C===void 0||!F&&this.#L(C))return;let B=this.#F[C];return this.#Z(B)?B.__staleWhileFetching:B}#d(D,u,F,C){let B=u===void 0?void 0:this.#F[u];if(this.#Z(B))return B;let $=new j0,{signal:E}=F;E?.addEventListener("abort",()=>$.abort(E.reason),{signal:$.signal});let Q={signal:$.signal,options:F,context:C},X=(z,G=!1)=>{let{aborted:W}=$.signal,I=F.ignoreFetchAbort&&z!==void 0;if(F.status)if(W&&!G){if(F.status.fetchAborted=!0,F.status.fetchError=$.signal.reason,I)F.status.fetchAbortIgnored=!0}else F.status.fetchResolved=!0;if(W&&!I&&!G)return J($.signal.reason);let O=A,R=this.#F[u];if(R===A||I&&G&&R===void 0)if(z===void 0)if(O.__staleWhileFetching!==void 0)this.#F[u]=O.__staleWhileFetching;else this.#P(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 J(z)},J=(z)=>{let{aborted:G}=$.signal,W=G&&F.allowStaleOnFetchAbort,I=W||F.allowStaleOnFetchRejection,O=I||F.noDeleteOnFetchRejection,R=A;if(this.#F[u]===A){if(!O||R.__staleWhileFetching===void 0)this.#P(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},V=(z,G)=>{let W=this.#W?.(D,B,Q);if(W&&W instanceof Promise)W.then((I)=>z(I===void 0?void 0:I),G);$.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 A=new Promise(V).then(X,Z),U=Object.assign(A,{__abortController:$,__staleWhileFetching:B,__returned:void 0});if(u===void 0)this.set(D,U,{...Q.options,status:void 0}),u=this.#Y.get(D);else this.#F[u]=U;return U}#Z(D){if(!this.#N)return!1;let u=D;return!!u&&u instanceof Promise&&u.hasOwnProperty("__staleWhileFetching")&&u.__abortController instanceof j0}async fetch(D,u={}){let{allowStale:F=this.allowStale,updateAgeOnGet:C=this.updateAgeOnGet,noDeleteOnStaleGet:B=this.noDeleteOnStaleGet,ttl:$=this.ttl,noDisposeOnSet:E=this.noDisposeOnSet,size:Q=0,sizeCalculation:X=this.sizeCalculation,noUpdateTTL:Z=this.noUpdateTTL,noDeleteOnFetchRejection:J=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:V=this.allowStaleOnFetchRejection,ignoreFetchAbort:A=this.ignoreFetchAbort,allowStaleOnFetchAbort:U=this.allowStaleOnFetchAbort,context:z,forceRefresh:G=!1,status:W,signal:I}=u;if(!this.#N){if(W)W.fetch="get";return this.get(D,{allowStale:F,updateAgeOnGet:C,noDeleteOnStaleGet:B,status:W})}let O={allowStale:F,updateAgeOnGet:C,noDeleteOnStaleGet:B,ttl:$,noDisposeOnSet:E,size:Q,sizeCalculation:X,noUpdateTTL:Z,noDeleteOnFetchRejection:J,allowStaleOnFetchRejection:V,allowStaleOnFetchAbort:U,ignoreFetchAbort:A,status:W,signal:I},R=this.#Y.get(D);if(R===void 0){if(W)W.fetch="miss";let L=this.#d(D,R,O,z);return L.__returned=L}else{let L=this.#F[R];if(this.#Z(L)){let iD=F&&L.__staleWhileFetching!==void 0;if(W){if(W.fetch="inflight",iD)W.returnedStale=!0}return iD?L.__staleWhileFetching:L.__returned=L}let S=this.#L(R);if(!G&&!S){if(W)W.fetch="hit";if(this.#b(R),C)this.#O(R);if(W)this.#R(W,R);return L}let h=this.#d(D,R,O,z),PD=h.__staleWhileFetching!==void 0&&F;if(W){if(W.fetch=S?"stale":"refresh",PD&&S)W.returnedStale=!0}return PD?h.__staleWhileFetching:h.__returned=h}}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.#z;if(!F)throw new Error("no memoMethod provided to constructor");let{context:C,forceRefresh:B,...$}=u,E=this.get(D,$);if(!B&&E!==void 0)return E;let Q=F(D,E,{options:$,context:C});return this.set(D,Q,$),Q}get(D,u={}){let{allowStale:F=this.allowStale,updateAgeOnGet:C=this.updateAgeOnGet,noDeleteOnStaleGet:B=this.noDeleteOnStaleGet,status:$}=u,E=this.#Y.get(D);if(E!==void 0){let Q=this.#F[E],X=this.#Z(Q);if($)this.#R($,E);if(this.#L(E)){if($)$.get="stale";if(!X){if(!B)this.#P(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.#b(E),C)this.#O(E);return Q}}else if($)$.get="miss"}#l(D,u){this.#_[u]=D,this.#V[D]=u}#b(D){if(D!==this.#A){if(D===this.#G)this.#G=this.#V[D];else this.#l(this.#_[D],this.#V[D]);this.#l(this.#A,D),this.#A=D}}delete(D){return this.#P(D,"delete")}#P(D,u){let F=!1;if(this.#Q!==0){let C=this.#Y.get(D);if(C!==void 0)if(F=!0,this.#Q===1)this.#g(u);else{this.#x(C);let B=this.#F[C];if(this.#Z(B))B.__abortController.abort(new Error("deleted"));else if(this.#j||this.#K){if(this.#j)this.#E?.(B,D,u);if(this.#K)this.#H?.push([B,D,u])}if(this.#Y.delete(D),this.#X[C]=void 0,this.#F[C]=void 0,C===this.#A)this.#A=this.#_[C];else if(C===this.#G)this.#G=this.#V[C];else{let $=this.#_[C];this.#V[$]=this.#V[C];let E=this.#V[C];this.#_[E]=this.#_[C]}this.#Q--,this.#T.push(C)}}if(this.#K&&this.#H?.length){let C=this.#H,B;while(B=C?.shift())this.#$?.(...B)}return F}clear(){return this.#g("delete")}#g(D){for(let u of this.#k({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.#j)this.#E?.(F,C,D);if(this.#K)this.#H?.push([F,C,D])}}if(this.#Y.clear(),this.#F.fill(void 0),this.#X.fill(void 0),this.#U&&this.#I)this.#U.fill(0),this.#I.fill(0);if(this.#M)this.#M.fill(0);if(this.#G=0,this.#A=0,this.#T.length=0,this.#q=0,this.#Q=0,this.#K&&this.#H){let u=this.#H,F;while(F=u?.shift())this.#$?.(...F)}}}import{posix as xB,win32 as C2}from"path";import{fileURLToPath as vB}from"url";import{lstatSync as fB,readdir as bB,readdirSync as yB,readlinkSync as hB,realpathSync as gB}from"fs";import*as mB from"fs";import{lstat as dB,readdir as lB,readlink as pB,realpath as nB}from"fs/promises";import{EventEmitter as eF}from"events";import s8 from"stream";import{StringDecoder as RB}from"string_decoder";var i8=typeof process==="object"&&process?process:{stdout:null,stderr:null},LB=(D)=>!!D&&typeof D==="object"&&(D instanceof oD||D instanceof s8||IB(D)||NB(D)),IB=(D)=>!!D&&typeof D==="object"&&D instanceof eF&&typeof D.pipe==="function"&&D.pipe!==s8.Writable.prototype.pipe,NB=(D)=>!!D&&typeof D==="object"&&D instanceof eF&&typeof D.write==="function"&&typeof D.end==="function",hD=Symbol("EOF"),gD=Symbol("maybeEmitEnd"),pD=Symbol("emittedEnd"),M0=Symbol("emittingEnd"),xu=Symbol("emittedError"),R0=Symbol("closed"),a8=Symbol("read"),L0=Symbol("flush"),r8=Symbol("flushChunk"),OD=Symbol("encoding"),Xu=Symbol("decoder"),n=Symbol("flowing"),vu=Symbol("paused"),Zu=Symbol("resume"),i=Symbol("buffer"),BD=Symbol("pipes"),a=Symbol("bufferLength"),aF=Symbol("bufferPush"),I0=Symbol("bufferShift"),e=Symbol("objectMode"),d=Symbol("destroyed"),rF=Symbol("error"),oF=Symbol("emitData"),o8=Symbol("emitEnd"),sF=Symbol("emitEnd2"),SD=Symbol("async"),tF=Symbol("abort"),N0=Symbol("aborted"),fu=Symbol("signal"),rD=Symbol("dataListeners"),VD=Symbol("discarded"),bu=(D)=>Promise.resolve().then(D),TB=(D)=>D(),OB=(D)=>D==="end"||D==="finish"||D==="prefinish",wB=(D)=>D instanceof ArrayBuffer||!!D&&typeof D==="object"&&D.constructor&&D.constructor.name==="ArrayBuffer"&&D.byteLength>=0,PB=(D)=>!Buffer.isBuffer(D)&&ArrayBuffer.isView(D);class D2{src;dest;opts;ondrain;constructor(D,u,F){this.src=D,this.dest=u,this.opts=F,this.ondrain=()=>D[Zu](),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 t8 extends D2{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 kB=(D)=>!!D.objectMode,SB=(D)=>!D.objectMode&&!!D.encoding&&D.encoding!=="buffer";class oD extends eF{[n]=!1;[vu]=!1;[BD]=[];[i]=[];[e];[OD];[SD];[Xu];[hD]=!1;[pD]=!1;[M0]=!1;[R0]=!1;[xu]=null;[a]=0;[d]=!1;[fu];[N0]=!1;[rD]=0;[VD]=!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(kB(u))this[e]=!0,this[OD]=null;else if(SB(u))this[OD]=u.encoding,this[e]=!1;else this[e]=!1,this[OD]=null;if(this[SD]=!!u.async,this[Xu]=this[OD]?new RB(this[OD]):null,u&&u.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[i]});if(u&&u.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[BD]});let{signal:F}=u;if(F)if(this[fu]=F,F.aborted)this[tF]();else F.addEventListener("abort",()=>this[tF]())}get bufferLength(){return this[a]}get encoding(){return this[OD]}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[e]}set objectMode(D){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[SD]}set["async"](D){this[SD]=this[SD]||!!D}[tF](){this[N0]=!0,this.emit("abort",this[fu]?.reason),this.destroy(this[fu]?.reason)}get aborted(){return this[N0]}set aborted(D){}write(D,u,F){if(this[N0])return!1;if(this[hD])throw new Error("write after end");if(this[d])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[SD]?bu:TB;if(!this[e]&&!Buffer.isBuffer(D)){if(PB(D))D=Buffer.from(D.buffer,D.byteOffset,D.byteLength);else if(wB(D))D=Buffer.from(D);else if(typeof D!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[e]){if(this[n]&&this[a]!==0)this[L0](!0);if(this[n])this.emit("data",D);else this[aF](D);if(this[a]!==0)this.emit("readable");if(F)C(F);return this[n]}if(!D.length){if(this[a]!==0)this.emit("readable");if(F)C(F);return this[n]}if(typeof D==="string"&&!(u===this[OD]&&!this[Xu]?.lastNeed))D=Buffer.from(D,u);if(Buffer.isBuffer(D)&&this[OD])D=this[Xu].write(D);if(this[n]&&this[a]!==0)this[L0](!0);if(this[n])this.emit("data",D);else this[aF](D);if(this[a]!==0)this.emit("readable");if(F)C(F);return this[n]}read(D){if(this[d])return null;if(this[VD]=!1,this[a]===0||D===0||D&&D>this[a])return this[gD](),null;if(this[e])D=null;if(this[i].length>1&&!this[e])this[i]=[this[OD]?this[i].join(""):Buffer.concat(this[i],this[a])];let u=this[a8](D||null,this[i][0]);return this[gD](),u}[a8](D,u){if(this[e])this[I0]();else{let F=u;if(D===F.length||D===null)this[I0]();else if(typeof F==="string")this[i][0]=F.slice(D),u=F.slice(0,D),this[a]-=D;else this[i][0]=F.subarray(D),u=F.subarray(0,D),this[a]-=D}if(this.emit("data",u),!this[i].length&&!this[hD])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[hD]=!0,this.writable=!1,this[n]||!this[vu])this[gD]();return this}[Zu](){if(this[d])return;if(!this[rD]&&!this[BD].length)this[VD]=!0;if(this[vu]=!1,this[n]=!0,this.emit("resume"),this[i].length)this[L0]();else if(this[hD])this[gD]();else this.emit("drain")}resume(){return this[Zu]()}pause(){this[n]=!1,this[vu]=!0,this[VD]=!1}get destroyed(){return this[d]}get flowing(){return this[n]}get paused(){return this[vu]}[aF](D){if(this[e])this[a]+=1;else this[a]+=D.length;this[i].push(D)}[I0](){if(this[e])this[a]-=1;else this[a]-=this[i][0].length;return this[i].shift()}[L0](D=!1){do;while(this[r8](this[I0]())&&this[i].length);if(!D&&!this[i].length&&!this[hD])this.emit("drain")}[r8](D){return this.emit("data",D),this[n]}pipe(D,u){if(this[d])return D;this[VD]=!1;let F=this[pD];if(u=u||{},D===i8.stdout||D===i8.stderr)u.end=!1;else u.end=u.end!==!1;if(u.proxyErrors=!!u.proxyErrors,F){if(u.end)D.end()}else if(this[BD].push(!u.proxyErrors?new D2(this,D,u):new t8(this,D,u)),this[SD])bu(()=>this[Zu]());else this[Zu]();return D}unpipe(D){let u=this[BD].find((F)=>F.dest===D);if(u){if(this[BD].length===1){if(this[n]&&this[rD]===0)this[n]=!1;this[BD]=[]}else this[BD].splice(this[BD].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[VD]=!1,this[rD]++,!this[BD].length&&!this[n])this[Zu]()}else if(D==="readable"&&this[a]!==0)super.emit("readable");else if(OB(D)&&this[pD])super.emit(D),this.removeAllListeners(D);else if(D==="error"&&this[xu]){let C=u;if(this[SD])bu(()=>C.call(this,this[xu]));else C.call(this,this[xu])}return F}removeListener(D,u){return this.off(D,u)}off(D,u){let F=super.off(D,u);if(D==="data"){if(this[rD]=this.listeners("data").length,this[rD]===0&&!this[VD]&&!this[BD].length)this[n]=!1}return F}removeAllListeners(D){let u=super.removeAllListeners(D);if(D==="data"||D===void 0){if(this[rD]=0,!this[VD]&&!this[BD].length)this[n]=!1}return u}get emittedEnd(){return this[pD]}[gD](){if(!this[M0]&&!this[pD]&&!this[d]&&this[i].length===0&&this[hD]){if(this[M0]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[R0])this.emit("close");this[M0]=!1}}emit(D,...u){let F=u[0];if(D!=="error"&&D!=="close"&&D!==d&&this[d])return!1;else if(D==="data")return!this[e]&&!F?!1:this[SD]?(bu(()=>this[oF](F)),!0):this[oF](F);else if(D==="end")return this[o8]();else if(D==="close"){if(this[R0]=!0,!this[pD]&&!this[d])return!1;let B=super.emit("close");return this.removeAllListeners("close"),B}else if(D==="error"){this[xu]=F,super.emit(rF,F);let B=!this[fu]||this.listeners("error").length?super.emit("error",F):!1;return this[gD](),B}else if(D==="resume"){let B=super.emit("resume");return this[gD](),B}else if(D==="finish"||D==="prefinish"){let B=super.emit(D);return this.removeAllListeners(D),B}let C=super.emit(D,...u);return this[gD](),C}[oF](D){for(let F of this[BD])if(F.dest.write(D)===!1)this.pause();let u=this[VD]?!1:super.emit("data",D);return this[gD](),u}[o8](){if(this[pD])return!1;return this[pD]=!0,this.readable=!1,this[SD]?(bu(()=>this[sF]()),!0):this[sF]()}[sF](){if(this[Xu]){let u=this[Xu].end();if(u){for(let F of this[BD])F.dest.write(u);if(!this[VD])super.emit("data",u)}}for(let u of this[BD])u.end();let D=super.emit("end");return this.removeAllListeners("end"),D}async collect(){let D=Object.assign([],{dataLength:0});if(!this[e])D.dataLength=0;let u=this.promise();return this.on("data",(F)=>{if(D.push(F),!this[e])D.dataLength+=F.length}),await u,D}async concat(){if(this[e])throw new Error("cannot concat in objectMode");let D=await this.collect();return this[OD]?D.join(""):Buffer.concat(D,D.dataLength)}async promise(){return new Promise((D,u)=>{this.on(d,()=>u(new Error("stream destroyed"))),this.on("error",(F)=>u(F)),this.on("end",()=>D())})}[Symbol.asyncIterator](){this[VD]=!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[hD])return u();let B,$,E=(J)=>{this.off("data",Q),this.off("end",X),this.off(d,Z),u(),$(J)},Q=(J)=>{this.off("error",E),this.off("end",X),this.off(d,Z),this.pause(),B({value:J,done:!!this[hD]})},X=()=>{this.off("error",E),this.off("data",Q),this.off(d,Z),u(),B({done:!0,value:void 0})},Z=()=>E(new Error("stream destroyed"));return new Promise((J,V)=>{$=V,B=J,this.once(d,Z),this.once("error",E),this.once("end",X),this.once("data",Q)})},throw:u,return:u,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[VD]=!1;let D=!1,u=()=>{return this.pause(),this.off(rF,u),this.off(d,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(rF,u),this.once(d,u),{next:F,throw:u,return:u,[Symbol.iterator](){return this}}}destroy(D){if(this[d]){if(D)this.emit("error",D);else this.emit(d);return this}this[d]=!0,this[VD]=!0,this[i].length=0,this[a]=0;let u=this;if(typeof u.close==="function"&&!this[R0])u.close();if(D)this.emit("error",D);else this.emit(d);return this}static get isStream(){return LB}}var cB=gB.native,hu={lstatSync:fB,readdir:bB,readdirSync:yB,readlinkSync:hB,realpathSync:cB,promises:{lstat:dB,readdir:lB,readlink:pB,realpath:nB}},C6=(D)=>!D||D===hu||D===mB?hu:{...hu,...D,promises:{...hu.promises,...D.promises||{}}},B6=/^\\\\\?\\([a-z]:)\\?$/i,iB=(D)=>D.replace(/\//g,"\\").replace(B6,"$1\\"),aB=/[\\\/]/,_D=0,E6=1,$6=2,xD=4,Q6=6,X6=8,sD=10,Z6=12,WD=15,yu=~WD,u2=16,e8=32,gu=64,wD=128,T0=256,w0=512,D6=gu|wD|w0,rB=1023,F2=(D)=>D.isFile()?X6:D.isDirectory()?xD:D.isSymbolicLink()?sD:D.isCharacterDevice()?$6:D.isBlockDevice()?Q6:D.isSocket()?Z6:D.isFIFO()?E6:_D,u6=new Map,mu=(D)=>{let u=u6.get(D);if(u)return u;let F=D.normalize("NFKD");return u6.set(D,F),F},F6=new Map,O0=(D)=>{let u=F6.get(D);if(u)return u;let F=mu(D.toLowerCase());return F6.set(D,F),F};class B2 extends Su{constructor(){super({max:256})}}class J6 extends Su{constructor(D=16384){super({maxSize:D,sizeCalculation:(u)=>u.length+1})}}var Y6=Symbol("PathScurry setAsCwd");class ED{name;root;roots;parent;nocase;isCWD=!1;#D;#u;get dev(){return this.#u}#E;get mode(){return this.#E}#B;get nlink(){return this.#B}#$;get uid(){return this.#$}#W;get gid(){return this.#W}#z;get rdev(){return this.#z}#J;get blksize(){return this.#J}#Q;get ino(){return this.#Q}#q;get size(){return this.#q}#Y;get blocks(){return this.#Y}#X;get atimeMs(){return this.#X}#F;get mtimeMs(){return this.#F}#V;get ctimeMs(){return this.#V}#_;get birthtimeMs(){return this.#_}#G;get atime(){return this.#G}#A;get mtime(){return this.#A}#T;get ctime(){return this.#T}#H;get birthtime(){return this.#H}#M;#I;#U;#j;#N;#K;#C;#S;#O;#R;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(D,u=_D,F,C,B,$,E){if(this.name=D,this.#M=B?O0(D):mu(D),this.#C=u&rB,this.nocase=B,this.roots=C,this.root=F||this,this.#S=$,this.#U=E.fullpath,this.#N=E.relative,this.#K=E.relativePosix,this.parent=E.parent,this.parent)this.#D=this.parent.#D;else this.#D=C6(E.fs)}depth(){if(this.#I!==void 0)return this.#I;if(!this.parent)return this.#I=0;return this.#I=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&=~u2,u}child(D,u){if(D===""||D===".")return this;if(D==="..")return this.parent||this;let F=this.children(),C=this.nocase?O0(D):mu(D);for(let Q of F)if(Q.#M===C)return Q;let B=this.parent?this.sep:"",$=this.#U?this.#U+B+D:void 0,E=this.newChild(D,_D,{...u,parent:this,fullpath:$});if(!this.canReaddir())E.#C|=wD;return F.push(E),E}relative(){if(this.isCWD)return"";if(this.#N!==void 0)return this.#N;let D=this.name,u=this.parent;if(!u)return this.#N=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.#K!==void 0)return this.#K;let D=this.name,u=this.parent;if(!u)return this.#K=this.fullpathPosix();let F=u.relativePosix();return F+(!F||!u.parent?"":"/")+D}fullpath(){if(this.#U!==void 0)return this.#U;let D=this.name,u=this.parent;if(!u)return this.#U=this.name;let C=u.fullpath()+(!u.parent?"":this.sep)+D;return this.#U=C}fullpathPosix(){if(this.#j!==void 0)return this.#j;if(this.sep==="/")return this.#j=this.fullpath();if(!this.parent){let C=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(C))return this.#j=`//?/${C}`;else return this.#j=C}let D=this.parent,u=D.fullpathPosix(),F=u+(!u||!D.parent?"":"/")+this.name;return this.#j=F}isUnknown(){return(this.#C&WD)===_D}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&WD)===X6}isDirectory(){return(this.#C&WD)===xD}isCharacterDevice(){return(this.#C&WD)===$6}isBlockDevice(){return(this.#C&WD)===Q6}isFIFO(){return(this.#C&WD)===E6}isSocket(){return(this.#C&WD)===Z6}isSymbolicLink(){return(this.#C&sD)===sD}lstatCached(){return this.#C&e8?this:void 0}readlinkCached(){return this.#O}realpathCached(){return this.#R}readdirCached(){let D=this.children();return D.slice(0,D.provisional)}canReadlink(){if(this.#O)return!0;if(!this.parent)return!1;let D=this.#C&WD;return!(D!==_D&&D!==sD||this.#C&T0||this.#C&wD)}calledReaddir(){return!!(this.#C&u2)}isENOENT(){return!!(this.#C&wD)}isNamed(D){return!this.nocase?this.#M===mu(D):this.#M===O0(D)}async readlink(){let D=this.#O;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.#O=F}catch(u){this.#c(u.code);return}}readlinkSync(){let D=this.#O;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.#O=F}catch(u){this.#c(u.code);return}}#L(D){this.#C|=u2;for(let u=D.provisional;uF(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 B=F.slice(0,F.provisional);if(u)D(null,B);else queueMicrotask(()=>D(null,B));return}if(this.#P.push(D),this.#g)return;this.#g=!0;let C=this.fullpath();this.#D.readdir(C,{withFileTypes:!0},(B,$)=>{if(B)this.#w(B.code),F.provisional=0;else{for(let E of $)this.#f(E,F);this.#L(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.#f(C,D);this.#L(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.#f(F,D);this.#L(D)}catch(F){this.#w(F.code),D.provisional=0}return D.slice(0,D.provisional)}canReaddir(){if(this.#C&D6)return!1;let D=WD&this.#C;if(!(D===_D||D===xD||D===sD))return!1;return!0}shouldWalk(D,u){return(this.#C&xD)===xD&&!(this.#C&D6)&&!D.has(this)&&(!u||u(this))}async realpath(){if(this.#R)return this.#R;if((w0|T0|wD)&this.#C)return;try{let D=await this.#D.promises.realpath(this.fullpath());return this.#R=this.resolve(D)}catch(D){this.#h()}}realpathSync(){if(this.#R)return this.#R;if((w0|T0|wD)&this.#C)return;try{let D=this.#D.realpathSync(this.fullpath());return this.#R=this.resolve(D)}catch(D){this.#h()}}[Y6](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.#N=F.join(this.sep),C.#K=F.join("/"),C=C.parent,F.push("..");C=D;while(C&&C.parent&&!u.has(C))C.#N=void 0,C.#K=void 0,C=C.parent}}class P0 extends ED{sep="\\";splitSep=aB;constructor(D,u=_D,F,C,B,$,E){super(D,u,F,C,B,$,E)}newChild(D,u=_D,F={}){return new P0(D,u,this.root,this.roots,this.nocase,this.childrenCache(),F)}getRootString(D){return C2.parse(D).root}getRoot(D){if(D=iB(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 cu(D,this).root}sameRoot(D,u=this.root.name){return D=D.toUpperCase().replace(/\//g,"\\").replace(B6,"$1\\"),D===u}}class k0 extends ED{splitSep="/";sep="/";constructor(D,u=_D,F,C,B,$,E){super(D,u,F,C,B,$,E)}getRootString(D){return D.startsWith("/")?"/":""}getRoot(D){return this.root}newChild(D,u=_D,F={}){return new k0(D,u,this.root,this.roots,this.nocase,this.childrenCache(),F)}}class E2{root;rootPath;roots;cwd;#D;#u;#E;nocase;#B;constructor(D=process.cwd(),u,F,{nocase:C,childrenCacheSize:B=16384,fs:$=hu}={}){if(this.#B=C6($),D instanceof URL||D.startsWith("file://"))D=vB(D);let E=u.resolve(D);this.roots=Object.create(null),this.rootPath=this.parseRootPath(E),this.#D=new B2,this.#u=new B2,this.#E=new J6(B);let Q=E.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.#B),this.roots[this.rootPath]=this.root;let X=this.root,Z=Q.length-1,J=u.sep,V=this.rootPath,A=!1;for(let U of Q){let z=Z--;X=X.child(U,{relative:new Array(z).fill("..").join(J),relativePosix:new Array(z).fill("..").join("/"),fullpath:V+=(A?"":J)+U}),A=!0}this.cwd=X}depth(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.depth()}childrenCache(){return this.#E}resolve(...D){let u="";for(let B=D.length-1;B>=0;B--){let $=D[B];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 B=D.length-1;B>=0;B--){let $=D[B];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 ED))u=D,D=this.cwd;let{withFileTypes:F}=u;if(!D.canReaddir())return[];else{let C=await D.readdir();return F?C:C.map((B)=>B.name)}}readdirSync(D=this.cwd,u={withFileTypes:!0}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof ED))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 ED))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 ED))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 ED))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 ED))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 ED))u=D,D=this.cwd;let{withFileTypes:F=!0,follow:C=!1,filter:B,walkFilter:$}=u,E=[];if(!B||B(D))E.push(F?D:D.fullpath());let Q=new Set,X=(J,V)=>{Q.add(J),J.readdirCB((A,U)=>{if(A)return V(A);let z=U.length;if(!z)return V();let G=()=>{if(--z===0)V()};for(let W of U){if(!B||B(W))E.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,G):G());else if(W.shouldWalk(Q,$))X(W,G);else G()}},!0)},Z=D;return new Promise((J,V)=>{X(Z,(A)=>{if(A)return V(A);J(E)})})}walkSync(D=this.cwd,u={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof ED))u=D,D=this.cwd;let{withFileTypes:F=!0,follow:C=!1,filter:B,walkFilter:$}=u,E=[];if(!B||B(D))E.push(F?D:D.fullpath());let Q=new Set([D]);for(let X of Q){let Z=X.readdirSync();for(let J of Z){if(!B||B(J))E.push(F?J:J.fullpath());let V=J;if(J.isSymbolicLink()){if(!(C&&(V=J.realpathSync())))continue;if(V.isUnknown())V.lstatSync()}if(V.shouldWalk(Q,$))Q.add(V)}}return E}[Symbol.asyncIterator](){return this.iterate()}iterate(D=this.cwd,u={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof ED))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 ED))u=D,D=this.cwd;let{withFileTypes:F=!0,follow:C=!1,filter:B,walkFilter:$}=u;if(!B||B(D))yield F?D:D.fullpath();let E=new Set([D]);for(let Q of E){let X=Q.readdirSync();for(let Z of X){if(!B||B(Z))yield F?Z:Z.fullpath();let J=Z;if(Z.isSymbolicLink()){if(!(C&&(J=Z.realpathSync())))continue;if(J.isUnknown())J.lstatSync()}if(J.shouldWalk(E,$))E.add(J)}}}stream(D=this.cwd,u={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof ED))u=D,D=this.cwd;let{withFileTypes:F=!0,follow:C=!1,filter:B,walkFilter:$}=u,E=new oD({objectMode:!0});if(!B||B(D))E.write(F?D:D.fullpath());let Q=new Set,X=[D],Z=0,J=()=>{let V=!1;while(!V){let A=X.shift();if(!A){if(Z===0)E.end();return}Z++,Q.add(A);let U=(G,W,I=!1)=>{if(G)return E.emit("error",G);if(C&&!I){let O=[];for(let R of W)if(R.isSymbolicLink())O.push(R.realpath().then((L)=>L?.isUnknown()?L.lstat():L));if(O.length){Promise.all(O).then(()=>U(null,W,!0));return}}for(let O of W)if(O&&(!B||B(O))){if(!E.write(F?O:O.fullpath()))V=!0}Z--;for(let O of W){let R=O.realpathCached()||O;if(R.shouldWalk(Q,$))X.push(R)}if(V&&!E.flowing)E.once("drain",J);else if(!z)J()},z=!0;A.readdirCB(U,!0),z=!1}};return J(),E}streamSync(D=this.cwd,u={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof ED))u=D,D=this.cwd;let{withFileTypes:F=!0,follow:C=!1,filter:B,walkFilter:$}=u,E=new oD({objectMode:!0}),Q=new Set;if(!B||B(D))E.write(F?D:D.fullpath());let X=[D],Z=0,J=()=>{let V=!1;while(!V){let A=X.shift();if(!A){if(Z===0)E.end();return}Z++,Q.add(A);let U=A.readdirSync();for(let z of U)if(!B||B(z)){if(!E.write(F?z:z.fullpath()))V=!0}Z--;for(let z of U){let G=z;if(z.isSymbolicLink()){if(!(C&&(G=z.realpathSync())))continue;if(G.isUnknown())G.lstatSync()}if(G.shouldWalk(Q,$))X.push(G)}}if(V&&!E.flowing)E.once("drain",J)};return J(),E}chdir(D=this.cwd){let u=this.cwd;this.cwd=typeof D==="string"?this.cwd.resolve(D):D,this.cwd[Y6](u)}}class cu extends E2{sep="\\";constructor(D=process.cwd(),u={}){let{nocase:F=!0}=u;super(D,C2,"\\",{...u,nocase:F});this.nocase=F;for(let C=this.cwd;C;C=C.parent)C.nocase=this.nocase}parseRootPath(D){return C2.parse(D).root.toUpperCase()}newRoot(D){return new P0(this.rootPath,xD,void 0,this.roots,this.nocase,this.childrenCache(),{fs:D})}isAbsolute(D){return D.startsWith("/")||D.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(D)}}class du extends E2{sep="/";constructor(D=process.cwd(),u={}){let{nocase:F=!1}=u;super(D,xB,"/",{...u,nocase:F});this.nocase=F}parseRootPath(D){return"/"}newRoot(D){return new k0(this.rootPath,xD,void 0,this.roots,this.nocase,this.childrenCache(),{fs:D})}isAbsolute(D){return D.startsWith("/")}}class S0 extends du{constructor(D=process.cwd(),u={}){let{nocase:F=!0}=u;super(D,{...u,nocase:F})}}var DQ=process.platform==="win32"?P0:k0,q6=process.platform==="win32"?cu:process.platform==="darwin"?S0:du;var oB=(D)=>D.length>=1,sB=(D)=>D.length>=1;class Ju{#D;#u;#E;length;#B;#$;#W;#z;#J;#Q;#q=!0;constructor(D,u,F,C){if(!oB(D))throw new TypeError("empty pattern list");if(!sB(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.#E=F,this.#B=C,this.#E===0){if(this.isUNC()){let[B,$,E,Q,...X]=this.#D,[Z,J,V,A,...U]=this.#u;if(X[0]==="")X.shift(),U.shift();let z=[B,$,E,Q,""].join("/"),G=[Z,J,V,A,""].join("/");this.#D=[z,...X],this.#u=[G,...U],this.length=this.#D.length}else if(this.isDrive()||this.isAbsolute()){let[B,...$]=this.#D,[E,...Q]=this.#u;if($[0]==="")$.shift(),Q.shift();let X=B+"/",Z=E+"/";this.#D=[X,...$],this.#u=[Z,...Q],this.length=this.#D.length}}}pattern(){return this.#D[this.#E]}isString(){return typeof this.#D[this.#E]==="string"}isGlobstar(){return this.#D[this.#E]===o}isRegExp(){return this.#D[this.#E]instanceof RegExp}globString(){return this.#W=this.#W||(this.#E===0?this.isAbsolute()?this.#u[0]+this.#u.slice(1).join("/"):this.#u.join("/"):this.#u.slice(this.#E).join("/"))}hasMore(){return this.length>this.#E+1}rest(){if(this.#$!==void 0)return this.#$;if(!this.hasMore())return this.#$=null;return this.#$=new Ju(this.#D,this.#u,this.#E+1,this.#B),this.#$.#Q=this.#Q,this.#$.#J=this.#J,this.#$.#z=this.#z,this.#$}isUNC(){let D=this.#D;return this.#J!==void 0?this.#J:this.#J=this.#B==="win32"&&this.#E===0&&D[0]===""&&D[1]===""&&typeof D[2]==="string"&&!!D[2]&&typeof D[3]==="string"&&!!D[3]}isDrive(){let D=this.#D;return this.#z!==void 0?this.#z:this.#z=this.#B==="win32"&&this.#E===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.#E===0?D:""}checkFollowGlobstar(){return!(this.#E===0||!this.isGlobstar()||!this.#q)}markFollowGlobstar(){if(this.#E===0||!this.isGlobstar()||!this.#q)return!1;return this.#q=!1,!0}}var tB=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class lu{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(D,{nobrace:u,nocase:F,noext:C,noglobstar:B,platform:$=tB}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=$,this.mmopts={dot:!0,nobrace:u,nocase:F,noext:C,noglobstar:B,optimizationLevel:2,platform:$,nocomment:!0,nonegate:!0};for(let E of D)this.add(E)}add(D){let u=new GD(D,this.mmopts);for(let F=0;F[D,!!(u&2),!!(u&1)])}}class V6{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 pu{hasWalkedCache;matches=new K6;subwalks=new V6;patterns;follow;dot;opts;constructor(D,u){this.opts=D,this.follow=!!D.follow,this.dot=!!D.dot,this.hasWalkedCache=u?u.copy():new $2}processPatterns(D,u){this.patterns=u;let F=u.map((C)=>[D,C]);for(let[C,B]of F){this.hasWalkedCache.storeWalked(C,B);let $=B.root(),E=B.isAbsolute()&&this.opts.absolute!==!1;if($){C=C.resolve($==="/"&&this.opts.root!==void 0?this.opts.root:$);let J=B.rest();if(!J){this.matches.add(C,!0,!1);continue}else B=J}if(C.isENOENT())continue;let Q,X,Z=!1;while(typeof(Q=B.pattern())==="string"&&(X=B.rest()))C=C.resolve(Q),B=X,Z=!0;if(Q=B.pattern(),X=B.rest(),Z){if(this.hasWalkedCache.hasWalked(C,B))continue;this.hasWalkedCache.storeWalked(C,B)}if(typeof Q==="string"){let J=Q===".."||Q===""||Q===".";this.matches.add(C.resolve(Q),E,J);continue}else if(Q===o){if(!C.isSymbolicLink()||this.follow||B.checkFollowGlobstar())this.subwalks.add(C,B);let J=X?.pattern(),V=X?.rest();if(!X||(J===""||J===".")&&!V)this.matches.add(C,E,J===""||J===".");else if(J===".."){let A=C.parent||C;if(!V)this.matches.add(A,E,!0);else if(!this.hasWalkedCache.hasWalked(A,V))this.subwalks.add(A,V)}}else if(Q instanceof RegExp)this.subwalks.add(C,B)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new pu(this.opts,this.hasWalkedCache)}filterEntries(D,u){let F=this.subwalks.get(D),C=this.child();for(let B of u)for(let $ of F){let E=$.isAbsolute(),Q=$.pattern(),X=$.rest();if(Q===o)C.testGlobstar(B,$,X,E);else if(Q instanceof RegExp)C.testRegExp(B,Q,X,E);else C.testString(B,Q,X,E)}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 B=F.pattern();if(typeof B==="string"&&B!==".."&&B!==""&&B!==".")this.testString(D,B,F.rest(),C);else if(B===".."){let $=D.parent||D;this.subwalks.add($,F)}else if(B instanceof RegExp)this.testRegExp(D,B,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 eB=(D,u)=>typeof D==="string"?new lu([D],u):Array.isArray(D)?new lu(D,u):D;class Q2{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#D=[];#u;#E;signal;maxDepth;includeChildMatches;constructor(D,u,F){if(this.patterns=D,this.path=u,this.opts=F,this.#E=!F.posix&&F.platform==="win32"?"\\":"/",this.includeChildMatches=F.includeChildMatches!==!1,F.ignore||!this.includeChildMatches){if(this.#u=eB(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})}#B(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 B=D.isUnknown()||this.opts.stat?await D.lstat():D;if(this.opts.follow&&this.opts.nodir&&B?.isSymbolicLink()){let $=await B.realpath();if($&&($.isUnknown()||this.opts.stat))await $.lstat()}return this.matchCheckTest(B,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.#B(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 B=D.isUnknown()||this.opts.stat?D.lstatSync():D;if(this.opts.follow&&this.opts.nodir&&B?.isSymbolicLink()){let $=B.realpathSync();if($&&($?.isUnknown()||this.opts.stat))$.lstatSync()}return this.matchCheckTest(B,u)}matchFinish(D,u){if(this.#B(D))return;if(!this.includeChildMatches&&this.#u?.add){let B=`${D.relativePosix()}/**`;this.#u.add(B)}let F=this.opts.absolute===void 0?u:this.opts.absolute;this.seen.add(D);let C=this.opts.mark&&D.isDirectory()?this.#E:"";if(this.opts.withFileTypes)this.matchEmit(D);else if(F){let B=this.opts.posix?D.fullpathPosix():D.fullpath();this.matchEmit(B+C)}else{let B=this.opts.posix?D.relativePosix():D.relative(),$=this.opts.dotRelative&&!B.startsWith(".."+this.#E)?"."+this.#E:"";this.matchEmit(!B?"."+C:$+B+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 pu(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 B=1,$=()=>{if(--B===0)C()};for(let[E,Q,X]of F.matches.entries()){if(this.#B(E))continue;B++,this.match(E,Q,X).then(()=>$())}for(let E of F.subwalkTargets()){if(this.maxDepth!==1/0&&E.depth()>=this.maxDepth)continue;B++;let Q=E.readdirCached();if(E.calledReaddir())this.walkCB3(E,Q,F,$);else E.readdirCB((X,Z)=>this.walkCB3(E,Z,F,$),!0)}$()}walkCB3(D,u,F,C){F=F.filterEntries(D,u);let B=1,$=()=>{if(--B===0)C()};for(let[E,Q,X]of F.matches.entries()){if(this.#B(E))continue;B++,this.match(E,Q,X).then(()=>$())}for(let[E,Q]of F.subwalks.entries())B++,this.walkCB2(E,Q,F.child(),$);$()}walkCBSync(D,u,F){if(this.signal?.aborted)F();this.walkCB2Sync(D,u,new pu(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 B=1,$=()=>{if(--B===0)C()};for(let[E,Q,X]of F.matches.entries()){if(this.#B(E))continue;this.matchSync(E,Q,X)}for(let E of F.subwalkTargets()){if(this.maxDepth!==1/0&&E.depth()>=this.maxDepth)continue;B++;let Q=E.readdirSync();this.walkCB3Sync(E,Q,F,$)}$()}walkCB3Sync(D,u,F,C){F=F.filterEntries(D,u);let B=1,$=()=>{if(--B===0)C()};for(let[E,Q,X]of F.matches.entries()){if(this.#B(E))continue;this.matchSync(E,Q,X)}for(let[E,Q]of F.subwalks.entries())B++,this.walkCB2Sync(E,Q,F.child(),$);$()}}class x0 extends Q2{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 v0 extends Q2{results;constructor(D,u,F){super(D,u,F);this.results=new oD({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 u4=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class vD{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=D4(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||u4,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"?cu:u.platform==="darwin"?S0:u.platform?du:q6;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},B=this.pattern.map((Q)=>new GD(Q,C)),[$,E]=B.reduce((Q,X)=>{return Q[0].push(...X.set),Q[1].push(...X.globParts),Q},[[],[]]);this.patterns=$.map((Q,X)=>{let Z=E[X];if(!Z)throw new Error("invalid pattern object");return new Ju(Q,Z,0,this.platform)})}async walk(){return[...await new x0(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 x0(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 v0(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 v0(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 X2=(D,u={})=>{if(!Array.isArray(D))D=[D];for(let F of D)if(new GD(F,u).hasMagic())return!0;return!1};function b0(D,u={}){return new vD(D,u).streamSync()}function H6(D,u={}){return new vD(D,u).stream()}function U6(D,u={}){return new vD(D,u).walkSync()}async function A6(D,u={}){return new vD(D,u).walk()}function y0(D,u={}){return new vD(D,u).iterateSync()}function z6(D,u={}){return new vD(D,u).iterate()}var F4=b0,C4=Object.assign(H6,{sync:b0}),B4=y0,E4=Object.assign(z6,{sync:y0}),$4=Object.assign(U6,{stream:b0,iterate:y0}),f0=Object.assign(A6,{glob:A6,globSync:U6,sync:$4,globStream:H6,stream:C4,globStreamSync:b0,streamSync:F4,globIterate:z6,iterate:E4,globIterateSync:y0,iterateSync:B4,Glob:vD,hasMagic:X2,escape:$u,unescape:TD});f0.glob=f0;FD();async function W6(D,u={}){let F=T.getInstance().getTrashDirectory();if(!G6(F))X4(F,{recursive:!0});let C=Array.isArray(D)?D:[D];for(let B of C){let $=await f0(B),E=$.length>0?$:[B];for(let Q of E)try{if(!G6(Q)){if(!u.force){console.error(`trash: ${Q}: No such file or directory`);continue}continue}if(Z4(Q).isDirectory()&&!u.recursive){if(!u.force){console.error(`trash: ${Q}: is a directory`);continue}}let Z=Y4(Q),J=Date.now(),V=J4(F,`${Z}.${J}`);Q4(Q,V),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 j6,statSync as M6}from"fs";import{join as R6}from"path";FD();function q4(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 _6(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 L6(D){let u=0,F=j6(D);for(let C of F){let B=R6(D,C),$=M6(B);if($.isDirectory())u+=L6(B);else u+=$.size}return u}async function I6(){let D=T.getInstance().getTrashDirectory();try{let u=j6(D);if(u.length===0){DD.info("\uD83D\uDDD1\uFE0F Trash is empty");return}let F=u.map((E)=>{let Q=R6(D,E),X=M6(Q),{name:Z,timestamp:J}=q4(E),V=X.isDirectory()?L6(Q):X.size;return{originalName:Z,trashedName:E,size:V,trashedAt:new Date(J),isDirectory:X.isDirectory()}});F.sort((E,Q)=>Q.trashedAt.getTime()-E.trashedAt.getTime()),console.log(` \uD83D\uDDD1\uFE0F Trash Contents -`),console.log("\u2500".repeat(80));let C=0,B=0,$=0;for(let E of F){if(C+=E.size,E.isDirectory)B++;else $++;let Q=E.isDirectory?"\uD83D\uDCC1":"\uD83D\uDCC4",X=E.trashedAt.toLocaleString(),Z=G6(E.size);console.log(`${Q} ${E.originalName}`),console.log(` Size: ${Z} | Trashed: ${X}`),console.log(` ID: ${E.trashedName}`),console.log()}console.log("\u2500".repeat(80)),console.log(`Total: ${B} folders, ${$} files (${G6(C)})`),console.log(` -To restore files: claude-mem restore`),console.log("To empty trash: claude-mem trash empty")}catch(u){if(u.code==="ENOENT")DD.info("\uD83D\uDDD1\uFE0F Trash is empty");else DD.error("Failed to read trash directory"),console.error(u)}}import{rmSync as F4,readdirSync as C4,existsSync as B4,statSync as E4}from"fs";import{join as L6}from"path";HD();async function I6(D={}){let u=O.getInstance().getTrashDirectory();if(!B4(u)){DD.info("\uD83D\uDDD1\uFE0F Trash is already empty");return}try{let F=C4(u);if(F.length===0){DD.info("\uD83D\uDDD1\uFE0F Trash is already empty");return}let C=0,B=0;for(let E of F){let Q=L6(u,E);if(E4(Q).isDirectory())C++;else B++}if(!D.force){let E=await tD({message:`Permanently delete ${C} folders and ${B} files from trash?`,initialValue:!1});if(VD(E)||!E){DD.info("Cancelled - trash not emptied");return}}let $=J3();$.start("Emptying trash...");for(let E of F){let Q=L6(u,E);F4(Q,{recursive:!0,force:!0})}$.stop(`\uD83D\uDDD1\uFE0F Trash emptied - permanently deleted ${C} folders and ${B} files`)}catch(F){DD.error("Failed to empty trash"),console.error(F),process.exit(1)}}import{readdirSync as $4,renameSync as Q4}from"fs";import{join as N6}from"path";HD();async function T6(){let D=O.getInstance().getTrashDirectory(),u=$4(D);if(u.length===0){console.log("Trash is empty");return}let F=await C0({message:"Select file to restore:",options:u.map((C)=>({value:C,label:C}))});if(VD(F))return;Q4(N6(D,F),N6(process.cwd(),F)),console.log(`Restored ${F}`)}HD();import qu from"fs";import z4 from"path";HD();import{Database as X4}from"bun:sqlite";import Z4 from"path";import J4 from"fs";var y0=null;class pD{static instance;db=null;migrations=[];static getInstance(){if(!pD.instance)pD.instance=new pD;return pD.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=O.getInstance().getDataDirectory();J4.mkdirSync(D,{recursive:!0});let u=Z4.join(D,"claude-mem.db");return this.db=new X4(u,{create:!0,readwrite:!0}),this.db.run("PRAGMA journal_mode = WAL"),this.db.run("PRAGMA synchronous = NORMAL"),this.db.run("PRAGMA foreign_keys = ON"),this.db.run("PRAGMA temp_store = memory"),this.db.run("PRAGMA mmap_size = 268435456"),this.db.run("PRAGMA cache_size = 10000"),this.initializeSchemaVersions(),await this.runMigrations(),y0=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,y0=null}initializeSchemaVersions(){if(!this.db)return;this.db.run(` +`),console.log("\u2500".repeat(80));let C=0,B=0,$=0;for(let E of F){if(C+=E.size,E.isDirectory)B++;else $++;let Q=E.isDirectory?"\uD83D\uDCC1":"\uD83D\uDCC4",X=E.trashedAt.toLocaleString(),Z=_6(E.size);console.log(`${Q} ${E.originalName}`),console.log(` Size: ${Z} | Trashed: ${X}`),console.log(` ID: ${E.trashedName}`),console.log()}console.log("\u2500".repeat(80)),console.log(`Total: ${B} folders, ${$} files (${_6(C)})`),console.log(` +To restore files: claude-mem restore`),console.log("To empty trash: claude-mem trash empty")}catch(u){if(u.code==="ENOENT")DD.info("\uD83D\uDDD1\uFE0F Trash is empty");else DD.error("Failed to read trash directory"),console.error(u)}}import{rmSync as K4,readdirSync as V4,existsSync as A4,statSync as H4}from"fs";import{join as N6}from"path";FD();async function T6(D={}){let u=T.getInstance().getTrashDirectory();if(!A4(u)){DD.info("\uD83D\uDDD1\uFE0F Trash is already empty");return}try{let F=V4(u);if(F.length===0){DD.info("\uD83D\uDDD1\uFE0F Trash is already empty");return}let C=0,B=0;for(let E of F){let Q=N6(u,E);if(H4(Q).isDirectory())C++;else B++}if(!D.force){let E=await eD({message:`Permanently delete ${C} folders and ${B} files from trash?`,initialValue:!1});if(HD(E)||!E){DD.info("Cancelled - trash not emptied");return}}let $=q3();$.start("Emptying trash...");for(let E of F){let Q=N6(u,E);K4(Q,{recursive:!0,force:!0})}$.stop(`\uD83D\uDDD1\uFE0F Trash emptied - permanently deleted ${C} folders and ${B} files`)}catch(F){DD.error("Failed to empty trash"),console.error(F),process.exit(1)}}import{readdirSync as U4,renameSync as z4}from"fs";import{join as O6}from"path";FD();async function w6(){let D=T.getInstance().getTrashDirectory(),u=U4(D);if(u.length===0){console.log("Trash is empty");return}let F=await B0({message:"Select file to restore:",options:u.map((C)=>({value:C,label:C}))});if(HD(F))return;z4(O6(D,F),O6(process.cwd(),F)),console.log(`Restored ${F}`)}FD();import Yu from"fs";import w4 from"path";FD();import{Database as G4}from"bun:sqlite";import W4 from"path";import _4 from"fs";var h0=null;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=T.getInstance().getDataDirectory();_4.mkdirSync(D,{recursive:!0});let u=W4.join(D,"claude-mem.db");return this.db=new G4(u,{create:!0,readwrite:!0}),this.db.run("PRAGMA journal_mode = WAL"),this.db.run("PRAGMA synchronous = NORMAL"),this.db.run("PRAGMA foreign_keys = ON"),this.db.run("PRAGMA temp_store = memory"),this.db.run("PRAGMA mmap_size = 268435456"),this.db.run("PRAGMA cache_size = 10000"),this.initializeSchemaVersions(),await this.runMigrations(),h0=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,h0=null}initializeSchemaVersions(){if(!this.db)return;this.db.run(` 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 u=this.db.query("SELECT version FROM schema_versions ORDER BY version").all().map((C)=>C.version),F=u.length>0?Math.max(...u):0;for(let C of this.migrations)if(C.version>F)console.log(`Applying migration ${C.version}...`),this.db.transaction(()=>{C.up(this.db),this.db.query("INSERT INTO schema_versions (version, applied_at) VALUES (?, ?)").run(C.version,new Date().toISOString())})(),console.log(`Migration ${C.version} applied successfully`)}getCurrentVersion(){if(!this.db)return 0;return this.db.query("SELECT MAX(version) as version FROM schema_versions").get()?.version||0}}function O6(){if(!y0)throw new Error("Database not initialized. Call DatabaseManager.getInstance().initialize() first.");return y0}async function w6(){return await pD.getInstance().initialize()}Ju();var V4={version:1,up:(D)=>{D.run(` + `)}async runMigrations(){if(!this.db)return;let u=this.db.query("SELECT version FROM schema_versions ORDER BY version").all().map((C)=>C.version),F=u.length>0?Math.max(...u):0;for(let C of this.migrations)if(C.version>F)console.log(`Applying migration ${C.version}...`),this.db.transaction(()=>{C.up(this.db),this.db.query("INSERT INTO schema_versions (version, applied_at) VALUES (?, ?)").run(C.version,new Date().toISOString())})(),console.log(`Migration ${C.version} applied successfully`)}getCurrentVersion(){if(!this.db)return 0;return this.db.query("SELECT MAX(version) as version FROM schema_versions").get()?.version||0}}function P6(){if(!h0)throw new Error("Database not initialized. Call DatabaseManager.getInstance().initialize() first.");return h0}async function k6(){return await nD.getInstance().initialize()}tD();var L4={version:1,up:(D)=>{D.run(` CREATE TABLE IF NOT EXISTS sessions ( id INTEGER PRIMARY KEY AUTOINCREMENT, session_id TEXT UNIQUE NOT NULL, @@ -314,7 +445,7 @@ To restore files: claude-mem restore`),console.log("To empty trash: claude-mem DROP TABLE IF EXISTS overviews; DROP TABLE IF EXISTS memories; DROP TABLE IF EXISTS sessions; - `)}},A4={version:2,up:(D)=>{D.run(` + `)}},I4={version:2,up:(D)=>{D.run(` ALTER TABLE memories ADD COLUMN title TEXT; ALTER TABLE memories ADD COLUMN subtitle TEXT; ALTER TABLE memories ADD COLUMN facts TEXT; @@ -323,7 +454,7 @@ To restore files: claude-mem restore`),console.log("To empty trash: claude-mem `),D.run(` CREATE INDEX IF NOT EXISTS idx_memories_title ON memories(title); CREATE INDEX IF NOT EXISTS idx_memories_concepts ON memories(concepts); - `),console.log("\u2705 Added hierarchical memory fields to memories table")},down:(D)=>{console.log("\u26A0\uFE0F Warning: SQLite ALTER TABLE DROP COLUMN not fully supported"),console.log("\u26A0\uFE0F To rollback, manually recreate the memories table")}},H4={version:3,up:(D)=>{D.run(` + `),console.log("\u2705 Added hierarchical memory fields to memories table")},down:(D)=>{console.log("\u26A0\uFE0F Warning: SQLite ALTER TABLE DROP COLUMN not fully supported"),console.log("\u26A0\uFE0F To rollback, manually recreate the memories table")}},N4={version:3,up:(D)=>{D.run(` CREATE TABLE IF NOT EXISTS streaming_sessions ( id INTEGER PRIMARY KEY AUTOINCREMENT, claude_session_id TEXT UNIQUE NOT NULL, @@ -348,7 +479,7 @@ To restore files: claude-mem restore`),console.log("To empty trash: claude-mem CREATE INDEX IF NOT EXISTS idx_streaming_sessions_started ON streaming_sessions(started_at_epoch DESC); `),console.log("\u2705 Created streaming_sessions table for real-time session tracking")},down:(D)=>{D.run(` DROP TABLE IF EXISTS streaming_sessions; - `)}},U4={version:4,up:(D)=>{D.run(` + `)}},T4={version:4,up:(D)=>{D.run(` CREATE TABLE IF NOT EXISTS sdk_sessions ( id INTEGER PRIMARY KEY AUTOINCREMENT, claude_session_id TEXT UNIQUE NOT NULL, @@ -424,5 +555,33 @@ To restore files: claude-mem restore`),console.log("To empty trash: claude-mem DROP TABLE IF EXISTS observations; DROP TABLE IF EXISTS observation_queue; DROP TABLE IF EXISTS sdk_sessions; - `)}},P6=[V4,A4,H4,U4];function G4(D){let u=D.status==="pass"?"\u2705":D.status==="warn"?"\u26A0\uFE0F ":"\u274C",F=D.details?`${D.name}: ${D.details}`:D.name;console.log(`${u} ${F}`)}async function k6(D={}){let u=O.getInstance(),F=[];try{let C=u.getDataDirectory();if(!qu.existsSync(C))qu.mkdirSync(C,{recursive:!0}),F.push({name:`Data directory created at ${C}`,status:"warn"});else{let B=qu.statSync(C),$=!1;try{qu.accessSync(C,qu.constants.W_OK),$=!0}catch{}F.push({name:`Data directory ${C}`,status:B.isDirectory()&&$?"pass":"fail",details:B.isDirectory()&&$?"accessible":"not writable"})}}catch(C){F.push({name:"Data directory",status:"fail",details:C?.message||String(C)})}try{let C=new _D;F.push({name:"SQLite database",status:"pass",details:"connected"})}catch(C){F.push({name:"SQLite database",status:"fail",details:C?.message||String(C)})}try{let C=u.getChromaDirectory(),B=qu.existsSync(C);F.push({name:"Chroma vector store",status:B?"pass":"warn",details:B?`data dir ${z4.resolve(C)}`:"Not yet initialized"})}catch(C){F.push({name:"Chroma vector store",status:"warn",details:C?.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(G4)}HD();import{readFileSync as X2,existsSync as h0,readdirSync as W4,statSync as _4}from"fs";import{join as g0,dirname as j4}from"path";import{execSync as M4}from"child_process";import{fileURLToPath as R4}from"url";var eQ=j4(R4(import.meta.url));async function S6(){console.log("\uD83D\uDD0D Claude Memory System Status Check"),console.log(`===================================== -`);let D=O.getInstance();console.log("\u2699\uFE0F Settings Configuration:");let u=(X,Z)=>{if(!h0(Z)){console.log(` \u23ED\uFE0F ${X}: No settings file`);return}console.log(` \uD83D\uDCCB ${X}: ${Z}`);try{let J=JSON.parse(X2(Z,"utf8")),V=J.hooks?.SessionStart?.some((G)=>G.hooks?.some((W)=>W.command?.includes("claude-mem"))),A=J.hooks?.Stop?.some((G)=>G.hooks?.some((W)=>W.command?.includes("claude-mem"))),U=J.hooks?.UserPromptSubmit?.some((G)=>G.hooks?.some((W)=>W.command?.includes("claude-mem"))),z=J.hooks?.PostToolUse?.some((G)=>G.hooks?.some((W)=>W.command?.includes("claude-mem")));console.log(` SessionStart (claude-mem context): ${V?"\u2705":"\u274C"}`),console.log(` Stop (claude-mem summary): ${A?"\u2705":"\u274C"}`),console.log(` UserPromptSubmit (claude-mem new): ${U?"\u2705":"\u274C"}`),console.log(` PostToolUse (claude-mem save): ${z?"\u2705":"\u274C"}`)}catch(J){console.log(" \u26A0\uFE0F Could not parse settings")}};u("Global",D.getClaudeSettingsPath()),u("Project",g0(process.cwd(),".claude","settings.json")),console.log(""),console.log("\uD83D\uDCE6 Compressed Transcripts:");let F=g0(D.getClaudeConfigDirectory(),"projects");if(h0(F))try{let X=0,Z=0,J=(V,A=0)=>{if(A>3)return;let U=W4(V);for(let z of U){let G=g0(V,z);if(_4(G).isDirectory()&&!z.startsWith("."))J(G,A+1);else if(z.endsWith(".jsonl.compressed"))X++;else if(z.endsWith(".jsonl.archive"))Z++}};J(F),console.log(` Compressed files: ${X}`),console.log(` Archive files: ${Z}`)}catch(X){console.log(" \u26A0\uFE0F Could not scan projects directory")}else console.log(" \u2139\uFE0F No Claude projects directory found");console.log(""),console.log("\uD83D\uDD27 Runtime Environment:");let C=(X,Z)=>{try{let J=M4(`${X} --version`,{encoding:"utf8"}).trim();console.log(` \u2705 ${Z}: ${J}`)}catch{console.log(` \u274C ${Z}: Not found`)}};C("node","Node.js"),C("bun","Bun"),console.log(""),console.log("\uD83E\uDDE0 Chroma Storage Status:"),console.log(" \u2705 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("\uD83D\uDCCA Summary:");let B=D.getClaudeSettingsPath(),$=g0(process.cwd(),".claude","settings.json"),E=!1,Q="Not installed";try{if(h0(B)){let X=JSON.parse(X2(B,"utf8"));if(X.hooks?.SessionStart||X.hooks?.Stop||X.hooks?.PostToolUse)E=!0,Q="Global"}if(h0($)){let X=JSON.parse(X2($,"utf8"));if(X.hooks?.SessionStart||X.hooks?.Stop||X.hooks?.PostToolUse)E=!0,Q=Q==="Global"?"Global + Project":"Project"}}catch{}if(E)console.log(` \u2705 Claude Memory System is installed (${Q})`),console.log(""),console.log("\uD83D\uDCA1 To test: Use /compact in Claude Code");else console.log(" \u274C Claude Memory System is not installed"),console.log(""),console.log("\uD83D\uDCA1 To install: claude-mem install")}var YD=new k2;YD.name(Au).description(g2).version(h2);YD.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 ","Custom installation path (with --local)").option("--timeout ","Hook execution timeout in milliseconds","180000").option("--skip-mcp","Skip Chroma MCP server installation").option("--force","Force installation even if already installed").action(U8);YD.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(W8);YD.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(j8);var J2=YD.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){J2.outputHelp();return}if(u.R)u.recursive=!0;await z6(D,{force:u.force,recursive:u.recursive})});J2.command("view").description("View contents of trash bin").action(R6);J2.command("empty").description("Permanently delete all files in trash").option("-f, --force","Skip confirmation prompt").action(I6);YD.command("restore").description("Restore files from trash interactively").action(T6);YD.command("doctor").description("Run health checks on claude-mem installation").option("--json","Output results as JSON").action(k6);YD.command("status").description("Show claude-mem system status").action(S6);YD.command("context").description("SessionStart hook - show recent session context").action(async()=>{let{contextHook:D}=await Promise.resolve().then(() => (nu(),pu)),u=await m0();D(JSON.parse(u))});YD.command("new").description("UserPromptSubmit hook - initialize SDK session").action(async()=>{let{newHook:D}=await Promise.resolve().then(() => (nu(),pu)),u=await m0();D(JSON.parse(u))});YD.command("save").description("PostToolUse hook - queue observation").action(async()=>{let{saveHook:D}=await Promise.resolve().then(() => (nu(),pu)),u=await m0();D(JSON.parse(u))});YD.command("summary").description("Stop hook - finalize session").action(async()=>{let{summaryHook:D}=await Promise.resolve().then(() => (nu(),pu)),u=await m0();D(JSON.parse(u))});async function m0(){return new Promise((D)=>{let u="";process.stdin.on("data",(F)=>{u+=F}),process.stdin.on("end",()=>{D(u)})})}YD.parse();export{P6 as migrations,w6 as initializeDatabase,O6 as getDatabase,pD as DatabaseManager}; + `)}},O4={version:5,up:(D)=>{D.run("DROP TABLE IF EXISTS streaming_sessions"),D.run("DROP TABLE IF EXISTS observation_queue"),console.log("\u2705 Dropped orphaned tables: streaming_sessions, observation_queue")},down:(D)=>{D.run(` + 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' + ) + `),D.run(` + CREATE TABLE IF NOT EXISTS observation_queue ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + sdk_session_id TEXT NOT NULL, + tool_name TEXT NOT NULL, + tool_input TEXT NOT NULL, + tool_output TEXT NOT NULL, + created_at_epoch INTEGER NOT NULL, + processed_at_epoch INTEGER, + FOREIGN KEY(sdk_session_id) REFERENCES sdk_sessions(sdk_session_id) ON DELETE CASCADE + ) + `),console.log("\u26A0\uFE0F Recreated streaming_sessions and observation_queue (for rollback only)")}},S6=[L4,I4,N4,T4,O4];function P4(D){let u=D.status==="pass"?"\u2705":D.status==="warn"?"\u26A0\uFE0F ":"\u274C",F=D.details?`${D.name}: ${D.details}`:D.name;console.log(`${u} ${F}`)}async function x6(D={}){let u=T.getInstance(),F=[];try{let C=u.getDataDirectory();if(!Yu.existsSync(C))Yu.mkdirSync(C,{recursive:!0}),F.push({name:`Data directory created at ${C}`,status:"warn"});else{let B=Yu.statSync(C),$=!1;try{Yu.accessSync(C,Yu.constants.W_OK),$=!0}catch{}F.push({name:`Data directory ${C}`,status:B.isDirectory()&&$?"pass":"fail",details:B.isDirectory()&&$?"accessible":"not writable"})}}catch(C){F.push({name:"Data directory",status:"fail",details:C?.message||String(C)})}try{let C=new $D;F.push({name:"SQLite database",status:"pass",details:"connected"})}catch(C){F.push({name:"SQLite database",status:"fail",details:C?.message||String(C)})}try{let C=u.getChromaDirectory(),B=Yu.existsSync(C);F.push({name:"Chroma vector store",status:B?"pass":"warn",details:B?`data dir ${w4.resolve(C)}`:"Not yet initialized"})}catch(C){F.push({name:"Chroma vector store",status:"warn",details:C?.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(P4)}FD();import{readFileSync as Z2,existsSync as g0,readdirSync as k4,statSync as S4}from"fs";import{join as m0,dirname as x4}from"path";import{execSync as v4}from"child_process";import{fileURLToPath as f4}from"url";var _X=x4(f4(import.meta.url));async function v6(){console.log("\uD83D\uDD0D Claude Memory System Status Check"),console.log(`===================================== +`);let D=T.getInstance();console.log("\u2699\uFE0F Settings Configuration:");let u=(X,Z)=>{if(!g0(Z)){console.log(` \u23ED\uFE0F ${X}: No settings file`);return}console.log(` \uD83D\uDCCB ${X}: ${Z}`);try{let J=JSON.parse(Z2(Z,"utf8")),V=J.hooks?.SessionStart?.some((G)=>G.hooks?.some((W)=>W.command?.includes("claude-mem"))),A=J.hooks?.Stop?.some((G)=>G.hooks?.some((W)=>W.command?.includes("claude-mem"))),U=J.hooks?.UserPromptSubmit?.some((G)=>G.hooks?.some((W)=>W.command?.includes("claude-mem"))),z=J.hooks?.PostToolUse?.some((G)=>G.hooks?.some((W)=>W.command?.includes("claude-mem")));console.log(` SessionStart (claude-mem context): ${V?"\u2705":"\u274C"}`),console.log(` Stop (claude-mem summary): ${A?"\u2705":"\u274C"}`),console.log(` UserPromptSubmit (claude-mem new): ${U?"\u2705":"\u274C"}`),console.log(` PostToolUse (claude-mem save): ${z?"\u2705":"\u274C"}`)}catch(J){console.log(" \u26A0\uFE0F Could not parse settings")}};u("Global",D.getClaudeSettingsPath()),u("Project",m0(process.cwd(),".claude","settings.json")),console.log(""),console.log("\uD83D\uDCE6 Compressed Transcripts:");let F=m0(D.getClaudeConfigDirectory(),"projects");if(g0(F))try{let X=0,Z=0,J=(V,A=0)=>{if(A>3)return;let U=k4(V);for(let z of U){let G=m0(V,z);if(S4(G).isDirectory()&&!z.startsWith("."))J(G,A+1);else if(z.endsWith(".jsonl.compressed"))X++;else if(z.endsWith(".jsonl.archive"))Z++}};J(F),console.log(` Compressed files: ${X}`),console.log(` Archive files: ${Z}`)}catch(X){console.log(" \u26A0\uFE0F Could not scan projects directory")}else console.log(" \u2139\uFE0F No Claude projects directory found");console.log(""),console.log("\uD83D\uDD27 Runtime Environment:");let C=(X,Z)=>{try{let J=v4(`${X} --version`,{encoding:"utf8"}).trim();console.log(` \u2705 ${Z}: ${J}`)}catch{console.log(` \u274C ${Z}: Not found`)}};C("node","Node.js"),C("bun","Bun"),console.log(""),console.log("\uD83E\uDDE0 Chroma Storage Status:"),console.log(" \u2705 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("\uD83D\uDCCA Summary:");let B=D.getClaudeSettingsPath(),$=m0(process.cwd(),".claude","settings.json"),E=!1,Q="Not installed";try{if(g0(B)){let X=JSON.parse(Z2(B,"utf8"));if(X.hooks?.SessionStart||X.hooks?.Stop||X.hooks?.PostToolUse)E=!0,Q="Global"}if(g0($)){let X=JSON.parse(Z2($,"utf8"));if(X.hooks?.SessionStart||X.hooks?.Stop||X.hooks?.PostToolUse)E=!0,Q=Q==="Global"?"Global + Project":"Project"}}catch{}if(E)console.log(` \u2705 Claude Memory System is installed (${Q})`),console.log(""),console.log("\uD83D\uDCA1 To test: Use /compact in Claude Code");else console.log(" \u274C Claude Memory System is not installed"),console.log(""),console.log("\uD83D\uDCA1 To install: claude-mem install")}var QD=new x2;QD.name(Hu).description(c2).version(m2);QD.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 ","Custom installation path (with --local)").option("--timeout ","Hook execution timeout in milliseconds","180000").option("--skip-mcp","Skip Chroma MCP server installation").option("--force","Force installation even if already installed").action(G8);QD.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(j8);QD.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(R8);var Y2=QD.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){Y2.outputHelp();return}if(u.R)u.recursive=!0;await W6(D,{force:u.force,recursive:u.recursive})});Y2.command("view").description("View contents of trash bin").action(I6);Y2.command("empty").description("Permanently delete all files in trash").option("-f, --force","Skip confirmation prompt").action(T6);QD.command("restore").description("Restore files from trash interactively").action(w6);QD.command("doctor").description("Run health checks on claude-mem installation").option("--json","Output results as JSON").action(x6);QD.command("status").description("Show claude-mem system status").action(v6);QD.command("context").description("SessionStart hook - show recent session context").action(async()=>{let{contextHook:D}=await Promise.resolve().then(() => (iu(),nu)),u=await c0();D(JSON.parse(u))});QD.command("new").description("UserPromptSubmit hook - initialize SDK session").action(async()=>{let{newHook:D}=await Promise.resolve().then(() => (iu(),nu)),u=await c0();D(JSON.parse(u))});QD.command("save").description("PostToolUse hook - queue observation").action(async()=>{let{saveHook:D}=await Promise.resolve().then(() => (iu(),nu)),u=await c0();D(JSON.parse(u))});QD.command("summary").description("Stop hook - finalize session").action(async()=>{let{summaryHook:D}=await Promise.resolve().then(() => (iu(),nu)),u=await c0();D(JSON.parse(u))});QD.command("worker ").description("Run SDK worker process (internal use)").action(async(D)=>{try{let{main:u}=await Promise.resolve().then(() => (D1(),e6));process.argv[2]=D,await u()}catch(u){console.error(`[SDK Worker] Fatal error: ${u.message}`),process.exit(1)}});async function c0(){return new Promise((D)=>{let u="";process.stdin.on("data",(F)=>{u+=F}),process.stdin.on("end",()=>{D(u)})})}QD.parse();export{S6 as migrations,k6 as initializeDatabase,P6 as getDatabase,nD as DatabaseManager}; diff --git a/docs/CODEMAP.md b/docs/CODEMAP.md new file mode 100644 index 00000000..aa5cdd30 --- /dev/null +++ b/docs/CODEMAP.md @@ -0,0 +1,1524 @@ +# Claude-Mem Codebase Map + +**Version**: 3.9.16 +**Description**: Memory compression system for Claude Code - persist context across sessions + +--- + +## Table of Contents + +1. [Project Overview](#project-overview) +2. [Architecture Overview](#architecture-overview) +3. [Directory Structure](#directory-structure) +4. [Core Components](#core-components) +5. [Entry Points & CLI](#entry-points--cli) +6. [Commands](#commands) +7. [Hooks System](#hooks-system) +8. [SDK & Worker](#sdk--worker) +9. [Services](#services) +10. [Shared Components](#shared-components) +11. [Utilities](#utilities) +12. [Key Workflows](#key-workflows) + +--- + +## Project Overview + +**claude-mem** is a sophisticated memory compression system designed to persist context across Claude Code sessions. It provides: + +- **Automatic memory capture** via Claude Code hooks (SessionStart, Stop, UserPromptSubmit, PostToolUse) +- **SDK-powered intelligence** that extracts meaningful insights from tool observations +- **Vector storage** using Chroma MCP for semantic search +- **SQLite persistence** for structured data and session summaries +- **Smart trash system** with file recovery capabilities +- **Cross-platform support** (Windows, macOS, Linux) + +--- + +## Architecture Overview + +### High-Level Flow + +``` +User Works in Claude Code + ↓ + Hooks Trigger + ↓ +┌────────────────────────────────────┐ +│ SessionStart → context hook │ Shows recent memories +│ UserPromptSubmit → new hook │ Spawns SDK worker +│ PostToolUse → save hook │ Queues observations +│ Stop → summary hook │ Finalizes session +└────────────────────────────────────┘ + ↓ + SDK Worker Process + (Background daemon) + ↓ + ┌──────────────────────┐ + │ Claude Agent SDK │ Analyzes observations + │ Streaming Session │ Extracts insights + └──────────────────────┘ + ↓ + ┌─────────┬─────────┐ + │ SQLite │ Chroma │ Persistent storage + └─────────┴─────────┘ + ↓ + Next Session Start + (Memories restored) +``` + +### Key Components + +1. **CLI Layer** (`src/bin/cli.ts`) - User-facing commands +2. **Hooks Layer** (`src/hooks/`) - Claude Code integration points +3. **SDK Layer** (`src/sdk/`) - Background intelligence worker +4. **Storage Layer** (`src/services/sqlite/`) - Data persistence +5. **Services Layer** (`src/services/`) - Path discovery, utilities + +--- + +## Directory Structure + +``` +src/ +├── bin/ # CLI entry point +│ └── cli.ts # Commander-based CLI router +├── commands/ # CLI command implementations +│ ├── install.ts # Hook installation wizard +│ ├── uninstall.ts # Hook removal +│ ├── doctor.ts # Health checks +│ ├── status.ts # System status +│ ├── logs.ts # Log viewer +│ ├── trash.ts # Move files to trash +│ ├── trash-view.ts # View trash contents +│ ├── trash-empty.ts # Empty trash +│ └── restore.ts # Restore from trash +├── hooks/ # Claude Code hook handlers +│ ├── index.ts # Hook exports +│ ├── context.ts # SessionStart hook +│ ├── new.ts # UserPromptSubmit hook +│ ├── save.ts # PostToolUse hook +│ └── summary.ts # Stop hook +├── sdk/ # Agent SDK integration +│ ├── index.ts # SDK exports +│ ├── worker.ts # Background worker process +│ ├── prompts.ts # Prompt builders for SDK +│ └── parser.ts # XML response parser +├── services/ # Core services +│ ├── path-discovery.ts # Cross-platform path resolution +│ └── sqlite/ # Database layer +│ ├── index.ts # Database exports +│ ├── Database.ts # SQLite manager with migrations +│ ├── HooksDatabase.ts # Lightweight hooks interface +│ ├── migrations.ts # Schema migrations +│ └── types.ts # TypeScript interfaces +├── shared/ # Shared configuration +│ ├── config.ts # Package metadata +│ ├── storage.ts # Storage provider interface +│ └── types.ts # Core type definitions +└── utils/ # Utility functions + └── platform.ts # Platform-specific helpers +``` + +--- + +## Core Components + +### Entry Points & CLI + +#### `src/bin/cli.ts` + +**Purpose**: Main CLI entry point using Commander.js + +**Key Responsibilities**: +- Route CLI commands to handlers +- Define command-line arguments and options +- Handle stdin for hook commands +- Export database utilities for programmatic use + +**Key Functions**: +- `readStdin()`: Reads JSON input from stdin for hooks +- Command definitions: + - `install`: Install hooks wizard + - `uninstall`: Remove hooks + - `doctor`: Health check + - `status`: System status + - `logs`: View operation logs + - `trash [files...]`: Move files to trash + - `trash view`: View trash contents + - `trash empty`: Empty trash + - `restore`: Restore from trash + - `context`: SessionStart hook (internal) + - `new`: UserPromptSubmit hook (internal) + - `save`: PostToolUse hook (internal) + - `summary`: Stop hook (internal) + - `worker `: SDK worker (internal) + +**Exports**: +```typescript +export { DatabaseManager, migrations, initializeDatabase, getDatabase } +``` + +--- + +## Commands + +### `src/commands/install.ts` + +**Purpose**: Interactive installation wizard for claude-mem hooks + +**Key Functions**: + +- **`install(options)`**: Main installation flow + - Creates directory structure + - Installs uv package manager + - Configures Claude Code hooks + - Installs Chroma MCP server + - Adds CLAUDE.md instructions + - Optionally configures Smart Trash alias + +- **`runInstallationWizard(existingInstall)`**: Interactive prompts + - Scope selection (user/project/local) + - Hook timeout configuration + - Smart Trash opt-in + - Save-on-clear opt-in + +- **`ensureDirectoryStructure()`**: Creates all data directories +- **`configureHooks(settingsPath)`**: Writes Claude settings.json +- **`installChromaMcp(forceReinstall)`**: Installs Chroma MCP via `claude mcp add` +- **`ensureClaudeMdInstructions()`**: Adds/updates CLAUDE.md quick reference +- **`configureSmartTrashAlias()`**: Adds `rm` alias to shell configs +- **`installClaudeCommands()`**: Copies slash commands to ~/.claude/commands/ + +**Installation Scopes**: +- **User**: `~/.claude/settings.json` (recommended) +- **Project**: `./.claude/settings.json` (project-specific) +- **Local**: Custom path + +**Hook Configuration**: +```json +{ + "hooks": { + "SessionStart": [{ "hooks": [{ "type": "command", "command": "claude-mem context", "timeout": 180 }] }], + "Stop": [{ "hooks": [{ "type": "command", "command": "claude-mem summary", "timeout": 60 }] }], + "UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "claude-mem new", "timeout": 60 }] }], + "PostToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "claude-mem save", "timeout": 180 }] }] + } +} +``` + +--- + +### `src/commands/uninstall.ts` + +**Purpose**: Remove claude-mem hooks from Claude Code settings + +**Key Functions**: +- **`uninstall(options)`**: Removes hooks from settings + - Supports `--user`, `--project`, `--all` flags + - Creates backups before modification + - Removes Smart Trash alias from shell configs +- **`removeSmartTrashAlias()`**: Cleans up shell configuration files + +--- + +### `src/commands/doctor.ts` + +**Purpose**: Run health checks on claude-mem installation + +**Key Functions**: +- **`doctor(options)`**: System health diagnostics + - Checks data directory existence and permissions + - Tests SQLite database connectivity + - Verifies Chroma vector store initialization + - Outputs results as JSON with `--json` flag + +**Check Results**: +- ✅ `pass`: System component healthy +- ⚠️ `warn`: Non-critical issue +- ❌ `fail`: Critical problem + +--- + +### `src/commands/status.ts` + +**Purpose**: Display comprehensive system status + +**Key Functions**: +- **`status()`**: Shows complete system state + - Hook configuration (global and project) + - Compressed transcript counts + - Archive counts + - Runtime environment (Node.js, Bun) + - Chroma storage status + - Installation summary + +--- + +### `src/commands/logs.ts` + +**Purpose**: View claude-mem operation logs + +**Key Functions**: +- **`logs(options)`**: Display log files + - Shows last N lines (default: 20) + - Finds most recent log file + - Supports `--tail` option +- **`showLog(logPath, logType, tail)`**: Formats and displays log content + +**Log Location**: `~/.claude-mem/logs/claude-mem-{timestamp}.log` + +--- + +### `src/commands/trash.ts` + +**Purpose**: Smart trash implementation - safer file deletion + +**Key Functions**: +- **`trash(filePaths, options)`**: Move files to trash + - Supports glob patterns + - `-r, --recursive`: Remove directories + - `-f, --force`: Suppress errors + - Adds timestamp to avoid conflicts + +**Trash Location**: `~/.claude-mem/trash/` + +--- + +### `src/commands/trash-view.ts` + +**Purpose**: Display trash contents with metadata + +**Key Functions**: +- **`viewTrash()`**: Shows trash items + - Original filename + - Size (files and directories) + - Timestamp + - Restore instructions +- **`formatSize(bytes)`**: Human-readable file sizes +- **`getDirectorySize(dirPath)`**: Recursive size calculation + +--- + +### `src/commands/trash-empty.ts` + +**Purpose**: Permanently delete all trash contents + +**Key Functions**: +- **`emptyTrash(options)`**: Clear trash + - Confirmation prompt (unless `--force`) + - Shows counts before deletion + - Recursive removal of all items + +--- + +### `src/commands/restore.ts` + +**Purpose**: Interactive file restoration from trash + +**Key Functions**: +- **`restore()`**: Restore files + - Interactive file selection + - Restores to current directory + - Preserves original filename + +--- + +## Hooks System + +The hooks system integrates claude-mem with Claude Code's lifecycle events. + +### `src/hooks/index.ts` + +**Purpose**: Export all hook handlers + +**Exports**: +```typescript +export { contextHook } from './context.js'; +export { saveHook } from './save.js'; +export { newHook } from './new.js'; +export { summaryHook } from './summary.js'; +``` + +--- + +### `src/hooks/context.ts` + +**Purpose**: SessionStart hook - provides recent session context + +**Trigger**: When Claude Code starts a new session (source='startup') + +**Key Functions**: +- **`contextHook(input)`**: Load and display recent memories + - Extracts project name from `cwd` + - Queries last 5 session summaries + - Formats as markdown for Claude to read + - Only runs on startup (not resume) + +**Input**: +```typescript +interface SessionStartInput { + session_id: string; + cwd: string; + source?: string; // 'startup' | 'resume' +} +``` + +**Output** (to stdout): +```markdown +# Recent Session Context + +Here's what happened in recent {project} sessions: + +--- + +**Request:** {what user asked} +**Completed:** {what was done} +**Learned:** {key insights} +**Next Steps:** {future work} +**Files Edited:** file1.ts, file2.ts +**Date:** 2025-10-15 +``` + +--- + +### `src/hooks/new.ts` + +**Purpose**: UserPromptSubmit hook - initializes SDK session + +**Trigger**: When user submits their first prompt in a session + +**Key Functions**: +- **`newHook(input)`**: Start SDK worker + - Creates SDK session record in SQLite + - Spawns detached worker process via `claude-mem worker {sessionId}` + - Returns immediately (non-blocking) + +**Input**: +```typescript +interface UserPromptSubmitInput { + session_id: string; + cwd: string; + prompt: string; +} +``` + +**Workflow**: +1. Check if SDK session already exists (prevent duplicates) +2. Create `sdk_sessions` table record with status='active' +3. Spawn worker: `spawn('claude-mem', ['worker', sessionId], { detached: true, stdio: 'ignore' })` +4. Output: `{"continue": true, "suppressOutput": true}` + +**Worker Lifecycle**: The spawned worker runs in the background until Stop hook + +--- + +### `src/hooks/save.ts` + +**Purpose**: PostToolUse hook - queues tool observations + +**Trigger**: After every tool execution in Claude Code + +**Key Functions**: +- **`saveHook(input)`**: Send observation to worker + - Skips low-value tools (TodoWrite, ListMcpResourcesTool) + - Finds active SDK session + - Sends observation via Unix socket to worker + +**Input**: +```typescript +interface PostToolUseInput { + session_id: string; + cwd: string; + tool_name: string; + tool_input: any; + tool_output: any; +} +``` + +**Skipped Tools**: +- `TodoWrite`: Too noisy +- `ListMcpResourcesTool`: Not meaningful + +**Communication**: Unix socket at `~/.claude-mem/worker-{sessionId}.sock` + +**Message Format**: +```json +{ + "type": "observation", + "tool_name": "Read", + "tool_input": "{\"file_path\": \"/path/to/file.ts\"}", + "tool_output": "{\"content\": \"...\"}" +} +``` + +--- + +### `src/hooks/summary.ts` + +**Purpose**: Stop hook - finalizes SDK session + +**Trigger**: When Claude Code session ends (user closes or `/clear`) + +**Key Functions**: +- **`summaryHook(input)`**: Signal worker to finalize + - Finds active SDK session + - Sends FINALIZE message via Unix socket + - Worker generates summary and stores to database + +**Input**: +```typescript +interface StopInput { + session_id: string; + cwd: string; +} +``` + +**Message Format**: +```json +{ + "type": "finalize" +} +``` + +**Worker Action**: Generates structured summary and stores to `session_summaries` table + +--- + +## SDK & Worker + +The SDK worker is a background daemon that analyzes tool observations using Claude Agent SDK. + +### `src/sdk/worker.ts` + +**Purpose**: Background process that synthesizes observations into insights + +**Key Class**: `SDKWorker` + +**Lifecycle**: +``` +1. new hook spawns worker + ↓ +2. Worker starts Unix socket server + ↓ +3. Worker initializes SDK streaming session + ↓ +4. save hooks send observations via socket + ↓ +5. Worker feeds observations to SDK agent + ↓ +6. SDK agent extracts insights (observations) + ↓ +7. summary hook sends finalize message + ↓ +8. SDK agent generates summary + ↓ +9. Worker stores summary and exits +``` + +**Key Methods**: + +- **`main()`**: Entry point + - Parses sessionDbId from argv + - Creates SDKWorker instance + - Calls `run()` + +- **`run()`**: Main worker loop + - Loads session from database + - Starts Unix socket server + - Runs SDK agent with streaming input + - Marks session as completed/failed + - Cleans up socket + +- **`startSocketServer()`**: Creates Unix socket + - Socket path: `~/.claude-mem/worker-{sessionId}.sock` + - Receives observation and finalize messages + - Adds messages to `pendingMessages` queue + +- **`handleMessage(message)`**: Process incoming messages + - Queues observations for SDK processing + - Sets `isFinalized` flag on finalize message + +- **`runSDKAgent()`**: Initialize SDK streaming session + - Model: `claude-sonnet-4-5` + - Disallowed tools: `Glob, Grep, ListMcpResourcesTool, WebSearch` + - Streaming input via async generator + - Captures SDK session ID from init message + +- **`createMessageGenerator()`**: Async generator for SDK + - Yields initial prompt + - Polls `pendingMessages` queue + - Yields observation prompts + - Yields finalize prompt when session ends + +- **`handleAgentMessage(content)`**: Parse SDK responses + - Extracts `` blocks → stores to `observations` table + - Extracts `` block → stores to `session_summaries` table + +- **`cleanup()`**: Shutdown + - Closes socket server + - Deletes socket file + +**Socket Message Types**: +- `observation`: Tool execution to analyze +- `finalize`: Generate summary and exit + +**SDK Session Configuration**: +```typescript +await query({ + model: 'claude-sonnet-4-5', + messages: () => this.createMessageGenerator(), + disallowedTools: ['Glob', 'Grep', 'ListMcpResourcesTool', 'WebSearch'], + signal: this.abortController.signal, + onSystemInitMessage: (msg) => { + // Capture SDK session ID + }, + onAgentMessage: (msg) => { + // Parse observations and summaries + } +}); +``` + +--- + +### `src/sdk/prompts.ts` + +**Purpose**: Build prompts for SDK agent + +**Key Functions**: + +- **`buildInitPrompt(project, sessionId, userPrompt)`**: Initialize SDK agent + - Explains the agent's role + - Defines what to capture (decisions, bugfixes, features, refactorings, discoveries) + - Defines what NOT to capture (routine operations, WIP, obvious facts) + - Provides XML format for observations + +- **`buildObservationPrompt(obs)`**: Send tool observation + - Shows tool name, time, input, output + - Asks: "Is this worth remembering?" + - If yes, output `......` + +- **`buildFinalizePrompt(session)`**: Generate session summary + - Reviews all observations + - Generates structured summary with 8 required fields + +**Observation Types**: +- `decision`: Architecture or design decisions +- `bugfix`: Bug fixes +- `feature`: New functionality +- `refactor`: Code restructuring +- `discovery`: New findings + +**XML Formats**: + +**Observation**: +```xml + + feature + Implemented JWT token refresh flow with 7-day expiry + +``` + +**Summary**: +```xml + + User's request + What we explored + Key insights + What was done + Future work + + src/auth.ts + + + src/auth.ts + + Additional notes + +``` + +**Types**: +```typescript +export interface Observation { + id: number; + tool_name: string; + tool_input: string; + tool_output: string; + created_at_epoch: number; +} + +export interface SDKSession { + id: number; + sdk_session_id: string | null; + project: string; + user_prompt: string; +} +``` + +--- + +### `src/sdk/parser.ts` + +**Purpose**: Parse XML observation and summary blocks from SDK responses + +**Key Functions**: + +- **`parseObservations(text)`**: Extract observation blocks + - Regex: `/\s*([^<]+)<\/type>\s*([^<]+)<\/text>\s*<\/observation>/g` + - Validates observation type (decision/bugfix/feature/refactor/discovery) + - Returns array of observations + +- **`parseSummary(text)`**: Extract summary block + - Regex: `/([\s\S]*?)<\/summary>/` + - Extracts 8 required fields + - Extracts file arrays + - Returns null if missing required fields + +- **`extractField(content, fieldName)`**: Extract simple text field +- **`extractFileArray(content, arrayName)`**: Extract file list + +**Types**: +```typescript +export interface ParsedObservation { + type: string; + text: string; +} + +export interface ParsedSummary { + request: string; + investigated: string; + learned: string; + completed: string; + next_steps: string; + files_read: string[]; + files_edited: string[]; + notes: string; +} +``` + +--- + +### `src/sdk/index.ts` + +**Purpose**: Export SDK module components + +**Exports**: +```typescript +export { buildInitPrompt, buildObservationPrompt, buildFinalizePrompt } from './prompts.js'; +export { parseObservations, parseSummary } from './parser.js'; +export type { Observation, SDKSession } from './prompts.js'; +export type { ParsedObservation, ParsedSummary } from './parser.js'; +``` + +--- + +## Services + +### `src/services/path-discovery.ts` + +**Purpose**: Central path resolution service for cross-platform compatibility + +**Key Class**: `PathDiscovery` (Singleton) + +**Key Responsibilities**: +- Discover paths across different installation scenarios (global npm, local, development) +- Handle cross-platform differences (Windows, macOS, Linux) +- Support environment variable overrides +- Find package resources (hooks, commands) + +**Key Methods**: + +**Data Directories**: +- `getDataDirectory()`: `~/.claude-mem` (or CLAUDE_MEM_DATA_DIR) +- `getArchivesDirectory()`: `~/.claude-mem/archives` +- `getLogsDirectory()`: `~/.claude-mem/logs` +- `getIndexDirectory()`: `~/.claude-mem` +- `getIndexPath()`: `~/.claude-mem/claude-mem-index.jsonl` +- `getTrashDirectory()`: `~/.claude-mem/trash` +- `getBackupsDirectory()`: `~/.claude-mem/backups` +- `getChromaDirectory()`: `~/.claude-mem/chroma` +- `getProjectArchiveDirectory(projectName)`: `~/.claude-mem/archives/{project}` +- `getUserSettingsPath()`: `~/.claude-mem/settings.json` + +**Claude Integration Paths**: +- `getClaudeConfigDirectory()`: `~/.claude` (or CLAUDE_CONFIG_DIR) +- `getClaudeSettingsPath()`: `~/.claude/settings.json` +- `getClaudeCommandsDirectory()`: `~/.claude/commands` +- `getClaudeMdPath()`: `~/.claude/CLAUDE.md` +- `getMcpConfigPath()`: `~/.claude.json` +- `getProjectMcpConfigPath()`: `./.mcp.json` + +**Package Discovery**: +- `getPackageRoot()`: Find claude-mem package root (3 fallback methods) +- `findPackageCommandsDirectory()`: Find commands directory in package + +**Utility Methods**: +- `ensureDirectory(dirPath)`: Create directory if missing +- `ensureDirectories(dirPaths)`: Create multiple directories +- `ensureAllDataDirectories()`: Create all claude-mem data dirs +- `ensureAllClaudeDirectories()`: Create all Claude integration dirs + +**Static Helpers**: +- `PathDiscovery.extractProjectName(filePath)`: Extract project from path +- `PathDiscovery.getCurrentProjectName()`: Get current project (git root or cwd) +- `PathDiscovery.createBackupFilename(originalPath)`: Generate timestamped backup +- `PathDiscovery.isPathAccessible(path)`: Check path existence and access + +**Environment Overrides**: +- `CLAUDE_MEM_DATA_DIR`: Override data directory +- `CLAUDE_CONFIG_DIR`: Override Claude config directory + +--- + +### `src/services/sqlite/Database.ts` + +**Purpose**: SQLite database manager with migration support + +**Key Class**: `DatabaseManager` (Singleton) + +**Key Responsibilities**: +- Initialize SQLite database with optimized settings +- Run schema migrations in order +- Provide transaction support +- Manage connection lifecycle + +**Key Methods**: + +- **`initialize()`**: Setup database + - Creates data directory + - Opens database: `~/.claude-mem/claude-mem.db` + - Applies optimized pragmas + - Initializes schema_versions table + - Runs pending migrations + +- **`getConnection()`**: Get active database connection + +- **`withTransaction(fn)`**: Execute function in transaction + +- **`close()`**: Close database connection + +- **`registerMigration(migration)`**: Add migration to queue + +- **`runMigrations()`**: Apply pending migrations + +- **`getCurrentVersion()`**: Get current schema version + +**Optimized SQLite Settings**: +```sql +PRAGMA journal_mode = WAL; -- Write-Ahead Logging for concurrency +PRAGMA synchronous = NORMAL; -- Balance safety and performance +PRAGMA foreign_keys = ON; -- Enforce relationships +PRAGMA temp_store = memory; -- Use RAM for temp tables +PRAGMA mmap_size = 268435456; -- 256MB memory-mapped I/O +PRAGMA cache_size = 10000; -- Large cache for performance +``` + +**Migration Interface**: +```typescript +interface Migration { + version: number; + up: (db: Database) => void; + down?: (db: Database) => void; +} +``` + +**Exports**: +```typescript +export { DatabaseManager } +export function getDatabase(): Database +export function initializeDatabase(): Promise +``` + +--- + +### `src/services/sqlite/HooksDatabase.ts` + +**Purpose**: Lightweight synchronous database interface for hooks + +**Key Class**: `HooksDatabase` + +**Why Separate?**: Hooks need fast, synchronous operations without complex logic + +**Key Methods**: + +**Session Summaries**: +- **`getRecentSummaries(project, limit)`**: Get last N summaries for project + - Returns: request, investigated, learned, completed, next_steps, files_read, files_edited, notes, created_at + +**SDK Sessions**: +- **`findActiveSDKSession(claudeSessionId)`**: Find active session for Claude session +- **`createSDKSession(claudeSessionId, project, userPrompt)`**: Create new SDK session +- **`updateSDKSessionId(id, sdkSessionId)`**: Update with SDK session ID +- **`markSessionCompleted(id)`**: Mark session as completed +- **`markSessionFailed(id)`**: Mark session as failed + +**Observations** (extracted by SDK): +- **`storeObservation(sdkSessionId, project, type, text)`**: Store insight + +**Session Summaries**: +- **`storeSummary(sdkSessionId, project, summary)`**: Store structured summary + +**Lifecycle**: +- **`close()`**: Close database connection + +--- + +### `src/services/sqlite/migrations.ts` + +**Purpose**: Database schema migrations + +**Migrations**: + +**Migration 001** - Initial schema: +- `sessions`: Core session tracking +- `memories`: Compressed memory chunks +- `overviews`: Session summaries (legacy) +- `diagnostics`: System health logs +- `transcript_events`: Raw conversation events + +**Migration 002** - Hierarchical memory fields: +- Adds: `title`, `subtitle`, `facts`, `concepts`, `files_touched` to memories table + +**Migration 003** - Streaming sessions: +- `streaming_sessions`: Real-time session tracking (DEPRECATED - dropped in migration005) + +**Migration 004** - SDK agent architecture: +- `sdk_sessions`: Track SDK streaming sessions +- `observation_queue`: Pending observations (DEPRECATED - dropped in migration005, superseded by Unix sockets) +- `observations`: Extracted insights +- `session_summaries`: Structured session summaries + +**Migration 005** - Remove orphaned tables: +- Drops `streaming_sessions` (superseded by `sdk_sessions`) +- Drops `observation_queue` (superseded by Unix socket communication in worker.ts) + +**Table Schemas**: + +**`sdk_sessions`**: +```sql +CREATE TABLE sdk_sessions ( + id INTEGER PRIMARY KEY, + claude_session_id TEXT UNIQUE NOT NULL, + sdk_session_id TEXT UNIQUE, + project TEXT NOT NULL, + user_prompt TEXT, + started_at TEXT NOT NULL, + started_at_epoch INTEGER NOT NULL, + completed_at TEXT, + completed_at_epoch INTEGER, + status TEXT CHECK(status IN ('active', 'completed', 'failed')) +); +``` + +**`observations`**: +```sql +CREATE TABLE observations ( + id INTEGER PRIMARY KEY, + sdk_session_id TEXT NOT NULL, + project TEXT NOT NULL, + text TEXT NOT NULL, + type TEXT CHECK(type IN ('decision', 'bugfix', 'feature', 'refactor', 'discovery')), + created_at TEXT NOT NULL, + created_at_epoch INTEGER NOT NULL +); +``` + +**`session_summaries`**: +```sql +CREATE TABLE session_summaries ( + id INTEGER PRIMARY KEY, + sdk_session_id TEXT UNIQUE NOT NULL, + project TEXT NOT NULL, + request TEXT, + investigated TEXT, + learned TEXT, + completed TEXT, + next_steps TEXT, + files_read TEXT, -- JSON array + files_edited TEXT, -- JSON array + notes TEXT, + created_at TEXT NOT NULL, + created_at_epoch INTEGER NOT NULL +); +``` + +**Export**: +```typescript +export const migrations: Migration[] = [ + migration001, + migration002, + migration003, + migration004, + migration005 +]; +``` + +--- + +### `src/services/sqlite/types.ts` + +**Purpose**: TypeScript interfaces for database operations + +**Key Types**: + +**Input Types** (for creating records): +```typescript +export interface SessionInput { + session_id: string; + project: string; + created_at: string; + created_at_epoch: number; + source?: string; + archive_path?: string; + metadata_json?: string; +} + +export interface MemoryInput { + session_id: string; + text: string; + document_id?: string; + keywords?: string; + project: string; + created_at?: string; + created_at_epoch?: number; +} + +export interface OverviewInput { + session_id: string; + content: string; + project: string; + created_at?: string; + created_at_epoch?: number; +} + +export interface DiagnosticInput { + session_id?: string; + message: string; + severity?: 'info' | 'warn' | 'error'; + project: string; + created_at?: string; + created_at_epoch?: number; +} +``` + +**Row Types** (returned from queries): +```typescript +export interface SessionRow { + id: number; + session_id: string; + project: string; + created_at: string; + created_at_epoch: number; + source: string; + archive_path: string | null; + metadata_json: string | null; +} + +export interface MemoryRow { + id: number; + session_id: string; + text: string; + document_id: string | null; + keywords: string | null; + created_at: string; + created_at_epoch: number; + project: string; +} + +export interface OverviewRow { + id: number; + session_id: string; + content: string; + created_at: string; + created_at_epoch: number; + project: string; +} + +export interface DiagnosticRow { + id: number; + session_id: string | null; + message: string; + severity: string; + created_at: string; + created_at_epoch: number; + project: string; +} +``` + +**Utilities**: +```typescript +export function normalizeTimestamp(timestamp: string | Date | number): { + iso: string; + epoch: number; +} +``` + +--- + +### `src/services/sqlite/index.ts` + +**Purpose**: Export all SQLite components + +**Exports**: +```typescript +// Database manager +export { DatabaseManager, getDatabase, initializeDatabase } from './Database.js'; + +// Hooks database +export { HooksDatabase } from './HooksDatabase.js'; + +// Types +export * from './types.js'; + +// Migrations +export { migrations } from './migrations.js'; +``` + +--- + +## Shared Components + +### `src/shared/config.ts` + +**Purpose**: Package metadata configuration + +**Exports**: +```typescript +export const PACKAGE_NAME: string; // 'claude-mem' +export const PACKAGE_VERSION: string; // From package.json or __DEFAULT_PACKAGE_VERSION__ +export const PACKAGE_DESCRIPTION: string; // Project description +export const CLI_NAME: string; // Alias for PACKAGE_NAME +``` + +**Build Process**: Version is replaced by build script using `--define` flag + +--- + +### `src/shared/types.ts` + +**Purpose**: Core type definitions + +**Key Types**: + +```typescript +export interface Settings { + autoCompress?: boolean; + projectName?: string; + installed?: boolean; + backend?: string; // 'chroma' + embedded?: boolean; + saveMemoriesOnClear?: boolean; + claudePath?: string; + rollingCaptureEnabled?: boolean; + rollingSummaryEnabled?: boolean; + rollingSessionStartEnabled?: boolean; + rollingChunkTokens?: number; + rollingChunkOverlapTokens?: number; + rollingSummaryTurnLimit?: number; + [key: string]: unknown; +} +``` + +--- + +### `src/shared/storage.ts` + +**Purpose**: Storage provider abstraction (currently SQLite-only) + +**Key Interfaces**: + +```typescript +export type StorageBackend = 'sqlite' | 'jsonl'; + +export interface IStorageProvider { + backend: StorageBackend; + + // Session operations + createSession(session: SessionInput): Promise; + getSession(sessionId: string): Promise; + hasSession(sessionId: string): Promise; + getAllSessionIds(): Promise>; + getRecentSessions(limit?: number): Promise; + getRecentSessionsForProject(project: string, limit?: number): Promise; + + // Memory operations + createMemory(memory: MemoryInput): Promise; + createMemories(memories: MemoryInput[]): Promise; + getRecentMemories(limit?: number): Promise; + getRecentMemoriesForProject(project: string, limit?: number): Promise; + hasDocumentId(documentId: string): Promise; + + // Overview operations + createOverview(overview: OverviewInput): Promise; + upsertOverview(overview: OverviewInput): Promise; + getRecentOverviews(limit?: number): Promise; + getRecentOverviewsForProject(project: string, limit?: number): Promise; + + // Diagnostic operations + createDiagnostic(diagnostic: DiagnosticInput): Promise; + + // Health check + isAvailable(): Promise; +} +``` + +**Implementation**: +```typescript +export class SQLiteStorageProvider implements IStorageProvider { + // ... implementation +} + +export async function getStorageProvider(): Promise +``` + +--- + +## Utilities + +### `src/utils/platform.ts` + +**Purpose**: Platform-specific utilities for cross-platform compatibility + +**Key Functions**: + +- **`Platform.findExecutable(name)`**: Find path to executable + - Windows: `where {name}` + - Unix: `which {name}` + +- **`Platform.installUv()`**: Install uv package manager + - Windows: PowerShell script + - Unix: curl + sh script + +- **`Platform.getShellConfigPaths()`**: Get shell config files + - Windows: PowerShell profiles + - Unix: `.bashrc`, `.zshrc`, `.bash_profile` + +- **`Platform.getAliasDefinition(aliasName, command)`**: Get alias syntax + - Windows: `function aliasName { command $args }` + - Unix: `alias aliasName='command'` + +**Platform Detection**: +```typescript +const isWindows = platform() === 'win32'; +``` + +**Shell Configs**: +- **Windows**: + - `~/Documents/PowerShell/Microsoft.PowerShell_profile.ps1` + - `~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1` +- **Unix**: + - `~/.bashrc` + - `~/.zshrc` + - `~/.bash_profile` + +--- + +## Key Workflows + +### 1. Installation Flow + +``` +User runs: claude-mem install + ↓ +1. Interactive wizard + - Select scope (user/project/local) + - Configure timeouts + - Enable Smart Trash? + - Enable save-on-clear? + ↓ +2. Install uv package manager + ↓ +3. Create directory structure + ~/.claude-mem/ + ├── archives/ + ├── logs/ + ├── trash/ + ├── backups/ + └── chroma/ + ↓ +4. Install Chroma MCP server + claude mcp add claude-mem -- uvx chroma-mcp ... + ↓ +5. Configure Claude hooks + ~/.claude/settings.json + ↓ +6. Add CLAUDE.md instructions + ~/.claude/CLAUDE.md + ↓ +7. Install slash commands + ~/.claude/commands/ + ├── save.md + ├── remember.md + └── claude-mem.md + ↓ +8. Configure Smart Trash alias (optional) + Add to shell config: + alias rm="claude-mem trash" + ↓ +9. Show success message +``` + +--- + +### 2. Session Memory Capture Flow + +``` +User starts Claude Code + ↓ +SessionStart hook fires + ↓ +context hook runs + ↓ +Query recent summaries for project + ↓ +Output markdown to Claude + ↓ +User sees context: +"# Recent Session Context + + Here's what happened in recent sessions: + + **Request:** Add authentication + **Completed:** Implemented JWT flow + **Learned:** Token rotation prevents security issues + **Next Steps:** Add refresh token API + **Files Edited:** src/auth.ts, src/middleware.ts" + ↓ +User types first prompt + ↓ +UserPromptSubmit hook fires + ↓ +new hook runs + ↓ +Create sdk_sessions record (status='active') + ↓ +Spawn detached worker: claude-mem worker {sessionId} + ↓ +Worker starts Unix socket server + ↓ +Worker initializes SDK streaming session + ↓ +User works (reads files, edits code, etc.) + ↓ +PostToolUse hook fires after each tool + ↓ +save hook runs + ↓ +Send observation to worker via socket: +{ + "type": "observation", + "tool_name": "Edit", + "tool_input": "{...}", + "tool_output": "{...}" +} + ↓ +Worker receives observation + ↓ +Worker feeds to SDK agent + ↓ +SDK analyzes: "Is this worth remembering?" + ↓ +If yes: SDK outputs: + + feature + Implemented JWT refresh flow with 7-day expiry + + ↓ +Worker parses XML and stores to observations table + ↓ +User finishes work and closes session + ↓ +Stop hook fires + ↓ +summary hook runs + ↓ +Send finalize message to worker: +{ "type": "finalize" } + ↓ +Worker receives finalize + ↓ +Worker sends finalize prompt to SDK + ↓ +SDK reviews all observations + ↓ +SDK generates summary: + + Add JWT authentication + Session management, token storage + Rotation prevents token reuse attacks + Implemented JWT + refresh flow with 7-day expiry + Add token revocation endpoint + + src/auth.ts + + + src/auth.ts + src/middleware/auth.ts + + Token secret in .env, rotation strategy used + + ↓ +Worker parses summary XML + ↓ +Worker stores to session_summaries table + ↓ +Worker marks session as completed + ↓ +Worker closes socket and exits + ↓ +Next session: context hook loads this summary! +``` + +--- + +### 3. Smart Trash Flow + +``` +User runs: rm file.txt + ↓ +(Smart Trash enabled) + ↓ +Alias redirects: claude-mem trash file.txt + ↓ +trash command runs + ↓ +1. Check if file exists +2. Add timestamp: file.txt.1729123456789 +3. Move to ~/.claude-mem/trash/ + ↓ +User wants to see trash + ↓ +User runs: claude-mem trash view + ↓ +Display: +🗑️ Trash Contents +──────────────────────────────────────── +📄 file.txt + Size: 1.2 KB | Trashed: 2025-10-16 10:30:45 + ID: file.txt.1729123456789 +──────────────────────────────────────── +Total: 0 folders, 1 files (1.2 KB) + ↓ +User wants to restore + ↓ +User runs: claude-mem restore + ↓ +Interactive selection + ↓ +Restore file.txt.1729123456789 → ./file.txt + ↓ +User wants to empty trash + ↓ +User runs: claude-mem trash empty + ↓ +Confirmation prompt + ↓ +Permanently delete all files +``` + +--- + +### 4. Doctor/Status Flow + +``` +User runs: claude-mem doctor + ↓ +Check data directory: ~/.claude-mem +✅ Data directory accessible + ↓ +Check SQLite database +✅ SQLite database connected + ↓ +Check Chroma vector store +✅ Chroma vector store data dir exists + ↓ +User runs: claude-mem status + ↓ +Show: +⚙️ Settings Configuration: + 📋 Global: ~/.claude/settings.json + SessionStart (claude-mem context): ✅ + Stop (claude-mem summary): ✅ + UserPromptSubmit (claude-mem new): ✅ + PostToolUse (claude-mem save): ✅ + +📦 Compressed Transcripts: + Compressed files: 5 + Archive files: 2 + +🔧 Runtime Environment: + ✅ Node.js: v20.11.0 + ✅ Bun: 1.0.26 + +🧠 Chroma Storage Status: + ✅ Storage backend: Chroma MCP + 📍 Data location: ~/.claude-mem/chroma + +📊 Summary: + ✅ Claude Memory System is installed (Global) +``` + +--- + +## Summary + +**claude-mem** is a sophisticated memory system that: + +1. **Captures context automatically** via Claude Code hooks +2. **Analyzes observations intelligently** using Claude Agent SDK +3. **Extracts meaningful insights** (not just raw data) +4. **Stores structured summaries** in SQLite +5. **Provides vector search** via Chroma MCP +6. **Restores context seamlessly** in new sessions + +**Key Innovation**: Instead of saving raw transcripts, claude-mem uses an AI agent to synthesize observations into actionable insights, creating a compressed, searchable knowledge base that grows with your work. + +**Core Philosophy**: Quality over quantity - only meaningful insights are stored. + +--- + +## File Reference Index + +### Entry Points +- `src/bin/cli.ts:20-213` - CLI router with Commander + +### Commands +- `src/commands/install.ts:429-538` - Installation wizard +- `src/commands/uninstall.ts:67-162` - Uninstall hooks +- `src/commands/doctor.ts:22-93` - Health checks +- `src/commands/status.ts:11-158` - System status +- `src/commands/logs.ts:40-73` - Log viewer +- `src/commands/trash.ts:11-60` - Move to trash +- `src/commands/trash-view.ts:53-124` - View trash +- `src/commands/trash-empty.ts:6-66` - Empty trash +- `src/commands/restore.ts:6-24` - Restore files + +### Hooks +- `src/hooks/context.ts:16-92` - SessionStart hook +- `src/hooks/new.ts:16-56` - UserPromptSubmit hook +- `src/hooks/save.ts:25-81` - PostToolUse hook +- `src/hooks/summary.ts:16-62` - Stop hook + +### SDK +- `src/sdk/worker.ts:36-311` - Background worker process +- `src/sdk/prompts.ts:24-177` - Prompt builders +- `src/sdk/parser.ts:26-132` - XML parser + +### Services +- `src/services/path-discovery.ts:16-341` - Path resolution +- `src/services/sqlite/Database.ts:20-177` - Database manager +- `src/services/sqlite/HooksDatabase.ts:11-207` - Hooks database +- `src/services/sqlite/migrations.ts:7-374` - Schema migrations + +### Shared +- `src/shared/config.ts:1-51` - Package metadata +- `src/shared/types.ts:15-30` - Core types +- `src/shared/storage.ts:26-188` - Storage abstraction + +### Utilities +- `src/utils/platform.ts:11-78` - Platform helpers + +--- + +**Generated**: 2025-10-16 +**Claude-Mem Version**: 3.9.16 diff --git a/src/bin/cli.ts b/src/bin/cli.ts index 2927acc5..68b36718 100644 --- a/src/bin/cli.ts +++ b/src/bin/cli.ts @@ -174,6 +174,22 @@ program summaryHook(JSON.parse(input)); }); +program + .command('worker ') + .description('Run SDK worker process (internal use)') + .action(async (sessionId: string) => { + try { + // Import and run the worker main function + const { main } = await import('../sdk/worker.js'); + // Set process.argv so worker can parse sessionId + process.argv[2] = sessionId; + await main(); + } catch (error: any) { + console.error(`[SDK Worker] Fatal error: ${error.message}`); + process.exit(1); + } + }); + // Helper function to read stdin async function readStdin(): Promise { return new Promise((resolve) => { diff --git a/src/hooks/new.ts b/src/hooks/new.ts index 81a873ed..cb63f272 100644 --- a/src/hooks/new.ts +++ b/src/hooks/new.ts @@ -1,7 +1,6 @@ import { HooksDatabase } from '../services/sqlite/HooksDatabase.js'; import path from 'path'; import { spawn } from 'child_process'; -import fs from 'fs'; export interface UserPromptSubmitInput { session_id: string; @@ -37,25 +36,8 @@ export function newHook(input: UserPromptSubmitInput): void { db.close(); // Start SDK worker in background as detached process - // Try source first (development), then fall back to dist (production) - const srcWorkerPath = path.join(__dirname, '..', 'sdk', 'worker.ts'); - const distWorkerPath = path.join(__dirname, '..', 'sdk', 'worker.js'); - - let workerPath: string; - if (fs.existsSync(srcWorkerPath)) { - workerPath = srcWorkerPath; - } else if (fs.existsSync(distWorkerPath)) { - workerPath = distWorkerPath; - } else { - // Fallback: assume we're in the bundled CLI - // In this case, we can't spawn the worker since it's bundled - // This is a limitation we'll need to address - console.error('[claude-mem] Worker not found, skipping background processing'); - console.log('{"continue": true, "suppressOutput": true}'); - process.exit(0); - } - - const child = spawn('bun', [workerPath, sessionId.toString()], { + // Use 'claude-mem worker' CLI command which is always available + const child = spawn('claude-mem', ['worker', sessionId.toString()], { detached: true, stdio: 'ignore' }); diff --git a/src/hooks/save.ts b/src/hooks/save.ts index f98229a9..fe921477 100644 --- a/src/hooks/save.ts +++ b/src/hooks/save.ts @@ -1,5 +1,7 @@ +import net from 'net'; +import { join } from 'path'; import { HooksDatabase } from '../services/sqlite/HooksDatabase.js'; -import path from 'path'; +import { PathDiscovery } from '../services/path-discovery.js'; export interface PostToolUseInput { session_id: string; @@ -18,11 +20,11 @@ const SKIP_TOOLS = new Set([ /** * Save Hook - PostToolUse - * Queues tool observations for SDK processing + * Sends tool observations to worker via Unix socket */ export function saveHook(input: PostToolUseInput): void { try { - const { session_id, cwd, tool_name, tool_input, tool_output } = input; + const { session_id, tool_name, tool_input, tool_output } = input; // Skip certain tools if (SKIP_TOOLS.has(tool_name)) { @@ -30,38 +32,45 @@ export function saveHook(input: PostToolUseInput): void { process.exit(0); } - // Extract project from cwd - const project = path.basename(cwd); - // Find active SDK session const db = new HooksDatabase(); const session = db.findActiveSDKSession(session_id); + db.close(); if (!session) { // No active session yet - this can happen if UserPromptSubmit hasn't run // Just exit silently - db.close(); console.log('{"continue": true, "suppressOutput": true}'); process.exit(0); } - // Queue the observation - // SDK session ID might be null if init message hasn't arrived yet - // Use the internal ID as a fallback - const sdkSessionId = session.sdk_session_id || `pending-${session.id}`; + // Get socket path + const dataDir = PathDiscovery.getInstance().getDataDirectory(); + const socketPath = join(dataDir, `worker-${session.id}.sock`); - db.queueObservation( - sdkSessionId, + // Send observation via Unix socket + const message = { + type: 'observation', tool_name, - JSON.stringify(tool_input), - JSON.stringify(tool_output) - ); + tool_input: JSON.stringify(tool_input), + tool_output: JSON.stringify(tool_output) + }; - db.close(); + const client = net.connect(socketPath, () => { + client.write(JSON.stringify(message) + '\n'); + client.end(); + }); - // Output hook response - console.log('{"continue": true, "suppressOutput": true}'); - process.exit(0); + client.on('error', (err) => { + // Socket not available - worker may have crashed or not started + console.error(`[claude-mem save] Socket error: ${err.message}`); + // Continue anyway, don't block Claude + }); + + client.on('close', () => { + console.log('{"continue": true, "suppressOutput": true}'); + process.exit(0); + }); } catch (error: any) { // On error, don't block Claude Code diff --git a/src/hooks/summary.ts b/src/hooks/summary.ts index b678c7d4..c7d817da 100644 --- a/src/hooks/summary.ts +++ b/src/hooks/summary.ts @@ -1,4 +1,7 @@ +import net from 'net'; +import { join } from 'path'; import { HooksDatabase } from '../services/sqlite/HooksDatabase.js'; +import { PathDiscovery } from '../services/path-discovery.js'; export interface StopInput { session_id: string; @@ -8,7 +11,7 @@ export interface StopInput { /** * Summary Hook - Stop - * Signals SDK to finalize and generate summary + * Sends FINALIZE message to worker via Unix socket */ export function summaryHook(input: StopInput): void { try { @@ -17,29 +20,38 @@ export function summaryHook(input: StopInput): void { // Find active SDK session const db = new HooksDatabase(); const session = db.findActiveSDKSession(session_id); + db.close(); if (!session) { // No active session - nothing to finalize - db.close(); console.log('{"continue": true, "suppressOutput": true}'); process.exit(0); } - // Insert special FINALIZE message into observation queue - const sdkSessionId = session.sdk_session_id || `pending-${session.id}`; + // Get socket path + const dataDir = PathDiscovery.getInstance().getDataDirectory(); + const socketPath = join(dataDir, `worker-${session.id}.sock`); - db.queueObservation( - sdkSessionId, - 'FINALIZE', - '{}', - '{}' - ); + // Send FINALIZE message via Unix socket + const message = { + type: 'finalize' + }; - db.close(); + const client = net.connect(socketPath, () => { + client.write(JSON.stringify(message) + '\n'); + client.end(); + }); - // Output hook response - console.log('{"continue": true, "suppressOutput": true}'); - process.exit(0); + client.on('error', (err) => { + // Socket not available - worker may have already finished or crashed + console.error(`[claude-mem summary] Socket error: ${err.message}`); + // Continue anyway, don't block Claude + }); + + client.on('close', () => { + console.log('{"continue": true, "suppressOutput": true}'); + process.exit(0); + }); } catch (error: any) { // On error, don't block Claude Code diff --git a/src/sdk/worker.ts b/src/sdk/worker.ts index 7c2aa11a..9cbfac05 100644 --- a/src/sdk/worker.ts +++ b/src/sdk/worker.ts @@ -1,23 +1,39 @@ #!/usr/bin/env bun /** * SDK Worker Process - * Background agent that processes tool observations and generates session summaries + * Background server that processes tool observations via Unix socket */ +import net from 'net'; +import { unlinkSync, existsSync } from 'fs'; +import { join } from 'path'; import { query } from '@anthropic-ai/claude-agent-sdk'; import { HooksDatabase } from '../services/sqlite/HooksDatabase.js'; +import { PathDiscovery } from '../services/path-discovery.js'; import { buildInitPrompt, buildObservationPrompt, buildFinalizePrompt } from './prompts.js'; import { parseObservations, parseSummary } from './parser.js'; -import type { Observation, SDKSession } from './prompts.js'; +import type { SDKSession } from './prompts.js'; -const POLL_INTERVAL_MS = 1000; // 1 second const MODEL = 'claude-sonnet-4-5'; const DISALLOWED_TOOLS = ['Glob', 'Grep', 'ListMcpResourcesTool', 'WebSearch']; +interface ObservationMessage { + type: 'observation'; + tool_name: string; + tool_input: string; + tool_output: string; +} + +interface FinalizeMessage { + type: 'finalize'; +} + +type WorkerMessage = ObservationMessage | FinalizeMessage; + /** * Main worker process entry point */ -async function main() { +export async function main() { const sessionDbId = parseInt(process.argv[2], 10); if (!sessionDbId) { @@ -30,21 +46,28 @@ async function main() { } /** - * SDK Worker class - handles the full lifecycle of observation processing + * SDK Worker - Unix socket server that processes observations */ class SDKWorker { private sessionDbId: number; private db: HooksDatabase; + private socketPath: string; + private server: net.Server | null = null; private sdkSessionId: string | null = null; private project: string = ''; private userPrompt: string = ''; private abortController: AbortController; private isFinalized = false; + private pendingMessages: WorkerMessage[] = []; constructor(sessionDbId: number) { this.sessionDbId = sessionDbId; this.db = new HooksDatabase(); this.abortController = new AbortController(); + + // Socket path: ~/.claude-mem/worker-{sessionId}.sock + const dataDir = PathDiscovery.getInstance().getDataDirectory(); + this.socketPath = join(dataDir, `worker-${sessionDbId}.sock`); } /** @@ -62,26 +85,92 @@ class SDKWorker { this.project = session.project; this.userPrompt = session.user_prompt; + // Start Unix socket server + await this.startSocketServer(); + console.error(`[SDK Worker] Socket server listening: ${this.socketPath}`); + // Run SDK agent with streaming input await this.runSDKAgent(); // Mark session as completed this.db.markSessionCompleted(this.sessionDbId); this.db.close(); + this.cleanup(); } catch (error: any) { console.error('[SDK Worker] Error:', error.message); this.db.markSessionFailed(this.sessionDbId); this.db.close(); + this.cleanup(); process.exit(1); } } + /** + * Start Unix socket server to receive messages from hooks + */ + private async startSocketServer(): Promise { + // Clean up old socket if it exists + if (existsSync(this.socketPath)) { + unlinkSync(this.socketPath); + } + + return new Promise((resolve, reject) => { + this.server = net.createServer((socket) => { + let buffer = ''; + + socket.on('data', (chunk) => { + buffer += chunk.toString(); + + // Try to parse complete JSON messages (separated by newlines) + const lines = buffer.split('\n'); + buffer = lines.pop() || ''; // Keep incomplete line in buffer + + for (const line of lines) { + if (line.trim()) { + try { + const message: WorkerMessage = JSON.parse(line); + this.handleMessage(message); + } catch (err) { + console.error('[SDK Worker] Invalid message:', line); + } + } + } + }); + + socket.on('error', (err) => { + console.error('[SDK Worker] Socket connection error:', err.message); + }); + }); + + this.server.on('error', (err: any) => { + if (err.code === 'EADDRINUSE') { + console.error(`[SDK Worker] Socket already in use: ${this.socketPath}`); + } + reject(err); + }); + + this.server.listen(this.socketPath, () => { + resolve(); + }); + }); + } + + /** + * Handle incoming message from hook + */ + private handleMessage(message: WorkerMessage): void { + this.pendingMessages.push(message); + + if (message.type === 'finalize') { + this.isFinalized = true; + } + } + /** * Load session from database */ private async loadSession(): Promise { - // Query session by ID const db = this.db as any; const query = db.db.query(` SELECT id, sdk_session_id, project, user_prompt @@ -98,11 +187,9 @@ class SDKWorker { * Run SDK agent with streaming input mode */ private async runSDKAgent(): Promise { - const messageGenerator = this.createMessageGenerator(); - await query({ model: MODEL, - messages: messageGenerator, + messages: () => this.createMessageGenerator(), disallowedTools: DISALLOWED_TOOLS, signal: this.abortController.signal, onSystemInitMessage: (msg) => { @@ -121,6 +208,7 @@ class SDKWorker { /** * Create async message generator for SDK streaming input + * Now pulls from socket messages instead of polling database */ private async* createMessageGenerator(): AsyncIterable<{ role: 'user'; content: string }> { // Yield initial prompt @@ -128,36 +216,37 @@ class SDKWorker { const initPrompt = buildInitPrompt(this.project, claudeSessionId, this.userPrompt); yield { role: 'user', content: initPrompt }; - // Poll observation queue + // Process messages as they arrive via socket while (!this.isFinalized) { - await this.sleep(POLL_INTERVAL_MS); - - if (!this.sdkSessionId) { - continue; // Wait for SDK session ID to be captured + // Wait for messages to arrive + if (this.pendingMessages.length === 0) { + await this.sleep(100); // Short sleep, just to yield control + continue; } - // Get pending observations - const observations = this.db.getPendingObservations(this.sdkSessionId, 10); + // Process all pending messages + while (this.pendingMessages.length > 0) { + const message = this.pendingMessages.shift()!; - for (const obs of observations) { - // Check for FINALIZE message - if (this.isFinalizationMessage(obs)) { + if (message.type === 'finalize') { this.isFinalized = true; const session = await this.loadSession(); if (session) { const finalizePrompt = buildFinalizePrompt(session); yield { role: 'user', content: finalizePrompt }; } - this.db.markObservationProcessed(obs.id); break; } - // Send observation to SDK - const observationPrompt = buildObservationPrompt(obs); - yield { role: 'user', content: observationPrompt }; - - // Mark as processed - this.db.markObservationProcessed(obs.id); + if (message.type === 'observation') { + // Build observation prompt + const observationPrompt = buildObservationPrompt({ + tool_name: message.tool_name, + tool_input: message.tool_input, + tool_output: message.tool_output + }); + yield { role: 'user', content: observationPrompt }; + } } } } @@ -194,10 +283,15 @@ class SDKWorker { } /** - * Check if observation is a FINALIZE message + * Cleanup socket server and socket file */ - private isFinalizationMessage(obs: Observation): boolean { - return obs.tool_name === 'FINALIZE'; + private cleanup(): void { + if (this.server) { + this.server.close(); + } + if (existsSync(this.socketPath)) { + unlinkSync(this.socketPath); + } } /** diff --git a/src/services/sqlite/HooksDatabase.ts b/src/services/sqlite/HooksDatabase.ts index d1fe5346..b7e94934 100644 --- a/src/services/sqlite/HooksDatabase.ts +++ b/src/services/sqlite/HooksDatabase.ts @@ -103,62 +103,6 @@ export class HooksDatabase { query.run(sdkSessionId, id); } - /** - * Queue an observation for SDK processing - */ - queueObservation( - sdkSessionId: string, - toolName: string, - toolInput: string, - toolOutput: string - ): void { - const nowEpoch = Date.now(); - - const query = this.db.query(` - INSERT INTO observation_queue - (sdk_session_id, tool_name, tool_input, tool_output, created_at_epoch) - VALUES (?, ?, ?, ?, ?) - `); - - query.run(sdkSessionId, toolName, toolInput, toolOutput, nowEpoch); - } - - /** - * Get pending observations for SDK processing - */ - getPendingObservations(sdkSessionId: string, limit: number = 10): Array<{ - id: number; - tool_name: string; - tool_input: string; - tool_output: string; - created_at_epoch: number; - }> { - const query = this.db.query(` - SELECT id, tool_name, tool_input, tool_output, created_at_epoch - FROM observation_queue - WHERE sdk_session_id = ? AND processed_at_epoch IS NULL - ORDER BY created_at_epoch ASC - LIMIT ? - `); - - return query.all(sdkSessionId, limit) as any[]; - } - - /** - * Mark observation as processed - */ - markObservationProcessed(id: number): void { - const nowEpoch = Date.now(); - - const query = this.db.query(` - UPDATE observation_queue - SET processed_at_epoch = ? - WHERE id = ? - `); - - query.run(nowEpoch, id); - } - /** * Store an observation (from SDK parsing) */ diff --git a/src/services/sqlite/migrations.ts b/src/services/sqlite/migrations.ts index 5cdd944f..5fa82978 100644 --- a/src/services/sqlite/migrations.ts +++ b/src/services/sqlite/migrations.ts @@ -305,6 +305,63 @@ export const migration004: Migration = { } }; +/** + * Migration 005 - Remove orphaned tables + * Drops streaming_sessions (superseded by sdk_sessions) + * Drops observation_queue (superseded by Unix socket communication) + */ +export const migration005: Migration = { + version: 5, + up: (db: Database) => { + // Drop streaming_sessions - superseded by sdk_sessions in migration004 + // This table was from v2 architecture and is no longer used + db.run(`DROP TABLE IF EXISTS streaming_sessions`); + + // Drop observation_queue - superseded by Unix socket communication + // Worker now uses sockets instead of database polling for observations + db.run(`DROP TABLE IF EXISTS observation_queue`); + + console.log('✅ Dropped orphaned tables: streaming_sessions, observation_queue'); + }, + + down: (db: Database) => { + // Recreate tables if needed (though they should never be used) + db.run(` + 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' + ) + `); + + db.run(` + CREATE TABLE IF NOT EXISTS observation_queue ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + sdk_session_id TEXT NOT NULL, + tool_name TEXT NOT NULL, + tool_input TEXT NOT NULL, + tool_output TEXT NOT NULL, + created_at_epoch INTEGER NOT NULL, + processed_at_epoch INTEGER, + FOREIGN KEY(sdk_session_id) REFERENCES sdk_sessions(sdk_session_id) ON DELETE CASCADE + ) + `); + + console.log('⚠️ Recreated streaming_sessions and observation_queue (for rollback only)'); + } +}; + /** * All migrations in order */ @@ -312,5 +369,6 @@ export const migrations: Migration[] = [ migration001, migration002, migration003, - migration004 + migration004, + migration005 ]; \ No newline at end of file diff --git a/test-worker.sh b/test-worker.sh new file mode 100755 index 00000000..f2303d00 --- /dev/null +++ b/test-worker.sh @@ -0,0 +1,48 @@ +#!/bin/bash +set -e + +echo "Creating session..." +echo '{"session_id":"test-socket-789","cwd":"/Users/alexnewman/Scripts/claude-mem","prompt":"testing"}' | bun src/bin/cli.ts new + +sleep 1 + +SESSION_ID=$(sqlite3 ~/.claude-mem/claude-mem.db "SELECT id FROM sdk_sessions ORDER BY id DESC LIMIT 1;") +echo "Session ID: $SESSION_ID" + +echo "Starting worker..." +bun src/sdk/worker.ts $SESSION_ID 2>&1 & +WORKER_PID=$! +echo "Worker PID: $WORKER_PID" + +sleep 3 + +if ps -p $WORKER_PID > /dev/null 2>&1; then + echo "✅ Worker is RUNNING!" + if [ -e ~/.claude-mem/worker-$SESSION_ID.sock ]; then + echo "✅ Socket file exists!" + ls -la ~/.claude-mem/worker-$SESSION_ID.sock + else + echo "❌ Socket file NOT found" + fi + + # Try to send a message + echo "Sending test observation..." + echo '{"type":"observation","tool_name":"TestTool","tool_input":"{}","tool_output":"{}"}' | nc -U ~/.claude-mem/worker-$SESSION_ID.sock + echo "Message sent!" + + sleep 2 + + # Send finalize + echo "Sending finalize..." + echo '{"type":"finalize"}' | nc -U ~/.claude-mem/worker-$SESSION_ID.sock + + sleep 2 + if ps -p $WORKER_PID > /dev/null 2>&1; then + echo "⚠️ Worker still running after finalize" + kill $WORKER_PID + else + echo "✅ Worker exited cleanly after finalize" + fi +else + echo "❌ Worker exited prematurely" +fi