faf-cli 7.3.0 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,176 +1,176 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as sQ}from"node:module";var hQ=Object.create;var{getPrototypeOf:uQ,defineProperty:G8,getOwnPropertyNames:mQ}=Object;var cQ=Object.prototype.hasOwnProperty;function dQ($){return this[$]}var lQ,pQ,iQ=($,Z,X)=>{var z=$!=null&&typeof $==="object";if(z){var J=Z?lQ??=new WeakMap:pQ??=new WeakMap,Q=J.get($);if(Q)return Q}X=$!=null?hQ(uQ($)):{};let Y=Z||!$||!$.__esModule?G8(X,"default",{value:$,enumerable:!0}):X;for(let W of mQ($))if(!cQ.call(Y,W))G8(Y,W,{get:dQ.bind($,W),enumerable:!0});if(z)J.set($,Y);return Y};var F=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var nQ=($)=>$;function rQ($,Z){this[$]=nQ.bind(null,Z)}var S5=($,Z)=>{for(var X in Z)G8($,X,{get:Z[X],enumerable:!0,configurable:!0,set:rQ.bind(Z,X)})};var g=($,Z)=>()=>($&&(Z=$($=0)),Z);var A0=sQ(import.meta.url);var c$=F((aQ)=>{class q8 extends Error{constructor($,Z,X){super(X);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=Z,this.exitCode=$,this.nestedError=void 0}}class x5 extends q8{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}aQ.CommanderError=q8;aQ.InvalidArgumentError=x5});var N3=F((ZY)=>{var{InvalidArgumentError:eQ}=c$();class b5{constructor($,Z){switch(this.description=Z||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue($,Z){if(Z===this.defaultValue||!Array.isArray(Z))return[$];return Z.push($),Z}default($,Z){return this.defaultValue=$,this.defaultValueDescription=Z,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(Z,X)=>{if(!this.argChoices.includes(Z))throw new eQ(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,X);return Z},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function $Y($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}ZY.Argument=b5;ZY.humanReadableArgName=$Y});var V8=F((QY)=>{var{humanReadableArgName:JY}=N3();class k5{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext($){this.helpWidth=this.helpWidth??$.helpWidth??80}visibleCommands($){let Z=$.commands.filter((z)=>!z._hidden),X=$._getHelpCommand();if(X&&!X._hidden)Z.push(X);if(this.sortSubcommands)Z.sort((z,J)=>{return z.name().localeCompare(J.name())});return Z}compareOptions($,Z){let X=(z)=>{return z.short?z.short.replace(/^-/,""):z.long.replace(/^--/,"")};return X($).localeCompare(X(Z))}visibleOptions($){let Z=$.options.filter((z)=>!z.hidden),X=$._getHelpOption();if(X&&!X.hidden){let z=X.short&&$._findOption(X.short),J=X.long&&$._findOption(X.long);if(!z&&!J)Z.push(X);else if(X.long&&!J)Z.push($.createOption(X.long,X.description));else if(X.short&&!z)Z.push($.createOption(X.short,X.description))}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let Z=[];for(let X=$.parent;X;X=X.parent){let z=X.options.filter((J)=>!J.hidden);Z.push(...z)}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((Z)=>{Z.description=Z.description||$._argsDescription[Z.name()]||""});if($.registeredArguments.find((Z)=>Z.description))return $.registeredArguments;return[]}subcommandTerm($){let Z=$.registeredArguments.map((X)=>JY(X)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(Z?" "+Z:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,Z){return Z.visibleCommands($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleSubcommandTerm(Z.subcommandTerm(z))))},0)}longestOptionTermLength($,Z){return Z.visibleOptions($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(z))))},0)}longestGlobalOptionTermLength($,Z){return Z.visibleGlobalOptions($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(z))))},0)}longestArgumentTermLength($,Z){return Z.visibleArguments($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleArgumentTerm(Z.argumentTerm(z))))},0)}commandUsage($){let Z=$._name;if($._aliases[0])Z=Z+"|"+$._aliases[0];let X="";for(let z=$.parent;z;z=z.parent)X=z.name()+" "+X;return X+Z+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((X)=>JSON.stringify(X)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)Z.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)Z.push(`env: ${$.envVar}`);if(Z.length>0){let X=`(${Z.join(", ")})`;if($.description)return`${$.description} ${X}`;return X}return $.description}argumentDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((X)=>JSON.stringify(X)).join(", ")}`);if($.defaultValue!==void 0)Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(Z.length>0){let X=`(${Z.join(", ")})`;if($.description)return`${$.description} ${X}`;return X}return $.description}formatItemList($,Z,X){if(Z.length===0)return[];return[X.styleTitle($),...Z,""]}groupItems($,Z,X){let z=new Map;return $.forEach((J)=>{let Q=X(J);if(!z.has(Q))z.set(Q,[])}),Z.forEach((J)=>{let Q=X(J);if(!z.has(Q))z.set(Q,[]);z.get(Q).push(J)}),z}formatHelp($,Z){let X=Z.padWidth($,Z),z=Z.helpWidth??80;function J(q,V){return Z.formatItem(q,X,V,Z)}let Q=[`${Z.styleTitle("Usage:")} ${Z.styleUsage(Z.commandUsage($))}`,""],Y=Z.commandDescription($);if(Y.length>0)Q=Q.concat([Z.boxWrap(Z.styleCommandDescription(Y),z),""]);let W=Z.visibleArguments($).map((q)=>{return J(Z.styleArgumentTerm(Z.argumentTerm(q)),Z.styleArgumentDescription(Z.argumentDescription(q)))});if(Q=Q.concat(this.formatItemList("Arguments:",W,Z)),this.groupItems($.options,Z.visibleOptions($),(q)=>q.helpGroupHeading??"Options:").forEach((q,V)=>{let K=q.map((B)=>{return J(Z.styleOptionTerm(Z.optionTerm(B)),Z.styleOptionDescription(Z.optionDescription(B)))});Q=Q.concat(this.formatItemList(V,K,Z))}),Z.showGlobalOptions){let q=Z.visibleGlobalOptions($).map((V)=>{return J(Z.styleOptionTerm(Z.optionTerm(V)),Z.styleOptionDescription(Z.optionDescription(V)))});Q=Q.concat(this.formatItemList("Global Options:",q,Z))}return this.groupItems($.commands,Z.visibleCommands($),(q)=>q.helpGroup()||"Commands:").forEach((q,V)=>{let K=q.map((B)=>{return J(Z.styleSubcommandTerm(Z.subcommandTerm(B)),Z.styleSubcommandDescription(Z.subcommandDescription(B)))});Q=Q.concat(this.formatItemList(V,K,Z))}),Q.join(`
3
- `)}displayWidth($){return y5($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((Z)=>{if(Z==="[options]")return this.styleOptionText(Z);if(Z==="[command]")return this.styleSubcommandText(Z);if(Z[0]==="["||Z[0]==="<")return this.styleArgumentText(Z);return this.styleCommandText(Z)}).join(" ")}styleCommandDescription($){return this.styleDescriptionText($)}styleOptionDescription($){return this.styleDescriptionText($)}styleSubcommandDescription($){return this.styleDescriptionText($)}styleArgumentDescription($){return this.styleDescriptionText($)}styleDescriptionText($){return $}styleOptionTerm($){return this.styleOptionText($)}styleSubcommandTerm($){return $.split(" ").map((Z)=>{if(Z==="[options]")return this.styleOptionText(Z);if(Z[0]==="["||Z[0]==="<")return this.styleArgumentText(Z);return this.styleSubcommandText(Z)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,Z){return Math.max(Z.longestOptionTermLength($,Z),Z.longestGlobalOptionTermLength($,Z),Z.longestSubcommandTermLength($,Z),Z.longestArgumentTermLength($,Z))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,Z,X,z){let Q=" ".repeat(2);if(!X)return Q+$;let Y=$.padEnd(Z+$.length-z.displayWidth($)),W=2,G=(this.helpWidth??80)-Z-W-2,q;if(G<this.minWidthToWrap||z.preformatted(X))q=X;else q=z.boxWrap(X,G).replace(/\n/g,`
2
+ import{createRequire as XY}from"node:module";var iQ=Object.create;var{getPrototypeOf:nQ,defineProperty:H8,getOwnPropertyNames:rQ}=Object;var sQ=Object.prototype.hasOwnProperty;function aQ($){return this[$]}var oQ,tQ,eQ=($,Z,X)=>{var z=$!=null&&typeof $==="object";if(z){var J=Z?oQ??=new WeakMap:tQ??=new WeakMap,Q=J.get($);if(Q)return Q}X=$!=null?iQ(nQ($)):{};let Y=Z||!$||!$.__esModule?H8(X,"default",{value:$,enumerable:!0}):X;for(let W of rQ($))if(!sQ.call(Y,W))H8(Y,W,{get:aQ.bind($,W),enumerable:!0});if(z)J.set($,Y);return Y};var _=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var $Y=($)=>$;function ZY($,Z){this[$]=$Y.bind(null,Z)}var f5=($,Z)=>{for(var X in Z)H8($,X,{get:Z[X],enumerable:!0,configurable:!0,set:ZY.bind(Z,X)})};var y=($,Z)=>()=>($&&(Z=$($=0)),Z);var A0=XY(import.meta.url);var d$=_((zY)=>{class B8 extends Error{constructor($,Z,X){super(X);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=Z,this.exitCode=$,this.nestedError=void 0}}class g5 extends B8{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}zY.CommanderError=B8;zY.InvalidArgumentError=g5});var N4=_((UY)=>{var{InvalidArgumentError:YY}=d$();class v5{constructor($,Z){switch(this.description=Z||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue($,Z){if(Z===this.defaultValue||!Array.isArray(Z))return[$];return Z.push($),Z}default($,Z){return this.defaultValue=$,this.defaultValueDescription=Z,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(Z,X)=>{if(!this.argChoices.includes(Z))throw new YY(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,X);return Z},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function WY($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}UY.Argument=v5;UY.humanReadableArgName=WY});var L8=_((KY)=>{var{humanReadableArgName:VY}=N4();class h5{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext($){this.helpWidth=this.helpWidth??$.helpWidth??80}visibleCommands($){let Z=$.commands.filter((z)=>!z._hidden),X=$._getHelpCommand();if(X&&!X._hidden)Z.push(X);if(this.sortSubcommands)Z.sort((z,J)=>{return z.name().localeCompare(J.name())});return Z}compareOptions($,Z){let X=(z)=>{return z.short?z.short.replace(/^-/,""):z.long.replace(/^--/,"")};return X($).localeCompare(X(Z))}visibleOptions($){let Z=$.options.filter((z)=>!z.hidden),X=$._getHelpOption();if(X&&!X.hidden){let z=X.short&&$._findOption(X.short),J=X.long&&$._findOption(X.long);if(!z&&!J)Z.push(X);else if(X.long&&!J)Z.push($.createOption(X.long,X.description));else if(X.short&&!z)Z.push($.createOption(X.short,X.description))}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let Z=[];for(let X=$.parent;X;X=X.parent){let z=X.options.filter((J)=>!J.hidden);Z.push(...z)}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((Z)=>{Z.description=Z.description||$._argsDescription[Z.name()]||""});if($.registeredArguments.find((Z)=>Z.description))return $.registeredArguments;return[]}subcommandTerm($){let Z=$.registeredArguments.map((X)=>VY(X)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(Z?" "+Z:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,Z){return Z.visibleCommands($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleSubcommandTerm(Z.subcommandTerm(z))))},0)}longestOptionTermLength($,Z){return Z.visibleOptions($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(z))))},0)}longestGlobalOptionTermLength($,Z){return Z.visibleGlobalOptions($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(z))))},0)}longestArgumentTermLength($,Z){return Z.visibleArguments($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleArgumentTerm(Z.argumentTerm(z))))},0)}commandUsage($){let Z=$._name;if($._aliases[0])Z=Z+"|"+$._aliases[0];let X="";for(let z=$.parent;z;z=z.parent)X=z.name()+" "+X;return X+Z+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((X)=>JSON.stringify(X)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)Z.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)Z.push(`env: ${$.envVar}`);if(Z.length>0){let X=`(${Z.join(", ")})`;if($.description)return`${$.description} ${X}`;return X}return $.description}argumentDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((X)=>JSON.stringify(X)).join(", ")}`);if($.defaultValue!==void 0)Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(Z.length>0){let X=`(${Z.join(", ")})`;if($.description)return`${$.description} ${X}`;return X}return $.description}formatItemList($,Z,X){if(Z.length===0)return[];return[X.styleTitle($),...Z,""]}groupItems($,Z,X){let z=new Map;return $.forEach((J)=>{let Q=X(J);if(!z.has(Q))z.set(Q,[])}),Z.forEach((J)=>{let Q=X(J);if(!z.has(Q))z.set(Q,[]);z.get(Q).push(J)}),z}formatHelp($,Z){let X=Z.padWidth($,Z),z=Z.helpWidth??80;function J(q,V){return Z.formatItem(q,X,V,Z)}let Q=[`${Z.styleTitle("Usage:")} ${Z.styleUsage(Z.commandUsage($))}`,""],Y=Z.commandDescription($);if(Y.length>0)Q=Q.concat([Z.boxWrap(Z.styleCommandDescription(Y),z),""]);let W=Z.visibleArguments($).map((q)=>{return J(Z.styleArgumentTerm(Z.argumentTerm(q)),Z.styleArgumentDescription(Z.argumentDescription(q)))});if(Q=Q.concat(this.formatItemList("Arguments:",W,Z)),this.groupItems($.options,Z.visibleOptions($),(q)=>q.helpGroupHeading??"Options:").forEach((q,V)=>{let K=q.map((H)=>{return J(Z.styleOptionTerm(Z.optionTerm(H)),Z.styleOptionDescription(Z.optionDescription(H)))});Q=Q.concat(this.formatItemList(V,K,Z))}),Z.showGlobalOptions){let q=Z.visibleGlobalOptions($).map((V)=>{return J(Z.styleOptionTerm(Z.optionTerm(V)),Z.styleOptionDescription(Z.optionDescription(V)))});Q=Q.concat(this.formatItemList("Global Options:",q,Z))}return this.groupItems($.commands,Z.visibleCommands($),(q)=>q.helpGroup()||"Commands:").forEach((q,V)=>{let K=q.map((H)=>{return J(Z.styleSubcommandTerm(Z.subcommandTerm(H)),Z.styleSubcommandDescription(Z.subcommandDescription(H)))});Q=Q.concat(this.formatItemList(V,K,Z))}),Q.join(`
3
+ `)}displayWidth($){return u5($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((Z)=>{if(Z==="[options]")return this.styleOptionText(Z);if(Z==="[command]")return this.styleSubcommandText(Z);if(Z[0]==="["||Z[0]==="<")return this.styleArgumentText(Z);return this.styleCommandText(Z)}).join(" ")}styleCommandDescription($){return this.styleDescriptionText($)}styleOptionDescription($){return this.styleDescriptionText($)}styleSubcommandDescription($){return this.styleDescriptionText($)}styleArgumentDescription($){return this.styleDescriptionText($)}styleDescriptionText($){return $}styleOptionTerm($){return this.styleOptionText($)}styleSubcommandTerm($){return $.split(" ").map((Z)=>{if(Z==="[options]")return this.styleOptionText(Z);if(Z[0]==="["||Z[0]==="<")return this.styleArgumentText(Z);return this.styleSubcommandText(Z)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,Z){return Math.max(Z.longestOptionTermLength($,Z),Z.longestGlobalOptionTermLength($,Z),Z.longestSubcommandTermLength($,Z),Z.longestArgumentTermLength($,Z))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,Z,X,z){let Q=" ".repeat(2);if(!X)return Q+$;let Y=$.padEnd(Z+$.length-z.displayWidth($)),W=2,G=(this.helpWidth??80)-Z-W-2,q;if(G<this.minWidthToWrap||z.preformatted(X))q=X;else q=z.boxWrap(X,G).replace(/\n/g,`
4
4
  `+" ".repeat(Z+W));return Q+Y+" ".repeat(W)+q.replace(/\n/g,`
5
5
  ${Q}`)}boxWrap($,Z){if(Z<this.minWidthToWrap)return $;let X=$.split(/\r\n|\n/),z=/[\s]*[^\s]+/g,J=[];return X.forEach((Q)=>{let Y=Q.match(z);if(Y===null){J.push("");return}let W=[Y.shift()],U=this.displayWidth(W[0]);Y.forEach((G)=>{let q=this.displayWidth(G);if(U+q<=Z){W.push(G),U+=q;return}J.push(W.join(""));let V=G.trimStart();W=[V],U=this.displayWidth(V)}),J.push(W.join(""))}),J.join(`
6
- `)}}function y5($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}QY.Help=k5;QY.stripColor=y5});var K8=F((qY)=>{var{InvalidArgumentError:UY}=c$();class g5{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let X=GY($);if(this.short=X.shortFlag,this.long=X.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($,Z){return this.defaultValue=$,this.defaultValueDescription=Z,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let Z=$;if(typeof $==="string")Z={[$]:!0};return this.implied=Object.assign(this.implied||{},Z),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_collectValue($,Z){if(Z===this.defaultValue||!Array.isArray(Z))return[$];return Z.push($),Z}choices($){return this.argChoices=$.slice(),this.parseArg=(Z,X)=>{if(!this.argChoices.includes(Z))throw new UY(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,X);return Z},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return f5(this.name().replace(/^no-/,""));return f5(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class v5{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((Z)=>{if(Z.negate)this.negativeOptions.set(Z.attributeName(),Z);else this.positiveOptions.set(Z.attributeName(),Z)}),this.negativeOptions.forEach((Z,X)=>{if(this.positiveOptions.has(X))this.dualOptions.add(X)})}valueFromOption($,Z){let X=Z.attributeName();if(!this.dualOptions.has(X))return!0;let z=this.negativeOptions.get(X).presetArg,J=z!==void 0?z:!1;return Z.negate===(J===$)}}function f5($){return $.split("-").reduce((Z,X)=>{return Z+X[0].toUpperCase()+X.slice(1)})}function GY($){let Z,X,z=/^-[^-]$/,J=/^--[^-]/,Q=$.split(/[ |,]+/).concat("guard");if(z.test(Q[0]))Z=Q.shift();if(J.test(Q[0]))X=Q.shift();if(!Z&&z.test(Q[0]))Z=Q.shift();if(!Z&&J.test(Q[0]))Z=X,X=Q.shift();if(Q[0].startsWith("-")){let Y=Q[0],W=`option creation failed due to '${Y}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${W}
6
+ `)}}function u5($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}KY.Help=h5;KY.stripColor=u5});var M8=_((OY)=>{var{InvalidArgumentError:LY}=d$();class c5{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let X=MY($);if(this.short=X.shortFlag,this.long=X.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($,Z){return this.defaultValue=$,this.defaultValueDescription=Z,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let Z=$;if(typeof $==="string")Z={[$]:!0};return this.implied=Object.assign(this.implied||{},Z),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_collectValue($,Z){if(Z===this.defaultValue||!Array.isArray(Z))return[$];return Z.push($),Z}choices($){return this.argChoices=$.slice(),this.parseArg=(Z,X)=>{if(!this.argChoices.includes(Z))throw new LY(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,X);return Z},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return m5(this.name().replace(/^no-/,""));return m5(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class d5{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((Z)=>{if(Z.negate)this.negativeOptions.set(Z.attributeName(),Z);else this.positiveOptions.set(Z.attributeName(),Z)}),this.negativeOptions.forEach((Z,X)=>{if(this.positiveOptions.has(X))this.dualOptions.add(X)})}valueFromOption($,Z){let X=Z.attributeName();if(!this.dualOptions.has(X))return!0;let z=this.negativeOptions.get(X).presetArg,J=z!==void 0?z:!1;return Z.negate===(J===$)}}function m5($){return $.split("-").reduce((Z,X)=>{return Z+X[0].toUpperCase()+X.slice(1)})}function MY($){let Z,X,z=/^-[^-]$/,J=/^--[^-]/,Q=$.split(/[ |,]+/).concat("guard");if(z.test(Q[0]))Z=Q.shift();if(J.test(Q[0]))X=Q.shift();if(!Z&&z.test(Q[0]))Z=Q.shift();if(!Z&&J.test(Q[0]))Z=X,X=Q.shift();if(Q[0].startsWith("-")){let Y=Q[0],W=`option creation failed due to '${Y}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${W}
7
7
  - a short flag is a single dash and a single character
8
8
  - either use a single dash and a single character (for a short flag)
9
9
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(z.test(Y))throw Error(`${W}
10
10
  - too many short flags`);if(J.test(Y))throw Error(`${W}
11
11
  - too many long flags`);throw Error(`${W}
12
- - unrecognised flag format`)}if(Z===void 0&&X===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:Z,longFlag:X}}qY.Option=g5;qY.DualOptions=v5});var h5=F((LY)=>{function HY($,Z){if(Math.abs($.length-Z.length)>3)return Math.max($.length,Z.length);let X=[];for(let z=0;z<=$.length;z++)X[z]=[z];for(let z=0;z<=Z.length;z++)X[0][z]=z;for(let z=1;z<=Z.length;z++)for(let J=1;J<=$.length;J++){let Q=1;if($[J-1]===Z[z-1])Q=0;else Q=1;if(X[J][z]=Math.min(X[J-1][z]+1,X[J][z-1]+1,X[J-1][z-1]+Q),J>1&&z>1&&$[J-1]===Z[z-2]&&$[J-2]===Z[z-1])X[J][z]=Math.min(X[J][z],X[J-2][z-2]+1)}return X[$.length][Z.length]}function BY($,Z){if(!Z||Z.length===0)return"";Z=Array.from(new Set(Z));let X=$.startsWith("--");if(X)$=$.slice(2),Z=Z.map((Y)=>Y.slice(2));let z=[],J=3,Q=0.4;if(Z.forEach((Y)=>{if(Y.length<=1)return;let W=HY($,Y),U=Math.max($.length,Y.length);if((U-W)/U>Q){if(W<J)J=W,z=[Y];else if(W===J)z.push(Y)}}),z.sort((Y,W)=>Y.localeCompare(W)),X)z=z.map((Y)=>`--${Y}`);if(z.length>1)return`
12
+ - unrecognised flag format`)}if(Z===void 0&&X===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:Z,longFlag:X}}OY.Option=c5;OY.DualOptions=d5});var l5=_((AY)=>{function DY($,Z){if(Math.abs($.length-Z.length)>3)return Math.max($.length,Z.length);let X=[];for(let z=0;z<=$.length;z++)X[z]=[z];for(let z=0;z<=Z.length;z++)X[0][z]=z;for(let z=1;z<=Z.length;z++)for(let J=1;J<=$.length;J++){let Q=1;if($[J-1]===Z[z-1])Q=0;else Q=1;if(X[J][z]=Math.min(X[J-1][z]+1,X[J][z-1]+1,X[J-1][z-1]+Q),J>1&&z>1&&$[J-1]===Z[z-2]&&$[J-2]===Z[z-1])X[J][z]=Math.min(X[J][z],X[J-2][z-2]+1)}return X[$.length][Z.length]}function IY($,Z){if(!Z||Z.length===0)return"";Z=Array.from(new Set(Z));let X=$.startsWith("--");if(X)$=$.slice(2),Z=Z.map((Y)=>Y.slice(2));let z=[],J=3,Q=0.4;if(Z.forEach((Y)=>{if(Y.length<=1)return;let W=DY($,Y),U=Math.max($.length,Y.length);if((U-W)/U>Q){if(W<J)J=W,z=[Y];else if(W===J)z.push(Y)}}),z.sort((Y,W)=>Y.localeCompare(W)),X)z=z.map((Y)=>`--${Y}`);if(z.length>1)return`
13
13
  (Did you mean one of ${z.join(", ")}?)`;if(z.length===1)return`
14
- (Did you mean ${z[0]}?)`;return""}LY.suggestSimilar=BY});var d5=F((RY)=>{var MY=A0("node:events").EventEmitter,H8=A0("node:child_process"),n0=A0("node:path"),M3=A0("node:fs"),n=A0("node:process"),{Argument:OY,humanReadableArgName:TY}=N3(),{CommanderError:B8}=c$(),{Help:DY,stripColor:IY}=V8(),{Option:u5,DualOptions:AY}=K8(),{suggestSimilar:m5}=h5();class N8 extends MY{constructor($){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=$||"",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:(Z)=>n.stdout.write(Z),writeErr:(Z)=>n.stderr.write(Z),outputError:(Z,X)=>X(Z),getOutHelpWidth:()=>n.stdout.isTTY?n.stdout.columns:void 0,getErrHelpWidth:()=>n.stderr.isTTY?n.stderr.columns:void 0,getOutHasColors:()=>L8()??(n.stdout.isTTY&&n.stdout.hasColors?.()),getErrHasColors:()=>L8()??(n.stderr.isTTY&&n.stderr.hasColors?.()),stripColor:(Z)=>IY(Z)},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($){return this._outputConfiguration=$._outputConfiguration,this._helpOption=$._helpOption,this._helpCommand=$._helpCommand,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let Z=this;Z;Z=Z.parent)$.push(Z);return $}command($,Z,X){let z=Z,J=X;if(typeof z==="object"&&z!==null)J=z,z=null;J=J||{};let[,Q,Y]=$.match(/([^ ]+) *(.*)/),W=this.createCommand(Q);if(z)W.description(z),W._executableHandler=!0;if(J.isDefault)this._defaultCommandName=W._name;if(W._hidden=!!(J.noHelp||J.hidden),W._executableFile=J.executableFile||null,Y)W.arguments(Y);if(this._registerCommand(W),W.parent=this,W.copyInheritedSettings(this),z)return this;return W}createCommand($){return new N8($)}createHelp(){return Object.assign(new DY,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...$},this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,Z){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
15
- - specify the name in Command constructor or using .name()`);if(Z=Z||{},Z.isDefault)this._defaultCommandName=$._name;if(Z.noHelp||Z.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,Z){return new OY($,Z)}argument($,Z,X,z){let J=this.createArgument($,Z);if(typeof X==="function")J.default(z).argParser(X);else J.default(X);return this.addArgument(J),this}arguments($){return $.trim().split(/ +/).forEach((Z)=>{this.argument(Z)}),this}addArgument($){let Z=this.registeredArguments.slice(-1)[0];if(Z?.variadic)throw Error(`only the last argument can be variadic '${Z.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}helpCommand($,Z){if(typeof $==="boolean"){if(this._addImplicitHelpCommand=$,$&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let X=$??"help [command]",[,z,J]=X.match(/([^ ]+) *(.*)/),Q=Z??"display help for command",Y=this.createCommand(z);if(Y.helpOption(!1),J)Y.arguments(J);if(Q)Y.description(Q);if(this._addImplicitHelpCommand=!0,this._helpCommand=Y,$||Z)this._initCommandGroup(Y);return this}addHelpCommand($,Z){if(typeof $!=="object")return this.helpCommand($,Z),this;return this._addImplicitHelpCommand=!0,this._helpCommand=$,this._initCommandGroup($),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($,Z){let X=["preSubcommand","preAction","postAction"];if(!X.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
16
- Expecting one of '${X.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(Z);else this._lifeCycleHooks[$]=[Z];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(Z)=>{if(Z.code!=="commander.executeSubCommandAsync")throw Z};return this}_exit($,Z,X){if(this._exitCallback)this._exitCallback(new B8($,Z,X));n.exit($)}action($){let Z=(X)=>{let z=this.registeredArguments.length,J=X.slice(0,z);if(this._storeOptionsAsProperties)J[z]=this;else J[z]=this.opts();return J.push(this),$.apply(this,J)};return this._actionHandler=Z,this}createOption($,Z){return new u5($,Z)}_callParseArg($,Z,X,z){try{return $.parseArg(Z,X)}catch(J){if(J.code==="commander.invalidArgument"){let Q=`${z} ${J.message}`;this.error(Q,{exitCode:J.exitCode,code:J.code})}throw J}}_registerOption($){let Z=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(Z){let X=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${X}'
17
- - already used by option '${Z.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let Z=(z)=>{return[z.name()].concat(z.aliases())},X=Z($).find((z)=>this._findCommand(z));if(X){let z=Z(this._findCommand(X)).join("|"),J=Z($).join("|");throw Error(`cannot add command '${J}' as already have command '${z}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let Z=$.name(),X=$.attributeName();if($.negate){let J=$.long.replace(/^--no-/,"--");if(!this._findOption(J))this.setOptionValueWithSource(X,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(X,$.defaultValue,"default");let z=(J,Q,Y)=>{if(J==null&&$.presetArg!==void 0)J=$.presetArg;let W=this.getOptionValue(X);if(J!==null&&$.parseArg)J=this._callParseArg($,J,W,Q);else if(J!==null&&$.variadic)J=$._collectValue(J,W);if(J==null)if($.negate)J=!1;else if($.isBoolean()||$.optional)J=!0;else J="";this.setOptionValueWithSource(X,J,Y)};if(this.on("option:"+Z,(J)=>{let Q=`error: option '${$.flags}' argument '${J}' is invalid.`;z(J,Q,"cli")}),$.envVar)this.on("optionEnv:"+Z,(J)=>{let Q=`error: option '${$.flags}' value '${J}' from env '${$.envVar}' is invalid.`;z(J,Q,"env")});return this}_optionEx($,Z,X,z,J){if(typeof Z==="object"&&Z instanceof u5)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let Q=this.createOption(Z,X);if(Q.makeOptionMandatory(!!$.mandatory),typeof z==="function")Q.default(J).argParser(z);else if(z instanceof RegExp){let Y=z;z=(W,U)=>{let G=Y.exec(W);return G?G[0]:U},Q.default(J).argParser(z)}else Q.default(z);return this.addOption(Q)}option($,Z,X,z){return this._optionEx({},$,Z,X,z)}requiredOption($,Z,X,z){return this._optionEx({mandatory:!0},$,Z,X,z)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,Z){return this.setOptionValueWithSource($,Z,void 0)}setOptionValueWithSource($,Z,X){if(this._storeOptionsAsProperties)this[$]=Z;else this._optionValues[$]=Z;return this._optionValueSources[$]=X,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let Z;return this._getCommandAndAncestors().forEach((X)=>{if(X.getOptionValueSource($)!==void 0)Z=X.getOptionValueSource($)}),Z}_prepareUserArgs($,Z){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(Z=Z||{},$===void 0&&Z.from===void 0){if(n.versions?.electron)Z.from="electron";let z=n.execArgv??[];if(z.includes("-e")||z.includes("--eval")||z.includes("-p")||z.includes("--print"))Z.from="eval"}if($===void 0)$=n.argv;this.rawArgs=$.slice();let X;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],X=$.slice(2);break;case"electron":if(n.defaultApp)this._scriptPath=$[1],X=$.slice(2);else X=$.slice(1);break;case"user":X=$.slice(0);break;case"eval":X=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${Z.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",X}parse($,Z){this._prepareForParse();let X=this._prepareUserArgs($,Z);return this._parseCommand([],X),this}async parseAsync($,Z){this._prepareForParse();let X=this._prepareUserArgs($,Z);return await this._parseCommand([],X),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 Error(`Can not call parse again when storeOptionsAsProperties is true.
18
- - 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($,Z,X){if(M3.existsSync($))return;let z=Z?`searched for local subcommand relative to directory '${Z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",J=`'${$}' does not exist
14
+ (Did you mean ${z[0]}?)`;return""}AY.suggestSimilar=IY});var r5=_((SY)=>{var _Y=A0("node:events").EventEmitter,O8=A0("node:child_process"),n0=A0("node:path"),T4=A0("node:fs"),r=A0("node:process"),{Argument:FY,humanReadableArgName:PY}=N4(),{CommanderError:N8}=d$(),{Help:CY,stripColor:wY}=L8(),{Option:p5,DualOptions:EY}=M8(),{suggestSimilar:i5}=l5();class D8 extends _Y{constructor($){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=$||"",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:(Z)=>r.stdout.write(Z),writeErr:(Z)=>r.stderr.write(Z),outputError:(Z,X)=>X(Z),getOutHelpWidth:()=>r.stdout.isTTY?r.stdout.columns:void 0,getErrHelpWidth:()=>r.stderr.isTTY?r.stderr.columns:void 0,getOutHasColors:()=>T8()??(r.stdout.isTTY&&r.stdout.hasColors?.()),getErrHasColors:()=>T8()??(r.stderr.isTTY&&r.stderr.hasColors?.()),stripColor:(Z)=>wY(Z)},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($){return this._outputConfiguration=$._outputConfiguration,this._helpOption=$._helpOption,this._helpCommand=$._helpCommand,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let Z=this;Z;Z=Z.parent)$.push(Z);return $}command($,Z,X){let z=Z,J=X;if(typeof z==="object"&&z!==null)J=z,z=null;J=J||{};let[,Q,Y]=$.match(/([^ ]+) *(.*)/),W=this.createCommand(Q);if(z)W.description(z),W._executableHandler=!0;if(J.isDefault)this._defaultCommandName=W._name;if(W._hidden=!!(J.noHelp||J.hidden),W._executableFile=J.executableFile||null,Y)W.arguments(Y);if(this._registerCommand(W),W.parent=this,W.copyInheritedSettings(this),z)return this;return W}createCommand($){return new D8($)}createHelp(){return Object.assign(new CY,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...$},this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,Z){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
15
+ - specify the name in Command constructor or using .name()`);if(Z=Z||{},Z.isDefault)this._defaultCommandName=$._name;if(Z.noHelp||Z.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,Z){return new FY($,Z)}argument($,Z,X,z){let J=this.createArgument($,Z);if(typeof X==="function")J.default(z).argParser(X);else J.default(X);return this.addArgument(J),this}arguments($){return $.trim().split(/ +/).forEach((Z)=>{this.argument(Z)}),this}addArgument($){let Z=this.registeredArguments.slice(-1)[0];if(Z?.variadic)throw Error(`only the last argument can be variadic '${Z.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}helpCommand($,Z){if(typeof $==="boolean"){if(this._addImplicitHelpCommand=$,$&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let X=$??"help [command]",[,z,J]=X.match(/([^ ]+) *(.*)/),Q=Z??"display help for command",Y=this.createCommand(z);if(Y.helpOption(!1),J)Y.arguments(J);if(Q)Y.description(Q);if(this._addImplicitHelpCommand=!0,this._helpCommand=Y,$||Z)this._initCommandGroup(Y);return this}addHelpCommand($,Z){if(typeof $!=="object")return this.helpCommand($,Z),this;return this._addImplicitHelpCommand=!0,this._helpCommand=$,this._initCommandGroup($),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($,Z){let X=["preSubcommand","preAction","postAction"];if(!X.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
16
+ Expecting one of '${X.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(Z);else this._lifeCycleHooks[$]=[Z];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(Z)=>{if(Z.code!=="commander.executeSubCommandAsync")throw Z};return this}_exit($,Z,X){if(this._exitCallback)this._exitCallback(new N8($,Z,X));r.exit($)}action($){let Z=(X)=>{let z=this.registeredArguments.length,J=X.slice(0,z);if(this._storeOptionsAsProperties)J[z]=this;else J[z]=this.opts();return J.push(this),$.apply(this,J)};return this._actionHandler=Z,this}createOption($,Z){return new p5($,Z)}_callParseArg($,Z,X,z){try{return $.parseArg(Z,X)}catch(J){if(J.code==="commander.invalidArgument"){let Q=`${z} ${J.message}`;this.error(Q,{exitCode:J.exitCode,code:J.code})}throw J}}_registerOption($){let Z=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(Z){let X=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${X}'
17
+ - already used by option '${Z.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let Z=(z)=>{return[z.name()].concat(z.aliases())},X=Z($).find((z)=>this._findCommand(z));if(X){let z=Z(this._findCommand(X)).join("|"),J=Z($).join("|");throw Error(`cannot add command '${J}' as already have command '${z}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let Z=$.name(),X=$.attributeName();if($.negate){let J=$.long.replace(/^--no-/,"--");if(!this._findOption(J))this.setOptionValueWithSource(X,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(X,$.defaultValue,"default");let z=(J,Q,Y)=>{if(J==null&&$.presetArg!==void 0)J=$.presetArg;let W=this.getOptionValue(X);if(J!==null&&$.parseArg)J=this._callParseArg($,J,W,Q);else if(J!==null&&$.variadic)J=$._collectValue(J,W);if(J==null)if($.negate)J=!1;else if($.isBoolean()||$.optional)J=!0;else J="";this.setOptionValueWithSource(X,J,Y)};if(this.on("option:"+Z,(J)=>{let Q=`error: option '${$.flags}' argument '${J}' is invalid.`;z(J,Q,"cli")}),$.envVar)this.on("optionEnv:"+Z,(J)=>{let Q=`error: option '${$.flags}' value '${J}' from env '${$.envVar}' is invalid.`;z(J,Q,"env")});return this}_optionEx($,Z,X,z,J){if(typeof Z==="object"&&Z instanceof p5)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let Q=this.createOption(Z,X);if(Q.makeOptionMandatory(!!$.mandatory),typeof z==="function")Q.default(J).argParser(z);else if(z instanceof RegExp){let Y=z;z=(W,U)=>{let G=Y.exec(W);return G?G[0]:U},Q.default(J).argParser(z)}else Q.default(z);return this.addOption(Q)}option($,Z,X,z){return this._optionEx({},$,Z,X,z)}requiredOption($,Z,X,z){return this._optionEx({mandatory:!0},$,Z,X,z)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,Z){return this.setOptionValueWithSource($,Z,void 0)}setOptionValueWithSource($,Z,X){if(this._storeOptionsAsProperties)this[$]=Z;else this._optionValues[$]=Z;return this._optionValueSources[$]=X,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let Z;return this._getCommandAndAncestors().forEach((X)=>{if(X.getOptionValueSource($)!==void 0)Z=X.getOptionValueSource($)}),Z}_prepareUserArgs($,Z){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(Z=Z||{},$===void 0&&Z.from===void 0){if(r.versions?.electron)Z.from="electron";let z=r.execArgv??[];if(z.includes("-e")||z.includes("--eval")||z.includes("-p")||z.includes("--print"))Z.from="eval"}if($===void 0)$=r.argv;this.rawArgs=$.slice();let X;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],X=$.slice(2);break;case"electron":if(r.defaultApp)this._scriptPath=$[1],X=$.slice(2);else X=$.slice(1);break;case"user":X=$.slice(0);break;case"eval":X=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${Z.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",X}parse($,Z){this._prepareForParse();let X=this._prepareUserArgs($,Z);return this._parseCommand([],X),this}async parseAsync($,Z){this._prepareForParse();let X=this._prepareUserArgs($,Z);return await this._parseCommand([],X),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 Error(`Can not call parse again when storeOptionsAsProperties is true.
18
+ - 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($,Z,X){if(T4.existsSync($))return;let z=Z?`searched for local subcommand relative to directory '${Z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",J=`'${$}' does not exist
19
19
  - if '${X}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
20
20
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
21
- - ${z}`;throw Error(J)}_executeSubCommand($,Z){Z=Z.slice();let X=!1,z=[".js",".ts",".tsx",".mjs",".cjs"];function J(G,q){let V=n0.resolve(G,q);if(M3.existsSync(V))return V;if(z.includes(n0.extname(q)))return;let K=z.find((B)=>M3.existsSync(`${V}${B}`));if(K)return`${V}${K}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Q=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let G;try{G=M3.realpathSync(this._scriptPath)}catch{G=this._scriptPath}Y=n0.resolve(n0.dirname(G),Y)}if(Y){let G=J(Y,Q);if(!G&&!$._executableFile&&this._scriptPath){let q=n0.basename(this._scriptPath,n0.extname(this._scriptPath));if(q!==this._name)G=J(Y,`${q}-${$._name}`)}Q=G||Q}X=z.includes(n0.extname(Q));let W;if(n.platform!=="win32")if(X)Z.unshift(Q),Z=c5(n.execArgv).concat(Z),W=H8.spawn(n.argv[0],Z,{stdio:"inherit"});else W=H8.spawn(Q,Z,{stdio:"inherit"});else this._checkForMissingExecutable(Q,Y,$._name),Z.unshift(Q),Z=c5(n.execArgv).concat(Z),W=H8.spawn(n.execPath,Z,{stdio:"inherit"});if(!W.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((q)=>{n.on(q,()=>{if(W.killed===!1&&W.exitCode===null)W.kill(q)})});let U=this._exitCallback;W.on("close",(G)=>{if(G=G??1,!U)n.exit(G);else U(new B8(G,"commander.executeSubCommandAsync","(close)"))}),W.on("error",(G)=>{if(G.code==="ENOENT")this._checkForMissingExecutable(Q,Y,$._name);else if(G.code==="EACCES")throw Error(`'${Q}' not executable`);if(!U)n.exit(1);else{let q=new B8(1,"commander.executeSubCommandAsync","(error)");q.nestedError=G,U(q)}}),this.runningCommand=W}_dispatchSubcommand($,Z,X){let z=this._findCommand($);if(!z)this.help({error:!0});z._prepareForParse();let J;return J=this._chainOrCallSubCommandHook(J,z,"preSubcommand"),J=this._chainOrCall(J,()=>{if(z._executableHandler)this._executeSubCommand(z,Z.concat(X));else return z._parseCommand(Z,X)}),J}_dispatchHelpCommand($){if(!$)this.help();let Z=this._findCommand($);if(Z&&!Z._executableHandler)Z.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,Z)=>{if($.required&&this.args[Z]==null)this.missingArgument($.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 $=(X,z,J)=>{let Q=z;if(z!==null&&X.parseArg){let Y=`error: command-argument value '${z}' is invalid for argument '${X.name()}'.`;Q=this._callParseArg(X,z,J,Y)}return Q};this._checkNumberOfArguments();let Z=[];this.registeredArguments.forEach((X,z)=>{let J=X.defaultValue;if(X.variadic){if(z<this.args.length){if(J=this.args.slice(z),X.parseArg)J=J.reduce((Q,Y)=>{return $(X,Y,Q)},X.defaultValue)}else if(J===void 0)J=[]}else if(z<this.args.length){if(J=this.args[z],X.parseArg)J=$(X,J,X.defaultValue)}Z[z]=J}),this.processedArgs=Z}_chainOrCall($,Z){if($?.then&&typeof $.then==="function")return $.then(()=>Z());return Z()}_chainOrCallHooks($,Z){let X=$,z=[];if(this._getCommandAndAncestors().reverse().filter((J)=>J._lifeCycleHooks[Z]!==void 0).forEach((J)=>{J._lifeCycleHooks[Z].forEach((Q)=>{z.push({hookedCommand:J,callback:Q})})}),Z==="postAction")z.reverse();return z.forEach((J)=>{X=this._chainOrCall(X,()=>{return J.callback(J.hookedCommand,this)})}),X}_chainOrCallSubCommandHook($,Z,X){let z=$;if(this._lifeCycleHooks[X]!==void 0)this._lifeCycleHooks[X].forEach((J)=>{z=this._chainOrCall(z,()=>{return J(this,Z)})});return z}_parseCommand($,Z){let X=this.parseOptions(Z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(X.operands),Z=X.unknown,this.args=$.concat(Z),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),Z);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(Z),this._dispatchSubcommand(this._defaultCommandName,$,Z);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(X.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let z=()=>{if(X.unknown.length>0)this.unknownOption(X.unknown[0])},J=`command:${this.name()}`;if(this._actionHandler){z(),this._processArguments();let Q;if(Q=this._chainOrCallHooks(Q,"preAction"),Q=this._chainOrCall(Q,()=>this._actionHandler(this.processedArgs)),this.parent)Q=this._chainOrCall(Q,()=>{this.parent.emit(J,$,Z)});return Q=this._chainOrCallHooks(Q,"postAction"),Q}if(this.parent?.listenerCount(J))z(),this._processArguments(),this.parent.emit(J,$,Z);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,Z);if(this.listenerCount("command:*"))this.emit("command:*",$,Z);else if(this.commands.length)this.unknownCommand();else z(),this._processArguments()}else if(this.commands.length)z(),this.help({error:!0});else z(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((Z)=>Z._name===$||Z._aliases.includes($))}_findOption($){return this.options.find((Z)=>Z.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((Z)=>{if(Z.mandatory&&$.getOptionValue(Z.attributeName())===void 0)$.missingMandatoryOptionValue(Z)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((X)=>{let z=X.attributeName();if(this.getOptionValue(z)===void 0)return!1;return this.getOptionValueSource(z)!=="default"});$.filter((X)=>X.conflictsWith.length>0).forEach((X)=>{let z=$.find((J)=>X.conflictsWith.includes(J.attributeName()));if(z)this._conflictingOption(X,z)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let Z=[],X=[],z=Z;function J(G){return G.length>1&&G[0]==="-"}let Q=(G)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(G))return!1;return!this._getCommandAndAncestors().some((q)=>q.options.map((V)=>V.short).some((V)=>/^-\d$/.test(V)))},Y=null,W=null,U=0;while(U<$.length||W){let G=W??$[U++];if(W=null,G==="--"){if(z===X)z.push(G);z.push(...$.slice(U));break}if(Y&&(!J(G)||Q(G))){this.emit(`option:${Y.name()}`,G);continue}if(Y=null,J(G)){let q=this._findOption(G);if(q){if(q.required){let V=$[U++];if(V===void 0)this.optionMissingArgument(q);this.emit(`option:${q.name()}`,V)}else if(q.optional){let V=null;if(U<$.length&&(!J($[U])||Q($[U])))V=$[U++];this.emit(`option:${q.name()}`,V)}else this.emit(`option:${q.name()}`);Y=q.variadic?q:null;continue}}if(G.length>2&&G[0]==="-"&&G[1]!=="-"){let q=this._findOption(`-${G[1]}`);if(q){if(q.required||q.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${q.name()}`,G.slice(2));else this.emit(`option:${q.name()}`),W=`-${G.slice(2)}`;continue}}if(/^--[^=]+=/.test(G)){let q=G.indexOf("="),V=this._findOption(G.slice(0,q));if(V&&(V.required||V.optional)){this.emit(`option:${V.name()}`,G.slice(q+1));continue}}if(z===Z&&J(G)&&!(this.commands.length===0&&Q(G)))z=X;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&X.length===0){if(this._findCommand(G)){Z.push(G),X.push(...$.slice(U));break}else if(this._getHelpCommand()&&G===this._getHelpCommand().name()){Z.push(G,...$.slice(U));break}else if(this._defaultCommandName){X.push(G,...$.slice(U));break}}if(this._passThroughOptions){z.push(G,...$.slice(U));break}z.push(G)}return{operands:Z,unknown:X}}opts(){if(this._storeOptionsAsProperties){let $={},Z=this.options.length;for(let X=0;X<Z;X++){let z=this.options[X].attributeName();$[z]=z===this._versionOptionName?this._version:this[z]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,Z)=>Object.assign($,Z.opts()),{})}error($,Z){if(this._outputConfiguration.outputError(`${$}
21
+ - ${z}`;throw Error(J)}_executeSubCommand($,Z){Z=Z.slice();let X=!1,z=[".js",".ts",".tsx",".mjs",".cjs"];function J(G,q){let V=n0.resolve(G,q);if(T4.existsSync(V))return V;if(z.includes(n0.extname(q)))return;let K=z.find((H)=>T4.existsSync(`${V}${H}`));if(K)return`${V}${K}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Q=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let G;try{G=T4.realpathSync(this._scriptPath)}catch{G=this._scriptPath}Y=n0.resolve(n0.dirname(G),Y)}if(Y){let G=J(Y,Q);if(!G&&!$._executableFile&&this._scriptPath){let q=n0.basename(this._scriptPath,n0.extname(this._scriptPath));if(q!==this._name)G=J(Y,`${q}-${$._name}`)}Q=G||Q}X=z.includes(n0.extname(Q));let W;if(r.platform!=="win32")if(X)Z.unshift(Q),Z=n5(r.execArgv).concat(Z),W=O8.spawn(r.argv[0],Z,{stdio:"inherit"});else W=O8.spawn(Q,Z,{stdio:"inherit"});else this._checkForMissingExecutable(Q,Y,$._name),Z.unshift(Q),Z=n5(r.execArgv).concat(Z),W=O8.spawn(r.execPath,Z,{stdio:"inherit"});if(!W.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((q)=>{r.on(q,()=>{if(W.killed===!1&&W.exitCode===null)W.kill(q)})});let U=this._exitCallback;W.on("close",(G)=>{if(G=G??1,!U)r.exit(G);else U(new N8(G,"commander.executeSubCommandAsync","(close)"))}),W.on("error",(G)=>{if(G.code==="ENOENT")this._checkForMissingExecutable(Q,Y,$._name);else if(G.code==="EACCES")throw Error(`'${Q}' not executable`);if(!U)r.exit(1);else{let q=new N8(1,"commander.executeSubCommandAsync","(error)");q.nestedError=G,U(q)}}),this.runningCommand=W}_dispatchSubcommand($,Z,X){let z=this._findCommand($);if(!z)this.help({error:!0});z._prepareForParse();let J;return J=this._chainOrCallSubCommandHook(J,z,"preSubcommand"),J=this._chainOrCall(J,()=>{if(z._executableHandler)this._executeSubCommand(z,Z.concat(X));else return z._parseCommand(Z,X)}),J}_dispatchHelpCommand($){if(!$)this.help();let Z=this._findCommand($);if(Z&&!Z._executableHandler)Z.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,Z)=>{if($.required&&this.args[Z]==null)this.missingArgument($.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 $=(X,z,J)=>{let Q=z;if(z!==null&&X.parseArg){let Y=`error: command-argument value '${z}' is invalid for argument '${X.name()}'.`;Q=this._callParseArg(X,z,J,Y)}return Q};this._checkNumberOfArguments();let Z=[];this.registeredArguments.forEach((X,z)=>{let J=X.defaultValue;if(X.variadic){if(z<this.args.length){if(J=this.args.slice(z),X.parseArg)J=J.reduce((Q,Y)=>{return $(X,Y,Q)},X.defaultValue)}else if(J===void 0)J=[]}else if(z<this.args.length){if(J=this.args[z],X.parseArg)J=$(X,J,X.defaultValue)}Z[z]=J}),this.processedArgs=Z}_chainOrCall($,Z){if($?.then&&typeof $.then==="function")return $.then(()=>Z());return Z()}_chainOrCallHooks($,Z){let X=$,z=[];if(this._getCommandAndAncestors().reverse().filter((J)=>J._lifeCycleHooks[Z]!==void 0).forEach((J)=>{J._lifeCycleHooks[Z].forEach((Q)=>{z.push({hookedCommand:J,callback:Q})})}),Z==="postAction")z.reverse();return z.forEach((J)=>{X=this._chainOrCall(X,()=>{return J.callback(J.hookedCommand,this)})}),X}_chainOrCallSubCommandHook($,Z,X){let z=$;if(this._lifeCycleHooks[X]!==void 0)this._lifeCycleHooks[X].forEach((J)=>{z=this._chainOrCall(z,()=>{return J(this,Z)})});return z}_parseCommand($,Z){let X=this.parseOptions(Z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(X.operands),Z=X.unknown,this.args=$.concat(Z),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),Z);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(Z),this._dispatchSubcommand(this._defaultCommandName,$,Z);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(X.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let z=()=>{if(X.unknown.length>0)this.unknownOption(X.unknown[0])},J=`command:${this.name()}`;if(this._actionHandler){z(),this._processArguments();let Q;if(Q=this._chainOrCallHooks(Q,"preAction"),Q=this._chainOrCall(Q,()=>this._actionHandler(this.processedArgs)),this.parent)Q=this._chainOrCall(Q,()=>{this.parent.emit(J,$,Z)});return Q=this._chainOrCallHooks(Q,"postAction"),Q}if(this.parent?.listenerCount(J))z(),this._processArguments(),this.parent.emit(J,$,Z);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,Z);if(this.listenerCount("command:*"))this.emit("command:*",$,Z);else if(this.commands.length)this.unknownCommand();else z(),this._processArguments()}else if(this.commands.length)z(),this.help({error:!0});else z(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((Z)=>Z._name===$||Z._aliases.includes($))}_findOption($){return this.options.find((Z)=>Z.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((Z)=>{if(Z.mandatory&&$.getOptionValue(Z.attributeName())===void 0)$.missingMandatoryOptionValue(Z)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((X)=>{let z=X.attributeName();if(this.getOptionValue(z)===void 0)return!1;return this.getOptionValueSource(z)!=="default"});$.filter((X)=>X.conflictsWith.length>0).forEach((X)=>{let z=$.find((J)=>X.conflictsWith.includes(J.attributeName()));if(z)this._conflictingOption(X,z)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let Z=[],X=[],z=Z;function J(G){return G.length>1&&G[0]==="-"}let Q=(G)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(G))return!1;return!this._getCommandAndAncestors().some((q)=>q.options.map((V)=>V.short).some((V)=>/^-\d$/.test(V)))},Y=null,W=null,U=0;while(U<$.length||W){let G=W??$[U++];if(W=null,G==="--"){if(z===X)z.push(G);z.push(...$.slice(U));break}if(Y&&(!J(G)||Q(G))){this.emit(`option:${Y.name()}`,G);continue}if(Y=null,J(G)){let q=this._findOption(G);if(q){if(q.required){let V=$[U++];if(V===void 0)this.optionMissingArgument(q);this.emit(`option:${q.name()}`,V)}else if(q.optional){let V=null;if(U<$.length&&(!J($[U])||Q($[U])))V=$[U++];this.emit(`option:${q.name()}`,V)}else this.emit(`option:${q.name()}`);Y=q.variadic?q:null;continue}}if(G.length>2&&G[0]==="-"&&G[1]!=="-"){let q=this._findOption(`-${G[1]}`);if(q){if(q.required||q.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${q.name()}`,G.slice(2));else this.emit(`option:${q.name()}`),W=`-${G.slice(2)}`;continue}}if(/^--[^=]+=/.test(G)){let q=G.indexOf("="),V=this._findOption(G.slice(0,q));if(V&&(V.required||V.optional)){this.emit(`option:${V.name()}`,G.slice(q+1));continue}}if(z===Z&&J(G)&&!(this.commands.length===0&&Q(G)))z=X;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&X.length===0){if(this._findCommand(G)){Z.push(G),X.push(...$.slice(U));break}else if(this._getHelpCommand()&&G===this._getHelpCommand().name()){Z.push(G,...$.slice(U));break}else if(this._defaultCommandName){X.push(G,...$.slice(U));break}}if(this._passThroughOptions){z.push(G,...$.slice(U));break}z.push(G)}return{operands:Z,unknown:X}}opts(){if(this._storeOptionsAsProperties){let $={},Z=this.options.length;for(let X=0;X<Z;X++){let z=this.options[X].attributeName();$[z]=z===this._versionOptionName?this._version:this[z]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,Z)=>Object.assign($,Z.opts()),{})}error($,Z){if(this._outputConfiguration.outputError(`${$}
22
22
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
23
23
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
24
- `),this.outputHelp({error:!0});let X=Z||{},z=X.exitCode||1,J=X.code||"commander.error";this._exit(z,J,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in n.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,n.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new AY(this.options),Z=(X)=>{return this.getOptionValue(X)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(X))};this.options.filter((X)=>X.implied!==void 0&&Z(X.attributeName())&&$.valueFromOption(this.getOptionValue(X.attributeName()),X)).forEach((X)=>{Object.keys(X.implied).filter((z)=>!Z(z)).forEach((z)=>{this.setOptionValueWithSource(z,X.implied[z],"implied")})})}missingArgument($){let Z=`error: missing required argument '${$}'`;this.error(Z,{code:"commander.missingArgument"})}optionMissingArgument($){let Z=`error: option '${$.flags}' argument missing`;this.error(Z,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let Z=`error: required option '${$.flags}' not specified`;this.error(Z,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,Z){let X=(Q)=>{let Y=Q.attributeName(),W=this.getOptionValue(Y),U=this.options.find((q)=>q.negate&&Y===q.attributeName()),G=this.options.find((q)=>!q.negate&&Y===q.attributeName());if(U&&(U.presetArg===void 0&&W===!1||U.presetArg!==void 0&&W===U.presetArg))return U;return G||Q},z=(Q)=>{let Y=X(Q),W=Y.attributeName();if(this.getOptionValueSource(W)==="env")return`environment variable '${Y.envVar}'`;return`option '${Y.flags}'`},J=`error: ${z($)} cannot be used with ${z(Z)}`;this.error(J,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let Z="";if($.startsWith("--")&&this._showSuggestionAfterError){let z=[],J=this;do{let Q=J.createHelp().visibleOptions(J).filter((Y)=>Y.long).map((Y)=>Y.long);z=z.concat(Q),J=J.parent}while(J&&!J._enablePositionalOptions);Z=m5($,z)}let X=`error: unknown option '${$}'${Z}`;this.error(X,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let Z=this.registeredArguments.length,X=Z===1?"":"s",J=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Z} argument${X} but got ${$.length}.`;this.error(J,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],Z="";if(this._showSuggestionAfterError){let z=[];this.createHelp().visibleCommands(this).forEach((J)=>{if(z.push(J.name()),J.alias())z.push(J.alias())}),Z=m5($,z)}let X=`error: unknown command '${$}'${Z}`;this.error(X,{code:"commander.unknownCommand"})}version($,Z,X){if($===void 0)return this._version;this._version=$,Z=Z||"-V, --version",X=X||"output the version number";let z=this.createOption(Z,X);return this._versionOptionName=z.attributeName(),this._registerOption(z),this.on("option:"+z.name(),()=>{this._outputConfiguration.writeOut(`${$}
25
- `),this._exit(0,"commander.version",$)}),this}description($,Z){if($===void 0&&Z===void 0)return this._description;if(this._description=$,Z)this._argsDescription=Z;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let Z=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)Z=this.commands[this.commands.length-1];if($===Z._name)throw Error("Command alias can't be the same as its name");let X=this.parent?._findCommand($);if(X){let z=[X.name()].concat(X.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${z}'`)}return Z._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((Z)=>this.alias(Z)),this}usage($){if($===void 0){if(this._usage)return this._usage;let Z=this.registeredArguments.map((X)=>{return TY(X)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?Z:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}helpGroup($){if($===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=$,this}commandsGroup($){if($===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=$,this}optionsGroup($){if($===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=$,this}_initOptionGroup($){if(this._defaultOptionGroup&&!$.helpGroupHeading)$.helpGroup(this._defaultOptionGroup)}_initCommandGroup($){if(this._defaultCommandGroup&&!$.helpGroup())$.helpGroup(this._defaultCommandGroup)}nameFromFilename($){return this._name=n0.basename($,n0.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let Z=this.createHelp(),X=this._getOutputContext($);Z.prepareContext({error:X.error,helpWidth:X.helpWidth,outputHasColors:X.hasColors});let z=Z.formatHelp(this,Z);if(X.hasColors)return z;return this._outputConfiguration.stripColor(z)}_getOutputContext($){$=$||{};let Z=!!$.error,X,z,J;if(Z)X=(Y)=>this._outputConfiguration.writeErr(Y),z=this._outputConfiguration.getErrHasColors(),J=this._outputConfiguration.getErrHelpWidth();else X=(Y)=>this._outputConfiguration.writeOut(Y),z=this._outputConfiguration.getOutHasColors(),J=this._outputConfiguration.getOutHelpWidth();return{error:Z,write:(Y)=>{if(!z)Y=this._outputConfiguration.stripColor(Y);return X(Y)},hasColors:z,helpWidth:J}}outputHelp($){let Z;if(typeof $==="function")Z=$,$=void 0;let X=this._getOutputContext($),z={error:X.error,write:X.write,command:this};this._getCommandAndAncestors().reverse().forEach((Q)=>Q.emit("beforeAllHelp",z)),this.emit("beforeHelp",z);let J=this.helpInformation({error:X.error});if(Z){if(J=Z(J),typeof J!=="string"&&!Buffer.isBuffer(J))throw Error("outputHelp callback must return a string or a Buffer")}if(X.write(J),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",z),this._getCommandAndAncestors().forEach((Q)=>Q.emit("afterAllHelp",z))}helpOption($,Z){if(typeof $==="boolean"){if($){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($??"-h, --help",Z??"display help for command"),$||Z)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let Z=Number(n.exitCode??0);if(Z===0&&$&&typeof $!=="function"&&$.error)Z=1;this._exit(Z,"commander.help","(outputHelp)")}addHelpText($,Z){let X=["beforeAll","before","after","afterAll"];if(!X.includes($))throw Error(`Unexpected value for position to addHelpText.
24
+ `),this.outputHelp({error:!0});let X=Z||{},z=X.exitCode||1,J=X.code||"commander.error";this._exit(z,J,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in r.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,r.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new EY(this.options),Z=(X)=>{return this.getOptionValue(X)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(X))};this.options.filter((X)=>X.implied!==void 0&&Z(X.attributeName())&&$.valueFromOption(this.getOptionValue(X.attributeName()),X)).forEach((X)=>{Object.keys(X.implied).filter((z)=>!Z(z)).forEach((z)=>{this.setOptionValueWithSource(z,X.implied[z],"implied")})})}missingArgument($){let Z=`error: missing required argument '${$}'`;this.error(Z,{code:"commander.missingArgument"})}optionMissingArgument($){let Z=`error: option '${$.flags}' argument missing`;this.error(Z,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let Z=`error: required option '${$.flags}' not specified`;this.error(Z,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,Z){let X=(Q)=>{let Y=Q.attributeName(),W=this.getOptionValue(Y),U=this.options.find((q)=>q.negate&&Y===q.attributeName()),G=this.options.find((q)=>!q.negate&&Y===q.attributeName());if(U&&(U.presetArg===void 0&&W===!1||U.presetArg!==void 0&&W===U.presetArg))return U;return G||Q},z=(Q)=>{let Y=X(Q),W=Y.attributeName();if(this.getOptionValueSource(W)==="env")return`environment variable '${Y.envVar}'`;return`option '${Y.flags}'`},J=`error: ${z($)} cannot be used with ${z(Z)}`;this.error(J,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let Z="";if($.startsWith("--")&&this._showSuggestionAfterError){let z=[],J=this;do{let Q=J.createHelp().visibleOptions(J).filter((Y)=>Y.long).map((Y)=>Y.long);z=z.concat(Q),J=J.parent}while(J&&!J._enablePositionalOptions);Z=i5($,z)}let X=`error: unknown option '${$}'${Z}`;this.error(X,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let Z=this.registeredArguments.length,X=Z===1?"":"s",J=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Z} argument${X} but got ${$.length}.`;this.error(J,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],Z="";if(this._showSuggestionAfterError){let z=[];this.createHelp().visibleCommands(this).forEach((J)=>{if(z.push(J.name()),J.alias())z.push(J.alias())}),Z=i5($,z)}let X=`error: unknown command '${$}'${Z}`;this.error(X,{code:"commander.unknownCommand"})}version($,Z,X){if($===void 0)return this._version;this._version=$,Z=Z||"-V, --version",X=X||"output the version number";let z=this.createOption(Z,X);return this._versionOptionName=z.attributeName(),this._registerOption(z),this.on("option:"+z.name(),()=>{this._outputConfiguration.writeOut(`${$}
25
+ `),this._exit(0,"commander.version",$)}),this}description($,Z){if($===void 0&&Z===void 0)return this._description;if(this._description=$,Z)this._argsDescription=Z;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let Z=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)Z=this.commands[this.commands.length-1];if($===Z._name)throw Error("Command alias can't be the same as its name");let X=this.parent?._findCommand($);if(X){let z=[X.name()].concat(X.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${z}'`)}return Z._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((Z)=>this.alias(Z)),this}usage($){if($===void 0){if(this._usage)return this._usage;let Z=this.registeredArguments.map((X)=>{return PY(X)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?Z:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}helpGroup($){if($===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=$,this}commandsGroup($){if($===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=$,this}optionsGroup($){if($===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=$,this}_initOptionGroup($){if(this._defaultOptionGroup&&!$.helpGroupHeading)$.helpGroup(this._defaultOptionGroup)}_initCommandGroup($){if(this._defaultCommandGroup&&!$.helpGroup())$.helpGroup(this._defaultCommandGroup)}nameFromFilename($){return this._name=n0.basename($,n0.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let Z=this.createHelp(),X=this._getOutputContext($);Z.prepareContext({error:X.error,helpWidth:X.helpWidth,outputHasColors:X.hasColors});let z=Z.formatHelp(this,Z);if(X.hasColors)return z;return this._outputConfiguration.stripColor(z)}_getOutputContext($){$=$||{};let Z=!!$.error,X,z,J;if(Z)X=(Y)=>this._outputConfiguration.writeErr(Y),z=this._outputConfiguration.getErrHasColors(),J=this._outputConfiguration.getErrHelpWidth();else X=(Y)=>this._outputConfiguration.writeOut(Y),z=this._outputConfiguration.getOutHasColors(),J=this._outputConfiguration.getOutHelpWidth();return{error:Z,write:(Y)=>{if(!z)Y=this._outputConfiguration.stripColor(Y);return X(Y)},hasColors:z,helpWidth:J}}outputHelp($){let Z;if(typeof $==="function")Z=$,$=void 0;let X=this._getOutputContext($),z={error:X.error,write:X.write,command:this};this._getCommandAndAncestors().reverse().forEach((Q)=>Q.emit("beforeAllHelp",z)),this.emit("beforeHelp",z);let J=this.helpInformation({error:X.error});if(Z){if(J=Z(J),typeof J!=="string"&&!Buffer.isBuffer(J))throw Error("outputHelp callback must return a string or a Buffer")}if(X.write(J),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",z),this._getCommandAndAncestors().forEach((Q)=>Q.emit("afterAllHelp",z))}helpOption($,Z){if(typeof $==="boolean"){if($){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($??"-h, --help",Z??"display help for command"),$||Z)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let Z=Number(r.exitCode??0);if(Z===0&&$&&typeof $!=="function"&&$.error)Z=1;this._exit(Z,"commander.help","(outputHelp)")}addHelpText($,Z){let X=["beforeAll","before","after","afterAll"];if(!X.includes($))throw Error(`Unexpected value for position to addHelpText.
26
26
  Expecting one of '${X.join("', '")}'`);let z=`${$}Help`;return this.on(z,(J)=>{let Q;if(typeof Z==="function")Q=Z({error:J.error,command:J.command});else Q=Z;if(Q)J.write(`${Q}
27
- `)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((z)=>Z.is(z)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function c5($){return $.map((Z)=>{if(!Z.startsWith("--inspect"))return Z;let X,z="127.0.0.1",J="9229",Q;if((Q=Z.match(/^(--inspect(-brk)?)$/))!==null)X=Q[1];else if((Q=Z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(X=Q[1],/^\d+$/.test(Q[3]))J=Q[3];else z=Q[3];else if((Q=Z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)X=Q[1],z=Q[3],J=Q[4];if(X&&J!=="0")return`${X}=${z}:${parseInt(J)+1}`;return Z})}function L8(){if(n.env.NO_COLOR||n.env.FORCE_COLOR==="0"||n.env.FORCE_COLOR==="false")return!1;if(n.env.FORCE_COLOR||n.env.CLICOLOR_FORCE!==void 0)return!0;return}RY.Command=N8;RY.useColor=L8});var n5=F((CY)=>{var{Argument:l5}=N3(),{Command:M8}=d5(),{CommanderError:PY,InvalidArgumentError:p5}=c$(),{Help:wY}=V8(),{Option:i5}=K8();CY.program=new M8;CY.createCommand=($)=>new M8($);CY.createOption=($,Z)=>new i5($,Z);CY.createArgument=($,Z)=>new l5($,Z);CY.Command=M8;CY.Option=i5;CY.Argument=l5;CY.Help=wY;CY.CommanderError=PY;CY.InvalidArgumentError=p5;CY.InvalidOptionArgumentError=p5});var p=F((nY)=>{var O8=Symbol.for("yaml.alias"),a5=Symbol.for("yaml.document"),O3=Symbol.for("yaml.map"),o5=Symbol.for("yaml.pair"),T8=Symbol.for("yaml.scalar"),T3=Symbol.for("yaml.seq"),r0=Symbol.for("yaml.node.type"),uY=($)=>!!$&&typeof $==="object"&&$[r0]===O8,mY=($)=>!!$&&typeof $==="object"&&$[r0]===a5,cY=($)=>!!$&&typeof $==="object"&&$[r0]===O3,dY=($)=>!!$&&typeof $==="object"&&$[r0]===o5,t5=($)=>!!$&&typeof $==="object"&&$[r0]===T8,lY=($)=>!!$&&typeof $==="object"&&$[r0]===T3;function e5($){if($&&typeof $==="object")switch($[r0]){case O3:case T3:return!0}return!1}function pY($){if($&&typeof $==="object")switch($[r0]){case O8:case O3:case T8:case T3:return!0}return!1}var iY=($)=>(t5($)||e5($))&&!!$.anchor;nY.ALIAS=O8;nY.DOC=a5;nY.MAP=O3;nY.NODE_TYPE=r0;nY.PAIR=o5;nY.SCALAR=T8;nY.SEQ=T3;nY.hasAnchor=iY;nY.isAlias=uY;nY.isCollection=e5;nY.isDocument=mY;nY.isMap=cY;nY.isNode=pY;nY.isPair=dY;nY.isScalar=t5;nY.isSeq=lY});var d$=F((qW)=>{var W0=p(),O0=Symbol("break visit"),$7=Symbol("skip children"),d0=Symbol("remove node");function D3($,Z){let X=Z7(Z);if(W0.isDocument($)){if(n1(null,$.contents,X,Object.freeze([$]))===d0)$.contents=null}else n1(null,$,X,Object.freeze([]))}D3.BREAK=O0;D3.SKIP=$7;D3.REMOVE=d0;function n1($,Z,X,z){let J=X7($,Z,X,z);if(W0.isNode(J)||W0.isPair(J))return z7($,z,J),n1($,J,X,z);if(typeof J!=="symbol"){if(W0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let Q=0;Q<Z.items.length;++Q){let Y=n1(Q,Z.items[Q],X,z);if(typeof Y==="number")Q=Y-1;else if(Y===O0)return O0;else if(Y===d0)Z.items.splice(Q,1),Q-=1}}else if(W0.isPair(Z)){z=Object.freeze(z.concat(Z));let Q=n1("key",Z.key,X,z);if(Q===O0)return O0;else if(Q===d0)Z.key=null;let Y=n1("value",Z.value,X,z);if(Y===O0)return O0;else if(Y===d0)Z.value=null}}return J}async function I3($,Z){let X=Z7(Z);if(W0.isDocument($)){if(await r1(null,$.contents,X,Object.freeze([$]))===d0)$.contents=null}else await r1(null,$,X,Object.freeze([]))}I3.BREAK=O0;I3.SKIP=$7;I3.REMOVE=d0;async function r1($,Z,X,z){let J=await X7($,Z,X,z);if(W0.isNode(J)||W0.isPair(J))return z7($,z,J),r1($,J,X,z);if(typeof J!=="symbol"){if(W0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let Q=0;Q<Z.items.length;++Q){let Y=await r1(Q,Z.items[Q],X,z);if(typeof Y==="number")Q=Y-1;else if(Y===O0)return O0;else if(Y===d0)Z.items.splice(Q,1),Q-=1}}else if(W0.isPair(Z)){z=Object.freeze(z.concat(Z));let Q=await r1("key",Z.key,X,z);if(Q===O0)return O0;else if(Q===d0)Z.key=null;let Y=await r1("value",Z.value,X,z);if(Y===O0)return O0;else if(Y===d0)Z.value=null}}return J}function Z7($){if(typeof $==="object"&&($.Collection||$.Node||$.Value))return Object.assign({Alias:$.Node,Map:$.Node,Scalar:$.Node,Seq:$.Node},$.Value&&{Map:$.Value,Scalar:$.Value,Seq:$.Value},$.Collection&&{Map:$.Collection,Seq:$.Collection},$);return $}function X7($,Z,X,z){if(typeof X==="function")return X($,Z,z);if(W0.isMap(Z))return X.Map?.($,Z,z);if(W0.isSeq(Z))return X.Seq?.($,Z,z);if(W0.isPair(Z))return X.Pair?.($,Z,z);if(W0.isScalar(Z))return X.Scalar?.($,Z,z);if(W0.isAlias(Z))return X.Alias?.($,Z,z);return}function z7($,Z,X){let z=Z[Z.length-1];if(W0.isCollection(z))z.items[$]=X;else if(W0.isPair(z))if($==="key")z.key=X;else z.value=X;else if(W0.isDocument(z))z.contents=X;else{let J=W0.isAlias(z)?"alias":"scalar";throw Error(`Cannot replace node with ${J} parent`)}}qW.visit=D3;qW.visitAsync=I3});var D8=F((NW)=>{var J7=p(),HW=d$(),BW={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},LW=($)=>$.replace(/[!,[\]{}]/g,(Z)=>BW[Z]);class S0{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},S0.defaultYaml,$),this.tags=Object.assign({},S0.defaultTags,Z)}clone(){let $=new S0(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new S0(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:S0.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},S0.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:S0.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},S0.defaultTags),this.atNextDocument=!1;let X=$.trim().split(/[ \t]+/),z=X.shift();switch(z){case"%TAG":{if(X.length!==2){if(Z(0,"%TAG directive should contain exactly two parts"),X.length<2)return!1}let[J,Q]=X;return this.tags[J]=Q,!0}case"%YAML":{if(this.yaml.explicit=!0,X.length!==1)return Z(0,"%YAML directive should contain exactly one part"),!1;let[J]=X;if(J==="1.1"||J==="1.2")return this.yaml.version=J,!0;else{let Q=/^\d+\.\d+$/.test(J);return Z(6,`Unsupported YAML version ${J}`,Q),!1}}default:return Z(0,`Unknown directive ${z}`,!0),!1}}tagName($,Z){if($==="!")return"!";if($[0]!=="!")return Z(`Not a valid tag: ${$}`),null;if($[1]==="<"){let Q=$.slice(2,-1);if(Q==="!"||Q==="!!")return Z(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")Z("Verbatim tags must end with a >");return Q}let[,X,z]=$.match(/^(.*!)([^!]*)$/s);if(!z)Z(`The ${$} tag has no suffix`);let J=this.tags[X];if(J)try{return J+decodeURIComponent(z)}catch(Q){return Z(String(Q)),null}if(X==="!")return $;return Z(`Could not resolve tag: ${$}`),null}tagString($){for(let[Z,X]of Object.entries(this.tags))if($.startsWith(X))return Z+LW($.substring(X.length));return $[0]==="!"?$:`!<${$}>`}toString($){let Z=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],X=Object.entries(this.tags),z;if($&&X.length>0&&J7.isNode($.contents)){let J={};HW.visit($.contents,(Q,Y)=>{if(J7.isNode(Y)&&Y.tag)J[Y.tag]=!0}),z=Object.keys(J)}else z=[];for(let[J,Q]of X){if(J==="!!"&&Q==="tag:yaml.org,2002:")continue;if(!$||z.some((Y)=>Y.startsWith(Q)))Z.push(`%TAG ${J} ${Q}`)}return Z.join(`
28
- `)}}S0.defaultYaml={explicit:!1,version:"1.2"};S0.defaultTags={"!!":"tag:yaml.org,2002:"};NW.Directives=S0});var A3=F((IW)=>{var Q7=p(),OW=d$();function TW($){if(/[\x00-\x19\s,[\]{}]/.test($)){let X=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(X)}return!0}function Y7($){let Z=new Set;return OW.visit($,{Value(X,z){if(z.anchor)Z.add(z.anchor)}}),Z}function W7($,Z){for(let X=1;;++X){let z=`${$}${X}`;if(!Z.has(z))return z}}function DW($,Z){let X=[],z=new Map,J=null;return{onAnchor:(Q)=>{X.push(Q),J??(J=Y7($));let Y=W7(Z,J);return J.add(Y),Y},setAnchors:()=>{for(let Q of X){let Y=z.get(Q);if(typeof Y==="object"&&Y.anchor&&(Q7.isScalar(Y.node)||Q7.isCollection(Y.node)))Y.node.anchor=Y.anchor;else{let W=Error("Failed to resolve repeated object (this should not happen)");throw W.source=Q,W}}},sourceObjects:z}}IW.anchorIsValid=TW;IW.anchorNames=Y7;IW.createNodeAnchors=DW;IW.findNewAnchor=W7});var I8=F((PW)=>{function l$($,Z,X,z){if(z&&typeof z==="object")if(Array.isArray(z))for(let J=0,Q=z.length;J<Q;++J){let Y=z[J],W=l$($,z,String(J),Y);if(W===void 0)delete z[J];else if(W!==Y)z[J]=W}else if(z instanceof Map)for(let J of Array.from(z.keys())){let Q=z.get(J),Y=l$($,z,J,Q);if(Y===void 0)z.delete(J);else if(Y!==Q)z.set(J,Y)}else if(z instanceof Set)for(let J of Array.from(z)){let Q=l$($,z,J,J);if(Q===void 0)z.delete(J);else if(Q!==J)z.delete(J),z.add(Q)}else for(let[J,Q]of Object.entries(z)){let Y=l$($,z,J,Q);if(Y===void 0)delete z[J];else if(Y!==Q)z[J]=Y}return $.call(Z,X,z)}PW.applyReviver=l$});var Y1=F((EW)=>{var CW=p();function U7($,Z,X){if(Array.isArray($))return $.map((z,J)=>U7(z,String(J),X));if($&&typeof $.toJSON==="function"){if(!X||!CW.hasAnchor($))return $.toJSON(Z,X);let z={aliasCount:0,count:1,res:void 0};X.anchors.set($,z),X.onCreate=(Q)=>{z.res=Q,delete X.onCreate};let J=$.toJSON(Z,X);if(X.onCreate)X.onCreate(J);return J}if(typeof $==="bigint"&&!X?.keep)return Number($);return $}EW.toJS=U7});var R3=F((bW)=>{var SW=I8(),G7=p(),xW=Y1();class q7{constructor($){Object.defineProperty(this,G7.NODE_TYPE,{value:$})}clone(){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)$.range=this.range.slice();return $}toJS($,{mapAsMap:Z,maxAliasCount:X,onAnchor:z,reviver:J}={}){if(!G7.isDocument($))throw TypeError("A document argument is required");let Q={anchors:new Map,doc:$,keep:!0,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof X==="number"?X:100},Y=xW.toJS(this,"",Q);if(typeof z==="function")for(let{count:W,res:U}of Q.anchors.values())z(U,W);return typeof J==="function"?SW.applyReviver(J,{"":Y},"",Y):Y}}bW.NodeBase=q7});var p$=F((hW)=>{var yW=A3(),fW=d$(),s1=p(),gW=R3(),vW=Y1();class V7 extends gW.NodeBase{constructor($){super(s1.ALIAS);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,Z){let X;if(Z?.aliasResolveCache)X=Z.aliasResolveCache;else if(X=[],fW.visit($,{Node:(J,Q)=>{if(s1.isAlias(Q)||s1.hasAnchor(Q))X.push(Q)}}),Z)Z.aliasResolveCache=X;let z=void 0;for(let J of X){if(J===this)break;if(J.anchor===this.source)z=J}return z}toJSON($,Z){if(!Z)return{source:this.source};let{anchors:X,doc:z,maxAliasCount:J}=Z,Q=this.resolve(z,Z);if(!Q){let W=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(W)}let Y=X.get(Q);if(!Y)vW.toJS(Q,null,Z),Y=X.get(Q);if(Y?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(J>=0){if(Y.count+=1,Y.aliasCount===0)Y.aliasCount=F3(z,Q,X);if(Y.count*Y.aliasCount>J)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return Y.res}toString($,Z,X){let z=`*${this.source}`;if($){if(yW.anchorIsValid(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let J=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(J)}if($.implicitKey)return`${z} `}return z}}function F3($,Z,X){if(s1.isAlias(Z)){let z=Z.resolve($),J=X&&z&&X.get(z);return J?J.count*J.aliasCount:0}else if(s1.isCollection(Z)){let z=0;for(let J of Z.items){let Q=F3($,J,X);if(Q>z)z=Q}return z}else if(s1.isPair(Z)){let z=F3($,Z.key,X),J=F3($,Z.value,X);return Math.max(z,J)}return 1}hW.Alias=V7});var X0=F((pW)=>{var mW=p(),cW=R3(),dW=Y1(),lW=($)=>!$||typeof $!=="function"&&typeof $!=="object";class w1 extends cW.NodeBase{constructor($){super(mW.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:dW.toJS(this.value,$,Z)}toString(){return String(this.value)}}w1.BLOCK_FOLDED="BLOCK_FOLDED";w1.BLOCK_LITERAL="BLOCK_LITERAL";w1.PLAIN="PLAIN";w1.QUOTE_DOUBLE="QUOTE_DOUBLE";w1.QUOTE_SINGLE="QUOTE_SINGLE";pW.Scalar=w1;pW.isScalarValue=lW});var i$=F((tW)=>{var rW=p$(),C1=p(),K7=X0(),sW="tag:yaml.org,2002:";function aW($,Z,X){if(Z){let z=X.filter((Q)=>Q.tag===Z),J=z.find((Q)=>!Q.format)??z[0];if(!J)throw Error(`Tag ${Z} not found`);return J}return X.find((z)=>z.identify?.($)&&!z.format)}function oW($,Z,X){if(C1.isDocument($))$=$.contents;if(C1.isNode($))return $;if(C1.isPair($)){let V=X.schema[C1.MAP].createNode?.(X.schema,null,X);return V.items.push($),V}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:z,onAnchor:J,onTagObj:Q,schema:Y,sourceObjects:W}=X,U=void 0;if(z&&$&&typeof $==="object")if(U=W.get($),U)return U.anchor??(U.anchor=J($)),new rW.Alias(U.anchor);else U={anchor:null,node:null},W.set($,U);if(Z?.startsWith("!!"))Z=sW+Z.slice(2);let G=aW($,Z,Y.tags);if(!G){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let V=new K7.Scalar($);if(U)U.node=V;return V}G=$ instanceof Map?Y[C1.MAP]:(Symbol.iterator in Object($))?Y[C1.SEQ]:Y[C1.MAP]}if(Q)Q(G),delete X.onTagObj;let q=G?.createNode?G.createNode(X.schema,$,X):typeof G?.nodeClass?.from==="function"?G.nodeClass.from(X.schema,$,X):new K7.Scalar($);if(Z)q.tag=Z;else if(!G.default)q.tag=G.tag;if(U)U.node=q;return q}tW.createNode=oW});var _3=F((XU)=>{var $U=i$(),l0=p(),ZU=R3();function A8($,Z,X){let z=X;for(let J=Z.length-1;J>=0;--J){let Q=Z[J];if(typeof Q==="number"&&Number.isInteger(Q)&&Q>=0){let Y=[];Y[Q]=z,z=Y}else z=new Map([[Q,z]])}return $U.createNode(z,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var H7=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class B7 extends ZU.NodeBase{constructor($,Z){super($);Object.defineProperty(this,"schema",{value:Z,configurable:!0,enumerable:!1,writable:!0})}clone($){let Z=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if($)Z.schema=$;if(Z.items=Z.items.map((X)=>l0.isNode(X)||l0.isPair(X)?X.clone($):X),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(H7($))this.add(Z);else{let[X,...z]=$,J=this.get(X,!0);if(l0.isCollection(J))J.addIn(z,Z);else if(J===void 0&&this.schema)this.set(X,A8(this.schema,z,Z));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${z}`)}}deleteIn($){let[Z,...X]=$;if(X.length===0)return this.delete(Z);let z=this.get(Z,!0);if(l0.isCollection(z))return z.deleteIn(X);else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${X}`)}getIn($,Z){let[X,...z]=$,J=this.get(X,!0);if(z.length===0)return!Z&&l0.isScalar(J)?J.value:J;else return l0.isCollection(J)?J.getIn(z,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!l0.isPair(Z))return!1;let X=Z.value;return X==null||$&&l0.isScalar(X)&&X.value==null&&!X.commentBefore&&!X.comment&&!X.tag})}hasIn($){let[Z,...X]=$;if(X.length===0)return this.has(Z);let z=this.get(Z,!0);return l0.isCollection(z)?z.hasIn(X):!1}setIn($,Z){let[X,...z]=$;if(z.length===0)this.set(X,Z);else{let J=this.get(X,!0);if(l0.isCollection(J))J.setIn(z,Z);else if(J===void 0&&this.schema)this.set(X,A8(this.schema,z,Z));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${z}`)}}}XU.Collection=B7;XU.collectionFromPath=A8;XU.isEmptyPath=H7});var n$=F((UU)=>{var YU=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function R8($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var WU=($,Z,X)=>$.endsWith(`
29
- `)?R8(X,Z):X.includes(`
27
+ `)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((z)=>Z.is(z)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function n5($){return $.map((Z)=>{if(!Z.startsWith("--inspect"))return Z;let X,z="127.0.0.1",J="9229",Q;if((Q=Z.match(/^(--inspect(-brk)?)$/))!==null)X=Q[1];else if((Q=Z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(X=Q[1],/^\d+$/.test(Q[3]))J=Q[3];else z=Q[3];else if((Q=Z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)X=Q[1],z=Q[3],J=Q[4];if(X&&J!=="0")return`${X}=${z}:${parseInt(J)+1}`;return Z})}function T8(){if(r.env.NO_COLOR||r.env.FORCE_COLOR==="0"||r.env.FORCE_COLOR==="false")return!1;if(r.env.FORCE_COLOR||r.env.CLICOLOR_FORCE!==void 0)return!0;return}SY.Command=D8;SY.useColor=T8});var t5=_((yY)=>{var{Argument:s5}=N4(),{Command:I8}=r5(),{CommanderError:bY,InvalidArgumentError:a5}=d$(),{Help:kY}=L8(),{Option:o5}=M8();yY.program=new I8;yY.createCommand=($)=>new I8($);yY.createOption=($,Z)=>new o5($,Z);yY.createArgument=($,Z)=>new s5($,Z);yY.Command=I8;yY.Option=o5;yY.Argument=s5;yY.Help=kY;yY.CommanderError=bY;yY.InvalidArgumentError=a5;yY.InvalidOptionArgumentError=a5});var p=_(($W)=>{var A8=Symbol.for("yaml.alias"),Z7=Symbol.for("yaml.document"),D4=Symbol.for("yaml.map"),X7=Symbol.for("yaml.pair"),R8=Symbol.for("yaml.scalar"),I4=Symbol.for("yaml.seq"),r0=Symbol.for("yaml.node.type"),nY=($)=>!!$&&typeof $==="object"&&$[r0]===A8,rY=($)=>!!$&&typeof $==="object"&&$[r0]===Z7,sY=($)=>!!$&&typeof $==="object"&&$[r0]===D4,aY=($)=>!!$&&typeof $==="object"&&$[r0]===X7,z7=($)=>!!$&&typeof $==="object"&&$[r0]===R8,oY=($)=>!!$&&typeof $==="object"&&$[r0]===I4;function J7($){if($&&typeof $==="object")switch($[r0]){case D4:case I4:return!0}return!1}function tY($){if($&&typeof $==="object")switch($[r0]){case A8:case D4:case R8:case I4:return!0}return!1}var eY=($)=>(z7($)||J7($))&&!!$.anchor;$W.ALIAS=A8;$W.DOC=Z7;$W.MAP=D4;$W.NODE_TYPE=r0;$W.PAIR=X7;$W.SCALAR=R8;$W.SEQ=I4;$W.hasAnchor=eY;$W.isAlias=nY;$W.isCollection=J7;$W.isDocument=rY;$W.isMap=sY;$W.isNode=tY;$W.isPair=aY;$W.isScalar=z7;$W.isSeq=oY});var l$=_((OW)=>{var U0=p(),T0=Symbol("break visit"),Q7=Symbol("skip children"),d0=Symbol("remove node");function A4($,Z){let X=Y7(Z);if(U0.isDocument($)){if(r1(null,$.contents,X,Object.freeze([$]))===d0)$.contents=null}else r1(null,$,X,Object.freeze([]))}A4.BREAK=T0;A4.SKIP=Q7;A4.REMOVE=d0;function r1($,Z,X,z){let J=W7($,Z,X,z);if(U0.isNode(J)||U0.isPair(J))return U7($,z,J),r1($,J,X,z);if(typeof J!=="symbol"){if(U0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let Q=0;Q<Z.items.length;++Q){let Y=r1(Q,Z.items[Q],X,z);if(typeof Y==="number")Q=Y-1;else if(Y===T0)return T0;else if(Y===d0)Z.items.splice(Q,1),Q-=1}}else if(U0.isPair(Z)){z=Object.freeze(z.concat(Z));let Q=r1("key",Z.key,X,z);if(Q===T0)return T0;else if(Q===d0)Z.key=null;let Y=r1("value",Z.value,X,z);if(Y===T0)return T0;else if(Y===d0)Z.value=null}}return J}async function R4($,Z){let X=Y7(Z);if(U0.isDocument($)){if(await s1(null,$.contents,X,Object.freeze([$]))===d0)$.contents=null}else await s1(null,$,X,Object.freeze([]))}R4.BREAK=T0;R4.SKIP=Q7;R4.REMOVE=d0;async function s1($,Z,X,z){let J=await W7($,Z,X,z);if(U0.isNode(J)||U0.isPair(J))return U7($,z,J),s1($,J,X,z);if(typeof J!=="symbol"){if(U0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let Q=0;Q<Z.items.length;++Q){let Y=await s1(Q,Z.items[Q],X,z);if(typeof Y==="number")Q=Y-1;else if(Y===T0)return T0;else if(Y===d0)Z.items.splice(Q,1),Q-=1}}else if(U0.isPair(Z)){z=Object.freeze(z.concat(Z));let Q=await s1("key",Z.key,X,z);if(Q===T0)return T0;else if(Q===d0)Z.key=null;let Y=await s1("value",Z.value,X,z);if(Y===T0)return T0;else if(Y===d0)Z.value=null}}return J}function Y7($){if(typeof $==="object"&&($.Collection||$.Node||$.Value))return Object.assign({Alias:$.Node,Map:$.Node,Scalar:$.Node,Seq:$.Node},$.Value&&{Map:$.Value,Scalar:$.Value,Seq:$.Value},$.Collection&&{Map:$.Collection,Seq:$.Collection},$);return $}function W7($,Z,X,z){if(typeof X==="function")return X($,Z,z);if(U0.isMap(Z))return X.Map?.($,Z,z);if(U0.isSeq(Z))return X.Seq?.($,Z,z);if(U0.isPair(Z))return X.Pair?.($,Z,z);if(U0.isScalar(Z))return X.Scalar?.($,Z,z);if(U0.isAlias(Z))return X.Alias?.($,Z,z);return}function U7($,Z,X){let z=Z[Z.length-1];if(U0.isCollection(z))z.items[$]=X;else if(U0.isPair(z))if($==="key")z.key=X;else z.value=X;else if(U0.isDocument(z))z.contents=X;else{let J=U0.isAlias(z)?"alias":"scalar";throw Error(`Cannot replace node with ${J} parent`)}}OW.visit=A4;OW.visitAsync=R4});var _8=_((RW)=>{var G7=p(),DW=l$(),IW={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},AW=($)=>$.replace(/[!,[\]{}]/g,(Z)=>IW[Z]);class j0{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},j0.defaultYaml,$),this.tags=Object.assign({},j0.defaultTags,Z)}clone(){let $=new j0(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new j0(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:j0.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},j0.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:j0.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},j0.defaultTags),this.atNextDocument=!1;let X=$.trim().split(/[ \t]+/),z=X.shift();switch(z){case"%TAG":{if(X.length!==2){if(Z(0,"%TAG directive should contain exactly two parts"),X.length<2)return!1}let[J,Q]=X;return this.tags[J]=Q,!0}case"%YAML":{if(this.yaml.explicit=!0,X.length!==1)return Z(0,"%YAML directive should contain exactly one part"),!1;let[J]=X;if(J==="1.1"||J==="1.2")return this.yaml.version=J,!0;else{let Q=/^\d+\.\d+$/.test(J);return Z(6,`Unsupported YAML version ${J}`,Q),!1}}default:return Z(0,`Unknown directive ${z}`,!0),!1}}tagName($,Z){if($==="!")return"!";if($[0]!=="!")return Z(`Not a valid tag: ${$}`),null;if($[1]==="<"){let Q=$.slice(2,-1);if(Q==="!"||Q==="!!")return Z(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")Z("Verbatim tags must end with a >");return Q}let[,X,z]=$.match(/^(.*!)([^!]*)$/s);if(!z)Z(`The ${$} tag has no suffix`);let J=this.tags[X];if(J)try{return J+decodeURIComponent(z)}catch(Q){return Z(String(Q)),null}if(X==="!")return $;return Z(`Could not resolve tag: ${$}`),null}tagString($){for(let[Z,X]of Object.entries(this.tags))if($.startsWith(X))return Z+AW($.substring(X.length));return $[0]==="!"?$:`!<${$}>`}toString($){let Z=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],X=Object.entries(this.tags),z;if($&&X.length>0&&G7.isNode($.contents)){let J={};DW.visit($.contents,(Q,Y)=>{if(G7.isNode(Y)&&Y.tag)J[Y.tag]=!0}),z=Object.keys(J)}else z=[];for(let[J,Q]of X){if(J==="!!"&&Q==="tag:yaml.org,2002:")continue;if(!$||z.some((Y)=>Y.startsWith(Q)))Z.push(`%TAG ${J} ${Q}`)}return Z.join(`
28
+ `)}}j0.defaultYaml={explicit:!1,version:"1.2"};j0.defaultTags={"!!":"tag:yaml.org,2002:"};RW.Directives=j0});var _4=_((wW)=>{var q7=p(),FW=l$();function PW($){if(/[\x00-\x19\s,[\]{}]/.test($)){let X=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(X)}return!0}function V7($){let Z=new Set;return FW.visit($,{Value(X,z){if(z.anchor)Z.add(z.anchor)}}),Z}function K7($,Z){for(let X=1;;++X){let z=`${$}${X}`;if(!Z.has(z))return z}}function CW($,Z){let X=[],z=new Map,J=null;return{onAnchor:(Q)=>{X.push(Q),J??(J=V7($));let Y=K7(Z,J);return J.add(Y),Y},setAnchors:()=>{for(let Q of X){let Y=z.get(Q);if(typeof Y==="object"&&Y.anchor&&(q7.isScalar(Y.node)||q7.isCollection(Y.node)))Y.node.anchor=Y.anchor;else{let W=Error("Failed to resolve repeated object (this should not happen)");throw W.source=Q,W}}},sourceObjects:z}}wW.anchorIsValid=PW;wW.anchorNames=V7;wW.createNodeAnchors=CW;wW.findNewAnchor=K7});var F8=_((bW)=>{function p$($,Z,X,z){if(z&&typeof z==="object")if(Array.isArray(z))for(let J=0,Q=z.length;J<Q;++J){let Y=z[J],W=p$($,z,String(J),Y);if(W===void 0)delete z[J];else if(W!==Y)z[J]=W}else if(z instanceof Map)for(let J of Array.from(z.keys())){let Q=z.get(J),Y=p$($,z,J,Q);if(Y===void 0)z.delete(J);else if(Y!==Q)z.set(J,Y)}else if(z instanceof Set)for(let J of Array.from(z)){let Q=p$($,z,J,J);if(Q===void 0)z.delete(J);else if(Q!==J)z.delete(J),z.add(Q)}else for(let[J,Q]of Object.entries(z)){let Y=p$($,z,J,Q);if(Y===void 0)delete z[J];else if(Y!==Q)z[J]=Y}return $.call(Z,X,z)}bW.applyReviver=p$});var Y1=_((fW)=>{var yW=p();function H7($,Z,X){if(Array.isArray($))return $.map((z,J)=>H7(z,String(J),X));if($&&typeof $.toJSON==="function"){if(!X||!yW.hasAnchor($))return $.toJSON(Z,X);let z={aliasCount:0,count:1,res:void 0};X.anchors.set($,z),X.onCreate=(Q)=>{z.res=Q,delete X.onCreate};let J=$.toJSON(Z,X);if(X.onCreate)X.onCreate(J);return J}if(typeof $==="bigint"&&!X?.keep)return Number($);return $}fW.toJS=H7});var F4=_((uW)=>{var vW=F8(),B7=p(),hW=Y1();class L7{constructor($){Object.defineProperty(this,B7.NODE_TYPE,{value:$})}clone(){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)$.range=this.range.slice();return $}toJS($,{mapAsMap:Z,maxAliasCount:X,onAnchor:z,reviver:J}={}){if(!B7.isDocument($))throw TypeError("A document argument is required");let Q={anchors:new Map,doc:$,keep:!0,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof X==="number"?X:100},Y=hW.toJS(this,"",Q);if(typeof z==="function")for(let{count:W,res:U}of Q.anchors.values())z(U,W);return typeof J==="function"?vW.applyReviver(J,{"":Y},"",Y):Y}}uW.NodeBase=L7});var i$=_((iW)=>{var cW=_4(),dW=l$(),a1=p(),lW=F4(),pW=Y1();class M7 extends lW.NodeBase{constructor($){super(a1.ALIAS);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,Z){let X;if(Z?.aliasResolveCache)X=Z.aliasResolveCache;else if(X=[],dW.visit($,{Node:(J,Q)=>{if(a1.isAlias(Q)||a1.hasAnchor(Q))X.push(Q)}}),Z)Z.aliasResolveCache=X;let z=void 0;for(let J of X){if(J===this)break;if(J.anchor===this.source)z=J}return z}toJSON($,Z){if(!Z)return{source:this.source};let{anchors:X,doc:z,maxAliasCount:J}=Z,Q=this.resolve(z,Z);if(!Q){let W=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(W)}let Y=X.get(Q);if(!Y)pW.toJS(Q,null,Z),Y=X.get(Q);if(Y?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(J>=0){if(Y.count+=1,Y.aliasCount===0)Y.aliasCount=P4(z,Q,X);if(Y.count*Y.aliasCount>J)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return Y.res}toString($,Z,X){let z=`*${this.source}`;if($){if(cW.anchorIsValid(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let J=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(J)}if($.implicitKey)return`${z} `}return z}}function P4($,Z,X){if(a1.isAlias(Z)){let z=Z.resolve($),J=X&&z&&X.get(z);return J?J.count*J.aliasCount:0}else if(a1.isCollection(Z)){let z=0;for(let J of Z.items){let Q=P4($,J,X);if(Q>z)z=Q}return z}else if(a1.isPair(Z)){let z=P4($,Z.key,X),J=P4($,Z.value,X);return Math.max(z,J)}return 1}iW.Alias=M7});var z0=_((tW)=>{var rW=p(),sW=F4(),aW=Y1(),oW=($)=>!$||typeof $!=="function"&&typeof $!=="object";class C1 extends sW.NodeBase{constructor($){super(rW.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:aW.toJS(this.value,$,Z)}toString(){return String(this.value)}}C1.BLOCK_FOLDED="BLOCK_FOLDED";C1.BLOCK_LITERAL="BLOCK_LITERAL";C1.PLAIN="PLAIN";C1.QUOTE_DOUBLE="QUOTE_DOUBLE";C1.QUOTE_SINGLE="QUOTE_SINGLE";tW.Scalar=C1;tW.isScalarValue=oW});var n$=_((QU)=>{var ZU=i$(),w1=p(),O7=z0(),XU="tag:yaml.org,2002:";function zU($,Z,X){if(Z){let z=X.filter((Q)=>Q.tag===Z),J=z.find((Q)=>!Q.format)??z[0];if(!J)throw Error(`Tag ${Z} not found`);return J}return X.find((z)=>z.identify?.($)&&!z.format)}function JU($,Z,X){if(w1.isDocument($))$=$.contents;if(w1.isNode($))return $;if(w1.isPair($)){let V=X.schema[w1.MAP].createNode?.(X.schema,null,X);return V.items.push($),V}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:z,onAnchor:J,onTagObj:Q,schema:Y,sourceObjects:W}=X,U=void 0;if(z&&$&&typeof $==="object")if(U=W.get($),U)return U.anchor??(U.anchor=J($)),new ZU.Alias(U.anchor);else U={anchor:null,node:null},W.set($,U);if(Z?.startsWith("!!"))Z=XU+Z.slice(2);let G=zU($,Z,Y.tags);if(!G){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let V=new O7.Scalar($);if(U)U.node=V;return V}G=$ instanceof Map?Y[w1.MAP]:(Symbol.iterator in Object($))?Y[w1.SEQ]:Y[w1.MAP]}if(Q)Q(G),delete X.onTagObj;let q=G?.createNode?G.createNode(X.schema,$,X):typeof G?.nodeClass?.from==="function"?G.nodeClass.from(X.schema,$,X):new O7.Scalar($);if(Z)q.tag=Z;else if(!G.default)q.tag=G.tag;if(U)U.node=q;return q}QU.createNode=JU});var C4=_((GU)=>{var WU=n$(),l0=p(),UU=F4();function P8($,Z,X){let z=X;for(let J=Z.length-1;J>=0;--J){let Q=Z[J];if(typeof Q==="number"&&Number.isInteger(Q)&&Q>=0){let Y=[];Y[Q]=z,z=Y}else z=new Map([[Q,z]])}return WU.createNode(z,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var N7=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class T7 extends UU.NodeBase{constructor($,Z){super($);Object.defineProperty(this,"schema",{value:Z,configurable:!0,enumerable:!1,writable:!0})}clone($){let Z=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if($)Z.schema=$;if(Z.items=Z.items.map((X)=>l0.isNode(X)||l0.isPair(X)?X.clone($):X),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(N7($))this.add(Z);else{let[X,...z]=$,J=this.get(X,!0);if(l0.isCollection(J))J.addIn(z,Z);else if(J===void 0&&this.schema)this.set(X,P8(this.schema,z,Z));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${z}`)}}deleteIn($){let[Z,...X]=$;if(X.length===0)return this.delete(Z);let z=this.get(Z,!0);if(l0.isCollection(z))return z.deleteIn(X);else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${X}`)}getIn($,Z){let[X,...z]=$,J=this.get(X,!0);if(z.length===0)return!Z&&l0.isScalar(J)?J.value:J;else return l0.isCollection(J)?J.getIn(z,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!l0.isPair(Z))return!1;let X=Z.value;return X==null||$&&l0.isScalar(X)&&X.value==null&&!X.commentBefore&&!X.comment&&!X.tag})}hasIn($){let[Z,...X]=$;if(X.length===0)return this.has(Z);let z=this.get(Z,!0);return l0.isCollection(z)?z.hasIn(X):!1}setIn($,Z){let[X,...z]=$;if(z.length===0)this.set(X,Z);else{let J=this.get(X,!0);if(l0.isCollection(J))J.setIn(z,Z);else if(J===void 0&&this.schema)this.set(X,P8(this.schema,z,Z));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${z}`)}}}GU.Collection=T7;GU.collectionFromPath=P8;GU.isEmptyPath=N7});var r$=_((LU)=>{var HU=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function C8($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var BU=($,Z,X)=>$.endsWith(`
29
+ `)?C8(X,Z):X.includes(`
30
30
  `)?`
31
- `+R8(X,Z):($.endsWith(" ")?"":" ")+X;UU.indentComment=R8;UU.lineComment=WU;UU.stringifyComment=YU});var N7=F((HU)=>{function KU($,Z,X="flow",{indentAtStart:z,lineWidth:J=80,minContentWidth:Q=20,onFold:Y,onOverflow:W}={}){if(!J||J<0)return $;if(J<Q)Q=0;let U=Math.max(1+Q,1+J-Z.length);if($.length<=U)return $;let G=[],q={},V=J-Z.length;if(typeof z==="number")if(z>J-Math.max(2,Q))G.push(0);else V=J-z;let K=void 0,B=void 0,O=!1,L=-1,M=-1,R=-1;if(X==="block"){if(L=L7($,L,Z.length),L!==-1)V=L+U}for(let w;w=$[L+=1];){if(X==="quoted"&&w==="\\"){switch(M=L,$[L+1]){case"x":L+=3;break;case"u":L+=5;break;case"U":L+=9;break;default:L+=1}R=L}if(w===`
32
- `){if(X==="block")L=L7($,L,Z.length);V=L+Z.length+U,K=void 0}else{if(w===" "&&B&&B!==" "&&B!==`
33
- `&&B!=="\t"){let k=$[L+1];if(k&&k!==" "&&k!==`
34
- `&&k!=="\t")K=L}if(L>=V)if(K)G.push(K),V=K+U,K=void 0;else if(X==="quoted"){while(B===" "||B==="\t")B=w,w=$[L+=1],O=!0;let k=L>R+1?L-2:M-1;if(q[k])return $;G.push(k),q[k]=!0,V=k+U,K=void 0}else O=!0}B=w}if(O&&W)W();if(G.length===0)return $;if(Y)Y();let P=$.slice(0,G[0]);for(let w=0;w<G.length;++w){let k=G[w],y=G[w+1]||$.length;if(k===0)P=`
35
- ${Z}${$.slice(0,y)}`;else{if(X==="quoted"&&q[k])P+=`${$[k]}\\`;P+=`
36
- ${Z}${$.slice(k+1,y)}`}}return P}function L7($,Z,X){let z=Z,J=Z+1,Q=$[J];while(Q===" "||Q==="\t")if(Z<J+X)Q=$[++Z];else{do Q=$[++Z];while(Q&&Q!==`
37
- `);z=Z,J=Z+1,Q=$[J]}return z}HU.FOLD_BLOCK="block";HU.FOLD_FLOW="flow";HU.FOLD_QUOTED="quoted";HU.foldFlowLines=KU});var s$=F((IU)=>{var v0=X0(),W1=N7(),w3=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),C3=($)=>/^(%|---|\.\.\.)/m.test($);function OU($,Z,X){if(!Z||Z<0)return!1;let z=Z-X,J=$.length;if(J<=z)return!1;for(let Q=0,Y=0;Q<J;++Q)if($[Q]===`
38
- `){if(Q-Y>z)return!0;if(Y=Q+1,J-Y<=z)return!1}return!0}function r$($,Z){let X=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return X;let{implicitKey:z}=Z,J=Z.options.doubleQuotedMinMultiLineLength,Q=Z.indent||(C3($)?" ":""),Y="",W=0;for(let U=0,G=X[U];G;G=X[++U]){if(G===" "&&X[U+1]==="\\"&&X[U+2]==="n")Y+=X.slice(W,U)+"\\ ",U+=1,W=U,G="\\";if(G==="\\")switch(X[U+1]){case"u":{Y+=X.slice(W,U);let q=X.substr(U+2,4);switch(q){case"0000":Y+="\\0";break;case"0007":Y+="\\a";break;case"000b":Y+="\\v";break;case"001b":Y+="\\e";break;case"0085":Y+="\\N";break;case"00a0":Y+="\\_";break;case"2028":Y+="\\L";break;case"2029":Y+="\\P";break;default:if(q.substr(0,2)==="00")Y+="\\x"+q.substr(2);else Y+=X.substr(U,6)}U+=5,W=U+1}break;case"n":if(z||X[U+2]==='"'||X.length<J)U+=1;else{Y+=X.slice(W,U)+`
31
+ `+C8(X,Z):($.endsWith(" ")?"":" ")+X;LU.indentComment=C8;LU.lineComment=BU;LU.stringifyComment=HU});var I7=_((DU)=>{function TU($,Z,X="flow",{indentAtStart:z,lineWidth:J=80,minContentWidth:Q=20,onFold:Y,onOverflow:W}={}){if(!J||J<0)return $;if(J<Q)Q=0;let U=Math.max(1+Q,1+J-Z.length);if($.length<=U)return $;let G=[],q={},V=J-Z.length;if(typeof z==="number")if(z>J-Math.max(2,Q))G.push(0);else V=J-z;let K=void 0,H=void 0,N=!1,L=-1,O=-1,R=-1;if(X==="block"){if(L=D7($,L,Z.length),L!==-1)V=L+U}for(let C;C=$[L+=1];){if(X==="quoted"&&C==="\\"){switch(O=L,$[L+1]){case"x":L+=3;break;case"u":L+=5;break;case"U":L+=9;break;default:L+=1}R=L}if(C===`
32
+ `){if(X==="block")L=D7($,L,Z.length);V=L+Z.length+U,K=void 0}else{if(C===" "&&H&&H!==" "&&H!==`
33
+ `&&H!=="\t"){let b=$[L+1];if(b&&b!==" "&&b!==`
34
+ `&&b!=="\t")K=L}if(L>=V)if(K)G.push(K),V=K+U,K=void 0;else if(X==="quoted"){while(H===" "||H==="\t")H=C,C=$[L+=1],N=!0;let b=L>R+1?L-2:O-1;if(q[b])return $;G.push(b),q[b]=!0,V=b+U,K=void 0}else N=!0}H=C}if(N&&W)W();if(G.length===0)return $;if(Y)Y();let P=$.slice(0,G[0]);for(let C=0;C<G.length;++C){let b=G[C],f=G[C+1]||$.length;if(b===0)P=`
35
+ ${Z}${$.slice(0,f)}`;else{if(X==="quoted"&&q[b])P+=`${$[b]}\\`;P+=`
36
+ ${Z}${$.slice(b+1,f)}`}}return P}function D7($,Z,X){let z=Z,J=Z+1,Q=$[J];while(Q===" "||Q==="\t")if(Z<J+X)Q=$[++Z];else{do Q=$[++Z];while(Q&&Q!==`
37
+ `);z=Z,J=Z+1,Q=$[J]}return z}DU.FOLD_BLOCK="block";DU.FOLD_FLOW="flow";DU.FOLD_QUOTED="quoted";DU.foldFlowLines=TU});var a$=_((wU)=>{var v0=z0(),W1=I7(),E4=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),S4=($)=>/^(%|---|\.\.\.)/m.test($);function FU($,Z,X){if(!Z||Z<0)return!1;let z=Z-X,J=$.length;if(J<=z)return!1;for(let Q=0,Y=0;Q<J;++Q)if($[Q]===`
38
+ `){if(Q-Y>z)return!0;if(Y=Q+1,J-Y<=z)return!1}return!0}function s$($,Z){let X=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return X;let{implicitKey:z}=Z,J=Z.options.doubleQuotedMinMultiLineLength,Q=Z.indent||(S4($)?" ":""),Y="",W=0;for(let U=0,G=X[U];G;G=X[++U]){if(G===" "&&X[U+1]==="\\"&&X[U+2]==="n")Y+=X.slice(W,U)+"\\ ",U+=1,W=U,G="\\";if(G==="\\")switch(X[U+1]){case"u":{Y+=X.slice(W,U);let q=X.substr(U+2,4);switch(q){case"0000":Y+="\\0";break;case"0007":Y+="\\a";break;case"000b":Y+="\\v";break;case"001b":Y+="\\e";break;case"0085":Y+="\\N";break;case"00a0":Y+="\\_";break;case"2028":Y+="\\L";break;case"2029":Y+="\\P";break;default:if(q.substr(0,2)==="00")Y+="\\x"+q.substr(2);else Y+=X.substr(U,6)}U+=5,W=U+1}break;case"n":if(z||X[U+2]==='"'||X.length<J)U+=1;else{Y+=X.slice(W,U)+`
39
39
 
40
40
  `;while(X[U+2]==="\\"&&X[U+3]==="n"&&X[U+4]!=='"')Y+=`
41
- `,U+=2;if(Y+=Q,X[U+2]===" ")Y+="\\";U+=1,W=U+1}break;default:U+=1}}return Y=W?Y+X.slice(W):X,z?Y:W1.foldFlowLines(Y,Q,W1.FOLD_QUOTED,w3(Z,!1))}function F8($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
42
- `)||/[ \t]\n|\n[ \t]/.test($))return r$($,Z);let X=Z.indent||(C3($)?" ":""),z="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
43
- ${X}`)+"'";return Z.implicitKey?z:W1.foldFlowLines(z,X,W1.FOLD_FLOW,w3(Z,!1))}function a1($,Z){let{singleQuote:X}=Z.options,z;if(X===!1)z=r$;else{let J=$.includes('"'),Q=$.includes("'");if(J&&!Q)z=F8;else if(Q&&!J)z=r$;else z=X?F8:r$}return z($,Z)}var _8;try{_8=new RegExp(`(^|(?<!
41
+ `,U+=2;if(Y+=Q,X[U+2]===" ")Y+="\\";U+=1,W=U+1}break;default:U+=1}}return Y=W?Y+X.slice(W):X,z?Y:W1.foldFlowLines(Y,Q,W1.FOLD_QUOTED,E4(Z,!1))}function w8($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
42
+ `)||/[ \t]\n|\n[ \t]/.test($))return s$($,Z);let X=Z.indent||(S4($)?" ":""),z="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
43
+ ${X}`)+"'";return Z.implicitKey?z:W1.foldFlowLines(z,X,W1.FOLD_FLOW,E4(Z,!1))}function o1($,Z){let{singleQuote:X}=Z.options,z;if(X===!1)z=s$;else{let J=$.includes('"'),Q=$.includes("'");if(J&&!Q)z=w8;else if(Q&&!J)z=s$;else z=X?w8:s$}return z($,Z)}var E8;try{E8=new RegExp(`(^|(?<!
44
44
  ))
45
45
  +(?!
46
- |$)`,"g")}catch{_8=/\n+(?!\n|$)/g}function P3({comment:$,type:Z,value:X},z,J,Q){let{blockQuote:Y,commentString:W,lineWidth:U}=z.options;if(!Y||/\n[\t ]+$/.test(X))return a1(X,z);let G=z.indent||(z.forceBlockIndent||C3(X)?" ":""),q=Y==="literal"?!0:Y==="folded"||Z===v0.Scalar.BLOCK_FOLDED?!1:Z===v0.Scalar.BLOCK_LITERAL?!0:!OU(X,U,G.length);if(!X)return q?`|
46
+ |$)`,"g")}catch{E8=/\n+(?!\n|$)/g}function w4({comment:$,type:Z,value:X},z,J,Q){let{blockQuote:Y,commentString:W,lineWidth:U}=z.options;if(!Y||/\n[\t ]+$/.test(X))return o1(X,z);let G=z.indent||(z.forceBlockIndent||S4(X)?" ":""),q=Y==="literal"?!0:Y==="folded"||Z===v0.Scalar.BLOCK_FOLDED?!1:Z===v0.Scalar.BLOCK_LITERAL?!0:!FU(X,U,G.length);if(!X)return q?`|
47
47
  `:`>
48
- `;let V,K;for(K=X.length;K>0;--K){let y=X[K-1];if(y!==`
49
- `&&y!=="\t"&&y!==" ")break}let B=X.substring(K),O=B.indexOf(`
50
- `);if(O===-1)V="-";else if(X===B||O!==B.length-1){if(V="+",Q)Q()}else V="";if(B){if(X=X.slice(0,-B.length),B[B.length-1]===`
51
- `)B=B.slice(0,-1);B=B.replace(_8,`$&${G}`)}let L=!1,M,R=-1;for(M=0;M<X.length;++M){let y=X[M];if(y===" ")L=!0;else if(y===`
52
- `)R=M;else break}let P=X.substring(0,R<M?R+1:M);if(P)X=X.substring(P.length),P=P.replace(/\n+/g,`$&${G}`);let k=(L?G?"2":"1":"")+V;if($){if(k+=" "+W($.replace(/ ?[\r\n]+/g," ")),J)J()}if(!q){let y=X.replace(/\n+/g,`
53
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${G}`),f=!1,i=w3(z,!0);if(Y!=="folded"&&Z!==v0.Scalar.BLOCK_FOLDED)i.onOverflow=()=>{f=!0};let C=W1.foldFlowLines(`${P}${y}${B}`,G,W1.FOLD_BLOCK,i);if(!f)return`>${k}
54
- ${G}${C}`}return X=X.replace(/\n+/g,`$&${G}`),`|${k}
55
- ${G}${P}${X}${B}`}function TU($,Z,X,z){let{type:J,value:Q}=$,{actualString:Y,implicitKey:W,indent:U,indentStep:G,inFlow:q}=Z;if(W&&Q.includes(`
56
- `)||q&&/[[\]{},]/.test(Q))return a1(Q,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(Q))return W||q||!Q.includes(`
57
- `)?a1(Q,Z):P3($,Z,X,z);if(!W&&!q&&J!==v0.Scalar.PLAIN&&Q.includes(`
58
- `))return P3($,Z,X,z);if(C3(Q)){if(U==="")return Z.forceBlockIndent=!0,P3($,Z,X,z);else if(W&&U===G)return a1(Q,Z)}let V=Q.replace(/\n+/g,`$&
59
- ${U}`);if(Y){let K=(L)=>L.default&&L.tag!=="tag:yaml.org,2002:str"&&L.test?.test(V),{compat:B,tags:O}=Z.doc.schema;if(O.some(K)||B?.some(K))return a1(Q,Z)}return W?V:W1.foldFlowLines(V,U,W1.FOLD_FLOW,w3(Z,!1))}function DU($,Z,X,z){let{implicitKey:J,inFlow:Q}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:W}=$;if(W!==v0.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))W=v0.Scalar.QUOTE_DOUBLE}let U=(q)=>{switch(q){case v0.Scalar.BLOCK_FOLDED:case v0.Scalar.BLOCK_LITERAL:return J||Q?a1(Y.value,Z):P3(Y,Z,X,z);case v0.Scalar.QUOTE_DOUBLE:return r$(Y.value,Z);case v0.Scalar.QUOTE_SINGLE:return F8(Y.value,Z);case v0.Scalar.PLAIN:return TU(Y,Z,X,z);default:return null}},G=U(W);if(G===null){let{defaultKeyType:q,defaultStringType:V}=Z.options,K=J&&q||V;if(G=U(K),G===null)throw Error(`Unsupported default string type ${K}`)}return G}IU.stringifyString=DU});var a$=F((jU)=>{var RU=A3(),U1=p(),FU=n$(),_U=s$();function PU($,Z){let X=Object.assign({blockQuote:!0,commentString:FU.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},$.schema.toStringOptions,Z),z;switch(X.collectionStyle){case"block":z=!1;break;case"flow":z=!0;break;default:z=null}return{anchors:new Set,doc:$,flowCollectionPadding:X.flowCollectionPadding?" ":"",indent:"",indentStep:typeof X.indent==="number"?" ".repeat(X.indent):" ",inFlow:z,options:X}}function wU($,Z){if(Z.tag){let J=$.filter((Q)=>Q.tag===Z.tag);if(J.length>0)return J.find((Q)=>Q.format===Z.format)??J[0]}let X=void 0,z;if(U1.isScalar(Z)){z=Z.value;let J=$.filter((Q)=>Q.identify?.(z));if(J.length>1){let Q=J.filter((Y)=>Y.test);if(Q.length>0)J=Q}X=J.find((Q)=>Q.format===Z.format)??J.find((Q)=>!Q.format)}else z=Z,X=$.find((J)=>J.nodeClass&&z instanceof J.nodeClass);if(!X){let J=z?.constructor?.name??(z===null?"null":typeof z);throw Error(`Tag not resolved for ${J} value`)}return X}function CU($,Z,{anchors:X,doc:z}){if(!z.directives)return"";let J=[],Q=(U1.isScalar($)||U1.isCollection($))&&$.anchor;if(Q&&RU.anchorIsValid(Q))X.add(Q),J.push(`&${Q}`);let Y=$.tag??(Z.default?null:Z.tag);if(Y)J.push(z.directives.tagString(Y));return J.join(" ")}function EU($,Z,X,z){if(U1.isPair($))return $.toString(Z,X,z);if(U1.isAlias($)){if(Z.doc.directives)return $.toString(Z);if(Z.resolvedAliases?.has($))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(Z.resolvedAliases)Z.resolvedAliases.add($);else Z.resolvedAliases=new Set([$]);$=$.resolve(Z.doc)}}let J=void 0,Q=U1.isNode($)?$:Z.doc.createNode($,{onTagObj:(U)=>J=U});J??(J=wU(Z.doc.schema.tags,Q));let Y=CU(Q,J,Z);if(Y.length>0)Z.indentAtStart=(Z.indentAtStart??0)+Y.length+1;let W=typeof J.stringify==="function"?J.stringify(Q,Z,X,z):U1.isScalar(Q)?_U.stringifyString(Q,Z,X,z):Q.toString(Z,X,z);if(!Y)return W;return U1.isScalar(Q)||W[0]==="{"||W[0]==="["?`${Y} ${W}`:`${Y}
60
- ${Z.indent}${W}`}jU.createStringifyContext=PU;jU.stringify=EU});var T7=F((kU)=>{var s0=p(),M7=X0(),O7=a$(),o$=n$();function bU({key:$,value:Z},X,z,J){let{allNullValues:Q,doc:Y,indent:W,indentStep:U,options:{commentString:G,indentSeq:q,simpleKeys:V}}=X,K=s0.isNode($)&&$.comment||null;if(V){if(K)throw Error("With simple keys, key nodes cannot have comments");if(s0.isCollection($)||!s0.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let B=!V&&(!$||K&&Z==null&&!X.inFlow||s0.isCollection($)||(s0.isScalar($)?$.type===M7.Scalar.BLOCK_FOLDED||$.type===M7.Scalar.BLOCK_LITERAL:typeof $==="object"));X=Object.assign({},X,{allNullValues:!1,implicitKey:!B&&(V||!Q),indent:W+U});let O=!1,L=!1,M=O7.stringify($,X,()=>O=!0,()=>L=!0);if(!B&&!X.inFlow&&M.length>1024){if(V)throw Error("With simple keys, single line scalar must not span more than 1024 characters");B=!0}if(X.inFlow){if(Q||Z==null){if(O&&z)z();return M===""?"?":B?`? ${M}`:M}}else if(Q&&!V||Z==null&&B){if(M=`? ${M}`,K&&!O)M+=o$.lineComment(M,X.indent,G(K));else if(L&&J)J();return M}if(O)K=null;if(B){if(K)M+=o$.lineComment(M,X.indent,G(K));M=`? ${M}
61
- ${W}:`}else if(M=`${M}:`,K)M+=o$.lineComment(M,X.indent,G(K));let R,P,w;if(s0.isNode(Z))R=!!Z.spaceBefore,P=Z.commentBefore,w=Z.comment;else if(R=!1,P=null,w=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(X.implicitKey=!1,!B&&!K&&s0.isScalar(Z))X.indentAtStart=M.length+1;if(L=!1,!q&&U.length>=2&&!X.inFlow&&!B&&s0.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)X.indent=X.indent.substring(2);let k=!1,y=O7.stringify(Z,X,()=>k=!0,()=>L=!0),f=" ";if(K||R||P){if(f=R?`
62
- `:"",P){let i=G(P);f+=`
63
- ${o$.indentComment(i,X.indent)}`}if(y===""&&!X.inFlow){if(f===`
64
- `&&w)f=`
65
-
66
- `}else f+=`
67
- ${X.indent}`}else if(!B&&s0.isCollection(Z)){let i=y[0],C=y.indexOf(`
68
- `),x=C!==-1,I0=X.inFlow??Z.flow??Z.items.length===0;if(x||!I0){let b=!1;if(x&&(i==="&"||i==="!")){let c=y.indexOf(" ");if(i==="&"&&c!==-1&&c<C&&y[c+1]==="!")c=y.indexOf(" ",c+1);if(c===-1||C<c)b=!0}if(!b)f=`
69
- ${X.indent}`}}else if(y===""||y[0]===`
70
- `)f="";if(M+=f+y,X.inFlow){if(k&&z)z()}else if(w&&!k)M+=o$.lineComment(M,X.indent,G(w));else if(L&&J)J();return M}kU.stringifyPair=bU});var P8=F((vU)=>{var D7=A0("process");function fU($,...Z){if($==="debug")console.log(...Z)}function gU($,Z){if($==="debug"||$==="warn")if(typeof D7.emitWarning==="function")D7.emitWarning(Z);else console.warn(Z)}vU.debug=fU;vU.warn=gU});var S3=F((cU)=>{var t$=p(),I7=X0(),E3="<<",j3={identify:($)=>$===E3||typeof $==="symbol"&&$.description===E3,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new I7.Scalar(Symbol(E3)),{addToJSMap:A7}),stringify:()=>E3},mU=($,Z)=>(j3.identify(Z)||t$.isScalar(Z)&&(!Z.type||Z.type===I7.Scalar.PLAIN)&&j3.identify(Z.value))&&$?.doc.schema.tags.some((X)=>X.tag===j3.tag&&X.default);function A7($,Z,X){if(X=$&&t$.isAlias(X)?X.resolve($.doc):X,t$.isSeq(X))for(let z of X.items)w8($,Z,z);else if(Array.isArray(X))for(let z of X)w8($,Z,z);else w8($,Z,X)}function w8($,Z,X){let z=$&&t$.isAlias(X)?X.resolve($.doc):X;if(!t$.isMap(z))throw Error("Merge sources must be maps or map aliases");let J=z.toJSON(null,$,Map);for(let[Q,Y]of J)if(Z instanceof Map){if(!Z.has(Q))Z.set(Q,Y)}else if(Z instanceof Set)Z.add(Q);else if(!Object.prototype.hasOwnProperty.call(Z,Q))Object.defineProperty(Z,Q,{value:Y,writable:!0,enumerable:!0,configurable:!0});return Z}cU.addMergeToJSMap=A7;cU.isMergeKey=mU;cU.merge=j3});var E8=F((aU)=>{var iU=P8(),R7=S3(),nU=a$(),F7=p(),C8=Y1();function rU($,Z,{key:X,value:z}){if(F7.isNode(X)&&X.addToJSMap)X.addToJSMap($,Z,z);else if(R7.isMergeKey($,X))R7.addMergeToJSMap($,Z,z);else{let J=C8.toJS(X,"",$);if(Z instanceof Map)Z.set(J,C8.toJS(z,J,$));else if(Z instanceof Set)Z.add(J);else{let Q=sU(X,J,$),Y=C8.toJS(z,Q,$);if(Q in Z)Object.defineProperty(Z,Q,{value:Y,writable:!0,enumerable:!0,configurable:!0});else Z[Q]=Y}}return Z}function sU($,Z,X){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(F7.isNode($)&&X?.doc){let z=nU.createStringifyContext(X.doc,{});z.anchors=new Set;for(let Q of X.anchors.keys())z.anchors.add(Q.anchor);z.inFlow=!0,z.inStringifyKey=!0;let J=$.toString(z);if(!X.mapKeyWarned){let Q=JSON.stringify(J);if(Q.length>40)Q=Q.substring(0,36)+'..."';iU.warn(X.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${Q}. Set mapAsMap: true to use object keys.`),X.mapKeyWarned=!0}return J}return JSON.stringify(Z)}aU.addPairToJSMap=rU});var G1=F((ZG)=>{var _7=i$(),tU=T7(),eU=E8(),x3=p();function $G($,Z,X){let z=_7.createNode($,void 0,X),J=_7.createNode(Z,void 0,X);return new b3(z,J)}class b3{constructor($,Z=null){Object.defineProperty(this,x3.NODE_TYPE,{value:x3.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:X}=this;if(x3.isNode(Z))Z=Z.clone($);if(x3.isNode(X))X=X.clone($);return new b3(Z,X)}toJSON($,Z){let X=Z?.mapAsMap?new Map:{};return eU.addPairToJSMap(Z,X,this)}toString($,Z,X){return $?.doc?tU.stringifyPair(this,$,Z,X):JSON.stringify(this)}}ZG.Pair=b3;ZG.createPair=$G});var j8=F((WG)=>{var E1=p(),P7=a$(),k3=n$();function JG($,Z,X){return(Z.inFlow??$.flow?YG:QG)($,Z,X)}function QG({comment:$,items:Z},X,{blockItemPrefix:z,flowChars:J,itemIndent:Q,onChompKeep:Y,onComment:W}){let{indent:U,options:{commentString:G}}=X,q=Object.assign({},X,{indent:Q,type:null}),V=!1,K=[];for(let O=0;O<Z.length;++O){let L=Z[O],M=null;if(E1.isNode(L)){if(!V&&L.spaceBefore)K.push("");if(y3(X,K,L.commentBefore,V),L.comment)M=L.comment}else if(E1.isPair(L)){let P=E1.isNode(L.key)?L.key:null;if(P){if(!V&&P.spaceBefore)K.push("");y3(X,K,P.commentBefore,V)}}V=!1;let R=P7.stringify(L,q,()=>M=null,()=>V=!0);if(M)R+=k3.lineComment(R,Q,G(M));if(V&&M)V=!1;K.push(z+R)}let B;if(K.length===0)B=J.start+J.end;else{B=K[0];for(let O=1;O<K.length;++O){let L=K[O];B+=L?`
48
+ `;let V,K;for(K=X.length;K>0;--K){let f=X[K-1];if(f!==`
49
+ `&&f!=="\t"&&f!==" ")break}let H=X.substring(K),N=H.indexOf(`
50
+ `);if(N===-1)V="-";else if(X===H||N!==H.length-1){if(V="+",Q)Q()}else V="";if(H){if(X=X.slice(0,-H.length),H[H.length-1]===`
51
+ `)H=H.slice(0,-1);H=H.replace(E8,`$&${G}`)}let L=!1,O,R=-1;for(O=0;O<X.length;++O){let f=X[O];if(f===" ")L=!0;else if(f===`
52
+ `)R=O;else break}let P=X.substring(0,R<O?R+1:O);if(P)X=X.substring(P.length),P=P.replace(/\n+/g,`$&${G}`);let b=(L?G?"2":"1":"")+V;if($){if(b+=" "+W($.replace(/ ?[\r\n]+/g," ")),J)J()}if(!q){let f=X.replace(/\n+/g,`
53
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${G}`),k=!1,i=E4(z,!0);if(Y!=="folded"&&Z!==v0.Scalar.BLOCK_FOLDED)i.onOverflow=()=>{k=!0};let w=W1.foldFlowLines(`${P}${f}${H}`,G,W1.FOLD_BLOCK,i);if(!k)return`>${b}
54
+ ${G}${w}`}return X=X.replace(/\n+/g,`$&${G}`),`|${b}
55
+ ${G}${P}${X}${H}`}function PU($,Z,X,z){let{type:J,value:Q}=$,{actualString:Y,implicitKey:W,indent:U,indentStep:G,inFlow:q}=Z;if(W&&Q.includes(`
56
+ `)||q&&/[[\]{},]/.test(Q))return o1(Q,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(Q))return W||q||!Q.includes(`
57
+ `)?o1(Q,Z):w4($,Z,X,z);if(!W&&!q&&J!==v0.Scalar.PLAIN&&Q.includes(`
58
+ `))return w4($,Z,X,z);if(S4(Q)){if(U==="")return Z.forceBlockIndent=!0,w4($,Z,X,z);else if(W&&U===G)return o1(Q,Z)}let V=Q.replace(/\n+/g,`$&
59
+ ${U}`);if(Y){let K=(L)=>L.default&&L.tag!=="tag:yaml.org,2002:str"&&L.test?.test(V),{compat:H,tags:N}=Z.doc.schema;if(N.some(K)||H?.some(K))return o1(Q,Z)}return W?V:W1.foldFlowLines(V,U,W1.FOLD_FLOW,E4(Z,!1))}function CU($,Z,X,z){let{implicitKey:J,inFlow:Q}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:W}=$;if(W!==v0.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))W=v0.Scalar.QUOTE_DOUBLE}let U=(q)=>{switch(q){case v0.Scalar.BLOCK_FOLDED:case v0.Scalar.BLOCK_LITERAL:return J||Q?o1(Y.value,Z):w4(Y,Z,X,z);case v0.Scalar.QUOTE_DOUBLE:return s$(Y.value,Z);case v0.Scalar.QUOTE_SINGLE:return w8(Y.value,Z);case v0.Scalar.PLAIN:return PU(Y,Z,X,z);default:return null}},G=U(W);if(G===null){let{defaultKeyType:q,defaultStringType:V}=Z.options,K=J&&q||V;if(G=U(K),G===null)throw Error(`Unsupported default string type ${K}`)}return G}wU.stringifyString=CU});var o$=_((gU)=>{var SU=_4(),U1=p(),jU=r$(),xU=a$();function bU($,Z){let X=Object.assign({blockQuote:!0,commentString:jU.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},$.schema.toStringOptions,Z),z;switch(X.collectionStyle){case"block":z=!1;break;case"flow":z=!0;break;default:z=null}return{anchors:new Set,doc:$,flowCollectionPadding:X.flowCollectionPadding?" ":"",indent:"",indentStep:typeof X.indent==="number"?" ".repeat(X.indent):" ",inFlow:z,options:X}}function kU($,Z){if(Z.tag){let J=$.filter((Q)=>Q.tag===Z.tag);if(J.length>0)return J.find((Q)=>Q.format===Z.format)??J[0]}let X=void 0,z;if(U1.isScalar(Z)){z=Z.value;let J=$.filter((Q)=>Q.identify?.(z));if(J.length>1){let Q=J.filter((Y)=>Y.test);if(Q.length>0)J=Q}X=J.find((Q)=>Q.format===Z.format)??J.find((Q)=>!Q.format)}else z=Z,X=$.find((J)=>J.nodeClass&&z instanceof J.nodeClass);if(!X){let J=z?.constructor?.name??(z===null?"null":typeof z);throw Error(`Tag not resolved for ${J} value`)}return X}function yU($,Z,{anchors:X,doc:z}){if(!z.directives)return"";let J=[],Q=(U1.isScalar($)||U1.isCollection($))&&$.anchor;if(Q&&SU.anchorIsValid(Q))X.add(Q),J.push(`&${Q}`);let Y=$.tag??(Z.default?null:Z.tag);if(Y)J.push(z.directives.tagString(Y));return J.join(" ")}function fU($,Z,X,z){if(U1.isPair($))return $.toString(Z,X,z);if(U1.isAlias($)){if(Z.doc.directives)return $.toString(Z);if(Z.resolvedAliases?.has($))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(Z.resolvedAliases)Z.resolvedAliases.add($);else Z.resolvedAliases=new Set([$]);$=$.resolve(Z.doc)}}let J=void 0,Q=U1.isNode($)?$:Z.doc.createNode($,{onTagObj:(U)=>J=U});J??(J=kU(Z.doc.schema.tags,Q));let Y=yU(Q,J,Z);if(Y.length>0)Z.indentAtStart=(Z.indentAtStart??0)+Y.length+1;let W=typeof J.stringify==="function"?J.stringify(Q,Z,X,z):U1.isScalar(Q)?xU.stringifyString(Q,Z,X,z):Q.toString(Z,X,z);if(!Y)return W;return U1.isScalar(Q)||W[0]==="{"||W[0]==="["?`${Y} ${W}`:`${Y}
60
+ ${Z.indent}${W}`}gU.createStringifyContext=bU;gU.stringify=fU});var _7=_((mU)=>{var s0=p(),A7=z0(),R7=o$(),t$=r$();function uU({key:$,value:Z},X,z,J){let{allNullValues:Q,doc:Y,indent:W,indentStep:U,options:{commentString:G,indentSeq:q,simpleKeys:V}}=X,K=s0.isNode($)&&$.comment||null;if(V){if(K)throw Error("With simple keys, key nodes cannot have comments");if(s0.isCollection($)||!s0.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let H=!V&&(!$||K&&Z==null&&!X.inFlow||s0.isCollection($)||(s0.isScalar($)?$.type===A7.Scalar.BLOCK_FOLDED||$.type===A7.Scalar.BLOCK_LITERAL:typeof $==="object"));X=Object.assign({},X,{allNullValues:!1,implicitKey:!H&&(V||!Q),indent:W+U});let N=!1,L=!1,O=R7.stringify($,X,()=>N=!0,()=>L=!0);if(!H&&!X.inFlow&&O.length>1024){if(V)throw Error("With simple keys, single line scalar must not span more than 1024 characters");H=!0}if(X.inFlow){if(Q||Z==null){if(N&&z)z();return O===""?"?":H?`? ${O}`:O}}else if(Q&&!V||Z==null&&H){if(O=`? ${O}`,K&&!N)O+=t$.lineComment(O,X.indent,G(K));else if(L&&J)J();return O}if(N)K=null;if(H){if(K)O+=t$.lineComment(O,X.indent,G(K));O=`? ${O}
61
+ ${W}:`}else if(O=`${O}:`,K)O+=t$.lineComment(O,X.indent,G(K));let R,P,C;if(s0.isNode(Z))R=!!Z.spaceBefore,P=Z.commentBefore,C=Z.comment;else if(R=!1,P=null,C=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(X.implicitKey=!1,!H&&!K&&s0.isScalar(Z))X.indentAtStart=O.length+1;if(L=!1,!q&&U.length>=2&&!X.inFlow&&!H&&s0.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)X.indent=X.indent.substring(2);let b=!1,f=R7.stringify(Z,X,()=>b=!0,()=>L=!0),k=" ";if(K||R||P){if(k=R?`
62
+ `:"",P){let i=G(P);k+=`
63
+ ${t$.indentComment(i,X.indent)}`}if(f===""&&!X.inFlow){if(k===`
64
+ `&&C)k=`
65
+
66
+ `}else k+=`
67
+ ${X.indent}`}else if(!H&&s0.isCollection(Z)){let i=f[0],w=f.indexOf(`
68
+ `),u=w!==-1,n=X.inFlow??Z.flow??Z.items.length===0;if(u||!n){let x=!1;if(u&&(i==="&"||i==="!")){let c=f.indexOf(" ");if(i==="&"&&c!==-1&&c<w&&f[c+1]==="!")c=f.indexOf(" ",c+1);if(c===-1||w<c)x=!0}if(!x)k=`
69
+ ${X.indent}`}}else if(f===""||f[0]===`
70
+ `)k="";if(O+=k+f,X.inFlow){if(b&&z)z()}else if(C&&!b)O+=t$.lineComment(O,X.indent,G(C));else if(L&&J)J();return O}mU.stringifyPair=uU});var S8=_((pU)=>{var F7=A0("process");function dU($,...Z){if($==="debug")console.log(...Z)}function lU($,Z){if($==="debug"||$==="warn")if(typeof F7.emitWarning==="function")F7.emitWarning(Z);else console.warn(Z)}pU.debug=dU;pU.warn=lU});var b4=_((sU)=>{var e$=p(),P7=z0(),j4="<<",x4={identify:($)=>$===j4||typeof $==="symbol"&&$.description===j4,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new P7.Scalar(Symbol(j4)),{addToJSMap:C7}),stringify:()=>j4},rU=($,Z)=>(x4.identify(Z)||e$.isScalar(Z)&&(!Z.type||Z.type===P7.Scalar.PLAIN)&&x4.identify(Z.value))&&$?.doc.schema.tags.some((X)=>X.tag===x4.tag&&X.default);function C7($,Z,X){if(X=$&&e$.isAlias(X)?X.resolve($.doc):X,e$.isSeq(X))for(let z of X.items)j8($,Z,z);else if(Array.isArray(X))for(let z of X)j8($,Z,z);else j8($,Z,X)}function j8($,Z,X){let z=$&&e$.isAlias(X)?X.resolve($.doc):X;if(!e$.isMap(z))throw Error("Merge sources must be maps or map aliases");let J=z.toJSON(null,$,Map);for(let[Q,Y]of J)if(Z instanceof Map){if(!Z.has(Q))Z.set(Q,Y)}else if(Z instanceof Set)Z.add(Q);else if(!Object.prototype.hasOwnProperty.call(Z,Q))Object.defineProperty(Z,Q,{value:Y,writable:!0,enumerable:!0,configurable:!0});return Z}sU.addMergeToJSMap=C7;sU.isMergeKey=rU;sU.merge=x4});var b8=_((zG)=>{var eU=S8(),w7=b4(),$G=o$(),E7=p(),x8=Y1();function ZG($,Z,{key:X,value:z}){if(E7.isNode(X)&&X.addToJSMap)X.addToJSMap($,Z,z);else if(w7.isMergeKey($,X))w7.addMergeToJSMap($,Z,z);else{let J=x8.toJS(X,"",$);if(Z instanceof Map)Z.set(J,x8.toJS(z,J,$));else if(Z instanceof Set)Z.add(J);else{let Q=XG(X,J,$),Y=x8.toJS(z,Q,$);if(Q in Z)Object.defineProperty(Z,Q,{value:Y,writable:!0,enumerable:!0,configurable:!0});else Z[Q]=Y}}return Z}function XG($,Z,X){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(E7.isNode($)&&X?.doc){let z=$G.createStringifyContext(X.doc,{});z.anchors=new Set;for(let Q of X.anchors.keys())z.anchors.add(Q.anchor);z.inFlow=!0,z.inStringifyKey=!0;let J=$.toString(z);if(!X.mapKeyWarned){let Q=JSON.stringify(J);if(Q.length>40)Q=Q.substring(0,36)+'..."';eU.warn(X.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${Q}. Set mapAsMap: true to use object keys.`),X.mapKeyWarned=!0}return J}return JSON.stringify(Z)}zG.addPairToJSMap=ZG});var G1=_((UG)=>{var S7=n$(),QG=_7(),YG=b8(),k4=p();function WG($,Z,X){let z=S7.createNode($,void 0,X),J=S7.createNode(Z,void 0,X);return new y4(z,J)}class y4{constructor($,Z=null){Object.defineProperty(this,k4.NODE_TYPE,{value:k4.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:X}=this;if(k4.isNode(Z))Z=Z.clone($);if(k4.isNode(X))X=X.clone($);return new y4(Z,X)}toJSON($,Z){let X=Z?.mapAsMap?new Map:{};return YG.addPairToJSMap(Z,X,this)}toString($,Z,X){return $?.doc?QG.stringifyPair(this,$,Z,X):JSON.stringify(this)}}UG.Pair=y4;UG.createPair=WG});var k8=_((BG)=>{var E1=p(),j7=o$(),f4=r$();function VG($,Z,X){return(Z.inFlow??$.flow?HG:KG)($,Z,X)}function KG({comment:$,items:Z},X,{blockItemPrefix:z,flowChars:J,itemIndent:Q,onChompKeep:Y,onComment:W}){let{indent:U,options:{commentString:G}}=X,q=Object.assign({},X,{indent:Q,type:null}),V=!1,K=[];for(let N=0;N<Z.length;++N){let L=Z[N],O=null;if(E1.isNode(L)){if(!V&&L.spaceBefore)K.push("");if(g4(X,K,L.commentBefore,V),L.comment)O=L.comment}else if(E1.isPair(L)){let P=E1.isNode(L.key)?L.key:null;if(P){if(!V&&P.spaceBefore)K.push("");g4(X,K,P.commentBefore,V)}}V=!1;let R=j7.stringify(L,q,()=>O=null,()=>V=!0);if(O)R+=f4.lineComment(R,Q,G(O));if(V&&O)V=!1;K.push(z+R)}let H;if(K.length===0)H=J.start+J.end;else{H=K[0];for(let N=1;N<K.length;++N){let L=K[N];H+=L?`
71
71
  ${U}${L}`:`
72
- `}}if($){if(B+=`
73
- `+k3.indentComment(G($),U),W)W()}else if(V&&Y)Y();return B}function YG({items:$},Z,{flowChars:X,itemIndent:z}){let{indent:J,indentStep:Q,flowCollectionPadding:Y,options:{commentString:W}}=Z;z+=Q;let U=Object.assign({},Z,{indent:z,inFlow:!0,type:null}),G=!1,q=0,V=[];for(let O=0;O<$.length;++O){let L=$[O],M=null;if(E1.isNode(L)){if(L.spaceBefore)V.push("");if(y3(Z,V,L.commentBefore,!1),L.comment)M=L.comment}else if(E1.isPair(L)){let P=E1.isNode(L.key)?L.key:null;if(P){if(P.spaceBefore)V.push("");if(y3(Z,V,P.commentBefore,!1),P.comment)G=!0}let w=E1.isNode(L.value)?L.value:null;if(w){if(w.comment)M=w.comment;if(w.commentBefore)G=!0}else if(L.value==null&&P?.comment)M=P.comment}if(M)G=!0;let R=P7.stringify(L,U,()=>M=null);if(G||(G=V.length>q||R.includes(`
74
- `)),O<$.length-1)R+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)G||(G=V.reduce((P,w)=>P+w.length+2,2)+(R.length+2)>Z.options.lineWidth);if(G)R+=","}if(M)R+=k3.lineComment(R,z,W(M));V.push(R),q=V.length}let{start:K,end:B}=X;if(V.length===0)return K+B;else{if(!G){let O=V.reduce((L,M)=>L+M.length+2,2);G=Z.options.lineWidth>0&&O>Z.options.lineWidth}if(G){let O=K;for(let L of V)O+=L?`
72
+ `}}if($){if(H+=`
73
+ `+f4.indentComment(G($),U),W)W()}else if(V&&Y)Y();return H}function HG({items:$},Z,{flowChars:X,itemIndent:z}){let{indent:J,indentStep:Q,flowCollectionPadding:Y,options:{commentString:W}}=Z;z+=Q;let U=Object.assign({},Z,{indent:z,inFlow:!0,type:null}),G=!1,q=0,V=[];for(let N=0;N<$.length;++N){let L=$[N],O=null;if(E1.isNode(L)){if(L.spaceBefore)V.push("");if(g4(Z,V,L.commentBefore,!1),L.comment)O=L.comment}else if(E1.isPair(L)){let P=E1.isNode(L.key)?L.key:null;if(P){if(P.spaceBefore)V.push("");if(g4(Z,V,P.commentBefore,!1),P.comment)G=!0}let C=E1.isNode(L.value)?L.value:null;if(C){if(C.comment)O=C.comment;if(C.commentBefore)G=!0}else if(L.value==null&&P?.comment)O=P.comment}if(O)G=!0;let R=j7.stringify(L,U,()=>O=null);if(G||(G=V.length>q||R.includes(`
74
+ `)),N<$.length-1)R+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)G||(G=V.reduce((P,C)=>P+C.length+2,2)+(R.length+2)>Z.options.lineWidth);if(G)R+=","}if(O)R+=f4.lineComment(R,z,W(O));V.push(R),q=V.length}let{start:K,end:H}=X;if(V.length===0)return K+H;else{if(!G){let N=V.reduce((L,O)=>L+O.length+2,2);G=Z.options.lineWidth>0&&N>Z.options.lineWidth}if(G){let N=K;for(let L of V)N+=L?`
75
75
  ${Q}${J}${L}`:`
76
- `;return`${O}
77
- ${J}${B}`}else return`${K}${Y}${V.join(" ")}${Y}${B}`}}function y3({indent:$,options:{commentString:Z}},X,z,J){if(z&&J)z=z.replace(/^\n+/,"");if(z){let Q=k3.indentComment(Z(z),$);X.push(Q.trimStart())}}WG.stringifyCollection=JG});var V1=F((HG)=>{var GG=j8(),qG=E8(),VG=_3(),q1=p(),f3=G1(),KG=X0();function e$($,Z){let X=q1.isScalar(Z)?Z.value:Z;for(let z of $)if(q1.isPair(z)){if(z.key===Z||z.key===X)return z;if(q1.isScalar(z.key)&&z.key.value===X)return z}return}class w7 extends VG.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(q1.MAP,$);this.items=[]}static from($,Z,X){let{keepUndefined:z,replacer:J}=X,Q=new this($),Y=(W,U)=>{if(typeof J==="function")U=J.call(Z,W,U);else if(Array.isArray(J)&&!J.includes(W))return;if(U!==void 0||z)Q.items.push(f3.createPair(W,U,X))};if(Z instanceof Map)for(let[W,U]of Z)Y(W,U);else if(Z&&typeof Z==="object")for(let W of Object.keys(Z))Y(W,Z[W]);if(typeof $.sortMapEntries==="function")Q.items.sort($.sortMapEntries);return Q}add($,Z){let X;if(q1.isPair($))X=$;else if(!$||typeof $!=="object"||!("key"in $))X=new f3.Pair($,$?.value);else X=new f3.Pair($.key,$.value);let z=e$(this.items,X.key),J=this.schema?.sortMapEntries;if(z){if(!Z)throw Error(`Key ${X.key} already set`);if(q1.isScalar(z.value)&&KG.isScalarValue(X.value))z.value.value=X.value;else z.value=X.value}else if(J){let Q=this.items.findIndex((Y)=>J(X,Y)<0);if(Q===-1)this.items.push(X);else this.items.splice(Q,0,X)}else this.items.push(X)}delete($){let Z=e$(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let z=e$(this.items,$)?.value;return(!Z&&q1.isScalar(z)?z.value:z)??void 0}has($){return!!e$(this.items,$)}set($,Z){this.add(new f3.Pair($,Z),!0)}toJSON($,Z,X){let z=X?new X:Z?.mapAsMap?new Map:{};if(Z?.onCreate)Z.onCreate(z);for(let J of this.items)qG.addPairToJSMap(Z,z,J);return z}toString($,Z,X){if(!$)return JSON.stringify(this);for(let z of this.items)if(!q1.isPair(z))throw Error(`Map items must all be pairs; found ${JSON.stringify(z)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return GG.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:X,onComment:Z})}}HG.YAMLMap=w7;HG.findPair=e$});var o1=F((OG)=>{var NG=p(),C7=V1(),MG={collection:"map",default:!0,nodeClass:C7.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!NG.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,X)=>C7.YAMLMap.from($,Z,X)};OG.map=MG});var K1=F((_G)=>{var DG=i$(),IG=j8(),AG=_3(),v3=p(),RG=X0(),FG=Y1();class E7 extends AG.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(v3.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=g3($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let X=g3($);if(typeof X!=="number")return;let z=this.items[X];return!Z&&v3.isScalar(z)?z.value:z}has($){let Z=g3($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let X=g3($);if(typeof X!=="number")throw Error(`Expected a valid index, not ${$}.`);let z=this.items[X];if(v3.isScalar(z)&&RG.isScalarValue(Z))z.value=Z;else this.items[X]=Z}toJSON($,Z){let X=[];if(Z?.onCreate)Z.onCreate(X);let z=0;for(let J of this.items)X.push(FG.toJS(J,String(z++),Z));return X}toString($,Z,X){if(!$)return JSON.stringify(this);return IG.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:X,onComment:Z})}static from($,Z,X){let{replacer:z}=X,J=new this($);if(Z&&Symbol.iterator in Object(Z)){let Q=0;for(let Y of Z){if(typeof z==="function"){let W=Z instanceof Set?Y:String(Q++);Y=z.call(Z,W,Y)}J.items.push(DG.createNode(Y,void 0,X))}}return J}}function g3($){let Z=v3.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}_G.YAMLSeq=E7});var t1=F((EG)=>{var wG=p(),j7=K1(),CG={collection:"seq",default:!0,nodeClass:j7.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!wG.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,X)=>j7.YAMLSeq.from($,Z,X)};EG.seq=CG});var $2=F((bG)=>{var SG=s$(),xG={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,X,z){return Z=Object.assign({actualString:!0},Z),SG.stringifyString($,Z,X,z)}};bG.string=xG});var h3=F((yG)=>{var S7=X0(),x7={identify:($)=>$==null,createNode:()=>new S7.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new S7.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&x7.test.test($)?$:Z.options.nullStr};yG.nullTag=x7});var S8=F((vG)=>{var gG=X0(),b7={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new gG.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},X){if($&&b7.test.test($)){let z=$[0]==="t"||$[0]==="T";if(Z===z)return $}return Z?X.options.trueStr:X.options.falseStr}};vG.boolTag=b7});var e1=F((mG)=>{function uG({format:$,minFractionDigits:Z,tag:X,value:z}){if(typeof z==="bigint")return String(z);let J=typeof z==="number"?z:Number(z);if(!isFinite(J))return isNaN(J)?".nan":J<0?"-.inf":".inf";let Q=Object.is(z,-0)?"-0":JSON.stringify(z);if(!$&&Z&&(!X||X==="tag:yaml.org,2002:float")&&/^\d/.test(Q)){let Y=Q.indexOf(".");if(Y<0)Y=Q.length,Q+=".";let W=Z-(Q.length-Y-1);while(W-- >0)Q+="0"}return Q}mG.stringifyNumber=uG});var b8=F((nG)=>{var dG=X0(),x8=e1(),lG={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:x8.stringifyNumber},pG={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($),stringify($){let Z=Number($.value);return isFinite(Z)?Z.toExponential():x8.stringifyNumber($)}},iG={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new dG.Scalar(parseFloat($)),X=$.indexOf(".");if(X!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-X-1;return Z},stringify:x8.stringifyNumber};nG.float=iG;nG.floatExp=pG;nG.floatNaN=lG});var y8=F(($q)=>{var k7=e1(),u3=($)=>typeof $==="bigint"||Number.isInteger($),k8=($,Z,X,{intAsBigInt:z})=>z?BigInt($):parseInt($.substring(Z),X);function y7($,Z,X){let{value:z}=$;if(u3(z)&&z>=0)return X+z.toString(Z);return k7.stringifyNumber($)}var oG={identify:($)=>u3($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,X)=>k8($,2,8,X),stringify:($)=>y7($,8,"0o")},tG={identify:u3,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,X)=>k8($,0,10,X),stringify:k7.stringifyNumber},eG={identify:($)=>u3($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,X)=>k8($,2,16,X),stringify:($)=>y7($,16,"0x")};$q.int=tG;$q.intHex=eG;$q.intOct=oG});var f7=F((qq)=>{var Jq=o1(),Qq=h3(),Yq=t1(),Wq=$2(),Uq=S8(),f8=b8(),g8=y8(),Gq=[Jq.map,Yq.seq,Wq.string,Qq.nullTag,Uq.boolTag,g8.intOct,g8.int,g8.intHex,f8.floatNaN,f8.floatExp,f8.float];qq.schema=Gq});var v7=F((Oq)=>{var Kq=X0(),Hq=o1(),Bq=t1();function g7($){return typeof $==="bigint"||Number.isInteger($)}var m3=({value:$})=>JSON.stringify($),Lq=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:m3},{identify:($)=>$==null,createNode:()=>new Kq.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:m3},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:m3},{identify:g7,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:X})=>X?BigInt($):parseInt($,10),stringify:({value:$})=>g7($)?$.toString():JSON.stringify($)},{identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:($)=>parseFloat($),stringify:m3}],Nq={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},Mq=[Hq.map,Bq.seq].concat(Lq,Nq);Oq.schema=Mq});var h8=F((Aq)=>{var Z2=A0("buffer"),v8=X0(),Dq=s$(),Iq={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof Z2.Buffer==="function")return Z2.Buffer.from($,"base64");else if(typeof atob==="function"){let X=atob($.replace(/[\n\r]/g,"")),z=new Uint8Array(X.length);for(let J=0;J<X.length;++J)z[J]=X.charCodeAt(J);return z}else return Z("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:Z,value:X},z,J,Q){if(!X)return"";let Y=X,W;if(typeof Z2.Buffer==="function")W=Y instanceof Z2.Buffer?Y.toString("base64"):Z2.Buffer.from(Y.buffer).toString("base64");else if(typeof btoa==="function"){let U="";for(let G=0;G<Y.length;++G)U+=String.fromCharCode(Y[G]);W=btoa(U)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(Z??(Z=v8.Scalar.BLOCK_LITERAL),Z!==v8.Scalar.QUOTE_DOUBLE){let U=Math.max(z.options.lineWidth-z.indent.length,z.options.minContentWidth),G=Math.ceil(W.length/U),q=Array(G);for(let V=0,K=0;V<G;++V,K+=U)q[V]=W.substr(K,U);W=q.join(Z===v8.Scalar.BLOCK_LITERAL?`
78
- `:" ")}return Dq.stringifyString({comment:$,type:Z,value:W},z,J,Q)}};Aq.binary=Iq});var d3=F((wq)=>{var c3=p(),u8=G1(),Fq=X0(),_q=K1();function h7($,Z){if(c3.isSeq($))for(let X=0;X<$.items.length;++X){let z=$.items[X];if(c3.isPair(z))continue;else if(c3.isMap(z)){if(z.items.length>1)Z("Each pair must have its own sequence indicator");let J=z.items[0]||new u8.Pair(new Fq.Scalar(null));if(z.commentBefore)J.key.commentBefore=J.key.commentBefore?`${z.commentBefore}
76
+ `;return`${N}
77
+ ${J}${H}`}else return`${K}${Y}${V.join(" ")}${Y}${H}`}}function g4({indent:$,options:{commentString:Z}},X,z,J){if(z&&J)z=z.replace(/^\n+/,"");if(z){let Q=f4.indentComment(Z(z),$);X.push(Q.trimStart())}}BG.stringifyCollection=VG});var V1=_((DG)=>{var MG=k8(),OG=b8(),NG=C4(),q1=p(),v4=G1(),TG=z0();function $2($,Z){let X=q1.isScalar(Z)?Z.value:Z;for(let z of $)if(q1.isPair(z)){if(z.key===Z||z.key===X)return z;if(q1.isScalar(z.key)&&z.key.value===X)return z}return}class x7 extends NG.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(q1.MAP,$);this.items=[]}static from($,Z,X){let{keepUndefined:z,replacer:J}=X,Q=new this($),Y=(W,U)=>{if(typeof J==="function")U=J.call(Z,W,U);else if(Array.isArray(J)&&!J.includes(W))return;if(U!==void 0||z)Q.items.push(v4.createPair(W,U,X))};if(Z instanceof Map)for(let[W,U]of Z)Y(W,U);else if(Z&&typeof Z==="object")for(let W of Object.keys(Z))Y(W,Z[W]);if(typeof $.sortMapEntries==="function")Q.items.sort($.sortMapEntries);return Q}add($,Z){let X;if(q1.isPair($))X=$;else if(!$||typeof $!=="object"||!("key"in $))X=new v4.Pair($,$?.value);else X=new v4.Pair($.key,$.value);let z=$2(this.items,X.key),J=this.schema?.sortMapEntries;if(z){if(!Z)throw Error(`Key ${X.key} already set`);if(q1.isScalar(z.value)&&TG.isScalarValue(X.value))z.value.value=X.value;else z.value=X.value}else if(J){let Q=this.items.findIndex((Y)=>J(X,Y)<0);if(Q===-1)this.items.push(X);else this.items.splice(Q,0,X)}else this.items.push(X)}delete($){let Z=$2(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let z=$2(this.items,$)?.value;return(!Z&&q1.isScalar(z)?z.value:z)??void 0}has($){return!!$2(this.items,$)}set($,Z){this.add(new v4.Pair($,Z),!0)}toJSON($,Z,X){let z=X?new X:Z?.mapAsMap?new Map:{};if(Z?.onCreate)Z.onCreate(z);for(let J of this.items)OG.addPairToJSMap(Z,z,J);return z}toString($,Z,X){if(!$)return JSON.stringify(this);for(let z of this.items)if(!q1.isPair(z))throw Error(`Map items must all be pairs; found ${JSON.stringify(z)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return MG.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:X,onComment:Z})}}DG.YAMLMap=x7;DG.findPair=$2});var t1=_((FG)=>{var RG=p(),b7=V1(),_G={collection:"map",default:!0,nodeClass:b7.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!RG.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,X)=>b7.YAMLMap.from($,Z,X)};FG.map=_G});var K1=_((xG)=>{var CG=n$(),wG=k8(),EG=C4(),u4=p(),SG=z0(),jG=Y1();class k7 extends EG.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(u4.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=h4($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let X=h4($);if(typeof X!=="number")return;let z=this.items[X];return!Z&&u4.isScalar(z)?z.value:z}has($){let Z=h4($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let X=h4($);if(typeof X!=="number")throw Error(`Expected a valid index, not ${$}.`);let z=this.items[X];if(u4.isScalar(z)&&SG.isScalarValue(Z))z.value=Z;else this.items[X]=Z}toJSON($,Z){let X=[];if(Z?.onCreate)Z.onCreate(X);let z=0;for(let J of this.items)X.push(jG.toJS(J,String(z++),Z));return X}toString($,Z,X){if(!$)return JSON.stringify(this);return wG.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:X,onComment:Z})}static from($,Z,X){let{replacer:z}=X,J=new this($);if(Z&&Symbol.iterator in Object(Z)){let Q=0;for(let Y of Z){if(typeof z==="function"){let W=Z instanceof Set?Y:String(Q++);Y=z.call(Z,W,Y)}J.items.push(CG.createNode(Y,void 0,X))}}return J}}function h4($){let Z=u4.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}xG.YAMLSeq=k7});var e1=_((fG)=>{var kG=p(),y7=K1(),yG={collection:"seq",default:!0,nodeClass:y7.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!kG.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,X)=>y7.YAMLSeq.from($,Z,X)};fG.seq=yG});var Z2=_((uG)=>{var vG=a$(),hG={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,X,z){return Z=Object.assign({actualString:!0},Z),vG.stringifyString($,Z,X,z)}};uG.string=hG});var m4=_((cG)=>{var f7=z0(),g7={identify:($)=>$==null,createNode:()=>new f7.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new f7.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&g7.test.test($)?$:Z.options.nullStr};cG.nullTag=g7});var y8=_((pG)=>{var lG=z0(),v7={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new lG.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},X){if($&&v7.test.test($)){let z=$[0]==="t"||$[0]==="T";if(Z===z)return $}return Z?X.options.trueStr:X.options.falseStr}};pG.boolTag=v7});var $$=_((rG)=>{function nG({format:$,minFractionDigits:Z,tag:X,value:z}){if(typeof z==="bigint")return String(z);let J=typeof z==="number"?z:Number(z);if(!isFinite(J))return isNaN(J)?".nan":J<0?"-.inf":".inf";let Q=Object.is(z,-0)?"-0":JSON.stringify(z);if(!$&&Z&&(!X||X==="tag:yaml.org,2002:float")&&/^\d/.test(Q)){let Y=Q.indexOf(".");if(Y<0)Y=Q.length,Q+=".";let W=Z-(Q.length-Y-1);while(W-- >0)Q+="0"}return Q}rG.stringifyNumber=nG});var g8=_(($q)=>{var aG=z0(),f8=$$(),oG={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:f8.stringifyNumber},tG={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($),stringify($){let Z=Number($.value);return isFinite(Z)?Z.toExponential():f8.stringifyNumber($)}},eG={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new aG.Scalar(parseFloat($)),X=$.indexOf(".");if(X!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-X-1;return Z},stringify:f8.stringifyNumber};$q.float=eG;$q.floatExp=tG;$q.floatNaN=oG});var h8=_((Wq)=>{var h7=$$(),c4=($)=>typeof $==="bigint"||Number.isInteger($),v8=($,Z,X,{intAsBigInt:z})=>z?BigInt($):parseInt($.substring(Z),X);function u7($,Z,X){let{value:z}=$;if(c4(z)&&z>=0)return X+z.toString(Z);return h7.stringifyNumber($)}var Jq={identify:($)=>c4($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,X)=>v8($,2,8,X),stringify:($)=>u7($,8,"0o")},Qq={identify:c4,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,X)=>v8($,0,10,X),stringify:h7.stringifyNumber},Yq={identify:($)=>c4($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,X)=>v8($,2,16,X),stringify:($)=>u7($,16,"0x")};Wq.int=Qq;Wq.intHex=Yq;Wq.intOct=Jq});var m7=_((Oq)=>{var Vq=t1(),Kq=m4(),Hq=e1(),Bq=Z2(),Lq=y8(),u8=g8(),m8=h8(),Mq=[Vq.map,Hq.seq,Bq.string,Kq.nullTag,Lq.boolTag,m8.intOct,m8.int,m8.intHex,u8.floatNaN,u8.floatExp,u8.float];Oq.schema=Mq});var d7=_((Fq)=>{var Tq=z0(),Dq=t1(),Iq=e1();function c7($){return typeof $==="bigint"||Number.isInteger($)}var d4=({value:$})=>JSON.stringify($),Aq=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:d4},{identify:($)=>$==null,createNode:()=>new Tq.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:d4},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:d4},{identify:c7,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:X})=>X?BigInt($):parseInt($,10),stringify:({value:$})=>c7($)?$.toString():JSON.stringify($)},{identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:($)=>parseFloat($),stringify:d4}],Rq={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},_q=[Dq.map,Iq.seq].concat(Aq,Rq);Fq.schema=_q});var d8=_((Eq)=>{var X2=A0("buffer"),c8=z0(),Cq=a$(),wq={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof X2.Buffer==="function")return X2.Buffer.from($,"base64");else if(typeof atob==="function"){let X=atob($.replace(/[\n\r]/g,"")),z=new Uint8Array(X.length);for(let J=0;J<X.length;++J)z[J]=X.charCodeAt(J);return z}else return Z("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:Z,value:X},z,J,Q){if(!X)return"";let Y=X,W;if(typeof X2.Buffer==="function")W=Y instanceof X2.Buffer?Y.toString("base64"):X2.Buffer.from(Y.buffer).toString("base64");else if(typeof btoa==="function"){let U="";for(let G=0;G<Y.length;++G)U+=String.fromCharCode(Y[G]);W=btoa(U)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(Z??(Z=c8.Scalar.BLOCK_LITERAL),Z!==c8.Scalar.QUOTE_DOUBLE){let U=Math.max(z.options.lineWidth-z.indent.length,z.options.minContentWidth),G=Math.ceil(W.length/U),q=Array(G);for(let V=0,K=0;V<G;++V,K+=U)q[V]=W.substr(K,U);W=q.join(Z===c8.Scalar.BLOCK_LITERAL?`
78
+ `:" ")}return Cq.stringifyString({comment:$,type:Z,value:W},z,J,Q)}};Eq.binary=wq});var p4=_((kq)=>{var l4=p(),l8=G1(),jq=z0(),xq=K1();function l7($,Z){if(l4.isSeq($))for(let X=0;X<$.items.length;++X){let z=$.items[X];if(l4.isPair(z))continue;else if(l4.isMap(z)){if(z.items.length>1)Z("Each pair must have its own sequence indicator");let J=z.items[0]||new l8.Pair(new jq.Scalar(null));if(z.commentBefore)J.key.commentBefore=J.key.commentBefore?`${z.commentBefore}
79
79
  ${J.key.commentBefore}`:z.commentBefore;if(z.comment){let Q=J.value??J.key;Q.comment=Q.comment?`${z.comment}
80
- ${Q.comment}`:z.comment}z=J}$.items[X]=c3.isPair(z)?z:new u8.Pair(z)}else Z("Expected a sequence for this tag");return $}function u7($,Z,X){let{replacer:z}=X,J=new _q.YAMLSeq($);J.tag="tag:yaml.org,2002:pairs";let Q=0;if(Z&&Symbol.iterator in Object(Z))for(let Y of Z){if(typeof z==="function")Y=z.call(Z,String(Q++),Y);let W,U;if(Array.isArray(Y))if(Y.length===2)W=Y[0],U=Y[1];else throw TypeError(`Expected [key, value] tuple: ${Y}`);else if(Y&&Y instanceof Object){let G=Object.keys(Y);if(G.length===1)W=G[0],U=Y[W];else throw TypeError(`Expected tuple with one key, not ${G.length} keys`)}else W=Y;J.items.push(u8.createPair(W,U,X))}return J}var Pq={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:h7,createNode:u7};wq.createPairs=u7;wq.pairs=Pq;wq.resolvePairs=h7});var c8=F((bq)=>{var m7=p(),m8=Y1(),X2=V1(),Sq=K1(),c7=d3();class j1 extends Sq.YAMLSeq{constructor(){super();this.add=X2.YAMLMap.prototype.add.bind(this),this.delete=X2.YAMLMap.prototype.delete.bind(this),this.get=X2.YAMLMap.prototype.get.bind(this),this.has=X2.YAMLMap.prototype.has.bind(this),this.set=X2.YAMLMap.prototype.set.bind(this),this.tag=j1.tag}toJSON($,Z){if(!Z)return super.toJSON($);let X=new Map;if(Z?.onCreate)Z.onCreate(X);for(let z of this.items){let J,Q;if(m7.isPair(z))J=m8.toJS(z.key,"",Z),Q=m8.toJS(z.value,J,Z);else J=m8.toJS(z,"",Z);if(X.has(J))throw Error("Ordered maps must not include duplicate keys");X.set(J,Q)}return X}static from($,Z,X){let z=c7.createPairs($,Z,X),J=new this;return J.items=z.items,J}}j1.tag="tag:yaml.org,2002:omap";var xq={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:j1,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let X=c7.resolvePairs($,Z),z=[];for(let{key:J}of X.items)if(m7.isScalar(J))if(z.includes(J.value))Z(`Ordered maps must not include duplicate keys: ${J.value}`);else z.push(J.value);return Object.assign(new j1,X)},createNode:($,Z,X)=>j1.from($,Z,X)};bq.YAMLOMap=j1;bq.omap=xq});var n7=F((fq)=>{var d7=X0();function l7({value:$,source:Z},X){if(Z&&($?p7:i7).test.test(Z))return Z;return $?X.options.trueStr:X.options.falseStr}var p7={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new d7.Scalar(!0),stringify:l7},i7={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new d7.Scalar(!1),stringify:l7};fq.falseTag=i7;fq.trueTag=p7});var r7=F((dq)=>{var hq=X0(),d8=e1(),uq={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:d8.stringifyNumber},mq={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($.replace(/_/g,"")),stringify($){let Z=Number($.value);return isFinite(Z)?Z.toExponential():d8.stringifyNumber($)}},cq={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new hq.Scalar(parseFloat($.replace(/_/g,""))),X=$.indexOf(".");if(X!==-1){let z=$.substring(X+1).replace(/_/g,"");if(z[z.length-1]==="0")Z.minFractionDigits=z.length}return Z},stringify:d8.stringifyNumber};dq.float=cq;dq.floatExp=mq;dq.floatNaN=uq});var a7=F((oq)=>{var s7=e1(),z2=($)=>typeof $==="bigint"||Number.isInteger($);function l3($,Z,X,{intAsBigInt:z}){let J=$[0];if(J==="-"||J==="+")Z+=1;if($=$.substring(Z).replace(/_/g,""),z){switch(X){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let Y=BigInt($);return J==="-"?BigInt(-1)*Y:Y}let Q=parseInt($,X);return J==="-"?-1*Q:Q}function l8($,Z,X){let{value:z}=$;if(z2(z)){let J=z.toString(Z);return z<0?"-"+X+J.substr(1):X+J}return s7.stringifyNumber($)}var nq={identify:z2,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,X)=>l3($,2,2,X),stringify:($)=>l8($,2,"0b")},rq={identify:z2,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,X)=>l3($,1,8,X),stringify:($)=>l8($,8,"0")},sq={identify:z2,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,X)=>l3($,0,10,X),stringify:s7.stringifyNumber},aq={identify:z2,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,X)=>l3($,2,16,X),stringify:($)=>l8($,16,"0x")};oq.int=sq;oq.intBin=nq;oq.intHex=aq;oq.intOct=rq});var p8=F((zV)=>{var n3=p(),p3=G1(),i3=V1();class S1 extends i3.YAMLMap{constructor($){super($);this.tag=S1.tag}add($){let Z;if(n3.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new p3.Pair($.key,null);else Z=new p3.Pair($,null);if(!i3.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let X=i3.findPair(this.items,$);return!Z&&n3.isPair(X)?n3.isScalar(X.key)?X.key.value:X.key:X}set($,Z){if(typeof Z!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof Z}`);let X=i3.findPair(this.items,$);if(X&&!Z)this.items.splice(this.items.indexOf(X),1);else if(!X&&Z)this.items.push(new p3.Pair($))}toJSON($,Z){return super.toJSON($,Z,Set)}toString($,Z,X){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),Z,X);else throw Error("Set items must all have null values")}static from($,Z,X){let{replacer:z}=X,J=new this($);if(Z&&Symbol.iterator in Object(Z))for(let Q of Z){if(typeof z==="function")Q=z.call(Z,Q,Q);J.items.push(p3.createPair(Q,null,X))}return J}}S1.tag="tag:yaml.org,2002:set";var XV={collection:"map",identify:($)=>$ instanceof Set,nodeClass:S1,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,X)=>S1.from($,Z,X),resolve($,Z){if(n3.isMap($))if($.hasAllNullValues(!0))return Object.assign(new S1,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};zV.YAMLSet=S1;zV.set=XV});var n8=F((GV)=>{var YV=e1();function i8($,Z){let X=$[0],z=X==="-"||X==="+"?$.substring(1):$,J=(Y)=>Z?BigInt(Y):Number(Y),Q=z.replace(/_/g,"").split(":").reduce((Y,W)=>Y*J(60)+J(W),J(0));return X==="-"?J(-1)*Q:Q}function o7($){let{value:Z}=$,X=(Y)=>Y;if(typeof Z==="bigint")X=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return YV.stringifyNumber($);let z="";if(Z<0)z="-",Z*=X(-1);let J=X(60),Q=[Z%J];if(Z<60)Q.unshift(0);else if(Z=(Z-Q[0])/J,Q.unshift(Z%J),Z>=60)Z=(Z-Q[0])/J,Q.unshift(Z);return z+Q.map((Y)=>String(Y).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var WV={identify:($)=>typeof $==="bigint"||Number.isInteger($),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:($,Z,{intAsBigInt:X})=>i8($,X),stringify:o7},UV={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:($)=>i8($,!1),stringify:o7},t7={identify:($)=>$ instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve($){let Z=$.match(t7.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,X,z,J,Q,Y,W]=Z.map(Number),U=Z[7]?Number((Z[7]+"00").substr(1,3)):0,G=Date.UTC(X,z-1,J,Q||0,Y||0,W||0,U),q=Z[8];if(q&&q!=="Z"){let V=i8(q,!1);if(Math.abs(V)<30)V*=60;G-=60000*V}return new Date(G)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};GV.floatTime=UV;GV.intTime=WV;GV.timestamp=t7});var $9=F((RV)=>{var HV=o1(),BV=h3(),LV=t1(),NV=$2(),MV=h8(),e7=n7(),r8=r7(),r3=a7(),OV=S3(),TV=c8(),DV=d3(),IV=p8(),s8=n8(),AV=[HV.map,LV.seq,NV.string,BV.nullTag,e7.trueTag,e7.falseTag,r3.intBin,r3.intOct,r3.int,r3.intHex,r8.floatNaN,r8.floatExp,r8.float,MV.binary,OV.merge,TV.omap,DV.pairs,IV.set,s8.intTime,s8.floatTime,s8.timestamp];RV.schema=AV});var q9=F((xV)=>{var J9=o1(),_V=h3(),Q9=t1(),PV=$2(),wV=S8(),a8=b8(),o8=y8(),CV=f7(),EV=v7(),Y9=h8(),J2=S3(),W9=c8(),U9=d3(),Z9=$9(),G9=p8(),s3=n8(),X9=new Map([["core",CV.schema],["failsafe",[J9.map,Q9.seq,PV.string]],["json",EV.schema],["yaml11",Z9.schema],["yaml-1.1",Z9.schema]]),z9={binary:Y9.binary,bool:wV.boolTag,float:a8.float,floatExp:a8.floatExp,floatNaN:a8.floatNaN,floatTime:s3.floatTime,int:o8.int,intHex:o8.intHex,intOct:o8.intOct,intTime:s3.intTime,map:J9.map,merge:J2.merge,null:_V.nullTag,omap:W9.omap,pairs:U9.pairs,seq:Q9.seq,set:G9.set,timestamp:s3.timestamp},jV={"tag:yaml.org,2002:binary":Y9.binary,"tag:yaml.org,2002:merge":J2.merge,"tag:yaml.org,2002:omap":W9.omap,"tag:yaml.org,2002:pairs":U9.pairs,"tag:yaml.org,2002:set":G9.set,"tag:yaml.org,2002:timestamp":s3.timestamp};function SV($,Z,X){let z=X9.get(Z);if(z&&!$)return X&&!z.includes(J2.merge)?z.concat(J2.merge):z.slice();let J=z;if(!J)if(Array.isArray($))J=[];else{let Q=Array.from(X9.keys()).filter((Y)=>Y!=="yaml11").map((Y)=>JSON.stringify(Y)).join(", ");throw Error(`Unknown schema "${Z}"; use one of ${Q} or define customTags array`)}if(Array.isArray($))for(let Q of $)J=J.concat(Q);else if(typeof $==="function")J=$(J.slice());if(X)J=J.concat(J2.merge);return J.reduce((Q,Y)=>{let W=typeof Y==="string"?z9[Y]:Y;if(!W){let U=JSON.stringify(Y),G=Object.keys(z9).map((q)=>JSON.stringify(q)).join(", ");throw Error(`Unknown custom tag ${U}; use one of ${G}`)}if(!Q.includes(W))Q.push(W);return Q},[])}xV.coreKnownTags=jV;xV.getTags=SV});var $6=F((hV)=>{var t8=p(),yV=o1(),fV=t1(),gV=$2(),a3=q9(),vV=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class e8{constructor({compat:$,customTags:Z,merge:X,resolveKnownTags:z,schema:J,sortMapEntries:Q,toStringDefaults:Y}){this.compat=Array.isArray($)?a3.getTags($,"compat"):$?a3.getTags(null,$):null,this.name=typeof J==="string"&&J||"core",this.knownTags=z?a3.coreKnownTags:{},this.tags=a3.getTags(Z,this.name,X),this.toStringOptions=Y??null,Object.defineProperty(this,t8.MAP,{value:yV.map}),Object.defineProperty(this,t8.SCALAR,{value:gV.string}),Object.defineProperty(this,t8.SEQ,{value:fV.seq}),this.sortMapEntries=typeof Q==="function"?Q:Q===!0?vV:null}clone(){let $=Object.create(e8.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}hV.Schema=e8});var V9=F((dV)=>{var mV=p(),Z6=a$(),Q2=n$();function cV($,Z){let X=[],z=Z.directives===!0;if(Z.directives!==!1&&$.directives){let U=$.directives.toString($);if(U)X.push(U),z=!0;else if($.directives.docStart)z=!0}if(z)X.push("---");let J=Z6.createStringifyContext($,Z),{commentString:Q}=J.options;if($.commentBefore){if(X.length!==1)X.unshift("");let U=Q($.commentBefore);X.unshift(Q2.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(mV.isNode($.contents)){if($.contents.spaceBefore&&z)X.push("");if($.contents.commentBefore){let q=Q($.contents.commentBefore);X.push(Q2.indentComment(q,""))}J.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,G=Z6.stringify($.contents,J,()=>W=null,U);if(W)G+=Q2.lineComment(G,"",Q(W));if((G[0]==="|"||G[0]===">")&&X[X.length-1]==="---")X[X.length-1]=`--- ${G}`;else X.push(G)}else X.push(Z6.stringify($.contents,J));if($.directives?.docEnd)if($.comment){let U=Q($.comment);if(U.includes(`
81
- `))X.push("..."),X.push(Q2.indentComment(U,""));else X.push(`... ${U}`)}else X.push("...");else{let U=$.comment;if(U&&Y)U=U.replace(/^\n+/,"");if(U){if((!Y||W)&&X[X.length-1]!=="")X.push("");X.push(Q2.indentComment(Q(U),""))}}return X.join(`
80
+ ${Q.comment}`:z.comment}z=J}$.items[X]=l4.isPair(z)?z:new l8.Pair(z)}else Z("Expected a sequence for this tag");return $}function p7($,Z,X){let{replacer:z}=X,J=new xq.YAMLSeq($);J.tag="tag:yaml.org,2002:pairs";let Q=0;if(Z&&Symbol.iterator in Object(Z))for(let Y of Z){if(typeof z==="function")Y=z.call(Z,String(Q++),Y);let W,U;if(Array.isArray(Y))if(Y.length===2)W=Y[0],U=Y[1];else throw TypeError(`Expected [key, value] tuple: ${Y}`);else if(Y&&Y instanceof Object){let G=Object.keys(Y);if(G.length===1)W=G[0],U=Y[W];else throw TypeError(`Expected tuple with one key, not ${G.length} keys`)}else W=Y;J.items.push(l8.createPair(W,U,X))}return J}var bq={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:l7,createNode:p7};kq.createPairs=p7;kq.pairs=bq;kq.resolvePairs=l7});var i8=_((uq)=>{var i7=p(),p8=Y1(),z2=V1(),vq=K1(),n7=p4();class S1 extends vq.YAMLSeq{constructor(){super();this.add=z2.YAMLMap.prototype.add.bind(this),this.delete=z2.YAMLMap.prototype.delete.bind(this),this.get=z2.YAMLMap.prototype.get.bind(this),this.has=z2.YAMLMap.prototype.has.bind(this),this.set=z2.YAMLMap.prototype.set.bind(this),this.tag=S1.tag}toJSON($,Z){if(!Z)return super.toJSON($);let X=new Map;if(Z?.onCreate)Z.onCreate(X);for(let z of this.items){let J,Q;if(i7.isPair(z))J=p8.toJS(z.key,"",Z),Q=p8.toJS(z.value,J,Z);else J=p8.toJS(z,"",Z);if(X.has(J))throw Error("Ordered maps must not include duplicate keys");X.set(J,Q)}return X}static from($,Z,X){let z=n7.createPairs($,Z,X),J=new this;return J.items=z.items,J}}S1.tag="tag:yaml.org,2002:omap";var hq={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:S1,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let X=n7.resolvePairs($,Z),z=[];for(let{key:J}of X.items)if(i7.isScalar(J))if(z.includes(J.value))Z(`Ordered maps must not include duplicate keys: ${J.value}`);else z.push(J.value);return Object.assign(new S1,X)},createNode:($,Z,X)=>S1.from($,Z,X)};uq.YAMLOMap=S1;uq.omap=hq});var t7=_((dq)=>{var r7=z0();function s7({value:$,source:Z},X){if(Z&&($?a7:o7).test.test(Z))return Z;return $?X.options.trueStr:X.options.falseStr}var a7={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new r7.Scalar(!0),stringify:s7},o7={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new r7.Scalar(!1),stringify:s7};dq.falseTag=o7;dq.trueTag=a7});var e7=_((aq)=>{var iq=z0(),n8=$$(),nq={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:n8.stringifyNumber},rq={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($.replace(/_/g,"")),stringify($){let Z=Number($.value);return isFinite(Z)?Z.toExponential():n8.stringifyNumber($)}},sq={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new iq.Scalar(parseFloat($.replace(/_/g,""))),X=$.indexOf(".");if(X!==-1){let z=$.substring(X+1).replace(/_/g,"");if(z[z.length-1]==="0")Z.minFractionDigits=z.length}return Z},stringify:n8.stringifyNumber};aq.float=sq;aq.floatExp=rq;aq.floatNaN=nq});var Z9=_((JV)=>{var $9=$$(),J2=($)=>typeof $==="bigint"||Number.isInteger($);function i4($,Z,X,{intAsBigInt:z}){let J=$[0];if(J==="-"||J==="+")Z+=1;if($=$.substring(Z).replace(/_/g,""),z){switch(X){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let Y=BigInt($);return J==="-"?BigInt(-1)*Y:Y}let Q=parseInt($,X);return J==="-"?-1*Q:Q}function r8($,Z,X){let{value:z}=$;if(J2(z)){let J=z.toString(Z);return z<0?"-"+X+J.substr(1):X+J}return $9.stringifyNumber($)}var $V={identify:J2,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,X)=>i4($,2,2,X),stringify:($)=>r8($,2,"0b")},ZV={identify:J2,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,X)=>i4($,1,8,X),stringify:($)=>r8($,8,"0")},XV={identify:J2,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,X)=>i4($,0,10,X),stringify:$9.stringifyNumber},zV={identify:J2,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,X)=>i4($,2,16,X),stringify:($)=>r8($,16,"0x")};JV.int=XV;JV.intBin=$V;JV.intHex=zV;JV.intOct=ZV});var s8=_((qV)=>{var s4=p(),n4=G1(),r4=V1();class j1 extends r4.YAMLMap{constructor($){super($);this.tag=j1.tag}add($){let Z;if(s4.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new n4.Pair($.key,null);else Z=new n4.Pair($,null);if(!r4.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let X=r4.findPair(this.items,$);return!Z&&s4.isPair(X)?s4.isScalar(X.key)?X.key.value:X.key:X}set($,Z){if(typeof Z!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof Z}`);let X=r4.findPair(this.items,$);if(X&&!Z)this.items.splice(this.items.indexOf(X),1);else if(!X&&Z)this.items.push(new n4.Pair($))}toJSON($,Z){return super.toJSON($,Z,Set)}toString($,Z,X){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),Z,X);else throw Error("Set items must all have null values")}static from($,Z,X){let{replacer:z}=X,J=new this($);if(Z&&Symbol.iterator in Object(Z))for(let Q of Z){if(typeof z==="function")Q=z.call(Z,Q,Q);J.items.push(n4.createPair(Q,null,X))}return J}}j1.tag="tag:yaml.org,2002:set";var GV={collection:"map",identify:($)=>$ instanceof Set,nodeClass:j1,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,X)=>j1.from($,Z,X),resolve($,Z){if(s4.isMap($))if($.hasAllNullValues(!0))return Object.assign(new j1,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};qV.YAMLSet=j1;qV.set=GV});var o8=_((MV)=>{var HV=$$();function a8($,Z){let X=$[0],z=X==="-"||X==="+"?$.substring(1):$,J=(Y)=>Z?BigInt(Y):Number(Y),Q=z.replace(/_/g,"").split(":").reduce((Y,W)=>Y*J(60)+J(W),J(0));return X==="-"?J(-1)*Q:Q}function X9($){let{value:Z}=$,X=(Y)=>Y;if(typeof Z==="bigint")X=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return HV.stringifyNumber($);let z="";if(Z<0)z="-",Z*=X(-1);let J=X(60),Q=[Z%J];if(Z<60)Q.unshift(0);else if(Z=(Z-Q[0])/J,Q.unshift(Z%J),Z>=60)Z=(Z-Q[0])/J,Q.unshift(Z);return z+Q.map((Y)=>String(Y).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var BV={identify:($)=>typeof $==="bigint"||Number.isInteger($),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:($,Z,{intAsBigInt:X})=>a8($,X),stringify:X9},LV={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:($)=>a8($,!1),stringify:X9},z9={identify:($)=>$ instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve($){let Z=$.match(z9.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,X,z,J,Q,Y,W]=Z.map(Number),U=Z[7]?Number((Z[7]+"00").substr(1,3)):0,G=Date.UTC(X,z-1,J,Q||0,Y||0,W||0,U),q=Z[8];if(q&&q!=="Z"){let V=a8(q,!1);if(Math.abs(V)<30)V*=60;G-=60000*V}return new Date(G)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};MV.floatTime=LV;MV.intTime=BV;MV.timestamp=z9});var Q9=_((SV)=>{var DV=t1(),IV=m4(),AV=e1(),RV=Z2(),_V=d8(),J9=t7(),t8=e7(),a4=Z9(),FV=b4(),PV=i8(),CV=p4(),wV=s8(),e8=o8(),EV=[DV.map,AV.seq,RV.string,IV.nullTag,J9.trueTag,J9.falseTag,a4.intBin,a4.intOct,a4.int,a4.intHex,t8.floatNaN,t8.floatExp,t8.float,_V.binary,FV.merge,PV.omap,CV.pairs,wV.set,e8.intTime,e8.floatTime,e8.timestamp];SV.schema=EV});var L9=_((hV)=>{var G9=t1(),xV=m4(),q9=e1(),bV=Z2(),kV=y8(),$6=g8(),Z6=h8(),yV=m7(),fV=d7(),V9=d8(),Q2=b4(),K9=i8(),H9=p4(),Y9=Q9(),B9=s8(),o4=o8(),W9=new Map([["core",yV.schema],["failsafe",[G9.map,q9.seq,bV.string]],["json",fV.schema],["yaml11",Y9.schema],["yaml-1.1",Y9.schema]]),U9={binary:V9.binary,bool:kV.boolTag,float:$6.float,floatExp:$6.floatExp,floatNaN:$6.floatNaN,floatTime:o4.floatTime,int:Z6.int,intHex:Z6.intHex,intOct:Z6.intOct,intTime:o4.intTime,map:G9.map,merge:Q2.merge,null:xV.nullTag,omap:K9.omap,pairs:H9.pairs,seq:q9.seq,set:B9.set,timestamp:o4.timestamp},gV={"tag:yaml.org,2002:binary":V9.binary,"tag:yaml.org,2002:merge":Q2.merge,"tag:yaml.org,2002:omap":K9.omap,"tag:yaml.org,2002:pairs":H9.pairs,"tag:yaml.org,2002:set":B9.set,"tag:yaml.org,2002:timestamp":o4.timestamp};function vV($,Z,X){let z=W9.get(Z);if(z&&!$)return X&&!z.includes(Q2.merge)?z.concat(Q2.merge):z.slice();let J=z;if(!J)if(Array.isArray($))J=[];else{let Q=Array.from(W9.keys()).filter((Y)=>Y!=="yaml11").map((Y)=>JSON.stringify(Y)).join(", ");throw Error(`Unknown schema "${Z}"; use one of ${Q} or define customTags array`)}if(Array.isArray($))for(let Q of $)J=J.concat(Q);else if(typeof $==="function")J=$(J.slice());if(X)J=J.concat(Q2.merge);return J.reduce((Q,Y)=>{let W=typeof Y==="string"?U9[Y]:Y;if(!W){let U=JSON.stringify(Y),G=Object.keys(U9).map((q)=>JSON.stringify(q)).join(", ");throw Error(`Unknown custom tag ${U}; use one of ${G}`)}if(!Q.includes(W))Q.push(W);return Q},[])}hV.coreKnownTags=gV;hV.getTags=vV});var J6=_((iV)=>{var X6=p(),cV=t1(),dV=e1(),lV=Z2(),t4=L9(),pV=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class z6{constructor({compat:$,customTags:Z,merge:X,resolveKnownTags:z,schema:J,sortMapEntries:Q,toStringDefaults:Y}){this.compat=Array.isArray($)?t4.getTags($,"compat"):$?t4.getTags(null,$):null,this.name=typeof J==="string"&&J||"core",this.knownTags=z?t4.coreKnownTags:{},this.tags=t4.getTags(Z,this.name,X),this.toStringOptions=Y??null,Object.defineProperty(this,X6.MAP,{value:cV.map}),Object.defineProperty(this,X6.SCALAR,{value:lV.string}),Object.defineProperty(this,X6.SEQ,{value:dV.seq}),this.sortMapEntries=typeof Q==="function"?Q:Q===!0?pV:null}clone(){let $=Object.create(z6.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}iV.Schema=z6});var M9=_((aV)=>{var rV=p(),Q6=o$(),Y2=r$();function sV($,Z){let X=[],z=Z.directives===!0;if(Z.directives!==!1&&$.directives){let U=$.directives.toString($);if(U)X.push(U),z=!0;else if($.directives.docStart)z=!0}if(z)X.push("---");let J=Q6.createStringifyContext($,Z),{commentString:Q}=J.options;if($.commentBefore){if(X.length!==1)X.unshift("");let U=Q($.commentBefore);X.unshift(Y2.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(rV.isNode($.contents)){if($.contents.spaceBefore&&z)X.push("");if($.contents.commentBefore){let q=Q($.contents.commentBefore);X.push(Y2.indentComment(q,""))}J.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,G=Q6.stringify($.contents,J,()=>W=null,U);if(W)G+=Y2.lineComment(G,"",Q(W));if((G[0]==="|"||G[0]===">")&&X[X.length-1]==="---")X[X.length-1]=`--- ${G}`;else X.push(G)}else X.push(Q6.stringify($.contents,J));if($.directives?.docEnd)if($.comment){let U=Q($.comment);if(U.includes(`
81
+ `))X.push("..."),X.push(Y2.indentComment(U,""));else X.push(`... ${U}`)}else X.push("...");else{let U=$.comment;if(U&&Y)U=U.replace(/^\n+/,"");if(U){if((!Y||W)&&X[X.length-1]!=="")X.push("");X.push(Y2.indentComment(Q(U),""))}}return X.join(`
82
82
  `)+`
83
- `}dV.stringifyDocument=cV});var Y2=F((tV)=>{var pV=p$(),$$=_3(),x0=p(),iV=G1(),nV=Y1(),rV=$6(),sV=V9(),X6=A3(),aV=I8(),oV=i$(),z6=D8();class J6{constructor($,Z,X){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,x0.NODE_TYPE,{value:x0.DOC});let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(X===void 0&&Z)X=Z,Z=void 0;let J=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},X);this.options=J;let{version:Q}=J;if(X?._directives){if(this.directives=X._directives.atDocument(),this.directives.yaml.explicit)Q=this.directives.yaml.version}else this.directives=new z6.Directives({version:Q});this.setSchema(Q,X),this.contents=$===void 0?null:this.createNode($,z,X)}clone(){let $=Object.create(J6.prototype,{[x0.NODE_TYPE]:{value:x0.DOC}});if($.commentBefore=this.commentBefore,$.comment=this.comment,$.errors=this.errors.slice(),$.warnings=this.warnings.slice(),$.options=Object.assign({},this.options),this.directives)$.directives=this.directives.clone();if($.schema=this.schema.clone(),$.contents=x0.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(Z$(this.contents))this.contents.add($)}addIn($,Z){if(Z$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let X=X6.anchorNames(this);$.anchor=!Z||X.has(Z)?X6.findNewAnchor(Z||"a",X):Z}return new pV.Alias($.anchor)}createNode($,Z,X){let z=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),z=Z;else if(Array.isArray(Z)){let L=(R)=>typeof R==="number"||R instanceof String||R instanceof Number,M=Z.filter(L).map(String);if(M.length>0)Z=Z.concat(M);z=Z}else if(X===void 0&&Z)X=Z,Z=void 0;let{aliasDuplicateObjects:J,anchorPrefix:Q,flow:Y,keepUndefined:W,onTagObj:U,tag:G}=X??{},{onAnchor:q,setAnchors:V,sourceObjects:K}=X6.createNodeAnchors(this,Q||"a"),B={aliasDuplicateObjects:J??!0,keepUndefined:W??!1,onAnchor:q,onTagObj:U,replacer:z,schema:this.schema,sourceObjects:K},O=oV.createNode($,G,B);if(Y&&x0.isCollection(O))O.flow=!0;return V(),O}createPair($,Z,X={}){let z=this.createNode($,null,X),J=this.createNode(Z,null,X);return new iV.Pair(z,J)}delete($){return Z$(this.contents)?this.contents.delete($):!1}deleteIn($){if($$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return Z$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return x0.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if($$.isEmptyPath($))return!Z&&x0.isScalar(this.contents)?this.contents.value:this.contents;return x0.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return x0.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if($$.isEmptyPath($))return this.contents!==void 0;return x0.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=$$.collectionFromPath(this.schema,[$],Z);else if(Z$(this.contents))this.contents.set($,Z)}setIn($,Z){if($$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=$$.collectionFromPath(this.schema,Array.from($),Z);else if(Z$(this.contents))this.contents.setIn($,Z)}setSchema($,Z={}){if(typeof $==="number")$=String($);let X;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new z6.Directives({version:"1.1"});X={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new z6.Directives({version:$});X={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;X=null;break;default:{let z=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${z}`)}}if(Z.schema instanceof Object)this.schema=Z.schema;else if(X)this.schema=new rV.Schema(Object.assign(X,Z));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:Z,mapAsMap:X,maxAliasCount:z,onAnchor:J,reviver:Q}={}){let Y={anchors:new Map,doc:this,keep:!$,mapAsMap:X===!0,mapKeyWarned:!1,maxAliasCount:typeof z==="number"?z:100},W=nV.toJS(this.contents,Z??"",Y);if(typeof J==="function")for(let{count:U,res:G}of Y.anchors.values())J(G,U);return typeof Q==="function"?aV.applyReviver(Q,{"":W},"",W):W}toJSON($,Z){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:Z})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let Z=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${Z}`)}return sV.stringifyDocument(this,$)}}function Z$($){if(x0.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}tV.Document=J6});var W2=F((ZK)=>{class o3 extends Error{constructor($,Z,X,z){super();this.name=$,this.code=X,this.message=z,this.pos=Z}}class K9 extends o3{constructor($,Z,X){super("YAMLParseError",$,Z,X)}}class H9 extends o3{constructor($,Z,X){super("YAMLWarning",$,Z,X)}}var $K=($,Z)=>(X)=>{if(X.pos[0]===-1)return;X.linePos=X.pos.map((W)=>Z.linePos(W));let{line:z,col:J}=X.linePos[0];X.message+=` at line ${z}, column ${J}`;let Q=J-1,Y=$.substring(Z.lineStarts[z-1],Z.lineStarts[z]).replace(/[\n\r]+$/,"");if(Q>=60&&Y.length>80){let W=Math.min(Q-39,Y.length-79);Y="…"+Y.substring(W),Q-=W-1}if(Y.length>80)Y=Y.substring(0,79)+"…";if(z>1&&/^ *$/.test(Y.substring(0,Q))){let W=$.substring(Z.lineStarts[z-2],Z.lineStarts[z-1]);if(W.length>80)W=W.substring(0,79)+`…
83
+ `}aV.stringifyDocument=sV});var W2=_((QK)=>{var tV=i$(),Z$=C4(),x0=p(),eV=G1(),$K=Y1(),ZK=J6(),XK=M9(),Y6=_4(),zK=F8(),JK=n$(),W6=_8();class U6{constructor($,Z,X){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,x0.NODE_TYPE,{value:x0.DOC});let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(X===void 0&&Z)X=Z,Z=void 0;let J=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},X);this.options=J;let{version:Q}=J;if(X?._directives){if(this.directives=X._directives.atDocument(),this.directives.yaml.explicit)Q=this.directives.yaml.version}else this.directives=new W6.Directives({version:Q});this.setSchema(Q,X),this.contents=$===void 0?null:this.createNode($,z,X)}clone(){let $=Object.create(U6.prototype,{[x0.NODE_TYPE]:{value:x0.DOC}});if($.commentBefore=this.commentBefore,$.comment=this.comment,$.errors=this.errors.slice(),$.warnings=this.warnings.slice(),$.options=Object.assign({},this.options),this.directives)$.directives=this.directives.clone();if($.schema=this.schema.clone(),$.contents=x0.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(X$(this.contents))this.contents.add($)}addIn($,Z){if(X$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let X=Y6.anchorNames(this);$.anchor=!Z||X.has(Z)?Y6.findNewAnchor(Z||"a",X):Z}return new tV.Alias($.anchor)}createNode($,Z,X){let z=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),z=Z;else if(Array.isArray(Z)){let L=(R)=>typeof R==="number"||R instanceof String||R instanceof Number,O=Z.filter(L).map(String);if(O.length>0)Z=Z.concat(O);z=Z}else if(X===void 0&&Z)X=Z,Z=void 0;let{aliasDuplicateObjects:J,anchorPrefix:Q,flow:Y,keepUndefined:W,onTagObj:U,tag:G}=X??{},{onAnchor:q,setAnchors:V,sourceObjects:K}=Y6.createNodeAnchors(this,Q||"a"),H={aliasDuplicateObjects:J??!0,keepUndefined:W??!1,onAnchor:q,onTagObj:U,replacer:z,schema:this.schema,sourceObjects:K},N=JK.createNode($,G,H);if(Y&&x0.isCollection(N))N.flow=!0;return V(),N}createPair($,Z,X={}){let z=this.createNode($,null,X),J=this.createNode(Z,null,X);return new eV.Pair(z,J)}delete($){return X$(this.contents)?this.contents.delete($):!1}deleteIn($){if(Z$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return X$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return x0.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(Z$.isEmptyPath($))return!Z&&x0.isScalar(this.contents)?this.contents.value:this.contents;return x0.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return x0.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(Z$.isEmptyPath($))return this.contents!==void 0;return x0.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=Z$.collectionFromPath(this.schema,[$],Z);else if(X$(this.contents))this.contents.set($,Z)}setIn($,Z){if(Z$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=Z$.collectionFromPath(this.schema,Array.from($),Z);else if(X$(this.contents))this.contents.setIn($,Z)}setSchema($,Z={}){if(typeof $==="number")$=String($);let X;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new W6.Directives({version:"1.1"});X={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new W6.Directives({version:$});X={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;X=null;break;default:{let z=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${z}`)}}if(Z.schema instanceof Object)this.schema=Z.schema;else if(X)this.schema=new ZK.Schema(Object.assign(X,Z));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:Z,mapAsMap:X,maxAliasCount:z,onAnchor:J,reviver:Q}={}){let Y={anchors:new Map,doc:this,keep:!$,mapAsMap:X===!0,mapKeyWarned:!1,maxAliasCount:typeof z==="number"?z:100},W=$K.toJS(this.contents,Z??"",Y);if(typeof J==="function")for(let{count:U,res:G}of Y.anchors.values())J(G,U);return typeof Q==="function"?zK.applyReviver(Q,{"":W},"",W):W}toJSON($,Z){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:Z})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let Z=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${Z}`)}return XK.stringifyDocument(this,$)}}function X$($){if(x0.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}QK.Document=U6});var U2=_((UK)=>{class e4 extends Error{constructor($,Z,X,z){super();this.name=$,this.code=X,this.message=z,this.pos=Z}}class O9 extends e4{constructor($,Z,X){super("YAMLParseError",$,Z,X)}}class N9 extends e4{constructor($,Z,X){super("YAMLWarning",$,Z,X)}}var WK=($,Z)=>(X)=>{if(X.pos[0]===-1)return;X.linePos=X.pos.map((W)=>Z.linePos(W));let{line:z,col:J}=X.linePos[0];X.message+=` at line ${z}, column ${J}`;let Q=J-1,Y=$.substring(Z.lineStarts[z-1],Z.lineStarts[z]).replace(/[\n\r]+$/,"");if(Q>=60&&Y.length>80){let W=Math.min(Q-39,Y.length-79);Y="…"+Y.substring(W),Q-=W-1}if(Y.length>80)Y=Y.substring(0,79)+"…";if(z>1&&/^ *$/.test(Y.substring(0,Q))){let W=$.substring(Z.lineStarts[z-2],Z.lineStarts[z-1]);if(W.length>80)W=W.substring(0,79)+`…
84
84
  `;Y=W+Y}if(/[^ ]/.test(Y)){let W=1,U=X.linePos[1];if(U?.line===z&&U.col>J)W=Math.max(1,Math.min(U.col-J,80-Q));let G=" ".repeat(Q)+"^".repeat(W);X.message+=`:
85
85
 
86
86
  ${Y}
87
87
  ${G}
88
- `}};ZK.YAMLError=o3;ZK.YAMLParseError=K9;ZK.YAMLWarning=H9;ZK.prettifyError=$K});var U2=F((WK)=>{function YK($,{flow:Z,indicator:X,next:z,offset:J,onError:Q,parentIndent:Y,startOnNewline:W}){let U=!1,G=W,q=W,V="",K="",B=!1,O=!1,L=null,M=null,R=null,P=null,w=null,k=null,y=null;for(let C of $){if(O){if(C.type!=="space"&&C.type!=="newline"&&C.type!=="comma")Q(C.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");O=!1}if(L){if(G&&C.type!=="comment"&&C.type!=="newline")Q(L,"TAB_AS_INDENT","Tabs are not allowed as indentation");L=null}switch(C.type){case"space":if(!Z&&(X!=="doc-start"||z?.type!=="flow-collection")&&C.source.includes("\t"))L=C;q=!0;break;case"comment":{if(!q)Q(C,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let x=C.source.substring(1)||" ";if(!V)V=x;else V+=K+x;K="",G=!1;break}case"newline":if(G){if(V)V+=C.source;else if(!k||X!=="seq-item-ind")U=!0}else K+=C.source;if(G=!0,B=!0,M||R)P=C;q=!0;break;case"anchor":if(M)Q(C,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(C.source.endsWith(":"))Q(C.offset+C.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);M=C,y??(y=C.offset),G=!1,q=!1,O=!0;break;case"tag":{if(R)Q(C,"MULTIPLE_TAGS","A node can have at most one tag");R=C,y??(y=C.offset),G=!1,q=!1,O=!0;break}case X:if(M||R)Q(C,"BAD_PROP_ORDER",`Anchors and tags must be after the ${C.source} indicator`);if(k)Q(C,"UNEXPECTED_TOKEN",`Unexpected ${C.source} in ${Z??"collection"}`);k=C,G=X==="seq-item-ind"||X==="explicit-key-ind",q=!1;break;case"comma":if(Z){if(w)Q(C,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);w=C,G=!1,q=!1;break}default:Q(C,"UNEXPECTED_TOKEN",`Unexpected ${C.type} token`),G=!1,q=!1}}let f=$[$.length-1],i=f?f.offset+f.source.length:J;if(O&&z&&z.type!=="space"&&z.type!=="newline"&&z.type!=="comma"&&(z.type!=="scalar"||z.source!==""))Q(z.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(L&&(G&&L.indent<=Y||z?.type==="block-map"||z?.type==="block-seq"))Q(L,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:w,found:k,spaceBefore:U,comment:V,hasNewline:B,anchor:M,tag:R,newlineAfterProp:P,end:i,start:y??i}}WK.resolveProps=YK});var t3=F((GK)=>{function Q6($){if(!$)return null;switch($.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if($.source.includes(`
89
- `))return!0;if($.end){for(let Z of $.end)if(Z.type==="newline")return!0}return!1;case"flow-collection":for(let Z of $.items){for(let X of Z.start)if(X.type==="newline")return!0;if(Z.sep){for(let X of Z.sep)if(X.type==="newline")return!0}if(Q6(Z.key)||Q6(Z.value))return!0}return!1;default:return!0}}GK.containsNewline=Q6});var Y6=F((HK)=>{var VK=t3();function KK($,Z,X){if(Z?.type==="flow-collection"){let z=Z.end[0];if(z.indent===$&&(z.source==="]"||z.source==="}")&&VK.containsNewline(Z))X(z,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}HK.flowIndentCheck=KK});var W6=F((NK)=>{var B9=p();function LK($,Z,X){let{uniqueKeys:z}=$.options;if(z===!1)return!1;let J=typeof z==="function"?z:(Q,Y)=>Q===Y||B9.isScalar(Q)&&B9.isScalar(Y)&&Q.value===Y.value;return Z.some((Q)=>J(Q.key,X))}NK.mapIncludes=LK});var T9=F((AK)=>{var L9=G1(),OK=V1(),N9=U2(),TK=t3(),M9=Y6(),DK=W6(),O9="All mapping items must start at the same column";function IK({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let W=new(Q?.nodeClass??OK.YAMLMap)(X.schema);if(X.atRoot)X.atRoot=!1;let U=z.offset,G=null;for(let q of z.items){let{start:V,key:K,sep:B,value:O}=q,L=N9.resolveProps(V,{indicator:"explicit-key-ind",next:K??B?.[0],offset:U,onError:J,parentIndent:z.indent,startOnNewline:!0}),M=!L.found;if(M){if(K){if(K.type==="block-seq")J(U,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in K&&K.indent!==z.indent)J(U,"BAD_INDENT",O9)}if(!L.anchor&&!L.tag&&!B){if(G=L.end,L.comment)if(W.comment)W.comment+=`
90
- `+L.comment;else W.comment=L.comment;continue}if(L.newlineAfterProp||TK.containsNewline(K))J(K??V[V.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(L.found?.indent!==z.indent)J(U,"BAD_INDENT",O9);X.atKey=!0;let R=L.end,P=K?$(X,K,L,J):Z(X,R,V,null,L,J);if(X.schema.compat)M9.flowIndentCheck(z.indent,K,J);if(X.atKey=!1,DK.mapIncludes(X,W.items,P))J(R,"DUPLICATE_KEY","Map keys must be unique");let w=N9.resolveProps(B??[],{indicator:"map-value-ind",next:O,offset:P.range[2],onError:J,parentIndent:z.indent,startOnNewline:!K||K.type==="block-scalar"});if(U=w.end,w.found){if(M){if(O?.type==="block-map"&&!w.hasNewline)J(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(X.options.strict&&L.start<w.found.offset-1024)J(P.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let k=O?$(X,O,w,J):Z(X,U,B,null,w,J);if(X.schema.compat)M9.flowIndentCheck(z.indent,O,J);U=k.range[2];let y=new L9.Pair(P,k);if(X.options.keepSourceTokens)y.srcToken=q;W.items.push(y)}else{if(M)J(P.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(w.comment)if(P.comment)P.comment+=`
91
- `+w.comment;else P.comment=w.comment;let k=new L9.Pair(P);if(X.options.keepSourceTokens)k.srcToken=q;W.items.push(k)}}if(G&&G<U)J(G,"IMPOSSIBLE","Map comment with trailing content");return W.range=[z.offset,U,G??U],W}AK.resolveBlockMap=IK});var D9=F((CK)=>{var FK=K1(),_K=U2(),PK=Y6();function wK({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let W=new(Q?.nodeClass??FK.YAMLSeq)(X.schema);if(X.atRoot)X.atRoot=!1;if(X.atKey)X.atKey=!1;let U=z.offset,G=null;for(let{start:q,value:V}of z.items){let K=_K.resolveProps(q,{indicator:"seq-item-ind",next:V,offset:U,onError:J,parentIndent:z.indent,startOnNewline:!0});if(!K.found)if(K.anchor||K.tag||V)if(V?.type==="block-seq")J(K.end,"BAD_INDENT","All sequence items must start at the same column");else J(U,"MISSING_CHAR","Sequence item without - indicator");else{if(G=K.end,K.comment)W.comment=K.comment;continue}let B=V?$(X,V,K,J):Z(X,K.end,q,null,K,J);if(X.schema.compat)PK.flowIndentCheck(z.indent,V,J);U=B.range[2],W.items.push(B)}return W.range=[z.offset,U,G??U],W}CK.resolveBlockSeq=wK});var X$=F((SK)=>{function jK($,Z,X,z){let J="";if($){let Q=!1,Y="";for(let W of $){let{source:U,type:G}=W;switch(G){case"space":Q=!0;break;case"comment":{if(X&&!Q)z(W,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let q=U.substring(1)||" ";if(!J)J=q;else J+=Y+q;Y="";break}case"newline":if(J)Y+=U;Q=!0;break;default:z(W,"UNEXPECTED_TOKEN",`Unexpected ${G} at node end`)}Z+=U.length}}return{comment:J,offset:Z}}SK.resolveEnd=jK});var R9=F((uK)=>{var bK=p(),kK=G1(),I9=V1(),yK=K1(),fK=X$(),A9=U2(),gK=t3(),vK=W6(),U6="Block collections are not allowed within flow collections",G6=($)=>$&&($.type==="block-map"||$.type==="block-seq");function hK({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let Y=z.start.source==="{",W=Y?"flow map":"flow sequence",G=new(Q?.nodeClass??(Y?I9.YAMLMap:yK.YAMLSeq))(X.schema);G.flow=!0;let q=X.atRoot;if(q)X.atRoot=!1;if(X.atKey)X.atKey=!1;let V=z.offset+z.start.source.length;for(let M=0;M<z.items.length;++M){let R=z.items[M],{start:P,key:w,sep:k,value:y}=R,f=A9.resolveProps(P,{flow:W,indicator:"explicit-key-ind",next:w??k?.[0],offset:V,onError:J,parentIndent:z.indent,startOnNewline:!1});if(!f.found){if(!f.anchor&&!f.tag&&!k&&!y){if(M===0&&f.comma)J(f.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`);else if(M<z.items.length-1)J(f.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${W}`);if(f.comment)if(G.comment)G.comment+=`
92
- `+f.comment;else G.comment=f.comment;V=f.end;continue}if(!Y&&X.options.strict&&gK.containsNewline(w))J(w,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(M===0){if(f.comma)J(f.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`)}else{if(!f.comma)J(f.start,"MISSING_CHAR",`Missing , between ${W} items`);if(f.comment){let i="";$:for(let C of P)switch(C.type){case"comma":case"space":break;case"comment":i=C.source.substring(1);break $;default:break $}if(i){let C=G.items[G.items.length-1];if(bK.isPair(C))C=C.value??C.key;if(C.comment)C.comment+=`
93
- `+i;else C.comment=i;f.comment=f.comment.substring(i.length+1)}}}if(!Y&&!k&&!f.found){let i=y?$(X,y,f,J):Z(X,f.end,k,null,f,J);if(G.items.push(i),V=i.range[2],G6(y))J(i.range,"BLOCK_IN_FLOW",U6)}else{X.atKey=!0;let i=f.end,C=w?$(X,w,f,J):Z(X,i,P,null,f,J);if(G6(w))J(C.range,"BLOCK_IN_FLOW",U6);X.atKey=!1;let x=A9.resolveProps(k??[],{flow:W,indicator:"map-value-ind",next:y,offset:C.range[2],onError:J,parentIndent:z.indent,startOnNewline:!1});if(x.found){if(!Y&&!f.found&&X.options.strict){if(k)for(let c of k){if(c===x.found)break;if(c.type==="newline"){J(c,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(f.start<x.found.offset-1024)J(x.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(y)if("source"in y&&y.source?.[0]===":")J(y,"MISSING_CHAR",`Missing space after : in ${W}`);else J(x.start,"MISSING_CHAR",`Missing , or : between ${W} items`);let I0=y?$(X,y,x,J):x.found?Z(X,x.end,k,null,x,J):null;if(I0){if(G6(y))J(I0.range,"BLOCK_IN_FLOW",U6)}else if(x.comment)if(C.comment)C.comment+=`
94
- `+x.comment;else C.comment=x.comment;let b=new kK.Pair(C,I0);if(X.options.keepSourceTokens)b.srcToken=R;if(Y){let c=G;if(vK.mapIncludes(X,c.items,C))J(i,"DUPLICATE_KEY","Map keys must be unique");c.items.push(b)}else{let c=new I9.YAMLMap(X.schema);c.flow=!0,c.items.push(b);let g0=(I0??C).range;c.range=[C.range[0],g0[1],g0[2]],G.items.push(c)}V=I0?I0.range[2]:x.end}}let K=Y?"}":"]",[B,...O]=z.end,L=V;if(B?.source===K)L=B.offset+B.source.length;else{let M=W[0].toUpperCase()+W.substring(1),R=q?`${M} must end with a ${K}`:`${M} in block collection must be sufficiently indented and end with a ${K}`;if(J(V,q?"MISSING_CHAR":"BAD_INDENT",R),B&&B.source.length!==1)O.unshift(B)}if(O.length>0){let M=fK.resolveEnd(O,L,X.options.strict,J);if(M.comment)if(G.comment)G.comment+=`
95
- `+M.comment;else G.comment=M.comment;G.range=[z.offset,L,M.offset]}else G.range=[z.offset,L,L];return G}uK.resolveFlowCollection=hK});var F9=F((aK)=>{var cK=p(),dK=X0(),lK=V1(),pK=K1(),iK=T9(),nK=D9(),rK=R9();function q6($,Z,X,z,J,Q){let Y=X.type==="block-map"?iK.resolveBlockMap($,Z,X,z,Q):X.type==="block-seq"?nK.resolveBlockSeq($,Z,X,z,Q):rK.resolveFlowCollection($,Z,X,z,Q),W=Y.constructor;if(J==="!"||J===W.tagName)return Y.tag=W.tagName,Y;if(J)Y.tag=J;return Y}function sK($,Z,X,z,J){let Q=z.tag,Y=!Q?null:Z.directives.tagName(Q.source,(K)=>J(Q,"TAG_RESOLVE_FAILED",K));if(X.type==="block-seq"){let{anchor:K,newlineAfterProp:B}=z,O=K&&Q?K.offset>Q.offset?K:Q:K??Q;if(O&&(!B||B.offset<O.offset))J(O,"MISSING_CHAR","Missing newline after block sequence props")}let W=X.type==="block-map"?"map":X.type==="block-seq"?"seq":X.start.source==="{"?"map":"seq";if(!Q||!Y||Y==="!"||Y===lK.YAMLMap.tagName&&W==="map"||Y===pK.YAMLSeq.tagName&&W==="seq")return q6($,Z,X,J,Y);let U=Z.schema.tags.find((K)=>K.tag===Y&&K.collection===W);if(!U){let K=Z.schema.knownTags[Y];if(K?.collection===W)Z.schema.tags.push(Object.assign({},K,{default:!1})),U=K;else{if(K)J(Q,"BAD_COLLECTION_TYPE",`${K.tag} used for ${W} collection, but expects ${K.collection??"scalar"}`,!0);else J(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return q6($,Z,X,J,Y)}}let G=q6($,Z,X,J,Y,U),q=U.resolve?.(G,(K)=>J(Q,"TAG_RESOLVE_FAILED",K),Z.options)??G,V=cK.isNode(q)?q:new dK.Scalar(q);if(V.range=G.range,V.tag=Y,U?.format)V.format=U.format;return V}aK.composeCollection=sK});var K6=F((ZH)=>{var V6=X0();function tK($,Z,X){let z=Z.offset,J=eK(Z,$.options.strict,X);if(!J)return{value:"",type:null,comment:"",range:[z,z,z]};let Q=J.mode===">"?V6.Scalar.BLOCK_FOLDED:V6.Scalar.BLOCK_LITERAL,Y=Z.source?$H(Z.source):[],W=Y.length;for(let L=Y.length-1;L>=0;--L){let M=Y[L][1];if(M===""||M==="\r")W=L;else break}if(W===0){let L=J.chomp==="+"&&Y.length>0?`
96
- `.repeat(Math.max(1,Y.length-1)):"",M=z+J.length;if(Z.source)M+=Z.source.length;return{value:L,type:Q,comment:J.comment,range:[z,M,M]}}let U=Z.indent+J.indent,G=Z.offset+J.length,q=0;for(let L=0;L<W;++L){let[M,R]=Y[L];if(R===""||R==="\r"){if(J.indent===0&&M.length>U)U=M.length}else{if(M.length<U)X(G+M.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(J.indent===0)U=M.length;if(q=L,U===0&&!$.atRoot)X(G,"BAD_INDENT","Block scalar values in collections must be indented");break}G+=M.length+R.length+1}for(let L=Y.length-1;L>=W;--L)if(Y[L][0].length>U)W=L+1;let V="",K="",B=!1;for(let L=0;L<q;++L)V+=Y[L][0].slice(U)+`
97
- `;for(let L=q;L<W;++L){let[M,R]=Y[L];G+=M.length+R.length+1;let P=R[R.length-1]==="\r";if(P)R=R.slice(0,-1);if(R&&M.length<U){let k=`Block scalar lines must not be less indented than their ${J.indent?"explicit indentation indicator":"first line"}`;X(G-R.length-(P?2:1),"BAD_INDENT",k),M=""}if(Q===V6.Scalar.BLOCK_LITERAL)V+=K+M.slice(U)+R,K=`
98
- `;else if(M.length>U||R[0]==="\t"){if(K===" ")K=`
99
- `;else if(!B&&K===`
88
+ `}};UK.YAMLError=e4;UK.YAMLParseError=O9;UK.YAMLWarning=N9;UK.prettifyError=WK});var G2=_((BK)=>{function HK($,{flow:Z,indicator:X,next:z,offset:J,onError:Q,parentIndent:Y,startOnNewline:W}){let U=!1,G=W,q=W,V="",K="",H=!1,N=!1,L=null,O=null,R=null,P=null,C=null,b=null,f=null;for(let w of $){if(N){if(w.type!=="space"&&w.type!=="newline"&&w.type!=="comma")Q(w.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");N=!1}if(L){if(G&&w.type!=="comment"&&w.type!=="newline")Q(L,"TAB_AS_INDENT","Tabs are not allowed as indentation");L=null}switch(w.type){case"space":if(!Z&&(X!=="doc-start"||z?.type!=="flow-collection")&&w.source.includes("\t"))L=w;q=!0;break;case"comment":{if(!q)Q(w,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=w.source.substring(1)||" ";if(!V)V=u;else V+=K+u;K="",G=!1;break}case"newline":if(G){if(V)V+=w.source;else if(!b||X!=="seq-item-ind")U=!0}else K+=w.source;if(G=!0,H=!0,O||R)P=w;q=!0;break;case"anchor":if(O)Q(w,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(w.source.endsWith(":"))Q(w.offset+w.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);O=w,f??(f=w.offset),G=!1,q=!1,N=!0;break;case"tag":{if(R)Q(w,"MULTIPLE_TAGS","A node can have at most one tag");R=w,f??(f=w.offset),G=!1,q=!1,N=!0;break}case X:if(O||R)Q(w,"BAD_PROP_ORDER",`Anchors and tags must be after the ${w.source} indicator`);if(b)Q(w,"UNEXPECTED_TOKEN",`Unexpected ${w.source} in ${Z??"collection"}`);b=w,G=X==="seq-item-ind"||X==="explicit-key-ind",q=!1;break;case"comma":if(Z){if(C)Q(w,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);C=w,G=!1,q=!1;break}default:Q(w,"UNEXPECTED_TOKEN",`Unexpected ${w.type} token`),G=!1,q=!1}}let k=$[$.length-1],i=k?k.offset+k.source.length:J;if(N&&z&&z.type!=="space"&&z.type!=="newline"&&z.type!=="comma"&&(z.type!=="scalar"||z.source!==""))Q(z.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(L&&(G&&L.indent<=Y||z?.type==="block-map"||z?.type==="block-seq"))Q(L,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:C,found:b,spaceBefore:U,comment:V,hasNewline:H,anchor:O,tag:R,newlineAfterProp:P,end:i,start:f??i}}BK.resolveProps=HK});var $3=_((MK)=>{function G6($){if(!$)return null;switch($.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if($.source.includes(`
89
+ `))return!0;if($.end){for(let Z of $.end)if(Z.type==="newline")return!0}return!1;case"flow-collection":for(let Z of $.items){for(let X of Z.start)if(X.type==="newline")return!0;if(Z.sep){for(let X of Z.sep)if(X.type==="newline")return!0}if(G6(Z.key)||G6(Z.value))return!0}return!1;default:return!0}}MK.containsNewline=G6});var q6=_((DK)=>{var NK=$3();function TK($,Z,X){if(Z?.type==="flow-collection"){let z=Z.end[0];if(z.indent===$&&(z.source==="]"||z.source==="}")&&NK.containsNewline(Z))X(z,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}DK.flowIndentCheck=TK});var V6=_((RK)=>{var T9=p();function AK($,Z,X){let{uniqueKeys:z}=$.options;if(z===!1)return!1;let J=typeof z==="function"?z:(Q,Y)=>Q===Y||T9.isScalar(Q)&&T9.isScalar(Y)&&Q.value===Y.value;return Z.some((Q)=>J(Q.key,X))}RK.mapIncludes=AK});var _9=_((EK)=>{var D9=G1(),FK=V1(),I9=G2(),PK=$3(),A9=q6(),CK=V6(),R9="All mapping items must start at the same column";function wK({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let W=new(Q?.nodeClass??FK.YAMLMap)(X.schema);if(X.atRoot)X.atRoot=!1;let U=z.offset,G=null;for(let q of z.items){let{start:V,key:K,sep:H,value:N}=q,L=I9.resolveProps(V,{indicator:"explicit-key-ind",next:K??H?.[0],offset:U,onError:J,parentIndent:z.indent,startOnNewline:!0}),O=!L.found;if(O){if(K){if(K.type==="block-seq")J(U,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in K&&K.indent!==z.indent)J(U,"BAD_INDENT",R9)}if(!L.anchor&&!L.tag&&!H){if(G=L.end,L.comment)if(W.comment)W.comment+=`
90
+ `+L.comment;else W.comment=L.comment;continue}if(L.newlineAfterProp||PK.containsNewline(K))J(K??V[V.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(L.found?.indent!==z.indent)J(U,"BAD_INDENT",R9);X.atKey=!0;let R=L.end,P=K?$(X,K,L,J):Z(X,R,V,null,L,J);if(X.schema.compat)A9.flowIndentCheck(z.indent,K,J);if(X.atKey=!1,CK.mapIncludes(X,W.items,P))J(R,"DUPLICATE_KEY","Map keys must be unique");let C=I9.resolveProps(H??[],{indicator:"map-value-ind",next:N,offset:P.range[2],onError:J,parentIndent:z.indent,startOnNewline:!K||K.type==="block-scalar"});if(U=C.end,C.found){if(O){if(N?.type==="block-map"&&!C.hasNewline)J(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(X.options.strict&&L.start<C.found.offset-1024)J(P.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let b=N?$(X,N,C,J):Z(X,U,H,null,C,J);if(X.schema.compat)A9.flowIndentCheck(z.indent,N,J);U=b.range[2];let f=new D9.Pair(P,b);if(X.options.keepSourceTokens)f.srcToken=q;W.items.push(f)}else{if(O)J(P.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(C.comment)if(P.comment)P.comment+=`
91
+ `+C.comment;else P.comment=C.comment;let b=new D9.Pair(P);if(X.options.keepSourceTokens)b.srcToken=q;W.items.push(b)}}if(G&&G<U)J(G,"IMPOSSIBLE","Map comment with trailing content");return W.range=[z.offset,U,G??U],W}EK.resolveBlockMap=wK});var F9=_((yK)=>{var jK=K1(),xK=G2(),bK=q6();function kK({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let W=new(Q?.nodeClass??jK.YAMLSeq)(X.schema);if(X.atRoot)X.atRoot=!1;if(X.atKey)X.atKey=!1;let U=z.offset,G=null;for(let{start:q,value:V}of z.items){let K=xK.resolveProps(q,{indicator:"seq-item-ind",next:V,offset:U,onError:J,parentIndent:z.indent,startOnNewline:!0});if(!K.found)if(K.anchor||K.tag||V)if(V?.type==="block-seq")J(K.end,"BAD_INDENT","All sequence items must start at the same column");else J(U,"MISSING_CHAR","Sequence item without - indicator");else{if(G=K.end,K.comment)W.comment=K.comment;continue}let H=V?$(X,V,K,J):Z(X,K.end,q,null,K,J);if(X.schema.compat)bK.flowIndentCheck(z.indent,V,J);U=H.range[2],W.items.push(H)}return W.range=[z.offset,U,G??U],W}yK.resolveBlockSeq=kK});var z$=_((vK)=>{function gK($,Z,X,z){let J="";if($){let Q=!1,Y="";for(let W of $){let{source:U,type:G}=W;switch(G){case"space":Q=!0;break;case"comment":{if(X&&!Q)z(W,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let q=U.substring(1)||" ";if(!J)J=q;else J+=Y+q;Y="";break}case"newline":if(J)Y+=U;Q=!0;break;default:z(W,"UNEXPECTED_TOKEN",`Unexpected ${G} at node end`)}Z+=U.length}}return{comment:J,offset:Z}}vK.resolveEnd=gK});var w9=_((nK)=>{var uK=p(),mK=G1(),P9=V1(),cK=K1(),dK=z$(),C9=G2(),lK=$3(),pK=V6(),K6="Block collections are not allowed within flow collections",H6=($)=>$&&($.type==="block-map"||$.type==="block-seq");function iK({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let Y=z.start.source==="{",W=Y?"flow map":"flow sequence",G=new(Q?.nodeClass??(Y?P9.YAMLMap:cK.YAMLSeq))(X.schema);G.flow=!0;let q=X.atRoot;if(q)X.atRoot=!1;if(X.atKey)X.atKey=!1;let V=z.offset+z.start.source.length;for(let O=0;O<z.items.length;++O){let R=z.items[O],{start:P,key:C,sep:b,value:f}=R,k=C9.resolveProps(P,{flow:W,indicator:"explicit-key-ind",next:C??b?.[0],offset:V,onError:J,parentIndent:z.indent,startOnNewline:!1});if(!k.found){if(!k.anchor&&!k.tag&&!b&&!f){if(O===0&&k.comma)J(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`);else if(O<z.items.length-1)J(k.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${W}`);if(k.comment)if(G.comment)G.comment+=`
92
+ `+k.comment;else G.comment=k.comment;V=k.end;continue}if(!Y&&X.options.strict&&lK.containsNewline(C))J(C,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(O===0){if(k.comma)J(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`)}else{if(!k.comma)J(k.start,"MISSING_CHAR",`Missing , between ${W} items`);if(k.comment){let i="";$:for(let w of P)switch(w.type){case"comma":case"space":break;case"comment":i=w.source.substring(1);break $;default:break $}if(i){let w=G.items[G.items.length-1];if(uK.isPair(w))w=w.value??w.key;if(w.comment)w.comment+=`
93
+ `+i;else w.comment=i;k.comment=k.comment.substring(i.length+1)}}}if(!Y&&!b&&!k.found){let i=f?$(X,f,k,J):Z(X,k.end,b,null,k,J);if(G.items.push(i),V=i.range[2],H6(f))J(i.range,"BLOCK_IN_FLOW",K6)}else{X.atKey=!0;let i=k.end,w=C?$(X,C,k,J):Z(X,i,P,null,k,J);if(H6(C))J(w.range,"BLOCK_IN_FLOW",K6);X.atKey=!1;let u=C9.resolveProps(b??[],{flow:W,indicator:"map-value-ind",next:f,offset:w.range[2],onError:J,parentIndent:z.indent,startOnNewline:!1});if(u.found){if(!Y&&!k.found&&X.options.strict){if(b)for(let c of b){if(c===u.found)break;if(c.type==="newline"){J(c,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(k.start<u.found.offset-1024)J(u.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(f)if("source"in f&&f.source?.[0]===":")J(f,"MISSING_CHAR",`Missing space after : in ${W}`);else J(u.start,"MISSING_CHAR",`Missing , or : between ${W} items`);let n=f?$(X,f,u,J):u.found?Z(X,u.end,b,null,u,J):null;if(n){if(H6(f))J(n.range,"BLOCK_IN_FLOW",K6)}else if(u.comment)if(w.comment)w.comment+=`
94
+ `+u.comment;else w.comment=u.comment;let x=new mK.Pair(w,n);if(X.options.keepSourceTokens)x.srcToken=R;if(Y){let c=G;if(pK.mapIncludes(X,c.items,w))J(i,"DUPLICATE_KEY","Map keys must be unique");c.items.push(x)}else{let c=new P9.YAMLMap(X.schema);c.flow=!0,c.items.push(x);let g0=(n??w).range;c.range=[w.range[0],g0[1],g0[2]],G.items.push(c)}V=n?n.range[2]:u.end}}let K=Y?"}":"]",[H,...N]=z.end,L=V;if(H?.source===K)L=H.offset+H.source.length;else{let O=W[0].toUpperCase()+W.substring(1),R=q?`${O} must end with a ${K}`:`${O} in block collection must be sufficiently indented and end with a ${K}`;if(J(V,q?"MISSING_CHAR":"BAD_INDENT",R),H&&H.source.length!==1)N.unshift(H)}if(N.length>0){let O=dK.resolveEnd(N,L,X.options.strict,J);if(O.comment)if(G.comment)G.comment+=`
95
+ `+O.comment;else G.comment=O.comment;G.range=[z.offset,L,O.offset]}else G.range=[z.offset,L,L];return G}nK.resolveFlowCollection=iK});var E9=_((zH)=>{var sK=p(),aK=z0(),oK=V1(),tK=K1(),eK=_9(),$H=F9(),ZH=w9();function B6($,Z,X,z,J,Q){let Y=X.type==="block-map"?eK.resolveBlockMap($,Z,X,z,Q):X.type==="block-seq"?$H.resolveBlockSeq($,Z,X,z,Q):ZH.resolveFlowCollection($,Z,X,z,Q),W=Y.constructor;if(J==="!"||J===W.tagName)return Y.tag=W.tagName,Y;if(J)Y.tag=J;return Y}function XH($,Z,X,z,J){let Q=z.tag,Y=!Q?null:Z.directives.tagName(Q.source,(K)=>J(Q,"TAG_RESOLVE_FAILED",K));if(X.type==="block-seq"){let{anchor:K,newlineAfterProp:H}=z,N=K&&Q?K.offset>Q.offset?K:Q:K??Q;if(N&&(!H||H.offset<N.offset))J(N,"MISSING_CHAR","Missing newline after block sequence props")}let W=X.type==="block-map"?"map":X.type==="block-seq"?"seq":X.start.source==="{"?"map":"seq";if(!Q||!Y||Y==="!"||Y===oK.YAMLMap.tagName&&W==="map"||Y===tK.YAMLSeq.tagName&&W==="seq")return B6($,Z,X,J,Y);let U=Z.schema.tags.find((K)=>K.tag===Y&&K.collection===W);if(!U){let K=Z.schema.knownTags[Y];if(K?.collection===W)Z.schema.tags.push(Object.assign({},K,{default:!1})),U=K;else{if(K)J(Q,"BAD_COLLECTION_TYPE",`${K.tag} used for ${W} collection, but expects ${K.collection??"scalar"}`,!0);else J(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return B6($,Z,X,J,Y)}}let G=B6($,Z,X,J,Y,U),q=U.resolve?.(G,(K)=>J(Q,"TAG_RESOLVE_FAILED",K),Z.options)??G,V=sK.isNode(q)?q:new aK.Scalar(q);if(V.range=G.range,V.tag=Y,U?.format)V.format=U.format;return V}zH.composeCollection=XH});var M6=_((UH)=>{var L6=z0();function QH($,Z,X){let z=Z.offset,J=YH(Z,$.options.strict,X);if(!J)return{value:"",type:null,comment:"",range:[z,z,z]};let Q=J.mode===">"?L6.Scalar.BLOCK_FOLDED:L6.Scalar.BLOCK_LITERAL,Y=Z.source?WH(Z.source):[],W=Y.length;for(let L=Y.length-1;L>=0;--L){let O=Y[L][1];if(O===""||O==="\r")W=L;else break}if(W===0){let L=J.chomp==="+"&&Y.length>0?`
96
+ `.repeat(Math.max(1,Y.length-1)):"",O=z+J.length;if(Z.source)O+=Z.source.length;return{value:L,type:Q,comment:J.comment,range:[z,O,O]}}let U=Z.indent+J.indent,G=Z.offset+J.length,q=0;for(let L=0;L<W;++L){let[O,R]=Y[L];if(R===""||R==="\r"){if(J.indent===0&&O.length>U)U=O.length}else{if(O.length<U)X(G+O.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(J.indent===0)U=O.length;if(q=L,U===0&&!$.atRoot)X(G,"BAD_INDENT","Block scalar values in collections must be indented");break}G+=O.length+R.length+1}for(let L=Y.length-1;L>=W;--L)if(Y[L][0].length>U)W=L+1;let V="",K="",H=!1;for(let L=0;L<q;++L)V+=Y[L][0].slice(U)+`
97
+ `;for(let L=q;L<W;++L){let[O,R]=Y[L];G+=O.length+R.length+1;let P=R[R.length-1]==="\r";if(P)R=R.slice(0,-1);if(R&&O.length<U){let b=`Block scalar lines must not be less indented than their ${J.indent?"explicit indentation indicator":"first line"}`;X(G-R.length-(P?2:1),"BAD_INDENT",b),O=""}if(Q===L6.Scalar.BLOCK_LITERAL)V+=K+O.slice(U)+R,K=`
98
+ `;else if(O.length>U||R[0]==="\t"){if(K===" ")K=`
99
+ `;else if(!H&&K===`
100
100
  `)K=`
101
101
 
102
- `;V+=K+M.slice(U)+R,K=`
103
- `,B=!0}else if(R==="")if(K===`
102
+ `;V+=K+O.slice(U)+R,K=`
103
+ `,H=!0}else if(R==="")if(K===`
104
104
  `)V+=`
105
105
  `;else K=`
106
- `;else V+=K+R,K=" ",B=!1}switch(J.chomp){case"-":break;case"+":for(let L=W;L<Y.length;++L)V+=`
106
+ `;else V+=K+R,K=" ",H=!1}switch(J.chomp){case"-":break;case"+":for(let L=W;L<Y.length;++L)V+=`
107
107
  `+Y[L][0].slice(U);if(V[V.length-1]!==`
108
108
  `)V+=`
109
109
  `;break;default:V+=`
110
- `}let O=z+J.length+Z.source.length;return{value:V,type:Q,comment:J.comment,range:[z,O,O]}}function eK({offset:$,props:Z},X,z){if(Z[0].type!=="block-scalar-header")return z(Z[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:J}=Z[0],Q=J[0],Y=0,W="",U=-1;for(let K=1;K<J.length;++K){let B=J[K];if(!W&&(B==="-"||B==="+"))W=B;else{let O=Number(B);if(!Y&&O)Y=O;else if(U===-1)U=$+K}}if(U!==-1)z(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${J}`);let G=!1,q="",V=J.length;for(let K=1;K<Z.length;++K){let B=Z[K];switch(B.type){case"space":G=!0;case"newline":V+=B.source.length;break;case"comment":if(X&&!G)z(B,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");V+=B.source.length,q=B.source.substring(1);break;case"error":z(B,"UNEXPECTED_TOKEN",B.message),V+=B.source.length;break;default:{let O=`Unexpected token in block scalar header: ${B.type}`;z(B,"UNEXPECTED_TOKEN",O);let L=B.source;if(L&&typeof L==="string")V+=L.length}}}return{mode:Q,indent:Y,chomp:W,comment:q,length:V}}function $H($){let Z=$.split(/\n( *)/),X=Z[0],z=X.match(/^( *)/),Q=[z?.[1]?[z[1],X.slice(z[1].length)]:["",X]];for(let Y=1;Y<Z.length;Y+=2)Q.push([Z[Y],Z[Y+1]]);return Q}ZH.resolveBlockScalar=tK});var B6=F((VH)=>{var H6=X0(),zH=X$();function JH($,Z,X){let{offset:z,type:J,source:Q,end:Y}=$,W,U,G=(K,B,O)=>X(z+K,B,O);switch(J){case"scalar":W=H6.Scalar.PLAIN,U=QH(Q,G);break;case"single-quoted-scalar":W=H6.Scalar.QUOTE_SINGLE,U=YH(Q,G);break;case"double-quoted-scalar":W=H6.Scalar.QUOTE_DOUBLE,U=WH(Q,G);break;default:return X($,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${J}`),{value:"",type:null,comment:"",range:[z,z+Q.length,z+Q.length]}}let q=z+Q.length,V=zH.resolveEnd(Y,q,Z,X);return{value:U,type:W,comment:V.comment,range:[z,q,V.offset]}}function QH($,Z){let X="";switch($[0]){case"\t":X="a tab character";break;case",":X="flow indicator character ,";break;case"%":X="directive indicator character %";break;case"|":case">":{X=`block scalar indicator ${$[0]}`;break}case"@":case"`":{X=`reserved character ${$[0]}`;break}}if(X)Z(0,"BAD_SCALAR_START",`Plain value cannot start with ${X}`);return _9($)}function YH($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return _9($.slice(1,-1)).replace(/''/g,"'")}function _9($){let Z,X;try{Z=new RegExp(`(.*?)(?<![ ])[ ]*\r?
110
+ `}let N=z+J.length+Z.source.length;return{value:V,type:Q,comment:J.comment,range:[z,N,N]}}function YH({offset:$,props:Z},X,z){if(Z[0].type!=="block-scalar-header")return z(Z[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:J}=Z[0],Q=J[0],Y=0,W="",U=-1;for(let K=1;K<J.length;++K){let H=J[K];if(!W&&(H==="-"||H==="+"))W=H;else{let N=Number(H);if(!Y&&N)Y=N;else if(U===-1)U=$+K}}if(U!==-1)z(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${J}`);let G=!1,q="",V=J.length;for(let K=1;K<Z.length;++K){let H=Z[K];switch(H.type){case"space":G=!0;case"newline":V+=H.source.length;break;case"comment":if(X&&!G)z(H,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");V+=H.source.length,q=H.source.substring(1);break;case"error":z(H,"UNEXPECTED_TOKEN",H.message),V+=H.source.length;break;default:{let N=`Unexpected token in block scalar header: ${H.type}`;z(H,"UNEXPECTED_TOKEN",N);let L=H.source;if(L&&typeof L==="string")V+=L.length}}}return{mode:Q,indent:Y,chomp:W,comment:q,length:V}}function WH($){let Z=$.split(/\n( *)/),X=Z[0],z=X.match(/^( *)/),Q=[z?.[1]?[z[1],X.slice(z[1].length)]:["",X]];for(let Y=1;Y<Z.length;Y+=2)Q.push([Z[Y],Z[Y+1]]);return Q}UH.resolveBlockScalar=QH});var N6=_((NH)=>{var O6=z0(),qH=z$();function VH($,Z,X){let{offset:z,type:J,source:Q,end:Y}=$,W,U,G=(K,H,N)=>X(z+K,H,N);switch(J){case"scalar":W=O6.Scalar.PLAIN,U=KH(Q,G);break;case"single-quoted-scalar":W=O6.Scalar.QUOTE_SINGLE,U=HH(Q,G);break;case"double-quoted-scalar":W=O6.Scalar.QUOTE_DOUBLE,U=BH(Q,G);break;default:return X($,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${J}`),{value:"",type:null,comment:"",range:[z,z+Q.length,z+Q.length]}}let q=z+Q.length,V=qH.resolveEnd(Y,q,Z,X);return{value:U,type:W,comment:V.comment,range:[z,q,V.offset]}}function KH($,Z){let X="";switch($[0]){case"\t":X="a tab character";break;case",":X="flow indicator character ,";break;case"%":X="directive indicator character %";break;case"|":case">":{X=`block scalar indicator ${$[0]}`;break}case"@":case"`":{X=`reserved character ${$[0]}`;break}}if(X)Z(0,"BAD_SCALAR_START",`Plain value cannot start with ${X}`);return S9($)}function HH($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return S9($.slice(1,-1)).replace(/''/g,"'")}function S9($){let Z,X;try{Z=new RegExp(`(.*?)(?<![ ])[ ]*\r?
111
111
  `,"sy"),X=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
112
112
  `,"sy")}catch{Z=/(.*?)[ \t]*\r?\n/sy,X=/[ \t]*(.*?)[ \t]*\r?\n/sy}let z=Z.exec($);if(!z)return $;let J=z[1],Q=" ",Y=Z.lastIndex;X.lastIndex=Y;while(z=X.exec($)){if(z[1]==="")if(Q===`
113
113
  `)J+=Q;else Q=`
114
- `;else J+=Q+z[1],Q=" ";Y=X.lastIndex}let W=/[ \t]*(.*)/sy;return W.lastIndex=Y,z=W.exec($),J+Q+(z?.[1]??"")}function WH($,Z){let X="";for(let z=1;z<$.length-1;++z){let J=$[z];if(J==="\r"&&$[z+1]===`
114
+ `;else J+=Q+z[1],Q=" ";Y=X.lastIndex}let W=/[ \t]*(.*)/sy;return W.lastIndex=Y,z=W.exec($),J+Q+(z?.[1]??"")}function BH($,Z){let X="";for(let z=1;z<$.length-1;++z){let J=$[z];if(J==="\r"&&$[z+1]===`
115
115
  `)continue;if(J===`
116
- `){let{fold:Q,offset:Y}=UH($,z);X+=Q,z=Y}else if(J==="\\"){let Q=$[++z],Y=GH[Q];if(Y)X+=Y;else if(Q===`
116
+ `){let{fold:Q,offset:Y}=LH($,z);X+=Q,z=Y}else if(J==="\\"){let Q=$[++z],Y=MH[Q];if(Y)X+=Y;else if(Q===`
117
117
  `){Q=$[z+1];while(Q===" "||Q==="\t")Q=$[++z+1]}else if(Q==="\r"&&$[z+1]===`
118
- `){Q=$[++z+1];while(Q===" "||Q==="\t")Q=$[++z+1]}else if(Q==="x"||Q==="u"||Q==="U"){let W={x:2,u:4,U:8}[Q];X+=qH($,z+1,W,Z),z+=W}else{let W=$.substr(z-1,2);Z(z-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),X+=W}}else if(J===" "||J==="\t"){let Q=z,Y=$[z+1];while(Y===" "||Y==="\t")Y=$[++z+1];if(Y!==`
118
+ `){Q=$[++z+1];while(Q===" "||Q==="\t")Q=$[++z+1]}else if(Q==="x"||Q==="u"||Q==="U"){let W={x:2,u:4,U:8}[Q];X+=OH($,z+1,W,Z),z+=W}else{let W=$.substr(z-1,2);Z(z-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),X+=W}}else if(J===" "||J==="\t"){let Q=z,Y=$[z+1];while(Y===" "||Y==="\t")Y=$[++z+1];if(Y!==`
119
119
  `&&!(Y==="\r"&&$[z+2]===`
120
- `))X+=z>Q?$.slice(Q,z+1):J}else X+=J}if($[$.length-1]!=='"'||$.length===1)Z($.length,"MISSING_CHAR",'Missing closing "quote');return X}function UH($,Z){let X="",z=$[Z+1];while(z===" "||z==="\t"||z===`
120
+ `))X+=z>Q?$.slice(Q,z+1):J}else X+=J}if($[$.length-1]!=='"'||$.length===1)Z($.length,"MISSING_CHAR",'Missing closing "quote');return X}function LH($,Z){let X="",z=$[Z+1];while(z===" "||z==="\t"||z===`
121
121
  `||z==="\r"){if(z==="\r"&&$[Z+2]!==`
122
122
  `)break;if(z===`
123
123
  `)X+=`
124
- `;Z+=1,z=$[Z+1]}if(!X)X=" ";return{fold:X,offset:Z}}var GH={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
125
- `,r:"\r",t:"\t",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function qH($,Z,X,z){let J=$.substr(Z,X),Y=J.length===X&&/^[0-9a-fA-F]+$/.test(J)?parseInt(J,16):NaN;if(isNaN(Y)){let W=$.substr(Z-2,X+2);return z(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),W}return String.fromCodePoint(Y)}VH.resolveFlowScalar=JH});var w9=F((OH)=>{var x1=p(),P9=X0(),HH=K6(),BH=B6();function LH($,Z,X,z){let{value:J,type:Q,comment:Y,range:W}=Z.type==="block-scalar"?HH.resolveBlockScalar($,Z,z):BH.resolveFlowScalar(Z,$.options.strict,z),U=X?$.directives.tagName(X.source,(V)=>z(X,"TAG_RESOLVE_FAILED",V)):null,G;if($.options.stringKeys&&$.atKey)G=$.schema[x1.SCALAR];else if(U)G=NH($.schema,J,U,X,z);else if(Z.type==="scalar")G=MH($,J,Z,z);else G=$.schema[x1.SCALAR];let q;try{let V=G.resolve(J,(K)=>z(X??Z,"TAG_RESOLVE_FAILED",K),$.options);q=x1.isScalar(V)?V:new P9.Scalar(V)}catch(V){let K=V instanceof Error?V.message:String(V);z(X??Z,"TAG_RESOLVE_FAILED",K),q=new P9.Scalar(J)}if(q.range=W,q.source=J,Q)q.type=Q;if(U)q.tag=U;if(G.format)q.format=G.format;if(Y)q.comment=Y;return q}function NH($,Z,X,z,J){if(X==="!")return $[x1.SCALAR];let Q=[];for(let W of $.tags)if(!W.collection&&W.tag===X)if(W.default&&W.test)Q.push(W);else return W;for(let W of Q)if(W.test?.test(Z))return W;let Y=$.knownTags[X];if(Y&&!Y.collection)return $.tags.push(Object.assign({},Y,{default:!1,test:void 0})),Y;return J(z,"TAG_RESOLVE_FAILED",`Unresolved tag: ${X}`,X!=="tag:yaml.org,2002:str"),$[x1.SCALAR]}function MH({atKey:$,directives:Z,schema:X},z,J,Q){let Y=X.tags.find((W)=>(W.default===!0||$&&W.default==="key")&&W.test?.test(z))||X[x1.SCALAR];if(X.compat){let W=X.compat.find((U)=>U.default&&U.test?.test(z))??X[x1.SCALAR];if(Y.tag!==W.tag){let U=Z.tagString(Y.tag),G=Z.tagString(W.tag),q=`Value may be parsed as either ${U} or ${G}`;Q(J,"TAG_RESOLVE_FAILED",q,!0)}}return Y}OH.composeScalar=LH});var C9=F((IH)=>{function DH($,Z,X){if(Z){X??(X=Z.length);for(let z=X-1;z>=0;--z){let J=Z[z];switch(J.type){case"space":case"comment":case"newline":$-=J.source.length;continue}J=Z[++z];while(J?.type==="space")$+=J.source.length,J=Z[++z];break}}return $}IH.emptyScalarPosition=DH});var S9=F((jH)=>{var RH=p$(),FH=p(),_H=F9(),E9=w9(),PH=X$(),wH=C9(),CH={composeNode:j9,composeEmptyNode:L6};function j9($,Z,X,z){let J=$.atKey,{spaceBefore:Q,comment:Y,anchor:W,tag:U}=X,G,q=!0;switch(Z.type){case"alias":if(G=EH($,Z,z),W||U)z(Z,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(G=E9.composeScalar($,Z,U,z),W)G.anchor=W.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(G=_H.composeCollection(CH,$,Z,X,z),W)G.anchor=W.source.substring(1)}catch(V){let K=V instanceof Error?V.message:String(V);z(Z,"RESOURCE_EXHAUSTION",K)}break;default:{let V=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;z(Z,"UNEXPECTED_TOKEN",V),q=!1}}if(G??(G=L6($,Z.offset,void 0,null,X,z)),W&&G.anchor==="")z(W,"BAD_ALIAS","Anchor cannot be an empty string");if(J&&$.options.stringKeys&&(!FH.isScalar(G)||typeof G.value!=="string"||G.tag&&G.tag!=="tag:yaml.org,2002:str"))z(U??Z,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(Q)G.spaceBefore=!0;if(Y)if(Z.type==="scalar"&&Z.source==="")G.comment=Y;else G.commentBefore=Y;if($.options.keepSourceTokens&&q)G.srcToken=Z;return G}function L6($,Z,X,z,{spaceBefore:J,comment:Q,anchor:Y,tag:W,end:U},G){let q={type:"scalar",offset:wH.emptyScalarPosition(Z,X,z),indent:-1,source:""},V=E9.composeScalar($,q,W,G);if(Y){if(V.anchor=Y.source.substring(1),V.anchor==="")G(Y,"BAD_ALIAS","Anchor cannot be an empty string")}if(J)V.spaceBefore=!0;if(Q)V.comment=Q,V.range[2]=U;return V}function EH({options:$},{offset:Z,source:X,end:z},J){let Q=new RH.Alias(X.substring(1));if(Q.source==="")J(Z,"BAD_ALIAS","Alias cannot be an empty string");if(Q.source.endsWith(":"))J(Z+X.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let Y=Z+X.length,W=PH.resolveEnd(z,Y,$.strict,J);if(Q.range=[Z,Y,W.offset],W.comment)Q.comment=W.comment;return Q}jH.composeEmptyNode=L6;jH.composeNode=j9});var b9=F((gH)=>{var bH=Y2(),x9=S9(),kH=X$(),yH=U2();function fH($,Z,{offset:X,start:z,value:J,end:Q},Y){let W=Object.assign({_directives:Z},$),U=new bH.Document(void 0,W),G={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},q=yH.resolveProps(z,{indicator:"doc-start",next:J??Q?.[0],offset:X,onError:Y,parentIndent:0,startOnNewline:!0});if(q.found){if(U.directives.docStart=!0,J&&(J.type==="block-map"||J.type==="block-seq")&&!q.hasNewline)Y(q.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}U.contents=J?x9.composeNode(G,J,q,Y):x9.composeEmptyNode(G,q.end,z,null,q,Y);let V=U.contents.range[2],K=kH.resolveEnd(Q,V,!1,Y);if(K.comment)U.comment=K.comment;return U.range=[X,V,K.offset],U}gH.composeDoc=fH});var N6=F((lH)=>{var hH=A0("process"),uH=D8(),mH=Y2(),G2=W2(),k9=p(),cH=b9(),dH=X$();function q2($){if(typeof $==="number")return[$,$+1];if(Array.isArray($))return $.length===2?$:[$[0],$[1]];let{offset:Z,source:X}=$;return[Z,Z+(typeof X==="string"?X.length:1)]}function y9($){let Z="",X=!1,z=!1;for(let J=0;J<$.length;++J){let Q=$[J];switch(Q[0]){case"#":Z+=(Z===""?"":z?`
124
+ `;Z+=1,z=$[Z+1]}if(!X)X=" ";return{fold:X,offset:Z}}var MH={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
125
+ `,r:"\r",t:"\t",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function OH($,Z,X,z){let J=$.substr(Z,X),Y=J.length===X&&/^[0-9a-fA-F]+$/.test(J)?parseInt(J,16):NaN;if(isNaN(Y)){let W=$.substr(Z-2,X+2);return z(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),W}return String.fromCodePoint(Y)}NH.resolveFlowScalar=VH});var x9=_((FH)=>{var x1=p(),j9=z0(),DH=M6(),IH=N6();function AH($,Z,X,z){let{value:J,type:Q,comment:Y,range:W}=Z.type==="block-scalar"?DH.resolveBlockScalar($,Z,z):IH.resolveFlowScalar(Z,$.options.strict,z),U=X?$.directives.tagName(X.source,(V)=>z(X,"TAG_RESOLVE_FAILED",V)):null,G;if($.options.stringKeys&&$.atKey)G=$.schema[x1.SCALAR];else if(U)G=RH($.schema,J,U,X,z);else if(Z.type==="scalar")G=_H($,J,Z,z);else G=$.schema[x1.SCALAR];let q;try{let V=G.resolve(J,(K)=>z(X??Z,"TAG_RESOLVE_FAILED",K),$.options);q=x1.isScalar(V)?V:new j9.Scalar(V)}catch(V){let K=V instanceof Error?V.message:String(V);z(X??Z,"TAG_RESOLVE_FAILED",K),q=new j9.Scalar(J)}if(q.range=W,q.source=J,Q)q.type=Q;if(U)q.tag=U;if(G.format)q.format=G.format;if(Y)q.comment=Y;return q}function RH($,Z,X,z,J){if(X==="!")return $[x1.SCALAR];let Q=[];for(let W of $.tags)if(!W.collection&&W.tag===X)if(W.default&&W.test)Q.push(W);else return W;for(let W of Q)if(W.test?.test(Z))return W;let Y=$.knownTags[X];if(Y&&!Y.collection)return $.tags.push(Object.assign({},Y,{default:!1,test:void 0})),Y;return J(z,"TAG_RESOLVE_FAILED",`Unresolved tag: ${X}`,X!=="tag:yaml.org,2002:str"),$[x1.SCALAR]}function _H({atKey:$,directives:Z,schema:X},z,J,Q){let Y=X.tags.find((W)=>(W.default===!0||$&&W.default==="key")&&W.test?.test(z))||X[x1.SCALAR];if(X.compat){let W=X.compat.find((U)=>U.default&&U.test?.test(z))??X[x1.SCALAR];if(Y.tag!==W.tag){let U=Z.tagString(Y.tag),G=Z.tagString(W.tag),q=`Value may be parsed as either ${U} or ${G}`;Q(J,"TAG_RESOLVE_FAILED",q,!0)}}return Y}FH.composeScalar=AH});var b9=_((wH)=>{function CH($,Z,X){if(Z){X??(X=Z.length);for(let z=X-1;z>=0;--z){let J=Z[z];switch(J.type){case"space":case"comment":case"newline":$-=J.source.length;continue}J=Z[++z];while(J?.type==="space")$+=J.source.length,J=Z[++z];break}}return $}wH.emptyScalarPosition=CH});var f9=_((gH)=>{var SH=i$(),jH=p(),xH=E9(),k9=x9(),bH=z$(),kH=b9(),yH={composeNode:y9,composeEmptyNode:T6};function y9($,Z,X,z){let J=$.atKey,{spaceBefore:Q,comment:Y,anchor:W,tag:U}=X,G,q=!0;switch(Z.type){case"alias":if(G=fH($,Z,z),W||U)z(Z,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(G=k9.composeScalar($,Z,U,z),W)G.anchor=W.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(G=xH.composeCollection(yH,$,Z,X,z),W)G.anchor=W.source.substring(1)}catch(V){let K=V instanceof Error?V.message:String(V);z(Z,"RESOURCE_EXHAUSTION",K)}break;default:{let V=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;z(Z,"UNEXPECTED_TOKEN",V),q=!1}}if(G??(G=T6($,Z.offset,void 0,null,X,z)),W&&G.anchor==="")z(W,"BAD_ALIAS","Anchor cannot be an empty string");if(J&&$.options.stringKeys&&(!jH.isScalar(G)||typeof G.value!=="string"||G.tag&&G.tag!=="tag:yaml.org,2002:str"))z(U??Z,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(Q)G.spaceBefore=!0;if(Y)if(Z.type==="scalar"&&Z.source==="")G.comment=Y;else G.commentBefore=Y;if($.options.keepSourceTokens&&q)G.srcToken=Z;return G}function T6($,Z,X,z,{spaceBefore:J,comment:Q,anchor:Y,tag:W,end:U},G){let q={type:"scalar",offset:kH.emptyScalarPosition(Z,X,z),indent:-1,source:""},V=k9.composeScalar($,q,W,G);if(Y){if(V.anchor=Y.source.substring(1),V.anchor==="")G(Y,"BAD_ALIAS","Anchor cannot be an empty string")}if(J)V.spaceBefore=!0;if(Q)V.comment=Q,V.range[2]=U;return V}function fH({options:$},{offset:Z,source:X,end:z},J){let Q=new SH.Alias(X.substring(1));if(Q.source==="")J(Z,"BAD_ALIAS","Alias cannot be an empty string");if(Q.source.endsWith(":"))J(Z+X.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let Y=Z+X.length,W=bH.resolveEnd(z,Y,$.strict,J);if(Q.range=[Z,Y,W.offset],W.comment)Q.comment=W.comment;return Q}gH.composeEmptyNode=T6;gH.composeNode=y9});var v9=_((lH)=>{var uH=W2(),g9=f9(),mH=z$(),cH=G2();function dH($,Z,{offset:X,start:z,value:J,end:Q},Y){let W=Object.assign({_directives:Z},$),U=new uH.Document(void 0,W),G={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},q=cH.resolveProps(z,{indicator:"doc-start",next:J??Q?.[0],offset:X,onError:Y,parentIndent:0,startOnNewline:!0});if(q.found){if(U.directives.docStart=!0,J&&(J.type==="block-map"||J.type==="block-seq")&&!q.hasNewline)Y(q.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}U.contents=J?g9.composeNode(G,J,q,Y):g9.composeEmptyNode(G,q.end,z,null,q,Y);let V=U.contents.range[2],K=mH.resolveEnd(Q,V,!1,Y);if(K.comment)U.comment=K.comment;return U.range=[X,V,K.offset],U}lH.composeDoc=dH});var D6=_((oH)=>{var iH=A0("process"),nH=_8(),rH=W2(),q2=U2(),h9=p(),sH=v9(),aH=z$();function V2($){if(typeof $==="number")return[$,$+1];if(Array.isArray($))return $.length===2?$:[$[0],$[1]];let{offset:Z,source:X}=$;return[Z,Z+(typeof X==="string"?X.length:1)]}function u9($){let Z="",X=!1,z=!1;for(let J=0;J<$.length;++J){let Q=$[J];switch(Q[0]){case"#":Z+=(Z===""?"":z?`
126
126
 
127
127
  `:`
128
- `)+(Q.substring(1)||" "),X=!0,z=!1;break;case"%":if($[J+1]?.[0]!=="#")J+=1;X=!1;break;default:if(!X)z=!0;X=!1}}return{comment:Z,afterEmptyLine:z}}class f9{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,X,z,J)=>{let Q=q2(Z);if(J)this.warnings.push(new G2.YAMLWarning(Q,X,z));else this.errors.push(new G2.YAMLParseError(Q,X,z))},this.directives=new uH.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:X,afterEmptyLine:z}=y9(this.prelude);if(X){let J=$.contents;if(Z)$.comment=$.comment?`${$.comment}
129
- ${X}`:X;else if(z||$.directives.docStart||!J)$.commentBefore=X;else if(k9.isCollection(J)&&!J.flow&&J.items.length>0){let Q=J.items[0];if(k9.isPair(Q))Q=Q.key;let Y=Q.commentBefore;Q.commentBefore=Y?`${X}
128
+ `)+(Q.substring(1)||" "),X=!0,z=!1;break;case"%":if($[J+1]?.[0]!=="#")J+=1;X=!1;break;default:if(!X)z=!0;X=!1}}return{comment:Z,afterEmptyLine:z}}class m9{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,X,z,J)=>{let Q=V2(Z);if(J)this.warnings.push(new q2.YAMLWarning(Q,X,z));else this.errors.push(new q2.YAMLParseError(Q,X,z))},this.directives=new nH.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:X,afterEmptyLine:z}=u9(this.prelude);if(X){let J=$.contents;if(Z)$.comment=$.comment?`${$.comment}
129
+ ${X}`:X;else if(z||$.directives.docStart||!J)$.commentBefore=X;else if(h9.isCollection(J)&&!J.flow&&J.items.length>0){let Q=J.items[0];if(h9.isPair(Q))Q=Q.key;let Y=Q.commentBefore;Q.commentBefore=Y?`${X}
130
130
  ${Y}`:X}else{let Q=J.commentBefore;J.commentBefore=Q?`${X}
131
- ${Q}`:X}}if(Z)Array.prototype.push.apply($.errors,this.errors),Array.prototype.push.apply($.warnings,this.warnings);else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:y9(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose($,Z=!1,X=-1){for(let z of $)yield*this.next(z);yield*this.end(Z,X)}*next($){if(hH.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,X,z)=>{let J=q2($);J[0]+=Z,this.onError(J,"BAD_DIRECTIVE",X,z)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=cH.composeDoc(this.options,this.directives,$,this.onError);if(this.atDirectives&&!Z.directives.docStart)this.onError($,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(Z,!1),this.doc)yield this.doc;this.doc=Z,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push($.source);break;case"error":{let Z=$.source?`${$.message}: ${JSON.stringify($.source)}`:$.message,X=new G2.YAMLParseError(q2($),"UNEXPECTED_TOKEN",Z);if(this.atDirectives||!this.doc)this.errors.push(X);else this.doc.errors.push(X);break}case"doc-end":{if(!this.doc){this.errors.push(new G2.YAMLParseError(q2($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=dH.resolveEnd($.end,$.offset+$.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),Z.comment){let X=this.doc.comment;this.doc.comment=X?`${X}
132
- ${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.push(new G2.YAMLParseError(q2($),"UNEXPECTED_TOKEN",`Unsupported token ${$.type}`))}}*end($=!1,Z=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if($){let X=Object.assign({_directives:this.directives},this.options),z=new mH.Document(void 0,X);if(this.atDirectives)this.onError(Z,"MISSING_CHAR","Missing directives-end indicator line");z.range=[0,Z,Z],this.decorate(z,!1),yield z}}}lH.Composer=f9});var h9=F((eH)=>{var iH=K6(),nH=B6(),rH=W2(),g9=s$();function sH($,Z=!0,X){if($){let z=(J,Q,Y)=>{let W=typeof J==="number"?J:Array.isArray(J)?J[0]:J.offset;if(X)X(W,Q,Y);else throw new rH.YAMLParseError([W,W+1],Q,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return nH.resolveFlowScalar($,Z,z);case"block-scalar":return iH.resolveBlockScalar({options:{strict:Z}},$,z)}}return null}function aH($,Z){let{implicitKey:X=!1,indent:z,inFlow:J=!1,offset:Q=-1,type:Y="PLAIN"}=Z,W=g9.stringifyString({type:Y,value:$},{implicitKey:X,indent:z>0?" ".repeat(z):"",inFlow:J,options:{blockQuote:!0,lineWidth:-1}}),U=Z.end??[{type:"newline",offset:-1,indent:z,source:`
131
+ ${Q}`:X}}if(Z)Array.prototype.push.apply($.errors,this.errors),Array.prototype.push.apply($.warnings,this.warnings);else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:u9(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose($,Z=!1,X=-1){for(let z of $)yield*this.next(z);yield*this.end(Z,X)}*next($){if(iH.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,X,z)=>{let J=V2($);J[0]+=Z,this.onError(J,"BAD_DIRECTIVE",X,z)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=sH.composeDoc(this.options,this.directives,$,this.onError);if(this.atDirectives&&!Z.directives.docStart)this.onError($,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(Z,!1),this.doc)yield this.doc;this.doc=Z,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push($.source);break;case"error":{let Z=$.source?`${$.message}: ${JSON.stringify($.source)}`:$.message,X=new q2.YAMLParseError(V2($),"UNEXPECTED_TOKEN",Z);if(this.atDirectives||!this.doc)this.errors.push(X);else this.doc.errors.push(X);break}case"doc-end":{if(!this.doc){this.errors.push(new q2.YAMLParseError(V2($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=aH.resolveEnd($.end,$.offset+$.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),Z.comment){let X=this.doc.comment;this.doc.comment=X?`${X}
132
+ ${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.push(new q2.YAMLParseError(V2($),"UNEXPECTED_TOKEN",`Unsupported token ${$.type}`))}}*end($=!1,Z=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if($){let X=Object.assign({_directives:this.directives},this.options),z=new rH.Document(void 0,X);if(this.atDirectives)this.onError(Z,"MISSING_CHAR","Missing directives-end indicator line");z.range=[0,Z,Z],this.decorate(z,!1),yield z}}}oH.Composer=m9});var l9=_((YB)=>{var eH=M6(),$B=N6(),ZB=U2(),c9=a$();function XB($,Z=!0,X){if($){let z=(J,Q,Y)=>{let W=typeof J==="number"?J:Array.isArray(J)?J[0]:J.offset;if(X)X(W,Q,Y);else throw new ZB.YAMLParseError([W,W+1],Q,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return $B.resolveFlowScalar($,Z,z);case"block-scalar":return eH.resolveBlockScalar({options:{strict:Z}},$,z)}}return null}function zB($,Z){let{implicitKey:X=!1,indent:z,inFlow:J=!1,offset:Q=-1,type:Y="PLAIN"}=Z,W=c9.stringifyString({type:Y,value:$},{implicitKey:X,indent:z>0?" ".repeat(z):"",inFlow:J,options:{blockQuote:!0,lineWidth:-1}}),U=Z.end??[{type:"newline",offset:-1,indent:z,source:`
133
133
  `}];switch(W[0]){case"|":case">":{let G=W.indexOf(`
134
134
  `),q=W.substring(0,G),V=W.substring(G+1)+`
135
- `,K=[{type:"block-scalar-header",offset:Q,indent:z,source:q}];if(!v9(K,U))K.push({type:"newline",offset:-1,indent:z,source:`
136
- `});return{type:"block-scalar",offset:Q,indent:z,props:K,source:V}}case'"':return{type:"double-quoted-scalar",offset:Q,indent:z,source:W,end:U};case"'":return{type:"single-quoted-scalar",offset:Q,indent:z,source:W,end:U};default:return{type:"scalar",offset:Q,indent:z,source:W,end:U}}}function oH($,Z,X={}){let{afterKey:z=!1,implicitKey:J=!1,inFlow:Q=!1,type:Y}=X,W="indent"in $?$.indent:null;if(z&&typeof W==="number")W+=2;if(!Y)switch($.type){case"single-quoted-scalar":Y="QUOTE_SINGLE";break;case"double-quoted-scalar":Y="QUOTE_DOUBLE";break;case"block-scalar":{let G=$.props[0];if(G.type!=="block-scalar-header")throw Error("Invalid block scalar header");Y=G.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:Y="PLAIN"}let U=g9.stringifyString({type:Y,value:Z},{implicitKey:J||W===null,indent:W!==null&&W>0?" ".repeat(W):"",inFlow:Q,options:{blockQuote:!0,lineWidth:-1}});switch(U[0]){case"|":case">":tH($,U);break;case'"':M6($,U,"double-quoted-scalar");break;case"'":M6($,U,"single-quoted-scalar");break;default:M6($,U,"scalar")}}function tH($,Z){let X=Z.indexOf(`
135
+ `,K=[{type:"block-scalar-header",offset:Q,indent:z,source:q}];if(!d9(K,U))K.push({type:"newline",offset:-1,indent:z,source:`
136
+ `});return{type:"block-scalar",offset:Q,indent:z,props:K,source:V}}case'"':return{type:"double-quoted-scalar",offset:Q,indent:z,source:W,end:U};case"'":return{type:"single-quoted-scalar",offset:Q,indent:z,source:W,end:U};default:return{type:"scalar",offset:Q,indent:z,source:W,end:U}}}function JB($,Z,X={}){let{afterKey:z=!1,implicitKey:J=!1,inFlow:Q=!1,type:Y}=X,W="indent"in $?$.indent:null;if(z&&typeof W==="number")W+=2;if(!Y)switch($.type){case"single-quoted-scalar":Y="QUOTE_SINGLE";break;case"double-quoted-scalar":Y="QUOTE_DOUBLE";break;case"block-scalar":{let G=$.props[0];if(G.type!=="block-scalar-header")throw Error("Invalid block scalar header");Y=G.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:Y="PLAIN"}let U=c9.stringifyString({type:Y,value:Z},{implicitKey:J||W===null,indent:W!==null&&W>0?" ".repeat(W):"",inFlow:Q,options:{blockQuote:!0,lineWidth:-1}});switch(U[0]){case"|":case">":QB($,U);break;case'"':I6($,U,"double-quoted-scalar");break;case"'":I6($,U,"single-quoted-scalar");break;default:I6($,U,"scalar")}}function QB($,Z){let X=Z.indexOf(`
137
137
  `),z=Z.substring(0,X),J=Z.substring(X+1)+`
138
- `;if($.type==="block-scalar"){let Q=$.props[0];if(Q.type!=="block-scalar-header")throw Error("Invalid block scalar header");Q.source=z,$.source=J}else{let{offset:Q}=$,Y="indent"in $?$.indent:-1,W=[{type:"block-scalar-header",offset:Q,indent:Y,source:z}];if(!v9(W,"end"in $?$.end:void 0))W.push({type:"newline",offset:-1,indent:Y,source:`
139
- `});for(let U of Object.keys($))if(U!=="type"&&U!=="offset")delete $[U];Object.assign($,{type:"block-scalar",indent:Y,props:W,source:J})}}function v9($,Z){if(Z)for(let X of Z)switch(X.type){case"space":case"comment":$.push(X);break;case"newline":return $.push(X),!0}return!1}function M6($,Z,X){switch($.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":$.type=X,$.source=Z;break;case"block-scalar":{let z=$.props.slice(1),J=Z.length;if($.props[0].type==="block-scalar-header")J-=$.props[0].source.length;for(let Q of z)Q.offset+=J;delete $.props,Object.assign($,{type:X,source:Z,end:z});break}case"block-map":case"block-seq":{let J={type:"newline",offset:$.offset+Z.length,indent:$.indent,source:`
140
- `};delete $.items,Object.assign($,{type:X,source:Z,end:[J]});break}default:{let z="indent"in $?$.indent:-1,J="end"in $&&Array.isArray($.end)?$.end.filter((Q)=>Q.type==="space"||Q.type==="comment"||Q.type==="newline"):[];for(let Q of Object.keys($))if(Q!=="type"&&Q!=="offset")delete $[Q];Object.assign($,{type:X,indent:z,source:Z,end:J})}}}eH.createScalarToken=aH;eH.resolveAsScalar=sH;eH.setScalarValue=oH});var u9=F((JB)=>{var zB=($)=>("type"in $)?$4($):e3($);function $4($){switch($.type){case"block-scalar":{let Z="";for(let X of $.props)Z+=$4(X);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let X of $.items)Z+=e3(X);return Z}case"flow-collection":{let Z=$.start.source;for(let X of $.items)Z+=e3(X);for(let X of $.end)Z+=X.source;return Z}case"document":{let Z=e3($);if($.end)for(let X of $.end)Z+=X.source;return Z}default:{let Z=$.source;if("end"in $&&$.end)for(let X of $.end)Z+=X.source;return Z}}}function e3({start:$,key:Z,sep:X,value:z}){let J="";for(let Q of $)J+=Q.source;if(Z)J+=$4(Z);if(X)for(let Q of X)J+=Q.source;if(z)J+=$4(z);return J}JB.stringify=zB});var d9=F((WB)=>{var O6=Symbol("break visit"),YB=Symbol("skip children"),m9=Symbol("remove item");function b1($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};c9(Object.freeze([]),$,Z)}b1.BREAK=O6;b1.SKIP=YB;b1.REMOVE=m9;b1.itemAtPath=($,Z)=>{let X=$;for(let[z,J]of Z){let Q=X?.[z];if(Q&&"items"in Q)X=Q.items[J];else return}return X};b1.parentCollection=($,Z)=>{let X=b1.itemAtPath($,Z.slice(0,-1)),z=Z[Z.length-1][0],J=X?.[z];if(J&&"items"in J)return J;throw Error("Parent collection not found")};function c9($,Z,X){let z=X(Z,$);if(typeof z==="symbol")return z;for(let J of["key","value"]){let Q=Z[J];if(Q&&"items"in Q){for(let Y=0;Y<Q.items.length;++Y){let W=c9(Object.freeze($.concat([[J,Y]])),Q.items[Y],X);if(typeof W==="number")Y=W-1;else if(W===O6)return O6;else if(W===m9)Q.items.splice(Y,1),Y-=1}if(typeof z==="function"&&J==="key")z=z(Z,$)}}return typeof z==="function"?z(Z,$):z}WB.visit=b1});var Z4=F((LB)=>{var T6=h9(),GB=u9(),qB=d9(),D6="\uFEFF",I6="\x02",A6="\x18",R6="\x1F",VB=($)=>!!$&&("items"in $),KB=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function HB($){switch($){case D6:return"<BOM>";case I6:return"<DOC>";case A6:return"<FLOW_END>";case R6:return"<SCALAR>";default:return JSON.stringify($)}}function BB($){switch($){case D6:return"byte-order-mark";case I6:return"doc-mode";case A6:return"flow-error-end";case R6:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
138
+ `;if($.type==="block-scalar"){let Q=$.props[0];if(Q.type!=="block-scalar-header")throw Error("Invalid block scalar header");Q.source=z,$.source=J}else{let{offset:Q}=$,Y="indent"in $?$.indent:-1,W=[{type:"block-scalar-header",offset:Q,indent:Y,source:z}];if(!d9(W,"end"in $?$.end:void 0))W.push({type:"newline",offset:-1,indent:Y,source:`
139
+ `});for(let U of Object.keys($))if(U!=="type"&&U!=="offset")delete $[U];Object.assign($,{type:"block-scalar",indent:Y,props:W,source:J})}}function d9($,Z){if(Z)for(let X of Z)switch(X.type){case"space":case"comment":$.push(X);break;case"newline":return $.push(X),!0}return!1}function I6($,Z,X){switch($.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":$.type=X,$.source=Z;break;case"block-scalar":{let z=$.props.slice(1),J=Z.length;if($.props[0].type==="block-scalar-header")J-=$.props[0].source.length;for(let Q of z)Q.offset+=J;delete $.props,Object.assign($,{type:X,source:Z,end:z});break}case"block-map":case"block-seq":{let J={type:"newline",offset:$.offset+Z.length,indent:$.indent,source:`
140
+ `};delete $.items,Object.assign($,{type:X,source:Z,end:[J]});break}default:{let z="indent"in $?$.indent:-1,J="end"in $&&Array.isArray($.end)?$.end.filter((Q)=>Q.type==="space"||Q.type==="comment"||Q.type==="newline"):[];for(let Q of Object.keys($))if(Q!=="type"&&Q!=="offset")delete $[Q];Object.assign($,{type:X,indent:z,source:Z,end:J})}}}YB.createScalarToken=zB;YB.resolveAsScalar=XB;YB.setScalarValue=JB});var p9=_((VB)=>{var qB=($)=>("type"in $)?X3($):Z3($);function X3($){switch($.type){case"block-scalar":{let Z="";for(let X of $.props)Z+=X3(X);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let X of $.items)Z+=Z3(X);return Z}case"flow-collection":{let Z=$.start.source;for(let X of $.items)Z+=Z3(X);for(let X of $.end)Z+=X.source;return Z}case"document":{let Z=Z3($);if($.end)for(let X of $.end)Z+=X.source;return Z}default:{let Z=$.source;if("end"in $&&$.end)for(let X of $.end)Z+=X.source;return Z}}}function Z3({start:$,key:Z,sep:X,value:z}){let J="";for(let Q of $)J+=Q.source;if(Z)J+=X3(Z);if(X)for(let Q of X)J+=Q.source;if(z)J+=X3(z);return J}VB.stringify=qB});var r9=_((BB)=>{var A6=Symbol("break visit"),HB=Symbol("skip children"),i9=Symbol("remove item");function b1($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};n9(Object.freeze([]),$,Z)}b1.BREAK=A6;b1.SKIP=HB;b1.REMOVE=i9;b1.itemAtPath=($,Z)=>{let X=$;for(let[z,J]of Z){let Q=X?.[z];if(Q&&"items"in Q)X=Q.items[J];else return}return X};b1.parentCollection=($,Z)=>{let X=b1.itemAtPath($,Z.slice(0,-1)),z=Z[Z.length-1][0],J=X?.[z];if(J&&"items"in J)return J;throw Error("Parent collection not found")};function n9($,Z,X){let z=X(Z,$);if(typeof z==="symbol")return z;for(let J of["key","value"]){let Q=Z[J];if(Q&&"items"in Q){for(let Y=0;Y<Q.items.length;++Y){let W=n9(Object.freeze($.concat([[J,Y]])),Q.items[Y],X);if(typeof W==="number")Y=W-1;else if(W===A6)return A6;else if(W===i9)Q.items.splice(Y,1),Y-=1}if(typeof z==="function"&&J==="key")z=z(Z,$)}}return typeof z==="function"?z(Z,$):z}BB.visit=b1});var z3=_((AB)=>{var R6=l9(),MB=p9(),OB=r9(),_6="\uFEFF",F6="\x02",P6="\x18",C6="\x1F",NB=($)=>!!$&&("items"in $),TB=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function DB($){switch($){case _6:return"<BOM>";case F6:return"<DOC>";case P6:return"<FLOW_END>";case C6:return"<SCALAR>";default:return JSON.stringify($)}}function IB($){switch($){case _6:return"byte-order-mark";case F6:return"doc-mode";case P6:return"flow-error-end";case C6:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
141
141
  `:case`\r
142
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch($[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}LB.createScalarToken=T6.createScalarToken;LB.resolveAsScalar=T6.resolveAsScalar;LB.setScalarValue=T6.setScalarValue;LB.stringify=GB.stringify;LB.visit=qB.visit;LB.BOM=D6;LB.DOCUMENT=I6;LB.FLOW_END=A6;LB.SCALAR=R6;LB.isCollection=VB;LB.isScalar=KB;LB.prettyToken=HB;LB.tokenType=BB});var _6=F((SB)=>{var V2=Z4();function h0($){switch($){case void 0:case" ":case`
143
- `:case"\r":case"\t":return!0;default:return!1}}var l9=new Set("0123456789ABCDEFabcdef"),EB=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),X4=new Set(",[]{}"),jB=new Set(` ,[]{}
144
- \r `),F6=($)=>!$||jB.has($);class p9{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex($,Z=!1){if($){if(typeof $!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+$:$,this.lineEndPos=null}this.atEnd=!Z;let X=this.next??"stream";while(X&&(Z||this.hasChars(1)))X=yield*this.parseNext(X)}atLineEnd(){let $=this.pos,Z=this.buffer[$];while(Z===" "||Z==="\t")Z=this.buffer[++$];if(!Z||Z==="#"||Z===`
142
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch($[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}AB.createScalarToken=R6.createScalarToken;AB.resolveAsScalar=R6.resolveAsScalar;AB.setScalarValue=R6.setScalarValue;AB.stringify=MB.stringify;AB.visit=OB.visit;AB.BOM=_6;AB.DOCUMENT=F6;AB.FLOW_END=P6;AB.SCALAR=C6;AB.isCollection=NB;AB.isScalar=TB;AB.prettyToken=DB;AB.tokenType=IB});var E6=_((vB)=>{var K2=z3();function h0($){switch($){case void 0:case" ":case`
143
+ `:case"\r":case"\t":return!0;default:return!1}}var s9=new Set("0123456789ABCDEFabcdef"),fB=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),J3=new Set(",[]{}"),gB=new Set(` ,[]{}
144
+ \r `),w6=($)=>!$||gB.has($);class a9{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex($,Z=!1){if($){if(typeof $!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+$:$,this.lineEndPos=null}this.atEnd=!Z;let X=this.next??"stream";while(X&&(Z||this.hasChars(1)))X=yield*this.parseNext(X)}atLineEnd(){let $=this.pos,Z=this.buffer[$];while(Z===" "||Z==="\t")Z=this.buffer[++$];if(!Z||Z==="#"||Z===`
145
145
  `)return!0;if(Z==="\r")return this.buffer[$+1]===`
146
146
  `;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let Z=this.buffer[$];if(this.indentNext>0){let X=0;while(Z===" ")Z=this.buffer[++X+$];if(Z==="\r"){let z=this.buffer[X+$+1];if(z===`
147
147
  `||!z&&!this.atEnd)return $+X+1}return Z===`
148
148
  `||X>=this.indentNext||!Z&&!this.atEnd?$+X:-1}if(Z==="-"||Z==="."){let X=this.buffer.substr($,3);if((X==="---"||X==="...")&&h0(this.buffer[$+3]))return-1}return $}getLine(){let $=this.lineEndPos;if(typeof $!=="number"||$!==-1&&$<this.pos)$=this.buffer.indexOf(`
149
- `,this.pos),this.lineEndPos=$;if($===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[$-1]==="\r")$-=1;return this.buffer.substring(this.pos,$)}hasChars($){return this.pos+$<=this.buffer.length}setNext($){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=$,null}peek($){return this.buffer.substr(this.pos,$)}*parseNext($){switch($){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let $=this.getLine();if($===null)return this.setNext("stream");if($[0]===V2.BOM)yield*this.pushCount(1),$=$.substring(1);if($[0]==="%"){let Z=$.length,X=$.indexOf("#");while(X!==-1){let J=$[X-1];if(J===" "||J==="\t"){Z=X-1;break}else X=$.indexOf("#",X+1)}while(!0){let J=$[Z-1];if(J===" "||J==="\t")Z-=1;else break}let z=(yield*this.pushCount(Z))+(yield*this.pushSpaces(!0));return yield*this.pushCount($.length-z),this.pushNewline(),"stream"}if(this.atLineEnd()){let Z=yield*this.pushSpaces(!0);return yield*this.pushCount($.length-Z),yield*this.pushNewline(),"stream"}return yield V2.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let $=this.charAt(0);if(!$&&!this.atEnd)return this.setNext("line-start");if($==="-"||$==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let Z=this.peek(3);if((Z==="---"||Z==="...")&&h0(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,Z==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!h0(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[$,Z]=this.peek(2);if(!Z&&!this.atEnd)return this.setNext("block-start");if(($==="-"||$==="?"||$===":")&&h0(Z)){let X=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=X,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let $=this.getLine();if($===null)return this.setNext("doc");let Z=yield*this.pushIndicators();switch($[Z]){case"#":yield*this.pushCount($.length-Z);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(F6),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return Z+=yield*this.parseBlockScalarHeader(),Z+=yield*this.pushSpaces(!0),yield*this.pushCount($.length-Z),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let $,Z,X=-1;do{if($=yield*this.pushNewline(),$>0)Z=yield*this.pushSpaces(!1),this.indentValue=X=Z;else Z=0;Z+=yield*this.pushSpaces(!0)}while($+Z>0);let z=this.getLine();if(z===null)return this.setNext("flow");if(X!==-1&&X<this.indentNext&&z[0]!=="#"||X===0&&(z.startsWith("---")||z.startsWith("..."))&&h0(z[3])){if(!(X===this.indentNext-1&&this.flowLevel===1&&(z[0]==="]"||z[0]==="}")))return this.flowLevel=0,yield V2.FLOW_END,yield*this.parseLineStart()}let J=0;while(z[J]===",")J+=yield*this.pushCount(1),J+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(J+=yield*this.pushIndicators(),z[J]){case void 0:return"flow";case"#":return yield*this.pushCount(z.length-J),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(F6),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let Q=this.charAt(1);if(this.flowKey||h0(Q)||Q===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=this.charAt(0),Z=this.buffer.indexOf($,this.pos+1);if($==="'")while(Z!==-1&&this.buffer[Z+1]==="'")Z=this.buffer.indexOf("'",Z+2);else while(Z!==-1){let J=0;while(this.buffer[Z-1-J]==="\\")J+=1;if(J%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let X=this.buffer.substring(0,Z),z=X.indexOf(`
149
+ `,this.pos),this.lineEndPos=$;if($===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[$-1]==="\r")$-=1;return this.buffer.substring(this.pos,$)}hasChars($){return this.pos+$<=this.buffer.length}setNext($){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=$,null}peek($){return this.buffer.substr(this.pos,$)}*parseNext($){switch($){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let $=this.getLine();if($===null)return this.setNext("stream");if($[0]===K2.BOM)yield*this.pushCount(1),$=$.substring(1);if($[0]==="%"){let Z=$.length,X=$.indexOf("#");while(X!==-1){let J=$[X-1];if(J===" "||J==="\t"){Z=X-1;break}else X=$.indexOf("#",X+1)}while(!0){let J=$[Z-1];if(J===" "||J==="\t")Z-=1;else break}let z=(yield*this.pushCount(Z))+(yield*this.pushSpaces(!0));return yield*this.pushCount($.length-z),this.pushNewline(),"stream"}if(this.atLineEnd()){let Z=yield*this.pushSpaces(!0);return yield*this.pushCount($.length-Z),yield*this.pushNewline(),"stream"}return yield K2.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let $=this.charAt(0);if(!$&&!this.atEnd)return this.setNext("line-start");if($==="-"||$==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let Z=this.peek(3);if((Z==="---"||Z==="...")&&h0(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,Z==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!h0(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[$,Z]=this.peek(2);if(!Z&&!this.atEnd)return this.setNext("block-start");if(($==="-"||$==="?"||$===":")&&h0(Z)){let X=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=X,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let $=this.getLine();if($===null)return this.setNext("doc");let Z=yield*this.pushIndicators();switch($[Z]){case"#":yield*this.pushCount($.length-Z);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(w6),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return Z+=yield*this.parseBlockScalarHeader(),Z+=yield*this.pushSpaces(!0),yield*this.pushCount($.length-Z),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let $,Z,X=-1;do{if($=yield*this.pushNewline(),$>0)Z=yield*this.pushSpaces(!1),this.indentValue=X=Z;else Z=0;Z+=yield*this.pushSpaces(!0)}while($+Z>0);let z=this.getLine();if(z===null)return this.setNext("flow");if(X!==-1&&X<this.indentNext&&z[0]!=="#"||X===0&&(z.startsWith("---")||z.startsWith("..."))&&h0(z[3])){if(!(X===this.indentNext-1&&this.flowLevel===1&&(z[0]==="]"||z[0]==="}")))return this.flowLevel=0,yield K2.FLOW_END,yield*this.parseLineStart()}let J=0;while(z[J]===",")J+=yield*this.pushCount(1),J+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(J+=yield*this.pushIndicators(),z[J]){case void 0:return"flow";case"#":return yield*this.pushCount(z.length-J),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(w6),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let Q=this.charAt(1);if(this.flowKey||h0(Q)||Q===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=this.charAt(0),Z=this.buffer.indexOf($,this.pos+1);if($==="'")while(Z!==-1&&this.buffer[Z+1]==="'")Z=this.buffer.indexOf("'",Z+2);else while(Z!==-1){let J=0;while(this.buffer[Z-1-J]==="\\")J+=1;if(J%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let X=this.buffer.substring(0,Z),z=X.indexOf(`
150
150
  `,this.pos);if(z!==-1){while(z!==-1){let J=this.continueScalar(z+1);if(J===-1)break;z=X.indexOf(`
151
151
  `,J)}if(z!==-1)Z=z-(X[z-1]==="\r"?2:1)}if(Z===-1){if(!this.atEnd)return this.setNext("quoted-scalar");Z=this.buffer.length}return yield*this.pushToIndex(Z+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let $=this.pos;while(!0){let Z=this.buffer[++$];if(Z==="+")this.blockScalarKeep=!0;else if(Z>"0"&&Z<="9")this.blockScalarIndent=Number(Z)-1;else if(Z!=="-")break}return yield*this.pushUntil((Z)=>h0(Z)||Z==="#")}*parseBlockScalar(){let $=this.pos-1,Z=0,X;$:for(let J=this.pos;X=this.buffer[J];++J)switch(X){case" ":Z+=1;break;case`
152
152
  `:$=J,Z=0;break;case"\r":{let Q=this.buffer[J+1];if(!Q&&!this.atEnd)return this.setNext("block-scalar");if(Q===`
153
153
  `)break}default:break $}if(!X&&!this.atEnd)return this.setNext("block-scalar");if(Z>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=Z;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let J=this.continueScalar($+1);if(J===-1)break;$=this.buffer.indexOf(`
154
154
  `,J)}while($!==-1);if($===-1){if(!this.atEnd)return this.setNext("block-scalar");$=this.buffer.length}}let z=$+1;X=this.buffer[z];while(X===" ")X=this.buffer[++z];if(X==="\t"){while(X==="\t"||X===" "||X==="\r"||X===`
155
155
  `)X=this.buffer[++z];$=z-1}else if(!this.blockScalarKeep)do{let J=$-1,Q=this.buffer[J];if(Q==="\r")Q=this.buffer[--J];let Y=J;while(Q===" ")Q=this.buffer[--J];if(Q===`
156
- `&&J>=this.pos&&J+1+Z>Y)$=J;else break}while(!0);return yield V2.SCALAR,yield*this.pushToIndex($+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let $=this.flowLevel>0,Z=this.pos-1,X=this.pos-1,z;while(z=this.buffer[++X])if(z===":"){let J=this.buffer[X+1];if(h0(J)||$&&X4.has(J))break;Z=X}else if(h0(z)){let J=this.buffer[X+1];if(z==="\r")if(J===`
156
+ `&&J>=this.pos&&J+1+Z>Y)$=J;else break}while(!0);return yield K2.SCALAR,yield*this.pushToIndex($+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let $=this.flowLevel>0,Z=this.pos-1,X=this.pos-1,z;while(z=this.buffer[++X])if(z===":"){let J=this.buffer[X+1];if(h0(J)||$&&J3.has(J))break;Z=X}else if(h0(z)){let J=this.buffer[X+1];if(z==="\r")if(J===`
157
157
  `)X+=1,z=`
158
- `,J=this.buffer[X+1];else Z=X;if(J==="#"||$&&X4.has(J))break;if(z===`
159
- `){let Q=this.continueScalar(X+1);if(Q===-1)break;X=Math.max(X,Q-2)}}else{if($&&X4.has(z))break;Z=X}if(!z&&!this.atEnd)return this.setNext("plain-scalar");return yield V2.SCALAR,yield*this.pushToIndex(Z+1,!0),$?"flow":"doc"}*pushCount($){if($>0)return yield this.buffer.substr(this.pos,$),this.pos+=$,$;return 0}*pushToIndex($,Z){let X=this.buffer.slice(this.pos,$);if(X)return yield X,this.pos+=X.length,X.length;else if(Z)yield"";return 0}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(F6))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let $=this.flowLevel>0,Z=this.charAt(1);if(h0(Z)||$&&X4.has(Z)){if(!$)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;return(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}}return 0}*pushTag(){if(this.charAt(1)==="<"){let $=this.pos+2,Z=this.buffer[$];while(!h0(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(EB.has(Z))Z=this.buffer[++$];else if(Z==="%"&&l9.has(this.buffer[$+1])&&l9.has(this.buffer[$+2]))Z=this.buffer[$+=3];else break;return yield*this.pushToIndex($,!1)}}*pushNewline(){let $=this.buffer[this.pos];if($===`
158
+ `,J=this.buffer[X+1];else Z=X;if(J==="#"||$&&J3.has(J))break;if(z===`
159
+ `){let Q=this.continueScalar(X+1);if(Q===-1)break;X=Math.max(X,Q-2)}}else{if($&&J3.has(z))break;Z=X}if(!z&&!this.atEnd)return this.setNext("plain-scalar");return yield K2.SCALAR,yield*this.pushToIndex(Z+1,!0),$?"flow":"doc"}*pushCount($){if($>0)return yield this.buffer.substr(this.pos,$),this.pos+=$,$;return 0}*pushToIndex($,Z){let X=this.buffer.slice(this.pos,$);if(X)return yield X,this.pos+=X.length,X.length;else if(Z)yield"";return 0}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(w6))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let $=this.flowLevel>0,Z=this.charAt(1);if(h0(Z)||$&&J3.has(Z)){if(!$)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;return(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}}return 0}*pushTag(){if(this.charAt(1)==="<"){let $=this.pos+2,Z=this.buffer[$];while(!h0(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(fB.has(Z))Z=this.buffer[++$];else if(Z==="%"&&s9.has(this.buffer[$+1])&&s9.has(this.buffer[$+2]))Z=this.buffer[$+=3];else break;return yield*this.pushToIndex($,!1)}}*pushNewline(){let $=this.buffer[this.pos];if($===`
160
160
  `)return yield*this.pushCount(1);else if($==="\r"&&this.charAt(1)===`
161
- `)return yield*this.pushCount(2);else return 0}*pushSpaces($){let Z=this.pos-1,X;do X=this.buffer[++Z];while(X===" "||$&&X==="\t");let z=Z-this.pos;if(z>0)yield this.buffer.substr(this.pos,z),this.pos=Z;return z}*pushUntil($){let Z=this.pos,X=this.buffer[Z];while(!$(X))X=this.buffer[++Z];return yield*this.pushToIndex(Z,!1)}}SB.Lexer=p9});var P6=F((bB)=>{class i9{constructor(){this.lineStarts=[],this.addNewLine=($)=>this.lineStarts.push($),this.linePos=($)=>{let Z=0,X=this.lineStarts.length;while(Z<X){let J=Z+X>>1;if(this.lineStarts[J]<$)Z=J+1;else X=J}if(this.lineStarts[Z]===$)return{line:Z+1,col:1};if(Z===0)return{line:0,col:$};let z=this.lineStarts[Z-1];return{line:Z,col:$-z+1}}}}bB.LineCounter=i9});var w6=F((gB)=>{var yB=A0("process"),n9=Z4(),fB=_6();function H1($,Z){for(let X=0;X<$.length;++X)if($[X].type===Z)return!0;return!1}function r9($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function a9($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function z4($){switch($.type){case"document":return $.start;case"block-map":{let Z=$.items[$.items.length-1];return Z.sep??Z.start}case"block-seq":return $.items[$.items.length-1].start;default:return[]}}function z$($){if($.length===0)return[];let Z=$.length;$:while(--Z>=0)switch($[Z].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break $}while($[++Z]?.type==="space");return $.splice(Z,$.length)}function s9($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!H1(Z.start,"explicit-key-ind")&&!H1(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,a9(Z.value))if(Z.value.end)Array.prototype.push.apply(Z.value.end,Z.sep);else Z.value.end=Z.sep;else Array.prototype.push.apply(Z.start,Z.sep);delete Z.sep}}}class o9{constructor($){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new fB.Lexer,this.onNewLine=$}*parse($,Z=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let X of this.lexer.lex($,Z))yield*this.next(X);if(!Z)yield*this.end()}*next($){if(this.source=$,yB.env.LOG_TOKENS)console.log("|",n9.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=n9.tokenType($);if(!Z){let X=`Not a YAML token: ${$}`;yield*this.pop({type:"error",offset:this.offset,message:X,source:$}),this.offset+=$.length}else if(Z==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=Z,yield*this.step(),Z){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+$.length);break;case"space":if(this.atNewLine&&$[0]===" ")this.indent+=$.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=$.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=$.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let $=this.peek(1);if(this.type==="doc-end"&&$?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!$)return yield*this.stream();switch($.type){case"document":return yield*this.document($);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar($);case"block-scalar":return yield*this.blockScalar($);case"block-map":return yield*this.blockMap($);case"block-seq":return yield*this.blockSequence($);case"flow-collection":return yield*this.flowCollection($);case"doc-end":return yield*this.documentEnd($)}yield*this.pop()}peek($){return this.stack[this.stack.length-$]}*pop($){let Z=$??this.stack.pop();if(!Z)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield Z;else{let X=this.peek(1);if(Z.type==="block-scalar")Z.indent="indent"in X?X.indent:0;else if(Z.type==="flow-collection"&&X.type==="document")Z.indent=0;if(Z.type==="flow-collection")s9(Z);switch(X.type){case"document":X.value=Z;break;case"block-scalar":X.props.push(Z);break;case"block-map":{let z=X.items[X.items.length-1];if(z.value){X.items.push({start:[],key:Z,sep:[]}),this.onKeyLine=!0;return}else if(z.sep)z.value=Z;else{Object.assign(z,{key:Z,sep:[]}),this.onKeyLine=!z.explicitKey;return}break}case"block-seq":{let z=X.items[X.items.length-1];if(z.value)X.items.push({start:[],value:Z});else z.value=Z;break}case"flow-collection":{let z=X.items[X.items.length-1];if(!z||z.value)X.items.push({start:[],key:Z,sep:[]});else if(z.sep)z.value=Z;else Object.assign(z,{key:Z,sep:[]});return}default:yield*this.pop(),yield*this.pop(Z)}if((X.type==="document"||X.type==="block-map"||X.type==="block-seq")&&(Z.type==="block-map"||Z.type==="block-seq")){let z=Z.items[Z.items.length-1];if(z&&!z.sep&&!z.value&&z.start.length>0&&r9(z.start)===-1&&(Z.indent===0||z.start.every((J)=>J.type!=="comment"||J.indent<Z.indent))){if(X.type==="document")X.end=z.start;else X.items.push({start:z.start});Z.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let $={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")$.start.push(this.sourceToken);this.stack.push($);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document($){if($.value)return yield*this.lineEnd($);switch(this.type){case"doc-start":{if(r9($.start)!==-1)yield*this.pop(),yield*this.step();else $.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":$.start.push(this.sourceToken);return}let Z=this.startBlockValue($);if(Z)this.stack.push(Z);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar($){if(this.type==="map-value-ind"){let Z=z4(this.peek(2)),X=z$(Z),z;if($.end)z=$.end,z.push(this.sourceToken),delete $.end;else z=[this.sourceToken];let J={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:X,key:$,sep:z}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=J}else yield*this.lineEnd($)}*blockScalar($){switch(this.type){case"space":case"comment":case"newline":$.props.push(this.sourceToken);return;case"scalar":if($.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let Z=this.source.indexOf(`
161
+ `)return yield*this.pushCount(2);else return 0}*pushSpaces($){let Z=this.pos-1,X;do X=this.buffer[++Z];while(X===" "||$&&X==="\t");let z=Z-this.pos;if(z>0)yield this.buffer.substr(this.pos,z),this.pos=Z;return z}*pushUntil($){let Z=this.pos,X=this.buffer[Z];while(!$(X))X=this.buffer[++Z];return yield*this.pushToIndex(Z,!1)}}vB.Lexer=a9});var S6=_((uB)=>{class o9{constructor(){this.lineStarts=[],this.addNewLine=($)=>this.lineStarts.push($),this.linePos=($)=>{let Z=0,X=this.lineStarts.length;while(Z<X){let J=Z+X>>1;if(this.lineStarts[J]<$)Z=J+1;else X=J}if(this.lineStarts[Z]===$)return{line:Z+1,col:1};if(Z===0)return{line:0,col:$};let z=this.lineStarts[Z-1];return{line:Z,col:$-z+1}}}}uB.LineCounter=o9});var j6=_((lB)=>{var cB=A0("process"),t9=z3(),dB=E6();function H1($,Z){for(let X=0;X<$.length;++X)if($[X].type===Z)return!0;return!1}function e9($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function ZX($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Q3($){switch($.type){case"document":return $.start;case"block-map":{let Z=$.items[$.items.length-1];return Z.sep??Z.start}case"block-seq":return $.items[$.items.length-1].start;default:return[]}}function J$($){if($.length===0)return[];let Z=$.length;$:while(--Z>=0)switch($[Z].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break $}while($[++Z]?.type==="space");return $.splice(Z,$.length)}function $X($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!H1(Z.start,"explicit-key-ind")&&!H1(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,ZX(Z.value))if(Z.value.end)Array.prototype.push.apply(Z.value.end,Z.sep);else Z.value.end=Z.sep;else Array.prototype.push.apply(Z.start,Z.sep);delete Z.sep}}}class XX{constructor($){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new dB.Lexer,this.onNewLine=$}*parse($,Z=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let X of this.lexer.lex($,Z))yield*this.next(X);if(!Z)yield*this.end()}*next($){if(this.source=$,cB.env.LOG_TOKENS)console.log("|",t9.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=t9.tokenType($);if(!Z){let X=`Not a YAML token: ${$}`;yield*this.pop({type:"error",offset:this.offset,message:X,source:$}),this.offset+=$.length}else if(Z==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=Z,yield*this.step(),Z){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+$.length);break;case"space":if(this.atNewLine&&$[0]===" ")this.indent+=$.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=$.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=$.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let $=this.peek(1);if(this.type==="doc-end"&&$?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!$)return yield*this.stream();switch($.type){case"document":return yield*this.document($);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar($);case"block-scalar":return yield*this.blockScalar($);case"block-map":return yield*this.blockMap($);case"block-seq":return yield*this.blockSequence($);case"flow-collection":return yield*this.flowCollection($);case"doc-end":return yield*this.documentEnd($)}yield*this.pop()}peek($){return this.stack[this.stack.length-$]}*pop($){let Z=$??this.stack.pop();if(!Z)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield Z;else{let X=this.peek(1);if(Z.type==="block-scalar")Z.indent="indent"in X?X.indent:0;else if(Z.type==="flow-collection"&&X.type==="document")Z.indent=0;if(Z.type==="flow-collection")$X(Z);switch(X.type){case"document":X.value=Z;break;case"block-scalar":X.props.push(Z);break;case"block-map":{let z=X.items[X.items.length-1];if(z.value){X.items.push({start:[],key:Z,sep:[]}),this.onKeyLine=!0;return}else if(z.sep)z.value=Z;else{Object.assign(z,{key:Z,sep:[]}),this.onKeyLine=!z.explicitKey;return}break}case"block-seq":{let z=X.items[X.items.length-1];if(z.value)X.items.push({start:[],value:Z});else z.value=Z;break}case"flow-collection":{let z=X.items[X.items.length-1];if(!z||z.value)X.items.push({start:[],key:Z,sep:[]});else if(z.sep)z.value=Z;else Object.assign(z,{key:Z,sep:[]});return}default:yield*this.pop(),yield*this.pop(Z)}if((X.type==="document"||X.type==="block-map"||X.type==="block-seq")&&(Z.type==="block-map"||Z.type==="block-seq")){let z=Z.items[Z.items.length-1];if(z&&!z.sep&&!z.value&&z.start.length>0&&e9(z.start)===-1&&(Z.indent===0||z.start.every((J)=>J.type!=="comment"||J.indent<Z.indent))){if(X.type==="document")X.end=z.start;else X.items.push({start:z.start});Z.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let $={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")$.start.push(this.sourceToken);this.stack.push($);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document($){if($.value)return yield*this.lineEnd($);switch(this.type){case"doc-start":{if(e9($.start)!==-1)yield*this.pop(),yield*this.step();else $.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":$.start.push(this.sourceToken);return}let Z=this.startBlockValue($);if(Z)this.stack.push(Z);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar($){if(this.type==="map-value-ind"){let Z=Q3(this.peek(2)),X=J$(Z),z;if($.end)z=$.end,z.push(this.sourceToken),delete $.end;else z=[this.sourceToken];let J={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:X,key:$,sep:z}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=J}else yield*this.lineEnd($)}*blockScalar($){switch(this.type){case"space":case"comment":case"newline":$.props.push(this.sourceToken);return;case"scalar":if($.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let Z=this.source.indexOf(`
162
162
  `)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
163
- `,Z)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,Z.value){let X="end"in Z.value?Z.value.end:void 0;if((Array.isArray(X)?X[X.length-1]:void 0)?.type==="comment")X?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else{if(this.atIndentedComment(Z.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){Array.prototype.push.apply(z,Z.start),z.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let X=!this.onKeyLine&&this.indent===$.indent,z=X&&(Z.sep||Z.explicitKey)&&this.type!=="seq-item-ind",J=[];if(z&&Z.sep&&!Z.value){let Q=[];for(let Y=0;Y<Z.sep.length;++Y){let W=Z.sep[Y];switch(W.type){case"newline":Q.push(Y);break;case"space":break;case"comment":if(W.indent>$.indent)Q.length=0;break;default:Q.length=0}}if(Q.length>=2)J=Z.sep.splice(Q[1])}switch(this.type){case"anchor":case"tag":if(z||Z.value)J.push(this.sourceToken),$.items.push({start:J}),this.onKeyLine=!0;else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"explicit-key-ind":if(!Z.sep&&!Z.explicitKey)Z.start.push(this.sourceToken),Z.explicitKey=!0;else if(z||Z.value)J.push(this.sourceToken),$.items.push({start:J,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(Z.explicitKey)if(!Z.sep)if(H1(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let Q=z$(Z.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:null,sep:[this.sourceToken]}]})}else if(Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(H1(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]});else if(a9(Z.key)&&!H1(Z.sep,"newline")){let Q=z$(Z.start),Y=Z.key,W=Z.sep;W.push(this.sourceToken),delete Z.key,delete Z.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:Y,sep:W}]})}else if(J.length>0)Z.sep=Z.sep.concat(J,this.sourceToken);else Z.sep.push(this.sourceToken);else if(!Z.sep)Object.assign(Z,{key:null,sep:[this.sourceToken]});else if(Z.value||z)$.items.push({start:J,key:null,sep:[this.sourceToken]});else if(H1(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else Z.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let Q=this.flowScalar(this.type);if(z||Z.value)$.items.push({start:J,key:Q,sep:[]}),this.onKeyLine=!0;else if(Z.sep)this.stack.push(Q);else Object.assign(Z,{key:Q,sep:[]}),this.onKeyLine=!0;return}default:{let Q=this.startBlockValue($);if(Q){if(Q.type==="block-seq"){if(!Z.explicitKey&&Z.sep&&!H1(Z.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(X)$.items.push({start:J});this.stack.push(Q);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(Z.value){let X="end"in Z.value?Z.value.end:void 0;if((Array.isArray(X)?X[X.length-1]:void 0)?.type==="comment")X?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(Z.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){Array.prototype.push.apply(z,Z.start),z.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return;case"anchor":case"tag":if(Z.value||this.indent<=$.indent)break;Z.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(Z.value||H1(Z.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return}if(this.indent>$.indent){let X=this.startBlockValue($);if(X){this.stack.push(X);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let Z=$.items[$.items.length-1];if(this.type==="flow-error-end"){let X;do yield*this.pop(),X=this.peek(1);while(X?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!Z||Z.sep)$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return;case"map-value-ind":if(!Z||Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Object.assign(Z,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!Z||Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let z=this.flowScalar(this.type);if(!Z||Z.value)$.items.push({start:[],key:z,sep:[]});else if(Z.sep)this.stack.push(z);else Object.assign(Z,{key:z,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let X=this.startBlockValue($);if(X)this.stack.push(X);else yield*this.pop(),yield*this.step()}else{let X=this.peek(2);if(X.type==="block-map"&&(this.type==="map-value-ind"&&X.indent===$.indent||this.type==="newline"&&!X.items[X.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&X.type!=="flow-collection"){let z=z4(X),J=z$(z);s9($);let Q=$.end.splice(1,$.end.length);Q.push(this.sourceToken);let Y={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:J,key:$,sep:Q}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=Y}else yield*this.lineEnd($)}}flowScalar($){if(this.onNewLine){let Z=this.source.indexOf(`
163
+ `,Z)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,Z.value){let X="end"in Z.value?Z.value.end:void 0;if((Array.isArray(X)?X[X.length-1]:void 0)?.type==="comment")X?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else{if(this.atIndentedComment(Z.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){Array.prototype.push.apply(z,Z.start),z.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let X=!this.onKeyLine&&this.indent===$.indent,z=X&&(Z.sep||Z.explicitKey)&&this.type!=="seq-item-ind",J=[];if(z&&Z.sep&&!Z.value){let Q=[];for(let Y=0;Y<Z.sep.length;++Y){let W=Z.sep[Y];switch(W.type){case"newline":Q.push(Y);break;case"space":break;case"comment":if(W.indent>$.indent)Q.length=0;break;default:Q.length=0}}if(Q.length>=2)J=Z.sep.splice(Q[1])}switch(this.type){case"anchor":case"tag":if(z||Z.value)J.push(this.sourceToken),$.items.push({start:J}),this.onKeyLine=!0;else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"explicit-key-ind":if(!Z.sep&&!Z.explicitKey)Z.start.push(this.sourceToken),Z.explicitKey=!0;else if(z||Z.value)J.push(this.sourceToken),$.items.push({start:J,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(Z.explicitKey)if(!Z.sep)if(H1(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let Q=J$(Z.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:null,sep:[this.sourceToken]}]})}else if(Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(H1(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]});else if(ZX(Z.key)&&!H1(Z.sep,"newline")){let Q=J$(Z.start),Y=Z.key,W=Z.sep;W.push(this.sourceToken),delete Z.key,delete Z.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:Y,sep:W}]})}else if(J.length>0)Z.sep=Z.sep.concat(J,this.sourceToken);else Z.sep.push(this.sourceToken);else if(!Z.sep)Object.assign(Z,{key:null,sep:[this.sourceToken]});else if(Z.value||z)$.items.push({start:J,key:null,sep:[this.sourceToken]});else if(H1(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else Z.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let Q=this.flowScalar(this.type);if(z||Z.value)$.items.push({start:J,key:Q,sep:[]}),this.onKeyLine=!0;else if(Z.sep)this.stack.push(Q);else Object.assign(Z,{key:Q,sep:[]}),this.onKeyLine=!0;return}default:{let Q=this.startBlockValue($);if(Q){if(Q.type==="block-seq"){if(!Z.explicitKey&&Z.sep&&!H1(Z.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(X)$.items.push({start:J});this.stack.push(Q);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(Z.value){let X="end"in Z.value?Z.value.end:void 0;if((Array.isArray(X)?X[X.length-1]:void 0)?.type==="comment")X?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(Z.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){Array.prototype.push.apply(z,Z.start),z.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return;case"anchor":case"tag":if(Z.value||this.indent<=$.indent)break;Z.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(Z.value||H1(Z.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return}if(this.indent>$.indent){let X=this.startBlockValue($);if(X){this.stack.push(X);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let Z=$.items[$.items.length-1];if(this.type==="flow-error-end"){let X;do yield*this.pop(),X=this.peek(1);while(X?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!Z||Z.sep)$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return;case"map-value-ind":if(!Z||Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Object.assign(Z,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!Z||Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let z=this.flowScalar(this.type);if(!Z||Z.value)$.items.push({start:[],key:z,sep:[]});else if(Z.sep)this.stack.push(z);else Object.assign(Z,{key:z,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let X=this.startBlockValue($);if(X)this.stack.push(X);else yield*this.pop(),yield*this.step()}else{let X=this.peek(2);if(X.type==="block-map"&&(this.type==="map-value-ind"&&X.indent===$.indent||this.type==="newline"&&!X.items[X.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&X.type!=="flow-collection"){let z=Q3(X),J=J$(z);$X($);let Q=$.end.splice(1,$.end.length);Q.push(this.sourceToken);let Y={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:J,key:$,sep:Q}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=Y}else yield*this.lineEnd($)}}flowScalar($){if(this.onNewLine){let Z=this.source.indexOf(`
164
164
  `)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
165
- `,Z)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Z=z4($),X=z$(Z);return X.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Z=z4($),X=z$(Z);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Z){if(this.type!=="comment")return!1;if(this.indent<=Z)return!1;return $.every((X)=>X.type==="newline"||X.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}gB.Parser=o9});var XX=F((iB)=>{var t9=N6(),hB=Y2(),K2=W2(),uB=P8(),mB=p(),cB=P6(),e9=w6();function $X($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new cB.LineCounter||null,prettyErrors:Z}}function dB($,Z={}){let{lineCounter:X,prettyErrors:z}=$X(Z),J=new e9.Parser(X?.addNewLine),Q=new t9.Composer(Z),Y=Array.from(Q.compose(J.parse($)));if(z&&X)for(let W of Y)W.errors.forEach(K2.prettifyError($,X)),W.warnings.forEach(K2.prettifyError($,X));if(Y.length>0)return Y;return Object.assign([],{empty:!0},Q.streamInfo())}function ZX($,Z={}){let{lineCounter:X,prettyErrors:z}=$X(Z),J=new e9.Parser(X?.addNewLine),Q=new t9.Composer(Z),Y=null;for(let W of Q.compose(J.parse($),!0,$.length))if(!Y)Y=W;else if(Y.options.logLevel!=="silent"){Y.errors.push(new K2.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&X)Y.errors.forEach(K2.prettifyError($,X)),Y.warnings.forEach(K2.prettifyError($,X));return Y}function lB($,Z,X){let z=void 0;if(typeof Z==="function")z=Z;else if(X===void 0&&Z&&typeof Z==="object")X=Z;let J=ZX($,X);if(!J)return null;if(J.warnings.forEach((Q)=>uB.warn(J.options.logLevel,Q)),J.errors.length>0)if(J.options.logLevel!=="silent")throw J.errors[0];else J.errors=[];return J.toJS(Object.assign({reviver:z},X))}function pB($,Z,X){let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(X===void 0&&Z)X=Z;if(typeof X==="string")X=X.length;if(typeof X==="number"){let J=Math.round(X);X=J<1?void 0:J>8?{indent:8}:{indent:J}}if($===void 0){let{keepUndefined:J}=X??Z??{};if(!J)return}if(mB.isDocument($)&&!z)return $.toString(X);return new hB.Document($,z,X).toString(X)}iB.parse=lB;iB.parseAllDocuments=dB;iB.parseDocument=ZX;iB.stringify=pB});var GX={};S5(GX,{orange:()=>V0,italic:()=>gL,fafCyanDeep:()=>Q4,fafCyan:()=>D,dim:()=>H,bold:()=>I,FAF_HEX:()=>B2});var j6=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,I,H,gL,B2,D=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,Q4=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,V0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var d=g(()=>{I=j6("1"),H=j6("2"),gL=j6("3"),B2={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var ZZ=F((NC,NT)=>{NT.exports={name:"faf-cli",version:"7.3.0",description:"Persistent AI context + memory — .faf and .fafm, IANA-registered. Anthropic-merged.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",types:"./dist/index.d.ts",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",clean:"rm -rf dist",build:"bun run clean && bun build src/cli.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/index.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && tsc -p tsconfig.build.json",compile:"bun build src/cli.ts --compile --bytecode --minify --outfile faf","compile:all":"bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-arm64 --outfile faf-darwin-arm64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-x64 --outfile faf-darwin-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-linux-x64 --outfile faf-linux-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-windows-x64 --outfile faf-windows-x64.exe",test:"bun test --timeout=120000","test:watch":"bun test --watch --timeout=120000",lint:"eslint src/**/*.ts",format:"prettier --write 'src/**/*.ts'","check:no-hardcode":"! grep -rEln '/(Users|home/runner|private/var)/' dist/ || (echo '❌ Hardcoded build-machine path leaked into dist — see grep output above. Externalize the offending dep in the build script.'; exit 1)",prepublishOnly:"bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","bi-sync","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational","agents-md","context-engineering","codex","windsurf","fafm","ai-memory","agents"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.1","faf-scoring-kernel":"^2.0.3",open:"^11.0.0",yaml:"^2.4.1"},optionalDependencies:{"@anthropic-ai/sdk":"^0.91.1"},devDependencies:{"@faf/specification":"github:Wolfe-Jam/faf","@types/bun":"^1.3.14","@types/node":"^22.15.0","@typescript-eslint/eslint-plugin":"^8.41.0","@typescript-eslint/parser":"^8.41.0",ajv:"^8.17.1",eslint:"^9.39.2",prettier:"^3.2.5",typescript:"^5.3.3","typescript-eslint":"^8.59.1"},engines:{node:">=18.0.0"},publishConfig:{access:"public"}}});function _($,Z,X,z,J){if(z==="m")throw TypeError("Private method is not writable");if(z==="a"&&!J)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!J:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return z==="a"?J.call($,X):J?J.value=X:Z.set($,X),X}function N($,Z,X,z){if(X==="a"&&!z)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!z:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return X==="m"?z:X==="a"?z.call($):z?z.value:Z.get($)}var $1=()=>{};var JZ=function(){let{crypto:$}=globalThis;if($?.randomUUID)return JZ=$.randomUUID.bind($),$.randomUUID();let Z=new Uint8Array(1),X=$?()=>$.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(z)=>(+z^X()&15>>+z/4).toString(16))};function Z1($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var F2=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var S,Q0,B0,O1,O$,T$,D$,I$,A$,R$,F$,_$,P$;var T0=g(()=>{S=class S extends Error{};Q0=class Q0 extends S{constructor($,Z,X,z,J){super(`${Q0.makeMessage($,Z,X)}`);this.status=$,this.headers=z,this.requestID=z?.get("request-id"),this.error=Z,this.type=J??null}static makeMessage($,Z,X){let z=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):X;if($&&z)return`${$} ${z}`;if($)return`${$} status code (no body)`;if(z)return z;return"(no status code or body)"}static generate($,Z,X,z){if(!$||!z)return new O1({message:X,cause:F2(Z)});let J=Z,Q=J?.error?.type;if($===400)return new T$($,J,X,z,Q);if($===401)return new D$($,J,X,z,Q);if($===403)return new I$($,J,X,z,Q);if($===404)return new A$($,J,X,z,Q);if($===409)return new R$($,J,X,z,Q);if($===422)return new F$($,J,X,z,Q);if($===429)return new _$($,J,X,z,Q);if($>=500)return new P$($,J,X,z,Q);return new Q0($,J,X,z,Q)}};B0=class B0 extends Q0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};O1=class O1 extends Q0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};O$=class O$ extends O1{constructor({message:$}={}){super({message:$??"Request timed out."})}};T$=class T$ extends Q0{};D$=class D$ extends Q0{};I$=class I$ extends Q0{};A$=class A$ extends Q0{};R$=class R$ extends Q0{};F$=class F$ extends Q0{};_$=class _$ extends Q0{};P$=class P$ extends Q0{}});function b4($){if(typeof $!=="object")return{};return $??{}}function WZ($){if(!$)return!0;for(let Z in $)return!1;return!0}function NJ($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var sT,LJ=($)=>{return sT.test($)},QZ=($)=>(QZ=Array.isArray,QZ($)),YZ,MJ=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new S(`${$} must be an integer`);if(Z<0)throw new S(`${$} must be a positive integer`);return Z},k4=($)=>{try{return JSON.parse($)}catch(Z){return}};var v1=g(()=>{T0();sT=/^[a-z][a-z0-9+.-]*:/i,YZ=QZ});var OJ=($)=>new Promise((Z)=>setTimeout(Z,$));var T1="0.91.1";function aT(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}function tT(){if(typeof navigator>"u"||!navigator)return null;let $=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:Z,pattern:X}of $){let z=X.exec(navigator.userAgent);if(z){let J=z[1]||0,Q=z[2]||0,Y=z[3]||0;return{browser:Z,version:`${J}.${Q}.${Y}`}}}return null}var AJ=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},oT=()=>{let $=aT();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":T1,"X-Stainless-OS":DJ(Deno.build.os),"X-Stainless-Arch":TJ(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":T1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if($==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":T1,"X-Stainless-OS":DJ(globalThis.process.platform??"unknown"),"X-Stainless-Arch":TJ(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=tT();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":T1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Z.browser}`,"X-Stainless-Runtime-Version":Z.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":T1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},TJ=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},DJ=($)=>{if($=$.toLowerCase(),$.includes("ios"))return"iOS";if($==="android")return"Android";if($==="darwin")return"MacOS";if($==="win32")return"Windows";if($==="freebsd")return"FreeBSD";if($==="openbsd")return"OpenBSD";if($==="linux")return"Linux";if($)return`Other:${$}`;return"Unknown"},IJ,RJ=()=>{return IJ??(IJ=oT())};var UZ=()=>{};function FJ(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function GZ(...$){let Z=globalThis.ReadableStream;if(typeof Z>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new Z(...$)}function y4($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return GZ({start(){},async pull(X){let{done:z,value:J}=await Z.next();if(z)X.close();else X.enqueue(J)},async cancel(){await Z.return?.()}})}function _2($){if($[Symbol.asyncIterator])return $;let Z=$.getReader();return{async next(){try{let X=await Z.read();if(X?.done)Z.releaseLock();return X}catch(X){throw Z.releaseLock(),X}},async return(){let X=Z.cancel();return Z.releaseLock(),await X,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function _J($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),X=Z.cancel();Z.releaseLock(),await X}var PJ=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function wJ($){return Object.entries($).filter(([Z,X])=>typeof X<"u").map(([Z,X])=>{if(typeof X==="string"||typeof X==="number"||typeof X==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent(X)}`;if(X===null)return`${encodeURIComponent(Z)}=`;throw new S(`Cannot stringify type ${typeof X}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}var CJ=g(()=>{T0()});function SJ($){let Z=0;for(let J of $)Z+=J.length;let X=new Uint8Array(Z),z=0;for(let J of $)X.set(J,z),z+=J.length;return X}function P2($){let Z;return(EJ??(Z=new globalThis.TextEncoder,EJ=Z.encode.bind(Z)))($)}function qZ($){let Z;return(jJ??(Z=new globalThis.TextDecoder,jJ=Z.decode.bind(Z)))($)}var EJ,jJ;class D1{constructor(){w0.set(this,void 0),C0.set(this,void 0),_(this,w0,new Uint8Array,"f"),_(this,C0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?P2($):$;_(this,w0,SJ([N(this,w0,"f"),Z]),"f");let X=[],z;while((z=ZD(N(this,w0,"f"),N(this,C0,"f")))!=null){if(z.carriage&&N(this,C0,"f")==null){_(this,C0,z.index,"f");continue}if(N(this,C0,"f")!=null&&(z.index!==N(this,C0,"f")+1||z.carriage)){X.push(qZ(N(this,w0,"f").subarray(0,N(this,C0,"f")-1))),_(this,w0,N(this,w0,"f").subarray(N(this,C0,"f")),"f"),_(this,C0,null,"f");continue}let J=N(this,C0,"f")!==null?z.preceding-1:z.preceding,Q=qZ(N(this,w0,"f").subarray(0,J));X.push(Q),_(this,w0,N(this,w0,"f").subarray(z.index),"f"),_(this,C0,null,"f")}return X}flush(){if(!N(this,w0,"f").length)return[];return this.decode(`
166
- `)}}function ZD($,Z){for(let J=Z??0;J<$.length;J++){if($[J]===10)return{preceding:J,index:J+1,carriage:!1};if($[J]===13)return{preceding:J,index:J+1,carriage:!0}}return null}function xJ($){for(let z=0;z<$.length-1;z++){if($[z]===10&&$[z+1]===10)return z+2;if($[z]===13&&$[z+1]===13)return z+2;if($[z]===13&&$[z+1]===10&&z+3<$.length&&$[z+2]===13&&$[z+3]===10)return z+4}return-1}var w0,C0;var VZ=g(()=>{$1();w0=new WeakMap,C0=new WeakMap;D1.NEWLINE_CHARS=new Set([`
167
- `,"\r"]);D1.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function w2(){}function f4($,Z,X){if(!Z||g4[$]>g4[X])return w2;else return Z[$].bind(Z)}function H0($){let Z=$.logger,X=$.logLevel??"off";if(!Z)return XD;let z=bJ.get(Z);if(z&&z[0]===X)return z[1];let J={error:f4("error",Z,X),warn:f4("warn",Z,X),info:f4("info",Z,X),debug:f4("debug",Z,X)};return bJ.set(Z,[X,J]),J}var g4,KZ=($,Z,X)=>{if(!$)return;if(NJ(g4,$))return $;H0(X).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(g4))}`);return},XD,bJ,X1=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([Z,X])=>[Z,Z.toLowerCase()==="x-api-key"||Z.toLowerCase()==="authorization"||Z.toLowerCase()==="cookie"||Z.toLowerCase()==="set-cookie"?"***":X]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var v4=g(()=>{v1();g4={off:0,error:200,warn:300,info:400,debug:500};XD={error:w2,warn:w2,info:w2,debug:w2},bJ=new WeakMap});async function*zD($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new S("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new S("Attempted to iterate over a response with no body")}let X=new kJ,z=new D1,J=_2($.body);for await(let Q of JD(J))for(let Y of z.decode(Q)){let W=X.decode(Y);if(W)yield W}for(let Q of z.flush()){let Y=X.decode(Q);if(Y)yield Y}}async function*JD($){let Z=new Uint8Array;for await(let X of $){if(X==null)continue;let z=X instanceof ArrayBuffer?new Uint8Array(X):typeof X==="string"?P2(X):X,J=new Uint8Array(Z.length+z.length);J.set(Z),J.set(z,Z.length),Z=J;let Q;while((Q=xJ(Z))!==-1)yield Z.slice(0,Q),Z=Z.slice(Q)}if(Z.length>0)yield Z}class kJ{constructor(){this.event=null,this.data=[],this.chunks=[]}decode($){if($.endsWith("\r"))$=$.substring(0,$.length-1);if(!$){if(!this.event&&!this.data.length)return null;let J={event:this.event,data:this.data.join(`
168
- `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],J}if(this.chunks.push($),$.startsWith(":"))return null;let[Z,X,z]=QD($,":");if(z.startsWith(" "))z=z.substring(1);if(Z==="event")this.event=z;else if(Z==="data")this.data.push(z);return null}}function QD($,Z){let X=$.indexOf(Z);if(X!==-1)return[$.substring(0,X),Z,$.substring(X+Z.length)];return[$,"",""]}var C2,E0;var HZ=g(()=>{$1();T0();VZ();v1();v4();T0();E0=class E0{constructor($,Z,X){this.iterator=$,C2.set(this,void 0),this.controller=Z,_(this,C2,X,"f")}static fromSSEResponse($,Z,X){let z=!1,J=X?H0(X):console;async function*Q(){if(z)throw new S("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Y=!1;try{for await(let W of zD($,Z)){if(W.event==="completion")try{yield JSON.parse(W.data)}catch(U){throw J.error("Could not parse message into JSON:",W.data),J.error("From chunk:",W.raw),U}if(W.event==="message_start"||W.event==="message_delta"||W.event==="message_stop"||W.event==="content_block_start"||W.event==="content_block_delta"||W.event==="content_block_stop"||W.event==="message"||W.event==="user.message"||W.event==="user.interrupt"||W.event==="user.tool_confirmation"||W.event==="user.custom_tool_result"||W.event==="agent.message"||W.event==="agent.thinking"||W.event==="agent.tool_use"||W.event==="agent.tool_result"||W.event==="agent.mcp_tool_use"||W.event==="agent.mcp_tool_result"||W.event==="agent.custom_tool_use"||W.event==="agent.thread_context_compacted"||W.event==="session.status_running"||W.event==="session.status_idle"||W.event==="session.status_rescheduled"||W.event==="session.status_terminated"||W.event==="session.error"||W.event==="session.deleted"||W.event==="span.model_request_start"||W.event==="span.model_request_end")try{yield JSON.parse(W.data)}catch(U){throw J.error("Could not parse message into JSON:",W.data),J.error("From chunk:",W.raw),U}if(W.event==="ping")continue;if(W.event==="error"){let U=k4(W.data)??W.data,G=U?.error?.type;throw new Q0(void 0,U,void 0,$.headers,G)}}Y=!0}catch(W){if(Z1(W))return;throw W}finally{if(!Y)Z.abort()}}return new E0(Q,Z,X)}static fromReadableStream($,Z,X){let z=!1;async function*J(){let Y=new D1,W=_2($);for await(let U of W)for(let G of Y.decode(U))yield G;for(let U of Y.flush())yield U}async function*Q(){if(z)throw new S("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Y=!1;try{for await(let W of J()){if(Y)continue;if(W)yield JSON.parse(W)}Y=!0}catch(W){if(Z1(W))return;throw W}finally{if(!Y)Z.abort()}}return new E0(Q,Z,X)}[(C2=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],Z=[],X=this.iterator(),z=(J)=>{return{next:()=>{if(J.length===0){let Q=X.next();$.push(Q),Z.push(Q)}return J.shift()}}};return[new E0(()=>z($),this.controller,N(this,C2,"f")),new E0(()=>z(Z),this.controller,N(this,C2,"f"))]}toReadableStream(){let $=this,Z;return GZ({async start(){Z=$[Symbol.asyncIterator]()},async pull(X){try{let{value:z,done:J}=await Z.next();if(J)return X.close();let Q=P2(JSON.stringify(z)+`
169
- `);X.enqueue(Q)}catch(z){X.error(z)}},async cancel(){await Z.return?.()}})}}});async function h4($,Z){let{response:X,requestLogID:z,retryOfRequestLogID:J,startTime:Q}=Z,Y=await(async()=>{if(Z.options.stream){if(H0($).debug("response",X.status,X.url,X.headers,X.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(X,Z.controller);return E0.fromSSEResponse(X,Z.controller)}if(X.status===204)return null;if(Z.options.__binaryResponse)return X;let U=X.headers.get("content-type")?.split(";")[0]?.trim();if(U?.includes("application/json")||U?.endsWith("+json")){if(X.headers.get("content-length")==="0")return;let K=await X.json();return BZ(K,X)}return await X.text()})();return H0($).debug(`[${z}] response parsed`,X1({retryOfRequestLogID:J,url:X.url,status:X.status,body:Y,durationMs:Date.now()-Q})),Y}function BZ($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var LZ=g(()=>{HZ();v4()});var E2,I1;var u4=g(()=>{$1();LZ();I1=class I1 extends Promise{constructor($,Z,X=h4){super((z)=>{z(null)});this.responsePromise=Z,this.parseResponse=X,E2.set(this,void 0),_(this,E2,$,"f")}_thenUnwrap($){return new I1(N(this,E2,"f"),this.responsePromise,async(Z,X)=>BZ($(await this.parseResponse(Z,X),X),X.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,Z]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:Z,request_id:Z.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(($)=>this.parseResponse(N(this,E2,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};E2=new WeakMap});var m4,NZ,j2,c0,r;var Z0=g(()=>{$1();T0();LZ();u4();v1();NZ=class NZ{constructor($,Z,X,z){m4.set(this,void 0),_(this,m4,$,"f"),this.options=z,this.response=Z,this.body=X}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new S("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await N(this,m4,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(m4=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};j2=class j2 extends I1{constructor($,Z,X){super($,Z,async(z,J)=>new X(z,J.response,await h4(z,J),J.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};c0=class c0 extends NZ{constructor($,Z,X,z){super($,Z,X,z);this.data=X.data||[],this.has_more=X.has_more||!1,this.first_id=X.first_id||null,this.last_id=X.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let Z=this.first_id;if(!Z)return null;return{...this.options,query:{...b4(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...b4(this.options.query),after_id:$}}}};r=class r extends NZ{constructor($,Z,X,z){super($,Z,X,z);this.data=X.data||[],this.next_page=X.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let $=this.next_page;if(!$)return null;return{...this.options,query:{...b4(this.options.query),page:$}}}}});function h1($,Z,X){return OZ(),new File($,Z??"unknown_file",X)}function S2($,Z){let X=typeof $==="object"&&$!==null&&(("name"in $)&&$.name&&String($.name)||("url"in $)&&$.url&&String($.url)||("filename"in $)&&$.filename&&String($.filename)||("path"in $)&&$.path&&String($.path))||"";return Z?X.split(/[\\/]/).pop()||void 0:X}function WD($){let Z=typeof $==="function"?$:$.fetch,X=yJ.get(Z);if(X)return X;let z=(async()=>{try{let J="Response"in Z?Z.Response:(await Z("data:,")).constructor,Q=new FormData;if(Q.toString()===await new J(Q).text())return!1;return!0}catch{return!0}})();return yJ.set(Z,z),z}var OZ=()=>{if(typeof File>"u"){let{process:$}=globalThis,Z=typeof $?.versions?.node==="string"&&parseInt($.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(Z?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}},TZ=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",w$=async($,Z,X=!0)=>{return{...$,body:await UD($.body,Z,X)}},yJ,UD=async($,Z,X=!0)=>{if(!await WD(Z))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let z=new FormData;return await Promise.all(Object.entries($||{}).map(([J,Q])=>MZ(z,J,Q,X))),z},GD=($)=>$ instanceof Blob&&("name"in $),MZ=async($,Z,X,z)=>{if(X===void 0)return;if(X==null)throw TypeError(`Received null for "${Z}"; to pass null in FormData, you must use the string 'null'`);if(typeof X==="string"||typeof X==="number"||typeof X==="boolean")$.append(Z,String(X));else if(X instanceof Response){let J={},Q=X.headers.get("Content-Type");if(Q)J={type:Q};$.append(Z,h1([await X.blob()],S2(X,z),J))}else if(TZ(X))$.append(Z,h1([await new Response(y4(X)).blob()],S2(X,z)));else if(GD(X))$.append(Z,h1([X],S2(X,z),{type:X.type}));else if(Array.isArray(X))await Promise.all(X.map((J)=>MZ($,Z+"[]",J,z)));else if(typeof X==="object")await Promise.all(Object.entries(X).map(([J,Q])=>MZ($,`${Z}[${J}]`,Q,z)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${X} instead`)};var C$=g(()=>{yJ=new WeakMap});async function x2($,Z,X){if(OZ(),$=await $,Z||(Z=S2($,!0)),qD($)){if($ instanceof File&&Z==null&&X==null)return $;return h1([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...X})}if(VD($)){let J=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),h1(await DZ(J),Z,X)}let z=await DZ($);if(!X?.type){let J=z.find((Q)=>typeof Q==="object"&&("type"in Q)&&Q.type);if(typeof J==="string")X={...X,type:J}}return h1(z,Z,X)}async function DZ($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(fJ($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(TZ($))for await(let X of $)Z.push(...await DZ(X));else{let X=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${X?`; constructor: ${X}`:""}${KD($)}`)}return Z}function KD($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((X)=>`"${X}"`).join(", ")}]`}var fJ=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",qD=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&fJ($),VD=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var gJ=g(()=>{C$();C$()});var IZ=g(()=>{gJ()});var vJ=()=>{};class u{constructor($){this._client=$}}function*BD($){if(!$)return;if(hJ in $){let{values:z,nulls:J}=$;yield*z.entries();for(let Q of J)yield[Q,null];return}let Z=!1,X;if($ instanceof Headers)X=$.entries();else if(YZ($))X=$;else Z=!0,X=Object.entries($??{});for(let z of X){let J=z[0];if(typeof J!=="string")throw TypeError("expected header name to be a string");let Q=YZ(z[1])?z[1]:[z[1]],Y=!1;for(let W of Q){if(W===void 0)continue;if(Z&&!Y)Y=!0,yield[J,null];yield[J,W]}}}var hJ,T=($)=>{let Z=new Headers,X=new Set;for(let z of $){let J=new Set;for(let[Q,Y]of BD(z)){let W=Q.toLowerCase();if(!J.has(W))Z.delete(Q),J.add(W);if(Y===null)Z.delete(Q),X.add(W);else Z.append(Q,Y),X.delete(W)}}return{[hJ]:!0,values:Z,nulls:X}};var a=g(()=>{v1();hJ=Symbol.for("brand.privateNullableHeaders")});function mJ($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var uJ,LD=($=mJ)=>function(X,...z){if(X.length===1)return X[0];let J=!1,Q=[],Y=X.reduce((q,V,K)=>{if(/[?#]/.test(V))J=!0;let B=z[K],O=(J?encodeURIComponent:$)(""+B);if(K!==z.length&&(B==null||typeof B==="object"&&B.toString===Object.getPrototypeOf(Object.getPrototypeOf(B.hasOwnProperty??uJ)??uJ)?.toString))O=B+"",Q.push({start:q.length+V.length,length:O.length,error:`Value of type ${Object.prototype.toString.call(B).slice(8,-1)} is not a valid path parameter`});return q+V+(K===z.length?"":O)},""),W=Y.split(/[?#]/,1)[0],U=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,G;while((G=U.exec(W))!==null)Q.push({start:G.index,length:G[0].length,error:`Value "${G[0]}" can't be safely passed as a path parameter`});if(Q.sort((q,V)=>q.start-V.start),Q.length>0){let q=0,V=Q.reduce((K,B)=>{let O=" ".repeat(B.start-q),L="^".repeat(B.length);return q=B.start+B.length,K+O+L},"");throw new S(`Path parameters result in path with invalid segments:
165
+ `,Z)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Z=Q3($),X=J$(Z);return X.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Z=Q3($),X=J$(Z);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Z){if(this.type!=="comment")return!1;if(this.indent<=Z)return!1;return $.every((X)=>X.type==="newline"||X.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}lB.Parser=XX});var WX=_((eB)=>{var zX=D6(),iB=W2(),H2=U2(),nB=S8(),rB=p(),sB=S6(),JX=j6();function QX($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new sB.LineCounter||null,prettyErrors:Z}}function aB($,Z={}){let{lineCounter:X,prettyErrors:z}=QX(Z),J=new JX.Parser(X?.addNewLine),Q=new zX.Composer(Z),Y=Array.from(Q.compose(J.parse($)));if(z&&X)for(let W of Y)W.errors.forEach(H2.prettifyError($,X)),W.warnings.forEach(H2.prettifyError($,X));if(Y.length>0)return Y;return Object.assign([],{empty:!0},Q.streamInfo())}function YX($,Z={}){let{lineCounter:X,prettyErrors:z}=QX(Z),J=new JX.Parser(X?.addNewLine),Q=new zX.Composer(Z),Y=null;for(let W of Q.compose(J.parse($),!0,$.length))if(!Y)Y=W;else if(Y.options.logLevel!=="silent"){Y.errors.push(new H2.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&X)Y.errors.forEach(H2.prettifyError($,X)),Y.warnings.forEach(H2.prettifyError($,X));return Y}function oB($,Z,X){let z=void 0;if(typeof Z==="function")z=Z;else if(X===void 0&&Z&&typeof Z==="object")X=Z;let J=YX($,X);if(!J)return null;if(J.warnings.forEach((Q)=>nB.warn(J.options.logLevel,Q)),J.errors.length>0)if(J.options.logLevel!=="silent")throw J.errors[0];else J.errors=[];return J.toJS(Object.assign({reviver:z},X))}function tB($,Z,X){let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(X===void 0&&Z)X=Z;if(typeof X==="string")X=X.length;if(typeof X==="number"){let J=Math.round(X);X=J<1?void 0:J>8?{indent:8}:{indent:J}}if($===void 0){let{keepUndefined:J}=X??Z??{};if(!J)return}if(rB.isDocument($)&&!z)return $.toString(X);return new iB.Document($,z,X).toString(X)}eB.parse=oB;eB.parseAllDocuments=aB;eB.parseDocument=YX;eB.stringify=tB});var BX={};f5(BX,{orange:()=>K0,italic:()=>lL,fafCyanDeep:()=>W3,fafCyan:()=>D,dim:()=>B,bold:()=>I,FAF_HEX:()=>L2});var k6=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,I,B,lL,L2,D=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,W3=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,K0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var d=y(()=>{I=k6("1"),B=k6("2"),lL=k6("3"),L2={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var YZ=_((pw,vT)=>{vT.exports={name:"faf-cli",version:"7.4.0",description:"Persistent AI context + memory — .faf and .fafm, IANA-registered. Anthropic-merged.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",types:"./dist/index.d.ts",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",clean:"rm -rf dist",build:"bun run clean && bun build src/cli.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/index.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && tsc -p tsconfig.build.json",compile:"bun build src/cli.ts --compile --bytecode --minify --outfile faf","compile:all":"bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-arm64 --outfile faf-darwin-arm64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-x64 --outfile faf-darwin-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-linux-x64 --outfile faf-linux-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-windows-x64 --outfile faf-windows-x64.exe",test:"bun test --timeout=120000","test:watch":"bun test --watch --timeout=120000",lint:"eslint src/**/*.ts",format:"prettier --write 'src/**/*.ts'","check:no-hardcode":"! grep -rEln '/(Users|home/runner|private/var)/' dist/ || (echo '❌ Hardcoded build-machine path leaked into dist — see grep output above. Externalize the offending dep in the build script.'; exit 1)",prepublishOnly:"bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","bi-sync","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational","agents-md","context-engineering","codex","windsurf","fafm","ai-memory","agents"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.1","faf-scoring-kernel":"^2.0.3",open:"^11.0.0",yaml:"^2.4.1"},optionalDependencies:{"@anthropic-ai/sdk":"^0.91.1"},devDependencies:{"@faf/specification":"github:Wolfe-Jam/faf","@types/bun":"^1.3.14","@types/node":"^22.15.0","@typescript-eslint/eslint-plugin":"^8.41.0","@typescript-eslint/parser":"^8.41.0",ajv:"^8.17.1",eslint:"^9.39.2",prettier:"^3.2.5",typescript:"^5.3.3","typescript-eslint":"^8.59.1"},engines:{node:">=18.0.0"},publishConfig:{access:"public"}}});function F($,Z,X,z,J){if(z==="m")throw TypeError("Private method is not writable");if(z==="a"&&!J)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!J:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return z==="a"?J.call($,X):J?J.value=X:Z.set($,X),X}function M($,Z,X,z){if(X==="a"&&!z)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!z:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return X==="m"?z:X==="a"?z.call($):z?z.value:Z.get($)}var $1=()=>{};var GZ=function(){let{crypto:$}=globalThis;if($?.randomUUID)return GZ=$.randomUUID.bind($),$.randomUUID();let Z=new Uint8Array(1),X=$?()=>$.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(z)=>(+z^X()&15>>+z/4).toString(16))};function Z1($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var P2=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var j,Y0,L0,N1,T$,D$,I$,A$,R$,_$,F$,P$,C$;var D0=y(()=>{j=class j extends Error{};Y0=class Y0 extends j{constructor($,Z,X,z,J){super(`${Y0.makeMessage($,Z,X)}`);this.status=$,this.headers=z,this.requestID=z?.get("request-id"),this.error=Z,this.type=J??null}static makeMessage($,Z,X){let z=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):X;if($&&z)return`${$} ${z}`;if($)return`${$} status code (no body)`;if(z)return z;return"(no status code or body)"}static generate($,Z,X,z){if(!$||!z)return new N1({message:X,cause:P2(Z)});let J=Z,Q=J?.error?.type;if($===400)return new D$($,J,X,z,Q);if($===401)return new I$($,J,X,z,Q);if($===403)return new A$($,J,X,z,Q);if($===404)return new R$($,J,X,z,Q);if($===409)return new _$($,J,X,z,Q);if($===422)return new F$($,J,X,z,Q);if($===429)return new P$($,J,X,z,Q);if($>=500)return new C$($,J,X,z,Q);return new Y0($,J,X,z,Q)}};L0=class L0 extends Y0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};N1=class N1 extends Y0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};T$=class T$ extends N1{constructor({message:$}={}){super({message:$??"Request timed out."})}};D$=class D$ extends Y0{};I$=class I$ extends Y0{};A$=class A$ extends Y0{};R$=class R$ extends Y0{};_$=class _$ extends Y0{};F$=class F$ extends Y0{};P$=class P$ extends Y0{};C$=class C$ extends Y0{}});function g3($){if(typeof $!=="object")return{};return $??{}}function KZ($){if(!$)return!0;for(let Z in $)return!1;return!0}function RJ($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var OD,AJ=($)=>{return OD.test($)},qZ=($)=>(qZ=Array.isArray,qZ($)),VZ,_J=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new j(`${$} must be an integer`);if(Z<0)throw new j(`${$} must be a positive integer`);return Z},v3=($)=>{try{return JSON.parse($)}catch(Z){return}};var h1=y(()=>{D0();OD=/^[a-z][a-z0-9+.-]*:/i,VZ=qZ});var FJ=($)=>new Promise((Z)=>setTimeout(Z,$));var T1="0.91.1";function ND(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}function DD(){if(typeof navigator>"u"||!navigator)return null;let $=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:Z,pattern:X}of $){let z=X.exec(navigator.userAgent);if(z){let J=z[1]||0,Q=z[2]||0,Y=z[3]||0;return{browser:Z,version:`${J}.${Q}.${Y}`}}}return null}var EJ=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},TD=()=>{let $=ND();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":T1,"X-Stainless-OS":CJ(Deno.build.os),"X-Stainless-Arch":PJ(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":T1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if($==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":T1,"X-Stainless-OS":CJ(globalThis.process.platform??"unknown"),"X-Stainless-Arch":PJ(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=DD();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":T1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Z.browser}`,"X-Stainless-Runtime-Version":Z.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":T1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},PJ=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},CJ=($)=>{if($=$.toLowerCase(),$.includes("ios"))return"iOS";if($==="android")return"Android";if($==="darwin")return"MacOS";if($==="win32")return"Windows";if($==="freebsd")return"FreeBSD";if($==="openbsd")return"OpenBSD";if($==="linux")return"Linux";if($)return`Other:${$}`;return"Unknown"},wJ,SJ=()=>{return wJ??(wJ=TD())};var HZ=()=>{};function jJ(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function BZ(...$){let Z=globalThis.ReadableStream;if(typeof Z>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new Z(...$)}function h3($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return BZ({start(){},async pull(X){let{done:z,value:J}=await Z.next();if(z)X.close();else X.enqueue(J)},async cancel(){await Z.return?.()}})}function C2($){if($[Symbol.asyncIterator])return $;let Z=$.getReader();return{async next(){try{let X=await Z.read();if(X?.done)Z.releaseLock();return X}catch(X){throw Z.releaseLock(),X}},async return(){let X=Z.cancel();return Z.releaseLock(),await X,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function xJ($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),X=Z.cancel();Z.releaseLock(),await X}var bJ=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function kJ($){return Object.entries($).filter(([Z,X])=>typeof X<"u").map(([Z,X])=>{if(typeof X==="string"||typeof X==="number"||typeof X==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent(X)}`;if(X===null)return`${encodeURIComponent(Z)}=`;throw new j(`Cannot stringify type ${typeof X}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}var yJ=y(()=>{D0()});function vJ($){let Z=0;for(let J of $)Z+=J.length;let X=new Uint8Array(Z),z=0;for(let J of $)X.set(J,z),z+=J.length;return X}function w2($){let Z;return(fJ??(Z=new globalThis.TextEncoder,fJ=Z.encode.bind(Z)))($)}function LZ($){let Z;return(gJ??(Z=new globalThis.TextDecoder,gJ=Z.decode.bind(Z)))($)}var fJ,gJ;class D1{constructor(){C0.set(this,void 0),w0.set(this,void 0),F(this,C0,new Uint8Array,"f"),F(this,w0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?w2($):$;F(this,C0,vJ([M(this,C0,"f"),Z]),"f");let X=[],z;while((z=RD(M(this,C0,"f"),M(this,w0,"f")))!=null){if(z.carriage&&M(this,w0,"f")==null){F(this,w0,z.index,"f");continue}if(M(this,w0,"f")!=null&&(z.index!==M(this,w0,"f")+1||z.carriage)){X.push(LZ(M(this,C0,"f").subarray(0,M(this,w0,"f")-1))),F(this,C0,M(this,C0,"f").subarray(M(this,w0,"f")),"f"),F(this,w0,null,"f");continue}let J=M(this,w0,"f")!==null?z.preceding-1:z.preceding,Q=LZ(M(this,C0,"f").subarray(0,J));X.push(Q),F(this,C0,M(this,C0,"f").subarray(z.index),"f"),F(this,w0,null,"f")}return X}flush(){if(!M(this,C0,"f").length)return[];return this.decode(`
166
+ `)}}function RD($,Z){for(let J=Z??0;J<$.length;J++){if($[J]===10)return{preceding:J,index:J+1,carriage:!1};if($[J]===13)return{preceding:J,index:J+1,carriage:!0}}return null}function hJ($){for(let z=0;z<$.length-1;z++){if($[z]===10&&$[z+1]===10)return z+2;if($[z]===13&&$[z+1]===13)return z+2;if($[z]===13&&$[z+1]===10&&z+3<$.length&&$[z+2]===13&&$[z+3]===10)return z+4}return-1}var C0,w0;var MZ=y(()=>{$1();C0=new WeakMap,w0=new WeakMap;D1.NEWLINE_CHARS=new Set([`
167
+ `,"\r"]);D1.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function E2(){}function u3($,Z,X){if(!Z||m3[$]>m3[X])return E2;else return Z[$].bind(Z)}function B0($){let Z=$.logger,X=$.logLevel??"off";if(!Z)return _D;let z=uJ.get(Z);if(z&&z[0]===X)return z[1];let J={error:u3("error",Z,X),warn:u3("warn",Z,X),info:u3("info",Z,X),debug:u3("debug",Z,X)};return uJ.set(Z,[X,J]),J}var m3,OZ=($,Z,X)=>{if(!$)return;if(RJ(m3,$))return $;B0(X).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(m3))}`);return},_D,uJ,X1=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([Z,X])=>[Z,Z.toLowerCase()==="x-api-key"||Z.toLowerCase()==="authorization"||Z.toLowerCase()==="cookie"||Z.toLowerCase()==="set-cookie"?"***":X]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var c3=y(()=>{h1();m3={off:0,error:200,warn:300,info:400,debug:500};_D={error:E2,warn:E2,info:E2,debug:E2},uJ=new WeakMap});async function*FD($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new j("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new j("Attempted to iterate over a response with no body")}let X=new mJ,z=new D1,J=C2($.body);for await(let Q of PD(J))for(let Y of z.decode(Q)){let W=X.decode(Y);if(W)yield W}for(let Q of z.flush()){let Y=X.decode(Q);if(Y)yield Y}}async function*PD($){let Z=new Uint8Array;for await(let X of $){if(X==null)continue;let z=X instanceof ArrayBuffer?new Uint8Array(X):typeof X==="string"?w2(X):X,J=new Uint8Array(Z.length+z.length);J.set(Z),J.set(z,Z.length),Z=J;let Q;while((Q=hJ(Z))!==-1)yield Z.slice(0,Q),Z=Z.slice(Q)}if(Z.length>0)yield Z}class mJ{constructor(){this.event=null,this.data=[],this.chunks=[]}decode($){if($.endsWith("\r"))$=$.substring(0,$.length-1);if(!$){if(!this.event&&!this.data.length)return null;let J={event:this.event,data:this.data.join(`
168
+ `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],J}if(this.chunks.push($),$.startsWith(":"))return null;let[Z,X,z]=CD($,":");if(z.startsWith(" "))z=z.substring(1);if(Z==="event")this.event=z;else if(Z==="data")this.data.push(z);return null}}function CD($,Z){let X=$.indexOf(Z);if(X!==-1)return[$.substring(0,X),Z,$.substring(X+Z.length)];return[$,"",""]}var S2,E0;var NZ=y(()=>{$1();D0();MZ();h1();c3();D0();E0=class E0{constructor($,Z,X){this.iterator=$,S2.set(this,void 0),this.controller=Z,F(this,S2,X,"f")}static fromSSEResponse($,Z,X){let z=!1,J=X?B0(X):console;async function*Q(){if(z)throw new j("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Y=!1;try{for await(let W of FD($,Z)){if(W.event==="completion")try{yield JSON.parse(W.data)}catch(U){throw J.error("Could not parse message into JSON:",W.data),J.error("From chunk:",W.raw),U}if(W.event==="message_start"||W.event==="message_delta"||W.event==="message_stop"||W.event==="content_block_start"||W.event==="content_block_delta"||W.event==="content_block_stop"||W.event==="message"||W.event==="user.message"||W.event==="user.interrupt"||W.event==="user.tool_confirmation"||W.event==="user.custom_tool_result"||W.event==="agent.message"||W.event==="agent.thinking"||W.event==="agent.tool_use"||W.event==="agent.tool_result"||W.event==="agent.mcp_tool_use"||W.event==="agent.mcp_tool_result"||W.event==="agent.custom_tool_use"||W.event==="agent.thread_context_compacted"||W.event==="session.status_running"||W.event==="session.status_idle"||W.event==="session.status_rescheduled"||W.event==="session.status_terminated"||W.event==="session.error"||W.event==="session.deleted"||W.event==="span.model_request_start"||W.event==="span.model_request_end")try{yield JSON.parse(W.data)}catch(U){throw J.error("Could not parse message into JSON:",W.data),J.error("From chunk:",W.raw),U}if(W.event==="ping")continue;if(W.event==="error"){let U=v3(W.data)??W.data,G=U?.error?.type;throw new Y0(void 0,U,void 0,$.headers,G)}}Y=!0}catch(W){if(Z1(W))return;throw W}finally{if(!Y)Z.abort()}}return new E0(Q,Z,X)}static fromReadableStream($,Z,X){let z=!1;async function*J(){let Y=new D1,W=C2($);for await(let U of W)for(let G of Y.decode(U))yield G;for(let U of Y.flush())yield U}async function*Q(){if(z)throw new j("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Y=!1;try{for await(let W of J()){if(Y)continue;if(W)yield JSON.parse(W)}Y=!0}catch(W){if(Z1(W))return;throw W}finally{if(!Y)Z.abort()}}return new E0(Q,Z,X)}[(S2=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],Z=[],X=this.iterator(),z=(J)=>{return{next:()=>{if(J.length===0){let Q=X.next();$.push(Q),Z.push(Q)}return J.shift()}}};return[new E0(()=>z($),this.controller,M(this,S2,"f")),new E0(()=>z(Z),this.controller,M(this,S2,"f"))]}toReadableStream(){let $=this,Z;return BZ({async start(){Z=$[Symbol.asyncIterator]()},async pull(X){try{let{value:z,done:J}=await Z.next();if(J)return X.close();let Q=w2(JSON.stringify(z)+`
169
+ `);X.enqueue(Q)}catch(z){X.error(z)}},async cancel(){await Z.return?.()}})}}});async function d3($,Z){let{response:X,requestLogID:z,retryOfRequestLogID:J,startTime:Q}=Z,Y=await(async()=>{if(Z.options.stream){if(B0($).debug("response",X.status,X.url,X.headers,X.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(X,Z.controller);return E0.fromSSEResponse(X,Z.controller)}if(X.status===204)return null;if(Z.options.__binaryResponse)return X;let U=X.headers.get("content-type")?.split(";")[0]?.trim();if(U?.includes("application/json")||U?.endsWith("+json")){if(X.headers.get("content-length")==="0")return;let K=await X.json();return TZ(K,X)}return await X.text()})();return B0($).debug(`[${z}] response parsed`,X1({retryOfRequestLogID:J,url:X.url,status:X.status,body:Y,durationMs:Date.now()-Q})),Y}function TZ($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var DZ=y(()=>{NZ();c3()});var j2,I1;var l3=y(()=>{$1();DZ();I1=class I1 extends Promise{constructor($,Z,X=d3){super((z)=>{z(null)});this.responsePromise=Z,this.parseResponse=X,j2.set(this,void 0),F(this,j2,$,"f")}_thenUnwrap($){return new I1(M(this,j2,"f"),this.responsePromise,async(Z,X)=>TZ($(await this.parseResponse(Z,X),X),X.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,Z]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:Z,request_id:Z.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(($)=>this.parseResponse(M(this,j2,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};j2=new WeakMap});var p3,IZ,x2,c0,s;var X0=y(()=>{$1();D0();DZ();l3();h1();IZ=class IZ{constructor($,Z,X,z){p3.set(this,void 0),F(this,p3,$,"f"),this.options=z,this.response=Z,this.body=X}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new j("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await M(this,p3,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(p3=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};x2=class x2 extends I1{constructor($,Z,X){super($,Z,async(z,J)=>new X(z,J.response,await d3(z,J),J.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};c0=class c0 extends IZ{constructor($,Z,X,z){super($,Z,X,z);this.data=X.data||[],this.has_more=X.has_more||!1,this.first_id=X.first_id||null,this.last_id=X.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let Z=this.first_id;if(!Z)return null;return{...this.options,query:{...g3(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...g3(this.options.query),after_id:$}}}};s=class s extends IZ{constructor($,Z,X,z){super($,Z,X,z);this.data=X.data||[],this.next_page=X.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let $=this.next_page;if(!$)return null;return{...this.options,query:{...g3(this.options.query),page:$}}}}});function u1($,Z,X){return RZ(),new File($,Z??"unknown_file",X)}function b2($,Z){let X=typeof $==="object"&&$!==null&&(("name"in $)&&$.name&&String($.name)||("url"in $)&&$.url&&String($.url)||("filename"in $)&&$.filename&&String($.filename)||("path"in $)&&$.path&&String($.path))||"";return Z?X.split(/[\\/]/).pop()||void 0:X}function ED($){let Z=typeof $==="function"?$:$.fetch,X=cJ.get(Z);if(X)return X;let z=(async()=>{try{let J="Response"in Z?Z.Response:(await Z("data:,")).constructor,Q=new FormData;if(Q.toString()===await new J(Q).text())return!1;return!0}catch{return!0}})();return cJ.set(Z,z),z}var RZ=()=>{if(typeof File>"u"){let{process:$}=globalThis,Z=typeof $?.versions?.node==="string"&&parseInt($.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(Z?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}},_Z=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",w$=async($,Z,X=!0)=>{return{...$,body:await SD($.body,Z,X)}},cJ,SD=async($,Z,X=!0)=>{if(!await ED(Z))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let z=new FormData;return await Promise.all(Object.entries($||{}).map(([J,Q])=>AZ(z,J,Q,X))),z},jD=($)=>$ instanceof Blob&&("name"in $),AZ=async($,Z,X,z)=>{if(X===void 0)return;if(X==null)throw TypeError(`Received null for "${Z}"; to pass null in FormData, you must use the string 'null'`);if(typeof X==="string"||typeof X==="number"||typeof X==="boolean")$.append(Z,String(X));else if(X instanceof Response){let J={},Q=X.headers.get("Content-Type");if(Q)J={type:Q};$.append(Z,u1([await X.blob()],b2(X,z),J))}else if(_Z(X))$.append(Z,u1([await new Response(h3(X)).blob()],b2(X,z)));else if(jD(X))$.append(Z,u1([X],b2(X,z),{type:X.type}));else if(Array.isArray(X))await Promise.all(X.map((J)=>AZ($,Z+"[]",J,z)));else if(typeof X==="object")await Promise.all(Object.entries(X).map(([J,Q])=>AZ($,`${Z}[${J}]`,Q,z)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${X} instead`)};var E$=y(()=>{cJ=new WeakMap});async function k2($,Z,X){if(RZ(),$=await $,Z||(Z=b2($,!0)),xD($)){if($ instanceof File&&Z==null&&X==null)return $;return u1([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...X})}if(bD($)){let J=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),u1(await FZ(J),Z,X)}let z=await FZ($);if(!X?.type){let J=z.find((Q)=>typeof Q==="object"&&("type"in Q)&&Q.type);if(typeof J==="string")X={...X,type:J}}return u1(z,Z,X)}async function FZ($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(dJ($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(_Z($))for await(let X of $)Z.push(...await FZ(X));else{let X=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${X?`; constructor: ${X}`:""}${kD($)}`)}return Z}function kD($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((X)=>`"${X}"`).join(", ")}]`}var dJ=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",xD=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&dJ($),bD=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var lJ=y(()=>{E$();E$()});var PZ=y(()=>{lJ()});var pJ=()=>{};class h{constructor($){this._client=$}}function*fD($){if(!$)return;if(iJ in $){let{values:z,nulls:J}=$;yield*z.entries();for(let Q of J)yield[Q,null];return}let Z=!1,X;if($ instanceof Headers)X=$.entries();else if(VZ($))X=$;else Z=!0,X=Object.entries($??{});for(let z of X){let J=z[0];if(typeof J!=="string")throw TypeError("expected header name to be a string");let Q=VZ(z[1])?z[1]:[z[1]],Y=!1;for(let W of Q){if(W===void 0)continue;if(Z&&!Y)Y=!0,yield[J,null];yield[J,W]}}}var iJ,T=($)=>{let Z=new Headers,X=new Set;for(let z of $){let J=new Set;for(let[Q,Y]of fD(z)){let W=Q.toLowerCase();if(!J.has(W))Z.delete(Q),J.add(W);if(Y===null)Z.delete(Q),X.add(W);else Z.append(Q,Y),X.delete(W)}}return{[iJ]:!0,values:Z,nulls:X}};var o=y(()=>{h1();iJ=Symbol.for("brand.privateNullableHeaders")});function rJ($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var nJ,gD=($=rJ)=>function(X,...z){if(X.length===1)return X[0];let J=!1,Q=[],Y=X.reduce((q,V,K)=>{if(/[?#]/.test(V))J=!0;let H=z[K],N=(J?encodeURIComponent:$)(""+H);if(K!==z.length&&(H==null||typeof H==="object"&&H.toString===Object.getPrototypeOf(Object.getPrototypeOf(H.hasOwnProperty??nJ)??nJ)?.toString))N=H+"",Q.push({start:q.length+V.length,length:N.length,error:`Value of type ${Object.prototype.toString.call(H).slice(8,-1)} is not a valid path parameter`});return q+V+(K===z.length?"":N)},""),W=Y.split(/[?#]/,1)[0],U=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,G;while((G=U.exec(W))!==null)Q.push({start:G.index,length:G[0].length,error:`Value "${G[0]}" can't be safely passed as a path parameter`});if(Q.sort((q,V)=>q.start-V.start),Q.length>0){let q=0,V=Q.reduce((K,H)=>{let N=" ".repeat(H.start-q),L="^".repeat(H.length);return q=H.start+H.length,K+N+L},"");throw new j(`Path parameters result in path with invalid segments:
170
170
  ${Q.map((K)=>K.error).join(`
171
171
  `)}
172
172
  ${Y}
173
- ${V}`)}return Y},A;var Y0=g(()=>{T0();uJ=Object.freeze(Object.create(null)),A=LD(mJ)});var b2;var AZ=g(()=>{Z0();a();Y0();b2=class b2 extends u{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/environments?beta=true",{body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/environments/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/environments/${$}?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/environments?beta=true",r,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(A`/v1/environments/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(A`/v1/environments/${$}/archive?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});function c4($){return typeof $==="object"&&$!==null&&k2 in $}function RZ($,Z){let X=new Set;if($){for(let z of $)if(c4(z))X.add(z[k2])}if(Z)for(let z of Z){if(c4(z))X.add(z[k2]);if(Array.isArray(z.content)){for(let J of z.content)if(c4(J))X.add(J[k2])}}return Array.from(X)}function d4($,Z){let X=RZ($,Z);if(X.length===0)return{};return{"x-stainless-helper":X.join(", ")}}function cJ($){if(c4($))return{"x-stainless-helper":$[k2]};return{}}var k2;var y2=g(()=>{k2=Symbol("anthropic.sdk.stainlessHelper")});var f2;var FZ=g(()=>{Z0();a();y2();C$();Y0();f2=class f2 extends u{list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/files?beta=true",c0,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(A`/v1/files/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}download($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/files/${$}/content?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},X?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/files/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}upload($,Z){let{betas:X,...z}=$;return this._client.post("/v1/files?beta=true",w$({body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},cJ(z.file),Z?.headers])},this._client))}}});var g2;var _Z=g(()=>{Z0();a();Y0();g2=class g2 extends u{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/models/${$}?beta=true`,{...X,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/models?beta=true",c0,{query:z,...Z,headers:T([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var v2;var PZ=g(()=>{Z0();a();Y0();v2=class v2 extends u{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/user_profiles?beta=true",{body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/user_profiles/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/user_profiles/${$}?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/user_profiles?beta=true",r,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},X){let{betas:z}=Z??{};return this._client.post(A`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}}});var h2;var wZ=g(()=>{Z0();a();Y0();h2=class h2 extends u{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(A`/v1/agents/${$}/versions?beta=true`,r,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var E$;var CZ=g(()=>{wZ();wZ();Z0();a();Y0();E$=class E$ extends u{constructor(){super(...arguments);this.versions=new h2(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/agents?beta=true",{body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z,...J}=Z??{};return this._client.get(A`/v1/agents/${$}?beta=true`,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/agents/${$}?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/agents?beta=true",r,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(A`/v1/agents/${$}/archive?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};E$.Versions=h2});var u2;var EZ=g(()=>{Z0();a();Y0();u2=class u2 extends u{create($,Z,X){let{view:z,betas:J,...Q}=Z;return this._client.post(A`/v1/memory_stores/${$}/memories?beta=true`,{query:{view:z},body:Q,...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}retrieve($,Z,X){let{memory_store_id:z,betas:J,...Q}=Z;return this._client.get(A`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:Q,...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{memory_store_id:z,view:J,betas:Q,...Y}=Z;return this._client.post(A`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:{view:J},body:Y,...X,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(A`/v1/memory_stores/${$}/memories?beta=true`,r,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}delete($,Z,X){let{memory_store_id:z,expected_content_sha256:J,betas:Q}=Z;return this._client.delete(A`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:{expected_content_sha256:J},...X,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var m2;var jZ=g(()=>{Z0();a();Y0();m2=class m2 extends u{retrieve($,Z,X){let{memory_store_id:z,betas:J,...Q}=Z;return this._client.get(A`/v1/memory_stores/${z}/memory_versions/${$}?beta=true`,{query:Q,...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(A`/v1/memory_stores/${$}/memory_versions?beta=true`,r,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}redact($,Z,X){let{memory_store_id:z,betas:J}=Z;return this._client.post(A`/v1/memory_stores/${z}/memory_versions/${$}/redact?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var u1;var SZ=g(()=>{EZ();EZ();jZ();jZ();Z0();a();Y0();u1=class u1 extends u{constructor(){super(...arguments);this.memories=new u2(this._client),this.memoryVersions=new m2(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/memory_stores?beta=true",{body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/memory_stores/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/memory_stores/${$}?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/memory_stores?beta=true",r,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(A`/v1/memory_stores/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(A`/v1/memory_stores/${$}/archive?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};u1.Memories=u2;u1.MemoryVersions=m2});var j$=g(()=>{T0()});var l4;var xZ=g(()=>{l4={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192}});function dJ($){return $?.output_format??$?.output_config?.format}function bZ($,Z,X){let z=dJ(Z);if(!Z||!("parse"in(z??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text"){let Q=Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(Q,"parsed",{get(){return X.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return J}),parsed_output:null};return kZ($,Z,X)}function kZ($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=_D(Z,Q.text);if(z===null)z=Y;let W=Object.defineProperty({...Q},"parsed_output",{value:Y,enumerable:!1});return Object.defineProperty(W,"parsed",{get(){return X.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),Y},enumerable:!1})}return Q});return{...$,content:J,parsed_output:z}}function _D($,Z){let X=dJ($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new S(`Failed to parse structured output: ${z}`)}}var yZ=g(()=>{T0()});var PD=($)=>{let Z=0,X=[];while(Z<$.length){let z=$[Z];if(z==="\\"){Z++;continue}if(z==="{"){X.push({type:"brace",value:"{"}),Z++;continue}if(z==="}"){X.push({type:"brace",value:"}"}),Z++;continue}if(z==="["){X.push({type:"paren",value:"["}),Z++;continue}if(z==="]"){X.push({type:"paren",value:"]"}),Z++;continue}if(z===":"){X.push({type:"separator",value:":"}),Z++;continue}if(z===","){X.push({type:"delimiter",value:","}),Z++;continue}if(z==='"'){let W="",U=!1;z=$[++Z];while(z!=='"'){if(Z===$.length){U=!0;break}if(z==="\\"){if(Z++,Z===$.length){U=!0;break}W+=z+$[Z],z=$[++Z]}else W+=z,z=$[++Z]}if(z=$[++Z],!U)X.push({type:"string",value:W});continue}if(z&&/\s/.test(z)){Z++;continue}let Q=/[0-9]/;if(z&&Q.test(z)||z==="-"||z==="."){let W="";if(z==="-")W+=z,z=$[++Z];while(z&&Q.test(z)||z===".")W+=z,z=$[++Z];X.push({type:"number",value:W});continue}let Y=/[a-z]/i;if(z&&Y.test(z)){let W="";while(z&&Y.test(z)){if(Z===$.length)break;W+=z,z=$[++Z]}if(W=="true"||W=="false"||W==="null")X.push({type:"name",value:W});else{Z++;continue}continue}Z++}return X},S$=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),S$($);break;case"number":let X=Z.value[Z.value.length-1];if(X==="."||X==="-")return $=$.slice(0,$.length-1),S$($);case"string":let z=$[$.length-2];if(z?.type==="delimiter")return $=$.slice(0,$.length-1),S$($);else if(z?.type==="brace"&&z.value==="{")return $=$.slice(0,$.length-1),S$($);break;case"delimiter":return $=$.slice(0,$.length-1),S$($);break}return $},wD=($)=>{let Z=[];if($.map((X)=>{if(X.type==="brace")if(X.value==="{")Z.push("}");else Z.splice(Z.lastIndexOf("}"),1);if(X.type==="paren")if(X.value==="[")Z.push("]");else Z.splice(Z.lastIndexOf("]"),1)}),Z.length>0)Z.reverse().map((X)=>{if(X==="}")$.push({type:"brace",value:"}"});else if(X==="]")$.push({type:"paren",value:"]"})});return $},CD=($)=>{let Z="";return $.map((X)=>{switch(X.type){case"string":Z+='"'+X.value+'"';break;default:Z+=X.value;break}}),Z},p4=($)=>JSON.parse(CD(wD(S$(PD($)))));var fZ=()=>{};var gZ=g(()=>{HZ()});function nJ($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function rJ($){}var y0,A1,x$,c2,i4,d2,l2,n4,p2,z1,i2,r4,s4,m1,a4,o4,n2,vZ,lJ,t4,hZ,uZ,mZ,pJ,iJ="__json_buf",r2;var sJ=g(()=>{$1();fZ();j$();gZ();yZ();r2=class r2{constructor($,Z){y0.add(this),this.messages=[],this.receivedMessages=[],A1.set(this,void 0),x$.set(this,null),this.controller=new AbortController,c2.set(this,void 0),i4.set(this,()=>{}),d2.set(this,()=>{}),l2.set(this,void 0),n4.set(this,()=>{}),p2.set(this,()=>{}),z1.set(this,{}),i2.set(this,!1),r4.set(this,!1),s4.set(this,!1),m1.set(this,!1),a4.set(this,void 0),o4.set(this,void 0),n2.set(this,void 0),t4.set(this,(X)=>{if(_(this,r4,!0,"f"),Z1(X))X=new B0;if(X instanceof B0)return _(this,s4,!0,"f"),this._emit("abort",X);if(X instanceof S)return this._emit("error",X);if(X instanceof Error){let z=new S(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new S(String(X)))}),_(this,c2,new Promise((X,z)=>{_(this,i4,X,"f"),_(this,d2,z,"f")}),"f"),_(this,l2,new Promise((X,z)=>{_(this,n4,X,"f"),_(this,p2,z,"f")}),"f"),N(this,c2,"f").catch(()=>{}),N(this,l2,"f").catch(()=>{}),_(this,x$,$,"f"),_(this,n2,Z?.logger??console,"f")}get response(){return N(this,a4,"f")}get request_id(){return N(this,o4,"f")}async withResponse(){_(this,m1,!0,"f");let $=await N(this,c2,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new r2(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new r2(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return _(J,x$,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},N(this,t4,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal,J;if(z){if(z.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),z.addEventListener("abort",J)}try{N(this,y0,"m",hZ).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let W of Y)N(this,y0,"m",uZ).call(this,W);if(Y.controller.signal?.aborted)throw new B0;N(this,y0,"m",mZ).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;_(this,a4,$,"f"),_(this,o4,$?.headers.get("request-id"),"f"),N(this,i4,"f").call(this,$),this._emit("connect")}get ended(){return N(this,i2,"f")}get errored(){return N(this,r4,"f")}get aborted(){return N(this,s4,"f")}abort(){this.controller.abort()}on($,Z){return(N(this,z1,"f")[$]||(N(this,z1,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=N(this,z1,"f")[$];if(!X)return this;let z=X.findIndex((J)=>J.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(N(this,z1,"f")[$]||(N(this,z1,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(_(this,m1,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){_(this,m1,!0,"f"),await N(this,l2,"f")}get currentMessage(){return N(this,A1,"f")}async finalMessage(){return await this.done(),N(this,y0,"m",vZ).call(this)}async finalText(){return await this.done(),N(this,y0,"m",lJ).call(this)}_emit($,...Z){if(N(this,i2,"f"))return;if($==="end")_(this,i2,!0,"f"),N(this,n4,"f").call(this);let X=N(this,z1,"f")[$];if(X)N(this,z1,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!N(this,m1,"f")&&!X?.length)Promise.reject(z);N(this,d2,"f").call(this,z),N(this,p2,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!N(this,m1,"f")&&!X?.length)Promise.reject(z);N(this,d2,"f").call(this,z),N(this,p2,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",N(this,y0,"m",vZ).call(this))}async _fromReadableStream($,Z){let X=Z?.signal,z;if(X){if(X.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),X.addEventListener("abort",z)}try{N(this,y0,"m",hZ).call(this),this._connected(null);let J=E0.fromReadableStream($,this.controller);for await(let Q of J)N(this,y0,"m",uZ).call(this,Q);if(J.controller.signal?.aborted)throw new B0;N(this,y0,"m",mZ).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(A1=new WeakMap,x$=new WeakMap,c2=new WeakMap,i4=new WeakMap,d2=new WeakMap,l2=new WeakMap,n4=new WeakMap,p2=new WeakMap,z1=new WeakMap,i2=new WeakMap,r4=new WeakMap,s4=new WeakMap,m1=new WeakMap,a4=new WeakMap,o4=new WeakMap,n2=new WeakMap,t4=new WeakMap,y0=new WeakSet,vZ=function(){if(this.receivedMessages.length===0)throw new S("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},lJ=function(){if(this.receivedMessages.length===0)throw new S("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new S("stream ended without producing a content block with type=text");return Z.join(" ")},hZ=function(){if(this.ended)return;_(this,A1,void 0,"f")},uZ=function(Z){if(this.ended)return;let X=N(this,y0,"m",pJ).call(this,Z);switch(this._emit("streamEvent",Z,X),Z.type){case"content_block_delta":{let z=X.content.at(-1);switch(Z.delta.type){case"text_delta":{if(z.type==="text")this._emit("text",Z.delta.text,z.text||"");break}case"citations_delta":{if(z.type==="text")this._emit("citation",Z.delta.citation,z.citations??[]);break}case"input_json_delta":{if(nJ(z)&&z.input)this._emit("inputJson",Z.delta.partial_json,z.input);break}case"thinking_delta":{if(z.type==="thinking")this._emit("thinking",Z.delta.thinking,z.thinking);break}case"signature_delta":{if(z.type==="thinking")this._emit("signature",z.signature);break}case"compaction_delta":{if(z.type==="compaction"&&z.content)this._emit("compaction",z.content);break}default:rJ(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(bZ(X,N(this,x$,"f"),{logger:N(this,n2,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{_(this,A1,X,"f");break}case"content_block_start":case"message_delta":break}},mZ=function(){if(this.ended)throw new S("stream has ended, this shouldn't happen");let Z=N(this,A1,"f");if(!Z)throw new S("request ended without sending any chunks");return _(this,A1,void 0,"f"),bZ(Z,N(this,x$,"f"),{logger:N(this,n2,"f")})},pJ=function(Z){let X=N(this,A1,"f");if(Z.type==="message_start"){if(X)throw new S(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new S(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":if(X.container=Z.delta.container,X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,X.context_management=Z.context_management,Z.usage.input_tokens!=null)X.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)X.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)X.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)X.usage.server_tool_use=Z.usage.server_tool_use;if(Z.usage.iterations!=null)X.usage.iterations=Z.usage.iterations;return X;case"content_block_start":return X.content.push(Z.content_block),X;case"content_block_delta":{let z=X.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(z?.type==="text")X.content[Z.index]={...z,text:(z.text||"")+Z.delta.text};break}case"citations_delta":{if(z?.type==="text")X.content[Z.index]={...z,citations:[...z.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(z&&nJ(z)){let J=z[iJ]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,iJ,{value:J,enumerable:!1,writable:!0}),J)try{Q.input=p4(J)}catch(Y){let W=new S(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${J}`);N(this,t4,"f").call(this,W)}X.content[Z.index]=Q}break}case"thinking_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,thinking:z.thinking+Z.delta.thinking};break}case"signature_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,signature:Z.delta.signature};break}case"compaction_delta":{if(z?.type==="compaction")X.content[Z.index]={...z,content:(z.content||"")+Z.delta.content};break}default:rJ(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let J=Z.shift();if(J)J.resolve(z);else $.push(z)}),this.on("end",()=>{X=!0;for(let z of Z)z.resolve(void 0);Z.length=0}),this.on("abort",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((J,Q)=>Z.push({resolve:J,reject:Q})).then((J)=>J?{value:J,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new E0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var b$;var e4=g(()=>{b$=class b$ extends Error{constructor($){let Z=typeof $==="string"?$:$.map((X)=>{if(X.type==="text")return X.text;return`[${X.type}]`}).join(" ");super(Z);this.name="ToolError",this.content=$}}});var aJ=1e5,oJ=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
173
+ ${V}`)}return Y},A;var W0=y(()=>{D0();nJ=Object.freeze(Object.create(null)),A=gD(rJ)});var y2;var CZ=y(()=>{X0();o();W0();y2=class y2 extends h{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/environments?beta=true",{body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/environments/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/environments/${$}?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/environments?beta=true",s,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(A`/v1/environments/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(A`/v1/environments/${$}/archive?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});function i3($){return typeof $==="object"&&$!==null&&f2 in $}function wZ($,Z){let X=new Set;if($){for(let z of $)if(i3(z))X.add(z[f2])}if(Z)for(let z of Z){if(i3(z))X.add(z[f2]);if(Array.isArray(z.content)){for(let J of z.content)if(i3(J))X.add(J[f2])}}return Array.from(X)}function n3($,Z){let X=wZ($,Z);if(X.length===0)return{};return{"x-stainless-helper":X.join(", ")}}function sJ($){if(i3($))return{"x-stainless-helper":$[f2]};return{}}var f2;var g2=y(()=>{f2=Symbol("anthropic.sdk.stainlessHelper")});var v2;var EZ=y(()=>{X0();o();g2();E$();W0();v2=class v2 extends h{list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/files?beta=true",c0,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(A`/v1/files/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}download($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/files/${$}/content?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},X?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/files/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}upload($,Z){let{betas:X,...z}=$;return this._client.post("/v1/files?beta=true",w$({body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},sJ(z.file),Z?.headers])},this._client))}}});var h2;var SZ=y(()=>{X0();o();W0();h2=class h2 extends h{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/models/${$}?beta=true`,{...X,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/models?beta=true",c0,{query:z,...Z,headers:T([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var u2;var jZ=y(()=>{X0();o();W0();u2=class u2 extends h{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/user_profiles?beta=true",{body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/user_profiles/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/user_profiles/${$}?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/user_profiles?beta=true",s,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},X){let{betas:z}=Z??{};return this._client.post(A`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}}});var m2;var xZ=y(()=>{X0();o();W0();m2=class m2 extends h{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(A`/v1/agents/${$}/versions?beta=true`,s,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var S$;var bZ=y(()=>{xZ();xZ();X0();o();W0();S$=class S$ extends h{constructor(){super(...arguments);this.versions=new m2(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/agents?beta=true",{body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z,...J}=Z??{};return this._client.get(A`/v1/agents/${$}?beta=true`,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/agents/${$}?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/agents?beta=true",s,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(A`/v1/agents/${$}/archive?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};S$.Versions=m2});var c2;var kZ=y(()=>{X0();o();W0();c2=class c2 extends h{create($,Z,X){let{view:z,betas:J,...Q}=Z;return this._client.post(A`/v1/memory_stores/${$}/memories?beta=true`,{query:{view:z},body:Q,...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}retrieve($,Z,X){let{memory_store_id:z,betas:J,...Q}=Z;return this._client.get(A`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:Q,...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{memory_store_id:z,view:J,betas:Q,...Y}=Z;return this._client.post(A`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:{view:J},body:Y,...X,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(A`/v1/memory_stores/${$}/memories?beta=true`,s,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}delete($,Z,X){let{memory_store_id:z,expected_content_sha256:J,betas:Q}=Z;return this._client.delete(A`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:{expected_content_sha256:J},...X,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var d2;var yZ=y(()=>{X0();o();W0();d2=class d2 extends h{retrieve($,Z,X){let{memory_store_id:z,betas:J,...Q}=Z;return this._client.get(A`/v1/memory_stores/${z}/memory_versions/${$}?beta=true`,{query:Q,...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(A`/v1/memory_stores/${$}/memory_versions?beta=true`,s,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}redact($,Z,X){let{memory_store_id:z,betas:J}=Z;return this._client.post(A`/v1/memory_stores/${z}/memory_versions/${$}/redact?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var m1;var fZ=y(()=>{kZ();kZ();yZ();yZ();X0();o();W0();m1=class m1 extends h{constructor(){super(...arguments);this.memories=new c2(this._client),this.memoryVersions=new d2(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/memory_stores?beta=true",{body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/memory_stores/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/memory_stores/${$}?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/memory_stores?beta=true",s,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(A`/v1/memory_stores/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(A`/v1/memory_stores/${$}/archive?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};m1.Memories=c2;m1.MemoryVersions=d2});var j$=y(()=>{D0()});var r3;var gZ=y(()=>{r3={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192}});function aJ($){return $?.output_format??$?.output_config?.format}function vZ($,Z,X){let z=aJ(Z);if(!Z||!("parse"in(z??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text"){let Q=Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(Q,"parsed",{get(){return X.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return J}),parsed_output:null};return hZ($,Z,X)}function hZ($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=nD(Z,Q.text);if(z===null)z=Y;let W=Object.defineProperty({...Q},"parsed_output",{value:Y,enumerable:!1});return Object.defineProperty(W,"parsed",{get(){return X.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),Y},enumerable:!1})}return Q});return{...$,content:J,parsed_output:z}}function nD($,Z){let X=aJ($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new j(`Failed to parse structured output: ${z}`)}}var uZ=y(()=>{D0()});var rD=($)=>{let Z=0,X=[];while(Z<$.length){let z=$[Z];if(z==="\\"){Z++;continue}if(z==="{"){X.push({type:"brace",value:"{"}),Z++;continue}if(z==="}"){X.push({type:"brace",value:"}"}),Z++;continue}if(z==="["){X.push({type:"paren",value:"["}),Z++;continue}if(z==="]"){X.push({type:"paren",value:"]"}),Z++;continue}if(z===":"){X.push({type:"separator",value:":"}),Z++;continue}if(z===","){X.push({type:"delimiter",value:","}),Z++;continue}if(z==='"'){let W="",U=!1;z=$[++Z];while(z!=='"'){if(Z===$.length){U=!0;break}if(z==="\\"){if(Z++,Z===$.length){U=!0;break}W+=z+$[Z],z=$[++Z]}else W+=z,z=$[++Z]}if(z=$[++Z],!U)X.push({type:"string",value:W});continue}if(z&&/\s/.test(z)){Z++;continue}let Q=/[0-9]/;if(z&&Q.test(z)||z==="-"||z==="."){let W="";if(z==="-")W+=z,z=$[++Z];while(z&&Q.test(z)||z===".")W+=z,z=$[++Z];X.push({type:"number",value:W});continue}let Y=/[a-z]/i;if(z&&Y.test(z)){let W="";while(z&&Y.test(z)){if(Z===$.length)break;W+=z,z=$[++Z]}if(W=="true"||W=="false"||W==="null")X.push({type:"name",value:W});else{Z++;continue}continue}Z++}return X},x$=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),x$($);break;case"number":let X=Z.value[Z.value.length-1];if(X==="."||X==="-")return $=$.slice(0,$.length-1),x$($);case"string":let z=$[$.length-2];if(z?.type==="delimiter")return $=$.slice(0,$.length-1),x$($);else if(z?.type==="brace"&&z.value==="{")return $=$.slice(0,$.length-1),x$($);break;case"delimiter":return $=$.slice(0,$.length-1),x$($);break}return $},sD=($)=>{let Z=[];if($.map((X)=>{if(X.type==="brace")if(X.value==="{")Z.push("}");else Z.splice(Z.lastIndexOf("}"),1);if(X.type==="paren")if(X.value==="[")Z.push("]");else Z.splice(Z.lastIndexOf("]"),1)}),Z.length>0)Z.reverse().map((X)=>{if(X==="}")$.push({type:"brace",value:"}"});else if(X==="]")$.push({type:"paren",value:"]"})});return $},aD=($)=>{let Z="";return $.map((X)=>{switch(X.type){case"string":Z+='"'+X.value+'"';break;default:Z+=X.value;break}}),Z},s3=($)=>JSON.parse(aD(sD(x$(rD($)))));var mZ=()=>{};var cZ=y(()=>{NZ()});function $Q($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function ZQ($){}var y0,A1,b$,l2,a3,p2,i2,o3,n2,z1,r2,t3,e3,c1,$8,Z8,s2,dZ,oJ,X8,lZ,pZ,iZ,tJ,eJ="__json_buf",a2;var XQ=y(()=>{$1();mZ();j$();cZ();uZ();a2=class a2{constructor($,Z){y0.add(this),this.messages=[],this.receivedMessages=[],A1.set(this,void 0),b$.set(this,null),this.controller=new AbortController,l2.set(this,void 0),a3.set(this,()=>{}),p2.set(this,()=>{}),i2.set(this,void 0),o3.set(this,()=>{}),n2.set(this,()=>{}),z1.set(this,{}),r2.set(this,!1),t3.set(this,!1),e3.set(this,!1),c1.set(this,!1),$8.set(this,void 0),Z8.set(this,void 0),s2.set(this,void 0),X8.set(this,(X)=>{if(F(this,t3,!0,"f"),Z1(X))X=new L0;if(X instanceof L0)return F(this,e3,!0,"f"),this._emit("abort",X);if(X instanceof j)return this._emit("error",X);if(X instanceof Error){let z=new j(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new j(String(X)))}),F(this,l2,new Promise((X,z)=>{F(this,a3,X,"f"),F(this,p2,z,"f")}),"f"),F(this,i2,new Promise((X,z)=>{F(this,o3,X,"f"),F(this,n2,z,"f")}),"f"),M(this,l2,"f").catch(()=>{}),M(this,i2,"f").catch(()=>{}),F(this,b$,$,"f"),F(this,s2,Z?.logger??console,"f")}get response(){return M(this,$8,"f")}get request_id(){return M(this,Z8,"f")}async withResponse(){F(this,c1,!0,"f");let $=await M(this,l2,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new a2(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new a2(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return F(J,b$,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},M(this,X8,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal,J;if(z){if(z.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),z.addEventListener("abort",J)}try{M(this,y0,"m",lZ).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let W of Y)M(this,y0,"m",pZ).call(this,W);if(Y.controller.signal?.aborted)throw new L0;M(this,y0,"m",iZ).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;F(this,$8,$,"f"),F(this,Z8,$?.headers.get("request-id"),"f"),M(this,a3,"f").call(this,$),this._emit("connect")}get ended(){return M(this,r2,"f")}get errored(){return M(this,t3,"f")}get aborted(){return M(this,e3,"f")}abort(){this.controller.abort()}on($,Z){return(M(this,z1,"f")[$]||(M(this,z1,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=M(this,z1,"f")[$];if(!X)return this;let z=X.findIndex((J)=>J.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(M(this,z1,"f")[$]||(M(this,z1,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(F(this,c1,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){F(this,c1,!0,"f"),await M(this,i2,"f")}get currentMessage(){return M(this,A1,"f")}async finalMessage(){return await this.done(),M(this,y0,"m",dZ).call(this)}async finalText(){return await this.done(),M(this,y0,"m",oJ).call(this)}_emit($,...Z){if(M(this,r2,"f"))return;if($==="end")F(this,r2,!0,"f"),M(this,o3,"f").call(this);let X=M(this,z1,"f")[$];if(X)M(this,z1,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!M(this,c1,"f")&&!X?.length)Promise.reject(z);M(this,p2,"f").call(this,z),M(this,n2,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!M(this,c1,"f")&&!X?.length)Promise.reject(z);M(this,p2,"f").call(this,z),M(this,n2,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",M(this,y0,"m",dZ).call(this))}async _fromReadableStream($,Z){let X=Z?.signal,z;if(X){if(X.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),X.addEventListener("abort",z)}try{M(this,y0,"m",lZ).call(this),this._connected(null);let J=E0.fromReadableStream($,this.controller);for await(let Q of J)M(this,y0,"m",pZ).call(this,Q);if(J.controller.signal?.aborted)throw new L0;M(this,y0,"m",iZ).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(A1=new WeakMap,b$=new WeakMap,l2=new WeakMap,a3=new WeakMap,p2=new WeakMap,i2=new WeakMap,o3=new WeakMap,n2=new WeakMap,z1=new WeakMap,r2=new WeakMap,t3=new WeakMap,e3=new WeakMap,c1=new WeakMap,$8=new WeakMap,Z8=new WeakMap,s2=new WeakMap,X8=new WeakMap,y0=new WeakSet,dZ=function(){if(this.receivedMessages.length===0)throw new j("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},oJ=function(){if(this.receivedMessages.length===0)throw new j("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new j("stream ended without producing a content block with type=text");return Z.join(" ")},lZ=function(){if(this.ended)return;F(this,A1,void 0,"f")},pZ=function(Z){if(this.ended)return;let X=M(this,y0,"m",tJ).call(this,Z);switch(this._emit("streamEvent",Z,X),Z.type){case"content_block_delta":{let z=X.content.at(-1);switch(Z.delta.type){case"text_delta":{if(z.type==="text")this._emit("text",Z.delta.text,z.text||"");break}case"citations_delta":{if(z.type==="text")this._emit("citation",Z.delta.citation,z.citations??[]);break}case"input_json_delta":{if($Q(z)&&z.input)this._emit("inputJson",Z.delta.partial_json,z.input);break}case"thinking_delta":{if(z.type==="thinking")this._emit("thinking",Z.delta.thinking,z.thinking);break}case"signature_delta":{if(z.type==="thinking")this._emit("signature",z.signature);break}case"compaction_delta":{if(z.type==="compaction"&&z.content)this._emit("compaction",z.content);break}default:ZQ(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(vZ(X,M(this,b$,"f"),{logger:M(this,s2,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{F(this,A1,X,"f");break}case"content_block_start":case"message_delta":break}},iZ=function(){if(this.ended)throw new j("stream has ended, this shouldn't happen");let Z=M(this,A1,"f");if(!Z)throw new j("request ended without sending any chunks");return F(this,A1,void 0,"f"),vZ(Z,M(this,b$,"f"),{logger:M(this,s2,"f")})},tJ=function(Z){let X=M(this,A1,"f");if(Z.type==="message_start"){if(X)throw new j(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new j(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":if(X.container=Z.delta.container,X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,X.context_management=Z.context_management,Z.usage.input_tokens!=null)X.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)X.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)X.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)X.usage.server_tool_use=Z.usage.server_tool_use;if(Z.usage.iterations!=null)X.usage.iterations=Z.usage.iterations;return X;case"content_block_start":return X.content.push(Z.content_block),X;case"content_block_delta":{let z=X.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(z?.type==="text")X.content[Z.index]={...z,text:(z.text||"")+Z.delta.text};break}case"citations_delta":{if(z?.type==="text")X.content[Z.index]={...z,citations:[...z.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(z&&$Q(z)){let J=z[eJ]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,eJ,{value:J,enumerable:!1,writable:!0}),J)try{Q.input=s3(J)}catch(Y){let W=new j(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${J}`);M(this,X8,"f").call(this,W)}X.content[Z.index]=Q}break}case"thinking_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,thinking:z.thinking+Z.delta.thinking};break}case"signature_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,signature:Z.delta.signature};break}case"compaction_delta":{if(z?.type==="compaction")X.content[Z.index]={...z,content:(z.content||"")+Z.delta.content};break}default:ZQ(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let J=Z.shift();if(J)J.resolve(z);else $.push(z)}),this.on("end",()=>{X=!0;for(let z of Z)z.resolve(void 0);Z.length=0}),this.on("abort",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((J,Q)=>Z.push({resolve:J,reject:Q})).then((J)=>J?{value:J,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new E0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var k$;var z8=y(()=>{k$=class k$ extends Error{constructor($){let Z=typeof $==="string"?$:$.map((X)=>{if(X.type==="text")return X.text;return`[${X.type}]`}).join(" ");super(Z);this.name="ToolError",this.content=$}}});var zQ=1e5,JQ=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
174
174
  1. Task Overview
175
175
  The user's core request and success criteria
176
176
  Any clarifications or constraints they specified
@@ -192,67 +192,67 @@ User preferences or style requirements
192
192
  Domain-specific details that aren't obvious
193
193
  Any promises made to the user
194
194
  Be concise but complete—err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.
195
- Wrap your summary in <summary></summary> tags.`;function eJ(){let $,Z;return{promise:new Promise((z,J)=>{$=z,Z=J}),resolve:$,reject:Z}}async function ED($,Z=$.messages.at(-1),X){if(!Z||Z.role!=="assistant"||!Z.content||typeof Z.content==="string")return null;let z=Z.content.filter((Q)=>Q.type==="tool_use");if(z.length===0)return null;return{role:"user",content:await Promise.all(z.map(async(Q)=>{let Y=$.tools.find((W)=>("name"in W?W.name:W.mcp_server_name)===Q.name);if(!Y||!("run"in Y))return{type:"tool_result",tool_use_id:Q.id,content:`Error: Tool '${Q.name}' not found`,is_error:!0};try{let W=Q.input;if("parse"in Y&&Y.parse)W=Y.parse(W);let U=await Y.run(W,{toolUseBlock:Q,signal:X?.signal});return{type:"tool_result",tool_use_id:Q.id,content:U}}catch(W){return{type:"tool_result",tool_use_id:Q.id,content:W instanceof b$?W.content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}var s2,k$,c1,q0,D0,j0,J1,R1,a2,tJ,cZ,o2;var dZ=g(()=>{$1();e4();T0();a();y2();o2=class o2{constructor($,Z,X){s2.add(this),this.client=$,k$.set(this,!1),c1.set(this,!1),q0.set(this,void 0),D0.set(this,void 0),j0.set(this,void 0),J1.set(this,void 0),R1.set(this,void 0),a2.set(this,0),_(this,q0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let J=["BetaToolRunner",...RZ(Z.tools,Z.messages)].join(", ");if(_(this,D0,{...X,headers:T([{"x-stainless-helper":J},X?.headers])},"f"),_(this,R1,eJ(),"f"),Z.compactionControl?.enabled)console.warn('Anthropic: The `compactionControl` parameter is deprecated and will be removed in a future version. Use server-side compaction instead by passing `edits: [{ type: "compact_20260112" }]` in the params passed to `toolRunner()`. See https://platform.claude.com/docs/en/build-with-claude/compaction')}async*[(k$=new WeakMap,c1=new WeakMap,q0=new WeakMap,D0=new WeakMap,j0=new WeakMap,J1=new WeakMap,R1=new WeakMap,a2=new WeakMap,s2=new WeakSet,tJ=async function(){let Z=N(this,q0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let X=0;if(N(this,j0,"f")!==void 0)try{let U=await N(this,j0,"f");X=U.usage.input_tokens+(U.usage.cache_creation_input_tokens??0)+(U.usage.cache_read_input_tokens??0)+U.usage.output_tokens}catch{return!1}let z=Z.contextTokenThreshold??aJ;if(X<z)return!1;let J=Z.model??N(this,q0,"f").params.model,Q=Z.summaryPrompt??oJ,Y=N(this,q0,"f").params.messages;if(Y[Y.length-1].role==="assistant"){let U=Y[Y.length-1];if(Array.isArray(U.content)){let G=U.content.filter((q)=>q.type!=="tool_use");if(G.length===0)Y.pop();else U.content=G}}let W=await this.client.beta.messages.create({model:J,messages:[...Y,{role:"user",content:[{type:"text",text:Q}]}],max_tokens:N(this,q0,"f").params.max_tokens},{signal:N(this,D0,"f").signal,headers:T([N(this,D0,"f").headers,{"x-stainless-helper":"compaction"}])});if(W.content[0]?.type!=="text")throw new S("Expected text response for compaction");return N(this,q0,"f").params.messages=[{role:"user",content:W.content}],!0},Symbol.asyncIterator)](){var $;if(N(this,k$,"f"))throw new S("Cannot iterate over a consumed stream");_(this,k$,!0,"f"),_(this,c1,!0,"f"),_(this,J1,void 0,"f");try{while(!0){let Z;try{if(N(this,q0,"f").params.max_iterations&&N(this,a2,"f")>=N(this,q0,"f").params.max_iterations)break;_(this,c1,!1,"f"),_(this,J1,void 0,"f"),_(this,a2,($=N(this,a2,"f"),$++,$),"f"),_(this,j0,void 0,"f");let{max_iterations:X,compactionControl:z,...J}=N(this,q0,"f").params;if(J.stream)Z=this.client.beta.messages.stream({...J},N(this,D0,"f")),_(this,j0,Z.finalMessage(),"f"),N(this,j0,"f").catch(()=>{}),yield Z;else _(this,j0,this.client.beta.messages.create({...J,stream:!1},N(this,D0,"f")),"f"),yield N(this,j0,"f");if(!await N(this,s2,"m",tJ).call(this)){if(!N(this,c1,"f")){let{role:W,content:U}=await N(this,j0,"f");N(this,q0,"f").params.messages.push({role:W,content:U})}let Y=await N(this,s2,"m",cZ).call(this,N(this,q0,"f").params.messages.at(-1));if(Y)N(this,q0,"f").params.messages.push(Y);else if(!N(this,c1,"f"))break}}finally{if(Z)Z.abort()}}if(!N(this,j0,"f"))throw new S("ToolRunner concluded without a message from the server");N(this,R1,"f").resolve(await N(this,j0,"f"))}catch(Z){throw _(this,k$,!1,"f"),N(this,R1,"f").promise.catch(()=>{}),N(this,R1,"f").reject(Z),_(this,R1,eJ(),"f"),Z}}setMessagesParams($){if(typeof $==="function")N(this,q0,"f").params=$(N(this,q0,"f").params);else N(this,q0,"f").params=$;_(this,c1,!0,"f"),_(this,J1,void 0,"f")}setRequestOptions($){if(typeof $==="function")_(this,D0,$(N(this,D0,"f")),"f");else _(this,D0,{...N(this,D0,"f"),...$},"f")}async generateToolResponse($=N(this,D0,"f").signal){let Z=await N(this,j0,"f")??this.params.messages.at(-1);if(!Z)return null;return N(this,s2,"m",cZ).call(this,Z,$)}done(){return N(this,R1,"f").promise}async runUntilDone(){if(!N(this,k$,"f"))for await(let $ of this);return this.done()}get params(){return N(this,q0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};cZ=async function(Z,X=N(this,D0,"f").signal){if(N(this,J1,"f")!==void 0)return N(this,J1,"f");return _(this,J1,ED(N(this,q0,"f").params,Z,{...N(this,D0,"f"),signal:X}),"f"),N(this,J1,"f")}});var y$;var lZ=g(()=>{T0();VZ();y$=class y${constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new D1;for await(let Z of this.iterator)for(let X of $.decode(Z))yield JSON.parse(X);for(let Z of $.flush())yield JSON.parse(Z)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new S("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new S("Attempted to iterate over a response with no body")}return new y$(_2($.body),Z)}}});var t2;var pZ=g(()=>{Z0();a();lZ();j$();Y0();t2=class t2 extends u{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/messages/batches?beta=true",{body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/messages/batches/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",c0,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(A`/v1/messages/batches/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}cancel($,Z={},X){let{betas:z}=Z??{};return this._client.post(A`/v1/messages/batches/${$}/cancel?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}async results($,Z={},X){let z=await this.retrieve($);if(!z.results_url)throw new S(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);let{betas:J}=Z??{};return this._client.get(z.results_url,{...X,headers:T([{"anthropic-beta":[...J??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},X?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,Y)=>y$.fromResponse(Y.response,Y.controller))}}});function ZQ($){if(!$.output_format)return $;if($.output_config?.format)throw new S("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...X}=$;return{...X,output_config:{...$.output_config,format:Z}}}var $Q,SD,F1;var iZ=g(()=>{j$();xZ();a();y2();yZ();sJ();dZ();e4();pZ();pZ();dZ();e4();$Q={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026"},SD=["claude-mythos-preview","claude-opus-4-6"];F1=class F1 extends u{constructor(){super(...arguments);this.batches=new t2(this._client)}create($,Z){let X=ZQ($),{betas:z,...J}=X;if(J.model in $Q)console.warn(`The model '${J.model}' is deprecated and will reach end-of-life on ${$Q[J.model]}
196
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(SD.includes(J.model)&&J.thinking&&J.thinking.type==="enabled")console.warn(`Using Claude with ${J.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let Q=this._client._options.timeout;if(!J.stream&&Q==null){let W=l4[J.model]??void 0;Q=this._client.calculateNonstreamingTimeout(J.max_tokens,W)}let Y=d4(J.tools,J.messages);return this._client.post("/v1/messages?beta=true",{body:J,timeout:Q??600000,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Y,Z?.headers]),stream:X.stream??!1})}parse($,Z){return Z={...Z,headers:T([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((X)=>kZ(X,$,{logger:this._client.logger??console}))}stream($,Z){return r2.createMessage(this,$,Z)}countTokens($,Z){let X=ZQ($),{betas:z,...J}=X;return this._client.post("/v1/messages/count_tokens?beta=true",{body:J,...Z,headers:T([{"anthropic-beta":[...z??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new o2(this._client,$,Z)}};F1.Batches=t2;F1.BetaToolRunner=o2;F1.ToolError=b$});var e2;var nZ=g(()=>{Z0();a();Y0();e2=class e2 extends u{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(A`/v1/sessions/${$}/events?beta=true`,r,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}send($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/sessions/${$}/events?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}stream($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/sessions/${$}/events/stream?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers]),stream:!0})}}});var $3;var rZ=g(()=>{Z0();a();Y0();$3=class $3 extends u{retrieve($,Z,X){let{session_id:z,betas:J}=Z;return this._client.get(A`/v1/sessions/${z}/resources/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{session_id:z,betas:J,...Q}=Z;return this._client.post(A`/v1/sessions/${z}/resources/${$}?beta=true`,{body:Q,...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(A`/v1/sessions/${$}/resources?beta=true`,r,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}delete($,Z,X){let{session_id:z,betas:J}=Z;return this._client.delete(A`/v1/sessions/${z}/resources/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}add($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/sessions/${$}/resources?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var d1;var sZ=g(()=>{nZ();nZ();rZ();rZ();Z0();a();Y0();d1=class d1 extends u{constructor(){super(...arguments);this.events=new e2(this._client),this.resources=new $3(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/sessions?beta=true",{body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/sessions/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/sessions/${$}?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/sessions?beta=true",r,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(A`/v1/sessions/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(A`/v1/sessions/${$}/archive?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};d1.Events=e2;d1.Resources=$3});var Z3;var aZ=g(()=>{Z0();a();C$();Y0();Z3=class Z3 extends u{create($,Z={},X){let{betas:z,...J}=Z??{};return this._client.post(A`/v1/skills/${$}/versions?beta=true`,w$({body:J,...X,headers:T([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])},this._client))}retrieve($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.get(A`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(A`/v1/skills/${$}/versions?beta=true`,r,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}delete($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.delete(A`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}}});var f$;var oZ=g(()=>{aZ();aZ();Z0();a();C$();Y0();f$=class f$ extends u{constructor(){super(...arguments);this.versions=new Z3(this._client)}create($={},Z){let{betas:X,...z}=$??{};return this._client.post("/v1/skills?beta=true",w$({body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/skills/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/skills?beta=true",r,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(A`/v1/skills/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}};f$.Versions=Z3});var X3;var tZ=g(()=>{Z0();a();Y0();X3=class X3 extends u{create($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/vaults/${$}/credentials?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}retrieve($,Z,X){let{vault_id:z,betas:J}=Z;return this._client.get(A`/v1/vaults/${z}/credentials/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{vault_id:z,betas:J,...Q}=Z;return this._client.post(A`/v1/vaults/${z}/credentials/${$}?beta=true`,{body:Q,...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(A`/v1/vaults/${$}/credentials?beta=true`,r,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}delete($,Z,X){let{vault_id:z,betas:J}=Z;return this._client.delete(A`/v1/vaults/${z}/credentials/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z,X){let{vault_id:z,betas:J}=Z;return this._client.post(A`/v1/vaults/${z}/credentials/${$}/archive?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var g$;var eZ=g(()=>{tZ();tZ();Z0();a();Y0();g$=class g$ extends u{constructor(){super(...arguments);this.credentials=new X3(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/vaults?beta=true",{body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/vaults/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/vaults/${$}?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/vaults?beta=true",r,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(A`/v1/vaults/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(A`/v1/vaults/${$}/archive?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};g$.Credentials=X3});var N0;var $5=g(()=>{AZ();AZ();FZ();FZ();_Z();_Z();PZ();PZ();CZ();CZ();SZ();SZ();iZ();iZ();sZ();sZ();oZ();oZ();eZ();eZ();N0=class N0 extends u{constructor(){super(...arguments);this.models=new g2(this._client),this.messages=new F1(this._client),this.agents=new E$(this._client),this.environments=new b2(this._client),this.sessions=new d1(this._client),this.vaults=new g$(this._client),this.memoryStores=new u1(this._client),this.files=new f2(this._client),this.skills=new f$(this._client),this.userProfiles=new v2(this._client)}};N0.Models=g2;N0.Messages=F1;N0.Agents=E$;N0.Environments=b2;N0.Sessions=d1;N0.Vaults=g$;N0.MemoryStores=u1;N0.Files=f2;N0.Skills=f$;N0.UserProfiles=v2});var v$;var Z5=g(()=>{a();v$=class v$ extends u{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/complete",{body:z,timeout:this._client._options.timeout??600000,...Z,headers:T([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function XQ($){return $?.output_config?.format}function X5($,Z,X){let z=XQ(Z);if(!Z||!("parse"in(z??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text")return Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return J}),parsed_output:null};return z5($,Z,X)}function z5($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=uD(Z,Q.text);if(z===null)z=Y;return Object.defineProperty({...Q},"parsed_output",{value:Y,enumerable:!1})}return Q});return{...$,content:J,parsed_output:z}}function uD($,Z){let X=XQ($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new S(`Failed to parse structured output: ${z}`)}}var J5=g(()=>{T0()});function YQ($){return $.type==="tool_use"||$.type==="server_tool_use"}function WQ($){}var f0,_1,h$,z3,$8,J3,Q3,Z8,Y3,Q1,W3,X8,z8,l1,J8,Q8,U3,Q5,zQ,Y5,W5,U5,G5,JQ,QQ="__json_buf",G3;var UQ=g(()=>{$1();j$();gZ();fZ();J5();G3=class G3{constructor($,Z){f0.add(this),this.messages=[],this.receivedMessages=[],_1.set(this,void 0),h$.set(this,null),this.controller=new AbortController,z3.set(this,void 0),$8.set(this,()=>{}),J3.set(this,()=>{}),Q3.set(this,void 0),Z8.set(this,()=>{}),Y3.set(this,()=>{}),Q1.set(this,{}),W3.set(this,!1),X8.set(this,!1),z8.set(this,!1),l1.set(this,!1),J8.set(this,void 0),Q8.set(this,void 0),U3.set(this,void 0),Y5.set(this,(X)=>{if(_(this,X8,!0,"f"),Z1(X))X=new B0;if(X instanceof B0)return _(this,z8,!0,"f"),this._emit("abort",X);if(X instanceof S)return this._emit("error",X);if(X instanceof Error){let z=new S(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new S(String(X)))}),_(this,z3,new Promise((X,z)=>{_(this,$8,X,"f"),_(this,J3,z,"f")}),"f"),_(this,Q3,new Promise((X,z)=>{_(this,Z8,X,"f"),_(this,Y3,z,"f")}),"f"),N(this,z3,"f").catch(()=>{}),N(this,Q3,"f").catch(()=>{}),_(this,h$,$,"f"),_(this,U3,Z?.logger??console,"f")}get response(){return N(this,J8,"f")}get request_id(){return N(this,Q8,"f")}async withResponse(){_(this,l1,!0,"f");let $=await N(this,z3,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new G3(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new G3(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return _(J,h$,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},N(this,Y5,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal,J;if(z){if(z.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),z.addEventListener("abort",J)}try{N(this,f0,"m",W5).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let W of Y)N(this,f0,"m",U5).call(this,W);if(Y.controller.signal?.aborted)throw new B0;N(this,f0,"m",G5).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;_(this,J8,$,"f"),_(this,Q8,$?.headers.get("request-id"),"f"),N(this,$8,"f").call(this,$),this._emit("connect")}get ended(){return N(this,W3,"f")}get errored(){return N(this,X8,"f")}get aborted(){return N(this,z8,"f")}abort(){this.controller.abort()}on($,Z){return(N(this,Q1,"f")[$]||(N(this,Q1,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=N(this,Q1,"f")[$];if(!X)return this;let z=X.findIndex((J)=>J.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(N(this,Q1,"f")[$]||(N(this,Q1,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(_(this,l1,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){_(this,l1,!0,"f"),await N(this,Q3,"f")}get currentMessage(){return N(this,_1,"f")}async finalMessage(){return await this.done(),N(this,f0,"m",Q5).call(this)}async finalText(){return await this.done(),N(this,f0,"m",zQ).call(this)}_emit($,...Z){if(N(this,W3,"f"))return;if($==="end")_(this,W3,!0,"f"),N(this,Z8,"f").call(this);let X=N(this,Q1,"f")[$];if(X)N(this,Q1,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!N(this,l1,"f")&&!X?.length)Promise.reject(z);N(this,J3,"f").call(this,z),N(this,Y3,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!N(this,l1,"f")&&!X?.length)Promise.reject(z);N(this,J3,"f").call(this,z),N(this,Y3,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",N(this,f0,"m",Q5).call(this))}async _fromReadableStream($,Z){let X=Z?.signal,z;if(X){if(X.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),X.addEventListener("abort",z)}try{N(this,f0,"m",W5).call(this),this._connected(null);let J=E0.fromReadableStream($,this.controller);for await(let Q of J)N(this,f0,"m",U5).call(this,Q);if(J.controller.signal?.aborted)throw new B0;N(this,f0,"m",G5).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(_1=new WeakMap,h$=new WeakMap,z3=new WeakMap,$8=new WeakMap,J3=new WeakMap,Q3=new WeakMap,Z8=new WeakMap,Y3=new WeakMap,Q1=new WeakMap,W3=new WeakMap,X8=new WeakMap,z8=new WeakMap,l1=new WeakMap,J8=new WeakMap,Q8=new WeakMap,U3=new WeakMap,Y5=new WeakMap,f0=new WeakSet,Q5=function(){if(this.receivedMessages.length===0)throw new S("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},zQ=function(){if(this.receivedMessages.length===0)throw new S("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new S("stream ended without producing a content block with type=text");return Z.join(" ")},W5=function(){if(this.ended)return;_(this,_1,void 0,"f")},U5=function(Z){if(this.ended)return;let X=N(this,f0,"m",JQ).call(this,Z);switch(this._emit("streamEvent",Z,X),Z.type){case"content_block_delta":{let z=X.content.at(-1);switch(Z.delta.type){case"text_delta":{if(z.type==="text")this._emit("text",Z.delta.text,z.text||"");break}case"citations_delta":{if(z.type==="text")this._emit("citation",Z.delta.citation,z.citations??[]);break}case"input_json_delta":{if(YQ(z)&&z.input)this._emit("inputJson",Z.delta.partial_json,z.input);break}case"thinking_delta":{if(z.type==="thinking")this._emit("thinking",Z.delta.thinking,z.thinking);break}case"signature_delta":{if(z.type==="thinking")this._emit("signature",z.signature);break}default:WQ(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(X5(X,N(this,h$,"f"),{logger:N(this,U3,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{_(this,_1,X,"f");break}case"content_block_start":case"message_delta":break}},G5=function(){if(this.ended)throw new S("stream has ended, this shouldn't happen");let Z=N(this,_1,"f");if(!Z)throw new S("request ended without sending any chunks");return _(this,_1,void 0,"f"),X5(Z,N(this,h$,"f"),{logger:N(this,U3,"f")})},JQ=function(Z){let X=N(this,_1,"f");if(Z.type==="message_start"){if(X)throw new S(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new S(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":if(X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,Z.usage.input_tokens!=null)X.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)X.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)X.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)X.usage.server_tool_use=Z.usage.server_tool_use;return X;case"content_block_start":return X.content.push({...Z.content_block}),X;case"content_block_delta":{let z=X.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(z?.type==="text")X.content[Z.index]={...z,text:(z.text||"")+Z.delta.text};break}case"citations_delta":{if(z?.type==="text")X.content[Z.index]={...z,citations:[...z.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(z&&YQ(z)){let J=z[QQ]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,QQ,{value:J,enumerable:!1,writable:!0}),J)Q.input=p4(J);X.content[Z.index]=Q}break}case"thinking_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,thinking:z.thinking+Z.delta.thinking};break}case"signature_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,signature:Z.delta.signature};break}default:WQ(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let J=Z.shift();if(J)J.resolve(z);else $.push(z)}),this.on("end",()=>{X=!0;for(let z of Z)z.resolve(void 0);Z.length=0}),this.on("abort",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((J,Q)=>Z.push({resolve:J,reject:Q})).then((J)=>J?{value:J,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new E0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var q3;var q5=g(()=>{Z0();a();lZ();j$();Y0();q3=class q3 extends u{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(A`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",c0,{query:$,...Z})}delete($,Z){return this._client.delete(A`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(A`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let X=await this.retrieve($);if(!X.results_url)throw new S(`No batch \`results_url\`; Has it finished processing? ${X.processing_status} - ${X.id}`);return this._client.get(X.results_url,{...Z,headers:T([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((z,J)=>y$.fromResponse(J.response,J.controller))}}});var p1,GQ,cD;var V5=g(()=>{a();y2();UQ();J5();q5();q5();xZ();p1=class p1 extends u{constructor(){super(...arguments);this.batches=new q3(this._client)}create($,Z){if($.model in GQ)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${GQ[$.model]}
197
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(cD.includes($.model)&&$.thinking&&$.thinking.type==="enabled")console.warn(`Using Claude with ${$.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let X=this._client._options.timeout;if(!$.stream&&X==null){let J=l4[$.model]??void 0;X=this._client.calculateNonstreamingTimeout($.max_tokens,J)}let z=d4($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:X??600000,...Z,headers:T([z,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((X)=>z5(X,$,{logger:this._client.logger??console}))}stream($,Z){return G3.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};GQ={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026","claude-opus-4-0":"June 15th, 2026","claude-opus-4-20250514":"June 15th, 2026","claude-sonnet-4-0":"June 15th, 2026","claude-sonnet-4-20250514":"June 15th, 2026"},cD=["claude-mythos-preview","claude-opus-4-6"];p1.Batches=q3});var u$;var K5=g(()=>{Z0();a();Y0();u$=class u$ extends u{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/models/${$}`,{...X,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/models",c0,{query:z,...Z,headers:T([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var qQ=g(()=>{$5();Z5();V5();K5();vJ()});var V3=($)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[$]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.($)?.trim()||void 0;return};class e{constructor({baseURL:$=V3("ANTHROPIC_BASE_URL"),apiKey:Z=V3("ANTHROPIC_API_KEY")??null,authToken:X=V3("ANTHROPIC_AUTH_TOKEN")??null,...z}={}){H5.add(this),Y8.set(this,void 0);let J={apiKey:Z,authToken:X,...z,baseURL:$||"https://api.anthropic.com"};if(!J.dangerouslyAllowBrowser&&AJ())throw new S(`It looks like you're running in a browser-like environment.
195
+ Wrap your summary in <summary></summary> tags.`;function YQ(){let $,Z;return{promise:new Promise((z,J)=>{$=z,Z=J}),resolve:$,reject:Z}}async function oD($,Z=$.messages.at(-1),X){if(!Z||Z.role!=="assistant"||!Z.content||typeof Z.content==="string")return null;let z=Z.content.filter((Q)=>Q.type==="tool_use");if(z.length===0)return null;return{role:"user",content:await Promise.all(z.map(async(Q)=>{let Y=$.tools.find((W)=>("name"in W?W.name:W.mcp_server_name)===Q.name);if(!Y||!("run"in Y))return{type:"tool_result",tool_use_id:Q.id,content:`Error: Tool '${Q.name}' not found`,is_error:!0};try{let W=Q.input;if("parse"in Y&&Y.parse)W=Y.parse(W);let U=await Y.run(W,{toolUseBlock:Q,signal:X?.signal});return{type:"tool_result",tool_use_id:Q.id,content:U}}catch(W){return{type:"tool_result",tool_use_id:Q.id,content:W instanceof k$?W.content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}var o2,y$,d1,V0,I0,S0,J1,R1,t2,QQ,nZ,e2;var rZ=y(()=>{$1();z8();D0();o();g2();e2=class e2{constructor($,Z,X){o2.add(this),this.client=$,y$.set(this,!1),d1.set(this,!1),V0.set(this,void 0),I0.set(this,void 0),S0.set(this,void 0),J1.set(this,void 0),R1.set(this,void 0),t2.set(this,0),F(this,V0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let J=["BetaToolRunner",...wZ(Z.tools,Z.messages)].join(", ");if(F(this,I0,{...X,headers:T([{"x-stainless-helper":J},X?.headers])},"f"),F(this,R1,YQ(),"f"),Z.compactionControl?.enabled)console.warn('Anthropic: The `compactionControl` parameter is deprecated and will be removed in a future version. Use server-side compaction instead by passing `edits: [{ type: "compact_20260112" }]` in the params passed to `toolRunner()`. See https://platform.claude.com/docs/en/build-with-claude/compaction')}async*[(y$=new WeakMap,d1=new WeakMap,V0=new WeakMap,I0=new WeakMap,S0=new WeakMap,J1=new WeakMap,R1=new WeakMap,t2=new WeakMap,o2=new WeakSet,QQ=async function(){let Z=M(this,V0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let X=0;if(M(this,S0,"f")!==void 0)try{let U=await M(this,S0,"f");X=U.usage.input_tokens+(U.usage.cache_creation_input_tokens??0)+(U.usage.cache_read_input_tokens??0)+U.usage.output_tokens}catch{return!1}let z=Z.contextTokenThreshold??zQ;if(X<z)return!1;let J=Z.model??M(this,V0,"f").params.model,Q=Z.summaryPrompt??JQ,Y=M(this,V0,"f").params.messages;if(Y[Y.length-1].role==="assistant"){let U=Y[Y.length-1];if(Array.isArray(U.content)){let G=U.content.filter((q)=>q.type!=="tool_use");if(G.length===0)Y.pop();else U.content=G}}let W=await this.client.beta.messages.create({model:J,messages:[...Y,{role:"user",content:[{type:"text",text:Q}]}],max_tokens:M(this,V0,"f").params.max_tokens},{signal:M(this,I0,"f").signal,headers:T([M(this,I0,"f").headers,{"x-stainless-helper":"compaction"}])});if(W.content[0]?.type!=="text")throw new j("Expected text response for compaction");return M(this,V0,"f").params.messages=[{role:"user",content:W.content}],!0},Symbol.asyncIterator)](){var $;if(M(this,y$,"f"))throw new j("Cannot iterate over a consumed stream");F(this,y$,!0,"f"),F(this,d1,!0,"f"),F(this,J1,void 0,"f");try{while(!0){let Z;try{if(M(this,V0,"f").params.max_iterations&&M(this,t2,"f")>=M(this,V0,"f").params.max_iterations)break;F(this,d1,!1,"f"),F(this,J1,void 0,"f"),F(this,t2,($=M(this,t2,"f"),$++,$),"f"),F(this,S0,void 0,"f");let{max_iterations:X,compactionControl:z,...J}=M(this,V0,"f").params;if(J.stream)Z=this.client.beta.messages.stream({...J},M(this,I0,"f")),F(this,S0,Z.finalMessage(),"f"),M(this,S0,"f").catch(()=>{}),yield Z;else F(this,S0,this.client.beta.messages.create({...J,stream:!1},M(this,I0,"f")),"f"),yield M(this,S0,"f");if(!await M(this,o2,"m",QQ).call(this)){if(!M(this,d1,"f")){let{role:W,content:U}=await M(this,S0,"f");M(this,V0,"f").params.messages.push({role:W,content:U})}let Y=await M(this,o2,"m",nZ).call(this,M(this,V0,"f").params.messages.at(-1));if(Y)M(this,V0,"f").params.messages.push(Y);else if(!M(this,d1,"f"))break}}finally{if(Z)Z.abort()}}if(!M(this,S0,"f"))throw new j("ToolRunner concluded without a message from the server");M(this,R1,"f").resolve(await M(this,S0,"f"))}catch(Z){throw F(this,y$,!1,"f"),M(this,R1,"f").promise.catch(()=>{}),M(this,R1,"f").reject(Z),F(this,R1,YQ(),"f"),Z}}setMessagesParams($){if(typeof $==="function")M(this,V0,"f").params=$(M(this,V0,"f").params);else M(this,V0,"f").params=$;F(this,d1,!0,"f"),F(this,J1,void 0,"f")}setRequestOptions($){if(typeof $==="function")F(this,I0,$(M(this,I0,"f")),"f");else F(this,I0,{...M(this,I0,"f"),...$},"f")}async generateToolResponse($=M(this,I0,"f").signal){let Z=await M(this,S0,"f")??this.params.messages.at(-1);if(!Z)return null;return M(this,o2,"m",nZ).call(this,Z,$)}done(){return M(this,R1,"f").promise}async runUntilDone(){if(!M(this,y$,"f"))for await(let $ of this);return this.done()}get params(){return M(this,V0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};nZ=async function(Z,X=M(this,I0,"f").signal){if(M(this,J1,"f")!==void 0)return M(this,J1,"f");return F(this,J1,oD(M(this,V0,"f").params,Z,{...M(this,I0,"f"),signal:X}),"f"),M(this,J1,"f")}});var f$;var sZ=y(()=>{D0();MZ();f$=class f${constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new D1;for await(let Z of this.iterator)for(let X of $.decode(Z))yield JSON.parse(X);for(let Z of $.flush())yield JSON.parse(Z)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new j("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new j("Attempted to iterate over a response with no body")}return new f$(C2($.body),Z)}}});var $4;var aZ=y(()=>{X0();o();sZ();j$();W0();$4=class $4 extends h{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/messages/batches?beta=true",{body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/messages/batches/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",c0,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(A`/v1/messages/batches/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}cancel($,Z={},X){let{betas:z}=Z??{};return this._client.post(A`/v1/messages/batches/${$}/cancel?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}async results($,Z={},X){let z=await this.retrieve($);if(!z.results_url)throw new j(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);let{betas:J}=Z??{};return this._client.get(z.results_url,{...X,headers:T([{"anthropic-beta":[...J??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},X?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,Y)=>f$.fromResponse(Y.response,Y.controller))}}});function UQ($){if(!$.output_format)return $;if($.output_config?.format)throw new j("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...X}=$;return{...X,output_config:{...$.output_config,format:Z}}}var WQ,eD,_1;var oZ=y(()=>{j$();gZ();o();g2();uZ();XQ();rZ();z8();aZ();aZ();rZ();z8();WQ={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026"},eD=["claude-mythos-preview","claude-opus-4-6"];_1=class _1 extends h{constructor(){super(...arguments);this.batches=new $4(this._client)}create($,Z){let X=UQ($),{betas:z,...J}=X;if(J.model in WQ)console.warn(`The model '${J.model}' is deprecated and will reach end-of-life on ${WQ[J.model]}
196
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(eD.includes(J.model)&&J.thinking&&J.thinking.type==="enabled")console.warn(`Using Claude with ${J.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let Q=this._client._options.timeout;if(!J.stream&&Q==null){let W=r3[J.model]??void 0;Q=this._client.calculateNonstreamingTimeout(J.max_tokens,W)}let Y=n3(J.tools,J.messages);return this._client.post("/v1/messages?beta=true",{body:J,timeout:Q??600000,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Y,Z?.headers]),stream:X.stream??!1})}parse($,Z){return Z={...Z,headers:T([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((X)=>hZ(X,$,{logger:this._client.logger??console}))}stream($,Z){return a2.createMessage(this,$,Z)}countTokens($,Z){let X=UQ($),{betas:z,...J}=X;return this._client.post("/v1/messages/count_tokens?beta=true",{body:J,...Z,headers:T([{"anthropic-beta":[...z??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new e2(this._client,$,Z)}};_1.Batches=$4;_1.BetaToolRunner=e2;_1.ToolError=k$});var Z4;var tZ=y(()=>{X0();o();W0();Z4=class Z4 extends h{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(A`/v1/sessions/${$}/events?beta=true`,s,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}send($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/sessions/${$}/events?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}stream($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/sessions/${$}/events/stream?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers]),stream:!0})}}});var X4;var eZ=y(()=>{X0();o();W0();X4=class X4 extends h{retrieve($,Z,X){let{session_id:z,betas:J}=Z;return this._client.get(A`/v1/sessions/${z}/resources/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{session_id:z,betas:J,...Q}=Z;return this._client.post(A`/v1/sessions/${z}/resources/${$}?beta=true`,{body:Q,...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(A`/v1/sessions/${$}/resources?beta=true`,s,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}delete($,Z,X){let{session_id:z,betas:J}=Z;return this._client.delete(A`/v1/sessions/${z}/resources/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}add($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/sessions/${$}/resources?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var l1;var $5=y(()=>{tZ();tZ();eZ();eZ();X0();o();W0();l1=class l1 extends h{constructor(){super(...arguments);this.events=new Z4(this._client),this.resources=new X4(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/sessions?beta=true",{body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/sessions/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/sessions/${$}?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/sessions?beta=true",s,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(A`/v1/sessions/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(A`/v1/sessions/${$}/archive?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};l1.Events=Z4;l1.Resources=X4});var z4;var Z5=y(()=>{X0();o();E$();W0();z4=class z4 extends h{create($,Z={},X){let{betas:z,...J}=Z??{};return this._client.post(A`/v1/skills/${$}/versions?beta=true`,w$({body:J,...X,headers:T([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])},this._client))}retrieve($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.get(A`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(A`/v1/skills/${$}/versions?beta=true`,s,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}delete($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.delete(A`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}}});var g$;var X5=y(()=>{Z5();Z5();X0();o();E$();W0();g$=class g$ extends h{constructor(){super(...arguments);this.versions=new z4(this._client)}create($={},Z){let{betas:X,...z}=$??{};return this._client.post("/v1/skills?beta=true",w$({body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/skills/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/skills?beta=true",s,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(A`/v1/skills/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}};g$.Versions=z4});var J4;var z5=y(()=>{X0();o();W0();J4=class J4 extends h{create($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/vaults/${$}/credentials?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}retrieve($,Z,X){let{vault_id:z,betas:J}=Z;return this._client.get(A`/v1/vaults/${z}/credentials/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{vault_id:z,betas:J,...Q}=Z;return this._client.post(A`/v1/vaults/${z}/credentials/${$}?beta=true`,{body:Q,...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(A`/v1/vaults/${$}/credentials?beta=true`,s,{query:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}delete($,Z,X){let{vault_id:z,betas:J}=Z;return this._client.delete(A`/v1/vaults/${z}/credentials/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z,X){let{vault_id:z,betas:J}=Z;return this._client.post(A`/v1/vaults/${z}/credentials/${$}/archive?beta=true`,{...X,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var v$;var J5=y(()=>{z5();z5();X0();o();W0();v$=class v$ extends h{constructor(){super(...arguments);this.credentials=new J4(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/vaults?beta=true",{body:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/vaults/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(A`/v1/vaults/${$}?beta=true`,{body:J,...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/vaults?beta=true",s,{query:z,...Z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(A`/v1/vaults/${$}?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(A`/v1/vaults/${$}/archive?beta=true`,{...X,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};v$.Credentials=J4});var O0;var Q5=y(()=>{CZ();CZ();EZ();EZ();SZ();SZ();jZ();jZ();bZ();bZ();fZ();fZ();oZ();oZ();$5();$5();X5();X5();J5();J5();O0=class O0 extends h{constructor(){super(...arguments);this.models=new h2(this._client),this.messages=new _1(this._client),this.agents=new S$(this._client),this.environments=new y2(this._client),this.sessions=new l1(this._client),this.vaults=new v$(this._client),this.memoryStores=new m1(this._client),this.files=new v2(this._client),this.skills=new g$(this._client),this.userProfiles=new u2(this._client)}};O0.Models=h2;O0.Messages=_1;O0.Agents=S$;O0.Environments=y2;O0.Sessions=l1;O0.Vaults=v$;O0.MemoryStores=m1;O0.Files=v2;O0.Skills=g$;O0.UserProfiles=u2});var h$;var Y5=y(()=>{o();h$=class h$ extends h{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/complete",{body:z,timeout:this._client._options.timeout??600000,...Z,headers:T([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function GQ($){return $?.output_config?.format}function W5($,Z,X){let z=GQ(Z);if(!Z||!("parse"in(z??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text")return Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return J}),parsed_output:null};return U5($,Z,X)}function U5($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=UI(Z,Q.text);if(z===null)z=Y;return Object.defineProperty({...Q},"parsed_output",{value:Y,enumerable:!1})}return Q});return{...$,content:J,parsed_output:z}}function UI($,Z){let X=GQ($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new j(`Failed to parse structured output: ${z}`)}}var G5=y(()=>{D0()});function HQ($){return $.type==="tool_use"||$.type==="server_tool_use"}function BQ($){}var f0,F1,u$,Q4,J8,Y4,W4,Q8,U4,Q1,G4,Y8,W8,p1,U8,G8,q4,q5,qQ,V5,K5,H5,B5,VQ,KQ="__json_buf",V4;var LQ=y(()=>{$1();j$();cZ();mZ();G5();V4=class V4{constructor($,Z){f0.add(this),this.messages=[],this.receivedMessages=[],F1.set(this,void 0),u$.set(this,null),this.controller=new AbortController,Q4.set(this,void 0),J8.set(this,()=>{}),Y4.set(this,()=>{}),W4.set(this,void 0),Q8.set(this,()=>{}),U4.set(this,()=>{}),Q1.set(this,{}),G4.set(this,!1),Y8.set(this,!1),W8.set(this,!1),p1.set(this,!1),U8.set(this,void 0),G8.set(this,void 0),q4.set(this,void 0),V5.set(this,(X)=>{if(F(this,Y8,!0,"f"),Z1(X))X=new L0;if(X instanceof L0)return F(this,W8,!0,"f"),this._emit("abort",X);if(X instanceof j)return this._emit("error",X);if(X instanceof Error){let z=new j(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new j(String(X)))}),F(this,Q4,new Promise((X,z)=>{F(this,J8,X,"f"),F(this,Y4,z,"f")}),"f"),F(this,W4,new Promise((X,z)=>{F(this,Q8,X,"f"),F(this,U4,z,"f")}),"f"),M(this,Q4,"f").catch(()=>{}),M(this,W4,"f").catch(()=>{}),F(this,u$,$,"f"),F(this,q4,Z?.logger??console,"f")}get response(){return M(this,U8,"f")}get request_id(){return M(this,G8,"f")}async withResponse(){F(this,p1,!0,"f");let $=await M(this,Q4,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new V4(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new V4(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return F(J,u$,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},M(this,V5,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal,J;if(z){if(z.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),z.addEventListener("abort",J)}try{M(this,f0,"m",K5).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let W of Y)M(this,f0,"m",H5).call(this,W);if(Y.controller.signal?.aborted)throw new L0;M(this,f0,"m",B5).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;F(this,U8,$,"f"),F(this,G8,$?.headers.get("request-id"),"f"),M(this,J8,"f").call(this,$),this._emit("connect")}get ended(){return M(this,G4,"f")}get errored(){return M(this,Y8,"f")}get aborted(){return M(this,W8,"f")}abort(){this.controller.abort()}on($,Z){return(M(this,Q1,"f")[$]||(M(this,Q1,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=M(this,Q1,"f")[$];if(!X)return this;let z=X.findIndex((J)=>J.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(M(this,Q1,"f")[$]||(M(this,Q1,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(F(this,p1,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){F(this,p1,!0,"f"),await M(this,W4,"f")}get currentMessage(){return M(this,F1,"f")}async finalMessage(){return await this.done(),M(this,f0,"m",q5).call(this)}async finalText(){return await this.done(),M(this,f0,"m",qQ).call(this)}_emit($,...Z){if(M(this,G4,"f"))return;if($==="end")F(this,G4,!0,"f"),M(this,Q8,"f").call(this);let X=M(this,Q1,"f")[$];if(X)M(this,Q1,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!M(this,p1,"f")&&!X?.length)Promise.reject(z);M(this,Y4,"f").call(this,z),M(this,U4,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!M(this,p1,"f")&&!X?.length)Promise.reject(z);M(this,Y4,"f").call(this,z),M(this,U4,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",M(this,f0,"m",q5).call(this))}async _fromReadableStream($,Z){let X=Z?.signal,z;if(X){if(X.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),X.addEventListener("abort",z)}try{M(this,f0,"m",K5).call(this),this._connected(null);let J=E0.fromReadableStream($,this.controller);for await(let Q of J)M(this,f0,"m",H5).call(this,Q);if(J.controller.signal?.aborted)throw new L0;M(this,f0,"m",B5).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(F1=new WeakMap,u$=new WeakMap,Q4=new WeakMap,J8=new WeakMap,Y4=new WeakMap,W4=new WeakMap,Q8=new WeakMap,U4=new WeakMap,Q1=new WeakMap,G4=new WeakMap,Y8=new WeakMap,W8=new WeakMap,p1=new WeakMap,U8=new WeakMap,G8=new WeakMap,q4=new WeakMap,V5=new WeakMap,f0=new WeakSet,q5=function(){if(this.receivedMessages.length===0)throw new j("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},qQ=function(){if(this.receivedMessages.length===0)throw new j("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new j("stream ended without producing a content block with type=text");return Z.join(" ")},K5=function(){if(this.ended)return;F(this,F1,void 0,"f")},H5=function(Z){if(this.ended)return;let X=M(this,f0,"m",VQ).call(this,Z);switch(this._emit("streamEvent",Z,X),Z.type){case"content_block_delta":{let z=X.content.at(-1);switch(Z.delta.type){case"text_delta":{if(z.type==="text")this._emit("text",Z.delta.text,z.text||"");break}case"citations_delta":{if(z.type==="text")this._emit("citation",Z.delta.citation,z.citations??[]);break}case"input_json_delta":{if(HQ(z)&&z.input)this._emit("inputJson",Z.delta.partial_json,z.input);break}case"thinking_delta":{if(z.type==="thinking")this._emit("thinking",Z.delta.thinking,z.thinking);break}case"signature_delta":{if(z.type==="thinking")this._emit("signature",z.signature);break}default:BQ(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(W5(X,M(this,u$,"f"),{logger:M(this,q4,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{F(this,F1,X,"f");break}case"content_block_start":case"message_delta":break}},B5=function(){if(this.ended)throw new j("stream has ended, this shouldn't happen");let Z=M(this,F1,"f");if(!Z)throw new j("request ended without sending any chunks");return F(this,F1,void 0,"f"),W5(Z,M(this,u$,"f"),{logger:M(this,q4,"f")})},VQ=function(Z){let X=M(this,F1,"f");if(Z.type==="message_start"){if(X)throw new j(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new j(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":if(X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,Z.usage.input_tokens!=null)X.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)X.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)X.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)X.usage.server_tool_use=Z.usage.server_tool_use;return X;case"content_block_start":return X.content.push({...Z.content_block}),X;case"content_block_delta":{let z=X.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(z?.type==="text")X.content[Z.index]={...z,text:(z.text||"")+Z.delta.text};break}case"citations_delta":{if(z?.type==="text")X.content[Z.index]={...z,citations:[...z.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(z&&HQ(z)){let J=z[KQ]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,KQ,{value:J,enumerable:!1,writable:!0}),J)Q.input=s3(J);X.content[Z.index]=Q}break}case"thinking_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,thinking:z.thinking+Z.delta.thinking};break}case"signature_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,signature:Z.delta.signature};break}default:BQ(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let J=Z.shift();if(J)J.resolve(z);else $.push(z)}),this.on("end",()=>{X=!0;for(let z of Z)z.resolve(void 0);Z.length=0}),this.on("abort",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((J,Q)=>Z.push({resolve:J,reject:Q})).then((J)=>J?{value:J,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new E0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var K4;var L5=y(()=>{X0();o();sZ();j$();W0();K4=class K4 extends h{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(A`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",c0,{query:$,...Z})}delete($,Z){return this._client.delete(A`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(A`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let X=await this.retrieve($);if(!X.results_url)throw new j(`No batch \`results_url\`; Has it finished processing? ${X.processing_status} - ${X.id}`);return this._client.get(X.results_url,{...Z,headers:T([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((z,J)=>f$.fromResponse(J.response,J.controller))}}});var i1,MQ,qI;var M5=y(()=>{o();g2();LQ();G5();L5();L5();gZ();i1=class i1 extends h{constructor(){super(...arguments);this.batches=new K4(this._client)}create($,Z){if($.model in MQ)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${MQ[$.model]}
197
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(qI.includes($.model)&&$.thinking&&$.thinking.type==="enabled")console.warn(`Using Claude with ${$.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let X=this._client._options.timeout;if(!$.stream&&X==null){let J=r3[$.model]??void 0;X=this._client.calculateNonstreamingTimeout($.max_tokens,J)}let z=n3($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:X??600000,...Z,headers:T([z,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((X)=>U5(X,$,{logger:this._client.logger??console}))}stream($,Z){return V4.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};MQ={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026","claude-opus-4-0":"June 15th, 2026","claude-opus-4-20250514":"June 15th, 2026","claude-sonnet-4-0":"June 15th, 2026","claude-sonnet-4-20250514":"June 15th, 2026"},qI=["claude-mythos-preview","claude-opus-4-6"];i1.Batches=K4});var m$;var O5=y(()=>{X0();o();W0();m$=class m$ extends h{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(A`/v1/models/${$}`,{...X,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/models",c0,{query:z,...Z,headers:T([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var OQ=y(()=>{Q5();Y5();M5();O5();pJ()});var H4=($)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[$]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.($)?.trim()||void 0;return};class $0{constructor({baseURL:$=H4("ANTHROPIC_BASE_URL"),apiKey:Z=H4("ANTHROPIC_API_KEY")??null,authToken:X=H4("ANTHROPIC_AUTH_TOKEN")??null,...z}={}){N5.add(this),q8.set(this,void 0);let J={apiKey:Z,authToken:X,...z,baseURL:$||"https://api.anthropic.com"};if(!J.dangerouslyAllowBrowser&&EJ())throw new j(`It looks like you're running in a browser-like environment.
198
198
 
199
199
  This is disabled by default, as it risks exposing your secret API credentials to attackers.
200
200
  If you understand the risks and have appropriate mitigations in place,
201
201
  you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
202
202
 
203
203
  new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
204
- `);this.baseURL=J.baseURL,this.timeout=J.timeout??B5.DEFAULT_TIMEOUT,this.logger=J.logger??console;let Q="warn";this.logLevel=Q,this.logLevel=KZ(J.logLevel,"ClientOptions.logLevel",this)??KZ(V3("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??Q,this.fetchOptions=J.fetchOptions,this.maxRetries=J.maxRetries??2,this.fetch=J.fetch??FJ(),_(this,Y8,PJ,"f"),this._options=J,this.apiKey=typeof Z==="string"?Z:null,this.authToken=X}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders($){return T([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return T([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return T([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return wJ($)}getUserAgent(){return`${this.constructor.name}/JS ${T1}`}defaultIdempotencyKey(){return`stainless-node-retry-${JZ()}`}makeStatusError($,Z,X,z){return Q0.generate($,Z,X,z)}buildURL($,Z,X){let z=!N(this,H5,"m",VQ).call(this)&&X||this.baseURL,J=LJ($)?new URL($):new URL(z+(z.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),Q=this.defaultQuery(),Y=Object.fromEntries(J.searchParams);if(!WZ(Q)||!WZ(Y))Z={...Y,...Q,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))J.search=this.stringifyQuery(Z);return J.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new S("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options:X}){}get($,Z){return this.methodRequest("get",$,Z)}post($,Z){return this.methodRequest("post",$,Z)}patch($,Z){return this.methodRequest("patch",$,Z)}put($,Z){return this.methodRequest("put",$,Z)}delete($,Z){return this.methodRequest("delete",$,Z)}methodRequest($,Z,X){return this.request(Promise.resolve(X).then((z)=>{return{method:$,path:Z,...z}}))}request($,Z=null){return new I1(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,X){let z=await $,J=z.maxRetries??this.maxRetries;if(Z==null)Z=J;await this.prepareOptions(z);let{req:Q,url:Y,timeout:W}=await this.buildRequest(z,{retryCount:J-Z});await this.prepareRequest(Q,{url:Y,options:z});let U="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),G=X===void 0?"":`, retryOf: ${X}`,q=Date.now();if(H0(this).debug(`[${U}] sending request`,X1({retryOfRequestLogID:X,method:z.method,url:Y,options:z,headers:Q.headers})),z.signal?.aborted)throw new B0;let V=new AbortController,K=await this.fetchWithTimeout(Y,Q,W,V).catch(F2),B=Date.now();if(K instanceof globalThis.Error){let M=`retrying, ${Z} attempts remaining`;if(z.signal?.aborted)throw new B0;let R=Z1(K)||/timed? ?out/i.test(String(K)+("cause"in K?String(K.cause):""));if(Z)return H0(this).info(`[${U}] connection ${R?"timed out":"failed"} - ${M}`),H0(this).debug(`[${U}] connection ${R?"timed out":"failed"} (${M})`,X1({retryOfRequestLogID:X,url:Y,durationMs:B-q,message:K.message})),this.retryRequest(z,Z,X??U);if(H0(this).info(`[${U}] connection ${R?"timed out":"failed"} - error; no more retries left`),H0(this).debug(`[${U}] connection ${R?"timed out":"failed"} (error; no more retries left)`,X1({retryOfRequestLogID:X,url:Y,durationMs:B-q,message:K.message})),R)throw new O$;throw new O1({cause:K})}let O=[...K.headers.entries()].filter(([M])=>M==="request-id").map(([M,R])=>", "+M+": "+JSON.stringify(R)).join(""),L=`[${U}${G}${O}] ${Q.method} ${Y} ${K.ok?"succeeded":"failed"} with status ${K.status} in ${B-q}ms`;if(!K.ok){let M=await this.shouldRetry(K);if(Z&&M){let f=`retrying, ${Z} attempts remaining`;return await _J(K.body),H0(this).info(`${L} - ${f}`),H0(this).debug(`[${U}] response error (${f})`,X1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,durationMs:B-q})),this.retryRequest(z,Z,X??U,K.headers)}let R=M?"error; no more retries left":"error; not retryable";H0(this).info(`${L} - ${R}`);let P=await K.text().catch((f)=>F2(f).message),w=k4(P),k=w?void 0:P;throw H0(this).debug(`[${U}] response error (${R})`,X1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,message:k,durationMs:Date.now()-q})),this.makeStatusError(K.status,w,k,K.headers)}return H0(this).info(L),H0(this).debug(`[${U}] response start`,X1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,durationMs:B-q})),{response:K,options:z,controller:V,requestLogID:U,retryOfRequestLogID:X,startTime:q}}getAPIList($,Z,X){return this.requestAPIList(Z,X&&"then"in X?X.then((z)=>({method:"get",path:$,...z})):{method:"get",path:$,...X})}requestAPIList($,Z){let X=this.makeRequest(Z,null,void 0);return new j2(this,X,$)}async fetchWithTimeout($,Z,X,z){let{signal:J,method:Q,...Y}=Z||{},W=this._makeAbort(z);if(J)J.addEventListener("abort",W,{once:!0});let U=setTimeout(W,X),G=globalThis.ReadableStream&&Y.body instanceof globalThis.ReadableStream||typeof Y.body==="object"&&Y.body!==null&&Symbol.asyncIterator in Y.body,q={signal:z.signal,...G?{duplex:"half"}:{},method:"GET",...Y};if(Q)q.method=Q.toUpperCase();try{return await this.fetch.call(void 0,$,q)}finally{clearTimeout(U)}}async shouldRetry($){let Z=$.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,Z,X,z){let J,Q=z?.get("retry-after-ms");if(Q){let W=parseFloat(Q);if(!Number.isNaN(W))J=W}let Y=z?.get("retry-after");if(Y&&!J){let W=parseFloat(Y);if(!Number.isNaN(W))J=W*1000;else J=Date.parse(Y)-Date.now()}if(J===void 0){let W=$.maxRetries??this.maxRetries;J=this.calculateDefaultRetryTimeoutMillis(Z,W)}return await OJ(J),this.makeRequest($,Z-1,X)}calculateDefaultRetryTimeoutMillis($,Z){let J=Z-$,Q=Math.min(0.5*Math.pow(2,J),8),Y=1-Math.random()*0.25;return Q*Y*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new S("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let X={...$},{method:z,path:J,query:Q,defaultBaseURL:Y}=X,W=this.buildURL(J,Q,Y);if("timeout"in X)MJ("timeout",X.timeout);X.timeout=X.timeout??this.timeout;let{bodyHeaders:U,body:G}=this.buildBody({options:X}),q=await this.buildHeaders({options:$,method:z,bodyHeaders:U,retryCount:Z});return{req:{method:z,headers:q,...X.signal&&{signal:X.signal},...globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"},...G&&{body:G},...this.fetchOptions??{},...X.fetchOptions??{}},url:W,timeout:X.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:X,retryCount:z}){let J={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();J[this.idempotencyHeader]=$.idempotencyKey}let Q=T([J,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(z),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...RJ(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,X,$.headers]);return this.validateHeaders(Q),Q.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let X=T([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&X.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:y4($)};else if(typeof $==="object"&&X.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery($)};else return N(this,Y8,"f").call(this,{body:$,headers:X})}}var H5,B5,Y8,VQ,L5="\\n\\nHuman:",N5="\\n\\nAssistant:",P1;var M5=g(()=>{$1();v1();UZ();CJ();T0();Z0();IZ();qQ();u4();Z5();K5();$5();V5();UZ();a();v4();v1();B5=e,Y8=new WeakMap,H5=new WeakSet,VQ=function(){return this.baseURL!=="https://api.anthropic.com"};e.Anthropic=B5;e.HUMAN_PROMPT=L5;e.AI_PROMPT=N5;e.DEFAULT_TIMEOUT=600000;e.AnthropicError=S;e.APIError=Q0;e.APIConnectionError=O1;e.APIConnectionTimeoutError=O$;e.APIUserAbortError=B0;e.NotFoundError=A$;e.ConflictError=R$;e.RateLimitError=_$;e.BadRequestError=T$;e.AuthenticationError=D$;e.InternalServerError=P$;e.PermissionDeniedError=I$;e.UnprocessableEntityError=F$;e.toFile=x2;P1=class P1 extends e{constructor(){super(...arguments);this.completions=new v$(this),this.messages=new p1(this),this.models=new u$(this),this.beta=new N0(this)}};P1.Completions=v$;P1.Messages=p1;P1.Models=u$;P1.Beta=N0});var KQ={};S5(KQ,{toFile:()=>x2,default:()=>P1,UnprocessableEntityError:()=>F$,RateLimitError:()=>_$,PermissionDeniedError:()=>I$,PagePromise:()=>j2,NotFoundError:()=>A$,InternalServerError:()=>P$,HUMAN_PROMPT:()=>L5,ConflictError:()=>R$,BaseAnthropic:()=>e,BadRequestError:()=>T$,AuthenticationError:()=>D$,AnthropicError:()=>S,Anthropic:()=>P1,APIUserAbortError:()=>B0,APIPromise:()=>I1,APIError:()=>Q0,APIConnectionTimeoutError:()=>O$,APIConnectionError:()=>O1,AI_PROMPT:()=>N5});var HQ=g(()=>{M5();IZ();u4();M5();Z0();T0()});var r5=iQ(n5(),1),{program:XA,createCommand:zA,createArgument:JA,createOption:QA,CommanderError:YA,InvalidArgumentError:WA,InvalidOptionArgumentError:UA,Command:s5,Argument:GA,Option:qA,Help:VA}=r5.default;import{readFileSync as YX,writeFileSync as kL,existsSync as JX}from"fs";import{join as QX,dirname as WX,basename as yL}from"path";import{execFileSync as fL}from"child_process";var oB=N6(),tB=Y2(),eB=$6(),C6=W2(),$L=p$(),B1=p(),ZL=G1(),XL=X0(),zL=V1(),JL=K1(),jR=Z4(),QL=_6(),YL=P6(),WL=w6(),J4=XX(),zX=d$();var UL=oB.Composer,GL=tB.Document,qL=eB.Schema,VL=C6.YAMLError,KL=C6.YAMLParseError,HL=C6.YAMLWarning,BL=$L.Alias,LL=B1.isAlias,NL=B1.isCollection,ML=B1.isDocument,OL=B1.isMap,TL=B1.isNode,DL=B1.isPair,IL=B1.isScalar,AL=B1.isSeq,RL=ZL.Pair,FL=XL.Scalar,_L=zL.YAMLMap,PL=JL.YAMLSeq;var wL=QL.Lexer,CL=YL.LineCounter,EL=WL.Parser,R0=J4.parse,jL=J4.parseAllDocuments,SL=J4.parseDocument,H2=J4.stringify,xL=zX.visit,bL=zX.visitAsync;function l($){let Z=YX($,"utf-8");return R0(Z)}function E6($){let Z=$._meta,X={...$};delete X._meta;let z=H2(X,{lineWidth:0});if(Z?.found&&Z.found.length>0){let J=Z.found.join(" + ");z=z.replace(/^(\s+type:\s+\S+)(\s*)$/m,(Q,Y,W)=>{if(W.includes("#"))return Q;return`${Y} # found: ${J}`})}return z}function o($,Z){kL($,E6(Z),"utf-8")}function m($){return YX($,"utf-8")}function UX($){return R0($)}function h($=process.cwd()){let Z=["project.faf",".faf"];for(let z of Z){let J=QX($,z);if(JX(J))return J}let X=WX($);if(X!==$)for(let z of Z){let J=QX(X,z);if(JX(J))return J}return null}function J$($,Z=process.cwd()){return fL("git",["-C",WX($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+yL($)}d();var Q$=[{name:"TROPHY",indicator:`${V0("✪")} ${V0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${V0(I("★"))} ${V0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${D("◆")} ${D("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${Q4("◇")} ${Q4("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${I("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${H("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${H("○")} RED`,threshold:1},{name:"WHITE",indicator:`${H("♡")}`,threshold:0}];function u0($){return $.indicator}function L1($){for(let Z of Q$)if($>=Z.threshold)return Z;return Q$[Q$.length-1]}var S6=null;function L2(){if(S6)return S6;try{let $=A0("faf-scoring-kernel");return S6=$,$}catch{throw Error(`faf-scoring-kernel not installed.
204
+ `);this.baseURL=J.baseURL,this.timeout=J.timeout??T5.DEFAULT_TIMEOUT,this.logger=J.logger??console;let Q="warn";this.logLevel=Q,this.logLevel=OZ(J.logLevel,"ClientOptions.logLevel",this)??OZ(H4("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??Q,this.fetchOptions=J.fetchOptions,this.maxRetries=J.maxRetries??2,this.fetch=J.fetch??jJ(),F(this,q8,bJ,"f"),this._options=J,this.apiKey=typeof Z==="string"?Z:null,this.authToken=X}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders($){return T([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return T([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return T([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return kJ($)}getUserAgent(){return`${this.constructor.name}/JS ${T1}`}defaultIdempotencyKey(){return`stainless-node-retry-${GZ()}`}makeStatusError($,Z,X,z){return Y0.generate($,Z,X,z)}buildURL($,Z,X){let z=!M(this,N5,"m",NQ).call(this)&&X||this.baseURL,J=AJ($)?new URL($):new URL(z+(z.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),Q=this.defaultQuery(),Y=Object.fromEntries(J.searchParams);if(!KZ(Q)||!KZ(Y))Z={...Y,...Q,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))J.search=this.stringifyQuery(Z);return J.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new j("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options:X}){}get($,Z){return this.methodRequest("get",$,Z)}post($,Z){return this.methodRequest("post",$,Z)}patch($,Z){return this.methodRequest("patch",$,Z)}put($,Z){return this.methodRequest("put",$,Z)}delete($,Z){return this.methodRequest("delete",$,Z)}methodRequest($,Z,X){return this.request(Promise.resolve(X).then((z)=>{return{method:$,path:Z,...z}}))}request($,Z=null){return new I1(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,X){let z=await $,J=z.maxRetries??this.maxRetries;if(Z==null)Z=J;await this.prepareOptions(z);let{req:Q,url:Y,timeout:W}=await this.buildRequest(z,{retryCount:J-Z});await this.prepareRequest(Q,{url:Y,options:z});let U="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),G=X===void 0?"":`, retryOf: ${X}`,q=Date.now();if(B0(this).debug(`[${U}] sending request`,X1({retryOfRequestLogID:X,method:z.method,url:Y,options:z,headers:Q.headers})),z.signal?.aborted)throw new L0;let V=new AbortController,K=await this.fetchWithTimeout(Y,Q,W,V).catch(P2),H=Date.now();if(K instanceof globalThis.Error){let O=`retrying, ${Z} attempts remaining`;if(z.signal?.aborted)throw new L0;let R=Z1(K)||/timed? ?out/i.test(String(K)+("cause"in K?String(K.cause):""));if(Z)return B0(this).info(`[${U}] connection ${R?"timed out":"failed"} - ${O}`),B0(this).debug(`[${U}] connection ${R?"timed out":"failed"} (${O})`,X1({retryOfRequestLogID:X,url:Y,durationMs:H-q,message:K.message})),this.retryRequest(z,Z,X??U);if(B0(this).info(`[${U}] connection ${R?"timed out":"failed"} - error; no more retries left`),B0(this).debug(`[${U}] connection ${R?"timed out":"failed"} (error; no more retries left)`,X1({retryOfRequestLogID:X,url:Y,durationMs:H-q,message:K.message})),R)throw new T$;throw new N1({cause:K})}let N=[...K.headers.entries()].filter(([O])=>O==="request-id").map(([O,R])=>", "+O+": "+JSON.stringify(R)).join(""),L=`[${U}${G}${N}] ${Q.method} ${Y} ${K.ok?"succeeded":"failed"} with status ${K.status} in ${H-q}ms`;if(!K.ok){let O=await this.shouldRetry(K);if(Z&&O){let k=`retrying, ${Z} attempts remaining`;return await xJ(K.body),B0(this).info(`${L} - ${k}`),B0(this).debug(`[${U}] response error (${k})`,X1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,durationMs:H-q})),this.retryRequest(z,Z,X??U,K.headers)}let R=O?"error; no more retries left":"error; not retryable";B0(this).info(`${L} - ${R}`);let P=await K.text().catch((k)=>P2(k).message),C=v3(P),b=C?void 0:P;throw B0(this).debug(`[${U}] response error (${R})`,X1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,message:b,durationMs:Date.now()-q})),this.makeStatusError(K.status,C,b,K.headers)}return B0(this).info(L),B0(this).debug(`[${U}] response start`,X1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,durationMs:H-q})),{response:K,options:z,controller:V,requestLogID:U,retryOfRequestLogID:X,startTime:q}}getAPIList($,Z,X){return this.requestAPIList(Z,X&&"then"in X?X.then((z)=>({method:"get",path:$,...z})):{method:"get",path:$,...X})}requestAPIList($,Z){let X=this.makeRequest(Z,null,void 0);return new x2(this,X,$)}async fetchWithTimeout($,Z,X,z){let{signal:J,method:Q,...Y}=Z||{},W=this._makeAbort(z);if(J)J.addEventListener("abort",W,{once:!0});let U=setTimeout(W,X),G=globalThis.ReadableStream&&Y.body instanceof globalThis.ReadableStream||typeof Y.body==="object"&&Y.body!==null&&Symbol.asyncIterator in Y.body,q={signal:z.signal,...G?{duplex:"half"}:{},method:"GET",...Y};if(Q)q.method=Q.toUpperCase();try{return await this.fetch.call(void 0,$,q)}finally{clearTimeout(U)}}async shouldRetry($){let Z=$.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,Z,X,z){let J,Q=z?.get("retry-after-ms");if(Q){let W=parseFloat(Q);if(!Number.isNaN(W))J=W}let Y=z?.get("retry-after");if(Y&&!J){let W=parseFloat(Y);if(!Number.isNaN(W))J=W*1000;else J=Date.parse(Y)-Date.now()}if(J===void 0){let W=$.maxRetries??this.maxRetries;J=this.calculateDefaultRetryTimeoutMillis(Z,W)}return await FJ(J),this.makeRequest($,Z-1,X)}calculateDefaultRetryTimeoutMillis($,Z){let J=Z-$,Q=Math.min(0.5*Math.pow(2,J),8),Y=1-Math.random()*0.25;return Q*Y*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new j("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let X={...$},{method:z,path:J,query:Q,defaultBaseURL:Y}=X,W=this.buildURL(J,Q,Y);if("timeout"in X)_J("timeout",X.timeout);X.timeout=X.timeout??this.timeout;let{bodyHeaders:U,body:G}=this.buildBody({options:X}),q=await this.buildHeaders({options:$,method:z,bodyHeaders:U,retryCount:Z});return{req:{method:z,headers:q,...X.signal&&{signal:X.signal},...globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"},...G&&{body:G},...this.fetchOptions??{},...X.fetchOptions??{}},url:W,timeout:X.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:X,retryCount:z}){let J={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();J[this.idempotencyHeader]=$.idempotencyKey}let Q=T([J,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(z),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...SJ(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,X,$.headers]);return this.validateHeaders(Q),Q.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let X=T([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&X.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:h3($)};else if(typeof $==="object"&&X.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery($)};else return M(this,q8,"f").call(this,{body:$,headers:X})}}var N5,T5,q8,NQ,D5="\\n\\nHuman:",I5="\\n\\nAssistant:",P1;var A5=y(()=>{$1();h1();HZ();yJ();D0();X0();PZ();OQ();l3();Y5();O5();Q5();M5();HZ();o();c3();h1();T5=$0,q8=new WeakMap,N5=new WeakSet,NQ=function(){return this.baseURL!=="https://api.anthropic.com"};$0.Anthropic=T5;$0.HUMAN_PROMPT=D5;$0.AI_PROMPT=I5;$0.DEFAULT_TIMEOUT=600000;$0.AnthropicError=j;$0.APIError=Y0;$0.APIConnectionError=N1;$0.APIConnectionTimeoutError=T$;$0.APIUserAbortError=L0;$0.NotFoundError=R$;$0.ConflictError=_$;$0.RateLimitError=P$;$0.BadRequestError=D$;$0.AuthenticationError=I$;$0.InternalServerError=C$;$0.PermissionDeniedError=A$;$0.UnprocessableEntityError=F$;$0.toFile=k2;P1=class P1 extends $0{constructor(){super(...arguments);this.completions=new h$(this),this.messages=new i1(this),this.models=new m$(this),this.beta=new O0(this)}};P1.Completions=h$;P1.Messages=i1;P1.Models=m$;P1.Beta=O0});var TQ={};f5(TQ,{toFile:()=>k2,default:()=>P1,UnprocessableEntityError:()=>F$,RateLimitError:()=>P$,PermissionDeniedError:()=>A$,PagePromise:()=>x2,NotFoundError:()=>R$,InternalServerError:()=>C$,HUMAN_PROMPT:()=>D5,ConflictError:()=>_$,BaseAnthropic:()=>$0,BadRequestError:()=>D$,AuthenticationError:()=>I$,AnthropicError:()=>j,Anthropic:()=>P1,APIUserAbortError:()=>L0,APIPromise:()=>I1,APIError:()=>Y0,APIConnectionTimeoutError:()=>T$,APIConnectionError:()=>N1,AI_PROMPT:()=>I5});var DQ=y(()=>{A5();PZ();l3();A5();X0();D0()});var e5=eQ(t5(),1),{program:_A,createCommand:FA,createArgument:PA,createOption:CA,CommanderError:wA,InvalidArgumentError:EA,InvalidOptionArgumentError:SA,Command:$7,Argument:jA,Option:xA,Help:bA}=e5.default;import{readFileSync as VX,writeFileSync as mL,existsSync as GX}from"fs";import{join as qX,dirname as KX,basename as cL}from"path";import{execFileSync as dL}from"child_process";var JL=D6(),QL=W2(),YL=J6(),x6=U2(),WL=i$(),B1=p(),UL=G1(),GL=z0(),qL=V1(),VL=K1(),tR=z3(),KL=E6(),HL=S6(),BL=j6(),Y3=WX(),UX=l$();var LL=JL.Composer,ML=QL.Document,OL=YL.Schema,NL=x6.YAMLError,TL=x6.YAMLParseError,DL=x6.YAMLWarning,IL=WL.Alias,AL=B1.isAlias,RL=B1.isCollection,_L=B1.isDocument,FL=B1.isMap,PL=B1.isNode,CL=B1.isPair,wL=B1.isScalar,EL=B1.isSeq,SL=UL.Pair,jL=GL.Scalar,xL=qL.YAMLMap,bL=VL.YAMLSeq;var kL=KL.Lexer,yL=HL.LineCounter,fL=BL.Parser,R0=Y3.parse,gL=Y3.parseAllDocuments,vL=Y3.parseDocument,B2=Y3.stringify,hL=UX.visit,uL=UX.visitAsync;function l($){let Z=VX($,"utf-8");return R0(Z)}function b6($){let Z=$._meta,X={...$};delete X._meta;let z=B2(X,{lineWidth:0});if(Z?.found&&Z.found.length>0){let J=Z.found.join(" + ");z=z.replace(/^(\s+type:\s+\S+)(\s*)$/m,(Q,Y,W)=>{if(W.includes("#"))return Q;return`${Y} # found: ${J}`})}return z}function t($,Z){mL($,b6(Z),"utf-8")}function m($){return VX($,"utf-8")}function HX($){return R0($)}function v($=process.cwd()){let Z=["project.faf",".faf"];for(let z of Z){let J=qX($,z);if(GX(J))return J}let X=KX($);if(X!==$)for(let z of Z){let J=qX(X,z);if(GX(J))return J}return null}function Q$($,Z=process.cwd()){return dL("git",["-C",KX($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+cL($)}d();var Y$=[{name:"TROPHY",indicator:`${K0("✪")} ${K0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${K0(I("★"))} ${K0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${D("◆")} ${D("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${W3("◇")} ${W3("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${I("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${B("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${B("○")} RED`,threshold:1},{name:"WHITE",indicator:`${B("♡")}`,threshold:0}];function u0($){return $.indicator}function L1($){for(let Z of Y$)if($>=Z.threshold)return Z;return Y$[Y$.length-1]}var y6=null;function M2(){if(y6)return y6;try{let $=A0("faf-scoring-kernel");return y6=$,$}catch{throw Error(`faf-scoring-kernel not installed.
205
205
 
206
206
  Run: npm install faf-scoring-kernel
207
- `)}}function U0($){return JSON.parse(L2().score_faf($))}function qX($){return L2().validate_faf($)}function Y4($){return L2().compile_fafb($)}function VX($){return JSON.parse(L2().decompile_fafb($))}function KX(){return L2().sdk_version()}function K0($){return{score:$.score,tier:L1($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function z0($){if(/^\s*app_type:\s*about\s*$/m.test($)){let X=$.match(/^\s+source_score:\s*(\d+)\s*$/m),z=X?parseInt(X[1],10):-1,J=z>=0&&z<=100?z:-1,Q=$.match(/^\s+represents:\s*(\S+)\s*$/m),Y=Q?Q[1]:void 0;return{score:J,tier:J>=0?L1(J):Q$[Q$.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Y}}return K0(U0($))}d();d();import{existsSync as vL,readFileSync as hL,writeFileSync as uL,mkdirSync as mL}from"fs";import{join as HX}from"path";import{homedir as cL}from"os";var dL=95,lL=30,pL=3,BX=HX(cL(),".config","faf"),x6=HX(BX,"star-nudge"),iL="github.com/Wolfe-Jam/faf-cli";function nL($){if($.score<dL)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??pL))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??lL)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function rL(){try{if(!vL(x6))return{shown:0,lastShownMs:null};let $=hL(x6,"utf-8").trim();if($.startsWith("{")){let X=JSON.parse($),z=X.last?Date.parse(X.last):NaN;return{shown:Number.isFinite(X.shown)?Number(X.shown):0,lastShownMs:Number.isFinite(z)?z:null}}let Z=Date.parse($);return{shown:1,lastShownMs:Number.isFinite(Z)?Z:null}}catch{return{shown:0,lastShownMs:null}}}function sL($,Z){try{mL(BX,{recursive:!0}),uL(x6,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}))}catch{}}function LX($){let Z=Date.now(),X=rL();if(!nL({score:$,isTTY:Boolean(process.stdout.isTTY),isCI:Boolean(process.env.CI),optedOut:Boolean(process.env.FAF_NO_NUDGE),shownCount:X.shown,lastShownMs:X.lastShownMs,nowMs:Z}))return;console.log(""),console.log(` ${V0("★")} ${H("Enjoying faf-cli? A star helps others find it:")} ${iL}`),sL(X.shown,Z)}function J0($,Z,X=!1){let z=u0($.tier),J=I(`${$.score}%`);if(console.log(`${z} ${J} ${H(`${$.populated}/${$.active} slots`)} ${H("—")} ${Z}`),$.tier.name==="TROPHY")console.log(H(" Trophy. AI never has to guess."));else if($.empty>0){let Q=Object.entries($.slots).filter(([,G])=>G==="empty").map(([G])=>G),Y=Q.slice(0,3).join(", "),W=Q.length>3?`, +${Q.length-3} more`:"",U=$.empty===1?"slot":"slots";console.log(H(` ${$.empty} ${U} from Trophy: ${Y}${W}`))}if(X)console.log(""),aL($);LX($.score)}function aL($){for(let[Z,X]of Object.entries($.slots)){let z=X==="populated"?D("●"):X==="slotignored"?H("—"):H("○");console.log(` ${z} ${X==="slotignored"?H(`${Z}: N/A`):Z}`)}}d();function W4($,Z={}){let X=$??h();if(!X)console.error(`Error: project.faf not found
207
+ `)}}function G0($){return JSON.parse(M2().score_faf($))}function LX($){return M2().validate_faf($)}function U3($){return M2().compile_fafb($)}function MX($){return JSON.parse(M2().decompile_fafb($))}function OX(){return M2().sdk_version()}function H0($){return{score:$.score,tier:L1($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function J0($){if(/^\s*app_type:\s*about\s*$/m.test($)){let X=$.match(/^\s+source_score:\s*(\d+)\s*$/m),z=X?parseInt(X[1],10):-1,J=z>=0&&z<=100?z:-1,Q=$.match(/^\s+represents:\s*(\S+)\s*$/m),Y=Q?Q[1]:void 0;return{score:J,tier:J>=0?L1(J):Y$[Y$.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Y}}return H0(G0($))}d();d();import{existsSync as pL,readFileSync as iL,writeFileSync as nL,mkdirSync as rL}from"fs";import{join as NX}from"path";import{homedir as sL}from"os";var aL=95,oL=30,tL=3,TX=NX(sL(),".config","faf"),f6=NX(TX,"star-nudge"),eL="github.com/Wolfe-Jam/faf-cli";function $M($){if($.score<aL)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??tL))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??oL)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function ZM(){try{if(!pL(f6))return{shown:0,lastShownMs:null};let $=iL(f6,"utf-8").trim();if($.startsWith("{")){let X=JSON.parse($),z=X.last?Date.parse(X.last):NaN;return{shown:Number.isFinite(X.shown)?Number(X.shown):0,lastShownMs:Number.isFinite(z)?z:null}}let Z=Date.parse($);return{shown:1,lastShownMs:Number.isFinite(Z)?Z:null}}catch{return{shown:0,lastShownMs:null}}}function XM($,Z){try{rL(TX,{recursive:!0}),nL(f6,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}))}catch{}}function DX($){let Z=Date.now(),X=ZM();if(!$M({score:$,isTTY:Boolean(process.stdout.isTTY),isCI:Boolean(process.env.CI),optedOut:Boolean(process.env.FAF_NO_NUDGE),shownCount:X.shown,lastShownMs:X.lastShownMs,nowMs:Z}))return;console.log(""),console.log(` ${K0("★")} ${B("Enjoying faf-cli? A star helps others find it:")} ${eL}`),XM(X.shown,Z)}function Q0($,Z,X=!1){let z=u0($.tier),J=I(`${$.score}%`);if(console.log(`${z} ${J} ${B(`${$.populated}/${$.active} slots`)} ${B("—")} ${Z}`),$.tier.name==="TROPHY")console.log(B(" Trophy. AI never has to guess."));else if($.empty>0){let Q=Object.entries($.slots).filter(([,G])=>G==="empty").map(([G])=>G),Y=Q.slice(0,3).join(", "),W=Q.length>3?`, +${Q.length-3} more`:"",U=$.empty===1?"slot":"slots";console.log(B(` ${$.empty} ${U} from Trophy: ${Y}${W}`))}if(X)console.log(""),zM($);DX($.score)}function zM($){for(let[Z,X]of Object.entries($.slots)){let z=X==="populated"?D("●"):X==="slotignored"?B("—"):B("○");console.log(` ${z} ${X==="slotignored"?B(`${Z}: N/A`):Z}`)}}d();function G3($,Z={}){let X=$??v();if(!X)console.error(`Error: project.faf not found
208
208
 
209
- Run 'faf init' to create one.`),process.exit(2);let z=m(X),J=z0(z);if(Z.json){let Q=l(X),Y={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",source:X,...J};console.log(JSON.stringify(Y,null,2));return}if(Z.status){console.log(`${u0(J.tier)} ${I(`${J.score}%`)}`);return}J0(J,X,Z.verbose)}import{existsSync as FM}from"fs";import{join as hX}from"path";var t=[{index:1,path:"project.name",label:"Name",description:"Project name",category:"project"},{index:2,path:"project.goal",label:"Goal",description:"Goal (use case)",category:"project"},{index:3,path:"project.main_language",label:"Language",description:"Primary language",category:"project"},{index:4,path:"human_context.who",label:"Who",description:"Who is this for?",category:"human"},{index:5,path:"human_context.what",label:"What",description:"What are they building",category:"human"},{index:6,path:"human_context.why",label:"Why",description:"Why does it exist",category:"human"},{index:7,path:"human_context.where",label:"Where",description:"Where does it run",category:"human"},{index:8,path:"human_context.when",label:"When",description:"When was it started / timeline",category:"human"},{index:9,path:"human_context.how",label:"How",description:"How is it built",category:"human"},{index:10,path:"stack.frontend",canonical:"stack.framework",label:"Framework",description:"Framework (React, Svelte, etc.)",category:"frontend"},{index:11,path:"stack.css_framework",canonical:"stack.css",label:"CSS",description:"CSS framework",category:"frontend"},{index:12,path:"stack.ui_library",label:"UI Library",description:"UI component library",category:"frontend"},{index:13,path:"stack.state_management",canonical:"stack.state",label:"State",description:"State management",category:"frontend"},{index:14,path:"stack.backend",label:"Backend",description:"Backend framework",category:"backend"},{index:15,path:"stack.api_type",canonical:"stack.api",label:"API",description:"API style (REST, GraphQL, etc.)",category:"backend"},{index:16,path:"stack.runtime",label:"Runtime",description:"Runtime (Node, Bun, Python, etc.)",category:"backend"},{index:17,path:"stack.database",canonical:"stack.db",label:"Database",description:"Database",category:"backend"},{index:18,path:"stack.connection",label:"Connection",description:"Connection method (Prisma, etc.)",category:"backend"},{index:19,path:"stack.hosting",label:"Hosting",description:"Hosting platform",category:"universal"},{index:20,path:"stack.build",label:"Build",description:"Build tool",category:"universal"},{index:21,path:"stack.cicd",label:"CI/CD",description:"CI/CD",category:"universal"},{index:22,path:"stack.monorepo_tool",label:"Monorepo",description:"Monorepo tool",category:"enterprise_infra"},{index:23,path:"stack.package_manager",canonical:"stack.pkg_manager",label:"Package Manager",description:"Package manager",category:"enterprise_infra"},{index:24,path:"stack.workspaces",label:"Workspaces",description:"Workspace configuration",category:"enterprise_infra"},{index:25,path:"monorepo.packages_count",label:"Packages",description:"Number of packages",category:"enterprise_infra"},{index:26,path:"monorepo.build_orchestrator",label:"Build Orchestrator",description:"Build orchestration tool",category:"enterprise_infra"},{index:27,path:"stack.admin",label:"Admin",description:"Admin panel",category:"enterprise_app"},{index:28,path:"stack.cache",label:"Cache",description:"Caching layer",category:"enterprise_app"},{index:29,path:"stack.search",label:"Search",description:"Search engine",category:"enterprise_app"},{index:30,path:"stack.storage",label:"Storage",description:"Object storage",category:"enterprise_app"},{index:31,path:"monorepo.versioning_strategy",label:"Versioning",description:"Version strategy",category:"enterprise_ops"},{index:32,path:"monorepo.shared_configs",label:"Shared Configs",description:"Shared configs",category:"enterprise_ops"},{index:33,path:"monorepo.remote_cache",label:"Remote Cache",description:"Remote build cache",category:"enterprise_ops"}],Y$=new Map(t.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),zF=new Map(t.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),JF=new Map(t.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function N2($,Z){let X=(J)=>{let Q=J.split("."),Y=$;for(let W of Q)if(Y&&typeof Y==="object"&&W in Y)Y=Y[W];else return;return Y},z=X(Z.path);if(z!==void 0)return z;if(Z.canonical)return X(Z.canonical);return}var QF=t.filter(($)=>$.index<=21);var b6=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","n/a","not applicable"]);function _0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return b6.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var W$={about:[],documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],cli:["project","human","universal"],library:["project","human","universal"],sdk:["project","human","universal"],wasm:["project","human","universal"],html:["project","human","universal"],"server-card":["project","human","universal"],frontend:["project","frontend","human","universal"],website:["project","frontend","human","universal"],mobile:["project","frontend","human","universal"],extension:["project","frontend","human","universal"],mcp:["project","backend","human","universal"],backend:["project","backend","universal","human"],"data-science":["project","backend","human","universal"],fullstack:["project","frontend","backend","universal","human"],svelte:["project","frontend","backend","universal","human"],framework:["project","frontend","backend","universal","human"],"monorepo-root":["project","human","enterprise_infra","enterprise_app","enterprise_ops"],mcpaas:["project","backend","universal","human","enterprise_app","enterprise_ops"],saas:["project","frontend","backend","universal","human","enterprise_app"],enterprise:["project","frontend","backend","universal","human","enterprise_infra","enterprise_app","enterprise_ops"]};var N1="3.0";import{existsSync as j,readFileSync as a0,readdirSync as AX}from"fs";import{join as E}from"path";var NX=[{name:"Next.js",slug:"nextjs",category:"frontend",signals:[{type:"dependency",key:"next"},{type:"file",pattern:"next.config.*"}]},{name:"React",slug:"react",category:"frontend",signals:[{type:"dependency",key:"react"}]},{name:"SvelteKit",slug:"sveltekit",category:"frontend",signals:[{type:"dependency",key:"@sveltejs/kit"},{type:"file",pattern:"svelte.config.*"}]},{name:"Svelte",slug:"svelte",category:"frontend",signals:[{type:"dependency",key:"svelte"},{type:"devDependency",key:"svelte"}]},{name:"Vue.js",slug:"vue",category:"frontend",signals:[{type:"dependency",key:"vue"}]},{name:"Nuxt",slug:"nuxt",category:"frontend",signals:[{type:"dependency",key:"nuxt"},{type:"file",pattern:"nuxt.config.*"}]},{name:"Angular",slug:"angular",category:"frontend",signals:[{type:"dependency",key:"@angular/core"},{type:"file",pattern:"angular.json"}]},{name:"Astro",slug:"astro",category:"frontend",signals:[{type:"dependency",key:"astro"},{type:"file",pattern:"astro.config.*"}]},{name:"Solid",slug:"solid",category:"frontend",signals:[{type:"dependency",key:"solid-js"}]},{name:"Remix",slug:"remix",category:"frontend",signals:[{type:"dependency",key:"@remix-run/react"}]},{name:"Gatsby",slug:"gatsby",category:"frontend",signals:[{type:"dependency",key:"gatsby"},{type:"file",pattern:"gatsby-config.*"}]},{name:"Qwik",slug:"qwik",category:"frontend",signals:[{type:"dependency",key:"@builder.io/qwik"}]},{name:"Vercel (SvelteKit)",slug:"adapter-vercel",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-vercel"},{type:"devDependency",key:"@sveltejs/adapter-vercel"}]},{name:"Node (SvelteKit)",slug:"adapter-node",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-node"},{type:"devDependency",key:"@sveltejs/adapter-node"}]},{name:"Static (SvelteKit)",slug:"adapter-static",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-static"},{type:"devDependency",key:"@sveltejs/adapter-static"}]},{name:"Cloudflare (SvelteKit)",slug:"adapter-cloudflare",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-cloudflare"},{type:"devDependency",key:"@sveltejs/adapter-cloudflare"}]},{name:"Netlify (SvelteKit)",slug:"adapter-netlify",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-netlify"},{type:"devDependency",key:"@sveltejs/adapter-netlify"}]},{name:"Tailwind CSS",slug:"tailwind",category:"css",signals:[{type:"dependency",key:"tailwindcss"},{type:"devDependency",key:"tailwindcss"},{type:"file",pattern:"tailwind.config.*"}]},{name:"Bootstrap",slug:"bootstrap",category:"css",signals:[{type:"dependency",key:"bootstrap"}]},{name:"Styled Components",slug:"styled-components",category:"css",signals:[{type:"dependency",key:"styled-components"}]},{name:"shadcn/ui",slug:"shadcn",category:"ui",signals:[{type:"file",pattern:"components.json"},{type:"dependency",key:"@radix-ui/react-dialog"}]},{name:"Material UI",slug:"mui",category:"ui",signals:[{type:"dependency",key:"@mui/material"}]},{name:"Chakra UI",slug:"chakra",category:"ui",signals:[{type:"dependency",key:"@chakra-ui/react"}]},{name:"Ant Design",slug:"antd",category:"ui",signals:[{type:"dependency",key:"antd"}]},{name:"Redux",slug:"redux",category:"state",signals:[{type:"dependency",key:"@reduxjs/toolkit"}]},{name:"Zustand",slug:"zustand",category:"state",signals:[{type:"dependency",key:"zustand"}]},{name:"Jotai",slug:"jotai",category:"state",signals:[{type:"dependency",key:"jotai"}]},{name:"Pinia",slug:"pinia",category:"state",signals:[{type:"dependency",key:"pinia"}]},{name:"Express",slug:"express",category:"backend",signals:[{type:"dependency",key:"express"}]},{name:"Fastify",slug:"fastify",category:"backend",signals:[{type:"dependency",key:"fastify"}]},{name:"Hono",slug:"hono",category:"backend",signals:[{type:"dependency",key:"hono"}]},{name:"Elysia",slug:"elysia",category:"backend",signals:[{type:"dependency",key:"elysia"}]},{name:"NestJS",slug:"nestjs",category:"backend",signals:[{type:"dependency",key:"@nestjs/core"}]},{name:"Koa",slug:"koa",category:"backend",signals:[{type:"dependency",key:"koa"}]},{name:"Django",slug:"django",category:"backend",signals:[{type:"file",pattern:"manage.py"},{type:"file",pattern:"settings.py"}]},{name:"Flask",slug:"flask",category:"backend",signals:[{type:"file",pattern:"app.py"}]},{name:"FastAPI",slug:"fastapi",category:"backend",signals:[{type:"file",pattern:"main.py"}]},{name:"Rails",slug:"rails",category:"backend",signals:[{type:"file",pattern:"Gemfile"},{type:"file",pattern:"config/routes.rb"}]},{name:"Spring Boot",slug:"spring",category:"backend",signals:[{type:"file",pattern:"pom.xml"},{type:"file",pattern:"build.gradle"}]},{name:"Prisma",slug:"prisma",category:"database",signals:[{type:"dependency",key:"prisma"},{type:"devDependency",key:"prisma"},{type:"file",pattern:"prisma/schema.prisma"}]},{name:"Drizzle",slug:"drizzle",category:"database",signals:[{type:"dependency",key:"drizzle-orm"},{type:"file",pattern:"drizzle.config.*"}]},{name:"TypeORM",slug:"typeorm",category:"database",signals:[{type:"dependency",key:"typeorm"}]},{name:"Mongoose",slug:"mongoose",category:"database",signals:[{type:"dependency",key:"mongoose"}]},{name:"Vite",slug:"vite",category:"build",signals:[{type:"dependency",key:"vite"},{type:"devDependency",key:"vite"},{type:"file",pattern:"vite.config.*"}]},{name:"webpack",slug:"webpack",category:"build",signals:[{type:"dependency",key:"webpack"},{type:"devDependency",key:"webpack"},{type:"file",pattern:"webpack.config.*"}]},{name:"esbuild",slug:"esbuild",category:"build",signals:[{type:"dependency",key:"esbuild"},{type:"devDependency",key:"esbuild"}]},{name:"Turbopack",slug:"turbopack",category:"build",signals:[{type:"file",pattern:"turbo.json"}]},{name:"Jest",slug:"jest",category:"testing",signals:[{type:"devDependency",key:"jest"},{type:"file",pattern:"jest.config.*"}]},{name:"Vitest",slug:"vitest",category:"testing",signals:[{type:"devDependency",key:"vitest"}]},{name:"Playwright",slug:"playwright",category:"testing",signals:[{type:"devDependency",key:"@playwright/test"},{type:"file",pattern:"playwright.config.*"}]},{name:"Cypress",slug:"cypress",category:"testing",signals:[{type:"devDependency",key:"cypress"},{type:"file",pattern:"cypress.config.*"}]},{name:"Turborepo",slug:"turborepo",category:"monorepo",signals:[{type:"devDependency",key:"turbo"},{type:"file",pattern:"turbo.json"}]},{name:"Nx",slug:"nx",category:"monorepo",signals:[{type:"devDependency",key:"nx"},{type:"file",pattern:"nx.json"}]},{name:"Lerna",slug:"lerna",category:"monorepo",signals:[{type:"devDependency",key:"lerna"},{type:"file",pattern:"lerna.json"}]},{name:"MCP SDK",slug:"mcp",category:"ai",signals:[{type:"dependency",key:"@modelcontextprotocol/sdk"}]},{name:"Anthropic SDK",slug:"anthropic",category:"ai",signals:[{type:"dependency",key:"@anthropic-ai/sdk"}]},{name:"OpenAI SDK",slug:"openai",category:"ai",signals:[{type:"dependency",key:"openai"}]},{name:"LangChain",slug:"langchain",category:"ai",signals:[{type:"dependency",key:"langchain"}]},{name:"Vercel",slug:"vercel",category:"hosting",signals:[{type:"file",pattern:"vercel.json"}]},{name:"Netlify",slug:"netlify",category:"hosting",signals:[{type:"file",pattern:"netlify.toml"}]},{name:"Docker",slug:"docker",category:"hosting",signals:[{type:"file",pattern:"Dockerfile"},{type:"file",pattern:"docker-compose.yml"}]},{name:"Cloudflare Workers",slug:"cloudflare",category:"hosting",signals:[{type:"file",pattern:"wrangler.toml"},{type:"dependency",key:"wrangler"}]},{name:"GitHub Actions",slug:"github-actions",category:"cicd",signals:[{type:"file",pattern:".github/workflows/*.yml"}]},{name:"Commander.js",slug:"commander",category:"cli",signals:[{type:"dependency",key:"commander"}]}];import{existsSync as MX,readFileSync as tL,readdirSync as eL}from"fs";import{join as k6}from"path";var U$={version:2,_doc:"SINGLE SOURCE of Dart/Flutter detection KNOWLEDGE (A+B hybrid, the Truth-is-faf-cli spec). faf-cli imports this directly; faf-python-sdk vendors a synced copy (phase 2); MCPs compose it. Bolster Dart/Flutter by editing THIS file. Logic stays in dart.ts. Refreshed 2026-08-01 (knowledge v2) — community receipt on top of 6.13.0 Dart Edition.",flutterDeps:["flutter"],mcpDeps:["dart_mcp","mcp_server","mcp_dart","dart_mcp_server","mcp","dart_mcpserver"],serverFrameworks:[["serverpod","Serverpod"],["dart_frog","Dart Frog"],["conduit","Conduit"],["angel3_framework","Angel3"],["alfred","Alfred"],["shelf","Shelf"],["jaspr","Jaspr"],["relic","Relic"]],stateManagement:[["flutter_riverpod","Riverpod"],["hooks_riverpod","Riverpod"],["riverpod_annotation","Riverpod"],["riverpod","Riverpod"],["flutter_bloc","Bloc"],["bloc","Bloc"],["provider","Provider"],["get","GetX"],["flutter_mobx","MobX"],["mobx","MobX"],["signals","Signals"],["flutter_hooks","Hooks"]],routing:[["go_router","go_router"],["auto_route","auto_route"],["beamer","Beamer"],["routemaster","Routemaster"]]};var $N=U$.flutterDeps,ZN=U$.mcpDeps,XN=U$.serverFrameworks,zN=U$.stateManagement,JN=U$.routing;function QN($){let Z=new Set,X=!1;for(let z of $.split(`
210
- `)){if(/^(dependencies|dev_dependencies|dependency_overrides):\s*$/.test(z)){X=!0;continue}if(/^\S/.test(z))X=!1;if(X){let J=z.match(/^\s{2}([a-zA-Z0-9_]+):/);if(J)Z.add(J[1].toLowerCase())}}return Z}function U4($){let Z=k6($,"pubspec.yaml");if(!MX(Z))return null;let X;try{X=tL(Z,"utf-8")}catch{return null}let z=QN(X),J=(w)=>z.has(w.toLowerCase()),Q=$N.some(J)||/^flutter:\s*$/m.test(X)||/\bsdk:\s*flutter\b/.test(X),Y=ZN.find(J),W=XN.find(([w])=>J(w)),U=zN.find(([w])=>J(w)),G=U?U[1]:"",q=JN.find(([w])=>J(w)),V=q?q[1]:"",K=J("flutter_test")?"flutter_test":J("test")?"test":"",B=/^executables:\s*$/m.test(X),O=!1;try{O=eL(k6($,"bin")).some((w)=>w.endsWith(".dart"))}catch{}let L=B||O,M,R="",P;if(Q)if(R="Flutter",MX(k6($,"lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(X))M="mobile",P="pubspec.yaml (Flutter app)";else M="library",P="pubspec.yaml (Flutter package)";else if(Y)M="mcp",P=`pubspec.yaml + ${Y} (Dart MCP server)`;else if(W)M="backend",R=W[1],P=`pubspec.yaml + ${W[0]} (Dart backend)`;else if(L)M="cli",P=B?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else M="library",P="pubspec.yaml (Dart package)";return{appType:M,isFlutter:Q,framework:R,stateManagement:G,routing:V,testing:K,found:P}}import{existsSync as y6,readFileSync as DX,readdirSync as OX,statSync as WN}from"fs";import{join as q4}from"path";var G4={version:1,_doc:"SINGLE SOURCE of Go detection KNOWLEDGE (A+B hybrid, Truth-is-faf-cli). faf-cli imports this directly; SDKs/MCPs compose it. Bolster Go by editing THIS file. Logic stays in go.ts. Content-aware: go.mod ≠ one bucket — backend · CLI · MCP · library. 2026-08-01 initial (Dart composition pattern).",mcpModules:["github.com/mark3labs/mcp-go","github.com/modelcontextprotocol/go-sdk","github.com/metoro-io/mcp-golang","github.com/ThinkInAIXYZ/go-mcp"],serverFrameworks:[["github.com/gin-gonic/gin","Gin"],["github.com/labstack/echo","Echo"],["github.com/labstack/echo/v4","Echo"],["github.com/gofiber/fiber","Fiber"],["github.com/gofiber/fiber/v2","Fiber"],["github.com/go-chi/chi","Chi"],["github.com/go-chi/chi/v5","Chi"],["github.com/gorilla/mux","Gorilla Mux"],["github.com/gofiber/fiber/v3","Fiber"],["google.golang.org/grpc","gRPC"],["connectrpc.com/connect","Connect"],["github.com/go-kratos/kratos","Kratos"],["github.com/go-kratos/kratos/v2","Kratos"],["github.com/zeromicro/go-zero","go-zero"],["github.com/cloudwego/hertz","Hertz"]],cliFrameworks:[["github.com/spf13/cobra","Cobra"],["github.com/urfave/cli","urfave/cli"],["github.com/urfave/cli/v2","urfave/cli"],["github.com/alecthomas/kingpin","Kingpin"],["github.com/alecthomas/kong","Kong"]]};var UN=G4.mcpModules,GN=G4.serverFrameworks,qN=G4.cliFrameworks;function VN($){let Z=new Set,X=!1;for(let z of $.split(`
211
- `)){let J=z.replace(/\/\/.*$/,"").trim();if(!J)continue;if(/^require\s*\(\s*$/.test(J)){X=!0;continue}if(X){if(J===")"){X=!1;continue}let Y=J.match(/^(\S+)/);if(Y)Z.add(Y[1].toLowerCase());continue}let Q=J.match(/^require\s+(\S+)/);if(Q&&Q[1]!=="(")Z.add(Q[1].toLowerCase())}return Z}function IX($,Z){let X=Z.toLowerCase();for(let z of $)if(z===X||z.startsWith(`${X}/`))return!0;return!1}function TX($,Z){let X;for(let z of Z){if(!IX($,z[0]))continue;if(!X||z[0].length>X[0].length)X=z}return X}function KN($,Z){let X;for(let z of Z){if(!IX($,z))continue;if(!X||z.length>X.length)X=z}return X}function HN($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function BN($){let Z=q4($,"cmd");if(!y6(Z))return!1;try{for(let X of OX(Z)){let z=q4(Z,X);try{if(WN(z).isDirectory()){if(OX(z).some((Q)=>Q.endsWith(".go")))return!0}else if(X.endsWith(".go"))return!0}catch{}}}catch{}return!1}function LN($){let Z=q4($,"main.go");if(!y6(Z))return!1;try{let X=DX(Z,"utf-8");return/^package\s+main\b/m.test(X)}catch{return!1}}function V4($){let Z=q4($,"go.mod");if(!y6(Z))return null;let X;try{X=DX(Z,"utf-8")}catch{return null}let z=HN(X),J=VN(X),Q=KN(J,UN),Y=TX(J,GN),W=TX(J,qN),U=BN($),G=LN($),q,V="",K;if(Q)q="mcp",K=`go.mod + ${Q} (Go MCP server)`;else if(Y)q="backend",V=Y[1],K=`go.mod + ${Y[0]} (Go backend)`;else if(W)q="cli",V=W[1],K=`go.mod + ${W[0]} (Go CLI)`;else if(U)q="cli",K="go.mod + cmd/ (Go CLI layout)";else if(G&&!Y)q="cli",K="go.mod + main.go package main (Go CLI)";else q="library",K="go.mod (Go module)";return{appType:q,modulePath:z,framework:V,found:K}}function NN($){let Z=E($,"Cargo.toml");if(!j(Z))return null;try{let z=a0(Z,"utf-8").match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return z?z[1]:null}catch{return null}}function MN($){let Z=E($,"Cargo.toml");if(!j(Z))return!1;try{let X=a0(Z,"utf-8");return/^\s*\[\[bin\]\]/m.test(X)}catch{return!1}}function ON($,Z){if(Z?.keywords?.some((z)=>/^sdk(?:\s|-|$)|-sdk$/i.test(z)))return'package.json keywords contains "sdk"';if(Z?.name&&/(?:^|[-_/])sdk(?:[-_/]|$)/i.test(Z.name))return`package.json name "${Z.name}" → sdk`;let X=NN($);if(X&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(X))return`Cargo.toml name "${X}" → sdk`;return null}function TN($){let Z=["manifest.json","public/manifest.json","src/manifest.json","app/manifest.json","extension/manifest.json","dist/manifest.json"];for(let X of Z){let z=E($,X);if(!j(z))continue;try{let J=JSON.parse(a0(z,"utf-8"));if(typeof J.manifest_version==="number")return`${X} manifest_version ${J.manifest_version} (browser extension)`}catch{}}return null}function DN($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,X=E($,"pyproject.toml");if(j(X))try{let Q=a0(X,"utf-8").match(Z);if(Q)return`pyproject.toml depends on ${Q[1]}`}catch{}let z=E($,"requirements.txt");if(j(z))try{let Q=a0(z,"utf-8").match(Z);if(Q)return`requirements.txt contains ${Q[1]}`}catch{}return null}function IN($,Z){let X=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let z of X)if(Z.dependencies?.[z]||Z.devDependencies?.[z])return`${z} dependency`}if(j(E($,"ios"))&&j(E($,"android")))return"ios/ + android/ dirs";return null}function AN($,Z){let X=E($,"Cargo.toml");if(j(X))try{let J=a0(X,"utf-8");if(/crate-type\s*=\s*\[[^\]]*"cdylib"/.test(J))return'Cargo.toml crate-type = ["cdylib"]';if(/wasm-bindgen|wasm-pack/i.test(J))return"Cargo.toml wasm-bindgen/wasm-pack"}catch{}let z=E($,"build.zig");if(j(z))try{let J=a0(z,"utf-8");if(/\.wasm\b|wasm32|setOutputFormat\(\.wasm/i.test(J))return"build.zig wasm target"}catch{}if(Z?.keywords?.some((J)=>/^wasm(?:-|$)|webassembly/i.test(J)))return'package.json keywords contains "wasm"';return null}function RN($,Z){if(!j(E($,"index.html")))return null;if(Z?.dependencies||Z?.devDependencies){let X={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((J)=>X[J]))return null}return"index.html (vanilla, no frontend framework)"}function FN($,Z){if(Z?.name&&/specification|^@.*\/spec/i.test(Z.name))return`package name "${Z.name}" → documentation`;if(Z?.keywords?.some((X)=>/^(specification|format-spec|standard)$/i.test(X)))return'package keywords contains "specification"';if(Z?.bin)return null;if(Z?.files&&Z.files.length>0){let X=/^(dist|src|lib|build|bin)(\/|$)|\/(dist|src|lib|build|bin)(\/|$)|(\.|\/)(js|ts|tsx|jsx|mjs|cjs|py|rs|go)$/,z=Z.files.some((Q)=>X.test(Q)),J=Z.files.some((Q)=>/\.(md|MD)$|examples?\//.test(Q)||Q==="README.md"||Q==="docs"||Q==="docs/");if(!z&&J)return"package.json files = docs/examples only (no source)"}return null}function _N($,Z,X){let z=X.find((J)=>J.slug==="astro"||J.slug==="gatsby");if(z)return`${z.name} (static-site framework)`;if(Z?.keywords?.some((J)=>/^(website|marketing|landing|brochure|portfolio)$/i.test(J)))return'package keywords contains "website"/"marketing"/"landing"';return null}function PN($,Z){if(!Z)return null;let X={...Z.dependencies??{},...Z.devDependencies??{}},z=["@clerk/nextjs","@clerk/clerk-react","next-auth","@auth/core","auth0","@auth0/nextjs-auth0"],J=["stripe","@stripe/stripe-js","lemonsqueezy"],Q=z.some((W)=>X[W]),Y=J.some((W)=>X[W]);if(Q&&Y)return"auth + payment dependencies";return null}function wN($,Z,X){if(Z?.keywords?.some((Q)=>/mcpaas/i.test(Q)))return'package keywords contains "mcpaas"';if(Z?.name&&/mcpaas/i.test(Z.name))return`package name "${Z.name}" → mcpaas`;let z=X.some((Q)=>Q.slug==="mcp"),J=X.some((Q)=>Q.category==="database");if(z&&J&&Z?.dependencies&&Object.keys(Z.dependencies).length>10)return"MCP + database + complex deps (platform shape)";return null}function CN($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||j(E($,"pnpm-workspace.yaml"))))return null;return"private workspace + multi-package"}function k1($){let Z=E($,"package.json");if(!j(Z))return null;try{return JSON.parse(a0(Z,"utf-8"))}catch{return null}}function EN($,Z){if(!Z.includes("*"))return j(E($,Z));let X=Z.split("/");if(X.length===1){let W=Z.split("*")[0];try{return AX($).some((U)=>U.startsWith(W))}catch{return!1}}let z=E($,...X.slice(0,-1)),J=X[X.length-1],Q=J.split("*")[0],Y=J.split("*")[1]||"";try{return AX(z).some((W)=>W.startsWith(Q)&&W.endsWith(Y))}catch{return!1}}function jN($,Z,X){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return EN(X,$.pattern);default:return!1}}function f6($){let Z=k1($);return NX.map((X)=>{let J=X.signals.filter((Q)=>jN(Q,Z,$)).length/X.signals.length;return{name:X.name,slug:X.slug,category:X.category,confidence:J}}).filter((X)=>X.confidence>0).sort((X,z)=>z.confidence-X.confidence)}function RX($){let Z=k1($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(j(E($,"tsconfig.json")))return"TypeScript";if(j(E($,"Cargo.toml")))return"Rust";if(j(E($,"go.mod")))return"Go";if(j(E($,"pyproject.toml"))||j(E($,"setup.py")))return"Python";if(j(E($,"Gemfile")))return"Ruby";if(j(E($,"pom.xml"))||j(E($,"build.gradle")))return"Java";if(j(E($,"Package.swift")))return"Swift";if(j(E($,"build.zig")))return"Zig";if(j(E($,"pubspec.yaml")))return"Dart";if(Z)return"JavaScript";return"Unknown"}function FX($){let Z=k1($),X=f6($),z=[],J=FN($,Z);if(J)return z.push(J),{type:"documentation",found:z};let Q=ON($,Z);if(Q)return z.push(Q),{type:"sdk",found:z};let Y=TN($);if(Y)return z.push(Y),{type:"extension",found:z};let W=wN($,Z,X);if(W)return z.push(W),{type:"mcpaas",found:z};let U=PN($,Z);if(U)return z.push(U),{type:"saas",found:z};let G=AN($,Z);if(G)return z.push(G),{type:"wasm",found:z};let q=U4($);if(q)return z.push(q.found),{type:q.appType,found:z};let V=V4($);if(V)return z.push(V.found),{type:V.appType,found:z};let K=IN($,Z);if(K)return z.push(K),{type:"mobile",found:z};if(X.some((x)=>x.slug==="mcp"))return z.push("MCP SDK signal"),{type:"mcp",found:z};if(Z?.bin)return z.push("package.json bin"),{type:"cli",found:z};if(MN($))return z.push("Cargo.toml [[bin]]"),{type:"cli",found:z};if(j(E($,"build.zig"))){if(z.push("build.zig"),j(E($,"src/main.zig")))return z.push("src/main.zig"),{type:"cli",found:z};if(j(E($,"src/root.zig")))return z.push("src/root.zig"),{type:"library",found:z}}let O=X.some((x)=>x.slug==="svelte"||x.slug==="sveltekit");if(Z?.private===!0&&(j(E($,"pnpm-workspace.yaml"))||Z?.workspaces!==void 0)&&O)return z.push("private workspace","Svelte"),{type:"framework",found:z};if(O)return z.push("Svelte/SvelteKit"),{type:"svelte",found:z};let M=X.some((x)=>x.category==="frontend"),R=X.some((x)=>x.category==="backend");if(Z?.private&&(Z.workspaces||j(E($,"pnpm-workspace.yaml")))&&M&&R)return z.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:z};let P=CN($,Z);if(P)return z.push(P),{type:"monorepo-root",found:z};let w=_N($,Z,X);if(w)return z.push(w),{type:"website",found:z};if(X.some((x)=>x.slug==="nextjs"||x.slug==="nuxt"))return z.push(X.find((x)=>x.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:z};let y=X.some((x)=>x.category==="frontend"),f=X.some((x)=>x.category==="backend");if(y&&f)return z.push("frontend framework","backend framework"),{type:"fullstack",found:z};if(y)return z.push("frontend framework"),{type:"frontend",found:z};if(f)return z.push("backend framework"),{type:"backend",found:z};let i=DN($);if(i)return z.push(i),{type:"data-science",found:z};let C=RN($,Z);if(C)return z.push(C),{type:"html",found:z};if(Z?.main&&!Z?.bin)return z.push("package.json main (no bin)"),{type:"library",found:z};return z.push("no classifying signals — fallback"),{type:"library",found:z}}function _X($){if(j(E($,"bunfig.toml")))return"Bun";if(j(E($,"deno.json"))||j(E($,"deno.jsonc")))return"Deno";if(k1($))return"Node.js";if(j(E($,"Cargo.toml")))return"Rust";if(j(E($,"go.mod")))return"Go";if(j(E($,"pubspec.yaml")))return"Dart";return"Unknown"}function PX($){if(j(E($,"pubspec.yaml")))return"pub";if(j(E($,"go.mod")))return"go modules";if(j(E($,"bun.lockb"))||j(E($,"bun.lock")))return"bun";if(j(E($,"pnpm-lock.yaml")))return"pnpm";if(j(E($,"yarn.lock")))return"yarn";if(j(E($,"package-lock.json")))return"npm";return"npm"}function wX($){if(j(E($,".github/workflows")))return"GitHub Actions";if(j(E($,".gitlab-ci.yml")))return"GitLab CI";if(j(E($,".circleci")))return"CircleCI";if(j(E($,"Jenkinsfile")))return"Jenkins";return null}function CX($){if(j(E($,"vercel.json")))return"Vercel";if(j(E($,"netlify.toml")))return"Netlify";if(j(E($,"wrangler.toml")))return"Cloudflare";if(j(E($,"Dockerfile")))return"Docker";if(j(E($,"fly.toml")))return"Fly.io";if(j(E($,"render.yaml")))return"Render";return null}function EX($){let Z=E($,"svelte.config.js");if(!j(Z))return null;try{let z=a0(Z,"utf-8").match(/@sveltejs\/adapter-(\w+)/);if(z){let J=z[1];switch(J){case"vercel":return"Vercel";case"node":return"Node";case"static":return"Static";case"cloudflare":return"Cloudflare";case"netlify":return"Netlify";case"auto":return"Auto";default:return J}}return null}catch{return null}}function jX($){let Z=k1($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return"Vite";if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(j(E($,"tsconfig.json"))&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function K4($){return["package.json","Cargo.toml","pyproject.toml","go.mod","build.zig","build.zig.zon","src/index.ts","src/index.js","src/main.ts","src/cli.ts","src/main.rs","src/lib.rs","src/main.zig","src/root.zig","src/__init__.py","main.py","__main__.py","main.go","cmd/main.go","README.md","SPECIFICATION.md","BINARY-FORMAT.md","tsconfig.json","wrangler.toml","vercel.json"].filter((X)=>j(E($,X)))}function H4($,Z){let X={};if(Z?.scripts){for(let z of["build","test","lint","dev","start"])if(Z.scripts[z]){let J=j(E($,"bun.lock"))||j(E($,"bun.lockb"))?"bun run":"npm run";X[z]=`${J} ${z}`}}if(j(E($,"Cargo.toml"))){if(!X.build)X.build="cargo build --release";if(!X.test)X.test="cargo test";if(!X.lint)X.lint="cargo clippy"}if(j(E($,"build.zig"))){if(!X.build)X.build="zig build";if(!X.test)X.test="zig build test"}if(j(E($,"go.mod"))){if(!X.build)X.build="go build ./...";if(!X.test)X.test="go test ./..."}if(j(E($,"pyproject.toml"))||j(E($,"pytest.ini"))){if(!X.test)X.test="pytest"}return X}function SX($,Z,X,z){let J=[];if(z&&z!=="Unknown")J.push(z);let Q=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let Y of X)if(Q.has(Y.category))J.push(Y.name);if(j(E($,"bunfig.toml")))J.push("Bun");else if(j(E($,"deno.json"))||j(E($,"deno.jsonc")))J.push("Deno");if(J.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let W of Y)if(!J.some((U)=>U.toLowerCase().includes(W.toLowerCase())))J.push(W)}return J}function B4($){let Z=k1($),X=f6($),z=RX($),J=FX($),Q=J.type,Y=_X($),W=PX($),U=wX($),G=CX($),q=jX($),V=X.find((s)=>s.category==="frontend"),K=X.find((s)=>s.category==="css"),B=X.find((s)=>s.category==="ui"),O=X.find((s)=>s.category==="state"),L=X.find((s)=>s.category==="backend"),M=X.find((s)=>s.category==="database"),R=W$[Q]||W$.library,P=Q==="framework",w=X.some((s)=>s.slug==="svelte"||s.slug==="sveltekit"),k=P&&w?"svelte":P?null:null,y=Q==="svelte"||k==="svelte",f=y?EX($):null,i=y&&X.some((s)=>s.slug==="sveltekit"),C=new Set(["css_framework","ui_library","database","connection","hosting"]),x={},I0=t.filter((s)=>s.path.startsWith("stack."));for(let s of I0){let $0=s.path.replace("stack.","");if(!R.includes(s.category)){x[$0]="slotignored";continue}if(P&&C.has($0)){x[$0]="slotignored";continue}switch($0){case"frontend":x[$0]=V?.name??(Q==="cli"?"CLI":"");break;case"css_framework":x[$0]=K?.name??"";break;case"ui_library":x[$0]=B?.name??"";break;case"state_management":x[$0]=y?O?.name??"Runes":O?.name??"";break;case"backend":x[$0]=y?i?"SvelteKit":L?.name??"":L?.name??"";break;case"api_type":x[$0]=i?"Server Routes":"";break;case"runtime":x[$0]=Y!=="Unknown"?Y:"";break;case"database":x[$0]=M?.name??"";break;case"connection":x[$0]=M?.name??"";break;case"hosting":if(y&&f)x[$0]=f;else x[$0]=G??"";break;case"build":x[$0]=y?"Vite":q??"";break;case"cicd":x[$0]=U??"";break;case"package_manager":x[$0]=W;break;default:x[$0]="";break}}let b={},c=t.filter((s)=>s.path.startsWith("monorepo."));for(let s of c){let $0=s.path.replace("monorepo.","");if(!R.includes(s.category))b[$0]="slotignored";else b[$0]=""}let g0={name:Z?.name??$.split("/").pop()??"project",goal:Z?.description??"",main_language:z,type:Q};if(P&&k)g0.framework=k;let m$=SX($,Z,X,z),E5=K4($),j5=H4($,Z),L3={faf_version:N1,project:g0,stack:x,human_context:{who:"",what:Z?.description??"",why:"",where:"",when:"",how:""},monorepo:b,_meta:{found:J.found}};if(m$.length>0)L3.tech_stack=m$;if(E5.length>0)L3.key_files=E5;if(Object.keys(j5).length>0)L3.commands=j5;return L3}import{existsSync as xN,readFileSync as bN}from"fs";import{join as kN}from"path";var xX={MIN_LENGTH:8,MAX_LENGTH:280},SN=[/^(see|see\s+the?)\s+readme/i,/^(tbd|todo|fixme|coming\s+soon)\b/i,/^(software|application|app|project|tool|library|framework)\.?$/i,/^(for\s+users|for\s+developers)\.?$/i,/^(description|goal|name|title)\.?$/i,/^lorem\s+ipsum/i,/^example(\s+\w+)?\.?$/i];function m0($){let Z=$.trim();if(Z.length<xX.MIN_LENGTH)return!1;if(Z.length>xX.MAX_LENGTH)return!1;if(SN.some((X)=>X.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
212
- `).length>4)return!1;return!0}function yN($){let Z=$.split(`
209
+ Run 'faf init' to create one.`),process.exit(2);let z=m(X),J=J0(z);if(Z.json){let Q=l(X),Y={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",source:X,...J};console.log(JSON.stringify(Y,null,2));return}if(Z.status){console.log(`${u0(J.tier)} ${I(`${J.score}%`)}`);return}Q0(J,X,Z.verbose)}import{existsSync as iO}from"fs";import{join as iX}from"path";var e=[{index:1,path:"project.name",label:"Name",description:"Project name",category:"project"},{index:2,path:"project.goal",label:"Goal",description:"Goal (use case)",category:"project"},{index:3,path:"project.main_language",label:"Language",description:"Primary language",category:"project"},{index:4,path:"human_context.who",label:"Who",description:"Who is this for?",category:"human"},{index:5,path:"human_context.what",label:"What",description:"What are they building",category:"human"},{index:6,path:"human_context.why",label:"Why",description:"Why does it exist",category:"human"},{index:7,path:"human_context.where",label:"Where",description:"Where does it run",category:"human"},{index:8,path:"human_context.when",label:"When",description:"When was it started / timeline",category:"human"},{index:9,path:"human_context.how",label:"How",description:"How is it built",category:"human"},{index:10,path:"stack.frontend",canonical:"stack.framework",label:"Framework",description:"Framework (React, Svelte, etc.)",category:"frontend"},{index:11,path:"stack.css_framework",canonical:"stack.css",label:"CSS",description:"CSS framework",category:"frontend"},{index:12,path:"stack.ui_library",label:"UI Library",description:"UI component library",category:"frontend"},{index:13,path:"stack.state_management",canonical:"stack.state",label:"State",description:"State management",category:"frontend"},{index:14,path:"stack.backend",label:"Backend",description:"Backend framework",category:"backend"},{index:15,path:"stack.api_type",canonical:"stack.api",label:"API",description:"API style (REST, GraphQL, etc.)",category:"backend"},{index:16,path:"stack.runtime",label:"Runtime",description:"Runtime (Node, Bun, Python, etc.)",category:"backend"},{index:17,path:"stack.database",canonical:"stack.db",label:"Database",description:"Database",category:"backend"},{index:18,path:"stack.connection",label:"Connection",description:"Connection method (Prisma, etc.)",category:"backend"},{index:19,path:"stack.hosting",label:"Hosting",description:"Hosting platform",category:"universal"},{index:20,path:"stack.build",label:"Build",description:"Build tool",category:"universal"},{index:21,path:"stack.cicd",label:"CI/CD",description:"CI/CD",category:"universal"},{index:22,path:"stack.monorepo_tool",label:"Monorepo",description:"Monorepo tool",category:"enterprise_infra"},{index:23,path:"stack.package_manager",canonical:"stack.pkg_manager",label:"Package Manager",description:"Package manager",category:"enterprise_infra"},{index:24,path:"stack.workspaces",label:"Workspaces",description:"Workspace configuration",category:"enterprise_infra"},{index:25,path:"monorepo.packages_count",label:"Packages",description:"Number of packages",category:"enterprise_infra"},{index:26,path:"monorepo.build_orchestrator",label:"Build Orchestrator",description:"Build orchestration tool",category:"enterprise_infra"},{index:27,path:"stack.admin",label:"Admin",description:"Admin panel",category:"enterprise_app"},{index:28,path:"stack.cache",label:"Cache",description:"Caching layer",category:"enterprise_app"},{index:29,path:"stack.search",label:"Search",description:"Search engine",category:"enterprise_app"},{index:30,path:"stack.storage",label:"Storage",description:"Object storage",category:"enterprise_app"},{index:31,path:"monorepo.versioning_strategy",label:"Versioning",description:"Version strategy",category:"enterprise_ops"},{index:32,path:"monorepo.shared_configs",label:"Shared Configs",description:"Shared configs",category:"enterprise_ops"},{index:33,path:"monorepo.remote_cache",label:"Remote Cache",description:"Remote build cache",category:"enterprise_ops"}],W$=new Map(e.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),F_=new Map(e.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),P_=new Map(e.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function O2($,Z){let X=(J)=>{let Q=J.split("."),Y=$;for(let W of Q)if(Y&&typeof Y==="object"&&W in Y)Y=Y[W];else return;return Y},z=X(Z.path);if(z!==void 0)return z;if(Z.canonical)return X(Z.canonical);return}var C_=e.filter(($)=>$.index<=21);var g6=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","n/a","not applicable"]);function F0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return g6.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var U$={about:[],documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],cli:["project","human","universal"],library:["project","human","universal"],sdk:["project","human","universal"],wasm:["project","human","universal"],html:["project","human","universal"],"server-card":["project","human","universal"],frontend:["project","frontend","human","universal"],website:["project","frontend","human","universal"],mobile:["project","frontend","human","universal"],extension:["project","frontend","human","universal"],mcp:["project","backend","human","universal"],backend:["project","backend","universal","human"],"data-science":["project","backend","human","universal"],fullstack:["project","frontend","backend","universal","human"],svelte:["project","frontend","backend","universal","human"],framework:["project","frontend","backend","universal","human"],"monorepo-root":["project","human","enterprise_infra","enterprise_app","enterprise_ops"],mcpaas:["project","backend","universal","human","enterprise_app","enterprise_ops"],saas:["project","frontend","backend","universal","human","enterprise_app"],enterprise:["project","frontend","backend","universal","human","enterprise_infra","enterprise_app","enterprise_ops"]};var M1="3.0";import{existsSync as S,readFileSync as a0,readdirSync as EX}from"fs";import{join as E}from"path";var IX=[{name:"Next.js",slug:"nextjs",category:"frontend",signals:[{type:"dependency",key:"next"},{type:"file",pattern:"next.config.*"}]},{name:"React",slug:"react",category:"frontend",signals:[{type:"dependency",key:"react"}]},{name:"SvelteKit",slug:"sveltekit",category:"frontend",signals:[{type:"dependency",key:"@sveltejs/kit"},{type:"file",pattern:"svelte.config.*"}]},{name:"Svelte",slug:"svelte",category:"frontend",signals:[{type:"dependency",key:"svelte"},{type:"devDependency",key:"svelte"}]},{name:"Vue.js",slug:"vue",category:"frontend",signals:[{type:"dependency",key:"vue"}]},{name:"Nuxt",slug:"nuxt",category:"frontend",signals:[{type:"dependency",key:"nuxt"},{type:"file",pattern:"nuxt.config.*"}]},{name:"Angular",slug:"angular",category:"frontend",signals:[{type:"dependency",key:"@angular/core"},{type:"file",pattern:"angular.json"}]},{name:"Astro",slug:"astro",category:"frontend",signals:[{type:"dependency",key:"astro"},{type:"file",pattern:"astro.config.*"}]},{name:"Solid",slug:"solid",category:"frontend",signals:[{type:"dependency",key:"solid-js"}]},{name:"Remix",slug:"remix",category:"frontend",signals:[{type:"dependency",key:"@remix-run/react"}]},{name:"Gatsby",slug:"gatsby",category:"frontend",signals:[{type:"dependency",key:"gatsby"},{type:"file",pattern:"gatsby-config.*"}]},{name:"Qwik",slug:"qwik",category:"frontend",signals:[{type:"dependency",key:"@builder.io/qwik"}]},{name:"Vercel (SvelteKit)",slug:"adapter-vercel",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-vercel"},{type:"devDependency",key:"@sveltejs/adapter-vercel"}]},{name:"Node (SvelteKit)",slug:"adapter-node",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-node"},{type:"devDependency",key:"@sveltejs/adapter-node"}]},{name:"Static (SvelteKit)",slug:"adapter-static",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-static"},{type:"devDependency",key:"@sveltejs/adapter-static"}]},{name:"Cloudflare (SvelteKit)",slug:"adapter-cloudflare",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-cloudflare"},{type:"devDependency",key:"@sveltejs/adapter-cloudflare"}]},{name:"Netlify (SvelteKit)",slug:"adapter-netlify",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-netlify"},{type:"devDependency",key:"@sveltejs/adapter-netlify"}]},{name:"Tailwind CSS",slug:"tailwind",category:"css",signals:[{type:"dependency",key:"tailwindcss"},{type:"devDependency",key:"tailwindcss"},{type:"file",pattern:"tailwind.config.*"}]},{name:"Bootstrap",slug:"bootstrap",category:"css",signals:[{type:"dependency",key:"bootstrap"}]},{name:"Styled Components",slug:"styled-components",category:"css",signals:[{type:"dependency",key:"styled-components"}]},{name:"shadcn/ui",slug:"shadcn",category:"ui",signals:[{type:"file",pattern:"components.json"},{type:"dependency",key:"@radix-ui/react-dialog"}]},{name:"Material UI",slug:"mui",category:"ui",signals:[{type:"dependency",key:"@mui/material"}]},{name:"Chakra UI",slug:"chakra",category:"ui",signals:[{type:"dependency",key:"@chakra-ui/react"}]},{name:"Ant Design",slug:"antd",category:"ui",signals:[{type:"dependency",key:"antd"}]},{name:"Redux",slug:"redux",category:"state",signals:[{type:"dependency",key:"@reduxjs/toolkit"}]},{name:"Zustand",slug:"zustand",category:"state",signals:[{type:"dependency",key:"zustand"}]},{name:"Jotai",slug:"jotai",category:"state",signals:[{type:"dependency",key:"jotai"}]},{name:"Pinia",slug:"pinia",category:"state",signals:[{type:"dependency",key:"pinia"}]},{name:"Express",slug:"express",category:"backend",signals:[{type:"dependency",key:"express"}]},{name:"Fastify",slug:"fastify",category:"backend",signals:[{type:"dependency",key:"fastify"}]},{name:"Hono",slug:"hono",category:"backend",signals:[{type:"dependency",key:"hono"}]},{name:"Elysia",slug:"elysia",category:"backend",signals:[{type:"dependency",key:"elysia"}]},{name:"NestJS",slug:"nestjs",category:"backend",signals:[{type:"dependency",key:"@nestjs/core"}]},{name:"Koa",slug:"koa",category:"backend",signals:[{type:"dependency",key:"koa"}]},{name:"Django",slug:"django",category:"backend",signals:[{type:"file",pattern:"manage.py"},{type:"file",pattern:"settings.py"}]},{name:"Flask",slug:"flask",category:"backend",signals:[{type:"file",pattern:"app.py"}]},{name:"FastAPI",slug:"fastapi",category:"backend",signals:[{type:"file",pattern:"main.py"}]},{name:"Rails",slug:"rails",category:"backend",signals:[{type:"file",pattern:"Gemfile"},{type:"file",pattern:"config/routes.rb"}]},{name:"Spring Boot",slug:"spring",category:"backend",signals:[{type:"file",pattern:"pom.xml"},{type:"file",pattern:"build.gradle"}]},{name:"Prisma",slug:"prisma",category:"database",signals:[{type:"dependency",key:"prisma"},{type:"devDependency",key:"prisma"},{type:"file",pattern:"prisma/schema.prisma"}]},{name:"Drizzle",slug:"drizzle",category:"database",signals:[{type:"dependency",key:"drizzle-orm"},{type:"file",pattern:"drizzle.config.*"}]},{name:"TypeORM",slug:"typeorm",category:"database",signals:[{type:"dependency",key:"typeorm"}]},{name:"Mongoose",slug:"mongoose",category:"database",signals:[{type:"dependency",key:"mongoose"}]},{name:"Vite",slug:"vite",category:"build",signals:[{type:"dependency",key:"vite"},{type:"devDependency",key:"vite"},{type:"file",pattern:"vite.config.*"}]},{name:"webpack",slug:"webpack",category:"build",signals:[{type:"dependency",key:"webpack"},{type:"devDependency",key:"webpack"},{type:"file",pattern:"webpack.config.*"}]},{name:"esbuild",slug:"esbuild",category:"build",signals:[{type:"dependency",key:"esbuild"},{type:"devDependency",key:"esbuild"}]},{name:"Turbopack",slug:"turbopack",category:"build",signals:[{type:"file",pattern:"turbo.json"}]},{name:"Jest",slug:"jest",category:"testing",signals:[{type:"devDependency",key:"jest"},{type:"file",pattern:"jest.config.*"}]},{name:"Vitest",slug:"vitest",category:"testing",signals:[{type:"devDependency",key:"vitest"}]},{name:"Playwright",slug:"playwright",category:"testing",signals:[{type:"devDependency",key:"@playwright/test"},{type:"file",pattern:"playwright.config.*"}]},{name:"Cypress",slug:"cypress",category:"testing",signals:[{type:"devDependency",key:"cypress"},{type:"file",pattern:"cypress.config.*"}]},{name:"Turborepo",slug:"turborepo",category:"monorepo",signals:[{type:"devDependency",key:"turbo"},{type:"file",pattern:"turbo.json"}]},{name:"Nx",slug:"nx",category:"monorepo",signals:[{type:"devDependency",key:"nx"},{type:"file",pattern:"nx.json"}]},{name:"Lerna",slug:"lerna",category:"monorepo",signals:[{type:"devDependency",key:"lerna"},{type:"file",pattern:"lerna.json"}]},{name:"MCP SDK",slug:"mcp",category:"ai",signals:[{type:"dependency",key:"@modelcontextprotocol/sdk"}]},{name:"Anthropic SDK",slug:"anthropic",category:"ai",signals:[{type:"dependency",key:"@anthropic-ai/sdk"}]},{name:"OpenAI SDK",slug:"openai",category:"ai",signals:[{type:"dependency",key:"openai"}]},{name:"LangChain",slug:"langchain",category:"ai",signals:[{type:"dependency",key:"langchain"}]},{name:"Vercel",slug:"vercel",category:"hosting",signals:[{type:"file",pattern:"vercel.json"}]},{name:"Netlify",slug:"netlify",category:"hosting",signals:[{type:"file",pattern:"netlify.toml"}]},{name:"Docker",slug:"docker",category:"hosting",signals:[{type:"file",pattern:"Dockerfile"},{type:"file",pattern:"docker-compose.yml"}]},{name:"Cloudflare Workers",slug:"cloudflare",category:"hosting",signals:[{type:"file",pattern:"wrangler.toml"},{type:"dependency",key:"wrangler"}]},{name:"GitHub Actions",slug:"github-actions",category:"cicd",signals:[{type:"file",pattern:".github/workflows/*.yml"}]},{name:"Commander.js",slug:"commander",category:"cli",signals:[{type:"dependency",key:"commander"}]}];import{existsSync as AX,readFileSync as QM,readdirSync as YM}from"fs";import{join as v6}from"path";var G$={version:2,_doc:"SINGLE SOURCE of Dart/Flutter detection KNOWLEDGE (A+B hybrid, the Truth-is-faf-cli spec). faf-cli imports this directly; faf-python-sdk vendors a synced copy (phase 2); MCPs compose it. Bolster Dart/Flutter by editing THIS file. Logic stays in dart.ts. Refreshed 2026-08-01 (knowledge v2) — community receipt on top of 6.13.0 Dart Edition.",flutterDeps:["flutter"],mcpDeps:["dart_mcp","mcp_server","mcp_dart","dart_mcp_server","mcp","dart_mcpserver"],serverFrameworks:[["serverpod","Serverpod"],["dart_frog","Dart Frog"],["conduit","Conduit"],["angel3_framework","Angel3"],["alfred","Alfred"],["shelf","Shelf"],["jaspr","Jaspr"],["relic","Relic"]],stateManagement:[["flutter_riverpod","Riverpod"],["hooks_riverpod","Riverpod"],["riverpod_annotation","Riverpod"],["riverpod","Riverpod"],["flutter_bloc","Bloc"],["bloc","Bloc"],["provider","Provider"],["get","GetX"],["flutter_mobx","MobX"],["mobx","MobX"],["signals","Signals"],["flutter_hooks","Hooks"]],routing:[["go_router","go_router"],["auto_route","auto_route"],["beamer","Beamer"],["routemaster","Routemaster"]]};var WM=G$.flutterDeps,UM=G$.mcpDeps,GM=G$.serverFrameworks,qM=G$.stateManagement,VM=G$.routing;function KM($){let Z=new Set,X=!1;for(let z of $.split(`
210
+ `)){if(/^(dependencies|dev_dependencies|dependency_overrides):\s*$/.test(z)){X=!0;continue}if(/^\S/.test(z))X=!1;if(X){let J=z.match(/^\s{2}([a-zA-Z0-9_]+):/);if(J)Z.add(J[1].toLowerCase())}}return Z}function q3($){let Z=v6($,"pubspec.yaml");if(!AX(Z))return null;let X;try{X=QM(Z,"utf-8")}catch{return null}let z=KM(X),J=(C)=>z.has(C.toLowerCase()),Q=WM.some(J)||/^flutter:\s*$/m.test(X)||/\bsdk:\s*flutter\b/.test(X),Y=UM.find(J),W=GM.find(([C])=>J(C)),U=qM.find(([C])=>J(C)),G=U?U[1]:"",q=VM.find(([C])=>J(C)),V=q?q[1]:"",K=J("flutter_test")?"flutter_test":J("test")?"test":"",H=/^executables:\s*$/m.test(X),N=!1;try{N=YM(v6($,"bin")).some((C)=>C.endsWith(".dart"))}catch{}let L=H||N,O,R="",P;if(Q)if(R="Flutter",AX(v6($,"lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(X))O="mobile",P="pubspec.yaml (Flutter app)";else O="library",P="pubspec.yaml (Flutter package)";else if(Y)O="mcp",P=`pubspec.yaml + ${Y} (Dart MCP server)`;else if(W)O="backend",R=W[1],P=`pubspec.yaml + ${W[0]} (Dart backend)`;else if(L)O="cli",P=H?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else O="library",P="pubspec.yaml (Dart package)";return{appType:O,isFlutter:Q,framework:R,stateManagement:G,routing:V,testing:K,found:P}}import{existsSync as h6,readFileSync as FX,readdirSync as RX,statSync as BM}from"fs";import{join as K3}from"path";var V3={version:1,_doc:"SINGLE SOURCE of Go detection KNOWLEDGE (A+B hybrid, Truth-is-faf-cli). faf-cli imports this directly; SDKs/MCPs compose it. Bolster Go by editing THIS file. Logic stays in go.ts. Content-aware: go.mod ≠ one bucket — backend · CLI · MCP · library. 2026-08-01 initial (Dart composition pattern).",mcpModules:["github.com/mark3labs/mcp-go","github.com/modelcontextprotocol/go-sdk","github.com/metoro-io/mcp-golang","github.com/ThinkInAIXYZ/go-mcp"],serverFrameworks:[["github.com/gin-gonic/gin","Gin"],["github.com/labstack/echo","Echo"],["github.com/labstack/echo/v4","Echo"],["github.com/gofiber/fiber","Fiber"],["github.com/gofiber/fiber/v2","Fiber"],["github.com/go-chi/chi","Chi"],["github.com/go-chi/chi/v5","Chi"],["github.com/gorilla/mux","Gorilla Mux"],["github.com/gofiber/fiber/v3","Fiber"],["google.golang.org/grpc","gRPC"],["connectrpc.com/connect","Connect"],["github.com/go-kratos/kratos","Kratos"],["github.com/go-kratos/kratos/v2","Kratos"],["github.com/zeromicro/go-zero","go-zero"],["github.com/cloudwego/hertz","Hertz"]],cliFrameworks:[["github.com/spf13/cobra","Cobra"],["github.com/urfave/cli","urfave/cli"],["github.com/urfave/cli/v2","urfave/cli"],["github.com/alecthomas/kingpin","Kingpin"],["github.com/alecthomas/kong","Kong"]]};var LM=V3.mcpModules,MM=V3.serverFrameworks,OM=V3.cliFrameworks;function NM($){let Z=new Set,X=!1;for(let z of $.split(`
211
+ `)){let J=z.replace(/\/\/.*$/,"").trim();if(!J)continue;if(/^require\s*\(\s*$/.test(J)){X=!0;continue}if(X){if(J===")"){X=!1;continue}let Y=J.match(/^(\S+)/);if(Y)Z.add(Y[1].toLowerCase());continue}let Q=J.match(/^require\s+(\S+)/);if(Q&&Q[1]!=="(")Z.add(Q[1].toLowerCase())}return Z}function PX($,Z){let X=Z.toLowerCase();for(let z of $)if(z===X||z.startsWith(`${X}/`))return!0;return!1}function _X($,Z){let X;for(let z of Z){if(!PX($,z[0]))continue;if(!X||z[0].length>X[0].length)X=z}return X}function TM($,Z){let X;for(let z of Z){if(!PX($,z))continue;if(!X||z.length>X.length)X=z}return X}function DM($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function IM($){let Z=K3($,"cmd");if(!h6(Z))return!1;try{for(let X of RX(Z)){let z=K3(Z,X);try{if(BM(z).isDirectory()){if(RX(z).some((Q)=>Q.endsWith(".go")))return!0}else if(X.endsWith(".go"))return!0}catch{}}}catch{}return!1}function AM($){let Z=K3($,"main.go");if(!h6(Z))return!1;try{let X=FX(Z,"utf-8");return/^package\s+main\b/m.test(X)}catch{return!1}}function H3($){let Z=K3($,"go.mod");if(!h6(Z))return null;let X;try{X=FX(Z,"utf-8")}catch{return null}let z=DM(X),J=NM(X),Q=TM(J,LM),Y=_X(J,MM),W=_X(J,OM),U=IM($),G=AM($),q,V="",K;if(Q)q="mcp",K=`go.mod + ${Q} (Go MCP server)`;else if(Y)q="backend",V=Y[1],K=`go.mod + ${Y[0]} (Go backend)`;else if(W)q="cli",V=W[1],K=`go.mod + ${W[0]} (Go CLI)`;else if(U)q="cli",K="go.mod + cmd/ (Go CLI layout)";else if(G&&!Y)q="cli",K="go.mod + main.go package main (Go CLI)";else q="library",K="go.mod (Go module)";return{appType:q,modulePath:z,framework:V,found:K}}import{existsSync as _M,readFileSync as FM,readdirSync as PM}from"fs";import{join as CM}from"path";var k1={version:1,_doc:"SINGLE SOURCE of C# /.NET detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Bolster C# by editing THIS file. Logic stays in csharp.ts. Content-aware: .csproj alone ≠ type — Sdk first, then props/packages. Kill line: .csproj alone ≠ type. 2026-08-01 initial.",mcpPackages:["ModelContextProtocol","ModelContextProtocol.AspNetCore","ModelContextProtocol.Core","ModelContextProtocol.Extensions.Tasks","ModelContextProtocol.Extensions.Apps"],cliPackages:[["System.CommandLine","System.CommandLine"],["Spectre.Console.Cli","Spectre.Console"],["Spectre.Console","Spectre.Console"],["McMaster.Extensions.CommandLineUtils","McMaster"]],testPackages:[["Microsoft.NET.Test.Sdk","VSTest"],["xunit.v3","xUnit"],["xunit","xUnit"],["NUnit","NUnit"],["MSTest.TestFramework","MSTest"],["MSTest","MSTest"]],grpcServerPackages:["Grpc.AspNetCore"],specializedSdks:[["Microsoft.NET.Sdk.Web","web","ASP.NET Core"],["Microsoft.NET.Sdk.Worker","worker","Worker"],["Microsoft.NET.Sdk.BlazorWebAssembly","blazor-wasm","Blazor WebAssembly"],["Microsoft.NET.Sdk.Razor","razor-lib","Razor Class Library"],["MSTest.Sdk","test","MSTest"],["Aspire.AppHost.Sdk","aspire","Aspire AppHost"]],baseSdk:"Microsoft.NET.Sdk"};var wM=k1.mcpPackages.map(($)=>$.toLowerCase()),EM=k1.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),SM=k1.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),jM=k1.grpcServerPackages.map(($)=>$.toLowerCase()),xM=k1.specializedSdks,CX=k1.baseSdk.toLowerCase();function bM($){let Z=$.match(/<Project\b[^>]*\bSdk\s*=\s*"([^"/]+)(?:\/[^"]*)?"/i),X=$.match(/<Sdk\b[^>]*\bName\s*=\s*"([^"]+)"/i),z=(Z?.[1]||X?.[1]||"").trim(),J=($.match(/<OutputType>\s*([^<]+?)\s*<\/OutputType>/i)?.[1]||"").trim(),Q=$.match(/<TargetFramework>\s*([^<]+?)\s*<\/TargetFramework>/i)?.[1],W=($.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i)?.[1]||Q||"").trim(),U=/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test($),G=/<UseMaui>\s*true\s*<\/UseMaui>/i.test($),q=/<UseWPF>\s*true\s*<\/UseWPF>/i.test($),V=/<UseWindowsForms>\s*true\s*<\/UseWindowsForms>/i.test($),K=new Set;for(let N of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))K.add(N[1].toLowerCase());for(let N of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))K.add(N[1].toLowerCase());let H=new Set;for(let N of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))H.add(N[1].toLowerCase());return{sdk:z,outputType:J,targetFramework:W,isTestProject:U,useMaui:G,useWpf:q,useWindowsForms:V,packages:K,frameworkRefs:H}}function u6($,Z){let X=Z.toLowerCase();if($.has(X))return!0;for(let z of $)if(z===X||z.startsWith(`${X}.`))return!0;return!1}function wX($,Z){let X;for(let[z,J]of Z){if(!u6($,z))continue;if(!X||z.length>X[0].length)X=[z,J]}return X}function kM($){let Z;for(let X of wM){if(!u6($,X))continue;if(!Z||X.length>Z.length)Z=X}for(let X of $)if(X==="modelcontextprotocol"||X.startsWith("modelcontextprotocol.")){if(!Z||X.length>Z.length)Z=X}return Z}function yM($){let Z=$.toLowerCase();if(!Z)return;let X;for(let z of xM){let J=z[0].toLowerCase();if(Z===J||Z.startsWith(`${J}/`)){if(!X||J.length>X[0].length)X=z}}return X}function B3($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function fM($,Z){if($==="mcp")return 0;if($==="mobile")return 1;if($==="backend")return 2;if($==="cli")return 3;if(Z&&Z!=="")return 4;return 5}function gM($,Z){let X=Z.replace(/\.csproj$/i,""),{sdk:z,packages:J,frameworkRefs:Q,outputType:Y}=$,W,U="",G,q=kM(J),V=yM(z),K=wX(J,SM),H=wX(J,EM),N=jM.some((O)=>u6(J,O)),L=Q.has("microsoft.aspnetcore.app");if(q)W="mcp",U="MCP",G=`${Z} + ${q} (C# MCP server)`;else if($.isTestProject||V?.[1]==="test"||K)W="library",U=K?.[1]||(V?.[1]==="test"?V[2]:"Test"),G=`${Z} + test (${U})`;else if($.useMaui)W="mobile",U="MAUI",G=`${Z} + UseMaui (MAUI)`;else if($.useWpf||$.useWindowsForms)W="backend",U=$.useWpf&&$.useWindowsForms?"WPF+WinForms":$.useWpf?"WPF":"Windows Forms",G=`${Z} + ${U}`;else if(V?.[1]==="web")W="backend",U=N?"gRPC":V[2],G=`${Z} + Sdk=${V[0]}${N?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(V?.[1]==="worker")W="backend",U=V[2],G=`${Z} + Sdk=${V[0]} (Worker)`;else if(V?.[1]==="blazor-wasm")W="backend",U=V[2],G=`${Z} + Sdk=${V[0]} (Blazor WASM)`;else if(V?.[1]==="aspire")W="backend",U=V[2],G=`${Z} + Sdk=${V[0]} (Aspire)`;else if(V?.[1]==="razor-lib")W="library",U=V[2],G=`${Z} + Sdk=${V[0]} (Razor class library)`;else if(L&&B3(Y))W="backend",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(L&&!B3(Y))W="library",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(H&&(B3(Y)||!Y))W="cli",U=H[1],G=`${Z} + ${H[0]} (C# CLI)`;else if(B3(Y))W="cli",G=`${Z} + OutputType=Exe (C# console)`;else{W="library";let O=z?` Sdk=${z}`:"";if(G=`${Z}${O} (C# class library)`.replace(" Sdk=Microsoft.NET.Sdk",""),!z||z.toLowerCase()===CX||z.toLowerCase().startsWith(`${CX}/`))G=`${Z} (C# class library)`}return{appType:W,projectName:X,targetFramework:$.targetFramework,sdk:z||"Microsoft.NET.Sdk",framework:U,found:G}}function N2($){if(!_M($))return[];try{return PM($).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}catch{return[]}}function L3($){let Z=N2($);if(Z.length===0)return null;let X=null,z=999;for(let J of Z){let Q=CM($,J),Y;try{Y=FM(Q,"utf-8")}catch{continue}let W=bM(Y),U=gM(W,J),G=fM(U.appType,U.framework);if(!X||G<z)X=U,z=G}return X}function vM($){let Z=E($,"Cargo.toml");if(!S(Z))return null;try{let z=a0(Z,"utf-8").match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return z?z[1]:null}catch{return null}}function hM($){let Z=E($,"Cargo.toml");if(!S(Z))return!1;try{let X=a0(Z,"utf-8");return/^\s*\[\[bin\]\]/m.test(X)}catch{return!1}}function uM($,Z){if(Z?.keywords?.some((z)=>/^sdk(?:\s|-|$)|-sdk$/i.test(z)))return'package.json keywords contains "sdk"';if(Z?.name&&/(?:^|[-_/])sdk(?:[-_/]|$)/i.test(Z.name))return`package.json name "${Z.name}" → sdk`;let X=vM($);if(X&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(X))return`Cargo.toml name "${X}" → sdk`;return null}function mM($){let Z=["manifest.json","public/manifest.json","src/manifest.json","app/manifest.json","extension/manifest.json","dist/manifest.json"];for(let X of Z){let z=E($,X);if(!S(z))continue;try{let J=JSON.parse(a0(z,"utf-8"));if(typeof J.manifest_version==="number")return`${X} manifest_version ${J.manifest_version} (browser extension)`}catch{}}return null}function cM($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,X=E($,"pyproject.toml");if(S(X))try{let Q=a0(X,"utf-8").match(Z);if(Q)return`pyproject.toml depends on ${Q[1]}`}catch{}let z=E($,"requirements.txt");if(S(z))try{let Q=a0(z,"utf-8").match(Z);if(Q)return`requirements.txt contains ${Q[1]}`}catch{}return null}function dM($,Z){let X=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let z of X)if(Z.dependencies?.[z]||Z.devDependencies?.[z])return`${z} dependency`}if(S(E($,"ios"))&&S(E($,"android")))return"ios/ + android/ dirs";return null}function lM($,Z){let X=E($,"Cargo.toml");if(S(X))try{let J=a0(X,"utf-8");if(/crate-type\s*=\s*\[[^\]]*"cdylib"/.test(J))return'Cargo.toml crate-type = ["cdylib"]';if(/wasm-bindgen|wasm-pack/i.test(J))return"Cargo.toml wasm-bindgen/wasm-pack"}catch{}let z=E($,"build.zig");if(S(z))try{let J=a0(z,"utf-8");if(/\.wasm\b|wasm32|setOutputFormat\(\.wasm/i.test(J))return"build.zig wasm target"}catch{}if(Z?.keywords?.some((J)=>/^wasm(?:-|$)|webassembly/i.test(J)))return'package.json keywords contains "wasm"';return null}function pM($,Z){if(!S(E($,"index.html")))return null;if(Z?.dependencies||Z?.devDependencies){let X={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((J)=>X[J]))return null}return"index.html (vanilla, no frontend framework)"}function iM($,Z){if(Z?.name&&/specification|^@.*\/spec/i.test(Z.name))return`package name "${Z.name}" → documentation`;if(Z?.keywords?.some((X)=>/^(specification|format-spec|standard)$/i.test(X)))return'package keywords contains "specification"';if(Z?.bin)return null;if(Z?.files&&Z.files.length>0){let X=/^(dist|src|lib|build|bin)(\/|$)|\/(dist|src|lib|build|bin)(\/|$)|(\.|\/)(js|ts|tsx|jsx|mjs|cjs|py|rs|go)$/,z=Z.files.some((Q)=>X.test(Q)),J=Z.files.some((Q)=>/\.(md|MD)$|examples?\//.test(Q)||Q==="README.md"||Q==="docs"||Q==="docs/");if(!z&&J)return"package.json files = docs/examples only (no source)"}return null}function nM($,Z,X){let z=X.find((J)=>J.slug==="astro"||J.slug==="gatsby");if(z)return`${z.name} (static-site framework)`;if(Z?.keywords?.some((J)=>/^(website|marketing|landing|brochure|portfolio)$/i.test(J)))return'package keywords contains "website"/"marketing"/"landing"';return null}function rM($,Z){if(!Z)return null;let X={...Z.dependencies??{},...Z.devDependencies??{}},z=["@clerk/nextjs","@clerk/clerk-react","next-auth","@auth/core","auth0","@auth0/nextjs-auth0"],J=["stripe","@stripe/stripe-js","lemonsqueezy"],Q=z.some((W)=>X[W]),Y=J.some((W)=>X[W]);if(Q&&Y)return"auth + payment dependencies";return null}function sM($,Z,X){if(Z?.keywords?.some((Q)=>/mcpaas/i.test(Q)))return'package keywords contains "mcpaas"';if(Z?.name&&/mcpaas/i.test(Z.name))return`package name "${Z.name}" → mcpaas`;let z=X.some((Q)=>Q.slug==="mcp"),J=X.some((Q)=>Q.category==="database");if(z&&J&&Z?.dependencies&&Object.keys(Z.dependencies).length>10)return"MCP + database + complex deps (platform shape)";return null}function aM($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||S(E($,"pnpm-workspace.yaml"))))return null;return"private workspace + multi-package"}function y1($){let Z=E($,"package.json");if(!S(Z))return null;try{return JSON.parse(a0(Z,"utf-8"))}catch{return null}}function oM($,Z){if(!Z.includes("*"))return S(E($,Z));let X=Z.split("/");if(X.length===1){let W=Z.split("*")[0];try{return EX($).some((U)=>U.startsWith(W))}catch{return!1}}let z=E($,...X.slice(0,-1)),J=X[X.length-1],Q=J.split("*")[0],Y=J.split("*")[1]||"";try{return EX(z).some((W)=>W.startsWith(Q)&&W.endsWith(Y))}catch{return!1}}function tM($,Z,X){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return oM(X,$.pattern);default:return!1}}function m6($){let Z=y1($);return IX.map((X)=>{let J=X.signals.filter((Q)=>tM(Q,Z,$)).length/X.signals.length;return{name:X.name,slug:X.slug,category:X.category,confidence:J}}).filter((X)=>X.confidence>0).sort((X,z)=>z.confidence-X.confidence)}function SX($){let Z=y1($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(S(E($,"tsconfig.json")))return"TypeScript";if(S(E($,"Cargo.toml")))return"Rust";if(S(E($,"go.mod")))return"Go";if(N2($).length>0)return"C#";if(S(E($,"pyproject.toml"))||S(E($,"setup.py")))return"Python";if(S(E($,"Gemfile")))return"Ruby";if(S(E($,"pom.xml"))||S(E($,"build.gradle")))return"Java";if(S(E($,"Package.swift")))return"Swift";if(S(E($,"build.zig")))return"Zig";if(S(E($,"pubspec.yaml")))return"Dart";if(Z)return"JavaScript";return"Unknown"}function jX($){let Z=y1($),X=m6($),z=[],J=iM($,Z);if(J)return z.push(J),{type:"documentation",found:z};let Q=uM($,Z);if(Q)return z.push(Q),{type:"sdk",found:z};let Y=mM($);if(Y)return z.push(Y),{type:"extension",found:z};let W=sM($,Z,X);if(W)return z.push(W),{type:"mcpaas",found:z};let U=rM($,Z);if(U)return z.push(U),{type:"saas",found:z};let G=lM($,Z);if(G)return z.push(G),{type:"wasm",found:z};let q=q3($);if(q)return z.push(q.found),{type:q.appType,found:z};let V=H3($);if(V)return z.push(V.found),{type:V.appType,found:z};let K=L3($);if(K)return z.push(K.found),{type:K.appType,found:z};let H=dM($,Z);if(H)return z.push(H),{type:"mobile",found:z};if(X.some((n)=>n.slug==="mcp"))return z.push("MCP SDK signal"),{type:"mcp",found:z};if(Z?.bin)return z.push("package.json bin"),{type:"cli",found:z};if(hM($))return z.push("Cargo.toml [[bin]]"),{type:"cli",found:z};if(S(E($,"build.zig"))){if(z.push("build.zig"),S(E($,"src/main.zig")))return z.push("src/main.zig"),{type:"cli",found:z};if(S(E($,"src/root.zig")))return z.push("src/root.zig"),{type:"library",found:z}}let L=X.some((n)=>n.slug==="svelte"||n.slug==="sveltekit");if(Z?.private===!0&&(S(E($,"pnpm-workspace.yaml"))||Z?.workspaces!==void 0)&&L)return z.push("private workspace","Svelte"),{type:"framework",found:z};if(L)return z.push("Svelte/SvelteKit"),{type:"svelte",found:z};let R=X.some((n)=>n.category==="frontend"),P=X.some((n)=>n.category==="backend");if(Z?.private&&(Z.workspaces||S(E($,"pnpm-workspace.yaml")))&&R&&P)return z.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:z};let C=aM($,Z);if(C)return z.push(C),{type:"monorepo-root",found:z};let b=nM($,Z,X);if(b)return z.push(b),{type:"website",found:z};if(X.some((n)=>n.slug==="nextjs"||n.slug==="nuxt"))return z.push(X.find((n)=>n.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:z};let k=X.some((n)=>n.category==="frontend"),i=X.some((n)=>n.category==="backend");if(k&&i)return z.push("frontend framework","backend framework"),{type:"fullstack",found:z};if(k)return z.push("frontend framework"),{type:"frontend",found:z};if(i)return z.push("backend framework"),{type:"backend",found:z};let w=cM($);if(w)return z.push(w),{type:"data-science",found:z};let u=pM($,Z);if(u)return z.push(u),{type:"html",found:z};if(Z?.main&&!Z?.bin)return z.push("package.json main (no bin)"),{type:"library",found:z};return z.push("no classifying signals — fallback"),{type:"library",found:z}}function xX($){if(S(E($,"bunfig.toml")))return"Bun";if(S(E($,"deno.json"))||S(E($,"deno.jsonc")))return"Deno";if(y1($))return"Node.js";if(S(E($,"Cargo.toml")))return"Rust";if(S(E($,"go.mod")))return"Go";if(N2($).length>0)return".NET";if(S(E($,"pubspec.yaml")))return"Dart";return"Unknown"}function bX($){if(S(E($,"pubspec.yaml")))return"pub";if(S(E($,"go.mod")))return"go modules";if(N2($).length>0)return"NuGet";if(S(E($,"bun.lockb"))||S(E($,"bun.lock")))return"bun";if(S(E($,"pnpm-lock.yaml")))return"pnpm";if(S(E($,"yarn.lock")))return"yarn";if(S(E($,"package-lock.json")))return"npm";return"npm"}function kX($){if(S(E($,".github/workflows")))return"GitHub Actions";if(S(E($,".gitlab-ci.yml")))return"GitLab CI";if(S(E($,".circleci")))return"CircleCI";if(S(E($,"Jenkinsfile")))return"Jenkins";return null}function yX($){if(S(E($,"vercel.json")))return"Vercel";if(S(E($,"netlify.toml")))return"Netlify";if(S(E($,"wrangler.toml")))return"Cloudflare";if(S(E($,"Dockerfile")))return"Docker";if(S(E($,"fly.toml")))return"Fly.io";if(S(E($,"render.yaml")))return"Render";return null}function fX($){let Z=E($,"svelte.config.js");if(!S(Z))return null;try{let z=a0(Z,"utf-8").match(/@sveltejs\/adapter-(\w+)/);if(z){let J=z[1];switch(J){case"vercel":return"Vercel";case"node":return"Node";case"static":return"Static";case"cloudflare":return"Cloudflare";case"netlify":return"Netlify";case"auto":return"Auto";default:return J}}return null}catch{return null}}function gX($){let Z=y1($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return"Vite";if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(S(E($,"tsconfig.json"))&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function M3($){return["package.json","Cargo.toml","pyproject.toml","go.mod","build.zig","build.zig.zon","src/index.ts","src/index.js","src/main.ts","src/cli.ts","src/main.rs","src/lib.rs","src/main.zig","src/root.zig","src/__init__.py","main.py","__main__.py","main.go","cmd/main.go","README.md","SPECIFICATION.md","BINARY-FORMAT.md","tsconfig.json","wrangler.toml","vercel.json"].filter((X)=>S(E($,X)))}function O3($,Z){let X={};if(Z?.scripts){for(let z of["build","test","lint","dev","start"])if(Z.scripts[z]){let J=S(E($,"bun.lock"))||S(E($,"bun.lockb"))?"bun run":"npm run";X[z]=`${J} ${z}`}}if(S(E($,"Cargo.toml"))){if(!X.build)X.build="cargo build --release";if(!X.test)X.test="cargo test";if(!X.lint)X.lint="cargo clippy"}if(S(E($,"build.zig"))){if(!X.build)X.build="zig build";if(!X.test)X.test="zig build test"}if(S(E($,"go.mod"))){if(!X.build)X.build="go build ./...";if(!X.test)X.test="go test ./..."}if(S(E($,"pyproject.toml"))||S(E($,"pytest.ini"))){if(!X.test)X.test="pytest"}return X}function vX($,Z,X,z){let J=[];if(z&&z!=="Unknown")J.push(z);let Q=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let Y of X)if(Q.has(Y.category))J.push(Y.name);if(S(E($,"bunfig.toml")))J.push("Bun");else if(S(E($,"deno.json"))||S(E($,"deno.jsonc")))J.push("Deno");if(J.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let W of Y)if(!J.some((U)=>U.toLowerCase().includes(W.toLowerCase())))J.push(W)}return J}function N3($){let Z=y1($),X=m6($),z=SX($),J=jX($),Q=J.type,Y=xX($),W=bX($),U=kX($),G=yX($),q=gX($),V=X.find((a)=>a.category==="frontend"),K=X.find((a)=>a.category==="css"),H=X.find((a)=>a.category==="ui"),N=X.find((a)=>a.category==="state"),L=X.find((a)=>a.category==="backend"),O=X.find((a)=>a.category==="database"),R=U$[Q]||U$.library,P=Q==="framework",C=X.some((a)=>a.slug==="svelte"||a.slug==="sveltekit"),b=P&&C?"svelte":P?null:null,f=Q==="svelte"||b==="svelte",k=f?fX($):null,i=f&&X.some((a)=>a.slug==="sveltekit"),w=new Set(["css_framework","ui_library","database","connection","hosting"]),u={},n=e.filter((a)=>a.path.startsWith("stack."));for(let a of n){let Z0=a.path.replace("stack.","");if(!R.includes(a.category)){u[Z0]="slotignored";continue}if(P&&w.has(Z0)){u[Z0]="slotignored";continue}switch(Z0){case"frontend":u[Z0]=V?.name??(Q==="cli"?"CLI":"");break;case"css_framework":u[Z0]=K?.name??"";break;case"ui_library":u[Z0]=H?.name??"";break;case"state_management":u[Z0]=f?N?.name??"Runes":N?.name??"";break;case"backend":u[Z0]=f?i?"SvelteKit":L?.name??"":L?.name??"";break;case"api_type":u[Z0]=i?"Server Routes":"";break;case"runtime":u[Z0]=Y!=="Unknown"?Y:"";break;case"database":u[Z0]=O?.name??"";break;case"connection":u[Z0]=O?.name??"";break;case"hosting":if(f&&k)u[Z0]=k;else u[Z0]=G??"";break;case"build":u[Z0]=f?"Vite":q??"";break;case"cicd":u[Z0]=U??"";break;case"package_manager":u[Z0]=W;break;default:u[Z0]="";break}}let x={},c=e.filter((a)=>a.path.startsWith("monorepo."));for(let a of c){let Z0=a.path.replace("monorepo.","");if(!R.includes(a.category))x[Z0]="slotignored";else x[Z0]=""}let g0={name:Z?.name??$.split("/").pop()??"project",goal:Z?.description??"",main_language:z,type:Q};if(P&&b)g0.framework=b;let c$=vX($,Z,X,z),k5=M3($),y5=O3($,Z),O4={faf_version:M1,project:g0,stack:u,human_context:{who:"",what:Z?.description??"",why:"",where:"",when:"",how:""},monorepo:x,_meta:{found:J.found}};if(c$.length>0)O4.tech_stack=c$;if(k5.length>0)O4.key_files=k5;if(Object.keys(y5).length>0)O4.commands=y5;return O4}import{existsSync as $O,readFileSync as ZO}from"fs";import{join as XO}from"path";var hX={MIN_LENGTH:8,MAX_LENGTH:280},eM=[/^(see|see\s+the?)\s+readme/i,/^(tbd|todo|fixme|coming\s+soon)\b/i,/^(software|application|app|project|tool|library|framework)\.?$/i,/^(for\s+users|for\s+developers)\.?$/i,/^(description|goal|name|title)\.?$/i,/^lorem\s+ipsum/i,/^example(\s+\w+)?\.?$/i];function m0($){let Z=$.trim();if(Z.length<hX.MIN_LENGTH)return!1;if(Z.length>hX.MAX_LENGTH)return!1;if(eM.some((X)=>X.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
212
+ `).length>4)return!1;return!0}function zO($){let Z=$.split(`
213
213
  `),X=0;while(X<Z.length&&/^(#\s|$)/.test(Z[X].trim()))X++;while(X<Z.length){let z=Z[X].trim();if(/^\[!\[/.test(z)){X++;continue}if(/^!\[/.test(z)){X++;continue}if(/^<img\s/i.test(z)){X++;continue}if(z===""){X++;continue}break}return Z.slice(X).join(`
214
- `)}function fN($){let X=yN($).split(`
215
- `),z=[];for(let J of X){let Q=J.trim();if(Q===""){if(z.length>0)break;continue}if(/^(#|>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(Q))break;if(/^\*\*[^*]+\*\*\s*$/.test(Q)&&z.length===0)continue;z.push(Q)}if(z.length===0)return null;return z.join(" ").trim()}function y1($,Z){let X=$.split(`
216
- `),z=0;while(z<X.length){let Q=X[z].trim().match(/^(#{1,6})\s+(.+)$/);if(Q&&Z.test(Q[2])){let Y=Q[1].length,W=[];z++;while(z<X.length){let U=X[z].trim(),G=U.match(/^(#{1,6})\s+/);if(G&&G[1].length<=Y)break;if(U===""){if(W.length>0)break;z++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(U))break;W.push(U),z++}if(W.length===0)return null;return W.join(" ").trim()}z++}return null}function gN($){let Z=y1($,/^(use\s+cases?|goal)\b/i);if(Z&&m0(Z))return Z;let X=fN($);if(X&&m0(X))return X;return}function vN($){let Z=y1($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&m0(Z))return Z;return}function hN($){let Z=y1($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&m0(Z))return Z;return}function uN($){let Z=y1($,/^(why|motivation|problem|rationale)\b/i);if(Z&&m0(Z))return Z;return}function mN($){let Z=y1($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&m0(Z))return Z;return}function cN($){let Z=y1($,/^(status|history|timeline|since|launched)\b/i);if(Z&&m0(Z))return Z;return}function dN($){let Z=y1($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&m0(Z))return Z;return}function g6($){let Z=["README.md","README.MD","Readme.md","readme.md"],X=null;for(let B of Z){let O=kN($,B);if(xN(O)){X=O;break}}if(!X)return{};let z;try{z=bN(X,"utf-8")}catch{return{}}let J={},Q=gN(z);if(Q)J.project={goal:Q};let Y={},W=vN(z);if(W)Y.what=W;let U=hN(z);if(U)Y.who=U;let G=uN(z);if(G)Y.why=G;let q=mN(z);if(q)Y.where=q;let V=cN(z);if(V)Y.when=V;let K=dN(z);if(K)Y.how=K;if(Object.keys(Y).length>0)J.human_context=Y;return J}import{existsSync as lN,readFileSync as pN}from"fs";import{join as iN}from"path";function nN($,Z){let X=$.split(`
217
- `),z=!1;for(let J of X){let Q=J.trim();if(/^\[/.test(Q)){z=Q==="[package]";continue}if(!z)continue;let Y=Q.match(new RegExp(`^${Z}\\s*=\\s*(.+)$`));if(Y){let W=Y[1].trim();W=W.replace(/\s*#.*$/,"").trim();let U=W.match(/^"((?:[^"\\]|\\.)*)"$/)||W.match(/^'((?:[^'\\]|\\.)*)'$/);if(U)return U[1];return W}}return null}function v6($){let Z=iN($,"Cargo.toml");if(!lN(Z))return{};let X;try{X=pN(Z,"utf-8")}catch{return{}}let z=nN(X,"description");if(z&&m0(z))return{project:{goal:z}};return{}}function rN($,Z){let X={project:{...Z.project??{},...$.project??{}},human_context:{...Z.human_context??{},...$.human_context??{}}};if(X.project&&Object.keys(X.project).length===0)delete X.project;if(X.human_context&&Object.keys(X.human_context).length===0)delete X.human_context;return X}function L4($){return rN(g6($),v6($))}import{existsSync as sN,readdirSync as bX,readFileSync as aN}from"fs";import{join as u6,dirname as oN,extname as tN,resolve as eN}from"path";var h6={"package.json":{frameworks:["Node.js","JavaScript","TypeScript"],slots:{packageManager:"npm/yarn/pnpm",mainLanguage:"JavaScript/TypeScript"},priority:35,intelligence:"ultra-high"},"README.md":{frameworks:[],slots:{targetUser:"developers",coreProblem:"understanding project",missionPurpose:"project documentation"},priority:25,intelligence:"high"},"requirements.txt":{frameworks:["Python"],slots:{packageManager:"pip",mainLanguage:"Python"},priority:35,intelligence:"ultra-high"},Pipfile:{frameworks:["Python"],slots:{packageManager:"pipenv",mainLanguage:"Python"},priority:35,intelligence:"ultra-high"},"pyproject.toml":{frameworks:["Python"],slots:{mainLanguage:"Python",runtime:"Python",backend:"Python"},priority:36,intelligence:"ultra-high"},Gemfile:{frameworks:["Ruby","Rails"],slots:{packageManager:"bundler",mainLanguage:"Ruby"},priority:35,intelligence:"ultra-high"},"composer.json":{frameworks:["PHP","Laravel","Symfony"],slots:{packageManager:"composer",mainLanguage:"PHP"},priority:35,intelligence:"ultra-high"},"Cargo.toml":{frameworks:["Rust"],slots:{packageManager:"cargo",mainLanguage:"Rust",buildTool:"cargo"},priority:36,intelligence:"ultra-high"},"go.mod":{frameworks:["Go"],slots:{packageManager:"go modules",mainLanguage:"Go",buildTool:"go build"},priority:36,intelligence:"ultra-high"},"pubspec.yaml":{frameworks:["Dart"],slots:{packageManager:"pub",mainLanguage:"Dart"},priority:35,intelligence:"ultra-high"},"pom.xml":{frameworks:["Java","Spring","Maven"],slots:{packageManager:"maven",mainLanguage:"Java",buildTool:"maven"},priority:35,intelligence:"ultra-high"},"build.gradle":{frameworks:["Java","Kotlin","Spring","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Java/Kotlin",buildTool:"gradle"},priority:35,intelligence:"ultra-high"},"next.config.js":{frameworks:["Next.js"],slots:{framework:"Next.js",runtime:"Node.js",buildTool:"Next.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"next.config.mjs":{frameworks:["Next.js"],slots:{framework:"Next.js",runtime:"Node.js",buildTool:"Next.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"next.config.ts":{frameworks:["Next.js 13+"],slots:{framework:"Next.js 13+",runtime:"Node.js",buildTool:"Next.js",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.js":{frameworks:["Nuxt 2"],slots:{framework:"Nuxt 2",runtime:"Node.js",buildTool:"Nuxt",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.ts":{frameworks:["Nuxt 3"],slots:{framework:"Nuxt 3",runtime:"Node.js",buildTool:"Nuxt",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"svelte.config.js":{frameworks:["SvelteKit"],slots:{framework:"SvelteKit",buildTool:"Vite",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"angular.json":{frameworks:["Angular"],slots:{framework:"Angular",buildTool:"Angular CLI",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"manifest.json":{frameworks:["Chrome Extension","Browser Extension"],slots:{framework:"Chrome Extension",runtime:"Chrome/Browser",mainLanguage:"JavaScript",hosting:"Chrome Web Store",apiType:"Chrome APIs"},priority:35,intelligence:"ultra-high",confirmWith:["popup.html","background.js","content.js"]},"vue.config.js":{frameworks:["Vue"],slots:{framework:"Vue",buildTool:"Vue CLI",mainLanguage:"JavaScript"},priority:30,intelligence:"high"},"remix.config.js":{frameworks:["Remix"],slots:{framework:"Remix",runtime:"Node.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"gatsby-config.js":{frameworks:["Gatsby"],slots:{framework:"Gatsby",buildTool:"Gatsby",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"gatsby-config.ts":{frameworks:["Gatsby"],slots:{framework:"Gatsby",buildTool:"Gatsby",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"astro.config.mjs":{frameworks:["Astro"],slots:{framework:"Astro",buildTool:"Vite",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"redwood.toml":{frameworks:["RedwoodJS"],slots:{framework:"RedwoodJS",buildTool:"Webpack",mainLanguage:"JavaScript/TypeScript",server:"Node.js",database:"Prisma"},priority:30,intelligence:"high"},"blitz.config.ts":{frameworks:["Blitz.js"],slots:{framework:"Blitz.js",buildTool:"Next.js",mainLanguage:"TypeScript",server:"Node.js",database:"Prisma"},priority:30,intelligence:"high"},"qwik.config.ts":{frameworks:["Qwik"],slots:{framework:"Qwik",buildTool:"Vite",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"manage.py":{frameworks:["Django"],slots:{framework:"Django",backend:"Django",mainLanguage:"Python",server:"Django",apiType:"Django Views"},priority:30,intelligence:"high"},artisan:{frameworks:["Laravel"],slots:{framework:"Laravel",backend:"Laravel",mainLanguage:"PHP",server:"PHP",apiType:"Laravel Routes"},priority:30,intelligence:"high"},"mix.exs":{frameworks:["Phoenix","Elixir"],slots:{framework:"Phoenix",backend:"Phoenix",mainLanguage:"Elixir",server:"BEAM"},priority:30,intelligence:"high"},"nest-cli.json":{frameworks:["NestJS"],slots:{framework:"NestJS",backend:"NestJS",mainLanguage:"TypeScript",server:"Node.js",apiType:"REST API"},priority:30,intelligence:"high"},"strapi.config.js":{frameworks:["Strapi"],slots:{backend:"Strapi",apiType:"REST API",database:"Required",server:"Node.js"},priority:30,intelligence:"high"},Dockerfile:{frameworks:["Docker"],slots:{hosting:"Docker",connection:"Containerized"},priority:30,intelligence:"high"},"docker-compose.yml":{frameworks:["Docker Compose"],slots:{hosting:"Docker",connection:"Multi-container"},priority:30,intelligence:"high"},"docker-compose.yaml":{frameworks:["Docker Compose"],slots:{hosting:"Docker",connection:"Multi-container"},priority:30,intelligence:"high"},"kubernetes.yml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes",connection:"Orchestrated"},priority:30,intelligence:"high"},"k8s.yaml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes",connection:"Orchestrated"},priority:30,intelligence:"high"},"vercel.json":{frameworks:["Vercel"],slots:{hosting:"Vercel",cicd:"Vercel"},priority:30,intelligence:"high"},"netlify.toml":{frameworks:["Netlify"],slots:{hosting:"Netlify",cicd:"Netlify"},priority:30,intelligence:"high"},"render.yaml":{frameworks:["Render"],slots:{hosting:"Render",cicd:"Render"},priority:30,intelligence:"high"},"fly.toml":{frameworks:["Fly.io"],slots:{hosting:"Fly.io",cicd:"Fly.io"},priority:30,intelligence:"high"},"railway.json":{frameworks:["Railway"],slots:{hosting:"Railway",cicd:"Railway"},priority:30,intelligence:"high"},"railway.toml":{frameworks:["Railway"],slots:{hosting:"Railway",cicd:"Railway"},priority:30,intelligence:"high"},"app.yaml":{frameworks:["Google App Engine"],slots:{hosting:"Google Cloud",cicd:"Google Cloud"},priority:30,intelligence:"high"},Procfile:{frameworks:["Heroku"],slots:{hosting:"Heroku",cicd:"Heroku"},priority:30,intelligence:"high"},"vite.config.js":{frameworks:["Vite"],slots:{buildTool:"Vite"},priority:25,intelligence:"medium"},"vite.config.ts":{frameworks:["Vite"],slots:{buildTool:"Vite",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"webpack.config.js":{frameworks:["Webpack"],slots:{buildTool:"Webpack"},priority:25,intelligence:"medium"},"rollup.config.js":{frameworks:["Rollup"],slots:{buildTool:"Rollup"},priority:25,intelligence:"medium"},"esbuild.config.js":{frameworks:["esbuild"],slots:{buildTool:"esbuild"},priority:25,intelligence:"medium"},"parcel.config.js":{frameworks:["Parcel"],slots:{buildTool:"Parcel"},priority:25,intelligence:"medium"},"snowpack.config.js":{frameworks:["Snowpack"],slots:{buildTool:"Snowpack"},priority:25,intelligence:"medium"},"tsconfig.json":{frameworks:["TypeScript"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"jsconfig.json":{frameworks:["JavaScript"],slots:{mainLanguage:"JavaScript"},priority:20,intelligence:"medium"},"babel.config.js":{frameworks:["Babel"],slots:{buildTool:"Babel"},priority:20,intelligence:"medium"},".babelrc":{frameworks:["Babel"],slots:{buildTool:"Babel"},priority:20,intelligence:"medium"},"jest.config.js":{frameworks:["Jest"],slots:{cicd:"Jest"},priority:25,intelligence:"medium"},"jest.config.ts":{frameworks:["Jest"],slots:{cicd:"Jest",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"vitest.config.ts":{frameworks:["Vitest"],slots:{cicd:"Vitest",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"cypress.config.js":{frameworks:["Cypress"],slots:{cicd:"Cypress"},priority:25,intelligence:"medium"},"playwright.config.ts":{frameworks:["Playwright"],slots:{cicd:"Playwright",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"karma.conf.js":{frameworks:["Karma"],slots:{cicd:"Karma"},priority:20,intelligence:"medium"},"mocha.opts":{frameworks:["Mocha"],slots:{cicd:"Mocha"},priority:20,intelligence:"medium"},".rspec":{frameworks:["RSpec"],slots:{cicd:"RSpec",mainLanguage:"Ruby"},priority:25,intelligence:"medium"},"pytest.ini":{frameworks:["Pytest"],slots:{cicd:"Pytest",mainLanguage:"Python"},priority:25,intelligence:"medium"},"phpunit.xml":{frameworks:["PHPUnit"],slots:{cicd:"PHPUnit",mainLanguage:"PHP"},priority:25,intelligence:"medium"},"schema.prisma":{frameworks:["Prisma"],slots:{database:"Prisma ORM",connection:"Prisma"},priority:25,intelligence:"medium"},"drizzle.config.ts":{frameworks:["Drizzle"],slots:{database:"Drizzle ORM",connection:"Drizzle",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"ormconfig.js":{frameworks:["TypeORM"],slots:{database:"TypeORM",connection:"TypeORM"},priority:25,intelligence:"medium"},"knexfile.js":{frameworks:["Knex.js"],slots:{database:"Knex.js",connection:"Knex.js"},priority:25,intelligence:"medium"},"sequelize.config.js":{frameworks:["Sequelize"],slots:{database:"Sequelize",connection:"Sequelize"},priority:25,intelligence:"medium"},"alembic.ini":{frameworks:["Alembic"],slots:{database:"Alembic",mainLanguage:"Python"},priority:25,intelligence:"medium"},".github/workflows":{frameworks:["GitHub Actions"],slots:{cicd:"GitHub Actions"},priority:25,intelligence:"medium"},".gitlab-ci.yml":{frameworks:["GitLab CI"],slots:{cicd:"GitLab CI"},priority:25,intelligence:"medium"},Jenkinsfile:{frameworks:["Jenkins"],slots:{cicd:"Jenkins"},priority:25,intelligence:"medium"},".circleci/config.yml":{frameworks:["CircleCI"],slots:{cicd:"CircleCI"},priority:25,intelligence:"medium"},".travis.yml":{frameworks:["Travis CI"],slots:{cicd:"Travis CI"},priority:25,intelligence:"medium"},"azure-pipelines.yml":{frameworks:["Azure DevOps"],slots:{cicd:"Azure DevOps"},priority:25,intelligence:"medium"},"bitbucket-pipelines.yml":{frameworks:["Bitbucket Pipelines"],slots:{cicd:"Bitbucket Pipelines"},priority:25,intelligence:"medium"},"tailwind.config.js":{frameworks:["Tailwind CSS"],slots:{cssFramework:"Tailwind CSS"},priority:20,intelligence:"medium"},"tailwind.config.ts":{frameworks:["Tailwind CSS"],slots:{cssFramework:"Tailwind CSS",mainLanguage:"TypeScript"},priority:20,intelligence:"medium"},"postcss.config.js":{frameworks:["PostCSS"],slots:{cssFramework:"PostCSS"},priority:20,intelligence:"medium"},"uno.config.ts":{frameworks:["UnoCSS"],slots:{cssFramework:"UnoCSS",mainLanguage:"TypeScript"},priority:20,intelligence:"medium"},"styled-components.config.js":{frameworks:["styled-components"],slots:{cssFramework:"styled-components",uiLibrary:"styled-components"},priority:20,intelligence:"medium"},"emotion.config.js":{frameworks:["Emotion"],slots:{cssFramework:"Emotion",uiLibrary:"Emotion"},priority:20,intelligence:"medium"},"metro.config.js":{frameworks:["React Native"],slots:{framework:"React Native",mainLanguage:"JavaScript"},priority:25,intelligence:"medium"},"expo.config.js":{frameworks:["Expo"],slots:{framework:"React Native",buildTool:"Expo"},priority:25,intelligence:"medium"},"app.json":{frameworks:["React Native","Expo"],slots:{framework:"React Native"},priority:20,intelligence:"medium",confirmWith:["expo"]},"capacitor.config.ts":{frameworks:["Capacitor"],slots:{framework:"Capacitor",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"ionic.config.json":{frameworks:["Ionic"],slots:{framework:"Ionic",uiLibrary:"Ionic"},priority:25,intelligence:"medium"},"nx.json":{frameworks:["Nx"],slots:{buildTool:"Nx"},priority:25,intelligence:"medium"},"turbo.json":{frameworks:["Turborepo"],slots:{buildTool:"Turborepo"},priority:25,intelligence:"medium"},"lerna.json":{frameworks:["Lerna"],slots:{buildTool:"Lerna"},priority:25,intelligence:"medium"},"rush.json":{frameworks:["Rush"],slots:{buildTool:"Rush"},priority:25,intelligence:"medium"},"pnpm-workspace.yaml":{frameworks:["pnpm workspaces"],slots:{packageManager:"pnpm",buildTool:"pnpm workspaces"},priority:25,intelligence:"medium"},"*.svelte":{frameworks:["Svelte","SvelteKit"],slots:{framework:"Svelte"},priority:15,intelligence:"low"},"*.vue":{frameworks:["Vue"],slots:{framework:"Vue"},priority:15,intelligence:"low"},"*.jsx":{frameworks:["React"],slots:{framework:"React",mainLanguage:"JavaScript"},priority:15,intelligence:"low"},"*.ts":{frameworks:["TypeScript"],slots:{mainLanguage:"TypeScript"},priority:15,intelligence:"low"},"*.tsx":{frameworks:["React","TypeScript"],slots:{framework:"React",mainLanguage:"TypeScript"},priority:15,intelligence:"low"},"*.py":{frameworks:["Python"],slots:{mainLanguage:"Python"},priority:15,intelligence:"low"},"*.rb":{frameworks:["Ruby"],slots:{mainLanguage:"Ruby"},priority:15,intelligence:"low"},"*.php":{frameworks:["PHP"],slots:{mainLanguage:"PHP"},priority:15,intelligence:"low"},"*.java":{frameworks:["Java"],slots:{mainLanguage:"Java"},priority:15,intelligence:"low"},"*.kt":{frameworks:["Kotlin"],slots:{mainLanguage:"Kotlin"},priority:15,intelligence:"low"},"*.swift":{frameworks:["Swift"],slots:{mainLanguage:"Swift"},priority:15,intelligence:"low"},"*.go":{frameworks:["Go"],slots:{mainLanguage:"Go"},priority:15,intelligence:"low"},"*.rs":{frameworks:["Rust"],slots:{mainLanguage:"Rust"},priority:15,intelligence:"low"},"*.dart":{frameworks:["Flutter","Dart"],slots:{mainLanguage:"Dart"},priority:15,intelligence:"low"},"*.ex":{frameworks:["Elixir"],slots:{mainLanguage:"Elixir"},priority:15,intelligence:"low"},"*.exs":{frameworks:["Elixir"],slots:{mainLanguage:"Elixir"},priority:15,intelligence:"low"},"*.scala":{frameworks:["Scala"],slots:{mainLanguage:"Scala"},priority:15,intelligence:"low"},"*.clj":{frameworks:["Clojure"],slots:{mainLanguage:"Clojure"},priority:15,intelligence:"low"},"*.lua":{frameworks:["Lua"],slots:{mainLanguage:"Lua"},priority:15,intelligence:"low"},"*.r":{frameworks:["R"],slots:{mainLanguage:"R"},priority:15,intelligence:"low"},"*.R":{frameworks:["R"],slots:{mainLanguage:"R"},priority:15,intelligence:"low"},"*.jl":{frameworks:["Julia"],slots:{mainLanguage:"Julia"},priority:15,intelligence:"low"},"*.nim":{frameworks:["Nim"],slots:{mainLanguage:"Nim"},priority:15,intelligence:"low"},"*.zig":{frameworks:["Zig"],slots:{mainLanguage:"Zig"},priority:15,intelligence:"low"},"build.zig":{frameworks:["Zig"],slots:{packageManager:"Zig Package Manager",mainLanguage:"Zig",buildTool:"zig build",framework:"Zig",build:"zig build"},priority:35,intelligence:"ultra-high"},"openapi.json":{frameworks:["OpenAPI"],slots:{apiType:"REST API",backend:"API Server"},priority:30,intelligence:"high"},"openapi.yaml":{frameworks:["OpenAPI"],slots:{apiType:"REST API",backend:"API Server"},priority:30,intelligence:"high"},"swagger.json":{frameworks:["Swagger"],slots:{apiType:"REST API",backend:"API Server"},priority:30,intelligence:"high"},"graphql.schema":{frameworks:["GraphQL"],slots:{apiType:"GraphQL",backend:"GraphQL Server"},priority:30,intelligence:"high"},"schema.graphql":{frameworks:["GraphQL"],slots:{apiType:"GraphQL",backend:"GraphQL Server"},priority:30,intelligence:"high"},".graphqlconfig":{frameworks:["GraphQL"],slots:{apiType:"GraphQL"},priority:25,intelligence:"medium"},"redux.config.js":{frameworks:["Redux"],slots:{stateManagement:"Redux"},priority:20,intelligence:"medium"},"mobx.config.js":{frameworks:["MobX"],slots:{stateManagement:"MobX"},priority:20,intelligence:"medium"},"vuex.config.js":{frameworks:["Vuex"],slots:{stateManagement:"Vuex",framework:"Vue"},priority:20,intelligence:"medium"},"pinia.config.js":{frameworks:["Pinia"],slots:{stateManagement:"Pinia",framework:"Vue"},priority:20,intelligence:"medium"},"zustand.config.js":{frameworks:["Zustand"],slots:{stateManagement:"Zustand"},priority:20,intelligence:"medium"},".eslintrc.js":{frameworks:["ESLint"],slots:{},priority:15,intelligence:"low"},".eslintrc.json":{frameworks:["ESLint"],slots:{},priority:15,intelligence:"low"},".prettierrc":{frameworks:["Prettier"],slots:{},priority:15,intelligence:"low"},".prettierrc.json":{frameworks:["Prettier"],slots:{},priority:15,intelligence:"low"},"biome.json":{frameworks:["Biome"],slots:{},priority:15,intelligence:"low"},".editorconfig":{frameworks:["EditorConfig"],slots:{},priority:10,intelligence:"low"},"serverless.yml":{frameworks:["Serverless Framework"],slots:{hosting:"AWS Lambda/Azure/GCP",backend:"Serverless",apiType:"API Gateway"},priority:30,intelligence:"high"},"serverless.yaml":{frameworks:["Serverless Framework"],slots:{hosting:"AWS Lambda/Azure/GCP",backend:"Serverless",apiType:"API Gateway"},priority:30,intelligence:"high"},"sam.yaml":{frameworks:["AWS SAM"],slots:{hosting:"AWS Lambda",backend:"AWS SAM",cicd:"AWS SAM CLI"},priority:30,intelligence:"high"},"template.yaml":{frameworks:["AWS SAM","CloudFormation"],slots:{hosting:"AWS",backend:"AWS SAM/CloudFormation",cicd:"AWS"},priority:25,intelligence:"medium",confirmWith:["samconfig.toml"]},"amplify.yml":{frameworks:["AWS Amplify"],slots:{hosting:"AWS Amplify",backend:"AWS Amplify",cicd:"AWS Amplify"},priority:30,intelligence:"high"},Podfile:{frameworks:["CocoaPods","iOS"],slots:{packageManager:"CocoaPods",mainLanguage:"Swift/Objective-C",framework:"iOS Native"},priority:30,intelligence:"high"},"build.gradle.kts":{frameworks:["Gradle Kotlin DSL","Android","Kotlin"],slots:{packageManager:"Gradle",mainLanguage:"Kotlin",buildTool:"Gradle Kotlin DSL",framework:"Android"},priority:30,intelligence:"high"},"*.ipynb":{frameworks:["Jupyter","Python"],slots:{mainLanguage:"Python",framework:"Jupyter Notebook"},priority:30,intelligence:"high"},MLproject:{frameworks:["MLflow"],slots:{mainLanguage:"Python",framework:"MLflow",backend:"MLflow",cicd:"MLflow"},priority:30,intelligence:"high"},"dvc.yaml":{frameworks:["DVC","Data Version Control"],slots:{mainLanguage:"Python",framework:"DVC",cicd:"DVC Pipelines"},priority:30,intelligence:"high"},"dvc.lock":{frameworks:["DVC"],slots:{framework:"DVC"},priority:20,intelligence:"medium"},"wrangler.toml":{frameworks:["Cloudflare Workers","Cloudflare"],slots:{hosting:"Cloudflare Workers",backend:"Cloudflare Workers",runtime:"V8 Isolates"},priority:30,intelligence:"high"},"deno.json":{frameworks:["Deno"],slots:{runtime:"Deno",mainLanguage:"TypeScript",packageManager:"Deno"},priority:30,intelligence:"high"},"bun.lockb":{frameworks:["Bun"],slots:{runtime:"Bun",packageManager:"Bun",mainLanguage:"TypeScript/JavaScript"},priority:30,intelligence:"high"},"codecov.yml":{frameworks:["Codecov"],slots:{cicd:"Codecov"},priority:25,intelligence:"high"},"dependabot.yml":{frameworks:["Dependabot","GitHub"],slots:{cicd:"Dependabot"},priority:25,intelligence:"high"},"renovate.json":{frameworks:["Renovate"],slots:{cicd:"Renovate"},priority:25,intelligence:"high"},Makefile:{frameworks:["Make","GNU Make"],slots:{buildTool:"Make"},priority:30,intelligence:"high"},"CMakeLists.txt":{frameworks:["CMake","C","C++"],slots:{buildTool:"CMake",mainLanguage:"C/C++"},priority:30,intelligence:"high"},"meson.build":{frameworks:["Meson","C","C++"],slots:{buildTool:"Meson",mainLanguage:"C/C++"},priority:30,intelligence:"high"},"*.c":{frameworks:["C"],slots:{mainLanguage:"C"},priority:30,intelligence:"high"},"*.cpp":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:30,intelligence:"high"},"*.cc":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:30,intelligence:"high"},"*.cxx":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:25,intelligence:"high"},"*.h":{frameworks:["C","C++"],slots:{mainLanguage:"C/C++"},priority:25,intelligence:"high"},"*.hpp":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:25,intelligence:"high"},"*.hxx":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:20,intelligence:"medium"},".env":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.example":{frameworks:[],slots:{},priority:25,intelligence:"high"},".env.local":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.development":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.production":{frameworks:[],slots:{},priority:20,intelligence:"medium"},"skaffold.yaml":{frameworks:["Skaffold","Kubernetes"],slots:{hosting:"Kubernetes",cicd:"Skaffold"},priority:30,intelligence:"high"},"Chart.yaml":{frameworks:["Helm","Kubernetes"],slots:{hosting:"Kubernetes",backend:"Helm"},priority:30,intelligence:"high"},"values.yaml":{frameworks:["Helm","Kubernetes"],slots:{hosting:"Kubernetes"},priority:25,intelligence:"high",confirmWith:["Chart.yaml"]},"pulumi.yaml":{frameworks:["Pulumi"],slots:{hosting:"Cloud",cicd:"Pulumi"},priority:30,intelligence:"high"},"Pulumi.yaml":{frameworks:["Pulumi"],slots:{hosting:"Cloud",cicd:"Pulumi"},priority:30,intelligence:"high"},"terragrunt.hcl":{frameworks:["Terragrunt","Terraform"],slots:{hosting:"Cloud",cicd:"Terragrunt"},priority:30,intelligence:"high"},"ansible.yml":{frameworks:["Ansible"],slots:{cicd:"Ansible"},priority:30,intelligence:"high"},"playbook.yml":{frameworks:["Ansible"],slots:{cicd:"Ansible"},priority:25,intelligence:"high"},"*.cs":{frameworks:["C#",".NET","Unity"],slots:{mainLanguage:"C#"},priority:30,intelligence:"high"},"*.m":{frameworks:["Objective-C","iOS"],slots:{mainLanguage:"Objective-C"},priority:25,intelligence:"high"},".nvmrc":{frameworks:["Node.js","nvm"],slots:{runtime:"Node.js"},priority:25,intelligence:"high"},".tool-versions":{frameworks:["asdf"],slots:{},priority:25,intelligence:"high"},".ruby-version":{frameworks:["Ruby","rbenv"],slots:{mainLanguage:"Ruby",runtime:"Ruby"},priority:25,intelligence:"high"},".python-version":{frameworks:["Python","pyenv"],slots:{mainLanguage:"Python",runtime:"Python"},priority:25,intelligence:"high"},".dockerignore":{frameworks:["Docker"],slots:{},priority:20,intelligence:"medium"},".gitattributes":{frameworks:["Git"],slots:{},priority:15,intelligence:"low"},".npmrc":{frameworks:["npm","Node.js"],slots:{packageManager:"npm"},priority:20,intelligence:"medium"},"sonar-project.properties":{frameworks:["SonarQube","SonarCloud"],slots:{cicd:"SonarQube"},priority:25,intelligence:"high"},"*.fs":{frameworks:["F#",".NET"],slots:{mainLanguage:"F#"},priority:25,intelligence:"high"},"*.mm":{frameworks:["Objective-C++","iOS","macOS"],slots:{mainLanguage:"Objective-C++"},priority:25,intelligence:"high"},"build.zig.zon":{frameworks:["Zig"],slots:{mainLanguage:"Zig",packageManager:"Zig Package Manager",buildTool:"zig build"},priority:35,intelligence:"ultra-high"},"gleam.toml":{frameworks:["Gleam","BEAM","Erlang"],slots:{mainLanguage:"Gleam",runtime:"BEAM",packageManager:"Gleam"},priority:30,intelligence:"high"},"bunfig.toml":{frameworks:["Bun"],slots:{runtime:"Bun",packageManager:"Bun",buildTool:"Bun"},priority:30,intelligence:"high"},"mise.toml":{frameworks:["mise"],slots:{},priority:25,intelligence:"high"},".mise.toml":{frameworks:["mise"],slots:{},priority:25,intelligence:"high"},"manifest.toml":{frameworks:["Flox","Nix"],slots:{},priority:25,intelligence:"high",confirmWith:[".flox"]},justfile:{frameworks:["Just"],slots:{buildTool:"Just"},priority:25,intelligence:"high"},".pre-commit-config.yaml":{frameworks:["pre-commit"],slots:{cicd:"pre-commit"},priority:25,intelligence:"high"},"CLAUDE.md":{frameworks:["Claude Code"],slots:{},priority:30,intelligence:"high",confirmWith:[".claude"]}};var $M=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),ZM=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),XM={mainLanguage:["project","main_language"],main_language:["project","main_language"],framework:["stack","frontend"],cssFramework:["stack","css_framework"],css:["stack","css_framework"],uiLibrary:["stack","ui_library"],ui_library:["stack","ui_library"],stateManagement:["stack","state_management"],state:["stack","state_management"],backend:["stack","backend"],apiType:["stack","api_type"],api:["stack","api_type"],runtime:["stack","runtime"],database:["stack","database"],db:["stack","database"],connection:["stack","connection"],hosting:["stack","hosting"],buildTool:["stack","build"],build_tool:["stack","build"],build:["stack","build"],packageManager:["stack","package_manager"],pkg_manager:["stack","package_manager"],cicd:["stack","cicd"]},zM=[["packageManager","package-manager"],["pkg_manager","package-manager"],["mainLanguage","language"],["main_language","language"],["framework","framework"],["backend","backend"],["database","database"],["db","database"],["cicd","ci-cd"],["hosting","hosting"],["buildTool","build"],["build_tool","build"],["build","build"],["runtime","runtime"],["cssFramework","css"],["css","css"],["uiLibrary","ui-library"],["stateManagement","state-management"],["apiType","api"],["api","api"]];function JM($,Z){for(let[X,z]of zM)if(X in $)return z;return Z.length>0?"framework":"config"}function QM($){try{let Z=JSON.parse(aN($,"utf-8")),X=["background","content_scripts","action","browser_action","permissions"].some((z)=>(z in Z));if(typeof Z.manifest_version==="number"&&X)return"chrome";return"other"}catch{return"other"}}function YM($){let Z=[],X=eN($),z=sN(u6($,".git"));for(let J=0;J<10;J++){let Q;try{Q=bX(X)}catch{break}for(let W of Q){let U=h6[W];if(!U)continue;if(W==="manifest.json"&&QM(u6(X,W))!=="chrome")continue;if(W==="pubspec.yaml"){let G=U4(X);if(G){let q={mainLanguage:"Dart",packageManager:"pub"};if(G.isFlutter){if(q.framework="Flutter",G.stateManagement)q.stateManagement=G.stateManagement}else if(G.appType==="backend"&&G.framework)q.backend=G.framework;else if(G.appType==="mcp")q.apiType="MCP";Z.push({slots:q,priority:U.priority,frameworks:G.isFlutter?["Flutter","Dart"]:["Dart"],fileName:W});continue}}if(W==="go.mod"){let G=V4(X);if(G){let q={mainLanguage:"Go",packageManager:"go modules",buildTool:"go build"};if(G.appType==="backend"&&G.framework)q.backend=G.framework;else if(G.appType==="cli"&&G.framework)q.framework=G.framework;else if(G.appType==="mcp")q.apiType="MCP";let V=G.framework?[G.framework,"Go"]:["Go"];Z.push({slots:q,priority:U.priority,frameworks:V,fileName:W});continue}}Z.push({slots:U.slots||{},priority:U.priority,frameworks:U.frameworks,fileName:W})}if(z&&J===0)break;let Y=oN(X);if(Y===X)break;X=Y}return Z}function WM($){let Z=[];for(let X of kX($,2,{count:0})){let z=h6[`*${X}`],J=z?.slots?.mainLanguage;if(J)Z.push({slots:{mainLanguage:J},priority:z.priority,frameworks:z.frameworks})}return Z}function UM($){let Z=[...YM($),...WM($)],X={},z={},J=new Set;for(let G of Z){G.frameworks.forEach((q)=>J.add(q));for(let[q,V]of Object.entries(G.slots))if(V&&!V.includes("/")&&(!(q in X)||G.priority>z[q]))X[q]=V,z[q]=G.priority}let Q=new Map;for(let G of Z){if(!G.fileName)continue;if(!Q.has(G.fileName))Q.set(G.fileName,{fileName:G.fileName,category:JM(G.slots,G.frameworks),priority:G.priority})}let Y=[...Q.values()].sort((G,q)=>q.priority-G.priority||G.fileName.localeCompare(q.fileName)),W=[];if(X.mainLanguage)W.push(X.mainLanguage.toLowerCase());if(X.framework)W.push(X.framework.toLowerCase());let U=W.length>0?W.join("-"):"unknown-stack";return{slotFills:X,frameworks:[...J],confirmedCount:Z.length,discoveredFormats:Y,stackSignature:U}}function N4($){let{slotFills:Z}=UM($),X={};for(let[z,J]of Object.entries(Z)){let Q=XM[z];if(!Q||!J)continue;let[Y,W]=Q;if(Y==="project")(X.project??={})[W]=J;else(X.stack??={})[W]=J}return X}function kX($,Z,X){let z=new Set;if(Z<0||X.count>400)return z;let J;try{J=bX($,{withFileTypes:!0})}catch{return z}for(let Q of J){if(X.count++>400)break;if(!Q.isDirectory()){let Y=tN(Q.name);if(ZM.has(Y))z.add(Y);continue}if($M.has(Q.name)||Q.name.startsWith("."))continue;for(let Y of kX(u6($,Q.name),Z-1,X))z.add(Y)}return z}import{existsSync as yX,readFileSync as fX}from"fs";import{join as gX}from"path";var L0=($,Z,X)=>({value:$,source:Z,confidence:X});function GM($){let Z=qM($),X=VM($),z={},J=(Q,Y)=>{if(Y)z[Q]=Y};return J("what",KM(Z,X)),J("who",HM(X)),J("why",BM(X)),J("where",LM(Z,X)),J("when",NM(X)),J("how",MM(Z,X)),z}function M4($){let Z=GM($),X={};return Object.keys(Z).forEach((z)=>{let J=Z[z];if(J)X[z]=J.value}),X}function qM($){let Z=gX($,"package.json");if(!yX(Z))return null;try{return JSON.parse(fX(Z,"utf-8"))}catch{return null}}function VM($){let Z=gX($,"README.md");if(!yX(Z))return"";let X;try{X=fX(Z,"utf-8")}catch{return""}return X.split(`
214
+ `)}function JO($){let X=zO($).split(`
215
+ `),z=[];for(let J of X){let Q=J.trim();if(Q===""){if(z.length>0)break;continue}if(/^(#|>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(Q))break;if(/^\*\*[^*]+\*\*\s*$/.test(Q)&&z.length===0)continue;z.push(Q)}if(z.length===0)return null;return z.join(" ").trim()}function f1($,Z){let X=$.split(`
216
+ `),z=0;while(z<X.length){let Q=X[z].trim().match(/^(#{1,6})\s+(.+)$/);if(Q&&Z.test(Q[2])){let Y=Q[1].length,W=[];z++;while(z<X.length){let U=X[z].trim(),G=U.match(/^(#{1,6})\s+/);if(G&&G[1].length<=Y)break;if(U===""){if(W.length>0)break;z++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(U))break;W.push(U),z++}if(W.length===0)return null;return W.join(" ").trim()}z++}return null}function QO($){let Z=f1($,/^(use\s+cases?|goal)\b/i);if(Z&&m0(Z))return Z;let X=JO($);if(X&&m0(X))return X;return}function YO($){let Z=f1($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&m0(Z))return Z;return}function WO($){let Z=f1($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&m0(Z))return Z;return}function UO($){let Z=f1($,/^(why|motivation|problem|rationale)\b/i);if(Z&&m0(Z))return Z;return}function GO($){let Z=f1($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&m0(Z))return Z;return}function qO($){let Z=f1($,/^(status|history|timeline|since|launched)\b/i);if(Z&&m0(Z))return Z;return}function VO($){let Z=f1($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&m0(Z))return Z;return}function c6($){let Z=["README.md","README.MD","Readme.md","readme.md"],X=null;for(let H of Z){let N=XO($,H);if($O(N)){X=N;break}}if(!X)return{};let z;try{z=ZO(X,"utf-8")}catch{return{}}let J={},Q=QO(z);if(Q)J.project={goal:Q};let Y={},W=YO(z);if(W)Y.what=W;let U=WO(z);if(U)Y.who=U;let G=UO(z);if(G)Y.why=G;let q=GO(z);if(q)Y.where=q;let V=qO(z);if(V)Y.when=V;let K=VO(z);if(K)Y.how=K;if(Object.keys(Y).length>0)J.human_context=Y;return J}import{existsSync as KO,readFileSync as HO}from"fs";import{join as BO}from"path";function LO($,Z){let X=$.split(`
217
+ `),z=!1;for(let J of X){let Q=J.trim();if(/^\[/.test(Q)){z=Q==="[package]";continue}if(!z)continue;let Y=Q.match(new RegExp(`^${Z}\\s*=\\s*(.+)$`));if(Y){let W=Y[1].trim();W=W.replace(/\s*#.*$/,"").trim();let U=W.match(/^"((?:[^"\\]|\\.)*)"$/)||W.match(/^'((?:[^'\\]|\\.)*)'$/);if(U)return U[1];return W}}return null}function d6($){let Z=BO($,"Cargo.toml");if(!KO(Z))return{};let X;try{X=HO(Z,"utf-8")}catch{return{}}let z=LO(X,"description");if(z&&m0(z))return{project:{goal:z}};return{}}function MO($,Z){let X={project:{...Z.project??{},...$.project??{}},human_context:{...Z.human_context??{},...$.human_context??{}}};if(X.project&&Object.keys(X.project).length===0)delete X.project;if(X.human_context&&Object.keys(X.human_context).length===0)delete X.human_context;return X}function T3($){return MO(c6($),d6($))}import{existsSync as OO,readdirSync as uX,readFileSync as NO}from"fs";import{join as p6,dirname as TO,extname as DO,resolve as IO}from"path";var l6={"package.json":{frameworks:["Node.js","JavaScript","TypeScript"],slots:{packageManager:"npm/yarn/pnpm",mainLanguage:"JavaScript/TypeScript"},priority:35,intelligence:"ultra-high"},"README.md":{frameworks:[],slots:{targetUser:"developers",coreProblem:"understanding project",missionPurpose:"project documentation"},priority:25,intelligence:"high"},"requirements.txt":{frameworks:["Python"],slots:{packageManager:"pip",mainLanguage:"Python"},priority:35,intelligence:"ultra-high"},Pipfile:{frameworks:["Python"],slots:{packageManager:"pipenv",mainLanguage:"Python"},priority:35,intelligence:"ultra-high"},"pyproject.toml":{frameworks:["Python"],slots:{mainLanguage:"Python",runtime:"Python",backend:"Python"},priority:36,intelligence:"ultra-high"},Gemfile:{frameworks:["Ruby","Rails"],slots:{packageManager:"bundler",mainLanguage:"Ruby"},priority:35,intelligence:"ultra-high"},"composer.json":{frameworks:["PHP","Laravel","Symfony"],slots:{packageManager:"composer",mainLanguage:"PHP"},priority:35,intelligence:"ultra-high"},"Cargo.toml":{frameworks:["Rust"],slots:{packageManager:"cargo",mainLanguage:"Rust",buildTool:"cargo"},priority:36,intelligence:"ultra-high"},"go.mod":{frameworks:["Go"],slots:{packageManager:"go modules",mainLanguage:"Go",buildTool:"go build"},priority:36,intelligence:"ultra-high"},"*.csproj":{frameworks:["C#",".NET"],slots:{packageManager:"NuGet",mainLanguage:"C#",buildTool:"dotnet"},priority:36,intelligence:"ultra-high"},"pubspec.yaml":{frameworks:["Dart"],slots:{packageManager:"pub",mainLanguage:"Dart"},priority:35,intelligence:"ultra-high"},"pom.xml":{frameworks:["Java","Spring","Maven"],slots:{packageManager:"maven",mainLanguage:"Java",buildTool:"maven"},priority:35,intelligence:"ultra-high"},"build.gradle":{frameworks:["Java","Kotlin","Spring","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Java/Kotlin",buildTool:"gradle"},priority:35,intelligence:"ultra-high"},"next.config.js":{frameworks:["Next.js"],slots:{framework:"Next.js",runtime:"Node.js",buildTool:"Next.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"next.config.mjs":{frameworks:["Next.js"],slots:{framework:"Next.js",runtime:"Node.js",buildTool:"Next.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"next.config.ts":{frameworks:["Next.js 13+"],slots:{framework:"Next.js 13+",runtime:"Node.js",buildTool:"Next.js",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.js":{frameworks:["Nuxt 2"],slots:{framework:"Nuxt 2",runtime:"Node.js",buildTool:"Nuxt",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.ts":{frameworks:["Nuxt 3"],slots:{framework:"Nuxt 3",runtime:"Node.js",buildTool:"Nuxt",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"svelte.config.js":{frameworks:["SvelteKit"],slots:{framework:"SvelteKit",buildTool:"Vite",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"angular.json":{frameworks:["Angular"],slots:{framework:"Angular",buildTool:"Angular CLI",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"manifest.json":{frameworks:["Chrome Extension","Browser Extension"],slots:{framework:"Chrome Extension",runtime:"Chrome/Browser",mainLanguage:"JavaScript",hosting:"Chrome Web Store",apiType:"Chrome APIs"},priority:35,intelligence:"ultra-high",confirmWith:["popup.html","background.js","content.js"]},"vue.config.js":{frameworks:["Vue"],slots:{framework:"Vue",buildTool:"Vue CLI",mainLanguage:"JavaScript"},priority:30,intelligence:"high"},"remix.config.js":{frameworks:["Remix"],slots:{framework:"Remix",runtime:"Node.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"gatsby-config.js":{frameworks:["Gatsby"],slots:{framework:"Gatsby",buildTool:"Gatsby",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"gatsby-config.ts":{frameworks:["Gatsby"],slots:{framework:"Gatsby",buildTool:"Gatsby",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"astro.config.mjs":{frameworks:["Astro"],slots:{framework:"Astro",buildTool:"Vite",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"redwood.toml":{frameworks:["RedwoodJS"],slots:{framework:"RedwoodJS",buildTool:"Webpack",mainLanguage:"JavaScript/TypeScript",server:"Node.js",database:"Prisma"},priority:30,intelligence:"high"},"blitz.config.ts":{frameworks:["Blitz.js"],slots:{framework:"Blitz.js",buildTool:"Next.js",mainLanguage:"TypeScript",server:"Node.js",database:"Prisma"},priority:30,intelligence:"high"},"qwik.config.ts":{frameworks:["Qwik"],slots:{framework:"Qwik",buildTool:"Vite",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"manage.py":{frameworks:["Django"],slots:{framework:"Django",backend:"Django",mainLanguage:"Python",server:"Django",apiType:"Django Views"},priority:30,intelligence:"high"},artisan:{frameworks:["Laravel"],slots:{framework:"Laravel",backend:"Laravel",mainLanguage:"PHP",server:"PHP",apiType:"Laravel Routes"},priority:30,intelligence:"high"},"mix.exs":{frameworks:["Phoenix","Elixir"],slots:{framework:"Phoenix",backend:"Phoenix",mainLanguage:"Elixir",server:"BEAM"},priority:30,intelligence:"high"},"nest-cli.json":{frameworks:["NestJS"],slots:{framework:"NestJS",backend:"NestJS",mainLanguage:"TypeScript",server:"Node.js",apiType:"REST API"},priority:30,intelligence:"high"},"strapi.config.js":{frameworks:["Strapi"],slots:{backend:"Strapi",apiType:"REST API",database:"Required",server:"Node.js"},priority:30,intelligence:"high"},Dockerfile:{frameworks:["Docker"],slots:{hosting:"Docker",connection:"Containerized"},priority:30,intelligence:"high"},"docker-compose.yml":{frameworks:["Docker Compose"],slots:{hosting:"Docker",connection:"Multi-container"},priority:30,intelligence:"high"},"docker-compose.yaml":{frameworks:["Docker Compose"],slots:{hosting:"Docker",connection:"Multi-container"},priority:30,intelligence:"high"},"kubernetes.yml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes",connection:"Orchestrated"},priority:30,intelligence:"high"},"k8s.yaml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes",connection:"Orchestrated"},priority:30,intelligence:"high"},"vercel.json":{frameworks:["Vercel"],slots:{hosting:"Vercel",cicd:"Vercel"},priority:30,intelligence:"high"},"netlify.toml":{frameworks:["Netlify"],slots:{hosting:"Netlify",cicd:"Netlify"},priority:30,intelligence:"high"},"render.yaml":{frameworks:["Render"],slots:{hosting:"Render",cicd:"Render"},priority:30,intelligence:"high"},"fly.toml":{frameworks:["Fly.io"],slots:{hosting:"Fly.io",cicd:"Fly.io"},priority:30,intelligence:"high"},"railway.json":{frameworks:["Railway"],slots:{hosting:"Railway",cicd:"Railway"},priority:30,intelligence:"high"},"railway.toml":{frameworks:["Railway"],slots:{hosting:"Railway",cicd:"Railway"},priority:30,intelligence:"high"},"app.yaml":{frameworks:["Google App Engine"],slots:{hosting:"Google Cloud",cicd:"Google Cloud"},priority:30,intelligence:"high"},Procfile:{frameworks:["Heroku"],slots:{hosting:"Heroku",cicd:"Heroku"},priority:30,intelligence:"high"},"vite.config.js":{frameworks:["Vite"],slots:{buildTool:"Vite"},priority:25,intelligence:"medium"},"vite.config.ts":{frameworks:["Vite"],slots:{buildTool:"Vite",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"webpack.config.js":{frameworks:["Webpack"],slots:{buildTool:"Webpack"},priority:25,intelligence:"medium"},"rollup.config.js":{frameworks:["Rollup"],slots:{buildTool:"Rollup"},priority:25,intelligence:"medium"},"esbuild.config.js":{frameworks:["esbuild"],slots:{buildTool:"esbuild"},priority:25,intelligence:"medium"},"parcel.config.js":{frameworks:["Parcel"],slots:{buildTool:"Parcel"},priority:25,intelligence:"medium"},"snowpack.config.js":{frameworks:["Snowpack"],slots:{buildTool:"Snowpack"},priority:25,intelligence:"medium"},"tsconfig.json":{frameworks:["TypeScript"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"jsconfig.json":{frameworks:["JavaScript"],slots:{mainLanguage:"JavaScript"},priority:20,intelligence:"medium"},"babel.config.js":{frameworks:["Babel"],slots:{buildTool:"Babel"},priority:20,intelligence:"medium"},".babelrc":{frameworks:["Babel"],slots:{buildTool:"Babel"},priority:20,intelligence:"medium"},"jest.config.js":{frameworks:["Jest"],slots:{cicd:"Jest"},priority:25,intelligence:"medium"},"jest.config.ts":{frameworks:["Jest"],slots:{cicd:"Jest",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"vitest.config.ts":{frameworks:["Vitest"],slots:{cicd:"Vitest",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"cypress.config.js":{frameworks:["Cypress"],slots:{cicd:"Cypress"},priority:25,intelligence:"medium"},"playwright.config.ts":{frameworks:["Playwright"],slots:{cicd:"Playwright",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"karma.conf.js":{frameworks:["Karma"],slots:{cicd:"Karma"},priority:20,intelligence:"medium"},"mocha.opts":{frameworks:["Mocha"],slots:{cicd:"Mocha"},priority:20,intelligence:"medium"},".rspec":{frameworks:["RSpec"],slots:{cicd:"RSpec",mainLanguage:"Ruby"},priority:25,intelligence:"medium"},"pytest.ini":{frameworks:["Pytest"],slots:{cicd:"Pytest",mainLanguage:"Python"},priority:25,intelligence:"medium"},"phpunit.xml":{frameworks:["PHPUnit"],slots:{cicd:"PHPUnit",mainLanguage:"PHP"},priority:25,intelligence:"medium"},"schema.prisma":{frameworks:["Prisma"],slots:{database:"Prisma ORM",connection:"Prisma"},priority:25,intelligence:"medium"},"drizzle.config.ts":{frameworks:["Drizzle"],slots:{database:"Drizzle ORM",connection:"Drizzle",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"ormconfig.js":{frameworks:["TypeORM"],slots:{database:"TypeORM",connection:"TypeORM"},priority:25,intelligence:"medium"},"knexfile.js":{frameworks:["Knex.js"],slots:{database:"Knex.js",connection:"Knex.js"},priority:25,intelligence:"medium"},"sequelize.config.js":{frameworks:["Sequelize"],slots:{database:"Sequelize",connection:"Sequelize"},priority:25,intelligence:"medium"},"alembic.ini":{frameworks:["Alembic"],slots:{database:"Alembic",mainLanguage:"Python"},priority:25,intelligence:"medium"},".github/workflows":{frameworks:["GitHub Actions"],slots:{cicd:"GitHub Actions"},priority:25,intelligence:"medium"},".gitlab-ci.yml":{frameworks:["GitLab CI"],slots:{cicd:"GitLab CI"},priority:25,intelligence:"medium"},Jenkinsfile:{frameworks:["Jenkins"],slots:{cicd:"Jenkins"},priority:25,intelligence:"medium"},".circleci/config.yml":{frameworks:["CircleCI"],slots:{cicd:"CircleCI"},priority:25,intelligence:"medium"},".travis.yml":{frameworks:["Travis CI"],slots:{cicd:"Travis CI"},priority:25,intelligence:"medium"},"azure-pipelines.yml":{frameworks:["Azure DevOps"],slots:{cicd:"Azure DevOps"},priority:25,intelligence:"medium"},"bitbucket-pipelines.yml":{frameworks:["Bitbucket Pipelines"],slots:{cicd:"Bitbucket Pipelines"},priority:25,intelligence:"medium"},"tailwind.config.js":{frameworks:["Tailwind CSS"],slots:{cssFramework:"Tailwind CSS"},priority:20,intelligence:"medium"},"tailwind.config.ts":{frameworks:["Tailwind CSS"],slots:{cssFramework:"Tailwind CSS",mainLanguage:"TypeScript"},priority:20,intelligence:"medium"},"postcss.config.js":{frameworks:["PostCSS"],slots:{cssFramework:"PostCSS"},priority:20,intelligence:"medium"},"uno.config.ts":{frameworks:["UnoCSS"],slots:{cssFramework:"UnoCSS",mainLanguage:"TypeScript"},priority:20,intelligence:"medium"},"styled-components.config.js":{frameworks:["styled-components"],slots:{cssFramework:"styled-components",uiLibrary:"styled-components"},priority:20,intelligence:"medium"},"emotion.config.js":{frameworks:["Emotion"],slots:{cssFramework:"Emotion",uiLibrary:"Emotion"},priority:20,intelligence:"medium"},"metro.config.js":{frameworks:["React Native"],slots:{framework:"React Native",mainLanguage:"JavaScript"},priority:25,intelligence:"medium"},"expo.config.js":{frameworks:["Expo"],slots:{framework:"React Native",buildTool:"Expo"},priority:25,intelligence:"medium"},"app.json":{frameworks:["React Native","Expo"],slots:{framework:"React Native"},priority:20,intelligence:"medium",confirmWith:["expo"]},"capacitor.config.ts":{frameworks:["Capacitor"],slots:{framework:"Capacitor",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"ionic.config.json":{frameworks:["Ionic"],slots:{framework:"Ionic",uiLibrary:"Ionic"},priority:25,intelligence:"medium"},"nx.json":{frameworks:["Nx"],slots:{buildTool:"Nx"},priority:25,intelligence:"medium"},"turbo.json":{frameworks:["Turborepo"],slots:{buildTool:"Turborepo"},priority:25,intelligence:"medium"},"lerna.json":{frameworks:["Lerna"],slots:{buildTool:"Lerna"},priority:25,intelligence:"medium"},"rush.json":{frameworks:["Rush"],slots:{buildTool:"Rush"},priority:25,intelligence:"medium"},"pnpm-workspace.yaml":{frameworks:["pnpm workspaces"],slots:{packageManager:"pnpm",buildTool:"pnpm workspaces"},priority:25,intelligence:"medium"},"*.svelte":{frameworks:["Svelte","SvelteKit"],slots:{framework:"Svelte"},priority:15,intelligence:"low"},"*.vue":{frameworks:["Vue"],slots:{framework:"Vue"},priority:15,intelligence:"low"},"*.jsx":{frameworks:["React"],slots:{framework:"React",mainLanguage:"JavaScript"},priority:15,intelligence:"low"},"*.ts":{frameworks:["TypeScript"],slots:{mainLanguage:"TypeScript"},priority:15,intelligence:"low"},"*.tsx":{frameworks:["React","TypeScript"],slots:{framework:"React",mainLanguage:"TypeScript"},priority:15,intelligence:"low"},"*.py":{frameworks:["Python"],slots:{mainLanguage:"Python"},priority:15,intelligence:"low"},"*.rb":{frameworks:["Ruby"],slots:{mainLanguage:"Ruby"},priority:15,intelligence:"low"},"*.php":{frameworks:["PHP"],slots:{mainLanguage:"PHP"},priority:15,intelligence:"low"},"*.java":{frameworks:["Java"],slots:{mainLanguage:"Java"},priority:15,intelligence:"low"},"*.kt":{frameworks:["Kotlin"],slots:{mainLanguage:"Kotlin"},priority:15,intelligence:"low"},"*.swift":{frameworks:["Swift"],slots:{mainLanguage:"Swift"},priority:15,intelligence:"low"},"*.go":{frameworks:["Go"],slots:{mainLanguage:"Go"},priority:15,intelligence:"low"},"*.rs":{frameworks:["Rust"],slots:{mainLanguage:"Rust"},priority:15,intelligence:"low"},"*.dart":{frameworks:["Flutter","Dart"],slots:{mainLanguage:"Dart"},priority:15,intelligence:"low"},"*.ex":{frameworks:["Elixir"],slots:{mainLanguage:"Elixir"},priority:15,intelligence:"low"},"*.exs":{frameworks:["Elixir"],slots:{mainLanguage:"Elixir"},priority:15,intelligence:"low"},"*.scala":{frameworks:["Scala"],slots:{mainLanguage:"Scala"},priority:15,intelligence:"low"},"*.clj":{frameworks:["Clojure"],slots:{mainLanguage:"Clojure"},priority:15,intelligence:"low"},"*.lua":{frameworks:["Lua"],slots:{mainLanguage:"Lua"},priority:15,intelligence:"low"},"*.r":{frameworks:["R"],slots:{mainLanguage:"R"},priority:15,intelligence:"low"},"*.R":{frameworks:["R"],slots:{mainLanguage:"R"},priority:15,intelligence:"low"},"*.jl":{frameworks:["Julia"],slots:{mainLanguage:"Julia"},priority:15,intelligence:"low"},"*.nim":{frameworks:["Nim"],slots:{mainLanguage:"Nim"},priority:15,intelligence:"low"},"*.zig":{frameworks:["Zig"],slots:{mainLanguage:"Zig"},priority:15,intelligence:"low"},"build.zig":{frameworks:["Zig"],slots:{packageManager:"Zig Package Manager",mainLanguage:"Zig",buildTool:"zig build",framework:"Zig",build:"zig build"},priority:35,intelligence:"ultra-high"},"openapi.json":{frameworks:["OpenAPI"],slots:{apiType:"REST API",backend:"API Server"},priority:30,intelligence:"high"},"openapi.yaml":{frameworks:["OpenAPI"],slots:{apiType:"REST API",backend:"API Server"},priority:30,intelligence:"high"},"swagger.json":{frameworks:["Swagger"],slots:{apiType:"REST API",backend:"API Server"},priority:30,intelligence:"high"},"graphql.schema":{frameworks:["GraphQL"],slots:{apiType:"GraphQL",backend:"GraphQL Server"},priority:30,intelligence:"high"},"schema.graphql":{frameworks:["GraphQL"],slots:{apiType:"GraphQL",backend:"GraphQL Server"},priority:30,intelligence:"high"},".graphqlconfig":{frameworks:["GraphQL"],slots:{apiType:"GraphQL"},priority:25,intelligence:"medium"},"redux.config.js":{frameworks:["Redux"],slots:{stateManagement:"Redux"},priority:20,intelligence:"medium"},"mobx.config.js":{frameworks:["MobX"],slots:{stateManagement:"MobX"},priority:20,intelligence:"medium"},"vuex.config.js":{frameworks:["Vuex"],slots:{stateManagement:"Vuex",framework:"Vue"},priority:20,intelligence:"medium"},"pinia.config.js":{frameworks:["Pinia"],slots:{stateManagement:"Pinia",framework:"Vue"},priority:20,intelligence:"medium"},"zustand.config.js":{frameworks:["Zustand"],slots:{stateManagement:"Zustand"},priority:20,intelligence:"medium"},".eslintrc.js":{frameworks:["ESLint"],slots:{},priority:15,intelligence:"low"},".eslintrc.json":{frameworks:["ESLint"],slots:{},priority:15,intelligence:"low"},".prettierrc":{frameworks:["Prettier"],slots:{},priority:15,intelligence:"low"},".prettierrc.json":{frameworks:["Prettier"],slots:{},priority:15,intelligence:"low"},"biome.json":{frameworks:["Biome"],slots:{},priority:15,intelligence:"low"},".editorconfig":{frameworks:["EditorConfig"],slots:{},priority:10,intelligence:"low"},"serverless.yml":{frameworks:["Serverless Framework"],slots:{hosting:"AWS Lambda/Azure/GCP",backend:"Serverless",apiType:"API Gateway"},priority:30,intelligence:"high"},"serverless.yaml":{frameworks:["Serverless Framework"],slots:{hosting:"AWS Lambda/Azure/GCP",backend:"Serverless",apiType:"API Gateway"},priority:30,intelligence:"high"},"sam.yaml":{frameworks:["AWS SAM"],slots:{hosting:"AWS Lambda",backend:"AWS SAM",cicd:"AWS SAM CLI"},priority:30,intelligence:"high"},"template.yaml":{frameworks:["AWS SAM","CloudFormation"],slots:{hosting:"AWS",backend:"AWS SAM/CloudFormation",cicd:"AWS"},priority:25,intelligence:"medium",confirmWith:["samconfig.toml"]},"amplify.yml":{frameworks:["AWS Amplify"],slots:{hosting:"AWS Amplify",backend:"AWS Amplify",cicd:"AWS Amplify"},priority:30,intelligence:"high"},Podfile:{frameworks:["CocoaPods","iOS"],slots:{packageManager:"CocoaPods",mainLanguage:"Swift/Objective-C",framework:"iOS Native"},priority:30,intelligence:"high"},"build.gradle.kts":{frameworks:["Gradle Kotlin DSL","Android","Kotlin"],slots:{packageManager:"Gradle",mainLanguage:"Kotlin",buildTool:"Gradle Kotlin DSL",framework:"Android"},priority:30,intelligence:"high"},"*.ipynb":{frameworks:["Jupyter","Python"],slots:{mainLanguage:"Python",framework:"Jupyter Notebook"},priority:30,intelligence:"high"},MLproject:{frameworks:["MLflow"],slots:{mainLanguage:"Python",framework:"MLflow",backend:"MLflow",cicd:"MLflow"},priority:30,intelligence:"high"},"dvc.yaml":{frameworks:["DVC","Data Version Control"],slots:{mainLanguage:"Python",framework:"DVC",cicd:"DVC Pipelines"},priority:30,intelligence:"high"},"dvc.lock":{frameworks:["DVC"],slots:{framework:"DVC"},priority:20,intelligence:"medium"},"wrangler.toml":{frameworks:["Cloudflare Workers","Cloudflare"],slots:{hosting:"Cloudflare Workers",backend:"Cloudflare Workers",runtime:"V8 Isolates"},priority:30,intelligence:"high"},"deno.json":{frameworks:["Deno"],slots:{runtime:"Deno",mainLanguage:"TypeScript",packageManager:"Deno"},priority:30,intelligence:"high"},"bun.lockb":{frameworks:["Bun"],slots:{runtime:"Bun",packageManager:"Bun",mainLanguage:"TypeScript/JavaScript"},priority:30,intelligence:"high"},"codecov.yml":{frameworks:["Codecov"],slots:{cicd:"Codecov"},priority:25,intelligence:"high"},"dependabot.yml":{frameworks:["Dependabot","GitHub"],slots:{cicd:"Dependabot"},priority:25,intelligence:"high"},"renovate.json":{frameworks:["Renovate"],slots:{cicd:"Renovate"},priority:25,intelligence:"high"},Makefile:{frameworks:["Make","GNU Make"],slots:{buildTool:"Make"},priority:30,intelligence:"high"},"CMakeLists.txt":{frameworks:["CMake","C","C++"],slots:{buildTool:"CMake",mainLanguage:"C/C++"},priority:30,intelligence:"high"},"meson.build":{frameworks:["Meson","C","C++"],slots:{buildTool:"Meson",mainLanguage:"C/C++"},priority:30,intelligence:"high"},"*.c":{frameworks:["C"],slots:{mainLanguage:"C"},priority:30,intelligence:"high"},"*.cpp":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:30,intelligence:"high"},"*.cc":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:30,intelligence:"high"},"*.cxx":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:25,intelligence:"high"},"*.h":{frameworks:["C","C++"],slots:{mainLanguage:"C/C++"},priority:25,intelligence:"high"},"*.hpp":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:25,intelligence:"high"},"*.hxx":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:20,intelligence:"medium"},".env":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.example":{frameworks:[],slots:{},priority:25,intelligence:"high"},".env.local":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.development":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.production":{frameworks:[],slots:{},priority:20,intelligence:"medium"},"skaffold.yaml":{frameworks:["Skaffold","Kubernetes"],slots:{hosting:"Kubernetes",cicd:"Skaffold"},priority:30,intelligence:"high"},"Chart.yaml":{frameworks:["Helm","Kubernetes"],slots:{hosting:"Kubernetes",backend:"Helm"},priority:30,intelligence:"high"},"values.yaml":{frameworks:["Helm","Kubernetes"],slots:{hosting:"Kubernetes"},priority:25,intelligence:"high",confirmWith:["Chart.yaml"]},"pulumi.yaml":{frameworks:["Pulumi"],slots:{hosting:"Cloud",cicd:"Pulumi"},priority:30,intelligence:"high"},"Pulumi.yaml":{frameworks:["Pulumi"],slots:{hosting:"Cloud",cicd:"Pulumi"},priority:30,intelligence:"high"},"terragrunt.hcl":{frameworks:["Terragrunt","Terraform"],slots:{hosting:"Cloud",cicd:"Terragrunt"},priority:30,intelligence:"high"},"ansible.yml":{frameworks:["Ansible"],slots:{cicd:"Ansible"},priority:30,intelligence:"high"},"playbook.yml":{frameworks:["Ansible"],slots:{cicd:"Ansible"},priority:25,intelligence:"high"},"*.cs":{frameworks:["C#",".NET","Unity"],slots:{mainLanguage:"C#"},priority:30,intelligence:"high"},"*.m":{frameworks:["Objective-C","iOS"],slots:{mainLanguage:"Objective-C"},priority:25,intelligence:"high"},".nvmrc":{frameworks:["Node.js","nvm"],slots:{runtime:"Node.js"},priority:25,intelligence:"high"},".tool-versions":{frameworks:["asdf"],slots:{},priority:25,intelligence:"high"},".ruby-version":{frameworks:["Ruby","rbenv"],slots:{mainLanguage:"Ruby",runtime:"Ruby"},priority:25,intelligence:"high"},".python-version":{frameworks:["Python","pyenv"],slots:{mainLanguage:"Python",runtime:"Python"},priority:25,intelligence:"high"},".dockerignore":{frameworks:["Docker"],slots:{},priority:20,intelligence:"medium"},".gitattributes":{frameworks:["Git"],slots:{},priority:15,intelligence:"low"},".npmrc":{frameworks:["npm","Node.js"],slots:{packageManager:"npm"},priority:20,intelligence:"medium"},"sonar-project.properties":{frameworks:["SonarQube","SonarCloud"],slots:{cicd:"SonarQube"},priority:25,intelligence:"high"},"*.fs":{frameworks:["F#",".NET"],slots:{mainLanguage:"F#"},priority:25,intelligence:"high"},"*.mm":{frameworks:["Objective-C++","iOS","macOS"],slots:{mainLanguage:"Objective-C++"},priority:25,intelligence:"high"},"build.zig.zon":{frameworks:["Zig"],slots:{mainLanguage:"Zig",packageManager:"Zig Package Manager",buildTool:"zig build"},priority:35,intelligence:"ultra-high"},"gleam.toml":{frameworks:["Gleam","BEAM","Erlang"],slots:{mainLanguage:"Gleam",runtime:"BEAM",packageManager:"Gleam"},priority:30,intelligence:"high"},"bunfig.toml":{frameworks:["Bun"],slots:{runtime:"Bun",packageManager:"Bun",buildTool:"Bun"},priority:30,intelligence:"high"},"mise.toml":{frameworks:["mise"],slots:{},priority:25,intelligence:"high"},".mise.toml":{frameworks:["mise"],slots:{},priority:25,intelligence:"high"},"manifest.toml":{frameworks:["Flox","Nix"],slots:{},priority:25,intelligence:"high",confirmWith:[".flox"]},justfile:{frameworks:["Just"],slots:{buildTool:"Just"},priority:25,intelligence:"high"},".pre-commit-config.yaml":{frameworks:["pre-commit"],slots:{cicd:"pre-commit"},priority:25,intelligence:"high"},"CLAUDE.md":{frameworks:["Claude Code"],slots:{},priority:30,intelligence:"high",confirmWith:[".claude"]}};var AO=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),RO=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),_O={mainLanguage:["project","main_language"],main_language:["project","main_language"],framework:["stack","frontend"],cssFramework:["stack","css_framework"],css:["stack","css_framework"],uiLibrary:["stack","ui_library"],ui_library:["stack","ui_library"],stateManagement:["stack","state_management"],state:["stack","state_management"],backend:["stack","backend"],apiType:["stack","api_type"],api:["stack","api_type"],runtime:["stack","runtime"],database:["stack","database"],db:["stack","database"],connection:["stack","connection"],hosting:["stack","hosting"],buildTool:["stack","build"],build_tool:["stack","build"],build:["stack","build"],packageManager:["stack","package_manager"],pkg_manager:["stack","package_manager"],cicd:["stack","cicd"]},FO=[["packageManager","package-manager"],["pkg_manager","package-manager"],["mainLanguage","language"],["main_language","language"],["framework","framework"],["backend","backend"],["database","database"],["db","database"],["cicd","ci-cd"],["hosting","hosting"],["buildTool","build"],["build_tool","build"],["build","build"],["runtime","runtime"],["cssFramework","css"],["css","css"],["uiLibrary","ui-library"],["stateManagement","state-management"],["apiType","api"],["api","api"]];function PO($,Z){for(let[X,z]of FO)if(X in $)return z;return Z.length>0?"framework":"config"}function CO($){try{let Z=JSON.parse(NO($,"utf-8")),X=["background","content_scripts","action","browser_action","permissions"].some((z)=>(z in Z));if(typeof Z.manifest_version==="number"&&X)return"chrome";return"other"}catch{return"other"}}function wO($){let Z=[],X=IO($),z=OO(p6($,".git"));for(let J=0;J<10;J++){let Q;try{Q=uX(X)}catch{break}for(let W of Q){if(W.toLowerCase().endsWith(".csproj")){let G=L3(X);if(G){let q={mainLanguage:"C#",packageManager:"NuGet",buildTool:"dotnet"};if(G.appType==="backend"&&G.framework)q.backend=G.framework;else if(G.appType==="cli"&&G.framework)q.framework=G.framework;else if(G.appType==="mcp")q.apiType="MCP";else if(G.appType==="mobile"&&G.framework)q.framework=G.framework;if(G.targetFramework)q.runtime=G.targetFramework;let V=G.framework?[G.framework,"C#",".NET"]:["C#",".NET"];Z.push({slots:q,priority:36,frameworks:V,fileName:W})}continue}let U=l6[W];if(!U)continue;if(W==="manifest.json"&&CO(p6(X,W))!=="chrome")continue;if(W==="pubspec.yaml"){let G=q3(X);if(G){let q={mainLanguage:"Dart",packageManager:"pub"};if(G.isFlutter){if(q.framework="Flutter",G.stateManagement)q.stateManagement=G.stateManagement}else if(G.appType==="backend"&&G.framework)q.backend=G.framework;else if(G.appType==="mcp")q.apiType="MCP";Z.push({slots:q,priority:U.priority,frameworks:G.isFlutter?["Flutter","Dart"]:["Dart"],fileName:W});continue}}if(W==="go.mod"){let G=H3(X);if(G){let q={mainLanguage:"Go",packageManager:"go modules",buildTool:"go build"};if(G.appType==="backend"&&G.framework)q.backend=G.framework;else if(G.appType==="cli"&&G.framework)q.framework=G.framework;else if(G.appType==="mcp")q.apiType="MCP";let V=G.framework?[G.framework,"Go"]:["Go"];Z.push({slots:q,priority:U.priority,frameworks:V,fileName:W});continue}}Z.push({slots:U.slots||{},priority:U.priority,frameworks:U.frameworks,fileName:W})}if(z&&J===0)break;let Y=TO(X);if(Y===X)break;X=Y}return Z}function EO($){let Z=[];for(let X of mX($,2,{count:0})){let z=l6[`*${X}`],J=z?.slots?.mainLanguage;if(J)Z.push({slots:{mainLanguage:J},priority:z.priority,frameworks:z.frameworks})}return Z}function SO($){let Z=[...wO($),...EO($)],X={},z={},J=new Set;for(let G of Z){G.frameworks.forEach((q)=>J.add(q));for(let[q,V]of Object.entries(G.slots))if(V&&!V.includes("/")&&(!(q in X)||G.priority>z[q]))X[q]=V,z[q]=G.priority}let Q=new Map;for(let G of Z){if(!G.fileName)continue;if(!Q.has(G.fileName))Q.set(G.fileName,{fileName:G.fileName,category:PO(G.slots,G.frameworks),priority:G.priority})}let Y=[...Q.values()].sort((G,q)=>q.priority-G.priority||G.fileName.localeCompare(q.fileName)),W=[];if(X.mainLanguage)W.push(X.mainLanguage.toLowerCase());if(X.framework)W.push(X.framework.toLowerCase());let U=W.length>0?W.join("-"):"unknown-stack";return{slotFills:X,frameworks:[...J],confirmedCount:Z.length,discoveredFormats:Y,stackSignature:U}}function D3($){let{slotFills:Z}=SO($),X={};for(let[z,J]of Object.entries(Z)){let Q=_O[z];if(!Q||!J)continue;let[Y,W]=Q;if(Y==="project")(X.project??={})[W]=J;else(X.stack??={})[W]=J}return X}function mX($,Z,X){let z=new Set;if(Z<0||X.count>400)return z;let J;try{J=uX($,{withFileTypes:!0})}catch{return z}for(let Q of J){if(X.count++>400)break;if(!Q.isDirectory()){let Y=DO(Q.name);if(RO.has(Y))z.add(Y);continue}if(AO.has(Q.name)||Q.name.startsWith("."))continue;for(let Y of mX(p6($,Q.name),Z-1,X))z.add(Y)}return z}import{existsSync as cX,readFileSync as dX}from"fs";import{join as lX}from"path";var M0=($,Z,X)=>({value:$,source:Z,confidence:X});function jO($){let Z=xO($),X=bO($),z={},J=(Q,Y)=>{if(Y)z[Q]=Y};return J("what",kO(Z,X)),J("who",yO(X)),J("why",fO(X)),J("where",gO(Z,X)),J("when",vO(X)),J("how",hO(Z,X)),z}function I3($){let Z=jO($),X={};return Object.keys(Z).forEach((z)=>{let J=Z[z];if(J)X[z]=J.value}),X}function xO($){let Z=lX($,"package.json");if(!cX(Z))return null;try{return JSON.parse(dX(Z,"utf-8"))}catch{return null}}function bO($){let Z=lX($,"README.md");if(!cX(Z))return"";let X;try{X=dX(Z,"utf-8")}catch{return""}return X.split(`
218
218
  `).filter((z)=>!/^\s*\[!\[/.test(z)&&!/^\s*!\[/.test(z)).join(`
219
- `).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function f1($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function G$($,Z){let X=new RegExp(`##?\\s+(${Z})\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n##?|$)`,"i"),z=$.match(X);return z&&z[2]&&z[2].trim().length>20?{body:f1(z[2]),heading:z[1].trim()}:null}function M2($,Z,X=30){for(let z of Z){let J=$.match(z);if(J&&J[1]&&J[1].trim().length>=X)return f1(J[1])}return null}function KM($,Z){if($?.description&&$.description.length>20)return L0(f1($.description),"package.json:description",0.95);let X=G$(Z,"Purpose|What|About|Overview|Description");if(X)return L0(X.body,`README:## ${X.heading}`,0.8);let z=Z.split(/\n\s*\n/).map((Q)=>Q.trim()).find((Q)=>Q.length>30&&!Q.startsWith("#"));if(z)return L0(f1(z),"README:first-paragraph",0.5);let J=M2(Z,[/(?:core|main|primary)\s+(?:problem|challenge)(?:\s+is)?\s*:?\s*([^.\n]{30,})/i,/solves?\s+(?:the\s+)?(?:problem\s+of\s+)?([^.\n]{30,})/i]);return J?L0(J,"README:problem-heuristic",0.6):null}function HM($){let Z=G$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return L0(Z.body,`README:## ${Z.heading}`,0.8);let X=M2($,[/\b(?:designed|built|made)\s+for\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i,/\bfor\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i],8);return X?L0(X,"README:audience-heuristic",0.6):null}function BM($){let Z=G$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return L0(Z.body,`README:## ${Z.heading}`,0.8);let X=M2($,[/(?:our\s+|the\s+)?(?:mission|purpose|goal)\s+is\s+([^.\n]{30,})/i,/\b(?:mission|purpose|goal)\s*:\s*([^.\n]{30,})/i,/(?:built|created|designed)\s+(?:because|to)\s+([^.\n]{30,})/i]);return X?L0(X,"README:mission-heuristic",0.6):null}function LM($,Z){let X=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(X)return L0(f1(X.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return L0(f1($.homepage),"package.json:homepage",0.9);let z=M2(Z,[/\b(?:deployed|hosted|available|published)\s+(?:on|at|via)\s+([^.\n]{3,80})/i],3);return z?L0(z,"README:deploy-heuristic",0.6):null}function NM($){let Z=G$($,"Timeline|Status|Release|Roadmap");if(Z)return L0(Z.body,`README:## ${Z.heading}`,0.8);let X=M2($,[/\b(production\s+since\s+[^.\n]{4,60})/i,/\b((?:in\s+)?(?:production|beta|alpha|development)\s+since\s+[^.\n]{4,60})/i,/\bsince\s+((?:[A-Z][a-z]+\s+)?\d{4}[^.\n]{0,40})/],4);return X?L0(X,"README:since-heuristic",0.6):null}function MM($,Z){let X=$?.scripts?Object.keys($.scripts):[],z=["start","dev","build"].filter((Y)=>X.includes(Y));if(z.length)return L0(f1(z.map((Y)=>`npm run ${Y}`).join(", ")),"package.json:scripts",0.9);let J=G$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(J)return L0(J.body,`README:## ${J.heading}`,0.8);let Q=G$(Z,"Architecture|Approach|How it works|Methodology|How");return Q?L0(Q.body,`README:## ${Q.heading}`,0.7):null}function q$($){let Z=B4($),X=L4($),z=o0(Z,X);OM(z);let J=o0(z,N4($));return o0(J,{human_context:M4($)})}function OM($){let Z=$.project?.type??"library",X=W$[Z]||W$.library;for(let z of t){if(X.includes(z.category))continue;let[J,Q]=z.path.split(".");if(J==="stack"&&$.stack)$.stack[Q]="slotignored";if(J==="monorepo"&&$.monorepo)$.monorepo[Q]="slotignored"}}function o0($,Z){let X={...$};for(let[z,J]of Object.entries(Z)){let Q=X[z];if(_0(Q))X[z]=J;else if(typeof J==="object"&&J!==null&&!Array.isArray(J)&&typeof Q==="object"&&Q!==null&&!Array.isArray(Q))X[z]=o0(Q,J)}return X}import{existsSync as vX,readFileSync as TM,writeFileSync as DM}from"fs";import{join as IM,basename as AM}from"path";import{createHash as RM}from"crypto";class t0{projectPath;dnaPath;dna=null;constructor($){this.projectPath=$,this.dnaPath=IM($,".faf-dna")}exists(){return vX(this.dnaPath)}birth($){let Z=new Date().toISOString();return this.dna={birthCertificate:{born:Z,birthDNA:$,birthDNASource:"init",projectDNA:this.generateProjectDNA(),certificate:this.generateCertificate()},versions:[{version:"v1.0.0",timestamp:Z,score:$,changes:["Birth — initial context"],growth:0}],current:{version:"v1.0.0",score:$,lastSync:Z},growth:{totalGrowth:0,daysActive:0,milestones:[{type:"birth",score:$,date:Z,version:"v1.0.0",label:"Birth",emoji:"\uD83D\uDC23"}]},lastModified:Z,format:"faf-dna-v1"},this.save(),this.dna}recordGrowth($,Z){if(!this.dna&&!this.load())return null;let X=this.dna;if($===X.current.score)return X;let z=new Date().toISOString(),J=X.birthCertificate.birthDNA,Q=$-J,Y=this.incrementVersion(X.versions[X.versions.length-1].version);return X.versions.push({version:Y,timestamp:z,score:$,changes:Z,growth:Q}),X.current={version:Y,score:$,lastSync:z},X.growth.totalGrowth=Q,X.growth.daysActive=this.daysSince(X.birthCertificate.born),this.updateMilestones($,Y,z),this.save(),X}getJourney(){if(!this.dna&&!this.load())return"";let $=this.dna,Z=$.birthCertificate.birthDNA,X=$.growth.milestones.find((Q)=>Q.type==="peak"),z=$.current.score,J=`${Z}%`;if(X&&X.score!==Z){if(J+=` → ${X.score}%`,z<X.score)J+=` ← ${z}%`}else if(z!==Z)J+=` → ${z}%`;return J}getBirthDNADisplay(){if(!this.dna&&!this.load())return null;let $=this.dna;return{current:$.current.score,birthDNA:$.birthCertificate.birthDNA,growth:$.current.score-$.birthCertificate.birthDNA,born:$.birthCertificate.born}}getLog(){if(!this.dna&&!this.load())return[];return this.dna.versions.map(($)=>{let Z=$.growth>50?"\uD83D\uDE80":$.growth>20?"\uD83D\uDCC8":"\uD83D\uDCCA";return`${$.version} — ${$.score}% ${Z} (${$.timestamp.split("T")[0]}) ${$.changes.join(", ")}`})}load(){if(this.dna)return this.dna;if(!vX(this.dnaPath))return null;try{return this.dna=JSON.parse(TM(this.dnaPath,"utf-8")),this.dna}catch{return null}}save(){if(!this.dna)return;this.dna.lastModified=new Date().toISOString(),DM(this.dnaPath,`${JSON.stringify(this.dna,null,2)}
220
- `,"utf-8")}generateProjectDNA(){return RM("sha256").update([this.projectPath,Date.now().toString(),Math.random().toString(36)].join(":")).digest("hex").substring(0,16)}generateCertificate(){let $=new Date().getFullYear(),Z=Math.random().toString(36).substring(2,6).toUpperCase(),X=AM(this.projectPath).replace(/[^A-Z0-9]/gi,"").toUpperCase().substring(0,8).padEnd(4,"X");return`FAF-${$}-${X}-${Z}`}incrementVersion($){let[Z,X,z]=$.replace("v","").split(".").map(Number);return`v${Z}.${X}.${z+1}`}daysSince($){return Math.floor((Date.now()-new Date($).getTime())/86400000)}updateMilestones($,Z,X){if(!this.dna)return;let z=this.dna.growth.milestones,J=(U)=>z.some((G)=>G.type===U),Q=(U,G,q)=>z.push({type:U,score:$,date:X,version:Z,label:G,emoji:q});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!J("doubled"))Q("doubled","Doubled","2️⃣");let Y=z.find((U)=>U.type==="peak");if(!Y||$>Y.score){if(Y)z.splice(z.indexOf(Y),1);Q("peak","Peak","\uD83C\uDFD4️")}let W=z.findIndex((U)=>U.type==="current");if(W>=0)z.splice(W,1);Q("current","Current","\uD83D\uDCCD")}}d();function m6($={}){let Z=process.cwd(),X=$.output?$.output.endsWith(".faf")?$.output:hX(Z,$.output):hX(Z,"project.faf");if(FM(X)&&!$.force)console.error(`project.faf already exists. Use ${I("--force")} to overwrite.`),process.exit(1);let z=q$(Z);o(X,z);let J=m(X),Q=z0(J),Y=new t0(Z);if(!Y.exists()||$.force)Y.birth(Q.score);if(console.log(`${D("created")} ${X}`),J0(Q,X),console.log(H(` \uD83E\uDDEC Birth DNA ${Q.score}% — your journey starts here (faf dna)`)),Q.score<100)console.log(H(`
221
- run ${I("'faf go'")} to fill empty slots`))}d();function uX(){let $=new t0(process.cwd());if(!$.load())console.error(`${I("×")} No FAF DNA found. Run ${I("'faf init'")} to start your journey.`),process.exit(1);let Z=$.getJourney(),X=$.getBirthDNADisplay(),z=X.born.split("T")[0];console.log(),console.log(V0(I("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${D(I(Z))}`),console.log(),console.log(H(` Birth DNA ${X.birthDNA}% (born ${z}) · current ${X.current}% · growth ${X.growth>=0?"+":""}${X.growth}%`));let J=$.getLog();if(J.length>1){console.log(),console.log(H(" history:"));for(let Q of J)console.log(H(` ${Q}`))}console.log()}import{existsSync as _M}from"fs";import{join as PM}from"path";d();function O4(){let $=process.cwd(),Z=PM($,"project.faf");if(_M(Z)){let Q=l(Z),Y=o0(Q,L4($)),W=o0(Y,B4($)),U=o0(W,N4($)),G=o0(U,{human_context:M4($)});o(Z,G),console.log(`${D("updated")} ${Z}`)}else o(Z,q$($)),console.log(`${D("created")} ${Z}`);let X=m(Z),z=K0(U0(X)),J=new t0($);if(J.exists())J.recordGrowth(z.score,["faf auto"]);if(J0(z,Z),z.score<100)console.log(H(`
222
- run ${I("'faf go'")} to reach ✪ Trophy`))}import{existsSync as kM}from"fs";import{join as yM}from"path";var V$="(terse — 3-4 words)",wM=[{path:"project.name",question:"What is the name of this project?",header:"Name",type:"text",required:!0},{path:"project.goal",question:"What does this project do? (one sentence)",header:"Goal",type:"text",required:!0},{path:"human_context.who",question:`Who is this for? ${V$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${V$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${V$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${V$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${V$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${V$}`,header:"How",type:"text",required:!0}],CM=[{path:"project.main_language",question:"What is the primary programming language?",header:"Language",type:"select",required:!0,options:[{label:"TypeScript",value:"TypeScript",description:"JavaScript with types"},{label:"JavaScript",value:"JavaScript",description:"Vanilla JS or Node.js"},{label:"Python",value:"Python",description:"Python 3.x"},{label:"Rust",value:"Rust",description:"Systems programming"},{label:"Go",value:"Go",description:"Golang"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.frontend",question:"What frontend framework does it use?",header:"Frontend",type:"select",required:!1,options:[{label:"React",value:"React",description:"React.js"},{label:"Vue",value:"Vue",description:"Vue.js"},{label:"Svelte",value:"Svelte",description:"Svelte/SvelteKit"},{label:"Next.js",value:"Next.js",description:"React framework"},{label:"None",value:"None",description:"No frontend"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.backend",question:"What backend framework does it use?",header:"Backend",type:"select",required:!1,options:[{label:"Express",value:"Express",description:"Node.js Express"},{label:"Fastify",value:"Fastify",description:"Node.js Fastify"},{label:"Django",value:"Django",description:"Python Django"},{label:"FastAPI",value:"FastAPI",description:"Python FastAPI"},{label:"None",value:"None",description:"No backend"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.database",question:"What database does it use?",header:"Database",type:"select",required:!1,options:[{label:"PostgreSQL",value:"PostgreSQL",description:"Postgres"},{label:"MySQL",value:"MySQL",description:"MySQL/MariaDB"},{label:"SQLite",value:"SQLite",description:"Embedded SQL"},{label:"MongoDB",value:"MongoDB",description:"Document store"},{label:"None",value:"None",description:"No database"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.runtime",question:"What runtime does it run on?",header:"Runtime",type:"text",required:!1},{path:"stack.hosting",question:"Where is it hosted or distributed?",header:"Hosting",type:"text",required:!1},{path:"stack.build",question:"What is the build tool?",header:"Build",type:"text",required:!1},{path:"stack.cicd",question:"What CI/CD does it use?",header:"CI/CD",type:"text",required:!1}],T4=[...wM,...CM],EM=new Map(T4.map(($)=>[$.path,$])),y_=Object.fromEntries(T4.map(($)=>[$.path,$]));function D4($){let Z=EM.get($);if(Z)return Z.question;let X=Y$.get($)??t.find((z)=>z.canonical===$);return X?`${X.description}?`.replace(/\?\?$/,"?"):`${$}?`}function d6($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||_0(Z)}return!1}function jM($,Z){let X=$;for(let z of Z.split("."))if(X&&typeof X==="object"&&z in X)X=X[z];else return;return X}function SM($){if($==="project.goal")return!0;return Y$.get($)?.category==="human"}function xM($,Z=d6){let X=[],z=[];for(let J of T4){let Q=jM($,J.path);if(Q==="slotignored")continue;if(!Z(Q))continue;(SM(J.path)?X:z).push(J.path)}return{human:X,sourceable:z}}function bM($,Z,X=d6){let z=xM(Z,X),J;if($>=100||z.human.length===0&&z.sourceable.length===0)J="done";else if(z.sourceable.length>0)J="can-source";else J="needs-human";let Q=J==="needs-human"?c6(z):[];return{status:J,score:$,gaps:z,ask:Q}}function c6($){return $.human.map((Z)=>({path:Z,question:D4(Z)}))}function mX($,Z={}){let X=Math.max(1,Z.maxRounds??5),z=Z.isEmpty??d6,J=[],Q=0;for(let W=0;W<=X;W++){let U=$.read();if(!U)return{status:"no-faf",score:0,rounds:Q,history:J,ask:[]};let G=$.score(U.yaml);J.push(G);let q=bM(G,U.data,z);if(q.status==="done")return{status:"done",score:G,rounds:Q,history:J,ask:[]};if(q.status==="needs-human")return{status:"needs-human",score:G,rounds:Q,history:J,ask:q.ask};if(J.length>=2&&G<=J[J.length-2])return q.gaps.human.length?{status:"needs-human",score:G,rounds:Q,history:J,ask:c6(q.gaps)}:{status:"stuck",score:G,rounds:Q,history:J,ask:[]};if(Q>=X)return{status:"capped",score:G,rounds:Q,history:J,ask:c6(q.gaps)};$.runAuto(),Q++}return{status:"capped",score:J[J.length-1]??0,rounds:Q,history:J,ask:[]}}d();function cX($={}){let Z=process.cwd(),X=yM(Z,"project.faf"),z=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;fM(mX({read:()=>kM(X)?{data:l(X),yaml:m(X)}:{data:{},yaml:""},score:(Q)=>Q?K0(U0(Q)).score:0,runAuto:()=>O4()},{maxRounds:z}))}function fM($){if($.history.length>1)console.log(H(`
223
- climb: ${$.history.join("% → ")}%`));switch(console.log(""),$.status){case"done":console.log(`${D("done")} — ✪ 100% AI-readiness. The .faf is complete.`);break;case"needs-human":{let Z=$.ask.length;console.log(`${I("Sourced everything detection can.")} ${Z} question${Z===1?"":"s"} only you can answer:`);for(let X of $.ask)console.log(` ${H("•")} ${X.question}`);console.log(H(`
224
- Answer with ${I("'faf go'")}, or fill them in project.faf directly.`));break}case"stuck":console.log(`${I(`Stopped at ${$.score}%.`)} The remaining gaps need evidence detection couldn't find, and there's nothing only you can answer. Add the missing manifests/README, then re-run.`);break;case"capped":console.log(`${I(`Stopped at ${$.score}% after ${$.rounds} rounds (the cap).`)} Re-run ${I("'faf loop'")} to continue, or raise ${H("--rounds")}.`);break;case"no-faf":console.log(`No project.faf, and none could be created here. Run ${I("'faf init'")} first.`);break}}import{existsSync as R4,statSync as aX}from"fs";import{join as oX,dirname as rM}from"path";import{readFileSync as dM,existsSync as lM,statSync as e_}from"fs";import{join as lX}from"path";import{readFileSync as gM,writeFileSync as I4,existsSync as vM}from"fs";var hM="<!-- faf:start -->",uM="<!-- faf:end -->",mM="<!-- faf:";function p0($,Z,X=hM,z=uM){let J=`${X}
219
+ `).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function g1($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function q$($,Z){let X=new RegExp(`##?\\s+(${Z})\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n##?|$)`,"i"),z=$.match(X);return z&&z[2]&&z[2].trim().length>20?{body:g1(z[2]),heading:z[1].trim()}:null}function T2($,Z,X=30){for(let z of Z){let J=$.match(z);if(J&&J[1]&&J[1].trim().length>=X)return g1(J[1])}return null}function kO($,Z){if($?.description&&$.description.length>20)return M0(g1($.description),"package.json:description",0.95);let X=q$(Z,"Purpose|What|About|Overview|Description");if(X)return M0(X.body,`README:## ${X.heading}`,0.8);let z=Z.split(/\n\s*\n/).map((Q)=>Q.trim()).find((Q)=>Q.length>30&&!Q.startsWith("#"));if(z)return M0(g1(z),"README:first-paragraph",0.5);let J=T2(Z,[/(?:core|main|primary)\s+(?:problem|challenge)(?:\s+is)?\s*:?\s*([^.\n]{30,})/i,/solves?\s+(?:the\s+)?(?:problem\s+of\s+)?([^.\n]{30,})/i]);return J?M0(J,"README:problem-heuristic",0.6):null}function yO($){let Z=q$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return M0(Z.body,`README:## ${Z.heading}`,0.8);let X=T2($,[/\b(?:designed|built|made)\s+for\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i,/\bfor\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i],8);return X?M0(X,"README:audience-heuristic",0.6):null}function fO($){let Z=q$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return M0(Z.body,`README:## ${Z.heading}`,0.8);let X=T2($,[/(?:our\s+|the\s+)?(?:mission|purpose|goal)\s+is\s+([^.\n]{30,})/i,/\b(?:mission|purpose|goal)\s*:\s*([^.\n]{30,})/i,/(?:built|created|designed)\s+(?:because|to)\s+([^.\n]{30,})/i]);return X?M0(X,"README:mission-heuristic",0.6):null}function gO($,Z){let X=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(X)return M0(g1(X.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return M0(g1($.homepage),"package.json:homepage",0.9);let z=T2(Z,[/\b(?:deployed|hosted|available|published)\s+(?:on|at|via)\s+([^.\n]{3,80})/i],3);return z?M0(z,"README:deploy-heuristic",0.6):null}function vO($){let Z=q$($,"Timeline|Status|Release|Roadmap");if(Z)return M0(Z.body,`README:## ${Z.heading}`,0.8);let X=T2($,[/\b(production\s+since\s+[^.\n]{4,60})/i,/\b((?:in\s+)?(?:production|beta|alpha|development)\s+since\s+[^.\n]{4,60})/i,/\bsince\s+((?:[A-Z][a-z]+\s+)?\d{4}[^.\n]{0,40})/],4);return X?M0(X,"README:since-heuristic",0.6):null}function hO($,Z){let X=$?.scripts?Object.keys($.scripts):[],z=["start","dev","build"].filter((Y)=>X.includes(Y));if(z.length)return M0(g1(z.map((Y)=>`npm run ${Y}`).join(", ")),"package.json:scripts",0.9);let J=q$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(J)return M0(J.body,`README:## ${J.heading}`,0.8);let Q=q$(Z,"Architecture|Approach|How it works|Methodology|How");return Q?M0(Q.body,`README:## ${Q.heading}`,0.7):null}function V$($){let Z=N3($),X=T3($),z=o0(Z,X);uO(z);let J=o0(z,D3($));return o0(J,{human_context:I3($)})}function uO($){let Z=$.project?.type??"library",X=U$[Z]||U$.library;for(let z of e){if(X.includes(z.category))continue;let[J,Q]=z.path.split(".");if(J==="stack"&&$.stack)$.stack[Q]="slotignored";if(J==="monorepo"&&$.monorepo)$.monorepo[Q]="slotignored"}}function o0($,Z){let X={...$};for(let[z,J]of Object.entries(Z)){let Q=X[z];if(F0(Q))X[z]=J;else if(typeof J==="object"&&J!==null&&!Array.isArray(J)&&typeof Q==="object"&&Q!==null&&!Array.isArray(Q))X[z]=o0(Q,J)}return X}import{existsSync as pX,readFileSync as mO,writeFileSync as cO}from"fs";import{join as dO,basename as lO}from"path";import{createHash as pO}from"crypto";class t0{projectPath;dnaPath;dna=null;constructor($){this.projectPath=$,this.dnaPath=dO($,".faf-dna")}exists(){return pX(this.dnaPath)}birth($){let Z=new Date().toISOString();return this.dna={birthCertificate:{born:Z,birthDNA:$,birthDNASource:"init",projectDNA:this.generateProjectDNA(),certificate:this.generateCertificate()},versions:[{version:"v1.0.0",timestamp:Z,score:$,changes:["Birth — initial context"],growth:0}],current:{version:"v1.0.0",score:$,lastSync:Z},growth:{totalGrowth:0,daysActive:0,milestones:[{type:"birth",score:$,date:Z,version:"v1.0.0",label:"Birth",emoji:"\uD83D\uDC23"}]},lastModified:Z,format:"faf-dna-v1"},this.save(),this.dna}recordGrowth($,Z){if(!this.dna&&!this.load())return null;let X=this.dna;if($===X.current.score)return X;let z=new Date().toISOString(),J=X.birthCertificate.birthDNA,Q=$-J,Y=this.incrementVersion(X.versions[X.versions.length-1].version);return X.versions.push({version:Y,timestamp:z,score:$,changes:Z,growth:Q}),X.current={version:Y,score:$,lastSync:z},X.growth.totalGrowth=Q,X.growth.daysActive=this.daysSince(X.birthCertificate.born),this.updateMilestones($,Y,z),this.save(),X}getJourney(){if(!this.dna&&!this.load())return"";let $=this.dna,Z=$.birthCertificate.birthDNA,X=$.growth.milestones.find((Q)=>Q.type==="peak"),z=$.current.score,J=`${Z}%`;if(X&&X.score!==Z){if(J+=` → ${X.score}%`,z<X.score)J+=` ← ${z}%`}else if(z!==Z)J+=` → ${z}%`;return J}getBirthDNADisplay(){if(!this.dna&&!this.load())return null;let $=this.dna;return{current:$.current.score,birthDNA:$.birthCertificate.birthDNA,growth:$.current.score-$.birthCertificate.birthDNA,born:$.birthCertificate.born}}getLog(){if(!this.dna&&!this.load())return[];return this.dna.versions.map(($)=>{let Z=$.growth>50?"\uD83D\uDE80":$.growth>20?"\uD83D\uDCC8":"\uD83D\uDCCA";return`${$.version} — ${$.score}% ${Z} (${$.timestamp.split("T")[0]}) ${$.changes.join(", ")}`})}load(){if(this.dna)return this.dna;if(!pX(this.dnaPath))return null;try{return this.dna=JSON.parse(mO(this.dnaPath,"utf-8")),this.dna}catch{return null}}save(){if(!this.dna)return;this.dna.lastModified=new Date().toISOString(),cO(this.dnaPath,`${JSON.stringify(this.dna,null,2)}
220
+ `,"utf-8")}generateProjectDNA(){return pO("sha256").update([this.projectPath,Date.now().toString(),Math.random().toString(36)].join(":")).digest("hex").substring(0,16)}generateCertificate(){let $=new Date().getFullYear(),Z=Math.random().toString(36).substring(2,6).toUpperCase(),X=lO(this.projectPath).replace(/[^A-Z0-9]/gi,"").toUpperCase().substring(0,8).padEnd(4,"X");return`FAF-${$}-${X}-${Z}`}incrementVersion($){let[Z,X,z]=$.replace("v","").split(".").map(Number);return`v${Z}.${X}.${z+1}`}daysSince($){return Math.floor((Date.now()-new Date($).getTime())/86400000)}updateMilestones($,Z,X){if(!this.dna)return;let z=this.dna.growth.milestones,J=(U)=>z.some((G)=>G.type===U),Q=(U,G,q)=>z.push({type:U,score:$,date:X,version:Z,label:G,emoji:q});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!J("doubled"))Q("doubled","Doubled","2️⃣");let Y=z.find((U)=>U.type==="peak");if(!Y||$>Y.score){if(Y)z.splice(z.indexOf(Y),1);Q("peak","Peak","\uD83C\uDFD4️")}let W=z.findIndex((U)=>U.type==="current");if(W>=0)z.splice(W,1);Q("current","Current","\uD83D\uDCCD")}}d();function i6($={}){let Z=process.cwd(),X=$.output?$.output.endsWith(".faf")?$.output:iX(Z,$.output):iX(Z,"project.faf");if(iO(X)&&!$.force)console.error(`project.faf already exists. Use ${I("--force")} to overwrite.`),process.exit(1);let z=V$(Z);t(X,z);let J=m(X),Q=J0(J),Y=new t0(Z);if(!Y.exists()||$.force)Y.birth(Q.score);if(console.log(`${D("created")} ${X}`),Q0(Q,X),console.log(B(` \uD83E\uDDEC Birth DNA ${Q.score}% — your journey starts here (faf dna)`)),Q.score<100)console.log(B(`
221
+ run ${I("'faf go'")} to fill empty slots`))}d();function nX(){let $=new t0(process.cwd());if(!$.load())console.error(`${I("×")} No FAF DNA found. Run ${I("'faf init'")} to start your journey.`),process.exit(1);let Z=$.getJourney(),X=$.getBirthDNADisplay(),z=X.born.split("T")[0];console.log(),console.log(K0(I("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${D(I(Z))}`),console.log(),console.log(B(` Birth DNA ${X.birthDNA}% (born ${z}) · current ${X.current}% · growth ${X.growth>=0?"+":""}${X.growth}%`));let J=$.getLog();if(J.length>1){console.log(),console.log(B(" history:"));for(let Q of J)console.log(B(` ${Q}`))}console.log()}import{existsSync as nO}from"fs";import{join as rO}from"path";d();function A3(){let $=process.cwd(),Z=rO($,"project.faf");if(nO(Z)){let Q=l(Z),Y=o0(Q,T3($)),W=o0(Y,N3($)),U=o0(W,D3($)),G=o0(U,{human_context:I3($)});t(Z,G),console.log(`${D("updated")} ${Z}`)}else t(Z,V$($)),console.log(`${D("created")} ${Z}`);let X=m(Z),z=H0(G0(X)),J=new t0($);if(J.exists())J.recordGrowth(z.score,["faf auto"]);if(Q0(z,Z),z.score<100)console.log(B(`
222
+ run ${I("'faf go'")} to reach ✪ Trophy`))}import{existsSync as XN}from"fs";import{join as zN}from"path";var K$="(terse — 3-4 words)",sO=[{path:"project.name",question:"What is the name of this project?",header:"Name",type:"text",required:!0},{path:"project.goal",question:"What does this project do? (one sentence)",header:"Goal",type:"text",required:!0},{path:"human_context.who",question:`Who is this for? ${K$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${K$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${K$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${K$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${K$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${K$}`,header:"How",type:"text",required:!0}],aO=[{path:"project.main_language",question:"What is the primary programming language?",header:"Language",type:"select",required:!0,options:[{label:"TypeScript",value:"TypeScript",description:"JavaScript with types"},{label:"JavaScript",value:"JavaScript",description:"Vanilla JS or Node.js"},{label:"Python",value:"Python",description:"Python 3.x"},{label:"Rust",value:"Rust",description:"Systems programming"},{label:"Go",value:"Go",description:"Golang"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.frontend",question:"What frontend framework does it use?",header:"Frontend",type:"select",required:!1,options:[{label:"React",value:"React",description:"React.js"},{label:"Vue",value:"Vue",description:"Vue.js"},{label:"Svelte",value:"Svelte",description:"Svelte/SvelteKit"},{label:"Next.js",value:"Next.js",description:"React framework"},{label:"None",value:"None",description:"No frontend"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.backend",question:"What backend framework does it use?",header:"Backend",type:"select",required:!1,options:[{label:"Express",value:"Express",description:"Node.js Express"},{label:"Fastify",value:"Fastify",description:"Node.js Fastify"},{label:"Django",value:"Django",description:"Python Django"},{label:"FastAPI",value:"FastAPI",description:"Python FastAPI"},{label:"None",value:"None",description:"No backend"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.database",question:"What database does it use?",header:"Database",type:"select",required:!1,options:[{label:"PostgreSQL",value:"PostgreSQL",description:"Postgres"},{label:"MySQL",value:"MySQL",description:"MySQL/MariaDB"},{label:"SQLite",value:"SQLite",description:"Embedded SQL"},{label:"MongoDB",value:"MongoDB",description:"Document store"},{label:"None",value:"None",description:"No database"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.runtime",question:"What runtime does it run on?",header:"Runtime",type:"text",required:!1},{path:"stack.hosting",question:"Where is it hosted or distributed?",header:"Hosting",type:"text",required:!1},{path:"stack.build",question:"What is the build tool?",header:"Build",type:"text",required:!1},{path:"stack.cicd",question:"What CI/CD does it use?",header:"CI/CD",type:"text",required:!1}],R3=[...sO,...aO],oO=new Map(R3.map(($)=>[$.path,$])),qP=Object.fromEntries(R3.map(($)=>[$.path,$]));function _3($){let Z=oO.get($);if(Z)return Z.question;let X=W$.get($)??e.find((z)=>z.canonical===$);return X?`${X.description}?`.replace(/\?\?$/,"?"):`${$}?`}function r6($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||F0(Z)}return!1}function tO($,Z){let X=$;for(let z of Z.split("."))if(X&&typeof X==="object"&&z in X)X=X[z];else return;return X}function eO($){if($==="project.goal")return!0;return W$.get($)?.category==="human"}function $N($,Z=r6){let X=[],z=[];for(let J of R3){let Q=tO($,J.path);if(Q==="slotignored")continue;if(!Z(Q))continue;(eO(J.path)?X:z).push(J.path)}return{human:X,sourceable:z}}function ZN($,Z,X=r6){let z=$N(Z,X),J;if($>=100||z.human.length===0&&z.sourceable.length===0)J="done";else if(z.sourceable.length>0)J="can-source";else J="needs-human";let Q=J==="needs-human"?n6(z):[];return{status:J,score:$,gaps:z,ask:Q}}function n6($){return $.human.map((Z)=>({path:Z,question:_3(Z)}))}function rX($,Z={}){let X=Math.max(1,Z.maxRounds??5),z=Z.isEmpty??r6,J=[],Q=0;for(let W=0;W<=X;W++){let U=$.read();if(!U)return{status:"no-faf",score:0,rounds:Q,history:J,ask:[]};let G=$.score(U.yaml);J.push(G);let q=ZN(G,U.data,z);if(q.status==="done")return{status:"done",score:G,rounds:Q,history:J,ask:[]};if(q.status==="needs-human")return{status:"needs-human",score:G,rounds:Q,history:J,ask:q.ask};if(J.length>=2&&G<=J[J.length-2])return q.gaps.human.length?{status:"needs-human",score:G,rounds:Q,history:J,ask:n6(q.gaps)}:{status:"stuck",score:G,rounds:Q,history:J,ask:[]};if(Q>=X)return{status:"capped",score:G,rounds:Q,history:J,ask:n6(q.gaps)};$.runAuto(),Q++}return{status:"capped",score:J[J.length-1]??0,rounds:Q,history:J,ask:[]}}d();function sX($={}){let Z=process.cwd(),X=zN(Z,"project.faf"),z=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;JN(rX({read:()=>XN(X)?{data:l(X),yaml:m(X)}:{data:{},yaml:""},score:(Q)=>Q?H0(G0(Q)).score:0,runAuto:()=>A3()},{maxRounds:z}))}function JN($){if($.history.length>1)console.log(B(`
223
+ climb: ${$.history.join("% → ")}%`));switch(console.log(""),$.status){case"done":console.log(`${D("done")} — ✪ 100% AI-readiness. The .faf is complete.`);break;case"needs-human":{let Z=$.ask.length;console.log(`${I("Sourced everything detection can.")} ${Z} question${Z===1?"":"s"} only you can answer:`);for(let X of $.ask)console.log(` ${B("•")} ${X.question}`);console.log(B(`
224
+ Answer with ${I("'faf go'")}, or fill them in project.faf directly.`));break}case"stuck":console.log(`${I(`Stopped at ${$.score}%.`)} The remaining gaps need evidence detection couldn't find, and there's nothing only you can answer. Add the missing manifests/README, then re-run.`);break;case"capped":console.log(`${I(`Stopped at ${$.score}% after ${$.rounds} rounds (the cap).`)} Re-run ${I("'faf loop'")} to continue, or raise ${B("--rounds")}.`);break;case"no-faf":console.log(`No project.faf, and none could be created here. Run ${I("'faf init'")} first.`);break}}import{existsSync as C3,statSync as zz}from"fs";import{join as Jz,dirname as MN}from"path";import{readFileSync as VN,existsSync as KN,statSync as wP}from"fs";import{join as oX}from"path";import{readFileSync as QN,writeFileSync as F3,existsSync as YN}from"fs";var WN="<!-- faf:start -->",UN="<!-- faf:end -->",GN="<!-- faf:";function p0($,Z,X=WN,z=UN){let J=`${X}
225
225
  ${Z.trim()}
226
- ${z}`;if(!vM($)){I4($,`${J}
227
- `,"utf-8");return}let Q=gM($,"utf-8"),Y=Q.indexOf(X),W=Q.indexOf(z);if(Y!==-1&&W!==-1&&W>Y){let U=Q.slice(0,Y),G=Q.slice(W+z.length);I4($,`${U}${J}${G}`,"utf-8");return}if(Q.trimStart().startsWith(mM)){I4($,`${J}
228
- `,"utf-8");return}I4($,`${J}
226
+ ${z}`;if(!YN($)){F3($,`${J}
227
+ `,"utf-8");return}let Q=QN($,"utf-8"),Y=Q.indexOf(X),W=Q.indexOf(z);if(Y!==-1&&W!==-1&&W>Y){let U=Q.slice(0,Y),G=Q.slice(W+z.length);F3($,`${U}${J}${G}`,"utf-8");return}if(Q.trimStart().startsWith(GN)){F3($,`${J}
228
+ `,"utf-8");return}F3($,`${J}
229
229
 
230
- ${Q}`,"utf-8")}var cM=new Set(["API","CI","CD","MCP","CLI","SDK","UI","UX","AI","ML","DB","ORM","OS","HTTP","HTTPS","REST","RPC","JSON","YAML","XML","SQL","CSS","HTML","AWS","GCP","CDN","DNS","JWT","ID","IP","URL","URI","TS","JS"]);function l6($){return $.split("_").map((Z)=>{if(!Z)return Z;let X=Z.toUpperCase();return cM.has(X)?X:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function P0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function b0($){let Z=Y$.get($);if(Z?.label)return Z.label;let X=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return l6(X)}var pX="CLAUDE.md",pM="STATUS: BI-SYNC ACTIVE";function iX($){let Z=lX($,pX);if(!lM(Z))return null;return dM(Z,"utf-8")}function nX($,Z){p0(lX($,pX),Z)}function e0($,Z={}){let X=String($.project?.name??"").trim(),z=String($.project?.main_language??"").trim(),J=String($.project?.type??"").trim(),Q=String($.project?.goal??"").trim(),Y=`<!-- faf: ${[X,z,J,Q].join(" | ")} -->`,W=[];if(Z.doc)W.push(`doc=${Z.doc}`);else W.push(`claim=${Z.claim??"project.faf"}`);if(typeof Z.score==="number")W.push(`score=${Z.score}`);if(W.push(`family=${Z.family??"FAF"}`),Z.siblings&&Z.siblings.length>0)W.push(`siblings=${Z.siblings.join(",")}`);let U=`<!-- faf: ${W.join(" | ")} -->`;return`${Y}
231
- ${U}`}function rX($){let Z=[],X=$.project?.name??"Project",z=$.project?.main_language??"",J=$.project?.goal??"";if(Z.push(e0($)),Z.push(""),Z.push(`# CLAUDE.md — ${X}`),Z.push(""),J)Z.push("## What This Is"),Z.push(""),Z.push(J),Z.push("");let Q=$.stack??{},Y=[];if(z)Y.push(`**Language:** ${z}`);for(let[G,q]of Object.entries(Q))if(q&&q!=="slotignored"&&String(q).trim())Y.push(`**${b0(`stack.${G}`)}:** ${q}`);if(Y.length>0){Z.push("## Stack"),Z.push("");for(let G of Y)Z.push(`- ${G}`);Z.push("")}let W=$.human_context??{},U=[["who",W.who],["what",W.what],["why",W.why],["where",W.where],["when",W.when],["how",W.how]].filter(([,G])=>G&&String(G).trim()).map(([G,q])=>`- **${b0(`human_context.${G}`)}:** ${q}`);if(U.length>0)Z.push("## Context"),Z.push(""),Z.push(...U),Z.push("");return Z.push("---"),Z.push(""),Z.push(`*${pM} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
232
- `)}function dX($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function A4($){let Z={project:{}},X=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(X)Z.project.name=dX(X[1].trim());if(!Z.project.name){let Q=$.match(/\*\*Name:\*\*\s*(.+)/);if(Q)Z.project.name=dX(Q[1].trim())}let z=$.match(/## What This Is\s*\n\s*\n(.+)/);if(z)Z.project.goal=z[1].trim();if(!Z.project.goal){let Q=$.match(/\*\*What Building:\*\*\s*(.+)/);if(Q)Z.project.goal=Q[1].trim()}let J=$.match(/\*\*Language:\*\*\s*(.+)/);if(J)Z.project.main_language=J[1].trim();if(!Z.project.main_language){let Q=$.match(/\*\*Main Language:\*\*\s*(.+)/);if(Q)Z.project.main_language=Q[1].trim()}return Z}import{readFileSync as QP,writeFileSync as iM,existsSync as YP}from"fs";import{join as nM}from"path";function sX($,Z){iM(nM($,"MEMORY.md"),Z,"utf-8")}d();function K$(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function p6($={}){let Z=process.cwd(),X=h(Z);if(!X)console.error(`Error: project.faf not found
230
+ ${Q}`,"utf-8")}var qN=new Set(["API","CI","CD","MCP","CLI","SDK","UI","UX","AI","ML","DB","ORM","OS","HTTP","HTTPS","REST","RPC","JSON","YAML","XML","SQL","CSS","HTML","AWS","GCP","CDN","DNS","JWT","ID","IP","URL","URI","TS","JS"]);function s6($){return $.split("_").map((Z)=>{if(!Z)return Z;let X=Z.toUpperCase();return qN.has(X)?X:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function P0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function b0($){let Z=W$.get($);if(Z?.label)return Z.label;let X=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return s6(X)}var tX="CLAUDE.md",HN="STATUS: BI-SYNC ACTIVE";function eX($){let Z=oX($,tX);if(!KN(Z))return null;return VN(Z,"utf-8")}function $z($,Z){p0(oX($,tX),Z)}function e0($,Z={}){let X=String($.project?.name??"").trim(),z=String($.project?.main_language??"").trim(),J=String($.project?.type??"").trim(),Q=String($.project?.goal??"").trim(),Y=`<!-- faf: ${[X,z,J,Q].join(" | ")} -->`,W=[];if(Z.doc)W.push(`doc=${Z.doc}`);else W.push(`claim=${Z.claim??"project.faf"}`);if(typeof Z.score==="number")W.push(`score=${Z.score}`);if(W.push(`family=${Z.family??"FAF"}`),Z.siblings&&Z.siblings.length>0)W.push(`siblings=${Z.siblings.join(",")}`);let U=`<!-- faf: ${W.join(" | ")} -->`;return`${Y}
231
+ ${U}`}function Zz($){let Z=[],X=$.project?.name??"Project",z=$.project?.main_language??"",J=$.project?.goal??"";if(Z.push(e0($)),Z.push(""),Z.push(`# CLAUDE.md — ${X}`),Z.push(""),J)Z.push("## What This Is"),Z.push(""),Z.push(J),Z.push("");let Q=$.stack??{},Y=[];if(z)Y.push(`**Language:** ${z}`);for(let[G,q]of Object.entries(Q))if(q&&q!=="slotignored"&&String(q).trim())Y.push(`**${b0(`stack.${G}`)}:** ${q}`);if(Y.length>0){Z.push("## Stack"),Z.push("");for(let G of Y)Z.push(`- ${G}`);Z.push("")}let W=$.human_context??{},U=[["who",W.who],["what",W.what],["why",W.why],["where",W.where],["when",W.when],["how",W.how]].filter(([,G])=>G&&String(G).trim()).map(([G,q])=>`- **${b0(`human_context.${G}`)}:** ${q}`);if(U.length>0)Z.push("## Context"),Z.push(""),Z.push(...U),Z.push("");return Z.push("---"),Z.push(""),Z.push(`*${HN} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
232
+ `)}function aX($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function P3($){let Z={project:{}},X=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(X)Z.project.name=aX(X[1].trim());if(!Z.project.name){let Q=$.match(/\*\*Name:\*\*\s*(.+)/);if(Q)Z.project.name=aX(Q[1].trim())}let z=$.match(/## What This Is\s*\n\s*\n(.+)/);if(z)Z.project.goal=z[1].trim();if(!Z.project.goal){let Q=$.match(/\*\*What Building:\*\*\s*(.+)/);if(Q)Z.project.goal=Q[1].trim()}let J=$.match(/\*\*Language:\*\*\s*(.+)/);if(J)Z.project.main_language=J[1].trim();if(!Z.project.main_language){let Q=$.match(/\*\*Main Language:\*\*\s*(.+)/);if(Q)Z.project.main_language=Q[1].trim()}return Z}import{readFileSync as kP,writeFileSync as BN,existsSync as yP}from"fs";import{join as LN}from"path";function Xz($,Z){BN(LN($,"MEMORY.md"),Z,"utf-8")}d();function H$(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function a6($={}){let Z=process.cwd(),X=v(Z);if(!X)console.error(`Error: project.faf not found
233
233
 
234
- Run 'faf init' to create one.`),process.exit(2);let z=oX(Z,"CLAUDE.md"),J=oX(Z,"MEMORY.md"),Q=$.direction??"auto";if(Q==="auto")tX(X,z,Z);else if(Q==="push")eX(X,Z);else if(Q==="pull")sM(X,z);if(K$())$z(X,J,Z);if($.watch)console.log(H("watching for changes... (Ctrl+C to stop)")),oM(X,z,J,Z)}function tX($,Z,X){eX($,X)}function eX($,Z){let X=l($),z=rX(X);nX(Z,z),console.log(`${D("◆")} sync .faf → CLAUDE.md ${H("← bi-sync")}`);let J=K0(U0(m($)));J0(J,$)}function sM($,Z){let X=K0(U0(m($)));if(X.tier.name!=="TROPHY")console.error(`${I("×")} sync --pull blocked: requires ✪ Trophy (currently ${X.score}%)`),console.error(H(" MD → .faf backfill only runs at 100%. Reach Trophy with 'faf go', then retry.")),process.exit(1);let z=iX(rM(Z));if(!z){console.error("CLAUDE.md not found.");return}let J=A4(z),Q=l($);if(J.project?.name)Q.project={...Q.project,name:J.project.name};if(J.project?.goal)Q.project={...Q.project,goal:J.project.goal};if(J.project?.main_language)Q.project={...Q.project,main_language:J.project.main_language};o($,Q),console.log(`${D("◆")} sync CLAUDE.md → .faf ${H("← bi-sync (Trophy-gated)")}`);let Y=K0(U0(m($)));J0(Y,$)}function $z($,Z,X){let z=l($),J=aX($).mtimeMs,Q=R4(Z)?aX(Z).mtimeMs:0;if(!R4(Z)||J>Q){let Y=aM(z);sX(X,Y),console.log(`${D("◆")} sync .faf → MEMORY.md ${H("← tri-sync")}`)}else console.log(`${D("◆")} sync MEMORY.md → .faf ${H("← tri-sync")}`)}function aM($){let Z=$.project??{},X=[`# ${Z.name??"Project"} — Memory Topics`,"","> Authored by faf sync (tri-sync)",""];if(Z.name)X.push(`- **Project:** ${Z.name}`);if(Z.goal)X.push(`- **Goal:** ${Z.goal}`);if(Z.main_language)X.push(`- **Language:** ${Z.main_language}`);if(Z.type)X.push(`- **Type:** ${Z.type}`);return`${X.join(`
234
+ Run 'faf init' to create one.`),process.exit(2);let z=Jz(Z,"CLAUDE.md"),J=Jz(Z,"MEMORY.md"),Q=$.direction??"auto";if(Q==="auto")Qz(X,z,Z);else if(Q==="push")Yz(X,Z);else if(Q==="pull")ON(X,z);if(H$())Wz(X,J,Z);if($.watch)console.log(B("watching for changes... (Ctrl+C to stop)")),TN(X,z,J,Z)}function Qz($,Z,X){Yz($,X)}function Yz($,Z){let X=l($),z=Zz(X);$z(Z,z),console.log(`${D("◆")} sync .faf → CLAUDE.md ${B("← bi-sync")}`);let J=H0(G0(m($)));Q0(J,$)}function ON($,Z){let X=H0(G0(m($)));if(X.tier.name!=="TROPHY")console.error(`${I("×")} sync --pull blocked: requires ✪ Trophy (currently ${X.score}%)`),console.error(B(" MD → .faf backfill only runs at 100%. Reach Trophy with 'faf go', then retry.")),process.exit(1);let z=eX(MN(Z));if(!z){console.error("CLAUDE.md not found.");return}let J=P3(z),Q=l($);if(J.project?.name)Q.project={...Q.project,name:J.project.name};if(J.project?.goal)Q.project={...Q.project,goal:J.project.goal};if(J.project?.main_language)Q.project={...Q.project,main_language:J.project.main_language};t($,Q),console.log(`${D("◆")} sync CLAUDE.md → .faf ${B("← bi-sync (Trophy-gated)")}`);let Y=H0(G0(m($)));Q0(Y,$)}function Wz($,Z,X){let z=l($),J=zz($).mtimeMs,Q=C3(Z)?zz(Z).mtimeMs:0;if(!C3(Z)||J>Q){let Y=NN(z);Xz(X,Y),console.log(`${D("◆")} sync .faf → MEMORY.md ${B("← tri-sync")}`)}else console.log(`${D("◆")} sync MEMORY.md → .faf ${B("← tri-sync")}`)}function NN($){let Z=$.project??{},X=[`# ${Z.name??"Project"} — Memory Topics`,"","> Authored by faf sync (tri-sync)",""];if(Z.name)X.push(`- **Project:** ${Z.name}`);if(Z.goal)X.push(`- **Goal:** ${Z.goal}`);if(Z.main_language)X.push(`- **Language:** ${Z.main_language}`);if(Z.type)X.push(`- **Type:** ${Z.type}`);return`${X.join(`
235
235
  `)}
236
- `}function oM($,Z,X,z){let{watch:J}=A0("fs"),Q=null,Y=()=>{if(Q)clearTimeout(Q);Q=setTimeout(()=>{if(console.log(H("change detected...")),tX($,Z,z),K$())$z($,X,z)},200)};if(J($,Y),R4(Z))J(Z,Y);if(K$()&&R4(X))J(X,Y)}import{writeFileSync as tM}from"fs";d();function Zz($,Z={}){let X=$??h();if(!X)console.error(`Error: project.faf not found
236
+ `}function TN($,Z,X,z){let{watch:J}=A0("fs"),Q=null,Y=()=>{if(Q)clearTimeout(Q);Q=setTimeout(()=>{if(console.log(B("change detected...")),Qz($,Z,z),H$())Wz($,X,z)},200)};if(J($,Y),C3(Z))J(Z,Y);if(H$()&&C3(X))J(X,Y)}import{writeFileSync as DN}from"fs";d();function Uz($,Z={}){let X=$??v();if(!X)console.error(`Error: project.faf not found
237
237
 
238
- Run 'faf init' to create one.`),process.exit(2);let z=m(X),J=Y4(z),Q=Z.output??X.replace(/\.faf$/,".fafb");tM(Q,J),console.log(`${D("compiled")} ${Q} ${H(`(${J.length} bytes)`)}`)}import{readFileSync as eM}from"fs";function Xz($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let X=new Uint8Array(eM($));if(String.fromCharCode(X[0],X[1],X[2],X[3])!=="FAFB")console.error("Error: Not a valid .fafb file (missing FAFB magic bytes)."),process.exit(3);let z=VX(X);console.log(JSON.stringify(z,null,2))}function zz($){let Z=[];if(!$||typeof $!=="object")return Z.push("File is not a valid YAML mapping"),{valid:!1,errors:Z};let X=$;if(!X.faf_version)Z.push("Missing required field: faf_version");if(!X.project?.name)Z.push("Missing required field: project.name");if(X.app_type==="about"){if(!X.about?.represents)Z.push("app_type 'about' requires about.represents (owner/repo of the source codebase)");else if(!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(X.about.represents))Z.push(`about.represents must be "owner/repo" format (got: ${X.about.represents})`);if(X.about?.source_score!==void 0){let z=X.about.source_score;if(typeof z!=="number"||z<0||z>100)Z.push(`about.source_score must be a number 0-100 (got: ${z})`)}}return{valid:Z.length===0,errors:Z}}d();function i6($,Z={}){let X=$??h();if(!X)console.error(`Error: project.faf not found
238
+ Run 'faf init' to create one.`),process.exit(2);let z=m(X),J=U3(z),Q=Z.output??X.replace(/\.faf$/,".fafb");DN(Q,J),console.log(`${D("compiled")} ${Q} ${B(`(${J.length} bytes)`)}`)}import{readFileSync as IN}from"fs";function Gz($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let X=new Uint8Array(IN($));if(String.fromCharCode(X[0],X[1],X[2],X[3])!=="FAFB")console.error("Error: Not a valid .fafb file (missing FAFB magic bytes)."),process.exit(3);let z=MX(X);console.log(JSON.stringify(z,null,2))}function qz($){let Z=[];if(!$||typeof $!=="object")return Z.push("File is not a valid YAML mapping"),{valid:!1,errors:Z};let X=$;if(!X.faf_version)Z.push("Missing required field: faf_version");if(!X.project?.name)Z.push("Missing required field: project.name");if(X.app_type==="about"){if(!X.about?.represents)Z.push("app_type 'about' requires about.represents (owner/repo of the source codebase)");else if(!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(X.about.represents))Z.push(`about.represents must be "owner/repo" format (got: ${X.about.represents})`);if(X.about?.source_score!==void 0){let z=X.about.source_score;if(typeof z!=="number"||z<0||z>100)Z.push(`about.source_score must be a number 0-100 (got: ${z})`)}}return{valid:Z.length===0,errors:Z}}d();function o6($,Z={}){let X=$??v();if(!X)console.error(`Error: project.faf not found
239
239
 
240
- Run 'faf init' to create one.`),process.exit(2);let z=l(X),J=zz(z);if(!J.valid){console.log(`${I("invalid")} ${X}`);for(let W of J.errors)console.log(` ${H("x")} ${W}`);process.exit(3)}let Q=m(X);if(!qX(Q))console.log(`${I("invalid yaml")} ${X}`),process.exit(3);console.log(`${D("valid")} ${X}`);let Y=z0(Q);if(J0(Y,X),Z.strict&&Y.score<100)console.log(H(`
241
- --strict requires 100%`)),process.exit(1)}import{join as $O}from"path";var k0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),Jz=($)=>Array.isArray($)?$.join(", "):String($),ZO=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),XO=new Set(["target_user","core_problem","mission_purpose"]);function zO($){let Z=[],X=(b="")=>Z.push(b),z=$.ai_instructions,J=$.preferences,Q=$.instant_context,Y=$.security,W=$.commands,U=$.key_files??Q?.key_files,G=W?Object.entries(W).filter(([,b])=>k0(b)):[],q=G.filter(([b])=>/test/i.test(b)),V=G.filter(([b])=>/lint|check/i.test(b)&&!/test/i.test(b)),K=G.filter(([b])=>!/test|lint|check/i.test(b)),B=(b)=>{let c=b.toLowerCase();if(/install|deps/.test(c))return 0;if(/^build$|build/.test(c)&&!/rebuild/.test(c))return 1;if(/^dev$|develop/.test(c))return 2;if(/^start$|run/.test(c))return 3;return 4},O=[...K].sort((b,c)=>B(b[0])-B(c[0])||b[0].localeCompare(c[0])),L=[...q,...V],M=q[0]?.[1],R=O.find(([b])=>/build/i.test(b))?.[1];X(e0($)),X(),X(`# AGENTS.md — ${$.project?.name??"Project"}`),X();let P=[];if($.project?.main_language)P.push(String($.project.main_language));if(k0($.project?.type))P.push(`type: ${String($.project?.type)}`);if(k0($.project?.version))P.push(`v${String($.project?.version)}`);let w=$.project?.goal?String($.project.goal):"";if(P.length)w+=(w?" — ":"")+P.join(" · ");if(w)X(w),X();if(X("> Authored by faf — do not edit the managed block; refresh with `faf export --agents`. Hand content outside `<!-- faf:start -->` … `<!-- faf:end -->` is preserved."),X(),O.length){X("## Setup & build"),X(),X("```bash");for(let[b,c]of O)X(`${c} # ${b}`);X("```"),X()}if(L.length){X("## Run the tests"),X(),X("```bash");for(let[,b]of L)X(b);X("```"),X()}if(U&&U.length){X("## Where things live"),X();for(let b of U)X(`- \`${b}\``);X()}let k=new Map,y=(b)=>{if(!b)return;for(let[c,g0]of Object.entries(b)){if(ZO.has(c)||!k0(g0))continue;let m$=l6(c);if(!k.has(m$))k.set(m$,Jz(g0))}};y(z?.working_style),y(J);let f=$.conventions??[];if(k.size||f.length){X("## Conventions"),X();for(let[b,c]of k)X(`- **${b}:** ${c}`);for(let b of f)if(k0(b))X(`- ${b}`);X()}let i=(z?.warnings??[]).filter((b)=>k0(b)),C=["read the tree"];if(M)C.push(`run the tests (\`${M}\`)`);if(R)C.push("build the project");for(let[,b]of V.slice(0,1))C.push(`\`${b}\``);X("## Guardrails"),X();for(let b of i)X(`- ${b}`);X(`- **Always OK:** ${[...new Set(C)].join(" · ")}.`),X("- **Ask first:** dependency installs, deletions, migrations, schema changes, publish/release."),X("- **Never:** force-push · push straight to `main` (branch and open a PR) · commit secrets."),X();let x=[];for(let[,b]of V)x.push(`\`${b}\` exits 0`);for(let[,b]of q)x.push(`\`${b}\` passes`);if(x.push("changes committed with a conventional message"),X("## Definition of Done"),X(),X(`Done when: ${[...new Set(x)].join(" · ")}.`),X(),X("## When stuck"),X(),X("Ask a clarifying question, propose a short plan, or open a draft PR with notes — do not push large speculative changes to `main`."),X(),Y&&(k0(Y.secrets)||(Y.never??[]).length)){if(X("## Security & secrets"),X(),k0(Y.secrets)){let b=k0(Y.example)?` (see \`${Y.example}\`)`:"";X(`- Secrets live in \`${Y.secrets}\`${b}. Never read or commit them.`)}for(let b of Y.never??[])if(k0(b))X(`- Never read or commit \`${b}\`.`);X()}if(X("## Commit & PR"),X(),J&&k0(J.commit_style))X(`- Commit style: ${Jz(J.commit_style)}`);else X("- Conventional Commits preferred (`feat:`, `fix:`, `chore:`, …).");if(X("- Branch off `main` and open a PR — never commit to `main` directly."),X("- If build/test scripts or layout change, refresh this file in the **same PR** (`faf export --agents`)."),X(),$.stack){let b=[];for(let[c,g0]of Object.entries($.stack)){if(XO.has(c))continue;if(P0(g0))b.push(`- **${b0(`stack.${c}`)}:** ${g0.trim()}`)}if(b.length){X("## Stack"),X();for(let c of b)X(c);X()}}let I0=$.generated;if(k0(I0))X(`*Context authored: ${String(I0)}*`);return Z.join(`
242
- `)}function Qz($,Z){p0($O($,"AGENTS.md"),zO(Z))}import{existsSync as F4,readFileSync as Yz}from"fs";import{join as O2}from"path";function JO($,Z){let X=[],z=(U)=>F4(O2($,U)),J=(U)=>{try{return Yz(O2($,U),"utf-8")}catch{return""}};if(z("tsconfig.json")&&/"strict"\s*:\s*true/.test(J("tsconfig.json")))X.push("TypeScript strict mode (tsconfig.json)");if(Z?.type==="module")X.push("ESM modules (`type: module`)");let Q=[],Y=Z?.devDependencies??{};if(z(".eslintrc")||z(".eslintrc.json")||z(".eslintrc.cjs")||z("eslint.config.js")||z("eslint.config.mjs")||"eslint"in Y)Q.push("ESLint");if(z(".prettierrc")||z(".prettierrc.json")||z("prettier.config.js")||"prettier"in Y)Q.push("Prettier");let W=z("pyproject.toml")?J("pyproject.toml"):"";if(/\[tool\.black\]/.test(W))Q.push("black");if(/\[tool\.ruff\]/.test(W))Q.push("ruff");if(/\[tool\.mypy\]/.test(W))Q.push("mypy");if(z("rustfmt.toml")||z(".rustfmt.toml"))Q.push("rustfmt");if(Q.length)X.push(`Style enforced by ${Q.join(" · ")} — obey the configs`);return X}function Wz($,Z){let X={...Z},z=null,J=O2($,"package.json");if(F4(J))try{z=JSON.parse(Yz(J,"utf-8"))}catch{z=null}let Q=H4($,z);if(Object.keys(Q).length)X.commands={...Q,...Z.commands??{}};let Y=Z.key_files??Z.instant_context?.key_files;if(!Y||Y.length===0){let W=K4($);if(W.length)X.key_files=W}if(!Z.security){let U=[".env",".env.local",".env.development"].find((G)=>F4(O2($,G)));if(U){let G=[".env.example",".env.sample",".env.template"].find((q)=>F4(O2($,q)));X.security={secrets:U,...G?{example:G}:{}}}}if(!Z.conventions){let W=JO($,z);if(W.length)X.conventions=W}return X}import{join as QO}from"path";function YO($){let Z=[];if(Z.push(e0($)),Z.push(""),Z.push("# .cursorrules"),Z.push(`# Authored from project.faf — ${$.project?.name??"Project"}`),Z.push(""),$.project?.main_language)Z.push(`language: ${$.project.main_language}`);if($.stack){Z.push(""),Z.push("# Stack");for(let[X,z]of Object.entries($.stack))if(P0(z))Z.push(`# ${b0(`stack.${X}`)}: ${z.trim()}`)}return Z.push(""),Z.join(`
243
- `)}function Uz($,Z){p0(QO($,".cursorrules"),YO(Z),"# faf:start","# faf:end")}import{join as WO}from"path";function UO($){let Z=[];if(Z.push(e0($)),Z.push(""),Z.push(`# GEMINI.md — ${$.project?.name??"Project"}`),Z.push(""),Z.push("> Authored from project.faf"),Z.push(""),$.project?.name)Z.push(`Project: ${$.project.name}`);if($.project?.goal)Z.push(`Goal: ${$.project.goal}`);if($.project?.main_language)Z.push(`Language: ${$.project.main_language}`);if($.stack){Z.push(""),Z.push("## Stack");for(let[X,z]of Object.entries($.stack))if(P0(z))Z.push(`- ${b0(`stack.${X}`)}: ${z.trim()}`)}return Z.push(""),Z.join(`
244
- `)}function Gz($,Z){p0(WO($,"GEMINI.md"),UO(Z))}import{join as qz}from"path";import{mkdirSync as GO}from"fs";var Vz=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],qO=new Set([...Vz.map(([$])=>$),"cicd"]);function VO($){let Z=[],X=$.project?.name??"Project";if(Z.push(e0($)),Z.push(""),Z.push(`# GitHub Copilot Instructions — ${X}`),Z.push(""),Z.push("> Authored from project.faf by FAF. Copilot reads these instructions on every request in this repository — keep them short and broadly applicable."),Z.push(""),P0($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let z=$.stack??{},J=[];if(P0($.project?.main_language))J.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[G,q]of Object.entries(z)){if(qO.has(G))continue;if(P0(q))J.push(`- **${b0(`stack.${G}`)}:** ${q.trim()}`)}if(J.length>0)Z.push("## Tech stack","",...J,"");let Q=[];for(let[G,q]of Vz){let V=z[G];if(P0(V))Q.push(`- ${q} \`${V.trim()}\`.`)}if(P0(z.cicd))Q.push(`- CI runs on ${z.cicd.trim()}.`);if(Q.length>0)Z.push("## Build & run","",...Q,"");let Y=$.human_context??{},U=[["who",Y.who],["what",Y.what],["why",Y.why],["where",Y.where],["when",Y.when],["how",Y.how]].filter(([,G])=>P0(G)).map(([G,q])=>`- **${b0(`human_context.${G}`)}:** ${q.trim()}`);if(U.length>0)Z.push("## Project context","",...U,"");return Z.join(`
245
- `)}function Kz($,Z){GO(qz($,".github"),{recursive:!0}),p0(qz($,".github","copilot-instructions.md"),VO(Z))}import{existsSync as KO,mkdirSync as HO,readFileSync as BO,writeFileSync as Hz}from"fs";import{join as Bz}from"path";var LO="https://mcpaas.live/grok/mcp/v1",Lz="mcp_servers.grok-faf-mcp";function NO($){return[`[${Lz}]`,`url = "${LO}"`,""].join(`
246
- `)}function Nz($,Z){let X=Bz($,".grok"),z=Bz(X,"config.toml"),J=NO(Z);if(!KO(z))return HO(X,{recursive:!0}),Hz(z,`# grok-faf-mcp — wired by FAF from project.faf
240
+ Run 'faf init' to create one.`),process.exit(2);let z=l(X),J=qz(z);if(!J.valid){console.log(`${I("invalid")} ${X}`);for(let W of J.errors)console.log(` ${B("x")} ${W}`);process.exit(3)}let Q=m(X);if(!LX(Q))console.log(`${I("invalid yaml")} ${X}`),process.exit(3);console.log(`${D("valid")} ${X}`);let Y=J0(Q);if(Q0(Y,X),Z.strict&&Y.score<100)console.log(B(`
241
+ --strict requires 100%`)),process.exit(1)}import{join as AN}from"path";var k0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),Vz=($)=>Array.isArray($)?$.join(", "):String($),RN=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),_N=new Set(["target_user","core_problem","mission_purpose"]);function FN($){let Z=[],X=(x="")=>Z.push(x),z=$.ai_instructions,J=$.preferences,Q=$.instant_context,Y=$.security,W=$.commands,U=$.key_files??Q?.key_files,G=W?Object.entries(W).filter(([,x])=>k0(x)):[],q=G.filter(([x])=>/test/i.test(x)),V=G.filter(([x])=>/lint|check/i.test(x)&&!/test/i.test(x)),K=G.filter(([x])=>!/test|lint|check/i.test(x)),H=(x)=>{let c=x.toLowerCase();if(/install|deps/.test(c))return 0;if(/^build$|build/.test(c)&&!/rebuild/.test(c))return 1;if(/^dev$|develop/.test(c))return 2;if(/^start$|run/.test(c))return 3;return 4},N=[...K].sort((x,c)=>H(x[0])-H(c[0])||x[0].localeCompare(c[0])),L=[...q,...V],O=q[0]?.[1],R=N.find(([x])=>/build/i.test(x))?.[1];X(e0($)),X(),X(`# AGENTS.md — ${$.project?.name??"Project"}`),X();let P=[];if($.project?.main_language)P.push(String($.project.main_language));if(k0($.project?.type))P.push(`type: ${String($.project?.type)}`);if(k0($.project?.version))P.push(`v${String($.project?.version)}`);let C=$.project?.goal?String($.project.goal):"";if(P.length)C+=(C?" — ":"")+P.join(" · ");if(C)X(C),X();if(X("> Authored by faf — do not edit the managed block; refresh with `faf export --agents`. Hand content outside `<!-- faf:start -->` … `<!-- faf:end -->` is preserved."),X(),N.length){X("## Setup & build"),X(),X("```bash");for(let[x,c]of N)X(`${c} # ${x}`);X("```"),X()}if(L.length){X("## Run the tests"),X(),X("```bash");for(let[,x]of L)X(x);X("```"),X()}if(U&&U.length){X("## Where things live"),X();for(let x of U)X(`- \`${x}\``);X()}let b=new Map,f=(x)=>{if(!x)return;for(let[c,g0]of Object.entries(x)){if(RN.has(c)||!k0(g0))continue;let c$=s6(c);if(!b.has(c$))b.set(c$,Vz(g0))}};f(z?.working_style),f(J);let k=$.conventions??[];if(b.size||k.length){X("## Conventions"),X();for(let[x,c]of b)X(`- **${x}:** ${c}`);for(let x of k)if(k0(x))X(`- ${x}`);X()}let i=(z?.warnings??[]).filter((x)=>k0(x)),w=["read the tree"];if(O)w.push(`run the tests (\`${O}\`)`);if(R)w.push("build the project");for(let[,x]of V.slice(0,1))w.push(`\`${x}\``);X("## Guardrails"),X();for(let x of i)X(`- ${x}`);X(`- **Always OK:** ${[...new Set(w)].join(" · ")}.`),X("- **Ask first:** dependency installs, deletions, migrations, schema changes, publish/release."),X("- **Never:** force-push · push straight to `main` (branch and open a PR) · commit secrets."),X();let u=[];for(let[,x]of V)u.push(`\`${x}\` exits 0`);for(let[,x]of q)u.push(`\`${x}\` passes`);if(u.push("changes committed with a conventional message"),X("## Definition of Done"),X(),X(`Done when: ${[...new Set(u)].join(" · ")}.`),X(),X("## When stuck"),X(),X("Ask a clarifying question, propose a short plan, or open a draft PR with notes — do not push large speculative changes to `main`."),X(),Y&&(k0(Y.secrets)||(Y.never??[]).length)){if(X("## Security & secrets"),X(),k0(Y.secrets)){let x=k0(Y.example)?` (see \`${Y.example}\`)`:"";X(`- Secrets live in \`${Y.secrets}\`${x}. Never read or commit them.`)}for(let x of Y.never??[])if(k0(x))X(`- Never read or commit \`${x}\`.`);X()}if(X("## Commit & PR"),X(),J&&k0(J.commit_style))X(`- Commit style: ${Vz(J.commit_style)}`);else X("- Conventional Commits preferred (`feat:`, `fix:`, `chore:`, …).");if(X("- Branch off `main` and open a PR — never commit to `main` directly."),X("- If build/test scripts or layout change, refresh this file in the **same PR** (`faf export --agents`)."),X(),$.stack){let x=[];for(let[c,g0]of Object.entries($.stack)){if(_N.has(c))continue;if(P0(g0))x.push(`- **${b0(`stack.${c}`)}:** ${g0.trim()}`)}if(x.length){X("## Stack"),X();for(let c of x)X(c);X()}}let n=$.generated;if(k0(n))X(`*Context authored: ${String(n)}*`);return Z.join(`
242
+ `)}function Kz($,Z){p0(AN($,"AGENTS.md"),FN(Z))}import{existsSync as w3,readFileSync as Hz}from"fs";import{join as D2}from"path";function PN($,Z){let X=[],z=(U)=>w3(D2($,U)),J=(U)=>{try{return Hz(D2($,U),"utf-8")}catch{return""}};if(z("tsconfig.json")&&/"strict"\s*:\s*true/.test(J("tsconfig.json")))X.push("TypeScript strict mode (tsconfig.json)");if(Z?.type==="module")X.push("ESM modules (`type: module`)");let Q=[],Y=Z?.devDependencies??{};if(z(".eslintrc")||z(".eslintrc.json")||z(".eslintrc.cjs")||z("eslint.config.js")||z("eslint.config.mjs")||"eslint"in Y)Q.push("ESLint");if(z(".prettierrc")||z(".prettierrc.json")||z("prettier.config.js")||"prettier"in Y)Q.push("Prettier");let W=z("pyproject.toml")?J("pyproject.toml"):"";if(/\[tool\.black\]/.test(W))Q.push("black");if(/\[tool\.ruff\]/.test(W))Q.push("ruff");if(/\[tool\.mypy\]/.test(W))Q.push("mypy");if(z("rustfmt.toml")||z(".rustfmt.toml"))Q.push("rustfmt");if(Q.length)X.push(`Style enforced by ${Q.join(" · ")} — obey the configs`);return X}function Bz($,Z){let X={...Z},z=null,J=D2($,"package.json");if(w3(J))try{z=JSON.parse(Hz(J,"utf-8"))}catch{z=null}let Q=O3($,z);if(Object.keys(Q).length)X.commands={...Q,...Z.commands??{}};let Y=Z.key_files??Z.instant_context?.key_files;if(!Y||Y.length===0){let W=M3($);if(W.length)X.key_files=W}if(!Z.security){let U=[".env",".env.local",".env.development"].find((G)=>w3(D2($,G)));if(U){let G=[".env.example",".env.sample",".env.template"].find((q)=>w3(D2($,q)));X.security={secrets:U,...G?{example:G}:{}}}}if(!Z.conventions){let W=PN($,z);if(W.length)X.conventions=W}return X}import{join as CN}from"path";function wN($){let Z=[];if(Z.push(e0($)),Z.push(""),Z.push("# .cursorrules"),Z.push(`# Authored from project.faf — ${$.project?.name??"Project"}`),Z.push(""),$.project?.main_language)Z.push(`language: ${$.project.main_language}`);if($.stack){Z.push(""),Z.push("# Stack");for(let[X,z]of Object.entries($.stack))if(P0(z))Z.push(`# ${b0(`stack.${X}`)}: ${z.trim()}`)}return Z.push(""),Z.join(`
243
+ `)}function Lz($,Z){p0(CN($,".cursorrules"),wN(Z),"# faf:start","# faf:end")}import{join as EN}from"path";function SN($){let Z=[];if(Z.push(e0($)),Z.push(""),Z.push(`# GEMINI.md — ${$.project?.name??"Project"}`),Z.push(""),Z.push("> Authored from project.faf"),Z.push(""),$.project?.name)Z.push(`Project: ${$.project.name}`);if($.project?.goal)Z.push(`Goal: ${$.project.goal}`);if($.project?.main_language)Z.push(`Language: ${$.project.main_language}`);if($.stack){Z.push(""),Z.push("## Stack");for(let[X,z]of Object.entries($.stack))if(P0(z))Z.push(`- ${b0(`stack.${X}`)}: ${z.trim()}`)}return Z.push(""),Z.join(`
244
+ `)}function Mz($,Z){p0(EN($,"GEMINI.md"),SN(Z))}import{join as Oz}from"path";import{mkdirSync as jN}from"fs";var Nz=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],xN=new Set([...Nz.map(([$])=>$),"cicd"]);function bN($){let Z=[],X=$.project?.name??"Project";if(Z.push(e0($)),Z.push(""),Z.push(`# GitHub Copilot Instructions — ${X}`),Z.push(""),Z.push("> Authored from project.faf by FAF. Copilot reads these instructions on every request in this repository — keep them short and broadly applicable."),Z.push(""),P0($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let z=$.stack??{},J=[];if(P0($.project?.main_language))J.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[G,q]of Object.entries(z)){if(xN.has(G))continue;if(P0(q))J.push(`- **${b0(`stack.${G}`)}:** ${q.trim()}`)}if(J.length>0)Z.push("## Tech stack","",...J,"");let Q=[];for(let[G,q]of Nz){let V=z[G];if(P0(V))Q.push(`- ${q} \`${V.trim()}\`.`)}if(P0(z.cicd))Q.push(`- CI runs on ${z.cicd.trim()}.`);if(Q.length>0)Z.push("## Build & run","",...Q,"");let Y=$.human_context??{},U=[["who",Y.who],["what",Y.what],["why",Y.why],["where",Y.where],["when",Y.when],["how",Y.how]].filter(([,G])=>P0(G)).map(([G,q])=>`- **${b0(`human_context.${G}`)}:** ${q.trim()}`);if(U.length>0)Z.push("## Project context","",...U,"");return Z.join(`
245
+ `)}function Tz($,Z){jN(Oz($,".github"),{recursive:!0}),p0(Oz($,".github","copilot-instructions.md"),bN(Z))}import{existsSync as kN,mkdirSync as yN,readFileSync as fN,writeFileSync as Dz}from"fs";import{join as Iz}from"path";var gN="https://mcpaas.live/grok/mcp/v1",Az="mcp_servers.grok-faf-mcp";function vN($){return[`[${Az}]`,`url = "${gN}"`,""].join(`
246
+ `)}function Rz($,Z){let X=Iz($,".grok"),z=Iz(X,"config.toml"),J=vN(Z);if(!kN(z))return yN(X,{recursive:!0}),Dz(z,`# grok-faf-mcp — wired by FAF from project.faf
247
247
 
248
- `+J,"utf-8"),"created";let Q=BO(z,"utf-8");if(Q.includes(`[${Lz}]`))return"unchanged";let Y=Q.endsWith(`
248
+ `+J,"utf-8"),"created";let Q=fN(z,"utf-8");if(Q.includes(`[${Az}]`))return"unchanged";let Y=Q.endsWith(`
249
249
 
250
250
  `)?"":Q.endsWith(`
251
251
  `)?`
252
252
  `:`
253
253
 
254
- `;return Hz(z,Q+Y+J,"utf-8"),"merged"}d();import{writeFileSync as MO}from"fs";import{join as OO}from"path";var Mz=B2.orange,TO=B2.cyan,DO=B2.cyanDeep,IO="#FF9500",AO="#FF3B30",RO="#E6EDF3",FO="#6E7681",Oz={TROPHY:{glyph:"✪",color:Mz},GOLD:{glyph:"★",color:Mz},SILVER:{glyph:"◆",color:TO},BRONZE:{glyph:"◇",color:DO},GREEN:{glyph:"●",color:RO},YELLOW:{glyph:"●",color:IO},RED:{glyph:"○",color:AO},WHITE:{glyph:"♡",color:FO}};function H$($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Tz=["who","what","why","where","when","how"];function _4($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,X])=>`<div class="row"><div class="k">${H$(Z)}</div><div class="v">${H$(X)}</div></div>`).join(`
255
- `)}function _O($,Z,X="project.faf"){let z=H$($.project?.name??"Project"),J=Z.tier?.name??"WHITE",Q=Oz[J]??Oz.WHITE,Y=Z.inherited?Z.represents?`inherited from ${H$(Z.represents)}`:"inherited":`${Z.score}%`,W=J==="TROPHY"&&!Z.inherited,U=$.human_context??{},G=Tz.map((L)=>[L,U[L]]),q=Object.entries(U).filter(([L])=>!Tz.includes(L)),V=[["goal",$.project?.goal],["main_language",$.project?.main_language],["type",$.project?.type],["framework",$.project?.framework],["faf_version",$.faf_version]],K=Object.entries($.stack??{}),B=K.filter(([,L])=>L&&L!=="slotignored"&&String(L).trim()!==""),O=K.filter(([,L])=>L==="slotignored").length;return`<!DOCTYPE html>
254
+ `;return Dz(z,Q+Y+J,"utf-8"),"merged"}d();import{writeFileSync as hN}from"fs";import{join as uN}from"path";var _z=L2.orange,mN=L2.cyan,cN=L2.cyanDeep,dN="#FF9500",lN="#FF3B30",pN="#E6EDF3",iN="#6E7681",Fz={TROPHY:{glyph:"✪",color:_z},GOLD:{glyph:"★",color:_z},SILVER:{glyph:"◆",color:mN},BRONZE:{glyph:"◇",color:cN},GREEN:{glyph:"●",color:pN},YELLOW:{glyph:"●",color:dN},RED:{glyph:"○",color:lN},WHITE:{glyph:"♡",color:iN}};function B$($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Pz=["who","what","why","where","when","how"];function E3($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,X])=>`<div class="row"><div class="k">${B$(Z)}</div><div class="v">${B$(X)}</div></div>`).join(`
255
+ `)}function nN($,Z,X="project.faf"){let z=B$($.project?.name??"Project"),J=Z.tier?.name??"WHITE",Q=Fz[J]??Fz.WHITE,Y=Z.inherited?Z.represents?`inherited from ${B$(Z.represents)}`:"inherited":`${Z.score}%`,W=J==="TROPHY"&&!Z.inherited,U=$.human_context??{},G=Pz.map((L)=>[L,U[L]]),q=Object.entries(U).filter(([L])=>!Pz.includes(L)),V=[["goal",$.project?.goal],["main_language",$.project?.main_language],["type",$.project?.type],["framework",$.project?.framework],["faf_version",$.faf_version]],K=Object.entries($.stack??{}),H=K.filter(([,L])=>L&&L!=="slotignored"&&String(L).trim()!==""),N=K.filter(([,L])=>L==="slotignored").length;return`<!DOCTYPE html>
256
256
  <html lang="en">
257
257
  <head>
258
258
  <meta charset="UTF-8">
@@ -293,99 +293,99 @@ footer strong{color:#e6edf3}
293
293
  <div class="eyebrow">project.faf · visual render</div>
294
294
  <header>
295
295
  <h1>${z}</h1>
296
- <span class="badge">${Q.glyph} ${H$(J)}</span>
296
+ <span class="badge">${Q.glyph} ${B$(J)}</span>
297
297
  <span class="score">${Y}</span>
298
298
  </header>
299
299
  <div class="meter"><span></span></div>
300
- ${W?'<p class="award statline"><span class="awd-pre">✅ All Required slots filled.</span> <span class="awd-win">100% Trophy ✪ Awarded</span></p>':`<p class="muted statline">${Z.populated}/${Z.active} slots populated · ${Z.total} total${O?` · ${O} N/A`:""}</p>`}
300
+ ${W?'<p class="award statline"><span class="awd-pre">✅ All Required slots filled.</span> <span class="awd-win">100% Trophy ✪ Awarded</span></p>':`<p class="muted statline">${Z.populated}/${Z.active} slots populated · ${Z.total} total${N?` · ${N} N/A`:""}</p>`}
301
301
 
302
302
  <section>
303
303
  <h2>The 6 W's</h2>
304
- ${_4(G)||'<p class="muted">No human_context yet.</p>'}
305
- ${q.length?_4(q):""}
304
+ ${E3(G)||'<p class="muted">No human_context yet.</p>'}
305
+ ${q.length?E3(q):""}
306
306
  </section>
307
307
 
308
308
  <section>
309
309
  <h2>Project</h2>
310
- ${_4(V)||'<p class="muted">—</p>'}
310
+ ${E3(V)||'<p class="muted">—</p>'}
311
311
  </section>
312
312
 
313
313
  <section>
314
314
  <h2>Stack</h2>
315
- ${B.length?_4(B):'<p class="muted">No active stack slots.</p>'}
315
+ ${H.length?E3(H):'<p class="muted">No active stack slots.</p>'}
316
316
  </section>
317
317
 
318
318
  <footer>
319
- Rendered on-demand from your current <strong>${H$(X)}</strong><br>
319
+ Rendered on-demand from your current <strong>${B$(X)}</strong><br>
320
320
  <strong>Humans like visuals. <span style="color:#00D4D4">We gave them one.</span></strong>
321
321
  </footer>
322
322
  </div>
323
323
  </body>
324
324
  </html>
325
- `}function P4($,Z,X,z="project.faf"){MO(OO($,"project.html"),_O(Z,X,z),"utf-8")}import{writeFileSync as PO}from"fs";import{join as wO}from"path";var Dz="application/vnd.faf+yaml",CO="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",EO=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function Az($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&EO.test(Z))return Z;let X=$.project?.homepage??$.project?.website??$.project?.url,z="local";if(X)try{z=new URL(X).hostname.replace(/^www\./,"").split(".").reverse().join(".")}catch{}let J=Z.replace(/[^a-zA-Z0-9._-]/g,"-").replace(/^-+|-+$/g,"")||"project";return`${z}/${J}`}function jO($){let Z=String($.project?.goal??$.context??$.project?.name??"MCP server").replace(/\s+/g," ").trim();if(!Z)return"MCP server";return Z.length<=100?Z:`${Z.slice(0,97).trimEnd()}...`}function Rz($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:Dz,iana:`https://www.iana.org/assignments/media-types/${Dz}`,deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function SO($,Z={}){let X={$schema:CO,name:Az($),version:String($.project?.version??"0.1.0"),description:jO($)},z=r6($)??$.project?.name;if(z&&z.length<=100)X.title=z;let J=$.project?.homepage??$.project?.website??$.project?.url;if(J)X.websiteUrl=J;if(Z.remoteUrl)X.remotes=[{type:"streamable-http",url:Z.remoteUrl}];return X._meta={"one.faf/context":Rz($,Z)},X}var n6="io.modelcontextprotocol.registry/publisher-provided",Iz=4096;function Fz($,Z={}){let X={"one.faf/context":Rz($,Z)},z=new TextEncoder().encode(JSON.stringify(X)).length;if(z>Iz)throw Error(`publisher-provided _meta is ${z}B — exceeds the registry ${Iz}B cap`);return{[n6]:X}}function _z($){return Az($)}function r6($){let Z=$.project?.title;if(typeof Z==="string"){let X=Z.trim();if(X&&X.length<=100)return X}return}function Pz($,Z,X={}){let z=SO(Z,X),J=wO($,"server-card");return PO(J,`${JSON.stringify(z,null,2)}
326
- `,"utf-8"),J}d();function B$($={}){let Z=h();if(!Z)console.error(`Error: project.faf not found
325
+ `}function S3($,Z,X,z="project.faf"){hN(uN($,"project.html"),nN(Z,X,z),"utf-8")}import{writeFileSync as rN}from"fs";import{join as sN}from"path";var Cz="application/vnd.faf+yaml",aN="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",oN=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function Ez($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&oN.test(Z))return Z;let X=$.project?.homepage??$.project?.website??$.project?.url,z="local";if(X)try{z=new URL(X).hostname.replace(/^www\./,"").split(".").reverse().join(".")}catch{}let J=Z.replace(/[^a-zA-Z0-9._-]/g,"-").replace(/^-+|-+$/g,"")||"project";return`${z}/${J}`}function tN($){let Z=String($.project?.goal??$.context??$.project?.name??"MCP server").replace(/\s+/g," ").trim();if(!Z)return"MCP server";return Z.length<=100?Z:`${Z.slice(0,97).trimEnd()}...`}function Sz($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:Cz,iana:`https://www.iana.org/assignments/media-types/${Cz}`,deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function eN($,Z={}){let X={$schema:aN,name:Ez($),version:String($.project?.version??"0.1.0"),description:tN($)},z=e6($)??$.project?.name;if(z&&z.length<=100)X.title=z;let J=$.project?.homepage??$.project?.website??$.project?.url;if(J)X.websiteUrl=J;if(Z.remoteUrl)X.remotes=[{type:"streamable-http",url:Z.remoteUrl}];return X._meta={"one.faf/context":Sz($,Z)},X}var t6="io.modelcontextprotocol.registry/publisher-provided",wz=4096;function jz($,Z={}){let X={"one.faf/context":Sz($,Z)},z=new TextEncoder().encode(JSON.stringify(X)).length;if(z>wz)throw Error(`publisher-provided _meta is ${z}B — exceeds the registry ${wz}B cap`);return{[t6]:X}}function xz($){return Ez($)}function e6($){let Z=$.project?.title;if(typeof Z==="string"){let X=Z.trim();if(X&&X.length<=100)return X}return}function bz($,Z,X={}){let z=eN(Z,X),J=sN($,"server-card");return rN(J,`${JSON.stringify(z,null,2)}
326
+ `,"utf-8"),J}d();function L$($={}){let Z=v();if(!Z)console.error(`Error: project.faf not found
327
327
 
328
- Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=l(Z),J=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.conductor&&!$.html&&!$.card;if(J||$.agents)Qz(X,Wz(X,z)),console.log(" AGENTS.md");if(J||$.cursor)Uz(X,z),console.log(" .cursorrules");if(J||$.gemini)Gz(X,z),console.log(" GEMINI.md");if(J||$.copilot)Kz(X,z),console.log(" .github/copilot-instructions.md");if($.grok){let Y=Nz(X,z);console.log(` .grok/config.toml (${Y})`)}if(J||$.html){let Y=z0(m(Z));P4(X,z,Y,Z),console.log(" project.html")}let Q=z.app_type==="server-card"||z.project?.type==="server-card";if($.card||J&&Q){let Y=Pz(X,z);console.log(` ${Y.replace(`${X}/`,"")}`)}console.log(`${D("exported")} ${H(`from ${Z}`)}`)}import{existsSync as wz,readFileSync as xO,writeFileSync as bO}from"fs";import{resolve as s6}from"path";d();var kO=["$schema","name","title","description","icons","version","repository","websiteUrl","packages","remotes","_meta"];function Cz($={}){let Z=$.faf?s6($.faf):h();if(!Z||!wz(Z))console.error(`Error: project.faf not found
328
+ Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=l(Z),J=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.conductor&&!$.html&&!$.card;if(J||$.agents)Kz(X,Bz(X,z)),console.log(" AGENTS.md");if(J||$.cursor)Lz(X,z),console.log(" .cursorrules");if(J||$.gemini)Mz(X,z),console.log(" GEMINI.md");if(J||$.copilot)Tz(X,z),console.log(" .github/copilot-instructions.md");if($.grok){let Y=Rz(X,z);console.log(` .grok/config.toml (${Y})`)}if(J||$.html){let Y=J0(m(Z));S3(X,z,Y,Z),console.log(" project.html")}let Q=z.app_type==="server-card"||z.project?.type==="server-card";if($.card||J&&Q){let Y=bz(X,z);console.log(` ${Y.replace(`${X}/`,"")}`)}console.log(`${D("exported")} ${B(`from ${Z}`)}`)}import{existsSync as kz,readFileSync as $T,writeFileSync as ZT}from"fs";import{resolve as $Z}from"path";d();var XT=["$schema","name","title","description","icons","version","repository","websiteUrl","packages","remotes","_meta"];function yz($={}){let Z=$.faf?$Z($.faf):v();if(!Z||!kz(Z))console.error(`Error: project.faf not found
329
329
 
330
- Run 'faf init' to create one.`),process.exit(2);let X=l(Z),z=s6($.in??"./server.json");if(!wz(z))console.error(`Error: ${z} not found.
330
+ Run 'faf init' to create one.`),process.exit(2);let X=l(Z),z=$Z($.in??"./server.json");if(!kz(z))console.error(`Error: ${z} not found.
331
331
 
332
332
  'faf server-card' patches the identity into an existing registry server.json;
333
- it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=JSON.parse(xO(z,"utf-8")),Y=J._meta?.[n6]?.["one.faf/context"]?.generated,W=$.generated??Y,U=_z(X),G=r6(X),q=Fz(X,{fafPointer:"./project.faf",now:W}),V={...J,name:U,...$.setVersion?{version:$.setVersion}:{},_meta:{...J._meta??{},...q}};if(G)V.title=G;else delete V.title;let K={};for(let L of kO)if(L in V&&V[L]!==void 0)K[L]=V[L];for(let L of Object.keys(V))if(!(L in K)&&V[L]!==void 0)K[L]=V[L];let B=`${JSON.stringify(K,null,2)}
334
- `;if($.check){process.stdout.write(B);return}let O=s6($.out??z);bO(O,B),console.error(`${D("✓")} ${O} — name=${U} title=${G??"(none)"} ${H("(identity emitted from faf-cli)")}`)}import{join as yO}from"path";import fO from"open";d();function gO($){if(process.env.CI)return!1;try{return fO($).catch(()=>{return}),!0}catch{return!1}}function Ez(){let $=h();if(!$)console.error(`Error: project.faf not found
333
+ it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=JSON.parse($T(z,"utf-8")),Y=J._meta?.[t6]?.["one.faf/context"]?.generated,W=$.generated??Y,U=xz(X),G=e6(X),q=jz(X,{fafPointer:"./project.faf",now:W}),V={...J,name:U,...$.setVersion?{version:$.setVersion}:{},_meta:{...J._meta??{},...q}};if(G)V.title=G;else delete V.title;let K={};for(let L of XT)if(L in V&&V[L]!==void 0)K[L]=V[L];for(let L of Object.keys(V))if(!(L in K)&&V[L]!==void 0)K[L]=V[L];let H=`${JSON.stringify(K,null,2)}
334
+ `;if($.check){process.stdout.write(H);return}let N=$Z($.out??z);ZT(N,H),console.error(`${D("✓")} ${N} — name=${U} title=${G??"(none)"} ${B("(identity emitted from faf-cli)")}`)}import{join as zT}from"path";import JT from"open";d();function QT($){if(process.env.CI)return!1;try{return JT($).catch(()=>{return}),!0}catch{return!1}}function fz(){let $=v();if(!$)console.error(`Error: project.faf not found
335
335
 
336
- Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=l($),z=z0(m($));P4(Z,X,z,$);let J=yO(Z,"project.html"),Q=gO(J);console.log(" project.html"),console.log(Q?`${D("opened")} ${H("in your browser")}`:`${D("rendered")} ${H(`file://${J}`)}`)}import{mkdirSync as vO,rmSync as hO,existsSync as uO}from"fs";import{join as jz,resolve as mO}from"path";import{execFileSync as cO}from"child_process";import{tmpdir as dO}from"os";d();function lO($){let Z=($??"").trim();if(!Z)throw Error("Please provide a GitHub URL.");if(/[\s;&|`$(){}<>\\^'"!*?[\]]/.test(Z))throw Error(`Refusing unsafe URL: ${JSON.stringify($)}`);let X=Z.replace(/\/+$/,"").replace(/\.git$/i,""),z=X.match(/^(?:github\.com\/)?([A-Za-z0-9][A-Za-z0-9._-]*)\/([A-Za-z0-9][A-Za-z0-9._-]*)$/);if(z)return`https://github.com/${z[1]}/${z[2]}.git`;if(/^https?:\/\/[A-Za-z0-9._\-/:@~%]+$/.test(X))return`${X}.git`;throw Error(`Not a recognized GitHub repo URL: ${JSON.stringify($)}`)}function pO($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function iO($,Z,X){return["clone","--depth","1",...X?["--branch",X]:[],"--",$,Z]}function nO($,Z=process.cwd()){if($.stdout)return{outputPath:null};let X=$.output?mO(Z,$.output):jz(Z,"project.faf");if(uO(X)&&!$.force)throw Error(`${X} already exists — refusing to overwrite your context.
337
- `+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:X}}function Sz($,Z={},X=process.cwd()){let z;try{z=lO($)}catch(Y){console.error(`Error: ${Y.message}
336
+ Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=l($),z=J0(m($));S3(Z,X,z,$);let J=zT(Z,"project.html"),Q=QT(J);console.log(" project.html"),console.log(Q?`${D("opened")} ${B("in your browser")}`:`${D("rendered")} ${B(`file://${J}`)}`)}import{mkdirSync as YT,rmSync as WT,existsSync as UT}from"fs";import{join as gz,resolve as GT}from"path";import{execFileSync as qT}from"child_process";import{tmpdir as VT}from"os";d();function KT($){let Z=($??"").trim();if(!Z)throw Error("Please provide a GitHub URL.");if(/[\s;&|`$(){}<>\\^'"!*?[\]]/.test(Z))throw Error(`Refusing unsafe URL: ${JSON.stringify($)}`);let X=Z.replace(/\/+$/,"").replace(/\.git$/i,""),z=X.match(/^(?:github\.com\/)?([A-Za-z0-9][A-Za-z0-9._-]*)\/([A-Za-z0-9][A-Za-z0-9._-]*)$/);if(z)return`https://github.com/${z[1]}/${z[2]}.git`;if(/^https?:\/\/[A-Za-z0-9._\-/:@~%]+$/.test(X))return`${X}.git`;throw Error(`Not a recognized GitHub repo URL: ${JSON.stringify($)}`)}function HT($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function BT($,Z,X){return["clone","--depth","1",...X?["--branch",X]:[],"--",$,Z]}function LT($,Z=process.cwd()){if($.stdout)return{outputPath:null};let X=$.output?GT(Z,$.output):gz(Z,"project.faf");if(UT(X)&&!$.force)throw Error(`${X} already exists — refusing to overwrite your context.
337
+ `+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:X}}function vz($,Z={},X=process.cwd()){let z;try{z=KT($)}catch(Y){console.error(`Error: ${Y.message}
338
338
 
339
- Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let J;try{J=nO(Z,X)}catch(Y){console.error(`Error: ${Y.message}`),process.exit(1);return}let Q=jz(dO(),`faf-git-${Date.now()}`);vO(Q,{recursive:!0});try{console.error(H(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{cO("git",iO(z,Q,Z.ref),{stdio:"pipe"})}catch(G){let V=(G?.stderr?.toString()??"").trim().split(`
339
+ Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let J;try{J=LT(Z,X)}catch(Y){console.error(`Error: ${Y.message}`),process.exit(1);return}let Q=gz(VT(),`faf-git-${Date.now()}`);YT(Q,{recursive:!0});try{console.error(B(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{qT("git",BT(z,Q,Z.ref),{stdio:"pipe"})}catch(G){let V=(G?.stderr?.toString()??"").trim().split(`
340
340
  `).slice(-2).join(" ").trim()||"git clone failed",K=Z.ref?`
341
341
 
342
342
  (does the branch/tag '${Z.ref}' exist?)`:"";console.error(`Error: could not clone ${$}
343
343
 
344
- ${V}${K}`),process.exit(1)}let Y=q$(Q);if(Y.project&&/^faf-git-\d+$/.test(String(Y.project.name??"")))Y.project.name=pO(z);if(J.outputPath===null){process.stdout.write(E6(Y));return}o(J.outputPath,Y),console.log(`${D("created")} ${J.outputPath}`);let W=m(J.outputPath),U=K0(U0(W));J0(U,J.outputPath)}finally{hO(Q,{recursive:!0,force:!0})}}import{execFileSync as M1}from"child_process";import{readFileSync as fz,existsSync as gz,appendFileSync as rO}from"fs";import{join as sO}from"path";var L$=($)=>String($).trim(),aO="slotignored",xz=($)=>_0($)||typeof $==="string"&&$.trim().toLowerCase()===aO;function oO($,Z){let X=[],z=0,J=0;for(let Q of t){let Y=N2($,Q),W=N2(Z,Q),U=!xz(Y),G=!xz(W);if(U)z++;if(G)J++;let q=Q.label??Q.path.split(".").pop()??Q.path,V={path:Q.path,label:q,category:String(Q.category)};if(!U&&G)X.push({...V,kind:"added",to:L$(W)});else if(U&&!G)X.push({...V,kind:"removed",from:L$(Y)});else if(U&&G&&L$(Y)!==L$(W))X.push({...V,kind:"changed",from:L$(Y),to:L$(W)})}return{changes:X,filledBase:z,filledTarget:J}}function bz($){if(!$.trim())return 0;try{return z0($).score??0}catch{return 0}}function kz($){if(!$.trim())return{};try{return UX($)??{}}catch{return{}}}function E4($,Z){let{changes:X,filledBase:z,filledTarget:J}=oO(kz($),kz(Z)),Q=bz($),Y=bz(Z);return{changes:X,scoreBase:Q,scoreTarget:Y,scoreDelta:Y-Q,filledBase:z,filledTarget:J}}var tO={added:"+",removed:"-",changed:"~"},yz=($)=>$>0?`+${$}`:`${$}`,w4=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function vz($,Z,X){let z=[],J=u0(L1($.scoreBase)),Q=u0(L1($.scoreTarget));if(z.push(`project.faf ${Z} → ${X}`),z.push(`Score: ${$.scoreBase}% ${J} → ${$.scoreTarget}% ${Q} (${yz($.scoreDelta)})`),z.push(""),$.changes.length===0)z.push(" (no slot changes)");else{let Y="";for(let W of $.changes){if(W.category!==Y)z.push(` ${W.category}`),Y=W.category;let U=tO[W.kind],G=W.label.padEnd(16);if(W.kind==="changed")z.push(` ${U} ${G} ${w4(W.from)} → ${w4(W.to)}`);else if(W.kind==="added")z.push(` ${U} ${G} ${w4(W.to)} (added)`);else z.push(` ${U} ${G} ${w4(W.from)} (removed)`)}}return z.push(""),z.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${yz($.filledTarget-$.filledBase)})`),z.join(`
345
- `)}function eO($,Z){try{return M1("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function T2($,Z){if(!eO($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function N$($,Z,X){try{return M1("git",["show",`${$}:${Z}`],{cwd:X,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function hz($){let Z=$[0]??"project.faf";try{if($.length<5){console.log(`${Z} — unmerged (resolve the conflict, then \`faf diff\`)`);return}let X=(Q)=>Q&&Q!=="/dev/null"&&gz(Q)?fz(Q,"utf-8"):"",z=(Q,Y)=>{if(!Q||Q==="/dev/null")return"(absent)";if(!Y||/^0+$/.test(Y))return"(working tree)";return Y.slice(0,7)},J=E4(X($[1]),X($[4]));console.log(vz(J,z($[1],$[2]),z($[4],$[5])))}catch(X){console.log(`${Z} — faf diff unavailable (${X instanceof Error?X.message:"error"})`)}}var C4="*.faf diff=faf";function a6($){let[Z,...X]=$.trim().split(/\s+/);try{return M1(Z,X,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function uz($){try{return M1("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}catch{throw console.error("Error: not a git repository."),process.exit(2),Error("unreachable")}}function $T($){let Z=uz($),X=sO(Z,".gitattributes"),z=gz(X)?fz(X,"utf-8"):"";if(!z.split(`
346
- `).some((J)=>J.trim()===C4))rO(X,`${z&&!z.endsWith(`
344
+ ${V}${K}`),process.exit(1)}let Y=V$(Q);if(Y.project&&/^faf-git-\d+$/.test(String(Y.project.name??"")))Y.project.name=HT(z);if(J.outputPath===null){process.stdout.write(b6(Y));return}t(J.outputPath,Y),console.log(`${D("created")} ${J.outputPath}`);let W=m(J.outputPath),U=H0(G0(W));Q0(U,J.outputPath)}finally{WT(Q,{recursive:!0,force:!0})}}import{execFileSync as O1}from"child_process";import{readFileSync as dz,existsSync as lz,appendFileSync as MT}from"fs";import{join as OT}from"path";var M$=($)=>String($).trim(),NT="slotignored",hz=($)=>F0($)||typeof $==="string"&&$.trim().toLowerCase()===NT;function TT($,Z){let X=[],z=0,J=0;for(let Q of e){let Y=O2($,Q),W=O2(Z,Q),U=!hz(Y),G=!hz(W);if(U)z++;if(G)J++;let q=Q.label??Q.path.split(".").pop()??Q.path,V={path:Q.path,label:q,category:String(Q.category)};if(!U&&G)X.push({...V,kind:"added",to:M$(W)});else if(U&&!G)X.push({...V,kind:"removed",from:M$(Y)});else if(U&&G&&M$(Y)!==M$(W))X.push({...V,kind:"changed",from:M$(Y),to:M$(W)})}return{changes:X,filledBase:z,filledTarget:J}}function uz($){if(!$.trim())return 0;try{return J0($).score??0}catch{return 0}}function mz($){if(!$.trim())return{};try{return HX($)??{}}catch{return{}}}function b3($,Z){let{changes:X,filledBase:z,filledTarget:J}=TT(mz($),mz(Z)),Q=uz($),Y=uz(Z);return{changes:X,scoreBase:Q,scoreTarget:Y,scoreDelta:Y-Q,filledBase:z,filledTarget:J}}var DT={added:"+",removed:"-",changed:"~"},cz=($)=>$>0?`+${$}`:`${$}`,j3=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function pz($,Z,X){let z=[],J=u0(L1($.scoreBase)),Q=u0(L1($.scoreTarget));if(z.push(`project.faf ${Z} → ${X}`),z.push(`Score: ${$.scoreBase}% ${J} → ${$.scoreTarget}% ${Q} (${cz($.scoreDelta)})`),z.push(""),$.changes.length===0)z.push(" (no slot changes)");else{let Y="";for(let W of $.changes){if(W.category!==Y)z.push(` ${W.category}`),Y=W.category;let U=DT[W.kind],G=W.label.padEnd(16);if(W.kind==="changed")z.push(` ${U} ${G} ${j3(W.from)} → ${j3(W.to)}`);else if(W.kind==="added")z.push(` ${U} ${G} ${j3(W.to)} (added)`);else z.push(` ${U} ${G} ${j3(W.from)} (removed)`)}}return z.push(""),z.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${cz($.filledTarget-$.filledBase)})`),z.join(`
345
+ `)}function IT($,Z){try{return O1("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function I2($,Z){if(!IT($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function O$($,Z,X){try{return O1("git",["show",`${$}:${Z}`],{cwd:X,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function iz($){let Z=$[0]??"project.faf";try{if($.length<5){console.log(`${Z} — unmerged (resolve the conflict, then \`faf diff\`)`);return}let X=(Q)=>Q&&Q!=="/dev/null"&&lz(Q)?dz(Q,"utf-8"):"",z=(Q,Y)=>{if(!Q||Q==="/dev/null")return"(absent)";if(!Y||/^0+$/.test(Y))return"(working tree)";return Y.slice(0,7)},J=b3(X($[1]),X($[4]));console.log(pz(J,z($[1],$[2]),z($[4],$[5])))}catch(X){console.log(`${Z} — faf diff unavailable (${X instanceof Error?X.message:"error"})`)}}var x3="*.faf diff=faf";function ZZ($){let[Z,...X]=$.trim().split(/\s+/);try{return O1(Z,X,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function nz($){try{return O1("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}catch{throw console.error("Error: not a git repository."),process.exit(2),Error("unreachable")}}function AT($){let Z=nz($),X=OT(Z,".gitattributes"),z=lz(X)?dz(X,"utf-8"):"";if(!z.split(`
346
+ `).some((J)=>J.trim()===x3))MT(X,`${z&&!z.endsWith(`
347
347
  `)?`
348
- `:""}${C4}
349
- `),console.log(`✅ .gitattributes ${C4}`);else console.log(`• .gitattributes already opts in (${C4})`);if(M1("git",["config","diff.faf.command","faf diff-driver"],{cwd:$}),console.log("✅ git config diff.faf.command = faf diff-driver"),console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!a6("faf diff-driver"))console.log("\n⚠ the `faf` on your PATH does not support `diff-driver` yet (needs faf ≥ 7.0)."),console.log(" `git diff` on .faf files falls back to the raw text diff until you upgrade.")}function ZT($){uz($);try{M1("git",["config","--unset","diff.faf.command"],{cwd:$,stdio:"pipe"})}catch{}console.log("✅ removed diff.faf.command (the .gitattributes line is left for you to keep or delete).")}function mz($,Z={},X=process.cwd()){if(Z.installDriver)return $T(X);if(Z.uninstallDriver)return ZT(X);let z=h(X);if(!z)console.error(`Error: project.faf not found
348
+ `:""}${x3}
349
+ `),console.log(`✅ .gitattributes ${x3}`);else console.log(`• .gitattributes already opts in (${x3})`);if(O1("git",["config","diff.faf.command","faf diff-driver"],{cwd:$}),console.log("✅ git config diff.faf.command = faf diff-driver"),console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!ZZ("faf diff-driver"))console.log("\n⚠ the `faf` on your PATH does not support `diff-driver` yet (needs faf ≥ 7.0)."),console.log(" `git diff` on .faf files falls back to the raw text diff until you upgrade.")}function RT($){nz($);try{O1("git",["config","--unset","diff.faf.command"],{cwd:$,stdio:"pipe"})}catch{}console.log("✅ removed diff.faf.command (the .gitattributes line is left for you to keep or delete).")}function rz($,Z={},X=process.cwd()){if(Z.installDriver)return AT(X);if(Z.uninstallDriver)return RT(X);let z=v(X);if(!z)console.error(`Error: project.faf not found
350
350
 
351
- Run 'faf init' to create one.`),process.exit(2);let J;try{J=M1("git",["rev-parse","--show-toplevel"],{cwd:X,encoding:"utf-8"}).trim()}catch{console.error("Error: not a git repository — faf diff compares .faf versions across git history."),process.exit(2);return}let Q=J$(z,X),Y,W,U,G;if(!$)Y="HEAD",W="(working tree)",U=N$("HEAD",Q,X),G=m(z);else if($.includes("...")){let[V,K]=$.split("...");T2(V,X),T2(K,X);let B;try{B=M1("git",["merge-base",V,K],{cwd:X,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${V}' and '${K}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=B.slice(0,7),W=K,U=N$(B,Q,X),G=N$(K,Q,X)}else if($.includes("..")){let[V,K]=$.split("..");T2(V,X),T2(K,X),Y=V,W=K,U=N$(V,Q,X),G=N$(K,Q,X)}else T2($,X),Y=$,W="(working tree)",U=N$($,Q,X),G=m(z);let q=E4(U,G);if(Z.json)console.log(JSON.stringify({base:Y,target:W,...q},null,2));else console.log(vz(q,Y,W))}import{execFileSync as o6}from"child_process";function XT($){if(!$.trim())return 0;try{return z0($).score??0}catch{return 0}}var zT=($)=>$>0?`+${$}`:`${$}`;function JT($){let Z=$.map((X)=>({...X,score:XT(X.raw)}));return Z.map((X,z)=>{let J=Z[z+1];return{hex:X.hex,date:X.date,subject:X.subject,score:X.score,delta:J?X.score-J.score:null,first:!J}})}function QT($,Z="project.faf"){if($.length===0)return`${Z} — no history (no commits touch it yet)`;let X=[];X.push(`${Z} — score timeline (${$.length} commit${$.length===1?"":"s"})`),X.push("");for(let z of $){let J=`${String(z.score).padStart(3)}%`,Q=z.first?" new ":z.delta===0?" ·":zT(z.delta).padStart(4);X.push(` ${J} ${Q} ${z.date} ${z.hex} ${u0(L1(z.score))} ${z.subject}`)}return X.join(`
352
- `)}function YT($,Z,X){try{return o6("git",["show",`${$}:${Z}`],{cwd:X,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function cz($={},Z=process.cwd()){let X=h(Z);if(!X)console.error(`Error: project.faf not found
351
+ Run 'faf init' to create one.`),process.exit(2);let J;try{J=O1("git",["rev-parse","--show-toplevel"],{cwd:X,encoding:"utf-8"}).trim()}catch{console.error("Error: not a git repository — faf diff compares .faf versions across git history."),process.exit(2);return}let Q=Q$(z,X),Y,W,U,G;if(!$)Y="HEAD",W="(working tree)",U=O$("HEAD",Q,X),G=m(z);else if($.includes("...")){let[V,K]=$.split("...");I2(V,X),I2(K,X);let H;try{H=O1("git",["merge-base",V,K],{cwd:X,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${V}' and '${K}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=H.slice(0,7),W=K,U=O$(H,Q,X),G=O$(K,Q,X)}else if($.includes("..")){let[V,K]=$.split("..");I2(V,X),I2(K,X),Y=V,W=K,U=O$(V,Q,X),G=O$(K,Q,X)}else I2($,X),Y=$,W="(working tree)",U=O$($,Q,X),G=m(z);let q=b3(U,G);if(Z.json)console.log(JSON.stringify({base:Y,target:W,...q},null,2));else console.log(pz(q,Y,W))}import{execFileSync as XZ}from"child_process";function _T($){if(!$.trim())return 0;try{return J0($).score??0}catch{return 0}}var FT=($)=>$>0?`+${$}`:`${$}`;function PT($){let Z=$.map((X)=>({...X,score:_T(X.raw)}));return Z.map((X,z)=>{let J=Z[z+1];return{hex:X.hex,date:X.date,subject:X.subject,score:X.score,delta:J?X.score-J.score:null,first:!J}})}function CT($,Z="project.faf"){if($.length===0)return`${Z} — no history (no commits touch it yet)`;let X=[];X.push(`${Z} — score timeline (${$.length} commit${$.length===1?"":"s"})`),X.push("");for(let z of $){let J=`${String(z.score).padStart(3)}%`,Q=z.first?" new ":z.delta===0?" ·":FT(z.delta).padStart(4);X.push(` ${J} ${Q} ${z.date} ${z.hex} ${u0(L1(z.score))} ${z.subject}`)}return X.join(`
352
+ `)}function wT($,Z,X){try{return XZ("git",["show",`${$}:${Z}`],{cwd:X,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function sz($={},Z=process.cwd()){let X=v(Z);if(!X)console.error(`Error: project.faf not found
353
353
 
354
- Run 'faf init' to create one.`),process.exit(2);let z;try{z=o6("git",["rev-parse","--show-toplevel"],{cwd:Z,encoding:"utf-8"}).trim()}catch{console.error("Error: not a git repository — faf log reads the .faf score across git history."),process.exit(2);return}let J=J$(X,Z),Q=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=o6("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",J],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let W=Y.split(`
355
- `).filter(Boolean).map((B)=>{let[O,L,M]=B.split("\x1F");return{hex:O,date:L,subject:M??""}}),U=Q>0?Math.min(W.length,Q+1):W.length,G=W.slice(0,U).map((B)=>({...B,raw:YT(B.hex,J,Z)})),q=JT(G),V=Q>0?q.slice(0,Q):q;if($.reverse)V=[...V].reverse();let K=W.length;if($.json)console.log(JSON.stringify({file:J,total:K,count:V.length,entries:V},null,2));else{let B=QT(V,J.split("/").pop()??"project.faf");if(Q>0&&K>V.length)B+=`
354
+ Run 'faf init' to create one.`),process.exit(2);let z;try{z=XZ("git",["rev-parse","--show-toplevel"],{cwd:Z,encoding:"utf-8"}).trim()}catch{console.error("Error: not a git repository — faf log reads the .faf score across git history."),process.exit(2);return}let J=Q$(X,Z),Q=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=XZ("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",J],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let W=Y.split(`
355
+ `).filter(Boolean).map((H)=>{let[N,L,O]=H.split("\x1F");return{hex:N,date:L,subject:O??""}}),U=Q>0?Math.min(W.length,Q+1):W.length,G=W.slice(0,U).map((H)=>({...H,raw:wT(H.hex,J,Z)})),q=PT(G),V=Q>0?q.slice(0,Q):q;if($.reverse)V=[...V].reverse();let K=W.length;if($.json)console.log(JSON.stringify({file:J,total:K,count:V.length,entries:V},null,2));else{let H=CT(V,J.split("/").pop()??"project.faf");if(Q>0&&K>V.length)H+=`
356
356
 
357
- … showing ${V.length} of ${K} commits — \`faf log --all\` for the full timeline.`;console.log(B)}}import{execFileSync as j4}from"child_process";import{existsSync as t6,readFileSync as e6,writeFileSync as pz,chmodSync as WT,mkdirSync as UT}from"fs";import{resolve as GT,dirname as qT}from"path";var S4="# >>> faf >>>",D2="# <<< faf <<<",dz="faf hooks-run",VT=($)=>$>0?`+${$}`:`${$}`;function iz($){return j4("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function lz($,Z){try{return j4("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function nz($,Z){try{return j4("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function $Z($){let Z=j4("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return GT($,Z)}function rz($={},Z=process.cwd()){try{let X;try{X=iz(Z)}catch{return}let z=h(Z);if(!z)return;let J=J$(z,Z),Q=lz(`:${J}`,Z);if(Q===null)return;let Y=lz(`HEAD:${J}`,Z)??"",W=E4(Y,Q),U=`${W.scoreBase}% → ${W.scoreTarget}% (${VT(W.scoreDelta)})`;if(W.scoreDelta<0){if(console.error(`⚠ faf: context regressed ${U} — ${W.changes.length} slot change(s)`),$.strict)console.error(" commit blocked (--strict). Fix with `faf score` / `faf sync`, or `git commit --no-verify` to override."),process.exit(1)}else console.log(`✓ faf: context ${U}`)}catch(X){console.error(`faf hooks: skipped (${X instanceof Error?X.message:"error"})`)}}function KT($,Z){let X=$.trim().split(/\s+/)[0],z=Z?`${$} --strict || exit 1`:`${$} || true`;return[S4,`if command -v ${X} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${z}`,"fi",D2,""].join(`
358
- `)}function HT($,Z={}){let X;try{X=iz($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let z=nz("core.hooksPath",$);if(z){let q=Z.runnerCmd??dz;return console.error(`Error: core.hooksPath is set (${z}) — a hook manager (husky/lefthook/pre-commit) owns hooks here.`),console.error(" faf won't touch a managed hooks directory. Add this to your pre-commit yourself:"),console.error(` ${q}${Z.strict?" --strict":""}`),!1}let J=$Z($),Q=Z.runnerCmd??dz;if(!a6(Q)){let q=Q.trim().split(/\s+/)[0];if(Z.strict)return console.error(`Error: \`${q}\` on PATH doesn't support \`hooks-run\` yet (needs faf ≥ 7.0).`),console.error(" A --strict hook against an older faf would BLOCK your commits. Upgrade faf, then re-install."),!1;console.log(`⚠ \`${q}\` on PATH doesn't support \`hooks-run\` yet (needs faf ≥ 7.0) — the hook no-ops until you upgrade.`)}let Y=KT(Q,!!Z.strict),W=t6(J)?e6(J,"utf-8"):"",U=W.indexOf(S4),G=W.indexOf(D2);if(U!==-1&&G!==-1){let q=W.slice(G+D2.length).replace(/^\n/,"");W=W.slice(0,U)+Y+q}else if(W.trim())W=W.endsWith(`
357
+ … showing ${V.length} of ${K} commits — \`faf log --all\` for the full timeline.`;console.log(H)}}import{execFileSync as k3}from"child_process";import{existsSync as zZ,readFileSync as JZ,writeFileSync as tz,chmodSync as ET,mkdirSync as ST}from"fs";import{resolve as jT,dirname as xT}from"path";var y3="# >>> faf >>>",A2="# <<< faf <<<",az="faf hooks-run",bT=($)=>$>0?`+${$}`:`${$}`;function ez($){return k3("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function oz($,Z){try{return k3("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function $J($,Z){try{return k3("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function QZ($){let Z=k3("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return jT($,Z)}function ZJ($={},Z=process.cwd()){try{let X;try{X=ez(Z)}catch{return}let z=v(Z);if(!z)return;let J=Q$(z,Z),Q=oz(`:${J}`,Z);if(Q===null)return;let Y=oz(`HEAD:${J}`,Z)??"",W=b3(Y,Q),U=`${W.scoreBase}% → ${W.scoreTarget}% (${bT(W.scoreDelta)})`;if(W.scoreDelta<0){if(console.error(`⚠ faf: context regressed ${U} — ${W.changes.length} slot change(s)`),$.strict)console.error(" commit blocked (--strict). Fix with `faf score` / `faf sync`, or `git commit --no-verify` to override."),process.exit(1)}else console.log(`✓ faf: context ${U}`)}catch(X){console.error(`faf hooks: skipped (${X instanceof Error?X.message:"error"})`)}}function kT($,Z){let X=$.trim().split(/\s+/)[0],z=Z?`${$} --strict || exit 1`:`${$} || true`;return[y3,`if command -v ${X} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${z}`,"fi",A2,""].join(`
358
+ `)}function yT($,Z={}){let X;try{X=ez($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let z=$J("core.hooksPath",$);if(z){let q=Z.runnerCmd??az;return console.error(`Error: core.hooksPath is set (${z}) — a hook manager (husky/lefthook/pre-commit) owns hooks here.`),console.error(" faf won't touch a managed hooks directory. Add this to your pre-commit yourself:"),console.error(` ${q}${Z.strict?" --strict":""}`),!1}let J=QZ($),Q=Z.runnerCmd??az;if(!ZZ(Q)){let q=Q.trim().split(/\s+/)[0];if(Z.strict)return console.error(`Error: \`${q}\` on PATH doesn't support \`hooks-run\` yet (needs faf ≥ 7.0).`),console.error(" A --strict hook against an older faf would BLOCK your commits. Upgrade faf, then re-install."),!1;console.log(`⚠ \`${q}\` on PATH doesn't support \`hooks-run\` yet (needs faf ≥ 7.0) — the hook no-ops until you upgrade.`)}let Y=kT(Q,!!Z.strict),W=zZ(J)?JZ(J,"utf-8"):"",U=W.indexOf(y3),G=W.indexOf(A2);if(U!==-1&&G!==-1){let q=W.slice(G+A2.length).replace(/^\n/,"");W=W.slice(0,U)+Y+q}else if(W.trim())W=W.endsWith(`
359
359
  `)?`${W}
360
360
  ${Y}`:`${W}
361
361
 
362
362
  ${Y}`;else W=`#!/bin/sh
363
- ${Y}`;return UT(qT(J),{recursive:!0}),pz(J,W),WT(J,493),console.log(`✅ pre-commit context guard installed — ${Z.strict?"STRICT (blocks on score regression)":"warn (informs only)"}`),console.log(" Skips when no .faf is staged · respects `git commit --no-verify` · fails open."),!0}function BT($){let Z;try{Z=$Z($)}catch{return console.error("Error: not a git repository."),!1}if(!t6(Z))return console.log("• no pre-commit hook to clean."),!0;let X=e6(Z,"utf-8"),z=X.indexOf(S4),J=X.indexOf(D2);if(z===-1||J===-1)return console.log("• faf block not found in pre-commit — nothing to remove."),!0;let Q=(X.slice(0,z)+X.slice(J+D2.length).replace(/^\n/,"")).replace(/^#!\/bin\/sh\s*$/,`#!/bin/sh
364
- `);return pz(Z,Q),console.log("✅ faf pre-commit block removed (other hook content preserved)."),!0}function LT($){let Z;try{Z=$Z($)}catch{console.error("Error: not a git repository.");return}let X=nz("core.hooksPath",$),z=t6(Z)?e6(Z,"utf-8"):"",J=z.includes(S4),Q=/hooks-run --strict/.test(z);if(console.log("faf pre-commit context guard"),console.log(` installed: ${J?`yes (${Q?"strict":"warn"})`:"no"}`),X)console.log(` ⚠ core.hooksPath = ${X} (a hook manager owns hooks — faf won't install here)`);if(!J&&!X)console.log(" → `faf hooks --install` (add --strict to block on regression)")}function sz($={}){let Z=process.cwd();if($.install){if(!HT(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!BT(Z))process.exit(2);return}LT(Z)}d();function az($={}){if($.version||Object.keys($).length===0)MT()}function MT(){let $=ZZ();console.log(`${D(I("faf"))} v${$.version}`),console.log(H(`kernel ${KX()} IANA application/vnd.faf+yaml`))}var I2=[{name:"HTML",extensions:[".html",".htm"],category:"web"},{name:"CSS",extensions:[".css"],category:"web"},{name:"JavaScript",extensions:[".js",".mjs",".cjs"],category:"web"},{name:"TypeScript",extensions:[".ts",".tsx",".mts",".cts"],category:"web"},{name:"JSX",extensions:[".jsx"],category:"web"},{name:"Vue",extensions:[".vue"],category:"web"},{name:"Svelte",extensions:[".svelte"],category:"web"},{name:"Astro",extensions:[".astro"],category:"web"},{name:"JSON",extensions:[".json"],category:"data"},{name:"YAML",extensions:[".yml",".yaml"],category:"data"},{name:"TOML",extensions:[".toml"],category:"data"},{name:"XML",extensions:[".xml"],category:"data"},{name:"CSV",extensions:[".csv"],category:"data"},{name:"INI",extensions:[".ini",".cfg"],category:"config"},{name:"Env",extensions:[".env"],category:"config"},{name:"Dockerfile",extensions:["Dockerfile"],category:"config"},{name:"Rust",extensions:[".rs"],category:"systems"},{name:"Go",extensions:[".go"],category:"systems"},{name:"C",extensions:[".c",".h"],category:"systems"},{name:"C++",extensions:[".cpp",".cc",".hpp"],category:"systems"},{name:"Zig",extensions:[".zig"],category:"systems"},{name:"Python",extensions:[".py"],category:"scripting"},{name:"Ruby",extensions:[".rb"],category:"scripting"},{name:"Shell",extensions:[".sh",".bash",".zsh"],category:"scripting"},{name:"Lua",extensions:[".lua"],category:"scripting"},{name:"Java",extensions:[".java"],category:"jvm"},{name:"Kotlin",extensions:[".kt",".kts"],category:"jvm"},{name:"Scala",extensions:[".scala"],category:"jvm"},{name:"C#",extensions:[".cs"],category:"dotnet"},{name:"F#",extensions:[".fs"],category:"dotnet"},{name:"Swift",extensions:[".swift"],category:"mobile"},{name:"Dart",extensions:[".dart"],category:"mobile"},{name:"Markdown",extensions:[".md",".mdx"],category:"docs"},{name:"LaTeX",extensions:[".tex"],category:"docs"},{name:"reStructuredText",extensions:[".rst"],category:"docs"},{name:"FAF",extensions:[".faf"],category:"faf"},{name:"FAFb",extensions:[".fafb"],category:"faf"},{name:"FAFm",extensions:[".fafm"],category:"faf"}];d();function oz(){console.log(`${D("formats")} ${H("— supported file types")}
365
- `);let $=new Map;for(let Z of I2){let X=$.get(Z.category)??[];X.push(Z),$.set(Z.category,X)}for(let[Z,X]of $){console.log(` ${I(Z)}`);for(let z of X)console.log(` ${z.name} ${H(z.extensions.join(", "))}`);console.log()}console.log(H(` ${I2.length} formats across ${$.size} categories`))}d();import{readdirSync as OT,rmSync as TT}from"fs";import{tmpdir as DT}from"os";import{join as IT}from"path";function tz(){let $=DT(),Z=0;try{let X=OT($);for(let z of X)if(z.startsWith("faf-git-"))TT(IT($,z),{recursive:!0,force:!0}),Z++}catch{}if(Z>0)console.log(`${D("cleared")} ${Z} cached director${Z===1?"y":"ies"}`);else console.log(H("nothing to clear"))}function ez($={}){let Z=h();if(!Z)console.error(`Error: project.faf not found
363
+ ${Y}`;return ST(xT(J),{recursive:!0}),tz(J,W),ET(J,493),console.log(`✅ pre-commit context guard installed — ${Z.strict?"STRICT (blocks on score regression)":"warn (informs only)"}`),console.log(" Skips when no .faf is staged · respects `git commit --no-verify` · fails open."),!0}function fT($){let Z;try{Z=QZ($)}catch{return console.error("Error: not a git repository."),!1}if(!zZ(Z))return console.log("• no pre-commit hook to clean."),!0;let X=JZ(Z,"utf-8"),z=X.indexOf(y3),J=X.indexOf(A2);if(z===-1||J===-1)return console.log("• faf block not found in pre-commit — nothing to remove."),!0;let Q=(X.slice(0,z)+X.slice(J+A2.length).replace(/^\n/,"")).replace(/^#!\/bin\/sh\s*$/,`#!/bin/sh
364
+ `);return tz(Z,Q),console.log("✅ faf pre-commit block removed (other hook content preserved)."),!0}function gT($){let Z;try{Z=QZ($)}catch{console.error("Error: not a git repository.");return}let X=$J("core.hooksPath",$),z=zZ(Z)?JZ(Z,"utf-8"):"",J=z.includes(y3),Q=/hooks-run --strict/.test(z);if(console.log("faf pre-commit context guard"),console.log(` installed: ${J?`yes (${Q?"strict":"warn"})`:"no"}`),X)console.log(` ⚠ core.hooksPath = ${X} (a hook manager owns hooks — faf won't install here)`);if(!J&&!X)console.log(" → `faf hooks --install` (add --strict to block on regression)")}function XJ($={}){let Z=process.cwd();if($.install){if(!yT(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!fT(Z))process.exit(2);return}gT(Z)}d();function zJ($={}){if($.version||Object.keys($).length===0)hT()}function hT(){let $=YZ();console.log(`${D(I("faf"))} v${$.version}`),console.log(B(`kernel ${OX()} IANA application/vnd.faf+yaml`))}var R2=[{name:"HTML",extensions:[".html",".htm"],category:"web"},{name:"CSS",extensions:[".css"],category:"web"},{name:"JavaScript",extensions:[".js",".mjs",".cjs"],category:"web"},{name:"TypeScript",extensions:[".ts",".tsx",".mts",".cts"],category:"web"},{name:"JSX",extensions:[".jsx"],category:"web"},{name:"Vue",extensions:[".vue"],category:"web"},{name:"Svelte",extensions:[".svelte"],category:"web"},{name:"Astro",extensions:[".astro"],category:"web"},{name:"JSON",extensions:[".json"],category:"data"},{name:"YAML",extensions:[".yml",".yaml"],category:"data"},{name:"TOML",extensions:[".toml"],category:"data"},{name:"XML",extensions:[".xml"],category:"data"},{name:"CSV",extensions:[".csv"],category:"data"},{name:"INI",extensions:[".ini",".cfg"],category:"config"},{name:"Env",extensions:[".env"],category:"config"},{name:"Dockerfile",extensions:["Dockerfile"],category:"config"},{name:"Rust",extensions:[".rs"],category:"systems"},{name:"Go",extensions:[".go"],category:"systems"},{name:"C",extensions:[".c",".h"],category:"systems"},{name:"C++",extensions:[".cpp",".cc",".hpp"],category:"systems"},{name:"Zig",extensions:[".zig"],category:"systems"},{name:"Python",extensions:[".py"],category:"scripting"},{name:"Ruby",extensions:[".rb"],category:"scripting"},{name:"Shell",extensions:[".sh",".bash",".zsh"],category:"scripting"},{name:"Lua",extensions:[".lua"],category:"scripting"},{name:"Java",extensions:[".java"],category:"jvm"},{name:"Kotlin",extensions:[".kt",".kts"],category:"jvm"},{name:"Scala",extensions:[".scala"],category:"jvm"},{name:"C#",extensions:[".cs"],category:"dotnet"},{name:"F#",extensions:[".fs"],category:"dotnet"},{name:"Swift",extensions:[".swift"],category:"mobile"},{name:"Dart",extensions:[".dart"],category:"mobile"},{name:"Markdown",extensions:[".md",".mdx"],category:"docs"},{name:"LaTeX",extensions:[".tex"],category:"docs"},{name:"reStructuredText",extensions:[".rst"],category:"docs"},{name:"FAF",extensions:[".faf"],category:"faf"},{name:"FAFb",extensions:[".fafb"],category:"faf"},{name:"FAFm",extensions:[".fafm"],category:"faf"}];d();function JJ(){console.log(`${D("formats")} ${B("— supported file types")}
365
+ `);let $=new Map;for(let Z of R2){let X=$.get(Z.category)??[];X.push(Z),$.set(Z.category,X)}for(let[Z,X]of $){console.log(` ${I(Z)}`);for(let z of X)console.log(` ${z.name} ${B(z.extensions.join(", "))}`);console.log()}console.log(B(` ${R2.length} formats across ${$.size} categories`))}d();import{readdirSync as uT,rmSync as mT}from"fs";import{tmpdir as cT}from"os";import{join as dT}from"path";function QJ(){let $=cT(),Z=0;try{let X=uT($);for(let z of X)if(z.startsWith("faf-git-"))mT(dT($,z),{recursive:!0,force:!0}),Z++}catch{}if(Z>0)console.log(`${D("cleared")} ${Z} cached director${Z===1?"y":"ies"}`);else console.log(B("nothing to clear"))}function YJ($={}){let Z=v();if(!Z)console.error(`Error: project.faf not found
366
366
 
367
- Run 'faf init' to create one.`),process.exit(2);if($.json){let X=l(Z);console.log(JSON.stringify(X,null,2))}else{let X=m(Z);console.log(X)}}d();function $J(){let $=h();if(!$)console.error(`Error: project.faf not found
367
+ Run 'faf init' to create one.`),process.exit(2);if($.json){let X=l(Z);console.log(JSON.stringify(X,null,2))}else{let X=m(Z);console.log(X)}}d();function WJ(){let $=v();if(!$)console.error(`Error: project.faf not found
368
368
 
369
- Run 'faf init' to create one.`),process.exit(2);let Z=l($),X=[];for(let z of t){let[J,Q]=z.path.split("."),W=Z[J]?.[Q];if(_0(W)||W==="slotignored")continue;X.push(`${z.path}: ${W}`)}if(X.length===0){console.log(H("no populated slots"));return}console.log(X.join(`
370
- `))}import{existsSync as AT,statSync as ZJ}from"fs";import{join as RT}from"path";d();var FT=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"];function XJ(){let $=h();if(!$)console.error(`Error: project.faf not found
369
+ Run 'faf init' to create one.`),process.exit(2);let Z=l($),X=[];for(let z of e){let[J,Q]=z.path.split("."),W=Z[J]?.[Q];if(F0(W)||W==="slotignored")continue;X.push(`${z.path}: ${W}`)}if(X.length===0){console.log(B("no populated slots"));return}console.log(X.join(`
370
+ `))}import{existsSync as lT,statSync as UJ}from"fs";import{join as pT}from"path";d();var iT=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"];function GJ(){let $=v();if(!$)console.error(`Error: project.faf not found
371
371
 
372
- Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=ZJ($).mtimeMs;console.log(`${D("drift")} ${H("— context file sync status")}
373
- `),console.log(` ${I(".faf")} ${H(XZ(X))}`);let z=0;for(let J of FT){let Q=RT(Z,J);if(!AT(Q)){console.log(` ${H("○")} ${J} ${H("missing")}`);continue}let Y=ZJ(Q).mtimeMs,W=Y-X;if(Math.abs(W)<1000)console.log(` ${D("●")} ${J} ${H("in sync")}`);else if(W>0)console.log(` ${I("!")} ${J} ${I("newer")} ${H(XZ(Y))}`),z++;else console.log(` ${H("○")} ${J} ${H("older")} ${H(XZ(Y))}`),z++}if(z>0)console.log(H(`
374
- run ${I("'faf sync'")} to resolve drift`))}function XZ($){let Z=Date.now()-$,X=Math.floor(Z/1000);if(X<60)return`${X}s ago`;let z=Math.floor(X/60);if(z<60)return`${z}m ago`;let J=Math.floor(z/60);if(J<24)return`${J}h ago`;return`${Math.floor(J/24)}d ago`}d();function zJ($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
372
+ Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=UJ($).mtimeMs;console.log(`${D("drift")} ${B("— context file sync status")}
373
+ `),console.log(` ${I(".faf")} ${B(WZ(X))}`);let z=0;for(let J of iT){let Q=pT(Z,J);if(!lT(Q)){console.log(` ${B("○")} ${J} ${B("missing")}`);continue}let Y=UJ(Q).mtimeMs,W=Y-X;if(Math.abs(W)<1000)console.log(` ${D("●")} ${J} ${B("in sync")}`);else if(W>0)console.log(` ${I("!")} ${J} ${I("newer")} ${B(WZ(Y))}`),z++;else console.log(` ${B("○")} ${J} ${B("older")} ${B(WZ(Y))}`),z++}if(z>0)console.log(B(`
374
+ run ${I("'faf sync'")} to resolve drift`))}function WZ($){let Z=Date.now()-$,X=Math.floor(Z/1000);if(X<60)return`${X}s ago`;let z=Math.floor(X/60);if(z<60)return`${z}m ago`;let J=Math.floor(z/60);if(J<24)return`${J}h ago`;return`${Math.floor(J/24)}d ago`}d();function qJ($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
375
375
 
376
- Example: faf edit project.name "My Project"`),process.exit(1);let X=h();if(!X)console.error(`Error: project.faf not found
376
+ Example: faf edit project.name "My Project"`),process.exit(1);let X=v();if(!X)console.error(`Error: project.faf not found
377
377
 
378
- Run 'faf init' to create one.`),process.exit(2);let z=l(X),J=$.split(".");if(J.length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let[Q,Y]=J;if(!z[Q]||typeof z[Q]!=="object")z[Q]={};z[Q][Y]=Z,o(X,z),console.log(`${D("updated")} ${$} ${H("→")} ${Z}`)}import{existsSync as x4,readFileSync as zZ}from"fs";import{join as A2}from"path";d();function JJ(){let $=process.cwd(),Z=[],X={faf_version:N1,project:{}},z=A2($,"CLAUDE.md");if(x4(z)){let U=zZ(z,"utf-8"),G=A4(U);if(G.project?.name)X.project.name=G.project.name;if(G.project?.goal)X.project.goal=G.project.goal;if(G.project?.main_language)X.project.main_language=G.project.main_language;Z.push("CLAUDE.md")}let J=A2($,"AGENTS.md");if(x4(J)){let U=zZ(J,"utf-8");if(!X.project.name){let G=U.match(/^#\s+(.+)/m);if(G)X.project.name=G[1].trim()}Z.push("AGENTS.md")}let Q=A2($,"GEMINI.md");if(x4(Q)){let U=zZ(Q,"utf-8");if(!X.project.name){let G=U.match(/^#\s+(.+)/m);if(G)X.project.name=G[1].trim()}Z.push("GEMINI.md")}let Y=A2($,".cursorrules");if(x4(Y))Z.push(".cursorrules");if(Z.length===0)console.error("No context files found (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules)."),process.exit(2);let W=h($);if(W){let U=l(W);if(!U.project)U.project={};if(X.project.name&&!U.project.name)U.project.name=X.project.name;if(X.project.goal&&!U.project.goal)U.project.goal=X.project.goal;if(X.project.main_language&&!U.project.main_language)U.project.main_language=X.project.main_language;o(W,U),console.log(`${D("◆")} recover merged into ${W}`)}else{let U=A2($,"project.faf");o(U,X),console.log(`${D("◆")} recover created ${U}`)}console.log(H(` sources: ${Z.join(", ")}`))}d();var R2=N1;function QJ($={}){let Z=h();if(!Z)console.error(`Error: project.faf not found
378
+ Run 'faf init' to create one.`),process.exit(2);let z=l(X),J=$.split(".");if(J.length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let[Q,Y]=J;if(!z[Q]||typeof z[Q]!=="object")z[Q]={};z[Q][Y]=Z,t(X,z),console.log(`${D("updated")} ${$} ${B("→")} ${Z}`)}import{existsSync as f3,readFileSync as UZ}from"fs";import{join as _2}from"path";d();function VJ(){let $=process.cwd(),Z=[],X={faf_version:M1,project:{}},z=_2($,"CLAUDE.md");if(f3(z)){let U=UZ(z,"utf-8"),G=P3(U);if(G.project?.name)X.project.name=G.project.name;if(G.project?.goal)X.project.goal=G.project.goal;if(G.project?.main_language)X.project.main_language=G.project.main_language;Z.push("CLAUDE.md")}let J=_2($,"AGENTS.md");if(f3(J)){let U=UZ(J,"utf-8");if(!X.project.name){let G=U.match(/^#\s+(.+)/m);if(G)X.project.name=G[1].trim()}Z.push("AGENTS.md")}let Q=_2($,"GEMINI.md");if(f3(Q)){let U=UZ(Q,"utf-8");if(!X.project.name){let G=U.match(/^#\s+(.+)/m);if(G)X.project.name=G[1].trim()}Z.push("GEMINI.md")}let Y=_2($,".cursorrules");if(f3(Y))Z.push(".cursorrules");if(Z.length===0)console.error("No context files found (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules)."),process.exit(2);let W=v($);if(W){let U=l(W);if(!U.project)U.project={};if(X.project.name&&!U.project.name)U.project.name=X.project.name;if(X.project.goal&&!U.project.goal)U.project.goal=X.project.goal;if(X.project.main_language&&!U.project.main_language)U.project.main_language=X.project.main_language;t(W,U),console.log(`${D("◆")} recover merged into ${W}`)}else{let U=_2($,"project.faf");t(U,X),console.log(`${D("◆")} recover created ${U}`)}console.log(B(` sources: ${Z.join(", ")}`))}d();var F2=M1;function KJ($={}){let Z=v();if(!Z)console.error(`Error: project.faf not found
379
379
 
380
- Run 'faf init' to create one.`),process.exit(2);let X=l(Z),z=X.faf_version??"unknown";if(z===R2){console.log(`${D("◆")} migrate already at v${R2}`);return}if(X.faf_version=R2,!X.project)X.project={};if(!X.stack)X.stack={};if(!X.human_context)X.human_context={};if(!X.monorepo)X.monorepo={};if($.dryRun){console.log(`${D("◆")} migrate ${H("(dry run)")} v${z} → v${R2}`),console.log(H(` would update ${Z}`));return}o(Z,X),console.log(`${D("◆")} migrate v${z} → v${R2}`),console.log(H(` updated ${Z}`))}d();function YJ($){if($==="features")PT();else if($==="activate")wT();else _T()}function _T(){let $=K$();if(console.log(`${D("pro")} ${H("— FAF Pro status")}
381
- `),console.log(` Status: ${$?V0(I("PRO")):I("Free")}`),console.log(""),!$)console.log(H(" Upgrade: faf pro activate"))}function PT(){console.log(`${D("pro")} ${H("— Pro features")}
382
- `);let $=[["tri-sync",".faf ↔ CLAUDE.md ↔ MEMORY.md"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,X]of $)console.log(` ${D("◆")} ${I(Z)} ${H("—")} ${X}`);console.log("")}function wT(){console.log(`${D("pro")} ${H("— activate")}
383
- `),console.log(" Set FAF_PRO=1 in your environment to enable Pro features."),console.log(""),console.log(H(" export FAF_PRO=1")),console.log(""),console.log(H(" Visit: https://faf.one/pro")),import("open").then(({default:$})=>$("https://faf.one/pro")).catch(()=>{})}import{gzipSync as CT}from"zlib";d();function WJ($={}){let Z=h();if(!Z)console.error(`Error: project.faf not found
380
+ Run 'faf init' to create one.`),process.exit(2);let X=l(Z),z=X.faf_version??"unknown";if(z===F2){console.log(`${D("◆")} migrate already at v${F2}`);return}if(X.faf_version=F2,!X.project)X.project={};if(!X.stack)X.stack={};if(!X.human_context)X.human_context={};if(!X.monorepo)X.monorepo={};if($.dryRun){console.log(`${D("◆")} migrate ${B("(dry run)")} v${z} → v${F2}`),console.log(B(` would update ${Z}`));return}t(Z,X),console.log(`${D("◆")} migrate v${z} → v${F2}`),console.log(B(` updated ${Z}`))}d();function HJ($){if($==="features")rT();else if($==="activate")sT();else nT()}function nT(){let $=H$();if(console.log(`${D("pro")} ${B("— FAF Pro status")}
381
+ `),console.log(` Status: ${$?K0(I("PRO")):I("Free")}`),console.log(""),!$)console.log(B(" Upgrade: faf pro activate"))}function rT(){console.log(`${D("pro")} ${B("— Pro features")}
382
+ `);let $=[["tri-sync",".faf ↔ CLAUDE.md ↔ MEMORY.md"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,X]of $)console.log(` ${D("◆")} ${I(Z)} ${B("—")} ${X}`);console.log("")}function sT(){console.log(`${D("pro")} ${B("— activate")}
383
+ `),console.log(" Set FAF_PRO=1 in your environment to enable Pro features."),console.log(""),console.log(B(" export FAF_PRO=1")),console.log(""),console.log(B(" Visit: https://faf.one/pro")),import("open").then(({default:$})=>$("https://faf.one/pro")).catch(()=>{})}import{gzipSync as aT}from"zlib";d();function BJ($={}){let Z=v();if(!Z)console.error(`Error: project.faf not found
384
384
 
385
- Run 'faf init' to create one.`),process.exit(2);let X=m(Z),J=CT(Buffer.from(X)).toString("base64url");if($.raw){console.log(J);return}let Q=`https://faf.one/share?d=${J}`;if(console.log(`${D("◆")} share ${H(Z)}
386
- `),console.log(` ${Q}`),$.copy)try{let{execSync:Y}=A0("child_process"),W=process.platform;if(W==="darwin")Y("pbcopy",{input:Q});else if(W==="linux")Y("xclip -selection clipboard",{input:Q});console.log(H(`
387
- copied to clipboard`))}catch{console.log(H(`
388
- copy failed — install xclip or pbcopy`))}}import{mkdirSync as ET,writeFileSync as jT,rmSync as ST}from"fs";import{tmpdir as xT}from"os";import{join as UJ}from"path";d();function GJ(){let $=UJ(xT(),`faf-demo-${Date.now()}`);ET($,{recursive:!0}),console.log(`${D("demo")} ${H("— FAF in action")}
385
+ Run 'faf init' to create one.`),process.exit(2);let X=m(Z),J=aT(Buffer.from(X)).toString("base64url");if($.raw){console.log(J);return}let Q=`https://faf.one/share?d=${J}`;if(console.log(`${D("◆")} share ${B(Z)}
386
+ `),console.log(` ${Q}`),$.copy)try{let{execSync:Y}=A0("child_process"),W=process.platform;if(W==="darwin")Y("pbcopy",{input:Q});else if(W==="linux")Y("xclip -selection clipboard",{input:Q});console.log(B(`
387
+ copied to clipboard`))}catch{console.log(B(`
388
+ copy failed — install xclip or pbcopy`))}}import{mkdirSync as oT,writeFileSync as tT,rmSync as eT}from"fs";import{tmpdir as $D}from"os";import{join as LJ}from"path";d();function MJ(){let $=LJ($D(),`faf-demo-${Date.now()}`);oT($,{recursive:!0}),console.log(`${D("demo")} ${B("— FAF in action")}
389
389
  `);let Z=`faf_version: 2.5.0
390
390
  project:
391
391
  name: acme-app
@@ -411,18 +411,18 @@ human_context:
411
411
  where: Cloud (Vercel + AWS)
412
412
  when: "2026"
413
413
  how: Agile sprints with CI/CD
414
- `,X=UJ($,"project.faf");jT(X,Z),console.log(` ${I("1.")} Created sample project.faf`),console.log(H(` ${X}
415
- `)),console.log(` ${I("2.")} Scoring...`);let z=K0(U0(m(X)));console.log(""),J0(z,"project.faf",!0),ST($,{recursive:!0,force:!0}),console.log(`
416
- ${H(' Demo complete. Run "faf init" in your project to get started.')}`)}d();function qJ($,Z={}){if(!$)console.error("Usage: faf search <keyword>"),process.exit(2);let X=$.toLowerCase(),z=!Z.slots&&!Z.formats,J=0;if(z||Z.slots){let Q=t.filter((Y)=>Y.path.toLowerCase().includes(X)||Y.description.toLowerCase().includes(X)||Y.category.toLowerCase().includes(X));if(Q.length>0){console.log(`${D("slots")} ${H(`— ${Q.length} match${Q.length===1?"":"es"}`)}
417
- `);for(let Y of Q)console.log(` ${I(`#${Y.index}`)} ${Y.path} ${H("—")} ${Y.description} ${H(`[${Y.category}]`)}`);console.log(""),J+=Q.length}}if(z||Z.formats){let Q=I2.filter((Y)=>Y.name.toLowerCase().includes(X)||Y.extensions.some((W)=>W.toLowerCase().includes(X))||Y.category.toLowerCase().includes(X));if(Q.length>0){console.log(`${D("formats")} ${H(`— ${Q.length} match${Q.length===1?"":"es"}`)}
418
- `);for(let Y of Q)console.log(` ${I(Y.name)} ${H(Y.extensions.join(", "))} ${H(`[${Y.category}]`)}`);console.log(""),J+=Q.length}}if(J===0)console.log(H(` No results for "${$}"`))}import{writeFileSync as VJ,existsSync as M$,mkdirSync as bT}from"fs";import{join as g1}from"path";d();var kT="Wolfe-Jam/faf-taf-git@v2.2.0";function KJ($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;if($==="setup"){vT(Z);return}hT(Z)}function yT($){if(M$(g1($,"bun.lockb"))||M$(g1($,"bun.lock")))return"bun";if(M$(g1($,"pnpm-lock.yaml")))return"pnpm";if(M$(g1($,"yarn.lock")))return"yarn";return"npm"}var fT={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: pnpm/action-setup@v4
414
+ `,X=LJ($,"project.faf");tT(X,Z),console.log(` ${I("1.")} Created sample project.faf`),console.log(B(` ${X}
415
+ `)),console.log(` ${I("2.")} Scoring...`);let z=H0(G0(m(X)));console.log(""),Q0(z,"project.faf",!0),eT($,{recursive:!0,force:!0}),console.log(`
416
+ ${B(' Demo complete. Run "faf init" in your project to get started.')}`)}d();function OJ($,Z={}){if(!$)console.error("Usage: faf search <keyword>"),process.exit(2);let X=$.toLowerCase(),z=!Z.slots&&!Z.formats,J=0;if(z||Z.slots){let Q=e.filter((Y)=>Y.path.toLowerCase().includes(X)||Y.description.toLowerCase().includes(X)||Y.category.toLowerCase().includes(X));if(Q.length>0){console.log(`${D("slots")} ${B(`— ${Q.length} match${Q.length===1?"":"es"}`)}
417
+ `);for(let Y of Q)console.log(` ${I(`#${Y.index}`)} ${Y.path} ${B("—")} ${Y.description} ${B(`[${Y.category}]`)}`);console.log(""),J+=Q.length}}if(z||Z.formats){let Q=R2.filter((Y)=>Y.name.toLowerCase().includes(X)||Y.extensions.some((W)=>W.toLowerCase().includes(X))||Y.category.toLowerCase().includes(X));if(Q.length>0){console.log(`${D("formats")} ${B(`— ${Q.length} match${Q.length===1?"":"es"}`)}
418
+ `);for(let Y of Q)console.log(` ${I(Y.name)} ${B(Y.extensions.join(", "))} ${B(`[${Y.category}]`)}`);console.log(""),J+=Q.length}}if(J===0)console.log(B(` No results for "${$}"`))}import{writeFileSync as NJ,existsSync as N$,mkdirSync as ZD}from"fs";import{join as v1}from"path";d();var XD="Wolfe-Jam/faf-taf-git@v2.2.0";function TJ($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;if($==="setup"){YD(Z);return}WD(Z)}function zD($){if(N$(v1($,"bun.lockb"))||N$(v1($,"bun.lock")))return"bun";if(N$(v1($,"pnpm-lock.yaml")))return"pnpm";if(N$(v1($,"yarn.lock")))return"yarn";return"npm"}var JD={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: pnpm/action-setup@v4
419
419
  - uses: actions/setup-node@v4
420
420
  with:
421
421
  node-version: 20`,install:"pnpm install --frozen-lockfile",test:"pnpm test"},yarn:{setup:` - uses: actions/setup-node@v4
422
422
  with:
423
423
  node-version: 20`,install:"yarn install --frozen-lockfile",test:"yarn test"},npm:{setup:` - uses: actions/setup-node@v4
424
424
  with:
425
- node-version: 20`,install:"npm ci",test:"npm test"}};function gT($){let Z=`name: TAF Receipts
425
+ node-version: 20`,install:"npm ci",test:"npm test"}};function QD($){let Z=`name: TAF Receipts
426
426
  `+`# Prints a Test Receipt (.taf) on every push — proof over time, cannot be gamed.
427
427
  `+`# Generated by \`faf taf setup\`. Docs: https://github.com/Wolfe-Jam/faf-taf-git
428
428
  on:
@@ -434,7 +434,7 @@ jobs:
434
434
  runs-on: ubuntu-latest
435
435
  steps:
436
436
  - uses: actions/checkout@v4
437
- `,X;if(M$(g1($,"package.json"))){let J=fT[yT($)];X=`${J.setup}
437
+ `,X;if(N$(v1($,"package.json"))){let J=JD[zD($)];X=`${J.setup}
438
438
  - run: ${J.install}
439
439
  - name: Run tests
440
440
  run: ${J.test} 2>&1 | tee test-output.txt
@@ -445,28 +445,28 @@ jobs:
445
445
  echo "TODO: your test command" 2>&1 | tee test-output.txt
446
446
  `;let z=` - name: Print TAF receipt
447
447
  if: github.event_name == 'push'
448
- uses: ${kT}
448
+ uses: ${XD}
449
449
  with:
450
450
  test-output-file: test-output.txt
451
451
  auto-commit: 'true'
452
452
  commit-message: 'chore(taf): update .taf receipt [skip ci]'
453
453
  target-branch: taf-receipts
454
- `;return Z+X+z}function vT($){let Z=process.cwd(),X=gT(Z),z=g1(Z,".github","workflows","taf.yml");if($.write){if(M$(z)){console.error(`${I("×")} .github/workflows/taf.yml already exists — not overwriting.`),console.error(H(" Add the faf-taf-git step to your existing workflow, or remove taf.yml and re-run."));return}bT(g1(Z,".github","workflows"),{recursive:!0}),VJ(z,X,"utf-8"),console.log(`${D("◆")} taf wrote .github/workflows/taf.yml`),console.log(H(" commit + push → your first Test Receipt prints to the taf-receipts branch."));return}console.log(`${D("TAF setup")} ${H("— Test Receipt Printer: proof over time, cannot be gamed")}
455
- `),console.log(H("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(X),console.log(H("Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run."))}function hT($){console.error(H("note: `faf taf` (score snapshot) is deprecated — use `faf score --json`. (`faf taf setup` wires the Receipt Printer.)"));let Z=h();if(!Z)console.error(`Error: project.faf not found
454
+ `;return Z+X+z}function YD($){let Z=process.cwd(),X=QD(Z),z=v1(Z,".github","workflows","taf.yml");if($.write){if(N$(z)){console.error(`${I("×")} .github/workflows/taf.yml already exists — not overwriting.`),console.error(B(" Add the faf-taf-git step to your existing workflow, or remove taf.yml and re-run."));return}ZD(v1(Z,".github","workflows"),{recursive:!0}),NJ(z,X,"utf-8"),console.log(`${D("◆")} taf wrote .github/workflows/taf.yml`),console.log(B(" commit + push → your first Test Receipt prints to the taf-receipts branch."));return}console.log(`${D("TAF setup")} ${B("— Test Receipt Printer: proof over time, cannot be gamed")}
455
+ `),console.log(B("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(X),console.log(B("Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run."))}function WD($){console.error(B("note: `faf taf` (score snapshot) is deprecated — use `faf score --json`. (`faf taf setup` wires the Receipt Printer.)"));let Z=v();if(!Z)console.error(`Error: project.faf not found
456
456
 
457
- Run 'faf init' to create one.`),process.exit(2);let X=l(Z),z=m(Z),J=z0(z),Q={taf_version:"1.0.0",generated:new Date().toISOString(),source:Z,project:X.project?.name??"unknown",faf_version:X.faf_version??"unknown",score:J.score,tier:J.tier.name,populated:J.populated,active:J.active,total:J.total,slots:J.slots},Y=JSON.stringify(Q,null,2);if($.output)VJ($.output,Y,"utf-8"),console.log(`${D("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as uT}from"readline";import{existsSync as HJ,readFileSync as mT,writeFileSync as cT,unlinkSync as dT}from"fs";import{join as lT}from"path";d();var pT=".faf-session.json";function iT($,Z){let X=Z.split("."),z=$;for(let J of X){if(z===null||z===void 0||typeof z!=="object")return;z=z[J]}return z}function nT($,Z,X){let z=Z.split("."),J=$;for(let Q=0;Q<z.length-1;Q++){if(!J[z[Q]]||typeof J[z[Q]]!=="object")J[z[Q]]={};J=J[z[Q]]}J[z[z.length-1]]=X}async function BJ($={}){let Z=h();if(!Z)console.error(`Error: project.faf not found
457
+ Run 'faf init' to create one.`),process.exit(2);let X=l(Z),z=m(Z),J=J0(z),Q={taf_version:"1.0.0",generated:new Date().toISOString(),source:Z,project:X.project?.name??"unknown",faf_version:X.faf_version??"unknown",score:J.score,tier:J.tier.name,populated:J.populated,active:J.active,total:J.total,slots:J.slots},Y=JSON.stringify(Q,null,2);if($.output)NJ($.output,Y,"utf-8"),console.log(`${D("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as UD}from"readline";import{existsSync as DJ,readFileSync as GD,writeFileSync as qD,unlinkSync as VD}from"fs";import{join as KD}from"path";d();var HD=".faf-session.json";function BD($,Z){let X=Z.split("."),z=$;for(let J of X){if(z===null||z===void 0||typeof z!=="object")return;z=z[J]}return z}function LD($,Z,X){let z=Z.split("."),J=$;for(let Q=0;Q<z.length-1;Q++){if(!J[z[Q]]||typeof J[z[Q]]!=="object")J[z[Q]]={};J=J[z[Q]]}J[z[z.length-1]]=X}async function IJ($={}){let Z=v();if(!Z)console.error(`Error: project.faf not found
458
458
 
459
- Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=lT(X,pT),J=0;if($.resume&&HJ(z))try{J=JSON.parse(mT(z,"utf-8")).slotIndex,console.log(H(` resuming from slot #${J+1}`))}catch{}let Q=l(Z),Y=t.filter((B)=>{let O=iT(Q,B.path);return _0(O)&&O!=="slotignored"});if(Y.length===0){console.log(`${D("◆")} go all slots populated — ✪ Trophy`);let B=K0(U0(m(Z)));J0(B,Z);return}console.log(`${D("go")} ${H("— guided interview to ✪ Trophy")}`);let W=Y.length===1?"slot":"slots";console.log(H(` ${Y.length} ${W} from Trophy. Enter a value, "skip" to skip, or "quit" to stop.
460
- `));let U=uT({input:process.stdin,output:process.stdout}),G=(B)=>new Promise((O)=>U.question(B,O)),q=0,V=Y.slice(J);for(let B=0;B<V.length;B++){let O=V[B],L=await G(` ${I(`#${O.index}`)} ${D4(O.path)} ${H(`(${O.path})`)}: `);if(L.toLowerCase()==="quit"){let M={slotIndex:J+B,fafPath:Z};cT(z,JSON.stringify(M),"utf-8"),console.log(H(`
461
- session saved. Resume with: faf go --resume`));break}if(L.toLowerCase()==="skip"||L.trim()==="")continue;nT(Q,O.path,L.trim()),q++}if(U.close(),q>0)o(Z,Q),console.log(`
462
- ${D("◆")} go filled ${q} slot${q===1?"":"s"}`);let K=K0(U0(m(Z)));if(J0(K,Z),HJ(z))try{dT(z)}catch{}}d();var lD=[/^(tbd|see\s+readme|todo|fixme|coming\s+soon|n\/a|unknown|none|null|not\s+specified)\b/i,/^(software|application|app|project|tool|library|framework)\.?$/i,/^(for\s+(users|developers|teams|engineers))\.?$/i,/^(general\s+purpose|various|multiple|description|goal|name|title)\.?$/i];function pD($){if(typeof $!=="string")return!1;let Z=$.trim();if(Z.length<4||Z.length>280)return!1;return!lD.some((X)=>X.test(Z))}function iD($,Z){let X=Z.split("."),z=$;for(let J of X){if(z===null||z===void 0||typeof z!=="object")return;z=z[J]}return z}function nD($,Z,X){let z=Z.split("."),J=$;for(let Q=0;Q<z.length-1;Q++){if(!J[z[Q]]||typeof J[z[Q]]!=="object")J[z[Q]]={};J=J[z[Q]]}J[z[z.length-1]]=X}async function BQ($){if($==="analyze")await sD();else if($==="enhance")await rD();else console.log(`${D("ai")} ${H("— AI-powered features")}
463
- `),console.log(` ${I("faf ai enhance")} ${H("— fill empty slots via Claude")}`),console.log(` ${I("faf ai analyze")} ${H("— get improvement suggestions")}`),console.log(""),console.log(H(" Requires ANTHROPIC_API_KEY environment variable."))}async function LQ(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
459
+ Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=KD(X,HD),J=0;if($.resume&&DJ(z))try{J=JSON.parse(GD(z,"utf-8")).slotIndex,console.log(B(` resuming from slot #${J+1}`))}catch{}let Q=l(Z),Y=e.filter((H)=>{let N=BD(Q,H.path);return F0(N)&&N!=="slotignored"});if(Y.length===0){console.log(`${D("◆")} go all slots populated — ✪ Trophy`);let H=H0(G0(m(Z)));Q0(H,Z);return}console.log(`${D("go")} ${B("— guided interview to ✪ Trophy")}`);let W=Y.length===1?"slot":"slots";console.log(B(` ${Y.length} ${W} from Trophy. Enter a value, "skip" to skip, or "quit" to stop.
460
+ `));let U=UD({input:process.stdin,output:process.stdout}),G=(H)=>new Promise((N)=>U.question(H,N)),q=0,V=Y.slice(J);for(let H=0;H<V.length;H++){let N=V[H],L=await G(` ${I(`#${N.index}`)} ${_3(N.path)} ${B(`(${N.path})`)}: `);if(L.toLowerCase()==="quit"){let O={slotIndex:J+H,fafPath:Z};qD(z,JSON.stringify(O),"utf-8"),console.log(B(`
461
+ session saved. Resume with: faf go --resume`));break}if(L.toLowerCase()==="skip"||L.trim()==="")continue;LD(Q,N.path,L.trim()),q++}if(U.close(),q>0)t(Z,Q),console.log(`
462
+ ${D("◆")} go filled ${q} slot${q===1?"":"s"}`);let K=H0(G0(m(Z)));if(Q0(K,Z),DJ(z))try{VD(z)}catch{}}d();var KI=[/^(tbd|see\s+readme|todo|fixme|coming\s+soon|n\/a|unknown|none|null|not\s+specified)\b/i,/^(software|application|app|project|tool|library|framework)\.?$/i,/^(for\s+(users|developers|teams|engineers))\.?$/i,/^(general\s+purpose|various|multiple|description|goal|name|title)\.?$/i];function HI($){if(typeof $!=="string")return!1;let Z=$.trim();if(Z.length<4||Z.length>280)return!1;return!KI.some((X)=>X.test(Z))}function BI($,Z){let X=Z.split("."),z=$;for(let J of X){if(z===null||z===void 0||typeof z!=="object")return;z=z[J]}return z}function LI($,Z,X){let z=Z.split("."),J=$;for(let Q=0;Q<z.length-1;Q++){if(!J[z[Q]]||typeof J[z[Q]]!=="object")J[z[Q]]={};J=J[z[Q]]}J[z[z.length-1]]=X}async function IQ($){if($==="analyze")await OI();else if($==="enhance")await MI();else console.log(`${D("ai")} ${B("— AI-powered features")}
463
+ `),console.log(` ${I("faf ai enhance")} ${B("— fill empty slots via Claude")}`),console.log(` ${I("faf ai analyze")} ${B("— get improvement suggestions")}`),console.log(""),console.log(B(" Requires ANTHROPIC_API_KEY environment variable."))}async function AQ(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
464
464
 
465
- export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (HQ(),KQ));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
465
+ export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (DQ(),TQ));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
466
466
 
467
- npm install @anthropic-ai/sdk`),process.exit(2)}}async function rD(){let $=h();if(!$)console.error(`Error: project.faf not found
467
+ npm install @anthropic-ai/sdk`),process.exit(2)}}async function MI(){let $=v();if(!$)console.error(`Error: project.faf not found
468
468
 
469
- Run 'faf init' to create one.`),process.exit(2);let Z=l($),X=m($),z=t.filter((U)=>{let G=iD(Z,U.path);return _0(G)&&G!=="slotignored"});if(z.length===0){console.log(`${D("◆")} ai enhance all slots populated`);return}console.log(`${D("ai")} enhance ${H(`extracting from ${z.length} empty slots...`)}`);let J=await LQ(),Q=z.map((U)=>`- ${U.path}: ${U.description}`).join(`
469
+ Run 'faf init' to create one.`),process.exit(2);let Z=l($),X=m($),z=e.filter((U)=>{let G=BI(Z,U.path);return F0(G)&&G!=="slotignored"});if(z.length===0){console.log(`${D("◆")} ai enhance all slots populated`);return}console.log(`${D("ai")} enhance ${B(`extracting from ${z.length} empty slots...`)}`);let J=await AQ(),Q=z.map((U)=>`- ${U.path}: ${U.description}`).join(`
470
470
  `),Y=`You are extracting concrete content from a project's .faf file to fill empty slots. STRICT RULES:
471
471
 
472
472
  1. Return JSON mapping dot-paths to values OR null.
@@ -482,54 +482,54 @@ ${X}
482
482
  Empty slots to fill (return null if no concrete evidence):
483
483
  ${Q}
484
484
 
485
- Respond with ONLY valid JSON, no markdown fences. Each value is either a short string (with concrete evidence) or null (leave empty).`,W=await J.messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:Y}]});try{let U=W.content[0].text,G=JSON.parse(U),q=0,V=0;for(let K of z){let B=G[K.path];if(B===null||B===void 0)continue;if(pD(B))nD(Z,K.path,B),console.log(` ${D("●")} ${K.path} ${H("←")} ${B}`),q++;else console.log(` ${H("○")} ${K.path} ${H("— rejected as slop, left empty")}`),V++}if(q>0){o($,Z),console.log(`
486
- ${D("◆")} ai enhance filled ${q} slot${q===1?"":"s"}${V>0?` (${V} rejected)`:""}`);let K=K0(U0(m($)));J0(K,$)}else if(V>0)console.log(`
487
- ${H("all extractions rejected as slop. Run")} ${I("'faf go'")} ${H("for interview-fill.")}`);else console.log(`
488
- ${H("no concrete evidence for empty slots. Run")} ${I("'faf go'")} ${H("for interview-fill.")}`)}catch{console.error("Error: Could not parse AI response.")}}async function sD(){let $=h();if(!$)console.error(`Error: project.faf not found
485
+ Respond with ONLY valid JSON, no markdown fences. Each value is either a short string (with concrete evidence) or null (leave empty).`,W=await J.messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:Y}]});try{let U=W.content[0].text,G=JSON.parse(U),q=0,V=0;for(let K of z){let H=G[K.path];if(H===null||H===void 0)continue;if(HI(H))LI(Z,K.path,H),console.log(` ${D("●")} ${K.path} ${B("←")} ${H}`),q++;else console.log(` ${B("○")} ${K.path} ${B("— rejected as slop, left empty")}`),V++}if(q>0){t($,Z),console.log(`
486
+ ${D("◆")} ai enhance filled ${q} slot${q===1?"":"s"}${V>0?` (${V} rejected)`:""}`);let K=H0(G0(m($)));Q0(K,$)}else if(V>0)console.log(`
487
+ ${B("all extractions rejected as slop. Run")} ${I("'faf go'")} ${B("for interview-fill.")}`);else console.log(`
488
+ ${B("no concrete evidence for empty slots. Run")} ${I("'faf go'")} ${B("for interview-fill.")}`)}catch{console.error("Error: Could not parse AI response.")}}async function OI(){let $=v();if(!$)console.error(`Error: project.faf not found
489
489
 
490
- Run 'faf init' to create one.`),process.exit(2);let Z=m($);console.log(`${D("ai")} analyze ${H("getting suggestions...")}`);let z=await(await LQ()).messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:`Analyze this .faf project context file and provide 3-5 specific suggestions for improvement. Focus on completeness, accuracy, and best practices.
490
+ Run 'faf init' to create one.`),process.exit(2);let Z=m($);console.log(`${D("ai")} analyze ${B("getting suggestions...")}`);let z=await(await AQ()).messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:`Analyze this .faf project context file and provide 3-5 specific suggestions for improvement. Focus on completeness, accuracy, and best practices.
491
491
 
492
492
  ${Z}
493
493
 
494
- Be concise. One line per suggestion.`}]});console.log(""),console.log(z.content[0].text)}import{existsSync as O5,readFileSync as T5,readdirSync as aD}from"fs";import{join as NQ}from"path";d();function MQ($,Z){if($==="import")oD(Z);else if($==="export")tD();else console.log(`${D("conductor")} ${H("— conductor integration")}
495
- `),console.log(` ${I("faf conductor import <path>")} ${H("— import conductor config into .faf")}`),console.log(` ${I("faf conductor export")} ${H("— author conductor config from .faf")}`)}function oD($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!O5($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:N1,project:{}};if(O5($)&&$.endsWith(".json")){let J=JSON.parse(T5($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)Z.project.goal=J.description;if(J.language)Z.project.main_language=J.language}else if(O5($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let J=R0(T5($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)Z.project.goal=J.description;if(J.language)Z.project.main_language=J.language}else try{let J=aD($);for(let Q of J){let Y=NQ($,Q);if(Q.endsWith(".json"))try{let W=JSON.parse(T5(Y,"utf-8"));if(W.name&&!Z.project.name)Z.project.name=W.name;if(W.description&&!Z.project.goal)Z.project.goal=W.description}catch{}}}catch{console.error(`Error: could not read directory: ${$}`),process.exit(2)}let X=process.cwd(),z=h(X);if(z){let J=l(z);if(!J.project)J.project={};if(Z.project.name&&!J.project.name)J.project.name=Z.project.name;if(Z.project.goal&&!J.project.goal)J.project.goal=Z.project.goal;if(Z.project.main_language&&!J.project.main_language)J.project.main_language=Z.project.main_language;o(z,J),console.log(`${D("◆")} conductor import merged into ${z}`)}else{let J=NQ(X,"project.faf");o(J,Z),console.log(`${D("◆")} conductor import created ${J}`)}}function tD(){let $=h();if(!$)console.error(`Error: project.faf not found
494
+ Be concise. One line per suggestion.`}]});console.log(""),console.log(z.content[0].text)}import{existsSync as R5,readFileSync as _5,readdirSync as NI}from"fs";import{join as RQ}from"path";d();function _Q($,Z){if($==="import")TI(Z);else if($==="export")DI();else console.log(`${D("conductor")} ${B("— conductor integration")}
495
+ `),console.log(` ${I("faf conductor import <path>")} ${B("— import conductor config into .faf")}`),console.log(` ${I("faf conductor export")} ${B("— author conductor config from .faf")}`)}function TI($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!R5($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:M1,project:{}};if(R5($)&&$.endsWith(".json")){let J=JSON.parse(_5($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)Z.project.goal=J.description;if(J.language)Z.project.main_language=J.language}else if(R5($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let J=R0(_5($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)Z.project.goal=J.description;if(J.language)Z.project.main_language=J.language}else try{let J=NI($);for(let Q of J){let Y=RQ($,Q);if(Q.endsWith(".json"))try{let W=JSON.parse(_5(Y,"utf-8"));if(W.name&&!Z.project.name)Z.project.name=W.name;if(W.description&&!Z.project.goal)Z.project.goal=W.description}catch{}}}catch{console.error(`Error: could not read directory: ${$}`),process.exit(2)}let X=process.cwd(),z=v(X);if(z){let J=l(z);if(!J.project)J.project={};if(Z.project.name&&!J.project.name)J.project.name=Z.project.name;if(Z.project.goal&&!J.project.goal)J.project.goal=Z.project.goal;if(Z.project.main_language&&!J.project.main_language)J.project.main_language=Z.project.main_language;t(z,J),console.log(`${D("◆")} conductor import merged into ${z}`)}else{let J=RQ(X,"project.faf");t(J,Z),console.log(`${D("◆")} conductor import created ${J}`)}}function DI(){let $=v();if(!$)console.error(`Error: project.faf not found
496
496
 
497
- Run 'faf init' to create one.`),process.exit(2);let Z=l($),X={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(X,null,2))}d();import{readdirSync as eD,readFileSync as $I,existsSync as ZI}from"fs";import{join as XI}from"path";var zI=["BRAKE","ENGINE","AERO","TYRE","PIT"],JI=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function QI($){let Z=$.match(JI);if(!Z)return null;return Z[1].toUpperCase()}function YI($){let Z=$.toLowerCase();if(Z.endsWith(".test.ts")||Z.endsWith(".test.js")||Z.endsWith(".test.tsx")||Z.endsWith(".test.jsx")||Z.endsWith(".spec.ts")||Z.endsWith(".spec.js"))return{ok:!0,lang:"typescript"};if(Z.endsWith(".rs"))return{ok:!0,lang:"rust"};if(Z.endsWith("_test.go"))return{ok:!0,lang:"go"};if((Z.startsWith("test_")||Z.endsWith("_test.py"))&&Z.endsWith(".py"))return{ok:!0,lang:"python"};if(Z.endsWith(".zig"))return{ok:!0,lang:"zig"};return{ok:!1}}function WI($,Z){let X=[];switch(Z){case"typescript":{let z=/\b(describe|test|it)\s*\(\s*(['"`])((?:\\.|(?!\2).)*)\2/g,J=[],Q;while((Q=z.exec($))!==null)J.push({idx:Q.index,type:Q[1]==="describe"?"describe":"test",name:Q[3]});let Y=[],W=0,U=null,G=0;for(let q=0;q<$.length;q++){while(G<J.length&&J[G].idx===q){let K=J[G];if(K.type==="describe")U=K.name;else{let B=Y.map((L)=>L.name),O=B.length>0?`${B.join(" > ")} > ${K.name}`:K.name;X.push(O)}G++}let V=$[q];if(V==="{"){if(W++,U!==null)Y.push({name:U,openDepth:W}),U=null}else if(V==="}"){W--;while(Y.length>0&&W<Y[Y.length-1].openDepth)Y.pop()}}break}case"rust":{let z=/#\[test\]\s*(?:\r?\n)\s*(?:pub\s+)?fn\s+([a-zA-Z_][a-zA-Z_0-9]*)/g,J;while((J=z.exec($))!==null)X.push(J[1]);break}case"python":{let z=/^\s*def\s+(test_[a-zA-Z_0-9]+)\s*\(/gm,J;while((J=z.exec($))!==null)X.push(J[1]);break}case"zig":{let z=/\btest\s+"((?:\\.|[^"\\])+)"/g,J;while((J=z.exec($))!==null)X.push(J[1]);break}case"go":{let z=/\bfunc\s+(Test[A-Z][a-zA-Z_0-9]*)\s*\(/g,J;while((J=z.exec($))!==null)X.push(J[1]);break}}return X}var UI=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function OQ($,Z=[]){let X;try{X=eD($,{withFileTypes:!0})}catch{return Z}for(let z of X){if(UI.has(z.name))continue;if(z.name.startsWith(".")&&z.name!==".")continue;let J=XI($,z.name);if(z.isDirectory())OQ(J,Z);else if(z.isFile())Z.push(J)}return Z}function GI($){let Z=[];if(!ZI($))return Z;let X=OQ($);for(let z of X){let J=z.split("/").pop()??"",Q=YI(J);if(!Q.ok||!Q.lang)continue;let Y;try{Y=$I(z,"utf-8")}catch{continue}if(Q.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(Q.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let W=WI(Y,Q.lang),U=z.replace(`${$}/`,"");for(let G of W)Z.push({file:U,language:Q.lang,testName:G,tier:QI(G)})}return Z}function qI($){let Z={BRAKE:0,ENGINE:0,AERO:0,TYRE:0,PIT:0},X={},z=0,J=[],Q=new Set;for(let Y of $)if(Q.add(Y.file),X[Y.language]=(X[Y.language]??0)+1,Y.tier)Z[Y.tier]++;else if(z++,J.length<5)J.push(`${Y.file}: ${Y.testName}`);return{totalTests:$.length,byTier:Z,untiered:z,untieredExamples:J,filesScanned:Q.size,byLanguage:X}}function VI($){if(console.log(`${D(I("faf wjttc"))} ${H("— vendor-neutral test audit")}`),console.log(""),console.log(` Files scanned: ${I(String($.filesScanned))}`),console.log(` Tests found: ${I(String($.totalTests))}`),console.log(""),$.totalTests===0){console.log(H(" no tests found"));return}console.log(H(" Tiers:"));for(let Z of zI){let X=$.byTier[Z],z=(X/$.totalTests*100).toFixed(0),J=Z==="BRAKE"?V0("●"):Z==="ENGINE"?D("●"):Z==="AERO"?H("●"):Z==="TYRE"?D("◐"):H("○");console.log(` ${J} ${Z.padEnd(7)} ${I(String(X).padStart(4))} ${H(`(${z}%)`)}`)}if($.untiered>0){let Z=($.untiered/$.totalTests*100).toFixed(0);console.log(` ${H("○")} ${"untiered".padEnd(7)} ${I(String($.untiered).padStart(4))} ${H(`(${Z}%)`)}`)}if($.untiered>0&&$.untieredExamples.length>0){console.log(""),console.log(H(` Untiered examples (first ${$.untieredExamples.length}):`));for(let Z of $.untieredExamples)console.log(` ${H("·")} ${Z}`)}if(Object.keys($.byLanguage).length>1){console.log(""),console.log(H(" Languages:"));for(let[Z,X]of Object.entries($.byLanguage))console.log(` ${H("·")} ${Z.padEnd(12)} ${I(String(X))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(V0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function TQ($={}){let Z=$.path??"tests",X=GI(Z),z=qI(X);if($.json)console.log(JSON.stringify(z,null,2));else VI(z);if($.strict&&z.untiered>0)process.exit(1)}import{createHash as AQ}from"crypto";import{readFileSync as RQ,writeFileSync as KI,existsSync as FQ}from"fs";import{join as _Q,dirname as HI}from"path";d();var DQ="faf-bench/1",BI={"project.name":"What is the project's name?","project.goal":"What is the project's goal — what is it for?","project.main_language":"What is the primary programming language?","human_context.who":"Who is this project for?","human_context.what":"What are they building?","human_context.why":"Why does this project exist?","human_context.where":"Where does it run or get distributed?","human_context.when":"When — what is the project's timeline or stage?","human_context.how":"How is it built or used?"};function LI($,Z){return BI[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var NI=[["typescript","ts"],["javascript","js"],["python","py","python3"],["node","nodejs","node js","node.js"],["github actions","gh actions","actions"],["postgresql","postgres","pg"],["kubernetes","k8s"],["npm","npm registry"],["cloudflare workers","cf workers","workers"],["google cloud run","cloud run","gcp cloud run"]],K3=new Map;NI.forEach(($,Z)=>$.forEach((X)=>K3.set(X,Z)));var MI=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function D5($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function IQ($){return D5($).split(" ").filter((Z)=>Z&&!MI.has(Z))}function OI($,Z){let X=D5($),z=D5(Z);if(!X||!z)return!1;if(X===z)return!0;let J=K3.get(X);if(J!==void 0&&K3.get(z)===J)return!0;let Q=IQ($);if(Q.length===0)return!1;let Y=new Set(IQ(Z));return Q.every((W)=>{if(Y.has(W))return!0;let U=K3.get(W);return U!==void 0&&[...Y].some((G)=>K3.get(G)===U)})}function TI($){let Z=z0($),X=R0($),z=[],J={},Q=0;for(let U of t){if(Z.slots[U.path]!=="populated")continue;let G=N2(X,U);if(typeof G!=="string")continue;let q=G.trim();if(!q||b6.has(q.toLowerCase()))continue;Q+=1,z.push({n:Q,path:U.path,question:LI(U.path,U.description)}),J[Q]=q}let Y=JSON.stringify({v:DQ,q:z.map((U)=>[U.path,U.question])}),W=AQ("sha256").update(Y).digest("hex").slice(0,12);return{version:DQ,qsetHash:W,questions:z,answers:J}}function DI($,Z){let X=$.questions.map((J)=>{let Q=Z[String(J.n)]??Z[J.path]??"";return{n:J.n,path:J.path,ok:typeof Q==="string"&&Q.trim()!==""&&OI($.answers[J.n],Q)}}),z=$.questions.filter((J)=>!X[J.n-1].ok);return{correct:X.filter((J)=>J.ok).length,total:$.questions.length,misses:z,perQuestion:X}}var PQ=".faf-bench.json";function II($){let Z=_Q($,PQ);if(!FQ(Z))return null;try{return JSON.parse(RQ(Z,"utf-8"))}catch{return null}}function AI($,Z){KI(_Q($,PQ),`${JSON.stringify(Z,null,2)}
498
- `,"utf-8")}function I5($,Z){let X=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:X,hash:AQ("sha256").update(X).digest("hex")}}var W8=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function RI($,Z){let{cold:X,faf:z}=$;console.log(`
497
+ Run 'faf init' to create one.`),process.exit(2);let Z=l($),X={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(X,null,2))}d();import{readdirSync as II,readFileSync as AI,existsSync as RI}from"fs";import{join as _I}from"path";var FI=["BRAKE","ENGINE","AERO","TYRE","PIT"],PI=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function CI($){let Z=$.match(PI);if(!Z)return null;return Z[1].toUpperCase()}function wI($){let Z=$.toLowerCase();if(Z.endsWith(".test.ts")||Z.endsWith(".test.js")||Z.endsWith(".test.tsx")||Z.endsWith(".test.jsx")||Z.endsWith(".spec.ts")||Z.endsWith(".spec.js"))return{ok:!0,lang:"typescript"};if(Z.endsWith(".rs"))return{ok:!0,lang:"rust"};if(Z.endsWith("_test.go"))return{ok:!0,lang:"go"};if((Z.startsWith("test_")||Z.endsWith("_test.py"))&&Z.endsWith(".py"))return{ok:!0,lang:"python"};if(Z.endsWith(".zig"))return{ok:!0,lang:"zig"};return{ok:!1}}function EI($,Z){let X=[];switch(Z){case"typescript":{let z=/\b(describe|test|it)\s*\(\s*(['"`])((?:\\.|(?!\2).)*)\2/g,J=[],Q;while((Q=z.exec($))!==null)J.push({idx:Q.index,type:Q[1]==="describe"?"describe":"test",name:Q[3]});let Y=[],W=0,U=null,G=0;for(let q=0;q<$.length;q++){while(G<J.length&&J[G].idx===q){let K=J[G];if(K.type==="describe")U=K.name;else{let H=Y.map((L)=>L.name),N=H.length>0?`${H.join(" > ")} > ${K.name}`:K.name;X.push(N)}G++}let V=$[q];if(V==="{"){if(W++,U!==null)Y.push({name:U,openDepth:W}),U=null}else if(V==="}"){W--;while(Y.length>0&&W<Y[Y.length-1].openDepth)Y.pop()}}break}case"rust":{let z=/#\[test\]\s*(?:\r?\n)\s*(?:pub\s+)?fn\s+([a-zA-Z_][a-zA-Z_0-9]*)/g,J;while((J=z.exec($))!==null)X.push(J[1]);break}case"python":{let z=/^\s*def\s+(test_[a-zA-Z_0-9]+)\s*\(/gm,J;while((J=z.exec($))!==null)X.push(J[1]);break}case"zig":{let z=/\btest\s+"((?:\\.|[^"\\])+)"/g,J;while((J=z.exec($))!==null)X.push(J[1]);break}case"go":{let z=/\bfunc\s+(Test[A-Z][a-zA-Z_0-9]*)\s*\(/g,J;while((J=z.exec($))!==null)X.push(J[1]);break}}return X}var SI=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function FQ($,Z=[]){let X;try{X=II($,{withFileTypes:!0})}catch{return Z}for(let z of X){if(SI.has(z.name))continue;if(z.name.startsWith(".")&&z.name!==".")continue;let J=_I($,z.name);if(z.isDirectory())FQ(J,Z);else if(z.isFile())Z.push(J)}return Z}function jI($){let Z=[];if(!RI($))return Z;let X=FQ($);for(let z of X){let J=z.split("/").pop()??"",Q=wI(J);if(!Q.ok||!Q.lang)continue;let Y;try{Y=AI(z,"utf-8")}catch{continue}if(Q.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(Q.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let W=EI(Y,Q.lang),U=z.replace(`${$}/`,"");for(let G of W)Z.push({file:U,language:Q.lang,testName:G,tier:CI(G)})}return Z}function xI($){let Z={BRAKE:0,ENGINE:0,AERO:0,TYRE:0,PIT:0},X={},z=0,J=[],Q=new Set;for(let Y of $)if(Q.add(Y.file),X[Y.language]=(X[Y.language]??0)+1,Y.tier)Z[Y.tier]++;else if(z++,J.length<5)J.push(`${Y.file}: ${Y.testName}`);return{totalTests:$.length,byTier:Z,untiered:z,untieredExamples:J,filesScanned:Q.size,byLanguage:X}}function bI($){if(console.log(`${D(I("faf wjttc"))} ${B("— vendor-neutral test audit")}`),console.log(""),console.log(` Files scanned: ${I(String($.filesScanned))}`),console.log(` Tests found: ${I(String($.totalTests))}`),console.log(""),$.totalTests===0){console.log(B(" no tests found"));return}console.log(B(" Tiers:"));for(let Z of FI){let X=$.byTier[Z],z=(X/$.totalTests*100).toFixed(0),J=Z==="BRAKE"?K0("●"):Z==="ENGINE"?D("●"):Z==="AERO"?B("●"):Z==="TYRE"?D("◐"):B("○");console.log(` ${J} ${Z.padEnd(7)} ${I(String(X).padStart(4))} ${B(`(${z}%)`)}`)}if($.untiered>0){let Z=($.untiered/$.totalTests*100).toFixed(0);console.log(` ${B("○")} ${"untiered".padEnd(7)} ${I(String($.untiered).padStart(4))} ${B(`(${Z}%)`)}`)}if($.untiered>0&&$.untieredExamples.length>0){console.log(""),console.log(B(` Untiered examples (first ${$.untieredExamples.length}):`));for(let Z of $.untieredExamples)console.log(` ${B("·")} ${Z}`)}if(Object.keys($.byLanguage).length>1){console.log(""),console.log(B(" Languages:"));for(let[Z,X]of Object.entries($.byLanguage))console.log(` ${B("·")} ${Z.padEnd(12)} ${I(String(X))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(K0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function PQ($={}){let Z=$.path??"tests",X=jI(Z),z=xI(X);if($.json)console.log(JSON.stringify(z,null,2));else bI(z);if($.strict&&z.untiered>0)process.exit(1)}import{createHash as EQ}from"crypto";import{readFileSync as SQ,writeFileSync as kI,existsSync as jQ}from"fs";import{join as xQ,dirname as yI}from"path";d();var CQ="faf-bench/1",fI={"project.name":"What is the project's name?","project.goal":"What is the project's goal — what is it for?","project.main_language":"What is the primary programming language?","human_context.who":"Who is this project for?","human_context.what":"What are they building?","human_context.why":"Why does this project exist?","human_context.where":"Where does it run or get distributed?","human_context.when":"When — what is the project's timeline or stage?","human_context.how":"How is it built or used?"};function gI($,Z){return fI[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var vI=[["typescript","ts"],["javascript","js"],["python","py","python3"],["node","nodejs","node js","node.js"],["github actions","gh actions","actions"],["postgresql","postgres","pg"],["kubernetes","k8s"],["npm","npm registry"],["cloudflare workers","cf workers","workers"],["google cloud run","cloud run","gcp cloud run"]],B4=new Map;vI.forEach(($,Z)=>$.forEach((X)=>B4.set(X,Z)));var hI=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function F5($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function wQ($){return F5($).split(" ").filter((Z)=>Z&&!hI.has(Z))}function uI($,Z){let X=F5($),z=F5(Z);if(!X||!z)return!1;if(X===z)return!0;let J=B4.get(X);if(J!==void 0&&B4.get(z)===J)return!0;let Q=wQ($);if(Q.length===0)return!1;let Y=new Set(wQ(Z));return Q.every((W)=>{if(Y.has(W))return!0;let U=B4.get(W);return U!==void 0&&[...Y].some((G)=>B4.get(G)===U)})}function mI($){let Z=J0($),X=R0($),z=[],J={},Q=0;for(let U of e){if(Z.slots[U.path]!=="populated")continue;let G=O2(X,U);if(typeof G!=="string")continue;let q=G.trim();if(!q||g6.has(q.toLowerCase()))continue;Q+=1,z.push({n:Q,path:U.path,question:gI(U.path,U.description)}),J[Q]=q}let Y=JSON.stringify({v:CQ,q:z.map((U)=>[U.path,U.question])}),W=EQ("sha256").update(Y).digest("hex").slice(0,12);return{version:CQ,qsetHash:W,questions:z,answers:J}}function cI($,Z){let X=$.questions.map((J)=>{let Q=Z[String(J.n)]??Z[J.path]??"";return{n:J.n,path:J.path,ok:typeof Q==="string"&&Q.trim()!==""&&uI($.answers[J.n],Q)}}),z=$.questions.filter((J)=>!X[J.n-1].ok);return{correct:X.filter((J)=>J.ok).length,total:$.questions.length,misses:z,perQuestion:X}}var bQ=".faf-bench.json";function dI($){let Z=xQ($,bQ);if(!jQ(Z))return null;try{return JSON.parse(SQ(Z,"utf-8"))}catch{return null}}function lI($,Z){kI(xQ($,bQ),`${JSON.stringify(Z,null,2)}
498
+ `,"utf-8")}function P5($,Z){let X=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:X,hash:EQ("sha256").update(X).digest("hex")}}var V8=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function pI($,Z){let{cold:X,faf:z}=$;console.log(`
499
499
  ${I(`faf bench — ${Z}`)}
500
- `),console.log(` ${H("without context")} ${D("with .faf")}`),console.log(`answers ${X.score}/${X.total} ${I(`${z.score}/${z.total}`)}`),console.log(`tokens ${W8(X.tokens)} ${W8(z.tokens)}`);let J=X.total-X.score;if(J>0)console.log(`
501
- ${H(`The ${J} missing answer${J===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(H("Structured context closes the gap."));let Q=I5($,Z);console.log(`
502
- ${V0("✪ BENCH RECEIPT")}`),console.log(H(` qset: ${$.qsetHash} protocol: ${$.protocol} model: ${z.model??X.model??"unreported"}`)),console.log(H(` cold ${X.score}/${X.total} · faf ${z.score}/${z.total} · sha256: ${Q.hash.slice(0,16)}…`))}function FI($,Z){let X=$.cold,z=X.total-X.score;if(console.log(`
503
- ${I(`faf bench — ${Z}`)} ${V0("Trouble ahead, expensive trouble.")}
504
- `),console.log(` ${H("without context")}`),console.log(`answers ${X.score}/${X.total} ${H("— the AI is guessing at what you are building")}`),X.tokens!==void 0)console.log(`tokens ${W8(X.tokens)} ${H("— re-derivation burn, paid again EVERY session")}`);if(z>0)console.log(`
500
+ `),console.log(` ${B("without context")} ${D("with .faf")}`),console.log(`answers ${X.score}/${X.total} ${I(`${z.score}/${z.total}`)}`),console.log(`tokens ${V8(X.tokens)} ${V8(z.tokens)}`);let J=X.total-X.score;if(J>0)console.log(`
501
+ ${B(`The ${J} missing answer${J===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(B("Structured context closes the gap."));let Q=P5($,Z);console.log(`
502
+ ${K0("✪ BENCH RECEIPT")}`),console.log(B(` qset: ${$.qsetHash} protocol: ${$.protocol} model: ${z.model??X.model??"unreported"}`)),console.log(B(` cold ${X.score}/${X.total} · faf ${z.score}/${z.total} · sha256: ${Q.hash.slice(0,16)}…`))}function iI($,Z){let X=$.cold,z=X.total-X.score;if(console.log(`
503
+ ${I(`faf bench — ${Z}`)} ${K0("Trouble ahead, expensive trouble.")}
504
+ `),console.log(` ${B("without context")}`),console.log(`answers ${X.score}/${X.total} ${B("— the AI is guessing at what you are building")}`),X.tokens!==void 0)console.log(`tokens ${V8(X.tokens)} ${B("— re-derivation burn, paid again EVERY session")}`);if(z>0)console.log(`
505
505
  ${z} answer${z===1?"":"s"} missing: the stack it can dig out (you pay for the dig);`),console.log("what you are trying to DO, it cannot derive at any price."),console.log("Both are already in your repo — unstructured.");console.log(`
506
- ${D("→ faf init && faf bench")} ${H("(close the gap, get the receipt)")}`)}var _I="https://mcpaas.live/bench/submit";async function PI($,Z){try{let X=await fetch(Z,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)});console.log(H(X.ok?` ✪ submitted to ${Z}`:` submit failed (${X.status})`))}catch{console.log(H(" submit skipped (endpoint unreachable)"))}}function wQ($,Z,X={}){let z=X.file??h();if(!z)console.error(`Error: project.faf not found
506
+ ${D("→ faf init && faf bench")} ${B("(close the gap, get the receipt)")}`)}var nI="https://mcpaas.live/bench/submit";async function rI($,Z){try{let X=await fetch(Z,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)});console.log(B(X.ok?` ✪ submitted to ${Z}`:` submit failed (${X.status})`))}catch{console.log(B(" submit skipped (endpoint unreachable)"))}}function kQ($,Z,X={}){let z=X.file??v();if(!z)console.error(`Error: project.faf not found
507
507
 
508
- Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let J=m(z),Q=TI(J),Y=HI(z),W=R0(J)?.project?.name??Y.split("/").pop();if(Q.questions.length===0)console.error("Error: no populated slots to derive questions from.\n\n Run `faf go` to fill the .faf first."),process.exit(2);if($==="questions"){if(X.json){console.log(JSON.stringify({version:Q.version,qsetHash:Q.qsetHash,questions:Q.questions.map(({n:U,question:G})=>({n:U,question:G}))},null,2));return}console.log(`
509
- ${I(`faf bench — ${Q.questions.length} questions`)} ${H(`qset ${Q.qsetHash}`)}
508
+ Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let J=m(z),Q=mI(J),Y=yI(z),W=R0(J)?.project?.name??Y.split("/").pop();if(Q.questions.length===0)console.error("Error: no populated slots to derive questions from.\n\n Run `faf go` to fill the .faf first."),process.exit(2);if($==="questions"){if(X.json){console.log(JSON.stringify({version:Q.version,qsetHash:Q.qsetHash,questions:Q.questions.map(({n:U,question:G})=>({n:U,question:G}))},null,2));return}console.log(`
509
+ ${I(`faf bench — ${Q.questions.length} questions`)} ${B(`qset ${Q.qsetHash}`)}
510
510
  `);for(let U of Q.questions)console.log(` ${String(U.n).padStart(2)}. ${U.question}`);console.log(`
511
- ${H('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!FQ(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(RQ(Z,"utf-8")),G=U.answers??U,q=DI(Q,G),V={score:q.correct,total:q.total,...X.tokens?{tokens:parseInt(X.tokens,10)}:{},...X.model?{model:X.model}:{}},K=II(Y),B=K&&K.qsetHash===Q.qsetHash?K:{version:Q.version,qsetHash:Q.qsetHash,protocol:"in-session"};if(X.cold)B.cold=V;else if(X.faf)B.faf=V;else console.error("Error: specify the run mode — --cold (no context) or --faf (after reading project.faf)."),process.exit(2);if(AI(Y,B),X.json){let O=I5(B,W);console.log(JSON.stringify({...B,receipt:O.hash,perQuestion:q.perQuestion},null,2));return}if(B.cold&&B.faf)RI(B,W);if(X.submit&&B.cold&&B.faf){let{cold:O,faf:L}=B,M=I5(B,W);PI({date:new Date().toISOString().slice(0,10),model:L.model??O.model??X.model??"unreported",repo:W,qset:B.qsetHash,cold:`${O.score}/${O.total}`,faf:`${L.score}/${L.total}`,sha256:M.hash.slice(0,16)},X.endpoint??_I)}else if(B.cold)FI(B,W);else console.log(`
512
- ${I(`faf bench — ${W}`)} ${D("with .faf")}: ${I(`${V.score}/${V.total}`)} ${H(`tokens ${W8(V.tokens)}`)}`),console.log(H("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
513
- ${I("faf bench — agent-native protocol")} ${H(`qset ${Q.qsetHash} · ${Q.questions.length} questions`)}
514
- `),console.log(`${I("COLD phase")} ${H("(fresh AI session, repo access)")}`),console.log(' 1. Instruct: "Answer these questions from the repository.'),console.log(' Do NOT read project.faf, CLAUDE.md, AGENTS.md, or any *.faf file."'),console.log(` 2. ${D("faf bench questions")} — hand them over; answers terse, saved as cold.json`),console.log(` 3. ${D("faf bench grade cold.json --cold --tokens <used> --model <name>")}
515
- `),console.log(`${I("FAF phase")} ${H("(same questions, context first)")}`),console.log(' 4. Instruct: "Read project.faf, then answer the same questions." → faf.json'),console.log(` 5. ${D("faf bench grade faf.json --faf --tokens <used> --model <name>")}
516
- `),console.log(H("Grading is mechanical against your own project.faf — the .faf IS the answer key.")),console.log(H(`Receipts carry protocol: in-session (honor-system cold). qset ${Q.qsetHash}.`))}import{existsSync as wI,writeFileSync as CI}from"fs";d();function CQ($={}){let Z=h();if(!Z)console.error(`Error: project.faf not found
511
+ ${B('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!jQ(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(SQ(Z,"utf-8")),G=U.answers??U,q=cI(Q,G),V={score:q.correct,total:q.total,...X.tokens?{tokens:parseInt(X.tokens,10)}:{},...X.model?{model:X.model}:{}},K=dI(Y),H=K&&K.qsetHash===Q.qsetHash?K:{version:Q.version,qsetHash:Q.qsetHash,protocol:"in-session"};if(X.cold)H.cold=V;else if(X.faf)H.faf=V;else console.error("Error: specify the run mode — --cold (no context) or --faf (after reading project.faf)."),process.exit(2);if(lI(Y,H),X.json){let N=P5(H,W);console.log(JSON.stringify({...H,receipt:N.hash,perQuestion:q.perQuestion},null,2));return}if(H.cold&&H.faf)pI(H,W);if(X.submit&&H.cold&&H.faf){let{cold:N,faf:L}=H,O=P5(H,W);rI({date:new Date().toISOString().slice(0,10),model:L.model??N.model??X.model??"unreported",repo:W,qset:H.qsetHash,cold:`${N.score}/${N.total}`,faf:`${L.score}/${L.total}`,sha256:O.hash.slice(0,16)},X.endpoint??nI)}else if(H.cold)iI(H,W);else console.log(`
512
+ ${I(`faf bench — ${W}`)} ${D("with .faf")}: ${I(`${V.score}/${V.total}`)} ${B(`tokens ${V8(V.tokens)}`)}`),console.log(B("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
513
+ ${I("faf bench — agent-native protocol")} ${B(`qset ${Q.qsetHash} · ${Q.questions.length} questions`)}
514
+ `),console.log(`${I("COLD phase")} ${B("(fresh AI session, repo access)")}`),console.log(' 1. Instruct: "Answer these questions from the repository.'),console.log(' Do NOT read project.faf, CLAUDE.md, AGENTS.md, or any *.faf file."'),console.log(` 2. ${D("faf bench questions")} — hand them over; answers terse, saved as cold.json`),console.log(` 3. ${D("faf bench grade cold.json --cold --tokens <used> --model <name>")}
515
+ `),console.log(`${I("FAF phase")} ${B("(same questions, context first)")}`),console.log(' 4. Instruct: "Read project.faf, then answer the same questions." → faf.json'),console.log(` 5. ${D("faf bench grade faf.json --faf --tokens <used> --model <name>")}
516
+ `),console.log(B("Grading is mechanical against your own project.faf — the .faf IS the answer key.")),console.log(B(`Receipts carry protocol: in-session (honor-system cold). qset ${Q.qsetHash}.`))}import{existsSync as sI,writeFileSync as aI}from"fs";d();function yQ($={}){let Z=v();if(!Z)console.error(`Error: project.faf not found
517
517
 
518
- Run 'faf init' to create one.`),process.exit(2);let X=m(Z),z=z0(X),J=new t0(process.cwd()),Q=J.load()?J.getBirthDNADisplay():null,Y=Q?Q.current:null,W=Y!==null&&Y!==void 0?z.score-Y:0,U=Y!==null&&Y!==void 0&&W!==0,G=Z.replace(/\.faf$/,".fafb"),q=null;if(wI(G)){let V=Y4(X);CI(G,V),q=V.length}if($.json)console.log(JSON.stringify({reGrounded:!0,score:z.score,tier:z.tier,baseline:Y,delta:W,drifted:U,fafb:q!==null&&q!==void 0?{reCompiled:!0,bytes:q}:{reCompiled:!1},journey:J.getJourney()||null},null,2));else{if(console.log(`${D("refresh")} ${H("— re-grounding on the live .faf")}
519
- `),U){let V=W>0?"↑":"↓";console.log(` drift: ${H(`${Y}%`)} ${V} ${I(`${z.score}%`)} ${H(`(${W>0?"+":""}${W})`)}`)}else if(Y!==null&&Y!==void 0)console.log(` no drift ${H(`— steady at ${z.score}%`)}`);else console.log(` baseline set ${H(`— ${z.score}%`)}`);if(q!==null&&q!==void 0)console.log(` .fafb re-compiled ${H(`(${q} bytes — fast tier current)`)}`);console.log(` re-grounded: ${u0(z.tier)} ${I(`${z.score}%`)}`)}if(J.exists())J.recordGrowth(z.score,["refresh — re-grounded"]);else J.birth(z.score)}d();import{existsSync as fQ}from"fs";import{resolve as B3}from"path";var EQ=["ephemeral","standard","high","critical"],i1=Object.fromEntries(EQ.map(($,Z)=>[$,Z])),A5=new Set(["user","feedback","project","reference"]),R5=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),F5=new Set(["facts","sessions","preferences","custom"]),_5={low:"ephemeral",medium:"standard"};import{readFileSync as EI,writeFileSync as jI,existsSync as SI}from"fs";function H3(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function M0($){return $===null||$===void 0}function U8($){if(M0($))return"standard";if(_5[$])return _5[$];if($ in i1)return $;return"standard"}var xI=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function jQ($){if(typeof $==="string")return{text:$,id:null,type:null,priority:"standard",tags:[],links:[],timestamp:null,source:null,extra:{}};if(!$||typeof $!=="object"||!("text"in $))throw Error(`fact must be a string or a mapping with 'text': ${JSON.stringify($)}`);let Z=$,X={};for(let[z,J]of Object.entries(Z))if(!xI.has(z))X[z]=J;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:U8(Z.priority),tags:Array.isArray(Z.tags)?Z.tags.slice():[],links:Array.isArray(Z.links)?Z.links.slice():[],timestamp:Z.timestamp??null,source:Z.source??null,extra:X}}function SQ($){if(M0($.id)&&M0($.type)&&$.tags.length===0&&$.links.length===0&&M0($.timestamp)&&M0($.source)&&Object.keys($.extra).length===0&&$.priority==="standard")return $.text;let X={text:$.text};if(!M0($.id))X.id=$.id;if(!M0($.type))X.type=$.type;if(X.priority=$.priority,$.tags.length)X.tags=$.tags;if($.links.length)X.links=$.links;if(!M0($.timestamp))X.timestamp=$.timestamp;if(!M0($.source))X.source=$.source;return Object.assign(X,$.extra),X}class i0{namepoint;profile;retention;created;last_etched;_facts;_byId;_index;_sessions;_preferences;_custom;_extra;_memoryExtra;constructor($,Z={}){this.namepoint=$,this.profile=Z.profile??"knowledge",this.retention=Z.retention??"forever",this.created=Z.created??H3(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.slice():[],this._byId=new Map,this._facts.forEach((X,z)=>{if(!M0(X.id))this._byId.set(X.id,z)}),this._index=Z.index?Z.index.slice():[],this._sessions=Z.sessions?structuredClone(Z.sessions):[],this._preferences=Z.preferences?{...Z.preferences}:{},this._custom=Z.custom?{...Z.custom}:{},this._extra=Z.extra?{...Z.extra}:{},this._memoryExtra=Z.memoryExtra?{...Z.memoryExtra}:{}}get facts(){return this._facts}get index(){return this._index}get sessions(){return this._sessions}get preferences(){return this._preferences}get custom(){return this._custom}get extra(){return this._extra}get memoryExtra(){return this._memoryExtra}static load($){if(!SI($))throw Error(`soul file not found: ${$}`);let Z=EI($,"utf-8"),X=R0(Z);if(!X||typeof X!=="object")throw Error("soul is not a YAML mapping");let z=X.memory&&typeof X.memory==="object"?X.memory:{},J=Array.isArray(z.facts)?z.facts:[],Q={};for(let[U,G]of Object.entries(X))if(!R5.has(U))Q[U]=structuredClone(G);let Y={};for(let[U,G]of Object.entries(z))if(!F5.has(U))Y[U]=structuredClone(G);let W=new i0(String(X.namepoint??$.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(X.profile??"voice"),facts:J.map(jQ),retention:String(X.retention??"forever"),created:X.created??null,index:Array.isArray(X.index)?X.index.slice():[],sessions:Array.isArray(z.sessions)?structuredClone(z.sessions):[],preferences:z.preferences&&typeof z.preferences==="object"?structuredClone(z.preferences):{},custom:z.custom&&typeof z.custom==="object"?structuredClone(z.custom):{},extra:Q,memoryExtra:Y});return W.last_etched=String(X.last_etched??W.created),W}static fromFile($){return i0.load($)}toDoc(){let $={facts:this._facts.map(SQ),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[X,z]of Object.entries(this._memoryExtra))if(!F5.has(X))$[X]=structuredClone(z);let Z={version:"1.1",profile:this.profile,namepoint:this.namepoint,created:this.created,last_etched:this.last_etched,retention:this.retention,index:this._index.slice(),memory:$};for(let[X,z]of Object.entries(this._extra))if(!R5.has(X))Z[X]=structuredClone(z);return Z}toYaml(){return H2(this.toDoc(),{lineWidth:100})}rebuildIndex($=80){return this._index=this._facts.map((Z)=>`${Z.id??"?"} — ${Z.text.slice(0,$)}`),this._index}save($,Z={}){if(Z.reindex!==!1)this.rebuildIndex();return jI($,this.toYaml(),"utf-8"),$}toFile($,Z={}){return this.save($,Z)}add($){if(!M0($.id)&&this._byId.has($.id)){let Z=this._byId.get($.id);if(Z!==void 0)this._facts[Z]=$}else if(this._facts.push($),!M0($.id))this._byId.set($.id,this._facts.length-1);if($.timestamp&&$.timestamp>(this.last_etched||""))this.last_etched=$.timestamp;return $}etch($,Z={}){return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:U8(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:H3(),source:Z.source??null,extra:{}})}recall($,Z={}){let X=i1[U8(Z.minPriority??"ephemeral")]??0,z=($??"").toLowerCase(),J=new Set(Z.tags??[]),Q=[];this._facts.forEach((W,U)=>{if(z&&!W.text.toLowerCase().includes(z))return;if(J.size>0&&![...J].some((G)=>W.tags.includes(G)))return;if(!M0(Z.type)&&W.type!==Z.type)return;if((i1[W.priority]??1)<X)return;Q.push([U,W])}),Q.sort((W,U)=>{let G=i1[W[1].priority]??1,q=i1[U[1].priority]??1;if(q!==G)return q-G;let V=W[1].timestamp??"",K=U[1].timestamp??"";if(K!==V)return K<V?-1:K>V?1:0;return U[0]-W[0]});let Y=Q.map(([,W])=>W);if(!M0(Z.limit))return Y.slice(0,Z.limit);return Y}getFact($){let Z=this._byId.get($);return Z===void 0?null:this._facts[Z]}deleteFact($){let Z=this._byId.get($);if(Z===void 0)return!1;return this._facts.splice(Z,1),this._byId.clear(),this._facts.forEach((X,z)=>{if(!M0(X.id))this._byId.set(X.id,z)}),!0}}import{readdirSync as bI,readFileSync as kI,statSync as xQ,existsSync as yI}from"fs";import{join as fI,basename as bQ,resolve as gI}from"path";var kQ=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),vI=/\[\[([^\]]+)\]\]/g;function hI($){let Z=xQ($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function uI($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let X=R0(Z[1]);if(!X||typeof X!=="object")return{fm:null,body:Z.slice(2).join("---").trim()};return{fm:X,body:Z.slice(2).join("---").trim()}}catch{return{fm:null,body:$}}}function mI($,Z,X){if(!X.name)return null;let z=X.metadata&&typeof X.metadata==="object"?X.metadata:{},J=z.type;if(typeof J!=="string"||!A5.has(J))return null;let Q=String(X.name).trim(),W=(X.description!==void 0&&X.description!==null&&String(X.description).trim()?String(X.description).trim():"")||Q,U={};if(z.originSessionId)U.provenance=[`session:${z.originSessionId}`];let G=[...new Set([...Z.matchAll(vI)].map((q)=>q[1]))].sort();return{text:W,id:Q,type:J,priority:"standard",tags:[],links:G,timestamp:hI($),source:`claude-code memory: ${bQ($)}`,extra:U}}function P5($,Z={}){let X=gI($);if(!yI(X))throw Error(`Claude memory directory not found: ${X}`);if(!xQ(X).isDirectory())throw Error(`Claude memory path is not a directory: ${X}`);let z=Z.skip??kQ,J=Z.namepoint??`@claude-code:${bQ(X)}`,Q=[],Y=bI(X).filter((V)=>V.endsWith(".md")).sort();for(let V of Y){if(z.has(V))continue;let K=fI(X,V),B;try{B=kI(K,"utf-8")}catch{continue}let{fm:O,body:L}=uI(B);if(!O)continue;let M=mI(K,L,O);if(M)Q.push(M)}let W=Q.map((V)=>V.timestamp).filter(Boolean),U=W.length?W.reduce((V,K)=>V<K?V:K):H3(),G=W.length?W.reduce((V,K)=>V>K?V:K):U,q=new i0(J,{profile:"knowledge",facts:Q,created:U});return q.last_etched=G,q.rebuildIndex(),q}function w5(){return B3(process.cwd(),"soul.fafm")}function C5($){let Z=B3($??w5());if(!fQ(Z))console.error(`Error: soul file not found: ${Z}
518
+ Run 'faf init' to create one.`),process.exit(2);let X=m(Z),z=J0(X),J=new t0(process.cwd()),Q=J.load()?J.getBirthDNADisplay():null,Y=Q?Q.current:null,W=Y!==null&&Y!==void 0?z.score-Y:0,U=Y!==null&&Y!==void 0&&W!==0,G=Z.replace(/\.faf$/,".fafb"),q=null;if(sI(G)){let V=U3(X);aI(G,V),q=V.length}if($.json)console.log(JSON.stringify({reGrounded:!0,score:z.score,tier:z.tier,baseline:Y,delta:W,drifted:U,fafb:q!==null&&q!==void 0?{reCompiled:!0,bytes:q}:{reCompiled:!1},journey:J.getJourney()||null},null,2));else{if(console.log(`${D("refresh")} ${B("— re-grounding on the live .faf")}
519
+ `),U){let V=W>0?"↑":"↓";console.log(` drift: ${B(`${Y}%`)} ${V} ${I(`${z.score}%`)} ${B(`(${W>0?"+":""}${W})`)}`)}else if(Y!==null&&Y!==void 0)console.log(` no drift ${B(`— steady at ${z.score}%`)}`);else console.log(` baseline set ${B(`— ${z.score}%`)}`);if(q!==null&&q!==void 0)console.log(` .fafb re-compiled ${B(`(${q} bytes — fast tier current)`)}`);console.log(` re-grounded: ${u0(z.tier)} ${I(`${z.score}%`)}`)}if(J.exists())J.recordGrowth(z.score,["refresh — re-grounded"]);else J.birth(z.score)}d();import{existsSync as dQ}from"fs";import{resolve as M4}from"path";var fQ=["ephemeral","standard","high","critical"],n1=Object.fromEntries(fQ.map(($,Z)=>[$,Z])),C5=new Set(["user","feedback","project","reference"]),w5=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),E5=new Set(["facts","sessions","preferences","custom"]),S5={low:"ephemeral",medium:"standard"};import{readFileSync as oI,writeFileSync as tI,existsSync as eI}from"fs";function L4(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function N0($){return $===null||$===void 0}function K8($){if(N0($))return"standard";if(S5[$])return S5[$];if($ in n1)return $;return"standard"}var $A=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function gQ($){if(typeof $==="string")return{text:$,id:null,type:null,priority:"standard",tags:[],links:[],timestamp:null,source:null,extra:{}};if(!$||typeof $!=="object"||!("text"in $))throw Error(`fact must be a string or a mapping with 'text': ${JSON.stringify($)}`);let Z=$,X={};for(let[z,J]of Object.entries(Z))if(!$A.has(z))X[z]=J;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:K8(Z.priority),tags:Array.isArray(Z.tags)?Z.tags.slice():[],links:Array.isArray(Z.links)?Z.links.slice():[],timestamp:Z.timestamp??null,source:Z.source??null,extra:X}}function vQ($){if(N0($.id)&&N0($.type)&&$.tags.length===0&&$.links.length===0&&N0($.timestamp)&&N0($.source)&&Object.keys($.extra).length===0&&$.priority==="standard")return $.text;let X={text:$.text};if(!N0($.id))X.id=$.id;if(!N0($.type))X.type=$.type;if(X.priority=$.priority,$.tags.length)X.tags=$.tags;if($.links.length)X.links=$.links;if(!N0($.timestamp))X.timestamp=$.timestamp;if(!N0($.source))X.source=$.source;return Object.assign(X,$.extra),X}class i0{namepoint;profile;retention;created;last_etched;_facts;_byId;_index;_sessions;_preferences;_custom;_extra;_memoryExtra;constructor($,Z={}){this.namepoint=$,this.profile=Z.profile??"knowledge",this.retention=Z.retention??"forever",this.created=Z.created??L4(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.slice():[],this._byId=new Map,this._facts.forEach((X,z)=>{if(!N0(X.id))this._byId.set(X.id,z)}),this._index=Z.index?Z.index.slice():[],this._sessions=Z.sessions?structuredClone(Z.sessions):[],this._preferences=Z.preferences?{...Z.preferences}:{},this._custom=Z.custom?{...Z.custom}:{},this._extra=Z.extra?{...Z.extra}:{},this._memoryExtra=Z.memoryExtra?{...Z.memoryExtra}:{}}get facts(){return this._facts}get index(){return this._index}get sessions(){return this._sessions}get preferences(){return this._preferences}get custom(){return this._custom}get extra(){return this._extra}get memoryExtra(){return this._memoryExtra}static load($){if(!eI($))throw Error(`soul file not found: ${$}`);let Z=oI($,"utf-8"),X=R0(Z);if(!X||typeof X!=="object")throw Error("soul is not a YAML mapping");let z=X.memory&&typeof X.memory==="object"?X.memory:{},J=Array.isArray(z.facts)?z.facts:[],Q={};for(let[U,G]of Object.entries(X))if(!w5.has(U))Q[U]=structuredClone(G);let Y={};for(let[U,G]of Object.entries(z))if(!E5.has(U))Y[U]=structuredClone(G);let W=new i0(String(X.namepoint??$.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(X.profile??"voice"),facts:J.map(gQ),retention:String(X.retention??"forever"),created:X.created??null,index:Array.isArray(X.index)?X.index.slice():[],sessions:Array.isArray(z.sessions)?structuredClone(z.sessions):[],preferences:z.preferences&&typeof z.preferences==="object"?structuredClone(z.preferences):{},custom:z.custom&&typeof z.custom==="object"?structuredClone(z.custom):{},extra:Q,memoryExtra:Y});return W.last_etched=String(X.last_etched??W.created),W}static fromFile($){return i0.load($)}toDoc(){let $={facts:this._facts.map(vQ),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[X,z]of Object.entries(this._memoryExtra))if(!E5.has(X))$[X]=structuredClone(z);let Z={version:"1.1",profile:this.profile,namepoint:this.namepoint,created:this.created,last_etched:this.last_etched,retention:this.retention,index:this._index.slice(),memory:$};for(let[X,z]of Object.entries(this._extra))if(!w5.has(X))Z[X]=structuredClone(z);return Z}toYaml(){return B2(this.toDoc(),{lineWidth:100})}rebuildIndex($=80){return this._index=this._facts.map((Z)=>`${Z.id??"?"} — ${Z.text.slice(0,$)}`),this._index}save($,Z={}){if(Z.reindex!==!1)this.rebuildIndex();return tI($,this.toYaml(),"utf-8"),$}toFile($,Z={}){return this.save($,Z)}add($){if(!N0($.id)&&this._byId.has($.id)){let Z=this._byId.get($.id);if(Z!==void 0)this._facts[Z]=$}else if(this._facts.push($),!N0($.id))this._byId.set($.id,this._facts.length-1);if($.timestamp&&$.timestamp>(this.last_etched||""))this.last_etched=$.timestamp;return $}etch($,Z={}){return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:K8(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:L4(),source:Z.source??null,extra:{}})}recall($,Z={}){let X=n1[K8(Z.minPriority??"ephemeral")]??0,z=($??"").toLowerCase(),J=new Set(Z.tags??[]),Q=[];this._facts.forEach((W,U)=>{if(z&&!W.text.toLowerCase().includes(z))return;if(J.size>0&&![...J].some((G)=>W.tags.includes(G)))return;if(!N0(Z.type)&&W.type!==Z.type)return;if((n1[W.priority]??1)<X)return;Q.push([U,W])}),Q.sort((W,U)=>{let G=n1[W[1].priority]??1,q=n1[U[1].priority]??1;if(q!==G)return q-G;let V=W[1].timestamp??"",K=U[1].timestamp??"";if(K!==V)return K<V?-1:K>V?1:0;return U[0]-W[0]});let Y=Q.map(([,W])=>W);if(!N0(Z.limit))return Y.slice(0,Z.limit);return Y}getFact($){let Z=this._byId.get($);return Z===void 0?null:this._facts[Z]}deleteFact($){let Z=this._byId.get($);if(Z===void 0)return!1;return this._facts.splice(Z,1),this._byId.clear(),this._facts.forEach((X,z)=>{if(!N0(X.id))this._byId.set(X.id,z)}),!0}}import{readdirSync as ZA,readFileSync as XA,statSync as hQ,existsSync as zA}from"fs";import{join as JA,basename as uQ,resolve as QA}from"path";var mQ=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),YA=/\[\[([^\]]+)\]\]/g;function WA($){let Z=hQ($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function UA($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let X=R0(Z[1]);if(!X||typeof X!=="object")return{fm:null,body:Z.slice(2).join("---").trim()};return{fm:X,body:Z.slice(2).join("---").trim()}}catch{return{fm:null,body:$}}}function GA($,Z,X){if(!X.name)return null;let z=X.metadata&&typeof X.metadata==="object"?X.metadata:{},J=z.type;if(typeof J!=="string"||!C5.has(J))return null;let Q=String(X.name).trim(),W=(X.description!==void 0&&X.description!==null&&String(X.description).trim()?String(X.description).trim():"")||Q,U={};if(z.originSessionId)U.provenance=[`session:${z.originSessionId}`];let G=[...new Set([...Z.matchAll(YA)].map((q)=>q[1]))].sort();return{text:W,id:Q,type:J,priority:"standard",tags:[],links:G,timestamp:WA($),source:`claude-code memory: ${uQ($)}`,extra:U}}function j5($,Z={}){let X=QA($);if(!zA(X))throw Error(`Claude memory directory not found: ${X}`);if(!hQ(X).isDirectory())throw Error(`Claude memory path is not a directory: ${X}`);let z=Z.skip??mQ,J=Z.namepoint??`@claude-code:${uQ(X)}`,Q=[],Y=ZA(X).filter((V)=>V.endsWith(".md")).sort();for(let V of Y){if(z.has(V))continue;let K=JA(X,V),H;try{H=XA(K,"utf-8")}catch{continue}let{fm:N,body:L}=UA(H);if(!N)continue;let O=GA(K,L,N);if(O)Q.push(O)}let W=Q.map((V)=>V.timestamp).filter(Boolean),U=W.length?W.reduce((V,K)=>V<K?V:K):L4(),G=W.length?W.reduce((V,K)=>V>K?V:K):U,q=new i0(J,{profile:"knowledge",facts:Q,created:U});return q.last_etched=G,q.rebuildIndex(),q}function x5(){return M4(process.cwd(),"soul.fafm")}function b5($){let Z=M4($??x5());if(!dQ(Z))console.error(`Error: soul file not found: ${Z}
520
520
 
521
- Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return i0.load(Z)}function cI($,Z){if(!$)console.error(`Error: directory required
521
+ Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return i0.load(Z)}function qA($,Z){if(!$)console.error(`Error: directory required
522
522
 
523
- faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let X=B3($);try{let z=P5(X,{namepoint:Z.namepoint}),J=B3(Z.output??w5());z.toFile(J),console.log(`${D("memory convert")} ${H("—")} ${z.facts.length} facts → ${J}`),console.log(H(` namepoint ${z.namepoint} profile ${z.profile} index ${z.index.length}`))}catch(z){console.error(`Error: ${z instanceof Error?z.message:z}`),process.exit(1)}}function dI($){let Z=C5($.file);if($.json){console.log(JSON.stringify(Z.facts.map((X)=>({id:X.id,text:X.text,type:X.type,priority:X.priority,tags:X.tags})),null,2));return}console.log(`${D("memory ls")} ${H(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
524
- `);for(let X of Z.recall()){let z=X.id?I(X.id):H("(no-id)"),J=[X.type,X.priority].filter(Boolean).join(" · ");if(console.log(` ${z} ${X.text.slice(0,80)}`),J)console.log(H(` ${J}`))}}function lI($,Z){let X=C5(Z.file),z=Z.tag?Z.tag.split(",").map((Y)=>Y.trim()):void 0,J=Z.limit!==void 0&&Z.limit!==null?parseInt(Z.limit,10):void 0,Q=X.recall($??null,{tags:z,type:Z.type,minPriority:Z.priority,limit:Number.isFinite(J)?J:null});if(Z.json){console.log(JSON.stringify(Q.map((Y)=>({id:Y.id,text:Y.text,priority:Y.priority})),null,2));return}console.log(`${D("memory recall")} ${H(`— ${Q.length} hit(s)`)}${$?H(` for "${$}"`):""}
525
- `);for(let Y of Q)console.log(` ${Y.id?I(Y.id):H("?")} ${Y.text}`)}function pI($,Z){if(!$)console.error(`Error: text required
523
+ faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let X=M4($);try{let z=j5(X,{namepoint:Z.namepoint}),J=M4(Z.output??x5());z.toFile(J),console.log(`${D("memory convert")} ${B("—")} ${z.facts.length} facts → ${J}`),console.log(B(` namepoint ${z.namepoint} profile ${z.profile} index ${z.index.length}`))}catch(z){console.error(`Error: ${z instanceof Error?z.message:z}`),process.exit(1)}}function VA($){let Z=b5($.file);if($.json){console.log(JSON.stringify(Z.facts.map((X)=>({id:X.id,text:X.text,type:X.type,priority:X.priority,tags:X.tags})),null,2));return}console.log(`${D("memory ls")} ${B(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
524
+ `);for(let X of Z.recall()){let z=X.id?I(X.id):B("(no-id)"),J=[X.type,X.priority].filter(Boolean).join(" · ");if(console.log(` ${z} ${X.text.slice(0,80)}`),J)console.log(B(` ${J}`))}}function KA($,Z){let X=b5(Z.file),z=Z.tag?Z.tag.split(",").map((Y)=>Y.trim()):void 0,J=Z.limit!==void 0&&Z.limit!==null?parseInt(Z.limit,10):void 0,Q=X.recall($??null,{tags:z,type:Z.type,minPriority:Z.priority,limit:Number.isFinite(J)?J:null});if(Z.json){console.log(JSON.stringify(Q.map((Y)=>({id:Y.id,text:Y.text,priority:Y.priority})),null,2));return}console.log(`${D("memory recall")} ${B(`— ${Q.length} hit(s)`)}${$?B(` for "${$}"`):""}
525
+ `);for(let Y of Q)console.log(` ${Y.id?I(Y.id):B("?")} ${Y.text}`)}function HA($,Z){if(!$)console.error(`Error: text required
526
526
 
527
- faf memory etch "a durable fact" [--id slug]`),process.exit(2);let X=B3(Z.file??w5()),z=fQ(X)?i0.load(X):new i0(Z.namepoint??"@local",{profile:"knowledge"}),J=z.etch($,{id:Z.id,type:Z.type,priority:Z.priority});z.toFile(X),console.log(`${D("memory etch")} ${H("—")} ${J.id??"(no-id)"} → ${X}`)}function iI($){let Z=C5($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${D("memory show")} ${H(`— ${Z.namepoint}`)}
527
+ faf memory etch "a durable fact" [--id slug]`),process.exit(2);let X=M4(Z.file??x5()),z=dQ(X)?i0.load(X):new i0(Z.namepoint??"@local",{profile:"knowledge"}),J=z.etch($,{id:Z.id,type:Z.type,priority:Z.priority});z.toFile(X),console.log(`${D("memory etch")} ${B("—")} ${J.id??"(no-id)"} → ${X}`)}function BA($){let Z=b5($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${D("memory show")} ${B(`— ${Z.namepoint}`)}
528
528
  `),console.log(` profile ${Z.profile}`),console.log(` facts ${Z.facts.length}`),console.log(` index ${Z.index.length}`),console.log(` created ${Z.created}`),console.log(` last_etched ${Z.last_etched}`),Z.index.length){console.log(`
529
- ${I("index")}`);for(let X of Z.index.slice(0,20))console.log(H(` ${X}`));if(Z.index.length>20)console.log(H(` … +${Z.index.length-20} more`))}}function gQ($,Z,X={}){if(Z&&typeof Z==="object")X=Z,Z=void 0;switch($){case"convert":cI(Z,X);break;case"ls":case"list":dI(X);break;case"recall":lI(Z,X);break;case"etch":pI(Z,X);break;case"show":iI(X);break;case void 0:case"help":yQ();break;default:console.error(`Unknown memory subcommand: ${$}`),yQ(),process.exit(2)}}function yQ(){console.log(`${D("faf memory")} ${H("— .fafm soul ops (knowledge profile)")}
529
+ ${I("index")}`);for(let X of Z.index.slice(0,20))console.log(B(` ${X}`));if(Z.index.length>20)console.log(B(` … +${Z.index.length-20} more`))}}function lQ($,Z,X={}){if(Z&&typeof Z==="object")X=Z,Z=void 0;switch($){case"convert":qA(Z,X);break;case"ls":case"list":VA(X);break;case"recall":KA(Z,X);break;case"etch":HA(Z,X);break;case"show":BA(X);break;case void 0:case"help":cQ();break;default:console.error(`Unknown memory subcommand: ${$}`),cQ(),process.exit(2)}}function cQ(){console.log(`${D("faf memory")} ${B("— .fafm soul ops (knowledge profile)")}
530
530
  `),console.log(" convert <dir> Claude Code memory dir → soul.fafm"),console.log(" etch <text> Write a fact (creates soul.fafm if needed)"),console.log(" ls List facts (ranked)"),console.log(" recall [query] Deterministic recall"),console.log(` show Soul summary
531
- `),console.log(H(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json")),console.log(H(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}var{version:vQ}=ZZ(),v=new s5;v.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(vQ,"-v, --version");v.command("init").description("Create .faf from your project").option("--yolo","Quick init with sensible defaults").option("--quick","Alias for --yolo").option("--force","Overwrite existing project.faf").option("--output <path>","Output path").action(($)=>m6($));v.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>uX());v.command("auto").description("Zero to 100% in one command").action(()=>O4());v.command("loop").description("Drive to 100% — source what we can, then ask only the human").option("-r, --rounds <n>","max auto rounds before stopping","5").action(($)=>cX($));v.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>BJ($));v.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>W4($,Z));v.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key)").option("--json","Output as JSON").option("--cold","Grade as the without-context run").option("--faf","Grade as the with-context run").option("--tokens <n>","Tokens used in the run (reported by the agent)").option("--model <name>","Model that answered (reported)").option("--file <path>","Path to project.faf (default: discovered)").option("--submit","Submit the full-pair receipt to the public bench ledger").option("--endpoint <url>","Override the submit endpoint").action(($,Z,X)=>wQ($,Z,X));v.command("show").description("Render project.faf → project.html and open it").action(()=>Ez());v.command("sync").description(".faf ↔ CLAUDE.md (bi-sync, mtime auto-direction)").option("--watch","Watch for changes").option("--direction <dir>","Force direction: auto|push|pull","auto").action(($)=>p6($));v.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").action(($,Z)=>Zz($,Z));v.command("decompile <file>").description("Decompile .fafb to JSON").option("--output <path>","Output path").action(($,Z)=>Xz($,Z));v.command("git <url>").description("Instant scored context from any GitHub repo (any branch/tag with --ref)").option("--ref <ref>","Clone at a specific branch or tag (versioned context)").option("--output <path>","Write to a custom path (default: ./project.faf)").option("--force","Overwrite an existing project.faf").option("--stdout","Print the .faf to stdout instead of writing a file").action(($,Z)=>Sz($,Z));v.command("diff [range]").description("Semantic context diff between two .faf versions (slot deltas + score). git ranges: <ref>, A..B, A...B").option("--json","Emit the delta as structured JSON").option("--install-driver","Wire faf diff into native git — `git diff` renders .faf score+slot deltas").option("--uninstall-driver","Remove the native-git diff driver").action(($,Z)=>mz($,Z));v.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>hz($??[]));v.command("log").description("Score timeline across git history — the .faf score at every commit that touched it").option("-n, --limit <n>","Max commits to show (default 20)").option("--all","Show every commit, no cap").option("--reverse","Oldest-first instead of newest-first").option("--json","Emit the timeline as structured JSON").action(($)=>cz($));v.command("hooks").description("Pre-commit context guard — scores staged .faf vs HEAD, warns (or --strict blocks) on regression").option("--install","Install the pre-commit hook").option("--uninstall","Remove the faf hook block (preserves other hooks)").option("--strict","With --install: block the commit on a score regression (default: warn only)").action(($)=>sz($));v.command("hooks-run",{hidden:!0}).description("Internal: the pre-commit context guard the git hook invokes").option("--strict","Exit non-zero on a score regression").action(($)=>rz($));v.command("export").description("Export context files from .faf").option("--agents","Author AGENTS.md").option("--cursor","Author .cursorrules").option("--gemini","Author GEMINI.md").option("--copilot","Author .github/copilot-instructions.md (GitHub Copilot)").option("--grok","Wire grok-faf-mcp into .grok/config.toml").option("--conductor","Author conductor config").option("--html","Author project.html (visual render of project.faf)").option("--card","Author MCP Server Card (.well-known/mcp/server-card) with the FAF context-block").option("--all","Author all formats").action(($)=>B$($));v.command("server-card").description("Emit the registry server.json identity (name + title + _meta) from project.faf — the cross-language server-card emitter; patches an existing file").option("--in <path>","Existing server.json to patch (default: ./server.json)").option("--out <path>","Output path (default: same as --in)").option("--faf <path>","project.faf path (default: auto-discover)").option("--set-version <version>","Set the version field (default: preserve existing). NOTE: not --version, which is the global CLI-version flag").option("--generated <iso>","Override the _meta generated stamp (default: preserve existing)").option("--check","Print to stdout, do not write (diff/verify — the idempotency-test hook)").action(($)=>Cz($));v.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--fix","Auto-fix issues").option("--doctor","Full diagnostic").option("--trust","Verify trust chain").action(($,Z)=>i6($,Z));v.command("info").description("Show version and system info").option("--version","Show version").option("--faq","Show FAQ").option("--index","Show command index").option("--stacks","Show supported stacks").action(($)=>az($));v.command("formats").description("Show supported formats").action(()=>oz());v.command("clear").description("Clear cached data").action(()=>tz());v.command("convert").description("Convert .faf to other formats").option("--json","Output as JSON").action(($)=>ez($));v.command("context").description("Author context output").action(()=>$J());v.command("refresh").description("Re-ground on the live .faf — re-score, measure drift vs the DNA baseline, keep .fafb current").option("--json","Output as JSON").action(($)=>CQ($));v.command("drift").description("Check context drift").action(()=>XJ());v.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>zJ($,Z));v.command("recover").description("Recover .faf from context files").action(()=>JJ());v.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>QJ($));v.command("pro [subcommand]").description("Pro features & licensing").action(($)=>YJ($));v.command("share").description("Share .faf via URL").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>WJ($));v.command("demo").description("Demo walkthrough").action(()=>GJ());v.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>qJ($,Z));v.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` wires the CI receipt printer; bare snapshot deprecated → faf score --json").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").action(($,Z)=>KJ($,Z));v.command("ai [subcommand]").description("AI-powered features (enhance|analyze)").action(($)=>BQ($));v.command("conductor [subcommand] [path]").description("Conductor integration").action(($,Z)=>MQ($,Z));v.command("wjttc").description("Audit test suite for WJTTC tier coverage (vendor-neutral)").option("--path <path>","Test directory (default: tests)").option("--strict","Exit non-zero if any tests are untiered").option("--json","Output as JSON for CI consumption").action(($)=>TQ($));v.command("memory [subcommand] [arg]").description(".fafm soul ops — convert Claude memory, etch, recall, ls, show").option("-f, --file <path>","Soul file (default: ./soul.fafm)").option("-o, --output <path>","Output path (convert)").option("--namepoint <handle>","Namepoint for new/converted soul").option("--id <id>","Fact id (etch)").option("--type <type>","Fact type filter / etch type").option("--tag <tags>","Comma-separated tags (recall)").option("--priority <level>","Min priority floor (recall) or etch priority").option("--limit <n>","Max recall hits").option("--json","JSON output").action(($,Z,X)=>gQ($,Z,X));v.command("bi-sync",{hidden:!0}).action(()=>p6());v.command("status",{hidden:!0}).action(()=>W4(void 0,{status:!0}));v.command("agents",{hidden:!0}).action(()=>B$({agents:!0}));v.command("cursor",{hidden:!0}).action(()=>B$({cursor:!0}));v.command("gemini",{hidden:!0}).action(()=>B$({gemini:!0}));v.command("grok",{hidden:!0}).action(()=>B$({grok:!0}));v.command("validate",{hidden:!0}).action(($)=>i6($));v.command("yolo",{hidden:!0}).action(()=>m6({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:X}=await Promise.resolve().then(() => (d(),GX)),z=process.cwd().replace(process.env.HOME??"","~"),J="\x1B[38;2;150;150;150m",Q="\x1B[48;2;150;150;150m",Y="\x1B[38;2;29;29;29m",W="\x1B[48;2;29;29;29m",U="\x1B[0m";console.log(""),console.log(`\x1B[48;2;29;29;29m ${"\x1B[38;2;150;150;150m"}▄${"\x1B[48;2;150;150;150m"}███████${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▄${"\x1B[0m"}`),console.log(`\x1B[48;2;29;29;29m \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}█${"\x1B[38;2;29;29;29m"}█${"\x1B[38;2;150;150;150m"}███████${"\x1B[0m"} ${X($("faf"))} ${Z(`v${vQ}`)}`);let G="\x1B[38;2;39;174;96m";console.log(`\x1B[48;2;29;29;29m${"\x1B[38;2;150;150;150m"}▀${"\x1B[48;2;150;150;150m"}${"\x1B[38;2;29;29;29m"}▀${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[0m ${Z("Nelly Never Forgets")}`),console.log(`${G}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`),console.log(`${Z(` ${z}`)}`),console.log("");try{await W4(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${X("faf --help")} ${Z("for commands")}`)})();else v.addHelpText("after",["","Git-native (The GIT Version):"," faf diff [range] semantic context diff + score delta (A..B, A...B)"," faf diff --install-driver make native `git diff` render .faf deltas"," faf log score timeline across history (Proof-Over-Time)"," faf hooks --install pre-commit guard against context regression"," faf git <url> [--ref] instant scored context from any repo, any branch/tag","",' "FAF is to Context what Git is to Versions."',""].join(`
532
- `)),v.parse(process.argv);
531
+ `),console.log(B(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json")),console.log(B(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}var{version:pQ}=YZ(),g=new $7;g.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(pQ,"-v, --version");g.command("init").description("Create .faf from your project").option("--yolo","Quick init with sensible defaults").option("--quick","Alias for --yolo").option("--force","Overwrite existing project.faf").option("--output <path>","Output path").action(($)=>i6($));g.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>nX());g.command("auto").description("Zero to 100% in one command").action(()=>A3());g.command("loop").description("Drive to 100% — source what we can, then ask only the human").option("-r, --rounds <n>","max auto rounds before stopping","5").action(($)=>sX($));g.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>IJ($));g.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>G3($,Z));g.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key)").option("--json","Output as JSON").option("--cold","Grade as the without-context run").option("--faf","Grade as the with-context run").option("--tokens <n>","Tokens used in the run (reported by the agent)").option("--model <name>","Model that answered (reported)").option("--file <path>","Path to project.faf (default: discovered)").option("--submit","Submit the full-pair receipt to the public bench ledger").option("--endpoint <url>","Override the submit endpoint").action(($,Z,X)=>kQ($,Z,X));g.command("show").description("Render project.faf → project.html and open it").action(()=>fz());g.command("sync").description(".faf ↔ CLAUDE.md (bi-sync, mtime auto-direction)").option("--watch","Watch for changes").option("--direction <dir>","Force direction: auto|push|pull","auto").action(($)=>a6($));g.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").action(($,Z)=>Uz($,Z));g.command("decompile <file>").description("Decompile .fafb to JSON").option("--output <path>","Output path").action(($,Z)=>Gz($,Z));g.command("git <url>").description("Instant scored context from any GitHub repo (any branch/tag with --ref)").option("--ref <ref>","Clone at a specific branch or tag (versioned context)").option("--output <path>","Write to a custom path (default: ./project.faf)").option("--force","Overwrite an existing project.faf").option("--stdout","Print the .faf to stdout instead of writing a file").action(($,Z)=>vz($,Z));g.command("diff [range]").description("Semantic context diff between two .faf versions (slot deltas + score). git ranges: <ref>, A..B, A...B").option("--json","Emit the delta as structured JSON").option("--install-driver","Wire faf diff into native git — `git diff` renders .faf score+slot deltas").option("--uninstall-driver","Remove the native-git diff driver").action(($,Z)=>rz($,Z));g.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>iz($??[]));g.command("log").description("Score timeline across git history — the .faf score at every commit that touched it").option("-n, --limit <n>","Max commits to show (default 20)").option("--all","Show every commit, no cap").option("--reverse","Oldest-first instead of newest-first").option("--json","Emit the timeline as structured JSON").action(($)=>sz($));g.command("hooks").description("Pre-commit context guard — scores staged .faf vs HEAD, warns (or --strict blocks) on regression").option("--install","Install the pre-commit hook").option("--uninstall","Remove the faf hook block (preserves other hooks)").option("--strict","With --install: block the commit on a score regression (default: warn only)").action(($)=>XJ($));g.command("hooks-run",{hidden:!0}).description("Internal: the pre-commit context guard the git hook invokes").option("--strict","Exit non-zero on a score regression").action(($)=>ZJ($));g.command("export").description("Export context files from .faf").option("--agents","Author AGENTS.md").option("--cursor","Author .cursorrules").option("--gemini","Author GEMINI.md").option("--copilot","Author .github/copilot-instructions.md (GitHub Copilot)").option("--grok","Wire grok-faf-mcp into .grok/config.toml").option("--conductor","Author conductor config").option("--html","Author project.html (visual render of project.faf)").option("--card","Author MCP Server Card (.well-known/mcp/server-card) with the FAF context-block").option("--all","Author all formats").action(($)=>L$($));g.command("server-card").description("Emit the registry server.json identity (name + title + _meta) from project.faf — the cross-language server-card emitter; patches an existing file").option("--in <path>","Existing server.json to patch (default: ./server.json)").option("--out <path>","Output path (default: same as --in)").option("--faf <path>","project.faf path (default: auto-discover)").option("--set-version <version>","Set the version field (default: preserve existing). NOTE: not --version, which is the global CLI-version flag").option("--generated <iso>","Override the _meta generated stamp (default: preserve existing)").option("--check","Print to stdout, do not write (diff/verify — the idempotency-test hook)").action(($)=>yz($));g.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--fix","Auto-fix issues").option("--doctor","Full diagnostic").option("--trust","Verify trust chain").action(($,Z)=>o6($,Z));g.command("info").description("Show version and system info").option("--version","Show version").option("--faq","Show FAQ").option("--index","Show command index").option("--stacks","Show supported stacks").action(($)=>zJ($));g.command("formats").description("Show supported formats").action(()=>JJ());g.command("clear").description("Clear cached data").action(()=>QJ());g.command("convert").description("Convert .faf to other formats").option("--json","Output as JSON").action(($)=>YJ($));g.command("context").description("Author context output").action(()=>WJ());g.command("refresh").description("Re-ground on the live .faf — re-score, measure drift vs the DNA baseline, keep .fafb current").option("--json","Output as JSON").action(($)=>yQ($));g.command("drift").description("Check context drift").action(()=>GJ());g.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>qJ($,Z));g.command("recover").description("Recover .faf from context files").action(()=>VJ());g.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>KJ($));g.command("pro [subcommand]").description("Pro features & licensing").action(($)=>HJ($));g.command("share").description("Share .faf via URL").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>BJ($));g.command("demo").description("Demo walkthrough").action(()=>MJ());g.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>OJ($,Z));g.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` wires the CI receipt printer; bare snapshot deprecated → faf score --json").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").action(($,Z)=>TJ($,Z));g.command("ai [subcommand]").description("AI-powered features (enhance|analyze)").action(($)=>IQ($));g.command("conductor [subcommand] [path]").description("Conductor integration").action(($,Z)=>_Q($,Z));g.command("wjttc").description("Audit test suite for WJTTC tier coverage (vendor-neutral)").option("--path <path>","Test directory (default: tests)").option("--strict","Exit non-zero if any tests are untiered").option("--json","Output as JSON for CI consumption").action(($)=>PQ($));g.command("memory [subcommand] [arg]").description(".fafm soul ops — convert Claude memory, etch, recall, ls, show").option("-f, --file <path>","Soul file (default: ./soul.fafm)").option("-o, --output <path>","Output path (convert)").option("--namepoint <handle>","Namepoint for new/converted soul").option("--id <id>","Fact id (etch)").option("--type <type>","Fact type filter / etch type").option("--tag <tags>","Comma-separated tags (recall)").option("--priority <level>","Min priority floor (recall) or etch priority").option("--limit <n>","Max recall hits").option("--json","JSON output").action(($,Z,X)=>lQ($,Z,X));g.command("bi-sync",{hidden:!0}).action(()=>a6());g.command("status",{hidden:!0}).action(()=>G3(void 0,{status:!0}));g.command("agents",{hidden:!0}).action(()=>L$({agents:!0}));g.command("cursor",{hidden:!0}).action(()=>L$({cursor:!0}));g.command("gemini",{hidden:!0}).action(()=>L$({gemini:!0}));g.command("grok",{hidden:!0}).action(()=>L$({grok:!0}));g.command("validate",{hidden:!0}).action(($)=>o6($));g.command("yolo",{hidden:!0}).action(()=>i6({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:X}=await Promise.resolve().then(() => (d(),BX)),z=process.cwd().replace(process.env.HOME??"","~"),J="\x1B[38;2;150;150;150m",Q="\x1B[48;2;150;150;150m",Y="\x1B[38;2;29;29;29m",W="\x1B[48;2;29;29;29m",U="\x1B[0m";console.log(""),console.log(`\x1B[48;2;29;29;29m ${"\x1B[38;2;150;150;150m"}▄${"\x1B[48;2;150;150;150m"}███████${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▄${"\x1B[0m"}`),console.log(`\x1B[48;2;29;29;29m \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}█${"\x1B[38;2;29;29;29m"}█${"\x1B[38;2;150;150;150m"}███████${"\x1B[0m"} ${X($("faf"))} ${Z(`v${pQ}`)}`);let G="\x1B[38;2;39;174;96m";console.log(`\x1B[48;2;29;29;29m${"\x1B[38;2;150;150;150m"}▀${"\x1B[48;2;150;150;150m"}${"\x1B[38;2;29;29;29m"}▀${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[0m ${Z("Nelly Never Forgets")}`),console.log(`${G}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`),console.log(`${Z(` ${z}`)}`),console.log("");try{await G3(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${X("faf --help")} ${Z("for commands")}`)})();else g.addHelpText("after",["","Git-native (The GIT Version):"," faf diff [range] semantic context diff + score delta (A..B, A...B)"," faf diff --install-driver make native `git diff` render .faf deltas"," faf log score timeline across history (Proof-Over-Time)"," faf hooks --install pre-commit guard against context regression"," faf git <url> [--ref] instant scored context from any repo, any branch/tag","",' "FAF is to Context what Git is to Versions."',""].join(`
532
+ `)),g.parse(process.argv);
533
533
 
534
- //# debugId=7C391F31944075A264756E2164756E21
534
+ //# debugId=C312CCC6816BD30164756E2164756E21
535
535
  //# sourceMappingURL=cli.js.map