Files
claude-mem/dist/claude-mem.min.js
T
Alex Newman 4d5b307a74 Release v3.7.2
Published from npm package build
Source: https://github.com/thedotmack/claude-mem-source
2025-09-22 14:14:51 -04:00

692 lines
706 KiB
JavaScript
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env node
import{createRequire as xw}from"node:module";var dw=Object.create;var{getPrototypeOf:Lw,defineProperty:M4,getOwnPropertyNames:pw}=Object;var lw=Object.prototype.hasOwnProperty;var F6=(q,_,j)=>{j=q!=null?dw(Lw(q)):{};let K=_||!q||!q.__esModule?M4(j,"default",{value:q,enumerable:!0}):j;for(let Y of pw(q))if(!lw.call(K,Y))M4(K,Y,{get:()=>q[Y],enumerable:!0});return K};var F=(q,_)=>()=>(_||q((_={exports:{}}).exports,_),_.exports);var $q=(q,_)=>{for(var j in _)M4(q,j,{get:_[j],enumerable:!0,configurable:!0,set:(K)=>_[j]=()=>K})};var R8=(q,_)=>()=>(q&&(_=q(q=0)),_);var g8=xw(import.meta.url);var aK=F((nw)=>{class N4 extends Error{constructor(q,_,j){super(j);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=_,this.exitCode=q,this.nestedError=void 0}}class x5 extends N4{constructor(q){super(1,"commander.invalidArgument",q);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}nw.CommanderError=N4;nw.InvalidArgumentError=x5});var _7=F((aw)=>{var{InvalidArgumentError:iw}=aK();class n5{constructor(q,_){switch(this.description=_||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,q[0]){case"<":this.required=!0,this._name=q.slice(1,-1);break;case"[":this.required=!1,this._name=q.slice(1,-1);break;default:this.required=!0,this._name=q;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue(q,_){if(_===this.defaultValue||!Array.isArray(_))return[q];return _.concat(q)}default(q,_){return this.defaultValue=q,this.defaultValueDescription=_,this}argParser(q){return this.parseArg=q,this}choices(q){return this.argChoices=q.slice(),this.parseArg=(_,j)=>{if(!this.argChoices.includes(_))throw new iw(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(_,j);return _},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function ow(q){let _=q.name()+(q.variadic===!0?"...":"");return q.required?"<"+_+">":"["+_+"]"}aw.Argument=n5;aw.humanReadableArgName=ow});var b4=F((ew)=>{var{humanReadableArgName:Fw}=_7();class c5{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(q){this.helpWidth=this.helpWidth??q.helpWidth??80}visibleCommands(q){let _=q.commands.filter((K)=>!K._hidden),j=q._getHelpCommand();if(j&&!j._hidden)_.push(j);if(this.sortSubcommands)_.sort((K,Y)=>{return K.name().localeCompare(Y.name())});return _}compareOptions(q,_){let j=(K)=>{return K.short?K.short.replace(/^-/,""):K.long.replace(/^--/,"")};return j(q).localeCompare(j(_))}visibleOptions(q){let _=q.options.filter((K)=>!K.hidden),j=q._getHelpOption();if(j&&!j.hidden){let K=j.short&&q._findOption(j.short),Y=j.long&&q._findOption(j.long);if(!K&&!Y)_.push(j);else if(j.long&&!Y)_.push(q.createOption(j.long,j.description));else if(j.short&&!K)_.push(q.createOption(j.short,j.description))}if(this.sortOptions)_.sort(this.compareOptions);return _}visibleGlobalOptions(q){if(!this.showGlobalOptions)return[];let _=[];for(let j=q.parent;j;j=j.parent){let K=j.options.filter((Y)=>!Y.hidden);_.push(...K)}if(this.sortOptions)_.sort(this.compareOptions);return _}visibleArguments(q){if(q._argsDescription)q.registeredArguments.forEach((_)=>{_.description=_.description||q._argsDescription[_.name()]||""});if(q.registeredArguments.find((_)=>_.description))return q.registeredArguments;return[]}subcommandTerm(q){let _=q.registeredArguments.map((j)=>Fw(j)).join(" ");return q._name+(q._aliases[0]?"|"+q._aliases[0]:"")+(q.options.length?" [options]":"")+(_?" "+_:"")}optionTerm(q){return q.flags}argumentTerm(q){return q.name()}longestSubcommandTermLength(q,_){return _.visibleCommands(q).reduce((j,K)=>{return Math.max(j,this.displayWidth(_.styleSubcommandTerm(_.subcommandTerm(K))))},0)}longestOptionTermLength(q,_){return _.visibleOptions(q).reduce((j,K)=>{return Math.max(j,this.displayWidth(_.styleOptionTerm(_.optionTerm(K))))},0)}longestGlobalOptionTermLength(q,_){return _.visibleGlobalOptions(q).reduce((j,K)=>{return Math.max(j,this.displayWidth(_.styleOptionTerm(_.optionTerm(K))))},0)}longestArgumentTermLength(q,_){return _.visibleArguments(q).reduce((j,K)=>{return Math.max(j,this.displayWidth(_.styleArgumentTerm(_.argumentTerm(K))))},0)}commandUsage(q){let _=q._name;if(q._aliases[0])_=_+"|"+q._aliases[0];let j="";for(let K=q.parent;K;K=K.parent)j=K.name()+" "+j;return j+_+" "+q.usage()}commandDescription(q){return q.description()}subcommandDescription(q){return q.summary()||q.description()}optionDescription(q){let _=[];if(q.argChoices)_.push(`choices: ${q.argChoices.map((j)=>JSON.stringify(j)).join(", ")}`);if(q.defaultValue!==void 0){if(q.required||q.optional||q.isBoolean()&&typeof q.defaultValue==="boolean")_.push(`default: ${q.defaultValueDescription||JSON.stringify(q.defaultValue)}`)}if(q.presetArg!==void 0&&q.optional)_.push(`preset: ${JSON.stringify(q.presetArg)}`);if(q.envVar!==void 0)_.push(`env: ${q.envVar}`);if(_.length>0){let j=`(${_.join(", ")})`;if(q.description)return`${q.description} ${j}`;return j}return q.description}argumentDescription(q){let _=[];if(q.argChoices)_.push(`choices: ${q.argChoices.map((j)=>JSON.stringify(j)).join(", ")}`);if(q.defaultValue!==void 0)_.push(`default: ${q.defaultValueDescription||JSON.stringify(q.defaultValue)}`);if(_.length>0){let j=`(${_.join(", ")})`;if(q.description)return`${q.description} ${j}`;return j}return q.description}formatItemList(q,_,j){if(_.length===0)return[];return[j.styleTitle(q),..._,""]}groupItems(q,_,j){let K=new Map;return q.forEach((Y)=>{let f=j(Y);if(!K.has(f))K.set(f,[])}),_.forEach((Y)=>{let f=j(Y);if(!K.has(f))K.set(f,[]);K.get(f).push(Y)}),K}formatHelp(q,_){let j=_.padWidth(q,_),K=_.helpWidth??80;function Y(z,W){return _.formatItem(z,j,W,_)}let f=[`${_.styleTitle("Usage:")} ${_.styleUsage(_.commandUsage(q))}`,""],P=_.commandDescription(q);if(P.length>0)f=f.concat([_.boxWrap(_.styleCommandDescription(P),K),""]);let $=_.visibleArguments(q).map((z)=>{return Y(_.styleArgumentTerm(_.argumentTerm(z)),_.styleArgumentDescription(_.argumentDescription(z)))});if(f=f.concat(this.formatItemList("Arguments:",$,_)),this.groupItems(q.options,_.visibleOptions(q),(z)=>z.helpGroupHeading??"Options:").forEach((z,W)=>{let v=z.map((H)=>{return Y(_.styleOptionTerm(_.optionTerm(H)),_.styleOptionDescription(_.optionDescription(H)))});f=f.concat(this.formatItemList(W,v,_))}),_.showGlobalOptions){let z=_.visibleGlobalOptions(q).map((W)=>{return Y(_.styleOptionTerm(_.optionTerm(W)),_.styleOptionDescription(_.optionDescription(W)))});f=f.concat(this.formatItemList("Global Options:",z,_))}return this.groupItems(q.commands,_.visibleCommands(q),(z)=>z.helpGroup()||"Commands:").forEach((z,W)=>{let v=z.map((H)=>{return Y(_.styleSubcommandTerm(_.subcommandTerm(H)),_.styleSubcommandDescription(_.subcommandDescription(H)))});f=f.concat(this.formatItemList(W,v,_))}),f.join(`
`)}displayWidth(q){return r5(q).length}styleTitle(q){return q}styleUsage(q){return q.split(" ").map((_)=>{if(_==="[options]")return this.styleOptionText(_);if(_==="[command]")return this.styleSubcommandText(_);if(_[0]==="["||_[0]==="<")return this.styleArgumentText(_);return this.styleCommandText(_)}).join(" ")}styleCommandDescription(q){return this.styleDescriptionText(q)}styleOptionDescription(q){return this.styleDescriptionText(q)}styleSubcommandDescription(q){return this.styleDescriptionText(q)}styleArgumentDescription(q){return this.styleDescriptionText(q)}styleDescriptionText(q){return q}styleOptionTerm(q){return this.styleOptionText(q)}styleSubcommandTerm(q){return q.split(" ").map((_)=>{if(_==="[options]")return this.styleOptionText(_);if(_[0]==="["||_[0]==="<")return this.styleArgumentText(_);return this.styleSubcommandText(_)}).join(" ")}styleArgumentTerm(q){return this.styleArgumentText(q)}styleOptionText(q){return q}styleArgumentText(q){return q}styleSubcommandText(q){return q}styleCommandText(q){return q}padWidth(q,_){return Math.max(_.longestOptionTermLength(q,_),_.longestGlobalOptionTermLength(q,_),_.longestSubcommandTermLength(q,_),_.longestArgumentTermLength(q,_))}preformatted(q){return/\n[^\S\r\n]/.test(q)}formatItem(q,_,j,K){let f=" ".repeat(2);if(!j)return f+q;let P=q.padEnd(_+q.length-K.displayWidth(q)),$=2,O=(this.helpWidth??80)-_-$-2,z;if(O<this.minWidthToWrap||K.preformatted(j))z=j;else z=K.boxWrap(j,O).replace(/\n/g,`
`+" ".repeat(_+$));return f+P+" ".repeat($)+z.replace(/\n/g,`
${f}`)}boxWrap(q,_){if(_<this.minWidthToWrap)return q;let j=q.split(/\r\n|\n/),K=/[\s]*[^\s]+/g,Y=[];return j.forEach((f)=>{let P=f.match(K);if(P===null){Y.push("");return}let $=[P.shift()],w=this.displayWidth($[0]);P.forEach((O)=>{let z=this.displayWidth(O);if(w+z<=_){$.push(O),w+=z;return}Y.push($.join(""));let W=O.trimStart();$=[W],w=this.displayWidth(W)}),Y.push($.join(""))}),Y.join(`
`)}}function r5(q){let _=/\x1b\[\d*(;\d*)*m/g;return q.replace(_,"")}ew.Help=c5;ew.stripColor=r5});var S4=F((_z)=>{var{InvalidArgumentError:Qw}=aK();class o5{constructor(q,_){this.flags=q,this.description=_||"",this.required=q.includes("<"),this.optional=q.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(q),this.mandatory=!1;let j=qz(q);if(this.short=j.shortFlag,this.long=j.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(q,_){return this.defaultValue=q,this.defaultValueDescription=_,this}preset(q){return this.presetArg=q,this}conflicts(q){return this.conflictsWith=this.conflictsWith.concat(q),this}implies(q){let _=q;if(typeof q==="string")_={[q]:!0};return this.implied=Object.assign(this.implied||{},_),this}env(q){return this.envVar=q,this}argParser(q){return this.parseArg=q,this}makeOptionMandatory(q=!0){return this.mandatory=!!q,this}hideHelp(q=!0){return this.hidden=!!q,this}_concatValue(q,_){if(_===this.defaultValue||!Array.isArray(_))return[q];return _.concat(q)}choices(q){return this.argChoices=q.slice(),this.parseArg=(_,j)=>{if(!this.argChoices.includes(_))throw new Qw(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(_,j);return _},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return i5(this.name().replace(/^no-/,""));return i5(this.name())}helpGroup(q){return this.helpGroupHeading=q,this}is(q){return this.short===q||this.long===q}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class a5{constructor(q){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,q.forEach((_)=>{if(_.negate)this.negativeOptions.set(_.attributeName(),_);else this.positiveOptions.set(_.attributeName(),_)}),this.negativeOptions.forEach((_,j)=>{if(this.positiveOptions.has(j))this.dualOptions.add(j)})}valueFromOption(q,_){let j=_.attributeName();if(!this.dualOptions.has(j))return!0;let K=this.negativeOptions.get(j).presetArg,Y=K!==void 0?K:!1;return _.negate===(Y===q)}}function i5(q){return q.split("-").reduce((_,j)=>{return _+j[0].toUpperCase()+j.slice(1)})}function qz(q){let _,j,K=/^-[^-]$/,Y=/^--[^-]/,f=q.split(/[ |,]+/).concat("guard");if(K.test(f[0]))_=f.shift();if(Y.test(f[0]))j=f.shift();if(!_&&K.test(f[0]))_=f.shift();if(!_&&Y.test(f[0]))_=j,j=f.shift();if(f[0].startsWith("-")){let P=f[0],$=`option creation failed due to '${P}' in option flags '${q}'`;if(/^-[^-][^-]/.test(P))throw new Error(`${$}
- 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(K.test(P))throw new Error(`${$}
- too many short flags`);if(Y.test(P))throw new Error(`${$}
- too many long flags`);throw new Error(`${$}
- unrecognised flag format`)}if(_===void 0&&j===void 0)throw new Error(`option creation failed due to no flags found in '${q}'.`);return{shortFlag:_,longFlag:j}}_z.Option=o5;_z.DualOptions=a5});var B5=F((fz)=>{function Pz(q,_){if(Math.abs(q.length-_.length)>3)return Math.max(q.length,_.length);let j=[];for(let K=0;K<=q.length;K++)j[K]=[K];for(let K=0;K<=_.length;K++)j[0][K]=K;for(let K=1;K<=_.length;K++)for(let Y=1;Y<=q.length;Y++){let f=1;if(q[Y-1]===_[K-1])f=0;else f=1;if(j[Y][K]=Math.min(j[Y-1][K]+1,j[Y][K-1]+1,j[Y-1][K-1]+f),Y>1&&K>1&&q[Y-1]===_[K-2]&&q[Y-2]===_[K-1])j[Y][K]=Math.min(j[Y][K],j[Y-2][K-2]+1)}return j[q.length][_.length]}function Yz(q,_){if(!_||_.length===0)return"";_=Array.from(new Set(_));let j=q.startsWith("--");if(j)q=q.slice(2),_=_.map((P)=>P.slice(2));let K=[],Y=3,f=0.4;if(_.forEach((P)=>{if(P.length<=1)return;let $=Pz(q,P),w=Math.max(q.length,P.length);if((w-$)/w>f){if($<Y)Y=$,K=[P];else if($===Y)K.push(P)}}),K.sort((P,$)=>P.localeCompare($)),j)K=K.map((P)=>`--${P}`);if(K.length>1)return`
(Did you mean one of ${K.join(", ")}?)`;if(K.length===1)return`
(Did you mean ${K[0]}?)`;return""}fz.suggestSimilar=Yz});var U5=F((Jz)=>{var Oz=g8("node:events").EventEmitter,E4=g8("node:child_process"),dq=g8("node:path"),K7=g8("node:fs"),b8=g8("node:process"),{Argument:wz,humanReadableArgName:zz}=_7(),{CommanderError:R4}=aK(),{Help:Wz,stripColor:vz}=b4(),{Option:t5,DualOptions:Hz}=S4(),{suggestSimilar:F5}=B5();class m4 extends Oz{constructor(q){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=q||"",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:(_)=>b8.stdout.write(_),writeErr:(_)=>b8.stderr.write(_),outputError:(_,j)=>j(_),getOutHelpWidth:()=>b8.stdout.isTTY?b8.stdout.columns:void 0,getErrHelpWidth:()=>b8.stderr.isTTY?b8.stderr.columns:void 0,getOutHasColors:()=>I4()??(b8.stdout.isTTY&&b8.stdout.hasColors?.()),getErrHasColors:()=>I4()??(b8.stderr.isTTY&&b8.stderr.hasColors?.()),stripColor:(_)=>vz(_)},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(q){return this._outputConfiguration=q._outputConfiguration,this._helpOption=q._helpOption,this._helpCommand=q._helpCommand,this._helpConfiguration=q._helpConfiguration,this._exitCallback=q._exitCallback,this._storeOptionsAsProperties=q._storeOptionsAsProperties,this._combineFlagAndOptionalValue=q._combineFlagAndOptionalValue,this._allowExcessArguments=q._allowExcessArguments,this._enablePositionalOptions=q._enablePositionalOptions,this._showHelpAfterError=q._showHelpAfterError,this._showSuggestionAfterError=q._showSuggestionAfterError,this}_getCommandAndAncestors(){let q=[];for(let _=this;_;_=_.parent)q.push(_);return q}command(q,_,j){let K=_,Y=j;if(typeof K==="object"&&K!==null)Y=K,K=null;Y=Y||{};let[,f,P]=q.match(/([^ ]+) *(.*)/),$=this.createCommand(f);if(K)$.description(K),$._executableHandler=!0;if(Y.isDefault)this._defaultCommandName=$._name;if($._hidden=!!(Y.noHelp||Y.hidden),$._executableFile=Y.executableFile||null,P)$.arguments(P);if(this._registerCommand($),$.parent=this,$.copyInheritedSettings(this),K)return this;return $}createCommand(q){return new m4(q)}createHelp(){return Object.assign(new Wz,this.configureHelp())}configureHelp(q){if(q===void 0)return this._helpConfiguration;return this._helpConfiguration=q,this}configureOutput(q){if(q===void 0)return this._outputConfiguration;return this._outputConfiguration=Object.assign({},this._outputConfiguration,q),this}showHelpAfterError(q=!0){if(typeof q!=="string")q=!!q;return this._showHelpAfterError=q,this}showSuggestionAfterError(q=!0){return this._showSuggestionAfterError=!!q,this}addCommand(q,_){if(!q._name)throw new Error(`Command passed to .addCommand() must have a name
- specify the name in Command constructor or using .name()`);if(_=_||{},_.isDefault)this._defaultCommandName=q._name;if(_.noHelp||_.hidden)q._hidden=!0;return this._registerCommand(q),q.parent=this,q._checkForBrokenPassThrough(),this}createArgument(q,_){return new wz(q,_)}argument(q,_,j,K){let Y=this.createArgument(q,_);if(typeof j==="function")Y.default(K).argParser(j);else Y.default(j);return this.addArgument(Y),this}arguments(q){return q.trim().split(/ +/).forEach((_)=>{this.argument(_)}),this}addArgument(q){let _=this.registeredArguments.slice(-1)[0];if(_&&_.variadic)throw new Error(`only the last argument can be variadic '${_.name()}'`);if(q.required&&q.defaultValue!==void 0&&q.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${q.name()}'`);return this.registeredArguments.push(q),this}helpCommand(q,_){if(typeof q==="boolean"){if(this._addImplicitHelpCommand=q,q&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let j=q??"help [command]",[,K,Y]=j.match(/([^ ]+) *(.*)/),f=_??"display help for command",P=this.createCommand(K);if(P.helpOption(!1),Y)P.arguments(Y);if(f)P.description(f);if(this._addImplicitHelpCommand=!0,this._helpCommand=P,q||_)this._initCommandGroup(P);return this}addHelpCommand(q,_){if(typeof q!=="object")return this.helpCommand(q,_),this;return this._addImplicitHelpCommand=!0,this._helpCommand=q,this._initCommandGroup(q),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(q,_){let j=["preSubcommand","preAction","postAction"];if(!j.includes(q))throw new Error(`Unexpected value for event passed to hook : '${q}'.
Expecting one of '${j.join("', '")}'`);if(this._lifeCycleHooks[q])this._lifeCycleHooks[q].push(_);else this._lifeCycleHooks[q]=[_];return this}exitOverride(q){if(q)this._exitCallback=q;else this._exitCallback=(_)=>{if(_.code!=="commander.executeSubCommandAsync")throw _};return this}_exit(q,_,j){if(this._exitCallback)this._exitCallback(new R4(q,_,j));b8.exit(q)}action(q){let _=(j)=>{let K=this.registeredArguments.length,Y=j.slice(0,K);if(this._storeOptionsAsProperties)Y[K]=this;else Y[K]=this.opts();return Y.push(this),q.apply(this,Y)};return this._actionHandler=_,this}createOption(q,_){return new t5(q,_)}_callParseArg(q,_,j,K){try{return q.parseArg(_,j)}catch(Y){if(Y.code==="commander.invalidArgument"){let f=`${K} ${Y.message}`;this.error(f,{exitCode:Y.exitCode,code:Y.code})}throw Y}}_registerOption(q){let _=q.short&&this._findOption(q.short)||q.long&&this._findOption(q.long);if(_){let j=q.long&&this._findOption(q.long)?q.long:q.short;throw new Error(`Cannot add option '${q.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${j}'
- already used by option '${_.flags}'`)}this._initOptionGroup(q),this.options.push(q)}_registerCommand(q){let _=(K)=>{return[K.name()].concat(K.aliases())},j=_(q).find((K)=>this._findCommand(K));if(j){let K=_(this._findCommand(j)).join("|"),Y=_(q).join("|");throw new Error(`cannot add command '${Y}' as already have command '${K}'`)}this._initCommandGroup(q),this.commands.push(q)}addOption(q){this._registerOption(q);let _=q.name(),j=q.attributeName();if(q.negate){let Y=q.long.replace(/^--no-/,"--");if(!this._findOption(Y))this.setOptionValueWithSource(j,q.defaultValue===void 0?!0:q.defaultValue,"default")}else if(q.defaultValue!==void 0)this.setOptionValueWithSource(j,q.defaultValue,"default");let K=(Y,f,P)=>{if(Y==null&&q.presetArg!==void 0)Y=q.presetArg;let $=this.getOptionValue(j);if(Y!==null&&q.parseArg)Y=this._callParseArg(q,Y,$,f);else if(Y!==null&&q.variadic)Y=q._concatValue(Y,$);if(Y==null)if(q.negate)Y=!1;else if(q.isBoolean()||q.optional)Y=!0;else Y="";this.setOptionValueWithSource(j,Y,P)};if(this.on("option:"+_,(Y)=>{let f=`error: option '${q.flags}' argument '${Y}' is invalid.`;K(Y,f,"cli")}),q.envVar)this.on("optionEnv:"+_,(Y)=>{let f=`error: option '${q.flags}' value '${Y}' from env '${q.envVar}' is invalid.`;K(Y,f,"env")});return this}_optionEx(q,_,j,K,Y){if(typeof _==="object"&&_ instanceof t5)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let f=this.createOption(_,j);if(f.makeOptionMandatory(!!q.mandatory),typeof K==="function")f.default(Y).argParser(K);else if(K instanceof RegExp){let P=K;K=($,w)=>{let O=P.exec($);return O?O[0]:w},f.default(Y).argParser(K)}else f.default(K);return this.addOption(f)}option(q,_,j,K){return this._optionEx({},q,_,j,K)}requiredOption(q,_,j,K){return this._optionEx({mandatory:!0},q,_,j,K)}combineFlagAndOptionalValue(q=!0){return this._combineFlagAndOptionalValue=!!q,this}allowUnknownOption(q=!0){return this._allowUnknownOption=!!q,this}allowExcessArguments(q=!0){return this._allowExcessArguments=!!q,this}enablePositionalOptions(q=!0){return this._enablePositionalOptions=!!q,this}passThroughOptions(q=!0){return this._passThroughOptions=!!q,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(q=!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=!!q,this}getOptionValue(q){if(this._storeOptionsAsProperties)return this[q];return this._optionValues[q]}setOptionValue(q,_){return this.setOptionValueWithSource(q,_,void 0)}setOptionValueWithSource(q,_,j){if(this._storeOptionsAsProperties)this[q]=_;else this._optionValues[q]=_;return this._optionValueSources[q]=j,this}getOptionValueSource(q){return this._optionValueSources[q]}getOptionValueSourceWithGlobals(q){let _;return this._getCommandAndAncestors().forEach((j)=>{if(j.getOptionValueSource(q)!==void 0)_=j.getOptionValueSource(q)}),_}_prepareUserArgs(q,_){if(q!==void 0&&!Array.isArray(q))throw new Error("first parameter to parse must be array or undefined");if(_=_||{},q===void 0&&_.from===void 0){if(b8.versions?.electron)_.from="electron";let K=b8.execArgv??[];if(K.includes("-e")||K.includes("--eval")||K.includes("-p")||K.includes("--print"))_.from="eval"}if(q===void 0)q=b8.argv;this.rawArgs=q.slice();let j;switch(_.from){case void 0:case"node":this._scriptPath=q[1],j=q.slice(2);break;case"electron":if(b8.defaultApp)this._scriptPath=q[1],j=q.slice(2);else j=q.slice(1);break;case"user":j=q.slice(0);break;case"eval":j=q.slice(1);break;default:throw new Error(`unexpected parse option { from: '${_.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",j}parse(q,_){this._prepareForParse();let j=this._prepareUserArgs(q,_);return this._parseCommand([],j),this}async parseAsync(q,_){this._prepareForParse();let j=this._prepareUserArgs(q,_);return await this._parseCommand([],j),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(q,_,j){if(K7.existsSync(q))return;let K=_?`searched for local subcommand relative to directory '${_}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",Y=`'${q}' does not exist
- if '${j}' 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
- ${K}`;throw new Error(Y)}_executeSubCommand(q,_){_=_.slice();let j=!1,K=[".js",".ts",".tsx",".mjs",".cjs"];function Y(O,z){let W=dq.resolve(O,z);if(K7.existsSync(W))return W;if(K.includes(dq.extname(z)))return;let v=K.find((H)=>K7.existsSync(`${W}${H}`));if(v)return`${W}${v}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let f=q._executableFile||`${this._name}-${q._name}`,P=this._executableDir||"";if(this._scriptPath){let O;try{O=K7.realpathSync(this._scriptPath)}catch{O=this._scriptPath}P=dq.resolve(dq.dirname(O),P)}if(P){let O=Y(P,f);if(!O&&!q._executableFile&&this._scriptPath){let z=dq.basename(this._scriptPath,dq.extname(this._scriptPath));if(z!==this._name)O=Y(P,`${z}-${q._name}`)}f=O||f}j=K.includes(dq.extname(f));let $;if(b8.platform!=="win32")if(j)_.unshift(f),_=e5(b8.execArgv).concat(_),$=E4.spawn(b8.argv[0],_,{stdio:"inherit"});else $=E4.spawn(f,_,{stdio:"inherit"});else this._checkForMissingExecutable(f,P,q._name),_.unshift(f),_=e5(b8.execArgv).concat(_),$=E4.spawn(b8.execPath,_,{stdio:"inherit"});if(!$.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((z)=>{b8.on(z,()=>{if($.killed===!1&&$.exitCode===null)$.kill(z)})});let w=this._exitCallback;$.on("close",(O)=>{if(O=O??1,!w)b8.exit(O);else w(new R4(O,"commander.executeSubCommandAsync","(close)"))}),$.on("error",(O)=>{if(O.code==="ENOENT")this._checkForMissingExecutable(f,P,q._name);else if(O.code==="EACCES")throw new Error(`'${f}' not executable`);if(!w)b8.exit(1);else{let z=new R4(1,"commander.executeSubCommandAsync","(error)");z.nestedError=O,w(z)}}),this.runningCommand=$}_dispatchSubcommand(q,_,j){let K=this._findCommand(q);if(!K)this.help({error:!0});K._prepareForParse();let Y;return Y=this._chainOrCallSubCommandHook(Y,K,"preSubcommand"),Y=this._chainOrCall(Y,()=>{if(K._executableHandler)this._executeSubCommand(K,_.concat(j));else return K._parseCommand(_,j)}),Y}_dispatchHelpCommand(q){if(!q)this.help();let _=this._findCommand(q);if(_&&!_._executableHandler)_.help();return this._dispatchSubcommand(q,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((q,_)=>{if(q.required&&this.args[_]==null)this.missingArgument(q.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 q=(j,K,Y)=>{let f=K;if(K!==null&&j.parseArg){let P=`error: command-argument value '${K}' is invalid for argument '${j.name()}'.`;f=this._callParseArg(j,K,Y,P)}return f};this._checkNumberOfArguments();let _=[];this.registeredArguments.forEach((j,K)=>{let Y=j.defaultValue;if(j.variadic){if(K<this.args.length){if(Y=this.args.slice(K),j.parseArg)Y=Y.reduce((f,P)=>{return q(j,P,f)},j.defaultValue)}else if(Y===void 0)Y=[]}else if(K<this.args.length){if(Y=this.args[K],j.parseArg)Y=q(j,Y,j.defaultValue)}_[K]=Y}),this.processedArgs=_}_chainOrCall(q,_){if(q&&q.then&&typeof q.then==="function")return q.then(()=>_());return _()}_chainOrCallHooks(q,_){let j=q,K=[];if(this._getCommandAndAncestors().reverse().filter((Y)=>Y._lifeCycleHooks[_]!==void 0).forEach((Y)=>{Y._lifeCycleHooks[_].forEach((f)=>{K.push({hookedCommand:Y,callback:f})})}),_==="postAction")K.reverse();return K.forEach((Y)=>{j=this._chainOrCall(j,()=>{return Y.callback(Y.hookedCommand,this)})}),j}_chainOrCallSubCommandHook(q,_,j){let K=q;if(this._lifeCycleHooks[j]!==void 0)this._lifeCycleHooks[j].forEach((Y)=>{K=this._chainOrCall(K,()=>{return Y(this,_)})});return K}_parseCommand(q,_){let j=this.parseOptions(_);if(this._parseOptionsEnv(),this._parseOptionsImplied(),q=q.concat(j.operands),_=j.unknown,this.args=q.concat(_),q&&this._findCommand(q[0]))return this._dispatchSubcommand(q[0],q.slice(1),_);if(this._getHelpCommand()&&q[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(q[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(_),this._dispatchSubcommand(this._defaultCommandName,q,_);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(j.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let K=()=>{if(j.unknown.length>0)this.unknownOption(j.unknown[0])},Y=`command:${this.name()}`;if(this._actionHandler){K(),this._processArguments();let f;if(f=this._chainOrCallHooks(f,"preAction"),f=this._chainOrCall(f,()=>this._actionHandler(this.processedArgs)),this.parent)f=this._chainOrCall(f,()=>{this.parent.emit(Y,q,_)});return f=this._chainOrCallHooks(f,"postAction"),f}if(this.parent&&this.parent.listenerCount(Y))K(),this._processArguments(),this.parent.emit(Y,q,_);else if(q.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",q,_);if(this.listenerCount("command:*"))this.emit("command:*",q,_);else if(this.commands.length)this.unknownCommand();else K(),this._processArguments()}else if(this.commands.length)K(),this.help({error:!0});else K(),this._processArguments()}_findCommand(q){if(!q)return;return this.commands.find((_)=>_._name===q||_._aliases.includes(q))}_findOption(q){return this.options.find((_)=>_.is(q))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((q)=>{q.options.forEach((_)=>{if(_.mandatory&&q.getOptionValue(_.attributeName())===void 0)q.missingMandatoryOptionValue(_)})})}_checkForConflictingLocalOptions(){let q=this.options.filter((j)=>{let K=j.attributeName();if(this.getOptionValue(K)===void 0)return!1;return this.getOptionValueSource(K)!=="default"});q.filter((j)=>j.conflictsWith.length>0).forEach((j)=>{let K=q.find((Y)=>j.conflictsWith.includes(Y.attributeName()));if(K)this._conflictingOption(j,K)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((q)=>{q._checkForConflictingLocalOptions()})}parseOptions(q){let _=[],j=[],K=_,Y=q.slice();function f(w){return w.length>1&&w[0]==="-"}let P=(w)=>{if(!/^-\d*\.?\d+(e[+-]?\d+)?$/.test(w))return!1;return!this._getCommandAndAncestors().some((O)=>O.options.map((z)=>z.short).some((z)=>/^-\d$/.test(z)))},$=null;while(Y.length){let w=Y.shift();if(w==="--"){if(K===j)K.push(w);K.push(...Y);break}if($&&(!f(w)||P(w))){this.emit(`option:${$.name()}`,w);continue}if($=null,f(w)){let O=this._findOption(w);if(O){if(O.required){let z=Y.shift();if(z===void 0)this.optionMissingArgument(O);this.emit(`option:${O.name()}`,z)}else if(O.optional){let z=null;if(Y.length>0&&(!f(Y[0])||P(Y[0])))z=Y.shift();this.emit(`option:${O.name()}`,z)}else this.emit(`option:${O.name()}`);$=O.variadic?O:null;continue}}if(w.length>2&&w[0]==="-"&&w[1]!=="-"){let O=this._findOption(`-${w[1]}`);if(O){if(O.required||O.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${O.name()}`,w.slice(2));else this.emit(`option:${O.name()}`),Y.unshift(`-${w.slice(2)}`);continue}}if(/^--[^=]+=/.test(w)){let O=w.indexOf("="),z=this._findOption(w.slice(0,O));if(z&&(z.required||z.optional)){this.emit(`option:${z.name()}`,w.slice(O+1));continue}}if(K===_&&f(w)&&!(this.commands.length===0&&P(w)))K=j;if((this._enablePositionalOptions||this._passThroughOptions)&&_.length===0&&j.length===0){if(this._findCommand(w)){if(_.push(w),Y.length>0)j.push(...Y);break}else if(this._getHelpCommand()&&w===this._getHelpCommand().name()){if(_.push(w),Y.length>0)_.push(...Y);break}else if(this._defaultCommandName){if(j.push(w),Y.length>0)j.push(...Y);break}}if(this._passThroughOptions){if(K.push(w),Y.length>0)K.push(...Y);break}K.push(w)}return{operands:_,unknown:j}}opts(){if(this._storeOptionsAsProperties){let q={},_=this.options.length;for(let j=0;j<_;j++){let K=this.options[j].attributeName();q[K]=K===this._versionOptionName?this._version:this[K]}return q}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((q,_)=>Object.assign(q,_.opts()),{})}error(q,_){if(this._outputConfiguration.outputError(`${q}
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
`),this.outputHelp({error:!0});let j=_||{},K=j.exitCode||1,Y=j.code||"commander.error";this._exit(K,Y,q)}_parseOptionsEnv(){this.options.forEach((q)=>{if(q.envVar&&q.envVar in b8.env){let _=q.attributeName();if(this.getOptionValue(_)===void 0||["default","config","env"].includes(this.getOptionValueSource(_)))if(q.required||q.optional)this.emit(`optionEnv:${q.name()}`,b8.env[q.envVar]);else this.emit(`optionEnv:${q.name()}`)}})}_parseOptionsImplied(){let q=new Hz(this.options),_=(j)=>{return this.getOptionValue(j)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(j))};this.options.filter((j)=>j.implied!==void 0&&_(j.attributeName())&&q.valueFromOption(this.getOptionValue(j.attributeName()),j)).forEach((j)=>{Object.keys(j.implied).filter((K)=>!_(K)).forEach((K)=>{this.setOptionValueWithSource(K,j.implied[K],"implied")})})}missingArgument(q){let _=`error: missing required argument '${q}'`;this.error(_,{code:"commander.missingArgument"})}optionMissingArgument(q){let _=`error: option '${q.flags}' argument missing`;this.error(_,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(q){let _=`error: required option '${q.flags}' not specified`;this.error(_,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(q,_){let j=(f)=>{let P=f.attributeName(),$=this.getOptionValue(P),w=this.options.find((z)=>z.negate&&P===z.attributeName()),O=this.options.find((z)=>!z.negate&&P===z.attributeName());if(w&&(w.presetArg===void 0&&$===!1||w.presetArg!==void 0&&$===w.presetArg))return w;return O||f},K=(f)=>{let P=j(f),$=P.attributeName();if(this.getOptionValueSource($)==="env")return`environment variable '${P.envVar}'`;return`option '${P.flags}'`},Y=`error: ${K(q)} cannot be used with ${K(_)}`;this.error(Y,{code:"commander.conflictingOption"})}unknownOption(q){if(this._allowUnknownOption)return;let _="";if(q.startsWith("--")&&this._showSuggestionAfterError){let K=[],Y=this;do{let f=Y.createHelp().visibleOptions(Y).filter((P)=>P.long).map((P)=>P.long);K=K.concat(f),Y=Y.parent}while(Y&&!Y._enablePositionalOptions);_=F5(q,K)}let j=`error: unknown option '${q}'${_}`;this.error(j,{code:"commander.unknownOption"})}_excessArguments(q){if(this._allowExcessArguments)return;let _=this.registeredArguments.length,j=_===1?"":"s",Y=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${_} argument${j} but got ${q.length}.`;this.error(Y,{code:"commander.excessArguments"})}unknownCommand(){let q=this.args[0],_="";if(this._showSuggestionAfterError){let K=[];this.createHelp().visibleCommands(this).forEach((Y)=>{if(K.push(Y.name()),Y.alias())K.push(Y.alias())}),_=F5(q,K)}let j=`error: unknown command '${q}'${_}`;this.error(j,{code:"commander.unknownCommand"})}version(q,_,j){if(q===void 0)return this._version;this._version=q,_=_||"-V, --version",j=j||"output the version number";let K=this.createOption(_,j);return this._versionOptionName=K.attributeName(),this._registerOption(K),this.on("option:"+K.name(),()=>{this._outputConfiguration.writeOut(`${q}
`),this._exit(0,"commander.version",q)}),this}description(q,_){if(q===void 0&&_===void 0)return this._description;if(this._description=q,_)this._argsDescription=_;return this}summary(q){if(q===void 0)return this._summary;return this._summary=q,this}alias(q){if(q===void 0)return this._aliases[0];let _=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)_=this.commands[this.commands.length-1];if(q===_._name)throw new Error("Command alias can't be the same as its name");let j=this.parent?._findCommand(q);if(j){let K=[j.name()].concat(j.aliases()).join("|");throw new Error(`cannot add alias '${q}' to command '${this.name()}' as already have command '${K}'`)}return _._aliases.push(q),this}aliases(q){if(q===void 0)return this._aliases;return q.forEach((_)=>this.alias(_)),this}usage(q){if(q===void 0){if(this._usage)return this._usage;let _=this.registeredArguments.map((j)=>{return zz(j)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?_:[]).join(" ")}return this._usage=q,this}name(q){if(q===void 0)return this._name;return this._name=q,this}helpGroup(q){if(q===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=q,this}commandsGroup(q){if(q===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=q,this}optionsGroup(q){if(q===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=q,this}_initOptionGroup(q){if(this._defaultOptionGroup&&!q.helpGroupHeading)q.helpGroup(this._defaultOptionGroup)}_initCommandGroup(q){if(this._defaultCommandGroup&&!q.helpGroup())q.helpGroup(this._defaultCommandGroup)}nameFromFilename(q){return this._name=dq.basename(q,dq.extname(q)),this}executableDir(q){if(q===void 0)return this._executableDir;return this._executableDir=q,this}helpInformation(q){let _=this.createHelp(),j=this._getOutputContext(q);_.prepareContext({error:j.error,helpWidth:j.helpWidth,outputHasColors:j.hasColors});let K=_.formatHelp(this,_);if(j.hasColors)return K;return this._outputConfiguration.stripColor(K)}_getOutputContext(q){q=q||{};let _=!!q.error,j,K,Y;if(_)j=(P)=>this._outputConfiguration.writeErr(P),K=this._outputConfiguration.getErrHasColors(),Y=this._outputConfiguration.getErrHelpWidth();else j=(P)=>this._outputConfiguration.writeOut(P),K=this._outputConfiguration.getOutHasColors(),Y=this._outputConfiguration.getOutHelpWidth();return{error:_,write:(P)=>{if(!K)P=this._outputConfiguration.stripColor(P);return j(P)},hasColors:K,helpWidth:Y}}outputHelp(q){let _;if(typeof q==="function")_=q,q=void 0;let j=this._getOutputContext(q),K={error:j.error,write:j.write,command:this};this._getCommandAndAncestors().reverse().forEach((f)=>f.emit("beforeAllHelp",K)),this.emit("beforeHelp",K);let Y=this.helpInformation({error:j.error});if(_){if(Y=_(Y),typeof Y!=="string"&&!Buffer.isBuffer(Y))throw new Error("outputHelp callback must return a string or a Buffer")}if(j.write(Y),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",K),this._getCommandAndAncestors().forEach((f)=>f.emit("afterAllHelp",K))}helpOption(q,_){if(typeof q==="boolean"){if(q){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(q??"-h, --help",_??"display help for command"),q||_)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(q){return this._helpOption=q,this._initOptionGroup(q),this}help(q){this.outputHelp(q);let _=Number(b8.exitCode??0);if(_===0&&q&&typeof q!=="function"&&q.error)_=1;this._exit(_,"commander.help","(outputHelp)")}addHelpText(q,_){let j=["beforeAll","before","after","afterAll"];if(!j.includes(q))throw new Error(`Unexpected value for position to addHelpText.
Expecting one of '${j.join("', '")}'`);let K=`${q}Help`;return this.on(K,(Y)=>{let f;if(typeof _==="function")f=_({error:Y.error,command:Y.command});else f=_;if(f)Y.write(`${f}
`)}),this}_outputHelpIfRequested(q){let _=this._getHelpOption();if(_&&q.find((K)=>_.is(K)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function e5(q){return q.map((_)=>{if(!_.startsWith("--inspect"))return _;let j,K="127.0.0.1",Y="9229",f;if((f=_.match(/^(--inspect(-brk)?)$/))!==null)j=f[1];else if((f=_.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(j=f[1],/^\d+$/.test(f[3]))Y=f[3];else K=f[3];else if((f=_.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)j=f[1],K=f[3],Y=f[4];if(j&&Y!=="0")return`${j}=${K}:${parseInt(Y)+1}`;return _})}function I4(){if(b8.env.NO_COLOR||b8.env.FORCE_COLOR==="0"||b8.env.FORCE_COLOR==="false")return!1;if(b8.env.FORCE_COLOR||b8.env.CLICOLOR_FORCE!==void 0)return!0;return}Jz.Command=m4;Jz.useColor=I4});var _1=F((Az)=>{var{Argument:s5}=_7(),{Command:g4}=U5(),{CommanderError:kz,InvalidArgumentError:Q5}=aK(),{Help:Xz}=b4(),{Option:q1}=S4();Az.program=new g4;Az.createCommand=(q)=>new g4(q);Az.createOption=(q,_)=>new q1(q,_);Az.createArgument=(q,_)=>new s5(q,_);Az.Command=g4;Az.Option=q1;Az.Argument=s5;Az.Help=Xz;Az.CommanderError=kz;Az.InvalidArgumentError=Q5;Az.InvalidOptionArgumentError=Q5});function y4(q){try{let _=q instanceof Date?q:new Date(q),K=new Date().getTime()-_.getTime(),Y=Math.floor(K/1000),f=Math.floor(Y/60),P=Math.floor(f/60),$=Math.floor(P/24),w=Math.floor($/7),O=Math.floor($/30);if(Y<60)return"Just now";else if(f<60)return f===1?"1 minute ago":`${f} minutes ago`;else if(P<24)return P===1?"1 hour ago":`${P} hours ago`;else if($===1)return"Yesterday";else if($<7)return`${$} days ago`;else if(w===1)return"1 week ago";else if(w<4)return`${w} weeks ago`;else if(O===1)return"1 month ago";else if(O<12)return`${O} months ago`;else{let z=Math.floor(O/12);return z===1?"1 year ago":`${z} years ago`}}catch(_){return"Recently"}}function v1(q){let _=["timestamp","created_at","date","time"];for(let j of _)if(q[j])try{let K=new Date(q[j]);if(!isNaN(K.getTime()))return K}catch{continue}return null}function F_(){let q=process.env.CLAUDE_MEM_WRAP_WIDTH;if(q){let _=parseInt(q,10);if(!Number.isNaN(_)&&_>40&&_<=200)return _}return 80}function dz(q,_){if(!q)return"";if(/^[\-=\u2014_\u2500\u2550]{5,}$/.test(q.trim()))return q;if(q.length<=_)return q;let j=q.match(/^\s*/),K=j?j[0]:"",Y=q.slice(K.length),f=Math.max(10,_-K.length),P=Y.split(/(\s+)/),$=[],w="",O=()=>{$.push(K+w.trimEnd()),w=""};for(let z of P){if(z==="")continue;if(!/\s/.test(z)&&z.length>f){if(w.trim().length>0)O();let W=0;while(W<z.length){let v=z.slice(W,W+f);$.push(K+v),W+=f}w="";continue}if(K.length+w.length+z.length>_)O();w+=z}if(w.trim().length>0||$.length===0)O();return $.join(`
`)}function I6(q,_){if(!q)return"";return q.split(`
`).map((j)=>dz(j,_)).join(`
`)}function j7(q="─",_=F_()){if(!q||q.length===0)q="-";return q.repeat(_).slice(0,_)}function H1(q){let _={searching:"\uD83D\uDD0D Searching previous memories...",loading:"\uD83D\uDCDA Loading relevant context...",formatting:"✨ Organizing memories for display...",compressing:"\uD83D\uDDDC Compressing session transcript...",archiving:"\uD83D\uDCE6 Archiving conversation..."},j=F_();return I6(_[q]||`${q}...`,j)}function tK(q,_,j){let K=_!==void 0?` (${_} items)`:"",Y=j?`
${j}`:"",f=F_();return I6(`${q} completed successfully${K}${Y}`,f)}function e_(q,_,j){let K=j?`
\uD83D\uDCA1 ${j}`:"",Y=F_();return I6(`${q} encountered an issue: ${_}${K}`,Y)}function U_(q,..._){let j=Lz[q](..._);return e_("Memory system",j.message,j.suggestion)}function d4(q){let _=typeof q==="string"?new Date(q):q,K=new Date().getTime()-_.getTime(),Y=Math.floor(K/60000),f=Math.floor(K/3600000),P=Math.floor(K/86400000);if(Y<1)return"just now";if(Y<60)return`${Y} minute${Y>1?"s":""} ago`;if(f<24)return`${f} hour${f>1?"s":""} ago`;if(P<7)return`${P} day${P>1?"s":""} ago`;return _.toLocaleDateString()}function J1(q,_){let{count:j,duration:K,details:Y}=_,f=K?` in ${K}ms`:"",P=Y?` - ${Y}`:"",$={compress:`Compressed ${j} conversation turns${f}${P}`,load:`Loaded ${j} relevant memories${f}${P}`,search:`Found ${j} matching memories${f}${P}`,archive:`Archived ${j} conversation segments${f}${P}`},w=F_();return I6(`\uD83D\uDCCA ${$[q]}`,w)}function pz(q,_=3,j){let K=q.filter((P)=>P.type==="overview");if(K.length===0)return[];let Y=K;if(j){if(Y=K.filter((P)=>P.project===j),Y.length===0)Y=K}return Y.slice(-_).map((P)=>{let $={content:P.content||"",sessionId:P.sessionId||P.session_id||"unknown"},w=v1(P);if(w)$.timestamp=w,$.timeAgo=y4(w);else $.timeAgo="Recently";return $})}function lz(q){if(q.length===0)return[];return q.filter((_)=>_.type==="memory").map((_)=>{let j={summary:_.text||"",sessionId:_.session_id||""};if(_.keywords)j.keywords=_.keywords;if(_.document_id&&!_.document_id.includes("Session:"))j.location=_.document_id;return j}).filter((_)=>_.summary.length>0)}function xz(q){let _=new Map;return q.forEach((j)=>{let K=j.sessionId;if(K){if(!_.has(K))_.set(K,[]);_.get(K).push(j)}}),Array.from(_.entries()).map(([j,K])=>{let Y=K.map((f,P)=>({...f,number:P+1}));return{sessionId:j,memories:Y}})}function nz(q){let _=new Map;return q.forEach((j)=>{let K=j.sessionId||"unknown";if(!_.has(K))_.set(K,[]);_.get(K).push(j)}),Array.from(_.entries()).map(([j,K])=>{let Y=K.map((P)=>P.timestamp).filter((P)=>P!==void 0).sort((P,$)=>P.getTime()-$.getTime()),f={sessionId:j,overviews:K};if(Y.length>0)f.earliestTimestamp=Y[0],f.timeAgo=y4(Y[0]);return f})}function L4(q){let{projectName:_,memoryCount:j,lastSessionTime:K,recentObjects:Y}=q,f=F_(),$=new Date().toLocaleString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",timeZoneName:"short"});console.log(""),console.log(I6(`\uD83D\uDCC5 ${$}`,f)),console.log(j7("─",f));let w=pz(Y,10,_);console.error(`[DEBUG] recentObjects has ${Y.length} items`),console.error(`[DEBUG] overviews extracted: ${w.length}`);let O=lz(Y),z=(W,v)=>{let H=W.includes(",")||W.includes(`
`)?W.split(/[\n,]+/):[W];for(let T of H){let J=T.trim();if(!J)continue;let k=J.toLowerCase();if(!v.has(k))v.set(k,J)}};if(O.length>0){let W=xz(O);console.log(""),console.log(""),console.log(I6("\uD83D\uDCDA Memories",f)),W.forEach((v)=>{console.log(j7("─",f)),console.log(""),console.log(I6(`\uD83D\uDD0D ${v.sessionId}`,f));let H=new Map;v.memories.forEach((J)=>{if(console.log(""),console.log(I6(`${J.number}. ${J.summary}`,f)),J.keywords)z(J.keywords,H)});let T=Array.from(H.values());if(T.length>0)console.log(""),console.log(I6(`\uD83C\uDFF7 ${T.join(", ")}`,f));console.log("")})}if(w.length>0){let W=nz(w);W.sort((v,H)=>{let T=v.earliestTimestamp?.getTime()||0,J=H.earliestTimestamp?.getTime()||0;return T-J}),console.log(""),console.log(I6("\uD83E\uDDE0 Overviews",f)),console.log(j7("─",f)),W.forEach((v)=>{console.log(""),console.log(I6(`\uD83D\uDD0D ${v.sessionId}`,f)),v.overviews.forEach((H,T)=>{if(console.log(""),console.log(I6(`${T+1}. ${H.content}`,f)),console.log(""),H.timeAgo)console.log(I6(`\uD83D\uDCC5 ${H.timeAgo}`,f))}),console.log(""),console.log(j7("─",f))})}else if(O.length===0)console.log(I6(`\uD83E\uDDE0 No recent context found for ${_}`,f))}var Lz;var p4=R8(()=>{Lz={NO_MEMORIES:(q)=>({message:`No previous memories found for ${q}`,suggestion:"This appears to be your first session. Memories will be created as you work."}),CONNECTION_FAILED:()=>({message:"Could not connect to memory system",suggestion:"Try restarting Claude Code or check if the MCP server is properly configured."}),SEARCH_FAILED:(q)=>({message:`Search for "${q}" didn't return any results`,suggestion:"Try using different keywords or check if memories exist for this project."}),LOAD_TIMEOUT:()=>({message:"Memory loading timed out",suggestion:"The operation is taking longer than expected. You can continue without loaded context."})}});import{join as A1}from"path";import{fileURLToPath as bW}from"url";import{setMaxListeners as SW}from"events";import{spawn as RW}from"child_process";import{createInterface as IW}from"readline";import*as J8 from"fs";import{stat as mW}from"fs/promises";function S1(q=EW){let _=new AbortController;return SW(q,_.signal),_}function dW(){return yW}class E1{options;child;childStdin;childStdout;ready=!1;abortController;exitError;exitListeners=[];processExitHandler;abortHandler;constructor(q){this.options=q,this.abortController=q.abortController||S1(),this.initialize()}initialize(){try{let{prompt:q,additionalDirectories:_=[],cwd:j,executable:K=this.isRunningWithBun()?"bun":"node",executableArgs:Y=[],extraArgs:f={},pathToClaudeCodeExecutable:P,env:$={...process.env},stderr:w,customSystemPrompt:O,appendSystemPrompt:z,maxTurns:W,model:v,fallbackModel:H,permissionMode:T,permissionPromptToolName:J,continueConversation:k,resume:A,allowedTools:G=[],disallowedTools:u=[],mcpServers:V,strictMcpConfig:m,canUseTool:N}=this.options,R=["--output-format","stream-json","--verbose"];if(O)R.push("--system-prompt",O);if(z)R.push("--append-system-prompt",z);if(W)R.push("--max-turns",W.toString());if(v)R.push("--model",v);if($.DEBUG)R.push("--debug-to-stderr");if(N){if(typeof q==="string")throw new Error("canUseTool callback requires --input-format stream-json. Please set prompt as an AsyncIterable.");if(J)throw new Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");R.push("--permission-prompt-tool","stdio")}else if(J)R.push("--permission-prompt-tool",J);if(k)R.push("--continue");if(A)R.push("--resume",A);if(G.length>0)R.push("--allowedTools",G.join(","));if(u.length>0)R.push("--disallowedTools",u.join(","));if(V&&Object.keys(V).length>0)R.push("--mcp-config",JSON.stringify({mcpServers:V}));if(m)R.push("--strict-mcp-config");if(T&&T!=="default")R.push("--permission-mode",T);if(H){if(v&&H===v)throw new Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");R.push("--fallback-model",H)}if(typeof q==="string")R.push("--print"),R.push("--",q.trim());else R.push("--input-format","stream-json");for(let L of _)R.push("--add-dir",L);for(let[L,c]of Object.entries(f))if(c===null)R.push(`--${L}`);else R.push(`--${L}`,c);if(!$.CLAUDE_CODE_ENTRYPOINT)$.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!dW().existsSync(P)){let L=G1(P)?`Claude Code native binary not found at ${P}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${P}. Is options.pathToClaudeCodeExecutable set?`;throw new ReferenceError(L)}let b=G1(P),d=b?P:K,y=b?R:[...Y,P,...R];this.logDebug(b?`Spawning Claude Code native binary: ${P} ${R.join(" ")}`:`Spawning Claude Code process: ${K} ${[...Y,P,...R].join(" ")}`);let M=$.DEBUG||w?"pipe":"ignore";if(this.child=RW(d,y,{cwd:j,stdio:["pipe","pipe",M],signal:this.abortController.signal,env:$}),this.childStdin=this.child.stdin,this.childStdout=this.child.stdout,typeof q==="string")this.childStdin.end(),this.childStdin=void 0;if($.DEBUG||w)this.child.stderr.on("data",(L)=>{if(this.logDebug(`Claude Code stderr: ${L.toString()}`),w)w(L.toString())});let S=()=>{if(this.child&&!this.child.killed)this.child.kill("SIGTERM")};this.processExitHandler=S,this.abortHandler=S,process.on("exit",this.processExitHandler),this.abortController.signal.addEventListener("abort",this.abortHandler),this.child.on("error",(L)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new Q_("Claude Code process aborted by user");else this.exitError=new Error(`Failed to spawn Claude Code process: ${L.message}`),this.logDebug(this.exitError.message)}),this.child.on("close",(L,c)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new Q_("Claude Code process aborted by user");else{let B=this.getProcessExitError(L,c);if(B)this.exitError=B,this.logDebug(B.message)}}),this.ready=!0}catch(q){throw this.ready=!1,q}}getProcessExitError(q,_){if(q!==0&&q!==null)return new Error(`Claude Code process exited with code ${q}`);else if(_)return new Error(`Claude Code process terminated by signal ${_}`);return}isRunningWithBun(){return process.versions.bun!==void 0||process.env.BUN_INSTALL!==void 0}logDebug(q){if(process.env.DEBUG)process.stderr.write(`${q}
`)}write(q){if(this.abortController.signal.aborted)throw new Q_("Operation aborted");if(!this.ready||!this.childStdin)throw new Error("ProcessTransport is not ready for writing");if(this.child?.killed||this.child?.exitCode!==null)throw new Error("Cannot write to terminated process");if(this.exitError)throw new Error(`Cannot write to process that exited with error: ${this.exitError.message}`);if(process.env.DEBUG_SDK)process.stderr.write(`[ProcessTransport] Writing to stdin: ${q.substring(0,100)}
`);try{if(!this.childStdin.write(q)&&process.env.DEBUG_SDK)console.warn("[ProcessTransport] Write buffer full, data queued")}catch(_){throw this.ready=!1,new Error(`Failed to write to process stdin: ${_.message}`)}}close(){if(this.childStdin)this.childStdin.end(),this.childStdin=void 0;if(this.processExitHandler)process.off("exit",this.processExitHandler),this.processExitHandler=void 0;if(this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;for(let{handler:q}of this.exitListeners)this.child?.off("exit",q);if(this.exitListeners=[],this.child&&!this.child.killed)this.child.kill("SIGTERM"),setTimeout(()=>{if(this.child&&!this.child.killed)this.child.kill("SIGKILL")},5000);this.ready=!1}isReady(){return this.ready}async*readMessages(){if(!this.childStdout)throw new Error("ProcessTransport output stream not available");let q=IW({input:this.childStdout});try{for await(let _ of q)if(_.trim())yield JSON.parse(_);await this.waitForExit()}catch(_){throw _}finally{q.close()}}endInput(){if(this.childStdin)this.childStdin.end()}getInputStream(){return this.childStdin}onExit(q){if(!this.child)return()=>{};let _=(j,K)=>{let Y=this.getProcessExitError(j,K);q(Y)};return this.child.on("exit",_),this.exitListeners.push({callback:q,handler:_}),()=>{if(this.child)this.child.off("exit",_);let j=this.exitListeners.findIndex((K)=>K.handler===_);if(j!==-1)this.exitListeners.splice(j,1)}}async waitForExit(){if(!this.child){if(this.exitError)throw this.exitError;return}if(this.child.exitCode!==null||this.child.killed){if(this.exitError)throw this.exitError;return}return new Promise((q,_)=>{let j=(Y,f)=>{if(this.abortController.signal.aborted){_(new Q_("Operation aborted"));return}let P=this.getProcessExitError(Y,f);if(P)_(P);else q()};this.child.once("exit",j);let K=(Y)=>{this.child.off("exit",j),_(Y)};this.child.once("error",K),this.child.once("exit",()=>{this.child.off("error",K)})})}}function G1(q){return![".js",".mjs",".tsx",".ts",".jsx"].some((j)=>q.endsWith(j))}class I1{sendMcpMessage;isClosed=!1;constructor(q){this.sendMcpMessage=q}onclose;onerror;onmessage;async start(){}async send(q){if(this.isClosed)throw new Error("Transport is closed");this.sendMcpMessage(q)}async close(){if(this.isClosed)return;this.isClosed=!0,this.onclose?.()}}function lW(q){g1=q}function P7(){return g1}function U(q,_){let j=P7(),K=Y7({issueData:_,data:q.data,path:q.path,errorMaps:[q.common.contextualErrorMap,q.schemaErrorMap,j,j===KK?void 0:KK].filter((Y)=>!!Y)});q.common.issues.push(K)}class A6{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(q,_){let j=[];for(let K of _){if(K.status==="aborted")return W8;if(K.status==="dirty")q.dirty();j.push(K.value)}return{status:q.value,value:j}}static async mergeObjectAsync(q,_){let j=[];for(let K of _){let Y=await K.key,f=await K.value;j.push({key:Y,value:f})}return A6.mergeObjectSync(q,j)}static mergeObjectSync(q,_){let j={};for(let K of _){let{key:Y,value:f}=K;if(Y.status==="aborted")return W8;if(f.status==="aborted")return W8;if(Y.status==="dirty")q.dirty();if(f.status==="dirty")q.dirty();if(Y.value!=="__proto__"&&(typeof f.value!=="undefined"||K.alwaysSet))j[Y.value]=f.value}return{status:q.value,value:j}}}class Wq{constructor(q,_,j,K){this._cachedPath=[],this.parent=q,this.data=_,this._path=j,this._key=K}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function Z8(q){if(!q)return{};let{errorMap:_,invalid_type_error:j,required_error:K,description:Y}=q;if(_&&(j||K))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(_)return{errorMap:_,description:Y};return{errorMap:(P,$)=>{let{message:w}=q;if(P.code==="invalid_enum_value")return{message:w??$.defaultError};if(typeof $.data==="undefined")return{message:w??K??$.defaultError};if(P.code!=="invalid_type")return{message:$.defaultError};return{message:w??j??$.defaultError}},description:Y}}class k8{get description(){return this._def.description}_getType(q){return pq(q.data)}_getOrReturnCtx(q,_){return _||{common:q.parent.common,data:q.data,parsedType:pq(q.data),schemaErrorMap:this._def.errorMap,path:q.path,parent:q.parent}}_processInputParams(q){return{status:new A6,ctx:{common:q.parent.common,data:q.data,parsedType:pq(q.data),schemaErrorMap:this._def.errorMap,path:q.path,parent:q.parent}}}_parseSync(q){let _=this._parse(q);if(FK(_))throw new Error("Synchronous parse encountered promise.");return _}_parseAsync(q){let _=this._parse(q);return Promise.resolve(_)}parse(q,_){let j=this.safeParse(q,_);if(j.success)return j.data;throw j.error}safeParse(q,_){let j={common:{issues:[],async:_?.async??!1,contextualErrorMap:_?.errorMap},path:_?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:q,parsedType:pq(q)},K=this._parseSync({data:q,path:j.path,parent:j});return u1(j,K)}"~validate"(q){let _={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:q,parsedType:pq(q)};if(!this["~standard"].async)try{let j=this._parseSync({data:q,path:[],parent:_});return X_(j)?{value:j.value}:{issues:_.common.issues}}catch(j){if(j?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;_.common={issues:[],async:!0}}return this._parseAsync({data:q,path:[],parent:_}).then((j)=>X_(j)?{value:j.value}:{issues:_.common.issues})}async parseAsync(q,_){let j=await this.safeParseAsync(q,_);if(j.success)return j.data;throw j.error}async safeParseAsync(q,_){let j={common:{issues:[],contextualErrorMap:_?.errorMap,async:!0},path:_?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:q,parsedType:pq(q)},K=this._parse({data:q,path:j.path,parent:j}),Y=await(FK(K)?K:Promise.resolve(K));return u1(j,Y)}refine(q,_){let j=(K)=>{if(typeof _==="string"||typeof _==="undefined")return{message:_};else if(typeof _==="function")return _(K);else return _};return this._refinement((K,Y)=>{let f=q(K),P=()=>Y.addIssue({code:t.custom,...j(K)});if(typeof Promise!=="undefined"&&f instanceof Promise)return f.then(($)=>{if(!$)return P(),!1;else return!0});if(!f)return P(),!1;else return!0})}refinement(q,_){return this._refinement((j,K)=>{if(!q(j))return K.addIssue(typeof _==="function"?_(j,K):_),!1;else return!0})}_refinement(q){return new e6({schema:this,typeName:v8.ZodEffects,effect:{type:"refinement",refinement:q}})}superRefine(q){return this._refinement(q)}constructor(q){this.spa=this.safeParseAsync,this._def=q,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(_)=>this["~validate"](_)}}optional(){return zq.create(this,this._def)}nullable(){return lq.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wq.create(this)}promise(){return h_.create(this,this._def)}or(q){return fK.create([this,q],this._def)}and(q){return $K.create(this,q,this._def)}transform(q){return new e6({...Z8(this._def),schema:this,typeName:v8.ZodEffects,effect:{type:"transform",transform:q}})}default(q){let _=typeof q==="function"?q:()=>q;return new WK({...Z8(this._def),innerType:this,defaultValue:_,typeName:v8.ZodDefault})}brand(){return new $7({typeName:v8.ZodBranded,type:this,...Z8(this._def)})}catch(q){let _=typeof q==="function"?q:()=>q;return new vK({...Z8(this._def),innerType:this,catchValue:_,typeName:v8.ZodCatch})}describe(q){return new this.constructor({...this._def,description:q})}pipe(q){return _3.create(this,q)}readonly(){return HK.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function d1(q){let _="[0-5]\\d";if(q.precision)_=`${_}\\.\\d{${q.precision}}`;else if(q.precision==null)_=`${_}(\\.\\d+)?`;let j=q.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${_})${j}`}function jv(q){return new RegExp(`^${d1(q)}$`)}function L1(q){let _=`${y1}T${d1(q)}`,j=[];if(j.push(q.local?"Z?":"Z"),q.offset)j.push("([+-]\\d{2}:?\\d{2})");return _=`${_}(${j.join("|")})`,new RegExp(`^${_}$`)}function Pv(q,_){if((_==="v4"||!_)&&eW.test(q))return!0;if((_==="v6"||!_)&&sW.test(q))return!0;return!1}function Yv(q,_){if(!aW.test(q))return!1;try{let[j]=q.split(".");if(!j)return!1;let K=j.replace(/-/g,"+").replace(/_/g,"/").padEnd(j.length+(4-j.length%4)%4,"="),Y=JSON.parse(atob(K));if(typeof Y!=="object"||Y===null)return!1;if("typ"in Y&&Y?.typ!=="JWT")return!1;if(!Y.alg)return!1;if(_&&Y.alg!==_)return!1;return!0}catch{return!1}}function fv(q,_){if((_==="v4"||!_)&&UW.test(q))return!0;if((_==="v6"||!_)&&QW.test(q))return!0;return!1}function $v(q,_){let j=(q.toString().split(".")[1]||"").length,K=(_.toString().split(".")[1]||"").length,Y=j>K?j:K,f=Number.parseInt(q.toFixed(Y).replace(".","")),P=Number.parseInt(_.toFixed(Y).replace(".",""));return f%P/10**Y}function s_(q){if(q instanceof B8){let _={};for(let j in q.shape){let K=q.shape[j];_[j]=zq.create(s_(K))}return new B8({...q._def,shape:()=>_})}else if(q instanceof wq)return new wq({...q._def,type:s_(q.element)});else if(q instanceof zq)return zq.create(s_(q.unwrap()));else if(q instanceof lq)return lq.create(s_(q.unwrap()));else if(q instanceof Cq)return Cq.create(q.items.map((_)=>s_(_)));else return q}function i4(q,_){let j=pq(q),K=pq(_);if(q===_)return{valid:!0,data:q};else if(j===Q.object&&K===Q.object){let Y=h8.objectKeys(_),f=h8.objectKeys(q).filter(($)=>Y.indexOf($)!==-1),P={...q,..._};for(let $ of f){let w=i4(q[$],_[$]);if(!w.valid)return{valid:!1};P[$]=w.data}return{valid:!0,data:P}}else if(j===Q.array&&K===Q.array){if(q.length!==_.length)return{valid:!1};let Y=[];for(let f=0;f<q.length;f++){let P=q[f],$=_[f],w=i4(P,$);if(!w.valid)return{valid:!1};Y.push(w.data)}return{valid:!0,data:Y}}else if(j===Q.date&&K===Q.date&&+q===+_)return{valid:!0,data:q};else return{valid:!1}}function p1(q,_){return new q_({values:q,typeName:v8.ZodEnum,...Z8(_)})}function h1(q,_){let j=typeof q==="function"?q(_):typeof q==="string"?{message:q}:q;return typeof j==="string"?{message:j}:j}function l1(q,_={},j){if(q)return G_.create().superRefine((K,Y)=>{let f=q(K);if(f instanceof Promise)return f.then((P)=>{if(!P){let $=h1(_,K),w=$.fatal??j??!0;Y.addIssue({code:"custom",...$,fatal:w})}});if(!f){let P=h1(_,K),$=P.fatal??j??!0;Y.addIssue({code:"custom",...P,fatal:$})}return});return G_.create()}function sH(q){if(!q)return{};let{errorMap:_,invalid_type_error:j,required_error:K,description:Y}=q;if(_&&(j||K))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(_)return{errorMap:_,description:Y};return{errorMap:(P,$)=>{var w,O;let{message:z}=q;if(P.code==="invalid_enum_value")return{message:z!==null&&z!==void 0?z:$.defaultError};if(typeof $.data==="undefined")return{message:(w=z!==null&&z!==void 0?z:K)!==null&&w!==void 0?w:$.defaultError};if(P.code!=="invalid_type")return{message:$.defaultError};return{message:(O=z!==null&&z!==void 0?z:j)!==null&&O!==void 0?O:$.defaultError}},description:Y}}function xq({prompt:q,options:{abortController:_=S1(),additionalDirectories:j=[],allowedTools:K=[],appendSystemPrompt:Y,canUseTool:f,continue:P,customSystemPrompt:$,cwd:w,disallowedTools:O=[],env:z,executable:W=QH()?"bun":"node",executableArgs:v=[],extraArgs:H={},fallbackModel:T,hooks:J,maxTurns:k,mcpServers:A,model:G,pathToClaudeCodeExecutable:u,permissionMode:V="default",permissionPromptToolName:m,resume:N,stderr:R,strictMcpConfig:p}={}}){if(!z)z={...process.env};if(!z.CLAUDE_CODE_ENTRYPOINT)z.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(u===void 0){let L=bW(import.meta.url),c=A1(L,"..");u=A1(c,"cli.js")}let b={},d=new Map;if(A)for(let[L,c]of Object.entries(A))if(c.type==="sdk")d.set(L,c.instance),b[L]={type:"sdk",name:L};else b[L]=c;let y=typeof q!=="string",M=new E1({prompt:q,abortController:_,additionalDirectories:j,cwd:w,executable:W,executableArgs:v,extraArgs:H,pathToClaudeCodeExecutable:u,env:z,stderr:R,customSystemPrompt:$,appendSystemPrompt:Y,maxTurns:k,model:G,fallbackModel:T,permissionMode:V,permissionPromptToolName:m,continueConversation:P,resume:N,allowedTools:K,disallowedTools:O,mcpServers:A,strictMcpConfig:p,canUseTool:!!f,hooks:!!J}),S=new m1(M,y,f,J,_,d);if(typeof q!=="string")S.streamInput(q);return S}function QH(){return process.versions.bun!==void 0||process.env.BUN_INSTALL!==void 0}var cz,rz,x4,iz,oz,az=(q,_,j)=>{j=q!=null?cz(rz(q)):{};let K=_||!q||!q.__esModule?x4(j,"default",{value:q,enumerable:!0}):j;for(let Y of iz(q))if(!oz.call(K,Y))x4(K,Y,{get:()=>q[Y],enumerable:!0});return K},T8=(q,_)=>()=>(_||q((_={exports:{}}).exports,_),_.exports),Bz=(q,_)=>{for(var j in _)x4(q,j,{get:_[j],enumerable:!0,configurable:!0,set:(K)=>_[j]=()=>K})},tz,B4,Fz,JK,V1,ez,t4,F4,M1,N1,Uz,sz,Qz,qW,_W,KW,jW,PW,YW,fW,$W,OW,wW,zW,T1,Z1,k1,X1,WW,vW,HW,JW,TW,ZW,kW,XW,AW,GW,uW,hW,CW,b1,DW,VW,MW,NW,EW=50,gW,yW,Q_,R1,m1,X,h8,n4,Q,pq=(q)=>{switch(typeof q){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return Number.isNaN(q)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"symbol":return Q.symbol;case"object":if(Array.isArray(q))return Q.array;if(q===null)return Q.null;if(q.then&&typeof q.then==="function"&&q.catch&&typeof q.catch==="function")return Q.promise;if(typeof Map!=="undefined"&&q instanceof Map)return Q.map;if(typeof Set!=="undefined"&&q instanceof Set)return Q.set;if(typeof Date!=="undefined"&&q instanceof Date)return Q.date;return Q.object;default:return Q.unknown}},t,LW=(q)=>{return JSON.stringify(q,null,2).replace(/"([^"]+)":/g,"$1:")},l6,pW=(q,_)=>{let j;switch(q.code){case t.invalid_type:if(q.received===Q.undefined)j="Required";else j=`Expected ${q.expected}, received ${q.received}`;break;case t.invalid_literal:j=`Invalid literal value, expected ${JSON.stringify(q.expected,h8.jsonStringifyReplacer)}`;break;case t.unrecognized_keys:j=`Unrecognized key(s) in object: ${h8.joinValues(q.keys,", ")}`;break;case t.invalid_union:j="Invalid input";break;case t.invalid_union_discriminator:j=`Invalid discriminator value. Expected ${h8.joinValues(q.options)}`;break;case t.invalid_enum_value:j=`Invalid enum value. Expected ${h8.joinValues(q.options)}, received '${q.received}'`;break;case t.invalid_arguments:j="Invalid function arguments";break;case t.invalid_return_type:j="Invalid function return type";break;case t.invalid_date:j="Invalid date";break;case t.invalid_string:if(typeof q.validation==="object")if("includes"in q.validation){if(j=`Invalid input: must include "${q.validation.includes}"`,typeof q.validation.position==="number")j=`${j} at one or more positions greater than or equal to ${q.validation.position}`}else if("startsWith"in q.validation)j=`Invalid input: must start with "${q.validation.startsWith}"`;else if("endsWith"in q.validation)j=`Invalid input: must end with "${q.validation.endsWith}"`;else h8.assertNever(q.validation);else if(q.validation!=="regex")j=`Invalid ${q.validation}`;else j="Invalid";break;case t.too_small:if(q.type==="array")j=`Array must contain ${q.exact?"exactly":q.inclusive?"at least":"more than"} ${q.minimum} element(s)`;else if(q.type==="string")j=`String must contain ${q.exact?"exactly":q.inclusive?"at least":"over"} ${q.minimum} character(s)`;else if(q.type==="number")j=`Number must be ${q.exact?"exactly equal to ":q.inclusive?"greater than or equal to ":"greater than "}${q.minimum}`;else if(q.type==="bigint")j=`Number must be ${q.exact?"exactly equal to ":q.inclusive?"greater than or equal to ":"greater than "}${q.minimum}`;else if(q.type==="date")j=`Date must be ${q.exact?"exactly equal to ":q.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(q.minimum))}`;else j="Invalid input";break;case t.too_big:if(q.type==="array")j=`Array must contain ${q.exact?"exactly":q.inclusive?"at most":"less than"} ${q.maximum} element(s)`;else if(q.type==="string")j=`String must contain ${q.exact?"exactly":q.inclusive?"at most":"under"} ${q.maximum} character(s)`;else if(q.type==="number")j=`Number must be ${q.exact?"exactly":q.inclusive?"less than or equal to":"less than"} ${q.maximum}`;else if(q.type==="bigint")j=`BigInt must be ${q.exact?"exactly":q.inclusive?"less than or equal to":"less than"} ${q.maximum}`;else if(q.type==="date")j=`Date must be ${q.exact?"exactly":q.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(q.maximum))}`;else j="Invalid input";break;case t.custom:j="Invalid input";break;case t.invalid_intersection_types:j="Intersection results could not be merged";break;case t.not_multiple_of:j=`Number must be a multiple of ${q.multipleOf}`;break;case t.not_finite:j="Number must be finite";break;default:j=_.defaultError,h8.assertNever(q)}return{message:j}},KK,g1,Y7=(q)=>{let{data:_,path:j,errorMaps:K,issueData:Y}=q,f=[...j,...Y.path||[]],P={...Y,path:f};if(Y.message!==void 0)return{...Y,path:f,message:Y.message};let $="",w=K.filter((O)=>!!O).slice().reverse();for(let O of w)$=O(P,{data:_,defaultError:$}).message;return{...Y,path:f,message:$}},xW,W8,qK=(q)=>({status:"dirty",value:q}),M6=(q)=>({status:"valid",value:q}),c4=(q)=>q.status==="aborted",r4=(q)=>q.status==="dirty",X_=(q)=>q.status==="valid",FK=(q)=>typeof Promise!=="undefined"&&q instanceof Promise,$8,u1=(q,_)=>{if(X_(_))return{success:!0,data:_.value};else{if(!q.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let j=new l6(q.common.issues);return this._error=j,this._error}}}},nW,cW,rW,iW,oW,aW,BW,tW,FW="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",l4,eW,UW,sW,QW,qv,_v,y1="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Kv,Oq,sq,Qq,jK,A_,eK,PK,YK,G_,Uq,hq,UK,wq,B8,fK,Lq=(q)=>{if(q instanceof OK)return Lq(q.schema);else if(q instanceof e6)return Lq(q.innerType());else if(q instanceof wK)return[q.value];else if(q instanceof q_)return q.options;else if(q instanceof zK)return h8.objectValues(q.enum);else if(q instanceof WK)return Lq(q._def.innerType);else if(q instanceof PK)return[void 0];else if(q instanceof YK)return[null];else if(q instanceof zq)return[void 0,...Lq(q.unwrap())];else if(q instanceof lq)return[null,...Lq(q.unwrap())];else if(q instanceof $7)return Lq(q.unwrap());else if(q instanceof HK)return Lq(q.unwrap());else if(q instanceof vK)return Lq(q._def.innerType);else return[]},f7,$K,Cq,sK,QK,u_,_K,OK,wK,q_,zK,h_,e6,zq,lq,WK,vK,q3,Ov,$7,_3,HK,wv,v8,zv=(q,_={message:`Input not instance of ${q.name}`})=>l1((j)=>j instanceof q,_),x1,n1,Wv,vv,c1,Hv,Jv,Tv,Zv,kv,Xv,Av,Gv,uv,hv,Cv,Dv,Vv,Mv,Nv,bv,Sv,Ev,Rv,Iv,mv,gv,yv,dv,C1,Lv,pv,lv,xv,nv=()=>x1().optional(),cv=()=>n1().optional(),rv=()=>c1().optional(),iv,ov,O7="2.0",r1,i1,av,U6,m6,K3,Dq,s6,w7,Bv,tv,Fv,D1,ev,dM,o1,a1,j3,B1,Uv,sv,Qv,qH,_H,t1,KH,F1,z7,W7,e1,U1,e4,s1,Q1,jH,PH,YH,fH,$H,OH,wH,zH,WH,vH,HH,JH,TH,ZH,kH,XH,U4,s4,Q4,AH,GH,qj,uH,hH,CH,DH,VH,MH,NH,_j,LM,bH,SH,Kj,EH,RH,IH,mH,gH,yH,dH,LH,pH,lH,xH,nH,cH,rH,iH,oH,aH,BH,tH,FH,eH,UH,pM,lM,xM,nM,cM,rM,iM,oM,aM,o4,a4;var v7=R8(()=>{cz=Object.create,rz=Object.getPrototypeOf,x4=Object.defineProperty,iz=Object.getOwnPropertyNames,oz=Object.prototype.hasOwnProperty,tz=T8((q,_)=>{(function(j,K){typeof q==="object"&&typeof _!=="undefined"?K(q):typeof define==="function"&&define.amd?define(["exports"],K):K(j.URI=j.URI||{})})(q,function(j){function K(){for(var I=arguments.length,h=Array(I),g=0;g<I;g++)h[g]=arguments[g];if(h.length>1){h[0]=h[0].slice(0,-1);var l=h.length-1;for(var n=1;n<l;++n)h[n]=h[n].slice(1,-1);return h[l]=h[l].slice(1),h.join("")}else return h[0]}function Y(I){return"(?:"+I+")"}function f(I){return I===void 0?"undefined":I===null?"null":Object.prototype.toString.call(I).split(" ").pop().split("]").shift().toLowerCase()}function P(I){return I.toUpperCase()}function $(I){return I!==void 0&&I!==null?I instanceof Array?I:typeof I.length!=="number"||I.split||I.setInterval||I.call?[I]:Array.prototype.slice.call(I):[]}function w(I,h){var g=I;if(h)for(var l in h)g[l]=h[l];return g}function O(I){var h="[A-Za-z]",g="[\\x0D]",l="[0-9]",n="[\\x22]",s=K(l,"[A-Fa-f]"),X8="[\\x0A]",D8="[\\x20]",S8=Y(Y("%[EFef]"+s+"%"+s+s+"%"+s+s)+"|"+Y("%[89A-Fa-f]"+s+"%"+s+s)+"|"+Y("%"+s+s)),K6="[\\:\\/\\?\\#\\[\\]\\@]",u8="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",o8=K(K6,u8),j6=I?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",l8=I?"[\\uE000-\\uF8FF]":"[]",N8=K(h,l,"[\\-\\.\\_\\~]",j6),a8=Y(h+K(h,l,"[\\+\\-\\.]")+"*"),E8=Y(Y(S8+"|"+K(N8,u8,"[\\:]"))+"*"),T_=Y(Y("25[0-5]")+"|"+Y("2[0-4]"+l)+"|"+Y("1"+l+l)+"|"+Y("[1-9]"+l)+"|"+l),L6=Y(Y("25[0-5]")+"|"+Y("2[0-4]"+l)+"|"+Y("1"+l+l)+"|"+Y("0?[1-9]"+l)+"|0?0?"+l),B6=Y(L6+"\\."+L6+"\\."+L6+"\\."+L6),m8=Y(s+"{1,4}"),p6=Y(Y(m8+"\\:"+m8)+"|"+B6),t6=Y(Y(m8+"\\:")+"{6}"+p6),uq=Y("\\:\\:"+Y(m8+"\\:")+"{5}"+p6),Z_=Y(Y(m8)+"?\\:\\:"+Y(m8+"\\:")+"{4}"+p6),mq=Y(Y(Y(m8+"\\:")+"{0,1}"+m8)+"?\\:\\:"+Y(m8+"\\:")+"{3}"+p6),nK=Y(Y(Y(m8+"\\:")+"{0,2}"+m8)+"?\\:\\:"+Y(m8+"\\:")+"{2}"+p6),s3=Y(Y(Y(m8+"\\:")+"{0,3}"+m8)+"?\\:\\:"+m8+"\\:"+p6),Q3=Y(Y(Y(m8+"\\:")+"{0,4}"+m8)+"?\\:\\:"+p6),r_=Y(Y(Y(m8+"\\:")+"{0,5}"+m8)+"?\\:\\:"+m8),i_=Y(Y(Y(m8+"\\:")+"{0,6}"+m8)+"?\\:\\:"),gq=Y([t6,uq,Z_,mq,nK,s3,Q3,r_,i_].join("|")),o_=Y(Y(N8+"|"+S8)+"+"),D4=Y(gq+"\\%25"+o_),k_=Y(gq+Y("\\%25|\\%(?!"+s+"{2})")+o_),Sw=Y("[vV]"+s+"+\\."+K(N8,u8,"[\\:]")+"+"),Ew=Y("\\["+Y(k_+"|"+gq+"|"+Sw)+"\\]"),d5=Y(Y(S8+"|"+K(N8,u8))+"*"),cK=Y(Ew+"|"+B6+"(?!"+d5+")|"+d5),rK=Y(l+"*"),L5=Y(Y(E8+"@")+"?"+cK+Y("\\:"+rK)+"?"),iK=Y(S8+"|"+K(N8,u8,"[\\:\\@]")),Rw=Y(iK+"*"),p5=Y(iK+"+"),Iw=Y(Y(S8+"|"+K(N8,u8,"[\\@]"))+"+"),yq=Y(Y("\\/"+Rw)+"*"),a_=Y("\\/"+Y(p5+yq)+"?"),V4=Y(Iw+yq),q7=Y(p5+yq),B_="(?!"+iK+")",FV=Y(yq+"|"+a_+"|"+V4+"|"+q7+"|"+B_),t_=Y(Y(iK+"|"+K("[\\/\\?]",l8))+"*"),oK=Y(Y(iK+"|[\\/\\?]")+"*"),l5=Y(Y("\\/\\/"+L5+yq)+"|"+a_+"|"+q7+"|"+B_),mw=Y(a8+"\\:"+l5+Y("\\?"+t_)+"?"+Y("\\#"+oK)+"?"),gw=Y(Y("\\/\\/"+L5+yq)+"|"+a_+"|"+V4+"|"+B_),yw=Y(gw+Y("\\?"+t_)+"?"+Y("\\#"+oK)+"?"),eV=Y(mw+"|"+yw),UV=Y(a8+"\\:"+l5+Y("\\?"+t_)+"?"),sV="^("+a8+")\\:"+Y(Y("\\/\\/("+Y("("+E8+")@")+"?("+cK+")"+Y("\\:("+rK+")")+"?)")+"?("+yq+"|"+a_+"|"+q7+"|"+B_+")")+Y("\\?("+t_+")")+"?"+Y("\\#("+oK+")")+"?$",QV="^(){0}"+Y(Y("\\/\\/("+Y("("+E8+")@")+"?("+cK+")"+Y("\\:("+rK+")")+"?)")+"?("+yq+"|"+a_+"|"+V4+"|"+B_+")")+Y("\\?("+t_+")")+"?"+Y("\\#("+oK+")")+"?$",qM="^("+a8+")\\:"+Y(Y("\\/\\/("+Y("("+E8+")@")+"?("+cK+")"+Y("\\:("+rK+")")+"?)")+"?("+yq+"|"+a_+"|"+q7+"|"+B_+")")+Y("\\?("+t_+")")+"?$",_M="^"+Y("\\#("+oK+")")+"?$",KM="^"+Y("("+E8+")@")+"?("+cK+")"+Y("\\:("+rK+")")+"?$";return{NOT_SCHEME:new RegExp(K("[^]",h,l,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(K("[^\\%\\:]",N8,u8),"g"),NOT_HOST:new RegExp(K("[^\\%\\[\\]\\:]",N8,u8),"g"),NOT_PATH:new RegExp(K("[^\\%\\/\\:\\@]",N8,u8),"g"),NOT_PATH_NOSCHEME:new RegExp(K("[^\\%\\/\\@]",N8,u8),"g"),NOT_QUERY:new RegExp(K("[^\\%]",N8,u8,"[\\:\\@\\/\\?]",l8),"g"),NOT_FRAGMENT:new RegExp(K("[^\\%]",N8,u8,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(K("[^]",N8,u8),"g"),UNRESERVED:new RegExp(N8,"g"),OTHER_CHARS:new RegExp(K("[^\\%]",N8,o8),"g"),PCT_ENCODED:new RegExp(S8,"g"),IPV4ADDRESS:new RegExp("^("+B6+")$"),IPV6ADDRESS:new RegExp("^\\[?("+gq+")"+Y(Y("\\%25|\\%(?!"+s+"{2})")+"("+o_+")")+"?\\]?$")}}var z=O(!1),W=O(!0),v=function(){function I(h,g){var l=[],n=!0,s=!1,X8=void 0;try{for(var D8=h[Symbol.iterator](),S8;!(n=(S8=D8.next()).done);n=!0)if(l.push(S8.value),g&&l.length===g)break}catch(K6){s=!0,X8=K6}finally{try{if(!n&&D8.return)D8.return()}finally{if(s)throw X8}}return l}return function(h,g){if(Array.isArray(h))return h;else if(Symbol.iterator in Object(h))return I(h,g);else throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),H=function(I){if(Array.isArray(I)){for(var h=0,g=Array(I.length);h<I.length;h++)g[h]=I[h];return g}else return Array.from(I)},T=2147483647,J=36,k=1,A=26,G=38,u=700,V=72,m=128,N="-",R=/^xn--/,p=/[^\0-\x7E]/,b=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=J-k,M=Math.floor,S=String.fromCharCode;function L(I){throw new RangeError(d[I])}function c(I,h){var g=[],l=I.length;while(l--)g[l]=h(I[l]);return g}function B(I,h){var g=I.split("@"),l="";if(g.length>1)l=g[0]+"@",I=g[1];I=I.replace(b,".");var n=I.split("."),s=c(n,h).join(".");return l+s}function e(I){var h=[],g=0,l=I.length;while(g<l){var n=I.charCodeAt(g++);if(n>=55296&&n<=56319&&g<l){var s=I.charCodeAt(g++);if((s&64512)==56320)h.push(((n&1023)<<10)+(s&1023)+65536);else h.push(n),g--}else h.push(n)}return h}var f8=function I(h){return String.fromCodePoint.apply(String,H(h))},K8=function I(h){if(h-48<10)return h-22;if(h-65<26)return h-65;if(h-97<26)return h-97;return J},z8=function I(h,g){return h+22+75*(h<26)-((g!=0)<<5)},O8=function I(h,g,l){var n=0;h=l?M(h/u):h>>1,h+=M(h/g);for(;h>y*A>>1;n+=J)h=M(h/y);return M(n+(y+1)*h/(h+G))},j8=function I(h){var g=[],l=h.length,n=0,s=m,X8=V,D8=h.lastIndexOf(N);if(D8<0)D8=0;for(var S8=0;S8<D8;++S8){if(h.charCodeAt(S8)>=128)L("not-basic");g.push(h.charCodeAt(S8))}for(var K6=D8>0?D8+1:0;K6<l;){var u8=n;for(var o8=1,j6=J;;j6+=J){if(K6>=l)L("invalid-input");var l8=K8(h.charCodeAt(K6++));if(l8>=J||l8>M((T-n)/o8))L("overflow");n+=l8*o8;var N8=j6<=X8?k:j6>=X8+A?A:j6-X8;if(l8<N8)break;var a8=J-N8;if(o8>M(T/a8))L("overflow");o8*=a8}var E8=g.length+1;if(X8=O8(n-u8,E8,u8==0),M(n/E8)>T-s)L("overflow");s+=M(n/E8),n%=E8,g.splice(n++,0,s)}return String.fromCodePoint.apply(String,g)},G8=function I(h){var g=[];h=e(h);var l=h.length,n=m,s=0,X8=V,D8=!0,S8=!1,K6=void 0;try{for(var u8=h[Symbol.iterator](),o8;!(D8=(o8=u8.next()).done);D8=!0){var j6=o8.value;if(j6<128)g.push(S(j6))}}catch(k_){S8=!0,K6=k_}finally{try{if(!D8&&u8.return)u8.return()}finally{if(S8)throw K6}}var l8=g.length,N8=l8;if(l8)g.push(N);while(N8<l){var a8=T,E8=!0,T_=!1,L6=void 0;try{for(var B6=h[Symbol.iterator](),m8;!(E8=(m8=B6.next()).done);E8=!0){var p6=m8.value;if(p6>=n&&p6<a8)a8=p6}}catch(k_){T_=!0,L6=k_}finally{try{if(!E8&&B6.return)B6.return()}finally{if(T_)throw L6}}var t6=N8+1;if(a8-n>M((T-s)/t6))L("overflow");s+=(a8-n)*t6,n=a8;var uq=!0,Z_=!1,mq=void 0;try{for(var nK=h[Symbol.iterator](),s3;!(uq=(s3=nK.next()).done);uq=!0){var Q3=s3.value;if(Q3<n&&++s>T)L("overflow");if(Q3==n){var r_=s;for(var i_=J;;i_+=J){var gq=i_<=X8?k:i_>=X8+A?A:i_-X8;if(r_<gq)break;var o_=r_-gq,D4=J-gq;g.push(S(z8(gq+o_%D4,0))),r_=M(o_/D4)}g.push(S(z8(r_,0))),X8=O8(s,t6,N8==l8),s=0,++N8}}}catch(k_){Z_=!0,mq=k_}finally{try{if(!uq&&nK.return)nK.return()}finally{if(Z_)throw mq}}++s,++n}return g.join("")},t8=function I(h){return B(h,function(g){return R.test(g)?j8(g.slice(4).toLowerCase()):g})},s8=function I(h){return B(h,function(g){return p.test(g)?"xn--"+G8(g):g})},C={version:"2.1.0",ucs2:{decode:e,encode:f8},decode:j8,encode:G8,toASCII:s8,toUnicode:t8},D={};function Z(I){var h=I.charCodeAt(0),g=void 0;if(h<16)g="%0"+h.toString(16).toUpperCase();else if(h<128)g="%"+h.toString(16).toUpperCase();else if(h<2048)g="%"+(h>>6|192).toString(16).toUpperCase()+"%"+(h&63|128).toString(16).toUpperCase();else g="%"+(h>>12|224).toString(16).toUpperCase()+"%"+(h>>6&63|128).toString(16).toUpperCase()+"%"+(h&63|128).toString(16).toUpperCase();return g}function E(I){var h="",g=0,l=I.length;while(g<l){var n=parseInt(I.substr(g+1,2),16);if(n<128)h+=String.fromCharCode(n),g+=3;else if(n>=194&&n<224){if(l-g>=6){var s=parseInt(I.substr(g+4,2),16);h+=String.fromCharCode((n&31)<<6|s&63)}else h+=I.substr(g,6);g+=6}else if(n>=224){if(l-g>=9){var X8=parseInt(I.substr(g+4,2),16),D8=parseInt(I.substr(g+7,2),16);h+=String.fromCharCode((n&15)<<12|(X8&63)<<6|D8&63)}else h+=I.substr(g,9);g+=9}else h+=I.substr(g,3),g+=3}return h}function x(I,h){function g(l){var n=E(l);return!n.match(h.UNRESERVED)?l:n}if(I.scheme)I.scheme=String(I.scheme).replace(h.PCT_ENCODED,g).toLowerCase().replace(h.NOT_SCHEME,"");if(I.userinfo!==void 0)I.userinfo=String(I.userinfo).replace(h.PCT_ENCODED,g).replace(h.NOT_USERINFO,Z).replace(h.PCT_ENCODED,P);if(I.host!==void 0)I.host=String(I.host).replace(h.PCT_ENCODED,g).toLowerCase().replace(h.NOT_HOST,Z).replace(h.PCT_ENCODED,P);if(I.path!==void 0)I.path=String(I.path).replace(h.PCT_ENCODED,g).replace(I.scheme?h.NOT_PATH:h.NOT_PATH_NOSCHEME,Z).replace(h.PCT_ENCODED,P);if(I.query!==void 0)I.query=String(I.query).replace(h.PCT_ENCODED,g).replace(h.NOT_QUERY,Z).replace(h.PCT_ENCODED,P);if(I.fragment!==void 0)I.fragment=String(I.fragment).replace(h.PCT_ENCODED,g).replace(h.NOT_FRAGMENT,Z).replace(h.PCT_ENCODED,P);return I}function i(I){return I.replace(/^0*(.*)/,"$1")||"0"}function r(I,h){var g=I.match(h.IPV4ADDRESS)||[],l=v(g,2),n=l[1];if(n)return n.split(".").map(i).join(".");else return I}function a(I,h){var g=I.match(h.IPV6ADDRESS)||[],l=v(g,3),n=l[1],s=l[2];if(n){var X8=n.toLowerCase().split("::").reverse(),D8=v(X8,2),S8=D8[0],K6=D8[1],u8=K6?K6.split(":").map(i):[],o8=S8.split(":").map(i),j6=h.IPV4ADDRESS.test(o8[o8.length-1]),l8=j6?7:8,N8=o8.length-l8,a8=Array(l8);for(var E8=0;E8<l8;++E8)a8[E8]=u8[E8]||o8[N8+E8]||"";if(j6)a8[l8-1]=r(a8[l8-1],h);var T_=a8.reduce(function(t6,uq,Z_){if(!uq||uq==="0"){var mq=t6[t6.length-1];if(mq&&mq.index+mq.length===Z_)mq.length++;else t6.push({index:Z_,length:1})}return t6},[]),L6=T_.sort(function(t6,uq){return uq.length-t6.length})[0],B6=void 0;if(L6&&L6.length>1){var m8=a8.slice(0,L6.index),p6=a8.slice(L6.index+L6.length);B6=m8.join(":")+"::"+p6.join(":")}else B6=a8.join(":");if(s)B6+="%"+s;return B6}else return I}var Y8=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,H8="".match(/(){0}/)[1]===void 0;function w8(I){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g={},l=h.iri!==!1?W:z;if(h.reference==="suffix")I=(h.scheme?h.scheme+":":"")+"//"+I;var n=I.match(Y8);if(n){if(H8){if(g.scheme=n[1],g.userinfo=n[3],g.host=n[4],g.port=parseInt(n[5],10),g.path=n[6]||"",g.query=n[7],g.fragment=n[8],isNaN(g.port))g.port=n[5]}else if(g.scheme=n[1]||void 0,g.userinfo=I.indexOf("@")!==-1?n[3]:void 0,g.host=I.indexOf("//")!==-1?n[4]:void 0,g.port=parseInt(n[5],10),g.path=n[6]||"",g.query=I.indexOf("?")!==-1?n[7]:void 0,g.fragment=I.indexOf("#")!==-1?n[8]:void 0,isNaN(g.port))g.port=I.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?n[4]:void 0;if(g.host)g.host=a(r(g.host,l),l);if(g.scheme===void 0&&g.userinfo===void 0&&g.host===void 0&&g.port===void 0&&!g.path&&g.query===void 0)g.reference="same-document";else if(g.scheme===void 0)g.reference="relative";else if(g.fragment===void 0)g.reference="absolute";else g.reference="uri";if(h.reference&&h.reference!=="suffix"&&h.reference!==g.reference)g.error=g.error||"URI is not a "+h.reference+" reference.";var s=D[(h.scheme||g.scheme||"").toLowerCase()];if(!h.unicodeSupport&&(!s||!s.unicodeSupport)){if(g.host&&(h.domainHost||s&&s.domainHost))try{g.host=C.toASCII(g.host.replace(l.PCT_ENCODED,E).toLowerCase())}catch(X8){g.error=g.error||"Host's domain name can not be converted to ASCII via punycode: "+X8}x(g,z)}else x(g,l);if(s&&s.parse)s.parse(g,h)}else g.error=g.error||"URI can not be parsed.";return g}function A8(I,h){var g=h.iri!==!1?W:z,l=[];if(I.userinfo!==void 0)l.push(I.userinfo),l.push("@");if(I.host!==void 0)l.push(a(r(String(I.host),g),g).replace(g.IPV6ADDRESS,function(n,s,X8){return"["+s+(X8?"%25"+X8:"")+"]"}));if(typeof I.port==="number"||typeof I.port==="string")l.push(":"),l.push(String(I.port));return l.length?l.join(""):void 0}var L8=/^\.\.?\//,M8=/^\/\.(\/|$)/,H6=/^\/\.\.(\/|$)/,F8=/^\/?(?:.|\n)*?(?=\/|$)/;function V6(I){var h=[];while(I.length)if(I.match(L8))I=I.replace(L8,"");else if(I.match(M8))I=I.replace(M8,"/");else if(I.match(H6))I=I.replace(H6,"/"),h.pop();else if(I==="."||I==="..")I="";else{var g=I.match(F8);if(g){var l=g[0];I=I.slice(l.length),h.push(l)}else throw new Error("Unexpected dot segment condition")}return h.join("")}function p8(I){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=h.iri?W:z,l=[],n=D[(h.scheme||I.scheme||"").toLowerCase()];if(n&&n.serialize)n.serialize(I,h);if(I.host){if(g.IPV6ADDRESS.test(I.host));else if(h.domainHost||n&&n.domainHost)try{I.host=!h.iri?C.toASCII(I.host.replace(g.PCT_ENCODED,E).toLowerCase()):C.toUnicode(I.host)}catch(D8){I.error=I.error||"Host's domain name can not be converted to "+(!h.iri?"ASCII":"Unicode")+" via punycode: "+D8}}if(x(I,g),h.reference!=="suffix"&&I.scheme)l.push(I.scheme),l.push(":");var s=A8(I,h);if(s!==void 0){if(h.reference!=="suffix")l.push("//");if(l.push(s),I.path&&I.path.charAt(0)!=="/")l.push("/")}if(I.path!==void 0){var X8=I.path;if(!h.absolutePath&&(!n||!n.absolutePath))X8=V6(X8);if(s===void 0)X8=X8.replace(/^\/\//,"/%2F");l.push(X8)}if(I.query!==void 0)l.push("?"),l.push(I.query);if(I.fragment!==void 0)l.push("#"),l.push(I.fragment);return l.join("")}function $6(I,h){var g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},l=arguments[3],n={};if(!l)I=w8(p8(I,g),g),h=w8(p8(h,g),g);if(g=g||{},!g.tolerant&&h.scheme)n.scheme=h.scheme,n.userinfo=h.userinfo,n.host=h.host,n.port=h.port,n.path=V6(h.path||""),n.query=h.query;else{if(h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)n.userinfo=h.userinfo,n.host=h.host,n.port=h.port,n.path=V6(h.path||""),n.query=h.query;else{if(!h.path)if(n.path=I.path,h.query!==void 0)n.query=h.query;else n.query=I.query;else{if(h.path.charAt(0)==="/")n.path=V6(h.path);else{if((I.userinfo!==void 0||I.host!==void 0||I.port!==void 0)&&!I.path)n.path="/"+h.path;else if(!I.path)n.path=h.path;else n.path=I.path.slice(0,I.path.lastIndexOf("/")+1)+h.path;n.path=V6(n.path)}n.query=h.query}n.userinfo=I.userinfo,n.host=I.host,n.port=I.port}n.scheme=I.scheme}return n.fragment=h.fragment,n}function a6(I,h,g){var l=w({scheme:"null"},g);return p8($6(w8(I,l),w8(h,l),l,!0),l)}function d6(I,h){if(typeof I==="string")I=p8(w8(I,h),h);else if(f(I)==="object")I=w8(p8(I,h),h);return I}function U3(I,h,g){if(typeof I==="string")I=p8(w8(I,g),g);else if(f(I)==="object")I=p8(I,g);if(typeof h==="string")h=p8(w8(h,g),g);else if(f(h)==="object")h=p8(h,g);return I===h}function h4(I,h){return I&&I.toString().replace(!h||!h.iri?z.ESCAPE:W.ESCAPE,Z)}function fq(I,h){return I&&I.toString().replace(!h||!h.iri?z.PCT_ENCODED:W.PCT_ENCODED,E)}var lK={scheme:"http",domainHost:!0,parse:function I(h,g){if(!h.host)h.error=h.error||"HTTP URIs must have a host.";return h},serialize:function I(h,g){var l=String(h.scheme).toLowerCase()==="https";if(h.port===(l?443:80)||h.port==="")h.port=void 0;if(!h.path)h.path="/";return h}},b5={scheme:"https",domainHost:lK.domainHost,parse:lK.parse,serialize:lK.serialize};function S5(I){return typeof I.secure==="boolean"?I.secure:String(I.scheme).toLowerCase()==="wss"}var xK={scheme:"ws",domainHost:!0,parse:function I(h,g){var l=h;return l.secure=S5(l),l.resourceName=(l.path||"/")+(l.query?"?"+l.query:""),l.path=void 0,l.query=void 0,l},serialize:function I(h,g){if(h.port===(S5(h)?443:80)||h.port==="")h.port=void 0;if(typeof h.secure==="boolean")h.scheme=h.secure?"wss":"ws",h.secure=void 0;if(h.resourceName){var l=h.resourceName.split("?"),n=v(l,2),s=n[0],X8=n[1];h.path=s&&s!=="/"?s:void 0,h.query=X8,h.resourceName=void 0}return h.fragment=void 0,h}},E5={scheme:"wss",domainHost:xK.domainHost,parse:xK.parse,serialize:xK.serialize},kw={},Xw=!0,R5="[A-Za-z0-9\\-\\.\\_\\~"+(Xw?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Gq="[0-9A-Fa-f]",Aw=Y(Y("%[EFef]"+Gq+"%"+Gq+Gq+"%"+Gq+Gq)+"|"+Y("%[89A-Fa-f]"+Gq+"%"+Gq+Gq)+"|"+Y("%"+Gq+Gq)),Gw="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",uw="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",hw=K(uw,"[\\\"\\\\]"),Cw="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Dw=new RegExp(R5,"g"),c_=new RegExp(Aw,"g"),Vw=new RegExp(K("[^]",Gw,"[\\.]","[\\\"]",hw),"g"),I5=new RegExp(K("[^]",R5,Cw),"g"),Mw=I5;function C4(I){var h=E(I);return!h.match(Dw)?I:h}var m5={scheme:"mailto",parse:function I(h,g){var l=h,n=l.to=l.path?l.path.split(","):[];if(l.path=void 0,l.query){var s=!1,X8={},D8=l.query.split("&");for(var S8=0,K6=D8.length;S8<K6;++S8){var u8=D8[S8].split("=");switch(u8[0]){case"to":var o8=u8[1].split(",");for(var j6=0,l8=o8.length;j6<l8;++j6)n.push(o8[j6]);break;case"subject":l.subject=fq(u8[1],g);break;case"body":l.body=fq(u8[1],g);break;default:s=!0,X8[fq(u8[0],g)]=fq(u8[1],g);break}}if(s)l.headers=X8}l.query=void 0;for(var N8=0,a8=n.length;N8<a8;++N8){var E8=n[N8].split("@");if(E8[0]=fq(E8[0]),!g.unicodeSupport)try{E8[1]=C.toASCII(fq(E8[1],g).toLowerCase())}catch(T_){l.error=l.error||"Email address's domain name can not be converted to ASCII via punycode: "+T_}else E8[1]=fq(E8[1],g).toLowerCase();n[N8]=E8.join("@")}return l},serialize:function I(h,g){var l=h,n=$(h.to);if(n){for(var s=0,X8=n.length;s<X8;++s){var D8=String(n[s]),S8=D8.lastIndexOf("@"),K6=D8.slice(0,S8).replace(c_,C4).replace(c_,P).replace(Vw,Z),u8=D8.slice(S8+1);try{u8=!g.iri?C.toASCII(fq(u8,g).toLowerCase()):C.toUnicode(u8)}catch(N8){l.error=l.error||"Email address's domain name can not be converted to "+(!g.iri?"ASCII":"Unicode")+" via punycode: "+N8}n[s]=K6+"@"+u8}l.path=n.join(",")}var o8=h.headers=h.headers||{};if(h.subject)o8.subject=h.subject;if(h.body)o8.body=h.body;var j6=[];for(var l8 in o8)if(o8[l8]!==kw[l8])j6.push(l8.replace(c_,C4).replace(c_,P).replace(I5,Z)+"="+o8[l8].replace(c_,C4).replace(c_,P).replace(Mw,Z));if(j6.length)l.query=j6.join("&");return l}},Nw=/^([^\:]+)\:(.*)/,g5={scheme:"urn",parse:function I(h,g){var l=h.path&&h.path.match(Nw),n=h;if(l){var s=g.scheme||n.scheme||"urn",X8=l[1].toLowerCase(),D8=l[2],S8=s+":"+(g.nid||X8),K6=D[S8];if(n.nid=X8,n.nss=D8,n.path=void 0,K6)n=K6.parse(n,g)}else n.error=n.error||"URN can not be parsed.";return n},serialize:function I(h,g){var l=g.scheme||h.scheme||"urn",n=h.nid,s=l+":"+(g.nid||n),X8=D[s];if(X8)h=X8.serialize(h,g);var D8=h,S8=h.nss;return D8.path=(n||g.nid)+":"+S8,D8}},bw=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,y5={scheme:"urn:uuid",parse:function I(h,g){var l=h;if(l.uuid=l.nss,l.nss=void 0,!g.tolerant&&(!l.uuid||!l.uuid.match(bw)))l.error=l.error||"UUID is not valid.";return l},serialize:function I(h,g){var l=h;return l.nss=(h.uuid||"").toLowerCase(),l}};D[lK.scheme]=lK,D[b5.scheme]=b5,D[xK.scheme]=xK,D[E5.scheme]=E5,D[m5.scheme]=m5,D[g5.scheme]=g5,D[y5.scheme]=y5,j.SCHEMES=D,j.pctEncChar=Z,j.pctDecChars=E,j.parse=w8,j.removeDotSegments=V6,j.serialize=p8,j.resolveComponents=$6,j.resolve=a6,j.normalize=d6,j.equal=U3,j.escapeComponent=h4,j.unescapeComponent=fq,Object.defineProperty(j,"__esModule",{value:!0})})}),B4=T8((q,_)=>{_.exports=function j(K,Y){if(K===Y)return!0;if(K&&Y&&typeof K=="object"&&typeof Y=="object"){if(K.constructor!==Y.constructor)return!1;var f,P,$;if(Array.isArray(K)){if(f=K.length,f!=Y.length)return!1;for(P=f;P--!==0;)if(!j(K[P],Y[P]))return!1;return!0}if(K.constructor===RegExp)return K.source===Y.source&&K.flags===Y.flags;if(K.valueOf!==Object.prototype.valueOf)return K.valueOf()===Y.valueOf();if(K.toString!==Object.prototype.toString)return K.toString()===Y.toString();if($=Object.keys(K),f=$.length,f!==Object.keys(Y).length)return!1;for(P=f;P--!==0;)if(!Object.prototype.hasOwnProperty.call(Y,$[P]))return!1;for(P=f;P--!==0;){var w=$[P];if(!j(K[w],Y[w]))return!1}return!0}return K!==K&&Y!==Y}}),Fz=T8((q,_)=>{_.exports=function j(K){var Y=0,f=K.length,P=0,$;while(P<f)if(Y++,$=K.charCodeAt(P++),$>=55296&&$<=56319&&P<f){if($=K.charCodeAt(P),($&64512)==56320)P++}return Y}}),JK=T8((q,_)=>{_.exports={copy:j,checkDataType:K,checkDataTypes:Y,coerceToTypes:P,toHash:$,getProperty:z,escapeQuotes:W,equal:B4(),ucs2length:Fz(),varOccurences:v,varReplace:H,schemaHasRules:T,schemaHasRulesExcept:J,schemaUnknownRules:k,toQuotedString:A,getPathExpr:G,getPath:u,getData:N,unescapeFragment:p,unescapeJsonPointer:y,escapeFragment:b,escapeJsonPointer:d};function j(M,S){S=S||{};for(var L in M)S[L]=M[L];return S}function K(M,S,L,c){var B=c?" !== ":" === ",e=c?" || ":" && ",f8=c?"!":"",K8=c?"":"!";switch(M){case"null":return S+B+"null";case"array":return f8+"Array.isArray("+S+")";case"object":return"("+f8+S+e+"typeof "+S+B+'"object"'+e+K8+"Array.isArray("+S+"))";case"integer":return"(typeof "+S+B+'"number"'+e+K8+"("+S+" % 1)"+e+S+B+S+(L?e+f8+"isFinite("+S+")":"")+")";case"number":return"(typeof "+S+B+'"'+M+'"'+(L?e+f8+"isFinite("+S+")":"")+")";default:return"typeof "+S+B+'"'+M+'"'}}function Y(M,S,L){switch(M.length){case 1:return K(M[0],S,L,!0);default:var c="",B=$(M);if(B.array&&B.object)c=B.null?"(":"(!"+S+" || ",c+="typeof "+S+' !== "object")',delete B.null,delete B.array,delete B.object;if(B.number)delete B.integer;for(var e in B)c+=(c?" && ":"")+K(e,S,L,!0);return c}}var f=$(["string","number","integer","boolean","null"]);function P(M,S){if(Array.isArray(S)){var L=[];for(var c=0;c<S.length;c++){var B=S[c];if(f[B])L[L.length]=B;else if(M==="array"&&B==="array")L[L.length]=B}if(L.length)return L}else if(f[S])return[S];else if(M==="array"&&S==="array")return["array"]}function $(M){var S={};for(var L=0;L<M.length;L++)S[M[L]]=!0;return S}var w=/^[a-z$_][a-z$_0-9]*$/i,O=/'|\\/g;function z(M){return typeof M=="number"?"["+M+"]":w.test(M)?"."+M:"['"+W(M)+"']"}function W(M){return M.replace(O,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function v(M,S){S+="[^0-9]";var L=M.match(new RegExp(S,"g"));return L?L.length:0}function H(M,S,L){return S+="([^0-9])",L=L.replace(/\$/g,"$$$$"),M.replace(new RegExp(S,"g"),L+"$1")}function T(M,S){if(typeof M=="boolean")return!M;for(var L in M)if(S[L])return!0}function J(M,S,L){if(typeof M=="boolean")return!M&&L!="not";for(var c in M)if(c!=L&&S[c])return!0}function k(M,S){if(typeof M=="boolean")return;for(var L in M)if(!S[L])return L}function A(M){return"'"+W(M)+"'"}function G(M,S,L,c){var B=L?"'/' + "+S+(c?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):c?"'[' + "+S+" + ']'":"'[\\'' + "+S+" + '\\']'";return R(M,B)}function u(M,S,L){var c=L?A("/"+d(S)):A(z(S));return R(M,c)}var V=/^\/(?:[^~]|~0|~1)*$/,m=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function N(M,S,L){var c,B,e,f8;if(M==="")return"rootData";if(M[0]=="/"){if(!V.test(M))throw new Error("Invalid JSON-pointer: "+M);B=M,e="rootData"}else{if(f8=M.match(m),!f8)throw new Error("Invalid JSON-pointer: "+M);if(c=+f8[1],B=f8[2],B=="#"){if(c>=S)throw new Error("Cannot access property/index "+c+" levels up, current level is "+S);return L[S-c]}if(c>S)throw new Error("Cannot access data "+c+" levels up, current level is "+S);if(e="data"+(S-c||""),!B)return e}var K8=e,z8=B.split("/");for(var O8=0;O8<z8.length;O8++){var j8=z8[O8];if(j8)e+=z(y(j8)),K8+=" && "+e}return K8}function R(M,S){if(M=='""')return S;return(M+" + "+S).replace(/([^\\])' \+ '/g,"$1")}function p(M){return y(decodeURIComponent(M))}function b(M){return encodeURIComponent(d(M))}function d(M){return M.replace(/~/g,"~0").replace(/\//g,"~1")}function y(M){return M.replace(/~1/g,"/").replace(/~0/g,"~")}}),V1=T8((q,_)=>{var j=JK();_.exports=K;function K(Y){j.copy(Y,this)}}),ez=T8((q,_)=>{var j=_.exports=function(f,P,$){if(typeof P=="function")$=P,P={};$=P.cb||$;var w=typeof $=="function"?$:$.pre||function(){},O=$.post||function(){};K(P,w,O,f,"",f)};j.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},j.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},j.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},j.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function K(f,P,$,w,O,z,W,v,H,T){if(w&&typeof w=="object"&&!Array.isArray(w)){P(w,O,z,W,v,H,T);for(var J in w){var k=w[J];if(Array.isArray(k)){if(J in j.arrayKeywords)for(var A=0;A<k.length;A++)K(f,P,$,k[A],O+"/"+J+"/"+A,z,O,J,w,A)}else if(J in j.propsKeywords){if(k&&typeof k=="object")for(var G in k)K(f,P,$,k[G],O+"/"+J+"/"+Y(G),z,O,J,w,G)}else if(J in j.keywords||f.allKeys&&!(J in j.skipKeywords))K(f,P,$,k,O+"/"+J,z,O,J,w)}$(w,O,z,W,v,H,T)}}function Y(f){return f.replace(/~/g,"~0").replace(/\//g,"~1")}}),t4=T8((q,_)=>{var j=tz(),K=B4(),Y=JK(),f=V1(),P=ez();_.exports=$,$.normalizeId=u,$.fullPath=k,$.url=V,$.ids=m,$.inlineRef=H,$.schema=w;function $(N,R,p){var b=this._refs[p];if(typeof b=="string")if(this._refs[b])b=this._refs[b];else return $.call(this,N,R,b);if(b=b||this._schemas[p],b instanceof f)return H(b.schema,this._opts.inlineRefs)?b.schema:b.validate||this._compile(b);var d=w.call(this,R,p),y,M,S;if(d)y=d.schema,R=d.root,S=d.baseId;if(y instanceof f)M=y.validate||N.call(this,y.schema,R,void 0,S);else if(y!==void 0)M=H(y,this._opts.inlineRefs)?y:N.call(this,y,R,void 0,S);return M}function w(N,R){var p=j.parse(R),b=A(p),d=k(this._getId(N.schema));if(Object.keys(N.schema).length===0||b!==d){var y=u(b),M=this._refs[y];if(typeof M=="string")return O.call(this,N,M,p);else if(M instanceof f){if(!M.validate)this._compile(M);N=M}else if(M=this._schemas[y],M instanceof f){if(!M.validate)this._compile(M);if(y==u(R))return{schema:M,root:N,baseId:d};N=M}else return;if(!N.schema)return;d=k(this._getId(N.schema))}return W.call(this,p,d,N.schema,N)}function O(N,R,p){var b=w.call(this,N,R);if(b){var{schema:d,baseId:y}=b;N=b.root;var M=this._getId(d);if(M)y=V(y,M);return W.call(this,p,y,d,N)}}var z=Y.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function W(N,R,p,b){if(N.fragment=N.fragment||"",N.fragment.slice(0,1)!="/")return;var d=N.fragment.split("/");for(var y=1;y<d.length;y++){var M=d[y];if(M){if(M=Y.unescapeFragment(M),p=p[M],p===void 0)break;var S;if(!z[M]){if(S=this._getId(p),S)R=V(R,S);if(p.$ref){var L=V(R,p.$ref),c=w.call(this,b,L);if(c)p=c.schema,b=c.root,R=c.baseId}}}}if(p!==void 0&&p!==b.schema)return{schema:p,root:b,baseId:R}}var v=Y.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function H(N,R){if(R===!1)return!1;if(R===void 0||R===!0)return T(N);else if(R)return J(N)<=R}function T(N){var R;if(Array.isArray(N)){for(var p=0;p<N.length;p++)if(R=N[p],typeof R=="object"&&!T(R))return!1}else for(var b in N){if(b=="$ref")return!1;if(R=N[b],typeof R=="object"&&!T(R))return!1}return!0}function J(N){var R=0,p;if(Array.isArray(N))for(var b=0;b<N.length;b++){if(p=N[b],typeof p=="object")R+=J(p);if(R==1/0)return 1/0}else for(var d in N){if(d=="$ref")return 1/0;if(v[d])R++;else{if(p=N[d],typeof p=="object")R+=J(p)+1;if(R==1/0)return 1/0}}return R}function k(N,R){if(R!==!1)N=u(N);var p=j.parse(N);return A(p)}function A(N){return j.serialize(N).split("#")[0]+"#"}var G=/#\/?$/;function u(N){return N?N.replace(G,""):""}function V(N,R){return R=u(R),j.resolve(N,R)}function m(N){var R=u(this._getId(N)),p={"":R},b={"":k(R,!1)},d={},y=this;return P(N,{allKeys:!0},function(M,S,L,c,B,e,f8){if(S==="")return;var K8=y._getId(M),z8=p[c],O8=b[c]+"/"+B;if(f8!==void 0)O8+="/"+(typeof f8=="number"?f8:Y.escapeFragment(f8));if(typeof K8=="string"){K8=z8=u(z8?j.resolve(z8,K8):K8);var j8=y._refs[K8];if(typeof j8=="string")j8=y._refs[j8];if(j8&&j8.schema){if(!K(M,j8.schema))throw new Error('id "'+K8+'" resolves to more than one schema')}else if(K8!=u(O8))if(K8[0]=="#"){if(d[K8]&&!K(M,d[K8]))throw new Error('id "'+K8+'" resolves to more than one schema');d[K8]=M}else y._refs[K8]=O8}p[S]=z8,b[S]=O8}),d}}),F4=T8((q,_)=>{var j=t4();_.exports={Validation:f(K),MissingRef:f(Y)};function K(P){this.message="validation failed",this.errors=P,this.ajv=this.validation=!0}Y.message=function(P,$){return"can't resolve reference "+$+" from id "+P};function Y(P,$,w){this.message=w||Y.message(P,$),this.missingRef=j.url(P,$),this.missingSchema=j.normalizeId(j.fullPath(this.missingRef))}function f(P){return P.prototype=Object.create(Error.prototype),P.prototype.constructor=P,P}}),M1=T8((q,_)=>{_.exports=function(j,K){if(!K)K={};if(typeof K==="function")K={cmp:K};var Y=typeof K.cycles==="boolean"?K.cycles:!1,f=K.cmp&&function($){return function(w){return function(O,z){var W={key:O,value:w[O]},v={key:z,value:w[z]};return $(W,v)}}}(K.cmp),P=[];return function $(w){if(w&&w.toJSON&&typeof w.toJSON==="function")w=w.toJSON();if(w===void 0)return;if(typeof w=="number")return isFinite(w)?""+w:"null";if(typeof w!=="object")return JSON.stringify(w);var O,z;if(Array.isArray(w)){z="[";for(O=0;O<w.length;O++){if(O)z+=",";z+=$(w[O])||"null"}return z+"]"}if(w===null)return"null";if(P.indexOf(w)!==-1){if(Y)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var W=P.push(w)-1,v=Object.keys(w).sort(f&&f(w));z="";for(O=0;O<v.length;O++){var H=v[O],T=$(w[H]);if(!T)continue;if(z)z+=",";z+=JSON.stringify(H)+":"+T}return P.splice(W,1),"{"+z+"}"}(j)}}),N1=T8((q,_)=>{_.exports=function j(K,Y,f){var P="",$=K.schema.$async===!0,w=K.util.schemaHasRulesExcept(K.schema,K.RULES.all,"$ref"),O=K.self._getId(K.schema);if(K.opts.strictKeywords){var z=K.util.schemaUnknownRules(K.schema,K.RULES.keywords);if(z){var W="unknown keyword: "+z;if(K.opts.strictKeywords==="log")K.logger.warn(W);else throw new Error(W)}}if(K.isTop){if(P+=" var validate = ",$)K.async=!0,P+="async ";if(P+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",O&&(K.opts.sourceCode||K.opts.processCode))P+=" "+("/*# sourceURL="+O+" */")+" "}if(typeof K.schema=="boolean"||!(w||K.schema.$ref)){var Y="false schema",v=K.level,H=K.dataLevel,T=K.schema[Y],J=K.schemaPath+K.util.getProperty(Y),k=K.errSchemaPath+"/"+Y,R=!K.opts.allErrors,d,A="data"+(H||""),N="valid"+v;if(K.schema===!1){if(K.isTop)R=!0;else P+=" var "+N+" = false; ";var G=G||[];if(G.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(d||"false schema")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(k)+" , params: {} ",K.opts.messages!==!1)P+=" , message: 'boolean schema is false' ";if(K.opts.verbose)P+=" , schema: false , parentSchema: validate.schema"+K.schemaPath+" , data: "+A+" ";P+=" } "}else P+=" {} ";var u=P;if(P=G.pop(),!K.compositeRule&&R)if(K.async)P+=" throw new ValidationError(["+u+"]); ";else P+=" validate.errors = ["+u+"]; return false; ";else P+=" var err = "+u+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else if(K.isTop)if($)P+=" return data; ";else P+=" validate.errors = null; return true; ";else P+=" var "+N+" = true; ";if(K.isTop)P+=" }; return validate; ";return P}if(K.isTop){var V=K.isTop,v=K.level=0,H=K.dataLevel=0,A="data";if(K.rootId=K.resolve.fullPath(K.self._getId(K.root.schema)),K.baseId=K.baseId||K.rootId,delete K.isTop,K.dataPathArr=[""],K.schema.default!==void 0&&K.opts.useDefaults&&K.opts.strictDefaults){var m="default is ignored in the schema root";if(K.opts.strictDefaults==="log")K.logger.warn(m);else throw new Error(m)}P+=" var vErrors = null; ",P+=" var errors = 0; ",P+=" if (rootData === undefined) rootData = data; "}else{var{level:v,dataLevel:H}=K,A="data"+(H||"");if(O)K.baseId=K.resolve.url(K.baseId,O);if($&&!K.async)throw new Error("async schema in sync schema");P+=" var errs_"+v+" = errors;"}var N="valid"+v,R=!K.opts.allErrors,p="",b="",d,y=K.schema.type,M=Array.isArray(y);if(y&&K.opts.nullable&&K.schema.nullable===!0){if(M){if(y.indexOf("null")==-1)y=y.concat("null")}else if(y!="null")y=[y,"null"],M=!0}if(M&&y.length==1)y=y[0],M=!1;if(K.schema.$ref&&w){if(K.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+K.errSchemaPath+'" (see option extendRefs)');else if(K.opts.extendRefs!==!0)w=!1,K.logger.warn('$ref: keywords ignored in schema at path "'+K.errSchemaPath+'"')}if(K.schema.$comment&&K.opts.$comment)P+=" "+K.RULES.all.$comment.code(K,"$comment");if(y){if(K.opts.coerceTypes)var S=K.util.coerceToTypes(K.opts.coerceTypes,y);var L=K.RULES.types[y];if(S||M||L===!0||L&&!F8(L)){var J=K.schemaPath+".type",k=K.errSchemaPath+"/type",J=K.schemaPath+".type",k=K.errSchemaPath+"/type",c=M?"checkDataTypes":"checkDataType";if(P+=" if ("+K.util[c](y,A,K.opts.strictNumbers,!0)+") { ",S){var B="dataType"+v,e="coerced"+v;if(P+=" var "+B+" = typeof "+A+"; var "+e+" = undefined; ",K.opts.coerceTypes=="array")P+=" if ("+B+" == 'object' && Array.isArray("+A+") && "+A+".length == 1) { "+A+" = "+A+"[0]; "+B+" = typeof "+A+"; if ("+K.util.checkDataType(K.schema.type,A,K.opts.strictNumbers)+") "+e+" = "+A+"; } ";P+=" if ("+e+" !== undefined) ; ";var f8=S;if(f8){var K8,z8=-1,O8=f8.length-1;while(z8<O8)if(K8=f8[z8+=1],K8=="string")P+=" else if ("+B+" == 'number' || "+B+" == 'boolean') "+e+" = '' + "+A+"; else if ("+A+" === null) "+e+" = ''; ";else if(K8=="number"||K8=="integer"){if(P+=" else if ("+B+" == 'boolean' || "+A+" === null || ("+B+" == 'string' && "+A+" && "+A+" == +"+A+" ",K8=="integer")P+=" && !("+A+" % 1)";P+=")) "+e+" = +"+A+"; "}else if(K8=="boolean")P+=" else if ("+A+" === 'false' || "+A+" === 0 || "+A+" === null) "+e+" = false; else if ("+A+" === 'true' || "+A+" === 1) "+e+" = true; ";else if(K8=="null")P+=" else if ("+A+" === '' || "+A+" === 0 || "+A+" === false) "+e+" = null; ";else if(K.opts.coerceTypes=="array"&&K8=="array")P+=" else if ("+B+" == 'string' || "+B+" == 'number' || "+B+" == 'boolean' || "+A+" == null) "+e+" = ["+A+"]; "}P+=" else { ";var G=G||[];if(G.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(d||"type")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(k)+" , params: { type: '",M)P+=""+y.join(",");else P+=""+y;if(P+="' } ",K.opts.messages!==!1){if(P+=" , message: 'should be ",M)P+=""+y.join(",");else P+=""+y;P+="' "}if(K.opts.verbose)P+=" , schema: validate.schema"+J+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+A+" ";P+=" } "}else P+=" {} ";var u=P;if(P=G.pop(),!K.compositeRule&&R)if(K.async)P+=" throw new ValidationError(["+u+"]); ";else P+=" validate.errors = ["+u+"]; return false; ";else P+=" var err = "+u+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";P+=" } if ("+e+" !== undefined) { ";var j8=H?"data"+(H-1||""):"parentData",G8=H?K.dataPathArr[H]:"parentDataProperty";if(P+=" "+A+" = "+e+"; ",!H)P+="if ("+j8+" !== undefined)";P+=" "+j8+"["+G8+"] = "+e+"; } "}else{var G=G||[];if(G.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(d||"type")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(k)+" , params: { type: '",M)P+=""+y.join(",");else P+=""+y;if(P+="' } ",K.opts.messages!==!1){if(P+=" , message: 'should be ",M)P+=""+y.join(",");else P+=""+y;P+="' "}if(K.opts.verbose)P+=" , schema: validate.schema"+J+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+A+" ";P+=" } "}else P+=" {} ";var u=P;if(P=G.pop(),!K.compositeRule&&R)if(K.async)P+=" throw new ValidationError(["+u+"]); ";else P+=" validate.errors = ["+u+"]; return false; ";else P+=" var err = "+u+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}P+=" } "}}if(K.schema.$ref&&!w){if(P+=" "+K.RULES.all.$ref.code(K,"$ref")+" ",R){if(P+=" } if (errors === ",V)P+="0";else P+="errs_"+v;P+=") { ",b+="}"}}else{var t8=K.RULES;if(t8){var L,s8=-1,C=t8.length-1;while(s8<C)if(L=t8[s8+=1],F8(L)){if(L.type)P+=" if ("+K.util.checkDataType(L.type,A,K.opts.strictNumbers)+") { ";if(K.opts.useDefaults){if(L.type=="object"&&K.schema.properties){var T=K.schema.properties,D=Object.keys(T),Z=D;if(Z){var E,x=-1,i=Z.length-1;while(x<i){E=Z[x+=1];var r=T[E];if(r.default!==void 0){var a=A+K.util.getProperty(E);if(K.compositeRule){if(K.opts.strictDefaults){var m="default is ignored for: "+a;if(K.opts.strictDefaults==="log")K.logger.warn(m);else throw new Error(m)}}else{if(P+=" if ("+a+" === undefined ",K.opts.useDefaults=="empty")P+=" || "+a+" === null || "+a+" === '' ";if(P+=" ) "+a+" = ",K.opts.useDefaults=="shared")P+=" "+K.useDefault(r.default)+" ";else P+=" "+JSON.stringify(r.default)+" ";P+="; "}}}}}else if(L.type=="array"&&Array.isArray(K.schema.items)){var Y8=K.schema.items;if(Y8){var r,z8=-1,H8=Y8.length-1;while(z8<H8)if(r=Y8[z8+=1],r.default!==void 0){var a=A+"["+z8+"]";if(K.compositeRule){if(K.opts.strictDefaults){var m="default is ignored for: "+a;if(K.opts.strictDefaults==="log")K.logger.warn(m);else throw new Error(m)}}else{if(P+=" if ("+a+" === undefined ",K.opts.useDefaults=="empty")P+=" || "+a+" === null || "+a+" === '' ";if(P+=" ) "+a+" = ",K.opts.useDefaults=="shared")P+=" "+K.useDefault(r.default)+" ";else P+=" "+JSON.stringify(r.default)+" ";P+="; "}}}}}var w8=L.rules;if(w8){var A8,L8=-1,M8=w8.length-1;while(L8<M8)if(A8=w8[L8+=1],V6(A8)){var H6=A8.code(K,A8.keyword,L.type);if(H6){if(P+=" "+H6+" ",R)p+="}"}}}if(R)P+=" "+p+" ",p="";if(L.type){if(P+=" } ",y&&y===L.type&&!S){P+=" else { ";var J=K.schemaPath+".type",k=K.errSchemaPath+"/type",G=G||[];if(G.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(d||"type")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(k)+" , params: { type: '",M)P+=""+y.join(",");else P+=""+y;if(P+="' } ",K.opts.messages!==!1){if(P+=" , message: 'should be ",M)P+=""+y.join(",");else P+=""+y;P+="' "}if(K.opts.verbose)P+=" , schema: validate.schema"+J+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+A+" ";P+=" } "}else P+=" {} ";var u=P;if(P=G.pop(),!K.compositeRule&&R)if(K.async)P+=" throw new ValidationError(["+u+"]); ";else P+=" validate.errors = ["+u+"]; return false; ";else P+=" var err = "+u+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";P+=" } "}}if(R){if(P+=" if (errors === ",V)P+="0";else P+="errs_"+v;P+=") { ",b+="}"}}}}if(R)P+=" "+b+" ";if(V){if($)P+=" if (errors === 0) return data; ",P+=" else throw new ValidationError(vErrors); ";else P+=" validate.errors = vErrors; ",P+=" return errors === 0; ";P+=" }; return validate;"}else P+=" var "+N+" = errors === errs_"+v+";";function F8($6){var a6=$6.rules;for(var d6=0;d6<a6.length;d6++)if(V6(a6[d6]))return!0}function V6($6){return K.schema[$6.keyword]!==void 0||$6.implements&&p8($6)}function p8($6){var a6=$6.implements;for(var d6=0;d6<a6.length;d6++)if(K.schema[a6[d6]]!==void 0)return!0}return P}}),Uz=T8((q,_)=>{var j=t4(),K=JK(),Y=F4(),f=M1(),P=N1(),$=K.ucs2length,w=B4(),O=Y.Validation;_.exports=z;function z(u,V,m,N){var R=this,p=this._opts,b=[void 0],d={},y=[],M={},S=[],L={},c=[];V=V||{schema:u,refVal:b,refs:d};var B=W.call(this,u,V,N),e=this._compilations[B.index];if(B.compiling)return e.callValidate=j8;var f8=this._formats,K8=this.RULES;try{var z8=G8(u,V,m,N);e.validate=z8;var O8=e.callValidate;if(O8){if(O8.schema=z8.schema,O8.errors=null,O8.refs=z8.refs,O8.refVal=z8.refVal,O8.root=z8.root,O8.$async=z8.$async,p.sourceCode)O8.source=z8.source}return z8}finally{v.call(this,u,V,N)}function j8(){var r=e.validate,a=r.apply(this,arguments);return j8.errors=r.errors,a}function G8(r,a,Y8,H8){var w8=!a||a&&a.schema==r;if(a.schema!=V.schema)return z.call(R,r,a,Y8,H8);var A8=r.$async===!0,L8=P({isTop:!0,schema:r,isRoot:w8,baseId:H8,root:a,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Y.MissingRef,RULES:K8,validate:P,util:K,resolve:j,resolveRef:t8,usePattern:E,useDefault:x,useCustomRule:i,opts:p,formats:f8,logger:R.logger,self:R});if(L8=G(b,k)+G(y,T)+G(S,J)+G(c,A)+L8,p.processCode)L8=p.processCode(L8,r);var M8;try{var H6=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",L8);M8=H6(R,K8,f8,V,b,S,c,w,$,O),b[0]=M8}catch(F8){throw R.logger.error("Error compiling schema, function code:",L8),F8}if(M8.schema=r,M8.errors=null,M8.refs=d,M8.refVal=b,M8.root=w8?M8:a,A8)M8.$async=!0;if(p.sourceCode===!0)M8.source={code:L8,patterns:y,defaults:S};return M8}function t8(r,a,Y8){a=j.url(r,a);var H8=d[a],w8,A8;if(H8!==void 0)return w8=b[H8],A8="refVal["+H8+"]",Z(w8,A8);if(!Y8&&V.refs){var L8=V.refs[a];if(L8!==void 0)return w8=V.refVal[L8],A8=s8(a,w8),Z(w8,A8)}A8=s8(a);var M8=j.call(R,G8,V,a);if(M8===void 0){var H6=m&&m[a];if(H6)M8=j.inlineRef(H6,p.inlineRefs)?H6:z.call(R,H6,V,m,r)}if(M8===void 0)C(a);else return D(a,M8),Z(M8,A8)}function s8(r,a){var Y8=b.length;return b[Y8]=a,d[r]=Y8,"refVal"+Y8}function C(r){delete d[r]}function D(r,a){var Y8=d[r];b[Y8]=a}function Z(r,a){return typeof r=="object"||typeof r=="boolean"?{code:a,schema:r,inline:!0}:{code:a,$async:r&&!!r.$async}}function E(r){var a=M[r];if(a===void 0)a=M[r]=y.length,y[a]=r;return"pattern"+a}function x(r){switch(typeof r){case"boolean":case"number":return""+r;case"string":return K.toQuotedString(r);case"object":if(r===null)return"null";var a=f(r),Y8=L[a];if(Y8===void 0)Y8=L[a]=S.length,S[Y8]=r;return"default"+Y8}}function i(r,a,Y8,H8){if(R._opts.validateSchema!==!1){var w8=r.definition.dependencies;if(w8&&!w8.every(function(a6){return Object.prototype.hasOwnProperty.call(Y8,a6)}))throw new Error("parent schema must have all required keywords: "+w8.join(","));var A8=r.definition.validateSchema;if(A8){var L8=A8(a);if(!L8){var M8="keyword schema is invalid: "+R.errorsText(A8.errors);if(R._opts.validateSchema=="log")R.logger.error(M8);else throw new Error(M8)}}}var H6=r.definition.compile,F8=r.definition.inline,V6=r.definition.macro,p8;if(H6)p8=H6.call(R,a,Y8,H8);else if(V6){if(p8=V6.call(R,a,Y8,H8),p.validateSchema!==!1)R.validateSchema(p8,!0)}else if(F8)p8=F8.call(R,H8,r.keyword,a,Y8);else if(p8=r.definition.validate,!p8)return;if(p8===void 0)throw new Error('custom keyword "'+r.keyword+'"failed to compile');var $6=c.length;return c[$6]=p8,{code:"customRule"+$6,validate:p8}}}function W(u,V,m){var N=H.call(this,u,V,m);if(N>=0)return{index:N,compiling:!0};return N=this._compilations.length,this._compilations[N]={schema:u,root:V,baseId:m},{index:N,compiling:!1}}function v(u,V,m){var N=H.call(this,u,V,m);if(N>=0)this._compilations.splice(N,1)}function H(u,V,m){for(var N=0;N<this._compilations.length;N++){var R=this._compilations[N];if(R.schema==u&&R.root==V&&R.baseId==m)return N}return-1}function T(u,V){return"var pattern"+u+" = new RegExp("+K.toQuotedString(V[u])+");"}function J(u){return"var default"+u+" = defaults["+u+"];"}function k(u,V){return V[u]===void 0?"":"var refVal"+u+" = refVal["+u+"];"}function A(u){return"var customRule"+u+" = customRules["+u+"];"}function G(u,V){if(!u.length)return"";var m="";for(var N=0;N<u.length;N++)m+=V(N,u);return m}}),sz=T8((q,_)=>{var j=_.exports=function K(){this._cache={}};j.prototype.put=function K(Y,f){this._cache[Y]=f},j.prototype.get=function K(Y){return this._cache[Y]},j.prototype.del=function K(Y){delete this._cache[Y]},j.prototype.clear=function K(){this._cache={}}}),Qz=T8((q,_)=>{var j=JK(),K=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Y=[0,31,28,31,30,31,30,31,31,30,31,30,31],f=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,P=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,$=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,w=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,O=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,z=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,W=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,v=/^(?:\/(?:[^~/]|~0|~1)*)*$/,H=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,T=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;_.exports=J;function J(b){return b=b=="full"?"full":"fast",j.copy(J[b])}J.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":O,url:z,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:P,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:p,uuid:W,"json-pointer":v,"json-pointer-uri-fragment":H,"relative-json-pointer":T},J.full={date:A,time:G,"date-time":V,uri:N,"uri-reference":w,"uri-template":O,url:z,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:P,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:p,uuid:W,"json-pointer":v,"json-pointer-uri-fragment":H,"relative-json-pointer":T};function k(b){return b%4===0&&(b%100!==0||b%400===0)}function A(b){var d=b.match(K);if(!d)return!1;var y=+d[1],M=+d[2],S=+d[3];return M>=1&&M<=12&&S>=1&&S<=(M==2&&k(y)?29:Y[M])}function G(b,d){var y=b.match(f);if(!y)return!1;var M=y[1],S=y[2],L=y[3],c=y[5];return(M<=23&&S<=59&&L<=59||M==23&&S==59&&L==60)&&(!d||c)}var u=/t|\s/i;function V(b){var d=b.split(u);return d.length==2&&A(d[0])&&G(d[1],!0)}var m=/\/|:/;function N(b){return m.test(b)&&$.test(b)}var R=/[^\\]\\Z/;function p(b){if(R.test(b))return!1;try{return new RegExp(b),!0}catch(d){return!1}}}),qW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,v="data"+(w||""),H="valid"+$,T,J;if(O=="#"||O=="#/")if(K.isRoot)T=K.async,J="validate";else T=K.root.schema.$async===!0,J="root.refVal[0]";else{var k=K.resolveRef(K.baseId,O,K.isRoot);if(k===void 0){var A=K.MissingRefError.message(K.baseId,O);if(K.opts.missingRefs=="fail"){K.logger.error(A);var G=G||[];if(G.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { ref: '"+K.util.escapeQuotes(O)+"' } ",K.opts.messages!==!1)P+=" , message: 'can\\'t resolve reference "+K.util.escapeQuotes(O)+"' ";if(K.opts.verbose)P+=" , schema: "+K.util.toQuotedString(O)+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+v+" ";P+=" } "}else P+=" {} ";var u=P;if(P=G.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+u+"]); ";else P+=" validate.errors = ["+u+"]; return false; ";else P+=" var err = "+u+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(W)P+=" if (false) { "}else if(K.opts.missingRefs=="ignore"){if(K.logger.warn(A),W)P+=" if (true) { "}else throw new K.MissingRefError(K.baseId,O,A)}else if(k.inline){var V=K.util.copy(K);V.level++;var m="valid"+V.level;V.schema=k.schema,V.schemaPath="",V.errSchemaPath=O;var N=K.validate(V).replace(/validate\.schema/g,k.code);if(P+=" "+N+" ",W)P+=" if ("+m+") { "}else T=k.$async===!0||K.async&&k.$async!==!1,J=k.code}if(J){var G=G||[];if(G.push(P),P="",K.opts.passContext)P+=" "+J+".call(this, ";else P+=" "+J+"( ";if(P+=" "+v+", (dataPath || '')",K.errorPath!='""')P+=" + "+K.errorPath;var R=w?"data"+(w-1||""):"parentData",p=w?K.dataPathArr[w]:"parentDataProperty";P+=" , "+R+" , "+p+", rootData) ";var b=P;if(P=G.pop(),T){if(!K.async)throw new Error("async schema referenced by sync schema");if(W)P+=" var "+H+"; ";if(P+=" try { await "+b+"; ",W)P+=" "+H+" = true; ";if(P+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",W)P+=" "+H+" = false; ";if(P+=" } ",W)P+=" if ("+H+") { "}else if(P+=" if (!"+b+") { if (vErrors === null) vErrors = "+J+".errors; else vErrors = vErrors.concat("+J+".errors); errors = vErrors.length; } ",W)P+=" else { "}return P}}),_W=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.schema[Y],w=K.schemaPath+K.util.getProperty(Y),O=K.errSchemaPath+"/"+Y,z=!K.opts.allErrors,W=K.util.copy(K),v="";W.level++;var H="valid"+W.level,T=W.baseId,J=!0,k=$;if(k){var A,G=-1,u=k.length-1;while(G<u)if(A=k[G+=1],K.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:K.util.schemaHasRules(A,K.RULES.all)){if(J=!1,W.schema=A,W.schemaPath=w+"["+G+"]",W.errSchemaPath=O+"/"+G,P+=" "+K.validate(W)+" ",W.baseId=T,z)P+=" if ("+H+") { ",v+="}"}}if(z)if(J)P+=" if (true) { ";else P+=" "+v.slice(0,-1)+" ";return P}}),KW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||""),T="valid"+$,J="errs__"+$,k=K.util.copy(K),A="";k.level++;var G="valid"+k.level,u=O.every(function(d){return K.opts.strictKeywords?typeof d=="object"&&Object.keys(d).length>0||d===!1:K.util.schemaHasRules(d,K.RULES.all)});if(u){var V=k.baseId;P+=" var "+J+" = errors; var "+T+" = false; ";var m=K.compositeRule;K.compositeRule=k.compositeRule=!0;var N=O;if(N){var R,p=-1,b=N.length-1;while(p<b)R=N[p+=1],k.schema=R,k.schemaPath=z+"["+p+"]",k.errSchemaPath=W+"/"+p,P+=" "+K.validate(k)+" ",k.baseId=V,P+=" "+T+" = "+T+" || "+G+"; if (!"+T+") { ",A+="}"}if(K.compositeRule=k.compositeRule=m,P+=" "+A+" if (!"+T+") { var err = ",K.createErrors!==!1){if(P+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: {} ",K.opts.messages!==!1)P+=" , message: 'should match some schema in anyOf' ";if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";if(P+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(vErrors); ";else P+=" validate.errors = vErrors; return false; ";if(P+=" } else { errors = "+J+"; if (vErrors !== null) { if ("+J+") vErrors.length = "+J+"; else vErrors = null; } ",K.opts.allErrors)P+=" } "}else if(v)P+=" if (true) { ";return P}}),jW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.schema[Y],w=K.errSchemaPath+"/"+Y,O=!K.opts.allErrors,z=K.util.toQuotedString($);if(K.opts.$comment===!0)P+=" console.log("+z+");";else if(typeof K.opts.$comment=="function")P+=" self._opts.$comment("+z+", "+K.util.toQuotedString(w)+", validate.root.schema);";return P}}),PW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||""),T="valid"+$,J=K.opts.$data&&O&&O.$data,k;if(J)P+=" var schema"+$+" = "+K.util.getData(O.$data,w,K.dataPathArr)+"; ",k="schema"+$;else k=O;if(!J)P+=" var schema"+$+" = validate.schema"+z+";";P+="var "+T+" = equal("+H+", schema"+$+"); if (!"+T+") { ";var A=A||[];if(A.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'const' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { allowedValue: schema"+$+" } ",K.opts.messages!==!1)P+=" , message: 'should be equal to constant' ";if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";var G=P;if(P=A.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+G+"]); ";else P+=" validate.errors = ["+G+"]; return false; ";else P+=" var err = "+G+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" }",v)P+=" else { ";return P}}),YW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||""),T="valid"+$,J="errs__"+$,k=K.util.copy(K),A="";k.level++;var G="valid"+k.level,u="i"+$,V=k.dataLevel=K.dataLevel+1,m="data"+V,N=K.baseId,R=K.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:K.util.schemaHasRules(O,K.RULES.all);if(P+="var "+J+" = errors;var "+T+";",R){var p=K.compositeRule;K.compositeRule=k.compositeRule=!0,k.schema=O,k.schemaPath=z,k.errSchemaPath=W,P+=" var "+G+" = false; for (var "+u+" = 0; "+u+" < "+H+".length; "+u+"++) { ",k.errorPath=K.util.getPathExpr(K.errorPath,u,K.opts.jsonPointers,!0);var b=H+"["+u+"]";k.dataPathArr[V]=u;var d=K.validate(k);if(k.baseId=N,K.util.varOccurences(d,m)<2)P+=" "+K.util.varReplace(d,m,b)+" ";else P+=" var "+m+" = "+b+"; "+d+" ";P+=" if ("+G+") break; } ",K.compositeRule=k.compositeRule=p,P+=" "+A+" if (!"+G+") {"}else P+=" if ("+H+".length == 0) {";var y=y||[];if(y.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: {} ",K.opts.messages!==!1)P+=" , message: 'should contain a valid item' ";if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";var M=P;if(P=y.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+M+"]); ";else P+=" validate.errors = ["+M+"]; return false; ";else P+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" } else { ",R)P+=" errors = "+J+"; if (vErrors !== null) { if ("+J+") vErrors.length = "+J+"; else vErrors = null; } ";if(K.opts.allErrors)P+=" } ";return P}}),fW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||""),T="errs__"+$,J=K.util.copy(K),k="";J.level++;var A="valid"+J.level,G={},u={},V=K.opts.ownProperties;for(p in O){if(p=="__proto__")continue;var m=O[p],N=Array.isArray(m)?u:G;N[p]=m}P+="var "+T+" = errors;";var R=K.errorPath;P+="var missing"+$+";";for(var p in u)if(N=u[p],N.length){if(P+=" if ( "+H+K.util.getProperty(p)+" !== undefined ",V)P+=" && Object.prototype.hasOwnProperty.call("+H+", '"+K.util.escapeQuotes(p)+"') ";if(v){P+=" && ( ";var b=N;if(b){var d,y=-1,M=b.length-1;while(y<M){if(d=b[y+=1],y)P+=" || ";var S=K.util.getProperty(d),L=H+S;if(P+=" ( ( "+L+" === undefined ",V)P+=" || ! Object.prototype.hasOwnProperty.call("+H+", '"+K.util.escapeQuotes(d)+"') ";P+=") && (missing"+$+" = "+K.util.toQuotedString(K.opts.jsonPointers?d:S)+") ) "}}P+=")) { ";var c="missing"+$,B="' + "+c+" + '";if(K.opts._errorDataPathProperty)K.errorPath=K.opts.jsonPointers?K.util.getPathExpr(R,c,!0):R+" + "+c;var e=e||[];if(e.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { property: '"+K.util.escapeQuotes(p)+"', missingProperty: '"+B+"', depsCount: "+N.length+", deps: '"+K.util.escapeQuotes(N.length==1?N[0]:N.join(", "))+"' } ",K.opts.messages!==!1){if(P+=" , message: 'should have ",N.length==1)P+="property "+K.util.escapeQuotes(N[0]);else P+="properties "+K.util.escapeQuotes(N.join(", "));P+=" when property "+K.util.escapeQuotes(p)+" is present' "}if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";var f8=P;if(P=e.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+f8+"]); ";else P+=" validate.errors = ["+f8+"]; return false; ";else P+=" var err = "+f8+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{P+=" ) { ";var K8=N;if(K8){var d,z8=-1,O8=K8.length-1;while(z8<O8){d=K8[z8+=1];var S=K.util.getProperty(d),B=K.util.escapeQuotes(d),L=H+S;if(K.opts._errorDataPathProperty)K.errorPath=K.util.getPath(R,d,K.opts.jsonPointers);if(P+=" if ( "+L+" === undefined ",V)P+=" || ! Object.prototype.hasOwnProperty.call("+H+", '"+K.util.escapeQuotes(d)+"') ";if(P+=") { var err = ",K.createErrors!==!1){if(P+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { property: '"+K.util.escapeQuotes(p)+"', missingProperty: '"+B+"', depsCount: "+N.length+", deps: '"+K.util.escapeQuotes(N.length==1?N[0]:N.join(", "))+"' } ",K.opts.messages!==!1){if(P+=" , message: 'should have ",N.length==1)P+="property "+K.util.escapeQuotes(N[0]);else P+="properties "+K.util.escapeQuotes(N.join(", "));P+=" when property "+K.util.escapeQuotes(p)+" is present' "}if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";P+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}if(P+=" } ",v)k+="}",P+=" else { "}K.errorPath=R;var j8=J.baseId;for(var p in G){var m=G[p];if(K.opts.strictKeywords?typeof m=="object"&&Object.keys(m).length>0||m===!1:K.util.schemaHasRules(m,K.RULES.all)){if(P+=" "+A+" = true; if ( "+H+K.util.getProperty(p)+" !== undefined ",V)P+=" && Object.prototype.hasOwnProperty.call("+H+", '"+K.util.escapeQuotes(p)+"') ";if(P+=") { ",J.schema=m,J.schemaPath=z+K.util.getProperty(p),J.errSchemaPath=W+"/"+K.util.escapeFragment(p),P+=" "+K.validate(J)+" ",J.baseId=j8,P+=" } ",v)P+=" if ("+A+") { ",k+="}"}}if(v)P+=" "+k+" if ("+T+" == errors) {";return P}}),$W=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||""),T="valid"+$,J=K.opts.$data&&O&&O.$data,k;if(J)P+=" var schema"+$+" = "+K.util.getData(O.$data,w,K.dataPathArr)+"; ",k="schema"+$;else k=O;var A="i"+$,G="schema"+$;if(!J)P+=" var "+G+" = validate.schema"+z+";";if(P+="var "+T+";",J)P+=" if (schema"+$+" === undefined) "+T+" = true; else if (!Array.isArray(schema"+$+")) "+T+" = false; else {";if(P+=""+T+" = false;for (var "+A+"=0; "+A+"<"+G+".length; "+A+"++) if (equal("+H+", "+G+"["+A+"])) { "+T+" = true; break; }",J)P+=" } ";P+=" if (!"+T+") { ";var u=u||[];if(u.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { allowedValues: schema"+$+" } ",K.opts.messages!==!1)P+=" , message: 'should be equal to one of the allowed values' ";if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";var V=P;if(P=u.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+V+"]); ";else P+=" validate.errors = ["+V+"]; return false; ";else P+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" }",v)P+=" else { ";return P}}),OW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||"");if(K.opts.format===!1){if(v)P+=" if (true) { ";return P}var T=K.opts.$data&&O&&O.$data,J;if(T)P+=" var schema"+$+" = "+K.util.getData(O.$data,w,K.dataPathArr)+"; ",J="schema"+$;else J=O;var k=K.opts.unknownFormats,A=Array.isArray(k);if(T){var G="format"+$,u="isObject"+$,V="formatType"+$;if(P+=" var "+G+" = formats["+J+"]; var "+u+" = typeof "+G+" == 'object' && !("+G+" instanceof RegExp) && "+G+".validate; var "+V+" = "+u+" && "+G+".type || 'string'; if ("+u+") { ",K.async)P+=" var async"+$+" = "+G+".async; ";if(P+=" "+G+" = "+G+".validate; } if ( ",T)P+=" ("+J+" !== undefined && typeof "+J+" != 'string') || ";if(P+=" (",k!="ignore"){if(P+=" ("+J+" && !"+G+" ",A)P+=" && self._opts.unknownFormats.indexOf("+J+") == -1 ";P+=") || "}if(P+=" ("+G+" && "+V+" == '"+f+"' && !(typeof "+G+" == 'function' ? ",K.async)P+=" (async"+$+" ? await "+G+"("+H+") : "+G+"("+H+")) ";else P+=" "+G+"("+H+") ";P+=" : "+G+".test("+H+"))))) {"}else{var G=K.formats[O];if(!G)if(k=="ignore"){if(K.logger.warn('unknown format "'+O+'" ignored in schema at path "'+K.errSchemaPath+'"'),v)P+=" if (true) { ";return P}else if(A&&k.indexOf(O)>=0){if(v)P+=" if (true) { ";return P}else throw new Error('unknown format "'+O+'" is used in schema at path "'+K.errSchemaPath+'"');var u=typeof G=="object"&&!(G instanceof RegExp)&&G.validate,V=u&&G.type||"string";if(u){var m=G.async===!0;G=G.validate}if(V!=f){if(v)P+=" if (true) { ";return P}if(m){if(!K.async)throw new Error("async format in sync schema");var N="formats"+K.util.getProperty(O)+".validate";P+=" if (!(await "+N+"("+H+"))) { "}else{P+=" if (! ";var N="formats"+K.util.getProperty(O);if(u)N+=".validate";if(typeof G=="function")P+=" "+N+"("+H+") ";else P+=" "+N+".test("+H+") ";P+=") { "}}var R=R||[];if(R.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'format' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { format: ",T)P+=""+J;else P+=""+K.util.toQuotedString(O);if(P+=" } ",K.opts.messages!==!1){if(P+=` , message: 'should match format "`,T)P+="' + "+J+" + '";else P+=""+K.util.escapeQuotes(O);P+=`"' `}if(K.opts.verbose){if(P+=" , schema: ",T)P+="validate.schema"+z;else P+=""+K.util.toQuotedString(O);P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" "}P+=" } "}else P+=" {} ";var p=P;if(P=R.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+p+"]); ";else P+=" validate.errors = ["+p+"]; return false; ";else P+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" } ",v)P+=" else { ";return P}}),wW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||""),T="valid"+$,J="errs__"+$,k=K.util.copy(K);k.level++;var A="valid"+k.level,G=K.schema.then,u=K.schema.else,V=G!==void 0&&(K.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:K.util.schemaHasRules(G,K.RULES.all)),m=u!==void 0&&(K.opts.strictKeywords?typeof u=="object"&&Object.keys(u).length>0||u===!1:K.util.schemaHasRules(u,K.RULES.all)),N=k.baseId;if(V||m){var R;k.createErrors=!1,k.schema=O,k.schemaPath=z,k.errSchemaPath=W,P+=" var "+J+" = errors; var "+T+" = true; ";var p=K.compositeRule;if(K.compositeRule=k.compositeRule=!0,P+=" "+K.validate(k)+" ",k.baseId=N,k.createErrors=!0,P+=" errors = "+J+"; if (vErrors !== null) { if ("+J+") vErrors.length = "+J+"; else vErrors = null; } ",K.compositeRule=k.compositeRule=p,V){if(P+=" if ("+A+") { ",k.schema=K.schema.then,k.schemaPath=K.schemaPath+".then",k.errSchemaPath=K.errSchemaPath+"/then",P+=" "+K.validate(k)+" ",k.baseId=N,P+=" "+T+" = "+A+"; ",V&&m)R="ifClause"+$,P+=" var "+R+" = 'then'; ";else R="'then'";if(P+=" } ",m)P+=" else { "}else P+=" if (!"+A+") { ";if(m){if(k.schema=K.schema.else,k.schemaPath=K.schemaPath+".else",k.errSchemaPath=K.errSchemaPath+"/else",P+=" "+K.validate(k)+" ",k.baseId=N,P+=" "+T+" = "+A+"; ",V&&m)R="ifClause"+$,P+=" var "+R+" = 'else'; ";else R="'else'";P+=" } "}if(P+=" if (!"+T+") { var err = ",K.createErrors!==!1){if(P+=" { keyword: 'if' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { failingKeyword: "+R+" } ",K.opts.messages!==!1)P+=` , message: 'should match "' + `+R+` + '" schema' `;if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";if(P+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(vErrors); ";else P+=" validate.errors = vErrors; return false; ";if(P+=" } ",v)P+=" else { "}else if(v)P+=" if (true) { ";return P}}),zW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||""),T="valid"+$,J="errs__"+$,k=K.util.copy(K),A="";k.level++;var G="valid"+k.level,u="i"+$,V=k.dataLevel=K.dataLevel+1,m="data"+V,N=K.baseId;if(P+="var "+J+" = errors;var "+T+";",Array.isArray(O)){var R=K.schema.additionalItems;if(R===!1){P+=" "+T+" = "+H+".length <= "+O.length+"; ";var p=W;W=K.errSchemaPath+"/additionalItems",P+=" if (!"+T+") { ";var b=b||[];if(b.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { limit: "+O.length+" } ",K.opts.messages!==!1)P+=" , message: 'should NOT have more than "+O.length+" items' ";if(K.opts.verbose)P+=" , schema: false , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";var d=P;if(P=b.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+d+"]); ";else P+=" validate.errors = ["+d+"]; return false; ";else P+=" var err = "+d+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" } ",W=p,v)A+="}",P+=" else { "}var y=O;if(y){var M,S=-1,L=y.length-1;while(S<L)if(M=y[S+=1],K.opts.strictKeywords?typeof M=="object"&&Object.keys(M).length>0||M===!1:K.util.schemaHasRules(M,K.RULES.all)){P+=" "+G+" = true; if ("+H+".length > "+S+") { ";var c=H+"["+S+"]";k.schema=M,k.schemaPath=z+"["+S+"]",k.errSchemaPath=W+"/"+S,k.errorPath=K.util.getPathExpr(K.errorPath,S,K.opts.jsonPointers,!0),k.dataPathArr[V]=S;var B=K.validate(k);if(k.baseId=N,K.util.varOccurences(B,m)<2)P+=" "+K.util.varReplace(B,m,c)+" ";else P+=" var "+m+" = "+c+"; "+B+" ";if(P+=" } ",v)P+=" if ("+G+") { ",A+="}"}}if(typeof R=="object"&&(K.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:K.util.schemaHasRules(R,K.RULES.all))){k.schema=R,k.schemaPath=K.schemaPath+".additionalItems",k.errSchemaPath=K.errSchemaPath+"/additionalItems",P+=" "+G+" = true; if ("+H+".length > "+O.length+") { for (var "+u+" = "+O.length+"; "+u+" < "+H+".length; "+u+"++) { ",k.errorPath=K.util.getPathExpr(K.errorPath,u,K.opts.jsonPointers,!0);var c=H+"["+u+"]";k.dataPathArr[V]=u;var B=K.validate(k);if(k.baseId=N,K.util.varOccurences(B,m)<2)P+=" "+K.util.varReplace(B,m,c)+" ";else P+=" var "+m+" = "+c+"; "+B+" ";if(v)P+=" if (!"+G+") break; ";if(P+=" } } ",v)P+=" if ("+G+") { ",A+="}"}}else if(K.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:K.util.schemaHasRules(O,K.RULES.all)){k.schema=O,k.schemaPath=z,k.errSchemaPath=W,P+=" for (var "+u+" = 0; "+u+" < "+H+".length; "+u+"++) { ",k.errorPath=K.util.getPathExpr(K.errorPath,u,K.opts.jsonPointers,!0);var c=H+"["+u+"]";k.dataPathArr[V]=u;var B=K.validate(k);if(k.baseId=N,K.util.varOccurences(B,m)<2)P+=" "+K.util.varReplace(B,m,c)+" ";else P+=" var "+m+" = "+c+"; "+B+" ";if(v)P+=" if (!"+G+") break; ";P+=" }"}if(v)P+=" "+A+" if ("+J+" == errors) {";return P}}),T1=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,N,H="data"+(w||""),T=K.opts.$data&&O&&O.$data,J;if(T)P+=" var schema"+$+" = "+K.util.getData(O.$data,w,K.dataPathArr)+"; ",J="schema"+$;else J=O;var k=Y=="maximum",A=k?"exclusiveMaximum":"exclusiveMinimum",G=K.schema[A],u=K.opts.$data&&G&&G.$data,V=k?"<":">",m=k?">":"<",N=void 0;if(!(T||typeof O=="number"||O===void 0))throw new Error(Y+" must be number");if(!(u||G===void 0||typeof G=="number"||typeof G=="boolean"))throw new Error(A+" must be number or boolean");if(u){var R=K.util.getData(G.$data,w,K.dataPathArr),p="exclusive"+$,b="exclType"+$,d="exclIsNumber"+$,y="op"+$,M="' + "+y+" + '";P+=" var schemaExcl"+$+" = "+R+"; ",R="schemaExcl"+$,P+=" var "+p+"; var "+b+" = typeof "+R+"; if ("+b+" != 'boolean' && "+b+" != 'undefined' && "+b+" != 'number') { ";var N=A,S=S||[];if(S.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(N||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: {} ",K.opts.messages!==!1)P+=" , message: '"+A+" should be boolean' ";if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";var L=P;if(P=S.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+L+"]); ";else P+=" validate.errors = ["+L+"]; return false; ";else P+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" } else if ( ",T)P+=" ("+J+" !== undefined && typeof "+J+" != 'number') || ";if(P+=" "+b+" == 'number' ? ( ("+p+" = "+J+" === undefined || "+R+" "+V+"= "+J+") ? "+H+" "+m+"= "+R+" : "+H+" "+m+" "+J+" ) : ( ("+p+" = "+R+" === true) ? "+H+" "+m+"= "+J+" : "+H+" "+m+" "+J+" ) || "+H+" !== "+H+") { var op"+$+" = "+p+" ? '"+V+"' : '"+V+"='; ",O===void 0)N=A,W=K.errSchemaPath+"/"+A,J=R,T=u}else{var d=typeof G=="number",M=V;if(d&&T){var y="'"+M+"'";if(P+=" if ( ",T)P+=" ("+J+" !== undefined && typeof "+J+" != 'number') || ";P+=" ( "+J+" === undefined || "+G+" "+V+"= "+J+" ? "+H+" "+m+"= "+G+" : "+H+" "+m+" "+J+" ) || "+H+" !== "+H+") { "}else{if(d&&O===void 0)p=!0,N=A,W=K.errSchemaPath+"/"+A,J=G,m+="=";else{if(d)J=Math[k?"min":"max"](G,O);if(G===(d?J:!0))p=!0,N=A,W=K.errSchemaPath+"/"+A,m+="=";else p=!1,M+="="}var y="'"+M+"'";if(P+=" if ( ",T)P+=" ("+J+" !== undefined && typeof "+J+" != 'number') || ";P+=" "+H+" "+m+" "+J+" || "+H+" !== "+H+") { "}}N=N||Y;var S=S||[];if(S.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(N||"_limit")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { comparison: "+y+", limit: "+J+", exclusive: "+p+" } ",K.opts.messages!==!1)if(P+=" , message: 'should be "+M+" ",T)P+="' + "+J;else P+=""+J+"'";if(K.opts.verbose){if(P+=" , schema: ",T)P+="validate.schema"+z;else P+=""+O;P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" "}P+=" } "}else P+=" {} ";var L=P;if(P=S.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+L+"]); ";else P+=" validate.errors = ["+L+"]; return false; ";else P+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" } ",v)P+=" else { ";return P}}),Z1=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,A,H="data"+(w||""),T=K.opts.$data&&O&&O.$data,J;if(T)P+=" var schema"+$+" = "+K.util.getData(O.$data,w,K.dataPathArr)+"; ",J="schema"+$;else J=O;if(!(T||typeof O=="number"))throw new Error(Y+" must be number");var k=Y=="maxItems"?">":"<";if(P+="if ( ",T)P+=" ("+J+" !== undefined && typeof "+J+" != 'number') || ";P+=" "+H+".length "+k+" "+J+") { ";var A=Y,G=G||[];if(G.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(A||"_limitItems")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { limit: "+J+" } ",K.opts.messages!==!1){if(P+=" , message: 'should NOT have ",Y=="maxItems")P+="more";else P+="fewer";if(P+=" than ",T)P+="' + "+J+" + '";else P+=""+O;P+=" items' "}if(K.opts.verbose){if(P+=" , schema: ",T)P+="validate.schema"+z;else P+=""+O;P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" "}P+=" } "}else P+=" {} ";var u=P;if(P=G.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+u+"]); ";else P+=" validate.errors = ["+u+"]; return false; ";else P+=" var err = "+u+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+="} ",v)P+=" else { ";return P}}),k1=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,A,H="data"+(w||""),T=K.opts.$data&&O&&O.$data,J;if(T)P+=" var schema"+$+" = "+K.util.getData(O.$data,w,K.dataPathArr)+"; ",J="schema"+$;else J=O;if(!(T||typeof O=="number"))throw new Error(Y+" must be number");var k=Y=="maxLength"?">":"<";if(P+="if ( ",T)P+=" ("+J+" !== undefined && typeof "+J+" != 'number') || ";if(K.opts.unicode===!1)P+=" "+H+".length ";else P+=" ucs2length("+H+") ";P+=" "+k+" "+J+") { ";var A=Y,G=G||[];if(G.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(A||"_limitLength")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { limit: "+J+" } ",K.opts.messages!==!1){if(P+=" , message: 'should NOT be ",Y=="maxLength")P+="longer";else P+="shorter";if(P+=" than ",T)P+="' + "+J+" + '";else P+=""+O;P+=" characters' "}if(K.opts.verbose){if(P+=" , schema: ",T)P+="validate.schema"+z;else P+=""+O;P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" "}P+=" } "}else P+=" {} ";var u=P;if(P=G.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+u+"]); ";else P+=" validate.errors = ["+u+"]; return false; ";else P+=" var err = "+u+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+="} ",v)P+=" else { ";return P}}),X1=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,A,H="data"+(w||""),T=K.opts.$data&&O&&O.$data,J;if(T)P+=" var schema"+$+" = "+K.util.getData(O.$data,w,K.dataPathArr)+"; ",J="schema"+$;else J=O;if(!(T||typeof O=="number"))throw new Error(Y+" must be number");var k=Y=="maxProperties"?">":"<";if(P+="if ( ",T)P+=" ("+J+" !== undefined && typeof "+J+" != 'number') || ";P+=" Object.keys("+H+").length "+k+" "+J+") { ";var A=Y,G=G||[];if(G.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(A||"_limitProperties")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { limit: "+J+" } ",K.opts.messages!==!1){if(P+=" , message: 'should NOT have ",Y=="maxProperties")P+="more";else P+="fewer";if(P+=" than ",T)P+="' + "+J+" + '";else P+=""+O;P+=" properties' "}if(K.opts.verbose){if(P+=" , schema: ",T)P+="validate.schema"+z;else P+=""+O;P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" "}P+=" } "}else P+=" {} ";var u=P;if(P=G.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+u+"]); ";else P+=" validate.errors = ["+u+"]; return false; ";else P+=" var err = "+u+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+="} ",v)P+=" else { ";return P}}),WW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||""),T=K.opts.$data&&O&&O.$data,J;if(T)P+=" var schema"+$+" = "+K.util.getData(O.$data,w,K.dataPathArr)+"; ",J="schema"+$;else J=O;if(!(T||typeof O=="number"))throw new Error(Y+" must be number");if(P+="var division"+$+";if (",T)P+=" "+J+" !== undefined && ( typeof "+J+" != 'number' || ";if(P+=" (division"+$+" = "+H+" / "+J+", ",K.opts.multipleOfPrecision)P+=" Math.abs(Math.round(division"+$+") - division"+$+") > 1e-"+K.opts.multipleOfPrecision+" ";else P+=" division"+$+" !== parseInt(division"+$+") ";if(P+=" ) ",T)P+=" ) ";P+=" ) { ";var k=k||[];if(k.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { multipleOf: "+J+" } ",K.opts.messages!==!1)if(P+=" , message: 'should be multiple of ",T)P+="' + "+J;else P+=""+J+"'";if(K.opts.verbose){if(P+=" , schema: ",T)P+="validate.schema"+z;else P+=""+O;P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" "}P+=" } "}else P+=" {} ";var A=P;if(P=k.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+A+"]); ";else P+=" validate.errors = ["+A+"]; return false; ";else P+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+="} ",v)P+=" else { ";return P}}),vW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||""),T="errs__"+$,J=K.util.copy(K);J.level++;var k="valid"+J.level;if(K.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:K.util.schemaHasRules(O,K.RULES.all)){J.schema=O,J.schemaPath=z,J.errSchemaPath=W,P+=" var "+T+" = errors; ";var A=K.compositeRule;K.compositeRule=J.compositeRule=!0,J.createErrors=!1;var G;if(J.opts.allErrors)G=J.opts.allErrors,J.opts.allErrors=!1;if(P+=" "+K.validate(J)+" ",J.createErrors=!0,G)J.opts.allErrors=G;K.compositeRule=J.compositeRule=A,P+=" if ("+k+") { ";var u=u||[];if(u.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'not' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: {} ",K.opts.messages!==!1)P+=" , message: 'should NOT be valid' ";if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";var V=P;if(P=u.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+V+"]); ";else P+=" validate.errors = ["+V+"]; return false; ";else P+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" } else { errors = "+T+"; if (vErrors !== null) { if ("+T+") vErrors.length = "+T+"; else vErrors = null; } ",K.opts.allErrors)P+=" } "}else{if(P+=" var err = ",K.createErrors!==!1){if(P+=" { keyword: 'not' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: {} ",K.opts.messages!==!1)P+=" , message: 'should NOT be valid' ";if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";if(P+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",v)P+=" if (false) { "}return P}}),HW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||""),T="valid"+$,J="errs__"+$,k=K.util.copy(K),A="";k.level++;var G="valid"+k.level,u=k.baseId,V="prevValid"+$,m="passingSchemas"+$;P+="var "+J+" = errors , "+V+" = false , "+T+" = false , "+m+" = null; ";var N=K.compositeRule;K.compositeRule=k.compositeRule=!0;var R=O;if(R){var p,b=-1,d=R.length-1;while(b<d){if(p=R[b+=1],K.opts.strictKeywords?typeof p=="object"&&Object.keys(p).length>0||p===!1:K.util.schemaHasRules(p,K.RULES.all))k.schema=p,k.schemaPath=z+"["+b+"]",k.errSchemaPath=W+"/"+b,P+=" "+K.validate(k)+" ",k.baseId=u;else P+=" var "+G+" = true; ";if(b)P+=" if ("+G+" && "+V+") { "+T+" = false; "+m+" = ["+m+", "+b+"]; } else { ",A+="}";P+=" if ("+G+") { "+T+" = "+V+" = true; "+m+" = "+b+"; }"}}if(K.compositeRule=k.compositeRule=N,P+=""+A+"if (!"+T+") { var err = ",K.createErrors!==!1){if(P+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { passingSchemas: "+m+" } ",K.opts.messages!==!1)P+=" , message: 'should match exactly one schema in oneOf' ";if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";if(P+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(vErrors); ";else P+=" validate.errors = vErrors; return false; ";if(P+="} else { errors = "+J+"; if (vErrors !== null) { if ("+J+") vErrors.length = "+J+"; else vErrors = null; }",K.opts.allErrors)P+=" } ";return P}}),JW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||""),T=K.opts.$data&&O&&O.$data,J;if(T)P+=" var schema"+$+" = "+K.util.getData(O.$data,w,K.dataPathArr)+"; ",J="schema"+$;else J=O;var k=T?"(new RegExp("+J+"))":K.usePattern(O);if(P+="if ( ",T)P+=" ("+J+" !== undefined && typeof "+J+" != 'string') || ";P+=" !"+k+".test("+H+") ) { ";var A=A||[];if(A.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { pattern: ",T)P+=""+J;else P+=""+K.util.toQuotedString(O);if(P+=" } ",K.opts.messages!==!1){if(P+=` , message: 'should match pattern "`,T)P+="' + "+J+" + '";else P+=""+K.util.escapeQuotes(O);P+=`"' `}if(K.opts.verbose){if(P+=" , schema: ",T)P+="validate.schema"+z;else P+=""+K.util.toQuotedString(O);P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" "}P+=" } "}else P+=" {} ";var G=P;if(P=A.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+G+"]); ";else P+=" validate.errors = ["+G+"]; return false; ";else P+=" var err = "+G+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+="} ",v)P+=" else { ";return P}}),TW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||""),T="errs__"+$,J=K.util.copy(K),k="";J.level++;var A="valid"+J.level,G="key"+$,u="idx"+$,V=J.dataLevel=K.dataLevel+1,m="data"+V,N="dataProperties"+$,R=Object.keys(O||{}).filter(z8),p=K.schema.patternProperties||{},b=Object.keys(p).filter(z8),d=K.schema.additionalProperties,y=R.length||b.length,M=d===!1,S=typeof d=="object"&&Object.keys(d).length,L=K.opts.removeAdditional,c=M||S||L,B=K.opts.ownProperties,e=K.baseId,f8=K.schema.required;if(f8&&!(K.opts.$data&&f8.$data)&&f8.length<K.opts.loopRequired)var K8=K.util.toHash(f8);function z8(fq){return fq!=="__proto__"}if(P+="var "+T+" = errors;var "+A+" = true;",B)P+=" var "+N+" = undefined;";if(c){if(B)P+=" "+N+" = "+N+" || Object.keys("+H+"); for (var "+u+"=0; "+u+"<"+N+".length; "+u+"++) { var "+G+" = "+N+"["+u+"]; ";else P+=" for (var "+G+" in "+H+") { ";if(y){if(P+=" var isAdditional"+$+" = !(false ",R.length)if(R.length>8)P+=" || validate.schema"+z+".hasOwnProperty("+G+") ";else{var O8=R;if(O8){var j8,G8=-1,t8=O8.length-1;while(G8<t8)j8=O8[G8+=1],P+=" || "+G+" == "+K.util.toQuotedString(j8)+" "}}if(b.length){var s8=b;if(s8){var C,D=-1,Z=s8.length-1;while(D<Z)C=s8[D+=1],P+=" || "+K.usePattern(C)+".test("+G+") "}}P+=" ); if (isAdditional"+$+") { "}if(L=="all")P+=" delete "+H+"["+G+"]; ";else{var E=K.errorPath,x="' + "+G+" + '";if(K.opts._errorDataPathProperty)K.errorPath=K.util.getPathExpr(K.errorPath,G,K.opts.jsonPointers);if(M)if(L)P+=" delete "+H+"["+G+"]; ";else{P+=" "+A+" = false; ";var i=W;W=K.errSchemaPath+"/additionalProperties";var r=r||[];if(r.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { additionalProperty: '"+x+"' } ",K.opts.messages!==!1){if(P+=" , message: '",K.opts._errorDataPathProperty)P+="is an invalid additional property";else P+="should NOT have additional properties";P+="' "}if(K.opts.verbose)P+=" , schema: false , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";var a=P;if(P=r.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+a+"]); ";else P+=" validate.errors = ["+a+"]; return false; ";else P+=" var err = "+a+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(W=i,v)P+=" break; "}else if(S)if(L=="failing"){P+=" var "+T+" = errors; ";var Y8=K.compositeRule;K.compositeRule=J.compositeRule=!0,J.schema=d,J.schemaPath=K.schemaPath+".additionalProperties",J.errSchemaPath=K.errSchemaPath+"/additionalProperties",J.errorPath=K.opts._errorDataPathProperty?K.errorPath:K.util.getPathExpr(K.errorPath,G,K.opts.jsonPointers);var H8=H+"["+G+"]";J.dataPathArr[V]=G;var w8=K.validate(J);if(J.baseId=e,K.util.varOccurences(w8,m)<2)P+=" "+K.util.varReplace(w8,m,H8)+" ";else P+=" var "+m+" = "+H8+"; "+w8+" ";P+=" if (!"+A+") { errors = "+T+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+H+"["+G+"]; } ",K.compositeRule=J.compositeRule=Y8}else{J.schema=d,J.schemaPath=K.schemaPath+".additionalProperties",J.errSchemaPath=K.errSchemaPath+"/additionalProperties",J.errorPath=K.opts._errorDataPathProperty?K.errorPath:K.util.getPathExpr(K.errorPath,G,K.opts.jsonPointers);var H8=H+"["+G+"]";J.dataPathArr[V]=G;var w8=K.validate(J);if(J.baseId=e,K.util.varOccurences(w8,m)<2)P+=" "+K.util.varReplace(w8,m,H8)+" ";else P+=" var "+m+" = "+H8+"; "+w8+" ";if(v)P+=" if (!"+A+") break; "}K.errorPath=E}if(y)P+=" } ";if(P+=" } ",v)P+=" if ("+A+") { ",k+="}"}var A8=K.opts.useDefaults&&!K.compositeRule;if(R.length){var L8=R;if(L8){var j8,M8=-1,H6=L8.length-1;while(M8<H6){j8=L8[M8+=1];var F8=O[j8];if(K.opts.strictKeywords?typeof F8=="object"&&Object.keys(F8).length>0||F8===!1:K.util.schemaHasRules(F8,K.RULES.all)){var V6=K.util.getProperty(j8),H8=H+V6,p8=A8&&F8.default!==void 0;J.schema=F8,J.schemaPath=z+V6,J.errSchemaPath=W+"/"+K.util.escapeFragment(j8),J.errorPath=K.util.getPath(K.errorPath,j8,K.opts.jsonPointers),J.dataPathArr[V]=K.util.toQuotedString(j8);var w8=K.validate(J);if(J.baseId=e,K.util.varOccurences(w8,m)<2){w8=K.util.varReplace(w8,m,H8);var $6=H8}else{var $6=m;P+=" var "+m+" = "+H8+"; "}if(p8)P+=" "+w8+" ";else{if(K8&&K8[j8]){if(P+=" if ( "+$6+" === undefined ",B)P+=" || ! Object.prototype.hasOwnProperty.call("+H+", '"+K.util.escapeQuotes(j8)+"') ";P+=") { "+A+" = false; ";var E=K.errorPath,i=W,a6=K.util.escapeQuotes(j8);if(K.opts._errorDataPathProperty)K.errorPath=K.util.getPath(E,j8,K.opts.jsonPointers);W=K.errSchemaPath+"/required";var r=r||[];if(r.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'required' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { missingProperty: '"+a6+"' } ",K.opts.messages!==!1){if(P+=" , message: '",K.opts._errorDataPathProperty)P+="is a required property";else P+="should have required property \\'"+a6+"\\'";P+="' "}if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";var a=P;if(P=r.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+a+"]); ";else P+=" validate.errors = ["+a+"]; return false; ";else P+=" var err = "+a+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";W=i,K.errorPath=E,P+=" } else { "}else if(v){if(P+=" if ( "+$6+" === undefined ",B)P+=" || ! Object.prototype.hasOwnProperty.call("+H+", '"+K.util.escapeQuotes(j8)+"') ";P+=") { "+A+" = true; } else { "}else{if(P+=" if ("+$6+" !== undefined ",B)P+=" && Object.prototype.hasOwnProperty.call("+H+", '"+K.util.escapeQuotes(j8)+"') ";P+=" ) { "}P+=" "+w8+" } "}}if(v)P+=" if ("+A+") { ",k+="}"}}}if(b.length){var d6=b;if(d6){var C,U3=-1,h4=d6.length-1;while(U3<h4){C=d6[U3+=1];var F8=p[C];if(K.opts.strictKeywords?typeof F8=="object"&&Object.keys(F8).length>0||F8===!1:K.util.schemaHasRules(F8,K.RULES.all)){if(J.schema=F8,J.schemaPath=K.schemaPath+".patternProperties"+K.util.getProperty(C),J.errSchemaPath=K.errSchemaPath+"/patternProperties/"+K.util.escapeFragment(C),B)P+=" "+N+" = "+N+" || Object.keys("+H+"); for (var "+u+"=0; "+u+"<"+N+".length; "+u+"++) { var "+G+" = "+N+"["+u+"]; ";else P+=" for (var "+G+" in "+H+") { ";P+=" if ("+K.usePattern(C)+".test("+G+")) { ",J.errorPath=K.util.getPathExpr(K.errorPath,G,K.opts.jsonPointers);var H8=H+"["+G+"]";J.dataPathArr[V]=G;var w8=K.validate(J);if(J.baseId=e,K.util.varOccurences(w8,m)<2)P+=" "+K.util.varReplace(w8,m,H8)+" ";else P+=" var "+m+" = "+H8+"; "+w8+" ";if(v)P+=" if (!"+A+") break; ";if(P+=" } ",v)P+=" else "+A+" = true; ";if(P+=" } ",v)P+=" if ("+A+") { ",k+="}"}}}}if(v)P+=" "+k+" if ("+T+" == errors) {";return P}}),ZW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||""),T="errs__"+$,J=K.util.copy(K),k="";J.level++;var A="valid"+J.level;if(P+="var "+T+" = errors;",K.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:K.util.schemaHasRules(O,K.RULES.all)){J.schema=O,J.schemaPath=z,J.errSchemaPath=W;var G="key"+$,u="idx"+$,V="i"+$,m="' + "+G+" + '",N=J.dataLevel=K.dataLevel+1,R="data"+N,p="dataProperties"+$,b=K.opts.ownProperties,d=K.baseId;if(b)P+=" var "+p+" = undefined; ";if(b)P+=" "+p+" = "+p+" || Object.keys("+H+"); for (var "+u+"=0; "+u+"<"+p+".length; "+u+"++) { var "+G+" = "+p+"["+u+"]; ";else P+=" for (var "+G+" in "+H+") { ";P+=" var startErrs"+$+" = errors; ";var y=G,M=K.compositeRule;K.compositeRule=J.compositeRule=!0;var S=K.validate(J);if(J.baseId=d,K.util.varOccurences(S,R)<2)P+=" "+K.util.varReplace(S,R,y)+" ";else P+=" var "+R+" = "+y+"; "+S+" ";if(K.compositeRule=J.compositeRule=M,P+=" if (!"+A+") { for (var "+V+"=startErrs"+$+"; "+V+"<errors; "+V+"++) { vErrors["+V+"].propertyName = "+G+"; } var err = ",K.createErrors!==!1){if(P+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { propertyName: '"+m+"' } ",K.opts.messages!==!1)P+=" , message: 'property name \\'"+m+"\\' is invalid' ";if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";if(P+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(vErrors); ";else P+=" validate.errors = vErrors; return false; ";if(v)P+=" break; ";P+=" } }"}if(v)P+=" "+k+" if ("+T+" == errors) {";return P}}),kW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||""),T="valid"+$,J=K.opts.$data&&O&&O.$data,k;if(J)P+=" var schema"+$+" = "+K.util.getData(O.$data,w,K.dataPathArr)+"; ",k="schema"+$;else k=O;var A="schema"+$;if(!J)if(O.length<K.opts.loopRequired&&K.schema.properties&&Object.keys(K.schema.properties).length){var G=[],u=O;if(u){var V,m=-1,N=u.length-1;while(m<N){V=u[m+=1];var R=K.schema.properties[V];if(!(R&&(K.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:K.util.schemaHasRules(R,K.RULES.all))))G[G.length]=V}}}else var G=O;if(J||G.length){var p=K.errorPath,b=J||G.length>=K.opts.loopRequired,d=K.opts.ownProperties;if(v)if(P+=" var missing"+$+"; ",b){if(!J)P+=" var "+A+" = validate.schema"+z+"; ";var y="i"+$,M="schema"+$+"["+y+"]",S="' + "+M+" + '";if(K.opts._errorDataPathProperty)K.errorPath=K.util.getPathExpr(p,M,K.opts.jsonPointers);if(P+=" var "+T+" = true; ",J)P+=" if (schema"+$+" === undefined) "+T+" = true; else if (!Array.isArray(schema"+$+")) "+T+" = false; else {";if(P+=" for (var "+y+" = 0; "+y+" < "+A+".length; "+y+"++) { "+T+" = "+H+"["+A+"["+y+"]] !== undefined ",d)P+=" && Object.prototype.hasOwnProperty.call("+H+", "+A+"["+y+"]) ";if(P+="; if (!"+T+") break; } ",J)P+=" } ";P+=" if (!"+T+") { ";var L=L||[];if(L.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'required' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { missingProperty: '"+S+"' } ",K.opts.messages!==!1){if(P+=" , message: '",K.opts._errorDataPathProperty)P+="is a required property";else P+="should have required property \\'"+S+"\\'";P+="' "}if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";var c=P;if(P=L.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+c+"]); ";else P+=" validate.errors = ["+c+"]; return false; ";else P+=" var err = "+c+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";P+=" } else { "}else{P+=" if ( ";var B=G;if(B){var e,y=-1,f8=B.length-1;while(y<f8){if(e=B[y+=1],y)P+=" || ";var K8=K.util.getProperty(e),z8=H+K8;if(P+=" ( ( "+z8+" === undefined ",d)P+=" || ! Object.prototype.hasOwnProperty.call("+H+", '"+K.util.escapeQuotes(e)+"') ";P+=") && (missing"+$+" = "+K.util.toQuotedString(K.opts.jsonPointers?e:K8)+") ) "}}P+=") { ";var M="missing"+$,S="' + "+M+" + '";if(K.opts._errorDataPathProperty)K.errorPath=K.opts.jsonPointers?K.util.getPathExpr(p,M,!0):p+" + "+M;var L=L||[];if(L.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'required' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { missingProperty: '"+S+"' } ",K.opts.messages!==!1){if(P+=" , message: '",K.opts._errorDataPathProperty)P+="is a required property";else P+="should have required property \\'"+S+"\\'";P+="' "}if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";var c=P;if(P=L.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+c+"]); ";else P+=" validate.errors = ["+c+"]; return false; ";else P+=" var err = "+c+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";P+=" } else { "}else if(b){if(!J)P+=" var "+A+" = validate.schema"+z+"; ";var y="i"+$,M="schema"+$+"["+y+"]",S="' + "+M+" + '";if(K.opts._errorDataPathProperty)K.errorPath=K.util.getPathExpr(p,M,K.opts.jsonPointers);if(J){if(P+=" if ("+A+" && !Array.isArray("+A+")) { var err = ",K.createErrors!==!1){if(P+=" { keyword: 'required' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { missingProperty: '"+S+"' } ",K.opts.messages!==!1){if(P+=" , message: '",K.opts._errorDataPathProperty)P+="is a required property";else P+="should have required property \\'"+S+"\\'";P+="' "}if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";P+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+A+" !== undefined) { "}if(P+=" for (var "+y+" = 0; "+y+" < "+A+".length; "+y+"++) { if ("+H+"["+A+"["+y+"]] === undefined ",d)P+=" || ! Object.prototype.hasOwnProperty.call("+H+", "+A+"["+y+"]) ";if(P+=") { var err = ",K.createErrors!==!1){if(P+=" { keyword: 'required' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { missingProperty: '"+S+"' } ",K.opts.messages!==!1){if(P+=" , message: '",K.opts._errorDataPathProperty)P+="is a required property";else P+="should have required property \\'"+S+"\\'";P+="' "}if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";if(P+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",J)P+=" } "}else{var O8=G;if(O8){var e,j8=-1,G8=O8.length-1;while(j8<G8){e=O8[j8+=1];var K8=K.util.getProperty(e),S=K.util.escapeQuotes(e),z8=H+K8;if(K.opts._errorDataPathProperty)K.errorPath=K.util.getPath(p,e,K.opts.jsonPointers);if(P+=" if ( "+z8+" === undefined ",d)P+=" || ! Object.prototype.hasOwnProperty.call("+H+", '"+K.util.escapeQuotes(e)+"') ";if(P+=") { var err = ",K.createErrors!==!1){if(P+=" { keyword: 'required' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { missingProperty: '"+S+"' } ",K.opts.messages!==!1){if(P+=" , message: '",K.opts._errorDataPathProperty)P+="is a required property";else P+="should have required property \\'"+S+"\\'";P+="' "}if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" ";P+=" } "}else P+=" {} ";P+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}K.errorPath=p}else if(v)P+=" if (true) {";return P}}),XW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H="data"+(w||""),T="valid"+$,J=K.opts.$data&&O&&O.$data,k;if(J)P+=" var schema"+$+" = "+K.util.getData(O.$data,w,K.dataPathArr)+"; ",k="schema"+$;else k=O;if((O||J)&&K.opts.uniqueItems!==!1){if(J)P+=" var "+T+"; if ("+k+" === false || "+k+" === undefined) "+T+" = true; else if (typeof "+k+" != 'boolean') "+T+" = false; else { ";P+=" var i = "+H+".length , "+T+" = true , j; if (i > 1) { ";var A=K.schema.items&&K.schema.items.type,G=Array.isArray(A);if(!A||A=="object"||A=="array"||G&&(A.indexOf("object")>=0||A.indexOf("array")>=0))P+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+H+"[i], "+H+"[j])) { "+T+" = false; break outer; } } } ";else{P+=" var itemIndices = {}, item; for (;i--;) { var item = "+H+"[i]; ";var u="checkDataType"+(G?"s":"");if(P+=" if ("+K.util[u](A,"item",K.opts.strictNumbers,!0)+") continue; ",G)P+=` if (typeof item == 'string') item = '"' + item; `;P+=" if (typeof itemIndices[item] == 'number') { "+T+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}if(P+=" } ",J)P+=" } ";P+=" if (!"+T+") { ";var V=V||[];if(V.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { i: i, j: j } ",K.opts.messages!==!1)P+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' ";if(K.opts.verbose){if(P+=" , schema: ",J)P+="validate.schema"+z;else P+=""+O;P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+H+" "}P+=" } "}else P+=" {} ";var m=P;if(P=V.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+m+"]); ";else P+=" validate.errors = ["+m+"]; return false; ";else P+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" } ",v)P+=" else { "}else if(v)P+=" if (true) { ";return P}}),AW=T8((q,_)=>{_.exports={$ref:qW(),allOf:_W(),anyOf:KW(),$comment:jW(),const:PW(),contains:YW(),dependencies:fW(),enum:$W(),format:OW(),if:wW(),items:zW(),maximum:T1(),minimum:T1(),maxItems:Z1(),minItems:Z1(),maxLength:k1(),minLength:k1(),maxProperties:X1(),minProperties:X1(),multipleOf:WW(),not:vW(),oneOf:HW(),pattern:JW(),properties:TW(),propertyNames:ZW(),required:kW(),uniqueItems:XW(),validate:N1()}}),GW=T8((q,_)=>{var j=AW(),K=JK().toHash;_.exports=function Y(){var f=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],P=["type","$comment"],$=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],w=["number","integer","string","array","object","boolean","null"];return f.all=K(P),f.types=K(w),f.forEach(function(O){if(O.rules=O.rules.map(function(z){var W;if(typeof z=="object"){var v=Object.keys(z)[0];W=z[v],z=v,W.forEach(function(T){P.push(T),f.all[T]=!0})}P.push(z);var H=f.all[z]={keyword:z,code:j[z],implements:W};return H}),f.all.$comment={keyword:"$comment",code:j.$comment},O.type)f.types[O.type]=O}),f.keywords=K(P.concat($)),f.custom={},f}}),uW=T8((q,_)=>{var j=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];_.exports=function(K,Y){for(var f=0;f<Y.length;f++){K=JSON.parse(JSON.stringify(K));var P=Y[f].split("/"),$=K,w;for(w=1;w<P.length;w++)$=$[P[w]];for(w=0;w<j.length;w++){var O=j[w],z=$[O];if(z)$[O]={anyOf:[z,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}}}return K}}),hW=T8((q,_)=>{var j=F4().MissingRef;_.exports=K;function K(Y,f,P){var $=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");if(typeof f=="function")P=f,f=void 0;var w=O(Y).then(function(){var W=$._addSchema(Y,void 0,f);return W.validate||z(W)});if(P)w.then(function(W){P(null,W)},P);return w;function O(W){var v=W.$schema;return v&&!$.getSchema(v)?K.call($,{$ref:v},!0):Promise.resolve()}function z(W){try{return $._compile(W)}catch(H){if(H instanceof j)return v(H);throw H}function v(H){var T=H.missingSchema;if(A(T))throw new Error("Schema "+T+" is loaded but "+H.missingRef+" cannot be resolved");var J=$._loadingSchemas[T];if(!J)J=$._loadingSchemas[T]=$._opts.loadSchema(T),J.then(k,k);return J.then(function(G){if(!A(T))return O(G).then(function(){if(!A(T))$.addSchema(G,T,void 0,f)})}).then(function(){return z(W)});function k(){delete $._loadingSchemas[T]}function A(G){return $._refs[G]||$._schemas[G]}}}}}),CW=T8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,w=K.dataLevel,O=K.schema[Y],z=K.schemaPath+K.util.getProperty(Y),W=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,H,T="data"+(w||""),J="valid"+$,k="errs__"+$,A=K.opts.$data&&O&&O.$data,G;if(A)P+=" var schema"+$+" = "+K.util.getData(O.$data,w,K.dataPathArr)+"; ",G="schema"+$;else G=O;var u=this,V="definition"+$,m=u.definition,N="",R,p,b,d,y;if(A&&m.$data){y="keywordValidate"+$;var M=m.validateSchema;P+=" var "+V+" = RULES.custom['"+Y+"'].definition; var "+y+" = "+V+".validate;"}else{if(d=K.useCustomRule(u,O,K.schema,K),!d)return;G="validate.schema"+z,y=d.code,R=m.compile,p=m.inline,b=m.macro}var S=y+".errors",L="i"+$,c="ruleErr"+$,B=m.async;if(B&&!K.async)throw new Error("async keyword in sync schema");if(!(p||b))P+=""+S+" = null;";if(P+="var "+k+" = errors;var "+J+";",A&&m.$data){if(N+="}",P+=" if ("+G+" === undefined) { "+J+" = true; } else { ",M)N+="}",P+=" "+J+" = "+V+".validateSchema("+G+"); if ("+J+") { "}if(p)if(m.statements)P+=" "+d.validate+" ";else P+=" "+J+" = "+d.validate+"; ";else if(b){var e=K.util.copy(K),N="";e.level++;var f8="valid"+e.level;e.schema=d.validate,e.schemaPath="";var K8=K.compositeRule;K.compositeRule=e.compositeRule=!0;var z8=K.validate(e).replace(/validate\.schema/g,y);K.compositeRule=e.compositeRule=K8,P+=" "+z8}else{var O8=O8||[];if(O8.push(P),P="",P+=" "+y+".call( ",K.opts.passContext)P+="this";else P+="self";if(R||m.schema===!1)P+=" , "+T+" ";else P+=" , "+G+" , "+T+" , validate.schema"+K.schemaPath+" ";if(P+=" , (dataPath || '')",K.errorPath!='""')P+=" + "+K.errorPath;var j8=w?"data"+(w-1||""):"parentData",G8=w?K.dataPathArr[w]:"parentDataProperty";P+=" , "+j8+" , "+G8+" , rootData ) ";var t8=P;if(P=O8.pop(),m.errors===!1){if(P+=" "+J+" = ",B)P+="await ";P+=""+t8+"; "}else if(B)S="customErrors"+$,P+=" var "+S+" = null; try { "+J+" = await "+t8+"; } catch (e) { "+J+" = false; if (e instanceof ValidationError) "+S+" = e.errors; else throw e; } ";else P+=" "+S+" = null; "+J+" = "+t8+"; "}if(m.modifying)P+=" if ("+j8+") "+T+" = "+j8+"["+G8+"];";if(P+=""+N,m.valid){if(v)P+=" if (true) { "}else{if(P+=" if ( ",m.valid===void 0)if(P+=" !",b)P+=""+f8;else P+=""+J;else P+=" "+!m.valid+" ";P+=") { ",H=u.keyword;var O8=O8||[];O8.push(P),P="";var O8=O8||[];if(O8.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(H||"custom")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { keyword: '"+u.keyword+"' } ",K.opts.messages!==!1)P+=` , message: 'should pass "`+u.keyword+`" keyword validation' `;if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+T+" ";P+=" } "}else P+=" {} ";var s8=P;if(P=O8.pop(),!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(["+s8+"]); ";else P+=" validate.errors = ["+s8+"]; return false; ";else P+=" var err = "+s8+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var C=P;if(P=O8.pop(),p)if(m.errors){if(m.errors!="full"){if(P+=" for (var "+L+"="+k+"; "+L+"<errors; "+L+"++) { var "+c+" = vErrors["+L+"]; if ("+c+".dataPath === undefined) "+c+".dataPath = (dataPath || '') + "+K.errorPath+"; if ("+c+".schemaPath === undefined) { "+c+'.schemaPath = "'+W+'"; } ',K.opts.verbose)P+=" "+c+".schema = "+G+"; "+c+".data = "+T+"; ";P+=" } "}}else if(m.errors===!1)P+=" "+C+" ";else{if(P+=" if ("+k+" == errors) { "+C+" } else { for (var "+L+"="+k+"; "+L+"<errors; "+L+"++) { var "+c+" = vErrors["+L+"]; if ("+c+".dataPath === undefined) "+c+".dataPath = (dataPath || '') + "+K.errorPath+"; if ("+c+".schemaPath === undefined) { "+c+'.schemaPath = "'+W+'"; } ',K.opts.verbose)P+=" "+c+".schema = "+G+"; "+c+".data = "+T+"; ";P+=" } } "}else if(b){if(P+=" var err = ",K.createErrors!==!1){if(P+=" { keyword: '"+(H||"custom")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(W)+" , params: { keyword: '"+u.keyword+"' } ",K.opts.messages!==!1)P+=` , message: 'should pass "`+u.keyword+`" keyword validation' `;if(K.opts.verbose)P+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+T+" ";P+=" } "}else P+=" {} ";if(P+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!K.compositeRule&&v)if(K.async)P+=" throw new ValidationError(vErrors); ";else P+=" validate.errors = vErrors; return false; "}else if(m.errors===!1)P+=" "+C+" ";else{if(P+=" if (Array.isArray("+S+")) { if (vErrors === null) vErrors = "+S+"; else vErrors = vErrors.concat("+S+"); errors = vErrors.length; for (var "+L+"="+k+"; "+L+"<errors; "+L+"++) { var "+c+" = vErrors["+L+"]; if ("+c+".dataPath === undefined) "+c+".dataPath = (dataPath || '') + "+K.errorPath+"; "+c+'.schemaPath = "'+W+'"; ',K.opts.verbose)P+=" "+c+".schema = "+G+"; "+c+".data = "+T+"; ";P+=" } } else { "+C+" } "}if(P+=" } ",v)P+=" else { "}return P}}),b1=T8((q,_)=>{_.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),DW=T8((q,_)=>{var j=b1();_.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:j.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:j.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}}),VW=T8((q,_)=>{var j=/^[a-z_$][a-z0-9_$-]*$/i,K=CW(),Y=DW();_.exports={add:f,get:P,remove:$,validate:w};function f(O,z){var W=this.RULES;if(W.keywords[O])throw new Error("Keyword "+O+" is already defined");if(!j.test(O))throw new Error("Keyword "+O+" is not a valid identifier");if(z){this.validateKeyword(z,!0);var v=z.type;if(Array.isArray(v))for(var H=0;H<v.length;H++)J(O,v[H],z);else J(O,v,z);var T=z.metaSchema;if(T){if(z.$data&&this._opts.$data)T={anyOf:[T,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]};z.validateSchema=this.compile(T,!0)}}W.keywords[O]=W.all[O]=!0;function J(k,A,G){var u;for(var V=0;V<W.length;V++){var m=W[V];if(m.type==A){u=m;break}}if(!u)u={type:A,rules:[]},W.push(u);var N={keyword:k,definition:G,custom:!0,code:K,implements:G.implements};u.rules.push(N),W.custom[k]=N}return this}function P(O){var z=this.RULES.custom[O];return z?z.definition:this.RULES.keywords[O]||!1}function $(O){var z=this.RULES;delete z.keywords[O],delete z.all[O],delete z.custom[O];for(var W=0;W<z.length;W++){var v=z[W].rules;for(var H=0;H<v.length;H++)if(v[H].keyword==O){v.splice(H,1);break}}return this}function w(O,z){w.errors=null;var W=this._validateKeyword=this._validateKeyword||this.compile(Y,!0);if(W(O))return!0;if(w.errors=W.errors,z)throw new Error("custom keyword definition is invalid: "+this.errorsText(W.errors));else return!1}}),MW=T8((q,_)=>{_.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),NW=T8((q,_)=>{var j=Uz(),K=t4(),Y=sz(),f=V1(),P=M1(),$=Qz(),w=GW(),O=uW(),z=JK();_.exports=k,k.prototype.validate=A,k.prototype.compile=G,k.prototype.addSchema=u,k.prototype.addMetaSchema=V,k.prototype.validateSchema=m,k.prototype.getSchema=R,k.prototype.removeSchema=d,k.prototype.addFormat=K8,k.prototype.errorsText=f8,k.prototype._addSchema=M,k.prototype._compile=S,k.prototype.compileAsync=hW();var W=VW();k.prototype.addKeyword=W.add,k.prototype.getKeyword=W.get,k.prototype.removeKeyword=W.remove,k.prototype.validateKeyword=W.validate;var v=F4();k.ValidationError=v.Validation,k.MissingRefError=v.MissingRef,k.$dataMetaSchema=O;var H="http://json-schema.org/draft-07/schema",T=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],J=["/properties"];function k(Z){if(!(this instanceof k))return new k(Z);if(Z=this._opts=z.copy(Z)||{},C(this),this._schemas={},this._refs={},this._fragments={},this._formats=$(Z.format),this._cache=Z.cache||new Y,this._loadingSchemas={},this._compilations=[],this.RULES=w(),this._getId=L(Z),Z.loopRequired=Z.loopRequired||1/0,Z.errorDataPath=="property")Z._errorDataPathProperty=!0;if(Z.serialize===void 0)Z.serialize=P;if(this._metaOpts=s8(this),Z.formats)j8(this);if(Z.keywords)G8(this);if(z8(this),typeof Z.meta=="object")this.addMetaSchema(Z.meta);if(Z.nullable)this.addKeyword("nullable",{metaSchema:{type:"boolean"}});O8(this)}function A(Z,E){var x;if(typeof Z=="string"){if(x=this.getSchema(Z),!x)throw new Error('no schema with key or ref "'+Z+'"')}else{var i=this._addSchema(Z);x=i.validate||this._compile(i)}var r=x(E);if(x.$async!==!0)this.errors=x.errors;return r}function G(Z,E){var x=this._addSchema(Z,void 0,E);return x.validate||this._compile(x)}function u(Z,E,x,i){if(Array.isArray(Z)){for(var r=0;r<Z.length;r++)this.addSchema(Z[r],void 0,x,i);return this}var a=this._getId(Z);if(a!==void 0&&typeof a!="string")throw new Error("schema id must be string");return E=K.normalizeId(E||a),t8(this,E),this._schemas[E]=this._addSchema(Z,x,i,!0),this}function V(Z,E,x){return this.addSchema(Z,E,x,!0),this}function m(Z,E){var x=Z.$schema;if(x!==void 0&&typeof x!="string")throw new Error("$schema must be a string");if(x=x||this._opts.defaultMeta||N(this),!x)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var i=this.validate(x,Z);if(!i&&E){var r="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(r);else throw new Error(r)}return i}function N(Z){var E=Z._opts.meta;return Z._opts.defaultMeta=typeof E=="object"?Z._getId(E)||E:Z.getSchema(H)?H:void 0,Z._opts.defaultMeta}function R(Z){var E=b(this,Z);switch(typeof E){case"object":return E.validate||this._compile(E);case"string":return this.getSchema(E);case"undefined":return p(this,Z)}}function p(Z,E){var x=K.schema.call(Z,{schema:{}},E);if(x){var{schema:i,root:r,baseId:a}=x,Y8=j.call(Z,i,r,void 0,a);return Z._fragments[E]=new f({ref:E,fragment:!0,schema:i,root:r,baseId:a,validate:Y8}),Y8}}function b(Z,E){return E=K.normalizeId(E),Z._schemas[E]||Z._refs[E]||Z._fragments[E]}function d(Z){if(Z instanceof RegExp)return y(this,this._schemas,Z),y(this,this._refs,Z),this;switch(typeof Z){case"undefined":return y(this,this._schemas),y(this,this._refs),this._cache.clear(),this;case"string":var E=b(this,Z);if(E)this._cache.del(E.cacheKey);return delete this._schemas[Z],delete this._refs[Z],this;case"object":var x=this._opts.serialize,i=x?x(Z):Z;this._cache.del(i);var r=this._getId(Z);if(r)r=K.normalizeId(r),delete this._schemas[r],delete this._refs[r]}return this}function y(Z,E,x){for(var i in E){var r=E[i];if(!r.meta&&(!x||x.test(i)))Z._cache.del(r.cacheKey),delete E[i]}}function M(Z,E,x,i){if(typeof Z!="object"&&typeof Z!="boolean")throw new Error("schema should be object or boolean");var r=this._opts.serialize,a=r?r(Z):Z,Y8=this._cache.get(a);if(Y8)return Y8;i=i||this._opts.addUsedSchema!==!1;var H8=K.normalizeId(this._getId(Z));if(H8&&i)t8(this,H8);var w8=this._opts.validateSchema!==!1&&!E,A8;if(w8&&!(A8=H8&&H8==K.normalizeId(Z.$schema)))this.validateSchema(Z,!0);var L8=K.ids.call(this,Z),M8=new f({id:H8,schema:Z,localRefs:L8,cacheKey:a,meta:x});if(H8[0]!="#"&&i)this._refs[H8]=M8;if(this._cache.put(a,M8),w8&&A8)this.validateSchema(Z,!0);return M8}function S(Z,E){if(Z.compiling){if(Z.validate=r,r.schema=Z.schema,r.errors=null,r.root=E?E:r,Z.schema.$async===!0)r.$async=!0;return r}Z.compiling=!0;var x;if(Z.meta)x=this._opts,this._opts=this._metaOpts;var i;try{i=j.call(this,Z.schema,E,Z.localRefs)}catch(a){throw delete Z.validate,a}finally{if(Z.compiling=!1,Z.meta)this._opts=x}return Z.validate=i,Z.refs=i.refs,Z.refVal=i.refVal,Z.root=i.root,i;function r(){var a=Z.validate,Y8=a.apply(this,arguments);return r.errors=a.errors,Y8}}function L(Z){switch(Z.schemaId){case"auto":return e;case"id":return c;default:return B}}function c(Z){if(Z.$id)this.logger.warn("schema $id ignored",Z.$id);return Z.id}function B(Z){if(Z.id)this.logger.warn("schema id ignored",Z.id);return Z.$id}function e(Z){if(Z.$id&&Z.id&&Z.$id!=Z.id)throw new Error("schema $id is different from id");return Z.$id||Z.id}function f8(Z,E){if(Z=Z||this.errors,!Z)return"No errors";E=E||{};var x=E.separator===void 0?", ":E.separator,i=E.dataVar===void 0?"data":E.dataVar,r="";for(var a=0;a<Z.length;a++){var Y8=Z[a];if(Y8)r+=i+Y8.dataPath+" "+Y8.message+x}return r.slice(0,-x.length)}function K8(Z,E){if(typeof E=="string")E=new RegExp(E);return this._formats[Z]=E,this}function z8(Z){var E;if(Z._opts.$data)E=MW(),Z.addMetaSchema(E,E.$id,!0);if(Z._opts.meta===!1)return;var x=b1();if(Z._opts.$data)x=O(x,J);Z.addMetaSchema(x,H,!0),Z._refs["http://json-schema.org/schema"]=H}function O8(Z){var E=Z._opts.schemas;if(!E)return;if(Array.isArray(E))Z.addSchema(E);else for(var x in E)Z.addSchema(E[x],x)}function j8(Z){for(var E in Z._opts.formats){var x=Z._opts.formats[E];Z.addFormat(E,x)}}function G8(Z){for(var E in Z._opts.keywords){var x=Z._opts.keywords[E];Z.addKeyword(E,x)}}function t8(Z,E){if(Z._schemas[E]||Z._refs[E])throw new Error('schema with key or id "'+E+'" already exists')}function s8(Z){var E=z.copy(Z._opts);for(var x=0;x<T.length;x++)delete E[T[x]];return E}function C(Z){var E=Z._opts.logger;if(E===!1)Z.logger={log:D,warn:D,error:D};else{if(E===void 0)E=console;if(!(typeof E=="object"&&E.log&&E.warn&&E.error))throw new Error("logger must implement log, warn and error methods");Z.logger=E}}function D(){}});gW={accessSync(q,_){J8.accessSync(q,_)},cwd(){return process.cwd()},chmodSync(q,_){J8.chmodSync(q,_)},existsSync(q){return J8.existsSync(q)},async stat(q){return mW(q)},statSync(q){return J8.statSync(q)},readFileSync(q,_){return J8.readFileSync(q,{encoding:_.encoding})},readFileBytesSync(q){return J8.readFileSync(q)},readSync(q,_){let j=void 0;try{j=J8.openSync(q,"r");let K=Buffer.alloc(_.length),Y=J8.readSync(j,K,0,_.length,0);return{buffer:K,bytesRead:Y}}finally{if(j)J8.closeSync(j)}},writeFileSync(q,_,j){if(!j.flush){J8.writeFileSync(q,_,{encoding:j.encoding});return}let K;try{K=J8.openSync(q,"w"),J8.writeFileSync(K,_,{encoding:j.encoding}),J8.fsyncSync(K)}finally{if(K)J8.closeSync(K)}},appendFileSync(q,_){J8.appendFileSync(q,_)},copyFileSync(q,_){J8.copyFileSync(q,_)},unlinkSync(q){J8.unlinkSync(q)},renameSync(q,_){J8.renameSync(q,_)},symlinkSync(q,_){J8.symlinkSync(q,_)},readlinkSync(q){return J8.readlinkSync(q)},realpathSync(q){return J8.realpathSync(q)},mkdirSync(q){if(!J8.existsSync(q))J8.mkdirSync(q,{recursive:!0})},readdirSync(q){return J8.readdirSync(q,{withFileTypes:!0})},readdirStringSync(q){return J8.readdirSync(q)},isDirEmptySync(q){return this.readdirSync(q).length===0},rmdirSync(q){J8.rmdirSync(q)},rmSync(q,_){J8.rmSync(q,_)}},yW=gW;Q_=class Q_ extends Error{};R1=class R1{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(q){this.returned=q}[Symbol.asyncIterator](){if(this.started)throw new Error("Stream can only be iterated once");return this.started=!0,this}next(){if(this.queue.length>0)return Promise.resolve({done:!1,value:this.queue.shift()});if(this.isDone)return Promise.resolve({done:!0,value:void 0});if(this.hasError)return Promise.reject(this.hasError);return new Promise((q,_)=>{this.readResolve=q,this.readReject=_})}enqueue(q){if(this.readResolve){let _=this.readResolve;this.readResolve=void 0,this.readReject=void 0,_({done:!1,value:q})}else this.queue.push(q)}done(){if(this.isDone=!0,this.readResolve){let q=this.readResolve;this.readResolve=void 0,this.readReject=void 0,q({done:!0,value:void 0})}}error(q){if(this.hasError=q,this.readReject){let _=this.readReject;this.readResolve=void 0,this.readReject=void 0,_(q)}}return(){if(this.isDone=!0,this.returned)this.returned();return Promise.resolve({done:!0,value:void 0})}};m1=class m1{transport;isStreamingMode;canUseTool;hooks;abortController;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new R1;intialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;pendingMcpResponses=new Map;constructor(q,_,j,K,Y,f=new Map){this.transport=q,this.isStreamingMode=_,this.canUseTool=j,this.hooks=K,this.abortController=Y;for(let[P,$]of f){let w=new I1((O)=>this.sendMcpServerMessageToCli(P,O));this.sdkMcpTransports.set(P,w),$.connect(w)}if(this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.isStreamingMode)this.intialization=this.initialize()}setError(q){this.inputStream.error(q)}cleanup(q){if(this.cleanupPerformed)return;this.cleanupPerformed=!0;try{if(this.transport.close(),this.pendingControlResponses.clear(),this.pendingMcpResponses.clear(),q)this.inputStream.error(q);else this.inputStream.done()}catch(_){}}next(...[q]){return this.sdkMessages.next(...[q])}return(q){return this.sdkMessages.return(q)}throw(q){return this.sdkMessages.throw(q)}[Symbol.asyncIterator](){return this.sdkMessages}[Symbol.asyncDispose](){return this.sdkMessages[Symbol.asyncDispose]()}async readMessages(){try{for await(let q of this.transport.readMessages()){if(q.type==="control_response"){let _=this.pendingControlResponses.get(q.response.request_id);if(_)_(q.response);continue}else if(q.type==="control_request"){this.handleControlRequest(q);continue}else if(q.type==="control_cancel_request"){this.handleControlCancelRequest(q);continue}this.inputStream.enqueue(q)}this.inputStream.done(),this.cleanup()}catch(q){this.inputStream.error(q),this.cleanup(q)}}async handleControlRequest(q){let _=new AbortController;this.cancelControllers.set(q.request_id,_);try{let j=await this.processControlRequest(q,_.signal),K={type:"control_response",response:{subtype:"success",request_id:q.request_id,response:j}};await Promise.resolve(this.transport.write(JSON.stringify(K)+`
`))}catch(j){let K={type:"control_response",response:{subtype:"error",request_id:q.request_id,error:j.message||String(j)}};await Promise.resolve(this.transport.write(JSON.stringify(K)+`
`))}finally{this.cancelControllers.delete(q.request_id)}}handleControlCancelRequest(q){let _=this.cancelControllers.get(q.request_id);if(_)_.abort(),this.cancelControllers.delete(q.request_id)}async processControlRequest(q,_){if(q.request.subtype==="can_use_tool"){if(!this.canUseTool)throw new Error("canUseTool callback is not provided.");return this.canUseTool(q.request.tool_name,q.request.input,{signal:_,suggestions:q.request.permission_suggestions})}else if(q.request.subtype==="hook_callback")return await this.handleHookCallbacks(q.request.callback_id,q.request.input,q.request.tool_use_id,_);else if(q.request.subtype==="mcp_message"){let j=q.request,K=this.sdkMcpTransports.get(j.server_name);if(!K)throw new Error(`SDK MCP server not found: ${j.server_name}`);if("method"in j.message&&"id"in j.message&&j.message.id!==null)return{mcp_response:await this.handleMcpControlRequest(j.server_name,j,K)};else{if(K.onmessage)K.onmessage(j.message);return{mcp_response:{jsonrpc:"2.0",result:{},id:0}}}}throw new Error("Unsupported control request subtype: "+q.request.subtype)}async*readSdkMessages(){for await(let q of this.inputStream)yield q}async initialize(){let q;if(this.hooks){q={};for(let[K,Y]of Object.entries(this.hooks))if(Y.length>0)q[K]=Y.map((f)=>{let P=[];for(let $ of f.hooks){let w=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(w,$),P.push(w)}return{matcher:f.matcher,hookCallbackIds:P}})}let _={subtype:"initialize",hooks:q};return(await this.request(_)).response}async interrupt(){if(!this.isStreamingMode)throw new Error("Interrupt requires --input-format stream-json");await this.request({subtype:"interrupt"})}async setPermissionMode(q){if(!this.isStreamingMode)throw new Error("setPermissionMode requires --input-format stream-json");await this.request({subtype:"set_permission_mode",mode:q})}request(q){let _=Math.random().toString(36).substring(2,15),j={request_id:_,type:"control_request",request:q};return new Promise((K,Y)=>{this.pendingControlResponses.set(_,(f)=>{if(f.subtype==="success")K(f);else Y(new Error(f.error))}),Promise.resolve(this.transport.write(JSON.stringify(j)+`
`))})}async supportedCommands(){if(!this.isStreamingMode)throw new Error("supportedCommands requires --input-format stream-json");if(!this.intialization)throw new Error("supportedCommands requires transport with bidirectional communication");return(await this.intialization).commands}async streamInput(q){try{for await(let _ of q){if(this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(JSON.stringify(_)+`
`))}this.transport.endInput()}catch(_){if(!(_ instanceof Q_))throw _}}handleHookCallbacks(q,_,j,K){let Y=this.hookCallbacks.get(q);if(!Y)throw new Error(`No hook callback found for ID: ${q}`);return Y(_,j,{signal:K})}sendMcpServerMessageToCli(q,_){if("id"in _&&_.id!==null&&_.id!==void 0){let j=`${q}:${_.id}`,K=this.pendingMcpResponses.get(j);if(K){K.resolve(_),this.pendingMcpResponses.delete(j);return}}throw new Error("No pending request found")}handleMcpControlRequest(q,_,j){let K="id"in _.message?_.message.id:null,Y=`${q}:${K}`;return new Promise((f,P)=>{let $=null,w=()=>{if($)clearTimeout($);this.pendingMcpResponses.delete(Y)},O=(W)=>{w(),f(W)},z=(W)=>{w(),P(W)};if(this.pendingMcpResponses.set(Y,{resolve:O,reject:z}),j.onmessage)j.onmessage(_.message);else{w(),P(new Error("No message handler registered"));return}$=setTimeout(()=>{if(this.pendingMcpResponses.has(Y))w(),P(new Error("Request timeout"))},30000)})}};X={};Bz(X,{void:()=>Gv,util:()=>h8,unknown:()=>Xv,union:()=>Dv,undefined:()=>Tv,tuple:()=>Nv,transformer:()=>C1,symbol:()=>Jv,string:()=>x1,strictObject:()=>Cv,setErrorMap:()=>lW,set:()=>Ev,record:()=>bv,quotelessJson:()=>LW,promise:()=>dv,preprocess:()=>lv,pipeline:()=>xv,ostring:()=>nv,optional:()=>Lv,onumber:()=>cv,oboolean:()=>rv,objectUtil:()=>n4,object:()=>hv,number:()=>n1,nullable:()=>pv,null:()=>Zv,never:()=>Av,nativeEnum:()=>yv,nan:()=>Wv,map:()=>Sv,makeIssue:()=>Y7,literal:()=>mv,lazy:()=>Iv,late:()=>wv,isValid:()=>X_,isDirty:()=>r4,isAsync:()=>FK,isAborted:()=>c4,intersection:()=>Mv,instanceof:()=>zv,getParsedType:()=>pq,getErrorMap:()=>P7,function:()=>Rv,enum:()=>gv,effect:()=>C1,discriminatedUnion:()=>Vv,defaultErrorMap:()=>KK,datetimeRegex:()=>L1,date:()=>Hv,custom:()=>l1,coerce:()=>iv,boolean:()=>c1,bigint:()=>vv,array:()=>uv,any:()=>kv,addIssueToContext:()=>U,ZodVoid:()=>UK,ZodUnknown:()=>Uq,ZodUnion:()=>fK,ZodUndefined:()=>PK,ZodType:()=>k8,ZodTuple:()=>Cq,ZodTransformer:()=>e6,ZodSymbol:()=>eK,ZodString:()=>Oq,ZodSet:()=>u_,ZodSchema:()=>k8,ZodRecord:()=>sK,ZodReadonly:()=>HK,ZodPromise:()=>h_,ZodPipeline:()=>_3,ZodParsedType:()=>Q,ZodOptional:()=>zq,ZodObject:()=>B8,ZodNumber:()=>sq,ZodNullable:()=>lq,ZodNull:()=>YK,ZodNever:()=>hq,ZodNativeEnum:()=>zK,ZodNaN:()=>q3,ZodMap:()=>QK,ZodLiteral:()=>wK,ZodLazy:()=>OK,ZodIssueCode:()=>t,ZodIntersection:()=>$K,ZodFunction:()=>_K,ZodFirstPartyTypeKind:()=>v8,ZodError:()=>l6,ZodEnum:()=>q_,ZodEffects:()=>e6,ZodDiscriminatedUnion:()=>f7,ZodDefault:()=>WK,ZodDate:()=>A_,ZodCatch:()=>vK,ZodBranded:()=>$7,ZodBoolean:()=>jK,ZodBigInt:()=>Qq,ZodArray:()=>wq,ZodAny:()=>G_,Schema:()=>k8,ParseStatus:()=>A6,OK:()=>M6,NEVER:()=>ov,INVALID:()=>W8,EMPTY_PATH:()=>xW,DIRTY:()=>qK,BRAND:()=>Ov});(function(q){q.assertEqual=(Y)=>{};function _(Y){}q.assertIs=_;function j(Y){throw new Error}q.assertNever=j,q.arrayToEnum=(Y)=>{let f={};for(let P of Y)f[P]=P;return f},q.getValidEnumValues=(Y)=>{let f=q.objectKeys(Y).filter(($)=>typeof Y[Y[$]]!=="number"),P={};for(let $ of f)P[$]=Y[$];return q.objectValues(P)},q.objectValues=(Y)=>{return q.objectKeys(Y).map(function(f){return Y[f]})},q.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let f=[];for(let P in Y)if(Object.prototype.hasOwnProperty.call(Y,P))f.push(P);return f},q.find=(Y,f)=>{for(let P of Y)if(f(P))return P;return},q.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function K(Y,f=" | "){return Y.map((P)=>typeof P==="string"?`'${P}'`:P).join(f)}q.joinValues=K,q.jsonStringifyReplacer=(Y,f)=>{if(typeof f==="bigint")return f.toString();return f}})(h8||(h8={}));(function(q){q.mergeShapes=(_,j)=>{return{..._,...j}}})(n4||(n4={}));Q=h8.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),t=h8.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);l6=class l6 extends Error{get errors(){return this.issues}constructor(q){super();this.issues=[],this.addIssue=(j)=>{this.issues=[...this.issues,j]},this.addIssues=(j=[])=>{this.issues=[...this.issues,...j]};let _=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,_);else this.__proto__=_;this.name="ZodError",this.issues=q}format(q){let _=q||function(Y){return Y.message},j={_errors:[]},K=(Y)=>{for(let f of Y.issues)if(f.code==="invalid_union")f.unionErrors.map(K);else if(f.code==="invalid_return_type")K(f.returnTypeError);else if(f.code==="invalid_arguments")K(f.argumentsError);else if(f.path.length===0)j._errors.push(_(f));else{let P=j,$=0;while($<f.path.length){let w=f.path[$];if($!==f.path.length-1)P[w]=P[w]||{_errors:[]};else P[w]=P[w]||{_errors:[]},P[w]._errors.push(_(f));P=P[w],$++}}};return K(this),j}static assert(q){if(!(q instanceof l6))throw new Error(`Not a ZodError: ${q}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,h8.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(q=(_)=>_.message){let _={},j=[];for(let K of this.issues)if(K.path.length>0){let Y=K.path[0];_[Y]=_[Y]||[],_[Y].push(q(K))}else j.push(q(K));return{formErrors:j,fieldErrors:_}}get formErrors(){return this.flatten()}};l6.create=(q)=>{return new l6(q)};KK=pW,g1=KK;xW=[];W8=Object.freeze({status:"aborted"});(function(q){q.errToObj=(_)=>typeof _==="string"?{message:_}:_||{},q.toString=(_)=>typeof _==="string"?_:_?.message})($8||($8={}));nW=/^c[^\s-]{8,}$/i,cW=/^[0-9a-z]+$/,rW=/^[0-9A-HJKMNP-TV-Z]{26}$/i,iW=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,oW=/^[a-z0-9_-]{21}$/i,aW=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,BW=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,tW=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,eW=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,UW=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,sW=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,QW=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_v=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Kv=new RegExp(`^${y1}$`);Oq=class Oq extends k8{_parse(q){if(this._def.coerce)q.data=String(q.data);if(this._getType(q)!==Q.string){let Y=this._getOrReturnCtx(q);return U(Y,{code:t.invalid_type,expected:Q.string,received:Y.parsedType}),W8}let j=new A6,K=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(q.data.length<Y.value)K=this._getOrReturnCtx(q,K),U(K,{code:t.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),j.dirty()}else if(Y.kind==="max"){if(q.data.length>Y.value)K=this._getOrReturnCtx(q,K),U(K,{code:t.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),j.dirty()}else if(Y.kind==="length"){let f=q.data.length>Y.value,P=q.data.length<Y.value;if(f||P){if(K=this._getOrReturnCtx(q,K),f)U(K,{code:t.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(P)U(K,{code:t.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});j.dirty()}}else if(Y.kind==="email"){if(!tW.test(q.data))K=this._getOrReturnCtx(q,K),U(K,{validation:"email",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="emoji"){if(!l4)l4=new RegExp(FW,"u");if(!l4.test(q.data))K=this._getOrReturnCtx(q,K),U(K,{validation:"emoji",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="uuid"){if(!iW.test(q.data))K=this._getOrReturnCtx(q,K),U(K,{validation:"uuid",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="nanoid"){if(!oW.test(q.data))K=this._getOrReturnCtx(q,K),U(K,{validation:"nanoid",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="cuid"){if(!nW.test(q.data))K=this._getOrReturnCtx(q,K),U(K,{validation:"cuid",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="cuid2"){if(!cW.test(q.data))K=this._getOrReturnCtx(q,K),U(K,{validation:"cuid2",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="ulid"){if(!rW.test(q.data))K=this._getOrReturnCtx(q,K),U(K,{validation:"ulid",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="url")try{new URL(q.data)}catch{K=this._getOrReturnCtx(q,K),U(K,{validation:"url",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="regex"){if(Y.regex.lastIndex=0,!Y.regex.test(q.data))K=this._getOrReturnCtx(q,K),U(K,{validation:"regex",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="trim")q.data=q.data.trim();else if(Y.kind==="includes"){if(!q.data.includes(Y.value,Y.position))K=this._getOrReturnCtx(q,K),U(K,{code:t.invalid_string,validation:{includes:Y.value,position:Y.position},message:Y.message}),j.dirty()}else if(Y.kind==="toLowerCase")q.data=q.data.toLowerCase();else if(Y.kind==="toUpperCase")q.data=q.data.toUpperCase();else if(Y.kind==="startsWith"){if(!q.data.startsWith(Y.value))K=this._getOrReturnCtx(q,K),U(K,{code:t.invalid_string,validation:{startsWith:Y.value},message:Y.message}),j.dirty()}else if(Y.kind==="endsWith"){if(!q.data.endsWith(Y.value))K=this._getOrReturnCtx(q,K),U(K,{code:t.invalid_string,validation:{endsWith:Y.value},message:Y.message}),j.dirty()}else if(Y.kind==="datetime"){if(!L1(Y).test(q.data))K=this._getOrReturnCtx(q,K),U(K,{code:t.invalid_string,validation:"datetime",message:Y.message}),j.dirty()}else if(Y.kind==="date"){if(!Kv.test(q.data))K=this._getOrReturnCtx(q,K),U(K,{code:t.invalid_string,validation:"date",message:Y.message}),j.dirty()}else if(Y.kind==="time"){if(!jv(Y).test(q.data))K=this._getOrReturnCtx(q,K),U(K,{code:t.invalid_string,validation:"time",message:Y.message}),j.dirty()}else if(Y.kind==="duration"){if(!BW.test(q.data))K=this._getOrReturnCtx(q,K),U(K,{validation:"duration",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="ip"){if(!Pv(q.data,Y.version))K=this._getOrReturnCtx(q,K),U(K,{validation:"ip",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="jwt"){if(!Yv(q.data,Y.alg))K=this._getOrReturnCtx(q,K),U(K,{validation:"jwt",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="cidr"){if(!fv(q.data,Y.version))K=this._getOrReturnCtx(q,K),U(K,{validation:"cidr",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="base64"){if(!qv.test(q.data))K=this._getOrReturnCtx(q,K),U(K,{validation:"base64",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="base64url"){if(!_v.test(q.data))K=this._getOrReturnCtx(q,K),U(K,{validation:"base64url",code:t.invalid_string,message:Y.message}),j.dirty()}else h8.assertNever(Y);return{status:j.value,value:q.data}}_regex(q,_,j){return this.refinement((K)=>q.test(K),{validation:_,code:t.invalid_string,...$8.errToObj(j)})}_addCheck(q){return new Oq({...this._def,checks:[...this._def.checks,q]})}email(q){return this._addCheck({kind:"email",...$8.errToObj(q)})}url(q){return this._addCheck({kind:"url",...$8.errToObj(q)})}emoji(q){return this._addCheck({kind:"emoji",...$8.errToObj(q)})}uuid(q){return this._addCheck({kind:"uuid",...$8.errToObj(q)})}nanoid(q){return this._addCheck({kind:"nanoid",...$8.errToObj(q)})}cuid(q){return this._addCheck({kind:"cuid",...$8.errToObj(q)})}cuid2(q){return this._addCheck({kind:"cuid2",...$8.errToObj(q)})}ulid(q){return this._addCheck({kind:"ulid",...$8.errToObj(q)})}base64(q){return this._addCheck({kind:"base64",...$8.errToObj(q)})}base64url(q){return this._addCheck({kind:"base64url",...$8.errToObj(q)})}jwt(q){return this._addCheck({kind:"jwt",...$8.errToObj(q)})}ip(q){return this._addCheck({kind:"ip",...$8.errToObj(q)})}cidr(q){return this._addCheck({kind:"cidr",...$8.errToObj(q)})}datetime(q){if(typeof q==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:q});return this._addCheck({kind:"datetime",precision:typeof q?.precision==="undefined"?null:q?.precision,offset:q?.offset??!1,local:q?.local??!1,...$8.errToObj(q?.message)})}date(q){return this._addCheck({kind:"date",message:q})}time(q){if(typeof q==="string")return this._addCheck({kind:"time",precision:null,message:q});return this._addCheck({kind:"time",precision:typeof q?.precision==="undefined"?null:q?.precision,...$8.errToObj(q?.message)})}duration(q){return this._addCheck({kind:"duration",...$8.errToObj(q)})}regex(q,_){return this._addCheck({kind:"regex",regex:q,...$8.errToObj(_)})}includes(q,_){return this._addCheck({kind:"includes",value:q,position:_?.position,...$8.errToObj(_?.message)})}startsWith(q,_){return this._addCheck({kind:"startsWith",value:q,...$8.errToObj(_)})}endsWith(q,_){return this._addCheck({kind:"endsWith",value:q,...$8.errToObj(_)})}min(q,_){return this._addCheck({kind:"min",value:q,...$8.errToObj(_)})}max(q,_){return this._addCheck({kind:"max",value:q,...$8.errToObj(_)})}length(q,_){return this._addCheck({kind:"length",value:q,...$8.errToObj(_)})}nonempty(q){return this.min(1,$8.errToObj(q))}trim(){return new Oq({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Oq({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Oq({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((q)=>q.kind==="datetime")}get isDate(){return!!this._def.checks.find((q)=>q.kind==="date")}get isTime(){return!!this._def.checks.find((q)=>q.kind==="time")}get isDuration(){return!!this._def.checks.find((q)=>q.kind==="duration")}get isEmail(){return!!this._def.checks.find((q)=>q.kind==="email")}get isURL(){return!!this._def.checks.find((q)=>q.kind==="url")}get isEmoji(){return!!this._def.checks.find((q)=>q.kind==="emoji")}get isUUID(){return!!this._def.checks.find((q)=>q.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((q)=>q.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((q)=>q.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((q)=>q.kind==="cuid2")}get isULID(){return!!this._def.checks.find((q)=>q.kind==="ulid")}get isIP(){return!!this._def.checks.find((q)=>q.kind==="ip")}get isCIDR(){return!!this._def.checks.find((q)=>q.kind==="cidr")}get isBase64(){return!!this._def.checks.find((q)=>q.kind==="base64")}get isBase64url(){return!!this._def.checks.find((q)=>q.kind==="base64url")}get minLength(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxLength(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value<q)q=_.value}return q}};Oq.create=(q)=>{return new Oq({checks:[],typeName:v8.ZodString,coerce:q?.coerce??!1,...Z8(q)})};sq=class sq extends k8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(q){if(this._def.coerce)q.data=Number(q.data);if(this._getType(q)!==Q.number){let Y=this._getOrReturnCtx(q);return U(Y,{code:t.invalid_type,expected:Q.number,received:Y.parsedType}),W8}let j=void 0,K=new A6;for(let Y of this._def.checks)if(Y.kind==="int"){if(!h8.isInteger(q.data))j=this._getOrReturnCtx(q,j),U(j,{code:t.invalid_type,expected:"integer",received:"float",message:Y.message}),K.dirty()}else if(Y.kind==="min"){if(Y.inclusive?q.data<Y.value:q.data<=Y.value)j=this._getOrReturnCtx(q,j),U(j,{code:t.too_small,minimum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),K.dirty()}else if(Y.kind==="max"){if(Y.inclusive?q.data>Y.value:q.data>=Y.value)j=this._getOrReturnCtx(q,j),U(j,{code:t.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),K.dirty()}else if(Y.kind==="multipleOf"){if($v(q.data,Y.value)!==0)j=this._getOrReturnCtx(q,j),U(j,{code:t.not_multiple_of,multipleOf:Y.value,message:Y.message}),K.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite(q.data))j=this._getOrReturnCtx(q,j),U(j,{code:t.not_finite,message:Y.message}),K.dirty()}else h8.assertNever(Y);return{status:K.value,value:q.data}}gte(q,_){return this.setLimit("min",q,!0,$8.toString(_))}gt(q,_){return this.setLimit("min",q,!1,$8.toString(_))}lte(q,_){return this.setLimit("max",q,!0,$8.toString(_))}lt(q,_){return this.setLimit("max",q,!1,$8.toString(_))}setLimit(q,_,j,K){return new sq({...this._def,checks:[...this._def.checks,{kind:q,value:_,inclusive:j,message:$8.toString(K)}]})}_addCheck(q){return new sq({...this._def,checks:[...this._def.checks,q]})}int(q){return this._addCheck({kind:"int",message:$8.toString(q)})}positive(q){return this._addCheck({kind:"min",value:0,inclusive:!1,message:$8.toString(q)})}negative(q){return this._addCheck({kind:"max",value:0,inclusive:!1,message:$8.toString(q)})}nonpositive(q){return this._addCheck({kind:"max",value:0,inclusive:!0,message:$8.toString(q)})}nonnegative(q){return this._addCheck({kind:"min",value:0,inclusive:!0,message:$8.toString(q)})}multipleOf(q,_){return this._addCheck({kind:"multipleOf",value:q,message:$8.toString(_)})}finite(q){return this._addCheck({kind:"finite",message:$8.toString(q)})}safe(q){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:$8.toString(q)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:$8.toString(q)})}get minValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value<q)q=_.value}return q}get isInt(){return!!this._def.checks.find((q)=>q.kind==="int"||q.kind==="multipleOf"&&h8.isInteger(q.value))}get isFinite(){let q=null,_=null;for(let j of this._def.checks)if(j.kind==="finite"||j.kind==="int"||j.kind==="multipleOf")return!0;else if(j.kind==="min"){if(_===null||j.value>_)_=j.value}else if(j.kind==="max"){if(q===null||j.value<q)q=j.value}return Number.isFinite(_)&&Number.isFinite(q)}};sq.create=(q)=>{return new sq({checks:[],typeName:v8.ZodNumber,coerce:q?.coerce||!1,...Z8(q)})};Qq=class Qq extends k8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(q){if(this._def.coerce)try{q.data=BigInt(q.data)}catch{return this._getInvalidInput(q)}if(this._getType(q)!==Q.bigint)return this._getInvalidInput(q);let j=void 0,K=new A6;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?q.data<Y.value:q.data<=Y.value)j=this._getOrReturnCtx(q,j),U(j,{code:t.too_small,type:"bigint",minimum:Y.value,inclusive:Y.inclusive,message:Y.message}),K.dirty()}else if(Y.kind==="max"){if(Y.inclusive?q.data>Y.value:q.data>=Y.value)j=this._getOrReturnCtx(q,j),U(j,{code:t.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),K.dirty()}else if(Y.kind==="multipleOf"){if(q.data%Y.value!==BigInt(0))j=this._getOrReturnCtx(q,j),U(j,{code:t.not_multiple_of,multipleOf:Y.value,message:Y.message}),K.dirty()}else h8.assertNever(Y);return{status:K.value,value:q.data}}_getInvalidInput(q){let _=this._getOrReturnCtx(q);return U(_,{code:t.invalid_type,expected:Q.bigint,received:_.parsedType}),W8}gte(q,_){return this.setLimit("min",q,!0,$8.toString(_))}gt(q,_){return this.setLimit("min",q,!1,$8.toString(_))}lte(q,_){return this.setLimit("max",q,!0,$8.toString(_))}lt(q,_){return this.setLimit("max",q,!1,$8.toString(_))}setLimit(q,_,j,K){return new Qq({...this._def,checks:[...this._def.checks,{kind:q,value:_,inclusive:j,message:$8.toString(K)}]})}_addCheck(q){return new Qq({...this._def,checks:[...this._def.checks,q]})}positive(q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:$8.toString(q)})}negative(q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:$8.toString(q)})}nonpositive(q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:$8.toString(q)})}nonnegative(q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:$8.toString(q)})}multipleOf(q,_){return this._addCheck({kind:"multipleOf",value:q,message:$8.toString(_)})}get minValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value<q)q=_.value}return q}};Qq.create=(q)=>{return new Qq({checks:[],typeName:v8.ZodBigInt,coerce:q?.coerce??!1,...Z8(q)})};jK=class jK extends k8{_parse(q){if(this._def.coerce)q.data=Boolean(q.data);if(this._getType(q)!==Q.boolean){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.boolean,received:j.parsedType}),W8}return M6(q.data)}};jK.create=(q)=>{return new jK({typeName:v8.ZodBoolean,coerce:q?.coerce||!1,...Z8(q)})};A_=class A_ extends k8{_parse(q){if(this._def.coerce)q.data=new Date(q.data);if(this._getType(q)!==Q.date){let Y=this._getOrReturnCtx(q);return U(Y,{code:t.invalid_type,expected:Q.date,received:Y.parsedType}),W8}if(Number.isNaN(q.data.getTime())){let Y=this._getOrReturnCtx(q);return U(Y,{code:t.invalid_date}),W8}let j=new A6,K=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(q.data.getTime()<Y.value)K=this._getOrReturnCtx(q,K),U(K,{code:t.too_small,message:Y.message,inclusive:!0,exact:!1,minimum:Y.value,type:"date"}),j.dirty()}else if(Y.kind==="max"){if(q.data.getTime()>Y.value)K=this._getOrReturnCtx(q,K),U(K,{code:t.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),j.dirty()}else h8.assertNever(Y);return{status:j.value,value:new Date(q.data.getTime())}}_addCheck(q){return new A_({...this._def,checks:[...this._def.checks,q]})}min(q,_){return this._addCheck({kind:"min",value:q.getTime(),message:$8.toString(_)})}max(q,_){return this._addCheck({kind:"max",value:q.getTime(),message:$8.toString(_)})}get minDate(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q!=null?new Date(q):null}get maxDate(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value<q)q=_.value}return q!=null?new Date(q):null}};A_.create=(q)=>{return new A_({checks:[],coerce:q?.coerce||!1,typeName:v8.ZodDate,...Z8(q)})};eK=class eK extends k8{_parse(q){if(this._getType(q)!==Q.symbol){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.symbol,received:j.parsedType}),W8}return M6(q.data)}};eK.create=(q)=>{return new eK({typeName:v8.ZodSymbol,...Z8(q)})};PK=class PK extends k8{_parse(q){if(this._getType(q)!==Q.undefined){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.undefined,received:j.parsedType}),W8}return M6(q.data)}};PK.create=(q)=>{return new PK({typeName:v8.ZodUndefined,...Z8(q)})};YK=class YK extends k8{_parse(q){if(this._getType(q)!==Q.null){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.null,received:j.parsedType}),W8}return M6(q.data)}};YK.create=(q)=>{return new YK({typeName:v8.ZodNull,...Z8(q)})};G_=class G_ extends k8{constructor(){super(...arguments);this._any=!0}_parse(q){return M6(q.data)}};G_.create=(q)=>{return new G_({typeName:v8.ZodAny,...Z8(q)})};Uq=class Uq extends k8{constructor(){super(...arguments);this._unknown=!0}_parse(q){return M6(q.data)}};Uq.create=(q)=>{return new Uq({typeName:v8.ZodUnknown,...Z8(q)})};hq=class hq extends k8{_parse(q){let _=this._getOrReturnCtx(q);return U(_,{code:t.invalid_type,expected:Q.never,received:_.parsedType}),W8}};hq.create=(q)=>{return new hq({typeName:v8.ZodNever,...Z8(q)})};UK=class UK extends k8{_parse(q){if(this._getType(q)!==Q.undefined){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.void,received:j.parsedType}),W8}return M6(q.data)}};UK.create=(q)=>{return new UK({typeName:v8.ZodVoid,...Z8(q)})};wq=class wq extends k8{_parse(q){let{ctx:_,status:j}=this._processInputParams(q),K=this._def;if(_.parsedType!==Q.array)return U(_,{code:t.invalid_type,expected:Q.array,received:_.parsedType}),W8;if(K.exactLength!==null){let f=_.data.length>K.exactLength.value,P=_.data.length<K.exactLength.value;if(f||P)U(_,{code:f?t.too_big:t.too_small,minimum:P?K.exactLength.value:void 0,maximum:f?K.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:K.exactLength.message}),j.dirty()}if(K.minLength!==null){if(_.data.length<K.minLength.value)U(_,{code:t.too_small,minimum:K.minLength.value,type:"array",inclusive:!0,exact:!1,message:K.minLength.message}),j.dirty()}if(K.maxLength!==null){if(_.data.length>K.maxLength.value)U(_,{code:t.too_big,maximum:K.maxLength.value,type:"array",inclusive:!0,exact:!1,message:K.maxLength.message}),j.dirty()}if(_.common.async)return Promise.all([..._.data].map((f,P)=>{return K.type._parseAsync(new Wq(_,f,_.path,P))})).then((f)=>{return A6.mergeArray(j,f)});let Y=[..._.data].map((f,P)=>{return K.type._parseSync(new Wq(_,f,_.path,P))});return A6.mergeArray(j,Y)}get element(){return this._def.type}min(q,_){return new wq({...this._def,minLength:{value:q,message:$8.toString(_)}})}max(q,_){return new wq({...this._def,maxLength:{value:q,message:$8.toString(_)}})}length(q,_){return new wq({...this._def,exactLength:{value:q,message:$8.toString(_)}})}nonempty(q){return this.min(1,q)}};wq.create=(q,_)=>{return new wq({type:q,minLength:null,maxLength:null,exactLength:null,typeName:v8.ZodArray,...Z8(_)})};B8=class B8 extends k8{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let q=this._def.shape(),_=h8.objectKeys(q);return this._cached={shape:q,keys:_},this._cached}_parse(q){if(this._getType(q)!==Q.object){let w=this._getOrReturnCtx(q);return U(w,{code:t.invalid_type,expected:Q.object,received:w.parsedType}),W8}let{status:j,ctx:K}=this._processInputParams(q),{shape:Y,keys:f}=this._getCached(),P=[];if(!(this._def.catchall instanceof hq&&this._def.unknownKeys==="strip")){for(let w in K.data)if(!f.includes(w))P.push(w)}let $=[];for(let w of f){let O=Y[w],z=K.data[w];$.push({key:{status:"valid",value:w},value:O._parse(new Wq(K,z,K.path,w)),alwaysSet:w in K.data})}if(this._def.catchall instanceof hq){let w=this._def.unknownKeys;if(w==="passthrough")for(let O of P)$.push({key:{status:"valid",value:O},value:{status:"valid",value:K.data[O]}});else if(w==="strict"){if(P.length>0)U(K,{code:t.unrecognized_keys,keys:P}),j.dirty()}else if(w==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let w=this._def.catchall;for(let O of P){let z=K.data[O];$.push({key:{status:"valid",value:O},value:w._parse(new Wq(K,z,K.path,O)),alwaysSet:O in K.data})}}if(K.common.async)return Promise.resolve().then(async()=>{let w=[];for(let O of $){let z=await O.key,W=await O.value;w.push({key:z,value:W,alwaysSet:O.alwaysSet})}return w}).then((w)=>{return A6.mergeObjectSync(j,w)});else return A6.mergeObjectSync(j,$)}get shape(){return this._def.shape()}strict(q){return $8.errToObj,new B8({...this._def,unknownKeys:"strict",...q!==void 0?{errorMap:(_,j)=>{let K=this._def.errorMap?.(_,j).message??j.defaultError;if(_.code==="unrecognized_keys")return{message:$8.errToObj(q).message??K};return{message:K}}}:{}})}strip(){return new B8({...this._def,unknownKeys:"strip"})}passthrough(){return new B8({...this._def,unknownKeys:"passthrough"})}extend(q){return new B8({...this._def,shape:()=>({...this._def.shape(),...q})})}merge(q){return new B8({unknownKeys:q._def.unknownKeys,catchall:q._def.catchall,shape:()=>({...this._def.shape(),...q._def.shape()}),typeName:v8.ZodObject})}setKey(q,_){return this.augment({[q]:_})}catchall(q){return new B8({...this._def,catchall:q})}pick(q){let _={};for(let j of h8.objectKeys(q))if(q[j]&&this.shape[j])_[j]=this.shape[j];return new B8({...this._def,shape:()=>_})}omit(q){let _={};for(let j of h8.objectKeys(this.shape))if(!q[j])_[j]=this.shape[j];return new B8({...this._def,shape:()=>_})}deepPartial(){return s_(this)}partial(q){let _={};for(let j of h8.objectKeys(this.shape)){let K=this.shape[j];if(q&&!q[j])_[j]=K;else _[j]=K.optional()}return new B8({...this._def,shape:()=>_})}required(q){let _={};for(let j of h8.objectKeys(this.shape))if(q&&!q[j])_[j]=this.shape[j];else{let Y=this.shape[j];while(Y instanceof zq)Y=Y._def.innerType;_[j]=Y}return new B8({...this._def,shape:()=>_})}keyof(){return p1(h8.objectKeys(this.shape))}};B8.create=(q,_)=>{return new B8({shape:()=>q,unknownKeys:"strip",catchall:hq.create(),typeName:v8.ZodObject,...Z8(_)})};B8.strictCreate=(q,_)=>{return new B8({shape:()=>q,unknownKeys:"strict",catchall:hq.create(),typeName:v8.ZodObject,...Z8(_)})};B8.lazycreate=(q,_)=>{return new B8({shape:q,unknownKeys:"strip",catchall:hq.create(),typeName:v8.ZodObject,...Z8(_)})};fK=class fK extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=this._def.options;function K(Y){for(let P of Y)if(P.result.status==="valid")return P.result;for(let P of Y)if(P.result.status==="dirty")return _.common.issues.push(...P.ctx.common.issues),P.result;let f=Y.map((P)=>new l6(P.ctx.common.issues));return U(_,{code:t.invalid_union,unionErrors:f}),W8}if(_.common.async)return Promise.all(j.map(async(Y)=>{let f={..._,common:{..._.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:_.data,path:_.path,parent:f}),ctx:f}})).then(K);else{let Y=void 0,f=[];for(let $ of j){let w={..._,common:{..._.common,issues:[]},parent:null},O=$._parseSync({data:_.data,path:_.path,parent:w});if(O.status==="valid")return O;else if(O.status==="dirty"&&!Y)Y={result:O,ctx:w};if(w.common.issues.length)f.push(w.common.issues)}if(Y)return _.common.issues.push(...Y.ctx.common.issues),Y.result;let P=f.map(($)=>new l6($));return U(_,{code:t.invalid_union,unionErrors:P}),W8}}get options(){return this._def.options}};fK.create=(q,_)=>{return new fK({options:q,typeName:v8.ZodUnion,...Z8(_)})};f7=class f7 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==Q.object)return U(_,{code:t.invalid_type,expected:Q.object,received:_.parsedType}),W8;let j=this.discriminator,K=_.data[j],Y=this.optionsMap.get(K);if(!Y)return U(_,{code:t.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[j]}),W8;if(_.common.async)return Y._parseAsync({data:_.data,path:_.path,parent:_});else return Y._parseSync({data:_.data,path:_.path,parent:_})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(q,_,j){let K=new Map;for(let Y of _){let f=Lq(Y.shape[q]);if(!f.length)throw new Error(`A discriminator value for key \`${q}\` could not be extracted from all schema options`);for(let P of f){if(K.has(P))throw new Error(`Discriminator property ${String(q)} has duplicate value ${String(P)}`);K.set(P,Y)}}return new f7({typeName:v8.ZodDiscriminatedUnion,discriminator:q,options:_,optionsMap:K,...Z8(j)})}};$K=class $K extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q),K=(Y,f)=>{if(c4(Y)||c4(f))return W8;let P=i4(Y.value,f.value);if(!P.valid)return U(j,{code:t.invalid_intersection_types}),W8;if(r4(Y)||r4(f))_.dirty();return{status:_.value,value:P.data}};if(j.common.async)return Promise.all([this._def.left._parseAsync({data:j.data,path:j.path,parent:j}),this._def.right._parseAsync({data:j.data,path:j.path,parent:j})]).then(([Y,f])=>K(Y,f));else return K(this._def.left._parseSync({data:j.data,path:j.path,parent:j}),this._def.right._parseSync({data:j.data,path:j.path,parent:j}))}};$K.create=(q,_,j)=>{return new $K({left:q,right:_,typeName:v8.ZodIntersection,...Z8(j)})};Cq=class Cq extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.array)return U(j,{code:t.invalid_type,expected:Q.array,received:j.parsedType}),W8;if(j.data.length<this._def.items.length)return U(j,{code:t.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),W8;if(!this._def.rest&&j.data.length>this._def.items.length)U(j,{code:t.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_.dirty();let Y=[...j.data].map((f,P)=>{let $=this._def.items[P]||this._def.rest;if(!$)return null;return $._parse(new Wq(j,f,j.path,P))}).filter((f)=>!!f);if(j.common.async)return Promise.all(Y).then((f)=>{return A6.mergeArray(_,f)});else return A6.mergeArray(_,Y)}get items(){return this._def.items}rest(q){return new Cq({...this._def,rest:q})}};Cq.create=(q,_)=>{if(!Array.isArray(q))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Cq({items:q,typeName:v8.ZodTuple,rest:null,...Z8(_)})};sK=class sK extends k8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.object)return U(j,{code:t.invalid_type,expected:Q.object,received:j.parsedType}),W8;let K=[],Y=this._def.keyType,f=this._def.valueType;for(let P in j.data)K.push({key:Y._parse(new Wq(j,P,j.path,P)),value:f._parse(new Wq(j,j.data[P],j.path,P)),alwaysSet:P in j.data});if(j.common.async)return A6.mergeObjectAsync(_,K);else return A6.mergeObjectSync(_,K)}get element(){return this._def.valueType}static create(q,_,j){if(_ instanceof k8)return new sK({keyType:q,valueType:_,typeName:v8.ZodRecord,...Z8(j)});return new sK({keyType:Oq.create(),valueType:q,typeName:v8.ZodRecord,...Z8(_)})}};QK=class QK extends k8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.map)return U(j,{code:t.invalid_type,expected:Q.map,received:j.parsedType}),W8;let K=this._def.keyType,Y=this._def.valueType,f=[...j.data.entries()].map(([P,$],w)=>{return{key:K._parse(new Wq(j,P,j.path,[w,"key"])),value:Y._parse(new Wq(j,$,j.path,[w,"value"]))}});if(j.common.async){let P=new Map;return Promise.resolve().then(async()=>{for(let $ of f){let w=await $.key,O=await $.value;if(w.status==="aborted"||O.status==="aborted")return W8;if(w.status==="dirty"||O.status==="dirty")_.dirty();P.set(w.value,O.value)}return{status:_.value,value:P}})}else{let P=new Map;for(let $ of f){let{key:w,value:O}=$;if(w.status==="aborted"||O.status==="aborted")return W8;if(w.status==="dirty"||O.status==="dirty")_.dirty();P.set(w.value,O.value)}return{status:_.value,value:P}}}};QK.create=(q,_,j)=>{return new QK({valueType:_,keyType:q,typeName:v8.ZodMap,...Z8(j)})};u_=class u_ extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.set)return U(j,{code:t.invalid_type,expected:Q.set,received:j.parsedType}),W8;let K=this._def;if(K.minSize!==null){if(j.data.size<K.minSize.value)U(j,{code:t.too_small,minimum:K.minSize.value,type:"set",inclusive:!0,exact:!1,message:K.minSize.message}),_.dirty()}if(K.maxSize!==null){if(j.data.size>K.maxSize.value)U(j,{code:t.too_big,maximum:K.maxSize.value,type:"set",inclusive:!0,exact:!1,message:K.maxSize.message}),_.dirty()}let Y=this._def.valueType;function f($){let w=new Set;for(let O of $){if(O.status==="aborted")return W8;if(O.status==="dirty")_.dirty();w.add(O.value)}return{status:_.value,value:w}}let P=[...j.data.values()].map(($,w)=>Y._parse(new Wq(j,$,j.path,w)));if(j.common.async)return Promise.all(P).then(($)=>f($));else return f(P)}min(q,_){return new u_({...this._def,minSize:{value:q,message:$8.toString(_)}})}max(q,_){return new u_({...this._def,maxSize:{value:q,message:$8.toString(_)}})}size(q,_){return this.min(q,_).max(q,_)}nonempty(q){return this.min(1,q)}};u_.create=(q,_)=>{return new u_({valueType:q,minSize:null,maxSize:null,typeName:v8.ZodSet,...Z8(_)})};_K=class _K extends k8{constructor(){super(...arguments);this.validate=this.implement}_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==Q.function)return U(_,{code:t.invalid_type,expected:Q.function,received:_.parsedType}),W8;function j(P,$){return Y7({data:P,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,P7(),KK].filter((w)=>!!w),issueData:{code:t.invalid_arguments,argumentsError:$}})}function K(P,$){return Y7({data:P,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,P7(),KK].filter((w)=>!!w),issueData:{code:t.invalid_return_type,returnTypeError:$}})}let Y={errorMap:_.common.contextualErrorMap},f=_.data;if(this._def.returns instanceof h_){let P=this;return M6(async function(...$){let w=new l6([]),O=await P._def.args.parseAsync($,Y).catch((v)=>{throw w.addIssue(j($,v)),w}),z=await Reflect.apply(f,this,O);return await P._def.returns._def.type.parseAsync(z,Y).catch((v)=>{throw w.addIssue(K(z,v)),w})})}else{let P=this;return M6(function(...$){let w=P._def.args.safeParse($,Y);if(!w.success)throw new l6([j($,w.error)]);let O=Reflect.apply(f,this,w.data),z=P._def.returns.safeParse(O,Y);if(!z.success)throw new l6([K(O,z.error)]);return z.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...q){return new _K({...this._def,args:Cq.create(q).rest(Uq.create())})}returns(q){return new _K({...this._def,returns:q})}implement(q){return this.parse(q)}strictImplement(q){return this.parse(q)}static create(q,_,j){return new _K({args:q?q:Cq.create([]).rest(Uq.create()),returns:_||Uq.create(),typeName:v8.ZodFunction,...Z8(j)})}};OK=class OK extends k8{get schema(){return this._def.getter()}_parse(q){let{ctx:_}=this._processInputParams(q);return this._def.getter()._parse({data:_.data,path:_.path,parent:_})}};OK.create=(q,_)=>{return new OK({getter:q,typeName:v8.ZodLazy,...Z8(_)})};wK=class wK extends k8{_parse(q){if(q.data!==this._def.value){let _=this._getOrReturnCtx(q);return U(_,{received:_.data,code:t.invalid_literal,expected:this._def.value}),W8}return{status:"valid",value:q.data}}get value(){return this._def.value}};wK.create=(q,_)=>{return new wK({value:q,typeName:v8.ZodLiteral,...Z8(_)})};q_=class q_ extends k8{_parse(q){if(typeof q.data!=="string"){let _=this._getOrReturnCtx(q),j=this._def.values;return U(_,{expected:h8.joinValues(j),received:_.parsedType,code:t.invalid_type}),W8}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(q.data)){let _=this._getOrReturnCtx(q),j=this._def.values;return U(_,{received:_.data,code:t.invalid_enum_value,options:j}),W8}return M6(q.data)}get options(){return this._def.values}get enum(){let q={};for(let _ of this._def.values)q[_]=_;return q}get Values(){let q={};for(let _ of this._def.values)q[_]=_;return q}get Enum(){let q={};for(let _ of this._def.values)q[_]=_;return q}extract(q,_=this._def){return q_.create(q,{...this._def,..._})}exclude(q,_=this._def){return q_.create(this.options.filter((j)=>!q.includes(j)),{...this._def,..._})}};q_.create=p1;zK=class zK extends k8{_parse(q){let _=h8.getValidEnumValues(this._def.values),j=this._getOrReturnCtx(q);if(j.parsedType!==Q.string&&j.parsedType!==Q.number){let K=h8.objectValues(_);return U(j,{expected:h8.joinValues(K),received:j.parsedType,code:t.invalid_type}),W8}if(!this._cache)this._cache=new Set(h8.getValidEnumValues(this._def.values));if(!this._cache.has(q.data)){let K=h8.objectValues(_);return U(j,{received:j.data,code:t.invalid_enum_value,options:K}),W8}return M6(q.data)}get enum(){return this._def.values}};zK.create=(q,_)=>{return new zK({values:q,typeName:v8.ZodNativeEnum,...Z8(_)})};h_=class h_ extends k8{unwrap(){return this._def.type}_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==Q.promise&&_.common.async===!1)return U(_,{code:t.invalid_type,expected:Q.promise,received:_.parsedType}),W8;let j=_.parsedType===Q.promise?_.data:Promise.resolve(_.data);return M6(j.then((K)=>{return this._def.type.parseAsync(K,{path:_.path,errorMap:_.common.contextualErrorMap})}))}};h_.create=(q,_)=>{return new h_({type:q,typeName:v8.ZodPromise,...Z8(_)})};e6=class e6 extends k8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v8.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(q){let{status:_,ctx:j}=this._processInputParams(q),K=this._def.effect||null,Y={addIssue:(f)=>{if(U(j,f),f.fatal)_.abort();else _.dirty()},get path(){return j.path}};if(Y.addIssue=Y.addIssue.bind(Y),K.type==="preprocess"){let f=K.transform(j.data,Y);if(j.common.async)return Promise.resolve(f).then(async(P)=>{if(_.value==="aborted")return W8;let $=await this._def.schema._parseAsync({data:P,path:j.path,parent:j});if($.status==="aborted")return W8;if($.status==="dirty")return qK($.value);if(_.value==="dirty")return qK($.value);return $});else{if(_.value==="aborted")return W8;let P=this._def.schema._parseSync({data:f,path:j.path,parent:j});if(P.status==="aborted")return W8;if(P.status==="dirty")return qK(P.value);if(_.value==="dirty")return qK(P.value);return P}}if(K.type==="refinement"){let f=(P)=>{let $=K.refinement(P,Y);if(j.common.async)return Promise.resolve($);if($ instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return P};if(j.common.async===!1){let P=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(P.status==="aborted")return W8;if(P.status==="dirty")_.dirty();return f(P.value),{status:_.value,value:P.value}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then((P)=>{if(P.status==="aborted")return W8;if(P.status==="dirty")_.dirty();return f(P.value).then(()=>{return{status:_.value,value:P.value}})})}if(K.type==="transform")if(j.common.async===!1){let f=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(!X_(f))return W8;let P=K.transform(f.value,Y);if(P instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:_.value,value:P}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then((f)=>{if(!X_(f))return W8;return Promise.resolve(K.transform(f.value,Y)).then((P)=>({status:_.value,value:P}))});h8.assertNever(K)}};e6.create=(q,_,j)=>{return new e6({schema:q,typeName:v8.ZodEffects,effect:_,...Z8(j)})};e6.createWithPreprocess=(q,_,j)=>{return new e6({schema:_,effect:{type:"preprocess",transform:q},typeName:v8.ZodEffects,...Z8(j)})};zq=class zq extends k8{_parse(q){if(this._getType(q)===Q.undefined)return M6(void 0);return this._def.innerType._parse(q)}unwrap(){return this._def.innerType}};zq.create=(q,_)=>{return new zq({innerType:q,typeName:v8.ZodOptional,...Z8(_)})};lq=class lq extends k8{_parse(q){if(this._getType(q)===Q.null)return M6(null);return this._def.innerType._parse(q)}unwrap(){return this._def.innerType}};lq.create=(q,_)=>{return new lq({innerType:q,typeName:v8.ZodNullable,...Z8(_)})};WK=class WK extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;if(_.parsedType===Q.undefined)j=this._def.defaultValue();return this._def.innerType._parse({data:j,path:_.path,parent:_})}removeDefault(){return this._def.innerType}};WK.create=(q,_)=>{return new WK({innerType:q,typeName:v8.ZodDefault,defaultValue:typeof _.default==="function"?_.default:()=>_.default,...Z8(_)})};vK=class vK extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j={..._,common:{..._.common,issues:[]}},K=this._def.innerType._parse({data:j.data,path:j.path,parent:{...j}});if(FK(K))return K.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new l6(j.common.issues)},input:j.data})}});else return{status:"valid",value:K.status==="valid"?K.value:this._def.catchValue({get error(){return new l6(j.common.issues)},input:j.data})}}removeCatch(){return this._def.innerType}};vK.create=(q,_)=>{return new vK({innerType:q,typeName:v8.ZodCatch,catchValue:typeof _.catch==="function"?_.catch:()=>_.catch,...Z8(_)})};q3=class q3 extends k8{_parse(q){if(this._getType(q)!==Q.nan){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.nan,received:j.parsedType}),W8}return{status:"valid",value:q.data}}};q3.create=(q)=>{return new q3({typeName:v8.ZodNaN,...Z8(q)})};Ov=Symbol("zod_brand");$7=class $7 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;return this._def.type._parse({data:j,path:_.path,parent:_})}unwrap(){return this._def.type}};_3=class _3 extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:j.data,path:j.path,parent:j});if(Y.status==="aborted")return W8;if(Y.status==="dirty")return _.dirty(),qK(Y.value);else return this._def.out._parseAsync({data:Y.value,path:j.path,parent:j})})();else{let K=this._def.in._parseSync({data:j.data,path:j.path,parent:j});if(K.status==="aborted")return W8;if(K.status==="dirty")return _.dirty(),{status:"dirty",value:K.value};else return this._def.out._parseSync({data:K.value,path:j.path,parent:j})}}static create(q,_){return new _3({in:q,out:_,typeName:v8.ZodPipeline})}};HK=class HK extends k8{_parse(q){let _=this._def.innerType._parse(q),j=(K)=>{if(X_(K))K.value=Object.freeze(K.value);return K};return FK(_)?_.then((K)=>j(K)):j(_)}unwrap(){return this._def.innerType}};HK.create=(q,_)=>{return new HK({innerType:q,typeName:v8.ZodReadonly,...Z8(_)})};wv={object:B8.lazycreate};(function(q){q.ZodString="ZodString",q.ZodNumber="ZodNumber",q.ZodNaN="ZodNaN",q.ZodBigInt="ZodBigInt",q.ZodBoolean="ZodBoolean",q.ZodDate="ZodDate",q.ZodSymbol="ZodSymbol",q.ZodUndefined="ZodUndefined",q.ZodNull="ZodNull",q.ZodAny="ZodAny",q.ZodUnknown="ZodUnknown",q.ZodNever="ZodNever",q.ZodVoid="ZodVoid",q.ZodArray="ZodArray",q.ZodObject="ZodObject",q.ZodUnion="ZodUnion",q.ZodDiscriminatedUnion="ZodDiscriminatedUnion",q.ZodIntersection="ZodIntersection",q.ZodTuple="ZodTuple",q.ZodRecord="ZodRecord",q.ZodMap="ZodMap",q.ZodSet="ZodSet",q.ZodFunction="ZodFunction",q.ZodLazy="ZodLazy",q.ZodLiteral="ZodLiteral",q.ZodEnum="ZodEnum",q.ZodEffects="ZodEffects",q.ZodNativeEnum="ZodNativeEnum",q.ZodOptional="ZodOptional",q.ZodNullable="ZodNullable",q.ZodDefault="ZodDefault",q.ZodCatch="ZodCatch",q.ZodPromise="ZodPromise",q.ZodBranded="ZodBranded",q.ZodPipeline="ZodPipeline",q.ZodReadonly="ZodReadonly"})(v8||(v8={}));x1=Oq.create,n1=sq.create,Wv=q3.create,vv=Qq.create,c1=jK.create,Hv=A_.create,Jv=eK.create,Tv=PK.create,Zv=YK.create,kv=G_.create,Xv=Uq.create,Av=hq.create,Gv=UK.create,uv=wq.create,hv=B8.create,Cv=B8.strictCreate,Dv=fK.create,Vv=f7.create,Mv=$K.create,Nv=Cq.create,bv=sK.create,Sv=QK.create,Ev=u_.create,Rv=_K.create,Iv=OK.create,mv=wK.create,gv=q_.create,yv=zK.create,dv=h_.create,C1=e6.create,Lv=zq.create,pv=lq.create,lv=e6.createWithPreprocess,xv=_3.create,iv={string:(q)=>Oq.create({...q,coerce:!0}),number:(q)=>sq.create({...q,coerce:!0}),boolean:(q)=>jK.create({...q,coerce:!0}),bigint:(q)=>Qq.create({...q,coerce:!0}),date:(q)=>A_.create({...q,coerce:!0})},ov=W8,r1=X.union([X.string(),X.number().int()]),i1=X.string(),av=X.object({progressToken:X.optional(r1)}).passthrough(),U6=X.object({_meta:X.optional(av)}).passthrough(),m6=X.object({method:X.string(),params:X.optional(U6)}),K3=X.object({_meta:X.optional(X.object({}).passthrough())}).passthrough(),Dq=X.object({method:X.string(),params:X.optional(K3)}),s6=X.object({_meta:X.optional(X.object({}).passthrough())}).passthrough(),w7=X.union([X.string(),X.number().int()]),Bv=X.object({jsonrpc:X.literal(O7),id:w7}).merge(m6).strict(),tv=X.object({jsonrpc:X.literal(O7)}).merge(Dq).strict(),Fv=X.object({jsonrpc:X.literal(O7),id:w7,result:s6}).strict();(function(q){q[q.ConnectionClosed=-32000]="ConnectionClosed",q[q.RequestTimeout=-32001]="RequestTimeout",q[q.ParseError=-32700]="ParseError",q[q.InvalidRequest=-32600]="InvalidRequest",q[q.MethodNotFound=-32601]="MethodNotFound",q[q.InvalidParams=-32602]="InvalidParams",q[q.InternalError=-32603]="InternalError"})(D1||(D1={}));ev=X.object({jsonrpc:X.literal(O7),id:w7,error:X.object({code:X.number().int(),message:X.string(),data:X.optional(X.unknown())})}).strict(),dM=X.union([Bv,tv,Fv,ev]),o1=s6.strict(),a1=Dq.extend({method:X.literal("notifications/cancelled"),params:K3.extend({requestId:w7,reason:X.string().optional()})}),j3=X.object({name:X.string(),title:X.optional(X.string())}).passthrough(),B1=j3.extend({version:X.string()}),Uv=X.object({experimental:X.optional(X.object({}).passthrough()),sampling:X.optional(X.object({}).passthrough()),elicitation:X.optional(X.object({}).passthrough()),roots:X.optional(X.object({listChanged:X.optional(X.boolean())}).passthrough())}).passthrough(),sv=m6.extend({method:X.literal("initialize"),params:U6.extend({protocolVersion:X.string(),capabilities:Uv,clientInfo:B1})}),Qv=X.object({experimental:X.optional(X.object({}).passthrough()),logging:X.optional(X.object({}).passthrough()),completions:X.optional(X.object({}).passthrough()),prompts:X.optional(X.object({listChanged:X.optional(X.boolean())}).passthrough()),resources:X.optional(X.object({subscribe:X.optional(X.boolean()),listChanged:X.optional(X.boolean())}).passthrough()),tools:X.optional(X.object({listChanged:X.optional(X.boolean())}).passthrough())}).passthrough(),qH=s6.extend({protocolVersion:X.string(),capabilities:Qv,serverInfo:B1,instructions:X.optional(X.string())}),_H=Dq.extend({method:X.literal("notifications/initialized")}),t1=m6.extend({method:X.literal("ping")}),KH=X.object({progress:X.number(),total:X.optional(X.number()),message:X.optional(X.string())}).passthrough(),F1=Dq.extend({method:X.literal("notifications/progress"),params:K3.merge(KH).extend({progressToken:r1})}),z7=m6.extend({params:U6.extend({cursor:X.optional(i1)}).optional()}),W7=s6.extend({nextCursor:X.optional(i1)}),e1=X.object({uri:X.string(),mimeType:X.optional(X.string()),_meta:X.optional(X.object({}).passthrough())}).passthrough(),U1=e1.extend({text:X.string()}),e4=X.string().refine((q)=>{try{return atob(q),!0}catch(_){return!1}},{message:"Invalid Base64 string"}),s1=e1.extend({blob:e4}),Q1=j3.extend({uri:X.string(),description:X.optional(X.string()),mimeType:X.optional(X.string()),_meta:X.optional(X.object({}).passthrough())}),jH=j3.extend({uriTemplate:X.string(),description:X.optional(X.string()),mimeType:X.optional(X.string()),_meta:X.optional(X.object({}).passthrough())}),PH=z7.extend({method:X.literal("resources/list")}),YH=W7.extend({resources:X.array(Q1)}),fH=z7.extend({method:X.literal("resources/templates/list")}),$H=W7.extend({resourceTemplates:X.array(jH)}),OH=m6.extend({method:X.literal("resources/read"),params:U6.extend({uri:X.string()})}),wH=s6.extend({contents:X.array(X.union([U1,s1]))}),zH=Dq.extend({method:X.literal("notifications/resources/list_changed")}),WH=m6.extend({method:X.literal("resources/subscribe"),params:U6.extend({uri:X.string()})}),vH=m6.extend({method:X.literal("resources/unsubscribe"),params:U6.extend({uri:X.string()})}),HH=Dq.extend({method:X.literal("notifications/resources/updated"),params:K3.extend({uri:X.string()})}),JH=X.object({name:X.string(),description:X.optional(X.string()),required:X.optional(X.boolean())}).passthrough(),TH=j3.extend({description:X.optional(X.string()),arguments:X.optional(X.array(JH)),_meta:X.optional(X.object({}).passthrough())}),ZH=z7.extend({method:X.literal("prompts/list")}),kH=W7.extend({prompts:X.array(TH)}),XH=m6.extend({method:X.literal("prompts/get"),params:U6.extend({name:X.string(),arguments:X.optional(X.record(X.string()))})}),U4=X.object({type:X.literal("text"),text:X.string(),_meta:X.optional(X.object({}).passthrough())}).passthrough(),s4=X.object({type:X.literal("image"),data:e4,mimeType:X.string(),_meta:X.optional(X.object({}).passthrough())}).passthrough(),Q4=X.object({type:X.literal("audio"),data:e4,mimeType:X.string(),_meta:X.optional(X.object({}).passthrough())}).passthrough(),AH=X.object({type:X.literal("resource"),resource:X.union([U1,s1]),_meta:X.optional(X.object({}).passthrough())}).passthrough(),GH=Q1.extend({type:X.literal("resource_link")}),qj=X.union([U4,s4,Q4,GH,AH]),uH=X.object({role:X.enum(["user","assistant"]),content:qj}).passthrough(),hH=s6.extend({description:X.optional(X.string()),messages:X.array(uH)}),CH=Dq.extend({method:X.literal("notifications/prompts/list_changed")}),DH=X.object({title:X.optional(X.string()),readOnlyHint:X.optional(X.boolean()),destructiveHint:X.optional(X.boolean()),idempotentHint:X.optional(X.boolean()),openWorldHint:X.optional(X.boolean())}).passthrough(),VH=j3.extend({description:X.optional(X.string()),inputSchema:X.object({type:X.literal("object"),properties:X.optional(X.object({}).passthrough()),required:X.optional(X.array(X.string()))}).passthrough(),outputSchema:X.optional(X.object({type:X.literal("object"),properties:X.optional(X.object({}).passthrough()),required:X.optional(X.array(X.string()))}).passthrough()),annotations:X.optional(DH),_meta:X.optional(X.object({}).passthrough())}),MH=z7.extend({method:X.literal("tools/list")}),NH=W7.extend({tools:X.array(VH)}),_j=s6.extend({content:X.array(qj).default([]),structuredContent:X.object({}).passthrough().optional(),isError:X.optional(X.boolean())}),LM=_j.or(s6.extend({toolResult:X.unknown()})),bH=m6.extend({method:X.literal("tools/call"),params:U6.extend({name:X.string(),arguments:X.optional(X.record(X.unknown()))})}),SH=Dq.extend({method:X.literal("notifications/tools/list_changed")}),Kj=X.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),EH=m6.extend({method:X.literal("logging/setLevel"),params:U6.extend({level:Kj})}),RH=Dq.extend({method:X.literal("notifications/message"),params:K3.extend({level:Kj,logger:X.optional(X.string()),data:X.unknown()})}),IH=X.object({name:X.string().optional()}).passthrough(),mH=X.object({hints:X.optional(X.array(IH)),costPriority:X.optional(X.number().min(0).max(1)),speedPriority:X.optional(X.number().min(0).max(1)),intelligencePriority:X.optional(X.number().min(0).max(1))}).passthrough(),gH=X.object({role:X.enum(["user","assistant"]),content:X.union([U4,s4,Q4])}).passthrough(),yH=m6.extend({method:X.literal("sampling/createMessage"),params:U6.extend({messages:X.array(gH),systemPrompt:X.optional(X.string()),includeContext:X.optional(X.enum(["none","thisServer","allServers"])),temperature:X.optional(X.number()),maxTokens:X.number().int(),stopSequences:X.optional(X.array(X.string())),metadata:X.optional(X.object({}).passthrough()),modelPreferences:X.optional(mH)})}),dH=s6.extend({model:X.string(),stopReason:X.optional(X.enum(["endTurn","stopSequence","maxTokens"]).or(X.string())),role:X.enum(["user","assistant"]),content:X.discriminatedUnion("type",[U4,s4,Q4])}),LH=X.object({type:X.literal("boolean"),title:X.optional(X.string()),description:X.optional(X.string()),default:X.optional(X.boolean())}).passthrough(),pH=X.object({type:X.literal("string"),title:X.optional(X.string()),description:X.optional(X.string()),minLength:X.optional(X.number()),maxLength:X.optional(X.number()),format:X.optional(X.enum(["email","uri","date","date-time"]))}).passthrough(),lH=X.object({type:X.enum(["number","integer"]),title:X.optional(X.string()),description:X.optional(X.string()),minimum:X.optional(X.number()),maximum:X.optional(X.number())}).passthrough(),xH=X.object({type:X.literal("string"),title:X.optional(X.string()),description:X.optional(X.string()),enum:X.array(X.string()),enumNames:X.optional(X.array(X.string()))}).passthrough(),nH=X.union([LH,pH,lH,xH]),cH=m6.extend({method:X.literal("elicitation/create"),params:U6.extend({message:X.string(),requestedSchema:X.object({type:X.literal("object"),properties:X.record(X.string(),nH),required:X.optional(X.array(X.string()))}).passthrough()})}),rH=s6.extend({action:X.enum(["accept","decline","cancel"]),content:X.optional(X.record(X.string(),X.unknown()))}),iH=X.object({type:X.literal("ref/resource"),uri:X.string()}).passthrough(),oH=X.object({type:X.literal("ref/prompt"),name:X.string()}).passthrough(),aH=m6.extend({method:X.literal("completion/complete"),params:U6.extend({ref:X.union([oH,iH]),argument:X.object({name:X.string(),value:X.string()}).passthrough(),context:X.optional(X.object({arguments:X.optional(X.record(X.string(),X.string()))}))})}),BH=s6.extend({completion:X.object({values:X.array(X.string()).max(100),total:X.optional(X.number().int()),hasMore:X.optional(X.boolean())}).passthrough()}),tH=X.object({uri:X.string().startsWith("file://"),name:X.optional(X.string()),_meta:X.optional(X.object({}).passthrough())}).passthrough(),FH=m6.extend({method:X.literal("roots/list")}),eH=s6.extend({roots:X.array(tH)}),UH=Dq.extend({method:X.literal("notifications/roots/list_changed")}),pM=X.union([t1,sv,aH,EH,XH,ZH,PH,fH,OH,WH,vH,bH,MH]),lM=X.union([a1,F1,_H,UH]),xM=X.union([o1,dH,rH,eH]),nM=X.union([t1,yH,cH,FH]),cM=X.union([a1,F1,RH,HH,zH,SH,CH]),rM=X.union([o1,qH,BH,hH,kH,YH,$H,wH,_j,NH]),iM=az(NW(),1),oM=Symbol("Let zodToJsonSchema decide on which parser to use"),aM=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");(function(q){q.Completable="McpCompletable"})(o4||(o4={}));a4=class a4 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;return this._def.type._parse({data:j,path:_.path,parent:_})}unwrap(){return this._def.type}};a4.create=(q,_)=>{return new a4({type:q,typeName:o4.Completable,complete:_.complete,...sH(_)})}});var jj={};$q(jj,{version:()=>_J,type:()=>jJ,scripts:()=>YJ,repository:()=>wJ,publishConfig:()=>vJ,name:()=>qJ,main:()=>PJ,license:()=>OJ,keywords:()=>fJ,homepage:()=>zJ,files:()=>kJ,engines:()=>TJ,devDependencies:()=>JJ,description:()=>KJ,dependencies:()=>HJ,default:()=>XJ,bugs:()=>WJ,bin:()=>ZJ,author:()=>$J});var qJ="claude-mem",_J="3.7.2",KJ="Memory compression system for Claude Code - persist context across sessions",jJ="module",PJ="claude-mem",YJ,fJ,$J="Alex Newman",OJ="SEE LICENSE IN LICENSE",wJ,zJ="https://github.com/thedotmack/claude-mem#readme",WJ,vJ,HJ,JJ,TJ,ZJ,kJ,XJ;var Pj=R8(()=>{YJ={dev:"tsx src/bin/cli.ts","dev:install":"node dist/claude-mem.min.js install --force","dev:status":"node dist/claude-mem.min.js status","dev:compress":"node dist/claude-mem.min.js compress","dev:load":"node dist/claude-mem.min.js load-context","dev:uninstall":"node dist/claude-mem.min.js uninstall",build:"./scripts/build-minified.sh",test:"bun test","test:unit":"bun test test/unit/","test:integration":"bun test test/integration/","test:e2e":"bun test test/e2e/","test:performance":"bun test test/performance/ --benchmark","test:coverage":"bun test --coverage","test:watch":"bun test --watch",lint:"eslint 'src/**/*.ts' 'hooks/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix",format:"prettier --write 'src/**/*.ts' 'hooks/**/*.ts' 'test/**/*.ts'","build:npm":"./scripts/npm-publish.sh",publish:"./scripts/publish-with-changelog.sh","publish:latest":"./scripts/publish-with-changelog.sh bump","publish:github":"./scripts/github-publish.sh"},fJ=["claude","claude-code","mcp","memory","compression","knowledge-graph","transcript","cli","typescript","bun"],wJ={type:"git",url:"https://github.com/thedotmack/claude-mem.git"},WJ={url:"https://github.com/thedotmack/claude-mem/issues"},vJ={access:"public",registry:"https://registry.npmjs.org/"},HJ={"@anthropic-ai/claude-code":"^1.0.88","@clack/prompts":"^0.11.0","@modelcontextprotocol/sdk":"^0.5.0","better-sqlite3":"^11.8.0",boxen:"^8.0.1",chalk:"^5.6.0",chromadb:"^3.0.14",commander:"^14.0.0",cors:"^2.8.5",express:"^5.1.0",glob:"^11.0.3","gradient-string":"^3.0.0",handlebars:"^4.7.8",http:"^0.0.1-security","oh-my-logo":"^0.3.2",open:"^10.2.0"},JJ={"@types/chai":"^4.3.0","@types/handlebars":"^4.0.40","@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0",chai:"^4.3.0",eslint:"^8.0.0",prettier:"^3.0.0","ts-node":"^10.0.0",tsx:"^4.20.5",typescript:"^5.0.0"},TJ={node:">=18.0.0",bun:">=1.0.0"},ZJ={"claude-mem":"dist/claude-mem.min.js"},kJ=["dist","hooks","commands","docs","src","CHANGELOG.md"],XJ={name:qJ,version:_J,description:KJ,type:jJ,main:PJ,scripts:YJ,keywords:fJ,author:$J,license:OJ,repository:wJ,homepage:zJ,bugs:WJ,publishConfig:vJ,dependencies:HJ,devDependencies:JJ,engines:TJ,bin:ZJ,files:kJ}});import{join as Q8,dirname as H7,sep as AJ}from"path";import{homedir as q2}from"os";import{existsSync as P3,statSync as GJ}from"fs";import{execSync as uJ}from"child_process";import{fileURLToPath as hJ}from"url";class _8{static instance=null;_dataDirectory=null;_packageRoot=null;_claudeConfigDirectory=null;static getInstance(){if(!_8.instance)_8.instance=new _8;return _8.instance}getDataDirectory(){if(this._dataDirectory)return this._dataDirectory;return this._dataDirectory=process.env.CLAUDE_MEM_DATA_DIR||Q8(q2(),".claude-mem"),this._dataDirectory}getArchivesDirectory(){return Q8(this.getDataDirectory(),"archives")}getHooksDirectory(){return Q8(this.getDataDirectory(),"hooks")}getLogsDirectory(){return Q8(this.getDataDirectory(),"logs")}getIndexDirectory(){return this.getDataDirectory()}getIndexPath(){return Q8(this.getIndexDirectory(),"claude-mem-index.jsonl")}getTrashDirectory(){return Q8(this.getDataDirectory(),"trash")}getBackupsDirectory(){return Q8(this.getDataDirectory(),"backups")}getChromaDirectory(){return Q8(this.getDataDirectory(),"chroma")}getProjectArchiveDirectory(q){return Q8(this.getArchivesDirectory(),q)}getUserSettingsPath(){return Q8(this.getDataDirectory(),"settings.json")}getClaudeConfigDirectory(){if(this._claudeConfigDirectory)return this._claudeConfigDirectory;return this._claudeConfigDirectory=process.env.CLAUDE_CONFIG_DIR||Q8(q2(),".claude"),this._claudeConfigDirectory}getClaudeSettingsPath(){return Q8(this.getClaudeConfigDirectory(),"settings.json")}getClaudeCommandsDirectory(){return Q8(this.getClaudeConfigDirectory(),"commands")}getClaudeMdPath(){return Q8(this.getClaudeConfigDirectory(),"CLAUDE.md")}getMcpConfigPath(){return Q8(q2(),".claude.json")}getProjectMcpConfigPath(){return Q8(process.cwd(),".mcp.json")}getPackageRoot(){if(this._packageRoot)return this._packageRoot;try{let j=g8.resolve("/Users/alexnewman/Scripts/claude-mem-source/package.json");return this._packageRoot=H7(j),this._packageRoot}catch{}let q=hJ(import.meta.url),_=H7(q);for(let j=0;j<10;j++){let K=Q8(_,"package.json");if(P3(K))try{if(g8(K).name==="claude-mem")return this._packageRoot=_,this._packageRoot}catch{}let Y=H7(_);if(Y===_)break;_=Y}try{let j=uJ("npm list -g claude-mem --json 2>/dev/null || npm list claude-mem --json 2>/dev/null",{encoding:"utf8"}),K=JSON.parse(j);if(K.dependencies?.["claude-mem"]?.resolved)return this._packageRoot=H7(K.dependencies["claude-mem"].resolved),this._packageRoot}catch{}throw new Error("Cannot locate claude-mem package root. Ensure claude-mem is properly installed.")}findPackageHooksDirectory(){let q=this.getPackageRoot(),_=Q8(q,"hooks"),j=["pre-compact.js","session-start.js"];for(let K of j)if(!P3(Q8(_,K)))throw new Error(`Package hooks directory missing required file: ${K}`);return _}findPackageCommandsDirectory(){let q=this.getPackageRoot(),_=Q8(q,"commands"),j=["save.md"];for(let K of j)if(!P3(Q8(_,K)))throw new Error(`Package commands directory missing required file: ${K}`);return _}ensureDirectory(q){if(!P3(q))g8("fs").mkdirSync(q,{recursive:!0})}ensureDirectories(q){q.forEach((_)=>this.ensureDirectory(_))}ensureAllDataDirectories(){this.ensureDirectories([this.getDataDirectory(),this.getArchivesDirectory(),this.getHooksDirectory(),this.getLogsDirectory(),this.getTrashDirectory(),this.getBackupsDirectory(),this.getChromaDirectory()])}ensureAllClaudeDirectories(){this.ensureDirectories([this.getClaudeConfigDirectory(),this.getClaudeCommandsDirectory()])}static extractProjectName(q){let _=q.split(AJ),j=["src","lib","app","project","workspace"];for(let K=_.length-1;K>=0;K--)if(j.includes(_[K])&&K>0)return _[K-1];if(_.length>1)return _[_.length-2];return"unknown-project"}static getCurrentProjectName(){return g8("path").basename(process.cwd())}static createBackupFilename(q){let _=new Date().toISOString().replace(/[:.]/g,"-").replace("T","_").slice(0,19);return`${q}.backup.${_}`}static isPathAccessible(q){try{return P3(q)&&GJ(q).isDirectory()}catch{return!1}}static getDataDirectory(){return _8.getInstance().getDataDirectory()}static getArchivesDirectory(){return _8.getInstance().getArchivesDirectory()}static getHooksDirectory(){return _8.getInstance().getHooksDirectory()}static getLogsDirectory(){return _8.getInstance().getLogsDirectory()}static getClaudeSettingsPath(){return _8.getInstance().getClaudeSettingsPath()}static getClaudeMdPath(){return _8.getInstance().getClaudeMdPath()}static findPackageHooksDirectory(){return _8.getInstance().findPackageHooksDirectory()}static findPackageCommandsDirectory(){return _8.getInstance().findPackageCommandsDirectory()}}var QM;var G6=R8(()=>{QM=_8.getInstance()});class nq{pathDiscovery;constructor(){this.pathDiscovery=_8.getInstance()}getConfigDir(){return this.pathDiscovery.getDataDirectory()}getIndexDir(){return this.pathDiscovery.getIndexDirectory()}getIndexPath(){return this.pathDiscovery.getIndexPath()}getArchiveDir(){return this.pathDiscovery.getArchivesDirectory()}getProjectArchiveDir(q){return this.pathDiscovery.getProjectArchiveDirectory(q)}getLogsDir(){return this.pathDiscovery.getLogsDirectory()}static ensureDirectory(q){_8.getInstance().ensureDirectory(q)}static ensureDirectories(q){_8.getInstance().ensureDirectories(q)}static extractProjectName(q){return _8.extractProjectName(q)}static getCurrentProjectPrefix(){return _8.getCurrentProjectName()}static getCurrentProjectName(){return _8.getCurrentProjectName()}}var _2=R8(()=>{G6()});var N6=F((mJ)=>{mJ.__esModule=!0;mJ.extend=Yj;mJ.indexOf=NJ;mJ.escapeExpression=bJ;mJ.isEmpty=SJ;mJ.createFrame=EJ;mJ.blockParams=RJ;mJ.appendContextPath=IJ;var CJ={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","=":"&#x3D;"},DJ=/[&<>"'`=]/g,VJ=/[&<>"'`=]/;function MJ(q){return CJ[q]}function Yj(q){for(var _=1;_<arguments.length;_++)for(var j in arguments[_])if(Object.prototype.hasOwnProperty.call(arguments[_],j))q[j]=arguments[_][j];return q}var j2=Object.prototype.toString;mJ.toString=j2;var K2=function q(_){return typeof _==="function"};if(K2(/x/))mJ.isFunction=K2=function(q){return typeof q==="function"&&j2.call(q)==="[object Function]"};mJ.isFunction=K2;var fj=Array.isArray||function(q){return q&&typeof q==="object"?j2.call(q)==="[object Array]":!1};mJ.isArray=fj;function NJ(q,_){for(var j=0,K=q.length;j<K;j++)if(q[j]===_)return j;return-1}function bJ(q){if(typeof q!=="string"){if(q&&q.toHTML)return q.toHTML();else if(q==null)return"";else if(!q)return q+"";q=""+q}if(!VJ.test(q))return q;return q.replace(DJ,MJ)}function SJ(q){if(!q&&q!==0)return!0;else if(fj(q)&&q.length===0)return!0;else return!1}function EJ(q){var _=Yj({},q);return _._parent=q,_}function RJ(q,_){return q.path=_,q}function IJ(q,_){return(q?q+".":"")+_}});var Q6=F(($j,Oj)=>{$j.__esModule=!0;var P2=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function Y2(q,_){var j=_&&_.loc,K=void 0,Y=void 0,f=void 0,P=void 0;if(j)K=j.start.line,Y=j.end.line,f=j.start.column,P=j.end.column,q+=" - "+K+":"+f;var $=Error.prototype.constructor.call(this,q);for(var w=0;w<P2.length;w++)this[P2[w]]=$[P2[w]];if(Error.captureStackTrace)Error.captureStackTrace(this,Y2);try{if(j)if(this.lineNumber=K,this.endLineNumber=Y,Object.defineProperty)Object.defineProperty(this,"column",{value:f,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:P,enumerable:!0});else this.column=f,this.endColumn=P}catch(O){}}Y2.prototype=new Error;$j.default=Y2;Oj.exports=$j.default});var Wj=F((wj,zj)=>{wj.__esModule=!0;var f2=N6();wj.default=function(q){q.registerHelper("blockHelperMissing",function(_,j){var{inverse:K,fn:Y}=j;if(_===!0)return Y(this);else if(_===!1||_==null)return K(this);else if(f2.isArray(_))if(_.length>0){if(j.ids)j.ids=[j.name];return q.helpers.each(_,j)}else return K(this);else{if(j.data&&j.ids){var f=f2.createFrame(j.data);f.contextPath=f2.appendContextPath(j.data.contextPath,j.name),j={data:f}}return Y(_,j)}})};zj.exports=wj.default});var Jj=F((vj,Hj)=>{vj.__esModule=!0;function FJ(q){return q&&q.__esModule?q:{default:q}}var Y3=N6(),eJ=Q6(),UJ=FJ(eJ);vj.default=function(q){q.registerHelper("each",function(_,j){if(!j)throw new UJ.default("Must pass iterator to #each");var{fn:K,inverse:Y}=j,f=0,P="",$=void 0,w=void 0;if(j.data&&j.ids)w=Y3.appendContextPath(j.data.contextPath,j.ids[0])+".";if(Y3.isFunction(_))_=_.call(this);if(j.data)$=Y3.createFrame(j.data);function O(T,J,k){if($){if($.key=T,$.index=J,$.first=J===0,$.last=!!k,w)$.contextPath=w+T}P=P+K(_[T],{data:$,blockParams:Y3.blockParams([_[T],T],[w+T,null])})}if(_&&typeof _==="object")if(Y3.isArray(_)){for(var z=_.length;f<z;f++)if(f in _)O(f,f,f===_.length-1)}else if(typeof Symbol==="function"&&_[Symbol.iterator]){var W=[],v=_[Symbol.iterator]();for(var H=v.next();!H.done;H=v.next())W.push(H.value);_=W;for(var z=_.length;f<z;f++)O(f,f,f===_.length-1)}else(function(){var T=void 0;if(Object.keys(_).forEach(function(J){if(T!==void 0)O(T,f-1);T=J,f++}),T!==void 0)O(T,f-1,!0)})();if(f===0)P=Y(this);return P})};Hj.exports=vj.default});var kj=F((Tj,Zj)=>{Tj.__esModule=!0;function qT(q){return q&&q.__esModule?q:{default:q}}var _T=Q6(),KT=qT(_T);Tj.default=function(q){q.registerHelper("helperMissing",function(){if(arguments.length===1)return;else throw new KT.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})};Zj.exports=Tj.default});var hj=F((Gj,uj)=>{Gj.__esModule=!0;function YT(q){return q&&q.__esModule?q:{default:q}}var Xj=N6(),fT=Q6(),Aj=YT(fT);Gj.default=function(q){q.registerHelper("if",function(_,j){if(arguments.length!=2)throw new Aj.default("#if requires exactly one argument");if(Xj.isFunction(_))_=_.call(this);if(!j.hash.includeZero&&!_||Xj.isEmpty(_))return j.inverse(this);else return j.fn(this)}),q.registerHelper("unless",function(_,j){if(arguments.length!=2)throw new Aj.default("#unless requires exactly one argument");return q.helpers.if.call(this,_,{fn:j.inverse,inverse:j.fn,hash:j.hash})})};uj.exports=Gj.default});var Vj=F((Cj,Dj)=>{Cj.__esModule=!0;Cj.default=function(q){q.registerHelper("log",function(){var _=[void 0],j=arguments[arguments.length-1];for(var K=0;K<arguments.length-1;K++)_.push(arguments[K]);var Y=1;if(j.hash.level!=null)Y=j.hash.level;else if(j.data&&j.data.level!=null)Y=j.data.level;_[0]=Y,q.log.apply(q,_)})};Dj.exports=Cj.default});var bj=F((Mj,Nj)=>{Mj.__esModule=!0;Mj.default=function(q){q.registerHelper("lookup",function(_,j,K){if(!_)return _;return K.lookupProperty(_,j)})};Nj.exports=Mj.default});var Rj=F((Sj,Ej)=>{Sj.__esModule=!0;function HT(q){return q&&q.__esModule?q:{default:q}}var f3=N6(),JT=Q6(),TT=HT(JT);Sj.default=function(q){q.registerHelper("with",function(_,j){if(arguments.length!=2)throw new TT.default("#with requires exactly one argument");if(f3.isFunction(_))_=_.call(this);var K=j.fn;if(!f3.isEmpty(_)){var Y=j.data;if(j.data&&j.ids)Y=f3.createFrame(j.data),Y.contextPath=f3.appendContextPath(j.data.contextPath,j.ids[0]);return K(_,{data:Y,blockParams:f3.blockParams([_],[Y&&Y.contextPath])})}else return j.inverse(this)})};Ej.exports=Sj.default});var $2=F((gT)=>{gT.__esModule=!0;gT.registerDefaultHelpers=IT;gT.moveHelperToHooks=mT;function C_(q){return q&&q.__esModule?q:{default:q}}var XT=Wj(),AT=C_(XT),GT=Jj(),uT=C_(GT),hT=kj(),CT=C_(hT),DT=hj(),VT=C_(DT),MT=Vj(),NT=C_(MT),bT=bj(),ST=C_(bT),ET=Rj(),RT=C_(ET);function IT(q){AT.default(q),uT.default(q),CT.default(q),VT.default(q),NT.default(q),ST.default(q),RT.default(q)}function mT(q,_,j){if(q.helpers[_]){if(q.hooks[_]=q.helpers[_],!j)delete q.helpers[_]}}});var gj=F((Ij,mj)=>{Ij.__esModule=!0;var pT=N6();Ij.default=function(q){q.registerDecorator("inline",function(_,j,K,Y){var f=_;if(!j.partials)j.partials={},f=function(P,$){var w=K.partials;K.partials=pT.extend({},w,j.partials);var O=_(P,$);return K.partials=w,O};return j.partials[Y.args[0]]=Y.fn,f})};mj.exports=Ij.default});var yj=F((oT)=>{oT.__esModule=!0;oT.registerDefaultDecorators=iT;function nT(q){return q&&q.__esModule?q:{default:q}}var cT=gj(),rT=nT(cT);function iT(q){rT.default(q)}});var O2=F((dj,Lj)=>{dj.__esModule=!0;var tT=N6(),TK={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function q(_){if(typeof _==="string"){var j=tT.indexOf(TK.methodMap,_.toLowerCase());if(j>=0)_=j;else _=parseInt(_,10)}return _},log:function q(_){if(_=TK.lookupLevel(_),typeof console!=="undefined"&&TK.lookupLevel(TK.level)<=_){var j=TK.methodMap[_];if(!console[j])j="log";for(var K=arguments.length,Y=Array(K>1?K-1:0),f=1;f<K;f++)Y[f-1]=arguments[f];console[j].apply(console,Y)}}};dj.default=TK;Lj.exports=dj.default});var pj=F((QT)=>{QT.__esModule=!0;QT.createNewLookupObject=sT;var UT=N6();function sT(){for(var q=arguments.length,_=Array(q),j=0;j<q;j++)_[j]=arguments[j];return UT.extend.apply(void 0,[Object.create(null)].concat(_))}});var w2=F((wZ)=>{wZ.__esModule=!0;wZ.createProtoAccessControl=YZ;wZ.resultIsAllowed=fZ;wZ.resetLoggedProperties=OZ;function KZ(q){return q&&q.__esModule?q:{default:q}}var lj=pj(),jZ=O2(),PZ=KZ(jZ),J7=Object.create(null);function YZ(q){var _=Object.create(null);_.constructor=!1,_.__defineGetter__=!1,_.__defineSetter__=!1,_.__lookupGetter__=!1;var j=Object.create(null);return j.__proto__=!1,{properties:{whitelist:lj.createNewLookupObject(j,q.allowedProtoProperties),defaultValue:q.allowProtoPropertiesByDefault},methods:{whitelist:lj.createNewLookupObject(_,q.allowedProtoMethods),defaultValue:q.allowProtoMethodsByDefault}}}function fZ(q,_,j){if(typeof q==="function")return xj(_.methods,j);else return xj(_.properties,j)}function xj(q,_){if(q.whitelist[_]!==void 0)return q.whitelist[_]===!0;if(q.defaultValue!==void 0)return q.defaultValue;return $Z(_),!1}function $Z(q){if(J7[q]!==!0)J7[q]=!0,PZ.default.log("error",'Handlebars: Access has been denied to resolve the property "'+q+`" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details`)}function OZ(){Object.keys(J7).forEach(function(q){delete J7[q]})}});var Z7=F((DZ)=>{DZ.__esModule=!0;DZ.HandlebarsEnvironment=v2;function nj(q){return q&&q.__esModule?q:{default:q}}var D_=N6(),JZ=Q6(),z2=nj(JZ),TZ=$2(),ZZ=yj(),kZ=O2(),T7=nj(kZ),XZ=w2(),AZ="4.7.8";DZ.VERSION=AZ;var GZ=8;DZ.COMPILER_REVISION=GZ;var uZ=7;DZ.LAST_COMPATIBLE_COMPILER_REVISION=uZ;var hZ={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};DZ.REVISION_CHANGES=hZ;var W2="[object Object]";function v2(q,_,j){this.helpers=q||{},this.partials=_||{},this.decorators=j||{},TZ.registerDefaultHelpers(this),ZZ.registerDefaultDecorators(this)}v2.prototype={constructor:v2,logger:T7.default,log:T7.default.log,registerHelper:function q(_,j){if(D_.toString.call(_)===W2){if(j)throw new z2.default("Arg not supported with multiple helpers");D_.extend(this.helpers,_)}else this.helpers[_]=j},unregisterHelper:function q(_){delete this.helpers[_]},registerPartial:function q(_,j){if(D_.toString.call(_)===W2)D_.extend(this.partials,_);else{if(typeof j==="undefined")throw new z2.default('Attempting to register a partial called "'+_+'" as undefined');this.partials[_]=j}},unregisterPartial:function q(_){delete this.partials[_]},registerDecorator:function q(_,j){if(D_.toString.call(_)===W2){if(j)throw new z2.default("Arg not supported with multiple decorators");D_.extend(this.decorators,_)}else this.decorators[_]=j},unregisterDecorator:function q(_){delete this.decorators[_]},resetLoggedPropertyAccesses:function q(){XZ.resetLoggedProperties()}};var CZ=T7.default.log;DZ.log=CZ;DZ.createFrame=D_.createFrame;DZ.logger=T7.default});var ij=F((cj,rj)=>{cj.__esModule=!0;function H2(q){this.string=q}H2.prototype.toString=H2.prototype.toHTML=function(){return""+this.string};cj.default=H2;rj.exports=cj.default});var oj=F((LZ)=>{LZ.__esModule=!0;LZ.wrapHelper=dZ;function dZ(q,_){if(typeof q!=="function")return q;var j=function K(){var Y=arguments[arguments.length-1];return arguments[arguments.length-1]=_(Y),q.apply(this,arguments)};return j}});var ej=F((sZ)=>{sZ.__esModule=!0;sZ.checkRevision=oZ;sZ.template=aZ;sZ.wrapProgram=k7;sZ.resolvePartial=BZ;sZ.invokePartial=tZ;sZ.noop=tj;function xZ(q){return q&&q.__esModule?q:{default:q}}function nZ(q){if(q&&q.__esModule)return q;else{var _={};if(q!=null){for(var j in q)if(Object.prototype.hasOwnProperty.call(q,j))_[j]=q[j]}return _.default=q,_}}var cZ=N6(),cq=nZ(cZ),rZ=Q6(),rq=xZ(rZ),iq=Z7(),aj=$2(),iZ=oj(),Bj=w2();function oZ(q){var _=q&&q[0]||1,j=iq.COMPILER_REVISION;if(_>=iq.LAST_COMPATIBLE_COMPILER_REVISION&&_<=iq.COMPILER_REVISION)return;if(_<iq.LAST_COMPATIBLE_COMPILER_REVISION){var K=iq.REVISION_CHANGES[j],Y=iq.REVISION_CHANGES[_];throw new rq.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+K+") or downgrade your runtime to an older version ("+Y+").")}else throw new rq.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+q[1]+").")}function aZ(q,_){if(!_)throw new rq.default("No environment passed to template");if(!q||!q.main)throw new rq.default("Unknown template object: "+typeof q);q.main.decorator=q.main_d,_.VM.checkRevision(q.compiler);var j=q.compiler&&q.compiler[0]===7;function K(P,$,w){if(w.hash){if($=cq.extend({},$,w.hash),w.ids)w.ids[0]=!0}P=_.VM.resolvePartial.call(this,P,$,w);var O=cq.extend({},w,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),z=_.VM.invokePartial.call(this,P,$,O);if(z==null&&_.compile)w.partials[w.name]=_.compile(P,q.compilerOptions,_),z=w.partials[w.name]($,O);if(z!=null){if(w.indent){var W=z.split(`
`);for(var v=0,H=W.length;v<H;v++){if(!W[v]&&v+1===H)break;W[v]=w.indent+W[v]}z=W.join(`
`)}return z}else throw new rq.default("The partial "+w.name+" could not be compiled when running in runtime-only mode")}var Y={strict:function P($,w,O){if(!$||!(w in $))throw new rq.default('"'+w+'" not defined in '+$,{loc:O});return Y.lookupProperty($,w)},lookupProperty:function P($,w){var O=$[w];if(O==null)return O;if(Object.prototype.hasOwnProperty.call($,w))return O;if(Bj.resultIsAllowed(O,Y.protoAccessControl,w))return O;return},lookup:function P($,w){var O=$.length;for(var z=0;z<O;z++){var W=$[z]&&Y.lookupProperty($[z],w);if(W!=null)return $[z][w]}},lambda:function P($,w){return typeof $==="function"?$.call(w):$},escapeExpression:cq.escapeExpression,invokePartial:K,fn:function P($){var w=q[$];return w.decorator=q[$+"_d"],w},programs:[],program:function P($,w,O,z,W){var v=this.programs[$],H=this.fn($);if(w||W||z||O)v=k7(this,$,H,w,O,z,W);else if(!v)v=this.programs[$]=k7(this,$,H);return v},data:function P($,w){while($&&w--)$=$._parent;return $},mergeIfNeeded:function P($,w){var O=$||w;if($&&w&&$!==w)O=cq.extend({},w,$);return O},nullContext:Object.seal({}),noop:_.VM.noop,compilerInfo:q.compiler};function f(P){var $=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],w=$.data;if(f._setup($),!$.partial&&q.useData)w=FZ(P,w);var O=void 0,z=q.useBlockParams?[]:void 0;if(q.useDepths)if($.depths)O=P!=$.depths[0]?[P].concat($.depths):$.depths;else O=[P];function W(v){return""+q.main(Y,v,Y.helpers,Y.partials,w,z,O)}return W=Fj(q.main,W,Y,$.depths||[],w,z),W(P,$)}return f.isTop=!0,f._setup=function(P){if(!P.partial){var $=cq.extend({},_.helpers,P.helpers);if(eZ($,Y),Y.helpers=$,q.usePartial)Y.partials=Y.mergeIfNeeded(P.partials,_.partials);if(q.usePartial||q.useDecorators)Y.decorators=cq.extend({},_.decorators,P.decorators);Y.hooks={},Y.protoAccessControl=Bj.createProtoAccessControl(P);var w=P.allowCallsToHelperMissing||j;aj.moveHelperToHooks(Y,"helperMissing",w),aj.moveHelperToHooks(Y,"blockHelperMissing",w)}else Y.protoAccessControl=P.protoAccessControl,Y.helpers=P.helpers,Y.partials=P.partials,Y.decorators=P.decorators,Y.hooks=P.hooks},f._child=function(P,$,w,O){if(q.useBlockParams&&!w)throw new rq.default("must pass block params");if(q.useDepths&&!O)throw new rq.default("must pass parent depths");return k7(Y,P,q[P],$,0,w,O)},f}function k7(q,_,j,K,Y,f,P){function $(w){var O=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],z=P;if(P&&w!=P[0]&&!(w===q.nullContext&&P[0]===null))z=[w].concat(P);return j(q,w,q.helpers,q.partials,O.data||K,f&&[O.blockParams].concat(f),z)}return $=Fj(j,$,q,P,K,f),$.program=_,$.depth=P?P.length:0,$.blockParams=Y||0,$}function BZ(q,_,j){if(!q)if(j.name==="@partial-block")q=j.data["partial-block"];else q=j.partials[j.name];else if(!q.call&&!j.name)j.name=q,q=j.partials[q];return q}function tZ(q,_,j){var K=j.data&&j.data["partial-block"];if(j.partial=!0,j.ids)j.data.contextPath=j.ids[0]||j.data.contextPath;var Y=void 0;if(j.fn&&j.fn!==tj)(function(){j.data=iq.createFrame(j.data);var f=j.fn;if(Y=j.data["partial-block"]=function P($){var w=arguments.length<=1||arguments[1]===void 0?{}:arguments[1];return w.data=iq.createFrame(w.data),w.data["partial-block"]=K,f($,w)},f.partials)j.partials=cq.extend({},j.partials,f.partials)})();if(q===void 0&&Y)q=Y;if(q===void 0)throw new rq.default("The partial "+j.name+" could not be found");else if(q instanceof Function)return q(_,j)}function tj(){return""}function FZ(q,_){if(!_||!("root"in _))_=_?iq.createFrame(_):{},_.root=q;return _}function Fj(q,_,j,K,Y,f){if(q.decorator){var P={};_=q.decorator(_,P,j,K&&K[0],Y,f,K),cq.extend(_,P)}return _}function eZ(q,_){Object.keys(q).forEach(function(j){var K=q[j];q[j]=UZ(K,_)})}function UZ(q,_){var j=_.lookupProperty;return iZ.wrapHelper(q,function(K){return cq.extend({lookupProperty:j},K)})}});var J2=F((Uj,sj)=>{Uj.__esModule=!0;Uj.default=function(q){(function(){if(typeof globalThis==="object")return;Object.prototype.__defineGetter__("__magic__",function(){return this}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__})();var _=globalThis.Handlebars;q.noConflict=function(){if(globalThis.Handlebars===q)globalThis.Handlebars=_;return q}};sj.exports=Uj.default});var PP=F((KP,jP)=>{KP.__esModule=!0;function Z2(q){return q&&q.__esModule?q:{default:q}}function k2(q){if(q&&q.__esModule)return q;else{var _={};if(q!=null){for(var j in q)if(Object.prototype.hasOwnProperty.call(q,j))_[j]=q[j]}return _.default=q,_}}var Ok=Z7(),Qj=k2(Ok),wk=ij(),zk=Z2(wk),Wk=Q6(),vk=Z2(Wk),Hk=N6(),T2=k2(Hk),Jk=ej(),qP=k2(Jk),Tk=J2(),Zk=Z2(Tk);function _P(){var q=new Qj.HandlebarsEnvironment;return T2.extend(q,Qj),q.SafeString=zk.default,q.Exception=vk.default,q.Utils=T2,q.escapeExpression=T2.escapeExpression,q.VM=qP,q.template=function(_){return qP.template(_,q)},q}var $3=_P();$3.create=_P;Zk.default($3);$3.default=$3;KP.default=$3;jP.exports=KP.default});var X2=F((fP,$P)=>{fP.__esModule=!0;var YP={helpers:{helperExpression:function q(_){return _.type==="SubExpression"||(_.type==="MustacheStatement"||_.type==="BlockStatement")&&!!(_.params&&_.params.length||_.hash)},scopedId:function q(_){return/^\.|this\b/.test(_.original)},simpleId:function q(_){return _.parts.length===1&&!YP.helpers.scopedId(_)&&!_.depth}}};fP.default=YP;$P.exports=fP.default});var zP=F((OP,wP)=>{OP.__esModule=!0;var uk=function(){var q={trace:function K(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,partialBlock:12,content:13,COMMENT:14,CONTENT:15,openRawBlock:16,rawBlock_repetition0:17,END_RAW_BLOCK:18,OPEN_RAW_BLOCK:19,helperName:20,openRawBlock_repetition0:21,openRawBlock_option0:22,CLOSE_RAW_BLOCK:23,openBlock:24,block_option0:25,closeBlock:26,openInverse:27,block_option1:28,OPEN_BLOCK:29,openBlock_repetition0:30,openBlock_option0:31,openBlock_option1:32,CLOSE:33,OPEN_INVERSE:34,openInverse_repetition0:35,openInverse_option0:36,openInverse_option1:37,openInverseChain:38,OPEN_INVERSE_CHAIN:39,openInverseChain_repetition0:40,openInverseChain_option0:41,openInverseChain_option1:42,inverseAndProgram:43,INVERSE:44,inverseChain:45,inverseChain_option0:46,OPEN_ENDBLOCK:47,OPEN:48,mustache_repetition0:49,mustache_option0:50,OPEN_UNESCAPED:51,mustache_repetition1:52,mustache_option1:53,CLOSE_UNESCAPED:54,OPEN_PARTIAL:55,partialName:56,partial_repetition0:57,partial_option0:58,openPartialBlock:59,OPEN_PARTIAL_BLOCK:60,openPartialBlock_repetition0:61,openPartialBlock_option0:62,param:63,sexpr:64,OPEN_SEXPR:65,sexpr_repetition0:66,sexpr_option0:67,CLOSE_SEXPR:68,hash:69,hash_repetition_plus0:70,hashSegment:71,ID:72,EQUALS:73,blockParams:74,OPEN_BLOCK_PARAMS:75,blockParams_repetition_plus0:76,CLOSE_BLOCK_PARAMS:77,path:78,dataName:79,STRING:80,NUMBER:81,BOOLEAN:82,UNDEFINED:83,NULL:84,DATA:85,pathSegments:86,SEP:87,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"COMMENT",15:"CONTENT",18:"END_RAW_BLOCK",19:"OPEN_RAW_BLOCK",23:"CLOSE_RAW_BLOCK",29:"OPEN_BLOCK",33:"CLOSE",34:"OPEN_INVERSE",39:"OPEN_INVERSE_CHAIN",44:"INVERSE",47:"OPEN_ENDBLOCK",48:"OPEN",51:"OPEN_UNESCAPED",54:"CLOSE_UNESCAPED",55:"OPEN_PARTIAL",60:"OPEN_PARTIAL_BLOCK",65:"OPEN_SEXPR",68:"CLOSE_SEXPR",72:"ID",73:"EQUALS",75:"OPEN_BLOCK_PARAMS",77:"CLOSE_BLOCK_PARAMS",80:"STRING",81:"NUMBER",82:"BOOLEAN",83:"UNDEFINED",84:"NULL",85:"DATA",87:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[13,1],[10,3],[16,5],[9,4],[9,4],[24,6],[27,6],[38,6],[43,2],[45,3],[45,1],[26,3],[8,5],[8,5],[11,5],[12,3],[59,5],[63,1],[63,1],[64,5],[69,1],[71,3],[74,3],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[56,1],[56,1],[79,2],[78,1],[86,3],[86,1],[6,0],[6,2],[17,0],[17,2],[21,0],[21,2],[22,0],[22,1],[25,0],[25,1],[28,0],[28,1],[30,0],[30,2],[31,0],[31,1],[32,0],[32,1],[35,0],[35,2],[36,0],[36,1],[37,0],[37,1],[40,0],[40,2],[41,0],[41,1],[42,0],[42,1],[46,0],[46,1],[49,0],[49,2],[50,0],[50,1],[52,0],[52,2],[53,0],[53,1],[57,0],[57,2],[58,0],[58,1],[61,0],[61,2],[62,0],[62,1],[66,0],[66,2],[67,0],[67,1],[70,1],[70,2],[76,1],[76,2]],performAction:function K(Y,f,P,$,w,O,z){var W=O.length-1;switch(w){case 1:return O[W-1];case 2:this.$=$.prepareProgram(O[W]);break;case 3:this.$=O[W];break;case 4:this.$=O[W];break;case 5:this.$=O[W];break;case 6:this.$=O[W];break;case 7:this.$=O[W];break;case 8:this.$=O[W];break;case 9:this.$={type:"CommentStatement",value:$.stripComment(O[W]),strip:$.stripFlags(O[W],O[W]),loc:$.locInfo(this._$)};break;case 10:this.$={type:"ContentStatement",original:O[W],value:O[W],loc:$.locInfo(this._$)};break;case 11:this.$=$.prepareRawBlock(O[W-2],O[W-1],O[W],this._$);break;case 12:this.$={path:O[W-3],params:O[W-2],hash:O[W-1]};break;case 13:this.$=$.prepareBlock(O[W-3],O[W-2],O[W-1],O[W],!1,this._$);break;case 14:this.$=$.prepareBlock(O[W-3],O[W-2],O[W-1],O[W],!0,this._$);break;case 15:this.$={open:O[W-5],path:O[W-4],params:O[W-3],hash:O[W-2],blockParams:O[W-1],strip:$.stripFlags(O[W-5],O[W])};break;case 16:this.$={path:O[W-4],params:O[W-3],hash:O[W-2],blockParams:O[W-1],strip:$.stripFlags(O[W-5],O[W])};break;case 17:this.$={path:O[W-4],params:O[W-3],hash:O[W-2],blockParams:O[W-1],strip:$.stripFlags(O[W-5],O[W])};break;case 18:this.$={strip:$.stripFlags(O[W-1],O[W-1]),program:O[W]};break;case 19:var v=$.prepareBlock(O[W-2],O[W-1],O[W],O[W],!1,this._$),H=$.prepareProgram([v],O[W-1].loc);H.chained=!0,this.$={strip:O[W-2].strip,program:H,chain:!0};break;case 20:this.$=O[W];break;case 21:this.$={path:O[W-1],strip:$.stripFlags(O[W-2],O[W])};break;case 22:this.$=$.prepareMustache(O[W-3],O[W-2],O[W-1],O[W-4],$.stripFlags(O[W-4],O[W]),this._$);break;case 23:this.$=$.prepareMustache(O[W-3],O[W-2],O[W-1],O[W-4],$.stripFlags(O[W-4],O[W]),this._$);break;case 24:this.$={type:"PartialStatement",name:O[W-3],params:O[W-2],hash:O[W-1],indent:"",strip:$.stripFlags(O[W-4],O[W]),loc:$.locInfo(this._$)};break;case 25:this.$=$.preparePartialBlock(O[W-2],O[W-1],O[W],this._$);break;case 26:this.$={path:O[W-3],params:O[W-2],hash:O[W-1],strip:$.stripFlags(O[W-4],O[W])};break;case 27:this.$=O[W];break;case 28:this.$=O[W];break;case 29:this.$={type:"SubExpression",path:O[W-3],params:O[W-2],hash:O[W-1],loc:$.locInfo(this._$)};break;case 30:this.$={type:"Hash",pairs:O[W],loc:$.locInfo(this._$)};break;case 31:this.$={type:"HashPair",key:$.id(O[W-2]),value:O[W],loc:$.locInfo(this._$)};break;case 32:this.$=$.id(O[W-1]);break;case 33:this.$=O[W];break;case 34:this.$=O[W];break;case 35:this.$={type:"StringLiteral",value:O[W],original:O[W],loc:$.locInfo(this._$)};break;case 36:this.$={type:"NumberLiteral",value:Number(O[W]),original:Number(O[W]),loc:$.locInfo(this._$)};break;case 37:this.$={type:"BooleanLiteral",value:O[W]==="true",original:O[W]==="true",loc:$.locInfo(this._$)};break;case 38:this.$={type:"UndefinedLiteral",original:void 0,value:void 0,loc:$.locInfo(this._$)};break;case 39:this.$={type:"NullLiteral",original:null,value:null,loc:$.locInfo(this._$)};break;case 40:this.$=O[W];break;case 41:this.$=O[W];break;case 42:this.$=$.preparePath(!0,O[W],this._$);break;case 43:this.$=$.preparePath(!1,O[W],this._$);break;case 44:O[W-2].push({part:$.id(O[W]),original:O[W],separator:O[W-1]}),this.$=O[W-2];break;case 45:this.$=[{part:$.id(O[W]),original:O[W]}];break;case 46:this.$=[];break;case 47:O[W-1].push(O[W]);break;case 48:this.$=[];break;case 49:O[W-1].push(O[W]);break;case 50:this.$=[];break;case 51:O[W-1].push(O[W]);break;case 58:this.$=[];break;case 59:O[W-1].push(O[W]);break;case 64:this.$=[];break;case 65:O[W-1].push(O[W]);break;case 70:this.$=[];break;case 71:O[W-1].push(O[W]);break;case 78:this.$=[];break;case 79:O[W-1].push(O[W]);break;case 82:this.$=[];break;case 83:O[W-1].push(O[W]);break;case 86:this.$=[];break;case 87:O[W-1].push(O[W]);break;case 90:this.$=[];break;case 91:O[W-1].push(O[W]);break;case 94:this.$=[];break;case 95:O[W-1].push(O[W]);break;case 98:this.$=[O[W]];break;case 99:O[W-1].push(O[W]);break;case 100:this.$=[O[W]];break;case 101:O[W-1].push(O[W]);break}},table:[{3:1,4:2,5:[2,46],6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:11,14:[1,12],15:[1,20],16:17,19:[1,23],24:15,27:16,29:[1,21],34:[1,22],39:[2,2],44:[2,2],47:[2,2],48:[1,13],51:[1,14],55:[1,18],59:19,60:[1,24]},{1:[2,1]},{5:[2,47],14:[2,47],15:[2,47],19:[2,47],29:[2,47],34:[2,47],39:[2,47],44:[2,47],47:[2,47],48:[2,47],51:[2,47],55:[2,47],60:[2,47]},{5:[2,3],14:[2,3],15:[2,3],19:[2,3],29:[2,3],34:[2,3],39:[2,3],44:[2,3],47:[2,3],48:[2,3],51:[2,3],55:[2,3],60:[2,3]},{5:[2,4],14:[2,4],15:[2,4],19:[2,4],29:[2,4],34:[2,4],39:[2,4],44:[2,4],47:[2,4],48:[2,4],51:[2,4],55:[2,4],60:[2,4]},{5:[2,5],14:[2,5],15:[2,5],19:[2,5],29:[2,5],34:[2,5],39:[2,5],44:[2,5],47:[2,5],48:[2,5],51:[2,5],55:[2,5],60:[2,5]},{5:[2,6],14:[2,6],15:[2,6],19:[2,6],29:[2,6],34:[2,6],39:[2,6],44:[2,6],47:[2,6],48:[2,6],51:[2,6],55:[2,6],60:[2,6]},{5:[2,7],14:[2,7],15:[2,7],19:[2,7],29:[2,7],34:[2,7],39:[2,7],44:[2,7],47:[2,7],48:[2,7],51:[2,7],55:[2,7],60:[2,7]},{5:[2,8],14:[2,8],15:[2,8],19:[2,8],29:[2,8],34:[2,8],39:[2,8],44:[2,8],47:[2,8],48:[2,8],51:[2,8],55:[2,8],60:[2,8]},{5:[2,9],14:[2,9],15:[2,9],19:[2,9],29:[2,9],34:[2,9],39:[2,9],44:[2,9],47:[2,9],48:[2,9],51:[2,9],55:[2,9],60:[2,9]},{20:25,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:36,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:37,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{4:38,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{15:[2,48],17:39,18:[2,48]},{20:41,56:40,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:44,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{5:[2,10],14:[2,10],15:[2,10],18:[2,10],19:[2,10],29:[2,10],34:[2,10],39:[2,10],44:[2,10],47:[2,10],48:[2,10],51:[2,10],55:[2,10],60:[2,10]},{20:45,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:46,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:47,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:41,56:48,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[2,78],49:49,65:[2,78],72:[2,78],80:[2,78],81:[2,78],82:[2,78],83:[2,78],84:[2,78],85:[2,78]},{23:[2,33],33:[2,33],54:[2,33],65:[2,33],68:[2,33],72:[2,33],75:[2,33],80:[2,33],81:[2,33],82:[2,33],83:[2,33],84:[2,33],85:[2,33]},{23:[2,34],33:[2,34],54:[2,34],65:[2,34],68:[2,34],72:[2,34],75:[2,34],80:[2,34],81:[2,34],82:[2,34],83:[2,34],84:[2,34],85:[2,34]},{23:[2,35],33:[2,35],54:[2,35],65:[2,35],68:[2,35],72:[2,35],75:[2,35],80:[2,35],81:[2,35],82:[2,35],83:[2,35],84:[2,35],85:[2,35]},{23:[2,36],33:[2,36],54:[2,36],65:[2,36],68:[2,36],72:[2,36],75:[2,36],80:[2,36],81:[2,36],82:[2,36],83:[2,36],84:[2,36],85:[2,36]},{23:[2,37],33:[2,37],54:[2,37],65:[2,37],68:[2,37],72:[2,37],75:[2,37],80:[2,37],81:[2,37],82:[2,37],83:[2,37],84:[2,37],85:[2,37]},{23:[2,38],33:[2,38],54:[2,38],65:[2,38],68:[2,38],72:[2,38],75:[2,38],80:[2,38],81:[2,38],82:[2,38],83:[2,38],84:[2,38],85:[2,38]},{23:[2,39],33:[2,39],54:[2,39],65:[2,39],68:[2,39],72:[2,39],75:[2,39],80:[2,39],81:[2,39],82:[2,39],83:[2,39],84:[2,39],85:[2,39]},{23:[2,43],33:[2,43],54:[2,43],65:[2,43],68:[2,43],72:[2,43],75:[2,43],80:[2,43],81:[2,43],82:[2,43],83:[2,43],84:[2,43],85:[2,43],87:[1,50]},{72:[1,35],86:51},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{52:52,54:[2,82],65:[2,82],72:[2,82],80:[2,82],81:[2,82],82:[2,82],83:[2,82],84:[2,82],85:[2,82]},{25:53,38:55,39:[1,57],43:56,44:[1,58],45:54,47:[2,54]},{28:59,43:60,44:[1,58],47:[2,56]},{13:62,15:[1,20],18:[1,61]},{33:[2,86],57:63,65:[2,86],72:[2,86],80:[2,86],81:[2,86],82:[2,86],83:[2,86],84:[2,86],85:[2,86]},{33:[2,40],65:[2,40],72:[2,40],80:[2,40],81:[2,40],82:[2,40],83:[2,40],84:[2,40],85:[2,40]},{33:[2,41],65:[2,41],72:[2,41],80:[2,41],81:[2,41],82:[2,41],83:[2,41],84:[2,41],85:[2,41]},{20:64,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:65,47:[1,66]},{30:67,33:[2,58],65:[2,58],72:[2,58],75:[2,58],80:[2,58],81:[2,58],82:[2,58],83:[2,58],84:[2,58],85:[2,58]},{33:[2,64],35:68,65:[2,64],72:[2,64],75:[2,64],80:[2,64],81:[2,64],82:[2,64],83:[2,64],84:[2,64],85:[2,64]},{21:69,23:[2,50],65:[2,50],72:[2,50],80:[2,50],81:[2,50],82:[2,50],83:[2,50],84:[2,50],85:[2,50]},{33:[2,90],61:70,65:[2,90],72:[2,90],80:[2,90],81:[2,90],82:[2,90],83:[2,90],84:[2,90],85:[2,90]},{20:74,33:[2,80],50:71,63:72,64:75,65:[1,43],69:73,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{72:[1,79]},{23:[2,42],33:[2,42],54:[2,42],65:[2,42],68:[2,42],72:[2,42],75:[2,42],80:[2,42],81:[2,42],82:[2,42],83:[2,42],84:[2,42],85:[2,42],87:[1,50]},{20:74,53:80,54:[2,84],63:81,64:75,65:[1,43],69:82,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:83,47:[1,66]},{47:[2,55]},{4:84,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{47:[2,20]},{20:85,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:86,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{26:87,47:[1,66]},{47:[2,57]},{5:[2,11],14:[2,11],15:[2,11],19:[2,11],29:[2,11],34:[2,11],39:[2,11],44:[2,11],47:[2,11],48:[2,11],51:[2,11],55:[2,11],60:[2,11]},{15:[2,49],18:[2,49]},{20:74,33:[2,88],58:88,63:89,64:75,65:[1,43],69:90,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{65:[2,94],66:91,68:[2,94],72:[2,94],80:[2,94],81:[2,94],82:[2,94],83:[2,94],84:[2,94],85:[2,94]},{5:[2,25],14:[2,25],15:[2,25],19:[2,25],29:[2,25],34:[2,25],39:[2,25],44:[2,25],47:[2,25],48:[2,25],51:[2,25],55:[2,25],60:[2,25]},{20:92,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,31:93,33:[2,60],63:94,64:75,65:[1,43],69:95,70:76,71:77,72:[1,78],75:[2,60],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,66],36:96,63:97,64:75,65:[1,43],69:98,70:76,71:77,72:[1,78],75:[2,66],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,22:99,23:[2,52],63:100,64:75,65:[1,43],69:101,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,92],62:102,63:103,64:75,65:[1,43],69:104,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,105]},{33:[2,79],65:[2,79],72:[2,79],80:[2,79],81:[2,79],82:[2,79],83:[2,79],84:[2,79],85:[2,79]},{33:[2,81]},{23:[2,27],33:[2,27],54:[2,27],65:[2,27],68:[2,27],72:[2,27],75:[2,27],80:[2,27],81:[2,27],82:[2,27],83:[2,27],84:[2,27],85:[2,27]},{23:[2,28],33:[2,28],54:[2,28],65:[2,28],68:[2,28],72:[2,28],75:[2,28],80:[2,28],81:[2,28],82:[2,28],83:[2,28],84:[2,28],85:[2,28]},{23:[2,30],33:[2,30],54:[2,30],68:[2,30],71:106,72:[1,107],75:[2,30]},{23:[2,98],33:[2,98],54:[2,98],68:[2,98],72:[2,98],75:[2,98]},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],73:[1,108],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{23:[2,44],33:[2,44],54:[2,44],65:[2,44],68:[2,44],72:[2,44],75:[2,44],80:[2,44],81:[2,44],82:[2,44],83:[2,44],84:[2,44],85:[2,44],87:[2,44]},{54:[1,109]},{54:[2,83],65:[2,83],72:[2,83],80:[2,83],81:[2,83],82:[2,83],83:[2,83],84:[2,83],85:[2,83]},{54:[2,85]},{5:[2,13],14:[2,13],15:[2,13],19:[2,13],29:[2,13],34:[2,13],39:[2,13],44:[2,13],47:[2,13],48:[2,13],51:[2,13],55:[2,13],60:[2,13]},{38:55,39:[1,57],43:56,44:[1,58],45:111,46:110,47:[2,76]},{33:[2,70],40:112,65:[2,70],72:[2,70],75:[2,70],80:[2,70],81:[2,70],82:[2,70],83:[2,70],84:[2,70],85:[2,70]},{47:[2,18]},{5:[2,14],14:[2,14],15:[2,14],19:[2,14],29:[2,14],34:[2,14],39:[2,14],44:[2,14],47:[2,14],48:[2,14],51:[2,14],55:[2,14],60:[2,14]},{33:[1,113]},{33:[2,87],65:[2,87],72:[2,87],80:[2,87],81:[2,87],82:[2,87],83:[2,87],84:[2,87],85:[2,87]},{33:[2,89]},{20:74,63:115,64:75,65:[1,43],67:114,68:[2,96],69:116,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,117]},{32:118,33:[2,62],74:119,75:[1,120]},{33:[2,59],65:[2,59],72:[2,59],75:[2,59],80:[2,59],81:[2,59],82:[2,59],83:[2,59],84:[2,59],85:[2,59]},{33:[2,61],75:[2,61]},{33:[2,68],37:121,74:122,75:[1,120]},{33:[2,65],65:[2,65],72:[2,65],75:[2,65],80:[2,65],81:[2,65],82:[2,65],83:[2,65],84:[2,65],85:[2,65]},{33:[2,67],75:[2,67]},{23:[1,123]},{23:[2,51],65:[2,51],72:[2,51],80:[2,51],81:[2,51],82:[2,51],83:[2,51],84:[2,51],85:[2,51]},{23:[2,53]},{33:[1,124]},{33:[2,91],65:[2,91],72:[2,91],80:[2,91],81:[2,91],82:[2,91],83:[2,91],84:[2,91],85:[2,91]},{33:[2,93]},{5:[2,22],14:[2,22],15:[2,22],19:[2,22],29:[2,22],34:[2,22],39:[2,22],44:[2,22],47:[2,22],48:[2,22],51:[2,22],55:[2,22],60:[2,22]},{23:[2,99],33:[2,99],54:[2,99],68:[2,99],72:[2,99],75:[2,99]},{73:[1,108]},{20:74,63:125,64:75,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,23],14:[2,23],15:[2,23],19:[2,23],29:[2,23],34:[2,23],39:[2,23],44:[2,23],47:[2,23],48:[2,23],51:[2,23],55:[2,23],60:[2,23]},{47:[2,19]},{47:[2,77]},{20:74,33:[2,72],41:126,63:127,64:75,65:[1,43],69:128,70:76,71:77,72:[1,78],75:[2,72],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,24],14:[2,24],15:[2,24],19:[2,24],29:[2,24],34:[2,24],39:[2,24],44:[2,24],47:[2,24],48:[2,24],51:[2,24],55:[2,24],60:[2,24]},{68:[1,129]},{65:[2,95],68:[2,95],72:[2,95],80:[2,95],81:[2,95],82:[2,95],83:[2,95],84:[2,95],85:[2,95]},{68:[2,97]},{5:[2,21],14:[2,21],15:[2,21],19:[2,21],29:[2,21],34:[2,21],39:[2,21],44:[2,21],47:[2,21],48:[2,21],51:[2,21],55:[2,21],60:[2,21]},{33:[1,130]},{33:[2,63]},{72:[1,132],76:131},{33:[1,133]},{33:[2,69]},{15:[2,12],18:[2,12]},{14:[2,26],15:[2,26],19:[2,26],29:[2,26],34:[2,26],47:[2,26],48:[2,26],51:[2,26],55:[2,26],60:[2,26]},{23:[2,31],33:[2,31],54:[2,31],68:[2,31],72:[2,31],75:[2,31]},{33:[2,74],42:134,74:135,75:[1,120]},{33:[2,71],65:[2,71],72:[2,71],75:[2,71],80:[2,71],81:[2,71],82:[2,71],83:[2,71],84:[2,71],85:[2,71]},{33:[2,73],75:[2,73]},{23:[2,29],33:[2,29],54:[2,29],65:[2,29],68:[2,29],72:[2,29],75:[2,29],80:[2,29],81:[2,29],82:[2,29],83:[2,29],84:[2,29],85:[2,29]},{14:[2,15],15:[2,15],19:[2,15],29:[2,15],34:[2,15],39:[2,15],44:[2,15],47:[2,15],48:[2,15],51:[2,15],55:[2,15],60:[2,15]},{72:[1,137],77:[1,136]},{72:[2,100],77:[2,100]},{14:[2,16],15:[2,16],19:[2,16],29:[2,16],34:[2,16],44:[2,16],47:[2,16],48:[2,16],51:[2,16],55:[2,16],60:[2,16]},{33:[1,138]},{33:[2,75]},{33:[2,32]},{72:[2,101],77:[2,101]},{14:[2,17],15:[2,17],19:[2,17],29:[2,17],34:[2,17],39:[2,17],44:[2,17],47:[2,17],48:[2,17],51:[2,17],55:[2,17],60:[2,17]}],defaultActions:{4:[2,1],54:[2,55],56:[2,20],60:[2,57],73:[2,81],82:[2,85],86:[2,18],90:[2,89],101:[2,53],104:[2,93],110:[2,19],111:[2,77],116:[2,97],119:[2,63],122:[2,69],135:[2,75],136:[2,32]},parseError:function K(Y,f){throw new Error(Y)},parse:function K(Y){var f=this,P=[0],$=[null],w=[],O=this.table,z="",W=0,v=0,H=0,T=2,J=1;if(this.lexer.setInput(Y),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,typeof this.lexer.yylloc=="undefined")this.lexer.yylloc={};var k=this.lexer.yylloc;w.push(k);var A=this.lexer.options&&this.lexer.options.ranges;if(typeof this.yy.parseError==="function")this.parseError=this.yy.parseError;function G(B){P.length=P.length-2*B,$.length=$.length-B,w.length=w.length-B}function u(){var B=f.lexer.lex()||1;if(typeof B!=="number")B=f.symbols_[B]||B;return B}var V,m,N,R,p,b,d={},y,M,S,L;while(!0){if(N=P[P.length-1],this.defaultActions[N])R=this.defaultActions[N];else{if(V===null||typeof V=="undefined")V=u();R=O[N]&&O[N][V]}if(typeof R==="undefined"||!R.length||!R[0]){var c="";if(!H){L=[];for(y in O[N])if(this.terminals_[y]&&y>2)L.push("'"+this.terminals_[y]+"'");if(this.lexer.showPosition)c="Parse error on line "+(W+1)+`:
`+this.lexer.showPosition()+`
Expecting `+L.join(", ")+", got '"+(this.terminals_[V]||V)+"'";else c="Parse error on line "+(W+1)+": Unexpected "+(V==1?"end of input":"'"+(this.terminals_[V]||V)+"'");this.parseError(c,{text:this.lexer.match,token:this.terminals_[V]||V,line:this.lexer.yylineno,loc:k,expected:L})}}if(R[0]instanceof Array&&R.length>1)throw new Error("Parse Error: multiple actions possible at state: "+N+", token: "+V);switch(R[0]){case 1:if(P.push(V),$.push(this.lexer.yytext),w.push(this.lexer.yylloc),P.push(R[1]),V=null,!m){if(v=this.lexer.yyleng,z=this.lexer.yytext,W=this.lexer.yylineno,k=this.lexer.yylloc,H>0)H--}else V=m,m=null;break;case 2:if(M=this.productions_[R[1]][1],d.$=$[$.length-M],d._$={first_line:w[w.length-(M||1)].first_line,last_line:w[w.length-1].last_line,first_column:w[w.length-(M||1)].first_column,last_column:w[w.length-1].last_column},A)d._$.range=[w[w.length-(M||1)].range[0],w[w.length-1].range[1]];if(b=this.performAction.call(d,z,v,W,this.yy,R[1],$,w),typeof b!=="undefined")return b;if(M)P=P.slice(0,-1*M*2),$=$.slice(0,-1*M),w=w.slice(0,-1*M);P.push(this.productions_[R[1]][0]),$.push(d.$),w.push(d._$),S=O[P[P.length-2]][P[P.length-1]],P.push(S);break;case 3:return!0}}return!0}},_=function(){var K={EOF:1,parseError:function Y(f,P){if(this.yy.parser)this.yy.parser.parseError(f,P);else throw new Error(f)},setInput:function Y(f){if(this._input=f,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges)this.yylloc.range=[0,0];return this.offset=0,this},input:function Y(){var f=this._input[0];this.yytext+=f,this.yyleng++,this.offset++,this.match+=f,this.matched+=f;var P=f.match(/(?:\r\n?|\n).*/g);if(P)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),f},unput:function Y(f){var P=f.length,$=f.split(/(?:\r\n?|\n)/g);this._input=f+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-P-1),this.offset-=P;var w=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),$.length-1)this.yylineno-=$.length-1;var O=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:$?($.length===w.length?this.yylloc.first_column:0)+w[w.length-$.length].length-$[0].length:this.yylloc.first_column-P},this.options.ranges)this.yylloc.range=[O[0],O[0]+this.yyleng-P];return this},more:function Y(){return this._more=!0,this},less:function Y(f){this.unput(this.match.slice(f))},pastInput:function Y(){var f=this.matched.substr(0,this.matched.length-this.match.length);return(f.length>20?"...":"")+f.substr(-20).replace(/\n/g,"")},upcomingInput:function Y(){var f=this.match;if(f.length<20)f+=this._input.substr(0,20-f.length);return(f.substr(0,20)+(f.length>20?"...":"")).replace(/\n/g,"")},showPosition:function Y(){var f=this.pastInput(),P=new Array(f.length+1).join("-");return f+this.upcomingInput()+`
`+P+"^"},next:function Y(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var f,P,$,w,O,z;if(!this._more)this.yytext="",this.match="";var W=this._currentRules();for(var v=0;v<W.length;v++)if($=this._input.match(this.rules[W[v]]),$&&(!P||$[0].length>P[0].length)){if(P=$,w=v,!this.options.flex)break}if(P){if(z=P[0].match(/(?:\r\n?|\n).*/g),z)this.yylineno+=z.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:z?z[z.length-1].length-z[z.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+P[0].length},this.yytext+=P[0],this.match+=P[0],this.matches=P,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._input=this._input.slice(P[0].length),this.matched+=P[0],f=this.performAction.call(this,this.yy,this,W[w],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(f)return f;else return}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function Y(){var f=this.next();if(typeof f!=="undefined")return f;else return this.lex()},begin:function Y(f){this.conditionStack.push(f)},popState:function Y(){return this.conditionStack.pop()},_currentRules:function Y(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function Y(){return this.conditionStack[this.conditionStack.length-2]},pushState:function Y(f){this.begin(f)}};return K.options={},K.performAction=function Y(f,P,$,w){function O(W,v){return P.yytext=P.yytext.substring(W,P.yyleng-v+W)}var z=w;switch($){case 0:if(P.yytext.slice(-2)==="\\\\")O(0,1),this.begin("mu");else if(P.yytext.slice(-1)==="\\")O(0,1),this.begin("emu");else this.begin("mu");if(P.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;break;case 3:return this.begin("raw"),15;break;case 4:if(this.popState(),this.conditionStack[this.conditionStack.length-1]==="raw")return 15;else return O(5,9),"END_RAW_BLOCK";break;case 5:return 15;case 6:return this.popState(),14;break;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;break;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;break;case 16:return this.popState(),44;break;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(P.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;break;case 23:return 48;case 24:return 73;case 25:return 72;case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;break;case 30:return this.popState(),33;break;case 31:return P.yytext=O(1,2).replace(/\\"/g,'"'),80;break;case 32:return P.yytext=O(1,2).replace(/\\'/g,"'"),80;break;case 33:return 85;case 34:return 82;case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return P.yytext=P.yytext.replace(/\\([\\\]])/g,"$1"),72;break;case 43:return"INVALID";case 44:return 5}},K.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],K.conditions={mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}},K}();q.lexer=_;function j(){this.yy={}}return j.prototype=q,q.Parser=j,new j}();OP.default=uk;wP.exports=OP.default});var G7=F((HP,JP)=>{HP.__esModule=!0;function Dk(q){return q&&q.__esModule?q:{default:q}}var Vk=Q6(),A2=Dk(Vk);function X7(){this.parents=[]}X7.prototype={constructor:X7,mutating:!1,acceptKey:function q(_,j){var K=this.accept(_[j]);if(this.mutating){if(K&&!X7.prototype[K.type])throw new A2.default('Unexpected node type "'+K.type+'" found when accepting '+j+" on "+_.type);_[j]=K}},acceptRequired:function q(_,j){if(this.acceptKey(_,j),!_[j])throw new A2.default(_.type+" requires "+j)},acceptArray:function q(_){for(var j=0,K=_.length;j<K;j++)if(this.acceptKey(_,j),!_[j])_.splice(j,1),j--,K--},accept:function q(_){if(!_)return;if(!this[_.type])throw new A2.default("Unknown type: "+_.type,_);if(this.current)this.parents.unshift(this.current);this.current=_;var j=this[_.type](_);if(this.current=this.parents.shift(),!this.mutating||j)return j;else if(j!==!1)return _},Program:function q(_){this.acceptArray(_.body)},MustacheStatement:A7,Decorator:A7,BlockStatement:WP,DecoratorBlock:WP,PartialStatement:vP,PartialBlockStatement:function q(_){vP.call(this,_),this.acceptKey(_,"program")},ContentStatement:function q(){},CommentStatement:function q(){},SubExpression:A7,PathExpression:function q(){},StringLiteral:function q(){},NumberLiteral:function q(){},BooleanLiteral:function q(){},UndefinedLiteral:function q(){},NullLiteral:function q(){},Hash:function q(_){this.acceptArray(_.pairs)},HashPair:function q(_){this.acceptRequired(_,"value")}};function A7(q){this.acceptRequired(q,"path"),this.acceptArray(q.params),this.acceptKey(q,"hash")}function WP(q){A7.call(this,q),this.acceptKey(q,"program"),this.acceptKey(q,"inverse")}function vP(q){this.acceptRequired(q,"name"),this.acceptArray(q.params),this.acceptKey(q,"hash")}HP.default=X7;JP.exports=HP.default});var kP=F((TP,ZP)=>{TP.__esModule=!0;function bk(q){return q&&q.__esModule?q:{default:q}}var Sk=G7(),Ek=bk(Sk);function Vq(){var q=arguments.length<=0||arguments[0]===void 0?{}:arguments[0];this.options=q}Vq.prototype=new Ek.default;Vq.prototype.Program=function(q){var _=!this.options.ignoreStandalone,j=!this.isRootSeen;this.isRootSeen=!0;var K=q.body;for(var Y=0,f=K.length;Y<f;Y++){var P=K[Y],$=this.accept(P);if(!$)continue;var w=G2(K,Y,j),O=u2(K,Y,j),z=$.openStandalone&&w,W=$.closeStandalone&&O,v=$.inlineStandalone&&w&&O;if($.close)V_(K,Y,!0);if($.open)__(K,Y,!0);if(_&&v){if(V_(K,Y),__(K,Y)){if(P.type==="PartialStatement")P.indent=/([ \t]+$)/.exec(K[Y-1].original)[1]}}if(_&&z)V_((P.program||P.inverse).body),__(K,Y);if(_&&W)V_(K,Y),__((P.inverse||P.program).body)}return q};Vq.prototype.BlockStatement=Vq.prototype.DecoratorBlock=Vq.prototype.PartialBlockStatement=function(q){this.accept(q.program),this.accept(q.inverse);var _=q.program||q.inverse,j=q.program&&q.inverse,K=j,Y=j;if(j&&j.chained){K=j.body[0].program;while(Y.chained)Y=Y.body[Y.body.length-1].program}var f={open:q.openStrip.open,close:q.closeStrip.close,openStandalone:u2(_.body),closeStandalone:G2((K||_).body)};if(q.openStrip.close)V_(_.body,null,!0);if(j){var P=q.inverseStrip;if(P.open)__(_.body,null,!0);if(P.close)V_(K.body,null,!0);if(q.closeStrip.open)__(Y.body,null,!0);if(!this.options.ignoreStandalone&&G2(_.body)&&u2(K.body))__(_.body),V_(K.body)}else if(q.closeStrip.open)__(_.body,null,!0);return f};Vq.prototype.Decorator=Vq.prototype.MustacheStatement=function(q){return q.strip};Vq.prototype.PartialStatement=Vq.prototype.CommentStatement=function(q){var _=q.strip||{};return{inlineStandalone:!0,open:_.open,close:_.close}};function G2(q,_,j){if(_===void 0)_=q.length;var K=q[_-1],Y=q[_-2];if(!K)return j;if(K.type==="ContentStatement")return(Y||!j?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(K.original)}function u2(q,_,j){if(_===void 0)_=-1;var K=q[_+1],Y=q[_+2];if(!K)return j;if(K.type==="ContentStatement")return(Y||!j?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(K.original)}function V_(q,_,j){var K=q[_==null?0:_+1];if(!K||K.type!=="ContentStatement"||!j&&K.rightStripped)return;var Y=K.value;K.value=K.value.replace(j?/^\s+/:/^[ \t]*\r?\n?/,""),K.rightStripped=K.value!==Y}function __(q,_,j){var K=q[_==null?q.length-1:_-1];if(!K||K.type!=="ContentStatement"||!j&&K.leftStripped)return;var Y=K.value;return K.value=K.value.replace(j?/\s+$/:/[ \t]+$/,""),K.leftStripped=K.value!==Y,K.leftStripped}TP.default=Vq;ZP.exports=TP.default});var XP=F((ok)=>{ok.__esModule=!0;ok.SourceLocation=yk;ok.id=dk;ok.stripFlags=Lk;ok.stripComment=pk;ok.preparePath=lk;ok.prepareMustache=xk;ok.prepareRawBlock=nk;ok.prepareBlock=ck;ok.prepareProgram=rk;ok.preparePartialBlock=ik;function mk(q){return q&&q.__esModule?q:{default:q}}var gk=Q6(),h2=mk(gk);function C2(q,_){if(_=_.path?_.path.original:_,q.path.original!==_){var j={loc:q.path.loc};throw new h2.default(q.path.original+" doesn't match "+_,j)}}function yk(q,_){this.source=q,this.start={line:_.first_line,column:_.first_column},this.end={line:_.last_line,column:_.last_column}}function dk(q){if(/^\[.*\]$/.test(q))return q.substring(1,q.length-1);else return q}function Lk(q,_){return{open:q.charAt(2)==="~",close:_.charAt(_.length-3)==="~"}}function pk(q){return q.replace(/^\{\{~?!-?-?/,"").replace(/-?-?~?\}\}$/,"")}function lk(q,_,j){j=this.locInfo(j);var K=q?"@":"",Y=[],f=0;for(var P=0,$=_.length;P<$;P++){var w=_[P].part,O=_[P].original!==w;if(K+=(_[P].separator||"")+w,!O&&(w===".."||w==="."||w==="this")){if(Y.length>0)throw new h2.default("Invalid path: "+K,{loc:j});else if(w==="..")f++}else Y.push(w)}return{type:"PathExpression",data:q,depth:f,parts:Y,original:K,loc:j}}function xk(q,_,j,K,Y,f){var P=K.charAt(3)||K.charAt(2),$=P!=="{"&&P!=="&",w=/\*/.test(K);return{type:w?"Decorator":"MustacheStatement",path:q,params:_,hash:j,escaped:$,strip:Y,loc:this.locInfo(f)}}function nk(q,_,j,K){C2(q,j),K=this.locInfo(K);var Y={type:"Program",body:_,strip:{},loc:K};return{type:"BlockStatement",path:q.path,params:q.params,hash:q.hash,program:Y,openStrip:{},inverseStrip:{},closeStrip:{},loc:K}}function ck(q,_,j,K,Y,f){if(K&&K.path)C2(q,K);var P=/\*/.test(q.open);_.blockParams=q.blockParams;var $=void 0,w=void 0;if(j){if(P)throw new h2.default("Unexpected inverse block on decorator",j);if(j.chain)j.program.body[0].closeStrip=K.strip;w=j.strip,$=j.program}if(Y)Y=$,$=_,_=Y;return{type:P?"DecoratorBlock":"BlockStatement",path:q.path,params:q.params,hash:q.hash,program:_,inverse:$,openStrip:q.strip,inverseStrip:w,closeStrip:K&&K.strip,loc:this.locInfo(f)}}function rk(q,_){if(!_&&q.length){var j=q[0].loc,K=q[q.length-1].loc;if(j&&K)_={source:j.source,start:{line:j.start.line,column:j.start.column},end:{line:K.end.line,column:K.end.column}}}return{type:"Program",body:q,strip:{},loc:_}}function ik(q,_,j,K){return C2(q,j),{type:"PartialBlockStatement",name:q.path,params:q.params,hash:q.hash,program:_,openStrip:q.strip,closeStrip:j&&j.strip,loc:this.locInfo(K)}}});var uP=F((WX)=>{WX.__esModule=!0;WX.parseWithoutProcessing=GP;WX.parse=zX;function jX(q){if(q&&q.__esModule)return q;else{var _={};if(q!=null){for(var j in q)if(Object.prototype.hasOwnProperty.call(q,j))_[j]=q[j]}return _.default=q,_}}function AP(q){return q&&q.__esModule?q:{default:q}}var PX=zP(),D2=AP(PX),YX=kP(),fX=AP(YX),$X=XP(),OX=jX($X),wX=N6();WX.parser=D2.default;var u7={};wX.extend(u7,OX);function GP(q,_){if(q.type==="Program")return q;D2.default.yy=u7,u7.locInfo=function(K){return new u7.SourceLocation(_&&_.srcName,K)};var j=D2.default.parse(q);return j}function zX(q,_){var j=GP(q,_),K=new fX.default(_);return K.accept(j)}});var VP=F((uX)=>{uX.__esModule=!0;uX.Compiler=V2;uX.precompile=AX;uX.compile=GX;function CP(q){return q&&q.__esModule?q:{default:q}}var ZX=Q6(),w3=CP(ZX),z3=N6(),kX=X2(),O3=CP(kX),XX=[].slice;function V2(){}V2.prototype={compiler:V2,equals:function q(_){var j=this.opcodes.length;if(_.opcodes.length!==j)return!1;for(var K=0;K<j;K++){var Y=this.opcodes[K],f=_.opcodes[K];if(Y.opcode!==f.opcode||!DP(Y.args,f.args))return!1}j=this.children.length;for(var K=0;K<j;K++)if(!this.children[K].equals(_.children[K]))return!1;return!0},guid:0,compile:function q(_,j){return this.sourceNode=[],this.opcodes=[],this.children=[],this.options=j,this.stringParams=j.stringParams,this.trackIds=j.trackIds,j.blockParams=j.blockParams||[],j.knownHelpers=z3.extend(Object.create(null),{helperMissing:!0,blockHelperMissing:!0,each:!0,if:!0,unless:!0,with:!0,log:!0,lookup:!0},j.knownHelpers),this.accept(_)},compileProgram:function q(_){var j=new this.compiler,K=j.compile(_,this.options),Y=this.guid++;return this.usePartial=this.usePartial||K.usePartial,this.children[Y]=K,this.useDepths=this.useDepths||K.useDepths,Y},accept:function q(_){if(!this[_.type])throw new w3.default("Unknown type: "+_.type,_);this.sourceNode.unshift(_);var j=this[_.type](_);return this.sourceNode.shift(),j},Program:function q(_){this.options.blockParams.unshift(_.blockParams);var j=_.body,K=j.length;for(var Y=0;Y<K;Y++)this.accept(j[Y]);return this.options.blockParams.shift(),this.isSimple=K===1,this.blockParams=_.blockParams?_.blockParams.length:0,this},BlockStatement:function q(_){hP(_);var{program:j,inverse:K}=_;j=j&&this.compileProgram(j),K=K&&this.compileProgram(K);var Y=this.classifySexpr(_);if(Y==="helper")this.helperSexpr(_,j,K);else if(Y==="simple")this.simpleSexpr(_),this.opcode("pushProgram",j),this.opcode("pushProgram",K),this.opcode("emptyHash"),this.opcode("blockValue",_.path.original);else this.ambiguousSexpr(_,j,K),this.opcode("pushProgram",j),this.opcode("pushProgram",K),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue");this.opcode("append")},DecoratorBlock:function q(_){var j=_.program&&this.compileProgram(_.program),K=this.setupFullMustacheParams(_,j,void 0),Y=_.path;this.useDecorators=!0,this.opcode("registerDecorator",K.length,Y.original)},PartialStatement:function q(_){this.usePartial=!0;var j=_.program;if(j)j=this.compileProgram(_.program);var K=_.params;if(K.length>1)throw new w3.default("Unsupported number of partial arguments: "+K.length,_);else if(!K.length)if(this.options.explicitPartialContext)this.opcode("pushLiteral","undefined");else K.push({type:"PathExpression",parts:[],depth:0});var Y=_.name.original,f=_.name.type==="SubExpression";if(f)this.accept(_.name);this.setupFullMustacheParams(_,j,void 0,!0);var P=_.indent||"";if(this.options.preventIndent&&P)this.opcode("appendContent",P),P="";this.opcode("invokePartial",f,Y,P),this.opcode("append")},PartialBlockStatement:function q(_){this.PartialStatement(_)},MustacheStatement:function q(_){if(this.SubExpression(_),_.escaped&&!this.options.noEscape)this.opcode("appendEscaped");else this.opcode("append")},Decorator:function q(_){this.DecoratorBlock(_)},ContentStatement:function q(_){if(_.value)this.opcode("appendContent",_.value)},CommentStatement:function q(){},SubExpression:function q(_){hP(_);var j=this.classifySexpr(_);if(j==="simple")this.simpleSexpr(_);else if(j==="helper")this.helperSexpr(_);else this.ambiguousSexpr(_)},ambiguousSexpr:function q(_,j,K){var Y=_.path,f=Y.parts[0],P=j!=null||K!=null;this.opcode("getContext",Y.depth),this.opcode("pushProgram",j),this.opcode("pushProgram",K),Y.strict=!0,this.accept(Y),this.opcode("invokeAmbiguous",f,P)},simpleSexpr:function q(_){var j=_.path;j.strict=!0,this.accept(j),this.opcode("resolvePossibleLambda")},helperSexpr:function q(_,j,K){var Y=this.setupFullMustacheParams(_,j,K),f=_.path,P=f.parts[0];if(this.options.knownHelpers[P])this.opcode("invokeKnownHelper",Y.length,P);else if(this.options.knownHelpersOnly)throw new w3.default("You specified knownHelpersOnly, but used the unknown helper "+P,_);else f.strict=!0,f.falsy=!0,this.accept(f),this.opcode("invokeHelper",Y.length,f.original,O3.default.helpers.simpleId(f))},PathExpression:function q(_){this.addDepth(_.depth),this.opcode("getContext",_.depth);var j=_.parts[0],K=O3.default.helpers.scopedId(_),Y=!_.depth&&!K&&this.blockParamIndex(j);if(Y)this.opcode("lookupBlockParam",Y,_.parts);else if(!j)this.opcode("pushContext");else if(_.data)this.options.data=!0,this.opcode("lookupData",_.depth,_.parts,_.strict);else this.opcode("lookupOnContext",_.parts,_.falsy,_.strict,K)},StringLiteral:function q(_){this.opcode("pushString",_.value)},NumberLiteral:function q(_){this.opcode("pushLiteral",_.value)},BooleanLiteral:function q(_){this.opcode("pushLiteral",_.value)},UndefinedLiteral:function q(){this.opcode("pushLiteral","undefined")},NullLiteral:function q(){this.opcode("pushLiteral","null")},Hash:function q(_){var j=_.pairs,K=0,Y=j.length;this.opcode("pushHash");for(;K<Y;K++)this.pushParam(j[K].value);while(K--)this.opcode("assignToHash",j[K].key);this.opcode("popHash")},opcode:function q(_){this.opcodes.push({opcode:_,args:XX.call(arguments,1),loc:this.sourceNode[0].loc})},addDepth:function q(_){if(!_)return;this.useDepths=!0},classifySexpr:function q(_){var j=O3.default.helpers.simpleId(_.path),K=j&&!!this.blockParamIndex(_.path.parts[0]),Y=!K&&O3.default.helpers.helperExpression(_),f=!K&&(Y||j);if(f&&!Y){var P=_.path.parts[0],$=this.options;if($.knownHelpers[P])Y=!0;else if($.knownHelpersOnly)f=!1}if(Y)return"helper";else if(f)return"ambiguous";else return"simple"},pushParams:function q(_){for(var j=0,K=_.length;j<K;j++)this.pushParam(_[j])},pushParam:function q(_){var j=_.value!=null?_.value:_.original||"";if(this.stringParams){if(j.replace)j=j.replace(/^(\.?\.\/)*/g,"").replace(/\//g,".");if(_.depth)this.addDepth(_.depth);if(this.opcode("getContext",_.depth||0),this.opcode("pushStringParam",j,_.type),_.type==="SubExpression")this.accept(_)}else{if(this.trackIds){var K=void 0;if(_.parts&&!O3.default.helpers.scopedId(_)&&!_.depth)K=this.blockParamIndex(_.parts[0]);if(K){var Y=_.parts.slice(1).join(".");this.opcode("pushId","BlockParam",K,Y)}else{if(j=_.original||j,j.replace)j=j.replace(/^this(?:\.|$)/,"").replace(/^\.\//,"").replace(/^\.$/,"");this.opcode("pushId",_.type,j)}}this.accept(_)}},setupFullMustacheParams:function q(_,j,K,Y){var f=_.params;if(this.pushParams(f),this.opcode("pushProgram",j),this.opcode("pushProgram",K),_.hash)this.accept(_.hash);else this.opcode("emptyHash",Y);return f},blockParamIndex:function q(_){for(var j=0,K=this.options.blockParams.length;j<K;j++){var Y=this.options.blockParams[j],f=Y&&z3.indexOf(Y,_);if(Y&&f>=0)return[j,f]}}};function AX(q,_,j){if(q==null||typeof q!=="string"&&q.type!=="Program")throw new w3.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+q);if(_=_||{},!("data"in _))_.data=!0;if(_.compat)_.useDepths=!0;var K=j.parse(q,_),Y=new j.Compiler().compile(K,_);return new j.JavaScriptCompiler().compile(Y,_)}function GX(q,_,j){if(_===void 0)_={};if(q==null||typeof q!=="string"&&q.type!=="Program")throw new w3.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+q);if(_=z3.extend({},_),!("data"in _))_.data=!0;if(_.compat)_.useDepths=!0;var K=void 0;function Y(){var P=j.parse(q,_),$=new j.Compiler().compile(P,_),w=new j.JavaScriptCompiler().compile($,_,void 0,!0);return j.template(w)}function f(P,$){if(!K)K=Y();return K.call(this,P,$)}return f._setup=function(P){if(!K)K=Y();return K._setup(P)},f._child=function(P,$,w,O){if(!K)K=Y();return K._child(P,$,w,O)},f}function DP(q,_){if(q===_)return!0;if(z3.isArray(q)&&z3.isArray(_)&&q.length===_.length){for(var j=0;j<q.length;j++)if(!DP(q[j],_[j]))return!1;return!0}}function hP(q){if(!q.path.parts){var _=q.path;q.path={type:"PathExpression",data:!1,depth:0,parts:[_.original+""],original:_.original+"",loc:_.loc}}}});var NP=F((MX)=>{var MP="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");MX.encode=function(q){if(0<=q&&q<MP.length)return MP[q];throw new TypeError("Must be between 0 and 63: "+q)};MX.decode=function(q){var _=65,j=90,K=97,Y=122,f=48,P=57,$=43,w=47,O=26,z=52;if(_<=q&&q<=j)return q-_;if(K<=q&&q<=Y)return q-K+O;if(f<=q&&q<=P)return q-f+z;if(q==$)return 62;if(q==w)return 63;return-1}});var N2=F((RX)=>{var bP=NP(),M2=5,SP=1<<M2,EP=SP-1,RP=SP;function SX(q){return q<0?(-q<<1)+1:(q<<1)+0}function EX(q){var _=(q&1)===1,j=q>>1;return _?-j:j}RX.encode=function q(_){var j="",K,Y=SX(_);do{if(K=Y&EP,Y>>>=M2,Y>0)K|=RP;j+=bP.encode(K)}while(Y>0);return j};RX.decode=function q(_,j,K){var Y=_.length,f=0,P=0,$,w;do{if(j>=Y)throw new Error("Expected more digits in base 64 VLQ value.");if(w=bP.decode(_.charCodeAt(j++)),w===-1)throw new Error("Invalid base64 digit: "+_.charAt(j-1));$=!!(w&RP),w&=EP,f=f+(w<<P),P+=M2}while($);K.value=EX(f),K.rest=j}});var XK=F((iX)=>{function gX(q,_,j){if(_ in q)return q[_];else if(arguments.length===3)return j;else throw new Error('"'+_+'" is a required argument.')}iX.getArg=gX;var IP=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,yX=/^data:.+\,.+$/;function W3(q){var _=q.match(IP);if(!_)return null;return{scheme:_[1],auth:_[2],host:_[3],port:_[4],path:_[5]}}iX.urlParse=W3;function ZK(q){var _="";if(q.scheme)_+=q.scheme+":";if(_+="//",q.auth)_+=q.auth+"@";if(q.host)_+=q.host;if(q.port)_+=":"+q.port;if(q.path)_+=q.path;return _}iX.urlGenerate=ZK;function b2(q){var _=q,j=W3(q);if(j){if(!j.path)return q;_=j.path}var K=iX.isAbsolute(_),Y=_.split(/\/+/);for(var f,P=0,$=Y.length-1;$>=0;$--)if(f=Y[$],f===".")Y.splice($,1);else if(f==="..")P++;else if(P>0)if(f==="")Y.splice($+1,P),P=0;else Y.splice($,2),P--;if(_=Y.join("/"),_==="")_=K?"/":".";if(j)return j.path=_,ZK(j);return _}iX.normalize=b2;function mP(q,_){if(q==="")q=".";if(_==="")_=".";var j=W3(_),K=W3(q);if(K)q=K.path||"/";if(j&&!j.scheme){if(K)j.scheme=K.scheme;return ZK(j)}if(j||_.match(yX))return _;if(K&&!K.host&&!K.path)return K.host=_,ZK(K);var Y=_.charAt(0)==="/"?_:b2(q.replace(/\/+$/,"")+"/"+_);if(K)return K.path=Y,ZK(K);return Y}iX.join=mP;iX.isAbsolute=function(q){return q.charAt(0)==="/"||IP.test(q)};function dX(q,_){if(q==="")q=".";q=q.replace(/\/$/,"");var j=0;while(_.indexOf(q+"/")!==0){var K=q.lastIndexOf("/");if(K<0)return _;if(q=q.slice(0,K),q.match(/^([^\/]+:\/)?\/*$/))return _;++j}return Array(j+1).join("../")+_.substr(q.length+1)}iX.relative=dX;var gP=function(){var q=Object.create(null);return!("__proto__"in q)}();function yP(q){return q}function LX(q){if(dP(q))return"$"+q;return q}iX.toSetString=gP?yP:LX;function pX(q){if(dP(q))return q.slice(1);return q}iX.fromSetString=gP?yP:pX;function dP(q){if(!q)return!1;var _=q.length;if(_<9)return!1;if(q.charCodeAt(_-1)!==95||q.charCodeAt(_-2)!==95||q.charCodeAt(_-3)!==111||q.charCodeAt(_-4)!==116||q.charCodeAt(_-5)!==111||q.charCodeAt(_-6)!==114||q.charCodeAt(_-7)!==112||q.charCodeAt(_-8)!==95||q.charCodeAt(_-9)!==95)return!1;for(var j=_-10;j>=0;j--)if(q.charCodeAt(j)!==36)return!1;return!0}function lX(q,_,j){var K=kK(q.source,_.source);if(K!==0)return K;if(K=q.originalLine-_.originalLine,K!==0)return K;if(K=q.originalColumn-_.originalColumn,K!==0||j)return K;if(K=q.generatedColumn-_.generatedColumn,K!==0)return K;if(K=q.generatedLine-_.generatedLine,K!==0)return K;return kK(q.name,_.name)}iX.compareByOriginalPositions=lX;function xX(q,_,j){var K=q.generatedLine-_.generatedLine;if(K!==0)return K;if(K=q.generatedColumn-_.generatedColumn,K!==0||j)return K;if(K=kK(q.source,_.source),K!==0)return K;if(K=q.originalLine-_.originalLine,K!==0)return K;if(K=q.originalColumn-_.originalColumn,K!==0)return K;return kK(q.name,_.name)}iX.compareByGeneratedPositionsDeflated=xX;function kK(q,_){if(q===_)return 0;if(q===null)return 1;if(_===null)return-1;if(q>_)return 1;return-1}function nX(q,_){var j=q.generatedLine-_.generatedLine;if(j!==0)return j;if(j=q.generatedColumn-_.generatedColumn,j!==0)return j;if(j=kK(q.source,_.source),j!==0)return j;if(j=q.originalLine-_.originalLine,j!==0)return j;if(j=q.originalColumn-_.originalColumn,j!==0)return j;return kK(q.name,_.name)}iX.compareByGeneratedPositionsInflated=nX;function cX(q){return JSON.parse(q.replace(/^\)]}'[^\n]*\n/,""))}iX.parseSourceMapInput=cX;function rX(q,_,j){if(_=_||"",q){if(q[q.length-1]!=="/"&&_[0]!=="/")q+="/";_=q+_}if(j){var K=W3(j);if(!K)throw new Error("sourceMapURL could not be parsed");if(K.path){var Y=K.path.lastIndexOf("/");if(Y>=0)K.path=K.path.substring(0,Y+1)}_=mP(ZK(K),_)}return b2(_)}iX.computeSourceURL=rX});var R2=F((YA)=>{var S2=XK(),E2=Object.prototype.hasOwnProperty,M_=typeof Map!=="undefined";function oq(){this._array=[],this._set=M_?new Map:Object.create(null)}oq.fromArray=function q(_,j){var K=new oq;for(var Y=0,f=_.length;Y<f;Y++)K.add(_[Y],j);return K};oq.prototype.size=function q(){return M_?this._set.size:Object.getOwnPropertyNames(this._set).length};oq.prototype.add=function q(_,j){var K=M_?_:S2.toSetString(_),Y=M_?this.has(_):E2.call(this._set,K),f=this._array.length;if(!Y||j)this._array.push(_);if(!Y)if(M_)this._set.set(_,f);else this._set[K]=f};oq.prototype.has=function q(_){if(M_)return this._set.has(_);else{var j=S2.toSetString(_);return E2.call(this._set,j)}};oq.prototype.indexOf=function q(_){if(M_){var j=this._set.get(_);if(j>=0)return j}else{var K=S2.toSetString(_);if(E2.call(this._set,K))return this._set[K]}throw new Error('"'+_+'" is not in the set.')};oq.prototype.at=function q(_){if(_>=0&&_<this._array.length)return this._array[_];throw new Error("No element indexed by "+_)};oq.prototype.toArray=function q(){return this._array.slice()};YA.ArraySet=oq});var pP=F((OA)=>{var LP=XK();function $A(q,_){var j=q.generatedLine,K=_.generatedLine,Y=q.generatedColumn,f=_.generatedColumn;return K>j||K==j&&f>=Y||LP.compareByGeneratedPositionsInflated(q,_)<=0}function h7(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}h7.prototype.unsortedForEach=function q(_,j){this._array.forEach(_,j)};h7.prototype.add=function q(_){if($A(this._last,_))this._last=_,this._array.push(_);else this._sorted=!1,this._array.push(_)};h7.prototype.toArray=function q(){if(!this._sorted)this._array.sort(LP.compareByGeneratedPositionsInflated),this._sorted=!0;return this._array};OA.MappingList=h7});var I2=F((WA)=>{var v3=N2(),P6=XK(),C7=R2().ArraySet,zA=pP().MappingList;function qq(q){if(!q)q={};this._file=P6.getArg(q,"file",null),this._sourceRoot=P6.getArg(q,"sourceRoot",null),this._skipValidation=P6.getArg(q,"skipValidation",!1),this._sources=new C7,this._names=new C7,this._mappings=new zA,this._sourcesContents=null}qq.prototype._version=3;qq.fromSourceMap=function q(_){var j=_.sourceRoot,K=new qq({file:_.file,sourceRoot:j});return _.eachMapping(function(Y){var f={generated:{line:Y.generatedLine,column:Y.generatedColumn}};if(Y.source!=null){if(f.source=Y.source,j!=null)f.source=P6.relative(j,f.source);if(f.original={line:Y.originalLine,column:Y.originalColumn},Y.name!=null)f.name=Y.name}K.addMapping(f)}),_.sources.forEach(function(Y){var f=Y;if(j!==null)f=P6.relative(j,Y);if(!K._sources.has(f))K._sources.add(f);var P=_.sourceContentFor(Y);if(P!=null)K.setSourceContent(Y,P)}),K};qq.prototype.addMapping=function q(_){var j=P6.getArg(_,"generated"),K=P6.getArg(_,"original",null),Y=P6.getArg(_,"source",null),f=P6.getArg(_,"name",null);if(!this._skipValidation)this._validateMapping(j,K,Y,f);if(Y!=null){if(Y=String(Y),!this._sources.has(Y))this._sources.add(Y)}if(f!=null){if(f=String(f),!this._names.has(f))this._names.add(f)}this._mappings.add({generatedLine:j.line,generatedColumn:j.column,originalLine:K!=null&&K.line,originalColumn:K!=null&&K.column,source:Y,name:f})};qq.prototype.setSourceContent=function q(_,j){var K=_;if(this._sourceRoot!=null)K=P6.relative(this._sourceRoot,K);if(j!=null){if(!this._sourcesContents)this._sourcesContents=Object.create(null);this._sourcesContents[P6.toSetString(K)]=j}else if(this._sourcesContents){if(delete this._sourcesContents[P6.toSetString(K)],Object.keys(this._sourcesContents).length===0)this._sourcesContents=null}};qq.prototype.applySourceMap=function q(_,j,K){var Y=j;if(j==null){if(_.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);Y=_.file}var f=this._sourceRoot;if(f!=null)Y=P6.relative(f,Y);var P=new C7,$=new C7;this._mappings.unsortedForEach(function(w){if(w.source===Y&&w.originalLine!=null){var O=_.originalPositionFor({line:w.originalLine,column:w.originalColumn});if(O.source!=null){if(w.source=O.source,K!=null)w.source=P6.join(K,w.source);if(f!=null)w.source=P6.relative(f,w.source);if(w.originalLine=O.line,w.originalColumn=O.column,O.name!=null)w.name=O.name}}var z=w.source;if(z!=null&&!P.has(z))P.add(z);var W=w.name;if(W!=null&&!$.has(W))$.add(W)},this),this._sources=P,this._names=$,_.sources.forEach(function(w){var O=_.sourceContentFor(w);if(O!=null){if(K!=null)w=P6.join(K,w);if(f!=null)w=P6.relative(f,w);this.setSourceContent(w,O)}},this)};qq.prototype._validateMapping=function q(_,j,K,Y){if(j&&typeof j.line!=="number"&&typeof j.column!=="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(_&&"line"in _&&"column"in _&&_.line>0&&_.column>=0&&!j&&!K&&!Y)return;else if(_&&"line"in _&&"column"in _&&j&&"line"in j&&"column"in j&&_.line>0&&_.column>=0&&j.line>0&&j.column>=0&&K)return;else throw new Error("Invalid mapping: "+JSON.stringify({generated:_,source:K,original:j,name:Y}))};qq.prototype._serializeMappings=function q(){var _=0,j=1,K=0,Y=0,f=0,P=0,$="",w,O,z,W,v=this._mappings.toArray();for(var H=0,T=v.length;H<T;H++){if(O=v[H],w="",O.generatedLine!==j){_=0;while(O.generatedLine!==j)w+=";",j++}else if(H>0){if(!P6.compareByGeneratedPositionsInflated(O,v[H-1]))continue;w+=","}if(w+=v3.encode(O.generatedColumn-_),_=O.generatedColumn,O.source!=null){if(W=this._sources.indexOf(O.source),w+=v3.encode(W-P),P=W,w+=v3.encode(O.originalLine-1-Y),Y=O.originalLine-1,w+=v3.encode(O.originalColumn-K),K=O.originalColumn,O.name!=null)z=this._names.indexOf(O.name),w+=v3.encode(z-f),f=z}$+=w}return $};qq.prototype._generateSourcesContent=function q(_,j){return _.map(function(K){if(!this._sourcesContents)return null;if(j!=null)K=P6.relative(j,K);var Y=P6.toSetString(K);return Object.prototype.hasOwnProperty.call(this._sourcesContents,Y)?this._sourcesContents[Y]:null},this)};qq.prototype.toJSON=function q(){var _={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null)_.file=this._file;if(this._sourceRoot!=null)_.sourceRoot=this._sourceRoot;if(this._sourcesContents)_.sourcesContent=this._generateSourcesContent(_.sources,_.sourceRoot);return _};qq.prototype.toString=function q(){return JSON.stringify(this.toJSON())};WA.SourceMapGenerator=qq});var xP=F((HA)=>{HA.GREATEST_LOWER_BOUND=1;HA.LEAST_UPPER_BOUND=2;function m2(q,_,j,K,Y,f){var P=Math.floor((_-q)/2)+q,$=Y(j,K[P],!0);if($===0)return P;else if($>0){if(_-P>1)return m2(P,_,j,K,Y,f);if(f==HA.LEAST_UPPER_BOUND)return _<K.length?_:-1;else return P}else{if(P-q>1)return m2(q,P,j,K,Y,f);if(f==HA.LEAST_UPPER_BOUND)return P;else return q<0?-1:q}}HA.search=function q(_,j,K,Y){if(j.length===0)return-1;var f=m2(-1,j.length,_,j,K,Y||HA.GREATEST_LOWER_BOUND);if(f<0)return-1;while(f-1>=0){if(K(j[f],j[f-1],!0)!==0)break;--f}return f}});var nP=F((ZA)=>{function y2(q,_,j){var K=q[_];q[_]=q[j],q[j]=K}function TA(q,_){return Math.round(q+Math.random()*(_-q))}function d2(q,_,j,K){if(j<K){var Y=TA(j,K),f=j-1;y2(q,Y,K);var P=q[K];for(var $=j;$<K;$++)if(_(q[$],P)<=0)f+=1,y2(q,f,$);y2(q,f+1,$);var w=f+1;d2(q,_,j,w-1),d2(q,_,w+1,K)}}ZA.quickSort=function(q,_){d2(q,_,0,q.length-1)}});var rP=F((AA)=>{var P8=XK(),L2=xP(),AK=R2().ArraySet,XA=N2(),H3=nP().quickSort;function y8(q,_){var j=q;if(typeof q==="string")j=P8.parseSourceMapInput(q);return j.sections!=null?new vq(j,_):new J6(j,_)}y8.fromSourceMap=function(q,_){return J6.fromSourceMap(q,_)};y8.prototype._version=3;y8.prototype.__generatedMappings=null;Object.defineProperty(y8.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){if(!this.__generatedMappings)this._parseMappings(this._mappings,this.sourceRoot);return this.__generatedMappings}});y8.prototype.__originalMappings=null;Object.defineProperty(y8.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){if(!this.__originalMappings)this._parseMappings(this._mappings,this.sourceRoot);return this.__originalMappings}});y8.prototype._charIsMappingSeparator=function q(_,j){var K=_.charAt(j);return K===";"||K===","};y8.prototype._parseMappings=function q(_,j){throw new Error("Subclasses must implement _parseMappings")};y8.GENERATED_ORDER=1;y8.ORIGINAL_ORDER=2;y8.GREATEST_LOWER_BOUND=1;y8.LEAST_UPPER_BOUND=2;y8.prototype.eachMapping=function q(_,j,K){var Y=j||null,f=K||y8.GENERATED_ORDER,P;switch(f){case y8.GENERATED_ORDER:P=this._generatedMappings;break;case y8.ORIGINAL_ORDER:P=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var $=this.sourceRoot;P.map(function(w){var O=w.source===null?null:this._sources.at(w.source);return O=P8.computeSourceURL($,O,this._sourceMapURL),{source:O,generatedLine:w.generatedLine,generatedColumn:w.generatedColumn,originalLine:w.originalLine,originalColumn:w.originalColumn,name:w.name===null?null:this._names.at(w.name)}},this).forEach(_,Y)};y8.prototype.allGeneratedPositionsFor=function q(_){var j=P8.getArg(_,"line"),K={source:P8.getArg(_,"source"),originalLine:j,originalColumn:P8.getArg(_,"column",0)};if(K.source=this._findSourceIndex(K.source),K.source<0)return[];var Y=[],f=this._findMapping(K,this._originalMappings,"originalLine","originalColumn",P8.compareByOriginalPositions,L2.LEAST_UPPER_BOUND);if(f>=0){var P=this._originalMappings[f];if(_.column===void 0){var $=P.originalLine;while(P&&P.originalLine===$)Y.push({line:P8.getArg(P,"generatedLine",null),column:P8.getArg(P,"generatedColumn",null),lastColumn:P8.getArg(P,"lastGeneratedColumn",null)}),P=this._originalMappings[++f]}else{var w=P.originalColumn;while(P&&P.originalLine===j&&P.originalColumn==w)Y.push({line:P8.getArg(P,"generatedLine",null),column:P8.getArg(P,"generatedColumn",null),lastColumn:P8.getArg(P,"lastGeneratedColumn",null)}),P=this._originalMappings[++f]}}return Y};AA.SourceMapConsumer=y8;function J6(q,_){var j=q;if(typeof q==="string")j=P8.parseSourceMapInput(q);var K=P8.getArg(j,"version"),Y=P8.getArg(j,"sources"),f=P8.getArg(j,"names",[]),P=P8.getArg(j,"sourceRoot",null),$=P8.getArg(j,"sourcesContent",null),w=P8.getArg(j,"mappings"),O=P8.getArg(j,"file",null);if(K!=this._version)throw new Error("Unsupported version: "+K);if(P)P=P8.normalize(P);Y=Y.map(String).map(P8.normalize).map(function(z){return P&&P8.isAbsolute(P)&&P8.isAbsolute(z)?P8.relative(P,z):z}),this._names=AK.fromArray(f.map(String),!0),this._sources=AK.fromArray(Y,!0),this._absoluteSources=this._sources.toArray().map(function(z){return P8.computeSourceURL(P,z,_)}),this.sourceRoot=P,this.sourcesContent=$,this._mappings=w,this._sourceMapURL=_,this.file=O}J6.prototype=Object.create(y8.prototype);J6.prototype.consumer=y8;J6.prototype._findSourceIndex=function(q){var _=q;if(this.sourceRoot!=null)_=P8.relative(this.sourceRoot,_);if(this._sources.has(_))return this._sources.indexOf(_);var j;for(j=0;j<this._absoluteSources.length;++j)if(this._absoluteSources[j]==q)return j;return-1};J6.fromSourceMap=function q(_,j){var K=Object.create(J6.prototype),Y=K._names=AK.fromArray(_._names.toArray(),!0),f=K._sources=AK.fromArray(_._sources.toArray(),!0);K.sourceRoot=_._sourceRoot,K.sourcesContent=_._generateSourcesContent(K._sources.toArray(),K.sourceRoot),K.file=_._file,K._sourceMapURL=j,K._absoluteSources=K._sources.toArray().map(function(H){return P8.computeSourceURL(K.sourceRoot,H,j)});var P=_._mappings.toArray().slice(),$=K.__generatedMappings=[],w=K.__originalMappings=[];for(var O=0,z=P.length;O<z;O++){var W=P[O],v=new cP;if(v.generatedLine=W.generatedLine,v.generatedColumn=W.generatedColumn,W.source){if(v.source=f.indexOf(W.source),v.originalLine=W.originalLine,v.originalColumn=W.originalColumn,W.name)v.name=Y.indexOf(W.name);w.push(v)}$.push(v)}return H3(K.__originalMappings,P8.compareByOriginalPositions),K};J6.prototype._version=3;Object.defineProperty(J6.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});function cP(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}J6.prototype._parseMappings=function q(_,j){var K=1,Y=0,f=0,P=0,$=0,w=0,O=_.length,z=0,W={},v={},H=[],T=[],J,k,A,G,u;while(z<O)if(_.charAt(z)===";")K++,z++,Y=0;else if(_.charAt(z)===",")z++;else{J=new cP,J.generatedLine=K;for(G=z;G<O;G++)if(this._charIsMappingSeparator(_,G))break;if(k=_.slice(z,G),A=W[k],A)z+=k.length;else{A=[];while(z<G)XA.decode(_,z,v),u=v.value,z=v.rest,A.push(u);if(A.length===2)throw new Error("Found a source, but no line and column");if(A.length===3)throw new Error("Found a source and line, but no column");W[k]=A}if(J.generatedColumn=Y+A[0],Y=J.generatedColumn,A.length>1){if(J.source=$+A[1],$+=A[1],J.originalLine=f+A[2],f=J.originalLine,J.originalLine+=1,J.originalColumn=P+A[3],P=J.originalColumn,A.length>4)J.name=w+A[4],w+=A[4]}if(T.push(J),typeof J.originalLine==="number")H.push(J)}H3(T,P8.compareByGeneratedPositionsDeflated),this.__generatedMappings=T,H3(H,P8.compareByOriginalPositions),this.__originalMappings=H};J6.prototype._findMapping=function q(_,j,K,Y,f,P){if(_[K]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+_[K]);if(_[Y]<0)throw new TypeError("Column must be greater than or equal to 0, got "+_[Y]);return L2.search(_,j,f,P)};J6.prototype.computeColumnSpans=function q(){for(var _=0;_<this._generatedMappings.length;++_){var j=this._generatedMappings[_];if(_+1<this._generatedMappings.length){var K=this._generatedMappings[_+1];if(j.generatedLine===K.generatedLine){j.lastGeneratedColumn=K.generatedColumn-1;continue}}j.lastGeneratedColumn=1/0}};J6.prototype.originalPositionFor=function q(_){var j={generatedLine:P8.getArg(_,"line"),generatedColumn:P8.getArg(_,"column")},K=this._findMapping(j,this._generatedMappings,"generatedLine","generatedColumn",P8.compareByGeneratedPositionsDeflated,P8.getArg(_,"bias",y8.GREATEST_LOWER_BOUND));if(K>=0){var Y=this._generatedMappings[K];if(Y.generatedLine===j.generatedLine){var f=P8.getArg(Y,"source",null);if(f!==null)f=this._sources.at(f),f=P8.computeSourceURL(this.sourceRoot,f,this._sourceMapURL);var P=P8.getArg(Y,"name",null);if(P!==null)P=this._names.at(P);return{source:f,line:P8.getArg(Y,"originalLine",null),column:P8.getArg(Y,"originalColumn",null),name:P}}}return{source:null,line:null,column:null,name:null}};J6.prototype.hasContentsOfAllSources=function q(){if(!this.sourcesContent)return!1;return this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(_){return _==null})};J6.prototype.sourceContentFor=function q(_,j){if(!this.sourcesContent)return null;var K=this._findSourceIndex(_);if(K>=0)return this.sourcesContent[K];var Y=_;if(this.sourceRoot!=null)Y=P8.relative(this.sourceRoot,Y);var f;if(this.sourceRoot!=null&&(f=P8.urlParse(this.sourceRoot))){var P=Y.replace(/^file:\/\//,"");if(f.scheme=="file"&&this._sources.has(P))return this.sourcesContent[this._sources.indexOf(P)];if((!f.path||f.path=="/")&&this._sources.has("/"+Y))return this.sourcesContent[this._sources.indexOf("/"+Y)]}if(j)return null;else throw new Error('"'+Y+'" is not in the SourceMap.')};J6.prototype.generatedPositionFor=function q(_){var j=P8.getArg(_,"source");if(j=this._findSourceIndex(j),j<0)return{line:null,column:null,lastColumn:null};var K={source:j,originalLine:P8.getArg(_,"line"),originalColumn:P8.getArg(_,"column")},Y=this._findMapping(K,this._originalMappings,"originalLine","originalColumn",P8.compareByOriginalPositions,P8.getArg(_,"bias",y8.GREATEST_LOWER_BOUND));if(Y>=0){var f=this._originalMappings[Y];if(f.source===K.source)return{line:P8.getArg(f,"generatedLine",null),column:P8.getArg(f,"generatedColumn",null),lastColumn:P8.getArg(f,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};AA.BasicSourceMapConsumer=J6;function vq(q,_){var j=q;if(typeof q==="string")j=P8.parseSourceMapInput(q);var K=P8.getArg(j,"version"),Y=P8.getArg(j,"sections");if(K!=this._version)throw new Error("Unsupported version: "+K);this._sources=new AK,this._names=new AK;var f={line:-1,column:0};this._sections=Y.map(function(P){if(P.url)throw new Error("Support for url field in sections not implemented.");var $=P8.getArg(P,"offset"),w=P8.getArg($,"line"),O=P8.getArg($,"column");if(w<f.line||w===f.line&&O<f.column)throw new Error("Section offsets must be ordered and non-overlapping.");return f=$,{generatedOffset:{generatedLine:w+1,generatedColumn:O+1},consumer:new y8(P8.getArg(P,"map"),_)}})}vq.prototype=Object.create(y8.prototype);vq.prototype.constructor=y8;vq.prototype._version=3;Object.defineProperty(vq.prototype,"sources",{get:function(){var q=[];for(var _=0;_<this._sections.length;_++)for(var j=0;j<this._sections[_].consumer.sources.length;j++)q.push(this._sections[_].consumer.sources[j]);return q}});vq.prototype.originalPositionFor=function q(_){var j={generatedLine:P8.getArg(_,"line"),generatedColumn:P8.getArg(_,"column")},K=L2.search(j,this._sections,function(f,P){var $=f.generatedLine-P.generatedOffset.generatedLine;if($)return $;return f.generatedColumn-P.generatedOffset.generatedColumn}),Y=this._sections[K];if(!Y)return{source:null,line:null,column:null,name:null};return Y.consumer.originalPositionFor({line:j.generatedLine-(Y.generatedOffset.generatedLine-1),column:j.generatedColumn-(Y.generatedOffset.generatedLine===j.generatedLine?Y.generatedOffset.generatedColumn-1:0),bias:_.bias})};vq.prototype.hasContentsOfAllSources=function q(){return this._sections.every(function(_){return _.consumer.hasContentsOfAllSources()})};vq.prototype.sourceContentFor=function q(_,j){for(var K=0;K<this._sections.length;K++){var Y=this._sections[K],f=Y.consumer.sourceContentFor(_,!0);if(f)return f}if(j)return null;else throw new Error('"'+_+'" is not in the SourceMap.')};vq.prototype.generatedPositionFor=function q(_){for(var j=0;j<this._sections.length;j++){var K=this._sections[j];if(K.consumer._findSourceIndex(P8.getArg(_,"source"))===-1)continue;var Y=K.consumer.generatedPositionFor(_);if(Y){var f={line:Y.line+(K.generatedOffset.generatedLine-1),column:Y.column+(K.generatedOffset.generatedLine===Y.line?K.generatedOffset.generatedColumn-1:0)};return f}}return{line:null,column:null}};vq.prototype._parseMappings=function q(_,j){this.__generatedMappings=[],this.__originalMappings=[];for(var K=0;K<this._sections.length;K++){var Y=this._sections[K],f=Y.consumer._generatedMappings;for(var P=0;P<f.length;P++){var $=f[P],w=Y.consumer._sources.at($.source);w=P8.computeSourceURL(Y.consumer.sourceRoot,w,this._sourceMapURL),this._sources.add(w),w=this._sources.indexOf(w);var O=null;if($.name)O=Y.consumer._names.at($.name),this._names.add(O),O=this._names.indexOf(O);var z={source:w,generatedLine:$.generatedLine+(Y.generatedOffset.generatedLine-1),generatedColumn:$.generatedColumn+(Y.generatedOffset.generatedLine===$.generatedLine?Y.generatedOffset.generatedColumn-1:0),originalLine:$.originalLine,originalColumn:$.originalColumn,name:O};if(this.__generatedMappings.push(z),typeof z.originalLine==="number")this.__originalMappings.push(z)}}H3(this.__generatedMappings,P8.compareByGeneratedPositionsDeflated),H3(this.__originalMappings,P8.compareByOriginalPositions)};AA.IndexedSourceMapConsumer=vq});var iP=F((MA)=>{var CA=I2().SourceMapGenerator,D7=XK(),DA=/(\r?\n)/,VA=10,GK="$$$isSourceNode$$$";function x6(q,_,j,K,Y){if(this.children=[],this.sourceContents={},this.line=q==null?null:q,this.column=_==null?null:_,this.source=j==null?null:j,this.name=Y==null?null:Y,this[GK]=!0,K!=null)this.add(K)}x6.fromStringWithSourceMap=function q(_,j,K){var Y=new x6,f=_.split(DA),P=0,$=function(){var v=T(),H=T()||"";return v+H;function T(){return P<f.length?f[P++]:void 0}},w=1,O=0,z=null;if(j.eachMapping(function(v){if(z!==null)if(w<v.generatedLine)W(z,$()),w++,O=0;else{var H=f[P]||"",T=H.substr(0,v.generatedColumn-O);f[P]=H.substr(v.generatedColumn-O),O=v.generatedColumn,W(z,T),z=v;return}while(w<v.generatedLine)Y.add($()),w++;if(O<v.generatedColumn){var H=f[P]||"";Y.add(H.substr(0,v.generatedColumn)),f[P]=H.substr(v.generatedColumn),O=v.generatedColumn}z=v},this),P<f.length){if(z)W(z,$());Y.add(f.splice(P).join(""))}return j.sources.forEach(function(v){var H=j.sourceContentFor(v);if(H!=null){if(K!=null)v=D7.join(K,v);Y.setSourceContent(v,H)}}),Y;function W(v,H){if(v===null||v.source===void 0)Y.add(H);else{var T=K?D7.join(K,v.source):v.source;Y.add(new x6(v.originalLine,v.originalColumn,T,H,v.name))}}};x6.prototype.add=function q(_){if(Array.isArray(_))_.forEach(function(j){this.add(j)},this);else if(_[GK]||typeof _==="string"){if(_)this.children.push(_)}else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+_);return this};x6.prototype.prepend=function q(_){if(Array.isArray(_))for(var j=_.length-1;j>=0;j--)this.prepend(_[j]);else if(_[GK]||typeof _==="string")this.children.unshift(_);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+_);return this};x6.prototype.walk=function q(_){var j;for(var K=0,Y=this.children.length;K<Y;K++)if(j=this.children[K],j[GK])j.walk(_);else if(j!=="")_(j,{source:this.source,line:this.line,column:this.column,name:this.name})};x6.prototype.join=function q(_){var j,K,Y=this.children.length;if(Y>0){j=[];for(K=0;K<Y-1;K++)j.push(this.children[K]),j.push(_);j.push(this.children[K]),this.children=j}return this};x6.prototype.replaceRight=function q(_,j){var K=this.children[this.children.length-1];if(K[GK])K.replaceRight(_,j);else if(typeof K==="string")this.children[this.children.length-1]=K.replace(_,j);else this.children.push("".replace(_,j));return this};x6.prototype.setSourceContent=function q(_,j){this.sourceContents[D7.toSetString(_)]=j};x6.prototype.walkSourceContents=function q(_){for(var j=0,K=this.children.length;j<K;j++)if(this.children[j][GK])this.children[j].walkSourceContents(_);var Y=Object.keys(this.sourceContents);for(var j=0,K=Y.length;j<K;j++)_(D7.fromSetString(Y[j]),this.sourceContents[Y[j]])};x6.prototype.toString=function q(){var _="";return this.walk(function(j){_+=j}),_};x6.prototype.toStringWithSourceMap=function q(_){var j={code:"",line:1,column:0},K=new CA(_),Y=!1,f=null,P=null,$=null,w=null;return this.walk(function(O,z){if(j.code+=O,z.source!==null&&z.line!==null&&z.column!==null){if(f!==z.source||P!==z.line||$!==z.column||w!==z.name)K.addMapping({source:z.source,original:{line:z.line,column:z.column},generated:{line:j.line,column:j.column},name:z.name});f=z.source,P=z.line,$=z.column,w=z.name,Y=!0}else if(Y)K.addMapping({generated:{line:j.line,column:j.column}}),f=null,Y=!1;for(var W=0,v=O.length;W<v;W++)if(O.charCodeAt(W)===VA){if(j.line++,j.column=0,W+1===v)f=null,Y=!1;else if(Y)K.addMapping({source:z.source,original:{line:z.line,column:z.column},generated:{line:j.line,column:j.column},name:z.name})}else j.column++}),this.walkSourceContents(function(O,z){K.setSourceContent(O,z)}),{code:j.code,map:K}};MA.SourceNode=x6});var oP=F((bA)=>{bA.SourceMapGenerator=I2().SourceMapGenerator;bA.SourceMapConsumer=rP().SourceMapConsumer;bA.SourceNode=iP().SourceNode});var FP=F((BP,tP)=>{BP.__esModule=!0;var l2=N6(),N_=void 0;try{if(typeof define!=="function"||!define.amd)x2=oP(),N_=x2.SourceNode}catch(q){}var x2;if(!N_)N_=function(q,_,j,K){if(this.src="",K)this.add(K)},N_.prototype={add:function q(_){if(l2.isArray(_))_=_.join("");this.src+=_},prepend:function q(_){if(l2.isArray(_))_=_.join("");this.src=_+this.src},toStringWithSourceMap:function q(){return{code:this.toString()}},toString:function q(){return this.src}};function p2(q,_,j){if(l2.isArray(q)){var K=[];for(var Y=0,f=q.length;Y<f;Y++)K.push(_.wrap(q[Y],j));return K}else if(typeof q==="boolean"||typeof q==="number")return q+"";return q}function aP(q){this.srcFile=q,this.source=[]}aP.prototype={isEmpty:function q(){return!this.source.length},prepend:function q(_,j){this.source.unshift(this.wrap(_,j))},push:function q(_,j){this.source.push(this.wrap(_,j))},merge:function q(){var _=this.empty();return this.each(function(j){_.add([" ",j,`
`])}),_},each:function q(_){for(var j=0,K=this.source.length;j<K;j++)_(this.source[j])},empty:function q(){var _=this.currentLocation||{start:{}};return new N_(_.start.line,_.start.column,this.srcFile)},wrap:function q(_){var j=arguments.length<=1||arguments[1]===void 0?this.currentLocation||{start:{}}:arguments[1];if(_ instanceof N_)return _;return _=p2(_,this,j),new N_(j.start.line,j.start.column,this.srcFile,_)},functionCall:function q(_,j,K){return K=this.generateList(K),this.wrap([_,j?"."+j+"(":"(",K,")"])},quotedString:function q(_){return'"'+(_+"").replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function q(_){var j=this,K=[];Object.keys(_).forEach(function(f){var P=p2(_[f],j);if(P!=="undefined")K.push([j.quotedString(f),":",P])});var Y=this.generateList(K);return Y.prepend("{"),Y.add("}"),Y},generateList:function q(_){var j=this.empty();for(var K=0,Y=_.length;K<Y;K++){if(K)j.add(",");j.add(p2(_[K],this))}return j},generateArray:function q(_){var j=this.generateList(_);return j.prepend("["),j.add("]"),j}};BP.default=aP;tP.exports=BP.default});var _Y=F((QP,qY)=>{QP.__esModule=!0;function sP(q){return q&&q.__esModule?q:{default:q}}var eP=Z7(),gA=Q6(),n2=sP(gA),yA=N6(),dA=FP(),UP=sP(dA);function uK(q){this.value=q}function hK(){}hK.prototype={nameLookup:function q(_,j){return this.internalNameLookup(_,j)},depthedLookup:function q(_){return[this.aliasable("container.lookup"),"(depths, ",JSON.stringify(_),")"]},compilerInfo:function q(){var _=eP.COMPILER_REVISION,j=eP.REVISION_CHANGES[_];return[_,j]},appendToBuffer:function q(_,j,K){if(!yA.isArray(_))_=[_];if(_=this.source.wrap(_,j),this.environment.isSimple)return["return ",_,";"];else if(K)return["buffer += ",_,";"];else return _.appendToBuffer=!0,_},initializeBuffer:function q(){return this.quotedString("")},internalNameLookup:function q(_,j){return this.lookupPropertyFunctionIsUsed=!0,["lookupProperty(",_,",",JSON.stringify(j),")"]},lookupPropertyFunctionIsUsed:!1,compile:function q(_,j,K,Y){this.environment=_,this.options=j,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!Y,this.name=this.environment.name,this.isChild=!!K,this.context=K||{decorators:[],programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.blockParams=[],this.compileChildren(_,j),this.useDepths=this.useDepths||_.useDepths||_.useDecorators||this.options.compat,this.useBlockParams=this.useBlockParams||_.useBlockParams;var f=_.opcodes,P=void 0,$=void 0,w=void 0,O=void 0;for(w=0,O=f.length;w<O;w++)P=f[w],this.source.currentLocation=P.loc,$=$||P.loc,this[P.opcode].apply(this,P.args);if(this.source.currentLocation=$,this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new n2.default("Compile completed with content left on stack");if(!this.decorators.isEmpty())if(this.useDecorators=!0,this.decorators.prepend(["var decorators = container.decorators, ",this.lookupPropertyFunctionVarDeclaration(),`;
`]),this.decorators.push("return fn;"),Y)this.decorators=Function.apply(this,["fn","props","container","depth0","data","blockParams","depths",this.decorators.merge()]);else this.decorators.prepend(`function(fn, props, container, depth0, data, blockParams, depths) {
`),this.decorators.push(`}
`),this.decorators=this.decorators.merge();else this.decorators=void 0;var z=this.createFunctionContext(Y);if(!this.isChild){var W={compiler:this.compilerInfo(),main:z};if(this.decorators)W.main_d=this.decorators,W.useDecorators=!0;var v=this.context,H=v.programs,T=v.decorators;for(w=0,O=H.length;w<O;w++)if(H[w]){if(W[w]=H[w],T[w])W[w+"_d"]=T[w],W.useDecorators=!0}if(this.environment.usePartial)W.usePartial=!0;if(this.options.data)W.useData=!0;if(this.useDepths)W.useDepths=!0;if(this.useBlockParams)W.useBlockParams=!0;if(this.options.compat)W.compat=!0;if(!Y)if(W.compiler=JSON.stringify(W.compiler),this.source.currentLocation={start:{line:1,column:0}},W=this.objectLiteral(W),j.srcName)W=W.toStringWithSourceMap({file:j.destName}),W.map=W.map&&W.map.toString();else W=W.toString();else W.compilerOptions=this.options;return W}else return z},preamble:function q(){this.lastContext=0,this.source=new UP.default(this.options.srcName),this.decorators=new UP.default(this.options.srcName)},createFunctionContext:function q(_){var j=this,K="",Y=this.stackVars.concat(this.registers.list);if(Y.length>0)K+=", "+Y.join(", ");var f=0;if(Object.keys(this.aliases).forEach(function(w){var O=j.aliases[w];if(O.children&&O.referenceCount>1)K+=", alias"+ ++f+"="+w,O.children[0]="alias"+f}),this.lookupPropertyFunctionIsUsed)K+=", "+this.lookupPropertyFunctionVarDeclaration();var P=["container","depth0","helpers","partials","data"];if(this.useBlockParams||this.useDepths)P.push("blockParams");if(this.useDepths)P.push("depths");var $=this.mergeSource(K);if(_)return P.push($),Function.apply(this,P);else return this.source.wrap(["function(",P.join(","),`) {
`,$,"}"])},mergeSource:function q(_){var j=this.environment.isSimple,K=!this.forceBuffer,Y=void 0,f=void 0,P=void 0,$=void 0;if(this.source.each(function(w){if(w.appendToBuffer){if(P)w.prepend(" + ");else P=w;$=w}else{if(P){if(!f)Y=!0;else P.prepend("buffer += ");$.add(";"),P=$=void 0}if(f=!0,!j)K=!1}}),K){if(P)P.prepend("return "),$.add(";");else if(!f)this.source.push('return "";')}else if(_+=", buffer = "+(Y?"":this.initializeBuffer()),P)P.prepend("return buffer + "),$.add(";");else this.source.push("return buffer;");if(_)this.source.prepend("var "+_.substring(2)+(Y?"":`;
`));return this.source.merge()},lookupPropertyFunctionVarDeclaration:function q(){return`
lookupProperty = container.lookupProperty || function(parent, propertyName) {
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
return parent[propertyName];
}
return undefined
}
`.trim()},blockValue:function q(_){var j=this.aliasable("container.hooks.blockHelperMissing"),K=[this.contextName(0)];this.setupHelperArgs(_,0,K);var Y=this.popStack();K.splice(1,0,Y),this.push(this.source.functionCall(j,"call",K))},ambiguousBlockValue:function q(){var _=this.aliasable("container.hooks.blockHelperMissing"),j=[this.contextName(0)];this.setupHelperArgs("",0,j,!0),this.flushInline();var K=this.topStack();j.splice(1,0,K),this.pushSource(["if (!",this.lastHelper,") { ",K," = ",this.source.functionCall(_,"call",j),"}"])},appendContent:function q(_){if(this.pendingContent)_=this.pendingContent+_;else this.pendingLocation=this.source.currentLocation;this.pendingContent=_},append:function q(){if(this.isInline())this.replaceStack(function(j){return[" != null ? ",j,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var _=this.popStack();if(this.pushSource(["if (",_," != null) { ",this.appendToBuffer(_,void 0,!0)," }"]),this.environment.isSimple)this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function q(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function q(_){this.lastContext=_},pushContext:function q(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function q(_,j,K,Y){var f=0;if(!Y&&this.options.compat&&!this.lastContext)this.push(this.depthedLookup(_[f++]));else this.pushContext();this.resolvePath("context",_,f,j,K)},lookupBlockParam:function q(_,j){this.useBlockParams=!0,this.push(["blockParams[",_[0],"][",_[1],"]"]),this.resolvePath("context",j,1)},lookupData:function q(_,j,K){if(!_)this.pushStackLiteral("data");else this.pushStackLiteral("container.data(data, "+_+")");this.resolvePath("data",j,0,!0,K)},resolvePath:function q(_,j,K,Y,f){var P=this;if(this.options.strict||this.options.assumeObjects){this.push(LA(this.options.strict&&f,this,j,K,_));return}var $=j.length;for(;K<$;K++)this.replaceStack(function(w){var O=P.nameLookup(w,j[K],_);if(!Y)return[" != null ? ",O," : ",w];else return[" && ",O]})},resolvePossibleLambda:function q(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function q(_,j){if(this.pushContext(),this.pushString(j),j!=="SubExpression")if(typeof _==="string")this.pushString(_);else this.pushStackLiteral(_)},emptyHash:function q(_){if(this.trackIds)this.push("{}");if(this.stringParams)this.push("{}"),this.push("{}");this.pushStackLiteral(_?"undefined":"{}")},pushHash:function q(){if(this.hash)this.hashes.push(this.hash);this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function q(){var _=this.hash;if(this.hash=this.hashes.pop(),this.trackIds)this.push(this.objectLiteral(_.ids));if(this.stringParams)this.push(this.objectLiteral(_.contexts)),this.push(this.objectLiteral(_.types));this.push(this.objectLiteral(_.values))},pushString:function q(_){this.pushStackLiteral(this.quotedString(_))},pushLiteral:function q(_){this.pushStackLiteral(_)},pushProgram:function q(_){if(_!=null)this.pushStackLiteral(this.programExpression(_));else this.pushStackLiteral(null)},registerDecorator:function q(_,j){var K=this.nameLookup("decorators",j,"decorator"),Y=this.setupHelperArgs(j,_);this.decorators.push(["fn = ",this.decorators.functionCall(K,"",["fn","props","container",Y])," || fn;"])},invokeHelper:function q(_,j,K){var Y=this.popStack(),f=this.setupHelper(_,j),P=[];if(K)P.push(f.name);if(P.push(Y),!this.options.strict)P.push(this.aliasable("container.hooks.helperMissing"));var $=["(",this.itemsSeparatedBy(P,"||"),")"],w=this.source.functionCall($,"call",f.callParams);this.push(w)},itemsSeparatedBy:function q(_,j){var K=[];K.push(_[0]);for(var Y=1;Y<_.length;Y++)K.push(j,_[Y]);return K},invokeKnownHelper:function q(_,j){var K=this.setupHelper(_,j);this.push(this.source.functionCall(K.name,"call",K.callParams))},invokeAmbiguous:function q(_,j){this.useRegister("helper");var K=this.popStack();this.emptyHash();var Y=this.setupHelper(0,_,j),f=this.lastHelper=this.nameLookup("helpers",_,"helper"),P=["(","(helper = ",f," || ",K,")"];if(!this.options.strict)P[0]="(helper = ",P.push(" != null ? helper : ",this.aliasable("container.hooks.helperMissing"));this.push(["(",P,Y.paramsInit?["),(",Y.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",Y.callParams)," : helper))"])},invokePartial:function q(_,j,K){var Y=[],f=this.setupParams(j,1,Y);if(_)j=this.popStack(),delete f.name;if(K)f.indent=JSON.stringify(K);if(f.helpers="helpers",f.partials="partials",f.decorators="container.decorators",!_)Y.unshift(this.nameLookup("partials",j,"partial"));else Y.unshift(j);if(this.options.compat)f.depths="depths";f=this.objectLiteral(f),Y.push(f),this.push(this.source.functionCall("container.invokePartial","",Y))},assignToHash:function q(_){var j=this.popStack(),K=void 0,Y=void 0,f=void 0;if(this.trackIds)f=this.popStack();if(this.stringParams)Y=this.popStack(),K=this.popStack();var P=this.hash;if(K)P.contexts[_]=K;if(Y)P.types[_]=Y;if(f)P.ids[_]=f;P.values[_]=j},pushId:function q(_,j,K){if(_==="BlockParam")this.pushStackLiteral("blockParams["+j[0]+"].path["+j[1]+"]"+(K?" + "+JSON.stringify("."+K):""));else if(_==="PathExpression")this.pushString(j);else if(_==="SubExpression")this.pushStackLiteral("true");else this.pushStackLiteral("null")},compiler:hK,compileChildren:function q(_,j){var K=_.children,Y=void 0,f=void 0;for(var P=0,$=K.length;P<$;P++){Y=K[P],f=new this.compiler;var w=this.matchExistingProgram(Y);if(w==null){this.context.programs.push("");var O=this.context.programs.length;Y.index=O,Y.name="program"+O,this.context.programs[O]=f.compile(Y,j,this.context,!this.precompile),this.context.decorators[O]=f.decorators,this.context.environments[O]=Y,this.useDepths=this.useDepths||f.useDepths,this.useBlockParams=this.useBlockParams||f.useBlockParams,Y.useDepths=this.useDepths,Y.useBlockParams=this.useBlockParams}else Y.index=w.index,Y.name="program"+w.index,this.useDepths=this.useDepths||w.useDepths,this.useBlockParams=this.useBlockParams||w.useBlockParams}},matchExistingProgram:function q(_){for(var j=0,K=this.context.environments.length;j<K;j++){var Y=this.context.environments[j];if(Y&&Y.equals(_))return Y}},programExpression:function q(_){var j=this.environment.children[_],K=[j.index,"data",j.blockParams];if(this.useBlockParams||this.useDepths)K.push("blockParams");if(this.useDepths)K.push("depths");return"container.program("+K.join(", ")+")"},useRegister:function q(_){if(!this.registers[_])this.registers[_]=!0,this.registers.list.push(_)},push:function q(_){if(!(_ instanceof uK))_=this.source.wrap(_);return this.inlineStack.push(_),_},pushStackLiteral:function q(_){this.push(new uK(_))},pushSource:function q(_){if(this.pendingContent)this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0;if(_)this.source.push(_)},replaceStack:function q(_){var j=["("],K=void 0,Y=void 0,f=void 0;if(!this.isInline())throw new n2.default("replaceStack on non-inline");var P=this.popStack(!0);if(P instanceof uK)K=[P.value],j=["(",K],f=!0;else{Y=!0;var $=this.incrStack();j=["((",this.push($)," = ",P,")"],K=this.topStack()}var w=_.call(this,K);if(!f)this.popStack();if(Y)this.stackSlot--;this.push(j.concat(w,")"))},incrStack:function q(){if(this.stackSlot++,this.stackSlot>this.stackVars.length)this.stackVars.push("stack"+this.stackSlot);return this.topStackName()},topStackName:function q(){return"stack"+this.stackSlot},flushInline:function q(){var _=this.inlineStack;this.inlineStack=[];for(var j=0,K=_.length;j<K;j++){var Y=_[j];if(Y instanceof uK)this.compileStack.push(Y);else{var f=this.incrStack();this.pushSource([f," = ",Y,";"]),this.compileStack.push(f)}}},isInline:function q(){return this.inlineStack.length},popStack:function q(_){var j=this.isInline(),K=(j?this.inlineStack:this.compileStack).pop();if(!_&&K instanceof uK)return K.value;else{if(!j){if(!this.stackSlot)throw new n2.default("Invalid stack pop");this.stackSlot--}return K}},topStack:function q(){var _=this.isInline()?this.inlineStack:this.compileStack,j=_[_.length-1];if(j instanceof uK)return j.value;else return j},contextName:function q(_){if(this.useDepths&&_)return"depths["+_+"]";else return"depth"+_},quotedString:function q(_){return this.source.quotedString(_)},objectLiteral:function q(_){return this.source.objectLiteral(_)},aliasable:function q(_){var j=this.aliases[_];if(j)return j.referenceCount++,j;return j=this.aliases[_]=this.source.wrap(_),j.aliasable=!0,j.referenceCount=1,j},setupHelper:function q(_,j,K){var Y=[],f=this.setupHelperArgs(j,_,Y,K),P=this.nameLookup("helpers",j,"helper"),$=this.aliasable(this.contextName(0)+" != null ? "+this.contextName(0)+" : (container.nullContext || {})");return{params:Y,paramsInit:f,name:P,callParams:[$].concat(Y)}},setupParams:function q(_,j,K){var Y={},f=[],P=[],$=[],w=!K,O=void 0;if(w)K=[];if(Y.name=this.quotedString(_),Y.hash=this.popStack(),this.trackIds)Y.hashIds=this.popStack();if(this.stringParams)Y.hashTypes=this.popStack(),Y.hashContexts=this.popStack();var z=this.popStack(),W=this.popStack();if(W||z)Y.fn=W||"container.noop",Y.inverse=z||"container.noop";var v=j;while(v--){if(O=this.popStack(),K[v]=O,this.trackIds)$[v]=this.popStack();if(this.stringParams)P[v]=this.popStack(),f[v]=this.popStack()}if(w)Y.args=this.source.generateArray(K);if(this.trackIds)Y.ids=this.source.generateArray($);if(this.stringParams)Y.types=this.source.generateArray(P),Y.contexts=this.source.generateArray(f);if(this.options.data)Y.data="data";if(this.useBlockParams)Y.blockParams="blockParams";return Y},setupHelperArgs:function q(_,j,K,Y){var f=this.setupParams(_,j,K);if(f.loc=JSON.stringify(this.source.currentLocation),f=this.objectLiteral(f),Y)return this.useRegister("options"),K.push("options"),["options=",f];else if(K)return K.push(f),"";else return f}};(function(){var q="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),_=hK.RESERVED_WORDS={};for(var j=0,K=q.length;j<K;j++)_[q[j]]=!0})();hK.isValidJavaScriptVariableName=function(q){return!hK.RESERVED_WORDS[q]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(q)};function LA(q,_,j,K,Y){var f=_.popStack(),P=j.length;if(q)P--;for(;K<P;K++)f=_.nameLookup(f,j[K],Y);if(q)return[_.aliasable("container.strict"),"(",f,", ",_.quotedString(j[K]),", ",JSON.stringify(_.source.currentLocation)," )"];else return f}QP.default=hK;qY.exports=QP.default});var YY=F((jY,PY)=>{jY.__esModule=!0;function J3(q){return q&&q.__esModule?q:{default:q}}var xA=PP(),nA=J3(xA),cA=X2(),rA=J3(cA),c2=uP(),r2=VP(),iA=_Y(),oA=J3(iA),aA=G7(),BA=J3(aA),tA=J2(),FA=J3(tA),eA=nA.default.create;function KY(){var q=eA();return q.compile=function(_,j){return r2.compile(_,j,q)},q.precompile=function(_,j){return r2.precompile(_,j,q)},q.AST=rA.default,q.Compiler=r2.Compiler,q.JavaScriptCompiler=oA.default,q.Parser=c2.parser,q.parse=c2.parse,q.parseWithoutProcessing=c2.parseWithoutProcessing,q}var CK=KY();CK.create=KY;FA.default(CK);CK.Visitor=BA.default;CK.default=CK;jY.default=CK;PY.exports=jY.default});var fY=F((jG)=>{jG.__esModule=!0;jG.print=KG;jG.PrintVisitor=e8;function QA(q){return q&&q.__esModule?q:{default:q}}var qG=G7(),_G=QA(qG);function KG(q){return new e8().accept(q)}function e8(){this.padding=0}e8.prototype=new _G.default;e8.prototype.pad=function(q){var _="";for(var j=0,K=this.padding;j<K;j++)_+=" ";return _+=q+`
`,_};e8.prototype.Program=function(q){var _="",j=q.body,K=void 0,Y=void 0;if(q.blockParams){var f="BLOCK PARAMS: [";for(K=0,Y=q.blockParams.length;K<Y;K++)f+=" "+q.blockParams[K];f+=" ]",_+=this.pad(f)}for(K=0,Y=j.length;K<Y;K++)_+=this.accept(j[K]);return this.padding--,_};e8.prototype.MustacheStatement=function(q){return this.pad("{{ "+this.SubExpression(q)+" }}")};e8.prototype.Decorator=function(q){return this.pad("{{ DIRECTIVE "+this.SubExpression(q)+" }}")};e8.prototype.BlockStatement=e8.prototype.DecoratorBlock=function(q){var _="";if(_+=this.pad((q.type==="DecoratorBlock"?"DIRECTIVE ":"")+"BLOCK:"),this.padding++,_+=this.pad(this.SubExpression(q)),q.program)_+=this.pad("PROGRAM:"),this.padding++,_+=this.accept(q.program),this.padding--;if(q.inverse){if(q.program)this.padding++;if(_+=this.pad("{{^}}"),this.padding++,_+=this.accept(q.inverse),this.padding--,q.program)this.padding--}return this.padding--,_};e8.prototype.PartialStatement=function(q){var _="PARTIAL:"+q.name.original;if(q.params[0])_+=" "+this.accept(q.params[0]);if(q.hash)_+=" "+this.accept(q.hash);return this.pad("{{> "+_+" }}")};e8.prototype.PartialBlockStatement=function(q){var _="PARTIAL BLOCK:"+q.name.original;if(q.params[0])_+=" "+this.accept(q.params[0]);if(q.hash)_+=" "+this.accept(q.hash);return _+=" "+this.pad("PROGRAM:"),this.padding++,_+=this.accept(q.program),this.padding--,this.pad("{{> "+_+" }}")};e8.prototype.ContentStatement=function(q){return this.pad("CONTENT[ '"+q.value+"' ]")};e8.prototype.CommentStatement=function(q){return this.pad("{{! '"+q.value+"' }}")};e8.prototype.SubExpression=function(q){var _=q.params,j=[],K=void 0;for(var Y=0,f=_.length;Y<f;Y++)j.push(this.accept(_[Y]));return _="["+j.join(", ")+"]",K=q.hash?" "+this.accept(q.hash):"",this.accept(q.path)+" "+_+K};e8.prototype.PathExpression=function(q){var _=q.parts.join("/");return(q.data?"@":"")+"PATH:"+_};e8.prototype.StringLiteral=function(q){return'"'+q.value+'"'};e8.prototype.NumberLiteral=function(q){return"NUMBER{"+q.value+"}"};e8.prototype.BooleanLiteral=function(q){return"BOOLEAN{"+q.value+"}"};e8.prototype.UndefinedLiteral=function(){return"UNDEFINED"};e8.prototype.NullLiteral=function(){return"NULL"};e8.prototype.Hash=function(q){var _=q.pairs,j=[];for(var K=0,Y=_.length;K<Y;K++)j.push(this.accept(_[K]));return"HASH{"+j.join(", ")+"}"};e8.prototype.HashPair=function(q){return q.key+"="+this.accept(q.value)}});var zY=F((N0,wY)=>{var V7=YY().default,OY=fY();V7.PrintVisitor=OY.PrintVisitor;V7.print=OY.print;wY.exports=V7;function $Y(q,_){var j=g8("fs"),K=j.readFileSync(_,"utf8");q.exports=V7.compile(K)}if(g8.extensions)g8.extensions[".handlebars"]=$Y,g8.extensions[".hbs"]=$Y});function wG(q,_,j,K){let Y={projectPrefix:q,sessionId:_,timestamp:j||new Date().toISOString(),archiveFilename:K||`${_}.jsonl.archive`};return OG(Y)}function vY(q,_,j,K){let Y=wG(j,_,K),f=`
RESPONSE FORMAT:
After storing memories in Chroma, return EXACTLY this JSON structure wrapped in tags:
<JSONResponse>
{
"overview": "2-3 sentence summary of session themes and accomplishments. Write for any developer to understand by organically defining jargon.",
"summaries": [
{
"text": "What was accomplished (start with action verb)",
"document_id": "${j}_${_}_1",
"keywords": "comma, separated, terms",
"timestamp": "${K||new Date().toISOString()}",
"archive": "${_}.jsonl.archive"
}
]
}
</JSONResponse>
IMPORTANT:
- Return 3-10 summaries based on conversation complexity
- Each summary should correspond to a memory you attempted to store
- If tool calls fail, still return the JSON response with summaries
- The JSON must be valid and complete
- Place NOTHING outside the <JSONResponse> tags
- Do not include any explanatory text before or after the JSON`;return Y+`
`+q+f}var WY,$G=`You are analyzing a Claude Code conversation transcript to create memories using the Chroma MCP memory system.
YOUR TASK:
1. Extract key learnings and accomplishments as natural language memories
2. Store memories using mcp__claude-mem__chroma_add_documents
3. Return a structured JSON response with the extracted summaries
WHAT TO EXTRACT:
- Technical implementations (functions, classes, APIs, databases)
- Design patterns and architectural decisions
- Bug fixes and problem solutions
- Workflows, processes, and integrations
- Performance optimizations and improvements
STORAGE INSTRUCTIONS:
Call mcp__claude-mem__chroma_add_documents with:
- collection_name: "claude_memories"
- documents: Array of natural language descriptions
- ids: ["{{projectPrefix}}_{{sessionId}}_1", "{{projectPrefix}}_{{sessionId}}_2", ...]
- metadatas: Array with fields:
* type: component/pattern/workflow/integration/concept/decision/tool/fix
* keywords: Comma-separated search terms
* context: Brief situation description
* timestamp: "{{timestamp}}"
* session_id: "{{sessionId}}"
ERROR HANDLING:
If you get "IDs already exist" errors, use mcp__claude-mem__chroma_update_documents instead.
If any tool calls fail, continue and return the JSON response anyway.
Project: {{projectPrefix}}
Session ID: {{sessionId}}
Conversation to compress:`,OG;var HY=R8(()=>{WY=F6(zY(),1),OG=WY.default.compile($G,{noEscape:!0})});class i2{projectName;constructor(q="claude-mem"){this.projectName=q}createAnalysisPrompt(q){let _=new Date().toISOString();return{prompt:this.buildAnalysisPrompt(q),context:q,type:"analysis",timestamp:_}}createSessionStartPrompt(q){let _=new Date().toISOString();return{message:this.buildSessionStartMessage(q),context:q,type:"session",timestamp:_}}createHookResponse(q){let _=new Date().toISOString();return{...this.buildHookResponse(q),context:q,type:"hook",timestamp:_}}buildAnalysisPrompt(q){let{transcriptContent:_,sessionId:j,projectName:K=this.projectName}=q;return vY(_,j,K)}buildSessionStartMessage(q){let{sessionId:_,source:j,projectName:K=this.projectName,additionalContext:Y,transcriptPath:f,cwd:P}=q,$=`## Session Started (${j})
**Project**: ${K}
**Session ID**: ${_} `;if(f)$+=`**Transcript**: ${f} `;if(P)$+=`**Working Directory**: ${P} `;if(Y)$+=`
### Additional Context
${Y}`;return $+=`
Memory system is active and ready to preserve context across sessions.`,$}buildHookResponse(q){let{hookEventName:_,success:j,message:K,data:Y,shouldContinue:f=j,stopReason:P}=q,$={continue:f,suppressOutput:!1};if(!f&&P)$.stopReason=P;if(_==="SessionStart")$.hookSpecificOutput={hookEventName:"SessionStart",additionalContext:K,...Y};else if(Y)$.hookSpecificOutput=Y;return $}validateAnalysisContext(q){return!!(q.transcriptContent&&q.sessionId)}validateSessionContext(q){return!!(q.sessionId&&q.source)}validateHookContext(q){return!!(q.hookEventName&&q.sessionId&&typeof q.success==="boolean")}getProjectName(){return this.projectName}setProjectName(q){this.projectName=q}}function JY(q,_,j={}){return{transcriptContent:q,sessionId:_,...j}}var TY=R8(()=>{HY()});var b_;var ZY=R8(()=>{b_={COMPRESSION_STARTED:"\uD83D\uDE80 COMPRESSION STARTED",TRANSCRIPT_PATH:(q)=>`\uD83D\uDCC1 Transcript Path: ${q}`,SESSION_ID:(q)=>`\uD83D\uDD0D Session ID: ${q}`,PROJECT_NAME:(q)=>`\uD83D\uDCDD PROJECT NAME: ${q}`,CLAUDE_SDK_CALL:"\uD83E\uDD16 Calling Claude SDK to analyze and populate memory database...",TRANSCRIPT_STATS:(q,_)=>`\uD83D\uDCCA Transcript size: ${q} characters, ${_} messages`,COMPRESSION_COMPLETE:(q)=>`✅ COMPRESSION COMPLETE
Total summaries extracted: ${q}`,CLAUDE_PATH_FOUND:(q)=>`\uD83C\uDFAF Found Claude Code at: ${q}`,MCP_CONFIG_USED:(q)=>`\uD83D\uDCCB Using MCP config: ${q}`}});class kY{level=DK.INFO;setLevel(q){this.level=DK[q]}debug(q,..._){if(this.level<=DK.DEBUG)console.debug(`[DEBUG] ${q}`,..._)}info(q,..._){if(this.level<=DK.INFO)console.info(`[INFO] ${q}`,..._)}warn(q,..._){if(this.level<=DK.WARN)console.warn(`[WARN] ${q}`,..._)}error(q,_,j){if(this.level<=DK.ERROR){if(console.error(`[ERROR] ${q}`),_)console.error(_);if(j)console.error("Context:",j)}}}var DK,d8;var XY=R8(()=>{DK={DEBUG:0,INFO:1,WARN:2,ERROR:3};d8=new kY});import{readFileSync as zG,existsSync as WG}from"fs";import{join as vG}from"path";function Hq(){return AY.getClaudePath()}var AY;var M7=R8(()=>{_2();AY=class AY{static settingsPath;static cachedSettings=null;static{let q=new nq;this.settingsPath=vG(q.getConfigDir(),"settings.json")}static readSettings(){if(this.cachedSettings!==null)return this.cachedSettings;try{if(WG(this.settingsPath)){let _=zG(this.settingsPath,"utf-8"),j=JSON.parse(_);return this.cachedSettings=j,j}}catch{}let q={};return this.cachedSettings=q,q}static getSetting(q,_){return this.readSettings()[q]??_}static getClaudePath(){return this.getSetting("claudePath","claude")}static clearCache(){this.cachedSettings=null}}});class S_{static DEFAULT_MAX_TOKENS=22400;static DEFAULT_MAX_BYTES=78400;static DEFAULT_CONTEXT_OVERLAP=2;static CHARS_PER_TOKEN_ESTIMATE=3.5;options;constructor(q={}){this.options={maxTokensPerChunk:q.maxTokensPerChunk??S_.DEFAULT_MAX_TOKENS,maxBytesPerChunk:q.maxBytesPerChunk??S_.DEFAULT_MAX_BYTES,preserveContext:q.preserveContext??!0,contextOverlap:q.contextOverlap??S_.DEFAULT_CONTEXT_OVERLAP,parallel:q.parallel??!1}}estimateTokenCount(q){return Math.ceil(q.length/S_.CHARS_PER_TOKEN_ESTIMATE)}parseFilteredOutput(q){let _=q.split(`
`).filter((K)=>K.trim()),j=[];for(let K of _)if(K.startsWith("- ")){let Y=K.substring(2);j.push({content:Y,estimatedTokens:this.estimateTokenCount(Y)})}return j}chunkTranscript(q){let _=this.parseFilteredOutput(q),j=[],K=[],Y=0,f=0,P=0;for(let $=0;$<_.length;$++){let w=_[$],O=this.formatMessage(w),z=Buffer.byteLength(O,"utf8"),W=w.estimatedTokens;if(K.length>0&&(Y+W>this.options.maxTokensPerChunk||f+z>this.options.maxBytesPerChunk)){let v=this.formatChunk(K);if(j.push({content:v,metadata:{chunkNumber:j.length+1,totalChunks:0,startIndex:P,endIndex:$-1,messageCount:K.length,estimatedTokens:Y,sizeBytes:f,hasOverlap:!1}}),K=[],Y=0,f=0,P=$,this.options.preserveContext&&j.length>0){let H=Math.max(0,$-this.options.contextOverlap);for(let T=H;T<$;T++){let J=_[T],k=this.formatMessage(J);K.push(J),Y+=J.estimatedTokens,f+=Buffer.byteLength(k,"utf8")}if(K.length>0)P=H}}K.push(w),Y+=W,f+=z}if(K.length>0){let $=this.formatChunk(K);j.push({content:$,metadata:{chunkNumber:j.length+1,totalChunks:0,startIndex:P,endIndex:_.length-1,messageCount:K.length,estimatedTokens:Y,sizeBytes:f,hasOverlap:this.options.preserveContext&&j.length>0}})}return j.forEach(($)=>{$.metadata.totalChunks=j.length}),j}formatMessage(q){return`- ${q.content}`}formatChunk(q){return q.map((_)=>this.formatMessage(_)).join(`
`)}createChunkHeader(q){let _=[];if(q.firstTimestamp&&q.lastTimestamp)_.push(`# ${q.firstTimestamp} to ${q.lastTimestamp} (chunk ${q.chunkNumber}/${q.totalChunks})`);else _.push(`# Chunk ${q.chunkNumber} of ${q.totalChunks}`);return _.join(`
`)+`
`}needsChunking(q){let _=this.estimateTokenCount(q),j=Buffer.byteLength(q,"utf8");return _>this.options.maxTokensPerChunk||j>this.options.maxBytesPerChunk}getChunkingStats(q){let _=q.reduce((Y,f)=>Y+f.metadata.messageCount,0),j=q.reduce((Y,f)=>Y+f.metadata.estimatedTokens,0),K=q.reduce((Y,f)=>Y+f.metadata.sizeBytes,0);return["\uD83D\uDCCA Chunking Statistics:",` • Total chunks: ${q.length}`,` • Total messages: ${_}`,` • Total estimated tokens: ${j.toLocaleString()}`,` • Total size: ${(K/1024).toFixed(1)} KB`,` • Average tokens per chunk: ${Math.round(j/q.length).toLocaleString()}`,` • Average size per chunk: ${(K/q.length/1024).toFixed(1)} KB`].join(`
`)}}var Mq=F((HG)=>{HG.getBooleanOption=(q,_)=>{let j=!1;if(_ in q&&typeof(j=q[_])!=="boolean")throw new TypeError(`Expected the "${_}" option to be a boolean`);return j};HG.cppdb=Symbol();HG.inspect=Symbol.for("nodejs.util.inspect.custom")});var a2=F((x0,GY)=>{var o2={value:"SqliteError",writable:!0,enumerable:!1,configurable:!0};function E_(q,_){if(new.target!==E_)return new E_(q,_);if(typeof _!=="string")throw new TypeError("Expected second argument to be a string");Error.call(this,q),o2.value=""+q,Object.defineProperty(this,"message",o2),Error.captureStackTrace(this,E_),this.code=_}Object.setPrototypeOf(E_,Error);Object.setPrototypeOf(E_.prototype,Error.prototype);Object.defineProperty(E_.prototype,"name",o2);GY.exports=E_});var hY=F((n0,uY)=>{var N7=g8("path").sep||"/";uY.exports=kG;function kG(q){if(typeof q!="string"||q.length<=7||q.substring(0,7)!="file://")throw new TypeError("must pass in a file:// URI to convert to a file path");var _=decodeURI(q.substring(7)),j=_.indexOf("/"),K=_.substring(0,j),Y=_.substring(j+1);if(K=="localhost")K="";if(K)K=N7+N7+K;if(Y=Y.replace(/^(.+)\|/,"$1:"),N7=="\\")Y=Y.replace(/\//g,"\\");if(/^.+\:/.test(Y));else Y=N7+Y;return K+Y}});var MY=F((E7,VY)=>{var __filename="/Users/alexnewman/Scripts/claude-mem-source/node_modules/bindings/bindings.js",B2=g8("fs"),S7=g8("path"),XG=hY(),b7=S7.join,AG=S7.dirname,CY=B2.accessSync&&function(q){try{B2.accessSync(q)}catch(_){return!1}return!0}||B2.existsSync||S7.existsSync,DY={arrow:process.env.NODE_BINDINGS_ARROW||" → ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};function GG(q){if(typeof q=="string")q={bindings:q};else if(!q)q={};if(Object.keys(DY).map(function(w){if(!(w in q))q[w]=DY[w]}),!q.module_root)q.module_root=E7.getRoot(E7.getFileName());if(S7.extname(q.bindings)!=".node")q.bindings+=".node";var _=typeof __webpack_require__==="function"?__non_webpack_require__:g8,j=[],K=0,Y=q.try.length,f,P,$;for(;K<Y;K++){f=b7.apply(null,q.try[K].map(function(w){return q[w]||w})),j.push(f);try{if(P=q.path?_.resolve(f):_(f),!q.path)P.path=f;return P}catch(w){if(w.code!=="MODULE_NOT_FOUND"&&w.code!=="QUALIFIED_PATH_RESOLUTION_FAILED"&&!/not find/i.test(w.message))throw w}}throw $=new Error(`Could not locate the bindings file. Tried:
`+j.map(function(w){return q.arrow+w}).join(`
`)),$.tries=j,$}VY.exports=E7=GG;E7.getFileName=function q(_){var{prepareStackTrace:j,stackTraceLimit:K}=Error,Y={},f;Error.stackTraceLimit=10,Error.prepareStackTrace=function($,w){for(var O=0,z=w.length;O<z;O++)if(f=w[O].getFileName(),f!==__filename)if(_){if(f!==_)return}else return},Error.captureStackTrace(Y),Y.stack,Error.prepareStackTrace=j,Error.stackTraceLimit=K;var P="file://";if(f.indexOf(P)===0)f=XG(f);return f};E7.getRoot=function q(_){var j=AG(_),K;while(!0){if(j===".")j=process.cwd();if(CY(b7(j,"package.json"))||CY(b7(j,"node_modules")))return j;if(K===j)throw new Error('Could not find module root given file: "'+_+'". Do you have a `package.json` file? ');K=j,j=b7(j,"..")}}});var NY=F((uG)=>{var{cppdb:Jq}=Mq();uG.prepare=function q(_){return this[Jq].prepare(_,this,!1)};uG.exec=function q(_){return this[Jq].exec(_),this};uG.close=function q(){return this[Jq].close(),this};uG.loadExtension=function q(..._){return this[Jq].loadExtension(..._),this};uG.defaultSafeIntegers=function q(..._){return this[Jq].defaultSafeIntegers(..._),this};uG.unsafeMode=function q(..._){return this[Jq].unsafeMode(..._),this};uG.getters={name:{get:function q(){return this[Jq].name},enumerable:!0},open:{get:function q(){return this[Jq].open},enumerable:!0},inTransaction:{get:function q(){return this[Jq].inTransaction},enumerable:!0},readonly:{get:function q(){return this[Jq].readonly},enumerable:!0},memory:{get:function q(){return this[Jq].memory},enumerable:!0}}});var EY=F((a0,SY)=>{var{cppdb:SG}=Mq(),bY=new WeakMap;SY.exports=function q(_){if(typeof _!=="function")throw new TypeError("Expected first argument to be a function");let j=this[SG],K=EG(j,this),{apply:Y}=Function.prototype,f={default:{value:R7(Y,_,j,K.default)},deferred:{value:R7(Y,_,j,K.deferred)},immediate:{value:R7(Y,_,j,K.immediate)},exclusive:{value:R7(Y,_,j,K.exclusive)},database:{value:this,enumerable:!0}};return Object.defineProperties(f.default.value,f),Object.defineProperties(f.deferred.value,f),Object.defineProperties(f.immediate.value,f),Object.defineProperties(f.exclusive.value,f),f.default.value};var EG=(q,_)=>{let j=bY.get(q);if(!j){let K={commit:q.prepare("COMMIT",_,!1),rollback:q.prepare("ROLLBACK",_,!1),savepoint:q.prepare("SAVEPOINT `\t_bs3. `",_,!1),release:q.prepare("RELEASE `\t_bs3. `",_,!1),rollbackTo:q.prepare("ROLLBACK TO `\t_bs3. `",_,!1)};bY.set(q,j={default:Object.assign({begin:q.prepare("BEGIN",_,!1)},K),deferred:Object.assign({begin:q.prepare("BEGIN DEFERRED",_,!1)},K),immediate:Object.assign({begin:q.prepare("BEGIN IMMEDIATE",_,!1)},K),exclusive:Object.assign({begin:q.prepare("BEGIN EXCLUSIVE",_,!1)},K)})}return j},R7=(q,_,j,{begin:K,commit:Y,rollback:f,savepoint:P,release:$,rollbackTo:w})=>function O(){let z,W,v;if(j.inTransaction)z=P,W=$,v=w;else z=K,W=Y,v=f;z.run();try{let H=q.call(_,this,arguments);if(H&&typeof H.then==="function")throw new TypeError("Transaction function cannot return a promise");return W.run(),H}catch(H){if(j.inTransaction){if(v.run(),v!==f)W.run()}throw H}}});var IY=F((B0,RY)=>{var{getBooleanOption:RG,cppdb:IG}=Mq();RY.exports=function q(_,j){if(j==null)j={};if(typeof _!=="string")throw new TypeError("Expected first argument to be a string");if(typeof j!=="object")throw new TypeError("Expected second argument to be an options object");let K=RG(j,"simple"),Y=this[IG].prepare(`PRAGMA ${_}`,this,!0);return K?Y.pluck().get():Y.all()}});var yY=F((t0,gY)=>{var mG=g8("fs"),gG=g8("path"),{promisify:yG}=g8("util"),{cppdb:dG}=Mq(),mY=yG(mG.access);gY.exports=async function q(_,j){if(j==null)j={};if(typeof _!=="string")throw new TypeError("Expected first argument to be a string");if(typeof j!=="object")throw new TypeError("Expected second argument to be an options object");_=_.trim();let K="attached"in j?j.attached:"main",Y="progress"in j?j.progress:null;if(!_)throw new TypeError("Backup filename cannot be an empty string");if(_===":memory:")throw new TypeError('Invalid backup filename ":memory:"');if(typeof K!=="string")throw new TypeError('Expected the "attached" option to be a string');if(!K)throw new TypeError('The "attached" option cannot be an empty string');if(Y!=null&&typeof Y!=="function")throw new TypeError('Expected the "progress" option to be a function');await mY(gG.dirname(_)).catch(()=>{throw new TypeError("Cannot save backup because the directory does not exist")});let f=await mY(_).then(()=>!1,()=>!0);return LG(this[dG].backup(this,K,_,f),Y||null)};var LG=(q,_)=>{let j=0,K=!0;return new Promise((Y,f)=>{setImmediate(function P(){try{let $=q.transfer(j);if(!$.remainingPages){q.close(),Y($);return}if(K)K=!1,j=100;if(_){let w=_($);if(w!==void 0)if(typeof w==="number"&&w===w)j=Math.max(0,Math.min(2147483647,Math.round(w)));else throw new TypeError("Expected progress callback to return a number or undefined")}setImmediate(P)}catch($){q.close(),f($)}})})}});var LY=F((F0,dY)=>{var{cppdb:pG}=Mq();dY.exports=function q(_){if(_==null)_={};if(typeof _!=="object")throw new TypeError("Expected first argument to be an options object");let j="attached"in _?_.attached:"main";if(typeof j!=="string")throw new TypeError('Expected the "attached" option to be a string');if(!j)throw new TypeError('The "attached" option cannot be an empty string');return this[pG].serialize(j)}});var lY=F((e0,pY)=>{var{getBooleanOption:I7,cppdb:lG}=Mq();pY.exports=function q(_,j,K){if(j==null)j={};if(typeof j==="function")K=j,j={};if(typeof _!=="string")throw new TypeError("Expected first argument to be a string");if(typeof K!=="function")throw new TypeError("Expected last argument to be a function");if(typeof j!=="object")throw new TypeError("Expected second argument to be an options object");if(!_)throw new TypeError("User-defined function name cannot be an empty string");let Y="safeIntegers"in j?+I7(j,"safeIntegers"):2,f=I7(j,"deterministic"),P=I7(j,"directOnly"),$=I7(j,"varargs"),w=-1;if(!$){if(w=K.length,!Number.isInteger(w)||w<0)throw new TypeError("Expected function.length to be a positive integer");if(w>100)throw new RangeError("User-defined functions cannot have more than 100 arguments")}return this[lG].function(K,_,w,Y,f,P),this}});var cY=F((U0,nY)=>{var{getBooleanOption:m7,cppdb:xG}=Mq();nY.exports=function q(_,j){if(typeof _!=="string")throw new TypeError("Expected first argument to be a string");if(typeof j!=="object"||j===null)throw new TypeError("Expected second argument to be an options object");if(!_)throw new TypeError("User-defined function name cannot be an empty string");let K="start"in j?j.start:null,Y=t2(j,"step",!0),f=t2(j,"inverse",!1),P=t2(j,"result",!1),$="safeIntegers"in j?+m7(j,"safeIntegers"):2,w=m7(j,"deterministic"),O=m7(j,"directOnly"),z=m7(j,"varargs"),W=-1;if(!z){if(W=Math.max(xY(Y),f?xY(f):0),W>0)W-=1;if(W>100)throw new RangeError("User-defined functions cannot have more than 100 arguments")}return this[xG].aggregate(K,Y,f,P,_,W,$,w,O),this};var t2=(q,_,j)=>{let K=_ in q?q[_]:null;if(typeof K==="function")return K;if(K!=null)throw new TypeError(`Expected the "${_}" option to be a function`);if(j)throw new TypeError(`Missing required option "${_}"`);return null},xY=({length:q})=>{if(Number.isInteger(q)&&q>=0)return q;throw new TypeError("Expected function.length to be a positive integer")}});var aY=F((s0,oY)=>{var{cppdb:nG}=Mq();oY.exports=function q(_,j){if(typeof _!=="string")throw new TypeError("Expected first argument to be a string");if(!_)throw new TypeError("Virtual table module name cannot be an empty string");let K=!1;if(typeof j==="object"&&j!==null)K=!0,j=FG(iY(j,"used",_));else{if(typeof j!=="function")throw new TypeError("Expected second argument to be a function or a table definition object");j=cG(j)}return this[nG].table(j,_,K),this};function cG(q){return function _(j,K,Y,...f){let P={module:j,database:K,table:Y},$=BG.call(q,P,f);if(typeof $!=="object"||$===null)throw new TypeError(`Virtual table module "${j}" did not return a table definition object`);return iY($,"returned",j)}}function iY(q,_,j){if(!T3.call(q,"rows"))throw new TypeError(`Virtual table module "${j}" ${_} a table definition without a "rows" property`);if(!T3.call(q,"columns"))throw new TypeError(`Virtual table module "${j}" ${_} a table definition without a "columns" property`);let K=q.rows;if(typeof K!=="function"||Object.getPrototypeOf(K)!==tG)throw new TypeError(`Virtual table module "${j}" ${_} a table definition with an invalid "rows" property (should be a generator function)`);let Y=q.columns;if(!Array.isArray(Y)||!(Y=[...Y]).every((O)=>typeof O==="string"))throw new TypeError(`Virtual table module "${j}" ${_} a table definition with an invalid "columns" property (should be an array of strings)`);if(Y.length!==new Set(Y).size)throw new TypeError(`Virtual table module "${j}" ${_} a table definition with duplicate column names`);if(!Y.length)throw new RangeError(`Virtual table module "${j}" ${_} a table definition with zero columns`);let f;if(T3.call(q,"parameters")){if(f=q.parameters,!Array.isArray(f)||!(f=[...f]).every((O)=>typeof O==="string"))throw new TypeError(`Virtual table module "${j}" ${_} a table definition with an invalid "parameters" property (should be an array of strings)`)}else f=aG(K);if(f.length!==new Set(f).size)throw new TypeError(`Virtual table module "${j}" ${_} a table definition with duplicate parameter names`);if(f.length>32)throw new RangeError(`Virtual table module "${j}" ${_} a table definition with more than the maximum number of 32 parameters`);for(let O of f)if(Y.includes(O))throw new TypeError(`Virtual table module "${j}" ${_} a table definition with column "${O}" which was ambiguously defined as both a column and parameter`);let P=2;if(T3.call(q,"safeIntegers")){let O=q.safeIntegers;if(typeof O!=="boolean")throw new TypeError(`Virtual table module "${j}" ${_} a table definition with an invalid "safeIntegers" property (should be a boolean)`);P=+O}let $=!1;if(T3.call(q,"directOnly")){if($=q.directOnly,typeof $!=="boolean")throw new TypeError(`Virtual table module "${j}" ${_} a table definition with an invalid "directOnly" property (should be a boolean)`)}return[`CREATE TABLE x(${[...f.map(rY).map((O)=>`${O} HIDDEN`),...Y.map(rY)].join(", ")});`,rG(K,new Map(Y.map((O,z)=>[O,f.length+z])),j),f,P,$]}function rG(q,_,j){return function*K(...Y){let f=Y.map((P)=>Buffer.isBuffer(P)?Buffer.from(P):P);for(let P=0;P<_.size;++P)f.push(null);for(let P of q(...Y))if(Array.isArray(P))iG(P,f,_.size,j),yield f;else if(typeof P==="object"&&P!==null)oG(P,f,_,j),yield f;else throw new TypeError(`Virtual table module "${j}" yielded something that isn't a valid row object`)}}function iG(q,_,j,K){if(q.length!==j)throw new TypeError(`Virtual table module "${K}" yielded a row with an incorrect number of columns`);let Y=_.length-j;for(let f=0;f<j;++f)_[f+Y]=q[f]}function oG(q,_,j,K){let Y=0;for(let f of Object.keys(q)){let P=j.get(f);if(P===void 0)throw new TypeError(`Virtual table module "${K}" yielded a row with an undeclared column "${f}"`);_[P]=q[f],Y+=1}if(Y!==j.size)throw new TypeError(`Virtual table module "${K}" yielded a row with missing columns`)}function aG({length:q}){if(!Number.isInteger(q)||q<0)throw new TypeError("Expected function.length to be a positive integer");let _=[];for(let j=0;j<q;++j)_.push(`$${j+1}`);return _}var{hasOwnProperty:T3}=Object.prototype,{apply:BG}=Function.prototype,tG=Object.getPrototypeOf(function*(){}),rY=(q)=>`"${q.replace(/"/g,'""')}"`,FG=(q)=>()=>q});var tY=F((Q0,BY)=>{var eG=function q(){};BY.exports=function q(_,j){return Object.assign(new eG,this)}});var sY=F((qN,UY)=>{var UG=g8("fs"),FY=g8("path"),g7=Mq(),sG=a2(),eY;function u6(q,_){if(new.target==null)return new u6(q,_);let j;if(Buffer.isBuffer(q))j=q,q=":memory:";if(q==null)q="";if(_==null)_={};if(typeof q!=="string")throw new TypeError("Expected first argument to be a string");if(typeof _!=="object")throw new TypeError("Expected second argument to be an options object");if("readOnly"in _)throw new TypeError('Misspelled option "readOnly" should be "readonly"');if("memory"in _)throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');let K=q.trim(),Y=K===""||K===":memory:",f=g7.getBooleanOption(_,"readonly"),P=g7.getBooleanOption(_,"fileMustExist"),$="timeout"in _?_.timeout:5000,w="verbose"in _?_.verbose:null,O="nativeBinding"in _?_.nativeBinding:null;if(f&&Y&&!j)throw new TypeError("In-memory/temporary databases cannot be readonly");if(!Number.isInteger($)||$<0)throw new TypeError('Expected the "timeout" option to be a positive integer');if($>2147483647)throw new RangeError('Option "timeout" cannot be greater than 2147483647');if(w!=null&&typeof w!=="function")throw new TypeError('Expected the "verbose" option to be a function');if(O!=null&&typeof O!=="string"&&typeof O!=="object")throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');let z;if(O==null)z=eY||(eY=MY()("better_sqlite3.node"));else if(typeof O==="string")z=(typeof __non_webpack_require__==="function"?__non_webpack_require__:g8)(FY.resolve(O).replace(/(\.node)?$/,".node"));else z=O;if(!z.isInitialized)z.setErrorConstructor(sG),z.isInitialized=!0;if(!Y&&!UG.existsSync(FY.dirname(K)))throw new TypeError("Cannot open database because the directory does not exist");Object.defineProperties(this,{[g7.cppdb]:{value:new z.Database(K,q,Y,f,P,$,w||null,j||null)},...R_.getters})}var R_=NY();u6.prototype.prepare=R_.prepare;u6.prototype.transaction=EY();u6.prototype.pragma=IY();u6.prototype.backup=yY();u6.prototype.serialize=LY();u6.prototype.function=lY();u6.prototype.aggregate=cY();u6.prototype.table=aY();u6.prototype.loadExtension=R_.loadExtension;u6.prototype.exec=R_.exec;u6.prototype.close=R_.close;u6.prototype.defaultSafeIntegers=R_.defaultSafeIntegers;u6.prototype.unsafeMode=R_.unsafeMode;u6.prototype[g7.inspect]=tY();UY.exports=u6});var QY=F((KN,F2)=>{F2.exports=sY();F2.exports.SqliteError=a2()});var _f={};$q(_f,{initializeDatabase:()=>qf,getDatabase:()=>bq,DatabaseManager:()=>Nq,Database:()=>e2.default});import QG from"path";import qu from"fs";class Nq{static instance;db=null;migrations=[];static getInstance(){if(!Nq.instance)Nq.instance=new Nq;return Nq.instance}registerMigration(q){this.migrations.push(q),this.migrations.sort((_,j)=>_.version-j.version)}async initialize(){if(this.db)return this.db;let q=_8.getInstance().getDataDirectory();qu.mkdirSync(q,{recursive:!0});let _=QG.join(q,"claude-mem.db");return this.db=new e2.default(_),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),this.db.pragma("temp_store = memory"),this.db.pragma("mmap_size = 268435456"),this.db.pragma("cache_size = 10000"),this.initializeSchemaVersions(),await this.runMigrations(),y7=this.db,this.db}getConnection(){if(!this.db)throw new Error("Database not initialized. Call initialize() first.");return this.db}withTransaction(q){let _=this.getConnection();return _.transaction(q)(_)}close(){if(this.db)this.db.close(),this.db=null,y7=null}initializeSchemaVersions(){if(!this.db)return;this.db.exec(`
CREATE TABLE IF NOT EXISTS schema_versions (
id INTEGER PRIMARY KEY,
version INTEGER UNIQUE NOT NULL,
applied_at TEXT NOT NULL
)
`)}async runMigrations(){if(!this.db)return;let q=this.db.prepare("SELECT version FROM schema_versions ORDER BY version").all().map((j)=>j.version),_=q.length>0?Math.max(...q):0;for(let j of this.migrations)if(j.version>_)console.log(`Applying migration ${j.version}...`),this.db.transaction(()=>{j.up(this.db),this.db.prepare("INSERT INTO schema_versions (version, applied_at) VALUES (?, ?)").run(j.version,new Date().toISOString())})(),console.log(`Migration ${j.version} applied successfully`)}getCurrentVersion(){if(!this.db)return 0;return this.db.prepare("SELECT MAX(version) as version FROM schema_versions").get()?.version||0}}function bq(){if(!y7)throw new Error("Database not initialized. Call DatabaseManager.getInstance().initialize() first.");return y7}async function qf(){return await Nq.getInstance().initialize()}var e2,y7=null;var K_=R8(()=>{e2=F6(QY(),1);G6()});var Kf;var jf=R8(()=>{Kf={version:1,up:(q)=>{q.exec(`
CREATE TABLE sessions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT UNIQUE NOT NULL,
project TEXT NOT NULL,
created_at TEXT NOT NULL,
created_at_epoch INTEGER NOT NULL,
source TEXT DEFAULT 'compress',
archive_path TEXT,
archive_bytes INTEGER,
archive_checksum TEXT,
archived_at TEXT,
metadata_json TEXT
)
`),q.exec(`
CREATE INDEX sessions_project_created_at ON sessions (project, created_at_epoch DESC)
`),q.exec(`
CREATE INDEX sessions_source_created ON sessions (source, created_at_epoch DESC)
`),q.exec(`
CREATE TABLE overviews (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT NOT NULL REFERENCES sessions(session_id) ON DELETE CASCADE,
content TEXT NOT NULL,
created_at TEXT NOT NULL,
created_at_epoch INTEGER NOT NULL,
project TEXT NOT NULL,
origin TEXT DEFAULT 'claude'
)
`),q.exec(`
CREATE INDEX overviews_project_created_at ON overviews (project, created_at_epoch DESC)
`),q.exec(`
CREATE TABLE memories (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT NOT NULL REFERENCES sessions(session_id) ON DELETE CASCADE,
text TEXT NOT NULL,
document_id TEXT,
keywords TEXT,
created_at TEXT NOT NULL,
created_at_epoch INTEGER NOT NULL,
project TEXT NOT NULL,
archive_basename TEXT,
origin TEXT DEFAULT 'transcript'
)
`),q.exec(`
CREATE INDEX memories_project_created_at ON memories (project, created_at_epoch DESC)
`),q.exec(`
CREATE UNIQUE INDEX memories_document_id_unique ON memories (document_id) WHERE document_id IS NOT NULL
`),q.exec(`
CREATE TABLE diagnostics (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT REFERENCES sessions(session_id) ON DELETE SET NULL,
message TEXT NOT NULL,
severity TEXT DEFAULT 'warn',
created_at TEXT NOT NULL,
created_at_epoch INTEGER NOT NULL,
project TEXT NOT NULL,
origin TEXT DEFAULT 'compressor'
)
`),q.exec(`
CREATE INDEX diagnostics_project_created_at ON diagnostics (project, created_at_epoch DESC)
`),q.exec(`
CREATE TABLE archives (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT UNIQUE NOT NULL REFERENCES sessions(session_id) ON DELETE CASCADE,
path TEXT NOT NULL,
bytes INTEGER,
checksum TEXT,
stored_at TEXT NOT NULL,
storage_status TEXT DEFAULT 'active'
)
`),q.exec(`
CREATE TABLE titles (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT UNIQUE NOT NULL REFERENCES sessions(session_id) ON DELETE CASCADE,
title TEXT NOT NULL,
created_at TEXT NOT NULL,
project TEXT NOT NULL
)
`),console.log("✅ Created initial database schema with all tables and indexes")},down:(q)=>{let _=["titles","archives","diagnostics","memories","overviews","sessions"];for(let j of _)q.exec(`DROP TABLE IF EXISTS ${j}`);console.log("\uD83D\uDDD1 Dropped all tables from initial migration")}}});function _u(){Nq.getInstance().registerMigration(Kf)}var Pf=R8(()=>{K_();jf();_u()});function T6(q){let _;if(!q)_=new Date;else if(q instanceof Date)_=q;else if(typeof q==="number")_=new Date(q);else if(typeof q==="string"){if(!q.trim())_=new Date;else if(_=new Date(q),isNaN(_.getTime())){let j=q.replace(/\s+/g,"T").replace(/T+/g,"T");if(_=new Date(j),isNaN(_.getTime()))_=new Date}}else _=new Date;return{isoString:_.toISOString(),epoch:_.getTime()}}var Yf={};$q(Yf,{SessionStore:()=>U2});class U2{db;constructor(q){this.db=q||bq()}create(q){let{isoString:_,epoch:j}=T6(q.created_at),Y=this.db.prepare(`
INSERT INTO sessions (
session_id, project, created_at, created_at_epoch, source,
archive_path, archive_bytes, archive_checksum, archived_at, metadata_json
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`).run(q.session_id,q.project,_,j,q.source||"compress",q.archive_path||null,q.archive_bytes||null,q.archive_checksum||null,q.archived_at||null,q.metadata_json||null);return this.getById(Y.lastInsertRowid)}upsert(q){let _=this.getBySessionId(q.session_id);if(_)return this.update(_.id,q);return this.create(q)}update(q,_){let j=this.getById(q);if(!j)throw new Error(`Session with id ${q} not found`);let{isoString:K,epoch:Y}=T6(_.created_at||j.created_at);return this.db.prepare(`
UPDATE sessions SET
project = ?, created_at = ?, created_at_epoch = ?, source = ?,
archive_path = ?, archive_bytes = ?, archive_checksum = ?, archived_at = ?, metadata_json = ?
WHERE id = ?
`).run(_.project||j.project,K,Y,_.source||j.source,_.archive_path!==void 0?_.archive_path:j.archive_path,_.archive_bytes!==void 0?_.archive_bytes:j.archive_bytes,_.archive_checksum!==void 0?_.archive_checksum:j.archive_checksum,_.archived_at!==void 0?_.archived_at:j.archived_at,_.metadata_json!==void 0?_.metadata_json:j.metadata_json,q),this.getById(q)}getById(q){return this.db.prepare("SELECT * FROM sessions WHERE id = ?").get(q)||null}getBySessionId(q){return this.db.prepare("SELECT * FROM sessions WHERE session_id = ?").get(q)||null}has(q){let _=this.db.prepare("SELECT 1 FROM sessions WHERE session_id = ? LIMIT 1");return Boolean(_.get(q))}getAllSessionIds(){let _=this.db.prepare("SELECT session_id FROM sessions").all();return new Set(_.map((j)=>j.session_id))}getRecentForProject(q,_=5){return this.db.prepare(`
SELECT * FROM sessions
WHERE project = ?
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(q,_)}getRecent(q=5){return this.db.prepare(`
SELECT * FROM sessions
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(q)}getBySource(q,_){let j=_?"SELECT * FROM sessions WHERE source = ? ORDER BY created_at_epoch DESC LIMIT ?":"SELECT * FROM sessions WHERE source = ? ORDER BY created_at_epoch DESC",K=this.db.prepare(j),Y=_?[q,_]:[q];return K.all(...Y)}count(){return this.db.prepare("SELECT COUNT(*) as count FROM sessions").get().count}countByProject(q){return this.db.prepare("SELECT COUNT(*) as count FROM sessions WHERE project = ?").get(q).count}deleteById(q){return this.db.prepare("DELETE FROM sessions WHERE id = ?").run(q).changes>0}deleteBySessionId(q){return this.db.prepare("DELETE FROM sessions WHERE session_id = ?").run(q).changes>0}}var s2=R8(()=>{K_()});var ff={};$q(ff,{MemoryStore:()=>Q2});class Q2{db;constructor(q){this.db=q||bq()}create(q){let{isoString:_,epoch:j}=T6(q.created_at),Y=this.db.prepare(`
INSERT INTO memories (
session_id, text, document_id, keywords, created_at, created_at_epoch,
project, archive_basename, origin
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
`).run(q.session_id,q.text,q.document_id||null,q.keywords||null,_,j,q.project,q.archive_basename||null,q.origin||"transcript");return this.getById(Y.lastInsertRowid)}createMany(q){return this.db.transaction((j)=>{let K=[];for(let Y of j)K.push(this.create(Y));return K})(q)}getById(q){return this.db.prepare("SELECT * FROM memories WHERE id = ?").get(q)||null}getByDocumentId(q){return this.db.prepare("SELECT * FROM memories WHERE document_id = ?").get(q)||null}hasDocumentId(q){let _=this.db.prepare("SELECT 1 FROM memories WHERE document_id = ? LIMIT 1");return Boolean(_.get(q))}getBySessionId(q){return this.db.prepare(`
SELECT * FROM memories
WHERE session_id = ?
ORDER BY created_at_epoch DESC
`).all(q)}getRecentForProject(q,_=10){return this.db.prepare(`
SELECT * FROM memories
WHERE project = ?
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(q,_)}getRecent(q=10){return this.db.prepare(`
SELECT * FROM memories
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(q)}searchByText(q,_,j=20){let K="SELECT * FROM memories WHERE text LIKE ?",Y=[`%${q}%`];if(_)K+=" AND project = ?",Y.push(_);return K+=" ORDER BY created_at_epoch DESC LIMIT ?",Y.push(j),this.db.prepare(K).all(...Y)}searchByKeywords(q,_,j=20){let K="SELECT * FROM memories WHERE keywords LIKE ?",Y=[`%${q}%`];if(_)K+=" AND project = ?",Y.push(_);return K+=" ORDER BY created_at_epoch DESC LIMIT ?",Y.push(j),this.db.prepare(K).all(...Y)}getByOrigin(q,_){let j=_?"SELECT * FROM memories WHERE origin = ? ORDER BY created_at_epoch DESC LIMIT ?":"SELECT * FROM memories WHERE origin = ? ORDER BY created_at_epoch DESC",K=this.db.prepare(j),Y=_?[q,_]:[q];return K.all(...Y)}count(){return this.db.prepare("SELECT COUNT(*) as count FROM memories").get().count}countByProject(q){return this.db.prepare("SELECT COUNT(*) as count FROM memories WHERE project = ?").get(q).count}update(q,_){let j=this.getById(q);if(!j)throw new Error(`Memory with id ${q} not found`);let{isoString:K,epoch:Y}=T6(_.created_at||j.created_at);return this.db.prepare(`
UPDATE memories SET
text = ?, document_id = ?, keywords = ?, created_at = ?, created_at_epoch = ?,
project = ?, archive_basename = ?, origin = ?
WHERE id = ?
`).run(_.text||j.text,_.document_id!==void 0?_.document_id:j.document_id,_.keywords!==void 0?_.keywords:j.keywords,K,Y,_.project||j.project,_.archive_basename!==void 0?_.archive_basename:j.archive_basename,_.origin||j.origin,q),this.getById(q)}deleteById(q){return this.db.prepare("DELETE FROM memories WHERE id = ?").run(q).changes>0}deleteBySessionId(q){return this.db.prepare("DELETE FROM memories WHERE session_id = ?").run(q).changes}getUniqueProjects(){return this.db.prepare("SELECT DISTINCT project FROM memories ORDER BY project").all().map((j)=>j.project)}}var q9=R8(()=>{K_()});var $f={};$q($f,{OverviewStore:()=>_9});class _9{db;constructor(q){this.db=q||bq()}create(q){let{isoString:_,epoch:j}=T6(q.created_at),Y=this.db.prepare(`
INSERT INTO overviews (
session_id, content, created_at, created_at_epoch, project, origin
) VALUES (?, ?, ?, ?, ?, ?)
`).run(q.session_id,q.content,_,j,q.project,q.origin||"claude");return this.getById(Y.lastInsertRowid)}upsert(q){let _=this.getBySessionId(q.session_id);if(_)return this.update(_.id,q);return this.create(q)}getById(q){return this.db.prepare("SELECT * FROM overviews WHERE id = ?").get(q)||null}getBySessionId(q){return this.db.prepare("SELECT * FROM overviews WHERE session_id = ?").get(q)||null}getRecentForProject(q,_=5){return this.db.prepare(`
SELECT * FROM overviews
WHERE project = ?
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(q,_)}getRecent(q=5){return this.db.prepare(`
SELECT * FROM overviews
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(q)}searchByContent(q,_,j=10){let K="SELECT * FROM overviews WHERE content LIKE ?",Y=[`%${q}%`];if(_)K+=" AND project = ?",Y.push(_);return K+=" ORDER BY created_at_epoch DESC LIMIT ?",Y.push(j),this.db.prepare(K).all(...Y)}getByOrigin(q,_){let j=_?"SELECT * FROM overviews WHERE origin = ? ORDER BY created_at_epoch DESC LIMIT ?":"SELECT * FROM overviews WHERE origin = ? ORDER BY created_at_epoch DESC",K=this.db.prepare(j),Y=_?[q,_]:[q];return K.all(...Y)}count(){return this.db.prepare("SELECT COUNT(*) as count FROM overviews").get().count}countByProject(q){return this.db.prepare("SELECT COUNT(*) as count FROM overviews WHERE project = ?").get(q).count}update(q,_){let j=this.getById(q);if(!j)throw new Error(`Overview with id ${q} not found`);let{isoString:K,epoch:Y}=T6(_.created_at||j.created_at);return this.db.prepare(`
UPDATE overviews SET
content = ?, created_at = ?, created_at_epoch = ?, project = ?, origin = ?
WHERE id = ?
`).run(_.content||j.content,K,Y,_.project||j.project,_.origin||j.origin,q),this.getById(q)}deleteById(q){return this.db.prepare("DELETE FROM overviews WHERE id = ?").run(q).changes>0}deleteBySessionId(q){return this.db.prepare("DELETE FROM overviews WHERE session_id = ?").run(q).changes>0}getUniqueProjects(){return this.db.prepare("SELECT DISTINCT project FROM overviews ORDER BY project").all().map((j)=>j.project)}}var K9=R8(()=>{K_()});var Of={};$q(Of,{DiagnosticsStore:()=>j9});class j9{db;constructor(q){this.db=q||bq()}create(q){let{isoString:_,epoch:j}=T6(q.created_at),Y=this.db.prepare(`
INSERT INTO diagnostics (
session_id, message, severity, created_at, created_at_epoch, project, origin
) VALUES (?, ?, ?, ?, ?, ?, ?)
`).run(q.session_id||null,q.message,q.severity||"warn",_,j,q.project,q.origin||"compressor");return this.getById(Y.lastInsertRowid)}getById(q){return this.db.prepare("SELECT * FROM diagnostics WHERE id = ?").get(q)||null}getBySessionId(q){return this.db.prepare(`
SELECT * FROM diagnostics
WHERE session_id = ?
ORDER BY created_at_epoch DESC
`).all(q)}getRecentForProject(q,_=10){return this.db.prepare(`
SELECT * FROM diagnostics
WHERE project = ?
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(q,_)}getRecent(q=10){return this.db.prepare(`
SELECT * FROM diagnostics
ORDER BY created_at_epoch DESC
LIMIT ?
`).all(q)}getBySeverity(q,_){let j=_?"SELECT * FROM diagnostics WHERE severity = ? ORDER BY created_at_epoch DESC LIMIT ?":"SELECT * FROM diagnostics WHERE severity = ? ORDER BY created_at_epoch DESC",K=this.db.prepare(j),Y=_?[q,_]:[q];return K.all(...Y)}getByOrigin(q,_){let j=_?"SELECT * FROM diagnostics WHERE origin = ? ORDER BY created_at_epoch DESC LIMIT ?":"SELECT * FROM diagnostics WHERE origin = ? ORDER BY created_at_epoch DESC",K=this.db.prepare(j),Y=_?[q,_]:[q];return K.all(...Y)}searchByMessage(q,_,j=20){let K="SELECT * FROM diagnostics WHERE message LIKE ?",Y=[`%${q}%`];if(_)K+=" AND project = ?",Y.push(_);return K+=" ORDER BY created_at_epoch DESC LIMIT ?",Y.push(j),this.db.prepare(K).all(...Y)}count(){return this.db.prepare("SELECT COUNT(*) as count FROM diagnostics").get().count}countByProject(q){return this.db.prepare("SELECT COUNT(*) as count FROM diagnostics WHERE project = ?").get(q).count}countBySeverity(q){return this.db.prepare("SELECT COUNT(*) as count FROM diagnostics WHERE severity = ?").get(q).count}update(q,_){let j=this.getById(q);if(!j)throw new Error(`Diagnostic with id ${q} not found`);let{isoString:K,epoch:Y}=T6(_.created_at||j.created_at);return this.db.prepare(`
UPDATE diagnostics SET
message = ?, severity = ?, created_at = ?, created_at_epoch = ?, project = ?, origin = ?
WHERE id = ?
`).run(_.message||j.message,_.severity||j.severity,K,Y,_.project||j.project,_.origin||j.origin,q),this.getById(q)}deleteById(q){return this.db.prepare("DELETE FROM diagnostics WHERE id = ?").run(q).changes>0}deleteBySessionId(q){return this.db.prepare("DELETE FROM diagnostics WHERE session_id = ?").run(q).changes}getUniqueProjects(){return this.db.prepare("SELECT DISTINCT project FROM diagnostics ORDER BY project").all().map((j)=>j.project)}getStats(){return this.db.prepare(`
SELECT
COUNT(*) as total,
COUNT(CASE WHEN severity = 'info' THEN 1 END) as info,
COUNT(CASE WHEN severity = 'warn' THEN 1 END) as warn,
COUNT(CASE WHEN severity = 'error' THEN 1 END) as error
FROM diagnostics
`).get()}}var P9=R8(()=>{K_()});async function Z3(){let{DatabaseManager:q}=await Promise.resolve().then(() => (K_(),_f)),_=await q.getInstance().initialize(),{SessionStore:j}=await Promise.resolve().then(() => (s2(),Yf)),{MemoryStore:K}=await Promise.resolve().then(() => (q9(),ff)),{OverviewStore:Y}=await Promise.resolve().then(() => (K9(),$f)),{DiagnosticsStore:f}=await Promise.resolve().then(() => (P9(),Of));return{sessions:new j(_),memories:new K(_),overviews:new Y(_),diagnostics:new f(_)}}var Y9=R8(()=>{Pf();K_();s2();q9();K9();P9()});import I_ from"fs";class f9{backend="sqlite";stores;async getStores(){if(!this.stores)this.stores=await Z3();return this.stores}async isAvailable(){try{return await this.getStores(),!0}catch(q){return!1}}async createSession(q){return(await this.getStores()).sessions.create(q)}async getSession(q){return(await this.getStores()).sessions.getBySessionId(q)}async hasSession(q){return(await this.getStores()).sessions.has(q)}async getAllSessionIds(){return(await this.getStores()).sessions.getAllSessionIds()}async getRecentSessions(q=5){return(await this.getStores()).sessions.getRecent(q)}async getRecentSessionsForProject(q,_=5){return(await this.getStores()).sessions.getRecentForProject(q,_)}async createMemory(q){return(await this.getStores()).memories.create(q)}async createMemories(q){(await this.getStores()).memories.createMany(q)}async getRecentMemories(q=10){return(await this.getStores()).memories.getRecent(q)}async getRecentMemoriesForProject(q,_=10){return(await this.getStores()).memories.getRecentForProject(q,_)}async hasDocumentId(q){return(await this.getStores()).memories.hasDocumentId(q)}async createOverview(q){return(await this.getStores()).overviews.create(q)}async upsertOverview(q){return(await this.getStores()).overviews.upsert(q)}async getRecentOverviews(q=5){return(await this.getStores()).overviews.getRecent(q)}async getRecentOverviewsForProject(q,_=5){return(await this.getStores()).overviews.getRecentForProject(q,_)}async createDiagnostic(q){return(await this.getStores()).diagnostics.create(q)}}class wf{backend="jsonl";pathDiscovery=_8.getInstance();async isAvailable(){try{let q=this.pathDiscovery.getDataDirectory();return I_.mkdirSync(q,{recursive:!0}),!0}catch{return!1}}appendToIndex(q){let _=this.pathDiscovery.getIndexPath();I_.appendFileSync(_,JSON.stringify(q)+"\\n","utf8")}async createSession(q){let _={type:"session",session_id:q.session_id,project:q.project,timestamp:q.created_at};this.appendToIndex(_)}async getSession(){return null}async hasSession(q){return(await this.getAllSessionIds()).has(q)}async getAllSessionIds(){let q=this.pathDiscovery.getIndexPath();if(!I_.existsSync(q))return new Set;let j=I_.readFileSync(q,"utf-8").trim().split("\\n").filter((Y)=>Y.trim()),K=new Set;for(let Y of j)try{let f=JSON.parse(Y);if(f.session_id)K.add(f.session_id)}catch{}return K}async getRecentSessions(){return[]}async getRecentSessionsForProject(){return[]}async createMemory(q){let _={type:"memory",text:q.text,document_id:q.document_id,keywords:q.keywords,session_id:q.session_id,project:q.project,timestamp:q.created_at,archive:q.archive_basename};this.appendToIndex(_)}async createMemories(q){for(let _ of q)await this.createMemory(_)}async getRecentMemories(){return[]}async getRecentMemoriesForProject(){return[]}async hasDocumentId(q){let _=this.pathDiscovery.getIndexPath();if(!I_.existsSync(_))return!1;let K=I_.readFileSync(_,"utf-8").trim().split("\\n").filter((Y)=>Y.trim());for(let Y of K)try{let f=JSON.parse(Y);if(f.type==="memory"&&f.document_id===q)return!0}catch{}return!1}async createOverview(q){let _={type:"overview",content:q.content,session_id:q.session_id,project:q.project,timestamp:q.created_at};this.appendToIndex(_)}async upsertOverview(q){await this.createOverview(q)}async getRecentOverviews(){return[]}async getRecentOverviewsForProject(){return[]}async createDiagnostic(q){let _={type:"diagnostic",message:q.message,session_id:q.session_id,project:q.project,timestamp:q.created_at};this.appendToIndex(_)}}async function j_(){if(VK)return VK;let q=new f9;if(await q.isAvailable())return VK=q,VK;let _=new wf;if(await _.isAvailable())return VK=_,VK;throw new Error("No storage backend available")}async function P_(){let _=_8.getInstance().getIndexPath();if(I_.existsSync(_)){if(!await new f9().isAvailable())return!0;try{return(await Z3()).sessions.count()===0}catch{return!0}}return!1}var VK=null;var k3=R8(()=>{G6();Y9()});var zf={};$q(zf,{TranscriptCompressor:()=>MK});import g6,{createWriteStream as Ku}from"fs";import X3,{join as $9}from"path";class MK{paths;logStream=null;logFile=null;promptOrchestrator;chunkManager;constructor(q={}){this.paths=new nq,this.promptOrchestrator=new i2,this.chunkManager=new S_,this.ensureClaudeMemStructure(),this.initializeLogging(),d8.debug("\uD83E\uDD16 TranscriptCompressor initialized")}ensureClaudeMemStructure(){let q=this.paths.getConfigDir(),_=this.paths.getIndexDir(),j=this.paths.getArchiveDir(),K=this.paths.getLogsDir();nq.ensureDirectories([q,_,j,K])}initializeLogging(){let q=this.paths.getLogsDir(),_=new Date().toISOString().replace(/[:.]/g,"-");this.logFile=$9(q,`claude-mem-${_}.log`),this.logStream=Ku(this.logFile,{flags:"a"}),this.debugLog("\uD83D\uDE80 DEBUG LOG STARTED"),this.debugLog(`\uD83D\uDCC1 Log file: ${this.logFile}`),this.debugLog("═".repeat(60))}debugLog(q){if(!this.logStream)return;let j=`[${new Date().toISOString()}] ${q}
`;this.logStream.write(j)}closeLogging(){if(this.logStream)this.debugLog("✅ DEBUG LOG ENDED"),this.logStream.end()}async compress(q,_,j){this.debugLog(`\uD83D\uDE80 Starting compression for: ${q}`),this.debugLog(`\uD83D\uDCCB Session ID: ${_||"auto-generated"}`);try{let K=j||nq.getCurrentProjectPrefix();d8.debug(b_.PROJECT_NAME(K)),this.debugLog(`\uD83D\uDCDD PROJECT PREFIX: ${K}`);let Y=g6.readFileSync(q,"utf-8");this.debugLog(`\uD83D\uDCD6 Reading transcript: ${Y.length} bytes`);let f=Y.trim().split(`
`).filter((k)=>k.trim()),P=[],$=0;for(let k=0;k<f.length;k++)try{let A=JSON.parse(f[k]);P.push(A)}catch(A){$++,d8.debug(`Parse error on line ${k+1}: ${A.message}`)}if(d8.debug(b_.TRANSCRIPT_STATS(Y.length,P.length)),$>0)d8.debug(`Parse errors: ${$}`);this.debugLog(`\uD83D\uDCCA Transcript loaded: ${f.length} lines, ${P.length} messages, ${$} parse errors`);let w=_||X3.basename(q,".jsonl"),O=new Date().toISOString();for(let k=P.length-1;k>=0;k--){let A=P[k];if(A.timestamp)try{let G=A.timestamp,u;if(typeof G==="string"&&G.includes("T"))u=new Date(G);else{let V=Number(G),m=V<10000000000?V*1000:V;u=new Date(m)}if(!isNaN(u.getTime())){O=u.toISOString(),this.debugLog(`\uD83D\uDCC5 Using timestamp from last message: ${O}`);break}}catch(G){this.debugLog(`⚠️ Invalid timestamp in message: ${A.timestamp}, trying earlier message`)}}let z=`${w}.jsonl.archive`,W=this.formatConversationForPrompt(P),v=this.chunkManager.needsChunking(W),H=[],T=null;if(v){let k=await this.compressInChunks(P,w,K);H=k.summaries,T=k.overview}else{let k=JY(W,w,{projectName:K,trigger:"manual"}),A=this.promptOrchestrator.createAnalysisPrompt(k);d8.debug("\uD83D\uDCE4 Analysis prompt created"),d8.debug(`\uD83D\uDCCA Prompt length: ${A.prompt.length} characters`);let G=X3.join(this.paths.getLogsDir(),`claude-prompt-${Date.now()}.txt`);g6.writeFileSync(G,`=== CLAUDE ANALYSIS PROMPT ===
${A.prompt}
`),this.debugLog(`\uD83D\uDCDD Full prompt saved to: ${G}`);let u=Hq(),V=this.findMCPConfig();if(d8.debug(b_.CLAUDE_PATH_FOUND(u)),V)d8.debug(b_.MCP_CONFIG_USED(V));this.debugLog("\uD83E\uDD16 Calling Claude SDK with MCP tools...");let m=await xq({prompt:A.prompt,options:{allowedTools:["mcp__claude-mem__chroma_list_collections","mcp__claude-mem__chroma_create_collection","mcp__claude-mem__chroma_peek_collection","mcp__claude-mem__chroma_get_collection_info","mcp__claude-mem__chroma_get_collection_count","mcp__claude-mem__chroma_modify_collection","mcp__claude-mem__chroma_fork_collection","mcp__claude-mem__chroma_delete_collection","mcp__claude-mem__chroma_add_documents","mcp__claude-mem__chroma_query_documents","mcp__claude-mem__chroma_get_documents","mcp__claude-mem__chroma_update_documents","mcp__claude-mem__chroma_delete_documents"],pathToClaudeCodeExecutable:Hq(),model:"sonnet"}});this.debugLog("✅ Claude SDK response received"),this.debugLog("\uD83D\uDD04 Processing Claude JSON response...");let N=await this.processClaudeResponse(m);if(this.debugLog(`\uD83D\uDCCB Extracted ${N.summaries.length} summaries from JSON`),N.overview)this.debugLog(`\uD83D\uDCDD Overview: ${N.overview}`);H=N.summaries,T=N.overview}d8.debug(b_.COMPRESSION_COMPLETE(H.length));let J=this.createArchive(q,K,w,Y);return this.debugLog(`\uD83D\uDCE6 Archive created: ${J}`),await this.appendToIndex(H,T,K,w,P,J,O),this.debugLog(`\uD83D\uDCE5 Written ${H.length} summaries to index`),d8.debug("✅ SUCCESS"),d8.debug(`Archive created: ${J}`),d8.debug(`Summaries created: ${H.length}`),this.debugLog("✅ Compression completed successfully"),this.closeLogging(),J}catch(K){throw d8.error("COMPRESSION FAILED",K,{transcriptPath:q,sessionId:_}),this.debugLog(`❌ ERROR: ${K instanceof Error?K.message:String(K)}`),this.closeLogging(),K}}findMCPConfig(){let q=_8.getInstance();return[q.getProjectMcpConfigPath(),q.getMcpConfigPath(),$9(q.getClaudeConfigDirectory(),".mcp.json")].find(g6.existsSync)||q.getMcpConfigPath()}async processClaudeResponse(q){let _="";_=await this.extractResponseContent(q,[]),this.debugLog(`\uD83D\uDD0D Claude response content length: ${_.length}`);let j=X3.join(this.paths.getLogsDir(),`claude-response-${Date.now()}.txt`);g6.writeFileSync(j,`=== CLAUDE RAW RESPONSE ===
${_}
`),this.debugLog(`\uD83D\uDCDD Raw response saved to: ${j}`);let K=this.extractJSONResponse(_);if(this.debugLog(`\uD83D\uDCCA Extracted ${K.summaries.length} summaries from JSON`),K.summaries.length===0)this.debugLog("⚠️ No summaries found in JSON response");return K}async extractResponseContent(q,_){if(q&&typeof q==="object"&&Symbol.asyncIterator in q){let j="",K=!1;for await(let Y of q){let f=this.extractMessageContent(Y);if(j+=f,f.includes("<JSONResponse>"))K=!0;if(f.includes("</JSONResponse>")){K=!1;continue}if(f&&!K)process.stdout.write(f);if(Y?.type==="result"&&Y?.result)j=Y.result}return j}if(typeof q==="string")return q;if(Array.isArray(q))return q.map((j)=>{if(typeof j==="string")return j;if(j?.text)return j.text;if(j?.content)return j.content;return""}).filter(Boolean).join(`
`);if(typeof q==="object"&&q!==null){if(q?.text)return q.text;if(q?.content)return q.content;if(q?.message)return q.message;return""}return""}extractMessageContent(q){let _="";if(q?.content)_+=q.content;if(q?.text)_+=q.text;if(q?.data)_+=q.data;if(q?.message?.content&&Array.isArray(q.message.content))q.message.content.forEach((j)=>{if(j.type==="text"&&j.text)_+=j.text});return _}extractJSONResponse(q){try{let _=q.match(/<JSONResponse>([\s\S]*?)<\/JSONResponse>/);if(!_)return this.debugLog("⚠️ No <JSONResponse> tags found in response"),{overview:null,summaries:[]};let j=_[1].trim();this.debugLog(`✅ Found JSON response: ${j.length} chars`);let K=JSON.parse(j);if(!K.summaries||!Array.isArray(K.summaries))return this.debugLog("⚠️ Invalid JSON structure: missing summaries array"),{overview:null,summaries:[]};let Y=[];if(K.summaries.forEach((f,P)=>{if(!f.text||!f.document_id){this.debugLog(`⚠️ Skipping invalid summary at index ${P}`);return}let $={text:f.text,document_id:f.document_id,keywords:f.keywords||"",timestamp:f.timestamp||new Date().toISOString(),archive:f.archive||`${f.document_id}.jsonl.archive`};Y.push($),this.debugLog(`✅ Valid summary ${P+1}: ${f.document_id}`)}),K.overview)this.debugLog(`\uD83D\uDCDD Session overview: ${K.overview}`);return{overview:K.overview||null,summaries:Y}}catch(_){return this.debugLog(`❌ Failed to parse JSON response: ${_}`),this.debugLog("\uD83D\uDD04 Attempting fallback to pipe-separated format..."),{overview:null,summaries:this.extractLegacyPipeSeparatedLines(q).map((Y,f)=>{let P=Y.split(" | ");return{text:P[0]||"",document_id:P[1]||`legacy_${Date.now()}_${f}`,keywords:P[2]||"",timestamp:P[3]||new Date().toISOString(),archive:P[4]||`legacy_${Date.now()}_${f}.jsonl.archive`}})}}}extractLegacyPipeSeparatedLines(q){let _=q.split(`
`),j=[];return _.forEach((K)=>{let Y=K.trim();if(Y&&Y.includes(" | ")&&Y.split(" | ").length>=3)j.push(Y)}),this.debugLog(`\uD83D\uDCCA Fallback extracted ${j.length} pipe-separated lines`),j}async compressInChunks(q,_,j){this.debugLog("\uD83D\uDCE6 Large transcript detected, processing in chunks...");let K=[];q.forEach((O,z)=>{let v=this.extractContent(O).replace(/\r\n/g,"\\n").replace(/\n/g,"\\n").replace(/\r/g,"\\n");K.push(`- ${v}`)});let Y=K.join(`
`),f=this.chunkManager.chunkTranscript(Y);this.debugLog(this.chunkManager.getChunkingStats(f)),console.log(`
\uD83D\uDCCA Processing ${f.length} chunks...`);let P=[],$=[];for(let O=0;O<f.length;O++){let z=f[O];console.log(`
\uD83D\uDD04 Processing chunk ${O+1}/${f.length}...`);let W=`Analyze this chunk (${O+1}/${f.length}) of a larger conversation transcript.
${z.metadata.hasOverlap?`Note: This chunk includes ${z.metadata.overlapMessages||2} messages from the previous chunk for context continuity.`:""}
Chunk contains messages ${z.metadata.startIndex+1} to ${z.metadata.endIndex+1}.
${z.content}`,v=this.promptOrchestrator.createAnalysisPrompt({transcriptContent:W,sessionId:_,projectName:j,trigger:"manual",originalTokens:z.metadata.estimatedTokens}),H=Hq(),T=this.findMCPConfig();if(T)d8.debug(b_.MCP_CONFIG_USED(T));let J=await xq({prompt:v.prompt,options:{allowedTools:["mcp__claude-mem__chroma_list_collections","mcp__claude-mem__chroma_create_collection","mcp__claude-mem__chroma_peek_collection","mcp__claude-mem__chroma_get_collection_info","mcp__claude-mem__chroma_get_collection_count","mcp__claude-mem__chroma_modify_collection","mcp__claude-mem__chroma_fork_collection","mcp__claude-mem__chroma_delete_collection","mcp__claude-mem__chroma_add_documents","mcp__claude-mem__chroma_query_documents","mcp__claude-mem__chroma_get_documents","mcp__claude-mem__chroma_update_documents","mcp__claude-mem__chroma_delete_documents"],pathToClaudeCodeExecutable:Hq(),model:"sonnet"}}),k=await this.extractResponseContent(J,[]),A=this.extractJSONResponse(k);if(A.summaries.length>0)console.log(` ✅ Extracted ${A.summaries.length} memories from chunk ${O+1}`),P.push(...A.summaries);else console.log(` ⚠️ No memories extracted from chunk ${O+1}`)}console.log(`
\uD83D\uDCDD Generating overview from ${P.length} extracted memories...`);let w=await this.generateOverviewFromMemories(j,_,P);return{summaries:P,overview:w}}async generateOverviewFromMemories(q,_,j){try{let K=j.map((w)=>w.text||w).filter(Boolean);if(K.length===0)return console.log(" ⚠️ No memories available to generate overview"),null;let Y=`You have just analyzed a long conversation and extracted ${K.length} key memories.
Based on these memories, create a comprehensive overview of the entire session.
MEMORIES EXTRACTED:
${K.map((w,O)=>`${O+1}. ${w}`).join(`
`)}
PROJECT: ${q}
SESSION: ${_}
Create a 2-3 sentence overview that:
1. Summarizes the main themes and accomplishments across ALL the memories
2. Highlights the most significant technical work or decisions
3. Written for any developer to understand (define jargon organically)
Return ONLY the overview text, nothing else.`,f=await xq({prompt:Y,options:{allowedTools:[],pathToClaudeCodeExecutable:Hq(),model:"sonnet"}}),P="";if(f&&typeof f==="object"&&Symbol.asyncIterator in f)for await(let w of f){let O=this.extractMessageContent(w);if(P+=O,w?.type==="result"&&w?.result)P=w.result}else if(typeof f==="string")P=f;else if(f?.text)P=f.text;else if(f?.content)P=f.content;let $=P.trim();if($)return console.log(" ✅ Overview generated successfully"),$;else return console.log(" ⚠️ No overview generated"),null}catch(K){return console.error(` ❌ Failed to generate overview: ${K}`),this.debugLog(`❌ Overview generation error: ${K}`),null}}formatConversationForPrompt(q){let _=[];return q.forEach((j,K)=>{let Y=j.type==="assistant"?"assistant":j.type==="user"?"user":j.type==="result"||j.type==="system"||j.type==="summary"?"system":j.message?.role||j.role,f=this.extractContent(j),P=j.session_id||"",$=this.normalizeTimestamp(j),w=j.uuid||"",z=`${f.replace(/\|/g,"\\|")} | ${P} | ${Y} | ${$} | ${w}`;_.push(z)}),d8.debug(`Field filtering complete: ${_.length} messages processed`),`<!-- TRANSCRIPT -->
${_.join(`
`)}
<!-- /TRANSCRIPT -->`}extractContent(q){let _="";if(q.type==="tool_result")return this.extractToolResultContent(q);if(q.type==="assistant"||q.type==="user"){let j=q.message?.content;if(Array.isArray(j))_=j.map((K)=>this.extractContentItem(K)).filter(Boolean).join(" ");else if(j)_=String(j).trim()}else if(q.type==="summary")_=q.summary||"";else if(q.type==="result"){if(q.subtype==="success"&&q.result)_=`[Result: ${q.result}]`;else if(q.subtype==="error_max_turns")_="[Error: Maximum turns reached]";else if(q.subtype==="error_during_execution")_="[Error during execution]"}else if(q.type==="system")if(q.subtype==="init")_=`[System initialized: ${q.model}, tools: ${q.tools?.length||0}, MCP servers: ${q.mcp_servers?.length||0}]`;else _=String(q.content||"").trim();if(!_){if(_=String(q.message?.content||q.content||""),Array.isArray(_))_=_.map((j)=>j.text||j.content||"").filter(Boolean).join(" ")}if(q.toolUseResult){let j=this.summarizeToolResult(q.toolUseResult,_);if(j)_=_?`${_}
${j}`:j}return String(_).trim()}extractContentItem(q){if(!q||typeof q!=="object")return String(q||"").trim();if(q.type==="text")return q.text||"";else if(q.type==="thinking")return q.thinking||"";else if(q.type==="tool_use"){let _=q.name||"unknown",j=q.id||"";return`[Tool: ${_}${j?` (${j})`:""}]`}else if(q.type==="tool_result"){let _=this.getToolResultSize(q);if(_>1048576)return`[FILTERED: Large tool result ~${Math.round(_/1048576*10)/10}MB - tool output to assistant]`;return this.extractToolResultFromItem(q)}else return q.text||q.content||q.thinking||JSON.stringify(q)}getToolResultSize(q){if(!q.content)return 0;if(Array.isArray(q.content))return q.content.reduce((_,j)=>{return _+(j.text_length||j.text?.length||j.content?.length||0)},0);if(typeof q.content==="string")return q.content.length;return JSON.stringify(q.content).length}extractToolResultContent(q){if(q.content&&Array.isArray(q.content)){let j=q.content.reduce((K,Y)=>{return K+(Y.text_length||Y.text?.length||0)},0);if(j>1048576)return`[FILTERED: Large tool result ~${Math.round(j/1048576*10)/10}MB - tool output to assistant]`;return q.content.map((K)=>this.extractToolResultFromItem(K)).filter(Boolean).join(" ")}if(q.content&&typeof q.content==="string"&&q.content.length>1048576)return`[FILTERED: Large tool result ~${Math.round(q.content.length/1048576*10)/10}MB - tool output to assistant]`;return this.extractToolResultFromItem(q)}extractToolResultFromItem(q){if(q.type==="text"&&q.text)return q.text;if(!q.content)return"[Tool result: no content]";if(Array.isArray(q.content))return q.content.map((_)=>{if(_.type==="text"&&_.text)return _.text;return _.text||_.content||""}).filter(Boolean).join(" ");if(typeof q.content==="string")return q.content;if(typeof q.content==="object")return q.content.text||q.content.content||"[Tool result: complex object]";return String(q.content||"")}createMessageFlowLabel(q,_){if(this.messageContainsToolResult(q))return`Message ${_} (tool → assistant)`;switch(q.type){case"user":return`Message ${_} (user → assistant)`;case"assistant":return`Message ${_} (assistant → user)`;case"system":return`Message ${_} (system)`;case"tool_result":return`Message ${_} (tool → assistant)`;case"summary":return`Message ${_} (session summary)`;case"result":if(q.subtype==="success")return`Message ${_} (session result)`;else if(q.subtype==="error_max_turns")return`Message ${_} (session error: max turns)`;else if(q.subtype==="error_during_execution")return`Message ${_} (session error: execution)`;return`Message ${_} (session result)`;default:return`Message ${_} (${q.type})`}}messageContainsToolResult(q){if(q.type==="user"&&q.message?.content&&Array.isArray(q.message.content))return q.message.content.some((_)=>_.type==="tool_result");if(q.type==="tool_result")return!0;if(q.content&&Array.isArray(q.content))return q.content.some((_)=>_.type==="tool_result");return!1}showFilteredOutput(q,_=!0){let K=g6.readFileSync(q,"utf-8").trim().split(`
`).filter((z)=>z.trim()),Y=[];for(let z of K)try{let W=JSON.parse(z);Y.push(W)}catch(W){continue}let f=[],P=Y.length>0?this.normalizeTimestamp(Y[0]):"",$=Y.length>0?this.normalizeTimestamp(Y[Y.length-1]):"";Y.forEach((z,W)=>{let H=this.extractContent(z).replace(/\r\n/g,"\\n").replace(/\n/g,"\\n").replace(/\r/g,"\\n");f.push(`- ${H}`)});let w=f.join(`
`),O=`/tmp/filtered-transcript-${Date.now()}`;if(_&&this.chunkManager.needsChunking(w)){console.log(`
\uD83D\uDCE6 Large transcript detected, chunking output...`);let z=this.chunkManager.chunkTranscript(w);console.log(this.chunkManager.getChunkingStats(z)),z.forEach((W,v)=>{let H=`${O}-chunk-${v+1}.txt`,T=W.metadata.startIndex,J=Math.min(W.metadata.endIndex,Y.length-1),k=Y[T]?this.normalizeTimestamp(Y[T]):"",A=Y[J]?this.normalizeTimestamp(Y[J]):"";W.metadata.firstTimestamp=k,W.metadata.lastTimestamp=A;let G=this.chunkManager.createChunkHeader(W.metadata)+W.content;g6.writeFileSync(H,G,"utf-8"),console.log(` ✅ Chunk ${v+1}/${z.length} saved to: ${H}`)}),console.log(`Processed ${Y.length} messages from transcript into ${z.length} chunks`),console.log(`\uD83D\uDCC5 Time range: ${P} to ${$}`)}else{let z=`${O}.txt`,W=`# ${P} to ${$}
${w}`;g6.writeFileSync(z,W,"utf-8"),console.log(`
Filtered output saved to: ${z}`),console.log(`Processed ${Y.length} messages from transcript`),console.log(`\uD83D\uDCC5 Time range: ${P} to ${$}`)}}summarizeToolResult(q,_){let j=[];if(q.stdout){let K=String(q.stdout);if(K.length>200){let Y=K.split(`
`).length,f=K.length,P=K.split(`
`),$=P.slice(0,3).join(`
`),w=P.length>6?`
...
${P.slice(-2).join(`
`)}`:"";j.push(`Result: ${$}${w} (${Y} lines, ${f} chars)`)}else j.push(`Result: ${K}`)}if(q.stderr&&q.stderr.trim())j.push(`Error: ${q.stderr}`);if(q.interrupted)j.push("(interrupted)");if(q.isImage)j.push("(image output)");return j.join(`
`)}normalizeTimestamp(q){let _=q.timestamp||q.message?.timestamp||q.created_at||q.message?.created_at;if(!_)return"";try{let j=new Date(_);if(isNaN(j.getTime()))return"";return j.toISOString().replace("T"," ")}catch(j){return d8.debug(`Invalid timestamp format: ${_}`),""}}createArchive(q,_,j,K){let Y=this.paths.getProjectArchiveDir(_);nq.ensureDirectory(Y);let f=$9(Y,`${j}.jsonl.archive`);return g6.writeFileSync(f,K),d8.debug(`\uD83D\uDCE6 Created archive: ${f}`),f}async appendToIndex(q,_,j,K,Y,f,P){try{if(await P_())this.debugLog("⚠️ JSONL to SQLite migration recommended. Run: claude-mem migrate-index");let $=await j_();this.debugLog(`\uD83D\uDCBE Using ${$.backend} storage backend`);let w={session_id:K,project:j,created_at:P,source:"compress",archive_path:f,archive_bytes:g6.statSync(f).size,archived_at:new Date().toISOString()};if(!await $.hasSession(K))await $.createSession(w),this.debugLog(`\uD83D\uDCCB Created session record: ${K}`);else this.debugLog(`\uD83D\uDCCB Session already exists: ${K}`);if(_){let O={session_id:K,content:_,created_at:P,project:j,origin:"claude"};await $.upsertOverview(O),this.debugLog(`\uD83D\uDCDD Stored overview for session: ${K}`)}if(!q||q.length===0){d8.debug("\uD83D\uDCDD No summaries extracted from JSON response");let O={session_id:K,message:"NO SUMMARIES EXTRACTED - Check logs for valid JSON response",severity:"warn",created_at:P,project:j,origin:"compressor"};await $.createDiagnostic(O),this.debugLog(`⚠️ No summaries for session ${K} - Check if Claude returned valid JSON in <JSONResponse> tags`)}else{let O=q.map((z)=>({session_id:K,text:z.text||"",document_id:z.document_id,keywords:z.keywords,created_at:z.timestamp||P,project:j,archive_basename:X3.basename(f),origin:"transcript"}));await $.createMemories(O),d8.debug(`\uD83D\uDCDD Stored ${q.length} summaries using ${$.backend}`),this.debugLog(`\uD83D\uDCBE Stored ${q.length} memories for session: ${K}`)}}catch($){this.debugLog(`❌ Storage failed, falling back to JSONL: ${$}`),d8.warn("Storage provider failed, falling back to JSONL",$),this.appendToIndexJSONL(q,_,j,K,Y,f,P)}}appendToIndexJSONL(q,_,j,K,Y,f,P){let $=this.paths.getIndexPath(),w=this.paths.getConfigDir();nq.ensureDirectory(w);let O={type:"session",session_id:K,timestamp:P,project:j};if(g6.appendFileSync($,JSON.stringify(O)+`
`),_){let z={type:"overview",content:_,session_id:K,project:j,timestamp:P};g6.appendFileSync($,JSON.stringify(z)+`
`)}if(!q||q.length===0){d8.debug("\uD83D\uDCDD No summaries extracted from JSON response");let z={type:"diagnostic",message:"NO SUMMARIES EXTRACTED - Check logs for valid JSON response",session_id:K,project:j,timestamp:P};g6.appendFileSync($,JSON.stringify(z)+`
`),this.debugLog(`⚠️ No summaries for session ${K} - Check if Claude returned valid JSON in <JSONResponse> tags`)}else q.forEach((z)=>{let W={type:"memory",text:z.text,document_id:z.document_id,keywords:z.keywords,session_id:K,project:j,timestamp:z.timestamp||P,archive:X3.basename(f)};g6.appendFileSync($,JSON.stringify(W)+`
`)}),d8.debug(`\uD83D\uDCDD Appended ${q.length} summaries to index as JSONL`);d8.debug(`Index path: ${$}`)}}var d7=R8(()=>{v7();_2();G6();TY();ZY();XY();M7();k3()});import{basename as Wf}from"path";async function A3(q,_={}){if(console.log(H1("compressing")),!q){console.log(e_("Compression","No transcript file provided","Please provide a path to a transcript file"));return}try{let j=Date.now(),{TranscriptCompressor:K}=await Promise.resolve().then(() => (d7(),zf)),Y=new K({verbose:_.verbose||!1}),f=_.sessionId||Wf(q,".jsonl"),P=await Y.compress(q,f),$=Date.now()-j;console.log(tK("Compression",void 0,`Session archived as ${Wf(P)}`)),console.log(J1("compress",{count:1,duration:$,details:`Session: ${f}`}))}catch(j){let K=j instanceof Error?j.message:String(j);throw console.log(e_("Compression",K,"Check that the transcript file exists and you have write permissions")),j}}var O9=R8(()=>{p4()});var z9=F((Zb,vf)=>{var w9={to(q,_){if(!_)return`\x1B[${q+1}G`;return`\x1B[${_+1};${q+1}H`},move(q,_){let j="";if(q<0)j+=`\x1B[${-q}D`;else if(q>0)j+=`\x1B[${q}C`;if(_<0)j+=`\x1B[${-_}A`;else if(_>0)j+=`\x1B[${_}B`;return j},up:(q=1)=>`\x1B[${q}A`,down:(q=1)=>`\x1B[${q}B`,forward:(q=1)=>`\x1B[${q}C`,backward:(q=1)=>`\x1B[${q}D`,nextLine:(q=1)=>"\x1B[E".repeat(q),prevLine:(q=1)=>"\x1B[F".repeat(q),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},ju={up:(q=1)=>"\x1B[S".repeat(q),down:(q=1)=>"\x1B[T".repeat(q)},Pu={screen:"\x1B[2J",up:(q=1)=>"\x1B[1J".repeat(q),down:(q=1)=>"\x1B[J".repeat(q),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(q){let _="";for(let j=0;j<q;j++)_+=this.line+(j<q-1?w9.up():"");if(q)_+=w9.left;return _}};vf.exports={cursor:w9,scroll:ju,erase:Pu,beep:"\x07"}});var v9=F((kb,W9)=>{var p7=process||{},Hf=p7.argv||[],L7=p7.env||{},Yu=!(!!L7.NO_COLOR||Hf.includes("--no-color"))&&(!!L7.FORCE_COLOR||Hf.includes("--color")||p7.platform==="win32"||(p7.stdout||{}).isTTY&&L7.TERM!=="dumb"||!!L7.CI),fu=(q,_,j=q)=>(K)=>{let Y=""+K,f=Y.indexOf(_,q.length);return~f?q+$u(Y,_,j,f)+_:q+Y+_},$u=(q,_,j,K)=>{let Y="",f=0;do Y+=q.substring(f,K)+j,f=K+_.length,K=q.indexOf(_,f);while(~K);return Y+q.substring(f)},Jf=(q=Yu)=>{let _=q?fu:()=>String;return{isColorSupported:q,reset:_("\x1B[0m","\x1B[0m"),bold:_("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:_("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:_("\x1B[3m","\x1B[23m"),underline:_("\x1B[4m","\x1B[24m"),inverse:_("\x1B[7m","\x1B[27m"),hidden:_("\x1B[8m","\x1B[28m"),strikethrough:_("\x1B[9m","\x1B[29m"),black:_("\x1B[30m","\x1B[39m"),red:_("\x1B[31m","\x1B[39m"),green:_("\x1B[32m","\x1B[39m"),yellow:_("\x1B[33m","\x1B[39m"),blue:_("\x1B[34m","\x1B[39m"),magenta:_("\x1B[35m","\x1B[39m"),cyan:_("\x1B[36m","\x1B[39m"),white:_("\x1B[37m","\x1B[39m"),gray:_("\x1B[90m","\x1B[39m"),bgBlack:_("\x1B[40m","\x1B[49m"),bgRed:_("\x1B[41m","\x1B[49m"),bgGreen:_("\x1B[42m","\x1B[49m"),bgYellow:_("\x1B[43m","\x1B[49m"),bgBlue:_("\x1B[44m","\x1B[49m"),bgMagenta:_("\x1B[45m","\x1B[49m"),bgCyan:_("\x1B[46m","\x1B[49m"),bgWhite:_("\x1B[47m","\x1B[49m"),blackBright:_("\x1B[90m","\x1B[39m"),redBright:_("\x1B[91m","\x1B[39m"),greenBright:_("\x1B[92m","\x1B[39m"),yellowBright:_("\x1B[93m","\x1B[39m"),blueBright:_("\x1B[94m","\x1B[39m"),magentaBright:_("\x1B[95m","\x1B[39m"),cyanBright:_("\x1B[96m","\x1B[39m"),whiteBright:_("\x1B[97m","\x1B[39m"),bgBlackBright:_("\x1B[100m","\x1B[49m"),bgRedBright:_("\x1B[101m","\x1B[49m"),bgGreenBright:_("\x1B[102m","\x1B[49m"),bgYellowBright:_("\x1B[103m","\x1B[49m"),bgBlueBright:_("\x1B[104m","\x1B[49m"),bgMagentaBright:_("\x1B[105m","\x1B[49m"),bgCyanBright:_("\x1B[106m","\x1B[49m"),bgWhiteBright:_("\x1B[107m","\x1B[49m")}};W9.exports=Jf();W9.exports.createColors=Jf});import{stdin as Df,stdout as Vf}from"node:process";import*as Y_ from"node:readline";import Tf from"node:readline";import{Writable as Ou}from"node:stream";function wu({onlyFirst:q=!1}={}){let _=["[\\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(_,q?void 0:"g")}function Nf(q){if(typeof q!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof q}\``);return q.replace(zu,"")}function bf(q){return q&&q.__esModule&&Object.prototype.hasOwnProperty.call(q,"default")?q.default:q}function G3(q,_={}){if(typeof q!="string"||q.length===0||(_={ambiguousIsNarrow:!0,..._},q=Nf(q),q.length===0))return 0;q=q.replace(Ju()," ");let j=_.ambiguousIsNarrow?1:2,K=0;for(let Y of q){let f=Y.codePointAt(0);if(f<=31||f>=127&&f<=159||f>=768&&f<=879)continue;switch(vu.eastAsianWidth(Y)){case"F":case"W":K+=2;break;case"A":K+=j;break;default:K+=1}}return K}function ku(){let q=new Map;for(let[_,j]of Object.entries(x8)){for(let[K,Y]of Object.entries(j))x8[K]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},j[K]=x8[K],q.set(Y[0],Y[1]);Object.defineProperty(x8,_,{value:j,enumerable:!1})}return Object.defineProperty(x8,"codes",{value:q,enumerable:!1}),x8.color.close="\x1B[39m",x8.bgColor.close="\x1B[49m",x8.color.ansi=Zf(),x8.color.ansi256=kf(),x8.color.ansi16m=Xf(),x8.bgColor.ansi=Zf(H9),x8.bgColor.ansi256=kf(H9),x8.bgColor.ansi16m=Xf(H9),Object.defineProperties(x8,{rgbToAnsi256:{value:(_,j,K)=>_===j&&j===K?_<8?16:_>248?231:Math.round((_-8)/247*24)+232:16+36*Math.round(_/255*5)+6*Math.round(j/255*5)+Math.round(K/255*5),enumerable:!1},hexToRgb:{value:(_)=>{let j=/[a-f\d]{6}|[a-f\d]{3}/i.exec(_.toString(16));if(!j)return[0,0,0];let[K]=j;K.length===3&&(K=[...K].map((f)=>f+f).join(""));let Y=Number.parseInt(K,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(_)=>x8.rgbToAnsi256(...x8.hexToRgb(_)),enumerable:!1},ansi256ToAnsi:{value:(_)=>{if(_<8)return 30+_;if(_<16)return 90+(_-8);let j,K,Y;if(_>=232)j=((_-232)*10+8)/255,K=j,Y=j;else{_-=16;let $=_%36;j=Math.floor(_/36)/5,K=Math.floor($/6)/5,Y=$%6/5}let f=Math.max(j,K,Y)*2;if(f===0)return 30;let P=30+(Math.round(Y)<<2|Math.round(K)<<1|Math.round(j));return f===2&&(P+=60),P},enumerable:!1},rgbToAnsi:{value:(_,j,K)=>x8.ansi256ToAnsi(x8.rgbToAnsi256(_,j,K)),enumerable:!1},hexToAnsi:{value:(_)=>x8.ansi256ToAnsi(x8.hexToAnsi256(_)),enumerable:!1}}),x8}function uf(q,_,j){return String(q).normalize().replace(/\r\n/g,`
`).split(`
`).map((K)=>Cu(K,_,j)).join(`
`)}function X9(q,_){if(typeof q=="string")return x7.aliases.get(q)===_;for(let j of q)if(j!==void 0&&X9(j,_))return!0;return!1}function Vu(q,_){if(q===_)return;let j=q.split(`
`),K=_.split(`
`),Y=[];for(let f=0;f<Math.max(j.length,K.length);f++)j[f]!==K[f]&&Y.push(f);return Y}function n8(q){return q===T9}function l7(q,_){let j=q;j.isTTY&&j.setRawMode(_)}function If({input:q=Df,output:_=Vf,overwrite:j=!0,hideCursor:K=!0}={}){let Y=Y_.createInterface({input:q,output:_,prompt:"",tabSize:1});Y_.emitKeypressEvents(q,Y),q.isTTY&&q.setRawMode(!0);let f=(P,{name:$,sequence:w})=>{let O=String(P);if(X9([O,$,w],"cancel")){K&&_.write(h6.cursor.show),process.exit(0);return}if(!j)return;Y_.moveCursor(_,$==="return"?0:-1,$==="return"?-1:0,()=>{Y_.clearLine(_,1,()=>{q.once("keypress",f)})})};return K&&_.write(h6.cursor.hide),q.once("keypress",f),()=>{q.off("keypress",f),K&&_.write(h6.cursor.show),q.isTTY&&!Mu&&q.setRawMode(!1),Y.terminal=!1,Y.close()}}class u3{constructor(q,_=!0){n6(this,"input"),n6(this,"output"),n6(this,"_abortSignal"),n6(this,"rl"),n6(this,"opts"),n6(this,"_render"),n6(this,"_track",!1),n6(this,"_prevFrame",""),n6(this,"_subscribers",new Map),n6(this,"_cursor",0),n6(this,"state","initial"),n6(this,"error",""),n6(this,"value");let{input:j=Df,output:K=Vf,render:Y,signal:f,...P}=q;this.opts=P,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=Y.bind(this),this._track=_,this._abortSignal=f,this.input=j,this.output=K}unsubscribe(){this._subscribers.clear()}setSubscriber(q,_){let j=this._subscribers.get(q)??[];j.push(_),this._subscribers.set(q,j)}on(q,_){this.setSubscriber(q,{cb:_})}once(q,_){this.setSubscriber(q,{cb:_,once:!0})}emit(q,..._){let j=this._subscribers.get(q)??[],K=[];for(let Y of j)Y.cb(..._),Y.once&&K.push(()=>j.splice(j.indexOf(Y),1));for(let Y of K)Y()}prompt(){return new Promise((q,_)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),q(T9);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let j=new Ou;j._write=(K,Y,f)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),f()},this.input.pipe(j),this.rl=Tf.createInterface({input:this.input,output:j,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Tf.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),l7(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(h6.cursor.show),this.output.off("resize",this.render),l7(this.input,!1),q(this.value)}),this.once("cancel",()=>{this.output.write(h6.cursor.show),this.output.off("resize",this.render),l7(this.input,!1),q(T9)})})}onKeypress(q,_){if(this.state==="error"&&(this.state="active"),_?.name&&(!this._track&&x7.aliases.has(_.name)&&this.emit("cursor",x7.aliases.get(_.name)),x7.actions.has(_.name)&&this.emit("cursor",_.name)),q&&(q.toLowerCase()==="y"||q.toLowerCase()==="n")&&this.emit("confirm",q.toLowerCase()==="y"),q==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),q&&this.emit("key",q.toLowerCase()),_?.name==="return"){if(this.opts.validate){let j=this.opts.validate(this.value);j&&(this.error=j instanceof Error?j.message:j,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}X9([q,_?.name,_?.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(`
`),l7(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let q=uf(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
`).length-1;this.output.write(h6.cursor.move(-999,q*-1))}render(){let q=uf(this._render(this)??"",process.stdout.columns,{hard:!0});if(q!==this._prevFrame){if(this.state==="initial")this.output.write(h6.cursor.hide);else{let _=Vu(this._prevFrame,q);if(this.restoreCursor(),_&&_?.length===1){let j=_[0];this.output.write(h6.cursor.move(0,j)),this.output.write(h6.erase.lines(1));let K=q.split(`
`);this.output.write(K[j]),this._prevFrame=q,this.output.write(h6.cursor.move(0,K.length-j-1));return}if(_&&_?.length>1){let j=_[0];this.output.write(h6.cursor.move(0,j)),this.output.write(h6.erase.down());let K=q.split(`
`).slice(j);this.output.write(K.join(`
`)),this._prevFrame=q;return}this.output.write(h6.erase.down())}this.output.write(q),this.state==="initial"&&(this.state="active"),this._prevFrame=q}}}var h6,Mf,zu,Sf,Wu,vu,Hu=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},Ju,H9=10,Zf=(q=0)=>(_)=>`\x1B[${_+q}m`,kf=(q=0)=>(_)=>`\x1B[${38+q};5;${_}m`,Xf=(q=0)=>(_,j,K)=>`\x1B[${38+q};2;${_};${j};${K}m`,x8,Tu,Zu,Xu,n7,Au=39,Z9="\x07",Ef="[",Gu="]",Rf="m",k9,Af=(q)=>`${n7.values().next().value}${Ef}${q}${Rf}`,Gf=(q)=>`${n7.values().next().value}${k9}${q}${Z9}`,uu=(q)=>q.split(" ").map((_)=>G3(_)),J9=(q,_,j)=>{let K=[..._],Y=!1,f=!1,P=G3(Nf(q[q.length-1]));for(let[$,w]of K.entries()){let O=G3(w);if(P+O<=j?q[q.length-1]+=w:(q.push(w),P=0),n7.has(w)&&(Y=!0,f=K.slice($+1).join("").startsWith(k9)),Y){f?w===Z9&&(Y=!1,f=!1):w===Rf&&(Y=!1);continue}P+=O,P===j&&$<K.length-1&&(q.push(""),P=0)}!P&&q[q.length-1].length>0&&q.length>1&&(q[q.length-2]+=q.pop())},hu=(q)=>{let _=q.split(" "),j=_.length;for(;j>0&&!(G3(_[j-1])>0);)j--;return j===_.length?q:_.slice(0,j).join(" ")+_.slice(j).join("")},Cu=(q,_,j={})=>{if(j.trim!==!1&&q.trim()==="")return"";let K="",Y,f,P=uu(q),$=[""];for(let[O,z]of q.split(" ").entries()){j.trim!==!1&&($[$.length-1]=$[$.length-1].trimStart());let W=G3($[$.length-1]);if(O!==0&&(W>=_&&(j.wordWrap===!1||j.trim===!1)&&($.push(""),W=0),(W>0||j.trim===!1)&&($[$.length-1]+=" ",W++)),j.hard&&P[O]>_){let v=_-W,H=1+Math.floor((P[O]-v-1)/_);Math.floor((P[O]-1)/_)<H&&$.push(""),J9($,z,_);continue}if(W+P[O]>_&&W>0&&P[O]>0){if(j.wordWrap===!1&&W<_){J9($,z,_);continue}$.push("")}if(W+P[O]>_&&j.wordWrap===!1){J9($,z,_);continue}$[$.length-1]+=z}j.trim!==!1&&($=$.map((O)=>hu(O)));let w=[...$.join(`
`)];for(let[O,z]of w.entries()){if(K+=z,n7.has(z)){let{groups:v}=new RegExp(`(?:\\${Ef}(?<code>\\d+)m|\\${k9}(?<uri>.*)${Z9})`).exec(w.slice(O).join(""))||{groups:{}};if(v.code!==void 0){let H=Number.parseFloat(v.code);Y=H===Au?void 0:H}else v.uri!==void 0&&(f=v.uri.length===0?void 0:v.uri)}let W=Xu.codes.get(Number(Y));w[O+1]===`
`?(f&&(K+=Gf("")),Y&&W&&(K+=Af(W))):z===`
`&&(Y&&W&&(K+=Af(Y)),f&&(K+=Gf(f)))}return K},Du,x7,Mu,T9,Nu,bu=(q,_,j)=>(_ in q)?Nu(q,_,{enumerable:!0,configurable:!0,writable:!0,value:j}):q[_]=j,n6=(q,_,j)=>(bu(q,typeof _!="symbol"?_+"":_,j),j),A9,Su,Eu,Ru=(q,_,j)=>(_ in q)?Eu(q,_,{enumerable:!0,configurable:!0,writable:!0,value:j}):q[_]=j,hf=(q,_,j)=>(Ru(q,typeof _!="symbol"?_+"":_,j),j),mf,Iu,mu=(q,_,j)=>(_ in q)?Iu(q,_,{enumerable:!0,configurable:!0,writable:!0,value:j}):q[_]=j,Cf=(q,_,j)=>(mu(q,typeof _!="symbol"?_+"":_,j),j),G9,u9;var h9=R8(()=>{h6=F6(z9(),1),Mf=F6(v9(),1);zu=wu();Sf={exports:{}};(function(q){var _={};q.exports=_,_.eastAsianWidth=function(K){var Y=K.charCodeAt(0),f=K.length==2?K.charCodeAt(1):0,P=Y;return 55296<=Y&&Y<=56319&&56320<=f&&f<=57343&&(Y&=1023,f&=1023,P=Y<<10|f,P+=65536),P==12288||65281<=P&&P<=65376||65504<=P&&P<=65510?"F":P==8361||65377<=P&&P<=65470||65474<=P&&P<=65479||65482<=P&&P<=65487||65490<=P&&P<=65495||65498<=P&&P<=65500||65512<=P&&P<=65518?"H":4352<=P&&P<=4447||4515<=P&&P<=4519||4602<=P&&P<=4607||9001<=P&&P<=9002||11904<=P&&P<=11929||11931<=P&&P<=12019||12032<=P&&P<=12245||12272<=P&&P<=12283||12289<=P&&P<=12350||12353<=P&&P<=12438||12441<=P&&P<=12543||12549<=P&&P<=12589||12593<=P&&P<=12686||12688<=P&&P<=12730||12736<=P&&P<=12771||12784<=P&&P<=12830||12832<=P&&P<=12871||12880<=P&&P<=13054||13056<=P&&P<=19903||19968<=P&&P<=42124||42128<=P&&P<=42182||43360<=P&&P<=43388||44032<=P&&P<=55203||55216<=P&&P<=55238||55243<=P&&P<=55291||63744<=P&&P<=64255||65040<=P&&P<=65049||65072<=P&&P<=65106||65108<=P&&P<=65126||65128<=P&&P<=65131||110592<=P&&P<=110593||127488<=P&&P<=127490||127504<=P&&P<=127546||127552<=P&&P<=127560||127568<=P&&P<=127569||131072<=P&&P<=194367||177984<=P&&P<=196605||196608<=P&&P<=262141?"W":32<=P&&P<=126||162<=P&&P<=163||165<=P&&P<=166||P==172||P==175||10214<=P&&P<=10221||10629<=P&&P<=10630?"Na":P==161||P==164||167<=P&&P<=168||P==170||173<=P&&P<=174||176<=P&&P<=180||182<=P&&P<=186||188<=P&&P<=191||P==198||P==208||215<=P&&P<=216||222<=P&&P<=225||P==230||232<=P&&P<=234||236<=P&&P<=237||P==240||242<=P&&P<=243||247<=P&&P<=250||P==252||P==254||P==257||P==273||P==275||P==283||294<=P&&P<=295||P==299||305<=P&&P<=307||P==312||319<=P&&P<=322||P==324||328<=P&&P<=331||P==333||338<=P&&P<=339||358<=P&&P<=359||P==363||P==462||P==464||P==466||P==468||P==470||P==472||P==474||P==476||P==593||P==609||P==708||P==711||713<=P&&P<=715||P==717||P==720||728<=P&&P<=731||P==733||P==735||768<=P&&P<=879||913<=P&&P<=929||931<=P&&P<=937||945<=P&&P<=961||963<=P&&P<=969||P==1025||1040<=P&&P<=1103||P==1105||P==8208||8211<=P&&P<=8214||8216<=P&&P<=8217||8220<=P&&P<=8221||8224<=P&&P<=8226||8228<=P&&P<=8231||P==8240||8242<=P&&P<=8243||P==8245||P==8251||P==8254||P==8308||P==8319||8321<=P&&P<=8324||P==8364||P==8451||P==8453||P==8457||P==8467||P==8470||8481<=P&&P<=8482||P==8486||P==8491||8531<=P&&P<=8532||8539<=P&&P<=8542||8544<=P&&P<=8555||8560<=P&&P<=8569||P==8585||8592<=P&&P<=8601||8632<=P&&P<=8633||P==8658||P==8660||P==8679||P==8704||8706<=P&&P<=8707||8711<=P&&P<=8712||P==8715||P==8719||P==8721||P==8725||P==8730||8733<=P&&P<=8736||P==8739||P==8741||8743<=P&&P<=8748||P==8750||8756<=P&&P<=8759||8764<=P&&P<=8765||P==8776||P==8780||P==8786||8800<=P&&P<=8801||8804<=P&&P<=8807||8810<=P&&P<=8811||8814<=P&&P<=8815||8834<=P&&P<=8835||8838<=P&&P<=8839||P==8853||P==8857||P==8869||P==8895||P==8978||9312<=P&&P<=9449||9451<=P&&P<=9547||9552<=P&&P<=9587||9600<=P&&P<=9615||9618<=P&&P<=9621||9632<=P&&P<=9633||9635<=P&&P<=9641||9650<=P&&P<=9651||9654<=P&&P<=9655||9660<=P&&P<=9661||9664<=P&&P<=9665||9670<=P&&P<=9672||P==9675||9678<=P&&P<=9681||9698<=P&&P<=9701||P==9711||9733<=P&&P<=9734||P==9737||9742<=P&&P<=9743||9748<=P&&P<=9749||P==9756||P==9758||P==9792||P==9794||9824<=P&&P<=9825||9827<=P&&P<=9829||9831<=P&&P<=9834||9836<=P&&P<=9837||P==9839||9886<=P&&P<=9887||9918<=P&&P<=9919||9924<=P&&P<=9933||9935<=P&&P<=9953||P==9955||9960<=P&&P<=9983||P==10045||P==10071||10102<=P&&P<=10111||11093<=P&&P<=11097||12872<=P&&P<=12879||57344<=P&&P<=63743||65024<=P&&P<=65039||P==65533||127232<=P&&P<=127242||127248<=P&&P<=127277||127280<=P&&P<=127337||127344<=P&&P<=127386||917760<=P&&P<=917999||983040<=P&&P<=1048573||1048576<=P&&P<=1114109?"A":"N"},_.characterLength=function(K){var Y=this.eastAsianWidth(K);return Y=="F"||Y=="W"||Y=="A"?2:1};function j(K){return K.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}_.length=function(K){for(var Y=j(K),f=0,P=0;P<Y.length;P++)f=f+this.characterLength(Y[P]);return f},_.slice=function(K,Y,f){textLen=_.length(K),Y=Y||0,f=f||1,Y<0&&(Y=textLen+Y),f<0&&(f=textLen+f);for(var P="",$=0,w=j(K),O=0;O<w.length;O++){var z=w[O],W=_.length(z);if($>=Y-(W==2?1:0))if($+W<=f)P+=z;else break;$+=W}return P}})(Sf);Wu=Sf.exports,vu=bf(Wu),Ju=bf(Hu);x8={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(x8.modifier);Tu=Object.keys(x8.color),Zu=Object.keys(x8.bgColor);[...Tu];Xu=ku(),n7=new Set(["\x1B","›"]),k9=`${Gu}8;;`;Du=["up","down","left","right","space","enter","cancel"],x7={actions:new Set(Du),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};Mu=globalThis.process.platform.startsWith("win"),T9=Symbol("clack:cancel");Nu=Object.defineProperty;A9=class A9 extends u3{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(q){super(q,!1),this.value=!!q.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(_)=>{this.output.write(h6.cursor.move(0,-1)),this.value=_,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};Su=new WeakMap;Eu=Object.defineProperty,mf=class extends u3{constructor(q){super(q,!1),hf(this,"options"),hf(this,"cursor",0),this.options=q.options,this.value=[...q.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:_})=>_===q.cursorAt),0),this.on("key",(_)=>{_==="a"&&this.toggleAll()}),this.on("cursor",(_)=>{switch(_){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;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let q=this.value.length===this.options.length;this.value=q?[]:this.options.map((_)=>_.value)}toggleValue(){let q=this.value.includes(this._value);this.value=q?this.value.filter((_)=>_!==this._value):[...this.value,this._value]}},Iu=Object.defineProperty;G9=class G9 extends u3{constructor(q){super(q,!1),Cf(this,"options"),Cf(this,"cursor",0),this.options=q.options,this.cursor=this.options.findIndex(({value:_})=>_===q.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(_)=>{switch(_){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}};u9=class u9 extends u3{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}`;let q=this.value.slice(0,this.cursor),[_,...j]=this.value.slice(this.cursor);return`${q}${Mf.default.inverse(_)}${j.join("")}`}get cursor(){return this._cursor}constructor(q){super(q),this.on("finalize",()=>{this.value||(this.value=q.defaultValue)})}}});import{stripVTControlCharacters as C9}from"node:util";import Tq from"node:process";function gu(){return Tq.platform!=="win32"?Tq.env.TERM!=="linux":!!Tq.env.CI||!!Tq.env.WT_SESSION||!!Tq.env.TERMINUS_SUBLIME||Tq.env.ConEmuTask==="{cmd::Cmder}"||Tq.env.TERM_PROGRAM==="Terminus-Sublime"||Tq.env.TERM_PROGRAM==="vscode"||Tq.env.TERM==="xterm-256color"||Tq.env.TERM==="alacritty"||Tq.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var o,c7,D9,q6=(q,_)=>D9?q:_,yu,df,Lf,r7,du,C8,f_,V9,M9,Lu,gf,pu,Eb,yf,lu,xu,nu,cu,ru,iu,ou,i7=(q)=>{switch(q){case"initial":case"active":return o.default.cyan(yu);case"cancel":return o.default.red(df);case"error":return o.default.yellow(Lf);case"submit":return o.default.green(r7)}},N9=(q)=>{let{cursor:_,options:j,style:K}=q,Y=q.maxItems??Number.POSITIVE_INFINITY,f=Math.max(process.stdout.rows-4,0),P=Math.min(f,Math.max(Y,5)),$=0;_>=$+P-3?$=Math.max(Math.min(_-P+3,j.length-P),0):_<$+2&&($=Math.max(_-2,0));let w=P<j.length&&$>0,O=P<j.length&&$+P<j.length;return j.slice($,$+P).map((z,W,v)=>{let H=W===0&&w,T=W===v.length-1&&O;return H||T?o.default.dim("..."):K(z,W+$===_)})},h3=(q)=>new u9({validate:q.validate,placeholder:q.placeholder,defaultValue:q.defaultValue,initialValue:q.initialValue,render(){let _=`${o.default.gray(C8)}
${i7(this.state)} ${q.message}
`,j=q.placeholder?o.default.inverse(q.placeholder[0])+o.default.dim(q.placeholder.slice(1)):o.default.inverse(o.default.hidden("_")),K=this.value?this.valueWithCursor:j;switch(this.state){case"error":return`${_.trim()}
${o.default.yellow(C8)} ${K}
${o.default.yellow(f_)} ${o.default.yellow(this.error)}
`;case"submit":return`${_}${o.default.gray(C8)} ${o.default.dim(this.value||q.placeholder)}`;case"cancel":return`${_}${o.default.gray(C8)} ${o.default.strikethrough(o.default.dim(this.value??""))}${this.value?.trim()?`
${o.default.gray(C8)}`:""}`;default:return`${_}${o.default.cyan(C8)} ${K}
${o.default.cyan(f_)}
`}}}).prompt(),Sq=(q)=>{let _=q.active??"Yes",j=q.inactive??"No";return new A9({active:_,inactive:j,initialValue:q.initialValue??!0,render(){let K=`${o.default.gray(C8)}
${i7(this.state)} ${q.message}
`,Y=this.value?_:j;switch(this.state){case"submit":return`${K}${o.default.gray(C8)} ${o.default.dim(Y)}`;case"cancel":return`${K}${o.default.gray(C8)} ${o.default.strikethrough(o.default.dim(Y))}
${o.default.gray(C8)}`;default:return`${K}${o.default.cyan(C8)} ${this.value?`${o.default.green(V9)} ${_}`:`${o.default.dim(M9)} ${o.default.dim(_)}`} ${o.default.dim("/")} ${this.value?`${o.default.dim(M9)} ${o.default.dim(j)}`:`${o.default.green(V9)} ${j}`}
${o.default.cyan(f_)}
`}}}).prompt()},aq=(q)=>{let _=(j,K)=>{let Y=j.label??String(j.value);switch(K){case"selected":return`${o.default.dim(Y)}`;case"active":return`${o.default.green(V9)} ${Y} ${j.hint?o.default.dim(`(${j.hint})`):""}`;case"cancelled":return`${o.default.strikethrough(o.default.dim(Y))}`;default:return`${o.default.dim(M9)} ${o.default.dim(Y)}`}};return new G9({options:q.options,initialValue:q.initialValue,render(){let j=`${o.default.gray(C8)}
${i7(this.state)} ${q.message}
`;switch(this.state){case"submit":return`${j}${o.default.gray(C8)} ${_(this.options[this.cursor],"selected")}`;case"cancel":return`${j}${o.default.gray(C8)} ${_(this.options[this.cursor],"cancelled")}
${o.default.gray(C8)}`;default:return`${j}${o.default.cyan(C8)} ${N9({cursor:this.cursor,options:this.options,maxItems:q.maxItems,style:(K,Y)=>_(K,Y?"active":"inactive")}).join(`
${o.default.cyan(C8)} `)}
${o.default.cyan(f_)}
`}}}).prompt()},b9=(q)=>{let _=(j,K)=>{let Y=j.label??String(j.value);return K==="active"?`${o.default.cyan(Lu)} ${Y} ${j.hint?o.default.dim(`(${j.hint})`):""}`:K==="selected"?`${o.default.green(gf)} ${o.default.dim(Y)} ${j.hint?o.default.dim(`(${j.hint})`):""}`:K==="cancelled"?`${o.default.strikethrough(o.default.dim(Y))}`:K==="active-selected"?`${o.default.green(gf)} ${Y} ${j.hint?o.default.dim(`(${j.hint})`):""}`:K==="submitted"?`${o.default.dim(Y)}`:`${o.default.dim(pu)} ${o.default.dim(Y)}`};return new mf({options:q.options,initialValues:q.initialValues,required:q.required??!0,cursorAt:q.cursorAt,validate(j){if(this.required&&j.length===0)return`Please select at least one option.
${o.default.reset(o.default.dim(`Press ${o.default.gray(o.default.bgWhite(o.default.inverse(" space ")))} to select, ${o.default.gray(o.default.bgWhite(o.default.inverse(" enter ")))} to submit`))}`},render(){let j=`${o.default.gray(C8)}
${i7(this.state)} ${q.message}
`,K=(Y,f)=>{let P=this.value.includes(Y.value);return f&&P?_(Y,"active-selected"):P?_(Y,"selected"):_(Y,f?"active":"inactive")};switch(this.state){case"submit":return`${j}${o.default.gray(C8)} ${this.options.filter(({value:Y})=>this.value.includes(Y)).map((Y)=>_(Y,"submitted")).join(o.default.dim(", "))||o.default.dim("none")}`;case"cancel":{let Y=this.options.filter(({value:f})=>this.value.includes(f)).map((f)=>_(f,"cancelled")).join(o.default.dim(", "));return`${j}${o.default.gray(C8)} ${Y.trim()?`${Y}
${o.default.gray(C8)}`:""}`}case"error":{let Y=this.error.split(`
`).map((f,P)=>P===0?`${o.default.yellow(f_)} ${o.default.yellow(f)}`:` ${f}`).join(`
`);return`${j+o.default.yellow(C8)} ${N9({options:this.options,cursor:this.cursor,maxItems:q.maxItems,style:K}).join(`
${o.default.yellow(C8)} `)}
${Y}
`}default:return`${j}${o.default.cyan(C8)} ${N9({options:this.options,cursor:this.cursor,maxItems:q.maxItems,style:K}).join(`
${o.default.cyan(C8)} `)}
${o.default.cyan(f_)}
`}}}).prompt()},S9=(q="",_="")=>{let j=`
${q}
`.split(`
`),K=C9(_).length,Y=Math.max(j.reduce((P,$)=>{let w=C9($);return w.length>P?w.length:P},0),K)+2,f=j.map((P)=>`${o.default.gray(C8)} ${o.default.dim(P)}${" ".repeat(Y-C9(P).length)}${o.default.gray(C8)}`).join(`
`);process.stdout.write(`${o.default.gray(C8)}
${o.default.green(r7)} ${o.default.reset(_)} ${o.default.gray(yf.repeat(Math.max(Y-K-1,1))+lu)}
${f}
${o.default.gray(xu+yf.repeat(Y+2)+nu)}
`)},O6=(q="")=>{process.stdout.write(`${o.default.gray(f_)} ${o.default.red(q)}
`)},pf=(q="")=>{process.stdout.write(`${o.default.gray(du)} ${q}
`)},Bq=(q="")=>{process.stdout.write(`${o.default.gray(C8)}
${o.default.gray(f_)} ${q}
`)},Y6,Rb,$_=({indicator:q="dots"}={})=>{let _=D9?["◒","◐","◓","◑"]:["•","o","O","0"],j=D9?80:120,K=process.env.CI==="true",Y,f,P=!1,$="",w,O=performance.now(),z=(V)=>{let m=V>1?"Something went wrong":"Canceled";P&&u(m,V)},W=()=>z(2),v=()=>z(1),H=()=>{process.on("uncaughtExceptionMonitor",W),process.on("unhandledRejection",W),process.on("SIGINT",v),process.on("SIGTERM",v),process.on("exit",z)},T=()=>{process.removeListener("uncaughtExceptionMonitor",W),process.removeListener("unhandledRejection",W),process.removeListener("SIGINT",v),process.removeListener("SIGTERM",v),process.removeListener("exit",z)},J=()=>{if(w===void 0)return;K&&process.stdout.write(`
`);let V=w.split(`
`);process.stdout.write(c7.cursor.move(-999,V.length-1)),process.stdout.write(c7.erase.down(V.length))},k=(V)=>V.replace(/\.+$/,""),A=(V)=>{let m=(performance.now()-V)/1000,N=Math.floor(m/60),R=Math.floor(m%60);return N>0?`[${N}m ${R}s]`:`[${R}s]`},G=(V="")=>{P=!0,Y=If(),$=k(V),O=performance.now(),process.stdout.write(`${o.default.gray(C8)}
`);let m=0,N=0;H(),f=setInterval(()=>{if(K&&$===w)return;J(),w=$;let R=o.default.magenta(_[m]);if(K)process.stdout.write(`${R} ${$}...`);else if(q==="timer")process.stdout.write(`${R} ${$} ${A(O)}`);else{let p=".".repeat(Math.floor(N)).slice(0,3);process.stdout.write(`${R} ${$}${p}`)}m=m+1<_.length?m+1:0,N=N<_.length?N+0.125:0},j)},u=(V="",m=0)=>{P=!1,clearInterval(f),J();let N=m===0?o.default.green(r7):m===1?o.default.red(df):o.default.red(Lf);$=k(V??$),q==="timer"?process.stdout.write(`${N} ${$} ${A(O)}
`):process.stdout.write(`${N} ${$}
`),T(),Y()};return{start:G,stop:u,message:(V="")=>{$=k(V??$)}}};var NK=R8(()=>{h9();h9();o=F6(v9(),1),c7=F6(z9(),1);D9=gu(),yu=q6("◆","*"),df=q6("■","x"),Lf=q6("▲","x"),r7=q6("◇","o"),du=q6("┌","T"),C8=q6("│","|"),f_=q6("└","—"),V9=q6("●",">"),M9=q6("○"," "),Lu=q6("◻","[•]"),gf=q6("◼","[+]"),pu=q6("◻","[ ]"),Eb=q6("▪","•"),yf=q6("─","-"),lu=q6("╮","+"),xu=q6("├","+"),nu=q6("╯","+"),cu=q6("●","•"),ru=q6("◆","*"),iu=q6("▲","!"),ou=q6("■","x"),Y6={message:(q="",{symbol:_=o.default.gray(C8)}={})=>{let j=[`${o.default.gray(C8)}`];if(q){let[K,...Y]=q.split(`
`);j.push(`${_} ${K}`,...Y.map((f)=>`${o.default.gray(C8)} ${f}`))}process.stdout.write(`${j.join(`
`)}
`)},info:(q)=>{Y6.message(q,{symbol:o.default.blue(cu)})},success:(q)=>{Y6.message(q,{symbol:o.default.green(ru)})},step:(q)=>{Y6.message(q,{symbol:o.default.green(r7)})},warn:(q)=>{Y6.message(q,{symbol:o.default.yellow(iu)})},warning:(q)=>{Y6.warn(q)},error:(q)=>{Y6.message(q,{symbol:o.default.red(ou)})}},Rb=`${o.default.gray(C8)} `});var Uf=F((g9,y9)=>{(function(q,_){typeof g9==="object"&&typeof y9!=="undefined"?y9.exports=_():typeof define==="function"&&define.amd?define(_):(q=typeof globalThis!=="undefined"?globalThis:q||self,q.tinycolor=_())})(g9,function(){function q(C){return q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D},q(C)}var _=/^\s+/,j=/\s+$/;function K(C,D){if(C=C?C:"",D=D||{},C instanceof K)return C;if(!(this instanceof K))return new K(C,D);var Z=Y(C);if(this._originalInput=C,this._r=Z.r,this._g=Z.g,this._b=Z.b,this._a=Z.a,this._roundA=Math.round(100*this._a)/100,this._format=D.format||Z.format,this._gradientType=D.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=Z.ok}K.prototype={isDark:function C(){return this.getBrightness()<128},isLight:function C(){return!this.isDark()},isValid:function C(){return this._ok},getOriginalInput:function C(){return this._originalInput},getFormat:function C(){return this._format},getAlpha:function C(){return this._a},getBrightness:function C(){var D=this.toRgb();return(D.r*299+D.g*587+D.b*114)/1000},getLuminance:function C(){var D=this.toRgb(),Z,E,x,i,r,a;if(Z=D.r/255,E=D.g/255,x=D.b/255,Z<=0.03928)i=Z/12.92;else i=Math.pow((Z+0.055)/1.055,2.4);if(E<=0.03928)r=E/12.92;else r=Math.pow((E+0.055)/1.055,2.4);if(x<=0.03928)a=x/12.92;else a=Math.pow((x+0.055)/1.055,2.4);return 0.2126*i+0.7152*r+0.0722*a},setAlpha:function C(D){return this._a=M(D),this._roundA=Math.round(100*this._a)/100,this},toHsv:function C(){var D=w(this._r,this._g,this._b);return{h:D.h*360,s:D.s,v:D.v,a:this._a}},toHsvString:function C(){var D=w(this._r,this._g,this._b),Z=Math.round(D.h*360),E=Math.round(D.s*100),x=Math.round(D.v*100);return this._a==1?"hsv("+Z+", "+E+"%, "+x+"%)":"hsva("+Z+", "+E+"%, "+x+"%, "+this._roundA+")"},toHsl:function C(){var D=P(this._r,this._g,this._b);return{h:D.h*360,s:D.s,l:D.l,a:this._a}},toHslString:function C(){var D=P(this._r,this._g,this._b),Z=Math.round(D.h*360),E=Math.round(D.s*100),x=Math.round(D.l*100);return this._a==1?"hsl("+Z+", "+E+"%, "+x+"%)":"hsla("+Z+", "+E+"%, "+x+"%, "+this._roundA+")"},toHex:function C(D){return z(this._r,this._g,this._b,D)},toHexString:function C(D){return"#"+this.toHex(D)},toHex8:function C(D){return W(this._r,this._g,this._b,this._a,D)},toHex8String:function C(D){return"#"+this.toHex8(D)},toRgb:function C(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function C(){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 C(){return{r:Math.round(S(this._r,255)*100)+"%",g:Math.round(S(this._g,255)*100)+"%",b:Math.round(S(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function C(){return this._a==1?"rgb("+Math.round(S(this._r,255)*100)+"%, "+Math.round(S(this._g,255)*100)+"%, "+Math.round(S(this._b,255)*100)+"%)":"rgba("+Math.round(S(this._r,255)*100)+"%, "+Math.round(S(this._g,255)*100)+"%, "+Math.round(S(this._b,255)*100)+"%, "+this._roundA+")"},toName:function C(){if(this._a===0)return"transparent";if(this._a<1)return!1;return d[z(this._r,this._g,this._b,!0)]||!1},toFilter:function C(D){var Z="#"+v(this._r,this._g,this._b,this._a),E=Z,x=this._gradientType?"GradientType = 1, ":"";if(D){var i=K(D);E="#"+v(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+x+"startColorstr="+Z+",endColorstr="+E+")"},toString:function C(D){var Z=!!D;D=D||this._format;var E=!1,x=this._a<1&&this._a>=0,i=!Z&&x&&(D==="hex"||D==="hex6"||D==="hex3"||D==="hex4"||D==="hex8"||D==="name");if(i){if(D==="name"&&this._a===0)return this.toName();return this.toRgbString()}if(D==="rgb")E=this.toRgbString();if(D==="prgb")E=this.toPercentageRgbString();if(D==="hex"||D==="hex6")E=this.toHexString();if(D==="hex3")E=this.toHexString(!0);if(D==="hex4")E=this.toHex8String(!0);if(D==="hex8")E=this.toHex8String();if(D==="name")E=this.toName();if(D==="hsl")E=this.toHslString();if(D==="hsv")E=this.toHsvString();return E||this.toHexString()},clone:function C(){return K(this.toString())},_applyModification:function C(D,Z){var E=D.apply(null,[this].concat([].slice.call(Z)));return this._r=E._r,this._g=E._g,this._b=E._b,this.setAlpha(E._a),this},lighten:function C(){return this._applyModification(k,arguments)},brighten:function C(){return this._applyModification(A,arguments)},darken:function C(){return this._applyModification(G,arguments)},desaturate:function C(){return this._applyModification(H,arguments)},saturate:function C(){return this._applyModification(T,arguments)},greyscale:function C(){return this._applyModification(J,arguments)},spin:function C(){return this._applyModification(u,arguments)},_applyCombination:function C(D,Z){return D.apply(null,[this].concat([].slice.call(Z)))},analogous:function C(){return this._applyCombination(R,arguments)},complement:function C(){return this._applyCombination(V,arguments)},monochromatic:function C(){return this._applyCombination(p,arguments)},splitcomplement:function C(){return this._applyCombination(N,arguments)},triad:function C(){return this._applyCombination(m,[3])},tetrad:function C(){return this._applyCombination(m,[4])}},K.fromRatio=function(C,D){if(q(C)=="object"){var Z={};for(var E in C)if(C.hasOwnProperty(E))if(E==="a")Z[E]=C[E];else Z[E]=K8(C[E]);C=Z}return K(C,D)};function Y(C){var D={r:0,g:0,b:0},Z=1,E=null,x=null,i=null,r=!1,a=!1;if(typeof C=="string")C=t8(C);if(q(C)=="object"){if(G8(C.r)&&G8(C.g)&&G8(C.b))D=f(C.r,C.g,C.b),r=!0,a=String(C.r).substr(-1)==="%"?"prgb":"rgb";else if(G8(C.h)&&G8(C.s)&&G8(C.v))E=K8(C.s),x=K8(C.v),D=O(C.h,E,x),r=!0,a="hsv";else if(G8(C.h)&&G8(C.s)&&G8(C.l))E=K8(C.s),i=K8(C.l),D=$(C.h,E,i),r=!0,a="hsl";if(C.hasOwnProperty("a"))Z=C.a}return Z=M(Z),{ok:r,format:C.format||a,r:Math.min(255,Math.max(D.r,0)),g:Math.min(255,Math.max(D.g,0)),b:Math.min(255,Math.max(D.b,0)),a:Z}}function f(C,D,Z){return{r:S(C,255)*255,g:S(D,255)*255,b:S(Z,255)*255}}function P(C,D,Z){C=S(C,255),D=S(D,255),Z=S(Z,255);var E=Math.max(C,D,Z),x=Math.min(C,D,Z),i,r,a=(E+x)/2;if(E==x)i=r=0;else{var Y8=E-x;switch(r=a>0.5?Y8/(2-E-x):Y8/(E+x),E){case C:i=(D-Z)/Y8+(D<Z?6:0);break;case D:i=(Z-C)/Y8+2;break;case Z:i=(C-D)/Y8+4;break}i/=6}return{h:i,s:r,l:a}}function $(C,D,Z){var E,x,i;C=S(C,360),D=S(D,100),Z=S(Z,100);function r(H8,w8,A8){if(A8<0)A8+=1;if(A8>1)A8-=1;if(A8<0.16666666666666666)return H8+(w8-H8)*6*A8;if(A8<0.5)return w8;if(A8<0.6666666666666666)return H8+(w8-H8)*(0.6666666666666666-A8)*6;return H8}if(D===0)E=x=i=Z;else{var a=Z<0.5?Z*(1+D):Z+D-Z*D,Y8=2*Z-a;E=r(Y8,a,C+0.3333333333333333),x=r(Y8,a,C),i=r(Y8,a,C-0.3333333333333333)}return{r:E*255,g:x*255,b:i*255}}function w(C,D,Z){C=S(C,255),D=S(D,255),Z=S(Z,255);var E=Math.max(C,D,Z),x=Math.min(C,D,Z),i,r,a=E,Y8=E-x;if(r=E===0?0:Y8/E,E==x)i=0;else{switch(E){case C:i=(D-Z)/Y8+(D<Z?6:0);break;case D:i=(Z-C)/Y8+2;break;case Z:i=(C-D)/Y8+4;break}i/=6}return{h:i,s:r,v:a}}function O(C,D,Z){C=S(C,360)*6,D=S(D,100),Z=S(Z,100);var E=Math.floor(C),x=C-E,i=Z*(1-D),r=Z*(1-x*D),a=Z*(1-(1-x)*D),Y8=E%6,H8=[Z,r,i,i,a,Z][Y8],w8=[a,Z,Z,r,i,i][Y8],A8=[i,i,a,Z,Z,r][Y8];return{r:H8*255,g:w8*255,b:A8*255}}function z(C,D,Z,E){var x=[f8(Math.round(C).toString(16)),f8(Math.round(D).toString(16)),f8(Math.round(Z).toString(16))];if(E&&x[0].charAt(0)==x[0].charAt(1)&&x[1].charAt(0)==x[1].charAt(1)&&x[2].charAt(0)==x[2].charAt(1))return x[0].charAt(0)+x[1].charAt(0)+x[2].charAt(0);return x.join("")}function W(C,D,Z,E,x){var i=[f8(Math.round(C).toString(16)),f8(Math.round(D).toString(16)),f8(Math.round(Z).toString(16)),f8(z8(E))];if(x&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1))return i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0);return i.join("")}function v(C,D,Z,E){var x=[f8(z8(E)),f8(Math.round(C).toString(16)),f8(Math.round(D).toString(16)),f8(Math.round(Z).toString(16))];return x.join("")}K.equals=function(C,D){if(!C||!D)return!1;return K(C).toRgbString()==K(D).toRgbString()},K.random=function(){return K.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function H(C,D){D=D===0?0:D||10;var Z=K(C).toHsl();return Z.s-=D/100,Z.s=L(Z.s),K(Z)}function T(C,D){D=D===0?0:D||10;var Z=K(C).toHsl();return Z.s+=D/100,Z.s=L(Z.s),K(Z)}function J(C){return K(C).desaturate(100)}function k(C,D){D=D===0?0:D||10;var Z=K(C).toHsl();return Z.l+=D/100,Z.l=L(Z.l),K(Z)}function A(C,D){D=D===0?0:D||10;var Z=K(C).toRgb();return Z.r=Math.max(0,Math.min(255,Z.r-Math.round(255*-(D/100)))),Z.g=Math.max(0,Math.min(255,Z.g-Math.round(255*-(D/100)))),Z.b=Math.max(0,Math.min(255,Z.b-Math.round(255*-(D/100)))),K(Z)}function G(C,D){D=D===0?0:D||10;var Z=K(C).toHsl();return Z.l-=D/100,Z.l=L(Z.l),K(Z)}function u(C,D){var Z=K(C).toHsl(),E=(Z.h+D)%360;return Z.h=E<0?360+E:E,K(Z)}function V(C){var D=K(C).toHsl();return D.h=(D.h+180)%360,K(D)}function m(C,D){if(isNaN(D)||D<=0)throw new Error("Argument to polyad must be a positive number");var Z=K(C).toHsl(),E=[K(C)],x=360/D;for(var i=1;i<D;i++)E.push(K({h:(Z.h+i*x)%360,s:Z.s,l:Z.l}));return E}function N(C){var D=K(C).toHsl(),Z=D.h;return[K(C),K({h:(Z+72)%360,s:D.s,l:D.l}),K({h:(Z+216)%360,s:D.s,l:D.l})]}function R(C,D,Z){D=D||6,Z=Z||30;var E=K(C).toHsl(),x=360/Z,i=[K(C)];for(E.h=(E.h-(x*D>>1)+720)%360;--D;)E.h=(E.h+x)%360,i.push(K(E));return i}function p(C,D){D=D||6;var Z=K(C).toHsv(),E=Z.h,x=Z.s,i=Z.v,r=[],a=1/D;while(D--)r.push(K({h:E,s:x,v:i})),i=(i+a)%1;return r}K.mix=function(C,D,Z){Z=Z===0?0:Z||50;var E=K(C).toRgb(),x=K(D).toRgb(),i=Z/100,r={r:(x.r-E.r)*i+E.r,g:(x.g-E.g)*i+E.g,b:(x.b-E.b)*i+E.b,a:(x.a-E.a)*i+E.a};return K(r)},K.readability=function(C,D){var Z=K(C),E=K(D);return(Math.max(Z.getLuminance(),E.getLuminance())+0.05)/(Math.min(Z.getLuminance(),E.getLuminance())+0.05)},K.isReadable=function(C,D,Z){var E=K.readability(C,D),x,i;switch(i=!1,x=s8(Z),x.level+x.size){case"AAsmall":case"AAAlarge":i=E>=4.5;break;case"AAlarge":i=E>=3;break;case"AAAsmall":i=E>=7;break}return i},K.mostReadable=function(C,D,Z){var E=null,x=0,i,r,a,Y8;Z=Z||{},r=Z.includeFallbackColors,a=Z.level,Y8=Z.size;for(var H8=0;H8<D.length;H8++)if(i=K.readability(C,D[H8]),i>x)x=i,E=K(D[H8]);if(K.isReadable(C,E,{level:a,size:Y8})||!r)return E;else return Z.includeFallbackColors=!1,K.mostReadable(C,["#fff","#000"],Z)};var b=K.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"},d=K.hexNames=y(b);function y(C){var D={};for(var Z in C)if(C.hasOwnProperty(Z))D[C[Z]]=Z;return D}function M(C){if(C=parseFloat(C),isNaN(C)||C<0||C>1)C=1;return C}function S(C,D){if(B(C))C="100%";var Z=e(C);if(C=Math.min(D,Math.max(0,parseFloat(C))),Z)C=parseInt(C*D,10)/100;if(Math.abs(C-D)<0.000001)return 1;return C%D/parseFloat(D)}function L(C){return Math.min(1,Math.max(0,C))}function c(C){return parseInt(C,16)}function B(C){return typeof C=="string"&&C.indexOf(".")!=-1&&parseFloat(C)===1}function e(C){return typeof C==="string"&&C.indexOf("%")!=-1}function f8(C){return C.length==1?"0"+C:""+C}function K8(C){if(C<=1)C=C*100+"%";return C}function z8(C){return Math.round(parseFloat(C)*255).toString(16)}function O8(C){return c(C)/255}var j8=function(){var C="[-\\+]?\\d+%?",D="[-\\+]?\\d*\\.\\d+%?",Z="(?:"+D+")|(?:"+C+")",E="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?",x="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?";return{CSS_UNIT:new RegExp(Z),rgb:new RegExp("rgb"+E),rgba:new RegExp("rgba"+x),hsl:new RegExp("hsl"+E),hsla:new RegExp("hsla"+x),hsv:new RegExp("hsv"+E),hsva:new RegExp("hsva"+x),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 G8(C){return!!j8.CSS_UNIT.exec(C)}function t8(C){C=C.replace(_,"").replace(j,"").toLowerCase();var D=!1;if(b[C])C=b[C],D=!0;else if(C=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var Z;if(Z=j8.rgb.exec(C))return{r:Z[1],g:Z[2],b:Z[3]};if(Z=j8.rgba.exec(C))return{r:Z[1],g:Z[2],b:Z[3],a:Z[4]};if(Z=j8.hsl.exec(C))return{h:Z[1],s:Z[2],l:Z[3]};if(Z=j8.hsla.exec(C))return{h:Z[1],s:Z[2],l:Z[3],a:Z[4]};if(Z=j8.hsv.exec(C))return{h:Z[1],s:Z[2],v:Z[3]};if(Z=j8.hsva.exec(C))return{h:Z[1],s:Z[2],v:Z[3],a:Z[4]};if(Z=j8.hex8.exec(C))return{r:c(Z[1]),g:c(Z[2]),b:c(Z[3]),a:O8(Z[4]),format:D?"name":"hex8"};if(Z=j8.hex6.exec(C))return{r:c(Z[1]),g:c(Z[2]),b:c(Z[3]),format:D?"name":"hex"};if(Z=j8.hex4.exec(C))return{r:c(Z[1]+""+Z[1]),g:c(Z[2]+""+Z[2]),b:c(Z[3]+""+Z[3]),a:O8(Z[4]+""+Z[4]),format:D?"name":"hex8"};if(Z=j8.hex3.exec(C))return{r:c(Z[1]+""+Z[1]),g:c(Z[2]+""+Z[2]),b:c(Z[3]+""+Z[3]),format:D?"name":"hex"};return!1}function s8(C){var D,Z;if(C=C||{level:"AA",size:"small"},D=(C.level||"AA").toUpperCase(),Z=(C.size||"small").toLowerCase(),D!=="AA"&&D!=="AAA")D="AA";if(Z!=="small"&&Z!=="large")Z="small";return{level:D,size:Z}}return K})});var P$=F((ab,j$)=>{var M3=Uf(),_$={r:256,g:256,b:256,a:1},K$={h:360,s:1,v:1,a:1};function L9(q,_,j){let K={};for(let Y in q)if(q.hasOwnProperty(Y))K[Y]=j===0?0:(_[Y]-q[Y])/j;return K}function p9(q,_,j,K){let Y={};for(let f in _)if(_.hasOwnProperty(f))Y[f]=q[f]*j+_[f],Y[f]=Y[f]<0?Y[f]+K[f]:K[f]!==1?Y[f]%K[f]:Y[f];return Y}function d9(q,_,j){let K=q.color.toRgb(),Y=_.color.toRgb(),f=L9(K,Y,j),P=[q.color];for(let $=1;$<j;$++){let w=p9(f,K,$,_$);P.push(M3(w))}return P}function sf(q,_,j,K){let Y=q.color.toHsv(),f=_.color.toHsv();if(Y.s===0||f.s===0)return d9(q,_,j);let P;if(typeof K==="boolean")P=K;else{let z=Y.h<f.h&&f.h-Y.h<180||Y.h>f.h&&Y.h-f.h>180;P=K==="long"&&z||K==="short"&&!z}let $=L9(Y,f,j),w=[q.color],O;if(Y.h<=f.h&&!P||Y.h>=f.h&&P)O=f.h-Y.h;else if(P)O=360-f.h+Y.h;else O=360-Y.h+f.h;$.h=Math.pow(-1,P?1:0)*Math.abs(O)/j;for(let z=1;z<j;z++){let W=p9($,Y,z,K$);w.push(M3(W))}return w}function Qf(q,_){let j=q.length;if(_=parseInt(_,10),isNaN(_)||_<2)throw new Error("Invalid number of steps (< 2)");if(_<j)throw new Error("Number of steps cannot be inferior to number of stops");let K=[];for(let f=1;f<j;f++){let P=(_-1)*(q[f].pos-q[f-1].pos);K.push(Math.max(1,Math.round(P)))}let Y=1;for(let f=j-1;f--;)Y+=K[f];while(Y!==_)if(Y<_){let f=Math.min.apply(null,K);K[K.indexOf(f)]++,Y++}else{let f=Math.max.apply(null,K);K[K.indexOf(f)]--,Y--}return K}function q$(q,_,j,K){if(_<0||_>1)throw new Error("Position must be between 0 and 1");let Y,f;for(let w=0,O=q.length;w<O-1;w++)if(_>=q[w].pos&&_<q[w+1].pos){Y=q[w],f=q[w+1];break}if(!Y)Y=f=q[q.length-1];let P=L9(Y.color[j](),f.color[j](),(f.pos-Y.pos)*100),$=p9(P,Y.color[j](),(_-Y.pos)*100,K);return M3($)}class B7{constructor(q){if(q.length<2)throw new Error("Invalid number of stops (< 2)");let _=q[0].pos!==void 0,j=q.length,K=-1,Y=!1;if(this.stops=q.map((f,P)=>{let $=f.pos!==void 0;if(_^$)throw new Error("Cannot mix positionned and not posionned color stops");if($){let w=f.color!==void 0;if(!w&&(Y||P===0||P===j-1))throw new Error("Cannot define two consecutive position-only stops");if(Y=!w,f={color:w?M3(f.color):null,colorLess:!w,pos:f.pos},f.pos<0||f.pos>1)throw new Error("Color stops positions must be between 0 and 1");else if(f.pos<K)throw new Error("Color stops positions are not ordered");K=f.pos}else f={color:M3(f.color!==void 0?f.color:f),pos:P/(j-1)};return f}),this.stops[0].pos!==0)this.stops.unshift({color:this.stops[0].color,pos:0}),j++;if(this.stops[j-1].pos!==1)this.stops.push({color:this.stops[j-1].color,pos:1})}reverse(){let q=[];return this.stops.forEach(function(_){q.push({color:_.color,pos:1-_.pos})}),new B7(q.reverse())}loop(){let q=[],_=[];return this.stops.forEach((j)=>{q.push({color:j.color,pos:j.pos/2})}),this.stops.slice(0,-1).forEach((j)=>{_.push({color:j.color,pos:1-j.pos/2})}),new B7(q.concat(_.reverse()))}rgb(q){let _=Qf(this.stops,q),j=[];this.stops.forEach((K,Y)=>{if(K.colorLess)K.color=d9(this.stops[Y-1],this.stops[Y+1],2)[1]});for(let K=0,Y=this.stops.length;K<Y-1;K++){let f=d9(this.stops[K],this.stops[K+1],_[K]);j.splice(j.length,0,...f)}return j.push(this.stops[this.stops.length-1].color),j}hsv(q,_){let j=Qf(this.stops,q),K=[];this.stops.forEach((Y,f)=>{if(Y.colorLess)Y.color=sf(this.stops[f-1],this.stops[f+1],2,_)[1]});for(let Y=0,f=this.stops.length;Y<f-1;Y++){let P=sf(this.stops[Y],this.stops[Y+1],j[Y],_);K.splice(K.length,0,...P)}return K.push(this.stops[this.stops.length-1].color),K}css(q,_){q=q||"linear",_=_||(q==="linear"?"to right":"ellipse at center");let j=q+"-gradient("+_;return this.stops.forEach(function(K){j+=", "+(K.colorLess?"":K.color.toRgbString()+" ")+K.pos*100+"%"}),j+=")",j}rgbAt(q){return q$(this.stops,q,"toRgb",_$)}hsvAt(q){return q$(this.stops,q,"toHsv",K$)}}j$.exports=function(q){if(arguments.length===1){if(!Array.isArray(arguments[0]))throw new Error('"stops" is not an array');q=arguments[0]}else q=Array.prototype.slice.call(arguments);return new B7(q)}});var W$=F((KS,z$)=>{z$.exports=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g}});var H$=F((OS,Mh)=>{Mh.exports={single:{topLeft:"┌",top:"─",topRight:"┐",right:"│",bottomRight:"┘",bottom:"─",bottomLeft:"└",left:"│"},double:{topLeft:"╔",top:"═",topRight:"╗",right:"║",bottomRight:"╝",bottom:"═",bottomLeft:"╚",left:"║"},round:{topLeft:"╭",top:"─",topRight:"╮",right:"│",bottomRight:"╯",bottom:"─",bottomLeft:"╰",left:"│"},bold:{topLeft:"┏",top:"━",topRight:"┓",right:"┃",bottomRight:"┛",bottom:"━",bottomLeft:"┗",left:"┃"},singleDouble:{topLeft:"╓",top:"─",topRight:"╖",right:"║",bottomRight:"╜",bottom:"─",bottomLeft:"╙",left:"║"},doubleSingle:{topLeft:"╒",top:"═",topRight:"╕",right:"│",bottomRight:"╛",bottom:"═",bottomLeft:"╘",left:"│"},classic:{topLeft:"+",top:"-",topRight:"+",right:"|",bottomRight:"+",bottom:"-",bottomLeft:"+",left:"|"},arrow:{topLeft:"↘",top:"↓",topRight:"↙",right:"←",bottomRight:"↖",bottom:"↑",bottomLeft:"↗",left:"→"}}});var o9=F((wS,i9)=>{var J$=H$();i9.exports=J$;i9.exports.default=J$});var G$=F((WS,A$)=>{A$.exports=({onlyFirst:q=!1}={})=>{let _=["[\\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(_,q?void 0:"g")}});var h$=F((vS,u$)=>{var mh=G$();u$.exports=(q)=>typeof q==="string"?q.replace(mh(),""):q});var D$=F((HS,t9)=>{var C$=(q)=>{if(Number.isNaN(q))return!1;if(q>=4352&&(q<=4447||q===9001||q===9002||11904<=q&&q<=12871&&q!==12351||12880<=q&&q<=19903||19968<=q&&q<=42182||43360<=q&&q<=43388||44032<=q&&q<=55203||63744<=q&&q<=64255||65040<=q&&q<=65049||65072<=q&&q<=65131||65281<=q&&q<=65376||65504<=q&&q<=65510||110592<=q&&q<=110593||127488<=q&&q<=127569||131072<=q&&q<=262141))return!0;return!1};t9.exports=C$;t9.exports.default=C$});var M$=F((JS,V$)=>{V$.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 b$=F((TS,F9)=>{var gh=h$(),yh=D$(),dh=M$(),N$=(q)=>{if(typeof q!=="string"||q.length===0)return 0;if(q=gh(q),q.length===0)return 0;q=q.replace(dh()," ");let _=0;for(let j=0;j<q.length;j++){let K=q.codePointAt(j);if(K<=31||K>=127&&K<=159)continue;if(K>=768&&K<=879)continue;if(K>65535)j++;_+=yh(K)?2:1}return _};F9.exports=N$;F9.exports.default=N$});var E$=F((ZS,S$)=>{var Lh=b$();function m_(q,_){if(!q)return q;_=_||{};let j=_.align||"center";if(j==="left")return q;let K=_.split||`
`,Y=_.pad||" ",f=j!=="right"?ph:lh,P=!1;if(!Array.isArray(q))P=!0,q=String(q).split(K);let $,w=0;return q=q.map(function(O){return O=String(O),$=Lh(O),w=Math.max($,w),{str:O,width:$}}).map(function(O){return new Array(f(w,O.width)+1).join(Y)+O.str}),P?q.join(K):q}m_.left=function q(_){return m_(_,{align:"left"})};m_.center=function q(_){return m_(_,{align:"center"})};m_.right=function q(_){return m_(_,{align:"right"})};S$.exports=m_;function ph(q,_){return Math.floor((q-_)/2)}function lh(q,_){return q-_}});import I3 from"fs";import{join as mC}from"path";function gC(q){let _=new Set;return _.add(q),_.add(q.replace(/-/g,"_")),_.add(q.replace(/_/g,"-")),(j)=>!!j&&_.has(j)}function yC(q){if(q===0)return"0 B";let _=1024,j=["B","KB","MB","GB"],K=Math.floor(Math.log(q)/Math.log(_));return parseFloat((q/Math.pow(_,K)).toFixed(1))+" "+j[K]}function dC(){let q=_8.getInstance().getTrashDirectory();if(!I3.existsSync(q))return{folderCount:0,fileCount:0,totalSize:0,isEmpty:!0};let _=I3.readdirSync(q);if(_.length===0)return{folderCount:0,fileCount:0,totalSize:0,isEmpty:!0};let j=0,K=0,Y=0;for(let f of _){let P=mC(q,f),$=I3.statSync(P);if($.isDirectory())j++;else K++;Y+=$.size}return{folderCount:j,fileCount:K,totalSize:Y,isEmpty:!1}}async function q4(q={}){try{if(await P_())console.warn("⚠️ JSONL to SQLite migration recommended. Run: claude-mem migrate-index");let _=await j_();if(_.backend==="jsonl")return await LC(q);let j=[],K=[],Y=[],f=q.project;if(!f&&q.format==="session-start")f=_8.getCurrentProjectName();if(f)j=await _.getRecentMemoriesForProject(f,10),K=await _.getRecentOverviewsForProject(f,q.format==="session-start"?5:3),Y=await _.getRecentSessionsForProject(f,5);else j=await _.getRecentMemories(10),K=await _.getRecentOverviews(q.format==="session-start"?5:3),Y=await _.getRecentSessions(5);let P=j.map((O)=>({type:"memory",text:O.text,document_id:O.document_id,keywords:O.keywords,session_id:O.session_id,project:O.project,timestamp:O.created_at,archive:O.archive_basename})),$=K.map((O)=>({type:"overview",content:O.content,session_id:O.session_id,project:O.project,timestamp:O.created_at})),w=Y.map((O)=>({type:"session",session_id:O.session_id,project:O.project,timestamp:O.created_at}));if(P.length===0&&$.length===0&&w.length===0){if(q.format==="session-start")console.log(U_("NO_MEMORIES",f||"this project"));return}if(q.format==="session-start"){let O=[...w,...P,...$],z="recently",W=O.map((v)=>{return v.timestamp?new Date(v.timestamp):null}).filter((v)=>v!==null).sort((v,H)=>H.getTime()-v.getTime());if(W.length>0)z=d4(W[0]);L4({projectName:f||"your project",memoryCount:P.length,lastSessionTime:z,recentObjects:O})}else if(q.format==="json"){let O=[...P,...$];console.log(JSON.stringify(O))}else{let O=P.length+$.length;console.log(tK("Context loading",O,"recent entries found")),P.forEach((z)=>{console.log(`${z.text} | ${z.document_id} | ${z.keywords}`)}),$.forEach((z)=>{console.log(`**Overview:** ${z.content}`)})}if(q.format!=="json"){let O=dC();if(!O.isEmpty){let z=yC(O.totalSize);console.log(`\uD83D\uDDD1 Trash ${O.folderCount} folders | ${O.fileCount} files | ${z} use \`$ claude-mem restore\``),console.log("")}}}catch(_){let j=_ instanceof Error?_.message:String(_);if(q.format==="session-start")console.log(U_("CONNECTION_FAILED",j));else console.log(e_("Context loading",j,"Check file permissions and try again"))}}async function LC(q={}){let j=_8.getInstance().getIndexPath(),K=q.project;if(!K&&q.format==="session-start")K=_8.getCurrentProjectName();if(!I3.existsSync(j)){if(q.format==="session-start")console.log(U_("NO_MEMORIES",K||"this project"));return}let f=I3.readFileSync(j,"utf-8").trim().split(`
`).filter((H)=>H.trim());if(f.length===0){if(q.format==="session-start")console.log(U_("NO_MEMORIES",K||"this project"));return}let P=[];for(let H of f)try{if(!H.trim().startsWith("{"))continue;let T=JSON.parse(H);P.push(T)}catch(T){continue}if(P.length===0){if(q.format==="session-start")console.log(U_("NO_MEMORIES",K||"this project"));return}let $=P.filter((H)=>H.type==="memory"),w=P.filter((H)=>H.type==="overview"),O=P.filter((H)=>H.type==="session"),z=$,W=w,v=O;if(K){let H=gC(K);z=$.filter((T)=>H(T.project)),W=w.filter((T)=>H(T.project)),v=O.filter((T)=>H(T.project))}if(q.format==="session-start"){let H=z.slice(-10),T=W.slice(-5),k=[...v.slice(-5),...H,...T],A="recently",G=k.map((u)=>{return u.timestamp?new Date(u.timestamp):null}).filter((u)=>u!==null).sort((u,V)=>V.getTime()-u.getTime());if(G.length>0)A=d4(G[0]);L4({projectName:K||"your project",memoryCount:H.length,lastSessionTime:A,recentObjects:k})}else if(q.format==="json"){let H=z.slice(-10),T=W.slice(-3),J=[...H,...T];console.log(JSON.stringify(J))}else{let H=z.slice(-10),T=W.slice(-3),J=H.length+T.length;console.log(tK("Context loading",J,"recent entries found")),H.forEach((k)=>{console.log(`${k.text} | ${k.document_id} | ${k.keywords}`)}),T.forEach((k)=>{console.log(`**Overview:** ${k.content}`)})}}var f5=R8(()=>{G6();p4();k3()});var ww={};$q(ww,{viewTrash:()=>lV});import{readdirSync as Yw,statSync as fw}from"fs";import{join as $w}from"path";function pV(q){let _=q.lastIndexOf(".");if(_===-1)return{name:q,timestamp:0};let j=parseInt(q.substring(_+1));if(isNaN(j))return{name:q,timestamp:0};return{name:q.substring(0,_),timestamp:j}}function Pw(q){if(q===0)return"0 B";let _=1024,j=["B","KB","MB","GB"],K=Math.floor(Math.log(q)/Math.log(_));return parseFloat((q/Math.pow(_,K)).toFixed(2))+" "+j[K]}function Ow(q){let _=0,j=Yw(q);for(let K of j){let Y=$w(q,K),f=fw(Y);if(f.isDirectory())_+=Ow(Y);else _+=f.size}return _}async function lV(){let q=_8.getInstance().getTrashDirectory();try{let _=Yw(q);if(_.length===0){Y6.info("\uD83D\uDDD1 Trash is empty");return}let j=_.map((P)=>{let $=$w(q,P),w=fw($),{name:O,timestamp:z}=pV(P),W=w.isDirectory()?Ow($):w.size;return{originalName:O,trashedName:P,size:W,trashedAt:new Date(z),isDirectory:w.isDirectory()}});j.sort((P,$)=>$.trashedAt.getTime()-P.trashedAt.getTime()),console.log(`
\uD83D\uDDD1 Trash Contents
`),console.log("─".repeat(80));let K=0,Y=0,f=0;for(let P of j){if(K+=P.size,P.isDirectory)Y++;else f++;let $=P.isDirectory?"\uD83D\uDCC1":"\uD83D\uDCC4",w=P.trashedAt.toLocaleString(),O=Pw(P.size);console.log(`${$} ${P.originalName}`),console.log(` Size: ${O} | Trashed: ${w}`),console.log(` ID: ${P.trashedName}`),console.log()}console.log("─".repeat(80)),console.log(`Total: ${Y} folders, ${f} files (${Pw(K)})`),console.log(`
To restore files: claude-mem restore`),console.log("To empty trash: claude-mem trash empty")}catch(_){if(_.code==="ENOENT")Y6.info("\uD83D\uDDD1 Trash is empty");else Y6.error("Failed to read trash directory"),console.error(_)}}var zw=R8(()=>{NK();G6()});var vw={};$q(vw,{emptyTrash:()=>iV});import{rmSync as xV,readdirSync as nV,existsSync as cV,statSync as rV}from"fs";import{join as Ww}from"path";async function iV(q={}){let _=_8.getInstance().getTrashDirectory();if(!cV(_)){Y6.info("\uD83D\uDDD1 Trash is already empty");return}try{let j=nV(_);if(j.length===0){Y6.info("\uD83D\uDDD1 Trash is already empty");return}let K=0,Y=0;for(let P of j){let $=Ww(_,P);if(rV($).isDirectory())K++;else Y++}if(!q.force){let P=await Sq({message:`Permanently delete ${K} folders and ${Y} files from trash?`,initialValue:!1});if(n8(P)||!P){Y6.info("Cancelled - trash not emptied");return}}let f=$_();f.start("Emptying trash...");for(let P of j){let $=Ww(_,P);xV($,{recursive:!0,force:!0})}f.stop(`\uD83D\uDDD1 Trash emptied - permanently deleted ${K} folders and ${Y} files`)}catch(j){Y6.error("Failed to empty trash"),console.error(j),process.exit(1)}}var Hw=R8(()=>{NK();G6()});var Jw={};$q(Jw,{migrateIndex:()=>oV});import J_ from"fs";import e3 from"path";async function oV(q={}){let _=_8.getInstance(),j=_.getIndexPath(),K=`${j}.backup-${Date.now()}`;if(console.log("\uD83D\uDD04 Starting JSONL to SQLite migration..."),console.log(`\uD83D\uDCC1 Index file: ${j}`),!J_.existsSync(j)){console.log("️ No JSONL index file found - nothing to migrate");return}try{console.log("\uD83C\uDFD7 Initializing SQLite database...");let Y=await Z3(),f=Y.sessions.count();if(f>0&&!q.force){console.log(`⚠️ SQLite database already contains ${f} sessions.`),console.log(" Use --force to migrate anyway (will skip duplicates)");return}if(!q.keepJsonl)console.log(`\uD83D\uDCBE Creating backup: ${e3.basename(K)}`),J_.copyFileSync(j,K);console.log("\uD83D\uDCD6 Reading JSONL index file...");let $=J_.readFileSync(j,"utf-8").trim().split(`
`).filter((A)=>A.trim()),w={totalLines:$.length,skippedLines:0,invalidJson:0,sessionsCreated:0,memoriesCreated:0,overviewsCreated:0,diagnosticsCreated:0,orphanedOverviews:0,orphanedMemories:0};console.log(`\uD83D\uDCDD Processing ${w.totalLines} lines...`);let O=[];for(let A=0;A<$.length;A++){let G=$[A];try{if(!G.trim().startsWith("{")){w.skippedLines++;continue}let u=JSON.parse(G);if(u&&typeof u==="object")O.push({...u,_lineNumber:A+1});else w.skippedLines++}catch(u){w.invalidJson++,console.warn(`⚠️ Invalid JSON at line ${A+1}: ${G.substring(0,50)}...`)}}console.log(`✅ Parsed ${O.length} valid records`);let z=O.filter((A)=>A.type==="session"),W=O.filter((A)=>A.type==="memory"),v=O.filter((A)=>A.type==="overview"),H=O.filter((A)=>A.type==="diagnostic"),T=O.filter((A)=>!["session","memory","overview","diagnostic"].includes(A.type));if(T.length>0)console.log(`⚠️ Found ${T.length} records with unknown types - will skip`),w.skippedLines+=T.length;let J=new Set(z.map((A)=>A.session_id)),k=new Set;console.log("\uD83D\uDCBE Migrating sessions...");for(let A of z)try{let{isoString:G}=T6(A.timestamp),u={session_id:A.session_id,project:A.project||"unknown",created_at:G,source:"legacy-jsonl"};if(!Y.sessions.has(u.session_id))Y.sessions.create(u),w.sessionsCreated++}catch(G){console.warn(`⚠️ Failed to migrate session ${A.session_id}: ${G}`)}console.log("\uD83E\uDDE0 Migrating memories...");for(let A of W)try{let{isoString:G}=T6(A.timestamp);if(!J.has(A.session_id)){if(!k.has(A.session_id)){k.add(A.session_id);let V={session_id:A.session_id,project:A.project||"unknown",created_at:G,source:"legacy-jsonl"};if(!Y.sessions.has(V.session_id))Y.sessions.create(V),w.sessionsCreated++,w.orphanedMemories++}}let u={session_id:A.session_id,text:A.text||"",document_id:A.document_id,keywords:A.keywords,created_at:G,project:A.project||"unknown",archive_basename:A.archive,origin:"transcript"};if(!u.document_id||!Y.memories.hasDocumentId(u.document_id))Y.memories.create(u),w.memoriesCreated++}catch(G){console.warn(`⚠️ Failed to migrate memory ${A.document_id}: ${G}`)}console.log("\uD83D\uDCCB Migrating overviews...");for(let A of v)try{let{isoString:G}=T6(A.timestamp);if(!J.has(A.session_id)){if(!k.has(A.session_id)){k.add(A.session_id);let V={session_id:A.session_id,project:A.project||"unknown",created_at:G,source:"legacy-jsonl"};if(!Y.sessions.has(V.session_id))Y.sessions.create(V),w.sessionsCreated++,w.orphanedOverviews++}}let u={session_id:A.session_id,content:A.content||"",created_at:G,project:A.project||"unknown",origin:"claude"};Y.overviews.upsert(u),w.overviewsCreated++}catch(G){console.warn(`⚠️ Failed to migrate overview ${A.session_id}: ${G}`)}console.log("\uD83E\uDE7A Migrating diagnostics...");for(let A of H)try{let{isoString:G}=T6(A.timestamp),u={session_id:A.session_id,message:A.message||"",severity:"warn",created_at:G,project:A.project||"unknown",origin:"compressor"};Y.diagnostics.create(u),w.diagnosticsCreated++}catch(G){console.warn(`⚠️ Failed to migrate diagnostic: ${G}`)}if(console.log(`
✅ Migration completed successfully!`),console.log(`
\uD83D\uDCCA Migration Summary:`),console.log(` Total lines processed: ${w.totalLines}`),console.log(` Skipped lines: ${w.skippedLines}`),console.log(` Invalid JSON lines: ${w.invalidJson}`),console.log(` Sessions created: ${w.sessionsCreated}`),console.log(` Memories created: ${w.memoriesCreated}`),console.log(` Overviews created: ${w.overviewsCreated}`),console.log(` Diagnostics created: ${w.diagnosticsCreated}`),w.orphanedOverviews>0||w.orphanedMemories>0)console.log(` Orphaned records (sessions synthesized): ${w.orphanedOverviews+w.orphanedMemories}`);if(q.keepJsonl)console.log(`
\uD83D\uDCBE Original JSONL file preserved: ${j}`),console.log(" SQLite database is now the primary index");else{let A=e3.join(_.getDataDirectory(),"archive","legacy");J_.mkdirSync(A,{recursive:!0});let G=e3.join(A,`claude-mem-index-${Date.now()}.jsonl`);J_.renameSync(j,G),console.log(`
\uD83D\uDCE6 Original JSONL file archived: ${e3.basename(G)}`),console.log(` Backup available at: ${e3.basename(K)}`)}console.log(`
\uD83C\uDF89 Migration complete! You can now use claude-mem with SQLite backend.`),console.log(" Run `claude-mem load-context` to verify the migration worked.")}catch(Y){if(console.error(`
❌ Migration failed:`,Y),J_.existsSync(K)&&!J_.existsSync(j))console.log("\uD83D\uDD04 Restoring backup..."),J_.renameSync(K,j);process.exit(1)}}var Tw=R8(()=>{G6();Y9()});var G4={};$q(G4,{sessionStartHook:()=>BV,sessionEndHook:()=>tV,preCompactHook:()=>aV});import{basename as Zw}from"path";async function aV(){try{let q="";process.stdin.setEncoding("utf8");for await(let j of process.stdin)q+=j;let _;if(q)try{_=JSON.parse(q).transcript_path}catch(j){_=q.trim()}if(!_)_=process.env.TRANSCRIPT_PATH||process.argv[2];if(!_){console.log("\uD83D\uDDDC Compressing session transcript..."),console.log("❌ No transcript path provided to pre-compact hook"),console.log("Hook data received:",q||"none"),console.log("Environment TRANSCRIPT_PATH:",process.env.TRANSCRIPT_PATH||"not set"),console.log("Command line args:",process.argv.slice(2));return}await A3(_,{dryRun:!1})}catch(q){console.error("Pre-compact hook failed:",q.message),process.exit(1)}}async function BV(){try{let q="";process.stdin.setEncoding("utf8");for await(let j of process.stdin)q+=j;let _;if(q)try{let j=JSON.parse(q);if(j.cwd)_=Zw(j.cwd)}catch(j){console.error("Failed to parse session-start hook data:",j)}if(!_)_=Zw(process.cwd());await q4({format:"session-start",count:"10",project:_})}catch(q){console.error("Session-start hook failed:",q.message),process.exit(1)}}async function tV(){try{let q="";process.stdin.setEncoding("utf8");for await(let _ of process.stdin)q+=_;if(q)try{let _=JSON.parse(q);if(_.reason==="clear"&&_.transcript_path)console.log("\uD83D\uDDDC Compressing current session before /clear..."),await A3(_.transcript_path,{dryRun:!1})}catch(_){console.error("Failed to parse hook data:",_)}console.log("Session ended successfully")}catch(q){console.error("Session-end hook failed:",q.message),process.exit(1)}}var u4=R8(()=>{O9();f5()});var K1=F6(_1(),1),{program:vM,createCommand:HM,createArgument:JM,createOption:TM,CommanderError:ZM,InvalidArgumentError:kM,InvalidOptionArgumentError:XM,Command:j1,Argument:AM,Option:GM,Help:uM}=K1.default;import{readFileSync as Rz,existsSync as Iz}from"fs";import{join as mz,dirname as gz}from"path";import{fileURLToPath as yz}from"url";var P1="claude-mem",Y1="3.7.2",f1="Memory compression system for Claude Code - persist context across sessions",$1=P1,O1=Y1,w1=f1;try{let q=yz(import.meta.url),_=gz(q),j=mz(_,"..","..","package.json");if(Iz(j)){let K=JSON.parse(Rz(j,"utf-8"));$1=K.name||P1,O1=K.version||Y1,w1=K.description||f1}}catch{}var eq=$1,z1=O1,W1=w1;O9();NK();import{readFileSync as EK,writeFileSync as d_,existsSync as I8,chmodSync as YC,mkdirSync as IK,copyFileSync as y_,statSync as fC,readdirSync as $C}from"fs";import{join as V8,dirname as RK}from"path";import{homedir as K5,platform as i$}from"os";import{execSync as g_}from"child_process";import{fileURLToPath as o$}from"url";var lf=(q=0)=>(_)=>`\x1B[${_+q}m`,xf=(q=0)=>(_)=>`\x1B[${38+q};5;${_}m`,nf=(q=0)=>(_,j,K)=>`\x1B[${38+q};2;${_};${j};${K}m`,c8={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]}},mb=Object.keys(c8.modifier),au=Object.keys(c8.color),Bu=Object.keys(c8.bgColor),gb=[...au,...Bu];function tu(){let q=new Map;for(let[_,j]of Object.entries(c8)){for(let[K,Y]of Object.entries(j))c8[K]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},j[K]=c8[K],q.set(Y[0],Y[1]);Object.defineProperty(c8,_,{value:j,enumerable:!1})}return Object.defineProperty(c8,"codes",{value:q,enumerable:!1}),c8.color.close="\x1B[39m",c8.bgColor.close="\x1B[49m",c8.color.ansi=lf(),c8.color.ansi256=xf(),c8.color.ansi16m=nf(),c8.bgColor.ansi=lf(10),c8.bgColor.ansi256=xf(10),c8.bgColor.ansi16m=nf(10),Object.defineProperties(c8,{rgbToAnsi256:{value(_,j,K){if(_===j&&j===K){if(_<8)return 16;if(_>248)return 231;return Math.round((_-8)/247*24)+232}return 16+36*Math.round(_/255*5)+6*Math.round(j/255*5)+Math.round(K/255*5)},enumerable:!1},hexToRgb:{value(_){let j=/[a-f\d]{6}|[a-f\d]{3}/i.exec(_.toString(16));if(!j)return[0,0,0];let[K]=j;if(K.length===3)K=[...K].map((f)=>f+f).join("");let Y=Number.parseInt(K,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(_)=>c8.rgbToAnsi256(...c8.hexToRgb(_)),enumerable:!1},ansi256ToAnsi:{value(_){if(_<8)return 30+_;if(_<16)return 90+(_-8);let j,K,Y;if(_>=232)j=((_-232)*10+8)/255,K=j,Y=j;else{_-=16;let $=_%36;j=Math.floor(_/36)/5,K=Math.floor($/6)/5,Y=$%6/5}let f=Math.max(j,K,Y)*2;if(f===0)return 30;let P=30+(Math.round(Y)<<2|Math.round(K)<<1|Math.round(j));if(f===2)P+=60;return P},enumerable:!1},rgbToAnsi:{value:(_,j,K)=>c8.ansi256ToAnsi(c8.rgbToAnsi256(_,j,K)),enumerable:!1},hexToAnsi:{value:(_)=>c8.ansi256ToAnsi(c8.hexToAnsi256(_)),enumerable:!1}}),c8}var Fu=tu(),Zq=Fu;import E9 from"node:process";import eu from"node:os";import cf from"node:tty";function _q(q,_=globalThis.Deno?globalThis.Deno.args:E9.argv){let j=q.startsWith("-")?"":q.length===1?"-":"--",K=_.indexOf(j+q),Y=_.indexOf("--");return K!==-1&&(Y===-1||K<Y)}var{env:r8}=E9,o7;if(_q("no-color")||_q("no-colors")||_q("color=false")||_q("color=never"))o7=0;else if(_q("color")||_q("colors")||_q("color=true")||_q("color=always"))o7=1;function Uu(){if("FORCE_COLOR"in r8){if(r8.FORCE_COLOR==="true")return 1;if(r8.FORCE_COLOR==="false")return 0;return r8.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(r8.FORCE_COLOR,10),3)}}function su(q){if(q===0)return!1;return{level:q,hasBasic:!0,has256:q>=2,has16m:q>=3}}function Qu(q,{streamIsTTY:_,sniffFlags:j=!0}={}){let K=Uu();if(K!==void 0)o7=K;let Y=j?o7:K;if(Y===0)return 0;if(j){if(_q("color=16m")||_q("color=full")||_q("color=truecolor"))return 3;if(_q("color=256"))return 2}if("TF_BUILD"in r8&&"AGENT_NAME"in r8)return 1;if(q&&!_&&Y===void 0)return 0;let f=Y||0;if(r8.TERM==="dumb")return f;if(E9.platform==="win32"){let P=eu.release().split(".");if(Number(P[0])>=10&&Number(P[2])>=10586)return Number(P[2])>=14931?3:2;return 1}if("CI"in r8){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((P)=>(P in r8)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((P)=>(P in r8))||r8.CI_NAME==="codeship")return 1;return f}if("TEAMCITY_VERSION"in r8)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r8.TEAMCITY_VERSION)?1:0;if(r8.COLORTERM==="truecolor")return 3;if(r8.TERM==="xterm-kitty")return 3;if(r8.TERM==="xterm-ghostty")return 3;if(r8.TERM==="wezterm")return 3;if("TERM_PROGRAM"in r8){let P=Number.parseInt((r8.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r8.TERM_PROGRAM){case"iTerm.app":return P>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(r8.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r8.TERM))return 1;if("COLORTERM"in r8)return 1;return f}function rf(q,_={}){let j=Qu(q,{streamIsTTY:q&&q.isTTY,..._});return su(j)}var qh={stdout:rf({isTTY:cf.isatty(1)}),stderr:rf({isTTY:cf.isatty(2)})},of=qh;function af(q,_,j){let K=q.indexOf(_);if(K===-1)return q;let Y=_.length,f=0,P="";do P+=q.slice(f,K)+_+j,f=K+Y,K=q.indexOf(_,f);while(K!==-1);return P+=q.slice(f),P}function Bf(q,_,j,K){let Y=0,f="";do{let P=q[K-1]==="\r";f+=q.slice(Y,P?K-1:K)+_+(P?`\r
`:`
`)+j,Y=K+1,K=q.indexOf(`
`,Y)}while(K!==-1);return f+=q.slice(Y),f}var{stdout:tf,stderr:Ff}=of,R9=Symbol("GENERATOR"),bK=Symbol("STYLER"),D3=Symbol("IS_EMPTY"),ef=["ansi","ansi","ansi256","ansi16m"],SK=Object.create(null),_h=(q,_={})=>{if(_.level&&!(Number.isInteger(_.level)&&_.level>=0&&_.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let j=tf?tf.level:0;q.level=_.level===void 0?j:_.level};var Kh=(q)=>{let _=(...j)=>j.join(" ");return _h(_,q),Object.setPrototypeOf(_,V3.prototype),_};function V3(q){return Kh(q)}Object.setPrototypeOf(V3.prototype,Function.prototype);for(let[q,_]of Object.entries(Zq))SK[q]={get(){let j=a7(this,m9(_.open,_.close,this[bK]),this[D3]);return Object.defineProperty(this,q,{value:j}),j}};SK.visible={get(){let q=a7(this,this[bK],!0);return Object.defineProperty(this,"visible",{value:q}),q}};var I9=(q,_,j,...K)=>{if(q==="rgb"){if(_==="ansi16m")return Zq[j].ansi16m(...K);if(_==="ansi256")return Zq[j].ansi256(Zq.rgbToAnsi256(...K));return Zq[j].ansi(Zq.rgbToAnsi(...K))}if(q==="hex")return I9("rgb",_,j,...Zq.hexToRgb(...K));return Zq[j][q](...K)},jh=["rgb","hex","ansi256"];for(let q of jh){SK[q]={get(){let{level:j}=this;return function(...K){let Y=m9(I9(q,ef[j],"color",...K),Zq.color.close,this[bK]);return a7(this,Y,this[D3])}}};let _="bg"+q[0].toUpperCase()+q.slice(1);SK[_]={get(){let{level:j}=this;return function(...K){let Y=m9(I9(q,ef[j],"bgColor",...K),Zq.bgColor.close,this[bK]);return a7(this,Y,this[D3])}}}}var Ph=Object.defineProperties(()=>{},{...SK,level:{enumerable:!0,get(){return this[R9].level},set(q){this[R9].level=q}}}),m9=(q,_,j)=>{let K,Y;if(j===void 0)K=q,Y=_;else K=j.openAll+q,Y=_+j.closeAll;return{open:q,close:_,openAll:K,closeAll:Y,parent:j}},a7=(q,_,j)=>{let K=(...Y)=>Yh(K,Y.length===1?""+Y[0]:Y.join(" "));return Object.setPrototypeOf(K,Ph),K[R9]=q,K[bK]=_,K[D3]=j,K},Yh=(q,_)=>{if(q.level<=0||!_)return q[D3]?"":_;let j=q[bK];if(j===void 0)return _;let{openAll:K,closeAll:Y}=j;if(_.includes("\x1B"))while(j!==void 0)_=af(_,j.close,j.open),j=j.parent;let f=_.indexOf(`
`);if(f!==-1)_=Bf(_,Y,K,f);return K+_+Y};Object.defineProperties(V3.prototype,SK);var fh=V3(),ib=V3({level:Ff?Ff.level:0});var q8=fh;var l9=F6(P$(),1),C6=(...q)=>{let _,j;if(q.length===0)throw new Error("Missing gradient colors");if(!Array.isArray(q[0])){if(q.length===1)throw new Error(`Expected an array of colors, received ${JSON.stringify(q[0])}`);_=l9.default(...q)}else _=l9.default(q[0]),j=x9(q[1]);let K=(Y,f)=>{return $h(Y?Y.toString():"",_,f??j)};return K.multiline=(Y,f)=>Oh(Y?Y.toString():"",_,f??j),K},Y$=(q,_,j)=>{return _.interpolation?.toLowerCase()==="hsv"?q.hsv(j,_.hsvSpin?.toLowerCase()||!1):q.rgb(j)};function $h(q,_,j){let K=x9(j),Y=Math.max(q.replace(/\s/g,"").length,_.stops.length),f=Y$(_,K,Y),P="";for(let $ of q)P+=$.match(/\s/g)?$:q8.hex(f.shift()?.toHex()||"#000")($);return P}function Oh(q,_,j){let K=x9(j),Y=q.split(`
`),f=Math.max(...Y.map((w)=>w.length),_.stops.length),P=Y$(_,K,f),$=[];for(let w of Y){let O=P.slice(0),z="";for(let W of w)z+=q8.hex(O.shift()?.toHex()||"#000")(W);$.push(z)}return $.join(`
`)}function x9(q){let _={interpolation:"rgb",hsvSpin:"short",...q};if(q!==void 0&&typeof q!=="object")throw new TypeError(`Expected \`options\` to be an \`object\`, got \`${typeof q}\``);if(typeof _.interpolation!=="string")throw new TypeError(`Expected \`options.interpolation\` to be \`rgb\` or \`hsv\`, got \`${typeof _.interpolation}\``);if(_.interpolation.toLowerCase()==="hsv"&&typeof _.hsvSpin!=="string")throw new TypeError(`Expected \`options.hsvSpin\` to be a \`short\` or \`long\`, got \`${typeof _.hsvSpin}\``);return _}var c6={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 r6(q){let _=(j)=>C6(...q.colors)(j,q.options);return _.multiline=(j="")=>C6(...q.colors).multiline(j,q.options),_}var n9=C6,wh=r6(c6.atlas),zh=r6(c6.cristal),Wh=r6(c6.teen),vh=r6(c6.mind),Hh=r6(c6.morning),Jh=r6(c6.vice),Th=r6(c6.passion),Zh=r6(c6.fruit),kh=r6(c6.instagram),Xh=r6(c6.retro),Ah=r6(c6.summer),Gh=r6(c6.rainbow),uh=r6(c6.pastel);C6.atlas=wh;C6.cristal=zh;C6.teen=Wh;C6.mind=vh;C6.morning=Hh;C6.vice=Jh;C6.passion=Th;C6.fruit=Zh;C6.instagram=kh;C6.retro=Xh;C6.summer=Ah;C6.rainbow=Gh;C6.pastel=uh;import s7 from"node:process";function c9({onlyFirst:q=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",q?void 0:"g")}var hh=c9();function r9(q){if(typeof q!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof q}\``);return q.replace(hh,"")}function f$(q){return q===161||q===164||q===167||q===168||q===170||q===173||q===174||q>=176&&q<=180||q>=182&&q<=186||q>=188&&q<=191||q===198||q===208||q===215||q===216||q>=222&&q<=225||q===230||q>=232&&q<=234||q===236||q===237||q===240||q===242||q===243||q>=247&&q<=250||q===252||q===254||q===257||q===273||q===275||q===283||q===294||q===295||q===299||q>=305&&q<=307||q===312||q>=319&&q<=322||q===324||q>=328&&q<=331||q===333||q===338||q===339||q===358||q===359||q===363||q===462||q===464||q===466||q===468||q===470||q===472||q===474||q===476||q===593||q===609||q===708||q===711||q>=713&&q<=715||q===717||q===720||q>=728&&q<=731||q===733||q===735||q>=768&&q<=879||q>=913&&q<=929||q>=931&&q<=937||q>=945&&q<=961||q>=963&&q<=969||q===1025||q>=1040&&q<=1103||q===1105||q===8208||q>=8211&&q<=8214||q===8216||q===8217||q===8220||q===8221||q>=8224&&q<=8226||q>=8228&&q<=8231||q===8240||q===8242||q===8243||q===8245||q===8251||q===8254||q===8308||q===8319||q>=8321&&q<=8324||q===8364||q===8451||q===8453||q===8457||q===8467||q===8470||q===8481||q===8482||q===8486||q===8491||q===8531||q===8532||q>=8539&&q<=8542||q>=8544&&q<=8555||q>=8560&&q<=8569||q===8585||q>=8592&&q<=8601||q===8632||q===8633||q===8658||q===8660||q===8679||q===8704||q===8706||q===8707||q===8711||q===8712||q===8715||q===8719||q===8721||q===8725||q===8730||q>=8733&&q<=8736||q===8739||q===8741||q>=8743&&q<=8748||q===8750||q>=8756&&q<=8759||q===8764||q===8765||q===8776||q===8780||q===8786||q===8800||q===8801||q>=8804&&q<=8807||q===8810||q===8811||q===8814||q===8815||q===8834||q===8835||q===8838||q===8839||q===8853||q===8857||q===8869||q===8895||q===8978||q>=9312&&q<=9449||q>=9451&&q<=9547||q>=9552&&q<=9587||q>=9600&&q<=9615||q>=9618&&q<=9621||q===9632||q===9633||q>=9635&&q<=9641||q===9650||q===9651||q===9654||q===9655||q===9660||q===9661||q===9664||q===9665||q>=9670&&q<=9672||q===9675||q>=9678&&q<=9681||q>=9698&&q<=9701||q===9711||q===9733||q===9734||q===9737||q===9742||q===9743||q===9756||q===9758||q===9792||q===9794||q===9824||q===9825||q>=9827&&q<=9829||q>=9831&&q<=9834||q===9836||q===9837||q===9839||q===9886||q===9887||q===9919||q>=9926&&q<=9933||q>=9935&&q<=9939||q>=9941&&q<=9953||q===9955||q===9960||q===9961||q>=9963&&q<=9969||q===9972||q>=9974&&q<=9977||q===9979||q===9980||q===9982||q===9983||q===10045||q>=10102&&q<=10111||q>=11094&&q<=11097||q>=12872&&q<=12879||q>=57344&&q<=63743||q>=65024&&q<=65039||q===65533||q>=127232&&q<=127242||q>=127248&&q<=127277||q>=127280&&q<=127337||q>=127344&&q<=127373||q===127375||q===127376||q>=127387&&q<=127404||q>=917760&&q<=917999||q>=983040&&q<=1048573||q>=1048576&&q<=1114109}function $$(q){return q===12288||q>=65281&&q<=65376||q>=65504&&q<=65510}function O$(q){return q>=4352&&q<=4447||q===8986||q===8987||q===9001||q===9002||q>=9193&&q<=9196||q===9200||q===9203||q===9725||q===9726||q===9748||q===9749||q>=9776&&q<=9783||q>=9800&&q<=9811||q===9855||q>=9866&&q<=9871||q===9875||q===9889||q===9898||q===9899||q===9917||q===9918||q===9924||q===9925||q===9934||q===9940||q===9962||q===9970||q===9971||q===9973||q===9978||q===9981||q===9989||q===9994||q===9995||q===10024||q===10060||q===10062||q>=10067&&q<=10069||q===10071||q>=10133&&q<=10135||q===10160||q===10175||q===11035||q===11036||q===11088||q===11093||q>=11904&&q<=11929||q>=11931&&q<=12019||q>=12032&&q<=12245||q>=12272&&q<=12287||q>=12289&&q<=12350||q>=12353&&q<=12438||q>=12441&&q<=12543||q>=12549&&q<=12591||q>=12593&&q<=12686||q>=12688&&q<=12773||q>=12783&&q<=12830||q>=12832&&q<=12871||q>=12880&&q<=42124||q>=42128&&q<=42182||q>=43360&&q<=43388||q>=44032&&q<=55203||q>=63744&&q<=64255||q>=65040&&q<=65049||q>=65072&&q<=65106||q>=65108&&q<=65126||q>=65128&&q<=65131||q>=94176&&q<=94180||q===94192||q===94193||q>=94208&&q<=100343||q>=100352&&q<=101589||q>=101631&&q<=101640||q>=110576&&q<=110579||q>=110581&&q<=110587||q===110589||q===110590||q>=110592&&q<=110882||q===110898||q>=110928&&q<=110930||q===110933||q>=110948&&q<=110951||q>=110960&&q<=111355||q>=119552&&q<=119638||q>=119648&&q<=119670||q===126980||q===127183||q===127374||q>=127377&&q<=127386||q>=127488&&q<=127490||q>=127504&&q<=127547||q>=127552&&q<=127560||q===127568||q===127569||q>=127584&&q<=127589||q>=127744&&q<=127776||q>=127789&&q<=127797||q>=127799&&q<=127868||q>=127870&&q<=127891||q>=127904&&q<=127946||q>=127951&&q<=127955||q>=127968&&q<=127984||q===127988||q>=127992&&q<=128062||q===128064||q>=128066&&q<=128252||q>=128255&&q<=128317||q>=128331&&q<=128334||q>=128336&&q<=128359||q===128378||q===128405||q===128406||q===128420||q>=128507&&q<=128591||q>=128640&&q<=128709||q===128716||q>=128720&&q<=128722||q>=128725&&q<=128727||q>=128732&&q<=128735||q===128747||q===128748||q>=128756&&q<=128764||q>=128992&&q<=129003||q===129008||q>=129292&&q<=129338||q>=129340&&q<=129349||q>=129351&&q<=129535||q>=129648&&q<=129660||q>=129664&&q<=129673||q>=129679&&q<=129734||q>=129742&&q<=129756||q>=129759&&q<=129769||q>=129776&&q<=129784||q>=131072&&q<=196605||q>=196608&&q<=262141}function Ch(q){if(!Number.isSafeInteger(q))throw new TypeError(`Expected a code point, got \`${typeof q}\`.`)}function w$(q,{ambiguousAsWide:_=!1}={}){if(Ch(q),$$(q)||O$(q)||_&&f$(q))return 2;return 1}var v$=F6(W$(),1),Dh=new Intl.Segmenter,Vh=/^\p{Default_Ignorable_Code_Point}$/u;function b6(q,_={}){if(typeof q!=="string"||q.length===0)return 0;let{ambiguousIsNarrow:j=!0,countAnsiEscapeCodes:K=!1}=_;if(!K)q=r9(q);if(q.length===0)return 0;let Y=0,f={ambiguousAsWide:!j};for(let{segment:P}of Dh.segment(q)){let $=P.codePointAt(0);if($<=31||$>=127&&$<=159)continue;if($>=8203&&$<=8207||$===65279)continue;if($>=768&&$<=879||$>=6832&&$<=6911||$>=7616&&$<=7679||$>=8400&&$<=8447||$>=65056&&$<=65071)continue;if($>=55296&&$<=57343)continue;if($>=65024&&$<=65039)continue;if(Vh.test(P))continue;if(v$.default().test(P)){Y+=2;continue}Y+=w$($,f)}return Y}function t7(q){let _=0;for(let j of q.split(`
`))_=Math.max(_,b6(j));return _}var c$=F6(o9(),1);var Nh=/[\p{Lu}]/u,bh=/[\p{Ll}]/u,T$=/^[\p{Lu}](?![\p{Lu}])/gu,X$=/([\p{Alpha}\p{N}_]|$)/u,a9=/[_.\- ]+/,Sh=new RegExp("^"+a9.source),Z$=new RegExp(a9.source+X$.source,"gu"),k$=new RegExp("\\d+"+X$.source,"gu"),Eh=(q,_,j,K)=>{let Y=!1,f=!1,P=!1,$=!1;for(let w=0;w<q.length;w++){let O=q[w];if($=w>2?q[w-3]==="-":!0,Y&&Nh.test(O))q=q.slice(0,w)+"-"+q.slice(w),Y=!1,P=f,f=!0,w++;else if(f&&P&&bh.test(O)&&(!$||K))q=q.slice(0,w-1)+"-"+q.slice(w-1),P=f,f=!1,Y=!0;else Y=_(O)===O&&j(O)!==O,P=f,f=j(O)===O&&_(O)!==O}return q},Rh=(q,_)=>{return T$.lastIndex=0,q.replaceAll(T$,(j)=>_(j))},Ih=(q,_)=>{return Z$.lastIndex=0,k$.lastIndex=0,q.replaceAll(k$,(j,K,Y)=>["_","-"].includes(q.charAt(Y+j.length))?j:_(j)).replaceAll(Z$,(j,K)=>_(K))};function B9(q,_){if(!(typeof q==="string"||Array.isArray(q)))throw new TypeError("Expected the input to be `string | string[]`");if(_={pascalCase:!1,preserveConsecutiveUppercase:!1,..._},Array.isArray(q))q=q.map((f)=>f.trim()).filter((f)=>f.length).join("-");else q=q.trim();if(q.length===0)return"";let j=_.locale===!1?(f)=>f.toLowerCase():(f)=>f.toLocaleLowerCase(_.locale),K=_.locale===!1?(f)=>f.toUpperCase():(f)=>f.toLocaleUpperCase(_.locale);if(q.length===1){if(a9.test(q))return"";return _.pascalCase?K(q):j(q)}if(q!==j(q))q=Eh(q,j,K,_.preserveConsecutiveUppercase);if(q=q.replace(Sh,""),q=_.preserveConsecutiveUppercase?Rh(q,j):j(q),_.pascalCase)q=K(q.charAt(0))+q.slice(1);return Ih(q,K)}var q5=F6(E$(),1);function e9({onlyFirst:q=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",q?void 0:"g")}var xh=e9();function U9(q){if(typeof q!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof q}\``);return q.replace(xh,"")}var R$=(q=0)=>(_)=>`\x1B[${_+q}m`,I$=(q=0)=>(_)=>`\x1B[${38+q};5;${_}m`,m$=(q=0)=>(_,j,K)=>`\x1B[${38+q};2;${_};${j};${K}m`,i8={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]}},GS=Object.keys(i8.modifier),nh=Object.keys(i8.color),ch=Object.keys(i8.bgColor),uS=[...nh,...ch];function rh(){let q=new Map;for(let[_,j]of Object.entries(i8)){for(let[K,Y]of Object.entries(j))i8[K]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},j[K]=i8[K],q.set(Y[0],Y[1]);Object.defineProperty(i8,_,{value:j,enumerable:!1})}return Object.defineProperty(i8,"codes",{value:q,enumerable:!1}),i8.color.close="\x1B[39m",i8.bgColor.close="\x1B[49m",i8.color.ansi=R$(),i8.color.ansi256=I$(),i8.color.ansi16m=m$(),i8.bgColor.ansi=R$(10),i8.bgColor.ansi256=I$(10),i8.bgColor.ansi16m=m$(10),Object.defineProperties(i8,{rgbToAnsi256:{value:(_,j,K)=>{if(_===j&&j===K){if(_<8)return 16;if(_>248)return 231;return Math.round((_-8)/247*24)+232}return 16+36*Math.round(_/255*5)+6*Math.round(j/255*5)+Math.round(K/255*5)},enumerable:!1},hexToRgb:{value:(_)=>{let j=/[a-f\d]{6}|[a-f\d]{3}/i.exec(_.toString(16));if(!j)return[0,0,0];let[K]=j;if(K.length===3)K=[...K].map((f)=>f+f).join("");let Y=Number.parseInt(K,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(_)=>i8.rgbToAnsi256(...i8.hexToRgb(_)),enumerable:!1},ansi256ToAnsi:{value:(_)=>{if(_<8)return 30+_;if(_<16)return 90+(_-8);let j,K,Y;if(_>=232)j=((_-232)*10+8)/255,K=j,Y=j;else{_-=16;let $=_%36;j=Math.floor(_/36)/5,K=Math.floor($/6)/5,Y=$%6/5}let f=Math.max(j,K,Y)*2;if(f===0)return 30;let P=30+(Math.round(Y)<<2|Math.round(K)<<1|Math.round(j));if(f===2)P+=60;return P},enumerable:!1},rgbToAnsi:{value:(_,j,K)=>i8.ansi256ToAnsi(i8.rgbToAnsi256(_,j,K)),enumerable:!1},hexToAnsi:{value:(_)=>i8.ansi256ToAnsi(i8.hexToAnsi256(_)),enumerable:!1}}),i8}var ih=rh(),g$=ih;var e7=new Set(["\x1B","›"]),oh=39,Q9="\x07",L$="[",ah="]",p$="m",F7=`${ah}8;;`,y$=(q)=>`${e7.values().next().value}${L$}${q}${p$}`,d$=(q)=>`${e7.values().next().value}${F7}${q}${Q9}`,Bh=(q)=>q.split(" ").map((_)=>b6(_)),s9=(q,_,j)=>{let K=[..._],Y=!1,f=!1,P=b6(U9(q.at(-1)));for(let[$,w]of K.entries()){let O=b6(w);if(P+O<=j)q[q.length-1]+=w;else q.push(w),P=0;if(e7.has(w))Y=!0,f=K.slice($+1,$+1+F7.length).join("")===F7;if(Y){if(f){if(w===Q9)Y=!1,f=!1}else if(w===p$)Y=!1;continue}if(P+=O,P===j&&$<K.length-1)q.push(""),P=0}if(!P&&q.at(-1).length>0&&q.length>1)q[q.length-2]+=q.pop()},th=(q)=>{let _=q.split(" "),j=_.length;while(j>0){if(b6(_[j-1])>0)break;j--}if(j===_.length)return q;return _.slice(0,j).join(" ")+_.slice(j).join("")},Fh=(q,_,j={})=>{if(j.trim!==!1&&q.trim()==="")return"";let K="",Y,f,P=Bh(q),$=[""];for(let[W,v]of q.split(" ").entries()){if(j.trim!==!1)$[$.length-1]=$.at(-1).trimStart();let H=b6($.at(-1));if(W!==0){if(H>=_&&(j.wordWrap===!1||j.trim===!1))$.push(""),H=0;if(H>0||j.trim===!1)$[$.length-1]+=" ",H++}if(j.hard&&P[W]>_){let T=_-H,J=1+Math.floor((P[W]-T-1)/_);if(Math.floor((P[W]-1)/_)<J)$.push("");s9($,v,_);continue}if(H+P[W]>_&&H>0&&P[W]>0){if(j.wordWrap===!1&&H<_){s9($,v,_);continue}$.push("")}if(H+P[W]>_&&j.wordWrap===!1){s9($,v,_);continue}$[$.length-1]+=v}if(j.trim!==!1)$=$.map((W)=>th(W));let w=$.join(`
`),O=[...w],z=0;for(let[W,v]of O.entries()){if(K+=v,e7.has(v)){let{groups:T}=new RegExp(`(?:\\${L$}(?<code>\\d+)m|\\${F7}(?<uri>.*)${Q9})`).exec(w.slice(z))||{groups:{}};if(T.code!==void 0){let J=Number.parseFloat(T.code);Y=J===oh?void 0:J}else if(T.uri!==void 0)f=T.uri.length===0?void 0:T.uri}let H=g$.codes.get(Number(Y));if(O[W+1]===`
`){if(f)K+=d$("");if(Y&&H)K+=y$(H)}else if(v===`
`){if(Y&&H)K+=y$(Y);if(f)K+=d$(f)}z+=v.length}return K};function U7(q,_,j){return String(q).normalize().replaceAll(`\r
`,`
`).split(`
`).map((K)=>Fh(K,_,j)).join(`
`)}var PC=F6(o9(),1),O_=`
`,i6=" ",N3="none",r$=()=>{let{env:q,stdout:_,stderr:j}=s7;if(_?.columns)return _.columns;if(j?.columns)return j.columns;if(q.COLUMNS)return Number.parseInt(q.COLUMNS,10);return 80},l$=(q)=>typeof q==="number"?{top:q,right:q*3,bottom:q,left:q*3}:{top:0,right:0,bottom:0,left:0,...q},b3=(q)=>q===N3?0:2,eh=(q)=>{let _=["topLeft","topRight","bottomRight","bottomLeft","left","right","top","bottom"],j;if(q===N3){q={};for(let K of _)q[K]=""}if(typeof q==="string"){if(j=c$.default[q],!j)throw new TypeError(`Invalid border style: ${q}`)}else{if(typeof q?.vertical==="string")q.left=q.vertical,q.right=q.vertical;if(typeof q?.horizontal==="string")q.top=q.horizontal,q.bottom=q.horizontal;for(let K of _)if(q[K]===null||typeof q[K]!=="string")throw new TypeError(`Invalid border style: ${K}`);j=q}return j},Uh=(q,_,j)=>{let K="",Y=b6(q);switch(j){case"left":{K=q+_.slice(Y);break}case"right":{K=_.slice(Y)+q;break}default:{if(_=_.slice(Y),_.length%2===1)_=_.slice(Math.floor(_.length/2)),K=_.slice(1)+q+_;else _=_.slice(_.length/2),K=_+q+_;break}}return K},sh=(q,{padding:_,width:j,textAlignment:K,height:Y})=>{q=q5.default(q,{align:K});let f=q.split(O_),P=t7(q),$=j-_.left-_.right;if(P>$){let z=[];for(let W of f){let v=U7(W,$,{hard:!0}),T=q5.default(v,{align:K}).split(`
`),J=Math.max(...T.map((k)=>b6(k)));for(let k of T){let A;switch(K){case"center":{A=i6.repeat(($-J)/2)+k;break}case"right":{A=i6.repeat($-J)+k;break}default:{A=k;break}}z.push(A)}}f=z}if(K==="center"&&P<$)f=f.map((z)=>i6.repeat(($-P)/2)+z);else if(K==="right"&&P<$)f=f.map((z)=>i6.repeat($-P)+z);let w=i6.repeat(_.left),O=i6.repeat(_.right);if(f=f.map((z)=>{let W=w+z+O;return W+i6.repeat(j-b6(W))}),_.top>0)f=[...Array.from({length:_.top}).fill(i6.repeat(j)),...f];if(_.bottom>0)f=[...f,...Array.from({length:_.bottom}).fill(i6.repeat(j))];if(Y&&f.length>Y)f=f.slice(0,Y);else if(Y&&f.length<Y)f=[...f,...Array.from({length:Y-f.length}).fill(i6.repeat(j))];return f.join(O_)},Qh=(q,_,j)=>{let K=(z)=>{let W=j.borderColor?KC(j.borderColor)(z):z;return j.dimBorder?q8.dim(W):W},Y=(z)=>j.backgroundColor?jC(j.backgroundColor)(z):z,f=eh(j.borderStyle),P=r$(),$=i6.repeat(j.margin.left);if(j.float==="center"){let z=Math.max((P-_-b3(j.borderStyle))/2,0);$=i6.repeat(z)}else if(j.float==="right"){let z=Math.max(P-_-j.margin.right-b3(j.borderStyle),0);$=i6.repeat(z)}let w="";if(j.margin.top)w+=O_.repeat(j.margin.top);if(j.borderStyle!==N3||j.title)w+=K($+f.topLeft+(j.title?Uh(j.title,f.top.repeat(_),j.titleAlignment):f.top.repeat(_))+f.topRight)+O_;let O=q.split(O_);if(w+=O.map((z)=>$+K(f.left)+Y(z)+K(f.right)).join(O_),j.borderStyle!==N3)w+=O_+K($+f.bottomLeft+f.bottom.repeat(_)+f.bottomRight);if(j.margin.bottom)w+=O_.repeat(j.margin.bottom);return w},qC=(q)=>{if(q.fullscreen&&s7?.stdout){let _=[s7.stdout.columns,s7.stdout.rows];if(typeof q.fullscreen==="function")_=q.fullscreen(..._);q.width||=_[0],q.height||=_[1]}return q.width&&=Math.max(1,q.width-b3(q.borderStyle)),q.height&&=Math.max(1,q.height-b3(q.borderStyle)),q},x$=(q,_)=>_===N3?q:` ${q} `,_C=(q,_)=>{_=qC(_);let j=_.width!==void 0,K=r$(),Y=b3(_.borderStyle),f=K-_.margin.left-_.margin.right-Y,P=t7(U7(q,K-Y,{hard:!0,trim:!1}))+_.padding.left+_.padding.right;if(_.title&&j)_.title=_.title.slice(0,Math.max(0,_.width-2)),_.title&&=x$(_.title,_.borderStyle);else if(_.title){if(_.title=_.title.slice(0,Math.max(0,f-2)),_.title){if(_.title=x$(_.title,_.borderStyle),b6(_.title)>P)_.width=b6(_.title)}}if(_.width||=P,!j){if(_.margin.left&&_.margin.right&&_.width>f){let w=(K-_.width-Y)/(_.margin.left+_.margin.right);_.margin.left=Math.max(0,Math.floor(_.margin.left*w)),_.margin.right=Math.max(0,Math.floor(_.margin.right*w))}_.width=Math.min(_.width,K-Y-_.margin.left-_.margin.right)}if(_.width-(_.padding.left+_.padding.right)<=0)_.padding.left=0,_.padding.right=0;if(_.height&&_.height-(_.padding.top+_.padding.bottom)<=0)_.padding.top=0,_.padding.bottom=0;return _},_5=(q)=>q.match(/^#(?:[0-f]{3}){1,2}$/i),n$=(q)=>typeof q==="string"&&(q8[q]??_5(q)),KC=(q)=>_5(q)?q8.hex(q):q8[q],jC=(q)=>_5(q)?q8.bgHex(q):q8[B9(["bg",q])];function w_(q,_){if(_={padding:0,borderStyle:"single",dimBorder:!1,textAlignment:"left",float:"left",titleAlignment:"left",..._},_.align)_.textAlignment=_.align;if(_.borderColor&&!n$(_.borderColor))throw new Error(`${_.borderColor} is not a valid borderColor`);if(_.backgroundColor&&!n$(_.backgroundColor))throw new Error(`${_.backgroundColor} is not a valid backgroundColor`);return _.padding=l$(_.padding),_.margin=l$(_.margin),_=_C(q,_),q=sh(q,_),Qh(q,_.width,_)}G6();function j5(q){let _,j=0,K=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];return{start(){_=setInterval(()=>{process.stdout.write(`\r${q8.cyan(K[j%K.length])} ${q}`),j++},50)},stop(Y,f=!0){clearInterval(_);let P=f?q8.green("✓"):q8.red("✗");process.stdout.write(`\r${P} ${Y}
`)}}}var Z6=(q)=>new Promise((_)=>setTimeout(_,q)),S3=n9(["#ff0000","#ff4500","#ffa500","#ffff00","#00ff00","#00ffff","#0000ff","#8b00ff"]),Q7=n9(["#ff006e","#fb5607","#ffbe0b","#8338ec","#3a86ff"]);async function OC(){let q=[{name:"Node.js version",check:async()=>{let j=process.versions.node,[K]=j.split(".").map(Number);return{success:K>=18,message:K>=18?"":`Node.js ${j} is below required version 18.0.0`}}},{name:"Claude Code CLI",check:async()=>{try{let j=i$()==="win32"?"where claude":"which claude";return g_(j,{stdio:"ignore"}),{success:!0,message:""}}catch{return{success:!1,message:"Claude Code CLI not found. Please install: https://docs.anthropic.com/claude/docs/claude-code"}}}},{name:"uv (Python package manager)",check:async()=>{try{return g_("which uv",{stdio:"ignore"}),{success:!0,message:""}}catch{return{success:!0,message:"",needsInstall:!0}}}},{name:"Write permissions",check:async()=>{let j=V8(_8.getDataDirectory(),"test-permissions");try{return IK(j,{recursive:!0}),d_(V8(j,"test"),"test"),g_(`rm -rf ${j}`,{stdio:"ignore"}),{success:!0,message:""}}catch{return{success:!1,message:"No write permissions to claude-mem data directory"}}}}],_=!1;for(let{name:j,check:K}of q){let Y=await K();if(!Y.success)return console.log(w_(q8.red(`${j} check failed!
${Y.message}`),{padding:1,margin:1,borderStyle:"double",borderColor:"red"})),!1;if(Y.needsInstall&&j==="uv (Python package manager)")_=!0}if(_){let j=j5("Installing uv (Python package manager)...");j.start();try{g_("curl -LsSf https://astral.sh/uv/install.sh | sh",{stdio:"pipe",shell:"/bin/sh"}),process.env.PATH=`${K5()}/.cargo/bin:${process.env.PATH}`,j.stop("uv installed successfully",!0)}catch(K){return j.stop("Failed to install uv automatically",!1),console.log(w_(q8.yellow(`⚠️ Please install uv manually:
${q8.cyan("curl -LsSf https://astral.sh/uv/install.sh | sh")}
Or visit: ${q8.cyan("https://docs.astral.sh/uv/getting-started/installation/")}`),{padding:1,margin:1,borderStyle:"round",borderColor:"yellow"})),!1}}return!0}function wC(){try{let q=i$()==="win32"?"where claude":"which claude";return g_(q,{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||null}catch{return null}}function zC(){let q={hasHooks:!1,hasChromaMcp:!1,hasSettings:!1,scope:void 0},_=_8.getHooksDirectory();q.hasHooks=I8(_)&&I8(V8(_,"pre-compact.js"))&&I8(V8(_,"session-start.js"));let j=_8.getInstance(),K=j.getMcpConfigPath(),Y=j.getProjectMcpConfigPath();if(I8(K))try{if(JSON.parse(EK(K,"utf8")).mcpServers?.["claude-mem"])q.hasChromaMcp=!0,q.scope="user"}catch{}if(I8(Y))try{if(JSON.parse(EK(Y,"utf8")).mcpServers?.["claude-mem"])q.hasChromaMcp=!0,q.scope="project"}catch{}let f=j.getUserSettingsPath();return q.hasSettings=I8(f),q}async function WC(q){let _={};if(q.hasHooks||q.hasChromaMcp){let f=await Sq({message:`\uD83E\uDDE0 Existing claude-mem installation detected. Your memories and data are safe!
Reinstall to update hooks and configuration?`,initialValue:!0});if(n8(f))return O6("Installation cancelled"),null;if(!f)return O6("Installation cancelled"),null;_.forceReinstall=!0}else _.forceReinstall=!1;let j=await aq({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:q.scope||"user"});if(n8(j))return O6("Installation cancelled"),null;if(_.scope=j,j==="local"){let f=await h3({message:"Enter custom installation directory",placeholder:V8(process.cwd(),".claude-mem"),validate:(P)=>{if(!P)return"Path is required";if(!P.startsWith("/")&&!P.startsWith("~"))return"Please provide an absolute path"}});if(n8(f))return O6("Installation cancelled"),null;_.customPath=f}_.hookTimeout=180000;let K=await Sq({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(n8(K))return O6("Installation cancelled"),null;_.enableSmartTrash=K;let Y=await Sq({message:`claude-mem is designed to save "memories" when you type /compact. The official compact summary + claude-mem produces the best ongoing results, but sometimes you may want to completely clear the context and still retain the "memories" from your last conversation.
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(n8(Y))return O6("Installation cancelled"),null;return _.saveMemoriesOnClear=Y,_}async function vC(){let q=_8.getInstance(),_=V8(q.getBackupsDirectory(),new Date().toISOString().replace(/[:.]/g,"-"));try{IK(_,{recursive:!0});let j=q.getHooksDirectory();if(I8(j))P5(j,V8(_,"hooks"));let K=q.getUserSettingsPath();if(I8(K))y_(K,V8(_,"settings.json"));let Y=q.getClaudeSettingsPath();if(I8(Y))y_(Y,V8(_,"claude-settings.json"));return _}catch(j){return null}}function HC(){let q=_8.getInstance();q.ensureAllDataDirectories(),q.ensureAllClaudeDirectories();let _=V8(q.getDataDirectory(),"package.json");if(!I8(_))d_(_,JSON.stringify({name:"claude-mem-data",type:"module"},null,2))}function P5(q,_){if(fC(q).isDirectory()){if(!I8(_))IK(_,{recursive:!0});$C(q).forEach((Y)=>{P5(V8(q,Y),V8(_,Y))})}else y_(q,_)}function JC(q=180000){let _=_8.getInstance(),j=_.getHooksDirectory(),K=o$(import.meta.url),f=RK(K),P=null;for(let v=0;v<10;v++){let H=V8(f,"hooks");if(I8(V8(H,"pre-compact.js"))){P=H;break}let T=RK(f);if(T===f)break;f=T}if(!P)try{P=_.findPackageHooksDirectory()}catch(v){throw new Error("Cannot dynamically locate hooks directory. The package may be corrupted.")}let $=["pre-compact.js","session-start.js","session-end.js"];for(let v of $){let H=V8(P,v),T=V8(j,v);if(I8(H))y_(H,T),YC(T,493)}let w=V8(P,"shared"),O=V8(j,"shared");if(I8(w))P5(w,O);let z=V8(j,"config.json");d_(z,JSON.stringify({packageName:eq,cliCommand:eq,backend:"chroma",timeout:q},null,2))}function TC(){let _=_8.getInstance().getClaudeMdPath(),j=RK(_);if(!I8(j))IK(j,{recursive:!0});let K=`
<!-- CLAUDE-MEM QUICK REFERENCE -->
## \uD83E\uDDE0 Memory System Quick Reference
### Search Your Memories (SIMPLE & POWERFUL)
- **Semantic search is king**: \`mcp__claude-mem__chroma_query_documents(["search terms"])\`
- **\uD83D\uDD12 ALWAYS include project name in query**: \`["claude-mem feature authentication"]\` not just \`["feature authentication"]\`
- **Include dates for temporal search**: \`["project-name 2025-09-09 bug fix"]\` finds memories from that date
- **Get specific memory**: \`mcp__claude-mem__chroma_get_documents(ids: ["document_id"])\`
### Search Tips That Actually Work
- **Project isolation**: Always prefix queries with project name to avoid cross-contamination
- **Temporal search**: Include dates (YYYY-MM-DD) in query text to find memories from specific times
- **Intent-based**: "implementing oauth" > "oauth implementation code function"
- **Multiple queries**: Search with different phrasings for better coverage
- **Session-specific**: Include session ID in query when you know it
### What Doesn't Work (Don't Do This!)
- ❌ Complex where filters with $and/$or - they cause errors
- ❌ Timestamp comparisons ($gte/$lt) - Chroma stores timestamps as strings
- ❌ Mixing project filters in where clause - causes "Error finding id"
### Storage
- Collection: "claude_memories"
- Archives: ~/.claude-mem/archives/
<!-- /CLAUDE-MEM QUICK REFERENCE -->`,Y="";if(I8(_)){Y=EK(_,"utf8");let f=Y.includes("<!-- CLAUDE-MEM INSTRUCTIONS -->"),P=Y.includes("<!-- CLAUDE-MEM QUICK REFERENCE -->");if(f||P){let $,w;if(f)$="<!-- CLAUDE-MEM INSTRUCTIONS -->",w="<!-- /CLAUDE-MEM INSTRUCTIONS -->";else $="<!-- CLAUDE-MEM QUICK REFERENCE -->",w="<!-- /CLAUDE-MEM QUICK REFERENCE -->";let O=Y.indexOf($),z=Y.indexOf(w)+w.length;if(O!==-1&&z!==-1)Y=Y.substring(0,O)+K.trim()+Y.substring(z)}else Y=Y.trim()+`
`+K}else Y=K.trim();d_(_,Y)}async function ZC(){let q=j5("Installing Chroma MCP server...");q.start();try{await Z6(400);try{g_("claude mcp remove claude-mem",{stdio:"pipe"}),await Z6(200)}catch{}let _=`${K5()}/.cargo/bin`;if(I8(_)&&!process.env.PATH?.includes(_))process.env.PATH=`${_}:${process.env.PATH}`;let j=`claude mcp add claude-mem -- uvx chroma-mcp --client-type persistent --data-dir ${_8.getInstance().getChromaDirectory()}`;return g_(j,{stdio:"pipe",env:process.env}),await Z6(300),q.stop(Q7("Chroma MCP server installed successfully! \uD83D\uDE80"),!0),!0}catch(_){return q.stop("Chroma MCP server installation failed",!1),console.log(w_(q8.yellow(`⚠️ Manual installation required:
${q8.cyan(`claude mcp add claude-mem -- uvx chroma-mcp --client-type persistent --data-dir ${_8.getInstance().getChromaDirectory()}`)}
Make sure uv is installed: ${q8.cyan("https://docs.astral.sh/uv/getting-started/installation/")}`),{padding:1,margin:1,borderStyle:"round",borderColor:"yellow"})),!1}}async function kC(q,_){let K=_8.getInstance().getHooksDirectory(),Y=V8(K,"pre-compact.js"),f=V8(K,"session-start.js"),P=V8(K,"session-end.js"),$={};if(I8(q)){let O=EK(q,"utf8");$=JSON.parse(O)}let w=RK(q);if(!I8(w))IK(w,{recursive:!0});if(!$.hooks)$.hooks={};if($.hooks.PreCompact){if($.hooks.PreCompact=$.hooks.PreCompact.filter((O)=>!O.hooks?.some((z)=>z.command?.includes(eq)||z.command?.includes("pre-compact.js"))),!$.hooks.PreCompact.length)delete $.hooks.PreCompact}if($.hooks.SessionStart){if($.hooks.SessionStart=$.hooks.SessionStart.filter((O)=>!O.hooks?.some((z)=>z.command?.includes(eq)||z.command?.includes("session-start.js"))),!$.hooks.SessionStart.length)delete $.hooks.SessionStart}if($.hooks.SessionEnd){if($.hooks.SessionEnd=$.hooks.SessionEnd.filter((O)=>!O.hooks?.some((z)=>z.command?.includes(eq)||z.command?.includes("session-end.js"))),!$.hooks.SessionEnd.length)delete $.hooks.SessionEnd}if(!$.hooks.PreCompact)$.hooks.PreCompact=[];if($.hooks.PreCompact.push({hooks:[{type:"command",command:Y,timeout:180}]}),!$.hooks.SessionStart)$.hooks.SessionStart=[];if($.hooks.SessionStart.push({hooks:[{type:"command",command:f,timeout:180}]}),I8(P)){if(!$.hooks.SessionEnd)$.hooks.SessionEnd=[];$.hooks.SessionEnd.push({hooks:[{type:"command",command:P,timeout:180}]})}d_(q,JSON.stringify($,null,2))}async function XC(){let q=K5(),_=[V8(q,".bashrc"),V8(q,".zshrc"),V8(q,".bash_profile")],j='alias rm="claude-mem trash"',K="# claude-mem smart trash alias";for(let Y of _){if(!I8(Y))continue;try{let f=EK(Y,"utf8");if(f.includes('alias rm="claude-mem trash"'))continue;f+=`
# claude-mem smart trash alias
alias rm="claude-mem trash"
`,d_(Y,f)}catch(f){}}}function AC(q){let j=new Date().toISOString().replace(/T/,"-").replace(/:/g,"").replace(/\..+/,"").replace(/-/g,""),K=`${j.slice(0,8)}-${j.slice(8)}`;return`${q}.backup.${K}`}function GC(q=!1){let _=_8.getInstance(),j=_.getClaudeCommandsDirectory(),K=o$(import.meta.url),f=RK(K),P=null;for(let W=0;W<10;W++){let v=V8(f,"commands");if(I8(V8(v,"save.md"))){P=v;break}let H=RK(f);if(H===f)break;f=H}if(!P)try{P=_.findPackageCommandsDirectory()}catch(W){throw new Error("Cannot dynamically locate commands directory. The package may be corrupted.")}if(!I8(j))IK(j,{recursive:!0});let $=["save.md","remember.md","claude-mem.md"],w=[],O=[],z=[];for(let W of $){let v=V8(P,W),H=V8(j,W);if(I8(v))if(I8(H))if(q){let T=AC(H);y_(H,T),y_(v,H),z.push(W)}else O.push(W);else y_(v,H),w.push(W)}if(w.length>0)console.log(` ${q8.green("✓")} Copied commands: ${w.join(", ")}`);if(z.length>0)console.log(` ${q8.blue("\uD83D\uDCE6")} Backed up and replaced commands: ${z.join(", ")}`);if(O.length>0)console.log(` ${q8.yellow("→")} Skipped existing commands: ${O.join(", ")}`)}async function uC(){let q=$_();q.start("Verifying installation");let _=[],K=_8.getInstance().getHooksDirectory();if(!I8(V8(K,"pre-compact.js")))_.push("Pre-compact hook not found");if(!I8(V8(K,"session-start.js")))_.push("Session-start hook not found");if(_.length>0)q.stop("Installation verification completed with issues"),Y6.warn("The following issues were detected:"),_.forEach((Y)=>Y6.error(` - ${Y}`)),Y6.info("The installation may not work correctly. Consider reinstalling with --force flag.");else q.stop("Installation verified successfully")}async function a$(q={}){console.log(S3(`
═══════════════════════════════════════`)),console.log(S3(" CLAUDE-MEM INSTALLER ")),console.log(S3("═══════════════════════════════════════")),console.log(w_(Q7(`\uD83E\uDDE0 Persistent Memory System for Claude Code
✨ Transform your Claude experience with seamless context preservation
\uD83D\uDE80 Never lose your conversation history again`),{padding:2,margin:1,borderStyle:"double",borderColor:"magenta",textAlignment:"center"})),await Z6(500);let _=q.user||q.project||q.local||q.force,j;if(_)j={scope:q.local?"local":q.project?"project":"user",customPath:q.path,hookTimeout:q.timeout?parseInt(q.timeout):180,forceReinstall:!!q.force};else{if(!await OC())Bq("Please fix the prerequisites issues and try again"),process.exit(1);let z=zC(),W=await WC(z);if(!W)process.exit(0);j=W}if(j.forceReinstall){let O=await vC();if(O)Y6.info(`Backup created at: ${O}`)}console.log(Q7(`
\uD83D\uDE80 Beginning Installation Process
`));let K=[{name:"Creating directory structure",action:async()=>{await Z6(200),HC(),await Z6(100)}},{name:"Installing Chroma MCP server",action:async()=>{if(!await ZC())throw new Error("MCP installation failed")}},{name:"Adding CLAUDE.md instructions",action:async()=>{await Z6(300),TC(),await Z6(200)}},{name:"Installing Claude commands",action:async()=>{await Z6(200),GC(j.forceReinstall),await Z6(100)}},{name:"Installing memory hooks",action:async()=>{await Z6(400),JC(j.hookTimeout),await Z6(200)}},{name:"Configuring Claude settings",action:async()=>{await Z6(300);let O;if(j.scope==="local"&&j.customPath)O=V8(j.customPath,"settings.local.json");else if(j.scope==="project")O=V8(process.cwd(),".claude","settings.json");else O=_8.getInstance().getClaudeSettingsPath();await kC(O,j);let W=_8.getInstance().getUserSettingsPath(),v={};if(I8(W))try{v=JSON.parse(EK(W,"utf8"))}catch{}v.backend="chroma",v.installed=!0,v.embedded=!0,v.saveMemoriesOnClear=j.saveMemoriesOnClear||!1;let H=wC();if(H)v.claudePath=H;else delete v.claudePath;d_(W,JSON.stringify(v,null,2)),await Z6(200)}}];if(j.enableSmartTrash)K.push({name:"Configuring Smart Trash alias",action:async()=>{await Z6(200),await XC(),await Z6(100)}});for(let O=0;O<K.length;O++){let z=K[O],W=`[${O+1}/${K.length}]`,v=j5(`${q8.gray(W)} ${z.name}...`);v.start();try{await z.action(),v.stop(`${q8.gray(W)} ${z.name} ${Q7("completed! ✨")}`)}catch(H){v.stop(`${q8.gray(W)} ${z.name} ${q8.red("failed")}`,!1),console.log(w_(q8.red(`❌ Installation failed at: ${z.name}
Error: ${H}`),{padding:1,margin:1,borderStyle:"double",borderColor:"red"})),process.exit(1)}await Z6(150)}console.log(q8.gray(`
\uD83D\uDD0D Verifying Installation
`)),await uC();let Y=S3("\uD83C\uDF89 INSTALLATION COMPLETE! \uD83C\uDF89"),f=j.saveMemoriesOnClear?`${q8.cyan("/compact")} or ${q8.cyan("/clear")}`:q8.cyan("/compact"),P=`
${q8.bold("How your new memory system works:")}
${q8.green("•")} When you start Claude Code, claude-mem loads your latest memories automatically
${q8.green("•")} Save your work by typing ${f} (takes ~30s to process)
${q8.green("•")} Ask Claude to search your memories anytime with natural language
${q8.green("•")} Instructions added to ${q8.cyan("~/.claude/CLAUDE.md")} teach Claude how to use the system
${q8.bold("Slash Commands Available:")}
${q8.cyan("/claude-mem help")} - Show all memory commands and features
${q8.cyan("/save")} - Quick save of current conversation overview
${q8.cyan("/remember")} - Search your saved memories
${q8.bold("Quick Start:")}
${q8.yellow("1.")} Restart Claude Code to activate your memory system
${q8.yellow("2.")} Start using Claude normally - memories save automatically
${q8.yellow("3.")} Search memories by asking: ${q8.italic('"Search my memories for X"')}`,$=j.enableSmartTrash?`
${q8.blue("\uD83D\uDDD1 Smart Trash Enabled:")}
${q8.gray(" • rm commands now move files to ~/.claude-mem/trash")}
${q8.gray(" • View trash:")} ${q8.cyan("claude-mem trash view")}
${q8.gray(" • Restore files:")} ${q8.cyan("claude-mem restore")}
${q8.gray(" • Empty trash:")} ${q8.cyan("claude-mem trash empty")}
${q8.yellow(" • Restart terminal for alias to activate")}`:"",w=j.saveMemoriesOnClear?`
${q8.magenta("\uD83D\uDCBE Save-on-clear enabled:")}
${q8.gray(" • /clear now saves memories automatically (takes ~1 minute)")}`:"";console.log(w_(Y+P+$+w,{padding:2,margin:1,borderStyle:"double",borderColor:"green",backgroundColor:"#001122"})),console.log(S3(`
✨ Welcome to the future of persistent AI conversations! ✨
`))}G6();import{readFileSync as hC,writeFileSync as B$,existsSync as CC}from"fs";import{join as E3}from"path";async function t$(q={}){console.log("\uD83D\uDD04 Uninstalling Claude Memory System hooks...");let _=[];if(q.all)_.push({name:"User",path:_8.getInstance().getClaudeSettingsPath()}),_.push({name:"Project",path:E3(process.cwd(),".claude","settings.json")});else{let w=q.project,O=_8.getInstance();_.push({name:w?"Project":"User",path:w?E3(process.cwd(),".claude","settings.json"):O.getClaudeSettingsPath()})}let K=_8.getInstance().getHooksDirectory(),Y=E3(K,"pre-compact.js"),f=E3(K,"session-start.js"),P=E3(K,"session-end.js"),$=0;for(let w of _){if(!CC(w.path)){console.log(`⏭️ No settings found at ${w.name} location`);continue}try{let O=hC(w.path,"utf8"),z=JSON.parse(O);if(!z.hooks){console.log(`⏭️ No hooks configured in ${w.name} settings`);continue}let W=!1;if(z.hooks.PreCompact){let v=z.hooks.PreCompact.filter((H)=>!H.hooks?.some((T)=>T.command===Y||T.command?.includes("pre-compact.js")||T.command?.includes("claude-mem")));if(v.length!==z.hooks.PreCompact.length)z.hooks.PreCompact=v.length?v:void 0,W=!0,console.log(`✅ Removed PreCompact hook from ${w.name} settings`)}if(z.hooks.SessionStart){let v=z.hooks.SessionStart.filter((H)=>!H.hooks?.some((T)=>T.command===f||T.command?.includes("session-start.js")||T.command?.includes("claude-mem")));if(v.length!==z.hooks.SessionStart.length)z.hooks.SessionStart=v.length?v:void 0,W=!0,console.log(`✅ Removed SessionStart hook from ${w.name} settings`)}if(z.hooks.SessionEnd){let v=z.hooks.SessionEnd.filter((H)=>!H.hooks?.some((T)=>T.command===P||T.command?.includes("session-end.js")||T.command?.includes("claude-mem")));if(v.length!==z.hooks.SessionEnd.length)z.hooks.SessionEnd=v.length?v:void 0,W=!0,console.log(`✅ Removed SessionEnd hook from ${w.name} settings`)}if(z.hooks.PreCompact===void 0)delete z.hooks.PreCompact;if(z.hooks.SessionStart===void 0)delete z.hooks.SessionStart;if(z.hooks.SessionEnd===void 0)delete z.hooks.SessionEnd;if(!Object.keys(z.hooks).length)delete z.hooks;if(W){let v=w.path+".backup."+Date.now();B$(v,O),console.log(`\uD83D\uDCCB Created backup: ${v}`),B$(w.path,JSON.stringify(z,null,2)),$++,console.log(`✅ Updated ${w.name} settings: ${w.path}`)}else console.log(`️ No Claude Memory System hooks found in ${w.name} settings`)}catch(O){console.log(`⚠️ Could not process ${w.name} settings: ${O.message}`)}}if(console.log(""),$>0)console.log("✨ Uninstallation complete!"),console.log("The Claude Memory System hooks have been removed from your settings."),console.log(""),console.log("Note: Your compressed transcripts and archives are preserved."),console.log("To reinstall: claude-mem install");else console.log("️ No Claude Memory System hooks were found to remove.")}G6();import{readFileSync as Y5,existsSync as R3,readdirSync as DC,statSync as VC}from"fs";import{join as L_,dirname as MC}from"path";import{execSync as NC}from"child_process";import{fileURLToPath as bC}from"url";var KE=MC(bC(import.meta.url));async function F$(){console.log("\uD83D\uDD0D Claude Memory System Status Check"),console.log(`=====================================
`),console.log("\uD83D\uDCC2 Installed Hook Scripts:");let q=_8.getInstance(),_=q.getHooksDirectory(),j=L_(_,"pre-compact.js"),K=L_(_,"session-start.js"),Y=L_(_,"session-end.js"),f=(H,T)=>{if(R3(H))console.log(`${T}: Found at ${H}`);else console.log(`${T}: Not found at ${H}`)};f(j,"pre-compact.js"),f(K,"session-start.js"),f(Y,"session-end.js"),console.log(""),console.log("⚙️ Settings Configuration:");let P=(H,T)=>{if(!R3(T)){console.log(` ⏭️ ${H}: No settings file`);return}console.log(` \uD83D\uDCCB ${H}: ${T}`);try{let J=JSON.parse(Y5(T,"utf8")),k=J.hooks?.PreCompact?.some((u)=>u.hooks?.some((V)=>V.command?.includes("pre-compact.js")||V.command?.includes("claude-mem"))),A=J.hooks?.SessionStart?.some((u)=>u.hooks?.some((V)=>V.command?.includes("session-start.js")||V.command?.includes("claude-mem"))),G=J.hooks?.SessionEnd?.some((u)=>u.hooks?.some((V)=>V.command?.includes("session-end.js")||V.command?.includes("claude-mem")));console.log(` PreCompact: ${k?"✅":"❌"}`),console.log(` SessionStart: ${A?"✅":"❌"}`),console.log(` SessionEnd: ${G?"✅":"❌"}`)}catch(J){console.log(" ⚠️ Could not parse settings")}};P("Global",q.getClaudeSettingsPath()),P("Project",L_(process.cwd(),".claude","settings.json")),console.log(""),console.log("\uD83D\uDCE6 Compressed Transcripts:");let $=L_(q.getClaudeConfigDirectory(),"projects");if(R3($))try{let H=0,T=0,J=(k,A=0)=>{if(A>3)return;let G=DC(k);for(let u of G){let V=L_(k,u);if(VC(V).isDirectory()&&!u.startsWith("."))J(V,A+1);else if(u.endsWith(".jsonl.compressed"))H++;else if(u.endsWith(".jsonl.archive"))T++}};J($),console.log(` Compressed files: ${H}`),console.log(` Archive files: ${T}`)}catch(H){console.log(" ⚠️ Could not scan projects directory")}else console.log(" ️ No Claude projects directory found");console.log(""),console.log("\uD83D\uDD27 Runtime Environment:");let w=(H,T)=>{try{let J=NC(`${H} --version`,{encoding:"utf8"}).trim();console.log(`${T}: ${J}`)}catch{console.log(`${T}: Not found`)}};w("node","Node.js"),w("bun","Bun"),console.log(""),console.log("\uD83E\uDDE0 Chroma Storage Status:"),console.log(" ✅ Storage backend: Chroma MCP"),console.log(` \uD83D\uDCCD Data location: ${q.getChromaDirectory()}`),console.log(" \uD83D\uDD0D Features: Vector search, semantic similarity, document storage"),console.log(""),console.log("\uD83D\uDCCA Summary:");let O=q.getClaudeSettingsPath(),z=L_(process.cwd(),".claude","settings.json"),W=!1,v="Not installed";try{if(R3(O)){let H=JSON.parse(Y5(O,"utf8"));if(H.hooks?.PreCompact||H.hooks?.SessionStart||H.hooks?.SessionEnd)W=!0,v="Global"}if(R3(z)){let H=JSON.parse(Y5(z,"utf8"));if(H.hooks?.PreCompact||H.hooks?.SessionStart||H.hooks?.SessionEnd)W=!0,v=v==="Global"?"Global + Project":"Project"}}catch{}if(W)console.log(` ✅ Claude Memory System is installed (${v})`),console.log(""),console.log("\uD83D\uDCA1 To test: Use /compact in Claude Code");else console.log(" ❌ Claude Memory System is not installed"),console.log(""),console.log("\uD83D\uDCA1 To install: claude-mem install")}G6();import{readFileSync as SC,readdirSync as EC,statSync as RC}from"fs";import{join as e$}from"path";async function IC(q,_,j){try{let f=SC(q,"utf8").split(`
`).filter((P)=>P.trim()).slice(-j);if(console.log(`\uD83D\uDCCB ${_} Logs (last ${j} lines):`),console.log(` File: ${q}`),console.log(""),f.length===0)console.log(" No log entries found");else f.forEach((P)=>{console.log(` ${P}`)});console.log("")}catch(K){console.log(`❌ Could not read ${_.toLowerCase()} log: ${q}`)}}async function U$(q={}){let _=_8.getLogsDirectory(),j=parseInt(q.tail)||20;try{let Y=EC(_).filter((f)=>f.startsWith("claude-mem-")&&f.endsWith(".log")).map((f)=>({name:f,path:e$(_,f),mtime:RC(e$(_,f)).mtime})).sort((f,P)=>P.mtime.getTime()-f.mtime.getTime());if(Y.length===0){console.log("❌ No log files found in ~/.claude-mem/logs/");return}if(await IC(Y[0].path,"Most Recent",j),q.all&&Y.length>1)console.log(`\uD83D\uDCDA Found ${Y.length} total log files`)}catch(K){console.log("❌ Could not read logs directory: ~/.claude-mem/logs/"),console.log(" Run a compression first to generate logs")}if(q.follow)console.log("Following logs... (Press Ctrl+C to stop)"),setInterval(()=>{},1000)}f5();import{renameSync as hV,existsSync as aO,mkdirSync as CV,statSync as DV}from"fs";import{join as VV,basename as MV}from"path";var $5=(q,_,j)=>{let K=q instanceof RegExp?s$(q,j):q,Y=_ instanceof RegExp?s$(_,j):_,f=K!==null&&Y!=null&&pC(K,Y,j);return f&&{start:f[0],end:f[1],pre:j.slice(0,f[0]),body:j.slice(f[0]+K.length,f[1]),post:j.slice(f[1]+Y.length)}},s$=(q,_)=>{let j=_.match(q);return j?j[0]:null},pC=(q,_,j)=>{let K,Y,f,P=void 0,$,w=j.indexOf(q),O=j.indexOf(_,w+1),z=w;if(w>=0&&O>0){if(q===_)return[w,O];K=[],f=j.length;while(z>=0&&!$){if(z===w)K.push(z),w=j.indexOf(q,z+1);else if(K.length===1){let W=K.pop();if(W!==void 0)$=[W,O]}else{if(Y=K.pop(),Y!==void 0&&Y<f)f=Y,P=O;O=j.indexOf(_,z+1)}z=w<O&&w>=0?w:O}if(K.length&&P!==void 0)$=[f,P]}return $};var Q$="\x00SLASH"+Math.random()+"\x00",qO="\x00OPEN"+Math.random()+"\x00",w5="\x00CLOSE"+Math.random()+"\x00",_O="\x00COMMA"+Math.random()+"\x00",KO="\x00PERIOD"+Math.random()+"\x00",lC=new RegExp(Q$,"g"),xC=new RegExp(qO,"g"),nC=new RegExp(w5,"g"),cC=new RegExp(_O,"g"),rC=new RegExp(KO,"g"),iC=/\\\\/g,oC=/\\{/g,aC=/\\}/g,BC=/\\,/g,tC=/\\./g;function O5(q){return!isNaN(q)?parseInt(q,10):q.charCodeAt(0)}function FC(q){return q.replace(iC,Q$).replace(oC,qO).replace(aC,w5).replace(BC,_O).replace(tC,KO)}function eC(q){return q.replace(lC,"\\").replace(xC,"{").replace(nC,"}").replace(cC,",").replace(rC,".")}function jO(q){if(!q)return[""];let _=[],j=$5("{","}",q);if(!j)return q.split(",");let{pre:K,body:Y,post:f}=j,P=K.split(",");P[P.length-1]+="{"+Y+"}";let $=jO(f);if(f.length)P[P.length-1]+=$.shift(),P.push.apply(P,$);return _.push.apply(_,P),_}function PO(q){if(!q)return[];if(q.slice(0,2)==="{}")q="\\{\\}"+q.slice(2);return m3(FC(q),!0).map(eC)}function UC(q){return"{"+q+"}"}function sC(q){return/^-?0\d/.test(q)}function QC(q,_){return q<=_}function qD(q,_){return q>=_}function m3(q,_){let j=[],K=$5("{","}",q);if(!K)return[q];let Y=K.pre,f=K.post.length?m3(K.post,!1):[""];if(/\$$/.test(K.pre))for(let P=0;P<f.length;P++){let $=Y+"{"+K.body+"}"+f[P];j.push($)}else{let P=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(K.body),$=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(K.body),w=P||$,O=K.body.indexOf(",")>=0;if(!w&&!O){if(K.post.match(/,(?!,).*\}/))return q=K.pre+"{"+K.body+w5+K.post,m3(q);return[q]}let z;if(w)z=K.body.split(/\.\./);else if(z=jO(K.body),z.length===1&&z[0]!==void 0){if(z=m3(z[0],!1).map(UC),z.length===1)return f.map((v)=>K.pre+z[0]+v)}let W;if(w&&z[0]!==void 0&&z[1]!==void 0){let v=O5(z[0]),H=O5(z[1]),T=Math.max(z[0].length,z[1].length),J=z.length===3&&z[2]!==void 0?Math.abs(O5(z[2])):1,k=QC;if(H<v)J*=-1,k=qD;let G=z.some(sC);W=[];for(let u=v;k(u,H);u+=J){let V;if($){if(V=String.fromCharCode(u),V==="\\")V=""}else if(V=String(u),G){let m=T-V.length;if(m>0){let N=new Array(m+1).join("0");if(u<0)V="-"+N+V.slice(1);else V=N+V}}W.push(V)}}else{W=[];for(let v=0;v<z.length;v++)W.push.apply(W,m3(z[v],!1))}for(let v=0;v<W.length;v++)for(let H=0;H<f.length;H++){let T=Y+W[v]+f[H];if(!_||w||T)j.push(T)}}return j}var g3=(q)=>{if(typeof q!=="string")throw new TypeError("invalid pattern");if(q.length>65536)throw new TypeError("pattern is too long")};var _D={"[: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]},y3=(q)=>q.replace(/[[\]\\-]/g,"\\$&"),KD=(q)=>q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),YO=(q)=>q.join(""),fO=(q,_)=>{let j=_;if(q.charAt(j)!=="[")throw new Error("not in a brace expression");let K=[],Y=[],f=j+1,P=!1,$=!1,w=!1,O=!1,z=j,W="";q:while(f<q.length){let J=q.charAt(f);if((J==="!"||J==="^")&&f===j+1){O=!0,f++;continue}if(J==="]"&&P&&!w){z=f+1;break}if(P=!0,J==="\\"){if(!w){w=!0,f++;continue}}if(J==="["&&!w){for(let[k,[A,G,u]]of Object.entries(_D))if(q.startsWith(k,f)){if(W)return["$.",!1,q.length-j,!0];if(f+=k.length,u)Y.push(A);else K.push(A);$=$||G;continue q}}if(w=!1,W){if(J>W)K.push(y3(W)+"-"+y3(J));else if(J===W)K.push(y3(J));W="",f++;continue}if(q.startsWith("-]",f+1)){K.push(y3(J+"-")),f+=2;continue}if(q.startsWith("-",f+1)){W=J,f+=2;continue}K.push(y3(J)),f++}if(z<f)return["",!1,0,!1];if(!K.length&&!Y.length)return["$.",!1,q.length-j,!0];if(Y.length===0&&K.length===1&&/^\\?.$/.test(K[0])&&!O){let J=K[0].length===2?K[0].slice(-1):K[0];return[KD(J),!1,z-j,!1]}let v="["+(O?"^":"")+YO(K)+"]",H="["+(O?"":"^")+YO(Y)+"]";return[K.length&&Y.length?"("+v+"|"+H+")":K.length?v:H,$,z-j,!0]};var kq=(q,{windowsPathsNoEscape:_=!1}={})=>{return _?q.replace(/\[([^\/\\])\]/g,"$1"):q.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var jD=new Set(["!","?","+","*","@"]),$O=(q)=>jD.has(q),PD="(?!(?:^|/)\\.\\.?(?:$|/))",_4="(?!\\.)",YD=new Set(["[","."]),fD=new Set(["..","."]),$D=new Set("().*{}+?[]^$\\!"),OD=(q)=>q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),z5="[^/]",OO=z5+"*?",wO=z5+"+?";class k6{type;#q;#_;#Y=!1;#P=[];#f;#G;#X;#z=!1;#$;#v;#W=!1;constructor(q,_,j={}){if(this.type=q,q)this.#_=!0;if(this.#f=_,this.#q=this.#f?this.#f.#q:this,this.#$=this.#q===this?j:this.#q.#$,this.#X=this.#q===this?[]:this.#q.#X,q==="!"&&!this.#q.#z)this.#X.push(this);this.#G=this.#f?this.#f.#P.length:0}get hasMagic(){if(this.#_!==void 0)return this.#_;for(let q of this.#P){if(typeof q==="string")continue;if(q.type||q.hasMagic)return this.#_=!0}return this.#_}toString(){if(this.#v!==void 0)return this.#v;if(!this.type)return this.#v=this.#P.map((q)=>String(q)).join("");else return this.#v=this.type+"("+this.#P.map((q)=>String(q)).join("|")+")"}#O(){if(this!==this.#q)throw new Error("should only call on root");if(this.#z)return this;this.toString(),this.#z=!0;let q;while(q=this.#X.pop()){if(q.type!=="!")continue;let _=q,j=_.#f;while(j){for(let K=_.#G+1;!j.type&&K<j.#P.length;K++)for(let Y of q.#P){if(typeof Y==="string")throw new Error("string part in extglob AST??");Y.copyIn(j.#P[K])}_=j,j=_.#f}}return this}push(...q){for(let _ of q){if(_==="")continue;if(typeof _!=="string"&&!(_ instanceof k6&&_.#f===this))throw new Error("invalid part: "+_);this.#P.push(_)}}toJSON(){let q=this.type===null?this.#P.slice().map((_)=>typeof _==="string"?_:_.toJSON()):[this.type,...this.#P.map((_)=>_.toJSON())];if(this.isStart()&&!this.type)q.unshift([]);if(this.isEnd()&&(this===this.#q||this.#q.#z&&this.#f?.type==="!"))q.push({});return q}isStart(){if(this.#q===this)return!0;if(!this.#f?.isStart())return!1;if(this.#G===0)return!0;let q=this.#f;for(let _=0;_<this.#G;_++){let j=q.#P[_];if(!(j instanceof k6&&j.type==="!"))return!1}return!0}isEnd(){if(this.#q===this)return!0;if(this.#f?.type==="!")return!0;if(!this.#f?.isEnd())return!1;if(!this.type)return this.#f?.isEnd();let q=this.#f?this.#f.#P.length:0;return this.#G===q-1}copyIn(q){if(typeof q==="string")this.push(q);else this.push(q.clone(this))}clone(q){let _=new k6(this.type,q);for(let j of this.#P)_.copyIn(j);return _}static#K(q,_,j,K){let Y=!1,f=!1,P=-1,$=!1;if(_.type===null){let v=j,H="";while(v<q.length){let T=q.charAt(v++);if(Y||T==="\\"){Y=!Y,H+=T;continue}if(f){if(v===P+1){if(T==="^"||T==="!")$=!0}else if(T==="]"&&!(v===P+2&&$))f=!1;H+=T;continue}else if(T==="["){f=!0,P=v,$=!1,H+=T;continue}if(!K.noext&&$O(T)&&q.charAt(v)==="("){_.push(H),H="";let J=new k6(T,_);v=k6.#K(q,J,v,K),_.push(J);continue}H+=T}return _.push(H),v}let w=j+1,O=new k6(null,_),z=[],W="";while(w<q.length){let v=q.charAt(w++);if(Y||v==="\\"){Y=!Y,W+=v;continue}if(f){if(w===P+1){if(v==="^"||v==="!")$=!0}else if(v==="]"&&!(w===P+2&&$))f=!1;W+=v;continue}else if(v==="["){f=!0,P=w,$=!1,W+=v;continue}if($O(v)&&q.charAt(w)==="("){O.push(W),W="";let H=new k6(v,O);O.push(H),w=k6.#K(q,H,w,K);continue}if(v==="|"){O.push(W),W="",z.push(O),O=new k6(null,_);continue}if(v===")"){if(W===""&&_.#P.length===0)_.#W=!0;return O.push(W),W="",_.push(...z,O),w}W+=v}return _.type=null,_.#_=void 0,_.#P=[q.substring(j-1)],w}static fromGlob(q,_={}){let j=new k6(null,void 0,_);return k6.#K(q,j,0,_),j}toMMPattern(){if(this!==this.#q)return this.#q.toMMPattern();let q=this.toString(),[_,j,K,Y]=this.toRegExpSource();if(!(K||this.#_||this.#$.nocase&&!this.#$.nocaseMagicOnly&&q.toUpperCase()!==q.toLowerCase()))return j;let P=(this.#$.nocase?"i":"")+(Y?"u":"");return Object.assign(new RegExp(`^${_}$`,P),{_src:_,_glob:q})}get options(){return this.#$}toRegExpSource(q){let _=q??!!this.#$.dot;if(this.#q===this)this.#O();if(!this.type){let $=this.isStart()&&this.isEnd(),w=this.#P.map((v)=>{let[H,T,J,k]=typeof v==="string"?k6.#u(v,this.#_,$):v.toRegExpSource(q);return this.#_=this.#_||J,this.#Y=this.#Y||k,H}).join(""),O="";if(this.isStart()){if(typeof this.#P[0]==="string"){if(!(this.#P.length===1&&fD.has(this.#P[0]))){let H=YD,T=_&&H.has(w.charAt(0))||w.startsWith("\\.")&&H.has(w.charAt(2))||w.startsWith("\\.\\.")&&H.has(w.charAt(4)),J=!_&&!q&&H.has(w.charAt(0));O=T?PD:J?_4:""}}}let z="";if(this.isEnd()&&this.#q.#z&&this.#f?.type==="!")z="(?:$|\\/)";return[O+w+z,kq(w),this.#_=!!this.#_,this.#Y]}let j=this.type==="*"||this.type==="+",K=this.type==="!"?"(?:(?!(?:":"(?:",Y=this.#J(_);if(this.isStart()&&this.isEnd()&&!Y&&this.type!=="!"){let $=this.toString();return this.#P=[$],this.type=null,this.#_=void 0,[$,kq(this.toString()),!1,!1]}let f=!j||q||_||!_4?"":this.#J(!0);if(f===Y)f="";if(f)Y=`(?:${Y})(?:${f})*?`;let P="";if(this.type==="!"&&this.#W)P=(this.isStart()&&!_?_4:"")+wO;else{let $=this.type==="!"?"))"+(this.isStart()&&!_&&!q?_4:"")+OO+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&f?")":this.type==="*"&&f?")?":`)${this.type}`;P=K+Y+$}return[P,kq(Y),this.#_=!!this.#_,this.#Y]}#J(q){return this.#P.map((_)=>{if(typeof _==="string")throw new Error("string type in extglob ast??");let[j,K,Y,f]=_.toRegExpSource(q);return this.#Y=this.#Y||f,j}).filter((_)=>!(this.isStart()&&this.isEnd())||!!_).join("|")}static#u(q,_,j=!1){let K=!1,Y="",f=!1;for(let P=0;P<q.length;P++){let $=q.charAt(P);if(K){K=!1,Y+=($D.has($)?"\\":"")+$;continue}if($==="\\"){if(P===q.length-1)Y+="\\\\";else K=!0;continue}if($==="["){let[w,O,z,W]=fO(q,P);if(z){Y+=w,f=f||O,P+=z-1,_=_||W;continue}}if($==="*"){if(j&&q==="*")Y+=wO;else Y+=OO;_=!0;continue}if($==="?"){Y+=z5,_=!0;continue}Y+=OD($)}return[Y,kq(q),!!_,f]}}var mK=(q,{windowsPathsNoEscape:_=!1}={})=>{return _?q.replace(/[?*()[\]]/g,"[$&]"):q.replace(/[?*()[\]\\]/g,"\\$&")};var S6=(q,_,j={})=>{if(g3(_),!j.nocomment&&_.charAt(0)==="#")return!1;return new jq(_,j).match(q)},wD=/^\*+([^+@!?\*\[\(]*)$/,zD=(q)=>(_)=>!_.startsWith(".")&&_.endsWith(q),WD=(q)=>(_)=>_.endsWith(q),vD=(q)=>{return q=q.toLowerCase(),(_)=>!_.startsWith(".")&&_.toLowerCase().endsWith(q)},HD=(q)=>{return q=q.toLowerCase(),(_)=>_.toLowerCase().endsWith(q)},JD=/^\*+\.\*+$/,TD=(q)=>!q.startsWith(".")&&q.includes("."),ZD=(q)=>q!=="."&&q!==".."&&q.includes("."),kD=/^\.\*+$/,XD=(q)=>q!=="."&&q!==".."&&q.startsWith("."),AD=/^\*+$/,GD=(q)=>q.length!==0&&!q.startsWith("."),uD=(q)=>q.length!==0&&q!=="."&&q!=="..",hD=/^\?+([^+@!?\*\[\(]*)?$/,CD=([q,_=""])=>{let j=vO([q]);if(!_)return j;return _=_.toLowerCase(),(K)=>j(K)&&K.toLowerCase().endsWith(_)},DD=([q,_=""])=>{let j=HO([q]);if(!_)return j;return _=_.toLowerCase(),(K)=>j(K)&&K.toLowerCase().endsWith(_)},VD=([q,_=""])=>{let j=HO([q]);return!_?j:(K)=>j(K)&&K.endsWith(_)},MD=([q,_=""])=>{let j=vO([q]);return!_?j:(K)=>j(K)&&K.endsWith(_)},vO=([q])=>{let _=q.length;return(j)=>j.length===_&&!j.startsWith(".")},HO=([q])=>{let _=q.length;return(j)=>j.length===_&&j!=="."&&j!==".."},JO=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",zO={win32:{sep:"\\"},posix:{sep:"/"}},ND=JO==="win32"?zO.win32.sep:zO.posix.sep;S6.sep=ND;var X6=Symbol("globstar **");S6.GLOBSTAR=X6;var bD="[^/]",SD=bD+"*?",ED="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",RD="(?:(?!(?:\\/|^)\\.).)*?",ID=(q,_={})=>(j)=>S6(j,q,_);S6.filter=ID;var Kq=(q,_={})=>Object.assign({},q,_),mD=(q)=>{if(!q||typeof q!=="object"||!Object.keys(q).length)return S6;let _=S6;return Object.assign((K,Y,f={})=>_(K,Y,Kq(q,f)),{Minimatch:class K extends _.Minimatch{constructor(Y,f={}){super(Y,Kq(q,f))}static defaults(Y){return _.defaults(Kq(q,Y)).Minimatch}},AST:class K extends _.AST{constructor(Y,f,P={}){super(Y,f,Kq(q,P))}static fromGlob(Y,f={}){return _.AST.fromGlob(Y,Kq(q,f))}},unescape:(K,Y={})=>_.unescape(K,Kq(q,Y)),escape:(K,Y={})=>_.escape(K,Kq(q,Y)),filter:(K,Y={})=>_.filter(K,Kq(q,Y)),defaults:(K)=>_.defaults(Kq(q,K)),makeRe:(K,Y={})=>_.makeRe(K,Kq(q,Y)),braceExpand:(K,Y={})=>_.braceExpand(K,Kq(q,Y)),match:(K,Y,f={})=>_.match(K,Y,Kq(q,f)),sep:_.sep,GLOBSTAR:X6})};S6.defaults=mD;var TO=(q,_={})=>{if(g3(q),_.nobrace||!/\{(?:(?!\{).)*\}/.test(q))return[q];return PO(q)};S6.braceExpand=TO;var gD=(q,_={})=>new jq(q,_).makeRe();S6.makeRe=gD;var yD=(q,_,j={})=>{let K=new jq(_,j);if(q=q.filter((Y)=>K.match(Y)),K.options.nonull&&!q.length)q.push(_);return q};S6.match=yD;var WO=/[?*]|[+@!]\(.*?\)|\[|\]/,dD=(q)=>q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class jq{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(q,_={}){if(g3(q),_=_||{},this.options=_,this.pattern=q,this.platform=_.platform||JO,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!_.windowsPathsNoEscape||_.allowWindowsEscape===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!_.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!_.nonegate,this.comment=!1,this.empty=!1,this.partial=!!_.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=_.windowsNoMagicRoot!==void 0?_.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 q of this.set)for(let _ of q)if(typeof _!=="string")return!0;return!1}debug(...q){}make(){let q=this.pattern,_=this.options;if(!_.nocomment&&q.charAt(0)==="#"){this.comment=!0;return}if(!q){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],_.debug)this.debug=(...Y)=>console.error(...Y);this.debug(this.pattern,this.globSet);let j=this.globSet.map((Y)=>this.slashSplit(Y));this.globParts=this.preprocess(j),this.debug(this.pattern,this.globParts);let K=this.globParts.map((Y,f,P)=>{if(this.isWindows&&this.windowsNoMagicRoot){let $=Y[0]===""&&Y[1]===""&&(Y[2]==="?"||!WO.test(Y[2]))&&!WO.test(Y[3]),w=/^[a-z]:/i.test(Y[0]);if($)return[...Y.slice(0,4),...Y.slice(4).map((O)=>this.parse(O))];else if(w)return[Y[0],...Y.slice(1).map((O)=>this.parse(O))]}return Y.map(($)=>this.parse($))});if(this.debug(this.pattern,K),this.set=K.filter((Y)=>Y.indexOf(!1)===-1),this.isWindows)for(let Y=0;Y<this.set.length;Y++){let f=this.set[Y];if(f[0]===""&&f[1]===""&&this.globParts[Y][2]==="?"&&typeof f[3]==="string"&&/^[a-z]:$/i.test(f[3]))f[2]="?"}this.debug(this.pattern,this.set)}preprocess(q){if(this.options.noglobstar){for(let j=0;j<q.length;j++)for(let K=0;K<q[j].length;K++)if(q[j][K]==="**")q[j][K]="*"}let{optimizationLevel:_=1}=this.options;if(_>=2)q=this.firstPhasePreProcess(q),q=this.secondPhasePreProcess(q);else if(_>=1)q=this.levelOneOptimize(q);else q=this.adjascentGlobstarOptimize(q);return q}adjascentGlobstarOptimize(q){return q.map((_)=>{let j=-1;while((j=_.indexOf("**",j+1))!==-1){let K=j;while(_[K+1]==="**")K++;if(K!==j)_.splice(j,K-j)}return _})}levelOneOptimize(q){return q.map((_)=>{return _=_.reduce((j,K)=>{let Y=j[j.length-1];if(K==="**"&&Y==="**")return j;if(K===".."){if(Y&&Y!==".."&&Y!=="."&&Y!=="**")return j.pop(),j}return j.push(K),j},[]),_.length===0?[""]:_})}levelTwoFileOptimize(q){if(!Array.isArray(q))q=this.slashSplit(q);let _=!1;do{if(_=!1,!this.preserveMultipleSlashes){for(let K=1;K<q.length-1;K++){let Y=q[K];if(K===1&&Y===""&&q[0]==="")continue;if(Y==="."||Y==="")_=!0,q.splice(K,1),K--}if(q[0]==="."&&q.length===2&&(q[1]==="."||q[1]===""))_=!0,q.pop()}let j=0;while((j=q.indexOf("..",j+1))!==-1){let K=q[j-1];if(K&&K!=="."&&K!==".."&&K!=="**")_=!0,q.splice(j-1,2),j-=2}}while(_);return q.length===0?[""]:q}firstPhasePreProcess(q){let _=!1;do{_=!1;for(let j of q){let K=-1;while((K=j.indexOf("**",K+1))!==-1){let f=K;while(j[f+1]==="**")f++;if(f>K)j.splice(K+1,f-K);let P=j[K+1],$=j[K+2],w=j[K+3];if(P!=="..")continue;if(!$||$==="."||$===".."||!w||w==="."||w==="..")continue;_=!0,j.splice(K,1);let O=j.slice(0);O[K]="**",q.push(O),K--}if(!this.preserveMultipleSlashes){for(let f=1;f<j.length-1;f++){let P=j[f];if(f===1&&P===""&&j[0]==="")continue;if(P==="."||P==="")_=!0,j.splice(f,1),f--}if(j[0]==="."&&j.length===2&&(j[1]==="."||j[1]===""))_=!0,j.pop()}let Y=0;while((Y=j.indexOf("..",Y+1))!==-1){let f=j[Y-1];if(f&&f!=="."&&f!==".."&&f!=="**"){_=!0;let $=Y===1&&j[Y+1]==="**"?["."]:[];if(j.splice(Y-1,2,...$),j.length===0)j.push("");Y-=2}}}}while(_);return q}secondPhasePreProcess(q){for(let _=0;_<q.length-1;_++)for(let j=_+1;j<q.length;j++){let K=this.partsMatch(q[_],q[j],!this.preserveMultipleSlashes);if(K){q[_]=[],q[j]=K;break}}return q.filter((_)=>_.length)}partsMatch(q,_,j=!1){let K=0,Y=0,f=[],P="";while(K<q.length&&Y<_.length)if(q[K]===_[Y])f.push(P==="b"?_[Y]:q[K]),K++,Y++;else if(j&&q[K]==="**"&&_[Y]===q[K+1])f.push(q[K]),K++;else if(j&&_[Y]==="**"&&q[K]===_[Y+1])f.push(_[Y]),Y++;else if(q[K]==="*"&&_[Y]&&(this.options.dot||!_[Y].startsWith("."))&&_[Y]!=="**"){if(P==="b")return!1;P="a",f.push(q[K]),K++,Y++}else if(_[Y]==="*"&&q[K]&&(this.options.dot||!q[K].startsWith("."))&&q[K]!=="**"){if(P==="a")return!1;P="b",f.push(_[Y]),K++,Y++}else return!1;return q.length===_.length&&f}parseNegate(){if(this.nonegate)return;let q=this.pattern,_=!1,j=0;for(let K=0;K<q.length&&q.charAt(K)==="!";K++)_=!_,j++;if(j)this.pattern=q.slice(j);this.negate=_}matchOne(q,_,j=!1){let K=this.options;if(this.isWindows){let T=typeof q[0]==="string"&&/^[a-z]:$/i.test(q[0]),J=!T&&q[0]===""&&q[1]===""&&q[2]==="?"&&/^[a-z]:$/i.test(q[3]),k=typeof _[0]==="string"&&/^[a-z]:$/i.test(_[0]),A=!k&&_[0]===""&&_[1]===""&&_[2]==="?"&&typeof _[3]==="string"&&/^[a-z]:$/i.test(_[3]),G=J?3:T?0:void 0,u=A?3:k?0:void 0;if(typeof G==="number"&&typeof u==="number"){let[V,m]=[q[G],_[u]];if(V.toLowerCase()===m.toLowerCase()){if(_[u]=V,u>G)_=_.slice(u);else if(G>u)q=q.slice(G)}}}let{optimizationLevel:Y=1}=this.options;if(Y>=2)q=this.levelTwoFileOptimize(q);this.debug("matchOne",this,{file:q,pattern:_}),this.debug("matchOne",q.length,_.length);for(var f=0,P=0,$=q.length,w=_.length;f<$&&P<w;f++,P++){this.debug("matchOne loop");var O=_[P],z=q[f];if(this.debug(_,O,z),O===!1)return!1;if(O===X6){this.debug("GLOBSTAR",[_,O,z]);var W=f,v=P+1;if(v===w){this.debug("** at the end");for(;f<$;f++)if(q[f]==="."||q[f]===".."||!K.dot&&q[f].charAt(0)===".")return!1;return!0}while(W<$){var H=q[W];if(this.debug(`
globstar while`,q,W,_,v,H),this.matchOne(q.slice(W),_.slice(v),j))return this.debug("globstar found match!",W,$,H),!0;else{if(H==="."||H===".."||!K.dot&&H.charAt(0)==="."){this.debug("dot detected!",q,W,_,v);break}this.debug("globstar swallow a segment, and continue"),W++}}if(j){if(this.debug(`
>>> no match, partial?`,q,W,_,v),W===$)return!0}return!1}let T;if(typeof O==="string")T=z===O,this.debug("string match",O,z,T);else T=O.test(z),this.debug("pattern match",O,z,T);if(!T)return!1}if(f===$&&P===w)return!0;else if(f===$)return j;else if(P===w)return f===$-1&&q[f]==="";else throw new Error("wtf?")}braceExpand(){return TO(this.pattern,this.options)}parse(q){g3(q);let _=this.options;if(q==="**")return X6;if(q==="")return"";let j,K=null;if(j=q.match(AD))K=_.dot?uD:GD;else if(j=q.match(wD))K=(_.nocase?_.dot?HD:vD:_.dot?WD:zD)(j[1]);else if(j=q.match(hD))K=(_.nocase?_.dot?DD:CD:_.dot?VD:MD)(j);else if(j=q.match(JD))K=_.dot?ZD:TD;else if(j=q.match(kD))K=XD;let Y=k6.fromGlob(q,this.options).toMMPattern();if(K&&typeof Y==="object")Reflect.defineProperty(Y,"test",{value:K});return Y}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let q=this.set;if(!q.length)return this.regexp=!1,this.regexp;let _=this.options,j=_.noglobstar?SD:_.dot?ED:RD,K=new Set(_.nocase?["i"]:[]),Y=q.map(($)=>{let w=$.map((O)=>{if(O instanceof RegExp)for(let z of O.flags.split(""))K.add(z);return typeof O==="string"?dD(O):O===X6?X6:O._src});return w.forEach((O,z)=>{let W=w[z+1],v=w[z-1];if(O!==X6||v===X6)return;if(v===void 0)if(W!==void 0&&W!==X6)w[z+1]="(?:\\/|"+j+"\\/)?"+W;else w[z]=j;else if(W===void 0)w[z-1]=v+"(?:\\/|"+j+")?";else if(W!==X6)w[z-1]=v+"(?:\\/|\\/"+j+"\\/)"+W,w[z+1]=X6}),w.filter((O)=>O!==X6).join("/")}).join("|"),[f,P]=q.length>1?["(?:",")"]:["",""];if(Y="^"+f+Y+P+"$",this.negate)Y="^(?!"+Y+").+$";try{this.regexp=new RegExp(Y,[...K].join(""))}catch($){this.regexp=!1}return this.regexp}slashSplit(q){if(this.preserveMultipleSlashes)return q.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(q))return["",...q.split(/\/+/)];else return q.split(/\/+/)}match(q,_=this.partial){if(this.debug("match",q,this.pattern),this.comment)return!1;if(this.empty)return q==="";if(q==="/"&&_)return!0;let j=this.options;if(this.isWindows)q=q.split("\\").join("/");let K=this.slashSplit(q);this.debug(this.pattern,"split",K);let Y=this.set;this.debug(this.pattern,"set",Y);let f=K[K.length-1];if(!f)for(let P=K.length-2;!f&&P>=0;P--)f=K[P];for(let P=0;P<Y.length;P++){let $=Y[P],w=K;if(j.matchBase&&$.length===1)w=[f];if(this.matchOne(w,$,_)){if(j.flipNegate)return!0;return!this.negate}}if(j.flipNegate)return!1;return this.negate}static defaults(q){return S6.defaults(q).Minimatch}}S6.AST=k6;S6.Minimatch=jq;S6.escape=mK;S6.unescape=kq;import{fileURLToPath as TV}from"node:url";var LD=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,kO=new Set,W5=typeof process==="object"&&!!process?process:{},XO=(q,_,j,K)=>{typeof W5.emitWarning==="function"?W5.emitWarning(q,_,j,K):console.error(`[${j}] ${_}: ${q}`)},K4=globalThis.AbortController,ZO=globalThis.AbortSignal;if(typeof K4==="undefined"){ZO=class j{onabort;_onabort=[];reason;aborted=!1;addEventListener(K,Y){this._onabort.push(Y)}},K4=class j{constructor(){_()}signal=new ZO;abort(K){if(this.signal.aborted)return;this.signal.reason=K,this.signal.aborted=!0;for(let Y of this.signal._onabort)Y(K);this.signal.onabort?.(K)}};let q=W5.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",_=()=>{if(!q)return;q=!1,XO("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",_)}}var pD=(q)=>!kO.has(q),mE=Symbol("type"),z_=(q)=>q&&q===Math.floor(q)&&q>0&&isFinite(q),AO=(q)=>!z_(q)?null:q<=Math.pow(2,8)?Uint8Array:q<=Math.pow(2,16)?Uint16Array:q<=Math.pow(2,32)?Uint32Array:q<=Number.MAX_SAFE_INTEGER?d3:null;class d3 extends Array{constructor(q){super(q);this.fill(0)}}class gK{heap;length;static#q=!1;static create(q){let _=AO(q);if(!_)return[];gK.#q=!0;let j=new gK(q,_);return gK.#q=!1,j}constructor(q,_){if(!gK.#q)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new _(q),this.length=0}push(q){this.heap[this.length++]=q}pop(){return this.heap[--this.length]}}class L3{#q;#_;#Y;#P;#f;#G;#X;#z;get perf(){return this.#z}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#$;#v;#W;#O;#K;#J;#u;#A;#T;#b;#Z;#C;#M;#k;#h;#N;#H;#j;static unsafeExposeInternals(q){return{starts:q.#M,ttls:q.#k,sizes:q.#C,keyMap:q.#W,keyList:q.#O,valList:q.#K,next:q.#J,prev:q.#u,get head(){return q.#A},get tail(){return q.#T},free:q.#b,isBackgroundFetch:(_)=>q.#w(_),backgroundFetch:(_,j,K,Y)=>q.#r(_,j,K,Y),moveToTail:(_)=>q.#L(_),indexes:(_)=>q.#E(_),rindexes:(_)=>q.#I(_),isStale:(_)=>q.#V(_)}}get max(){return this.#q}get maxSize(){return this.#_}get calculatedSize(){return this.#v}get size(){return this.#$}get fetchMethod(){return this.#G}get memoMethod(){return this.#X}get dispose(){return this.#Y}get onInsert(){return this.#P}get disposeAfter(){return this.#f}constructor(q){let{max:_=0,ttl:j,ttlResolution:K=1,ttlAutopurge:Y,updateAgeOnGet:f,updateAgeOnHas:P,allowStale:$,dispose:w,onInsert:O,disposeAfter:z,noDisposeOnSet:W,noUpdateTTL:v,maxSize:H=0,maxEntrySize:T=0,sizeCalculation:J,fetchMethod:k,memoMethod:A,noDeleteOnFetchRejection:G,noDeleteOnStaleGet:u,allowStaleOnFetchRejection:V,allowStaleOnFetchAbort:m,ignoreFetchAbort:N,perf:R}=q;if(R!==void 0){if(typeof R?.now!=="function")throw new TypeError("perf option must have a now() method if specified")}if(this.#z=R??LD,_!==0&&!z_(_))throw new TypeError("max option must be a nonnegative integer");let p=_?AO(_):Array;if(!p)throw new Error("invalid max value: "+_);if(this.#q=_,this.#_=H,this.maxEntrySize=T||this.#_,this.sizeCalculation=J,this.sizeCalculation){if(!this.#_&&!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(A!==void 0&&typeof A!=="function")throw new TypeError("memoMethod must be a function if defined");if(this.#X=A,k!==void 0&&typeof k!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#G=k,this.#N=!!k,this.#W=new Map,this.#O=new Array(_).fill(void 0),this.#K=new Array(_).fill(void 0),this.#J=new p(_),this.#u=new p(_),this.#A=0,this.#T=0,this.#b=gK.create(_),this.#$=0,this.#v=0,typeof w==="function")this.#Y=w;if(typeof O==="function")this.#P=O;if(typeof z==="function")this.#f=z,this.#Z=[];else this.#f=void 0,this.#Z=void 0;if(this.#h=!!this.#Y,this.#j=!!this.#P,this.#H=!!this.#f,this.noDisposeOnSet=!!W,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!G,this.allowStaleOnFetchRejection=!!V,this.allowStaleOnFetchAbort=!!m,this.ignoreFetchAbort=!!N,this.maxEntrySize!==0){if(this.#_!==0){if(!z_(this.#_))throw new TypeError("maxSize must be a positive integer if specified")}if(!z_(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#p()}if(this.allowStale=!!$,this.noDeleteOnStaleGet=!!u,this.updateAgeOnGet=!!f,this.updateAgeOnHas=!!P,this.ttlResolution=z_(K)||K===0?K:1,this.ttlAutopurge=!!Y,this.ttl=j||0,this.ttl){if(!z_(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#m()}if(this.#q===0&&this.ttl===0&&this.#_===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#q&&!this.#_){if(pD("LRU_CACHE_UNBOUNDED"))kO.add("LRU_CACHE_UNBOUNDED"),XO("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",L3)}}getRemainingTTL(q){return this.#W.has(q)?1/0:0}#m(){let q=new d3(this.#q),_=new d3(this.#q);this.#k=q,this.#M=_,this.#n=(Y,f,P=this.#z.now())=>{if(_[Y]=f!==0?P:0,q[Y]=f,f!==0&&this.ttlAutopurge){let $=setTimeout(()=>{if(this.#V(Y))this.#R(this.#O[Y],"expire")},f+1);if($.unref)$.unref()}},this.#S=(Y)=>{_[Y]=q[Y]!==0?this.#z.now():0},this.#D=(Y,f)=>{if(q[f]){let P=q[f],$=_[f];if(!P||!$)return;Y.ttl=P,Y.start=$,Y.now=j||K();let w=Y.now-$;Y.remainingTTL=P-w}};let j=0,K=()=>{let Y=this.#z.now();if(this.ttlResolution>0){j=Y;let f=setTimeout(()=>j=0,this.ttlResolution);if(f.unref)f.unref()}return Y};this.getRemainingTTL=(Y)=>{let f=this.#W.get(Y);if(f===void 0)return 0;let P=q[f],$=_[f];if(!P||!$)return 1/0;let w=(j||K())-$;return P-w},this.#V=(Y)=>{let f=_[Y],P=q[Y];return!!P&&!!f&&(j||K())-f>P}}#S=()=>{};#D=()=>{};#n=()=>{};#V=()=>!1;#p(){let q=new d3(this.#q);this.#v=0,this.#C=q,this.#g=(_)=>{this.#v-=q[_],q[_]=0},this.#y=(_,j,K,Y)=>{if(this.#w(j))return 0;if(!z_(K))if(Y){if(typeof Y!=="function")throw new TypeError("sizeCalculation must be a function");if(K=Y(j,_),!z_(K))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 K},this.#l=(_,j,K)=>{if(q[_]=j,this.#_){let Y=this.#_-q[_];while(this.#v>Y)this.#d(!0)}if(this.#v+=q[_],K)K.entrySize=j,K.totalCalculatedSize=this.#v}}#g=(q)=>{};#l=(q,_,j)=>{};#y=(q,_,j,K)=>{if(j||K)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#E({allowStale:q=this.allowStale}={}){if(this.#$)for(let _=this.#T;;){if(!this.#c(_))break;if(q||!this.#V(_))yield _;if(_===this.#A)break;else _=this.#u[_]}}*#I({allowStale:q=this.allowStale}={}){if(this.#$)for(let _=this.#A;;){if(!this.#c(_))break;if(q||!this.#V(_))yield _;if(_===this.#T)break;else _=this.#J[_]}}#c(q){return q!==void 0&&this.#W.get(this.#O[q])===q}*entries(){for(let q of this.#E())if(this.#K[q]!==void 0&&this.#O[q]!==void 0&&!this.#w(this.#K[q]))yield[this.#O[q],this.#K[q]]}*rentries(){for(let q of this.#I())if(this.#K[q]!==void 0&&this.#O[q]!==void 0&&!this.#w(this.#K[q]))yield[this.#O[q],this.#K[q]]}*keys(){for(let q of this.#E()){let _=this.#O[q];if(_!==void 0&&!this.#w(this.#K[q]))yield _}}*rkeys(){for(let q of this.#I()){let _=this.#O[q];if(_!==void 0&&!this.#w(this.#K[q]))yield _}}*values(){for(let q of this.#E())if(this.#K[q]!==void 0&&!this.#w(this.#K[q]))yield this.#K[q]}*rvalues(){for(let q of this.#I())if(this.#K[q]!==void 0&&!this.#w(this.#K[q]))yield this.#K[q]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(q,_={}){for(let j of this.#E()){let K=this.#K[j],Y=this.#w(K)?K.__staleWhileFetching:K;if(Y===void 0)continue;if(q(Y,this.#O[j],this))return this.get(this.#O[j],_)}}forEach(q,_=this){for(let j of this.#E()){let K=this.#K[j],Y=this.#w(K)?K.__staleWhileFetching:K;if(Y===void 0)continue;q.call(_,Y,this.#O[j],this)}}rforEach(q,_=this){for(let j of this.#I()){let K=this.#K[j],Y=this.#w(K)?K.__staleWhileFetching:K;if(Y===void 0)continue;q.call(_,Y,this.#O[j],this)}}purgeStale(){let q=!1;for(let _ of this.#I({allowStale:!0}))if(this.#V(_))this.#R(this.#O[_],"expire"),q=!0;return q}info(q){let _=this.#W.get(q);if(_===void 0)return;let j=this.#K[_],K=this.#w(j)?j.__staleWhileFetching:j;if(K===void 0)return;let Y={value:K};if(this.#k&&this.#M){let f=this.#k[_],P=this.#M[_];if(f&&P){let $=f-(this.#z.now()-P);Y.ttl=$,Y.start=Date.now()}}if(this.#C)Y.size=this.#C[_];return Y}dump(){let q=[];for(let _ of this.#E({allowStale:!0})){let j=this.#O[_],K=this.#K[_],Y=this.#w(K)?K.__staleWhileFetching:K;if(Y===void 0||j===void 0)continue;let f={value:Y};if(this.#k&&this.#M){f.ttl=this.#k[_];let P=this.#z.now()-this.#M[_];f.start=Math.floor(Date.now()-P)}if(this.#C)f.size=this.#C[_];q.unshift([j,f])}return q}load(q){this.clear();for(let[_,j]of q){if(j.start){let K=Date.now()-j.start;j.start=this.#z.now()-K}this.set(_,j.value,j)}}set(q,_,j={}){if(_===void 0)return this.delete(q),this;let{ttl:K=this.ttl,start:Y,noDisposeOnSet:f=this.noDisposeOnSet,sizeCalculation:P=this.sizeCalculation,status:$}=j,{noUpdateTTL:w=this.noUpdateTTL}=j,O=this.#y(q,_,j.size||0,P);if(this.maxEntrySize&&O>this.maxEntrySize){if($)$.set="miss",$.maxEntrySizeExceeded=!0;return this.#R(q,"set"),this}let z=this.#$===0?void 0:this.#W.get(q);if(z===void 0){if(z=this.#$===0?this.#T:this.#b.length!==0?this.#b.pop():this.#$===this.#q?this.#d(!1):this.#$,this.#O[z]=q,this.#K[z]=_,this.#W.set(q,z),this.#J[this.#T]=z,this.#u[z]=this.#T,this.#T=z,this.#$++,this.#l(z,O,$),$)$.set="add";if(w=!1,this.#j)this.#P?.(_,q,"add")}else{this.#L(z);let W=this.#K[z];if(_!==W){if(this.#N&&this.#w(W)){W.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:v}=W;if(v!==void 0&&!f){if(this.#h)this.#Y?.(v,q,"set");if(this.#H)this.#Z?.push([v,q,"set"])}}else if(!f){if(this.#h)this.#Y?.(W,q,"set");if(this.#H)this.#Z?.push([W,q,"set"])}if(this.#g(z),this.#l(z,O,$),this.#K[z]=_,$){$.set="replace";let v=W&&this.#w(W)?W.__staleWhileFetching:W;if(v!==void 0)$.oldValue=v}}else if($)$.set="update";if(this.#j)this.onInsert?.(_,q,_===W?"update":"replace")}if(K!==0&&!this.#k)this.#m();if(this.#k){if(!w)this.#n(z,K,Y);if($)this.#D($,z)}if(!f&&this.#H&&this.#Z){let W=this.#Z,v;while(v=W?.shift())this.#f?.(...v)}return this}pop(){try{while(this.#$){let q=this.#K[this.#A];if(this.#d(!0),this.#w(q)){if(q.__staleWhileFetching)return q.__staleWhileFetching}else if(q!==void 0)return q}}finally{if(this.#H&&this.#Z){let q=this.#Z,_;while(_=q?.shift())this.#f?.(..._)}}}#d(q){let _=this.#A,j=this.#O[_],K=this.#K[_];if(this.#N&&this.#w(K))K.__abortController.abort(new Error("evicted"));else if(this.#h||this.#H){if(this.#h)this.#Y?.(K,j,"evict");if(this.#H)this.#Z?.push([K,j,"evict"])}if(this.#g(_),q)this.#O[_]=void 0,this.#K[_]=void 0,this.#b.push(_);if(this.#$===1)this.#A=this.#T=0,this.#b.length=0;else this.#A=this.#J[_];return this.#W.delete(j),this.#$--,_}has(q,_={}){let{updateAgeOnHas:j=this.updateAgeOnHas,status:K}=_,Y=this.#W.get(q);if(Y!==void 0){let f=this.#K[Y];if(this.#w(f)&&f.__staleWhileFetching===void 0)return!1;if(!this.#V(Y)){if(j)this.#S(Y);if(K)K.has="hit",this.#D(K,Y);return!0}else if(K)K.has="stale",this.#D(K,Y)}else if(K)K.has="miss";return!1}peek(q,_={}){let{allowStale:j=this.allowStale}=_,K=this.#W.get(q);if(K===void 0||!j&&this.#V(K))return;let Y=this.#K[K];return this.#w(Y)?Y.__staleWhileFetching:Y}#r(q,_,j,K){let Y=_===void 0?void 0:this.#K[_];if(this.#w(Y))return Y;let f=new K4,{signal:P}=j;P?.addEventListener("abort",()=>f.abort(P.reason),{signal:f.signal});let $={signal:f.signal,options:j,context:K},w=(T,J=!1)=>{let{aborted:k}=f.signal,A=j.ignoreFetchAbort&&T!==void 0;if(j.status)if(k&&!J){if(j.status.fetchAborted=!0,j.status.fetchError=f.signal.reason,A)j.status.fetchAbortIgnored=!0}else j.status.fetchResolved=!0;if(k&&!A&&!J)return z(f.signal.reason);let G=v;if(this.#K[_]===v)if(T===void 0)if(G.__staleWhileFetching!==void 0)this.#K[_]=G.__staleWhileFetching;else this.#R(q,"fetch");else{if(j.status)j.status.fetchUpdated=!0;this.set(q,T,$.options)}return T},O=(T)=>{if(j.status)j.status.fetchRejected=!0,j.status.fetchError=T;return z(T)},z=(T)=>{let{aborted:J}=f.signal,k=J&&j.allowStaleOnFetchAbort,A=k||j.allowStaleOnFetchRejection,G=A||j.noDeleteOnFetchRejection,u=v;if(this.#K[_]===v){if(!G||u.__staleWhileFetching===void 0)this.#R(q,"fetch");else if(!k)this.#K[_]=u.__staleWhileFetching}if(A){if(j.status&&u.__staleWhileFetching!==void 0)j.status.returnedStale=!0;return u.__staleWhileFetching}else if(u.__returned===u)throw T},W=(T,J)=>{let k=this.#G?.(q,Y,$);if(k&&k instanceof Promise)k.then((A)=>T(A===void 0?void 0:A),J);f.signal.addEventListener("abort",()=>{if(!j.ignoreFetchAbort||j.allowStaleOnFetchAbort){if(T(void 0),j.allowStaleOnFetchAbort)T=(A)=>w(A,!0)}})};if(j.status)j.status.fetchDispatched=!0;let v=new Promise(W).then(w,O),H=Object.assign(v,{__abortController:f,__staleWhileFetching:Y,__returned:void 0});if(_===void 0)this.set(q,H,{...$.options,status:void 0}),_=this.#W.get(q);else this.#K[_]=H;return H}#w(q){if(!this.#N)return!1;let _=q;return!!_&&_ instanceof Promise&&_.hasOwnProperty("__staleWhileFetching")&&_.__abortController instanceof K4}async fetch(q,_={}){let{allowStale:j=this.allowStale,updateAgeOnGet:K=this.updateAgeOnGet,noDeleteOnStaleGet:Y=this.noDeleteOnStaleGet,ttl:f=this.ttl,noDisposeOnSet:P=this.noDisposeOnSet,size:$=0,sizeCalculation:w=this.sizeCalculation,noUpdateTTL:O=this.noUpdateTTL,noDeleteOnFetchRejection:z=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:W=this.allowStaleOnFetchRejection,ignoreFetchAbort:v=this.ignoreFetchAbort,allowStaleOnFetchAbort:H=this.allowStaleOnFetchAbort,context:T,forceRefresh:J=!1,status:k,signal:A}=_;if(!this.#N){if(k)k.fetch="get";return this.get(q,{allowStale:j,updateAgeOnGet:K,noDeleteOnStaleGet:Y,status:k})}let G={allowStale:j,updateAgeOnGet:K,noDeleteOnStaleGet:Y,ttl:f,noDisposeOnSet:P,size:$,sizeCalculation:w,noUpdateTTL:O,noDeleteOnFetchRejection:z,allowStaleOnFetchRejection:W,allowStaleOnFetchAbort:H,ignoreFetchAbort:v,status:k,signal:A},u=this.#W.get(q);if(u===void 0){if(k)k.fetch="miss";let V=this.#r(q,u,G,T);return V.__returned=V}else{let V=this.#K[u];if(this.#w(V)){let b=j&&V.__staleWhileFetching!==void 0;if(k){if(k.fetch="inflight",b)k.returnedStale=!0}return b?V.__staleWhileFetching:V.__returned=V}let m=this.#V(u);if(!J&&!m){if(k)k.fetch="hit";if(this.#L(u),K)this.#S(u);if(k)this.#D(k,u);return V}let N=this.#r(q,u,G,T),p=N.__staleWhileFetching!==void 0&&j;if(k){if(k.fetch=m?"stale":"refresh",p&&m)k.returnedStale=!0}return p?N.__staleWhileFetching:N.__returned=N}}async forceFetch(q,_={}){let j=await this.fetch(q,_);if(j===void 0)throw new Error("fetch() returned undefined");return j}memo(q,_={}){let j=this.#X;if(!j)throw new Error("no memoMethod provided to constructor");let{context:K,forceRefresh:Y,...f}=_,P=this.get(q,f);if(!Y&&P!==void 0)return P;let $=j(q,P,{options:f,context:K});return this.set(q,$,f),$}get(q,_={}){let{allowStale:j=this.allowStale,updateAgeOnGet:K=this.updateAgeOnGet,noDeleteOnStaleGet:Y=this.noDeleteOnStaleGet,status:f}=_,P=this.#W.get(q);if(P!==void 0){let $=this.#K[P],w=this.#w($);if(f)this.#D(f,P);if(this.#V(P)){if(f)f.get="stale";if(!w){if(!Y)this.#R(q,"expire");if(f&&j)f.returnedStale=!0;return j?$:void 0}else{if(f&&j&&$.__staleWhileFetching!==void 0)f.returnedStale=!0;return j?$.__staleWhileFetching:void 0}}else{if(f)f.get="hit";if(w)return $.__staleWhileFetching;if(this.#L(P),K)this.#S(P);return $}}else if(f)f.get="miss"}#i(q,_){this.#u[_]=q,this.#J[q]=_}#L(q){if(q!==this.#T){if(q===this.#A)this.#A=this.#J[q];else this.#i(this.#u[q],this.#J[q]);this.#i(this.#T,q),this.#T=q}}delete(q){return this.#R(q,"delete")}#R(q,_){let j=!1;if(this.#$!==0){let K=this.#W.get(q);if(K!==void 0)if(j=!0,this.#$===1)this.#x(_);else{this.#g(K);let Y=this.#K[K];if(this.#w(Y))Y.__abortController.abort(new Error("deleted"));else if(this.#h||this.#H){if(this.#h)this.#Y?.(Y,q,_);if(this.#H)this.#Z?.push([Y,q,_])}if(this.#W.delete(q),this.#O[K]=void 0,this.#K[K]=void 0,K===this.#T)this.#T=this.#u[K];else if(K===this.#A)this.#A=this.#J[K];else{let f=this.#u[K];this.#J[f]=this.#J[K];let P=this.#J[K];this.#u[P]=this.#u[K]}this.#$--,this.#b.push(K)}}if(this.#H&&this.#Z?.length){let K=this.#Z,Y;while(Y=K?.shift())this.#f?.(...Y)}return j}clear(){return this.#x("delete")}#x(q){for(let _ of this.#I({allowStale:!0})){let j=this.#K[_];if(this.#w(j))j.__abortController.abort(new Error("deleted"));else{let K=this.#O[_];if(this.#h)this.#Y?.(j,K,q);if(this.#H)this.#Z?.push([j,K,q])}}if(this.#W.clear(),this.#K.fill(void 0),this.#O.fill(void 0),this.#k&&this.#M)this.#k.fill(0),this.#M.fill(0);if(this.#C)this.#C.fill(0);if(this.#A=0,this.#T=0,this.#b.length=0,this.#v=0,this.#$=0,this.#H&&this.#Z){let _=this.#Z,j;while(j=_?.shift())this.#f?.(...j)}}}import{posix as FD,win32 as u5}from"node:path";import{fileURLToPath as eD}from"node:url";import{lstatSync as UD,readdir as sD,readdirSync as QD,readlinkSync as qV,realpathSync as _V}from"fs";import*as KV from"node:fs";import{lstat as PV,readdir as YV,readlink as fV,realpath as $V}from"node:fs/promises";import{EventEmitter as k5}from"node:events";import DO from"node:stream";import{StringDecoder as lD}from"node:string_decoder";var GO=typeof process==="object"&&process?process:{stdout:null,stderr:null},xD=(q)=>!!q&&typeof q==="object"&&(q instanceof l_||q instanceof DO||nD(q)||cD(q)),nD=(q)=>!!q&&typeof q==="object"&&q instanceof k5&&typeof q.pipe==="function"&&q.pipe!==DO.Writable.prototype.pipe,cD=(q)=>!!q&&typeof q==="object"&&q instanceof k5&&typeof q.write==="function"&&typeof q.end==="function",tq=Symbol("EOF"),Fq=Symbol("maybeEmitEnd"),W_=Symbol("emittedEnd"),j4=Symbol("emittingEnd"),p3=Symbol("emittedError"),P4=Symbol("closed"),uO=Symbol("read"),Y4=Symbol("flush"),hO=Symbol("flushChunk"),Xq=Symbol("encoding"),yK=Symbol("decoder"),w6=Symbol("flowing"),l3=Symbol("paused"),dK=Symbol("resume"),z6=Symbol("buffer"),E6=Symbol("pipes"),W6=Symbol("bufferLength"),v5=Symbol("bufferPush"),f4=Symbol("bufferShift"),D6=Symbol("objectMode"),_6=Symbol("destroyed"),H5=Symbol("error"),J5=Symbol("emitData"),CO=Symbol("emitEnd"),T5=Symbol("emitEnd2"),Eq=Symbol("async"),Z5=Symbol("abort"),$4=Symbol("aborted"),x3=Symbol("signal"),p_=Symbol("dataListeners"),o6=Symbol("discarded"),n3=(q)=>Promise.resolve().then(q),rD=(q)=>q(),iD=(q)=>q==="end"||q==="finish"||q==="prefinish",oD=(q)=>q instanceof ArrayBuffer||!!q&&typeof q==="object"&&q.constructor&&q.constructor.name==="ArrayBuffer"&&q.byteLength>=0,aD=(q)=>!Buffer.isBuffer(q)&&ArrayBuffer.isView(q);class X5{src;dest;opts;ondrain;constructor(q,_,j){this.src=q,this.dest=_,this.opts=j,this.ondrain=()=>q[dK](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(q){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class VO extends X5{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(q,_,j){super(q,_,j);this.proxyErrors=(K)=>_.emit("error",K),q.on("error",this.proxyErrors)}}var BD=(q)=>!!q.objectMode,tD=(q)=>!q.objectMode&&!!q.encoding&&q.encoding!=="buffer";class l_ extends k5{[w6]=!1;[l3]=!1;[E6]=[];[z6]=[];[D6];[Xq];[Eq];[yK];[tq]=!1;[W_]=!1;[j4]=!1;[P4]=!1;[p3]=null;[W6]=0;[_6]=!1;[x3];[$4]=!1;[p_]=0;[o6]=!1;writable=!0;readable=!0;constructor(...q){let _=q[0]||{};super();if(_.objectMode&&typeof _.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(BD(_))this[D6]=!0,this[Xq]=null;else if(tD(_))this[Xq]=_.encoding,this[D6]=!1;else this[D6]=!1,this[Xq]=null;if(this[Eq]=!!_.async,this[yK]=this[Xq]?new lD(this[Xq]):null,_&&_.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[z6]});if(_&&_.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[E6]});let{signal:j}=_;if(j)if(this[x3]=j,j.aborted)this[Z5]();else j.addEventListener("abort",()=>this[Z5]())}get bufferLength(){return this[W6]}get encoding(){return this[Xq]}set encoding(q){throw new Error("Encoding must be set at instantiation time")}setEncoding(q){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[D6]}set objectMode(q){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[Eq]}set["async"](q){this[Eq]=this[Eq]||!!q}[Z5](){this[$4]=!0,this.emit("abort",this[x3]?.reason),this.destroy(this[x3]?.reason)}get aborted(){return this[$4]}set aborted(q){}write(q,_,j){if(this[$4])return!1;if(this[tq])throw new Error("write after end");if(this[_6])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof _==="function")j=_,_="utf8";if(!_)_="utf8";let K=this[Eq]?n3:rD;if(!this[D6]&&!Buffer.isBuffer(q)){if(aD(q))q=Buffer.from(q.buffer,q.byteOffset,q.byteLength);else if(oD(q))q=Buffer.from(q);else if(typeof q!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[D6]){if(this[w6]&&this[W6]!==0)this[Y4](!0);if(this[w6])this.emit("data",q);else this[v5](q);if(this[W6]!==0)this.emit("readable");if(j)K(j);return this[w6]}if(!q.length){if(this[W6]!==0)this.emit("readable");if(j)K(j);return this[w6]}if(typeof q==="string"&&!(_===this[Xq]&&!this[yK]?.lastNeed))q=Buffer.from(q,_);if(Buffer.isBuffer(q)&&this[Xq])q=this[yK].write(q);if(this[w6]&&this[W6]!==0)this[Y4](!0);if(this[w6])this.emit("data",q);else this[v5](q);if(this[W6]!==0)this.emit("readable");if(j)K(j);return this[w6]}read(q){if(this[_6])return null;if(this[o6]=!1,this[W6]===0||q===0||q&&q>this[W6])return this[Fq](),null;if(this[D6])q=null;if(this[z6].length>1&&!this[D6])this[z6]=[this[Xq]?this[z6].join(""):Buffer.concat(this[z6],this[W6])];let _=this[uO](q||null,this[z6][0]);return this[Fq](),_}[uO](q,_){if(this[D6])this[f4]();else{let j=_;if(q===j.length||q===null)this[f4]();else if(typeof j==="string")this[z6][0]=j.slice(q),_=j.slice(0,q),this[W6]-=q;else this[z6][0]=j.subarray(q),_=j.subarray(0,q),this[W6]-=q}if(this.emit("data",_),!this[z6].length&&!this[tq])this.emit("drain");return _}end(q,_,j){if(typeof q==="function")j=q,q=void 0;if(typeof _==="function")j=_,_="utf8";if(q!==void 0)this.write(q,_);if(j)this.once("end",j);if(this[tq]=!0,this.writable=!1,this[w6]||!this[l3])this[Fq]();return this}[dK](){if(this[_6])return;if(!this[p_]&&!this[E6].length)this[o6]=!0;if(this[l3]=!1,this[w6]=!0,this.emit("resume"),this[z6].length)this[Y4]();else if(this[tq])this[Fq]();else this.emit("drain")}resume(){return this[dK]()}pause(){this[w6]=!1,this[l3]=!0,this[o6]=!1}get destroyed(){return this[_6]}get flowing(){return this[w6]}get paused(){return this[l3]}[v5](q){if(this[D6])this[W6]+=1;else this[W6]+=q.length;this[z6].push(q)}[f4](){if(this[D6])this[W6]-=1;else this[W6]-=this[z6][0].length;return this[z6].shift()}[Y4](q=!1){do;while(this[hO](this[f4]())&&this[z6].length);if(!q&&!this[z6].length&&!this[tq])this.emit("drain")}[hO](q){return this.emit("data",q),this[w6]}pipe(q,_){if(this[_6])return q;this[o6]=!1;let j=this[W_];if(_=_||{},q===GO.stdout||q===GO.stderr)_.end=!1;else _.end=_.end!==!1;if(_.proxyErrors=!!_.proxyErrors,j){if(_.end)q.end()}else if(this[E6].push(!_.proxyErrors?new X5(this,q,_):new VO(this,q,_)),this[Eq])n3(()=>this[dK]());else this[dK]();return q}unpipe(q){let _=this[E6].find((j)=>j.dest===q);if(_){if(this[E6].length===1){if(this[w6]&&this[p_]===0)this[w6]=!1;this[E6]=[]}else this[E6].splice(this[E6].indexOf(_),1);_.unpipe()}}addListener(q,_){return this.on(q,_)}on(q,_){let j=super.on(q,_);if(q==="data"){if(this[o6]=!1,this[p_]++,!this[E6].length&&!this[w6])this[dK]()}else if(q==="readable"&&this[W6]!==0)super.emit("readable");else if(iD(q)&&this[W_])super.emit(q),this.removeAllListeners(q);else if(q==="error"&&this[p3]){let K=_;if(this[Eq])n3(()=>K.call(this,this[p3]));else K.call(this,this[p3])}return j}removeListener(q,_){return this.off(q,_)}off(q,_){let j=super.off(q,_);if(q==="data"){if(this[p_]=this.listeners("data").length,this[p_]===0&&!this[o6]&&!this[E6].length)this[w6]=!1}return j}removeAllListeners(q){let _=super.removeAllListeners(q);if(q==="data"||q===void 0){if(this[p_]=0,!this[o6]&&!this[E6].length)this[w6]=!1}return _}get emittedEnd(){return this[W_]}[Fq](){if(!this[j4]&&!this[W_]&&!this[_6]&&this[z6].length===0&&this[tq]){if(this[j4]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[P4])this.emit("close");this[j4]=!1}}emit(q,..._){let j=_[0];if(q!=="error"&&q!=="close"&&q!==_6&&this[_6])return!1;else if(q==="data")return!this[D6]&&!j?!1:this[Eq]?(n3(()=>this[J5](j)),!0):this[J5](j);else if(q==="end")return this[CO]();else if(q==="close"){if(this[P4]=!0,!this[W_]&&!this[_6])return!1;let Y=super.emit("close");return this.removeAllListeners("close"),Y}else if(q==="error"){this[p3]=j,super.emit(H5,j);let Y=!this[x3]||this.listeners("error").length?super.emit("error",j):!1;return this[Fq](),Y}else if(q==="resume"){let Y=super.emit("resume");return this[Fq](),Y}else if(q==="finish"||q==="prefinish"){let Y=super.emit(q);return this.removeAllListeners(q),Y}let K=super.emit(q,..._);return this[Fq](),K}[J5](q){for(let j of this[E6])if(j.dest.write(q)===!1)this.pause();let _=this[o6]?!1:super.emit("data",q);return this[Fq](),_}[CO](){if(this[W_])return!1;return this[W_]=!0,this.readable=!1,this[Eq]?(n3(()=>this[T5]()),!0):this[T5]()}[T5](){if(this[yK]){let _=this[yK].end();if(_){for(let j of this[E6])j.dest.write(_);if(!this[o6])super.emit("data",_)}}for(let _ of this[E6])_.end();let q=super.emit("end");return this.removeAllListeners("end"),q}async collect(){let q=Object.assign([],{dataLength:0});if(!this[D6])q.dataLength=0;let _=this.promise();return this.on("data",(j)=>{if(q.push(j),!this[D6])q.dataLength+=j.length}),await _,q}async concat(){if(this[D6])throw new Error("cannot concat in objectMode");let q=await this.collect();return this[Xq]?q.join(""):Buffer.concat(q,q.dataLength)}async promise(){return new Promise((q,_)=>{this.on(_6,()=>_(new Error("stream destroyed"))),this.on("error",(j)=>_(j)),this.on("end",()=>q())})}[Symbol.asyncIterator](){this[o6]=!1;let q=!1,_=async()=>{return this.pause(),q=!0,{value:void 0,done:!0}};return{next:()=>{if(q)return _();let K=this.read();if(K!==null)return Promise.resolve({done:!1,value:K});if(this[tq])return _();let Y,f,P=(z)=>{this.off("data",$),this.off("end",w),this.off(_6,O),_(),f(z)},$=(z)=>{this.off("error",P),this.off("end",w),this.off(_6,O),this.pause(),Y({value:z,done:!!this[tq]})},w=()=>{this.off("error",P),this.off("data",$),this.off(_6,O),_(),Y({done:!0,value:void 0})},O=()=>P(new Error("stream destroyed"));return new Promise((z,W)=>{f=W,Y=z,this.once(_6,O),this.once("error",P),this.once("end",w),this.once("data",$)})},throw:_,return:_,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[o6]=!1;let q=!1,_=()=>{return this.pause(),this.off(H5,_),this.off(_6,_),this.off("end",_),q=!0,{done:!0,value:void 0}},j=()=>{if(q)return _();let K=this.read();return K===null?_():{done:!1,value:K}};return this.once("end",_),this.once(H5,_),this.once(_6,_),{next:j,throw:_,return:_,[Symbol.iterator](){return this}}}destroy(q){if(this[_6]){if(q)this.emit("error",q);else this.emit(_6);return this}this[_6]=!0,this[o6]=!0,this[z6].length=0,this[W6]=0;let _=this;if(typeof _.close==="function"&&!this[P4])_.close();if(q)this.emit("error",q);else this.emit(_6);return this}static get isStream(){return xD}}var jV=_V.native,r3={lstatSync:UD,readdir:sD,readdirSync:QD,readlinkSync:qV,realpathSync:jV,promises:{lstat:PV,readdir:YV,readlink:fV,realpath:$V}},EO=(q)=>!q||q===r3||q===KV?r3:{...r3,...q,promises:{...r3.promises,...q.promises||{}}},RO=/^\\\\\?\\([a-z]:)\\?$/i,OV=(q)=>q.replace(/\//g,"\\").replace(RO,"$1\\"),wV=/[\\\/]/,Yq=0,IO=1,mO=2,Rq=4,gO=6,yO=8,x_=10,dO=12,Pq=15,c3=~Pq,A5=16,MO=32,i3=64,Aq=128,O4=256,z4=512,NO=i3|Aq|z4,zV=1023,G5=(q)=>q.isFile()?yO:q.isDirectory()?Rq:q.isSymbolicLink()?x_:q.isCharacterDevice()?mO:q.isBlockDevice()?gO:q.isSocket()?dO:q.isFIFO()?IO:Yq,bO=new Map,o3=(q)=>{let _=bO.get(q);if(_)return _;let j=q.normalize("NFKD");return bO.set(q,j),j},SO=new Map,w4=(q)=>{let _=SO.get(q);if(_)return _;let j=o3(q.toLowerCase());return SO.set(q,j),j};class h5 extends L3{constructor(){super({max:256})}}class LO extends L3{constructor(q=16384){super({maxSize:q,sizeCalculation:(_)=>_.length+1})}}var pO=Symbol("PathScurry setAsCwd");class R6{name;root;roots;parent;nocase;isCWD=!1;#q;#_;get dev(){return this.#_}#Y;get mode(){return this.#Y}#P;get nlink(){return this.#P}#f;get uid(){return this.#f}#G;get gid(){return this.#G}#X;get rdev(){return this.#X}#z;get blksize(){return this.#z}#$;get ino(){return this.#$}#v;get size(){return this.#v}#W;get blocks(){return this.#W}#O;get atimeMs(){return this.#O}#K;get mtimeMs(){return this.#K}#J;get ctimeMs(){return this.#J}#u;get birthtimeMs(){return this.#u}#A;get atime(){return this.#A}#T;get mtime(){return this.#T}#b;get ctime(){return this.#b}#Z;get birthtime(){return this.#Z}#C;#M;#k;#h;#N;#H;#j;#m;#S;#D;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(q,_=Yq,j,K,Y,f,P){if(this.name=q,this.#C=Y?w4(q):o3(q),this.#j=_&zV,this.nocase=Y,this.roots=K,this.root=j||this,this.#m=f,this.#k=P.fullpath,this.#N=P.relative,this.#H=P.relativePosix,this.parent=P.parent,this.parent)this.#q=this.parent.#q;else this.#q=EO(P.fs)}depth(){if(this.#M!==void 0)return this.#M;if(!this.parent)return this.#M=0;return this.#M=this.parent.depth()+1}childrenCache(){return this.#m}resolve(q){if(!q)return this;let _=this.getRootString(q),K=q.substring(_.length).split(this.splitSep);return _?this.getRoot(_).#n(K):this.#n(K)}#n(q){let _=this;for(let j of q)_=_.child(j);return _}children(){let q=this.#m.get(this);if(q)return q;let _=Object.assign([],{provisional:0});return this.#m.set(this,_),this.#j&=~A5,_}child(q,_){if(q===""||q===".")return this;if(q==="..")return this.parent||this;let j=this.children(),K=this.nocase?w4(q):o3(q);for(let $ of j)if($.#C===K)return $;let Y=this.parent?this.sep:"",f=this.#k?this.#k+Y+q:void 0,P=this.newChild(q,Yq,{..._,parent:this,fullpath:f});if(!this.canReaddir())P.#j|=Aq;return j.push(P),P}relative(){if(this.isCWD)return"";if(this.#N!==void 0)return this.#N;let q=this.name,_=this.parent;if(!_)return this.#N=this.name;let j=_.relative();return j+(!j||!_.parent?"":this.sep)+q}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#H!==void 0)return this.#H;let q=this.name,_=this.parent;if(!_)return this.#H=this.fullpathPosix();let j=_.relativePosix();return j+(!j||!_.parent?"":"/")+q}fullpath(){if(this.#k!==void 0)return this.#k;let q=this.name,_=this.parent;if(!_)return this.#k=this.name;let K=_.fullpath()+(!_.parent?"":this.sep)+q;return this.#k=K}fullpathPosix(){if(this.#h!==void 0)return this.#h;if(this.sep==="/")return this.#h=this.fullpath();if(!this.parent){let K=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(K))return this.#h=`//?/${K}`;else return this.#h=K}let q=this.parent,_=q.fullpathPosix(),j=_+(!_||!q.parent?"":"/")+this.name;return this.#h=j}isUnknown(){return(this.#j&Pq)===Yq}isType(q){return this[`is${q}`]()}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.#j&Pq)===yO}isDirectory(){return(this.#j&Pq)===Rq}isCharacterDevice(){return(this.#j&Pq)===mO}isBlockDevice(){return(this.#j&Pq)===gO}isFIFO(){return(this.#j&Pq)===IO}isSocket(){return(this.#j&Pq)===dO}isSymbolicLink(){return(this.#j&x_)===x_}lstatCached(){return this.#j&MO?this:void 0}readlinkCached(){return this.#S}realpathCached(){return this.#D}readdirCached(){let q=this.children();return q.slice(0,q.provisional)}canReadlink(){if(this.#S)return!0;if(!this.parent)return!1;let q=this.#j&Pq;return!(q!==Yq&&q!==x_||this.#j&O4||this.#j&Aq)}calledReaddir(){return!!(this.#j&A5)}isENOENT(){return!!(this.#j&Aq)}isNamed(q){return!this.nocase?this.#C===o3(q):this.#C===w4(q)}async readlink(){let q=this.#S;if(q)return q;if(!this.canReadlink())return;if(!this.parent)return;try{let _=await this.#q.promises.readlink(this.fullpath()),j=(await this.parent.realpath())?.resolve(_);if(j)return this.#S=j}catch(_){this.#c(_.code);return}}readlinkSync(){let q=this.#S;if(q)return q;if(!this.canReadlink())return;if(!this.parent)return;try{let _=this.#q.readlinkSync(this.fullpath()),j=this.parent.realpathSync()?.resolve(_);if(j)return this.#S=j}catch(_){this.#c(_.code);return}}#V(q){this.#j|=A5;for(let _=q.provisional;_<q.length;_++){let j=q[_];if(j)j.#p()}}#p(){if(this.#j&Aq)return;this.#j=(this.#j|Aq)&c3,this.#g()}#g(){let q=this.children();q.provisional=0;for(let _ of q)_.#p()}#l(){this.#j|=z4,this.#y()}#y(){if(this.#j&i3)return;let q=this.#j;if((q&Pq)===Rq)q&=c3;this.#j=q|i3,this.#g()}#E(q=""){if(q==="ENOTDIR"||q==="EPERM")this.#y();else if(q==="ENOENT")this.#p();else this.children().provisional=0}#I(q=""){if(q==="ENOTDIR")this.parent.#y();else if(q==="ENOENT")this.#p()}#c(q=""){let _=this.#j;if(_|=O4,q==="ENOENT")_|=Aq;if(q==="EINVAL"||q==="UNKNOWN")_&=c3;if(this.#j=_,q==="ENOTDIR"&&this.parent)this.parent.#y()}#d(q,_){return this.#w(q,_)||this.#r(q,_)}#r(q,_){let j=G5(q),K=this.newChild(q.name,j,{parent:this}),Y=K.#j&Pq;if(Y!==Rq&&Y!==x_&&Y!==Yq)K.#j|=i3;return _.unshift(K),_.provisional++,K}#w(q,_){for(let j=_.provisional;j<_.length;j++){let K=_[j];if((this.nocase?w4(q.name):o3(q.name))!==K.#C)continue;return this.#i(q,K,j,_)}}#i(q,_,j,K){let Y=_.name;if(_.#j=_.#j&c3|G5(q),Y!==q.name)_.name=q.name;if(j!==K.provisional){if(j===K.length-1)K.pop();else K.splice(j,1);K.unshift(_)}return K.provisional++,_}async lstat(){if((this.#j&Aq)===0)try{return this.#L(await this.#q.promises.lstat(this.fullpath())),this}catch(q){this.#I(q.code)}}lstatSync(){if((this.#j&Aq)===0)try{return this.#L(this.#q.lstatSync(this.fullpath())),this}catch(q){this.#I(q.code)}}#L(q){let{atime:_,atimeMs:j,birthtime:K,birthtimeMs:Y,blksize:f,blocks:P,ctime:$,ctimeMs:w,dev:O,gid:z,ino:W,mode:v,mtime:H,mtimeMs:T,nlink:J,rdev:k,size:A,uid:G}=q;this.#A=_,this.#O=j,this.#Z=K,this.#u=Y,this.#z=f,this.#W=P,this.#b=$,this.#J=w,this.#_=O,this.#G=z,this.#$=W,this.#Y=v,this.#T=H,this.#K=T,this.#P=J,this.#X=k,this.#v=A,this.#f=G;let u=G5(q);if(this.#j=this.#j&c3|u|MO,u!==Yq&&u!==Rq&&u!==x_)this.#j|=i3}#R=[];#x=!1;#a(q){this.#x=!1;let _=this.#R.slice();this.#R.length=0,_.forEach((j)=>j(null,q))}readdirCB(q,_=!1){if(!this.canReaddir()){if(_)q(null,[]);else queueMicrotask(()=>q(null,[]));return}let j=this.children();if(this.calledReaddir()){let Y=j.slice(0,j.provisional);if(_)q(null,Y);else queueMicrotask(()=>q(null,Y));return}if(this.#R.push(q),this.#x)return;this.#x=!0;let K=this.fullpath();this.#q.readdir(K,{withFileTypes:!0},(Y,f)=>{if(Y)this.#E(Y.code),j.provisional=0;else{for(let P of f)this.#d(P,j);this.#V(j)}this.#a(j.slice(0,j.provisional));return})}#o;async readdir(){if(!this.canReaddir())return[];let q=this.children();if(this.calledReaddir())return q.slice(0,q.provisional);let _=this.fullpath();if(this.#o)await this.#o;else{let j=()=>{};this.#o=new Promise((K)=>j=K);try{for(let K of await this.#q.promises.readdir(_,{withFileTypes:!0}))this.#d(K,q);this.#V(q)}catch(K){this.#E(K.code),q.provisional=0}this.#o=void 0,j()}return q.slice(0,q.provisional)}readdirSync(){if(!this.canReaddir())return[];let q=this.children();if(this.calledReaddir())return q.slice(0,q.provisional);let _=this.fullpath();try{for(let j of this.#q.readdirSync(_,{withFileTypes:!0}))this.#d(j,q);this.#V(q)}catch(j){this.#E(j.code),q.provisional=0}return q.slice(0,q.provisional)}canReaddir(){if(this.#j&NO)return!1;let q=Pq&this.#j;if(!(q===Yq||q===Rq||q===x_))return!1;return!0}shouldWalk(q,_){return(this.#j&Rq)===Rq&&!(this.#j&NO)&&!q.has(this)&&(!_||_(this))}async realpath(){if(this.#D)return this.#D;if((z4|O4|Aq)&this.#j)return;try{let q=await this.#q.promises.realpath(this.fullpath());return this.#D=this.resolve(q)}catch(q){this.#l()}}realpathSync(){if(this.#D)return this.#D;if((z4|O4|Aq)&this.#j)return;try{let q=this.#q.realpathSync(this.fullpath());return this.#D=this.resolve(q)}catch(q){this.#l()}}[pO](q){if(q===this)return;q.isCWD=!1,this.isCWD=!0;let _=new Set([]),j=[],K=this;while(K&&K.parent)_.add(K),K.#N=j.join(this.sep),K.#H=j.join("/"),K=K.parent,j.push("..");K=q;while(K&&K.parent&&!_.has(K))K.#N=void 0,K.#H=void 0,K=K.parent}}class W4 extends R6{sep="\\";splitSep=wV;constructor(q,_=Yq,j,K,Y,f,P){super(q,_,j,K,Y,f,P)}newChild(q,_=Yq,j={}){return new W4(q,_,this.root,this.roots,this.nocase,this.childrenCache(),j)}getRootString(q){return u5.parse(q).root}getRoot(q){if(q=OV(q.toUpperCase()),q===this.root.name)return this.root;for(let[_,j]of Object.entries(this.roots))if(this.sameRoot(q,_))return this.roots[q]=j;return this.roots[q]=new a3(q,this).root}sameRoot(q,_=this.root.name){return q=q.toUpperCase().replace(/\//g,"\\").replace(RO,"$1\\"),q===_}}class v4 extends R6{splitSep="/";sep="/";constructor(q,_=Yq,j,K,Y,f,P){super(q,_,j,K,Y,f,P)}getRootString(q){return q.startsWith("/")?"/":""}getRoot(q){return this.root}newChild(q,_=Yq,j={}){return new v4(q,_,this.root,this.roots,this.nocase,this.childrenCache(),j)}}class C5{root;rootPath;roots;cwd;#q;#_;#Y;nocase;#P;constructor(q=process.cwd(),_,j,{nocase:K,childrenCacheSize:Y=16384,fs:f=r3}={}){if(this.#P=EO(f),q instanceof URL||q.startsWith("file://"))q=eD(q);let P=_.resolve(q);this.roots=Object.create(null),this.rootPath=this.parseRootPath(P),this.#q=new h5,this.#_=new h5,this.#Y=new LO(Y);let $=P.substring(this.rootPath.length).split(j);if($.length===1&&!$[0])$.pop();if(K===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=K,this.root=this.newRoot(this.#P),this.roots[this.rootPath]=this.root;let w=this.root,O=$.length-1,z=_.sep,W=this.rootPath,v=!1;for(let H of $){let T=O--;w=w.child(H,{relative:new Array(T).fill("..").join(z),relativePosix:new Array(T).fill("..").join("/"),fullpath:W+=(v?"":z)+H}),v=!0}this.cwd=w}depth(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.depth()}childrenCache(){return this.#Y}resolve(...q){let _="";for(let Y=q.length-1;Y>=0;Y--){let f=q[Y];if(!f||f===".")continue;if(_=_?`${f}/${_}`:f,this.isAbsolute(f))break}let j=this.#q.get(_);if(j!==void 0)return j;let K=this.cwd.resolve(_).fullpath();return this.#q.set(_,K),K}resolvePosix(...q){let _="";for(let Y=q.length-1;Y>=0;Y--){let f=q[Y];if(!f||f===".")continue;if(_=_?`${f}/${_}`:f,this.isAbsolute(f))break}let j=this.#_.get(_);if(j!==void 0)return j;let K=this.cwd.resolve(_).fullpathPosix();return this.#_.set(_,K),K}relative(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.relative()}relativePosix(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.relativePosix()}basename(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.name}dirname(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return(q.parent||q).fullpath()}async readdir(q=this.cwd,_={withFileTypes:!0}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof R6))_=q,q=this.cwd;let{withFileTypes:j}=_;if(!q.canReaddir())return[];else{let K=await q.readdir();return j?K:K.map((Y)=>Y.name)}}readdirSync(q=this.cwd,_={withFileTypes:!0}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof R6))_=q,q=this.cwd;let{withFileTypes:j=!0}=_;if(!q.canReaddir())return[];else if(j)return q.readdirSync();else return q.readdirSync().map((K)=>K.name)}async lstat(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.lstat()}lstatSync(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.lstatSync()}async readlink(q=this.cwd,{withFileTypes:_}={withFileTypes:!1}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof R6))_=q.withFileTypes,q=this.cwd;let j=await q.readlink();return _?j:j?.fullpath()}readlinkSync(q=this.cwd,{withFileTypes:_}={withFileTypes:!1}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof R6))_=q.withFileTypes,q=this.cwd;let j=q.readlinkSync();return _?j:j?.fullpath()}async realpath(q=this.cwd,{withFileTypes:_}={withFileTypes:!1}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof R6))_=q.withFileTypes,q=this.cwd;let j=await q.realpath();return _?j:j?.fullpath()}realpathSync(q=this.cwd,{withFileTypes:_}={withFileTypes:!1}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof R6))_=q.withFileTypes,q=this.cwd;let j=q.realpathSync();return _?j:j?.fullpath()}async walk(q=this.cwd,_={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof R6))_=q,q=this.cwd;let{withFileTypes:j=!0,follow:K=!1,filter:Y,walkFilter:f}=_,P=[];if(!Y||Y(q))P.push(j?q:q.fullpath());let $=new Set,w=(z,W)=>{$.add(z),z.readdirCB((v,H)=>{if(v)return W(v);let T=H.length;if(!T)return W();let J=()=>{if(--T===0)W()};for(let k of H){if(!Y||Y(k))P.push(j?k:k.fullpath());if(K&&k.isSymbolicLink())k.realpath().then((A)=>A?.isUnknown()?A.lstat():A).then((A)=>A?.shouldWalk($,f)?w(A,J):J());else if(k.shouldWalk($,f))w(k,J);else J()}},!0)},O=q;return new Promise((z,W)=>{w(O,(v)=>{if(v)return W(v);z(P)})})}walkSync(q=this.cwd,_={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof R6))_=q,q=this.cwd;let{withFileTypes:j=!0,follow:K=!1,filter:Y,walkFilter:f}=_,P=[];if(!Y||Y(q))P.push(j?q:q.fullpath());let $=new Set([q]);for(let w of $){let O=w.readdirSync();for(let z of O){if(!Y||Y(z))P.push(j?z:z.fullpath());let W=z;if(z.isSymbolicLink()){if(!(K&&(W=z.realpathSync())))continue;if(W.isUnknown())W.lstatSync()}if(W.shouldWalk($,f))$.add(W)}}return P}[Symbol.asyncIterator](){return this.iterate()}iterate(q=this.cwd,_={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof R6))_=q,q=this.cwd;return this.stream(q,_)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(q=this.cwd,_={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof R6))_=q,q=this.cwd;let{withFileTypes:j=!0,follow:K=!1,filter:Y,walkFilter:f}=_;if(!Y||Y(q))yield j?q:q.fullpath();let P=new Set([q]);for(let $ of P){let w=$.readdirSync();for(let O of w){if(!Y||Y(O))yield j?O:O.fullpath();let z=O;if(O.isSymbolicLink()){if(!(K&&(z=O.realpathSync())))continue;if(z.isUnknown())z.lstatSync()}if(z.shouldWalk(P,f))P.add(z)}}}stream(q=this.cwd,_={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof R6))_=q,q=this.cwd;let{withFileTypes:j=!0,follow:K=!1,filter:Y,walkFilter:f}=_,P=new l_({objectMode:!0});if(!Y||Y(q))P.write(j?q:q.fullpath());let $=new Set,w=[q],O=0,z=()=>{let W=!1;while(!W){let v=w.shift();if(!v){if(O===0)P.end();return}O++,$.add(v);let H=(J,k,A=!1)=>{if(J)return P.emit("error",J);if(K&&!A){let G=[];for(let u of k)if(u.isSymbolicLink())G.push(u.realpath().then((V)=>V?.isUnknown()?V.lstat():V));if(G.length){Promise.all(G).then(()=>H(null,k,!0));return}}for(let G of k)if(G&&(!Y||Y(G))){if(!P.write(j?G:G.fullpath()))W=!0}O--;for(let G of k){let u=G.realpathCached()||G;if(u.shouldWalk($,f))w.push(u)}if(W&&!P.flowing)P.once("drain",z);else if(!T)z()},T=!0;v.readdirCB(H,!0),T=!1}};return z(),P}streamSync(q=this.cwd,_={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof R6))_=q,q=this.cwd;let{withFileTypes:j=!0,follow:K=!1,filter:Y,walkFilter:f}=_,P=new l_({objectMode:!0}),$=new Set;if(!Y||Y(q))P.write(j?q:q.fullpath());let w=[q],O=0,z=()=>{let W=!1;while(!W){let v=w.shift();if(!v){if(O===0)P.end();return}O++,$.add(v);let H=v.readdirSync();for(let T of H)if(!Y||Y(T)){if(!P.write(j?T:T.fullpath()))W=!0}O--;for(let T of H){let J=T;if(T.isSymbolicLink()){if(!(K&&(J=T.realpathSync())))continue;if(J.isUnknown())J.lstatSync()}if(J.shouldWalk($,f))w.push(J)}}if(W&&!P.flowing)P.once("drain",z)};return z(),P}chdir(q=this.cwd){let _=this.cwd;this.cwd=typeof q==="string"?this.cwd.resolve(q):q,this.cwd[pO](_)}}class a3 extends C5{sep="\\";constructor(q=process.cwd(),_={}){let{nocase:j=!0}=_;super(q,u5,"\\",{..._,nocase:j});this.nocase=j;for(let K=this.cwd;K;K=K.parent)K.nocase=this.nocase}parseRootPath(q){return u5.parse(q).root.toUpperCase()}newRoot(q){return new W4(this.rootPath,Rq,void 0,this.roots,this.nocase,this.childrenCache(),{fs:q})}isAbsolute(q){return q.startsWith("/")||q.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(q)}}class B3 extends C5{sep="/";constructor(q=process.cwd(),_={}){let{nocase:j=!1}=_;super(q,FD,"/",{..._,nocase:j});this.nocase=j}parseRootPath(q){return"/"}newRoot(q){return new v4(this.rootPath,Rq,void 0,this.roots,this.nocase,this.childrenCache(),{fs:q})}isAbsolute(q){return q.startsWith("/")}}class H4 extends B3{constructor(q=process.cwd(),_={}){let{nocase:j=!0}=_;super(q,{..._,nocase:j})}}var oE=process.platform==="win32"?W4:v4,lO=process.platform==="win32"?a3:process.platform==="darwin"?H4:B3;var WV=(q)=>q.length>=1,vV=(q)=>q.length>=1;class LK{#q;#_;#Y;length;#P;#f;#G;#X;#z;#$;#v=!0;constructor(q,_,j,K){if(!WV(q))throw new TypeError("empty pattern list");if(!vV(_))throw new TypeError("empty glob list");if(_.length!==q.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=q.length,j<0||j>=this.length)throw new TypeError("index out of range");if(this.#q=q,this.#_=_,this.#Y=j,this.#P=K,this.#Y===0){if(this.isUNC()){let[Y,f,P,$,...w]=this.#q,[O,z,W,v,...H]=this.#_;if(w[0]==="")w.shift(),H.shift();let T=[Y,f,P,$,""].join("/"),J=[O,z,W,v,""].join("/");this.#q=[T,...w],this.#_=[J,...H],this.length=this.#q.length}else if(this.isDrive()||this.isAbsolute()){let[Y,...f]=this.#q,[P,...$]=this.#_;if(f[0]==="")f.shift(),$.shift();let w=Y+"/",O=P+"/";this.#q=[w,...f],this.#_=[O,...$],this.length=this.#q.length}}}pattern(){return this.#q[this.#Y]}isString(){return typeof this.#q[this.#Y]==="string"}isGlobstar(){return this.#q[this.#Y]===X6}isRegExp(){return this.#q[this.#Y]instanceof RegExp}globString(){return this.#G=this.#G||(this.#Y===0?this.isAbsolute()?this.#_[0]+this.#_.slice(1).join("/"):this.#_.join("/"):this.#_.slice(this.#Y).join("/"))}hasMore(){return this.length>this.#Y+1}rest(){if(this.#f!==void 0)return this.#f;if(!this.hasMore())return this.#f=null;return this.#f=new LK(this.#q,this.#_,this.#Y+1,this.#P),this.#f.#$=this.#$,this.#f.#z=this.#z,this.#f.#X=this.#X,this.#f}isUNC(){let q=this.#q;return this.#z!==void 0?this.#z:this.#z=this.#P==="win32"&&this.#Y===0&&q[0]===""&&q[1]===""&&typeof q[2]==="string"&&!!q[2]&&typeof q[3]==="string"&&!!q[3]}isDrive(){let q=this.#q;return this.#X!==void 0?this.#X:this.#X=this.#P==="win32"&&this.#Y===0&&this.length>1&&typeof q[0]==="string"&&/^[a-z]:$/i.test(q[0])}isAbsolute(){let q=this.#q;return this.#$!==void 0?this.#$:this.#$=q[0]===""&&q.length>1||this.isDrive()||this.isUNC()}root(){let q=this.#q[0];return typeof q==="string"&&this.isAbsolute()&&this.#Y===0?q:""}checkFollowGlobstar(){return!(this.#Y===0||!this.isGlobstar()||!this.#v)}markFollowGlobstar(){if(this.#Y===0||!this.isGlobstar()||!this.#v)return!1;return this.#v=!1,!0}}var HV=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class t3{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(q,{nobrace:_,nocase:j,noext:K,noglobstar:Y,platform:f=HV}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=f,this.mmopts={dot:!0,nobrace:_,nocase:j,noext:K,noglobstar:Y,optimizationLevel:2,platform:f,nocomment:!0,nonegate:!0};for(let P of q)this.add(P)}add(q){let _=new jq(q,this.mmopts);for(let j=0;j<_.set.length;j++){let K=_.set[j],Y=_.globParts[j];if(!K||!Y)throw new Error("invalid pattern object");while(K[0]==="."&&Y[0]===".")K.shift(),Y.shift();let f=new LK(K,Y,0,this.platform),P=new jq(f.globString(),this.mmopts),$=Y[Y.length-1]==="**",w=f.isAbsolute();if(w)this.absolute.push(P);else this.relative.push(P);if($)if(w)this.absoluteChildren.push(P);else this.relativeChildren.push(P)}}ignored(q){let _=q.fullpath(),j=`${_}/`,K=q.relative()||".",Y=`${K}/`;for(let f of this.relative)if(f.match(K)||f.match(Y))return!0;for(let f of this.absolute)if(f.match(_)||f.match(j))return!0;return!1}childrenIgnored(q){let _=q.fullpath()+"/",j=(q.relative()||".")+"/";for(let K of this.relativeChildren)if(K.match(j))return!0;for(let K of this.absoluteChildren)if(K.match(_))return!0;return!1}}class D5{store;constructor(q=new Map){this.store=q}copy(){return new D5(new Map(this.store))}hasWalked(q,_){return this.store.get(q.fullpath())?.has(_.globString())}storeWalked(q,_){let j=q.fullpath(),K=this.store.get(j);if(K)K.add(_.globString());else this.store.set(j,new Set([_.globString()]))}}class xO{store=new Map;add(q,_,j){let K=(_?2:0)|(j?1:0),Y=this.store.get(q);this.store.set(q,Y===void 0?K:K&Y)}entries(){return[...this.store.entries()].map(([q,_])=>[q,!!(_&2),!!(_&1)])}}class nO{store=new Map;add(q,_){if(!q.canReaddir())return;let j=this.store.get(q);if(j){if(!j.find((K)=>K.globString()===_.globString()))j.push(_)}else this.store.set(q,[_])}get(q){let _=this.store.get(q);if(!_)throw new Error("attempting to walk unknown path");return _}entries(){return this.keys().map((q)=>[q,this.store.get(q)])}keys(){return[...this.store.keys()].filter((q)=>q.canReaddir())}}class F3{hasWalkedCache;matches=new xO;subwalks=new nO;patterns;follow;dot;opts;constructor(q,_){this.opts=q,this.follow=!!q.follow,this.dot=!!q.dot,this.hasWalkedCache=_?_.copy():new D5}processPatterns(q,_){this.patterns=_;let j=_.map((K)=>[q,K]);for(let[K,Y]of j){this.hasWalkedCache.storeWalked(K,Y);let f=Y.root(),P=Y.isAbsolute()&&this.opts.absolute!==!1;if(f){K=K.resolve(f==="/"&&this.opts.root!==void 0?this.opts.root:f);let z=Y.rest();if(!z){this.matches.add(K,!0,!1);continue}else Y=z}if(K.isENOENT())continue;let $,w,O=!1;while(typeof($=Y.pattern())==="string"&&(w=Y.rest()))K=K.resolve($),Y=w,O=!0;if($=Y.pattern(),w=Y.rest(),O){if(this.hasWalkedCache.hasWalked(K,Y))continue;this.hasWalkedCache.storeWalked(K,Y)}if(typeof $==="string"){let z=$===".."||$===""||$===".";this.matches.add(K.resolve($),P,z);continue}else if($===X6){if(!K.isSymbolicLink()||this.follow||Y.checkFollowGlobstar())this.subwalks.add(K,Y);let z=w?.pattern(),W=w?.rest();if(!w||(z===""||z===".")&&!W)this.matches.add(K,P,z===""||z===".");else if(z===".."){let v=K.parent||K;if(!W)this.matches.add(v,P,!0);else if(!this.hasWalkedCache.hasWalked(v,W))this.subwalks.add(v,W)}}else if($ instanceof RegExp)this.subwalks.add(K,Y)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new F3(this.opts,this.hasWalkedCache)}filterEntries(q,_){let j=this.subwalks.get(q),K=this.child();for(let Y of _)for(let f of j){let P=f.isAbsolute(),$=f.pattern(),w=f.rest();if($===X6)K.testGlobstar(Y,f,w,P);else if($ instanceof RegExp)K.testRegExp(Y,$,w,P);else K.testString(Y,$,w,P)}return K}testGlobstar(q,_,j,K){if(this.dot||!q.name.startsWith(".")){if(!_.hasMore())this.matches.add(q,K,!1);if(q.canReaddir()){if(this.follow||!q.isSymbolicLink())this.subwalks.add(q,_);else if(q.isSymbolicLink()){if(j&&_.checkFollowGlobstar())this.subwalks.add(q,j);else if(_.markFollowGlobstar())this.subwalks.add(q,_)}}}if(j){let Y=j.pattern();if(typeof Y==="string"&&Y!==".."&&Y!==""&&Y!==".")this.testString(q,Y,j.rest(),K);else if(Y===".."){let f=q.parent||q;this.subwalks.add(f,j)}else if(Y instanceof RegExp)this.testRegExp(q,Y,j.rest(),K)}}testRegExp(q,_,j,K){if(!_.test(q.name))return;if(!j)this.matches.add(q,K,!1);else this.subwalks.add(q,j)}testString(q,_,j,K){if(!q.isNamed(_))return;if(!j)this.matches.add(q,K,!1);else this.subwalks.add(q,j)}}var JV=(q,_)=>typeof q==="string"?new t3([q],_):Array.isArray(q)?new t3(q,_):q;class V5{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#q=[];#_;#Y;signal;maxDepth;includeChildMatches;constructor(q,_,j){if(this.patterns=q,this.path=_,this.opts=j,this.#Y=!j.posix&&j.platform==="win32"?"\\":"/",this.includeChildMatches=j.includeChildMatches!==!1,j.ignore||!this.includeChildMatches){if(this.#_=JV(j.ignore??[],j),!this.includeChildMatches&&typeof this.#_.add!=="function")throw new Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=j.maxDepth||1/0,j.signal)this.signal=j.signal,this.signal.addEventListener("abort",()=>{this.#q.length=0})}#P(q){return this.seen.has(q)||!!this.#_?.ignored?.(q)}#f(q){return!!this.#_?.childrenIgnored?.(q)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let q=void 0;while(!this.paused&&(q=this.#q.shift()))q()}onResume(q){if(this.signal?.aborted)return;if(!this.paused)q();else this.#q.push(q)}async matchCheck(q,_){if(_&&this.opts.nodir)return;let j;if(this.opts.realpath){if(j=q.realpathCached()||await q.realpath(),!j)return;q=j}let Y=q.isUnknown()||this.opts.stat?await q.lstat():q;if(this.opts.follow&&this.opts.nodir&&Y?.isSymbolicLink()){let f=await Y.realpath();if(f&&(f.isUnknown()||this.opts.stat))await f.lstat()}return this.matchCheckTest(Y,_)}matchCheckTest(q,_){return q&&(this.maxDepth===1/0||q.depth()<=this.maxDepth)&&(!_||q.canReaddir())&&(!this.opts.nodir||!q.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!q.isSymbolicLink()||!q.realpathCached()?.isDirectory())&&!this.#P(q)?q:void 0}matchCheckSync(q,_){if(_&&this.opts.nodir)return;let j;if(this.opts.realpath){if(j=q.realpathCached()||q.realpathSync(),!j)return;q=j}let Y=q.isUnknown()||this.opts.stat?q.lstatSync():q;if(this.opts.follow&&this.opts.nodir&&Y?.isSymbolicLink()){let f=Y.realpathSync();if(f&&(f?.isUnknown()||this.opts.stat))f.lstatSync()}return this.matchCheckTest(Y,_)}matchFinish(q,_){if(this.#P(q))return;if(!this.includeChildMatches&&this.#_?.add){let Y=`${q.relativePosix()}/**`;this.#_.add(Y)}let j=this.opts.absolute===void 0?_:this.opts.absolute;this.seen.add(q);let K=this.opts.mark&&q.isDirectory()?this.#Y:"";if(this.opts.withFileTypes)this.matchEmit(q);else if(j){let Y=this.opts.posix?q.fullpathPosix():q.fullpath();this.matchEmit(Y+K)}else{let Y=this.opts.posix?q.relativePosix():q.relative(),f=this.opts.dotRelative&&!Y.startsWith(".."+this.#Y)?"."+this.#Y:"";this.matchEmit(!Y?"."+K:f+Y+K)}}async match(q,_,j){let K=await this.matchCheck(q,j);if(K)this.matchFinish(K,_)}matchSync(q,_,j){let K=this.matchCheckSync(q,j);if(K)this.matchFinish(K,_)}walkCB(q,_,j){if(this.signal?.aborted)j();this.walkCB2(q,_,new F3(this.opts),j)}walkCB2(q,_,j,K){if(this.#f(q))return K();if(this.signal?.aborted)K();if(this.paused){this.onResume(()=>this.walkCB2(q,_,j,K));return}j.processPatterns(q,_);let Y=1,f=()=>{if(--Y===0)K()};for(let[P,$,w]of j.matches.entries()){if(this.#P(P))continue;Y++,this.match(P,$,w).then(()=>f())}for(let P of j.subwalkTargets()){if(this.maxDepth!==1/0&&P.depth()>=this.maxDepth)continue;Y++;let $=P.readdirCached();if(P.calledReaddir())this.walkCB3(P,$,j,f);else P.readdirCB((w,O)=>this.walkCB3(P,O,j,f),!0)}f()}walkCB3(q,_,j,K){j=j.filterEntries(q,_);let Y=1,f=()=>{if(--Y===0)K()};for(let[P,$,w]of j.matches.entries()){if(this.#P(P))continue;Y++,this.match(P,$,w).then(()=>f())}for(let[P,$]of j.subwalks.entries())Y++,this.walkCB2(P,$,j.child(),f);f()}walkCBSync(q,_,j){if(this.signal?.aborted)j();this.walkCB2Sync(q,_,new F3(this.opts),j)}walkCB2Sync(q,_,j,K){if(this.#f(q))return K();if(this.signal?.aborted)K();if(this.paused){this.onResume(()=>this.walkCB2Sync(q,_,j,K));return}j.processPatterns(q,_);let Y=1,f=()=>{if(--Y===0)K()};for(let[P,$,w]of j.matches.entries()){if(this.#P(P))continue;this.matchSync(P,$,w)}for(let P of j.subwalkTargets()){if(this.maxDepth!==1/0&&P.depth()>=this.maxDepth)continue;Y++;let $=P.readdirSync();this.walkCB3Sync(P,$,j,f)}f()}walkCB3Sync(q,_,j,K){j=j.filterEntries(q,_);let Y=1,f=()=>{if(--Y===0)K()};for(let[P,$,w]of j.matches.entries()){if(this.#P(P))continue;this.matchSync(P,$,w)}for(let[P,$]of j.subwalks.entries())Y++,this.walkCB2Sync(P,$,j.child(),f);f()}}class J4 extends V5{matches=new Set;constructor(q,_,j){super(q,_,j)}matchEmit(q){this.matches.add(q)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((q,_)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)_(this.signal.reason);else q(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 T4 extends V5{results;constructor(q,_,j){super(q,_,j);this.results=new l_({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(q){if(this.results.write(q),!this.results.flowing)this.pause()}stream(){let q=this.path;if(q.isUnknown())q.lstat().then(()=>{this.walkCB(q,this.patterns,()=>this.results.end())});else this.walkCB(q,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 ZV=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class Iq{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(q,_){if(!_)throw new TypeError("glob options required");if(this.withFileTypes=!!_.withFileTypes,this.signal=_.signal,this.follow=!!_.follow,this.dot=!!_.dot,this.dotRelative=!!_.dotRelative,this.nodir=!!_.nodir,this.mark=!!_.mark,!_.cwd)this.cwd="";else if(_.cwd instanceof URL||_.cwd.startsWith("file://"))_.cwd=TV(_.cwd);if(this.cwd=_.cwd||"",this.root=_.root,this.magicalBraces=!!_.magicalBraces,this.nobrace=!!_.nobrace,this.noext=!!_.noext,this.realpath=!!_.realpath,this.absolute=_.absolute,this.includeChildMatches=_.includeChildMatches!==!1,this.noglobstar=!!_.noglobstar,this.matchBase=!!_.matchBase,this.maxDepth=typeof _.maxDepth==="number"?_.maxDepth:1/0,this.stat=!!_.stat,this.ignore=_.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof q==="string")q=[q];if(this.windowsPathsNoEscape=!!_.windowsPathsNoEscape||_.allowWindowsEscape===!1,this.windowsPathsNoEscape)q=q.map(($)=>$.replace(/\\/g,"/"));if(this.matchBase){if(_.noglobstar)throw new TypeError("base matching requires globstar");q=q.map(($)=>$.includes("/")?$:`./**/${$}`)}if(this.pattern=q,this.platform=_.platform||ZV,this.opts={..._,platform:this.platform},_.scurry){if(this.scurry=_.scurry,_.nocase!==void 0&&_.nocase!==_.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let $=_.platform==="win32"?a3:_.platform==="darwin"?H4:_.platform?B3:lO;this.scurry=new $(this.cwd,{nocase:_.nocase,fs:_.fs})}this.nocase=this.scurry.nocase;let j=this.platform==="darwin"||this.platform==="win32",K={..._,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:j,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},Y=this.pattern.map(($)=>new jq($,K)),[f,P]=Y.reduce(($,w)=>{return $[0].push(...w.set),$[1].push(...w.globParts),$},[[],[]]);this.patterns=f.map(($,w)=>{let O=P[w];if(!O)throw new Error("invalid pattern object");return new LK($,O,0,this.platform)})}async walk(){return[...await new J4(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 J4(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 T4(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 T4(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 M5=(q,_={})=>{if(!Array.isArray(q))q=[q];for(let j of q)if(new jq(j,_).hasMagic())return!0;return!1};function k4(q,_={}){return new Iq(q,_).streamSync()}function rO(q,_={}){return new Iq(q,_).stream()}function iO(q,_={}){return new Iq(q,_).walkSync()}async function cO(q,_={}){return new Iq(q,_).walk()}function X4(q,_={}){return new Iq(q,_).iterateSync()}function oO(q,_={}){return new Iq(q,_).iterate()}var kV=k4,XV=Object.assign(rO,{sync:k4}),AV=X4,GV=Object.assign(oO,{sync:X4}),uV=Object.assign(iO,{stream:k4,iterate:X4}),Z4=Object.assign(cO,{glob:cO,globSync:iO,sync:uV,globStream:rO,stream:XV,globStreamSync:k4,streamSync:kV,globIterate:oO,iterate:GV,globIterateSync:X4,iterateSync:AV,Glob:Iq,hasMagic:M5,escape:mK,unescape:kq});Z4.glob=Z4;G6();async function BO(q,_={}){let j=_8.getInstance().getTrashDirectory();if(!aO(j))CV(j,{recursive:!0});let K=Array.isArray(q)?q:[q];for(let Y of K){let f=await Z4(Y),P=f.length>0?f:[Y];for(let $ of P)try{if(!aO($)){if(!_.force){console.error(`trash: ${$}: No such file or directory`);continue}continue}if(DV($).isDirectory()&&!_.recursive){if(!_.force){console.error(`trash: ${$}: is a directory`);continue}}let O=MV($),z=Date.now(),W=VV(j,`${O}.${z}`);hV($,W),console.log(`Moved ${O} to trash`)}catch(w){if(!_.force){let O=w instanceof Error?w.message:String(w);console.error(`trash: ${$}: ${O}`)}}}}NK();G6();import{readdirSync as NV,renameSync as bV}from"fs";import{join as tO}from"path";async function FO(){let q=_8.getInstance().getTrashDirectory(),_=NV(q);if(_.length===0){console.log("Trash is empty");return}let j=await aq({message:"Select file to restore:",options:_.map((K)=>({value:K,label:K}))});if(n8(j))return;bV(tO(q,j),tO(process.cwd(),j)),console.log(`Restored ${j}`)}G6();k3();import{appendFileSync as SV}from"fs";function EV(q){let j=q.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter((f)=>f.length>2).slice(0,4).join("-"),K=j.length>30?j.substring(0,27)+"...":j,Y=new Date().toISOString().substring(11,19).replace(/:/g,"");return`${K}-${Y}`}async function eO(q,_={}){if(SV("/Users/alexnewman/.claude-mem/save-debug.log",`[${new Date().toISOString()}] Received message: "${q}" (type: ${typeof q}, length: ${q?.length})
`,"utf8"),!q||q.trim()==="")console.error("Error: Message is required"),process.exit(1);let j=new Date().toISOString(),K=_8.getCurrentProjectName(),Y=EV(q),f=`${K}_${Y}_overview`;try{if(await P_())console.warn("⚠️ JSONL to SQLite migration recommended. Run: claude-mem migrate-index");let P=await j_();if(!await P.hasSession(Y))await P.createSession({session_id:Y,project:K,created_at:j,source:"save"});await P.upsertOverview({session_id:Y,content:q,created_at:j,project:K,origin:"manual"}),console.log(JSON.stringify({success:!0,document_id:f,session_id:Y,project:K,timestamp:j,backend:P.backend,suppressOutput:!0}))}catch(P){console.error("Error saving message:",P),process.exit(1)}}v7();M7();import U8 from"fs";import y6 from"path";import{execSync as UO}from"child_process";async function QO(q){try{if(q.update){await sO(q);return}let _=y6.join(process.cwd(),"package.json"),j="unknown",K="unknown";if(U8.existsSync(_))try{let b=JSON.parse(U8.readFileSync(_,"utf-8"));j=b.version||"unknown",K=b.name||y6.basename(process.cwd())}catch(b){K=y6.basename(process.cwd())}let Y=[],f=q.historical||1;if(q.generate)Y.push(q.generate),f=1,console.log(`\uD83C\uDFAF Generating changelog for specific version: ${q.generate}`);else if(j!=="unknown"){let b=j.split(".");if(b.length===3){let d=parseInt(b[0]),y=parseInt(b[1]),M=parseInt(b[2]);for(let S=0;S<f;S++)if(Y.push(`${d}.${y}.${M}`),M===0){if(y===0)break;y--,M=9}else M--}}if(Y.length===0)console.log("⚠️ Could not determine versions to search. Please check package.json"),process.exit(1);let P=y6.join(process.env.HOME||process.env.USERPROFILE||"",".claude-mem","projects"),$=y6.join(P,`${K}-changelog.jsonl`),w=!1;if(U8.existsSync($)){let b=U8.readFileSync($,"utf-8").split(`
`).filter((d)=>d.trim());for(let d of b)try{if(JSON.parse(d).version===j)w=!0}catch(y){}if(!q.historical&&!q.generate&&f===1){if(w)console.log(`❌ Version ${j} already has changelog entries.`),console.log(`
\uD83D\uDCDD Workflow:`),console.log(" 1. Make your code updates"),console.log(" 2. Build and test: bun run build"),console.log(" 3. Bump version: npm version patch"),console.log(" 4. Generate changelog: claude-mem changelog"),console.log(` 5. Commit and push
`),console.log("\uD83D\uDCA1 Or use --historical 1 to regenerate this version's changelog"),process.exit(1)}}let O=[];if(q.start&&q.end){let b=q.generate||j;O.push({version:b,startTime:q.start,endTime:q.end}),console.log(`\uD83D\uDCC5 Using custom time range for ${b}:`),console.log(` Start: ${new Date(q.start).toLocaleString()}`),console.log(` End: ${new Date(q.end).toLocaleString()}`)}else try{let b=UO(`npm view ${K} time --json`,{encoding:"utf-8",timeout:5000}),d=JSON.parse(b),y="";if(f>1){let S=Y[Y.length-1].split("."),L=parseInt(S[0]),c=parseInt(S[1]),B=parseInt(S[2]);if(B>0)y=`${L}.${c}.${B-1}`;else if(c>0){let e=`${L}.${c-1}.`,f8=Object.keys(d).filter((K8)=>K8.startsWith(e)).sort((K8,z8)=>{let O8=parseInt(K8.split(".")[2]||"0");return parseInt(z8.split(".")[2]||"0")-O8});if(f8.length>0)y=f8[0]}else if(L>0){let e=`${L-1}.`,f8=Object.keys(d).filter((K8)=>K8.startsWith(e)).sort((K8,z8)=>{let[,O8,j8]=K8.split(".").map(Number),[,G8,t8]=z8.split(".").map(Number);if(O8!==G8)return G8-O8;return t8-j8});if(f8.length>0)y=f8[0]}if(q.verbose&&y&&d[y])console.log(`\uD83D\uDCCD Using ${y} as start boundary for time ranges`)}for(let M=0;M<Y.length;M++){let S=Y[M],L="2000-01-01T00:00:00Z";if(M===0){let B=S.split("."),e=parseInt(B[0]),f8=parseInt(B[1]),K8=parseInt(B[2]),z8="";if(K8>0)z8=`${e}.${f8}.${K8-1}`;else if(f8>0){let O8=`${e}.${f8-1}.`,j8=Object.keys(d).filter((G8)=>G8.startsWith(O8)).sort((G8,t8)=>{let s8=parseInt(G8.split(".")[2]||"0");return parseInt(t8.split(".")[2]||"0")-s8});if(j8.length>0)z8=j8[0]}if(d[z8])L=d[z8]}else if(M<Y.length-1){let B=Y[M+1];if(d[B])L=d[B]}else if(y&&d[y])L=d[y];let c=d[S]||new Date().toISOString();if(O.push({version:S,startTime:L,endTime:c}),q.verbose)console.log(`\uD83D\uDCC5 Version ${S}: ${new Date(L).toLocaleString()} - ${new Date(c).toLocaleString()}`)}if(f===1){let M=O[0];if(M)console.log(`\uD83D\uDCE6 Using npm time range for ${M.version}: ${new Date(M.startTime).toLocaleString()} - ${new Date(M.endTime).toLocaleString()}`)}}catch(b){console.log("❌ Could not fetch npm publish times. Cannot proceed without time ranges."),process.exit(1)}console.log(`\uD83D\uDD0D Searching memories for versions: ${Y.join(", ")}`),console.log(`\uD83D\uDCE6 Project: ${K}
`);let z=O.length>0?`You are helping generate a changelog by searching for memories within specific time ranges for multiple versions.
PROJECT: ${K}
VERSION TIME RANGES:
${O.map((b)=>`- Version ${b.version}: ${new Date(b.startTime).toLocaleDateString()} to ${new Date(b.endTime).toLocaleDateString()}`).join(`
`)}
YOUR TASK:
Use mcp__claude-mem__chroma_query_documents to search for memories for each version time range.
SEARCH STRATEGY:
${O.map((b)=>{let d=new Date(b.startTime),y=new Date(b.endTime),M=[],S=new Date(d);while(S<=y){let L=S.toISOString().split("T")[0];M.push(L),S.setDate(S.getDate()+1)}return`
Version ${b.version} (${new Date(b.startTime).toLocaleDateString()} to ${new Date(b.endTime).toLocaleDateString()}):
1. Search for memories from these dates: ${M.join(", ")}
2. Make multiple calls to mcp__claude-mem__chroma_query_documents:
- collection_name: "claude_memories"
- query_texts: Include the project name AND date in each query:
* "${K} ${M[0]} feature"
* "${K} ${M[0]} fix"
* "${K} ${M[0]} change"
* "${K} ${M[0]} improvement"
* "${K} ${M[0]} refactor"
- n_results: 50
3. The date in the query text helps semantic search find memories from that day
4. Assign memories to this version if their timestamp falls within:
- Start: ${b.startTime}
- End: ${b.endTime}`}).join(`
`)}
IMPORTANT:
- Always include project name and date in query_texts for best results
- Semantic search will naturally find memories near those dates
- Group returned memories by version based on their timestamp metadata
Return a JSON object with this structure:
{
"memories": [
{
"version": "version_number",
"text": "memory content",
"metadata": {metadata object with timestamp},
"relevance": "high/medium/low"
}
]
}
Group memories by the version they belong to based on timestamp.
Start searching now.`:"ERROR: No time ranges available. This should never happen.";if(O.length===0)console.log("❌ No time ranges available. Cannot search memories."),process.exit(1);if(q.verbose)console.log("\uD83D\uDCDD Calling Claude to search memories...");let W=await xq({prompt:z,options:{allowedTools:["mcp__claude-mem__chroma_query_documents","mcp__claude-mem__chroma_get_documents"],pathToClaudeCodeExecutable:Hq()}}),v="";if(W&&typeof W==="object"&&Symbol.asyncIterator in W){for await(let b of W)if(b?.type==="assistant"&&b?.message?.content){let d=b.message.content;if(typeof d==="string")v+=d;else if(Array.isArray(d)){for(let y of d)if(y.type==="text"&&y.text)v+=y.text}}}let H=[];try{let b=v.match(/```json\n([\s\S]*?)\n```/)||v.match(/\{[\s\S]*\}/);if(b){let d=JSON.parse(b[1]||b[0]);if(d.memories&&Array.isArray(d.memories))H=d.memories}}catch(b){console.error("⚠️ Could not parse memory search results:",b)}if(H.length===0){console.log(`
⚠️ No version-related memories found for this version.`),console.log(" This is normal for the first release or when no changes were tracked."),console.log(" Creating a placeholder changelog entry...");let b={version:Y[0],date:J,type:"Changed",description:"Initial release or minor updates",timestamp:new Date().toISOString(),generatedAt:new Date().toISOString()};if(!U8.existsSync(P))U8.mkdirSync(P,{recursive:!0});let d=JSON.stringify(b)+`
`;U8.appendFileSync($,d),console.log(`✅ Created placeholder changelog entry for v${Y[0]}`),await sO(q);return}console.log(`✅ Found ${H.length} version-related memories
`);let J=UO('date "+%Y-%m-%d %H:%M:%S %Z"').toString().trim().split(" ")[0],k=`Analyze these memories and generate changelog entries.
PROJECT: ${K}
DATE: ${J}
MEMORIES BY VERSION:
${Y.map((b)=>{let d=H.filter((y)=>y.version===b);if(d.length===0)return`### Version ${b}
No memories found.`;return`### Version ${b} (${d.length} memories):
${d.map((y,M)=>`${M+1}. ${y.text}`).join(`
`)}`}).join(`
`)}
INSTRUCTIONS:
1. Extract concrete changes, fixes, and additions from the memories
2. Categorize each change as: Added, Changed, Fixed, Removed, Deprecated, or Security
3. Write clear, user-facing descriptions
4. Start each entry with an action verb
5. Focus on what matters to users, not internal implementation details
Return ONLY a JSON array with this structure:
[
{
"version": "3.6.1",
"type": "Added",
"description": "New feature description"
},
{
"version": "3.6.1",
"type": "Fixed",
"description": "Bug fix description"
}
]`;console.log("\uD83D\uDD04 Generating changelog entries...");let A=await xq({prompt:k,options:{allowedTools:[],pathToClaudeCodeExecutable:Hq()}}),G="";if(A&&typeof A==="object"&&Symbol.asyncIterator in A){for await(let b of A)if(b?.type==="assistant"&&b?.message?.content){let d=b.message.content;if(typeof d==="string")G+=d;else if(Array.isArray(d)){for(let y of d)if(y.type==="text"&&y.text)G+=y.text}}}let u=[];try{let b=G.match(/```json\n([\s\S]*?)\n```/)||G.match(/\[[\s\S]*\]/);if(b){let d=JSON.parse(b[1]||b[0]);if(Array.isArray(d)){let y=new Date().toISOString();u=d.map((M)=>({...M,date:J,timestamp:M.timestamp||y,generatedAt:y}))}}}catch(b){console.error("⚠️ Could not parse changelog entries:",b)}if(u.length===0)console.log("⚠️ No changelog entries generated."),process.exit(1);if(!U8.existsSync(P))U8.mkdirSync(P,{recursive:!0});if(console.log(`
\uD83D\uDCBE Saving ${u.length} changelog entries to ${y6.basename($)}`),q.historical&&f>1||q.generate){let b=[];if(U8.existsSync($)){let M=U8.readFileSync($,"utf-8").split(`
`).filter((S)=>S.trim());for(let S of M)try{let L=JSON.parse(S);if(!Y.includes(L.version))b.push(L)}catch(L){}}let y=[...b,...u].map((M)=>JSON.stringify(M)).join(`
`)+`
`;U8.writeFileSync($,y),console.log(`\uD83D\uDD04 Regenerated entries for versions: ${Y.join(", ")}`)}else{let b=u.map((d)=>JSON.stringify(d)).join(`
`)+`
`;U8.appendFileSync($,b)}console.log(`
\uD83D\uDCDD Generating CHANGELOG.md from entries...`);let V=[];if(U8.existsSync($)){let b=U8.readFileSync($,"utf-8").split(`
`).filter((d)=>d.trim());for(let d of b)try{V.push(JSON.parse(d))}catch(y){}}let m=new Map;for(let b of V){if(!m.has(b.version))m.set(b.version,[]);m.get(b.version).push(b)}let N=`# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
`,R=Array.from(m.keys()).sort((b,d)=>{let y=b.split(".").map(Number),M=d.split(".").map(Number);for(let S=0;S<3;S++)if(y[S]!==M[S])return M[S]-y[S];return 0});for(let b of R){let d=m.get(b),y=d[0].date||J;N+=`
## [${b}] - ${y}
`;let M=["Added","Changed","Fixed","Removed","Deprecated","Security"];for(let S of M){let L=d.filter((c)=>c.type===S);if(L.length>0){N+=`### ${S}
`;for(let c of L)N+=`- ${c.description}
`;N+=`
`}}}let p=y6.join(process.cwd(),"CHANGELOG.md");if(U8.writeFileSync(p,N),console.log(`✅ Generated CHANGELOG.md with ${V.length} total entries across ${m.size} versions!`),q.preview){if(console.log(`
\uD83D\uDCC4 Preview:
`),console.log(N.split(`
`).slice(0,30).join(`
`)),N.split(`
`).length>30)console.log(`
... (truncated for preview)`)}}catch(_){if(console.error("❌ Error generating changelog:",_ instanceof Error?_.message:_),_ instanceof Error&&_.stack)console.error("Stack:",_.stack);process.exit(1)}}async function sO(q){try{let _=y6.join(process.cwd(),"package.json"),j="unknown";if(U8.existsSync(_))try{j=JSON.parse(U8.readFileSync(_,"utf-8")).name||y6.basename(process.cwd())}catch(W){j=y6.basename(process.cwd())}let K=y6.join(process.env.HOME||process.env.USERPROFILE||"",".claude-mem","projects"),Y=y6.join(K,`${j}-changelog.jsonl`);if(!U8.existsSync(Y))console.log("❌ No changelog entries found. Generate some first with: claude-mem changelog"),process.exit(1);console.log("\uD83D\uDCDD Updating CHANGELOG.md from JSONL entries...");let f=[],P=U8.readFileSync(Y,"utf-8").split(`
`).filter((W)=>W.trim());for(let W of P)try{f.push(JSON.parse(W))}catch(v){}if(f.length===0)console.log("❌ No valid entries found in JSONL file"),process.exit(1);let $=new Map;for(let W of f){if(!$.has(W.version))$.set(W.version,[]);$.get(W.version).push(W)}let w=`# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
`,O=Array.from($.keys()).sort((W,v)=>{let H=W.split(".").map(Number),T=v.split(".").map(Number);for(let J=0;J<3;J++)if(H[J]!==T[J])return T[J]-H[J];return 0});for(let W of O){let v=$.get(W),H=v[0].date;w+=`
## [${W}] - ${H}
`;let T=["Added","Changed","Fixed","Removed","Deprecated","Security"];for(let J of T){let k=v.filter((A)=>A.type===J);if(k.length>0){w+=`### ${J}
`;for(let A of k)w+=`- ${A.description}
`;w+=`
`}}}let z=y6.join(process.cwd(),"CHANGELOG.md");if(U8.writeFileSync(z,w),console.log(`✅ Updated CHANGELOG.md with ${f.length} entries across ${$.size} versions!`),q.preview){if(console.log(`
\uD83D\uDCC4 Preview:
`),console.log(w.split(`
`).slice(0,30).join(`
`)),w.split(`
`).length>30)console.log(`
... (truncated for preview)`)}}catch(_){console.error("❌ Error updating changelog:",_ instanceof Error?_.message:_),process.exit(1)}}NK();import v_ from"path";import H_ from"fs";import IV from"os";d7();v7();M7();import n_ from"fs";import qw from"path";import RV from"os";class pK{titlesIndexPath;constructor(){this.titlesIndexPath=qw.join(RV.homedir(),".claude-mem","conversation-titles.jsonl"),this.ensureTitlesIndex()}ensureTitlesIndex(){let q=qw.dirname(this.titlesIndexPath);if(!n_.existsSync(q))n_.mkdirSync(q,{recursive:!0});if(!n_.existsSync(this.titlesIndexPath))n_.writeFileSync(this.titlesIndexPath,"","utf-8")}async generateTitle(q){let _=`Generate a 3-7 word descriptive title for this conversation based on the first message.
The title should:
- Capture the main topic or intent
- Be concise and descriptive
- Use proper capitalization
- Not include "Help with" or "Question about" prefixes
First message: "${q.substring(0,500)}"
Respond with just the title, nothing else.`,j=await xq({prompt:_,options:{model:"claude-3-5-haiku-20241022",pathToClaudeCodeExecutable:Hq()}}),K="";if(j&&typeof j==="object"&&Symbol.asyncIterator in j)for await(let Y of j){if(Y?.content)K+=Y.content;if(Y?.text)K+=Y.text}else if(typeof j==="string")K=j;return K.trim().replace(/^["']|["']$/g,"")}async batchGenerateTitles(q){let _=[];for(let j of q)try{let K=await this.generateTitle(j.firstMessage),Y={session_id:j.sessionId,generated_title:K,timestamp:new Date().toISOString(),project_name:j.projectName};_.push(Y),this.storeTitleInIndex(Y)}catch(K){console.error(`Failed to generate title for ${j.sessionId}:`,K)}return _}storeTitleInIndex(q){let _=JSON.stringify(q)+`
`;n_.appendFileSync(this.titlesIndexPath,_,"utf-8")}getExistingTitles(){let q=new Map;if(!n_.existsSync(this.titlesIndexPath))return q;let j=n_.readFileSync(this.titlesIndexPath,"utf-8").trim().split(`
`).filter(Boolean);for(let K of j)try{let Y=JSON.parse(K);q.set(Y.session_id,Y)}catch(Y){}return q}getTitleForSession(q){let j=this.getExistingTitles().get(q);return j?j.generated_title:null}}k3();function A4(q){if(q<1024)return`${q}B`;if(q<1048576)return`${(q/1024).toFixed(1)}KB`;return`${(q/1048576).toFixed(1)}MB`}function mV(q){let j=new Date().getTime()-q.getTime(),K=Math.floor(j/60000),Y=Math.floor(j/3600000),f=Math.floor(j/86400000);if(K<1)return"just now";if(K<60)return`${K}m ago`;if(Y<24)return`${Y}h ago`;if(f<7)return`${f}d ago`;if(f<30)return`${Math.floor(f/7)}w ago`;if(f<365)return`${Math.floor(f/30)}mo ago`;return`${Math.floor(f/365)}y ago`}function gV(q,_){try{let Y=new Date(q);if(!isNaN(Y.getTime()))return Y}catch{}let j=_.match(/(\d{4})-(\d{2})-(\d{2})_(\d{2})-(\d{2})-(\d{2})/);if(j){let[Y,f,P,$,w,O,z]=j;return new Date(parseInt(f),parseInt(P)-1,parseInt($),parseInt(w),parseInt(O),parseInt(z))}return H_.statSync(_).mtime}function yV(q){try{let j=H_.readFileSync(q,"utf-8").trim().split(`
`).filter(Boolean);for(let K of j)try{let Y=JSON.parse(K);if(Y.type==="user"&&Y.message?.content){let f=Y.message.content;if(Array.isArray(f)){let P=f.filter(($)=>$.type==="text").map(($)=>$.text).join(" ");if(P.trim())return P.trim()}else if(typeof f==="string")return f.trim()}}catch{}return"Conversation"}catch{return"Conversation"}}async function dV(){try{if(await P_())console.warn("⚠️ JSONL to SQLite migration recommended. Run: claude-mem migrate-index");return await(await j_()).getAllSessionIds()}catch(q){return console.warn("Failed to load imported sessions, proceeding with empty set:",q),new Set}}async function LV(){let q=v_.join(IV.homedir(),".claude","projects");if(!H_.existsSync(q))return{conversations:[],skippedCount:0};let _=H_.readdirSync(q).filter((f)=>H_.statSync(v_.join(q,f)).isDirectory()),j=[],K=await dV(),Y=0;for(let f of _){let P=v_.join(q,f),$=H_.readdirSync(P).filter((w)=>w.endsWith(".jsonl")).map((w)=>v_.join(P,w));for(let w of $)try{let z=H_.readFileSync(w,"utf-8").trim().split(`
`).filter(Boolean),W=JSON.parse(z[0]),v=z.length,H=H_.statSync(w),T=H.size,J={sessionId:W.sessionId||v_.basename(w,".jsonl"),timestamp:W.timestamp||H.mtime.toISOString(),messageCount:v,branch:W.branch,cwd:W.cwd||P,fileSize:T};if(K.has(J.sessionId)){Y++;continue}let k=v_.basename(v_.dirname(w)),A=gV(J.timestamp,w),G=mV(A);j.push({filePath:w,...J,projectName:k,parsedDate:A,relativeDate:G})}catch{}}return{conversations:j,skippedCount:Y}}async function jw(q={}){console.clear(),pf(q8.bgCyan.black(" CLAUDE-MEM IMPORT "));let _=$_();_.start("Scanning conversation history");let{conversations:j,skippedCount:K}=await LV();if(j.length===0){_.stop("No new conversations found");let w=K>0?`All ${K} conversation${K===1?" is":"s are"} already imported.`:"No conversations found.";Bq(q8.yellow(w));return}j.sort((w,O)=>O.parsedDate.getTime()-w.parsedDate.getTime());let Y=K>0?`Found ${j.length} new conversation${j.length===1?"":"s"} (${K} already imported)`:`Found ${j.length} new conversation${j.length===1?"":"s"}`;_.stop(Y);let f=j.reduce((w,O)=>{if(!w[O.projectName])w[O.projectName]=[];return w[O.projectName].push(O),w},{}),P=await aq({message:"How would you like to import?",options:[{value:"browse",label:"Browse by Project",hint:"Select project then conversations"},{value:"project",label:"Import Entire Project",hint:"Select project and import all conversations"},{value:"recent",label:"Recent Conversations",hint:"Import most recent across all projects"},{value:"search",label:"Search",hint:"Search for specific conversations"}]});if(n8(P)){O6("Import cancelled");return}let $=[];if(P==="browse"){let w=Object.entries(f).sort((T,J)=>J[1][0].parsedDate.getTime()-T[1][0].parsedDate.getTime()).map(([T,J])=>({value:T,label:T,hint:`${J.length} conversation${J.length===1?"":"s"}, latest: ${J[0].relativeDate}`})),O=await aq({message:"Select a project",options:w});if(n8(O)){O6("Import cancelled");return}let z=f[O],W=await Sq({message:"Would you like to generate titles for easier browsing?",initialValue:!1});if(n8(W)){O6("Import cancelled");return}if(W)await _w(z,O);let v=new pK,H=z.map((T)=>{let J=v.getTitleForSession(T.sessionId),k=J?`"${J}" • `:"";return{value:T.sessionId,label:`${k}${T.relativeDate}${T.messageCount} messages • ${A4(T.fileSize)}`,hint:T.branch?`branch: ${T.branch}`:void 0}});if(q.multi){let T=await b9({message:`Select conversations from ${O} (Space to select, Enter to confirm)`,options:H,required:!1});if(n8(T)){O6("Import cancelled");return}let J=T;$=z.filter((k)=>J.includes(k.sessionId))}else{let T=!0,J=new Set;while(T&&z.length>J.size){let k=z.filter((m)=>!J.has(m.sessionId));if(k.length===0)break;let A=new pK,G=k.map((m)=>{let N=A.getTitleForSession(m.sessionId),R=N?`"${N}" • `:"";return{value:m.sessionId,label:`${R}${m.relativeDate}${m.messageCount} messages • ${A4(m.fileSize)}`,hint:m.branch?`branch: ${m.branch}`:void 0}}),u=await aq({message:`Select a conversation (${J.size}/${z.length} imported)`,options:[...G,{value:"done",label:"✅ Done importing",hint:"Exit import mode"}]});if(n8(u)||u==="done"){T=!1;break}let V=k.find((m)=>m.sessionId===u);if(V)$=[V],await Kw($,q.verbose),J.add(V.sessionId)}if(J.size>0)Bq(q8.green(`✅ Imported ${J.size} conversation${J.size===1?"":"s"}`));else Bq(q8.yellow("No conversations imported"));return}}else if(P==="project"){let w=Object.entries(f).sort((H,T)=>T[1][0].parsedDate.getTime()-H[1][0].parsedDate.getTime()).map(([H,T])=>({value:H,label:H,hint:`${T.length} conversation${T.length===1?"":"s"}, latest: ${T[0].relativeDate}`})),O=await aq({message:"Select a project to import all conversations",options:w});if(n8(O)){O6("Import cancelled");return}let z=f[O],W=await Sq({message:"Would you like to generate titles for easier browsing?",initialValue:!1});if(n8(W)){O6("Import cancelled");return}if(W)await _w(z,O);let v=await Sq({message:`Import all ${z.length} conversation${z.length===1?"":"s"} from ${O}?`});if(n8(v)||!v){O6("Import cancelled");return}$=z}else if(P==="recent"){let w=await h3({message:"How many recent conversations?",placeholder:"10",initialValue:"10",validate:(z)=>{let W=parseInt(z);if(isNaN(W)||W<1)return"Please enter a valid number";if(W>j.length)return`Only ${j.length} available`}});if(n8(w)){O6("Import cancelled");return}let O=parseInt(w);$=j.slice(0,O)}else if(P==="search"){let w=await h3({message:"Search conversations (project name or session ID)",placeholder:"Enter search term"});if(n8(w)){O6("Import cancelled");return}let O=w.toLowerCase(),z=j.filter((J)=>J.projectName.toLowerCase().includes(O)||J.sessionId.toLowerCase().includes(O)||J.branch&&J.branch.toLowerCase().includes(O));if(z.length===0){Bq(q8.yellow("No matching conversations found"));return}let W=new pK,v=z.map((J)=>{let k=W.getTitleForSession(J.sessionId),A=k?`"${k}" • `:"";return{value:J.sessionId,label:`${A}${J.projectName}${J.relativeDate}${J.messageCount} msgs`,hint:A4(J.fileSize)}}),H=await b9({message:`Found ${z.length} matches. Select to import:`,options:v,required:!1});if(n8(H)){O6("Import cancelled");return}let T=H;$=z.filter((J)=>T.includes(J.sessionId))}if($.length>0)await Kw($,q.verbose),Bq(q8.green(`✅ Successfully imported ${$.length} conversation${$.length===1?"":"s"}`));else Bq(q8.yellow("No conversations selected for import"))}async function _w(q,_){let j=new pK,K=j.getExistingTitles(),Y=q.filter(($)=>!K.has($.sessionId));if(Y.length===0){S9("All conversations already have titles!","Title Generation");return}let f=$_();f.start(`Generating titles for ${Y.length} conversations...`);let P=Y.map(($)=>({sessionId:$.sessionId,projectName:_,firstMessage:yV($.filePath)}));try{await j.batchGenerateTitles(P),f.stop(`✅ Generated ${Y.length} titles`)}catch($){f.stop("❌ Failed to generate titles"),console.error(q8.red(`Error: ${$}`))}}async function Kw(q,_){let j=$_();for(let K=0;K<q.length;K++){let Y=q[K],f=q.length>1?`[${K+1}/${q.length}] `:"";j.start(`${f}Importing ${Y.projectName} (${Y.relativeDate})`);try{let P=v_.basename(Y.cwd);if(await new MK().compress(Y.filePath,Y.sessionId,P),j.stop(`${f}Imported ${Y.projectName} (${Y.messageCount} messages)`),_)S9(`Session: ${Y.sessionId}
Size: ${A4(Y.fileSize)}
Branch: ${Y.branch||"main"}`,"Details")}catch(P){if(j.stop(`${f}Failed to import ${Y.projectName}`),_)console.error(q8.red(`Error: ${P}`))}}}d7();var v6=new j1;v6.name(eq).description(W1).version(z1);v6.command("compress [transcript]").description("Compress a Claude Code transcript into memory").option("--output <path>","Output directory for compressed files").option("--dry-run","Show what would be compressed without doing it").option("-v, --verbose","Show detailed output").action(A3);v6.command("install").description("Install Claude Code hooks for automatic compression").option("--user","Install for current user (default)").option("--project","Install for current project only").option("--local","Install to custom local directory").option("--path <path>","Custom installation path (with --local)").option("--timeout <ms>","Hook execution timeout in milliseconds","180000").option("--skip-mcp","Skip Chroma MCP server installation").option("--force","Force installation even if already installed").action(a$);v6.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(t$);v6.command("status").description("Check installation status of Claude Memory System").action(F$);v6.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(U$);v6.command("load-context").description("Load compressed memories for current session").option("--project <name>","Filter by project name").option("--count <n>","Number of memories to load","10").option("--raw","Output raw JSON instead of formatted text").option("--format <type>","Output format: json, session-start, or default").action(q4);var N5=v6.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(q,_)=>{if(!q||q.length===0){N5.outputHelp();return}if(_.R)_.recursive=!0;await BO(q,{force:_.force,recursive:_.recursive})});N5.command("view").description("View contents of trash bin").action(async()=>{let{viewTrash:q}=await Promise.resolve().then(() => (zw(),ww));await q()});N5.command("empty").description("Permanently delete all files in trash").option("-f, --force","Skip confirmation prompt").action(async(q)=>{let{emptyTrash:_}=await Promise.resolve().then(() => (Hw(),vw));await _(q)});v6.command("restore").description("Restore files from trash interactively").action(FO);v6.command("save <message>").description("Save a message to the memory system").action(eO);v6.command("changelog").description("Generate CHANGELOG.md from claude-mem memories").option("--historical <n>","Number of versions to search (default: current version only)").option("--generate <version>","Generate changelog for a specific version").option("--start <time>","Start time for memory search (ISO format)").option("--end <time>","End time for memory search (ISO format)").option("--update","Update CHANGELOG.md from JSONL entries").option("--preview","Preview the generated changelog").option("-v, --verbose","Show detailed output").action(QO);v6.command("import-history").description("Import historical Claude Code conversations into memory").option("-v, --verbose","Show detailed output").option("-m, --multi","Enable multi-select mode (default is single-select)").action(jw);v6.command("migrate-index").description("Migrate JSONL index to SQLite database").option("--force","Force migration even if SQLite database already has data").option("--keep-jsonl","Keep original JSONL file (archive it by default)").action(async(q)=>{let{migrateIndex:_}=await Promise.resolve().then(() => (Tw(),Jw));await _(q)});v6.command("hook:pre-compact",{hidden:!0}).description("Internal pre-compact hook handler").action(async()=>{let{preCompactHook:q}=await Promise.resolve().then(() => (u4(),G4));await q()});v6.command("hook:session-start",{hidden:!0}).description("Internal session-start hook handler").action(async()=>{let{sessionStartHook:q}=await Promise.resolve().then(() => (u4(),G4));await q()});v6.command("hook:session-end",{hidden:!0}).description("Internal session-end hook handler").action(async()=>{let{sessionEndHook:q}=await Promise.resolve().then(() => (u4(),G4));await q()});v6.command("debug-filter").description("Show filtered transcript output (first 5 messages)").argument("<transcript-path>","Path to transcript file").action((q)=>{new MK().showFilteredOutput(q)});v6.parse();