@pickled-dev/cli 0.1.0 → 0.3.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.
Files changed (3) hide show
  1. package/README.md +83 -74
  2. package/dist/index.js +246 -106
  3. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -1,125 +1,265 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import{createRequire as H4}from"node:module";var G4=Object.create;var{getPrototypeOf:V4,defineProperty:u1,getOwnPropertyNames:q4}=Object;var U4=Object.prototype.hasOwnProperty;var N4=($,X,J)=>{J=$!=null?G4(V4($)):{};let Z=X||!$||!$.__esModule?u1(J,"default",{value:$,enumerable:!0}):J;for(let z of q4($))if(!U4.call(Z,z))u1(Z,z,{get:()=>$[z],enumerable:!0});return Z};var J$=($,X)=>()=>(X||$((X={exports:{}}).exports,X),X.exports);var S$=H4(import.meta.url);var j$=J$((w4)=>{class o0 extends Error{constructor($,X,J){super(J);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=X,this.exitCode=$,this.nestedError=void 0}}class m1 extends o0{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}w4.CommanderError=o0;w4.InvalidArgumentError=m1});var T0=J$((E4)=>{var{InvalidArgumentError:L4}=j$();class d1{constructor($,X){switch(this.description=X||"",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($,X){if(X===this.defaultValue||!Array.isArray(X))return[$];return X.push($),X}default($,X){return this.defaultValue=$,this.defaultValueDescription=X,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(X,J)=>{if(!this.argChoices.includes(X))throw new L4(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(X,J);return X},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function D4($){let X=$.name()+($.variadic===!0?"...":"");return $.required?"<"+X+">":"["+X+"]"}E4.Argument=d1;E4.humanReadableArgName=D4});var a0=J$((I4)=>{var{humanReadableArgName:j4}=T0();class p1{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 X=$.commands.filter((Z)=>!Z._hidden),J=$._getHelpCommand();if(J&&!J._hidden)X.push(J);if(this.sortSubcommands)X.sort((Z,z)=>{return Z.name().localeCompare(z.name())});return X}compareOptions($,X){let J=(Z)=>{return Z.short?Z.short.replace(/^-/,""):Z.long.replace(/^--/,"")};return J($).localeCompare(J(X))}visibleOptions($){let X=$.options.filter((Z)=>!Z.hidden),J=$._getHelpOption();if(J&&!J.hidden){let Z=J.short&&$._findOption(J.short),z=J.long&&$._findOption(J.long);if(!Z&&!z)X.push(J);else if(J.long&&!z)X.push($.createOption(J.long,J.description));else if(J.short&&!Z)X.push($.createOption(J.short,J.description))}if(this.sortOptions)X.sort(this.compareOptions);return X}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let X=[];for(let J=$.parent;J;J=J.parent){let Z=J.options.filter((z)=>!z.hidden);X.push(...Z)}if(this.sortOptions)X.sort(this.compareOptions);return X}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((X)=>{X.description=X.description||$._argsDescription[X.name()]||""});if($.registeredArguments.find((X)=>X.description))return $.registeredArguments;return[]}subcommandTerm($){let X=$.registeredArguments.map((J)=>j4(J)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(X?" "+X:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,X){return X.visibleCommands($).reduce((J,Z)=>{return Math.max(J,this.displayWidth(X.styleSubcommandTerm(X.subcommandTerm(Z))))},0)}longestOptionTermLength($,X){return X.visibleOptions($).reduce((J,Z)=>{return Math.max(J,this.displayWidth(X.styleOptionTerm(X.optionTerm(Z))))},0)}longestGlobalOptionTermLength($,X){return X.visibleGlobalOptions($).reduce((J,Z)=>{return Math.max(J,this.displayWidth(X.styleOptionTerm(X.optionTerm(Z))))},0)}longestArgumentTermLength($,X){return X.visibleArguments($).reduce((J,Z)=>{return Math.max(J,this.displayWidth(X.styleArgumentTerm(X.argumentTerm(Z))))},0)}commandUsage($){let X=$._name;if($._aliases[0])X=X+"|"+$._aliases[0];let J="";for(let Z=$.parent;Z;Z=Z.parent)J=Z.name()+" "+J;return J+X+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let X=[];if($.argChoices)X.push(`choices: ${$.argChoices.map((J)=>JSON.stringify(J)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")X.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)X.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)X.push(`env: ${$.envVar}`);if(X.length>0){let J=`(${X.join(", ")})`;if($.description)return`${$.description} ${J}`;return J}return $.description}argumentDescription($){let X=[];if($.argChoices)X.push(`choices: ${$.argChoices.map((J)=>JSON.stringify(J)).join(", ")}`);if($.defaultValue!==void 0)X.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(X.length>0){let J=`(${X.join(", ")})`;if($.description)return`${$.description} ${J}`;return J}return $.description}formatItemList($,X,J){if(X.length===0)return[];return[J.styleTitle($),...X,""]}groupItems($,X,J){let Z=new Map;return $.forEach((z)=>{let Y=J(z);if(!Z.has(Y))Z.set(Y,[])}),X.forEach((z)=>{let Y=J(z);if(!Z.has(Y))Z.set(Y,[]);Z.get(Y).push(z)}),Z}formatHelp($,X){let J=X.padWidth($,X),Z=X.helpWidth??80;function z(q,N){return X.formatItem(q,J,N,X)}let Y=[`${X.styleTitle("Usage:")} ${X.styleUsage(X.commandUsage($))}`,""],W=X.commandDescription($);if(W.length>0)Y=Y.concat([X.boxWrap(X.styleCommandDescription(W),Z),""]);let Q=X.visibleArguments($).map((q)=>{return z(X.styleArgumentTerm(X.argumentTerm(q)),X.styleArgumentDescription(X.argumentDescription(q)))});if(Y=Y.concat(this.formatItemList("Arguments:",Q,X)),this.groupItems($.options,X.visibleOptions($),(q)=>q.helpGroupHeading??"Options:").forEach((q,N)=>{let w=q.map((T)=>{return z(X.styleOptionTerm(X.optionTerm(T)),X.styleOptionDescription(X.optionDescription(T)))});Y=Y.concat(this.formatItemList(N,w,X))}),X.showGlobalOptions){let q=X.visibleGlobalOptions($).map((N)=>{return z(X.styleOptionTerm(X.optionTerm(N)),X.styleOptionDescription(X.optionDescription(N)))});Y=Y.concat(this.formatItemList("Global Options:",q,X))}return this.groupItems($.commands,X.visibleCommands($),(q)=>q.helpGroup()||"Commands:").forEach((q,N)=>{let w=q.map((T)=>{return z(X.styleSubcommandTerm(X.subcommandTerm(T)),X.styleSubcommandDescription(X.subcommandDescription(T)))});Y=Y.concat(this.formatItemList(N,w,X))}),Y.join(`
4
- `)}displayWidth($){return l1($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((X)=>{if(X==="[options]")return this.styleOptionText(X);if(X==="[command]")return this.styleSubcommandText(X);if(X[0]==="["||X[0]==="<")return this.styleArgumentText(X);return this.styleCommandText(X)}).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((X)=>{if(X==="[options]")return this.styleOptionText(X);if(X[0]==="["||X[0]==="<")return this.styleArgumentText(X);return this.styleSubcommandText(X)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,X){return Math.max(X.longestOptionTermLength($,X),X.longestGlobalOptionTermLength($,X),X.longestSubcommandTermLength($,X),X.longestArgumentTermLength($,X))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,X,J,Z){let Y=" ".repeat(2);if(!J)return Y+$;let W=$.padEnd(X+$.length-Z.displayWidth($)),Q=2,V=(this.helpWidth??80)-X-Q-2,q;if(V<this.minWidthToWrap||Z.preformatted(J))q=J;else q=Z.boxWrap(J,V).replace(/\n/g,`
5
- `+" ".repeat(X+Q));return Y+W+" ".repeat(Q)+q.replace(/\n/g,`
6
- ${Y}`)}boxWrap($,X){if(X<this.minWidthToWrap)return $;let J=$.split(/\r\n|\n/),Z=/[\s]*[^\s]+/g,z=[];return J.forEach((Y)=>{let W=Y.match(Z);if(W===null){z.push("");return}let Q=[W.shift()],G=this.displayWidth(Q[0]);W.forEach((V)=>{let q=this.displayWidth(V);if(G+q<=X){Q.push(V),G+=q;return}z.push(Q.join(""));let N=V.trimStart();Q=[N],G=this.displayWidth(N)}),z.push(Q.join(""))}),z.join(`
7
- `)}}function l1($){let X=/\x1b\[\d*(;\d*)*m/g;return $.replace(X,"")}I4.Help=p1;I4.stripColor=l1});var t0=J$((C4)=>{var{InvalidArgumentError:O4}=j$();class n1{constructor($,X){this.flags=$,this.description=X||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let J=P4($);if(this.short=J.shortFlag,this.long=J.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default($,X){return this.defaultValue=$,this.defaultValueDescription=X,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let X=$;if(typeof $==="string")X={[$]:!0};return this.implied=Object.assign(this.implied||{},X),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_collectValue($,X){if(X===this.defaultValue||!Array.isArray(X))return[$];return X.push($),X}choices($){return this.argChoices=$.slice(),this.parseArg=(X,J)=>{if(!this.argChoices.includes(X))throw new O4(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(X,J);return X},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return i1(this.name().replace(/^no-/,""));return i1(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class o1{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((X)=>{if(X.negate)this.negativeOptions.set(X.attributeName(),X);else this.positiveOptions.set(X.attributeName(),X)}),this.negativeOptions.forEach((X,J)=>{if(this.positiveOptions.has(J))this.dualOptions.add(J)})}valueFromOption($,X){let J=X.attributeName();if(!this.dualOptions.has(J))return!0;let Z=this.negativeOptions.get(J).presetArg,z=Z!==void 0?Z:!1;return X.negate===(z===$)}}function i1($){return $.split("-").reduce((X,J)=>{return X+J[0].toUpperCase()+J.slice(1)})}function P4($){let X,J,Z=/^-[^-]$/,z=/^--[^-]/,Y=$.split(/[ |,]+/).concat("guard");if(Z.test(Y[0]))X=Y.shift();if(z.test(Y[0]))J=Y.shift();if(!X&&Z.test(Y[0]))X=Y.shift();if(!X&&z.test(Y[0]))X=J,J=Y.shift();if(Y[0].startsWith("-")){let W=Y[0],Q=`option creation failed due to '${W}' in option flags '${$}'`;if(/^-[^-][^-]/.test(W))throw Error(`${Q}
3
+ import{createRequire as rG}from"node:module";var pG=Object.create;var{getPrototypeOf:dG,defineProperty:I4,getOwnPropertyNames:iG}=Object;var nG=Object.prototype.hasOwnProperty;var j4=(X,Q,J)=>{J=X!=null?pG(dG(X)):{};let Y=Q||!X||!X.__esModule?I4(J,"default",{value:X,enumerable:!0}):J;for(let G of iG(X))if(!nG.call(Y,G))I4(Y,G,{get:()=>X[G],enumerable:!0});return Y};var p=(X,Q)=>()=>(Q||X((Q={exports:{}}).exports,Q),Q.exports);var O1=rG(import.meta.url);var y9=p((oG)=>{class UX extends Error{constructor(X,Q,J){super(J);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=Q,this.exitCode=X,this.nestedError=void 0}}class w4 extends UX{constructor(X){super(1,"commander.invalidArgument",X);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}oG.CommanderError=UX;oG.InvalidArgumentError=w4});var v8=p((X$)=>{var{InvalidArgumentError:tG}=y9();class P4{constructor(X,Q){switch(this.description=Q||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,X[0]){case"<":this.required=!0,this._name=X.slice(1,-1);break;case"[":this.required=!1,this._name=X.slice(1,-1);break;default:this.required=!0,this._name=X;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(X,Q){if(Q===this.defaultValue||!Array.isArray(Q))return[X];return Q.push(X),Q}default(X,Q){return this.defaultValue=X,this.defaultValueDescription=Q,this}argParser(X){return this.parseArg=X,this}choices(X){return this.argChoices=X.slice(),this.parseArg=(Q,J)=>{if(!this.argChoices.includes(Q))throw new tG(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Q,J);return Q},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function eG(X){let Q=X.name()+(X.variadic===!0?"...":"");return X.required?"<"+Q+">":"["+Q+"]"}X$.Argument=P4;X$.humanReadableArgName=eG});var BX=p((G$)=>{var{humanReadableArgName:Y$}=v8();class T4{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(X){this.helpWidth=this.helpWidth??X.helpWidth??80}visibleCommands(X){let Q=X.commands.filter((Y)=>!Y._hidden),J=X._getHelpCommand();if(J&&!J._hidden)Q.push(J);if(this.sortSubcommands)Q.sort((Y,G)=>{return Y.name().localeCompare(G.name())});return Q}compareOptions(X,Q){let J=(Y)=>{return Y.short?Y.short.replace(/^-/,""):Y.long.replace(/^--/,"")};return J(X).localeCompare(J(Q))}visibleOptions(X){let Q=X.options.filter((Y)=>!Y.hidden),J=X._getHelpOption();if(J&&!J.hidden){let Y=J.short&&X._findOption(J.short),G=J.long&&X._findOption(J.long);if(!Y&&!G)Q.push(J);else if(J.long&&!G)Q.push(X.createOption(J.long,J.description));else if(J.short&&!Y)Q.push(X.createOption(J.short,J.description))}if(this.sortOptions)Q.sort(this.compareOptions);return Q}visibleGlobalOptions(X){if(!this.showGlobalOptions)return[];let Q=[];for(let J=X.parent;J;J=J.parent){let Y=J.options.filter((G)=>!G.hidden);Q.push(...Y)}if(this.sortOptions)Q.sort(this.compareOptions);return Q}visibleArguments(X){if(X._argsDescription)X.registeredArguments.forEach((Q)=>{Q.description=Q.description||X._argsDescription[Q.name()]||""});if(X.registeredArguments.find((Q)=>Q.description))return X.registeredArguments;return[]}subcommandTerm(X){let Q=X.registeredArguments.map((J)=>Y$(J)).join(" ");return X._name+(X._aliases[0]?"|"+X._aliases[0]:"")+(X.options.length?" [options]":"")+(Q?" "+Q:"")}optionTerm(X){return X.flags}argumentTerm(X){return X.name()}longestSubcommandTermLength(X,Q){return Q.visibleCommands(X).reduce((J,Y)=>{return Math.max(J,this.displayWidth(Q.styleSubcommandTerm(Q.subcommandTerm(Y))))},0)}longestOptionTermLength(X,Q){return Q.visibleOptions(X).reduce((J,Y)=>{return Math.max(J,this.displayWidth(Q.styleOptionTerm(Q.optionTerm(Y))))},0)}longestGlobalOptionTermLength(X,Q){return Q.visibleGlobalOptions(X).reduce((J,Y)=>{return Math.max(J,this.displayWidth(Q.styleOptionTerm(Q.optionTerm(Y))))},0)}longestArgumentTermLength(X,Q){return Q.visibleArguments(X).reduce((J,Y)=>{return Math.max(J,this.displayWidth(Q.styleArgumentTerm(Q.argumentTerm(Y))))},0)}commandUsage(X){let Q=X._name;if(X._aliases[0])Q=Q+"|"+X._aliases[0];let J="";for(let Y=X.parent;Y;Y=Y.parent)J=Y.name()+" "+J;return J+Q+" "+X.usage()}commandDescription(X){return X.description()}subcommandDescription(X){return X.summary()||X.description()}optionDescription(X){let Q=[];if(X.argChoices)Q.push(`choices: ${X.argChoices.map((J)=>JSON.stringify(J)).join(", ")}`);if(X.defaultValue!==void 0){if(X.required||X.optional||X.isBoolean()&&typeof X.defaultValue==="boolean")Q.push(`default: ${X.defaultValueDescription||JSON.stringify(X.defaultValue)}`)}if(X.presetArg!==void 0&&X.optional)Q.push(`preset: ${JSON.stringify(X.presetArg)}`);if(X.envVar!==void 0)Q.push(`env: ${X.envVar}`);if(Q.length>0){let J=`(${Q.join(", ")})`;if(X.description)return`${X.description} ${J}`;return J}return X.description}argumentDescription(X){let Q=[];if(X.argChoices)Q.push(`choices: ${X.argChoices.map((J)=>JSON.stringify(J)).join(", ")}`);if(X.defaultValue!==void 0)Q.push(`default: ${X.defaultValueDescription||JSON.stringify(X.defaultValue)}`);if(Q.length>0){let J=`(${Q.join(", ")})`;if(X.description)return`${X.description} ${J}`;return J}return X.description}formatItemList(X,Q,J){if(Q.length===0)return[];return[J.styleTitle(X),...Q,""]}groupItems(X,Q,J){let Y=new Map;return X.forEach((G)=>{let $=J(G);if(!Y.has($))Y.set($,[])}),Q.forEach((G)=>{let $=J(G);if(!Y.has($))Y.set($,[]);Y.get($).push(G)}),Y}formatHelp(X,Q){let J=Q.padWidth(X,Q),Y=Q.helpWidth??80;function G(q,K){return Q.formatItem(q,J,K,Q)}let $=[`${Q.styleTitle("Usage:")} ${Q.styleUsage(Q.commandUsage(X))}`,""],W=Q.commandDescription(X);if(W.length>0)$=$.concat([Q.boxWrap(Q.styleCommandDescription(W),Y),""]);let H=Q.visibleArguments(X).map((q)=>{return G(Q.styleArgumentTerm(Q.argumentTerm(q)),Q.styleArgumentDescription(Q.argumentDescription(q)))});if($=$.concat(this.formatItemList("Arguments:",H,Q)),this.groupItems(X.options,Q.visibleOptions(X),(q)=>q.helpGroupHeading??"Options:").forEach((q,K)=>{let V=q.map((N)=>{return G(Q.styleOptionTerm(Q.optionTerm(N)),Q.styleOptionDescription(Q.optionDescription(N)))});$=$.concat(this.formatItemList(K,V,Q))}),Q.showGlobalOptions){let q=Q.visibleGlobalOptions(X).map((K)=>{return G(Q.styleOptionTerm(Q.optionTerm(K)),Q.styleOptionDescription(Q.optionDescription(K)))});$=$.concat(this.formatItemList("Global Options:",q,Q))}return this.groupItems(X.commands,Q.visibleCommands(X),(q)=>q.helpGroup()||"Commands:").forEach((q,K)=>{let V=q.map((N)=>{return G(Q.styleSubcommandTerm(Q.subcommandTerm(N)),Q.styleSubcommandDescription(Q.subcommandDescription(N)))});$=$.concat(this.formatItemList(K,V,Q))}),$.join(`
4
+ `)}displayWidth(X){return S4(X).length}styleTitle(X){return X}styleUsage(X){return X.split(" ").map((Q)=>{if(Q==="[options]")return this.styleOptionText(Q);if(Q==="[command]")return this.styleSubcommandText(Q);if(Q[0]==="["||Q[0]==="<")return this.styleArgumentText(Q);return this.styleCommandText(Q)}).join(" ")}styleCommandDescription(X){return this.styleDescriptionText(X)}styleOptionDescription(X){return this.styleDescriptionText(X)}styleSubcommandDescription(X){return this.styleDescriptionText(X)}styleArgumentDescription(X){return this.styleDescriptionText(X)}styleDescriptionText(X){return X}styleOptionTerm(X){return this.styleOptionText(X)}styleSubcommandTerm(X){return X.split(" ").map((Q)=>{if(Q==="[options]")return this.styleOptionText(Q);if(Q[0]==="["||Q[0]==="<")return this.styleArgumentText(Q);return this.styleSubcommandText(Q)}).join(" ")}styleArgumentTerm(X){return this.styleArgumentText(X)}styleOptionText(X){return X}styleArgumentText(X){return X}styleSubcommandText(X){return X}styleCommandText(X){return X}padWidth(X,Q){return Math.max(Q.longestOptionTermLength(X,Q),Q.longestGlobalOptionTermLength(X,Q),Q.longestSubcommandTermLength(X,Q),Q.longestArgumentTermLength(X,Q))}preformatted(X){return/\n[^\S\r\n]/.test(X)}formatItem(X,Q,J,Y){let $=" ".repeat(2);if(!J)return $+X;let W=X.padEnd(Q+X.length-Y.displayWidth(X)),H=2,B=(this.helpWidth??80)-Q-H-2,q;if(B<this.minWidthToWrap||Y.preformatted(J))q=J;else q=Y.boxWrap(J,B).replace(/\n/g,`
5
+ `+" ".repeat(Q+H));return $+W+" ".repeat(H)+q.replace(/\n/g,`
6
+ ${$}`)}boxWrap(X,Q){if(Q<this.minWidthToWrap)return X;let J=X.split(/\r\n|\n/),Y=/[\s]*[^\s]+/g,G=[];return J.forEach(($)=>{let W=$.match(Y);if(W===null){G.push("");return}let H=[W.shift()],U=this.displayWidth(H[0]);W.forEach((B)=>{let q=this.displayWidth(B);if(U+q<=Q){H.push(B),U+=q;return}G.push(H.join(""));let K=B.trimStart();H=[K],U=this.displayWidth(K)}),G.push(H.join(""))}),G.join(`
7
+ `)}}function S4(X){let Q=/\x1b\[\d*(;\d*)*m/g;return X.replace(Q,"")}G$.Help=T4;G$.stripColor=S4});var zX=p((B$)=>{var{InvalidArgumentError:H$}=y9();class b4{constructor(X,Q){this.flags=X,this.description=Q||"",this.required=X.includes("<"),this.optional=X.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(X),this.mandatory=!1;let J=U$(X);if(this.short=J.shortFlag,this.long=J.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(X,Q){return this.defaultValue=X,this.defaultValueDescription=Q,this}preset(X){return this.presetArg=X,this}conflicts(X){return this.conflictsWith=this.conflictsWith.concat(X),this}implies(X){let Q=X;if(typeof X==="string")Q={[X]:!0};return this.implied=Object.assign(this.implied||{},Q),this}env(X){return this.envVar=X,this}argParser(X){return this.parseArg=X,this}makeOptionMandatory(X=!0){return this.mandatory=!!X,this}hideHelp(X=!0){return this.hidden=!!X,this}_collectValue(X,Q){if(Q===this.defaultValue||!Array.isArray(Q))return[X];return Q.push(X),Q}choices(X){return this.argChoices=X.slice(),this.parseArg=(Q,J)=>{if(!this.argChoices.includes(Q))throw new H$(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Q,J);return Q},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return E4(this.name().replace(/^no-/,""));return E4(this.name())}helpGroup(X){return this.helpGroupHeading=X,this}is(X){return this.short===X||this.long===X}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class C4{constructor(X){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,X.forEach((Q)=>{if(Q.negate)this.negativeOptions.set(Q.attributeName(),Q);else this.positiveOptions.set(Q.attributeName(),Q)}),this.negativeOptions.forEach((Q,J)=>{if(this.positiveOptions.has(J))this.dualOptions.add(J)})}valueFromOption(X,Q){let J=Q.attributeName();if(!this.dualOptions.has(J))return!0;let Y=this.negativeOptions.get(J).presetArg,G=Y!==void 0?Y:!1;return Q.negate===(G===X)}}function E4(X){return X.split("-").reduce((Q,J)=>{return Q+J[0].toUpperCase()+J.slice(1)})}function U$(X){let Q,J,Y=/^-[^-]$/,G=/^--[^-]/,$=X.split(/[ |,]+/).concat("guard");if(Y.test($[0]))Q=$.shift();if(G.test($[0]))J=$.shift();if(!Q&&Y.test($[0]))Q=$.shift();if(!Q&&G.test($[0]))Q=J,J=$.shift();if($[0].startsWith("-")){let W=$[0],H=`option creation failed due to '${W}' in option flags '${X}'`;if(/^-[^-][^-]/.test(W))throw Error(`${H}
8
8
  - a short flag is a single dash and a single character
9
9
  - either use a single dash and a single character (for a short flag)
10
- - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(Z.test(W))throw Error(`${Q}
11
- - too many short flags`);if(z.test(W))throw Error(`${Q}
12
- - too many long flags`);throw Error(`${Q}
13
- - unrecognised flag format`)}if(X===void 0&&J===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:X,longFlag:J}}C4.Option=n1;C4.DualOptions=o1});var a1=J$((y4)=>{function f4($,X){if(Math.abs($.length-X.length)>3)return Math.max($.length,X.length);let J=[];for(let Z=0;Z<=$.length;Z++)J[Z]=[Z];for(let Z=0;Z<=X.length;Z++)J[0][Z]=Z;for(let Z=1;Z<=X.length;Z++)for(let z=1;z<=$.length;z++){let Y=1;if($[z-1]===X[Z-1])Y=0;else Y=1;if(J[z][Z]=Math.min(J[z-1][Z]+1,J[z][Z-1]+1,J[z-1][Z-1]+Y),z>1&&Z>1&&$[z-1]===X[Z-2]&&$[z-2]===X[Z-1])J[z][Z]=Math.min(J[z][Z],J[z-2][Z-2]+1)}return J[$.length][X.length]}function k4($,X){if(!X||X.length===0)return"";X=Array.from(new Set(X));let J=$.startsWith("--");if(J)$=$.slice(2),X=X.map((W)=>W.slice(2));let Z=[],z=3,Y=0.4;if(X.forEach((W)=>{if(W.length<=1)return;let Q=f4($,W),G=Math.max($.length,W.length);if((G-Q)/G>Y){if(Q<z)z=Q,Z=[W];else if(Q===z)Z.push(W)}}),Z.sort((W,Q)=>W.localeCompare(Q)),J)Z=Z.map((W)=>`--${W}`);if(Z.length>1)return`
14
- (Did you mean one of ${Z.join(", ")}?)`;if(Z.length===1)return`
15
- (Did you mean ${Z[0]}?)`;return""}y4.suggestSimilar=k4});var e1=J$((m4)=>{var b4=S$("node:events").EventEmitter,s0=S$("node:child_process"),l=S$("node:path"),L0=S$("node:fs"),L=S$("node:process"),{Argument:h4,humanReadableArgName:v4}=T0(),{CommanderError:r0}=j$(),{Help:g4,stripColor:c4}=a0(),{Option:t1,DualOptions:u4}=t0(),{suggestSimilar:s1}=a1();class $1 extends b4{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:(X)=>L.stdout.write(X),writeErr:(X)=>L.stderr.write(X),outputError:(X,J)=>J(X),getOutHelpWidth:()=>L.stdout.isTTY?L.stdout.columns:void 0,getErrHelpWidth:()=>L.stderr.isTTY?L.stderr.columns:void 0,getOutHasColors:()=>e0()??(L.stdout.isTTY&&L.stdout.hasColors?.()),getErrHasColors:()=>e0()??(L.stderr.isTTY&&L.stderr.hasColors?.()),stripColor:(X)=>c4(X)},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 X=this;X;X=X.parent)$.push(X);return $}command($,X,J){let Z=X,z=J;if(typeof Z==="object"&&Z!==null)z=Z,Z=null;z=z||{};let[,Y,W]=$.match(/([^ ]+) *(.*)/),Q=this.createCommand(Y);if(Z)Q.description(Z),Q._executableHandler=!0;if(z.isDefault)this._defaultCommandName=Q._name;if(Q._hidden=!!(z.noHelp||z.hidden),Q._executableFile=z.executableFile||null,W)Q.arguments(W);if(this._registerCommand(Q),Q.parent=this,Q.copyInheritedSettings(this),Z)return this;return Q}createCommand($){return new $1($)}createHelp(){return Object.assign(new g4,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($,X){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
16
- - specify the name in Command constructor or using .name()`);if(X=X||{},X.isDefault)this._defaultCommandName=$._name;if(X.noHelp||X.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,X){return new h4($,X)}argument($,X,J,Z){let z=this.createArgument($,X);if(typeof J==="function")z.default(Z).argParser(J);else z.default(J);return this.addArgument(z),this}arguments($){return $.trim().split(/ +/).forEach((X)=>{this.argument(X)}),this}addArgument($){let X=this.registeredArguments.slice(-1)[0];if(X?.variadic)throw Error(`only the last argument can be variadic '${X.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($,X){if(typeof $==="boolean"){if(this._addImplicitHelpCommand=$,$&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let J=$??"help [command]",[,Z,z]=J.match(/([^ ]+) *(.*)/),Y=X??"display help for command",W=this.createCommand(Z);if(W.helpOption(!1),z)W.arguments(z);if(Y)W.description(Y);if(this._addImplicitHelpCommand=!0,this._helpCommand=W,$||X)this._initCommandGroup(W);return this}addHelpCommand($,X){if(typeof $!=="object")return this.helpCommand($,X),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($,X){let J=["preSubcommand","preAction","postAction"];if(!J.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
17
- Expecting one of '${J.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(X);else this._lifeCycleHooks[$]=[X];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(X)=>{if(X.code!=="commander.executeSubCommandAsync")throw X};return this}_exit($,X,J){if(this._exitCallback)this._exitCallback(new r0($,X,J));L.exit($)}action($){let X=(J)=>{let Z=this.registeredArguments.length,z=J.slice(0,Z);if(this._storeOptionsAsProperties)z[Z]=this;else z[Z]=this.opts();return z.push(this),$.apply(this,z)};return this._actionHandler=X,this}createOption($,X){return new t1($,X)}_callParseArg($,X,J,Z){try{return $.parseArg(X,J)}catch(z){if(z.code==="commander.invalidArgument"){let Y=`${Z} ${z.message}`;this.error(Y,{exitCode:z.exitCode,code:z.code})}throw z}}_registerOption($){let X=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(X){let J=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${J}'
18
- - already used by option '${X.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let X=(Z)=>{return[Z.name()].concat(Z.aliases())},J=X($).find((Z)=>this._findCommand(Z));if(J){let Z=X(this._findCommand(J)).join("|"),z=X($).join("|");throw Error(`cannot add command '${z}' as already have command '${Z}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let X=$.name(),J=$.attributeName();if($.negate){let z=$.long.replace(/^--no-/,"--");if(!this._findOption(z))this.setOptionValueWithSource(J,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(J,$.defaultValue,"default");let Z=(z,Y,W)=>{if(z==null&&$.presetArg!==void 0)z=$.presetArg;let Q=this.getOptionValue(J);if(z!==null&&$.parseArg)z=this._callParseArg($,z,Q,Y);else if(z!==null&&$.variadic)z=$._collectValue(z,Q);if(z==null)if($.negate)z=!1;else if($.isBoolean()||$.optional)z=!0;else z="";this.setOptionValueWithSource(J,z,W)};if(this.on("option:"+X,(z)=>{let Y=`error: option '${$.flags}' argument '${z}' is invalid.`;Z(z,Y,"cli")}),$.envVar)this.on("optionEnv:"+X,(z)=>{let Y=`error: option '${$.flags}' value '${z}' from env '${$.envVar}' is invalid.`;Z(z,Y,"env")});return this}_optionEx($,X,J,Z,z){if(typeof X==="object"&&X instanceof t1)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let Y=this.createOption(X,J);if(Y.makeOptionMandatory(!!$.mandatory),typeof Z==="function")Y.default(z).argParser(Z);else if(Z instanceof RegExp){let W=Z;Z=(Q,G)=>{let V=W.exec(Q);return V?V[0]:G},Y.default(z).argParser(Z)}else Y.default(Z);return this.addOption(Y)}option($,X,J,Z){return this._optionEx({},$,X,J,Z)}requiredOption($,X,J,Z){return this._optionEx({mandatory:!0},$,X,J,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($,X){return this.setOptionValueWithSource($,X,void 0)}setOptionValueWithSource($,X,J){if(this._storeOptionsAsProperties)this[$]=X;else this._optionValues[$]=X;return this._optionValueSources[$]=J,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let X;return this._getCommandAndAncestors().forEach((J)=>{if(J.getOptionValueSource($)!==void 0)X=J.getOptionValueSource($)}),X}_prepareUserArgs($,X){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(X=X||{},$===void 0&&X.from===void 0){if(L.versions?.electron)X.from="electron";let Z=L.execArgv??[];if(Z.includes("-e")||Z.includes("--eval")||Z.includes("-p")||Z.includes("--print"))X.from="eval"}if($===void 0)$=L.argv;this.rawArgs=$.slice();let J;switch(X.from){case void 0:case"node":this._scriptPath=$[1],J=$.slice(2);break;case"electron":if(L.defaultApp)this._scriptPath=$[1],J=$.slice(2);else J=$.slice(1);break;case"user":J=$.slice(0);break;case"eval":J=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${X.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",J}parse($,X){this._prepareForParse();let J=this._prepareUserArgs($,X);return this._parseCommand([],J),this}async parseAsync($,X){this._prepareForParse();let J=this._prepareUserArgs($,X);return await this._parseCommand([],J),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
19
- - 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($,X,J){if(L0.existsSync($))return;let Z=X?`searched for local subcommand relative to directory '${X}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",z=`'${$}' does not exist
10
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(Y.test(W))throw Error(`${H}
11
+ - too many short flags`);if(G.test(W))throw Error(`${H}
12
+ - too many long flags`);throw Error(`${H}
13
+ - unrecognised flag format`)}if(Q===void 0&&J===void 0)throw Error(`option creation failed due to no flags found in '${X}'.`);return{shortFlag:Q,longFlag:J}}B$.Option=b4;B$.DualOptions=C4});var _4=p((K$)=>{function q$(X,Q){if(Math.abs(X.length-Q.length)>3)return Math.max(X.length,Q.length);let J=[];for(let Y=0;Y<=X.length;Y++)J[Y]=[Y];for(let Y=0;Y<=Q.length;Y++)J[0][Y]=Y;for(let Y=1;Y<=Q.length;Y++)for(let G=1;G<=X.length;G++){let $=1;if(X[G-1]===Q[Y-1])$=0;else $=1;if(J[G][Y]=Math.min(J[G-1][Y]+1,J[G][Y-1]+1,J[G-1][Y-1]+$),G>1&&Y>1&&X[G-1]===Q[Y-2]&&X[G-2]===Q[Y-1])J[G][Y]=Math.min(J[G][Y],J[G-2][Y-2]+1)}return J[X.length][Q.length]}function F$(X,Q){if(!Q||Q.length===0)return"";Q=Array.from(new Set(Q));let J=X.startsWith("--");if(J)X=X.slice(2),Q=Q.map((W)=>W.slice(2));let Y=[],G=3,$=0.4;if(Q.forEach((W)=>{if(W.length<=1)return;let H=q$(X,W),U=Math.max(X.length,W.length);if((U-H)/U>$){if(H<G)G=H,Y=[W];else if(H===G)Y.push(W)}}),Y.sort((W,H)=>W.localeCompare(H)),J)Y=Y.map((W)=>`--${W}`);if(Y.length>1)return`
14
+ (Did you mean one of ${Y.join(", ")}?)`;if(Y.length===1)return`
15
+ (Did you mean ${Y[0]}?)`;return""}K$.suggestSimilar=F$});var x4=p((R$)=>{var M$=O1("node:events").EventEmitter,LX=O1("node:child_process"),A1=O1("node:path"),y8=O1("node:fs"),Z0=O1("node:process"),{Argument:D$,humanReadableArgName:Z$}=v8(),{CommanderError:qX}=y9(),{Help:O$,stripColor:A$}=BX(),{Option:k4,DualOptions:N$}=zX(),{suggestSimilar:v4}=_4();class KX extends M${constructor(X){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=X||"",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:(Q)=>Z0.stdout.write(Q),writeErr:(Q)=>Z0.stderr.write(Q),outputError:(Q,J)=>J(Q),getOutHelpWidth:()=>Z0.stdout.isTTY?Z0.stdout.columns:void 0,getErrHelpWidth:()=>Z0.stderr.isTTY?Z0.stderr.columns:void 0,getOutHasColors:()=>FX()??(Z0.stdout.isTTY&&Z0.stdout.hasColors?.()),getErrHasColors:()=>FX()??(Z0.stderr.isTTY&&Z0.stderr.hasColors?.()),stripColor:(Q)=>A$(Q)},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(X){return this._outputConfiguration=X._outputConfiguration,this._helpOption=X._helpOption,this._helpCommand=X._helpCommand,this._helpConfiguration=X._helpConfiguration,this._exitCallback=X._exitCallback,this._storeOptionsAsProperties=X._storeOptionsAsProperties,this._combineFlagAndOptionalValue=X._combineFlagAndOptionalValue,this._allowExcessArguments=X._allowExcessArguments,this._enablePositionalOptions=X._enablePositionalOptions,this._showHelpAfterError=X._showHelpAfterError,this._showSuggestionAfterError=X._showSuggestionAfterError,this}_getCommandAndAncestors(){let X=[];for(let Q=this;Q;Q=Q.parent)X.push(Q);return X}command(X,Q,J){let Y=Q,G=J;if(typeof Y==="object"&&Y!==null)G=Y,Y=null;G=G||{};let[,$,W]=X.match(/([^ ]+) *(.*)/),H=this.createCommand($);if(Y)H.description(Y),H._executableHandler=!0;if(G.isDefault)this._defaultCommandName=H._name;if(H._hidden=!!(G.noHelp||G.hidden),H._executableFile=G.executableFile||null,W)H.arguments(W);if(this._registerCommand(H),H.parent=this,H.copyInheritedSettings(this),Y)return this;return H}createCommand(X){return new KX(X)}createHelp(){return Object.assign(new O$,this.configureHelp())}configureHelp(X){if(X===void 0)return this._helpConfiguration;return this._helpConfiguration=X,this}configureOutput(X){if(X===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...X},this}showHelpAfterError(X=!0){if(typeof X!=="string")X=!!X;return this._showHelpAfterError=X,this}showSuggestionAfterError(X=!0){return this._showSuggestionAfterError=!!X,this}addCommand(X,Q){if(!X._name)throw Error(`Command passed to .addCommand() must have a name
16
+ - specify the name in Command constructor or using .name()`);if(Q=Q||{},Q.isDefault)this._defaultCommandName=X._name;if(Q.noHelp||Q.hidden)X._hidden=!0;return this._registerCommand(X),X.parent=this,X._checkForBrokenPassThrough(),this}createArgument(X,Q){return new D$(X,Q)}argument(X,Q,J,Y){let G=this.createArgument(X,Q);if(typeof J==="function")G.default(Y).argParser(J);else G.default(J);return this.addArgument(G),this}arguments(X){return X.trim().split(/ +/).forEach((Q)=>{this.argument(Q)}),this}addArgument(X){let Q=this.registeredArguments.slice(-1)[0];if(Q?.variadic)throw Error(`only the last argument can be variadic '${Q.name()}'`);if(X.required&&X.defaultValue!==void 0&&X.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${X.name()}'`);return this.registeredArguments.push(X),this}helpCommand(X,Q){if(typeof X==="boolean"){if(this._addImplicitHelpCommand=X,X&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let J=X??"help [command]",[,Y,G]=J.match(/([^ ]+) *(.*)/),$=Q??"display help for command",W=this.createCommand(Y);if(W.helpOption(!1),G)W.arguments(G);if($)W.description($);if(this._addImplicitHelpCommand=!0,this._helpCommand=W,X||Q)this._initCommandGroup(W);return this}addHelpCommand(X,Q){if(typeof X!=="object")return this.helpCommand(X,Q),this;return this._addImplicitHelpCommand=!0,this._helpCommand=X,this._initCommandGroup(X),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(X,Q){let J=["preSubcommand","preAction","postAction"];if(!J.includes(X))throw Error(`Unexpected value for event passed to hook : '${X}'.
17
+ Expecting one of '${J.join("', '")}'`);if(this._lifeCycleHooks[X])this._lifeCycleHooks[X].push(Q);else this._lifeCycleHooks[X]=[Q];return this}exitOverride(X){if(X)this._exitCallback=X;else this._exitCallback=(Q)=>{if(Q.code!=="commander.executeSubCommandAsync")throw Q};return this}_exit(X,Q,J){if(this._exitCallback)this._exitCallback(new qX(X,Q,J));Z0.exit(X)}action(X){let Q=(J)=>{let Y=this.registeredArguments.length,G=J.slice(0,Y);if(this._storeOptionsAsProperties)G[Y]=this;else G[Y]=this.opts();return G.push(this),X.apply(this,G)};return this._actionHandler=Q,this}createOption(X,Q){return new k4(X,Q)}_callParseArg(X,Q,J,Y){try{return X.parseArg(Q,J)}catch(G){if(G.code==="commander.invalidArgument"){let $=`${Y} ${G.message}`;this.error($,{exitCode:G.exitCode,code:G.code})}throw G}}_registerOption(X){let Q=X.short&&this._findOption(X.short)||X.long&&this._findOption(X.long);if(Q){let J=X.long&&this._findOption(X.long)?X.long:X.short;throw Error(`Cannot add option '${X.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${J}'
18
+ - already used by option '${Q.flags}'`)}this._initOptionGroup(X),this.options.push(X)}_registerCommand(X){let Q=(Y)=>{return[Y.name()].concat(Y.aliases())},J=Q(X).find((Y)=>this._findCommand(Y));if(J){let Y=Q(this._findCommand(J)).join("|"),G=Q(X).join("|");throw Error(`cannot add command '${G}' as already have command '${Y}'`)}this._initCommandGroup(X),this.commands.push(X)}addOption(X){this._registerOption(X);let Q=X.name(),J=X.attributeName();if(X.negate){let G=X.long.replace(/^--no-/,"--");if(!this._findOption(G))this.setOptionValueWithSource(J,X.defaultValue===void 0?!0:X.defaultValue,"default")}else if(X.defaultValue!==void 0)this.setOptionValueWithSource(J,X.defaultValue,"default");let Y=(G,$,W)=>{if(G==null&&X.presetArg!==void 0)G=X.presetArg;let H=this.getOptionValue(J);if(G!==null&&X.parseArg)G=this._callParseArg(X,G,H,$);else if(G!==null&&X.variadic)G=X._collectValue(G,H);if(G==null)if(X.negate)G=!1;else if(X.isBoolean()||X.optional)G=!0;else G="";this.setOptionValueWithSource(J,G,W)};if(this.on("option:"+Q,(G)=>{let $=`error: option '${X.flags}' argument '${G}' is invalid.`;Y(G,$,"cli")}),X.envVar)this.on("optionEnv:"+Q,(G)=>{let $=`error: option '${X.flags}' value '${G}' from env '${X.envVar}' is invalid.`;Y(G,$,"env")});return this}_optionEx(X,Q,J,Y,G){if(typeof Q==="object"&&Q instanceof k4)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let $=this.createOption(Q,J);if($.makeOptionMandatory(!!X.mandatory),typeof Y==="function")$.default(G).argParser(Y);else if(Y instanceof RegExp){let W=Y;Y=(H,U)=>{let B=W.exec(H);return B?B[0]:U},$.default(G).argParser(Y)}else $.default(Y);return this.addOption($)}option(X,Q,J,Y){return this._optionEx({},X,Q,J,Y)}requiredOption(X,Q,J,Y){return this._optionEx({mandatory:!0},X,Q,J,Y)}combineFlagAndOptionalValue(X=!0){return this._combineFlagAndOptionalValue=!!X,this}allowUnknownOption(X=!0){return this._allowUnknownOption=!!X,this}allowExcessArguments(X=!0){return this._allowExcessArguments=!!X,this}enablePositionalOptions(X=!0){return this._enablePositionalOptions=!!X,this}passThroughOptions(X=!0){return this._passThroughOptions=!!X,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(X=!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=!!X,this}getOptionValue(X){if(this._storeOptionsAsProperties)return this[X];return this._optionValues[X]}setOptionValue(X,Q){return this.setOptionValueWithSource(X,Q,void 0)}setOptionValueWithSource(X,Q,J){if(this._storeOptionsAsProperties)this[X]=Q;else this._optionValues[X]=Q;return this._optionValueSources[X]=J,this}getOptionValueSource(X){return this._optionValueSources[X]}getOptionValueSourceWithGlobals(X){let Q;return this._getCommandAndAncestors().forEach((J)=>{if(J.getOptionValueSource(X)!==void 0)Q=J.getOptionValueSource(X)}),Q}_prepareUserArgs(X,Q){if(X!==void 0&&!Array.isArray(X))throw Error("first parameter to parse must be array or undefined");if(Q=Q||{},X===void 0&&Q.from===void 0){if(Z0.versions?.electron)Q.from="electron";let Y=Z0.execArgv??[];if(Y.includes("-e")||Y.includes("--eval")||Y.includes("-p")||Y.includes("--print"))Q.from="eval"}if(X===void 0)X=Z0.argv;this.rawArgs=X.slice();let J;switch(Q.from){case void 0:case"node":this._scriptPath=X[1],J=X.slice(2);break;case"electron":if(Z0.defaultApp)this._scriptPath=X[1],J=X.slice(2);else J=X.slice(1);break;case"user":J=X.slice(0);break;case"eval":J=X.slice(1);break;default:throw Error(`unexpected parse option { from: '${Q.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",J}parse(X,Q){this._prepareForParse();let J=this._prepareUserArgs(X,Q);return this._parseCommand([],J),this}async parseAsync(X,Q){this._prepareForParse();let J=this._prepareUserArgs(X,Q);return await this._parseCommand([],J),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
19
+ - 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(X,Q,J){if(y8.existsSync(X))return;let Y=Q?`searched for local subcommand relative to directory '${Q}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",G=`'${X}' does not exist
20
20
  - if '${J}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
21
21
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
22
- - ${Z}`;throw Error(z)}_executeSubCommand($,X){X=X.slice();let J=!1,Z=[".js",".ts",".tsx",".mjs",".cjs"];function z(V,q){let N=l.resolve(V,q);if(L0.existsSync(N))return N;if(Z.includes(l.extname(q)))return;let w=Z.find((T)=>L0.existsSync(`${N}${T}`));if(w)return`${N}${w}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Y=$._executableFile||`${this._name}-${$._name}`,W=this._executableDir||"";if(this._scriptPath){let V;try{V=L0.realpathSync(this._scriptPath)}catch{V=this._scriptPath}W=l.resolve(l.dirname(V),W)}if(W){let V=z(W,Y);if(!V&&!$._executableFile&&this._scriptPath){let q=l.basename(this._scriptPath,l.extname(this._scriptPath));if(q!==this._name)V=z(W,`${q}-${$._name}`)}Y=V||Y}J=Z.includes(l.extname(Y));let Q;if(L.platform!=="win32")if(J)X.unshift(Y),X=r1(L.execArgv).concat(X),Q=s0.spawn(L.argv[0],X,{stdio:"inherit"});else Q=s0.spawn(Y,X,{stdio:"inherit"});else this._checkForMissingExecutable(Y,W,$._name),X.unshift(Y),X=r1(L.execArgv).concat(X),Q=s0.spawn(L.execPath,X,{stdio:"inherit"});if(!Q.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((q)=>{L.on(q,()=>{if(Q.killed===!1&&Q.exitCode===null)Q.kill(q)})});let G=this._exitCallback;Q.on("close",(V)=>{if(V=V??1,!G)L.exit(V);else G(new r0(V,"commander.executeSubCommandAsync","(close)"))}),Q.on("error",(V)=>{if(V.code==="ENOENT")this._checkForMissingExecutable(Y,W,$._name);else if(V.code==="EACCES")throw Error(`'${Y}' not executable`);if(!G)L.exit(1);else{let q=new r0(1,"commander.executeSubCommandAsync","(error)");q.nestedError=V,G(q)}}),this.runningCommand=Q}_dispatchSubcommand($,X,J){let Z=this._findCommand($);if(!Z)this.help({error:!0});Z._prepareForParse();let z;return z=this._chainOrCallSubCommandHook(z,Z,"preSubcommand"),z=this._chainOrCall(z,()=>{if(Z._executableHandler)this._executeSubCommand(Z,X.concat(J));else return Z._parseCommand(X,J)}),z}_dispatchHelpCommand($){if(!$)this.help();let X=this._findCommand($);if(X&&!X._executableHandler)X.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,X)=>{if($.required&&this.args[X]==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 $=(J,Z,z)=>{let Y=Z;if(Z!==null&&J.parseArg){let W=`error: command-argument value '${Z}' is invalid for argument '${J.name()}'.`;Y=this._callParseArg(J,Z,z,W)}return Y};this._checkNumberOfArguments();let X=[];this.registeredArguments.forEach((J,Z)=>{let z=J.defaultValue;if(J.variadic){if(Z<this.args.length){if(z=this.args.slice(Z),J.parseArg)z=z.reduce((Y,W)=>{return $(J,W,Y)},J.defaultValue)}else if(z===void 0)z=[]}else if(Z<this.args.length){if(z=this.args[Z],J.parseArg)z=$(J,z,J.defaultValue)}X[Z]=z}),this.processedArgs=X}_chainOrCall($,X){if($?.then&&typeof $.then==="function")return $.then(()=>X());return X()}_chainOrCallHooks($,X){let J=$,Z=[];if(this._getCommandAndAncestors().reverse().filter((z)=>z._lifeCycleHooks[X]!==void 0).forEach((z)=>{z._lifeCycleHooks[X].forEach((Y)=>{Z.push({hookedCommand:z,callback:Y})})}),X==="postAction")Z.reverse();return Z.forEach((z)=>{J=this._chainOrCall(J,()=>{return z.callback(z.hookedCommand,this)})}),J}_chainOrCallSubCommandHook($,X,J){let Z=$;if(this._lifeCycleHooks[J]!==void 0)this._lifeCycleHooks[J].forEach((z)=>{Z=this._chainOrCall(Z,()=>{return z(this,X)})});return Z}_parseCommand($,X){let J=this.parseOptions(X);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(J.operands),X=J.unknown,this.args=$.concat(X),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),X);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(X),this._dispatchSubcommand(this._defaultCommandName,$,X);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(J.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Z=()=>{if(J.unknown.length>0)this.unknownOption(J.unknown[0])},z=`command:${this.name()}`;if(this._actionHandler){Z(),this._processArguments();let Y;if(Y=this._chainOrCallHooks(Y,"preAction"),Y=this._chainOrCall(Y,()=>this._actionHandler(this.processedArgs)),this.parent)Y=this._chainOrCall(Y,()=>{this.parent.emit(z,$,X)});return Y=this._chainOrCallHooks(Y,"postAction"),Y}if(this.parent?.listenerCount(z))Z(),this._processArguments(),this.parent.emit(z,$,X);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,X);if(this.listenerCount("command:*"))this.emit("command:*",$,X);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((X)=>X._name===$||X._aliases.includes($))}_findOption($){return this.options.find((X)=>X.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((X)=>{if(X.mandatory&&$.getOptionValue(X.attributeName())===void 0)$.missingMandatoryOptionValue(X)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((J)=>{let Z=J.attributeName();if(this.getOptionValue(Z)===void 0)return!1;return this.getOptionValueSource(Z)!=="default"});$.filter((J)=>J.conflictsWith.length>0).forEach((J)=>{let Z=$.find((z)=>J.conflictsWith.includes(z.attributeName()));if(Z)this._conflictingOption(J,Z)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let X=[],J=[],Z=X;function z(V){return V.length>1&&V[0]==="-"}let Y=(V)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(V))return!1;return!this._getCommandAndAncestors().some((q)=>q.options.map((N)=>N.short).some((N)=>/^-\d$/.test(N)))},W=null,Q=null,G=0;while(G<$.length||Q){let V=Q??$[G++];if(Q=null,V==="--"){if(Z===J)Z.push(V);Z.push(...$.slice(G));break}if(W&&(!z(V)||Y(V))){this.emit(`option:${W.name()}`,V);continue}if(W=null,z(V)){let q=this._findOption(V);if(q){if(q.required){let N=$[G++];if(N===void 0)this.optionMissingArgument(q);this.emit(`option:${q.name()}`,N)}else if(q.optional){let N=null;if(G<$.length&&(!z($[G])||Y($[G])))N=$[G++];this.emit(`option:${q.name()}`,N)}else this.emit(`option:${q.name()}`);W=q.variadic?q:null;continue}}if(V.length>2&&V[0]==="-"&&V[1]!=="-"){let q=this._findOption(`-${V[1]}`);if(q){if(q.required||q.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${q.name()}`,V.slice(2));else this.emit(`option:${q.name()}`),Q=`-${V.slice(2)}`;continue}}if(/^--[^=]+=/.test(V)){let q=V.indexOf("="),N=this._findOption(V.slice(0,q));if(N&&(N.required||N.optional)){this.emit(`option:${N.name()}`,V.slice(q+1));continue}}if(Z===X&&z(V)&&!(this.commands.length===0&&Y(V)))Z=J;if((this._enablePositionalOptions||this._passThroughOptions)&&X.length===0&&J.length===0){if(this._findCommand(V)){X.push(V),J.push(...$.slice(G));break}else if(this._getHelpCommand()&&V===this._getHelpCommand().name()){X.push(V,...$.slice(G));break}else if(this._defaultCommandName){J.push(V,...$.slice(G));break}}if(this._passThroughOptions){Z.push(V,...$.slice(G));break}Z.push(V)}return{operands:X,unknown:J}}opts(){if(this._storeOptionsAsProperties){let $={},X=this.options.length;for(let J=0;J<X;J++){let Z=this.options[J].attributeName();$[Z]=Z===this._versionOptionName?this._version:this[Z]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,X)=>Object.assign($,X.opts()),{})}error($,X){if(this._outputConfiguration.outputError(`${$}
22
+ - ${Y}`;throw Error(G)}_executeSubCommand(X,Q){Q=Q.slice();let J=!1,Y=[".js",".ts",".tsx",".mjs",".cjs"];function G(B,q){let K=A1.resolve(B,q);if(y8.existsSync(K))return K;if(Y.includes(A1.extname(q)))return;let V=Y.find((N)=>y8.existsSync(`${K}${N}`));if(V)return`${K}${V}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let $=X._executableFile||`${this._name}-${X._name}`,W=this._executableDir||"";if(this._scriptPath){let B;try{B=y8.realpathSync(this._scriptPath)}catch{B=this._scriptPath}W=A1.resolve(A1.dirname(B),W)}if(W){let B=G(W,$);if(!B&&!X._executableFile&&this._scriptPath){let q=A1.basename(this._scriptPath,A1.extname(this._scriptPath));if(q!==this._name)B=G(W,`${q}-${X._name}`)}$=B||$}J=Y.includes(A1.extname($));let H;if(Z0.platform!=="win32")if(J)Q.unshift($),Q=y4(Z0.execArgv).concat(Q),H=LX.spawn(Z0.argv[0],Q,{stdio:"inherit"});else H=LX.spawn($,Q,{stdio:"inherit"});else this._checkForMissingExecutable($,W,X._name),Q.unshift($),Q=y4(Z0.execArgv).concat(Q),H=LX.spawn(Z0.execPath,Q,{stdio:"inherit"});if(!H.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((q)=>{Z0.on(q,()=>{if(H.killed===!1&&H.exitCode===null)H.kill(q)})});let U=this._exitCallback;H.on("close",(B)=>{if(B=B??1,!U)Z0.exit(B);else U(new qX(B,"commander.executeSubCommandAsync","(close)"))}),H.on("error",(B)=>{if(B.code==="ENOENT")this._checkForMissingExecutable($,W,X._name);else if(B.code==="EACCES")throw Error(`'${$}' not executable`);if(!U)Z0.exit(1);else{let q=new qX(1,"commander.executeSubCommandAsync","(error)");q.nestedError=B,U(q)}}),this.runningCommand=H}_dispatchSubcommand(X,Q,J){let Y=this._findCommand(X);if(!Y)this.help({error:!0});Y._prepareForParse();let G;return G=this._chainOrCallSubCommandHook(G,Y,"preSubcommand"),G=this._chainOrCall(G,()=>{if(Y._executableHandler)this._executeSubCommand(Y,Q.concat(J));else return Y._parseCommand(Q,J)}),G}_dispatchHelpCommand(X){if(!X)this.help();let Q=this._findCommand(X);if(Q&&!Q._executableHandler)Q.help();return this._dispatchSubcommand(X,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((X,Q)=>{if(X.required&&this.args[Q]==null)this.missingArgument(X.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=(J,Y,G)=>{let $=Y;if(Y!==null&&J.parseArg){let W=`error: command-argument value '${Y}' is invalid for argument '${J.name()}'.`;$=this._callParseArg(J,Y,G,W)}return $};this._checkNumberOfArguments();let Q=[];this.registeredArguments.forEach((J,Y)=>{let G=J.defaultValue;if(J.variadic){if(Y<this.args.length){if(G=this.args.slice(Y),J.parseArg)G=G.reduce(($,W)=>{return X(J,W,$)},J.defaultValue)}else if(G===void 0)G=[]}else if(Y<this.args.length){if(G=this.args[Y],J.parseArg)G=X(J,G,J.defaultValue)}Q[Y]=G}),this.processedArgs=Q}_chainOrCall(X,Q){if(X?.then&&typeof X.then==="function")return X.then(()=>Q());return Q()}_chainOrCallHooks(X,Q){let J=X,Y=[];if(this._getCommandAndAncestors().reverse().filter((G)=>G._lifeCycleHooks[Q]!==void 0).forEach((G)=>{G._lifeCycleHooks[Q].forEach(($)=>{Y.push({hookedCommand:G,callback:$})})}),Q==="postAction")Y.reverse();return Y.forEach((G)=>{J=this._chainOrCall(J,()=>{return G.callback(G.hookedCommand,this)})}),J}_chainOrCallSubCommandHook(X,Q,J){let Y=X;if(this._lifeCycleHooks[J]!==void 0)this._lifeCycleHooks[J].forEach((G)=>{Y=this._chainOrCall(Y,()=>{return G(this,Q)})});return Y}_parseCommand(X,Q){let J=this.parseOptions(Q);if(this._parseOptionsEnv(),this._parseOptionsImplied(),X=X.concat(J.operands),Q=J.unknown,this.args=X.concat(Q),X&&this._findCommand(X[0]))return this._dispatchSubcommand(X[0],X.slice(1),Q);if(this._getHelpCommand()&&X[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(X[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(Q),this._dispatchSubcommand(this._defaultCommandName,X,Q);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(J.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Y=()=>{if(J.unknown.length>0)this.unknownOption(J.unknown[0])},G=`command:${this.name()}`;if(this._actionHandler){Y(),this._processArguments();let $;if($=this._chainOrCallHooks($,"preAction"),$=this._chainOrCall($,()=>this._actionHandler(this.processedArgs)),this.parent)$=this._chainOrCall($,()=>{this.parent.emit(G,X,Q)});return $=this._chainOrCallHooks($,"postAction"),$}if(this.parent?.listenerCount(G))Y(),this._processArguments(),this.parent.emit(G,X,Q);else if(X.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",X,Q);if(this.listenerCount("command:*"))this.emit("command:*",X,Q);else if(this.commands.length)this.unknownCommand();else Y(),this._processArguments()}else if(this.commands.length)Y(),this.help({error:!0});else Y(),this._processArguments()}_findCommand(X){if(!X)return;return this.commands.find((Q)=>Q._name===X||Q._aliases.includes(X))}_findOption(X){return this.options.find((Q)=>Q.is(X))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((X)=>{X.options.forEach((Q)=>{if(Q.mandatory&&X.getOptionValue(Q.attributeName())===void 0)X.missingMandatoryOptionValue(Q)})})}_checkForConflictingLocalOptions(){let X=this.options.filter((J)=>{let Y=J.attributeName();if(this.getOptionValue(Y)===void 0)return!1;return this.getOptionValueSource(Y)!=="default"});X.filter((J)=>J.conflictsWith.length>0).forEach((J)=>{let Y=X.find((G)=>J.conflictsWith.includes(G.attributeName()));if(Y)this._conflictingOption(J,Y)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((X)=>{X._checkForConflictingLocalOptions()})}parseOptions(X){let Q=[],J=[],Y=Q;function G(B){return B.length>1&&B[0]==="-"}let $=(B)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(B))return!1;return!this._getCommandAndAncestors().some((q)=>q.options.map((K)=>K.short).some((K)=>/^-\d$/.test(K)))},W=null,H=null,U=0;while(U<X.length||H){let B=H??X[U++];if(H=null,B==="--"){if(Y===J)Y.push(B);Y.push(...X.slice(U));break}if(W&&(!G(B)||$(B))){this.emit(`option:${W.name()}`,B);continue}if(W=null,G(B)){let q=this._findOption(B);if(q){if(q.required){let K=X[U++];if(K===void 0)this.optionMissingArgument(q);this.emit(`option:${q.name()}`,K)}else if(q.optional){let K=null;if(U<X.length&&(!G(X[U])||$(X[U])))K=X[U++];this.emit(`option:${q.name()}`,K)}else this.emit(`option:${q.name()}`);W=q.variadic?q:null;continue}}if(B.length>2&&B[0]==="-"&&B[1]!=="-"){let q=this._findOption(`-${B[1]}`);if(q){if(q.required||q.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${q.name()}`,B.slice(2));else this.emit(`option:${q.name()}`),H=`-${B.slice(2)}`;continue}}if(/^--[^=]+=/.test(B)){let q=B.indexOf("="),K=this._findOption(B.slice(0,q));if(K&&(K.required||K.optional)){this.emit(`option:${K.name()}`,B.slice(q+1));continue}}if(Y===Q&&G(B)&&!(this.commands.length===0&&$(B)))Y=J;if((this._enablePositionalOptions||this._passThroughOptions)&&Q.length===0&&J.length===0){if(this._findCommand(B)){Q.push(B),J.push(...X.slice(U));break}else if(this._getHelpCommand()&&B===this._getHelpCommand().name()){Q.push(B,...X.slice(U));break}else if(this._defaultCommandName){J.push(B,...X.slice(U));break}}if(this._passThroughOptions){Y.push(B,...X.slice(U));break}Y.push(B)}return{operands:Q,unknown:J}}opts(){if(this._storeOptionsAsProperties){let X={},Q=this.options.length;for(let J=0;J<Q;J++){let Y=this.options[J].attributeName();X[Y]=Y===this._versionOptionName?this._version:this[Y]}return X}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((X,Q)=>Object.assign(X,Q.opts()),{})}error(X,Q){if(this._outputConfiguration.outputError(`${X}
23
23
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
24
24
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
25
- `),this.outputHelp({error:!0});let J=X||{},Z=J.exitCode||1,z=J.code||"commander.error";this._exit(Z,z,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in L.env){let X=$.attributeName();if(this.getOptionValue(X)===void 0||["default","config","env"].includes(this.getOptionValueSource(X)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,L.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new u4(this.options),X=(J)=>{return this.getOptionValue(J)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(J))};this.options.filter((J)=>J.implied!==void 0&&X(J.attributeName())&&$.valueFromOption(this.getOptionValue(J.attributeName()),J)).forEach((J)=>{Object.keys(J.implied).filter((Z)=>!X(Z)).forEach((Z)=>{this.setOptionValueWithSource(Z,J.implied[Z],"implied")})})}missingArgument($){let X=`error: missing required argument '${$}'`;this.error(X,{code:"commander.missingArgument"})}optionMissingArgument($){let X=`error: option '${$.flags}' argument missing`;this.error(X,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let X=`error: required option '${$.flags}' not specified`;this.error(X,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,X){let J=(Y)=>{let W=Y.attributeName(),Q=this.getOptionValue(W),G=this.options.find((q)=>q.negate&&W===q.attributeName()),V=this.options.find((q)=>!q.negate&&W===q.attributeName());if(G&&(G.presetArg===void 0&&Q===!1||G.presetArg!==void 0&&Q===G.presetArg))return G;return V||Y},Z=(Y)=>{let W=J(Y),Q=W.attributeName();if(this.getOptionValueSource(Q)==="env")return`environment variable '${W.envVar}'`;return`option '${W.flags}'`},z=`error: ${Z($)} cannot be used with ${Z(X)}`;this.error(z,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let X="";if($.startsWith("--")&&this._showSuggestionAfterError){let Z=[],z=this;do{let Y=z.createHelp().visibleOptions(z).filter((W)=>W.long).map((W)=>W.long);Z=Z.concat(Y),z=z.parent}while(z&&!z._enablePositionalOptions);X=s1($,Z)}let J=`error: unknown option '${$}'${X}`;this.error(J,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let X=this.registeredArguments.length,J=X===1?"":"s",z=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${X} argument${J} but got ${$.length}.`;this.error(z,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],X="";if(this._showSuggestionAfterError){let Z=[];this.createHelp().visibleCommands(this).forEach((z)=>{if(Z.push(z.name()),z.alias())Z.push(z.alias())}),X=s1($,Z)}let J=`error: unknown command '${$}'${X}`;this.error(J,{code:"commander.unknownCommand"})}version($,X,J){if($===void 0)return this._version;this._version=$,X=X||"-V, --version",J=J||"output the version number";let Z=this.createOption(X,J);return this._versionOptionName=Z.attributeName(),this._registerOption(Z),this.on("option:"+Z.name(),()=>{this._outputConfiguration.writeOut(`${$}
26
- `),this._exit(0,"commander.version",$)}),this}description($,X){if($===void 0&&X===void 0)return this._description;if(this._description=$,X)this._argsDescription=X;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let X=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)X=this.commands[this.commands.length-1];if($===X._name)throw Error("Command alias can't be the same as its name");let J=this.parent?._findCommand($);if(J){let Z=[J.name()].concat(J.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${Z}'`)}return X._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((X)=>this.alias(X)),this}usage($){if($===void 0){if(this._usage)return this._usage;let X=this.registeredArguments.map((J)=>{return v4(J)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?X:[]).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=l.basename($,l.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let X=this.createHelp(),J=this._getOutputContext($);X.prepareContext({error:J.error,helpWidth:J.helpWidth,outputHasColors:J.hasColors});let Z=X.formatHelp(this,X);if(J.hasColors)return Z;return this._outputConfiguration.stripColor(Z)}_getOutputContext($){$=$||{};let X=!!$.error,J,Z,z;if(X)J=(W)=>this._outputConfiguration.writeErr(W),Z=this._outputConfiguration.getErrHasColors(),z=this._outputConfiguration.getErrHelpWidth();else J=(W)=>this._outputConfiguration.writeOut(W),Z=this._outputConfiguration.getOutHasColors(),z=this._outputConfiguration.getOutHelpWidth();return{error:X,write:(W)=>{if(!Z)W=this._outputConfiguration.stripColor(W);return J(W)},hasColors:Z,helpWidth:z}}outputHelp($){let X;if(typeof $==="function")X=$,$=void 0;let J=this._getOutputContext($),Z={error:J.error,write:J.write,command:this};this._getCommandAndAncestors().reverse().forEach((Y)=>Y.emit("beforeAllHelp",Z)),this.emit("beforeHelp",Z);let z=this.helpInformation({error:J.error});if(X){if(z=X(z),typeof z!=="string"&&!Buffer.isBuffer(z))throw Error("outputHelp callback must return a string or a Buffer")}if(J.write(z),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",Z),this._getCommandAndAncestors().forEach((Y)=>Y.emit("afterAllHelp",Z))}helpOption($,X){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",X??"display help for command"),$||X)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 X=Number(L.exitCode??0);if(X===0&&$&&typeof $!=="function"&&$.error)X=1;this._exit(X,"commander.help","(outputHelp)")}addHelpText($,X){let J=["beforeAll","before","after","afterAll"];if(!J.includes($))throw Error(`Unexpected value for position to addHelpText.
27
- Expecting one of '${J.join("', '")}'`);let Z=`${$}Help`;return this.on(Z,(z)=>{let Y;if(typeof X==="function")Y=X({error:z.error,command:z.command});else Y=X;if(Y)z.write(`${Y}
28
- `)}),this}_outputHelpIfRequested($){let X=this._getHelpOption();if(X&&$.find((Z)=>X.is(Z)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function r1($){return $.map((X)=>{if(!X.startsWith("--inspect"))return X;let J,Z="127.0.0.1",z="9229",Y;if((Y=X.match(/^(--inspect(-brk)?)$/))!==null)J=Y[1];else if((Y=X.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(J=Y[1],/^\d+$/.test(Y[3]))z=Y[3];else Z=Y[3];else if((Y=X.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)J=Y[1],Z=Y[3],z=Y[4];if(J&&z!=="0")return`${J}=${Z}:${parseInt(z)+1}`;return X})}function e0(){if(L.env.NO_COLOR||L.env.FORCE_COLOR==="0"||L.env.FORCE_COLOR==="false")return!1;if(L.env.FORCE_COLOR||L.env.CLICOLOR_FORCE!==void 0)return!0;return}m4.Command=$1;m4.useColor=e0});var Z5=J$((n4)=>{var{Argument:$5}=T0(),{Command:X1}=e1(),{CommanderError:l4,InvalidArgumentError:X5}=j$(),{Help:i4}=a0(),{Option:J5}=t0();n4.program=new X1;n4.createCommand=($)=>new X1($);n4.createOption=($,X)=>new J5($,X);n4.createArgument=($,X)=>new $5($,X);n4.Command=X1;n4.Option=J5;n4.Argument=$5;n4.Help=i4;n4.CommanderError=l4;n4.InvalidArgumentError=X5;n4.InvalidOptionArgumentError=X5});var z5=N4(Z5(),1),{program:D0,createCommand:w8,createArgument:M8,createOption:T8,CommanderError:L8,InvalidArgumentError:D8,InvalidOptionArgumentError:E8,Command:B8,Argument:S8,Option:j8,Help:I8}=z5.default;function U($,X,J,Z,z){if(Z==="m")throw TypeError("Private method is not writable");if(Z==="a"&&!z)throw TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!z:!X.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return Z==="a"?z.call($,J):z?z.value=J:X.set($,J),J}function K($,X,J,Z){if(J==="a"&&!Z)throw TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!Z:!X.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return J==="m"?Z:J==="a"?Z.call($):Z?Z.value:X.get($)}var J1=function(){let{crypto:$}=globalThis;if($?.randomUUID)return J1=$.randomUUID.bind($),$.randomUUID();let X=new Uint8Array(1),J=$?()=>$.getRandomValues(X)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(Z)=>(+Z^J()&15>>+Z/4).toString(16))};function i($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var I$=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let X=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)X.stack=$.stack;if($.cause&&!X.cause)X.cause=$.cause;if($.name)X.name=$.name;return X}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};class H extends Error{}class F extends H{constructor($,X,J,Z){super(`${F.makeMessage($,X,J)}`);this.status=$,this.headers=Z,this.requestID=Z?.get("request-id"),this.error=X}static makeMessage($,X,J){let Z=X?.message?typeof X.message==="string"?X.message:JSON.stringify(X.message):X?JSON.stringify(X):J;if($&&Z)return`${$} ${Z}`;if($)return`${$} status code (no body)`;if(Z)return Z;return"(no status code or body)"}static generate($,X,J,Z){if(!$||!Z)return new Z$({message:J,cause:I$(X)});let z=X;if($===400)return new x$($,z,J,Z);if($===401)return new O$($,z,J,Z);if($===403)return new P$($,z,J,Z);if($===404)return new C$($,z,J,Z);if($===409)return new A$($,z,J,Z);if($===422)return new R$($,z,J,Z);if($===429)return new f$($,z,J,Z);if($>=500)return new k$($,z,J,Z);return new F($,z,J,Z)}}class C extends F{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}}class Z$ extends F{constructor({message:$,cause:X}){super(void 0,void 0,$||"Connection error.",void 0);if(X)this.cause=X}}class F$ extends Z${constructor({message:$}={}){super({message:$??"Request timed out."})}}class x$ extends F{}class O$ extends F{}class P$ extends F{}class C$ extends F{}class A$ extends F{}class R$ extends F{}class f$ extends F{}class k$ extends F{}var WX=/^[a-z][a-z0-9+.-]*:/i,Y5=($)=>{return WX.test($)},Z1=($)=>(Z1=Array.isArray,Z1($)),z1=Z1;function E0($){if(typeof $!=="object")return{};return $??{}}function W5($){if(!$)return!0;for(let X in $)return!1;return!0}function Q5($,X){return Object.prototype.hasOwnProperty.call($,X)}var K5=($,X)=>{if(typeof X!=="number"||!Number.isInteger(X))throw new H(`${$} must be an integer`);if(X<0)throw new H(`${$} must be a positive integer`);return X};var B0=($)=>{try{return JSON.parse($)}catch(X){return}};var G5=($)=>new Promise((X)=>setTimeout(X,$));var s="0.71.2";var N5=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"};function QX(){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"}var KX=()=>{let $=QX();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":s,"X-Stainless-OS":q5(Deno.build.os),"X-Stainless-Arch":V5(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":s,"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":s,"X-Stainless-OS":q5(globalThis.process.platform??"unknown"),"X-Stainless-Arch":V5(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let X=GX();if(X)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":s,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${X.browser}`,"X-Stainless-Runtime-Version":X.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":s,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function GX(){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:X,pattern:J}of $){let Z=J.exec(navigator.userAgent);if(Z){let z=Z[1]||0,Y=Z[2]||0,W=Z[3]||0;return{browser:X,version:`${z}.${Y}.${W}`}}}return null}var V5=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},q5=($)=>{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"},U5,H5=()=>{return U5??(U5=KX())};function w5(){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 Y1(...$){let X=globalThis.ReadableStream;if(typeof X>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new X(...$)}function S0($){let X=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return Y1({start(){},async pull(J){let{done:Z,value:z}=await X.next();if(Z)J.close();else J.enqueue(z)},async cancel(){await X.return?.()}})}function y$($){if($[Symbol.asyncIterator])return $;let X=$.getReader();return{async next(){try{let J=await X.read();if(J?.done)X.releaseLock();return J}catch(J){throw X.releaseLock(),J}},async return(){let J=X.cancel();return X.releaseLock(),await J,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function M5($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let X=$.getReader(),J=X.cancel();X.releaseLock(),await J}var T5=({headers:$,body:X})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(X)}};function E5($){let X=0;for(let z of $)X+=z.length;let J=new Uint8Array(X),Z=0;for(let z of $)J.set(z,Z),Z+=z.length;return J}var L5;function _$($){let X;return(L5??(X=new globalThis.TextEncoder,L5=X.encode.bind(X)))($)}var D5;function W1($){let X;return(D5??(X=new globalThis.TextDecoder,D5=X.decode.bind(X)))($)}var f,k;class r{constructor(){f.set(this,void 0),k.set(this,void 0),U(this,f,new Uint8Array,"f"),U(this,k,null,"f")}decode($){if($==null)return[];let X=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?_$($):$;U(this,f,E5([K(this,f,"f"),X]),"f");let J=[],Z;while((Z=UX(K(this,f,"f"),K(this,k,"f")))!=null){if(Z.carriage&&K(this,k,"f")==null){U(this,k,Z.index,"f");continue}if(K(this,k,"f")!=null&&(Z.index!==K(this,k,"f")+1||Z.carriage)){J.push(W1(K(this,f,"f").subarray(0,K(this,k,"f")-1))),U(this,f,K(this,f,"f").subarray(K(this,k,"f")),"f"),U(this,k,null,"f");continue}let z=K(this,k,"f")!==null?Z.preceding-1:Z.preceding,Y=W1(K(this,f,"f").subarray(0,z));J.push(Y),U(this,f,K(this,f,"f").subarray(Z.index),"f"),U(this,k,null,"f")}return J}flush(){if(!K(this,f,"f").length)return[];return this.decode(`
29
- `)}}f=new WeakMap,k=new WeakMap;r.NEWLINE_CHARS=new Set([`
30
- `,"\r"]);r.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function UX($,X){for(let z=X??0;z<$.length;z++){if($[z]===10)return{preceding:z,index:z+1,carriage:!1};if($[z]===13)return{preceding:z,index:z+1,carriage:!0}}return null}function B5($){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 I0={off:0,error:200,warn:300,info:400,debug:500},Q1=($,X,J)=>{if(!$)return;if(Q5(I0,$))return $;O(J).warn(`${X} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(I0))}`);return};function b$(){}function j0($,X,J){if(!X||I0[$]>I0[J])return b$;else return X[$].bind(X)}var NX={error:b$,warn:b$,info:b$,debug:b$},S5=new WeakMap;function O($){let X=$.logger,J=$.logLevel??"off";if(!X)return NX;let Z=S5.get(X);if(Z&&Z[0]===J)return Z[1];let z={error:j0("error",X,J),warn:j0("warn",X,J),info:j0("info",X,J),debug:j0("debug",X,J)};return S5.set(X,[J,z]),z}var n=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([X,J])=>[X,X.toLowerCase()==="x-api-key"||X.toLowerCase()==="authorization"||X.toLowerCase()==="cookie"||X.toLowerCase()==="set-cookie"?"***":J]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var h$;class y{constructor($,X,J){this.iterator=$,h$.set(this,void 0),this.controller=X,U(this,h$,J,"f")}static fromSSEResponse($,X,J){let Z=!1,z=J?O(J):console;async function*Y(){if(Z)throw new H("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Z=!0;let W=!1;try{for await(let Q of HX($,X)){if(Q.event==="completion")try{yield JSON.parse(Q.data)}catch(G){throw z.error("Could not parse message into JSON:",Q.data),z.error("From chunk:",Q.raw),G}if(Q.event==="message_start"||Q.event==="message_delta"||Q.event==="message_stop"||Q.event==="content_block_start"||Q.event==="content_block_delta"||Q.event==="content_block_stop")try{yield JSON.parse(Q.data)}catch(G){throw z.error("Could not parse message into JSON:",Q.data),z.error("From chunk:",Q.raw),G}if(Q.event==="ping")continue;if(Q.event==="error")throw new F(void 0,B0(Q.data)??Q.data,void 0,$.headers)}W=!0}catch(Q){if(i(Q))return;throw Q}finally{if(!W)X.abort()}}return new y(Y,X,J)}static fromReadableStream($,X,J){let Z=!1;async function*z(){let W=new r,Q=y$($);for await(let G of Q)for(let V of W.decode(G))yield V;for(let G of W.flush())yield G}async function*Y(){if(Z)throw new H("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Z=!0;let W=!1;try{for await(let Q of z()){if(W)continue;if(Q)yield JSON.parse(Q)}W=!0}catch(Q){if(i(Q))return;throw Q}finally{if(!W)X.abort()}}return new y(Y,X,J)}[(h$=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],X=[],J=this.iterator(),Z=(z)=>{return{next:()=>{if(z.length===0){let Y=J.next();$.push(Y),X.push(Y)}return z.shift()}}};return[new y(()=>Z($),this.controller,K(this,h$,"f")),new y(()=>Z(X),this.controller,K(this,h$,"f"))]}toReadableStream(){let $=this,X;return Y1({async start(){X=$[Symbol.asyncIterator]()},async pull(J){try{let{value:Z,done:z}=await X.next();if(z)return J.close();let Y=_$(JSON.stringify(Z)+`
31
- `);J.enqueue(Y)}catch(Z){J.error(Z)}},async cancel(){await X.return?.()}})}}async function*HX($,X){if(!$.body){if(X.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new H("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 H("Attempted to iterate over a response with no body")}let J=new j5,Z=new r,z=y$($.body);for await(let Y of wX(z))for(let W of Z.decode(Y)){let Q=J.decode(W);if(Q)yield Q}for(let Y of Z.flush()){let W=J.decode(Y);if(W)yield W}}async function*wX($){let X=new Uint8Array;for await(let J of $){if(J==null)continue;let Z=J instanceof ArrayBuffer?new Uint8Array(J):typeof J==="string"?_$(J):J,z=new Uint8Array(X.length+Z.length);z.set(X),z.set(Z,X.length),X=z;let Y;while((Y=B5(X))!==-1)yield X.slice(0,Y),X=X.slice(Y)}if(X.length>0)yield X}class j5{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 z={event:this.event,data:this.data.join(`
32
- `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],z}if(this.chunks.push($),$.startsWith(":"))return null;let[X,J,Z]=MX($,":");if(Z.startsWith(" "))Z=Z.substring(1);if(X==="event")this.event=Z;else if(X==="data")this.data.push(Z);return null}}function MX($,X){let J=$.indexOf(X);if(J!==-1)return[$.substring(0,J),X,$.substring(J+X.length)];return[$,"",""]}async function F0($,X){let{response:J,requestLogID:Z,retryOfRequestLogID:z,startTime:Y}=X,W=await(async()=>{if(X.options.stream){if(O($).debug("response",J.status,J.url,J.headers,J.body),X.options.__streamClass)return X.options.__streamClass.fromSSEResponse(J,X.controller);return y.fromSSEResponse(J,X.controller)}if(J.status===204)return null;if(X.options.__binaryResponse)return J;let G=J.headers.get("content-type")?.split(";")[0]?.trim();if(G?.includes("application/json")||G?.endsWith("+json")){let N=await J.json();return K1(N,J)}return await J.text()})();return O($).debug(`[${Z}] response parsed`,n({retryOfRequestLogID:z,url:J.url,status:J.status,body:W,durationMs:Date.now()-Y})),W}function K1($,X){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:X.headers.get("request-id"),enumerable:!1})}var v$;class z$ extends Promise{constructor($,X,J=F0){super((Z)=>{Z(null)});this.responsePromise=X,this.parseResponse=J,v$.set(this,void 0),U(this,v$,$,"f")}_thenUnwrap($){return new z$(K(this,v$,"f"),this.responsePromise,async(X,J)=>K1($(await this.parseResponse(X,J),J),J.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,X]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:X,request_id:X.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(($)=>this.parseResponse(K(this,v$,"f"),$));return this.parsedPromise}then($,X){return this.parse().then($,X)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}}v$=new WeakMap;var x0;class G1{constructor($,X,J,Z){x0.set(this,void 0),U(this,x0,$,"f"),this.options=Z,this.response=X,this.body=J}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new H("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await K(this,x0,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(x0=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let X of $.getPaginatedItems())yield X}}class O0 extends z${constructor($,X,J){super($,X,async(Z,z)=>new J(Z,z.response,await F0(Z,z),z.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let X of $)yield X}}class u extends G1{constructor($,X,J,Z){super($,X,J,Z);this.data=J.data||[],this.has_more=J.has_more||!1,this.first_id=J.first_id||null,this.last_id=J.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 X=this.first_id;if(!X)return null;return{...this.options,query:{...E0(this.options.query),before_id:X}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...E0(this.options.query),after_id:$}}}}class g$ extends G1{constructor($,X,J,Z){super($,X,J,Z);this.data=J.data||[],this.has_more=J.has_more||!1,this.next_page=J.next_page||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let $=this.next_page;if(!$)return null;return{...this.options,query:{...E0(this.options.query),page:$}}}}var q1=()=>{if(typeof File>"u"){let{process:$}=globalThis,X=typeof $?.versions?.node==="string"&&parseInt($.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(X?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Y$($,X,J){return q1(),new File($,X??"unknown_file",J)}function c$($){return(typeof $==="object"&&$!==null&&(("name"in $)&&$.name&&String($.name)||("url"in $)&&$.url&&String($.url)||("filename"in $)&&$.filename&&String($.filename)||("path"in $)&&$.path&&String($.path))||"").split(/[\\/]/).pop()||void 0}var U1=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function";var q$=async($,X)=>{return{...$,body:await DX($.body,X)}},I5=new WeakMap;function LX($){let X=typeof $==="function"?$:$.fetch,J=I5.get(X);if(J)return J;let Z=(async()=>{try{let z="Response"in X?X.Response:(await X("data:,")).constructor,Y=new FormData;if(Y.toString()===await new z(Y).text())return!1;return!0}catch{return!0}})();return I5.set(X,Z),Z}var DX=async($,X)=>{if(!await LX(X))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let J=new FormData;return await Promise.all(Object.entries($||{}).map(([Z,z])=>V1(J,Z,z))),J},EX=($)=>$ instanceof Blob&&("name"in $);var V1=async($,X,J)=>{if(J===void 0)return;if(J==null)throw TypeError(`Received null for "${X}"; to pass null in FormData, you must use the string 'null'`);if(typeof J==="string"||typeof J==="number"||typeof J==="boolean")$.append(X,String(J));else if(J instanceof Response){let Z={},z=J.headers.get("Content-Type");if(z)Z={type:z};$.append(X,Y$([await J.blob()],c$(J),Z))}else if(U1(J))$.append(X,Y$([await new Response(S0(J)).blob()],c$(J)));else if(EX(J))$.append(X,Y$([J],c$(J),{type:J.type}));else if(Array.isArray(J))await Promise.all(J.map((Z)=>V1($,X+"[]",Z)));else if(typeof J==="object")await Promise.all(Object.entries(J).map(([Z,z])=>V1($,`${X}[${Z}]`,z)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${J} instead`)};var F5=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",BX=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&F5($),SX=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";async function P0($,X,J){if(q1(),$=await $,X||(X=c$($)),BX($)){if($ instanceof File&&X==null&&J==null)return $;return Y$([await $.arrayBuffer()],X??$.name,{type:$.type,lastModified:$.lastModified,...J})}if(SX($)){let z=await $.blob();return X||(X=new URL($.url).pathname.split(/[\\/]/).pop()),Y$(await N1(z),X,J)}let Z=await N1($);if(!J?.type){let z=Z.find((Y)=>typeof Y==="object"&&("type"in Y)&&Y.type);if(typeof z==="string")J={...J,type:z}}return Y$(Z,X,J)}async function N1($){let X=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)X.push($);else if(F5($))X.push($ instanceof Blob?$:await $.arrayBuffer());else if(U1($))for await(let J of $)X.push(...await N1(J));else{let J=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${J?`; constructor: ${J}`:""}${jX($)}`)}return X}function jX($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((J)=>`"${J}"`).join(", ")}]`}class S{constructor($){this._client=$}}var x5=Symbol.for("brand.privateNullableHeaders");function*FX($){if(!$)return;if(x5 in $){let{values:Z,nulls:z}=$;yield*Z.entries();for(let Y of z)yield[Y,null];return}let X=!1,J;if($ instanceof Headers)J=$.entries();else if(z1($))J=$;else X=!0,J=Object.entries($??{});for(let Z of J){let z=Z[0];if(typeof z!=="string")throw TypeError("expected header name to be a string");let Y=z1(Z[1])?Z[1]:[Z[1]],W=!1;for(let Q of Y){if(Q===void 0)continue;if(X&&!W)W=!0,yield[z,null];yield[z,Q]}}}var M=($)=>{let X=new Headers,J=new Set;for(let Z of $){let z=new Set;for(let[Y,W]of FX(Z)){let Q=Y.toLowerCase();if(!z.has(Q))X.delete(Y),z.add(Q);if(W===null)X.delete(Y),J.add(Q);else X.append(Y,W),J.delete(Q)}}return{[x5]:!0,values:X,nulls:J}};function P5($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var O5=Object.freeze(Object.create(null)),xX=($=P5)=>function(J,...Z){if(J.length===1)return J[0];let z=!1,Y=[],W=J.reduce((q,N,w)=>{if(/[?#]/.test(N))z=!0;let T=Z[w],R=(z?encodeURIComponent:$)(""+T);if(w!==Z.length&&(T==null||typeof T==="object"&&T.toString===Object.getPrototypeOf(Object.getPrototypeOf(T.hasOwnProperty??O5)??O5)?.toString))R=T+"",Y.push({start:q.length+N.length,length:R.length,error:`Value of type ${Object.prototype.toString.call(T).slice(8,-1)} is not a valid path parameter`});return q+N+(w===Z.length?"":R)},""),Q=W.split(/[?#]/,1)[0],G=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,V;while((V=G.exec(Q))!==null)Y.push({start:V.index,length:V[0].length,error:`Value "${V[0]}" can't be safely passed as a path parameter`});if(Y.sort((q,N)=>q.start-N.start),Y.length>0){let q=0,N=Y.reduce((w,T)=>{let R=" ".repeat(T.start-q),c="^".repeat(T.length);return q=T.start+T.length,w+R+c},"");throw new H(`Path parameters result in path with invalid segments:
33
- ${Y.map((w)=>w.error).join(`
34
- `)}
25
+ `),this.outputHelp({error:!0});let J=Q||{},Y=J.exitCode||1,G=J.code||"commander.error";this._exit(Y,G,X)}_parseOptionsEnv(){this.options.forEach((X)=>{if(X.envVar&&X.envVar in Z0.env){let Q=X.attributeName();if(this.getOptionValue(Q)===void 0||["default","config","env"].includes(this.getOptionValueSource(Q)))if(X.required||X.optional)this.emit(`optionEnv:${X.name()}`,Z0.env[X.envVar]);else this.emit(`optionEnv:${X.name()}`)}})}_parseOptionsImplied(){let X=new N$(this.options),Q=(J)=>{return this.getOptionValue(J)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(J))};this.options.filter((J)=>J.implied!==void 0&&Q(J.attributeName())&&X.valueFromOption(this.getOptionValue(J.attributeName()),J)).forEach((J)=>{Object.keys(J.implied).filter((Y)=>!Q(Y)).forEach((Y)=>{this.setOptionValueWithSource(Y,J.implied[Y],"implied")})})}missingArgument(X){let Q=`error: missing required argument '${X}'`;this.error(Q,{code:"commander.missingArgument"})}optionMissingArgument(X){let Q=`error: option '${X.flags}' argument missing`;this.error(Q,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(X){let Q=`error: required option '${X.flags}' not specified`;this.error(Q,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(X,Q){let J=($)=>{let W=$.attributeName(),H=this.getOptionValue(W),U=this.options.find((q)=>q.negate&&W===q.attributeName()),B=this.options.find((q)=>!q.negate&&W===q.attributeName());if(U&&(U.presetArg===void 0&&H===!1||U.presetArg!==void 0&&H===U.presetArg))return U;return B||$},Y=($)=>{let W=J($),H=W.attributeName();if(this.getOptionValueSource(H)==="env")return`environment variable '${W.envVar}'`;return`option '${W.flags}'`},G=`error: ${Y(X)} cannot be used with ${Y(Q)}`;this.error(G,{code:"commander.conflictingOption"})}unknownOption(X){if(this._allowUnknownOption)return;let Q="";if(X.startsWith("--")&&this._showSuggestionAfterError){let Y=[],G=this;do{let $=G.createHelp().visibleOptions(G).filter((W)=>W.long).map((W)=>W.long);Y=Y.concat($),G=G.parent}while(G&&!G._enablePositionalOptions);Q=v4(X,Y)}let J=`error: unknown option '${X}'${Q}`;this.error(J,{code:"commander.unknownOption"})}_excessArguments(X){if(this._allowExcessArguments)return;let Q=this.registeredArguments.length,J=Q===1?"":"s",G=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Q} argument${J} but got ${X.length}.`;this.error(G,{code:"commander.excessArguments"})}unknownCommand(){let X=this.args[0],Q="";if(this._showSuggestionAfterError){let Y=[];this.createHelp().visibleCommands(this).forEach((G)=>{if(Y.push(G.name()),G.alias())Y.push(G.alias())}),Q=v4(X,Y)}let J=`error: unknown command '${X}'${Q}`;this.error(J,{code:"commander.unknownCommand"})}version(X,Q,J){if(X===void 0)return this._version;this._version=X,Q=Q||"-V, --version",J=J||"output the version number";let Y=this.createOption(Q,J);return this._versionOptionName=Y.attributeName(),this._registerOption(Y),this.on("option:"+Y.name(),()=>{this._outputConfiguration.writeOut(`${X}
26
+ `),this._exit(0,"commander.version",X)}),this}description(X,Q){if(X===void 0&&Q===void 0)return this._description;if(this._description=X,Q)this._argsDescription=Q;return this}summary(X){if(X===void 0)return this._summary;return this._summary=X,this}alias(X){if(X===void 0)return this._aliases[0];let Q=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)Q=this.commands[this.commands.length-1];if(X===Q._name)throw Error("Command alias can't be the same as its name");let J=this.parent?._findCommand(X);if(J){let Y=[J.name()].concat(J.aliases()).join("|");throw Error(`cannot add alias '${X}' to command '${this.name()}' as already have command '${Y}'`)}return Q._aliases.push(X),this}aliases(X){if(X===void 0)return this._aliases;return X.forEach((Q)=>this.alias(Q)),this}usage(X){if(X===void 0){if(this._usage)return this._usage;let Q=this.registeredArguments.map((J)=>{return Z$(J)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?Q:[]).join(" ")}return this._usage=X,this}name(X){if(X===void 0)return this._name;return this._name=X,this}helpGroup(X){if(X===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=X,this}commandsGroup(X){if(X===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=X,this}optionsGroup(X){if(X===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=X,this}_initOptionGroup(X){if(this._defaultOptionGroup&&!X.helpGroupHeading)X.helpGroup(this._defaultOptionGroup)}_initCommandGroup(X){if(this._defaultCommandGroup&&!X.helpGroup())X.helpGroup(this._defaultCommandGroup)}nameFromFilename(X){return this._name=A1.basename(X,A1.extname(X)),this}executableDir(X){if(X===void 0)return this._executableDir;return this._executableDir=X,this}helpInformation(X){let Q=this.createHelp(),J=this._getOutputContext(X);Q.prepareContext({error:J.error,helpWidth:J.helpWidth,outputHasColors:J.hasColors});let Y=Q.formatHelp(this,Q);if(J.hasColors)return Y;return this._outputConfiguration.stripColor(Y)}_getOutputContext(X){X=X||{};let Q=!!X.error,J,Y,G;if(Q)J=(W)=>this._outputConfiguration.writeErr(W),Y=this._outputConfiguration.getErrHasColors(),G=this._outputConfiguration.getErrHelpWidth();else J=(W)=>this._outputConfiguration.writeOut(W),Y=this._outputConfiguration.getOutHasColors(),G=this._outputConfiguration.getOutHelpWidth();return{error:Q,write:(W)=>{if(!Y)W=this._outputConfiguration.stripColor(W);return J(W)},hasColors:Y,helpWidth:G}}outputHelp(X){let Q;if(typeof X==="function")Q=X,X=void 0;let J=this._getOutputContext(X),Y={error:J.error,write:J.write,command:this};this._getCommandAndAncestors().reverse().forEach(($)=>$.emit("beforeAllHelp",Y)),this.emit("beforeHelp",Y);let G=this.helpInformation({error:J.error});if(Q){if(G=Q(G),typeof G!=="string"&&!Buffer.isBuffer(G))throw Error("outputHelp callback must return a string or a Buffer")}if(J.write(G),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",Y),this._getCommandAndAncestors().forEach(($)=>$.emit("afterAllHelp",Y))}helpOption(X,Q){if(typeof X==="boolean"){if(X){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(X??"-h, --help",Q??"display help for command"),X||Q)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(X){return this._helpOption=X,this._initOptionGroup(X),this}help(X){this.outputHelp(X);let Q=Number(Z0.exitCode??0);if(Q===0&&X&&typeof X!=="function"&&X.error)Q=1;this._exit(Q,"commander.help","(outputHelp)")}addHelpText(X,Q){let J=["beforeAll","before","after","afterAll"];if(!J.includes(X))throw Error(`Unexpected value for position to addHelpText.
27
+ Expecting one of '${J.join("', '")}'`);let Y=`${X}Help`;return this.on(Y,(G)=>{let $;if(typeof Q==="function")$=Q({error:G.error,command:G.command});else $=Q;if($)G.write(`${$}
28
+ `)}),this}_outputHelpIfRequested(X){let Q=this._getHelpOption();if(Q&&X.find((Y)=>Q.is(Y)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function y4(X){return X.map((Q)=>{if(!Q.startsWith("--inspect"))return Q;let J,Y="127.0.0.1",G="9229",$;if(($=Q.match(/^(--inspect(-brk)?)$/))!==null)J=$[1];else if(($=Q.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(J=$[1],/^\d+$/.test($[3]))G=$[3];else Y=$[3];else if(($=Q.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)J=$[1],Y=$[3],G=$[4];if(J&&G!=="0")return`${J}=${Y}:${parseInt(G)+1}`;return Q})}function FX(){if(Z0.env.NO_COLOR||Z0.env.FORCE_COLOR==="0"||Z0.env.FORCE_COLOR==="false")return!1;if(Z0.env.FORCE_COLOR||Z0.env.CLICOLOR_FORCE!==void 0)return!0;return}R$.Command=KX;R$.useColor=FX});var u4=p((T$)=>{var{Argument:g4}=v8(),{Command:VX}=x4(),{CommanderError:w$,InvalidArgumentError:h4}=y9(),{Help:P$}=BX(),{Option:f4}=zX();T$.program=new VX;T$.createCommand=(X)=>new VX(X);T$.createOption=(X,Q)=>new f4(X,Q);T$.createArgument=(X,Q)=>new g4(X,Q);T$.Command=VX;T$.Option=f4;T$.Argument=g4;T$.Help=P$;T$.CommanderError=w$;T$.InvalidArgumentError=h4;T$.InvalidOptionArgumentError=h4});var K0=p((hV)=>{var GQ=Symbol.for("yaml.alias"),Z7=Symbol.for("yaml.document"),M6=Symbol.for("yaml.map"),O7=Symbol.for("yaml.pair"),$Q=Symbol.for("yaml.scalar"),D6=Symbol.for("yaml.seq"),E1=Symbol.for("yaml.node.type"),CV=(X)=>!!X&&typeof X==="object"&&X[E1]===GQ,_V=(X)=>!!X&&typeof X==="object"&&X[E1]===Z7,kV=(X)=>!!X&&typeof X==="object"&&X[E1]===M6,vV=(X)=>!!X&&typeof X==="object"&&X[E1]===O7,A7=(X)=>!!X&&typeof X==="object"&&X[E1]===$Q,yV=(X)=>!!X&&typeof X==="object"&&X[E1]===D6;function N7(X){if(X&&typeof X==="object")switch(X[E1]){case M6:case D6:return!0}return!1}function xV(X){if(X&&typeof X==="object")switch(X[E1]){case GQ:case M6:case $Q:case D6:return!0}return!1}var gV=(X)=>(A7(X)||N7(X))&&!!X.anchor;hV.ALIAS=GQ;hV.DOC=Z7;hV.MAP=M6;hV.NODE_TYPE=E1;hV.PAIR=O7;hV.SCALAR=$Q;hV.SEQ=D6;hV.hasAnchor=gV;hV.isAlias=CV;hV.isCollection=N7;hV.isDocument=_V;hV.isMap=kV;hV.isNode=xV;hV.isPair=vV;hV.isScalar=A7;hV.isSeq=yV});var U8=p((QM)=>{var g0=K0(),a0=Symbol("break visit"),R7=Symbol("skip children"),D1=Symbol("remove node");function Z6(X,Q){let J=I7(Q);if(g0.isDocument(X)){if(N9(null,X.contents,J,Object.freeze([X]))===D1)X.contents=null}else N9(null,X,J,Object.freeze([]))}Z6.BREAK=a0;Z6.SKIP=R7;Z6.REMOVE=D1;function N9(X,Q,J,Y){let G=j7(X,Q,J,Y);if(g0.isNode(G)||g0.isPair(G))return w7(X,Y,G),N9(X,G,J,Y);if(typeof G!=="symbol"){if(g0.isCollection(Q)){Y=Object.freeze(Y.concat(Q));for(let $=0;$<Q.items.length;++$){let W=N9($,Q.items[$],J,Y);if(typeof W==="number")$=W-1;else if(W===a0)return a0;else if(W===D1)Q.items.splice($,1),$-=1}}else if(g0.isPair(Q)){Y=Object.freeze(Y.concat(Q));let $=N9("key",Q.key,J,Y);if($===a0)return a0;else if($===D1)Q.key=null;let W=N9("value",Q.value,J,Y);if(W===a0)return a0;else if(W===D1)Q.value=null}}return G}async function O6(X,Q){let J=I7(Q);if(g0.isDocument(X)){if(await R9(null,X.contents,J,Object.freeze([X]))===D1)X.contents=null}else await R9(null,X,J,Object.freeze([]))}O6.BREAK=a0;O6.SKIP=R7;O6.REMOVE=D1;async function R9(X,Q,J,Y){let G=await j7(X,Q,J,Y);if(g0.isNode(G)||g0.isPair(G))return w7(X,Y,G),R9(X,G,J,Y);if(typeof G!=="symbol"){if(g0.isCollection(Q)){Y=Object.freeze(Y.concat(Q));for(let $=0;$<Q.items.length;++$){let W=await R9($,Q.items[$],J,Y);if(typeof W==="number")$=W-1;else if(W===a0)return a0;else if(W===D1)Q.items.splice($,1),$-=1}}else if(g0.isPair(Q)){Y=Object.freeze(Y.concat(Q));let $=await R9("key",Q.key,J,Y);if($===a0)return a0;else if($===D1)Q.key=null;let W=await R9("value",Q.value,J,Y);if(W===a0)return a0;else if(W===D1)Q.value=null}}return G}function I7(X){if(typeof X==="object"&&(X.Collection||X.Node||X.Value))return Object.assign({Alias:X.Node,Map:X.Node,Scalar:X.Node,Seq:X.Node},X.Value&&{Map:X.Value,Scalar:X.Value,Seq:X.Value},X.Collection&&{Map:X.Collection,Seq:X.Collection},X);return X}function j7(X,Q,J,Y){if(typeof J==="function")return J(X,Q,Y);if(g0.isMap(Q))return J.Map?.(X,Q,Y);if(g0.isSeq(Q))return J.Seq?.(X,Q,Y);if(g0.isPair(Q))return J.Pair?.(X,Q,Y);if(g0.isScalar(Q))return J.Scalar?.(X,Q,Y);if(g0.isAlias(Q))return J.Alias?.(X,Q,Y);return}function w7(X,Q,J){let Y=Q[Q.length-1];if(g0.isCollection(Y))Y.items[X]=J;else if(g0.isPair(Y))if(X==="key")Y.key=J;else Y.value=J;else if(g0.isDocument(Y))Y.contents=J;else{let G=g0.isAlias(Y)?"alias":"scalar";throw Error(`Cannot replace node with ${G} parent`)}}QM.visit=Z6;QM.visitAsync=O6});var WQ=p((HM)=>{var P7=K0(),GM=U8(),$M={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},WM=(X)=>X.replace(/[!,[\]{}]/g,(Q)=>$M[Q]);class Q1{constructor(X,Q){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Q1.defaultYaml,X),this.tags=Object.assign({},Q1.defaultTags,Q)}clone(){let X=new Q1(this.yaml,this.tags);return X.docStart=this.docStart,X}atDocument(){let X=new Q1(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Q1.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Q1.defaultTags);break}return X}add(X,Q){if(this.atNextDocument)this.yaml={explicit:Q1.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Q1.defaultTags),this.atNextDocument=!1;let J=X.trim().split(/[ \t]+/),Y=J.shift();switch(Y){case"%TAG":{if(J.length!==2){if(Q(0,"%TAG directive should contain exactly two parts"),J.length<2)return!1}let[G,$]=J;return this.tags[G]=$,!0}case"%YAML":{if(this.yaml.explicit=!0,J.length!==1)return Q(0,"%YAML directive should contain exactly one part"),!1;let[G]=J;if(G==="1.1"||G==="1.2")return this.yaml.version=G,!0;else{let $=/^\d+\.\d+$/.test(G);return Q(6,`Unsupported YAML version ${G}`,$),!1}}default:return Q(0,`Unknown directive ${Y}`,!0),!1}}tagName(X,Q){if(X==="!")return"!";if(X[0]!=="!")return Q(`Not a valid tag: ${X}`),null;if(X[1]==="<"){let $=X.slice(2,-1);if($==="!"||$==="!!")return Q(`Verbatim tags aren't resolved, so ${X} is invalid.`),null;if(X[X.length-1]!==">")Q("Verbatim tags must end with a >");return $}let[,J,Y]=X.match(/^(.*!)([^!]*)$/s);if(!Y)Q(`The ${X} tag has no suffix`);let G=this.tags[J];if(G)try{return G+decodeURIComponent(Y)}catch($){return Q(String($)),null}if(J==="!")return X;return Q(`Could not resolve tag: ${X}`),null}tagString(X){for(let[Q,J]of Object.entries(this.tags))if(X.startsWith(J))return Q+WM(X.substring(J.length));return X[0]==="!"?X:`!<${X}>`}toString(X){let Q=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],J=Object.entries(this.tags),Y;if(X&&J.length>0&&P7.isNode(X.contents)){let G={};GM.visit(X.contents,($,W)=>{if(P7.isNode(W)&&W.tag)G[W.tag]=!0}),Y=Object.keys(G)}else Y=[];for(let[G,$]of J){if(G==="!!"&&$==="tag:yaml.org,2002:")continue;if(!X||Y.some((W)=>W.startsWith($)))Q.push(`%TAG ${G} ${$}`)}return Q.join(`
29
+ `)}}Q1.defaultYaml={explicit:!1,version:"1.2"};Q1.defaultTags={"!!":"tag:yaml.org,2002:"};HM.Directives=Q1});var A6=p((qM)=>{var T7=K0(),BM=U8();function zM(X){if(/[\x00-\x19\s,[\]{}]/.test(X)){let J=`Anchor must not contain whitespace or control characters: ${JSON.stringify(X)}`;throw Error(J)}return!0}function S7(X){let Q=new Set;return BM.visit(X,{Value(J,Y){if(Y.anchor)Q.add(Y.anchor)}}),Q}function E7(X,Q){for(let J=1;;++J){let Y=`${X}${J}`;if(!Q.has(Y))return Y}}function LM(X,Q){let J=[],Y=new Map,G=null;return{onAnchor:($)=>{J.push($),G??(G=S7(X));let W=E7(Q,G);return G.add(W),W},setAnchors:()=>{for(let $ of J){let W=Y.get($);if(typeof W==="object"&&W.anchor&&(T7.isScalar(W.node)||T7.isCollection(W.node)))W.node.anchor=W.anchor;else{let H=Error("Failed to resolve repeated object (this should not happen)");throw H.source=$,H}}},sourceObjects:Y}}qM.anchorIsValid=zM;qM.anchorNames=S7;qM.createNodeAnchors=LM;qM.findNewAnchor=E7});var HQ=p((DM)=>{function B8(X,Q,J,Y){if(Y&&typeof Y==="object")if(Array.isArray(Y))for(let G=0,$=Y.length;G<$;++G){let W=Y[G],H=B8(X,Y,String(G),W);if(H===void 0)delete Y[G];else if(H!==W)Y[G]=H}else if(Y instanceof Map)for(let G of Array.from(Y.keys())){let $=Y.get(G),W=B8(X,Y,G,$);if(W===void 0)Y.delete(G);else if(W!==$)Y.set(G,W)}else if(Y instanceof Set)for(let G of Array.from(Y)){let $=B8(X,Y,G,G);if($===void 0)Y.delete(G);else if($!==G)Y.delete(G),Y.add($)}else for(let[G,$]of Object.entries(Y)){let W=B8(X,Y,G,$);if(W===void 0)delete Y[G];else if(W!==$)Y[G]=W}return X.call(Q,J,Y)}DM.applyReviver=B8});var x1=p((AM)=>{var OM=K0();function b7(X,Q,J){if(Array.isArray(X))return X.map((Y,G)=>b7(Y,String(G),J));if(X&&typeof X.toJSON==="function"){if(!J||!OM.hasAnchor(X))return X.toJSON(Q,J);let Y={aliasCount:0,count:1,res:void 0};J.anchors.set(X,Y),J.onCreate=($)=>{Y.res=$,delete J.onCreate};let G=X.toJSON(Q,J);if(J.onCreate)J.onCreate(G);return G}if(typeof X==="bigint"&&!J?.keep)return Number(X);return X}AM.toJS=b7});var N6=p((jM)=>{var RM=HQ(),C7=K0(),IM=x1();class _7{constructor(X){Object.defineProperty(this,C7.NODE_TYPE,{value:X})}clone(){let X=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)X.range=this.range.slice();return X}toJS(X,{mapAsMap:Q,maxAliasCount:J,onAnchor:Y,reviver:G}={}){if(!C7.isDocument(X))throw TypeError("A document argument is required");let $={anchors:new Map,doc:X,keep:!0,mapAsMap:Q===!0,mapKeyWarned:!1,maxAliasCount:typeof J==="number"?J:100},W=IM.toJS(this,"",$);if(typeof Y==="function")for(let{count:H,res:U}of $.anchors.values())Y(U,H);return typeof G==="function"?RM.applyReviver(G,{"":W},"",W):W}}jM.NodeBase=_7});var z8=p((bM)=>{var PM=A6(),TM=U8(),I9=K0(),SM=N6(),EM=x1();class k7 extends SM.NodeBase{constructor(X){super(I9.ALIAS);this.source=X,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(X,Q){let J;if(Q?.aliasResolveCache)J=Q.aliasResolveCache;else if(J=[],TM.visit(X,{Node:(G,$)=>{if(I9.isAlias($)||I9.hasAnchor($))J.push($)}}),Q)Q.aliasResolveCache=J;let Y=void 0;for(let G of J){if(G===this)break;if(G.anchor===this.source)Y=G}return Y}toJSON(X,Q){if(!Q)return{source:this.source};let{anchors:J,doc:Y,maxAliasCount:G}=Q,$=this.resolve(Y,Q);if(!$){let H=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(H)}let W=J.get($);if(!W)EM.toJS($,null,Q),W=J.get($);if(W?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(G>=0){if(W.count+=1,W.aliasCount===0)W.aliasCount=R6(Y,$,J);if(W.count*W.aliasCount>G)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return W.res}toString(X,Q,J){let Y=`*${this.source}`;if(X){if(PM.anchorIsValid(this.source),X.options.verifyAliasOrder&&!X.anchors.has(this.source)){let G=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(G)}if(X.implicitKey)return`${Y} `}return Y}}function R6(X,Q,J){if(I9.isAlias(Q)){let Y=Q.resolve(X),G=J&&Y&&J.get(Y);return G?G.count*G.aliasCount:0}else if(I9.isCollection(Q)){let Y=0;for(let G of Q.items){let $=R6(X,G,J);if($>Y)Y=$}return Y}else if(I9.isPair(Q)){let Y=R6(X,Q.key,J),G=R6(X,Q.value,J);return Math.max(Y,G)}return 1}bM.Alias=k7});var v0=p((xM)=>{var _M=K0(),kM=N6(),vM=x1(),yM=(X)=>!X||typeof X!=="function"&&typeof X!=="object";class a1 extends kM.NodeBase{constructor(X){super(_M.SCALAR);this.value=X}toJSON(X,Q){return Q?.keep?this.value:vM.toJS(this.value,X,Q)}toString(){return String(this.value)}}a1.BLOCK_FOLDED="BLOCK_FOLDED";a1.BLOCK_LITERAL="BLOCK_LITERAL";a1.PLAIN="PLAIN";a1.QUOTE_DOUBLE="QUOTE_DOUBLE";a1.QUOTE_SINGLE="QUOTE_SINGLE";xM.Scalar=a1;xM.isScalarValue=yM});var L8=p((cM)=>{var fM=z8(),s1=K0(),v7=v0(),uM="tag:yaml.org,2002:";function mM(X,Q,J){if(Q){let Y=J.filter(($)=>$.tag===Q),G=Y.find(($)=>!$.format)??Y[0];if(!G)throw Error(`Tag ${Q} not found`);return G}return J.find((Y)=>Y.identify?.(X)&&!Y.format)}function lM(X,Q,J){if(s1.isDocument(X))X=X.contents;if(s1.isNode(X))return X;if(s1.isPair(X)){let K=J.schema[s1.MAP].createNode?.(J.schema,null,J);return K.items.push(X),K}if(X instanceof String||X instanceof Number||X instanceof Boolean||typeof BigInt<"u"&&X instanceof BigInt)X=X.valueOf();let{aliasDuplicateObjects:Y,onAnchor:G,onTagObj:$,schema:W,sourceObjects:H}=J,U=void 0;if(Y&&X&&typeof X==="object")if(U=H.get(X),U)return U.anchor??(U.anchor=G(X)),new fM.Alias(U.anchor);else U={anchor:null,node:null},H.set(X,U);if(Q?.startsWith("!!"))Q=uM+Q.slice(2);let B=mM(X,Q,W.tags);if(!B){if(X&&typeof X.toJSON==="function")X=X.toJSON();if(!X||typeof X!=="object"){let K=new v7.Scalar(X);if(U)U.node=K;return K}B=X instanceof Map?W[s1.MAP]:(Symbol.iterator in Object(X))?W[s1.SEQ]:W[s1.MAP]}if($)$(B),delete J.onTagObj;let q=B?.createNode?B.createNode(J.schema,X,J):typeof B?.nodeClass?.from==="function"?B.nodeClass.from(J.schema,X,J):new v7.Scalar(X);if(Q)q.tag=Q;else if(!B.default)q.tag=B.tag;if(U)U.node=q;return q}cM.createNode=lM});var I6=p((nM)=>{var dM=L8(),Z1=K0(),iM=N6();function UQ(X,Q,J){let Y=J;for(let G=Q.length-1;G>=0;--G){let $=Q[G];if(typeof $==="number"&&Number.isInteger($)&&$>=0){let W=[];W[$]=Y,Y=W}else Y=new Map([[$,Y]])}return dM.createNode(Y,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:X,sourceObjects:new Map})}var y7=(X)=>X==null||typeof X==="object"&&!!X[Symbol.iterator]().next().done;class x7 extends iM.NodeBase{constructor(X,Q){super(X);Object.defineProperty(this,"schema",{value:Q,configurable:!0,enumerable:!1,writable:!0})}clone(X){let Q=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(X)Q.schema=X;if(Q.items=Q.items.map((J)=>Z1.isNode(J)||Z1.isPair(J)?J.clone(X):J),this.range)Q.range=this.range.slice();return Q}addIn(X,Q){if(y7(X))this.add(Q);else{let[J,...Y]=X,G=this.get(J,!0);if(Z1.isCollection(G))G.addIn(Y,Q);else if(G===void 0&&this.schema)this.set(J,UQ(this.schema,Y,Q));else throw Error(`Expected YAML collection at ${J}. Remaining path: ${Y}`)}}deleteIn(X){let[Q,...J]=X;if(J.length===0)return this.delete(Q);let Y=this.get(Q,!0);if(Z1.isCollection(Y))return Y.deleteIn(J);else throw Error(`Expected YAML collection at ${Q}. Remaining path: ${J}`)}getIn(X,Q){let[J,...Y]=X,G=this.get(J,!0);if(Y.length===0)return!Q&&Z1.isScalar(G)?G.value:G;else return Z1.isCollection(G)?G.getIn(Y,Q):void 0}hasAllNullValues(X){return this.items.every((Q)=>{if(!Z1.isPair(Q))return!1;let J=Q.value;return J==null||X&&Z1.isScalar(J)&&J.value==null&&!J.commentBefore&&!J.comment&&!J.tag})}hasIn(X){let[Q,...J]=X;if(J.length===0)return this.has(Q);let Y=this.get(Q,!0);return Z1.isCollection(Y)?Y.hasIn(J):!1}setIn(X,Q){let[J,...Y]=X;if(Y.length===0)this.set(J,Q);else{let G=this.get(J,!0);if(Z1.isCollection(G))G.setIn(Y,Q);else if(G===void 0&&this.schema)this.set(J,UQ(this.schema,Y,Q));else throw Error(`Expected YAML collection at ${J}. Remaining path: ${Y}`)}}}nM.Collection=x7;nM.collectionFromPath=UQ;nM.isEmptyPath=y7});var q8=p((eM)=>{var sM=(X)=>X.replace(/^(?!$)(?: $)?/gm,"#");function BQ(X,Q){if(/^\n+$/.test(X))return X.substring(1);return Q?X.replace(/^(?! *$)/gm,Q):X}var tM=(X,Q,J)=>X.endsWith(`
30
+ `)?BQ(J,Q):J.includes(`
31
+ `)?`
32
+ `+BQ(J,Q):(X.endsWith(" ")?"":" ")+J;eM.indentComment=BQ;eM.lineComment=tM;eM.stringifyComment=sM});var h7=p((GD)=>{function YD(X,Q,J="flow",{indentAtStart:Y,lineWidth:G=80,minContentWidth:$=20,onFold:W,onOverflow:H}={}){if(!G||G<0)return X;if(G<$)$=0;let U=Math.max(1+$,1+G-Q.length);if(X.length<=U)return X;let B=[],q={},K=G-Q.length;if(typeof Y==="number")if(Y>G-Math.max(2,$))B.push(0);else K=G-Y;let V=void 0,N=void 0,w=!1,A=-1,Z=-1,z=-1;if(J==="block"){if(A=g7(X,A,Q.length),A!==-1)K=A+U}for(let F;F=X[A+=1];){if(J==="quoted"&&F==="\\"){switch(Z=A,X[A+1]){case"x":A+=3;break;case"u":A+=5;break;case"U":A+=9;break;default:A+=1}z=A}if(F===`
33
+ `){if(J==="block")A=g7(X,A,Q.length);K=A+Q.length+U,V=void 0}else{if(F===" "&&N&&N!==" "&&N!==`
34
+ `&&N!=="\t"){let L=X[A+1];if(L&&L!==" "&&L!==`
35
+ `&&L!=="\t")V=A}if(A>=K)if(V)B.push(V),K=V+U,V=void 0;else if(J==="quoted"){while(N===" "||N==="\t")N=F,F=X[A+=1],w=!0;let L=A>z+1?A-2:Z-1;if(q[L])return X;B.push(L),q[L]=!0,K=L+U,V=void 0}else w=!0}N=F}if(w&&H)H();if(B.length===0)return X;if(W)W();let M=X.slice(0,B[0]);for(let F=0;F<B.length;++F){let L=B[F],O=B[F+1]||X.length;if(L===0)M=`
36
+ ${Q}${X.slice(0,O)}`;else{if(J==="quoted"&&q[L])M+=`${X[L]}\\`;M+=`
37
+ ${Q}${X.slice(L+1,O)}`}}return M}function g7(X,Q,J){let Y=Q,G=Q+1,$=X[G];while($===" "||$==="\t")if(Q<G+J)$=X[++Q];else{do $=X[++Q];while($&&$!==`
38
+ `);Y=Q,G=Q+1,$=X[G]}return Y}GD.FOLD_BLOCK="block";GD.FOLD_FLOW="flow";GD.FOLD_QUOTED="quoted";GD.foldFlowLines=YD});var K8=p((qD)=>{var U1=v0(),g1=h7(),w6=(X,Q)=>({indentAtStart:Q?X.indent.length:X.indentAtStart,lineWidth:X.options.lineWidth,minContentWidth:X.options.minContentWidth}),P6=(X)=>/^(%|---|\.\.\.)/m.test(X);function BD(X,Q,J){if(!Q||Q<0)return!1;let Y=Q-J,G=X.length;if(G<=Y)return!1;for(let $=0,W=0;$<G;++$)if(X[$]===`
39
+ `){if($-W>Y)return!0;if(W=$+1,G-W<=Y)return!1}return!0}function F8(X,Q){let J=JSON.stringify(X);if(Q.options.doubleQuotedAsJSON)return J;let{implicitKey:Y}=Q,G=Q.options.doubleQuotedMinMultiLineLength,$=Q.indent||(P6(X)?" ":""),W="",H=0;for(let U=0,B=J[U];B;B=J[++U]){if(B===" "&&J[U+1]==="\\"&&J[U+2]==="n")W+=J.slice(H,U)+"\\ ",U+=1,H=U,B="\\";if(B==="\\")switch(J[U+1]){case"u":{W+=J.slice(H,U);let q=J.substr(U+2,4);switch(q){case"0000":W+="\\0";break;case"0007":W+="\\a";break;case"000b":W+="\\v";break;case"001b":W+="\\e";break;case"0085":W+="\\N";break;case"00a0":W+="\\_";break;case"2028":W+="\\L";break;case"2029":W+="\\P";break;default:if(q.substr(0,2)==="00")W+="\\x"+q.substr(2);else W+=J.substr(U,6)}U+=5,H=U+1}break;case"n":if(Y||J[U+2]==='"'||J.length<G)U+=1;else{W+=J.slice(H,U)+`
40
+
41
+ `;while(J[U+2]==="\\"&&J[U+3]==="n"&&J[U+4]!=='"')W+=`
42
+ `,U+=2;if(W+=$,J[U+2]===" ")W+="\\";U+=1,H=U+1}break;default:U+=1}}return W=H?W+J.slice(H):J,Y?W:g1.foldFlowLines(W,$,g1.FOLD_QUOTED,w6(Q,!1))}function zQ(X,Q){if(Q.options.singleQuote===!1||Q.implicitKey&&X.includes(`
43
+ `)||/[ \t]\n|\n[ \t]/.test(X))return F8(X,Q);let J=Q.indent||(P6(X)?" ":""),Y="'"+X.replace(/'/g,"''").replace(/\n+/g,`$&
44
+ ${J}`)+"'";return Q.implicitKey?Y:g1.foldFlowLines(Y,J,g1.FOLD_FLOW,w6(Q,!1))}function j9(X,Q){let{singleQuote:J}=Q.options,Y;if(J===!1)Y=F8;else{let G=X.includes('"'),$=X.includes("'");if(G&&!$)Y=zQ;else if($&&!G)Y=F8;else Y=J?zQ:F8}return Y(X,Q)}var LQ;try{LQ=new RegExp(`(^|(?<!
45
+ ))
46
+ +(?!
47
+ |$)`,"g")}catch{LQ=/\n+(?!\n|$)/g}function j6({comment:X,type:Q,value:J},Y,G,$){let{blockQuote:W,commentString:H,lineWidth:U}=Y.options;if(!W||/\n[\t ]+$/.test(J))return j9(J,Y);let B=Y.indent||(Y.forceBlockIndent||P6(J)?" ":""),q=W==="literal"?!0:W==="folded"||Q===U1.Scalar.BLOCK_FOLDED?!1:Q===U1.Scalar.BLOCK_LITERAL?!0:!BD(J,U,B.length);if(!J)return q?`|
48
+ `:`>
49
+ `;let K,V;for(V=J.length;V>0;--V){let O=J[V-1];if(O!==`
50
+ `&&O!=="\t"&&O!==" ")break}let N=J.substring(V),w=N.indexOf(`
51
+ `);if(w===-1)K="-";else if(J===N||w!==N.length-1){if(K="+",$)$()}else K="";if(N){if(J=J.slice(0,-N.length),N[N.length-1]===`
52
+ `)N=N.slice(0,-1);N=N.replace(LQ,`$&${B}`)}let A=!1,Z,z=-1;for(Z=0;Z<J.length;++Z){let O=J[Z];if(O===" ")A=!0;else if(O===`
53
+ `)z=Z;else break}let M=J.substring(0,z<Z?z+1:Z);if(M)J=J.substring(M.length),M=M.replace(/\n+/g,`$&${B}`);let L=(A?B?"2":"1":"")+K;if(X){if(L+=" "+H(X.replace(/ ?[\r\n]+/g," ")),G)G()}if(!q){let O=J.replace(/\n+/g,`
54
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${B}`),D=!1,I=w6(Y,!0);if(W!=="folded"&&Q!==U1.Scalar.BLOCK_FOLDED)I.onOverflow=()=>{D=!0};let j=g1.foldFlowLines(`${M}${O}${N}`,B,g1.FOLD_BLOCK,I);if(!D)return`>${L}
55
+ ${B}${j}`}return J=J.replace(/\n+/g,`$&${B}`),`|${L}
56
+ ${B}${M}${J}${N}`}function zD(X,Q,J,Y){let{type:G,value:$}=X,{actualString:W,implicitKey:H,indent:U,indentStep:B,inFlow:q}=Q;if(H&&$.includes(`
57
+ `)||q&&/[[\]{},]/.test($))return j9($,Q);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test($))return H||q||!$.includes(`
58
+ `)?j9($,Q):j6(X,Q,J,Y);if(!H&&!q&&G!==U1.Scalar.PLAIN&&$.includes(`
59
+ `))return j6(X,Q,J,Y);if(P6($)){if(U==="")return Q.forceBlockIndent=!0,j6(X,Q,J,Y);else if(H&&U===B)return j9($,Q)}let K=$.replace(/\n+/g,`$&
60
+ ${U}`);if(W){let V=(A)=>A.default&&A.tag!=="tag:yaml.org,2002:str"&&A.test?.test(K),{compat:N,tags:w}=Q.doc.schema;if(w.some(V)||N?.some(V))return j9($,Q)}return H?K:g1.foldFlowLines(K,U,g1.FOLD_FLOW,w6(Q,!1))}function LD(X,Q,J,Y){let{implicitKey:G,inFlow:$}=Q,W=typeof X.value==="string"?X:Object.assign({},X,{value:String(X.value)}),{type:H}=X;if(H!==U1.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(W.value))H=U1.Scalar.QUOTE_DOUBLE}let U=(q)=>{switch(q){case U1.Scalar.BLOCK_FOLDED:case U1.Scalar.BLOCK_LITERAL:return G||$?j9(W.value,Q):j6(W,Q,J,Y);case U1.Scalar.QUOTE_DOUBLE:return F8(W.value,Q);case U1.Scalar.QUOTE_SINGLE:return zQ(W.value,Q);case U1.Scalar.PLAIN:return zD(W,Q,J,Y);default:return null}},B=U(H);if(B===null){let{defaultKeyType:q,defaultStringType:K}=Q.options,V=G&&q||K;if(B=U(V),B===null)throw Error(`Unsupported default string type ${V}`)}return B}qD.stringifyString=LD});var V8=p((ND)=>{var KD=A6(),h1=K0(),VD=q8(),MD=K8();function DD(X,Q){let J=Object.assign({blockQuote:!0,commentString:VD.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,trueStr:"true",verifyAliasOrder:!0},X.schema.toStringOptions,Q),Y;switch(J.collectionStyle){case"block":Y=!1;break;case"flow":Y=!0;break;default:Y=null}return{anchors:new Set,doc:X,flowCollectionPadding:J.flowCollectionPadding?" ":"",indent:"",indentStep:typeof J.indent==="number"?" ".repeat(J.indent):" ",inFlow:Y,options:J}}function ZD(X,Q){if(Q.tag){let G=X.filter(($)=>$.tag===Q.tag);if(G.length>0)return G.find(($)=>$.format===Q.format)??G[0]}let J=void 0,Y;if(h1.isScalar(Q)){Y=Q.value;let G=X.filter(($)=>$.identify?.(Y));if(G.length>1){let $=G.filter((W)=>W.test);if($.length>0)G=$}J=G.find(($)=>$.format===Q.format)??G.find(($)=>!$.format)}else Y=Q,J=X.find((G)=>G.nodeClass&&Y instanceof G.nodeClass);if(!J){let G=Y?.constructor?.name??(Y===null?"null":typeof Y);throw Error(`Tag not resolved for ${G} value`)}return J}function OD(X,Q,{anchors:J,doc:Y}){if(!Y.directives)return"";let G=[],$=(h1.isScalar(X)||h1.isCollection(X))&&X.anchor;if($&&KD.anchorIsValid($))J.add($),G.push(`&${$}`);let W=X.tag??(Q.default?null:Q.tag);if(W)G.push(Y.directives.tagString(W));return G.join(" ")}function AD(X,Q,J,Y){if(h1.isPair(X))return X.toString(Q,J,Y);if(h1.isAlias(X)){if(Q.doc.directives)return X.toString(Q);if(Q.resolvedAliases?.has(X))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(Q.resolvedAliases)Q.resolvedAliases.add(X);else Q.resolvedAliases=new Set([X]);X=X.resolve(Q.doc)}}let G=void 0,$=h1.isNode(X)?X:Q.doc.createNode(X,{onTagObj:(U)=>G=U});G??(G=ZD(Q.doc.schema.tags,$));let W=OD($,G,Q);if(W.length>0)Q.indentAtStart=(Q.indentAtStart??0)+W.length+1;let H=typeof G.stringify==="function"?G.stringify($,Q,J,Y):h1.isScalar($)?MD.stringifyString($,Q,J,Y):$.toString(Q,J,Y);if(!W)return H;return h1.isScalar($)||H[0]==="{"||H[0]==="["?`${W} ${H}`:`${W}
61
+ ${Q.indent}${H}`}ND.createStringifyContext=DD;ND.stringify=AD});var m7=p((wD)=>{var b1=K0(),f7=v0(),u7=V8(),M8=q8();function jD({key:X,value:Q},J,Y,G){let{allNullValues:$,doc:W,indent:H,indentStep:U,options:{commentString:B,indentSeq:q,simpleKeys:K}}=J,V=b1.isNode(X)&&X.comment||null;if(K){if(V)throw Error("With simple keys, key nodes cannot have comments");if(b1.isCollection(X)||!b1.isNode(X)&&typeof X==="object")throw Error("With simple keys, collection cannot be used as a key value")}let N=!K&&(!X||V&&Q==null&&!J.inFlow||b1.isCollection(X)||(b1.isScalar(X)?X.type===f7.Scalar.BLOCK_FOLDED||X.type===f7.Scalar.BLOCK_LITERAL:typeof X==="object"));J=Object.assign({},J,{allNullValues:!1,implicitKey:!N&&(K||!$),indent:H+U});let w=!1,A=!1,Z=u7.stringify(X,J,()=>w=!0,()=>A=!0);if(!N&&!J.inFlow&&Z.length>1024){if(K)throw Error("With simple keys, single line scalar must not span more than 1024 characters");N=!0}if(J.inFlow){if($||Q==null){if(w&&Y)Y();return Z===""?"?":N?`? ${Z}`:Z}}else if($&&!K||Q==null&&N){if(Z=`? ${Z}`,V&&!w)Z+=M8.lineComment(Z,J.indent,B(V));else if(A&&G)G();return Z}if(w)V=null;if(N){if(V)Z+=M8.lineComment(Z,J.indent,B(V));Z=`? ${Z}
62
+ ${H}:`}else if(Z=`${Z}:`,V)Z+=M8.lineComment(Z,J.indent,B(V));let z,M,F;if(b1.isNode(Q))z=!!Q.spaceBefore,M=Q.commentBefore,F=Q.comment;else if(z=!1,M=null,F=null,Q&&typeof Q==="object")Q=W.createNode(Q);if(J.implicitKey=!1,!N&&!V&&b1.isScalar(Q))J.indentAtStart=Z.length+1;if(A=!1,!q&&U.length>=2&&!J.inFlow&&!N&&b1.isSeq(Q)&&!Q.flow&&!Q.tag&&!Q.anchor)J.indent=J.indent.substring(2);let L=!1,O=u7.stringify(Q,J,()=>L=!0,()=>A=!0),D=" ";if(V||z||M){if(D=z?`
63
+ `:"",M){let I=B(M);D+=`
64
+ ${M8.indentComment(I,J.indent)}`}if(O===""&&!J.inFlow){if(D===`
65
+ `&&F)D=`
66
+
67
+ `}else D+=`
68
+ ${J.indent}`}else if(!N&&b1.isCollection(Q)){let I=O[0],j=O.indexOf(`
69
+ `),E=j!==-1,g=J.inFlow??Q.flow??Q.items.length===0;if(E||!g){let k=!1;if(E&&(I==="&"||I==="!")){let x=O.indexOf(" ");if(I==="&"&&x!==-1&&x<j&&O[x+1]==="!")x=O.indexOf(" ",x+1);if(x===-1||j<x)k=!0}if(!k)D=`
70
+ ${J.indent}`}}else if(O===""||O[0]===`
71
+ `)D="";if(Z+=D+O,J.inFlow){if(L&&Y)Y()}else if(F&&!L)Z+=M8.lineComment(Z,J.indent,B(F));else if(A&&G)G();return Z}wD.stringifyPair=jD});var qQ=p((ED)=>{var l7=O1("process");function TD(X,...Q){if(X==="debug")console.log(...Q)}function SD(X,Q){if(X==="debug"||X==="warn")if(typeof l7.emitWarning==="function")l7.emitWarning(Q);else console.warn(Q)}ED.debug=TD;ED.warn=SD});var E6=p((kD)=>{var D8=K0(),c7=v0(),T6="<<",S6={identify:(X)=>X===T6||typeof X==="symbol"&&X.description===T6,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new c7.Scalar(Symbol(T6)),{addToJSMap:p7}),stringify:()=>T6},_D=(X,Q)=>(S6.identify(Q)||D8.isScalar(Q)&&(!Q.type||Q.type===c7.Scalar.PLAIN)&&S6.identify(Q.value))&&X?.doc.schema.tags.some((J)=>J.tag===S6.tag&&J.default);function p7(X,Q,J){if(J=X&&D8.isAlias(J)?J.resolve(X.doc):J,D8.isSeq(J))for(let Y of J.items)FQ(X,Q,Y);else if(Array.isArray(J))for(let Y of J)FQ(X,Q,Y);else FQ(X,Q,J)}function FQ(X,Q,J){let Y=X&&D8.isAlias(J)?J.resolve(X.doc):J;if(!D8.isMap(Y))throw Error("Merge sources must be maps or map aliases");let G=Y.toJSON(null,X,Map);for(let[$,W]of G)if(Q instanceof Map){if(!Q.has($))Q.set($,W)}else if(Q instanceof Set)Q.add($);else if(!Object.prototype.hasOwnProperty.call(Q,$))Object.defineProperty(Q,$,{value:W,writable:!0,enumerable:!0,configurable:!0});return Q}kD.addMergeToJSMap=p7;kD.isMergeKey=_D;kD.merge=S6});var VQ=p((mD)=>{var gD=qQ(),d7=E6(),hD=V8(),i7=K0(),KQ=x1();function fD(X,Q,{key:J,value:Y}){if(i7.isNode(J)&&J.addToJSMap)J.addToJSMap(X,Q,Y);else if(d7.isMergeKey(X,J))d7.addMergeToJSMap(X,Q,Y);else{let G=KQ.toJS(J,"",X);if(Q instanceof Map)Q.set(G,KQ.toJS(Y,G,X));else if(Q instanceof Set)Q.add(G);else{let $=uD(J,G,X),W=KQ.toJS(Y,$,X);if($ in Q)Object.defineProperty(Q,$,{value:W,writable:!0,enumerable:!0,configurable:!0});else Q[$]=W}}return Q}function uD(X,Q,J){if(Q===null)return"";if(typeof Q!=="object")return String(Q);if(i7.isNode(X)&&J?.doc){let Y=hD.createStringifyContext(J.doc,{});Y.anchors=new Set;for(let $ of J.anchors.keys())Y.anchors.add($.anchor);Y.inFlow=!0,Y.inStringifyKey=!0;let G=X.toString(Y);if(!J.mapKeyWarned){let $=JSON.stringify(G);if($.length>40)$=$.substring(0,36)+'..."';gD.warn(J.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${$}. Set mapAsMap: true to use object keys.`),J.mapKeyWarned=!0}return G}return JSON.stringify(Q)}mD.addPairToJSMap=fD});var f1=p((iD)=>{var n7=L8(),cD=m7(),pD=VQ(),b6=K0();function dD(X,Q,J){let Y=n7.createNode(X,void 0,J),G=n7.createNode(Q,void 0,J);return new C6(Y,G)}class C6{constructor(X,Q=null){Object.defineProperty(this,b6.NODE_TYPE,{value:b6.PAIR}),this.key=X,this.value=Q}clone(X){let{key:Q,value:J}=this;if(b6.isNode(Q))Q=Q.clone(X);if(b6.isNode(J))J=J.clone(X);return new C6(Q,J)}toJSON(X,Q){let J=Q?.mapAsMap?new Map:{};return pD.addPairToJSMap(Q,J,this)}toString(X,Q,J){return X?.doc?cD.stringifyPair(this,X,Q,J):JSON.stringify(this)}}iD.Pair=C6;iD.createPair=dD});var MQ=p((tD)=>{var t1=K0(),r7=V8(),_6=q8();function oD(X,Q,J){return(Q.inFlow??X.flow?sD:aD)(X,Q,J)}function aD({comment:X,items:Q},J,{blockItemPrefix:Y,flowChars:G,itemIndent:$,onChompKeep:W,onComment:H}){let{indent:U,options:{commentString:B}}=J,q=Object.assign({},J,{indent:$,type:null}),K=!1,V=[];for(let w=0;w<Q.length;++w){let A=Q[w],Z=null;if(t1.isNode(A)){if(!K&&A.spaceBefore)V.push("");if(k6(J,V,A.commentBefore,K),A.comment)Z=A.comment}else if(t1.isPair(A)){let M=t1.isNode(A.key)?A.key:null;if(M){if(!K&&M.spaceBefore)V.push("");k6(J,V,M.commentBefore,K)}}K=!1;let z=r7.stringify(A,q,()=>Z=null,()=>K=!0);if(Z)z+=_6.lineComment(z,$,B(Z));if(K&&Z)K=!1;V.push(Y+z)}let N;if(V.length===0)N=G.start+G.end;else{N=V[0];for(let w=1;w<V.length;++w){let A=V[w];N+=A?`
72
+ ${U}${A}`:`
73
+ `}}if(X){if(N+=`
74
+ `+_6.indentComment(B(X),U),H)H()}else if(K&&W)W();return N}function sD({items:X},Q,{flowChars:J,itemIndent:Y}){let{indent:G,indentStep:$,flowCollectionPadding:W,options:{commentString:H}}=Q;Y+=$;let U=Object.assign({},Q,{indent:Y,inFlow:!0,type:null}),B=!1,q=0,K=[];for(let w=0;w<X.length;++w){let A=X[w],Z=null;if(t1.isNode(A)){if(A.spaceBefore)K.push("");if(k6(Q,K,A.commentBefore,!1),A.comment)Z=A.comment}else if(t1.isPair(A)){let M=t1.isNode(A.key)?A.key:null;if(M){if(M.spaceBefore)K.push("");if(k6(Q,K,M.commentBefore,!1),M.comment)B=!0}let F=t1.isNode(A.value)?A.value:null;if(F){if(F.comment)Z=F.comment;if(F.commentBefore)B=!0}else if(A.value==null&&M?.comment)Z=M.comment}if(Z)B=!0;let z=r7.stringify(A,U,()=>Z=null);if(w<X.length-1)z+=",";if(Z)z+=_6.lineComment(z,Y,H(Z));if(!B&&(K.length>q||z.includes(`
75
+ `)))B=!0;K.push(z),q=K.length}let{start:V,end:N}=J;if(K.length===0)return V+N;else{if(!B){let w=K.reduce((A,Z)=>A+Z.length+2,2);B=Q.options.lineWidth>0&&w>Q.options.lineWidth}if(B){let w=V;for(let A of K)w+=A?`
76
+ ${$}${G}${A}`:`
77
+ `;return`${w}
78
+ ${G}${N}`}else return`${V}${W}${K.join(" ")}${W}${N}`}}function k6({indent:X,options:{commentString:Q}},J,Y,G){if(Y&&G)Y=Y.replace(/^\n+/,"");if(Y){let $=_6.indentComment(Q(Y),X);J.push($.trimStart())}}tD.stringifyCollection=oD});var m1=p((GZ)=>{var XZ=MQ(),QZ=VQ(),JZ=I6(),u1=K0(),v6=f1(),YZ=v0();function Z8(X,Q){let J=u1.isScalar(Q)?Q.value:Q;for(let Y of X)if(u1.isPair(Y)){if(Y.key===Q||Y.key===J)return Y;if(u1.isScalar(Y.key)&&Y.key.value===J)return Y}return}class o7 extends JZ.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(X){super(u1.MAP,X);this.items=[]}static from(X,Q,J){let{keepUndefined:Y,replacer:G}=J,$=new this(X),W=(H,U)=>{if(typeof G==="function")U=G.call(Q,H,U);else if(Array.isArray(G)&&!G.includes(H))return;if(U!==void 0||Y)$.items.push(v6.createPair(H,U,J))};if(Q instanceof Map)for(let[H,U]of Q)W(H,U);else if(Q&&typeof Q==="object")for(let H of Object.keys(Q))W(H,Q[H]);if(typeof X.sortMapEntries==="function")$.items.sort(X.sortMapEntries);return $}add(X,Q){let J;if(u1.isPair(X))J=X;else if(!X||typeof X!=="object"||!("key"in X))J=new v6.Pair(X,X?.value);else J=new v6.Pair(X.key,X.value);let Y=Z8(this.items,J.key),G=this.schema?.sortMapEntries;if(Y){if(!Q)throw Error(`Key ${J.key} already set`);if(u1.isScalar(Y.value)&&YZ.isScalarValue(J.value))Y.value.value=J.value;else Y.value=J.value}else if(G){let $=this.items.findIndex((W)=>G(J,W)<0);if($===-1)this.items.push(J);else this.items.splice($,0,J)}else this.items.push(J)}delete(X){let Q=Z8(this.items,X);if(!Q)return!1;return this.items.splice(this.items.indexOf(Q),1).length>0}get(X,Q){let Y=Z8(this.items,X)?.value;return(!Q&&u1.isScalar(Y)?Y.value:Y)??void 0}has(X){return!!Z8(this.items,X)}set(X,Q){this.add(new v6.Pair(X,Q),!0)}toJSON(X,Q,J){let Y=J?new J:Q?.mapAsMap?new Map:{};if(Q?.onCreate)Q.onCreate(Y);for(let G of this.items)QZ.addPairToJSMap(Q,Y,G);return Y}toString(X,Q,J){if(!X)return JSON.stringify(this);for(let Y of this.items)if(!u1.isPair(Y))throw Error(`Map items must all be pairs; found ${JSON.stringify(Y)} instead`);if(!X.allNullValues&&this.hasAllNullValues(!1))X=Object.assign({},X,{allNullValues:!0});return XZ.stringifyCollection(this,X,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:X.indent||"",onChompKeep:J,onComment:Q})}}GZ.YAMLMap=o7;GZ.findPair=Z8});var w9=p((BZ)=>{var HZ=K0(),a7=m1(),UZ={collection:"map",default:!0,nodeClass:a7.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(X,Q){if(!HZ.isMap(X))Q("Expected a mapping for this tag");return X},createNode:(X,Q,J)=>a7.YAMLMap.from(X,Q,J)};BZ.map=UZ});var l1=p((MZ)=>{var LZ=L8(),qZ=MQ(),FZ=I6(),x6=K0(),KZ=v0(),VZ=x1();class s7 extends FZ.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(X){super(x6.SEQ,X);this.items=[]}add(X){this.items.push(X)}delete(X){let Q=y6(X);if(typeof Q!=="number")return!1;return this.items.splice(Q,1).length>0}get(X,Q){let J=y6(X);if(typeof J!=="number")return;let Y=this.items[J];return!Q&&x6.isScalar(Y)?Y.value:Y}has(X){let Q=y6(X);return typeof Q==="number"&&Q<this.items.length}set(X,Q){let J=y6(X);if(typeof J!=="number")throw Error(`Expected a valid index, not ${X}.`);let Y=this.items[J];if(x6.isScalar(Y)&&KZ.isScalarValue(Q))Y.value=Q;else this.items[J]=Q}toJSON(X,Q){let J=[];if(Q?.onCreate)Q.onCreate(J);let Y=0;for(let G of this.items)J.push(VZ.toJS(G,String(Y++),Q));return J}toString(X,Q,J){if(!X)return JSON.stringify(this);return qZ.stringifyCollection(this,X,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(X.indent||"")+" ",onChompKeep:J,onComment:Q})}static from(X,Q,J){let{replacer:Y}=J,G=new this(X);if(Q&&Symbol.iterator in Object(Q)){let $=0;for(let W of Q){if(typeof Y==="function"){let H=Q instanceof Set?W:String($++);W=Y.call(Q,H,W)}G.items.push(LZ.createNode(W,void 0,J))}}return G}}function y6(X){let Q=x6.isScalar(X)?X.value:X;if(Q&&typeof Q==="string")Q=Number(Q);return typeof Q==="number"&&Number.isInteger(Q)&&Q>=0?Q:null}MZ.YAMLSeq=s7});var P9=p((AZ)=>{var ZZ=K0(),t7=l1(),OZ={collection:"seq",default:!0,nodeClass:t7.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(X,Q){if(!ZZ.isSeq(X))Q("Expected a sequence for this tag");return X},createNode:(X,Q,J)=>t7.YAMLSeq.from(X,Q,J)};AZ.seq=OZ});var O8=p((jZ)=>{var RZ=K8(),IZ={identify:(X)=>typeof X==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(X)=>X,stringify(X,Q,J,Y){return Q=Object.assign({actualString:!0},Q),RZ.stringifyString(X,Q,J,Y)}};jZ.string=IZ});var g6=p((PZ)=>{var e7=v0(),XY={identify:(X)=>X==null,createNode:()=>new e7.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new e7.Scalar(null),stringify:({source:X},Q)=>typeof X==="string"&&XY.test.test(X)?X:Q.options.nullStr};PZ.nullTag=XY});var DQ=p((EZ)=>{var SZ=v0(),QY={identify:(X)=>typeof X==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:(X)=>new SZ.Scalar(X[0]==="t"||X[0]==="T"),stringify({source:X,value:Q},J){if(X&&QY.test.test(X)){let Y=X[0]==="t"||X[0]==="T";if(Q===Y)return X}return Q?J.options.trueStr:J.options.falseStr}};EZ.boolTag=QY});var T9=p((_Z)=>{function CZ({format:X,minFractionDigits:Q,tag:J,value:Y}){if(typeof Y==="bigint")return String(Y);let G=typeof Y==="number"?Y:Number(Y);if(!isFinite(G))return isNaN(G)?".nan":G<0?"-.inf":".inf";let $=Object.is(Y,-0)?"-0":JSON.stringify(Y);if(!X&&Q&&(!J||J==="tag:yaml.org,2002:float")&&/^\d/.test($)){let W=$.indexOf(".");if(W<0)W=$.length,$+=".";let H=Q-($.length-W-1);while(H-- >0)$+="0"}return $}_Z.stringifyNumber=CZ});var OQ=p((hZ)=>{var vZ=v0(),ZQ=T9(),yZ={identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(X)=>X.slice(-3).toLowerCase()==="nan"?NaN:X[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ZQ.stringifyNumber},xZ={identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:(X)=>parseFloat(X),stringify(X){let Q=Number(X.value);return isFinite(Q)?Q.toExponential():ZQ.stringifyNumber(X)}},gZ={identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(X){let Q=new vZ.Scalar(parseFloat(X)),J=X.indexOf(".");if(J!==-1&&X[X.length-1]==="0")Q.minFractionDigits=X.length-J-1;return Q},stringify:ZQ.stringifyNumber};hZ.float=gZ;hZ.floatExp=xZ;hZ.floatNaN=yZ});var NQ=p((dZ)=>{var JY=T9(),h6=(X)=>typeof X==="bigint"||Number.isInteger(X),AQ=(X,Q,J,{intAsBigInt:Y})=>Y?BigInt(X):parseInt(X.substring(Q),J);function YY(X,Q,J){let{value:Y}=X;if(h6(Y)&&Y>=0)return J+Y.toString(Q);return JY.stringifyNumber(X)}var lZ={identify:(X)=>h6(X)&&X>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(X,Q,J)=>AQ(X,2,8,J),stringify:(X)=>YY(X,8,"0o")},cZ={identify:h6,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(X,Q,J)=>AQ(X,0,10,J),stringify:JY.stringifyNumber},pZ={identify:(X)=>h6(X)&&X>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(X,Q,J)=>AQ(X,2,16,J),stringify:(X)=>YY(X,16,"0x")};dZ.int=cZ;dZ.intHex=pZ;dZ.intOct=lZ});var GY=p((QO)=>{var oZ=w9(),aZ=g6(),sZ=P9(),tZ=O8(),eZ=DQ(),RQ=OQ(),IQ=NQ(),XO=[oZ.map,sZ.seq,tZ.string,aZ.nullTag,eZ.boolTag,IQ.intOct,IQ.int,IQ.intHex,RQ.floatNaN,RQ.floatExp,RQ.float];QO.schema=XO});var WY=p((BO)=>{var YO=v0(),GO=w9(),$O=P9();function $Y(X){return typeof X==="bigint"||Number.isInteger(X)}var f6=({value:X})=>JSON.stringify(X),WO=[{identify:(X)=>typeof X==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(X)=>X,stringify:f6},{identify:(X)=>X==null,createNode:()=>new YO.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:f6},{identify:(X)=>typeof X==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:(X)=>X==="true",stringify:f6},{identify:$Y,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(X,Q,{intAsBigInt:J})=>J?BigInt(X):parseInt(X,10),stringify:({value:X})=>$Y(X)?X.toString():JSON.stringify(X)},{identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:(X)=>parseFloat(X),stringify:f6}],HO={default:!0,tag:"",test:/^/,resolve(X,Q){return Q(`Unresolved plain scalar ${JSON.stringify(X)}`),X}},UO=[GO.map,$O.seq].concat(WO,HO);BO.schema=UO});var wQ=p((FO)=>{var A8=O1("buffer"),jQ=v0(),LO=K8(),qO={identify:(X)=>X instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(X,Q){if(typeof A8.Buffer==="function")return A8.Buffer.from(X,"base64");else if(typeof atob==="function"){let J=atob(X.replace(/[\n\r]/g,"")),Y=new Uint8Array(J.length);for(let G=0;G<J.length;++G)Y[G]=J.charCodeAt(G);return Y}else return Q("This environment does not support reading binary tags; either Buffer or atob is required"),X},stringify({comment:X,type:Q,value:J},Y,G,$){if(!J)return"";let W=J,H;if(typeof A8.Buffer==="function")H=W instanceof A8.Buffer?W.toString("base64"):A8.Buffer.from(W.buffer).toString("base64");else if(typeof btoa==="function"){let U="";for(let B=0;B<W.length;++B)U+=String.fromCharCode(W[B]);H=btoa(U)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(Q??(Q=jQ.Scalar.BLOCK_LITERAL),Q!==jQ.Scalar.QUOTE_DOUBLE){let U=Math.max(Y.options.lineWidth-Y.indent.length,Y.options.minContentWidth),B=Math.ceil(H.length/U),q=Array(B);for(let K=0,V=0;K<B;++K,V+=U)q[K]=H.substr(V,U);H=q.join(Q===jQ.Scalar.BLOCK_LITERAL?`
79
+ `:" ")}return LO.stringifyString({comment:X,type:Q,value:H},Y,G,$)}};FO.binary=qO});var m6=p((ZO)=>{var u6=K0(),PQ=f1(),VO=v0(),MO=l1();function HY(X,Q){if(u6.isSeq(X))for(let J=0;J<X.items.length;++J){let Y=X.items[J];if(u6.isPair(Y))continue;else if(u6.isMap(Y)){if(Y.items.length>1)Q("Each pair must have its own sequence indicator");let G=Y.items[0]||new PQ.Pair(new VO.Scalar(null));if(Y.commentBefore)G.key.commentBefore=G.key.commentBefore?`${Y.commentBefore}
80
+ ${G.key.commentBefore}`:Y.commentBefore;if(Y.comment){let $=G.value??G.key;$.comment=$.comment?`${Y.comment}
81
+ ${$.comment}`:Y.comment}Y=G}X.items[J]=u6.isPair(Y)?Y:new PQ.Pair(Y)}else Q("Expected a sequence for this tag");return X}function UY(X,Q,J){let{replacer:Y}=J,G=new MO.YAMLSeq(X);G.tag="tag:yaml.org,2002:pairs";let $=0;if(Q&&Symbol.iterator in Object(Q))for(let W of Q){if(typeof Y==="function")W=Y.call(Q,String($++),W);let H,U;if(Array.isArray(W))if(W.length===2)H=W[0],U=W[1];else throw TypeError(`Expected [key, value] tuple: ${W}`);else if(W&&W instanceof Object){let B=Object.keys(W);if(B.length===1)H=B[0],U=W[H];else throw TypeError(`Expected tuple with one key, not ${B.length} keys`)}else H=W;G.items.push(PQ.createPair(H,U,J))}return G}var DO={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:HY,createNode:UY};ZO.createPairs=UY;ZO.pairs=DO;ZO.resolvePairs=HY});var SQ=p((jO)=>{var BY=K0(),TQ=x1(),N8=m1(),RO=l1(),zY=m6();class e1 extends RO.YAMLSeq{constructor(){super();this.add=N8.YAMLMap.prototype.add.bind(this),this.delete=N8.YAMLMap.prototype.delete.bind(this),this.get=N8.YAMLMap.prototype.get.bind(this),this.has=N8.YAMLMap.prototype.has.bind(this),this.set=N8.YAMLMap.prototype.set.bind(this),this.tag=e1.tag}toJSON(X,Q){if(!Q)return super.toJSON(X);let J=new Map;if(Q?.onCreate)Q.onCreate(J);for(let Y of this.items){let G,$;if(BY.isPair(Y))G=TQ.toJS(Y.key,"",Q),$=TQ.toJS(Y.value,G,Q);else G=TQ.toJS(Y,"",Q);if(J.has(G))throw Error("Ordered maps must not include duplicate keys");J.set(G,$)}return J}static from(X,Q,J){let Y=zY.createPairs(X,Q,J),G=new this;return G.items=Y.items,G}}e1.tag="tag:yaml.org,2002:omap";var IO={collection:"seq",identify:(X)=>X instanceof Map,nodeClass:e1,default:!1,tag:"tag:yaml.org,2002:omap",resolve(X,Q){let J=zY.resolvePairs(X,Q),Y=[];for(let{key:G}of J.items)if(BY.isScalar(G))if(Y.includes(G.value))Q(`Ordered maps must not include duplicate keys: ${G.value}`);else Y.push(G.value);return Object.assign(new e1,J)},createNode:(X,Q,J)=>e1.from(X,Q,J)};jO.YAMLOMap=e1;jO.omap=IO});var VY=p((TO)=>{var LY=v0();function qY({value:X,source:Q},J){if(Q&&(X?FY:KY).test.test(Q))return Q;return X?J.options.trueStr:J.options.falseStr}var FY={identify:(X)=>X===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new LY.Scalar(!0),stringify:qY},KY={identify:(X)=>X===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new LY.Scalar(!1),stringify:qY};TO.falseTag=KY;TO.trueTag=FY});var MY=p((vO)=>{var bO=v0(),EQ=T9(),CO={identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(X)=>X.slice(-3).toLowerCase()==="nan"?NaN:X[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:EQ.stringifyNumber},_O={identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(X)=>parseFloat(X.replace(/_/g,"")),stringify(X){let Q=Number(X.value);return isFinite(Q)?Q.toExponential():EQ.stringifyNumber(X)}},kO={identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(X){let Q=new bO.Scalar(parseFloat(X.replace(/_/g,""))),J=X.indexOf(".");if(J!==-1){let Y=X.substring(J+1).replace(/_/g,"");if(Y[Y.length-1]==="0")Q.minFractionDigits=Y.length}return Q},stringify:EQ.stringifyNumber};vO.float=kO;vO.floatExp=_O;vO.floatNaN=CO});var ZY=p((lO)=>{var DY=T9(),R8=(X)=>typeof X==="bigint"||Number.isInteger(X);function l6(X,Q,J,{intAsBigInt:Y}){let G=X[0];if(G==="-"||G==="+")Q+=1;if(X=X.substring(Q).replace(/_/g,""),Y){switch(J){case 2:X=`0b${X}`;break;case 8:X=`0o${X}`;break;case 16:X=`0x${X}`;break}let W=BigInt(X);return G==="-"?BigInt(-1)*W:W}let $=parseInt(X,J);return G==="-"?-1*$:$}function bQ(X,Q,J){let{value:Y}=X;if(R8(Y)){let G=Y.toString(Q);return Y<0?"-"+J+G.substr(1):J+G}return DY.stringifyNumber(X)}var hO={identify:R8,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(X,Q,J)=>l6(X,2,2,J),stringify:(X)=>bQ(X,2,"0b")},fO={identify:R8,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(X,Q,J)=>l6(X,1,8,J),stringify:(X)=>bQ(X,8,"0")},uO={identify:R8,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(X,Q,J)=>l6(X,0,10,J),stringify:DY.stringifyNumber},mO={identify:R8,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(X,Q,J)=>l6(X,2,16,J),stringify:(X)=>bQ(X,16,"0x")};lO.int=uO;lO.intBin=hO;lO.intHex=mO;lO.intOct=fO});var CQ=p((rO)=>{var d6=K0(),c6=f1(),p6=m1();class X9 extends p6.YAMLMap{constructor(X){super(X);this.tag=X9.tag}add(X){let Q;if(d6.isPair(X))Q=X;else if(X&&typeof X==="object"&&"key"in X&&"value"in X&&X.value===null)Q=new c6.Pair(X.key,null);else Q=new c6.Pair(X,null);if(!p6.findPair(this.items,Q.key))this.items.push(Q)}get(X,Q){let J=p6.findPair(this.items,X);return!Q&&d6.isPair(J)?d6.isScalar(J.key)?J.key.value:J.key:J}set(X,Q){if(typeof Q!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof Q}`);let J=p6.findPair(this.items,X);if(J&&!Q)this.items.splice(this.items.indexOf(J),1);else if(!J&&Q)this.items.push(new c6.Pair(X))}toJSON(X,Q){return super.toJSON(X,Q,Set)}toString(X,Q,J){if(!X)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},X,{allNullValues:!0}),Q,J);else throw Error("Set items must all have null values")}static from(X,Q,J){let{replacer:Y}=J,G=new this(X);if(Q&&Symbol.iterator in Object(Q))for(let $ of Q){if(typeof Y==="function")$=Y.call(Q,$,$);G.items.push(c6.createPair($,null,J))}return G}}X9.tag="tag:yaml.org,2002:set";var nO={collection:"map",identify:(X)=>X instanceof Set,nodeClass:X9,default:!1,tag:"tag:yaml.org,2002:set",createNode:(X,Q,J)=>X9.from(X,Q,J),resolve(X,Q){if(d6.isMap(X))if(X.hasAllNullValues(!0))return Object.assign(new X9,X);else Q("Set items must all have null values");else Q("Expected a mapping for this tag");return X}};rO.YAMLSet=X9;rO.set=nO});var kQ=p((XA)=>{var sO=T9();function _Q(X,Q){let J=X[0],Y=J==="-"||J==="+"?X.substring(1):X,G=(W)=>Q?BigInt(W):Number(W),$=Y.replace(/_/g,"").split(":").reduce((W,H)=>W*G(60)+G(H),G(0));return J==="-"?G(-1)*$:$}function OY(X){let{value:Q}=X,J=(W)=>W;if(typeof Q==="bigint")J=(W)=>BigInt(W);else if(isNaN(Q)||!isFinite(Q))return sO.stringifyNumber(X);let Y="";if(Q<0)Y="-",Q*=J(-1);let G=J(60),$=[Q%G];if(Q<60)$.unshift(0);else if(Q=(Q-$[0])/G,$.unshift(Q%G),Q>=60)Q=(Q-$[0])/G,$.unshift(Q);return Y+$.map((W)=>String(W).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var tO={identify:(X)=>typeof X==="bigint"||Number.isInteger(X),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(X,Q,{intAsBigInt:J})=>_Q(X,J),stringify:OY},eO={identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(X)=>_Q(X,!1),stringify:OY},AY={identify:(X)=>X 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(X){let Q=X.match(AY.test);if(!Q)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,J,Y,G,$,W,H]=Q.map(Number),U=Q[7]?Number((Q[7]+"00").substr(1,3)):0,B=Date.UTC(J,Y-1,G,$||0,W||0,H||0,U),q=Q[8];if(q&&q!=="Z"){let K=_Q(q,!1);if(Math.abs(K)<30)K*=60;B-=60000*K}return new Date(B)},stringify:({value:X})=>X?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};XA.floatTime=eO;XA.intTime=tO;XA.timestamp=AY});var RY=p((KA)=>{var GA=w9(),$A=g6(),WA=P9(),HA=O8(),UA=wQ(),NY=VY(),vQ=MY(),i6=ZY(),BA=E6(),zA=SQ(),LA=m6(),qA=CQ(),yQ=kQ(),FA=[GA.map,WA.seq,HA.string,$A.nullTag,NY.trueTag,NY.falseTag,i6.intBin,i6.intOct,i6.int,i6.intHex,vQ.floatNaN,vQ.floatExp,vQ.float,UA.binary,BA.merge,zA.omap,LA.pairs,qA.set,yQ.intTime,yQ.floatTime,yQ.timestamp];KA.schema=FA});var _Y=p((IA)=>{var PY=w9(),MA=g6(),TY=P9(),DA=O8(),ZA=DQ(),xQ=OQ(),gQ=NQ(),OA=GY(),AA=WY(),SY=wQ(),I8=E6(),EY=SQ(),bY=m6(),IY=RY(),CY=CQ(),n6=kQ(),jY=new Map([["core",OA.schema],["failsafe",[PY.map,TY.seq,DA.string]],["json",AA.schema],["yaml11",IY.schema],["yaml-1.1",IY.schema]]),wY={binary:SY.binary,bool:ZA.boolTag,float:xQ.float,floatExp:xQ.floatExp,floatNaN:xQ.floatNaN,floatTime:n6.floatTime,int:gQ.int,intHex:gQ.intHex,intOct:gQ.intOct,intTime:n6.intTime,map:PY.map,merge:I8.merge,null:MA.nullTag,omap:EY.omap,pairs:bY.pairs,seq:TY.seq,set:CY.set,timestamp:n6.timestamp},NA={"tag:yaml.org,2002:binary":SY.binary,"tag:yaml.org,2002:merge":I8.merge,"tag:yaml.org,2002:omap":EY.omap,"tag:yaml.org,2002:pairs":bY.pairs,"tag:yaml.org,2002:set":CY.set,"tag:yaml.org,2002:timestamp":n6.timestamp};function RA(X,Q,J){let Y=jY.get(Q);if(Y&&!X)return J&&!Y.includes(I8.merge)?Y.concat(I8.merge):Y.slice();let G=Y;if(!G)if(Array.isArray(X))G=[];else{let $=Array.from(jY.keys()).filter((W)=>W!=="yaml11").map((W)=>JSON.stringify(W)).join(", ");throw Error(`Unknown schema "${Q}"; use one of ${$} or define customTags array`)}if(Array.isArray(X))for(let $ of X)G=G.concat($);else if(typeof X==="function")G=X(G.slice());if(J)G=G.concat(I8.merge);return G.reduce(($,W)=>{let H=typeof W==="string"?wY[W]:W;if(!H){let U=JSON.stringify(W),B=Object.keys(wY).map((q)=>JSON.stringify(q)).join(", ");throw Error(`Unknown custom tag ${U}; use one of ${B}`)}if(!$.includes(H))$.push(H);return $},[])}IA.coreKnownTags=NA;IA.getTags=RA});var uQ=p((bA)=>{var hQ=K0(),PA=w9(),TA=P9(),SA=O8(),r6=_Y(),EA=(X,Q)=>X.key<Q.key?-1:X.key>Q.key?1:0;class fQ{constructor({compat:X,customTags:Q,merge:J,resolveKnownTags:Y,schema:G,sortMapEntries:$,toStringDefaults:W}){this.compat=Array.isArray(X)?r6.getTags(X,"compat"):X?r6.getTags(null,X):null,this.name=typeof G==="string"&&G||"core",this.knownTags=Y?r6.coreKnownTags:{},this.tags=r6.getTags(Q,this.name,J),this.toStringOptions=W??null,Object.defineProperty(this,hQ.MAP,{value:PA.map}),Object.defineProperty(this,hQ.SCALAR,{value:SA.string}),Object.defineProperty(this,hQ.SEQ,{value:TA.seq}),this.sortMapEntries=typeof $==="function"?$:$===!0?EA:null}clone(){let X=Object.create(fQ.prototype,Object.getOwnPropertyDescriptors(this));return X.tags=this.tags.slice(),X}}bA.Schema=fQ});var kY=p((vA)=>{var _A=K0(),mQ=V8(),j8=q8();function kA(X,Q){let J=[],Y=Q.directives===!0;if(Q.directives!==!1&&X.directives){let U=X.directives.toString(X);if(U)J.push(U),Y=!0;else if(X.directives.docStart)Y=!0}if(Y)J.push("---");let G=mQ.createStringifyContext(X,Q),{commentString:$}=G.options;if(X.commentBefore){if(J.length!==1)J.unshift("");let U=$(X.commentBefore);J.unshift(j8.indentComment(U,""))}let W=!1,H=null;if(X.contents){if(_A.isNode(X.contents)){if(X.contents.spaceBefore&&Y)J.push("");if(X.contents.commentBefore){let q=$(X.contents.commentBefore);J.push(j8.indentComment(q,""))}G.forceBlockIndent=!!X.comment,H=X.contents.comment}let U=H?void 0:()=>W=!0,B=mQ.stringify(X.contents,G,()=>H=null,U);if(H)B+=j8.lineComment(B,"",$(H));if((B[0]==="|"||B[0]===">")&&J[J.length-1]==="---")J[J.length-1]=`--- ${B}`;else J.push(B)}else J.push(mQ.stringify(X.contents,G));if(X.directives?.docEnd)if(X.comment){let U=$(X.comment);if(U.includes(`
82
+ `))J.push("..."),J.push(j8.indentComment(U,""));else J.push(`... ${U}`)}else J.push("...");else{let U=X.comment;if(U&&W)U=U.replace(/^\n+/,"");if(U){if((!W||H)&&J[J.length-1]!=="")J.push("");J.push(j8.indentComment($(U),""))}}return J.join(`
83
+ `)+`
84
+ `}vA.stringifyDocument=kA});var w8=p((cA)=>{var xA=z8(),S9=I6(),J1=K0(),gA=f1(),hA=x1(),fA=uQ(),uA=kY(),lQ=A6(),mA=HQ(),lA=L8(),cQ=WQ();class pQ{constructor(X,Q,J){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,J1.NODE_TYPE,{value:J1.DOC});let Y=null;if(typeof Q==="function"||Array.isArray(Q))Y=Q;else if(J===void 0&&Q)J=Q,Q=void 0;let G=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},J);this.options=G;let{version:$}=G;if(J?._directives){if(this.directives=J._directives.atDocument(),this.directives.yaml.explicit)$=this.directives.yaml.version}else this.directives=new cQ.Directives({version:$});this.setSchema($,J),this.contents=X===void 0?null:this.createNode(X,Y,J)}clone(){let X=Object.create(pQ.prototype,{[J1.NODE_TYPE]:{value:J1.DOC}});if(X.commentBefore=this.commentBefore,X.comment=this.comment,X.errors=this.errors.slice(),X.warnings=this.warnings.slice(),X.options=Object.assign({},this.options),this.directives)X.directives=this.directives.clone();if(X.schema=this.schema.clone(),X.contents=J1.isNode(this.contents)?this.contents.clone(X.schema):this.contents,this.range)X.range=this.range.slice();return X}add(X){if(E9(this.contents))this.contents.add(X)}addIn(X,Q){if(E9(this.contents))this.contents.addIn(X,Q)}createAlias(X,Q){if(!X.anchor){let J=lQ.anchorNames(this);X.anchor=!Q||J.has(Q)?lQ.findNewAnchor(Q||"a",J):Q}return new xA.Alias(X.anchor)}createNode(X,Q,J){let Y=void 0;if(typeof Q==="function")X=Q.call({"":X},"",X),Y=Q;else if(Array.isArray(Q)){let A=(z)=>typeof z==="number"||z instanceof String||z instanceof Number,Z=Q.filter(A).map(String);if(Z.length>0)Q=Q.concat(Z);Y=Q}else if(J===void 0&&Q)J=Q,Q=void 0;let{aliasDuplicateObjects:G,anchorPrefix:$,flow:W,keepUndefined:H,onTagObj:U,tag:B}=J??{},{onAnchor:q,setAnchors:K,sourceObjects:V}=lQ.createNodeAnchors(this,$||"a"),N={aliasDuplicateObjects:G??!0,keepUndefined:H??!1,onAnchor:q,onTagObj:U,replacer:Y,schema:this.schema,sourceObjects:V},w=lA.createNode(X,B,N);if(W&&J1.isCollection(w))w.flow=!0;return K(),w}createPair(X,Q,J={}){let Y=this.createNode(X,null,J),G=this.createNode(Q,null,J);return new gA.Pair(Y,G)}delete(X){return E9(this.contents)?this.contents.delete(X):!1}deleteIn(X){if(S9.isEmptyPath(X)){if(this.contents==null)return!1;return this.contents=null,!0}return E9(this.contents)?this.contents.deleteIn(X):!1}get(X,Q){return J1.isCollection(this.contents)?this.contents.get(X,Q):void 0}getIn(X,Q){if(S9.isEmptyPath(X))return!Q&&J1.isScalar(this.contents)?this.contents.value:this.contents;return J1.isCollection(this.contents)?this.contents.getIn(X,Q):void 0}has(X){return J1.isCollection(this.contents)?this.contents.has(X):!1}hasIn(X){if(S9.isEmptyPath(X))return this.contents!==void 0;return J1.isCollection(this.contents)?this.contents.hasIn(X):!1}set(X,Q){if(this.contents==null)this.contents=S9.collectionFromPath(this.schema,[X],Q);else if(E9(this.contents))this.contents.set(X,Q)}setIn(X,Q){if(S9.isEmptyPath(X))this.contents=Q;else if(this.contents==null)this.contents=S9.collectionFromPath(this.schema,Array.from(X),Q);else if(E9(this.contents))this.contents.setIn(X,Q)}setSchema(X,Q={}){if(typeof X==="number")X=String(X);let J;switch(X){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new cQ.Directives({version:"1.1"});J={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=X;else this.directives=new cQ.Directives({version:X});J={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;J=null;break;default:{let Y=JSON.stringify(X);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${Y}`)}}if(Q.schema instanceof Object)this.schema=Q.schema;else if(J)this.schema=new fA.Schema(Object.assign(J,Q));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:X,jsonArg:Q,mapAsMap:J,maxAliasCount:Y,onAnchor:G,reviver:$}={}){let W={anchors:new Map,doc:this,keep:!X,mapAsMap:J===!0,mapKeyWarned:!1,maxAliasCount:typeof Y==="number"?Y:100},H=hA.toJS(this.contents,Q??"",W);if(typeof G==="function")for(let{count:U,res:B}of W.anchors.values())G(B,U);return typeof $==="function"?mA.applyReviver($,{"":H},"",H):H}toJSON(X,Q){return this.toJS({json:!0,jsonArg:X,mapAsMap:!1,onAnchor:Q})}toString(X={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in X&&(!Number.isInteger(X.indent)||Number(X.indent)<=0)){let Q=JSON.stringify(X.indent);throw Error(`"indent" option must be a positive integer, not ${Q}`)}return uA.stringifyDocument(this,X)}}function E9(X){if(J1.isCollection(X))return!0;throw Error("Expected a YAML collection as document contents")}cA.Document=pQ});var P8=p((iA)=>{class o6 extends Error{constructor(X,Q,J,Y){super();this.name=X,this.code=J,this.message=Y,this.pos=Q}}class vY extends o6{constructor(X,Q,J){super("YAMLParseError",X,Q,J)}}class yY extends o6{constructor(X,Q,J){super("YAMLWarning",X,Q,J)}}var dA=(X,Q)=>(J)=>{if(J.pos[0]===-1)return;J.linePos=J.pos.map((H)=>Q.linePos(H));let{line:Y,col:G}=J.linePos[0];J.message+=` at line ${Y}, column ${G}`;let $=G-1,W=X.substring(Q.lineStarts[Y-1],Q.lineStarts[Y]).replace(/[\n\r]+$/,"");if($>=60&&W.length>80){let H=Math.min($-39,W.length-79);W="…"+W.substring(H),$-=H-1}if(W.length>80)W=W.substring(0,79)+"…";if(Y>1&&/^ *$/.test(W.substring(0,$))){let H=X.substring(Q.lineStarts[Y-2],Q.lineStarts[Y-1]);if(H.length>80)H=H.substring(0,79)+`…
85
+ `;W=H+W}if(/[^ ]/.test(W)){let H=1,U=J.linePos[1];if(U?.line===Y&&U.col>G)H=Math.max(1,Math.min(U.col-G,80-$));let B=" ".repeat($)+"^".repeat(H);J.message+=`:
86
+
35
87
  ${W}
36
- ${N}`)}return W},D=xX(P5);class u$ extends S{list($={},X){let{betas:J,...Z}=$??{};return this._client.getAPIList("/v1/files",u,{query:Z,...X,headers:M([{"anthropic-beta":[...J??[],"files-api-2025-04-14"].toString()},X?.headers])})}delete($,X={},J){let{betas:Z}=X??{};return this._client.delete(D`/v1/files/${$}`,{...J,headers:M([{"anthropic-beta":[...Z??[],"files-api-2025-04-14"].toString()},J?.headers])})}download($,X={},J){let{betas:Z}=X??{};return this._client.get(D`/v1/files/${$}/content`,{...J,headers:M([{"anthropic-beta":[...Z??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},J?.headers]),__binaryResponse:!0})}retrieveMetadata($,X={},J){let{betas:Z}=X??{};return this._client.get(D`/v1/files/${$}`,{...J,headers:M([{"anthropic-beta":[...Z??[],"files-api-2025-04-14"].toString()},J?.headers])})}upload($,X){let{betas:J,...Z}=$;return this._client.post("/v1/files",q$({body:Z,...X,headers:M([{"anthropic-beta":[...J??[],"files-api-2025-04-14"].toString()},X?.headers])},this._client))}}class m$ extends S{retrieve($,X={},J){let{betas:Z}=X??{};return this._client.get(D`/v1/models/${$}?beta=true`,{...J,headers:M([{...Z?.toString()!=null?{"anthropic-beta":Z?.toString()}:void 0},J?.headers])})}list($={},X){let{betas:J,...Z}=$??{};return this._client.getAPIList("/v1/models?beta=true",u,{query:Z,...X,headers:M([{...J?.toString()!=null?{"anthropic-beta":J?.toString()}:void 0},X?.headers])})}}var C0={"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 H1($,X,J){if(!X||!("parse"in(X.output_format??{})))return{...$,content:$.content.map((Z)=>{if(Z.type==="text"){let z=Object.defineProperty({...Z},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(z,"parsed",{get(){return J.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return Z}),parsed_output:null};return w1($,X,J)}function w1($,X,J){let Z=null,z=$.content.map((Y)=>{if(Y.type==="text"){let W=CX(X,Y.text);if(Z===null)Z=W;let Q=Object.defineProperty({...Y},"parsed_output",{value:W,enumerable:!1});return Object.defineProperty(Q,"parsed",{get(){return J.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),W},enumerable:!1})}return Y});return{...$,content:z,parsed_output:Z}}function CX($,X){if($.output_format?.type!=="json_schema")return null;try{if("parse"in $.output_format)return $.output_format.parse(X);return JSON.parse(X)}catch(J){throw new H(`Failed to parse structured output: ${J}`)}}var AX=($)=>{let X=0,J=[];while(X<$.length){let Z=$[X];if(Z==="\\"){X++;continue}if(Z==="{"){J.push({type:"brace",value:"{"}),X++;continue}if(Z==="}"){J.push({type:"brace",value:"}"}),X++;continue}if(Z==="["){J.push({type:"paren",value:"["}),X++;continue}if(Z==="]"){J.push({type:"paren",value:"]"}),X++;continue}if(Z===":"){J.push({type:"separator",value:":"}),X++;continue}if(Z===","){J.push({type:"delimiter",value:","}),X++;continue}if(Z==='"'){let Q="",G=!1;Z=$[++X];while(Z!=='"'){if(X===$.length){G=!0;break}if(Z==="\\"){if(X++,X===$.length){G=!0;break}Q+=Z+$[X],Z=$[++X]}else Q+=Z,Z=$[++X]}if(Z=$[++X],!G)J.push({type:"string",value:Q});continue}if(Z&&/\s/.test(Z)){X++;continue}let Y=/[0-9]/;if(Z&&Y.test(Z)||Z==="-"||Z==="."){let Q="";if(Z==="-")Q+=Z,Z=$[++X];while(Z&&Y.test(Z)||Z===".")Q+=Z,Z=$[++X];J.push({type:"number",value:Q});continue}let W=/[a-z]/i;if(Z&&W.test(Z)){let Q="";while(Z&&W.test(Z)){if(X===$.length)break;Q+=Z,Z=$[++X]}if(Q=="true"||Q=="false"||Q==="null")J.push({type:"name",value:Q});else{X++;continue}continue}X++}return J},U$=($)=>{if($.length===0)return $;let X=$[$.length-1];switch(X.type){case"separator":return $=$.slice(0,$.length-1),U$($);break;case"number":let J=X.value[X.value.length-1];if(J==="."||J==="-")return $=$.slice(0,$.length-1),U$($);case"string":let Z=$[$.length-2];if(Z?.type==="delimiter")return $=$.slice(0,$.length-1),U$($);else if(Z?.type==="brace"&&Z.value==="{")return $=$.slice(0,$.length-1),U$($);break;case"delimiter":return $=$.slice(0,$.length-1),U$($);break}return $},RX=($)=>{let X=[];if($.map((J)=>{if(J.type==="brace")if(J.value==="{")X.push("}");else X.splice(X.lastIndexOf("}"),1);if(J.type==="paren")if(J.value==="[")X.push("]");else X.splice(X.lastIndexOf("]"),1)}),X.length>0)X.reverse().map((J)=>{if(J==="}")$.push({type:"brace",value:"}"});else if(J==="]")$.push({type:"paren",value:"]"})});return $},fX=($)=>{let X="";return $.map((J)=>{switch(J.type){case"string":X+='"'+J.value+'"';break;default:X+=J.value;break}}),X},A0=($)=>JSON.parse(fX(RX(U$(AX($)))));var h,e,N$,d$,R0,p$,l$,f0,i$,o,n$,k0,y0,W$,_0,b0,o$,M1,C5,h0,T1,L1,D1,A5,R5="__json_buf";function f5($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}class a${constructor($,X){h.add(this),this.messages=[],this.receivedMessages=[],e.set(this,void 0),N$.set(this,null),this.controller=new AbortController,d$.set(this,void 0),R0.set(this,()=>{}),p$.set(this,()=>{}),l$.set(this,void 0),f0.set(this,()=>{}),i$.set(this,()=>{}),o.set(this,{}),n$.set(this,!1),k0.set(this,!1),y0.set(this,!1),W$.set(this,!1),_0.set(this,void 0),b0.set(this,void 0),o$.set(this,void 0),h0.set(this,(J)=>{if(U(this,k0,!0,"f"),i(J))J=new C;if(J instanceof C)return U(this,y0,!0,"f"),this._emit("abort",J);if(J instanceof H)return this._emit("error",J);if(J instanceof Error){let Z=new H(J.message);return Z.cause=J,this._emit("error",Z)}return this._emit("error",new H(String(J)))}),U(this,d$,new Promise((J,Z)=>{U(this,R0,J,"f"),U(this,p$,Z,"f")}),"f"),U(this,l$,new Promise((J,Z)=>{U(this,f0,J,"f"),U(this,i$,Z,"f")}),"f"),K(this,d$,"f").catch(()=>{}),K(this,l$,"f").catch(()=>{}),U(this,N$,$,"f"),U(this,o$,X?.logger??console,"f")}get response(){return K(this,_0,"f")}get request_id(){return K(this,b0,"f")}async withResponse(){U(this,W$,!0,"f");let $=await K(this,d$,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let X=new a$(null);return X._run(()=>X._fromReadableStream($)),X}static createMessage($,X,J,{logger:Z}={}){let z=new a$(X,{logger:Z});for(let Y of X.messages)z._addMessageParam(Y);return U(z,N$,{...X,stream:!0},"f"),z._run(()=>z._createMessage($,{...X,stream:!0},{...J,headers:{...J?.headers,"X-Stainless-Helper-Method":"stream"}})),z}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},K(this,h0,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,X=!0){if(this.receivedMessages.push($),X)this._emit("message",$)}async _createMessage($,X,J){let Z=J?.signal,z;if(Z){if(Z.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),Z.addEventListener("abort",z)}try{K(this,h,"m",T1).call(this);let{response:Y,data:W}=await $.create({...X,stream:!0},{...J,signal:this.controller.signal}).withResponse();this._connected(Y);for await(let Q of W)K(this,h,"m",L1).call(this,Q);if(W.controller.signal?.aborted)throw new C;K(this,h,"m",D1).call(this)}finally{if(Z&&z)Z.removeEventListener("abort",z)}}_connected($){if(this.ended)return;U(this,_0,$,"f"),U(this,b0,$?.headers.get("request-id"),"f"),K(this,R0,"f").call(this,$),this._emit("connect")}get ended(){return K(this,n$,"f")}get errored(){return K(this,k0,"f")}get aborted(){return K(this,y0,"f")}abort(){this.controller.abort()}on($,X){return(K(this,o,"f")[$]||(K(this,o,"f")[$]=[])).push({listener:X}),this}off($,X){let J=K(this,o,"f")[$];if(!J)return this;let Z=J.findIndex((z)=>z.listener===X);if(Z>=0)J.splice(Z,1);return this}once($,X){return(K(this,o,"f")[$]||(K(this,o,"f")[$]=[])).push({listener:X,once:!0}),this}emitted($){return new Promise((X,J)=>{if(U(this,W$,!0,"f"),$!=="error")this.once("error",J);this.once($,X)})}async done(){U(this,W$,!0,"f"),await K(this,l$,"f")}get currentMessage(){return K(this,e,"f")}async finalMessage(){return await this.done(),K(this,h,"m",M1).call(this)}async finalText(){return await this.done(),K(this,h,"m",C5).call(this)}_emit($,...X){if(K(this,n$,"f"))return;if($==="end")U(this,n$,!0,"f"),K(this,f0,"f").call(this);let J=K(this,o,"f")[$];if(J)K(this,o,"f")[$]=J.filter((Z)=>!Z.once),J.forEach(({listener:Z})=>Z(...X));if($==="abort"){let Z=X[0];if(!K(this,W$,"f")&&!J?.length)Promise.reject(Z);K(this,p$,"f").call(this,Z),K(this,i$,"f").call(this,Z),this._emit("end");return}if($==="error"){let Z=X[0];if(!K(this,W$,"f")&&!J?.length)Promise.reject(Z);K(this,p$,"f").call(this,Z),K(this,i$,"f").call(this,Z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",K(this,h,"m",M1).call(this))}async _fromReadableStream($,X){let J=X?.signal,Z;if(J){if(J.aborted)this.controller.abort();Z=this.controller.abort.bind(this.controller),J.addEventListener("abort",Z)}try{K(this,h,"m",T1).call(this),this._connected(null);let z=y.fromReadableStream($,this.controller);for await(let Y of z)K(this,h,"m",L1).call(this,Y);if(z.controller.signal?.aborted)throw new C;K(this,h,"m",D1).call(this)}finally{if(J&&Z)J.removeEventListener("abort",Z)}}[(e=new WeakMap,N$=new WeakMap,d$=new WeakMap,R0=new WeakMap,p$=new WeakMap,l$=new WeakMap,f0=new WeakMap,i$=new WeakMap,o=new WeakMap,n$=new WeakMap,k0=new WeakMap,y0=new WeakMap,W$=new WeakMap,_0=new WeakMap,b0=new WeakMap,o$=new WeakMap,h0=new WeakMap,h=new WeakSet,M1=function(){if(this.receivedMessages.length===0)throw new H("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},C5=function(){if(this.receivedMessages.length===0)throw new H("stream ended without producing a Message with role=assistant");let X=this.receivedMessages.at(-1).content.filter((J)=>J.type==="text").map((J)=>J.text);if(X.length===0)throw new H("stream ended without producing a content block with type=text");return X.join(" ")},T1=function(){if(this.ended)return;U(this,e,void 0,"f")},L1=function(X){if(this.ended)return;let J=K(this,h,"m",A5).call(this,X);switch(this._emit("streamEvent",X,J),X.type){case"content_block_delta":{let Z=J.content.at(-1);switch(X.delta.type){case"text_delta":{if(Z.type==="text")this._emit("text",X.delta.text,Z.text||"");break}case"citations_delta":{if(Z.type==="text")this._emit("citation",X.delta.citation,Z.citations??[]);break}case"input_json_delta":{if(f5(Z)&&Z.input)this._emit("inputJson",X.delta.partial_json,Z.input);break}case"thinking_delta":{if(Z.type==="thinking")this._emit("thinking",X.delta.thinking,Z.thinking);break}case"signature_delta":{if(Z.type==="thinking")this._emit("signature",Z.signature);break}default:k5(X.delta)}break}case"message_stop":{this._addMessageParam(J),this._addMessage(H1(J,K(this,N$,"f"),{logger:K(this,o$,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",J.content.at(-1));break}case"message_start":{U(this,e,J,"f");break}case"content_block_start":case"message_delta":break}},D1=function(){if(this.ended)throw new H("stream has ended, this shouldn't happen");let X=K(this,e,"f");if(!X)throw new H("request ended without sending any chunks");return U(this,e,void 0,"f"),H1(X,K(this,N$,"f"),{logger:K(this,o$,"f")})},A5=function(X){let J=K(this,e,"f");if(X.type==="message_start"){if(J)throw new H(`Unexpected event order, got ${X.type} before receiving "message_stop"`);return X.message}if(!J)throw new H(`Unexpected event order, got ${X.type} before "message_start"`);switch(X.type){case"message_stop":return J;case"message_delta":if(J.container=X.delta.container,J.stop_reason=X.delta.stop_reason,J.stop_sequence=X.delta.stop_sequence,J.usage.output_tokens=X.usage.output_tokens,J.context_management=X.context_management,X.usage.input_tokens!=null)J.usage.input_tokens=X.usage.input_tokens;if(X.usage.cache_creation_input_tokens!=null)J.usage.cache_creation_input_tokens=X.usage.cache_creation_input_tokens;if(X.usage.cache_read_input_tokens!=null)J.usage.cache_read_input_tokens=X.usage.cache_read_input_tokens;if(X.usage.server_tool_use!=null)J.usage.server_tool_use=X.usage.server_tool_use;return J;case"content_block_start":return J.content.push(X.content_block),J;case"content_block_delta":{let Z=J.content.at(X.index);switch(X.delta.type){case"text_delta":{if(Z?.type==="text")J.content[X.index]={...Z,text:(Z.text||"")+X.delta.text};break}case"citations_delta":{if(Z?.type==="text")J.content[X.index]={...Z,citations:[...Z.citations??[],X.delta.citation]};break}case"input_json_delta":{if(Z&&f5(Z)){let z=Z[R5]||"";z+=X.delta.partial_json;let Y={...Z};if(Object.defineProperty(Y,R5,{value:z,enumerable:!1,writable:!0}),z)try{Y.input=A0(z)}catch(W){let Q=new H(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${W}. JSON: ${z}`);K(this,h0,"f").call(this,Q)}J.content[X.index]=Y}break}case"thinking_delta":{if(Z?.type==="thinking")J.content[X.index]={...Z,thinking:Z.thinking+X.delta.thinking};break}case"signature_delta":{if(Z?.type==="thinking")J.content[X.index]={...Z,signature:X.delta.signature};break}default:k5(X.delta)}return J}case"content_block_stop":return J}},Symbol.asyncIterator)](){let $=[],X=[],J=!1;return this.on("streamEvent",(Z)=>{let z=X.shift();if(z)z.resolve(Z);else $.push(Z)}),this.on("end",()=>{J=!0;for(let Z of X)Z.resolve(void 0);X.length=0}),this.on("abort",(Z)=>{J=!0;for(let z of X)z.reject(Z);X.length=0}),this.on("error",(Z)=>{J=!0;for(let z of X)z.reject(Z);X.length=0}),{next:async()=>{if(!$.length){if(J)return{value:void 0,done:!0};return new Promise((z,Y)=>X.push({resolve:z,reject:Y})).then((z)=>z?{value:z,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 y(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function k5($){}var y5=1e5,_5=`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:
37
- 1. Task Overview
38
- The user's core request and success criteria
39
- Any clarifications or constraints they specified
40
- 2. Current State
41
- What has been completed so far
42
- Files created, modified, or analyzed (with paths if relevant)
43
- Key outputs or artifacts produced
44
- 3. Important Discoveries
45
- Technical constraints or requirements uncovered
46
- Decisions made and their rationale
47
- Errors encountered and how they were resolved
48
- What approaches were tried that didn't work (and why)
49
- 4. Next Steps
50
- Specific actions needed to complete the task
51
- Any blockers or open questions to resolve
52
- Priority order if multiple steps remain
53
- 5. Context to Preserve
54
- User preferences or style requirements
55
- Domain-specific details that aren't obvious
56
- Any promises made to the user
57
- 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.
58
- Wrap your summary in <summary></summary> tags.`;var t$,H$,Q$,x,s$,_,a,$$,r$,b5,E1;function h5(){let $,X;return{promise:new Promise((Z,z)=>{$=Z,X=z}),resolve:$,reject:X}}class e${constructor($,X,J){t$.add(this),this.client=$,H$.set(this,!1),Q$.set(this,!1),x.set(this,void 0),s$.set(this,void 0),_.set(this,void 0),a.set(this,void 0),$$.set(this,void 0),r$.set(this,0),U(this,x,{params:{...X,messages:structuredClone(X.messages)}},"f"),U(this,s$,{...J,headers:M([{"x-stainless-helper":"BetaToolRunner"},J?.headers])},"f"),U(this,$$,h5(),"f")}async*[(H$=new WeakMap,Q$=new WeakMap,x=new WeakMap,s$=new WeakMap,_=new WeakMap,a=new WeakMap,$$=new WeakMap,r$=new WeakMap,t$=new WeakSet,b5=async function(){let X=K(this,x,"f").params.compactionControl;if(!X||!X.enabled)return!1;let J=0;if(K(this,_,"f")!==void 0)try{let G=await K(this,_,"f");J=G.usage.input_tokens+(G.usage.cache_creation_input_tokens??0)+(G.usage.cache_read_input_tokens??0)+G.usage.output_tokens}catch{return!1}let Z=X.contextTokenThreshold??y5;if(J<Z)return!1;let z=X.model??K(this,x,"f").params.model,Y=X.summaryPrompt??_5,W=K(this,x,"f").params.messages;if(W[W.length-1].role==="assistant"){let G=W[W.length-1];if(Array.isArray(G.content)){let V=G.content.filter((q)=>q.type!=="tool_use");if(V.length===0)W.pop();else G.content=V}}let Q=await this.client.beta.messages.create({model:z,messages:[...W,{role:"user",content:[{type:"text",text:Y}]}],max_tokens:K(this,x,"f").params.max_tokens},{headers:{"x-stainless-helper":"compaction"}});if(Q.content[0]?.type!=="text")throw new H("Expected text response for compaction");return K(this,x,"f").params.messages=[{role:"user",content:Q.content}],!0},Symbol.asyncIterator)](){var $;if(K(this,H$,"f"))throw new H("Cannot iterate over a consumed stream");U(this,H$,!0,"f"),U(this,Q$,!0,"f"),U(this,a,void 0,"f");try{while(!0){let X;try{if(K(this,x,"f").params.max_iterations&&K(this,r$,"f")>=K(this,x,"f").params.max_iterations)break;U(this,Q$,!1,"f"),U(this,a,void 0,"f"),U(this,r$,($=K(this,r$,"f"),$++,$),"f"),U(this,_,void 0,"f");let{max_iterations:J,compactionControl:Z,...z}=K(this,x,"f").params;if(z.stream)X=this.client.beta.messages.stream({...z},K(this,s$,"f")),U(this,_,X.finalMessage(),"f"),K(this,_,"f").catch(()=>{}),yield X;else U(this,_,this.client.beta.messages.create({...z,stream:!1},K(this,s$,"f")),"f"),yield K(this,_,"f");if(!await K(this,t$,"m",b5).call(this)){if(!K(this,Q$,"f")){let{role:Q,content:G}=await K(this,_,"f");K(this,x,"f").params.messages.push({role:Q,content:G})}let W=await K(this,t$,"m",E1).call(this,K(this,x,"f").params.messages.at(-1));if(W)K(this,x,"f").params.messages.push(W);else if(!K(this,Q$,"f"))break}}finally{if(X)X.abort()}}if(!K(this,_,"f"))throw new H("ToolRunner concluded without a message from the server");K(this,$$,"f").resolve(await K(this,_,"f"))}catch(X){throw U(this,H$,!1,"f"),K(this,$$,"f").promise.catch(()=>{}),K(this,$$,"f").reject(X),U(this,$$,h5(),"f"),X}}setMessagesParams($){if(typeof $==="function")K(this,x,"f").params=$(K(this,x,"f").params);else K(this,x,"f").params=$;U(this,Q$,!0,"f"),U(this,a,void 0,"f")}async generateToolResponse(){let $=await K(this,_,"f")??this.params.messages.at(-1);if(!$)return null;return K(this,t$,"m",E1).call(this,$)}done(){return K(this,$$,"f").promise}async runUntilDone(){if(!K(this,H$,"f"))for await(let $ of this);return this.done()}get params(){return K(this,x,"f").params}pushMessages(...$){this.setMessagesParams((X)=>({...X,messages:[...X.messages,...$]}))}then($,X){return this.runUntilDone().then($,X)}}E1=async function(X){if(K(this,a,"f")!==void 0)return K(this,a,"f");return U(this,a,kX(K(this,x,"f").params,X),"f"),K(this,a,"f")};async function kX($,X=$.messages.at(-1)){if(!X||X.role!=="assistant"||!X.content||typeof X.content==="string")return null;let J=X.content.filter((z)=>z.type==="tool_use");if(J.length===0)return null;return{role:"user",content:await Promise.all(J.map(async(z)=>{let Y=$.tools.find((W)=>("name"in W?W.name:W.mcp_server_name)===z.name);if(!Y||!("run"in Y))return{type:"tool_result",tool_use_id:z.id,content:`Error: Tool '${z.name}' not found`,is_error:!0};try{let W=z.input;if("parse"in Y&&Y.parse)W=Y.parse(W);let Q=await Y.run(W);return{type:"tool_result",tool_use_id:z.id,content:Q}}catch(W){return{type:"tool_result",tool_use_id:z.id,content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}class w${constructor($,X){this.iterator=$,this.controller=X}async*decoder(){let $=new r;for await(let X of this.iterator)for(let J of $.decode(X))yield JSON.parse(J);for(let X of $.flush())yield JSON.parse(X)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse($,X){if(!$.body){if(X.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new H("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 H("Attempted to iterate over a response with no body")}return new w$(y$($.body),X)}}class $0 extends S{create($,X){let{betas:J,...Z}=$;return this._client.post("/v1/messages/batches?beta=true",{body:Z,...X,headers:M([{"anthropic-beta":[...J??[],"message-batches-2024-09-24"].toString()},X?.headers])})}retrieve($,X={},J){let{betas:Z}=X??{};return this._client.get(D`/v1/messages/batches/${$}?beta=true`,{...J,headers:M([{"anthropic-beta":[...Z??[],"message-batches-2024-09-24"].toString()},J?.headers])})}list($={},X){let{betas:J,...Z}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",u,{query:Z,...X,headers:M([{"anthropic-beta":[...J??[],"message-batches-2024-09-24"].toString()},X?.headers])})}delete($,X={},J){let{betas:Z}=X??{};return this._client.delete(D`/v1/messages/batches/${$}?beta=true`,{...J,headers:M([{"anthropic-beta":[...Z??[],"message-batches-2024-09-24"].toString()},J?.headers])})}cancel($,X={},J){let{betas:Z}=X??{};return this._client.post(D`/v1/messages/batches/${$}/cancel?beta=true`,{...J,headers:M([{"anthropic-beta":[...Z??[],"message-batches-2024-09-24"].toString()},J?.headers])})}async results($,X={},J){let Z=await this.retrieve($);if(!Z.results_url)throw new H(`No batch \`results_url\`; Has it finished processing? ${Z.processing_status} - ${Z.id}`);let{betas:z}=X??{};return this._client.get(Z.results_url,{...J,headers:M([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},J?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Y,W)=>w$.fromResponse(W.response,W.controller))}}var v5={"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"};class K$ extends S{constructor(){super(...arguments);this.batches=new $0(this._client)}create($,X){let{betas:J,...Z}=$;if(Z.model in v5)console.warn(`The model '${Z.model}' is deprecated and will reach end-of-life on ${v5[Z.model]}
59
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let z=this._client._options.timeout;if(!Z.stream&&z==null){let Y=C0[Z.model]??void 0;z=this._client.calculateNonstreamingTimeout(Z.max_tokens,Y)}return this._client.post("/v1/messages?beta=true",{body:Z,timeout:z??600000,...X,headers:M([{...J?.toString()!=null?{"anthropic-beta":J?.toString()}:void 0},X?.headers]),stream:$.stream??!1})}parse($,X){return X={...X,headers:M([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-11-13"].toString()},X?.headers])},this.create($,X).then((J)=>w1(J,$,{logger:this._client.logger??console}))}stream($,X){return a$.createMessage(this,$,X)}countTokens($,X){let{betas:J,...Z}=$;return this._client.post("/v1/messages/count_tokens?beta=true",{body:Z,...X,headers:M([{"anthropic-beta":[...J??[],"token-counting-2024-11-01"].toString()},X?.headers])})}toolRunner($,X){return new e$(this._client,$,X)}}K$.Batches=$0;K$.BetaToolRunner=e$;class X0 extends S{create($,X={},J){let{betas:Z,...z}=X??{};return this._client.post(D`/v1/skills/${$}/versions?beta=true`,q$({body:z,...J,headers:M([{"anthropic-beta":[...Z??[],"skills-2025-10-02"].toString()},J?.headers])},this._client))}retrieve($,X,J){let{skill_id:Z,betas:z}=X;return this._client.get(D`/v1/skills/${Z}/versions/${$}?beta=true`,{...J,headers:M([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},J?.headers])})}list($,X={},J){let{betas:Z,...z}=X??{};return this._client.getAPIList(D`/v1/skills/${$}/versions?beta=true`,g$,{query:z,...J,headers:M([{"anthropic-beta":[...Z??[],"skills-2025-10-02"].toString()},J?.headers])})}delete($,X,J){let{skill_id:Z,betas:z}=X;return this._client.delete(D`/v1/skills/${Z}/versions/${$}?beta=true`,{...J,headers:M([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},J?.headers])})}}class M$ extends S{constructor(){super(...arguments);this.versions=new X0(this._client)}create($={},X){let{betas:J,...Z}=$??{};return this._client.post("/v1/skills?beta=true",q$({body:Z,...X,headers:M([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])},this._client))}retrieve($,X={},J){let{betas:Z}=X??{};return this._client.get(D`/v1/skills/${$}?beta=true`,{...J,headers:M([{"anthropic-beta":[...Z??[],"skills-2025-10-02"].toString()},J?.headers])})}list($={},X){let{betas:J,...Z}=$??{};return this._client.getAPIList("/v1/skills?beta=true",g$,{query:Z,...X,headers:M([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}delete($,X={},J){let{betas:Z}=X??{};return this._client.delete(D`/v1/skills/${$}?beta=true`,{...J,headers:M([{"anthropic-beta":[...Z??[],"skills-2025-10-02"].toString()},J?.headers])})}}M$.Versions=X0;class p extends S{constructor(){super(...arguments);this.models=new m$(this._client),this.messages=new K$(this._client),this.files=new u$(this._client),this.skills=new M$(this._client)}}p.Models=m$;p.Messages=K$;p.Files=u$;p.Skills=M$;class T$ extends S{create($,X){let{betas:J,...Z}=$;return this._client.post("/v1/complete",{body:Z,timeout:this._client._options.timeout??600000,...X,headers:M([{...J?.toString()!=null?{"anthropic-beta":J?.toString()}:void 0},X?.headers]),stream:$.stream??!1})}}var v,X$,J0,v0,Z0,z0,g0,Y0,t,W0,c0,u0,G$,m0,d0,B1,g5,S1,j1,I1,F1,c5,u5="__json_buf";function m5($){return $.type==="tool_use"||$.type==="server_tool_use"}class Q0{constructor(){v.add(this),this.messages=[],this.receivedMessages=[],X$.set(this,void 0),this.controller=new AbortController,J0.set(this,void 0),v0.set(this,()=>{}),Z0.set(this,()=>{}),z0.set(this,void 0),g0.set(this,()=>{}),Y0.set(this,()=>{}),t.set(this,{}),W0.set(this,!1),c0.set(this,!1),u0.set(this,!1),G$.set(this,!1),m0.set(this,void 0),d0.set(this,void 0),S1.set(this,($)=>{if(U(this,c0,!0,"f"),i($))$=new C;if($ instanceof C)return U(this,u0,!0,"f"),this._emit("abort",$);if($ instanceof H)return this._emit("error",$);if($ instanceof Error){let X=new H($.message);return X.cause=$,this._emit("error",X)}return this._emit("error",new H(String($)))}),U(this,J0,new Promise(($,X)=>{U(this,v0,$,"f"),U(this,Z0,X,"f")}),"f"),U(this,z0,new Promise(($,X)=>{U(this,g0,$,"f"),U(this,Y0,X,"f")}),"f"),K(this,J0,"f").catch(()=>{}),K(this,z0,"f").catch(()=>{})}get response(){return K(this,m0,"f")}get request_id(){return K(this,d0,"f")}async withResponse(){U(this,G$,!0,"f");let $=await K(this,J0,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let X=new Q0;return X._run(()=>X._fromReadableStream($)),X}static createMessage($,X,J){let Z=new Q0;for(let z of X.messages)Z._addMessageParam(z);return Z._run(()=>Z._createMessage($,{...X,stream:!0},{...J,headers:{...J?.headers,"X-Stainless-Helper-Method":"stream"}})),Z}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},K(this,S1,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,X=!0){if(this.receivedMessages.push($),X)this._emit("message",$)}async _createMessage($,X,J){let Z=J?.signal,z;if(Z){if(Z.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),Z.addEventListener("abort",z)}try{K(this,v,"m",j1).call(this);let{response:Y,data:W}=await $.create({...X,stream:!0},{...J,signal:this.controller.signal}).withResponse();this._connected(Y);for await(let Q of W)K(this,v,"m",I1).call(this,Q);if(W.controller.signal?.aborted)throw new C;K(this,v,"m",F1).call(this)}finally{if(Z&&z)Z.removeEventListener("abort",z)}}_connected($){if(this.ended)return;U(this,m0,$,"f"),U(this,d0,$?.headers.get("request-id"),"f"),K(this,v0,"f").call(this,$),this._emit("connect")}get ended(){return K(this,W0,"f")}get errored(){return K(this,c0,"f")}get aborted(){return K(this,u0,"f")}abort(){this.controller.abort()}on($,X){return(K(this,t,"f")[$]||(K(this,t,"f")[$]=[])).push({listener:X}),this}off($,X){let J=K(this,t,"f")[$];if(!J)return this;let Z=J.findIndex((z)=>z.listener===X);if(Z>=0)J.splice(Z,1);return this}once($,X){return(K(this,t,"f")[$]||(K(this,t,"f")[$]=[])).push({listener:X,once:!0}),this}emitted($){return new Promise((X,J)=>{if(U(this,G$,!0,"f"),$!=="error")this.once("error",J);this.once($,X)})}async done(){U(this,G$,!0,"f"),await K(this,z0,"f")}get currentMessage(){return K(this,X$,"f")}async finalMessage(){return await this.done(),K(this,v,"m",B1).call(this)}async finalText(){return await this.done(),K(this,v,"m",g5).call(this)}_emit($,...X){if(K(this,W0,"f"))return;if($==="end")U(this,W0,!0,"f"),K(this,g0,"f").call(this);let J=K(this,t,"f")[$];if(J)K(this,t,"f")[$]=J.filter((Z)=>!Z.once),J.forEach(({listener:Z})=>Z(...X));if($==="abort"){let Z=X[0];if(!K(this,G$,"f")&&!J?.length)Promise.reject(Z);K(this,Z0,"f").call(this,Z),K(this,Y0,"f").call(this,Z),this._emit("end");return}if($==="error"){let Z=X[0];if(!K(this,G$,"f")&&!J?.length)Promise.reject(Z);K(this,Z0,"f").call(this,Z),K(this,Y0,"f").call(this,Z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",K(this,v,"m",B1).call(this))}async _fromReadableStream($,X){let J=X?.signal,Z;if(J){if(J.aborted)this.controller.abort();Z=this.controller.abort.bind(this.controller),J.addEventListener("abort",Z)}try{K(this,v,"m",j1).call(this),this._connected(null);let z=y.fromReadableStream($,this.controller);for await(let Y of z)K(this,v,"m",I1).call(this,Y);if(z.controller.signal?.aborted)throw new C;K(this,v,"m",F1).call(this)}finally{if(J&&Z)J.removeEventListener("abort",Z)}}[(X$=new WeakMap,J0=new WeakMap,v0=new WeakMap,Z0=new WeakMap,z0=new WeakMap,g0=new WeakMap,Y0=new WeakMap,t=new WeakMap,W0=new WeakMap,c0=new WeakMap,u0=new WeakMap,G$=new WeakMap,m0=new WeakMap,d0=new WeakMap,S1=new WeakMap,v=new WeakSet,B1=function(){if(this.receivedMessages.length===0)throw new H("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},g5=function(){if(this.receivedMessages.length===0)throw new H("stream ended without producing a Message with role=assistant");let X=this.receivedMessages.at(-1).content.filter((J)=>J.type==="text").map((J)=>J.text);if(X.length===0)throw new H("stream ended without producing a content block with type=text");return X.join(" ")},j1=function(){if(this.ended)return;U(this,X$,void 0,"f")},I1=function(X){if(this.ended)return;let J=K(this,v,"m",c5).call(this,X);switch(this._emit("streamEvent",X,J),X.type){case"content_block_delta":{let Z=J.content.at(-1);switch(X.delta.type){case"text_delta":{if(Z.type==="text")this._emit("text",X.delta.text,Z.text||"");break}case"citations_delta":{if(Z.type==="text")this._emit("citation",X.delta.citation,Z.citations??[]);break}case"input_json_delta":{if(m5(Z)&&Z.input)this._emit("inputJson",X.delta.partial_json,Z.input);break}case"thinking_delta":{if(Z.type==="thinking")this._emit("thinking",X.delta.thinking,Z.thinking);break}case"signature_delta":{if(Z.type==="thinking")this._emit("signature",Z.signature);break}default:d5(X.delta)}break}case"message_stop":{this._addMessageParam(J),this._addMessage(J,!0);break}case"content_block_stop":{this._emit("contentBlock",J.content.at(-1));break}case"message_start":{U(this,X$,J,"f");break}case"content_block_start":case"message_delta":break}},F1=function(){if(this.ended)throw new H("stream has ended, this shouldn't happen");let X=K(this,X$,"f");if(!X)throw new H("request ended without sending any chunks");return U(this,X$,void 0,"f"),X},c5=function(X){let J=K(this,X$,"f");if(X.type==="message_start"){if(J)throw new H(`Unexpected event order, got ${X.type} before receiving "message_stop"`);return X.message}if(!J)throw new H(`Unexpected event order, got ${X.type} before "message_start"`);switch(X.type){case"message_stop":return J;case"message_delta":if(J.stop_reason=X.delta.stop_reason,J.stop_sequence=X.delta.stop_sequence,J.usage.output_tokens=X.usage.output_tokens,X.usage.input_tokens!=null)J.usage.input_tokens=X.usage.input_tokens;if(X.usage.cache_creation_input_tokens!=null)J.usage.cache_creation_input_tokens=X.usage.cache_creation_input_tokens;if(X.usage.cache_read_input_tokens!=null)J.usage.cache_read_input_tokens=X.usage.cache_read_input_tokens;if(X.usage.server_tool_use!=null)J.usage.server_tool_use=X.usage.server_tool_use;return J;case"content_block_start":return J.content.push({...X.content_block}),J;case"content_block_delta":{let Z=J.content.at(X.index);switch(X.delta.type){case"text_delta":{if(Z?.type==="text")J.content[X.index]={...Z,text:(Z.text||"")+X.delta.text};break}case"citations_delta":{if(Z?.type==="text")J.content[X.index]={...Z,citations:[...Z.citations??[],X.delta.citation]};break}case"input_json_delta":{if(Z&&m5(Z)){let z=Z[u5]||"";z+=X.delta.partial_json;let Y={...Z};if(Object.defineProperty(Y,u5,{value:z,enumerable:!1,writable:!0}),z)Y.input=A0(z);J.content[X.index]=Y}break}case"thinking_delta":{if(Z?.type==="thinking")J.content[X.index]={...Z,thinking:Z.thinking+X.delta.thinking};break}case"signature_delta":{if(Z?.type==="thinking")J.content[X.index]={...Z,signature:X.delta.signature};break}default:d5(X.delta)}return J}case"content_block_stop":return J}},Symbol.asyncIterator)](){let $=[],X=[],J=!1;return this.on("streamEvent",(Z)=>{let z=X.shift();if(z)z.resolve(Z);else $.push(Z)}),this.on("end",()=>{J=!0;for(let Z of X)Z.resolve(void 0);X.length=0}),this.on("abort",(Z)=>{J=!0;for(let z of X)z.reject(Z);X.length=0}),this.on("error",(Z)=>{J=!0;for(let z of X)z.reject(Z);X.length=0}),{next:async()=>{if(!$.length){if(J)return{value:void 0,done:!0};return new Promise((z,Y)=>X.push({resolve:z,reject:Y})).then((z)=>z?{value:z,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 y(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function d5($){}class K0 extends S{create($,X){return this._client.post("/v1/messages/batches",{body:$,...X})}retrieve($,X){return this._client.get(D`/v1/messages/batches/${$}`,X)}list($={},X){return this._client.getAPIList("/v1/messages/batches",u,{query:$,...X})}delete($,X){return this._client.delete(D`/v1/messages/batches/${$}`,X)}cancel($,X){return this._client.post(D`/v1/messages/batches/${$}/cancel`,X)}async results($,X){let J=await this.retrieve($);if(!J.results_url)throw new H(`No batch \`results_url\`; Has it finished processing? ${J.processing_status} - ${J.id}`);return this._client.get(J.results_url,{...X,headers:M([{Accept:"application/binary"},X?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Z,z)=>w$.fromResponse(z.response,z.controller))}}class V$ extends S{constructor(){super(...arguments);this.batches=new K0(this._client)}create($,X){if($.model in p5)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${p5[$.model]}
60
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let J=this._client._options.timeout;if(!$.stream&&J==null){let Z=C0[$.model]??void 0;J=this._client.calculateNonstreamingTimeout($.max_tokens,Z)}return this._client.post("/v1/messages",{body:$,timeout:J??600000,...X,stream:$.stream??!1})}stream($,X){return Q0.createMessage(this,$,X)}countTokens($,X){return this._client.post("/v1/messages/count_tokens",{body:$,...X})}}var p5={"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"};V$.Batches=K0;class L$ extends S{retrieve($,X={},J){let{betas:Z}=X??{};return this._client.get(D`/v1/models/${$}`,{...J,headers:M([{...Z?.toString()!=null?{"anthropic-beta":Z?.toString()}:void 0},J?.headers])})}list($={},X){let{betas:J,...Z}=$??{};return this._client.getAPIList("/v1/models",u,{query:Z,...X,headers:M([{...J?.toString()!=null?{"anthropic-beta":J?.toString()}:void 0},X?.headers])})}}var G0=($)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[$]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.($)?.trim();return};var x1,O1,p0,l5,i5="\\n\\nHuman:",n5="\\n\\nAssistant:";class I{constructor({baseURL:$=G0("ANTHROPIC_BASE_URL"),apiKey:X=G0("ANTHROPIC_API_KEY")??null,authToken:J=G0("ANTHROPIC_AUTH_TOKEN")??null,...Z}={}){x1.add(this),p0.set(this,void 0);let z={apiKey:X,authToken:J,...Z,baseURL:$||"https://api.anthropic.com"};if(!z.dangerouslyAllowBrowser&&N5())throw new H(`It looks like you're running in a browser-like environment.
88
+ ${B}
89
+ `}};iA.YAMLError=o6;iA.YAMLParseError=vY;iA.YAMLWarning=yY;iA.prettifyError=dA});var T8=p((tA)=>{function sA(X,{flow:Q,indicator:J,next:Y,offset:G,onError:$,parentIndent:W,startOnNewline:H}){let U=!1,B=H,q=H,K="",V="",N=!1,w=!1,A=null,Z=null,z=null,M=null,F=null,L=null,O=null;for(let j of X){if(w){if(j.type!=="space"&&j.type!=="newline"&&j.type!=="comma")$(j.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");w=!1}if(A){if(B&&j.type!=="comment"&&j.type!=="newline")$(A,"TAB_AS_INDENT","Tabs are not allowed as indentation");A=null}switch(j.type){case"space":if(!Q&&(J!=="doc-start"||Y?.type!=="flow-collection")&&j.source.includes("\t"))A=j;q=!0;break;case"comment":{if(!q)$(j,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let E=j.source.substring(1)||" ";if(!K)K=E;else K+=V+E;V="",B=!1;break}case"newline":if(B){if(K)K+=j.source;else if(!L||J!=="seq-item-ind")U=!0}else V+=j.source;if(B=!0,N=!0,Z||z)M=j;q=!0;break;case"anchor":if(Z)$(j,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(j.source.endsWith(":"))$(j.offset+j.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);Z=j,O??(O=j.offset),B=!1,q=!1,w=!0;break;case"tag":{if(z)$(j,"MULTIPLE_TAGS","A node can have at most one tag");z=j,O??(O=j.offset),B=!1,q=!1,w=!0;break}case J:if(Z||z)$(j,"BAD_PROP_ORDER",`Anchors and tags must be after the ${j.source} indicator`);if(L)$(j,"UNEXPECTED_TOKEN",`Unexpected ${j.source} in ${Q??"collection"}`);L=j,B=J==="seq-item-ind"||J==="explicit-key-ind",q=!1;break;case"comma":if(Q){if(F)$(j,"UNEXPECTED_TOKEN",`Unexpected , in ${Q}`);F=j,B=!1,q=!1;break}default:$(j,"UNEXPECTED_TOKEN",`Unexpected ${j.type} token`),B=!1,q=!1}}let D=X[X.length-1],I=D?D.offset+D.source.length:G;if(w&&Y&&Y.type!=="space"&&Y.type!=="newline"&&Y.type!=="comma"&&(Y.type!=="scalar"||Y.source!==""))$(Y.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(A&&(B&&A.indent<=W||Y?.type==="block-map"||Y?.type==="block-seq"))$(A,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:F,found:L,spaceBefore:U,comment:K,hasNewline:N,anchor:Z,tag:z,newlineAfterProp:M,end:I,start:O??I}}tA.resolveProps=sA});var a6=p((XN)=>{function dQ(X){if(!X)return null;switch(X.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(X.source.includes(`
90
+ `))return!0;if(X.end){for(let Q of X.end)if(Q.type==="newline")return!0}return!1;case"flow-collection":for(let Q of X.items){for(let J of Q.start)if(J.type==="newline")return!0;if(Q.sep){for(let J of Q.sep)if(J.type==="newline")return!0}if(dQ(Q.key)||dQ(Q.value))return!0}return!1;default:return!0}}XN.containsNewline=dQ});var iQ=p((GN)=>{var JN=a6();function YN(X,Q,J){if(Q?.type==="flow-collection"){let Y=Q.end[0];if(Y.indent===X&&(Y.source==="]"||Y.source==="}")&&JN.containsNewline(Q))J(Y,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}GN.flowIndentCheck=YN});var nQ=p((HN)=>{var xY=K0();function WN(X,Q,J){let{uniqueKeys:Y}=X.options;if(Y===!1)return!1;let G=typeof Y==="function"?Y:($,W)=>$===W||xY.isScalar($)&&xY.isScalar(W)&&$.value===W.value;return Q.some(($)=>G($.key,J))}HN.mapIncludes=WN});var mY=p((FN)=>{var gY=f1(),BN=m1(),hY=T8(),zN=a6(),fY=iQ(),LN=nQ(),uY="All mapping items must start at the same column";function qN({composeNode:X,composeEmptyNode:Q},J,Y,G,$){let H=new($?.nodeClass??BN.YAMLMap)(J.schema);if(J.atRoot)J.atRoot=!1;let U=Y.offset,B=null;for(let q of Y.items){let{start:K,key:V,sep:N,value:w}=q,A=hY.resolveProps(K,{indicator:"explicit-key-ind",next:V??N?.[0],offset:U,onError:G,parentIndent:Y.indent,startOnNewline:!0}),Z=!A.found;if(Z){if(V){if(V.type==="block-seq")G(U,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in V&&V.indent!==Y.indent)G(U,"BAD_INDENT",uY)}if(!A.anchor&&!A.tag&&!N){if(B=A.end,A.comment)if(H.comment)H.comment+=`
91
+ `+A.comment;else H.comment=A.comment;continue}if(A.newlineAfterProp||zN.containsNewline(V))G(V??K[K.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(A.found?.indent!==Y.indent)G(U,"BAD_INDENT",uY);J.atKey=!0;let z=A.end,M=V?X(J,V,A,G):Q(J,z,K,null,A,G);if(J.schema.compat)fY.flowIndentCheck(Y.indent,V,G);if(J.atKey=!1,LN.mapIncludes(J,H.items,M))G(z,"DUPLICATE_KEY","Map keys must be unique");let F=hY.resolveProps(N??[],{indicator:"map-value-ind",next:w,offset:M.range[2],onError:G,parentIndent:Y.indent,startOnNewline:!V||V.type==="block-scalar"});if(U=F.end,F.found){if(Z){if(w?.type==="block-map"&&!F.hasNewline)G(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(J.options.strict&&A.start<F.found.offset-1024)G(M.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let L=w?X(J,w,F,G):Q(J,U,N,null,F,G);if(J.schema.compat)fY.flowIndentCheck(Y.indent,w,G);U=L.range[2];let O=new gY.Pair(M,L);if(J.options.keepSourceTokens)O.srcToken=q;H.items.push(O)}else{if(Z)G(M.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(F.comment)if(M.comment)M.comment+=`
92
+ `+F.comment;else M.comment=F.comment;let L=new gY.Pair(M);if(J.options.keepSourceTokens)L.srcToken=q;H.items.push(L)}}if(B&&B<U)G(B,"IMPOSSIBLE","Map comment with trailing content");return H.range=[Y.offset,U,B??U],H}FN.resolveBlockMap=qN});var lY=p((ON)=>{var VN=l1(),MN=T8(),DN=iQ();function ZN({composeNode:X,composeEmptyNode:Q},J,Y,G,$){let H=new($?.nodeClass??VN.YAMLSeq)(J.schema);if(J.atRoot)J.atRoot=!1;if(J.atKey)J.atKey=!1;let U=Y.offset,B=null;for(let{start:q,value:K}of Y.items){let V=MN.resolveProps(q,{indicator:"seq-item-ind",next:K,offset:U,onError:G,parentIndent:Y.indent,startOnNewline:!0});if(!V.found)if(V.anchor||V.tag||K)if(K?.type==="block-seq")G(V.end,"BAD_INDENT","All sequence items must start at the same column");else G(U,"MISSING_CHAR","Sequence item without - indicator");else{if(B=V.end,V.comment)H.comment=V.comment;continue}let N=K?X(J,K,V,G):Q(J,V.end,q,null,V,G);if(J.schema.compat)DN.flowIndentCheck(Y.indent,K,G);U=N.range[2],H.items.push(N)}return H.range=[Y.offset,U,B??U],H}ON.resolveBlockSeq=ZN});var b9=p((RN)=>{function NN(X,Q,J,Y){let G="";if(X){let $=!1,W="";for(let H of X){let{source:U,type:B}=H;switch(B){case"space":$=!0;break;case"comment":{if(J&&!$)Y(H,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let q=U.substring(1)||" ";if(!G)G=q;else G+=W+q;W="";break}case"newline":if(G)W+=U;$=!0;break;default:Y(H,"UNEXPECTED_TOKEN",`Unexpected ${B} at node end`)}Q+=U.length}}return{comment:G,offset:Q}}RN.resolveEnd=NN});var dY=p((CN)=>{var jN=K0(),wN=f1(),cY=m1(),PN=l1(),TN=b9(),pY=T8(),SN=a6(),EN=nQ(),rQ="Block collections are not allowed within flow collections",oQ=(X)=>X&&(X.type==="block-map"||X.type==="block-seq");function bN({composeNode:X,composeEmptyNode:Q},J,Y,G,$){let W=Y.start.source==="{",H=W?"flow map":"flow sequence",B=new($?.nodeClass??(W?cY.YAMLMap:PN.YAMLSeq))(J.schema);B.flow=!0;let q=J.atRoot;if(q)J.atRoot=!1;if(J.atKey)J.atKey=!1;let K=Y.offset+Y.start.source.length;for(let Z=0;Z<Y.items.length;++Z){let z=Y.items[Z],{start:M,key:F,sep:L,value:O}=z,D=pY.resolveProps(M,{flow:H,indicator:"explicit-key-ind",next:F??L?.[0],offset:K,onError:G,parentIndent:Y.indent,startOnNewline:!1});if(!D.found){if(!D.anchor&&!D.tag&&!L&&!O){if(Z===0&&D.comma)G(D.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${H}`);else if(Z<Y.items.length-1)G(D.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${H}`);if(D.comment)if(B.comment)B.comment+=`
93
+ `+D.comment;else B.comment=D.comment;K=D.end;continue}if(!W&&J.options.strict&&SN.containsNewline(F))G(F,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(Z===0){if(D.comma)G(D.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${H}`)}else{if(!D.comma)G(D.start,"MISSING_CHAR",`Missing , between ${H} items`);if(D.comment){let I="";X:for(let j of M)switch(j.type){case"comma":case"space":break;case"comment":I=j.source.substring(1);break X;default:break X}if(I){let j=B.items[B.items.length-1];if(jN.isPair(j))j=j.value??j.key;if(j.comment)j.comment+=`
94
+ `+I;else j.comment=I;D.comment=D.comment.substring(I.length+1)}}}if(!W&&!L&&!D.found){let I=O?X(J,O,D,G):Q(J,D.end,L,null,D,G);if(B.items.push(I),K=I.range[2],oQ(O))G(I.range,"BLOCK_IN_FLOW",rQ)}else{J.atKey=!0;let I=D.end,j=F?X(J,F,D,G):Q(J,I,M,null,D,G);if(oQ(F))G(j.range,"BLOCK_IN_FLOW",rQ);J.atKey=!1;let E=pY.resolveProps(L??[],{flow:H,indicator:"map-value-ind",next:O,offset:j.range[2],onError:G,parentIndent:Y.indent,startOnNewline:!1});if(E.found){if(!W&&!D.found&&J.options.strict){if(L)for(let x of L){if(x===E.found)break;if(x.type==="newline"){G(x,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(D.start<E.found.offset-1024)G(E.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(O)if("source"in O&&O.source?.[0]===":")G(O,"MISSING_CHAR",`Missing space after : in ${H}`);else G(E.start,"MISSING_CHAR",`Missing , or : between ${H} items`);let g=O?X(J,O,E,G):E.found?Q(J,E.end,L,null,E,G):null;if(g){if(oQ(O))G(g.range,"BLOCK_IN_FLOW",rQ)}else if(E.comment)if(j.comment)j.comment+=`
95
+ `+E.comment;else j.comment=E.comment;let k=new wN.Pair(j,g);if(J.options.keepSourceTokens)k.srcToken=z;if(W){let x=B;if(EN.mapIncludes(J,x.items,j))G(I,"DUPLICATE_KEY","Map keys must be unique");x.items.push(k)}else{let x=new cY.YAMLMap(J.schema);x.flow=!0,x.items.push(k);let u=(g??j).range;x.range=[j.range[0],u[1],u[2]],B.items.push(x)}K=g?g.range[2]:E.end}}let V=W?"}":"]",[N,...w]=Y.end,A=K;if(N?.source===V)A=N.offset+N.source.length;else{let Z=H[0].toUpperCase()+H.substring(1),z=q?`${Z} must end with a ${V}`:`${Z} in block collection must be sufficiently indented and end with a ${V}`;if(G(K,q?"MISSING_CHAR":"BAD_INDENT",z),N&&N.source.length!==1)w.unshift(N)}if(w.length>0){let Z=TN.resolveEnd(w,A,J.options.strict,G);if(Z.comment)if(B.comment)B.comment+=`
96
+ `+Z.comment;else B.comment=Z.comment;B.range=[Y.offset,A,Z.offset]}else B.range=[Y.offset,A,A];return B}CN.resolveFlowCollection=bN});var iY=p((mN)=>{var kN=K0(),vN=v0(),yN=m1(),xN=l1(),gN=mY(),hN=lY(),fN=dY();function aQ(X,Q,J,Y,G,$){let W=J.type==="block-map"?gN.resolveBlockMap(X,Q,J,Y,$):J.type==="block-seq"?hN.resolveBlockSeq(X,Q,J,Y,$):fN.resolveFlowCollection(X,Q,J,Y,$),H=W.constructor;if(G==="!"||G===H.tagName)return W.tag=H.tagName,W;if(G)W.tag=G;return W}function uN(X,Q,J,Y,G){let $=Y.tag,W=!$?null:Q.directives.tagName($.source,(V)=>G($,"TAG_RESOLVE_FAILED",V));if(J.type==="block-seq"){let{anchor:V,newlineAfterProp:N}=Y,w=V&&$?V.offset>$.offset?V:$:V??$;if(w&&(!N||N.offset<w.offset))G(w,"MISSING_CHAR","Missing newline after block sequence props")}let H=J.type==="block-map"?"map":J.type==="block-seq"?"seq":J.start.source==="{"?"map":"seq";if(!$||!W||W==="!"||W===yN.YAMLMap.tagName&&H==="map"||W===xN.YAMLSeq.tagName&&H==="seq")return aQ(X,Q,J,G,W);let U=Q.schema.tags.find((V)=>V.tag===W&&V.collection===H);if(!U){let V=Q.schema.knownTags[W];if(V?.collection===H)Q.schema.tags.push(Object.assign({},V,{default:!1})),U=V;else{if(V)G($,"BAD_COLLECTION_TYPE",`${V.tag} used for ${H} collection, but expects ${V.collection??"scalar"}`,!0);else G($,"TAG_RESOLVE_FAILED",`Unresolved tag: ${W}`,!0);return aQ(X,Q,J,G,W)}}let B=aQ(X,Q,J,G,W,U),q=U.resolve?.(B,(V)=>G($,"TAG_RESOLVE_FAILED",V),Q.options)??B,K=kN.isNode(q)?q:new vN.Scalar(q);if(K.range=B.range,K.tag=W,U?.format)K.format=U.format;return K}mN.composeCollection=uN});var tQ=p((iN)=>{var sQ=v0();function cN(X,Q,J){let Y=Q.offset,G=pN(Q,X.options.strict,J);if(!G)return{value:"",type:null,comment:"",range:[Y,Y,Y]};let $=G.mode===">"?sQ.Scalar.BLOCK_FOLDED:sQ.Scalar.BLOCK_LITERAL,W=Q.source?dN(Q.source):[],H=W.length;for(let A=W.length-1;A>=0;--A){let Z=W[A][1];if(Z===""||Z==="\r")H=A;else break}if(H===0){let A=G.chomp==="+"&&W.length>0?`
97
+ `.repeat(Math.max(1,W.length-1)):"",Z=Y+G.length;if(Q.source)Z+=Q.source.length;return{value:A,type:$,comment:G.comment,range:[Y,Z,Z]}}let U=Q.indent+G.indent,B=Q.offset+G.length,q=0;for(let A=0;A<H;++A){let[Z,z]=W[A];if(z===""||z==="\r"){if(G.indent===0&&Z.length>U)U=Z.length}else{if(Z.length<U)J(B+Z.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(G.indent===0)U=Z.length;if(q=A,U===0&&!X.atRoot)J(B,"BAD_INDENT","Block scalar values in collections must be indented");break}B+=Z.length+z.length+1}for(let A=W.length-1;A>=H;--A)if(W[A][0].length>U)H=A+1;let K="",V="",N=!1;for(let A=0;A<q;++A)K+=W[A][0].slice(U)+`
98
+ `;for(let A=q;A<H;++A){let[Z,z]=W[A];B+=Z.length+z.length+1;let M=z[z.length-1]==="\r";if(M)z=z.slice(0,-1);if(z&&Z.length<U){let L=`Block scalar lines must not be less indented than their ${G.indent?"explicit indentation indicator":"first line"}`;J(B-z.length-(M?2:1),"BAD_INDENT",L),Z=""}if($===sQ.Scalar.BLOCK_LITERAL)K+=V+Z.slice(U)+z,V=`
99
+ `;else if(Z.length>U||z[0]==="\t"){if(V===" ")V=`
100
+ `;else if(!N&&V===`
101
+ `)V=`
61
102
 
62
- This is disabled by default, as it risks exposing your secret API credentials to attackers.
63
- If you understand the risks and have appropriate mitigations in place,
64
- you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
103
+ `;K+=V+Z.slice(U)+z,V=`
104
+ `,N=!0}else if(z==="")if(V===`
105
+ `)K+=`
106
+ `;else V=`
107
+ `;else K+=V+z,V=" ",N=!1}switch(G.chomp){case"-":break;case"+":for(let A=H;A<W.length;++A)K+=`
108
+ `+W[A][0].slice(U);if(K[K.length-1]!==`
109
+ `)K+=`
110
+ `;break;default:K+=`
111
+ `}let w=Y+G.length+Q.source.length;return{value:K,type:$,comment:G.comment,range:[Y,w,w]}}function pN({offset:X,props:Q},J,Y){if(Q[0].type!=="block-scalar-header")return Y(Q[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:G}=Q[0],$=G[0],W=0,H="",U=-1;for(let V=1;V<G.length;++V){let N=G[V];if(!H&&(N==="-"||N==="+"))H=N;else{let w=Number(N);if(!W&&w)W=w;else if(U===-1)U=X+V}}if(U!==-1)Y(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${G}`);let B=!1,q="",K=G.length;for(let V=1;V<Q.length;++V){let N=Q[V];switch(N.type){case"space":B=!0;case"newline":K+=N.source.length;break;case"comment":if(J&&!B)Y(N,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");K+=N.source.length,q=N.source.substring(1);break;case"error":Y(N,"UNEXPECTED_TOKEN",N.message),K+=N.source.length;break;default:{let w=`Unexpected token in block scalar header: ${N.type}`;Y(N,"UNEXPECTED_TOKEN",w);let A=N.source;if(A&&typeof A==="string")K+=A.length}}}return{mode:$,indent:W,chomp:H,comment:q,length:K}}function dN(X){let Q=X.split(/\n( *)/),J=Q[0],Y=J.match(/^( *)/),$=[Y?.[1]?[Y[1],J.slice(Y[1].length)]:["",J]];for(let W=1;W<Q.length;W+=2)$.push([Q[W],Q[W+1]]);return $}iN.resolveBlockScalar=cN});var X4=p((JR)=>{var eQ=v0(),rN=b9();function oN(X,Q,J){let{offset:Y,type:G,source:$,end:W}=X,H,U,B=(V,N,w)=>J(Y+V,N,w);switch(G){case"scalar":H=eQ.Scalar.PLAIN,U=aN($,B);break;case"single-quoted-scalar":H=eQ.Scalar.QUOTE_SINGLE,U=sN($,B);break;case"double-quoted-scalar":H=eQ.Scalar.QUOTE_DOUBLE,U=tN($,B);break;default:return J(X,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${G}`),{value:"",type:null,comment:"",range:[Y,Y+$.length,Y+$.length]}}let q=Y+$.length,K=rN.resolveEnd(W,q,Q,J);return{value:U,type:H,comment:K.comment,range:[Y,q,K.offset]}}function aN(X,Q){let J="";switch(X[0]){case"\t":J="a tab character";break;case",":J="flow indicator character ,";break;case"%":J="directive indicator character %";break;case"|":case">":{J=`block scalar indicator ${X[0]}`;break}case"@":case"`":{J=`reserved character ${X[0]}`;break}}if(J)Q(0,"BAD_SCALAR_START",`Plain value cannot start with ${J}`);return nY(X)}function sN(X,Q){if(X[X.length-1]!=="'"||X.length===1)Q(X.length,"MISSING_CHAR","Missing closing 'quote");return nY(X.slice(1,-1)).replace(/''/g,"'")}function nY(X){let Q,J;try{Q=new RegExp(`(.*?)(?<![ ])[ ]*\r?
112
+ `,"sy"),J=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
113
+ `,"sy")}catch{Q=/(.*?)[ \t]*\r?\n/sy,J=/[ \t]*(.*?)[ \t]*\r?\n/sy}let Y=Q.exec(X);if(!Y)return X;let G=Y[1],$=" ",W=Q.lastIndex;J.lastIndex=W;while(Y=J.exec(X)){if(Y[1]==="")if($===`
114
+ `)G+=$;else $=`
115
+ `;else G+=$+Y[1],$=" ";W=J.lastIndex}let H=/[ \t]*(.*)/sy;return H.lastIndex=W,Y=H.exec(X),G+$+(Y?.[1]??"")}function tN(X,Q){let J="";for(let Y=1;Y<X.length-1;++Y){let G=X[Y];if(G==="\r"&&X[Y+1]===`
116
+ `)continue;if(G===`
117
+ `){let{fold:$,offset:W}=eN(X,Y);J+=$,Y=W}else if(G==="\\"){let $=X[++Y],W=XR[$];if(W)J+=W;else if($===`
118
+ `){$=X[Y+1];while($===" "||$==="\t")$=X[++Y+1]}else if($==="\r"&&X[Y+1]===`
119
+ `){$=X[++Y+1];while($===" "||$==="\t")$=X[++Y+1]}else if($==="x"||$==="u"||$==="U"){let H={x:2,u:4,U:8}[$];J+=QR(X,Y+1,H,Q),Y+=H}else{let H=X.substr(Y-1,2);Q(Y-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${H}`),J+=H}}else if(G===" "||G==="\t"){let $=Y,W=X[Y+1];while(W===" "||W==="\t")W=X[++Y+1];if(W!==`
120
+ `&&!(W==="\r"&&X[Y+2]===`
121
+ `))J+=Y>$?X.slice($,Y+1):G}else J+=G}if(X[X.length-1]!=='"'||X.length===1)Q(X.length,"MISSING_CHAR",'Missing closing "quote');return J}function eN(X,Q){let J="",Y=X[Q+1];while(Y===" "||Y==="\t"||Y===`
122
+ `||Y==="\r"){if(Y==="\r"&&X[Q+2]!==`
123
+ `)break;if(Y===`
124
+ `)J+=`
125
+ `;Q+=1,Y=X[Q+1]}if(!J)J=" ";return{fold:J,offset:Q}}var XR={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
126
+ `,r:"\r",t:"\t",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function QR(X,Q,J,Y){let G=X.substr(Q,J),W=G.length===J&&/^[0-9a-fA-F]+$/.test(G)?parseInt(G,16):NaN;if(isNaN(W)){let H=X.substr(Q-2,J+2);return Y(Q-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${H}`),H}return String.fromCodePoint(W)}JR.resolveFlowScalar=oN});var oY=p((BR)=>{var Q9=K0(),rY=v0(),GR=tQ(),$R=X4();function WR(X,Q,J,Y){let{value:G,type:$,comment:W,range:H}=Q.type==="block-scalar"?GR.resolveBlockScalar(X,Q,Y):$R.resolveFlowScalar(Q,X.options.strict,Y),U=J?X.directives.tagName(J.source,(K)=>Y(J,"TAG_RESOLVE_FAILED",K)):null,B;if(X.options.stringKeys&&X.atKey)B=X.schema[Q9.SCALAR];else if(U)B=HR(X.schema,G,U,J,Y);else if(Q.type==="scalar")B=UR(X,G,Q,Y);else B=X.schema[Q9.SCALAR];let q;try{let K=B.resolve(G,(V)=>Y(J??Q,"TAG_RESOLVE_FAILED",V),X.options);q=Q9.isScalar(K)?K:new rY.Scalar(K)}catch(K){let V=K instanceof Error?K.message:String(K);Y(J??Q,"TAG_RESOLVE_FAILED",V),q=new rY.Scalar(G)}if(q.range=H,q.source=G,$)q.type=$;if(U)q.tag=U;if(B.format)q.format=B.format;if(W)q.comment=W;return q}function HR(X,Q,J,Y,G){if(J==="!")return X[Q9.SCALAR];let $=[];for(let H of X.tags)if(!H.collection&&H.tag===J)if(H.default&&H.test)$.push(H);else return H;for(let H of $)if(H.test?.test(Q))return H;let W=X.knownTags[J];if(W&&!W.collection)return X.tags.push(Object.assign({},W,{default:!1,test:void 0})),W;return G(Y,"TAG_RESOLVE_FAILED",`Unresolved tag: ${J}`,J!=="tag:yaml.org,2002:str"),X[Q9.SCALAR]}function UR({atKey:X,directives:Q,schema:J},Y,G,$){let W=J.tags.find((H)=>(H.default===!0||X&&H.default==="key")&&H.test?.test(Y))||J[Q9.SCALAR];if(J.compat){let H=J.compat.find((U)=>U.default&&U.test?.test(Y))??J[Q9.SCALAR];if(W.tag!==H.tag){let U=Q.tagString(W.tag),B=Q.tagString(H.tag),q=`Value may be parsed as either ${U} or ${B}`;$(G,"TAG_RESOLVE_FAILED",q,!0)}}return W}BR.composeScalar=WR});var aY=p((qR)=>{function LR(X,Q,J){if(Q){J??(J=Q.length);for(let Y=J-1;Y>=0;--Y){let G=Q[Y];switch(G.type){case"space":case"comment":case"newline":X-=G.source.length;continue}G=Q[++Y];while(G?.type==="space")X+=G.source.length,G=Q[++Y];break}}return X}qR.emptyScalarPosition=LR});var eY=p((NR)=>{var KR=z8(),VR=K0(),MR=iY(),sY=oY(),DR=b9(),ZR=aY(),OR={composeNode:tY,composeEmptyNode:Q4};function tY(X,Q,J,Y){let G=X.atKey,{spaceBefore:$,comment:W,anchor:H,tag:U}=J,B,q=!0;switch(Q.type){case"alias":if(B=AR(X,Q,Y),H||U)Y(Q,"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(B=sY.composeScalar(X,Q,U,Y),H)B.anchor=H.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":if(B=MR.composeCollection(OR,X,Q,J,Y),H)B.anchor=H.source.substring(1);break;default:{let K=Q.type==="error"?Q.message:`Unsupported token (type: ${Q.type})`;Y(Q,"UNEXPECTED_TOKEN",K),B=Q4(X,Q.offset,void 0,null,J,Y),q=!1}}if(H&&B.anchor==="")Y(H,"BAD_ALIAS","Anchor cannot be an empty string");if(G&&X.options.stringKeys&&(!VR.isScalar(B)||typeof B.value!=="string"||B.tag&&B.tag!=="tag:yaml.org,2002:str"))Y(U??Q,"NON_STRING_KEY","With stringKeys, all keys must be strings");if($)B.spaceBefore=!0;if(W)if(Q.type==="scalar"&&Q.source==="")B.comment=W;else B.commentBefore=W;if(X.options.keepSourceTokens&&q)B.srcToken=Q;return B}function Q4(X,Q,J,Y,{spaceBefore:G,comment:$,anchor:W,tag:H,end:U},B){let q={type:"scalar",offset:ZR.emptyScalarPosition(Q,J,Y),indent:-1,source:""},K=sY.composeScalar(X,q,H,B);if(W){if(K.anchor=W.source.substring(1),K.anchor==="")B(W,"BAD_ALIAS","Anchor cannot be an empty string")}if(G)K.spaceBefore=!0;if($)K.comment=$,K.range[2]=U;return K}function AR({options:X},{offset:Q,source:J,end:Y},G){let $=new KR.Alias(J.substring(1));if($.source==="")G(Q,"BAD_ALIAS","Alias cannot be an empty string");if($.source.endsWith(":"))G(Q+J.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let W=Q+J.length,H=DR.resolveEnd(Y,W,X.strict,G);if($.range=[Q,W,H.offset],H.comment)$.comment=H.comment;return $}NR.composeEmptyNode=Q4;NR.composeNode=tY});var QG=p((SR)=>{var jR=w8(),XG=eY(),wR=b9(),PR=T8();function TR(X,Q,{offset:J,start:Y,value:G,end:$},W){let H=Object.assign({_directives:Q},X),U=new jR.Document(void 0,H),B={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},q=PR.resolveProps(Y,{indicator:"doc-start",next:G??$?.[0],offset:J,onError:W,parentIndent:0,startOnNewline:!0});if(q.found){if(U.directives.docStart=!0,G&&(G.type==="block-map"||G.type==="block-seq")&&!q.hasNewline)W(q.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}U.contents=G?XG.composeNode(B,G,q,W):XG.composeEmptyNode(B,q.end,Y,null,q,W);let K=U.contents.range[2],V=wR.resolveEnd($,K,!1,W);if(V.comment)U.comment=V.comment;return U.range=[J,K,V.offset],U}SR.composeDoc=TR});var J4=p((yR)=>{var bR=O1("process"),CR=WQ(),_R=w8(),S8=P8(),JG=K0(),kR=QG(),vR=b9();function E8(X){if(typeof X==="number")return[X,X+1];if(Array.isArray(X))return X.length===2?X:[X[0],X[1]];let{offset:Q,source:J}=X;return[Q,Q+(typeof J==="string"?J.length:1)]}function YG(X){let Q="",J=!1,Y=!1;for(let G=0;G<X.length;++G){let $=X[G];switch($[0]){case"#":Q+=(Q===""?"":Y?`
65
127
 
66
- new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
67
- `);this.baseURL=z.baseURL,this.timeout=z.timeout??O1.DEFAULT_TIMEOUT,this.logger=z.logger??console;let Y="warn";this.logLevel=Y,this.logLevel=Q1(z.logLevel,"ClientOptions.logLevel",this)??Q1(G0("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??Y,this.fetchOptions=z.fetchOptions,this.maxRetries=z.maxRetries??2,this.fetch=z.fetch??w5(),U(this,p0,T5,"f"),this._options=z,this.apiKey=typeof X==="string"?X:null,this.authToken=J}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:X}){if($.get("x-api-key")||$.get("authorization"))return;if(this.apiKey&&$.get("x-api-key"))return;if(X.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(X.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 M([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return M([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return M([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return Object.entries($).filter(([X,J])=>typeof J<"u").map(([X,J])=>{if(typeof J==="string"||typeof J==="number"||typeof J==="boolean")return`${encodeURIComponent(X)}=${encodeURIComponent(J)}`;if(J===null)return`${encodeURIComponent(X)}=`;throw new H(`Cannot stringify type ${typeof J}; 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("&")}getUserAgent(){return`${this.constructor.name}/JS ${s}`}defaultIdempotencyKey(){return`stainless-node-retry-${J1()}`}makeStatusError($,X,J,Z){return F.generate($,X,J,Z)}buildURL($,X,J){let Z=!K(this,x1,"m",l5).call(this)&&J||this.baseURL,z=Y5($)?new URL($):new URL(Z+(Z.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),Y=this.defaultQuery();if(!W5(Y))X={...Y,...X};if(typeof X==="object"&&X&&!Array.isArray(X))z.search=this.stringifyQuery(X);return z.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new H("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:X,options:J}){}get($,X){return this.methodRequest("get",$,X)}post($,X){return this.methodRequest("post",$,X)}patch($,X){return this.methodRequest("patch",$,X)}put($,X){return this.methodRequest("put",$,X)}delete($,X){return this.methodRequest("delete",$,X)}methodRequest($,X,J){return this.request(Promise.resolve(J).then((Z)=>{return{method:$,path:X,...Z}}))}request($,X=null){return new z$(this,this.makeRequest($,X,void 0))}async makeRequest($,X,J){let Z=await $,z=Z.maxRetries??this.maxRetries;if(X==null)X=z;await this.prepareOptions(Z);let{req:Y,url:W,timeout:Q}=await this.buildRequest(Z,{retryCount:z-X});await this.prepareRequest(Y,{url:W,options:Z});let G="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),V=J===void 0?"":`, retryOf: ${J}`,q=Date.now();if(O(this).debug(`[${G}] sending request`,n({retryOfRequestLogID:J,method:Z.method,url:W,options:Z,headers:Y.headers})),Z.signal?.aborted)throw new C;let N=new AbortController,w=await this.fetchWithTimeout(W,Y,Q,N).catch(I$),T=Date.now();if(w instanceof globalThis.Error){let b=`retrying, ${X} attempts remaining`;if(Z.signal?.aborted)throw new C;let A=i(w)||/timed? ?out/i.test(String(w)+("cause"in w?String(w.cause):""));if(X)return O(this).info(`[${G}] connection ${A?"timed out":"failed"} - ${b}`),O(this).debug(`[${G}] connection ${A?"timed out":"failed"} (${b})`,n({retryOfRequestLogID:J,url:W,durationMs:T-q,message:w.message})),this.retryRequest(Z,X,J??G);if(O(this).info(`[${G}] connection ${A?"timed out":"failed"} - error; no more retries left`),O(this).debug(`[${G}] connection ${A?"timed out":"failed"} (error; no more retries left)`,n({retryOfRequestLogID:J,url:W,durationMs:T-q,message:w.message})),A)throw new F$;throw new Z$({cause:w})}let R=[...w.headers.entries()].filter(([b])=>b==="request-id").map(([b,A])=>", "+b+": "+JSON.stringify(A)).join(""),c=`[${G}${V}${R}] ${Y.method} ${W} ${w.ok?"succeeded":"failed"} with status ${w.status} in ${T-q}ms`;if(!w.ok){let b=await this.shouldRetry(w);if(X&&b){let M0=`retrying, ${X} attempts remaining`;return await M5(w.body),O(this).info(`${c} - ${M0}`),O(this).debug(`[${G}] response error (${M0})`,n({retryOfRequestLogID:J,url:w.url,status:w.status,headers:w.headers,durationMs:T-q})),this.retryRequest(Z,X,J??G,w.headers)}let A=b?"error; no more retries left":"error; not retryable";O(this).info(`${c} - ${A}`);let P=await w.text().catch((M0)=>I$(M0).message),B$=B0(P),c1=B$?void 0:P;throw O(this).debug(`[${G}] response error (${A})`,n({retryOfRequestLogID:J,url:w.url,status:w.status,headers:w.headers,message:c1,durationMs:Date.now()-q})),this.makeStatusError(w.status,B$,c1,w.headers)}return O(this).info(c),O(this).debug(`[${G}] response start`,n({retryOfRequestLogID:J,url:w.url,status:w.status,headers:w.headers,durationMs:T-q})),{response:w,options:Z,controller:N,requestLogID:G,retryOfRequestLogID:J,startTime:q}}getAPIList($,X,J){return this.requestAPIList(X,{method:"get",path:$,...J})}requestAPIList($,X){let J=this.makeRequest(X,null,void 0);return new O0(this,J,$)}async fetchWithTimeout($,X,J,Z){let{signal:z,method:Y,...W}=X||{};if(z)z.addEventListener("abort",()=>Z.abort());let Q=setTimeout(()=>Z.abort(),J),G=globalThis.ReadableStream&&W.body instanceof globalThis.ReadableStream||typeof W.body==="object"&&W.body!==null&&Symbol.asyncIterator in W.body,V={signal:Z.signal,...G?{duplex:"half"}:{},method:"GET",...W};if(Y)V.method=Y.toUpperCase();try{return await this.fetch.call(void 0,$,V)}finally{clearTimeout(Q)}}async shouldRetry($){let X=$.headers.get("x-should-retry");if(X==="true")return!0;if(X==="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($,X,J,Z){let z,Y=Z?.get("retry-after-ms");if(Y){let Q=parseFloat(Y);if(!Number.isNaN(Q))z=Q}let W=Z?.get("retry-after");if(W&&!z){let Q=parseFloat(W);if(!Number.isNaN(Q))z=Q*1000;else z=Date.parse(W)-Date.now()}if(!(z&&0<=z&&z<60000)){let Q=$.maxRetries??this.maxRetries;z=this.calculateDefaultRetryTimeoutMillis(X,Q)}return await G5(z),this.makeRequest($,X-1,J)}calculateDefaultRetryTimeoutMillis($,X){let z=X-$,Y=Math.min(0.5*Math.pow(2,z),8),W=1-Math.random()*0.25;return Y*W*1000}calculateNonstreamingTimeout($,X){if(3600000*$/128000>600000||X!=null&&$>X)throw new H("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:X=0}={}){let J={...$},{method:Z,path:z,query:Y,defaultBaseURL:W}=J,Q=this.buildURL(z,Y,W);if("timeout"in J)K5("timeout",J.timeout);J.timeout=J.timeout??this.timeout;let{bodyHeaders:G,body:V}=this.buildBody({options:J}),q=await this.buildHeaders({options:$,method:Z,bodyHeaders:G,retryCount:X});return{req:{method:Z,headers:q,...J.signal&&{signal:J.signal},...globalThis.ReadableStream&&V instanceof globalThis.ReadableStream&&{duplex:"half"},...V&&{body:V},...this.fetchOptions??{},...J.fetchOptions??{}},url:Q,timeout:J.timeout}}async buildHeaders({options:$,method:X,bodyHeaders:J,retryCount:Z}){let z={};if(this.idempotencyHeader&&X!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();z[this.idempotencyHeader]=$.idempotencyKey}let Y=M([z,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(Z),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...H5(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,J,$.headers]);return this.validateHeaders(Y),Y.values}buildBody({options:{body:$,headers:X}}){if(!$)return{bodyHeaders:void 0,body:void 0};let J=M([X]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&J.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:S0($)};else return K(this,p0,"f").call(this,{body:$,headers:J})}}O1=I,p0=new WeakMap,x1=new WeakSet,l5=function(){return this.baseURL!=="https://api.anthropic.com"};I.Anthropic=O1;I.HUMAN_PROMPT=i5;I.AI_PROMPT=n5;I.DEFAULT_TIMEOUT=600000;I.AnthropicError=H;I.APIError=F;I.APIConnectionError=Z$;I.APIConnectionTimeoutError=F$;I.APIUserAbortError=C;I.NotFoundError=C$;I.ConflictError=A$;I.RateLimitError=f$;I.BadRequestError=x$;I.AuthenticationError=O$;I.InternalServerError=k$;I.PermissionDeniedError=P$;I.UnprocessableEntityError=R$;I.toFile=P0;class m extends I{constructor(){super(...arguments);this.completions=new T$(this),this.messages=new V$(this),this.models=new L$(this),this.beta=new p(this)}}m.Completions=T$;m.Messages=V$;m.Models=L$;m.Beta=p;var o5=($=0)=>(X)=>`\x1B[${X+$}m`,a5=($=0)=>(X)=>`\x1B[${38+$};5;${X}m`,t5=($=0)=>(X,J,Z)=>`\x1B[${38+$};2;${X};${J};${Z}m`,E={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},yZ=Object.keys(E.modifier),cX=Object.keys(E.color),uX=Object.keys(E.bgColor),_Z=[...cX,...uX];function mX(){let $=new Map;for(let[X,J]of Object.entries(E)){for(let[Z,z]of Object.entries(J))E[Z]={open:`\x1B[${z[0]}m`,close:`\x1B[${z[1]}m`},J[Z]=E[Z],$.set(z[0],z[1]);Object.defineProperty(E,X,{value:J,enumerable:!1})}return Object.defineProperty(E,"codes",{value:$,enumerable:!1}),E.color.close="\x1B[39m",E.bgColor.close="\x1B[49m",E.color.ansi=o5(),E.color.ansi256=a5(),E.color.ansi16m=t5(),E.bgColor.ansi=o5(10),E.bgColor.ansi256=a5(10),E.bgColor.ansi16m=t5(10),Object.defineProperties(E,{rgbToAnsi256:{value(X,J,Z){if(X===J&&J===Z){if(X<8)return 16;if(X>248)return 231;return Math.round((X-8)/247*24)+232}return 16+36*Math.round(X/255*5)+6*Math.round(J/255*5)+Math.round(Z/255*5)},enumerable:!1},hexToRgb:{value(X){let J=/[a-f\d]{6}|[a-f\d]{3}/i.exec(X.toString(16));if(!J)return[0,0,0];let[Z]=J;if(Z.length===3)Z=[...Z].map((Y)=>Y+Y).join("");let z=Number.parseInt(Z,16);return[z>>16&255,z>>8&255,z&255]},enumerable:!1},hexToAnsi256:{value:(X)=>E.rgbToAnsi256(...E.hexToRgb(X)),enumerable:!1},ansi256ToAnsi:{value(X){if(X<8)return 30+X;if(X<16)return 90+(X-8);let J,Z,z;if(X>=232)J=((X-232)*10+8)/255,Z=J,z=J;else{X-=16;let Q=X%36;J=Math.floor(X/36)/5,Z=Math.floor(Q/6)/5,z=Q%6/5}let Y=Math.max(J,Z,z)*2;if(Y===0)return 30;let W=30+(Math.round(z)<<2|Math.round(Z)<<1|Math.round(J));if(Y===2)W+=60;return W},enumerable:!1},rgbToAnsi:{value:(X,J,Z)=>E.ansi256ToAnsi(E.rgbToAnsi256(X,J,Z)),enumerable:!1},hexToAnsi:{value:(X)=>E.ansi256ToAnsi(E.hexToAnsi256(X)),enumerable:!1}}),E}var dX=mX(),d=dX;import P1 from"node:process";import pX from"node:os";import s5 from"node:tty";function g($,X=globalThis.Deno?globalThis.Deno.args:P1.argv){let J=$.startsWith("-")?"":$.length===1?"-":"--",Z=X.indexOf(J+$),z=X.indexOf("--");return Z!==-1&&(z===-1||Z<z)}var{env:B}=P1,l0;if(g("no-color")||g("no-colors")||g("color=false")||g("color=never"))l0=0;else if(g("color")||g("colors")||g("color=true")||g("color=always"))l0=1;function lX(){if("FORCE_COLOR"in B){if(B.FORCE_COLOR==="true")return 1;if(B.FORCE_COLOR==="false")return 0;return B.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(B.FORCE_COLOR,10),3)}}function iX($){if($===0)return!1;return{level:$,hasBasic:!0,has256:$>=2,has16m:$>=3}}function nX($,{streamIsTTY:X,sniffFlags:J=!0}={}){let Z=lX();if(Z!==void 0)l0=Z;let z=J?l0:Z;if(z===0)return 0;if(J){if(g("color=16m")||g("color=full")||g("color=truecolor"))return 3;if(g("color=256"))return 2}if("TF_BUILD"in B&&"AGENT_NAME"in B)return 1;if($&&!X&&z===void 0)return 0;let Y=z||0;if(B.TERM==="dumb")return Y;if(P1.platform==="win32"){let W=pX.release().split(".");if(Number(W[0])>=10&&Number(W[2])>=10586)return Number(W[2])>=14931?3:2;return 1}if("CI"in B){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((W)=>(W in B)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((W)=>(W in B))||B.CI_NAME==="codeship")return 1;return Y}if("TEAMCITY_VERSION"in B)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(B.TEAMCITY_VERSION)?1:0;if(B.COLORTERM==="truecolor")return 3;if(B.TERM==="xterm-kitty")return 3;if(B.TERM==="xterm-ghostty")return 3;if(B.TERM==="wezterm")return 3;if("TERM_PROGRAM"in B){let W=Number.parseInt((B.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(B.TERM_PROGRAM){case"iTerm.app":return W>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(B.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(B.TERM))return 1;if("COLORTERM"in B)return 1;return Y}function r5($,X={}){let J=nX($,{streamIsTTY:$&&$.isTTY,...X});return iX(J)}var oX={stdout:r5({isTTY:s5.isatty(1)}),stderr:r5({isTTY:s5.isatty(2)})},e5=oX;function $4($,X,J){let Z=$.indexOf(X);if(Z===-1)return $;let z=X.length,Y=0,W="";do W+=$.slice(Y,Z)+X+J,Y=Z+z,Z=$.indexOf(X,Y);while(Z!==-1);return W+=$.slice(Y),W}function X4($,X,J,Z){let z=0,Y="";do{let W=$[Z-1]==="\r";Y+=$.slice(z,W?Z-1:Z)+X+(W?`\r
68
128
  `:`
69
- `)+J,z=Z+1,Z=$.indexOf(`
70
- `,z)}while(Z!==-1);return Y+=$.slice(z),Y}var{stdout:J4,stderr:Z4}=e5,C1=Symbol("GENERATOR"),D$=Symbol("STYLER"),V0=Symbol("IS_EMPTY"),z4=["ansi","ansi","ansi256","ansi16m"],E$=Object.create(null),aX=($,X={})=>{if(X.level&&!(Number.isInteger(X.level)&&X.level>=0&&X.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let J=J4?J4.level:0;$.level=X.level===void 0?J:X.level};var tX=($)=>{let X=(...J)=>J.join(" ");return aX(X,$),Object.setPrototypeOf(X,q0.prototype),X};function q0($){return tX($)}Object.setPrototypeOf(q0.prototype,Function.prototype);for(let[$,X]of Object.entries(d))E$[$]={get(){let J=i0(this,R1(X.open,X.close,this[D$]),this[V0]);return Object.defineProperty(this,$,{value:J}),J}};E$.visible={get(){let $=i0(this,this[D$],!0);return Object.defineProperty(this,"visible",{value:$}),$}};var A1=($,X,J,...Z)=>{if($==="rgb"){if(X==="ansi16m")return d[J].ansi16m(...Z);if(X==="ansi256")return d[J].ansi256(d.rgbToAnsi256(...Z));return d[J].ansi(d.rgbToAnsi(...Z))}if($==="hex")return A1("rgb",X,J,...d.hexToRgb(...Z));return d[J][$](...Z)},sX=["rgb","hex","ansi256"];for(let $ of sX){E$[$]={get(){let{level:J}=this;return function(...Z){let z=R1(A1($,z4[J],"color",...Z),d.color.close,this[D$]);return i0(this,z,this[V0])}}};let X="bg"+$[0].toUpperCase()+$.slice(1);E$[X]={get(){let{level:J}=this;return function(...Z){let z=R1(A1($,z4[J],"bgColor",...Z),d.bgColor.close,this[D$]);return i0(this,z,this[V0])}}}}var rX=Object.defineProperties(()=>{},{...E$,level:{enumerable:!0,get(){return this[C1].level},set($){this[C1].level=$}}}),R1=($,X,J)=>{let Z,z;if(J===void 0)Z=$,z=X;else Z=J.openAll+$,z=X+J.closeAll;return{open:$,close:X,openAll:Z,closeAll:z,parent:J}},i0=($,X,J)=>{let Z=(...z)=>eX(Z,z.length===1?""+z[0]:z.join(" "));return Object.setPrototypeOf(Z,rX),Z[C1]=$,Z[D$]=X,Z[V0]=J,Z},eX=($,X)=>{if($.level<=0||!X)return $[V0]?"":X;let J=$[D$];if(J===void 0)return X;let{openAll:Z,closeAll:z}=J;if(X.includes("\x1B"))while(J!==void 0)X=$4(X,J.close,J.open),J=J.parent;let Y=X.indexOf(`
71
- `);if(Y!==-1)X=X4(X,z,Z,Y);return Z+X+z};Object.defineProperties(q0.prototype,E$);var $8=q0(),lZ=q0({level:Z4?Z4.level:0});var j=$8;var f1=null;function X8(){if(!process.env.ANTHROPIC_API_KEY)console.error(j.red("\uD83E\uDD52 Something went sour.")),console.error(),console.error(" Missing API key for the AI."),console.error(j.dim(" Get one at: https://console.anthropic.com/")),process.exit(1);if(!f1)f1=new m;return f1}async function U0($){let X=X8();try{let J=await X.messages.create({model:"claude-sonnet-4-20250514",max_tokens:2048,messages:[{role:"user",content:$}]});return J.content[0].type==="text"?J.content[0].text:""}catch(J){if(J instanceof m.AuthenticationError)console.error(j.red("\uD83E\uDD52 That API key's gone bad. Double-check it?")),process.exit(1);if(J instanceof m.RateLimitError)return console.error(j.yellow("⏳ Brine time... AI needs a breather (10s)")),await Bun.sleep(1e4),U0($);throw J}}async function N0($){let J=(await U0(`${$}
129
+ `)+($.substring(1)||" "),J=!0,Y=!1;break;case"%":if(X[G+1]?.[0]!=="#")G+=1;J=!1;break;default:if(!J)Y=!0;J=!1}}return{comment:Q,afterEmptyLine:Y}}class GG{constructor(X={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Q,J,Y,G)=>{let $=E8(Q);if(G)this.warnings.push(new S8.YAMLWarning($,J,Y));else this.errors.push(new S8.YAMLParseError($,J,Y))},this.directives=new CR.Directives({version:X.version||"1.2"}),this.options=X}decorate(X,Q){let{comment:J,afterEmptyLine:Y}=YG(this.prelude);if(J){let G=X.contents;if(Q)X.comment=X.comment?`${X.comment}
130
+ ${J}`:J;else if(Y||X.directives.docStart||!G)X.commentBefore=J;else if(JG.isCollection(G)&&!G.flow&&G.items.length>0){let $=G.items[0];if(JG.isPair($))$=$.key;let W=$.commentBefore;$.commentBefore=W?`${J}
131
+ ${W}`:J}else{let $=G.commentBefore;G.commentBefore=$?`${J}
132
+ ${$}`:J}}if(Q)Array.prototype.push.apply(X.errors,this.errors),Array.prototype.push.apply(X.warnings,this.warnings);else X.errors=this.errors,X.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:YG(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(X,Q=!1,J=-1){for(let Y of X)yield*this.next(Y);yield*this.end(Q,J)}*next(X){if(bR.env.LOG_STREAM)console.dir(X,{depth:null});switch(X.type){case"directive":this.directives.add(X.source,(Q,J,Y)=>{let G=E8(X);G[0]+=Q,this.onError(G,"BAD_DIRECTIVE",J,Y)}),this.prelude.push(X.source),this.atDirectives=!0;break;case"document":{let Q=kR.composeDoc(this.options,this.directives,X,this.onError);if(this.atDirectives&&!Q.directives.docStart)this.onError(X,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(Q,!1),this.doc)yield this.doc;this.doc=Q,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(X.source);break;case"error":{let Q=X.source?`${X.message}: ${JSON.stringify(X.source)}`:X.message,J=new S8.YAMLParseError(E8(X),"UNEXPECTED_TOKEN",Q);if(this.atDirectives||!this.doc)this.errors.push(J);else this.doc.errors.push(J);break}case"doc-end":{if(!this.doc){this.errors.push(new S8.YAMLParseError(E8(X),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Q=vR.resolveEnd(X.end,X.offset+X.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),Q.comment){let J=this.doc.comment;this.doc.comment=J?`${J}
133
+ ${Q.comment}`:Q.comment}this.doc.range[2]=Q.offset;break}default:this.errors.push(new S8.YAMLParseError(E8(X),"UNEXPECTED_TOKEN",`Unsupported token ${X.type}`))}}*end(X=!1,Q=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(X){let J=Object.assign({_directives:this.directives},this.options),Y=new _R.Document(void 0,J);if(this.atDirectives)this.onError(Q,"MISSING_CHAR","Missing directives-end indicator line");Y.range=[0,Q,Q],this.decorate(Y,!1),yield Y}}}yR.Composer=GG});var HG=p((pR)=>{var gR=tQ(),hR=X4(),fR=P8(),$G=K8();function uR(X,Q=!0,J){if(X){let Y=(G,$,W)=>{let H=typeof G==="number"?G:Array.isArray(G)?G[0]:G.offset;if(J)J(H,$,W);else throw new fR.YAMLParseError([H,H+1],$,W)};switch(X.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return hR.resolveFlowScalar(X,Q,Y);case"block-scalar":return gR.resolveBlockScalar({options:{strict:Q}},X,Y)}}return null}function mR(X,Q){let{implicitKey:J=!1,indent:Y,inFlow:G=!1,offset:$=-1,type:W="PLAIN"}=Q,H=$G.stringifyString({type:W,value:X},{implicitKey:J,indent:Y>0?" ".repeat(Y):"",inFlow:G,options:{blockQuote:!0,lineWidth:-1}}),U=Q.end??[{type:"newline",offset:-1,indent:Y,source:`
134
+ `}];switch(H[0]){case"|":case">":{let B=H.indexOf(`
135
+ `),q=H.substring(0,B),K=H.substring(B+1)+`
136
+ `,V=[{type:"block-scalar-header",offset:$,indent:Y,source:q}];if(!WG(V,U))V.push({type:"newline",offset:-1,indent:Y,source:`
137
+ `});return{type:"block-scalar",offset:$,indent:Y,props:V,source:K}}case'"':return{type:"double-quoted-scalar",offset:$,indent:Y,source:H,end:U};case"'":return{type:"single-quoted-scalar",offset:$,indent:Y,source:H,end:U};default:return{type:"scalar",offset:$,indent:Y,source:H,end:U}}}function lR(X,Q,J={}){let{afterKey:Y=!1,implicitKey:G=!1,inFlow:$=!1,type:W}=J,H="indent"in X?X.indent:null;if(Y&&typeof H==="number")H+=2;if(!W)switch(X.type){case"single-quoted-scalar":W="QUOTE_SINGLE";break;case"double-quoted-scalar":W="QUOTE_DOUBLE";break;case"block-scalar":{let B=X.props[0];if(B.type!=="block-scalar-header")throw Error("Invalid block scalar header");W=B.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:W="PLAIN"}let U=$G.stringifyString({type:W,value:Q},{implicitKey:G||H===null,indent:H!==null&&H>0?" ".repeat(H):"",inFlow:$,options:{blockQuote:!0,lineWidth:-1}});switch(U[0]){case"|":case">":cR(X,U);break;case'"':Y4(X,U,"double-quoted-scalar");break;case"'":Y4(X,U,"single-quoted-scalar");break;default:Y4(X,U,"scalar")}}function cR(X,Q){let J=Q.indexOf(`
138
+ `),Y=Q.substring(0,J),G=Q.substring(J+1)+`
139
+ `;if(X.type==="block-scalar"){let $=X.props[0];if($.type!=="block-scalar-header")throw Error("Invalid block scalar header");$.source=Y,X.source=G}else{let{offset:$}=X,W="indent"in X?X.indent:-1,H=[{type:"block-scalar-header",offset:$,indent:W,source:Y}];if(!WG(H,"end"in X?X.end:void 0))H.push({type:"newline",offset:-1,indent:W,source:`
140
+ `});for(let U of Object.keys(X))if(U!=="type"&&U!=="offset")delete X[U];Object.assign(X,{type:"block-scalar",indent:W,props:H,source:G})}}function WG(X,Q){if(Q)for(let J of Q)switch(J.type){case"space":case"comment":X.push(J);break;case"newline":return X.push(J),!0}return!1}function Y4(X,Q,J){switch(X.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":X.type=J,X.source=Q;break;case"block-scalar":{let Y=X.props.slice(1),G=Q.length;if(X.props[0].type==="block-scalar-header")G-=X.props[0].source.length;for(let $ of Y)$.offset+=G;delete X.props,Object.assign(X,{type:J,source:Q,end:Y});break}case"block-map":case"block-seq":{let G={type:"newline",offset:X.offset+Q.length,indent:X.indent,source:`
141
+ `};delete X.items,Object.assign(X,{type:J,source:Q,end:[G]});break}default:{let Y="indent"in X?X.indent:-1,G="end"in X&&Array.isArray(X.end)?X.end.filter(($)=>$.type==="space"||$.type==="comment"||$.type==="newline"):[];for(let $ of Object.keys(X))if($!=="type"&&$!=="offset")delete X[$];Object.assign(X,{type:J,indent:Y,source:Q,end:G})}}}pR.createScalarToken=mR;pR.resolveAsScalar=uR;pR.setScalarValue=lR});var UG=p((oR)=>{var rR=(X)=>("type"in X)?t6(X):s6(X);function t6(X){switch(X.type){case"block-scalar":{let Q="";for(let J of X.props)Q+=t6(J);return Q+X.source}case"block-map":case"block-seq":{let Q="";for(let J of X.items)Q+=s6(J);return Q}case"flow-collection":{let Q=X.start.source;for(let J of X.items)Q+=s6(J);for(let J of X.end)Q+=J.source;return Q}case"document":{let Q=s6(X);if(X.end)for(let J of X.end)Q+=J.source;return Q}default:{let Q=X.source;if("end"in X&&X.end)for(let J of X.end)Q+=J.source;return Q}}}function s6({start:X,key:Q,sep:J,value:Y}){let G="";for(let $ of X)G+=$.source;if(Q)G+=t6(Q);if(J)for(let $ of J)G+=$.source;if(Y)G+=t6(Y);return G}oR.stringify=rR});var LG=p((tR)=>{var G4=Symbol("break visit"),sR=Symbol("skip children"),BG=Symbol("remove item");function J9(X,Q){if("type"in X&&X.type==="document")X={start:X.start,value:X.value};zG(Object.freeze([]),X,Q)}J9.BREAK=G4;J9.SKIP=sR;J9.REMOVE=BG;J9.itemAtPath=(X,Q)=>{let J=X;for(let[Y,G]of Q){let $=J?.[Y];if($&&"items"in $)J=$.items[G];else return}return J};J9.parentCollection=(X,Q)=>{let J=J9.itemAtPath(X,Q.slice(0,-1)),Y=Q[Q.length-1][0],G=J?.[Y];if(G&&"items"in G)return G;throw Error("Parent collection not found")};function zG(X,Q,J){let Y=J(Q,X);if(typeof Y==="symbol")return Y;for(let G of["key","value"]){let $=Q[G];if($&&"items"in $){for(let W=0;W<$.items.length;++W){let H=zG(Object.freeze(X.concat([[G,W]])),$.items[W],J);if(typeof H==="number")W=H-1;else if(H===G4)return G4;else if(H===BG)$.items.splice(W,1),W-=1}if(typeof Y==="function"&&G==="key")Y=Y(Q,X)}}return typeof Y==="function"?Y(Q,X):Y}tR.visit=J9});var e6=p((WI)=>{var $4=HG(),XI=UG(),QI=LG(),W4="\uFEFF",H4="\x02",U4="\x18",B4="\x1F",JI=(X)=>!!X&&("items"in X),YI=(X)=>!!X&&(X.type==="scalar"||X.type==="single-quoted-scalar"||X.type==="double-quoted-scalar"||X.type==="block-scalar");function GI(X){switch(X){case W4:return"<BOM>";case H4:return"<DOC>";case U4:return"<FLOW_END>";case B4:return"<SCALAR>";default:return JSON.stringify(X)}}function $I(X){switch(X){case W4:return"byte-order-mark";case H4:return"doc-mode";case U4:return"flow-error-end";case B4:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
142
+ `:case`\r
143
+ `: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(X[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}WI.createScalarToken=$4.createScalarToken;WI.resolveAsScalar=$4.resolveAsScalar;WI.setScalarValue=$4.setScalarValue;WI.stringify=XI.stringify;WI.visit=QI.visit;WI.BOM=W4;WI.DOCUMENT=H4;WI.FLOW_END=U4;WI.SCALAR=B4;WI.isCollection=JI;WI.isScalar=YI;WI.prettyToken=GI;WI.tokenType=$I});var L4=p((RI)=>{var b8=e6();function B1(X){switch(X){case void 0:case" ":case`
144
+ `:case"\r":case"\t":return!0;default:return!1}}var qG=new Set("0123456789ABCDEFabcdef"),AI=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),XX=new Set(",[]{}"),NI=new Set(` ,[]{}
145
+ \r `),z4=(X)=>!X||NI.has(X);class FG{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(X,Q=!1){if(X){if(typeof X!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+X:X,this.lineEndPos=null}this.atEnd=!Q;let J=this.next??"stream";while(J&&(Q||this.hasChars(1)))J=yield*this.parseNext(J)}atLineEnd(){let X=this.pos,Q=this.buffer[X];while(Q===" "||Q==="\t")Q=this.buffer[++X];if(!Q||Q==="#"||Q===`
146
+ `)return!0;if(Q==="\r")return this.buffer[X+1]===`
147
+ `;return!1}charAt(X){return this.buffer[this.pos+X]}continueScalar(X){let Q=this.buffer[X];if(this.indentNext>0){let J=0;while(Q===" ")Q=this.buffer[++J+X];if(Q==="\r"){let Y=this.buffer[J+X+1];if(Y===`
148
+ `||!Y&&!this.atEnd)return X+J+1}return Q===`
149
+ `||J>=this.indentNext||!Q&&!this.atEnd?X+J:-1}if(Q==="-"||Q==="."){let J=this.buffer.substr(X,3);if((J==="---"||J==="...")&&B1(this.buffer[X+3]))return-1}return X}getLine(){let X=this.lineEndPos;if(typeof X!=="number"||X!==-1&&X<this.pos)X=this.buffer.indexOf(`
150
+ `,this.pos),this.lineEndPos=X;if(X===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[X-1]==="\r")X-=1;return this.buffer.substring(this.pos,X)}hasChars(X){return this.pos+X<=this.buffer.length}setNext(X){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=X,null}peek(X){return this.buffer.substr(this.pos,X)}*parseNext(X){switch(X){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 X=this.getLine();if(X===null)return this.setNext("stream");if(X[0]===b8.BOM)yield*this.pushCount(1),X=X.substring(1);if(X[0]==="%"){let Q=X.length,J=X.indexOf("#");while(J!==-1){let G=X[J-1];if(G===" "||G==="\t"){Q=J-1;break}else J=X.indexOf("#",J+1)}while(!0){let G=X[Q-1];if(G===" "||G==="\t")Q-=1;else break}let Y=(yield*this.pushCount(Q))+(yield*this.pushSpaces(!0));return yield*this.pushCount(X.length-Y),this.pushNewline(),"stream"}if(this.atLineEnd()){let Q=yield*this.pushSpaces(!0);return yield*this.pushCount(X.length-Q),yield*this.pushNewline(),"stream"}return yield b8.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let X=this.charAt(0);if(!X&&!this.atEnd)return this.setNext("line-start");if(X==="-"||X==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let Q=this.peek(3);if((Q==="---"||Q==="...")&&B1(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,Q==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!B1(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[X,Q]=this.peek(2);if(!Q&&!this.atEnd)return this.setNext("block-start");if((X==="-"||X==="?"||X===":")&&B1(Q)){let J=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=J,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let X=this.getLine();if(X===null)return this.setNext("doc");let Q=yield*this.pushIndicators();switch(X[Q]){case"#":yield*this.pushCount(X.length-Q);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(z4),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return Q+=yield*this.parseBlockScalarHeader(),Q+=yield*this.pushSpaces(!0),yield*this.pushCount(X.length-Q),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let X,Q,J=-1;do{if(X=yield*this.pushNewline(),X>0)Q=yield*this.pushSpaces(!1),this.indentValue=J=Q;else Q=0;Q+=yield*this.pushSpaces(!0)}while(X+Q>0);let Y=this.getLine();if(Y===null)return this.setNext("flow");if(J!==-1&&J<this.indentNext&&Y[0]!=="#"||J===0&&(Y.startsWith("---")||Y.startsWith("..."))&&B1(Y[3])){if(!(J===this.indentNext-1&&this.flowLevel===1&&(Y[0]==="]"||Y[0]==="}")))return this.flowLevel=0,yield b8.FLOW_END,yield*this.parseLineStart()}let G=0;while(Y[G]===",")G+=yield*this.pushCount(1),G+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(G+=yield*this.pushIndicators(),Y[G]){case void 0:return"flow";case"#":return yield*this.pushCount(Y.length-G),"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(z4),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let $=this.charAt(1);if(this.flowKey||B1($)||$===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let X=this.charAt(0),Q=this.buffer.indexOf(X,this.pos+1);if(X==="'")while(Q!==-1&&this.buffer[Q+1]==="'")Q=this.buffer.indexOf("'",Q+2);else while(Q!==-1){let G=0;while(this.buffer[Q-1-G]==="\\")G+=1;if(G%2===0)break;Q=this.buffer.indexOf('"',Q+1)}let J=this.buffer.substring(0,Q),Y=J.indexOf(`
151
+ `,this.pos);if(Y!==-1){while(Y!==-1){let G=this.continueScalar(Y+1);if(G===-1)break;Y=J.indexOf(`
152
+ `,G)}if(Y!==-1)Q=Y-(J[Y-1]==="\r"?2:1)}if(Q===-1){if(!this.atEnd)return this.setNext("quoted-scalar");Q=this.buffer.length}return yield*this.pushToIndex(Q+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let X=this.pos;while(!0){let Q=this.buffer[++X];if(Q==="+")this.blockScalarKeep=!0;else if(Q>"0"&&Q<="9")this.blockScalarIndent=Number(Q)-1;else if(Q!=="-")break}return yield*this.pushUntil((Q)=>B1(Q)||Q==="#")}*parseBlockScalar(){let X=this.pos-1,Q=0,J;X:for(let G=this.pos;J=this.buffer[G];++G)switch(J){case" ":Q+=1;break;case`
153
+ `:X=G,Q=0;break;case"\r":{let $=this.buffer[G+1];if(!$&&!this.atEnd)return this.setNext("block-scalar");if($===`
154
+ `)break}default:break X}if(!J&&!this.atEnd)return this.setNext("block-scalar");if(Q>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=Q;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let G=this.continueScalar(X+1);if(G===-1)break;X=this.buffer.indexOf(`
155
+ `,G)}while(X!==-1);if(X===-1){if(!this.atEnd)return this.setNext("block-scalar");X=this.buffer.length}}let Y=X+1;J=this.buffer[Y];while(J===" ")J=this.buffer[++Y];if(J==="\t"){while(J==="\t"||J===" "||J==="\r"||J===`
156
+ `)J=this.buffer[++Y];X=Y-1}else if(!this.blockScalarKeep)do{let G=X-1,$=this.buffer[G];if($==="\r")$=this.buffer[--G];let W=G;while($===" ")$=this.buffer[--G];if($===`
157
+ `&&G>=this.pos&&G+1+Q>W)X=G;else break}while(!0);return yield b8.SCALAR,yield*this.pushToIndex(X+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let X=this.flowLevel>0,Q=this.pos-1,J=this.pos-1,Y;while(Y=this.buffer[++J])if(Y===":"){let G=this.buffer[J+1];if(B1(G)||X&&XX.has(G))break;Q=J}else if(B1(Y)){let G=this.buffer[J+1];if(Y==="\r")if(G===`
158
+ `)J+=1,Y=`
159
+ `,G=this.buffer[J+1];else Q=J;if(G==="#"||X&&XX.has(G))break;if(Y===`
160
+ `){let $=this.continueScalar(J+1);if($===-1)break;J=Math.max(J,$-2)}}else{if(X&&XX.has(Y))break;Q=J}if(!Y&&!this.atEnd)return this.setNext("plain-scalar");return yield b8.SCALAR,yield*this.pushToIndex(Q+1,!0),X?"flow":"doc"}*pushCount(X){if(X>0)return yield this.buffer.substr(this.pos,X),this.pos+=X,X;return 0}*pushToIndex(X,Q){let J=this.buffer.slice(this.pos,X);if(J)return yield J,this.pos+=J.length,J.length;else if(Q)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(z4))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let X=this.flowLevel>0,Q=this.charAt(1);if(B1(Q)||X&&XX.has(Q)){if(!X)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 X=this.pos+2,Q=this.buffer[X];while(!B1(Q)&&Q!==">")Q=this.buffer[++X];return yield*this.pushToIndex(Q===">"?X+1:X,!1)}else{let X=this.pos+1,Q=this.buffer[X];while(Q)if(AI.has(Q))Q=this.buffer[++X];else if(Q==="%"&&qG.has(this.buffer[X+1])&&qG.has(this.buffer[X+2]))Q=this.buffer[X+=3];else break;return yield*this.pushToIndex(X,!1)}}*pushNewline(){let X=this.buffer[this.pos];if(X===`
161
+ `)return yield*this.pushCount(1);else if(X==="\r"&&this.charAt(1)===`
162
+ `)return yield*this.pushCount(2);else return 0}*pushSpaces(X){let Q=this.pos-1,J;do J=this.buffer[++Q];while(J===" "||X&&J==="\t");let Y=Q-this.pos;if(Y>0)yield this.buffer.substr(this.pos,Y),this.pos=Q;return Y}*pushUntil(X){let Q=this.pos,J=this.buffer[Q];while(!X(J))J=this.buffer[++Q];return yield*this.pushToIndex(Q,!1)}}RI.Lexer=FG});var q4=p((jI)=>{class KG{constructor(){this.lineStarts=[],this.addNewLine=(X)=>this.lineStarts.push(X),this.linePos=(X)=>{let Q=0,J=this.lineStarts.length;while(Q<J){let G=Q+J>>1;if(this.lineStarts[G]<X)Q=G+1;else J=G}if(this.lineStarts[Q]===X)return{line:Q+1,col:1};if(Q===0)return{line:0,col:X};let Y=this.lineStarts[Q-1];return{line:Q,col:X-Y+1}}}}jI.LineCounter=KG});var F4=p((SI)=>{var PI=O1("process"),VG=e6(),TI=L4();function c1(X,Q){for(let J=0;J<X.length;++J)if(X[J].type===Q)return!0;return!1}function MG(X){for(let Q=0;Q<X.length;++Q)switch(X[Q].type){case"space":case"comment":case"newline":break;default:return Q}return-1}function ZG(X){switch(X?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function QX(X){switch(X.type){case"document":return X.start;case"block-map":{let Q=X.items[X.items.length-1];return Q.sep??Q.start}case"block-seq":return X.items[X.items.length-1].start;default:return[]}}function C9(X){if(X.length===0)return[];let Q=X.length;X:while(--Q>=0)switch(X[Q].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break X}while(X[++Q]?.type==="space");return X.splice(Q,X.length)}function DG(X){if(X.start.type==="flow-seq-start"){for(let Q of X.items)if(Q.sep&&!Q.value&&!c1(Q.start,"explicit-key-ind")&&!c1(Q.sep,"map-value-ind")){if(Q.key)Q.value=Q.key;if(delete Q.key,ZG(Q.value))if(Q.value.end)Array.prototype.push.apply(Q.value.end,Q.sep);else Q.value.end=Q.sep;else Array.prototype.push.apply(Q.start,Q.sep);delete Q.sep}}}class OG{constructor(X){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new TI.Lexer,this.onNewLine=X}*parse(X,Q=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let J of this.lexer.lex(X,Q))yield*this.next(J);if(!Q)yield*this.end()}*next(X){if(this.source=X,PI.env.LOG_TOKENS)console.log("|",VG.prettyToken(X));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=X.length;return}let Q=VG.tokenType(X);if(!Q){let J=`Not a YAML token: ${X}`;yield*this.pop({type:"error",offset:this.offset,message:J,source:X}),this.offset+=X.length}else if(Q==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=Q,yield*this.step(),Q){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+X.length);break;case"space":if(this.atNewLine&&X[0]===" ")this.indent+=X.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=X.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=X.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 X=this.peek(1);if(this.type==="doc-end"&&X?.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(!X)return yield*this.stream();switch(X.type){case"document":return yield*this.document(X);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(X);case"block-scalar":return yield*this.blockScalar(X);case"block-map":return yield*this.blockMap(X);case"block-seq":return yield*this.blockSequence(X);case"flow-collection":return yield*this.flowCollection(X);case"doc-end":return yield*this.documentEnd(X)}yield*this.pop()}peek(X){return this.stack[this.stack.length-X]}*pop(X){let Q=X??this.stack.pop();if(!Q)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield Q;else{let J=this.peek(1);if(Q.type==="block-scalar")Q.indent="indent"in J?J.indent:0;else if(Q.type==="flow-collection"&&J.type==="document")Q.indent=0;if(Q.type==="flow-collection")DG(Q);switch(J.type){case"document":J.value=Q;break;case"block-scalar":J.props.push(Q);break;case"block-map":{let Y=J.items[J.items.length-1];if(Y.value){J.items.push({start:[],key:Q,sep:[]}),this.onKeyLine=!0;return}else if(Y.sep)Y.value=Q;else{Object.assign(Y,{key:Q,sep:[]}),this.onKeyLine=!Y.explicitKey;return}break}case"block-seq":{let Y=J.items[J.items.length-1];if(Y.value)J.items.push({start:[],value:Q});else Y.value=Q;break}case"flow-collection":{let Y=J.items[J.items.length-1];if(!Y||Y.value)J.items.push({start:[],key:Q,sep:[]});else if(Y.sep)Y.value=Q;else Object.assign(Y,{key:Q,sep:[]});return}default:yield*this.pop(),yield*this.pop(Q)}if((J.type==="document"||J.type==="block-map"||J.type==="block-seq")&&(Q.type==="block-map"||Q.type==="block-seq")){let Y=Q.items[Q.items.length-1];if(Y&&!Y.sep&&!Y.value&&Y.start.length>0&&MG(Y.start)===-1&&(Q.indent===0||Y.start.every((G)=>G.type!=="comment"||G.indent<Q.indent))){if(J.type==="document")J.end=Y.start;else J.items.push({start:Y.start});Q.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 X={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")X.start.push(this.sourceToken);this.stack.push(X);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(X){if(X.value)return yield*this.lineEnd(X);switch(this.type){case"doc-start":{if(MG(X.start)!==-1)yield*this.pop(),yield*this.step();else X.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":X.start.push(this.sourceToken);return}let Q=this.startBlockValue(X);if(Q)this.stack.push(Q);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(X){if(this.type==="map-value-ind"){let Q=QX(this.peek(2)),J=C9(Q),Y;if(X.end)Y=X.end,Y.push(this.sourceToken),delete X.end;else Y=[this.sourceToken];let G={type:"block-map",offset:X.offset,indent:X.indent,items:[{start:J,key:X,sep:Y}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=G}else yield*this.lineEnd(X)}*blockScalar(X){switch(this.type){case"space":case"comment":case"newline":X.props.push(this.sourceToken);return;case"scalar":if(X.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let Q=this.source.indexOf(`
163
+ `)+1;while(Q!==0)this.onNewLine(this.offset+Q),Q=this.source.indexOf(`
164
+ `,Q)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(X){let Q=X.items[X.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,Q.value){let J="end"in Q.value?Q.value.end:void 0;if((Array.isArray(J)?J[J.length-1]:void 0)?.type==="comment")J?.push(this.sourceToken);else X.items.push({start:[this.sourceToken]})}else if(Q.sep)Q.sep.push(this.sourceToken);else Q.start.push(this.sourceToken);return;case"space":case"comment":if(Q.value)X.items.push({start:[this.sourceToken]});else if(Q.sep)Q.sep.push(this.sourceToken);else{if(this.atIndentedComment(Q.start,X.indent)){let Y=X.items[X.items.length-2]?.value?.end;if(Array.isArray(Y)){Array.prototype.push.apply(Y,Q.start),Y.push(this.sourceToken),X.items.pop();return}}Q.start.push(this.sourceToken)}return}if(this.indent>=X.indent){let J=!this.onKeyLine&&this.indent===X.indent,Y=J&&(Q.sep||Q.explicitKey)&&this.type!=="seq-item-ind",G=[];if(Y&&Q.sep&&!Q.value){let $=[];for(let W=0;W<Q.sep.length;++W){let H=Q.sep[W];switch(H.type){case"newline":$.push(W);break;case"space":break;case"comment":if(H.indent>X.indent)$.length=0;break;default:$.length=0}}if($.length>=2)G=Q.sep.splice($[1])}switch(this.type){case"anchor":case"tag":if(Y||Q.value)G.push(this.sourceToken),X.items.push({start:G}),this.onKeyLine=!0;else if(Q.sep)Q.sep.push(this.sourceToken);else Q.start.push(this.sourceToken);return;case"explicit-key-ind":if(!Q.sep&&!Q.explicitKey)Q.start.push(this.sourceToken),Q.explicitKey=!0;else if(Y||Q.value)G.push(this.sourceToken),X.items.push({start:G,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(Q.explicitKey)if(!Q.sep)if(c1(Q.start,"newline"))Object.assign(Q,{key:null,sep:[this.sourceToken]});else{let $=C9(Q.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:$,key:null,sep:[this.sourceToken]}]})}else if(Q.value)X.items.push({start:[],key:null,sep:[this.sourceToken]});else if(c1(Q.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:G,key:null,sep:[this.sourceToken]}]});else if(ZG(Q.key)&&!c1(Q.sep,"newline")){let $=C9(Q.start),W=Q.key,H=Q.sep;H.push(this.sourceToken),delete Q.key,delete Q.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:$,key:W,sep:H}]})}else if(G.length>0)Q.sep=Q.sep.concat(G,this.sourceToken);else Q.sep.push(this.sourceToken);else if(!Q.sep)Object.assign(Q,{key:null,sep:[this.sourceToken]});else if(Q.value||Y)X.items.push({start:G,key:null,sep:[this.sourceToken]});else if(c1(Q.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else Q.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let $=this.flowScalar(this.type);if(Y||Q.value)X.items.push({start:G,key:$,sep:[]}),this.onKeyLine=!0;else if(Q.sep)this.stack.push($);else Object.assign(Q,{key:$,sep:[]}),this.onKeyLine=!0;return}default:{let $=this.startBlockValue(X);if($){if($.type==="block-seq"){if(!Q.explicitKey&&Q.sep&&!c1(Q.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(J)X.items.push({start:G});this.stack.push($);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(X){let Q=X.items[X.items.length-1];switch(this.type){case"newline":if(Q.value){let J="end"in Q.value?Q.value.end:void 0;if((Array.isArray(J)?J[J.length-1]:void 0)?.type==="comment")J?.push(this.sourceToken);else X.items.push({start:[this.sourceToken]})}else Q.start.push(this.sourceToken);return;case"space":case"comment":if(Q.value)X.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(Q.start,X.indent)){let Y=X.items[X.items.length-2]?.value?.end;if(Array.isArray(Y)){Array.prototype.push.apply(Y,Q.start),Y.push(this.sourceToken),X.items.pop();return}}Q.start.push(this.sourceToken)}return;case"anchor":case"tag":if(Q.value||this.indent<=X.indent)break;Q.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==X.indent)break;if(Q.value||c1(Q.start,"seq-item-ind"))X.items.push({start:[this.sourceToken]});else Q.start.push(this.sourceToken);return}if(this.indent>X.indent){let J=this.startBlockValue(X);if(J){this.stack.push(J);return}}yield*this.pop(),yield*this.step()}*flowCollection(X){let Q=X.items[X.items.length-1];if(this.type==="flow-error-end"){let J;do yield*this.pop(),J=this.peek(1);while(J?.type==="flow-collection")}else if(X.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!Q||Q.sep)X.items.push({start:[this.sourceToken]});else Q.start.push(this.sourceToken);return;case"map-value-ind":if(!Q||Q.value)X.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Q.sep)Q.sep.push(this.sourceToken);else Object.assign(Q,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!Q||Q.value)X.items.push({start:[this.sourceToken]});else if(Q.sep)Q.sep.push(this.sourceToken);else Q.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let Y=this.flowScalar(this.type);if(!Q||Q.value)X.items.push({start:[],key:Y,sep:[]});else if(Q.sep)this.stack.push(Y);else Object.assign(Q,{key:Y,sep:[]});return}case"flow-map-end":case"flow-seq-end":X.end.push(this.sourceToken);return}let J=this.startBlockValue(X);if(J)this.stack.push(J);else yield*this.pop(),yield*this.step()}else{let J=this.peek(2);if(J.type==="block-map"&&(this.type==="map-value-ind"&&J.indent===X.indent||this.type==="newline"&&!J.items[J.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&J.type!=="flow-collection"){let Y=QX(J),G=C9(Y);DG(X);let $=X.end.splice(1,X.end.length);$.push(this.sourceToken);let W={type:"block-map",offset:X.offset,indent:X.indent,items:[{start:G,key:X,sep:$}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=W}else yield*this.lineEnd(X)}}flowScalar(X){if(this.onNewLine){let Q=this.source.indexOf(`
165
+ `)+1;while(Q!==0)this.onNewLine(this.offset+Q),Q=this.source.indexOf(`
166
+ `,Q)+1}return{type:X,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(X){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 Q=QX(X),J=C9(Q);return J.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Q=QX(X),J=C9(Q);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(X,Q){if(this.type!=="comment")return!1;if(this.indent<=Q)return!1;return X.every((J)=>J.type==="newline"||J.type==="space")}*documentEnd(X){if(this.type!=="doc-mode"){if(X.end)X.end.push(this.sourceToken);else X.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(X){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(X.end)X.end.push(this.sourceToken);else X.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}SI.Parser=OG});var jG=p((gI)=>{var AG=J4(),bI=w8(),C8=P8(),CI=qQ(),_I=K0(),kI=q4(),NG=F4();function RG(X){let Q=X.prettyErrors!==!1;return{lineCounter:X.lineCounter||Q&&new kI.LineCounter||null,prettyErrors:Q}}function vI(X,Q={}){let{lineCounter:J,prettyErrors:Y}=RG(Q),G=new NG.Parser(J?.addNewLine),$=new AG.Composer(Q),W=Array.from($.compose(G.parse(X)));if(Y&&J)for(let H of W)H.errors.forEach(C8.prettifyError(X,J)),H.warnings.forEach(C8.prettifyError(X,J));if(W.length>0)return W;return Object.assign([],{empty:!0},$.streamInfo())}function IG(X,Q={}){let{lineCounter:J,prettyErrors:Y}=RG(Q),G=new NG.Parser(J?.addNewLine),$=new AG.Composer(Q),W=null;for(let H of $.compose(G.parse(X),!0,X.length))if(!W)W=H;else if(W.options.logLevel!=="silent"){W.errors.push(new C8.YAMLParseError(H.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Y&&J)W.errors.forEach(C8.prettifyError(X,J)),W.warnings.forEach(C8.prettifyError(X,J));return W}function yI(X,Q,J){let Y=void 0;if(typeof Q==="function")Y=Q;else if(J===void 0&&Q&&typeof Q==="object")J=Q;let G=IG(X,J);if(!G)return null;if(G.warnings.forEach(($)=>CI.warn(G.options.logLevel,$)),G.errors.length>0)if(G.options.logLevel!=="silent")throw G.errors[0];else G.errors=[];return G.toJS(Object.assign({reviver:Y},J))}function xI(X,Q,J){let Y=null;if(typeof Q==="function"||Array.isArray(Q))Y=Q;else if(J===void 0&&Q)J=Q;if(typeof J==="string")J=J.length;if(typeof J==="number"){let G=Math.round(J);J=G<1?void 0:G>8?{indent:8}:{indent:G}}if(X===void 0){let{keepUndefined:G}=J??Q??{};if(!G)return}if(_I.isDocument(X)&&!Y)return X.toString(J);return new bI.Document(X,Y,J).toString(J)}gI.parse=yI;gI.parseAllDocuments=vI;gI.parseDocument=IG;gI.stringify=xI});var PG=p((Xj)=>{var lI=J4(),cI=w8(),pI=uQ(),K4=P8(),dI=z8(),p1=K0(),iI=f1(),nI=v0(),rI=m1(),oI=l1(),aI=e6(),sI=L4(),tI=q4(),eI=F4(),JX=jG(),wG=U8();Xj.Composer=lI.Composer;Xj.Document=cI.Document;Xj.Schema=pI.Schema;Xj.YAMLError=K4.YAMLError;Xj.YAMLParseError=K4.YAMLParseError;Xj.YAMLWarning=K4.YAMLWarning;Xj.Alias=dI.Alias;Xj.isAlias=p1.isAlias;Xj.isCollection=p1.isCollection;Xj.isDocument=p1.isDocument;Xj.isMap=p1.isMap;Xj.isNode=p1.isNode;Xj.isPair=p1.isPair;Xj.isScalar=p1.isScalar;Xj.isSeq=p1.isSeq;Xj.Pair=iI.Pair;Xj.Scalar=nI.Scalar;Xj.YAMLMap=rI.YAMLMap;Xj.YAMLSeq=oI.YAMLSeq;Xj.CST=aI;Xj.Lexer=sI.Lexer;Xj.LineCounter=tI.LineCounter;Xj.Parser=eI.Parser;Xj.parse=JX.parse;Xj.parseAllDocuments=JX.parseAllDocuments;Xj.parseDocument=JX.parseDocument;Xj.stringify=JX.stringify;Xj.visit=wG.visit;Xj.visitAsync=wG.visitAsync});var m4=j4(u4(),1),{program:x9,createCommand:$w,createArgument:Ww,createOption:Hw,CommanderError:Uw,InvalidArgumentError:Bw,InvalidOptionArgumentError:zw,Command:Lw,Argument:qw,Option:Fw,Help:Kw}=m4.default;var l4={name:"@pickled-dev/cli",version:"0.2.0",description:"Stay fresh in AI 🥒",module:"dist/index.js",type:"module",bin:{pickled:"./dist/index.js"},files:["dist"],scripts:{dev:"bun run ./src/index.ts",build:"bun build ./src/index.ts --outdir ./dist --target node --minify",release:"semantic-release"},dependencies:{commander:"^14.0.2",chalk:"^5.6.2"},devDependencies:{"@pickled-dev/core":"workspace:*","semantic-release":"^25.0.2","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/exec":"^7.1.0","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2"}};import nj from"node:path";import c4 from"node:path";function u$(X){return X.startsWith("http://")||X.startsWith("https://")}async function m$(X){let Q=new URL("/llms.txt",X).href,J=await fetch(Q);if(!J.ok){if(J=await fetch(X),!J.ok)throw Error(`No llms.txt found at ${X}`)}let Y=await J.text(),G=new URL(X).hostname;return{content:Y,name:`llms.txt from ${G}`,type:"url"}}async function l$(X){let Q=c4.resolve(X),J=Bun.file(Q);if(!await J.exists())throw Error(`File not found: ${Q}`);return{content:await J.text(),name:c4.basename(Q),type:"file"}}async function MX(X){if(X.startsWith("mcp:"))return{content:"",name:X,type:"mcp"};if(u$(X))return m$(X);return l$(X)}function DX(X){return{content:"",name:`codebase at ${X}`,type:"codebase"}}import{join as d4}from"path";import{fileURLToPath as pW}from"url";import{setMaxListeners as dW}from"events";import{spawn as nW}from"child_process";import{createInterface as rW}from"readline";import*as W0 from"fs";import{stat as oW,open as ww}from"fs/promises";import{join as fU}from"path";import{homedir as uU}from"os";import{dirname as jX,join as f5}from"path";import{cwd as mU}from"process";import{realpathSync as lU}from"fs";import{randomUUID as cU}from"crypto";import{randomUUID as WB}from"crypto";import{appendFileSync as HB,existsSync as UB,mkdirSync as BB}from"fs";import{join as e4}from"path";import{randomUUID as FB}from"crypto";var{create:c$,getPrototypeOf:p$,defineProperty:IX,getOwnPropertyNames:d$}=Object,i$=Object.prototype.hasOwnProperty,j5=(X,Q,J)=>{J=X!=null?c$(p$(X)):{};let Y=Q||!X||!X.__esModule?IX(J,"default",{value:X,enumerable:!0}):J;for(let G of d$(X))if(!i$.call(Y,G))IX(Y,G,{get:()=>X[G],enumerable:!0});return Y},i=(X,Q)=>()=>(Q||X((Q={exports:{}}).exports,Q),Q.exports),w5=(X,Q)=>{for(var J in Q)IX(X,J,{get:Q[J],enumerable:!0,configurable:!0,set:(Y)=>Q[J]=()=>Y})};var l8=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.regexpCode=X.getEsmExportName=X.getProperty=X.safeStringify=X.stringify=X.strConcat=X.addCodeArg=X.str=X._=X.nil=X._Code=X.Name=X.IDENTIFIER=X._CodeOrName=void 0;class Q{}X._CodeOrName=Q,X.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class J extends Q{constructor(z){super();if(!X.IDENTIFIER.test(z))throw Error("CodeGen: name must be a valid identifier");this.str=z}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}X.Name=J;class Y extends Q{constructor(z){super();this._items=typeof z==="string"?[z]:z}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let z=this._items[0];return z===""||z==='""'}get str(){var z;return(z=this._str)!==null&&z!==void 0?z:this._str=this._items.reduce((M,F)=>`${M}${F}`,"")}get names(){var z;return(z=this._names)!==null&&z!==void 0?z:this._names=this._items.reduce((M,F)=>{if(F instanceof J)M[F.str]=(M[F.str]||0)+1;return M},{})}}X._Code=Y,X.nil=new Y("");function G(z,...M){let F=[z[0]],L=0;while(L<M.length)H(F,M[L]),F.push(z[++L]);return new Y(F)}X._=G;var $=new Y("+");function W(z,...M){let F=[N(z[0])],L=0;while(L<M.length)F.push($),H(F,M[L]),F.push($,N(z[++L]));return U(F),new Y(F)}X.str=W;function H(z,M){if(M instanceof Y)z.push(...M._items);else if(M instanceof J)z.push(M);else z.push(K(M))}X.addCodeArg=H;function U(z){let M=1;while(M<z.length-1){if(z[M]===$){let F=B(z[M-1],z[M+1]);if(F!==void 0){z.splice(M-1,3,F);continue}z[M++]="+"}M++}}function B(z,M){if(M==='""')return z;if(z==='""')return M;if(typeof z=="string"){if(M instanceof J||z[z.length-1]!=='"')return;if(typeof M!="string")return`${z.slice(0,-1)}${M}"`;if(M[0]==='"')return z.slice(0,-1)+M.slice(1);return}if(typeof M=="string"&&M[0]==='"'&&!(z instanceof J))return`"${z}${M.slice(1)}`;return}function q(z,M){return M.emptyStr()?z:z.emptyStr()?M:W`${z}${M}`}X.strConcat=q;function K(z){return typeof z=="number"||typeof z=="boolean"||z===null?z:N(Array.isArray(z)?z.join(","):z)}function V(z){return new Y(N(z))}X.stringify=V;function N(z){return JSON.stringify(z).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}X.safeStringify=N;function w(z){return typeof z=="string"&&X.IDENTIFIER.test(z)?new Y(`.${z}`):G`[${z}]`}X.getProperty=w;function A(z){if(typeof z=="string"&&X.IDENTIFIER.test(z))return new Y(`${z}`);throw Error(`CodeGen: invalid export name: ${z}, use explicit $id name mapping`)}X.getEsmExportName=A;function Z(z){return new Y(z.toString())}X.regexpCode=Z}),p4=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.ValueScope=X.ValueScopeName=X.Scope=X.varKinds=X.UsedValueState=void 0;var Q=l8();class J extends Error{constructor(U){super(`CodeGen: "code" for ${U} not defined`);this.value=U.value}}var Y;(function(U){U[U.Started=0]="Started",U[U.Completed=1]="Completed"})(Y||(X.UsedValueState=Y={})),X.varKinds={const:new Q.Name("const"),let:new Q.Name("let"),var:new Q.Name("var")};class G{constructor({prefixes:U,parent:B}={}){this._names={},this._prefixes=U,this._parent=B}toName(U){return U instanceof Q.Name?U:this.name(U)}name(U){return new Q.Name(this._newName(U))}_newName(U){let B=this._names[U]||this._nameGroup(U);return`${U}${B.index++}`}_nameGroup(U){var B,q;if(((q=(B=this._parent)===null||B===void 0?void 0:B._prefixes)===null||q===void 0?void 0:q.has(U))||this._prefixes&&!this._prefixes.has(U))throw Error(`CodeGen: prefix "${U}" is not allowed in this scope`);return this._names[U]={prefix:U,index:0}}}X.Scope=G;class $ extends Q.Name{constructor(U,B){super(B);this.prefix=U}setValue(U,{property:B,itemIndex:q}){this.value=U,this.scopePath=Q._`.${new Q.Name(B)}[${q}]`}}X.ValueScopeName=$;var W=Q._`\n`;class H extends G{constructor(U){super(U);this._values={},this._scope=U.scope,this.opts={...U,_n:U.lines?W:Q.nil}}get(){return this._scope}name(U){return new $(U,this._newName(U))}value(U,B){var q;if(B.ref===void 0)throw Error("CodeGen: ref must be passed in value");let K=this.toName(U),{prefix:V}=K,N=(q=B.key)!==null&&q!==void 0?q:B.ref,w=this._values[V];if(w){let z=w.get(N);if(z)return z}else w=this._values[V]=new Map;w.set(N,K);let A=this._scope[V]||(this._scope[V]=[]),Z=A.length;return A[Z]=B.ref,K.setValue(B,{property:V,itemIndex:Z}),K}getValue(U,B){let q=this._values[U];if(!q)return;return q.get(B)}scopeRefs(U,B=this._values){return this._reduceValues(B,(q)=>{if(q.scopePath===void 0)throw Error(`CodeGen: name "${q}" has no value`);return Q._`${U}${q.scopePath}`})}scopeCode(U=this._values,B,q){return this._reduceValues(U,(K)=>{if(K.value===void 0)throw Error(`CodeGen: name "${K}" has no value`);return K.value.code},B,q)}_reduceValues(U,B,q={},K){let V=Q.nil;for(let N in U){let w=U[N];if(!w)continue;let A=q[N]=q[N]||new Map;w.forEach((Z)=>{if(A.has(Z))return;A.set(Z,Y.Started);let z=B(Z);if(z){let M=this.opts.es5?X.varKinds.var:X.varKinds.const;V=Q._`${V}${M} ${Z} = ${z};${this.opts._n}`}else if(z=K===null||K===void 0?void 0:K(Z))V=Q._`${V}${z}${this.opts._n}`;else throw new J(Z);A.set(Z,Y.Completed)})}return V}}X.ValueScope=H}),B0=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.or=X.and=X.not=X.CodeGen=X.operators=X.varKinds=X.ValueScopeName=X.ValueScope=X.Scope=X.Name=X.regexpCode=X.stringify=X.getProperty=X.nil=X.strConcat=X.str=X._=void 0;var Q=l8(),J=p4(),Y=l8();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return Y._}}),Object.defineProperty(X,"str",{enumerable:!0,get:function(){return Y.str}}),Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return Y.strConcat}}),Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return Y.nil}}),Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return Y.getProperty}}),Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return Y.stringify}}),Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return Y.regexpCode}}),Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return Y.Name}});var G=p4();Object.defineProperty(X,"Scope",{enumerable:!0,get:function(){return G.Scope}}),Object.defineProperty(X,"ValueScope",{enumerable:!0,get:function(){return G.ValueScope}}),Object.defineProperty(X,"ValueScopeName",{enumerable:!0,get:function(){return G.ValueScopeName}}),Object.defineProperty(X,"varKinds",{enumerable:!0,get:function(){return G.varKinds}}),X.operators={GT:new Q._Code(">"),GTE:new Q._Code(">="),LT:new Q._Code("<"),LTE:new Q._Code("<="),EQ:new Q._Code("==="),NEQ:new Q._Code("!=="),NOT:new Q._Code("!"),OR:new Q._Code("||"),AND:new Q._Code("&&"),ADD:new Q._Code("+")};class ${optimizeNodes(){return this}optimizeNames(R,T){return this}}class W extends ${constructor(R,T,C){super();this.varKind=R,this.name=T,this.rhs=C}render({es5:R,_n:T}){let C=R?J.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${C} ${this.name}${r};`+T}optimizeNames(R,T){if(!R[this.name.str])return;if(this.rhs)this.rhs=l(this.rhs,R,T);return this}get names(){return this.rhs instanceof Q._CodeOrName?this.rhs.names:{}}}class H extends ${constructor(R,T,C){super();this.lhs=R,this.rhs=T,this.sideEffects=C}render({_n:R}){return`${this.lhs} = ${this.rhs};`+R}optimizeNames(R,T){if(this.lhs instanceof Q.Name&&!R[this.lhs.str]&&!this.sideEffects)return;return this.rhs=l(this.rhs,R,T),this}get names(){let R=this.lhs instanceof Q.Name?{}:{...this.lhs.names};return u(R,this.rhs)}}class U extends H{constructor(R,T,C,r){super(R,C,r);this.op=T}render({_n:R}){return`${this.lhs} ${this.op}= ${this.rhs};`+R}}class B extends ${constructor(R){super();this.label=R,this.names={}}render({_n:R}){return`${this.label}:`+R}}class q extends ${constructor(R){super();this.label=R,this.names={}}render({_n:R}){return`break${this.label?` ${this.label}`:""};`+R}}class K extends ${constructor(R){super();this.error=R}render({_n:R}){return`throw ${this.error};`+R}get names(){return this.error.names}}class V extends ${constructor(R){super();this.code=R}render({_n:R}){return`${this.code};`+R}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(R,T){return this.code=l(this.code,R,T),this}get names(){return this.code instanceof Q._CodeOrName?this.code.names:{}}}class N extends ${constructor(R=[]){super();this.nodes=R}render(R){return this.nodes.reduce((T,C)=>T+C.render(R),"")}optimizeNodes(){let{nodes:R}=this,T=R.length;while(T--){let C=R[T].optimizeNodes();if(Array.isArray(C))R.splice(T,1,...C);else if(C)R[T]=C;else R.splice(T,1)}return R.length>0?this:void 0}optimizeNames(R,T){let{nodes:C}=this,r=C.length;while(r--){let X0=C[r];if(X0.optimizeNames(R,T))continue;Y0(R,X0.names),C.splice(r,1)}return C.length>0?this:void 0}get names(){return this.nodes.reduce((R,T)=>x(R,T.names),{})}}class w extends N{render(R){return"{"+R._n+super.render(R)+"}"+R._n}}class A extends N{}class Z extends w{}Z.kind="else";class z extends w{constructor(R,T){super(T);this.condition=R}render(R){let T=`if(${this.condition})`+super.render(R);if(this.else)T+="else "+this.else.render(R);return T}optimizeNodes(){super.optimizeNodes();let R=this.condition;if(R===!0)return this.nodes;let T=this.else;if(T){let C=T.optimizeNodes();T=this.else=Array.isArray(C)?new Z(C):C}if(T){if(R===!1)return T instanceof z?T:T.nodes;if(this.nodes.length)return this;return new z(O0(R),T instanceof z?[T]:T.nodes)}if(R===!1||!this.nodes.length)return;return this}optimizeNames(R,T){var C;if(this.else=(C=this.else)===null||C===void 0?void 0:C.optimizeNames(R,T),!(super.optimizeNames(R,T)||this.else))return;return this.condition=l(this.condition,R,T),this}get names(){let R=super.names;if(u(R,this.condition),this.else)x(R,this.else.names);return R}}z.kind="if";class M extends w{}M.kind="for";class F extends M{constructor(R){super();this.iteration=R}render(R){return`for(${this.iteration})`+super.render(R)}optimizeNames(R,T){if(!super.optimizeNames(R,T))return;return this.iteration=l(this.iteration,R,T),this}get names(){return x(super.names,this.iteration.names)}}class L extends M{constructor(R,T,C,r){super();this.varKind=R,this.name=T,this.from=C,this.to=r}render(R){let T=R.es5?J.varKinds.var:this.varKind,{name:C,from:r,to:X0}=this;return`for(${T} ${C}=${r}; ${C}<${X0}; ${C}++)`+super.render(R)}get names(){let R=u(super.names,this.from);return u(R,this.to)}}class O extends M{constructor(R,T,C,r){super();this.loop=R,this.varKind=T,this.name=C,this.iterable=r}render(R){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(R)}optimizeNames(R,T){if(!super.optimizeNames(R,T))return;return this.iterable=l(this.iterable,R,T),this}get names(){return x(super.names,this.iterable.names)}}class D extends w{constructor(R,T,C){super();this.name=R,this.args=T,this.async=C}render(R){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(R)}}D.kind="func";class I extends N{render(R){return"return "+super.render(R)}}I.kind="return";class j extends w{render(R){let T="try"+super.render(R);if(this.catch)T+=this.catch.render(R);if(this.finally)T+=this.finally.render(R);return T}optimizeNodes(){var R,T;return super.optimizeNodes(),(R=this.catch)===null||R===void 0||R.optimizeNodes(),(T=this.finally)===null||T===void 0||T.optimizeNodes(),this}optimizeNames(R,T){var C,r;return super.optimizeNames(R,T),(C=this.catch)===null||C===void 0||C.optimizeNames(R,T),(r=this.finally)===null||r===void 0||r.optimizeNames(R,T),this}get names(){let R=super.names;if(this.catch)x(R,this.catch.names);if(this.finally)x(R,this.finally.names);return R}}class E extends w{constructor(R){super();this.error=R}render(R){return`catch(${this.error})`+super.render(R)}}E.kind="catch";class g extends w{render(R){return"finally"+super.render(R)}}g.kind="finally";class k{constructor(R,T={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...T,_n:T.lines?`
167
+ `:""},this._extScope=R,this._scope=new J.Scope({parent:R}),this._nodes=[new A]}toString(){return this._root.render(this.opts)}name(R){return this._scope.name(R)}scopeName(R){return this._extScope.name(R)}scopeValue(R,T){let C=this._extScope.value(R,T);return(this._values[C.prefix]||(this._values[C.prefix]=new Set)).add(C),C}getScopeValue(R,T){return this._extScope.getValue(R,T)}scopeRefs(R){return this._extScope.scopeRefs(R,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(R,T,C,r){let X0=this._scope.toName(T);if(C!==void 0&&r)this._constants[X0.str]=C;return this._leafNode(new W(R,X0,C)),X0}const(R,T,C){return this._def(J.varKinds.const,R,T,C)}let(R,T,C){return this._def(J.varKinds.let,R,T,C)}var(R,T,C){return this._def(J.varKinds.var,R,T,C)}assign(R,T,C){return this._leafNode(new H(R,T,C))}add(R,T){return this._leafNode(new U(R,X.operators.ADD,T))}code(R){if(typeof R=="function")R();else if(R!==Q.nil)this._leafNode(new V(R));return this}object(...R){let T=["{"];for(let[C,r]of R){if(T.length>1)T.push(",");if(T.push(C),C!==r||this.opts.es5)T.push(":"),(0,Q.addCodeArg)(T,r)}return T.push("}"),new Q._Code(T)}if(R,T,C){if(this._blockNode(new z(R)),T&&C)this.code(T).else().code(C).endIf();else if(T)this.code(T).endIf();else if(C)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(R){return this._elseNode(new z(R))}else(){return this._elseNode(new Z)}endIf(){return this._endBlockNode(z,Z)}_for(R,T){if(this._blockNode(R),T)this.code(T).endFor();return this}for(R,T){return this._for(new F(R),T)}forRange(R,T,C,r,X0=this.opts.es5?J.varKinds.var:J.varKinds.let){let U0=this._scope.toName(R);return this._for(new L(X0,U0,T,C),()=>r(U0))}forOf(R,T,C,r=J.varKinds.const){let X0=this._scope.toName(R);if(this.opts.es5){let U0=T instanceof Q.Name?T:this.var("_arr",T);return this.forRange("_i",0,Q._`${U0}.length`,(Q0)=>{this.var(X0,Q._`${U0}[${Q0}]`),C(X0)})}return this._for(new O("of",r,X0,T),()=>C(X0))}forIn(R,T,C,r=this.opts.es5?J.varKinds.var:J.varKinds.const){if(this.opts.ownProperties)return this.forOf(R,Q._`Object.keys(${T})`,C);let X0=this._scope.toName(R);return this._for(new O("in",r,X0,T),()=>C(X0))}endFor(){return this._endBlockNode(M)}label(R){return this._leafNode(new B(R))}break(R){return this._leafNode(new q(R))}return(R){let T=new I;if(this._blockNode(T),this.code(R),T.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(I)}try(R,T,C){if(!T&&!C)throw Error('CodeGen: "try" without "catch" and "finally"');let r=new j;if(this._blockNode(r),this.code(R),T){let X0=this.name("e");this._currNode=r.catch=new E(X0),T(X0)}if(C)this._currNode=r.finally=new g,this.code(C);return this._endBlockNode(E,g)}throw(R){return this._leafNode(new K(R))}block(R,T){if(this._blockStarts.push(this._nodes.length),R)this.code(R).endBlock(T);return this}endBlock(R){let T=this._blockStarts.pop();if(T===void 0)throw Error("CodeGen: not in self-balancing block");let C=this._nodes.length-T;if(C<0||R!==void 0&&C!==R)throw Error(`CodeGen: wrong number of nodes: ${C} vs ${R} expected`);return this._nodes.length=T,this}func(R,T=Q.nil,C,r){if(this._blockNode(new D(R,T,C)),r)this.code(r).endFunc();return this}endFunc(){return this._endBlockNode(D)}optimize(R=1){while(R-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(R){return this._currNode.nodes.push(R),this}_blockNode(R){this._currNode.nodes.push(R),this._nodes.push(R)}_endBlockNode(R,T){let C=this._currNode;if(C instanceof R||T&&C instanceof T)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${T?`${R.kind}/${T.kind}`:R.kind}"`)}_elseNode(R){let T=this._currNode;if(!(T instanceof z))throw Error('CodeGen: "else" without "if"');return this._currNode=T.else=R,this}get _root(){return this._nodes[0]}get _currNode(){let R=this._nodes;return R[R.length-1]}set _currNode(R){let T=this._nodes;T[T.length-1]=R}}X.CodeGen=k;function x(R,T){for(let C in T)R[C]=(R[C]||0)+(T[C]||0);return R}function u(R,T){return T instanceof Q._CodeOrName?x(R,T.names):R}function l(R,T,C){if(R instanceof Q.Name)return r(R);if(!X0(R))return R;return new Q._Code(R._items.reduce((U0,Q0)=>{if(Q0 instanceof Q.Name)Q0=r(Q0);if(Q0 instanceof Q._Code)U0.push(...Q0._items);else U0.push(Q0);return U0},[]));function r(U0){let Q0=C[U0.str];if(Q0===void 0||T[U0.str]!==1)return U0;return delete T[U0.str],Q0}function X0(U0){return U0 instanceof Q._Code&&U0._items.some((Q0)=>Q0 instanceof Q.Name&&T[Q0.str]===1&&C[Q0.str]!==void 0)}}function Y0(R,T){for(let C in T)R[C]=(R[C]||0)-(T[C]||0)}function O0(R){return typeof R=="boolean"||typeof R=="number"||R===null?!R:Q._`!${f(R)}`}X.not=O0;var _0=b(X.operators.AND);function h0(...R){return R.reduce(_0)}X.and=h0;var q0=b(X.operators.OR);function S(...R){return R.reduce(q0)}X.or=S;function b(R){return(T,C)=>T===Q.nil?C:C===Q.nil?T:Q._`${f(T)} ${R} ${f(C)}`}function f(R){return R instanceof Q.Name?R:Q._`(${R})`}}),D0=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.checkStrictMode=X.getErrorPath=X.Type=X.useFunc=X.setEvaluated=X.evaluatedPropsToName=X.mergeEvaluated=X.eachItem=X.unescapeJsonPointer=X.escapeJsonPointer=X.escapeFragment=X.unescapeFragment=X.schemaRefOrVal=X.schemaHasRulesButRef=X.schemaHasRules=X.checkUnknownRules=X.alwaysValidSchema=X.toHash=void 0;var Q=B0(),J=l8();function Y(D){let I={};for(let j of D)I[j]=!0;return I}X.toHash=Y;function G(D,I){if(typeof I=="boolean")return I;if(Object.keys(I).length===0)return!0;return $(D,I),!W(I,D.self.RULES.all)}X.alwaysValidSchema=G;function $(D,I=D.schema){let{opts:j,self:E}=D;if(!j.strictSchema)return;if(typeof I==="boolean")return;let g=E.RULES.keywords;for(let k in I)if(!g[k])O(D,`unknown keyword: "${k}"`)}X.checkUnknownRules=$;function W(D,I){if(typeof D=="boolean")return!D;for(let j in D)if(I[j])return!0;return!1}X.schemaHasRules=W;function H(D,I){if(typeof D=="boolean")return!D;for(let j in D)if(j!=="$ref"&&I.all[j])return!0;return!1}X.schemaHasRulesButRef=H;function U({topSchemaRef:D,schemaPath:I},j,E,g){if(!g){if(typeof j=="number"||typeof j=="boolean")return j;if(typeof j=="string")return Q._`${j}`}return Q._`${D}${I}${(0,Q.getProperty)(E)}`}X.schemaRefOrVal=U;function B(D){return V(decodeURIComponent(D))}X.unescapeFragment=B;function q(D){return encodeURIComponent(K(D))}X.escapeFragment=q;function K(D){if(typeof D=="number")return`${D}`;return D.replace(/~/g,"~0").replace(/\//g,"~1")}X.escapeJsonPointer=K;function V(D){return D.replace(/~1/g,"/").replace(/~0/g,"~")}X.unescapeJsonPointer=V;function N(D,I){if(Array.isArray(D))for(let j of D)I(j);else I(D)}X.eachItem=N;function w({mergeNames:D,mergeToName:I,mergeValues:j,resultToName:E}){return(g,k,x,u)=>{let l=x===void 0?k:x instanceof Q.Name?(k instanceof Q.Name?D(g,k,x):I(g,k,x),x):k instanceof Q.Name?(I(g,x,k),k):j(k,x);return u===Q.Name&&!(l instanceof Q.Name)?E(g,l):l}}X.mergeEvaluated={props:w({mergeNames:(D,I,j)=>D.if(Q._`${j} !== true && ${I} !== undefined`,()=>{D.if(Q._`${I} === true`,()=>D.assign(j,!0),()=>D.assign(j,Q._`${j} || {}`).code(Q._`Object.assign(${j}, ${I})`))}),mergeToName:(D,I,j)=>D.if(Q._`${j} !== true`,()=>{if(I===!0)D.assign(j,!0);else D.assign(j,Q._`${j} || {}`),Z(D,j,I)}),mergeValues:(D,I)=>D===!0?!0:{...D,...I},resultToName:A}),items:w({mergeNames:(D,I,j)=>D.if(Q._`${j} !== true && ${I} !== undefined`,()=>D.assign(j,Q._`${I} === true ? true : ${j} > ${I} ? ${j} : ${I}`)),mergeToName:(D,I,j)=>D.if(Q._`${j} !== true`,()=>D.assign(j,I===!0?!0:Q._`${j} > ${I} ? ${j} : ${I}`)),mergeValues:(D,I)=>D===!0?!0:Math.max(D,I),resultToName:(D,I)=>D.var("items",I)})};function A(D,I){if(I===!0)return D.var("props",!0);let j=D.var("props",Q._`{}`);if(I!==void 0)Z(D,j,I);return j}X.evaluatedPropsToName=A;function Z(D,I,j){Object.keys(j).forEach((E)=>D.assign(Q._`${I}${(0,Q.getProperty)(E)}`,!0))}X.setEvaluated=Z;var z={};function M(D,I){return D.scopeValue("func",{ref:I,code:z[I.code]||(z[I.code]=new J._Code(I.code))})}X.useFunc=M;var F;(function(D){D[D.Num=0]="Num",D[D.Str=1]="Str"})(F||(X.Type=F={}));function L(D,I,j){if(D instanceof Q.Name){let E=I===F.Num;return j?E?Q._`"[" + ${D} + "]"`:Q._`"['" + ${D} + "']"`:E?Q._`"/" + ${D}`:Q._`"/" + ${D}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return j?(0,Q.getProperty)(D).toString():"/"+K(D)}X.getErrorPath=L;function O(D,I,j=D.opts.strictSchema){if(!j)return;if(I=`strict mode: ${I}`,j===!0)throw Error(I);D.self.logger.warn(I)}X.checkStrictMode=O}),v1=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=B0(),J={data:new Q.Name("data"),valCxt:new Q.Name("valCxt"),instancePath:new Q.Name("instancePath"),parentData:new Q.Name("parentData"),parentDataProperty:new Q.Name("parentDataProperty"),rootData:new Q.Name("rootData"),dynamicAnchors:new Q.Name("dynamicAnchors"),vErrors:new Q.Name("vErrors"),errors:new Q.Name("errors"),this:new Q.Name("this"),self:new Q.Name("self"),scope:new Q.Name("scope"),json:new Q.Name("json"),jsonPos:new Q.Name("jsonPos"),jsonLen:new Q.Name("jsonLen"),jsonPart:new Q.Name("jsonPart")};X.default=J}),Q6=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.extendErrors=X.resetErrorsCount=X.reportExtraError=X.reportError=X.keyword$DataError=X.keywordError=void 0;var Q=B0(),J=D0(),Y=v1();X.keywordError={message:({keyword:Z})=>Q.str`must pass "${Z}" keyword validation`},X.keyword$DataError={message:({keyword:Z,schemaType:z})=>z?Q.str`"${Z}" keyword must be ${z} ($data)`:Q.str`"${Z}" keyword is invalid ($data)`};function G(Z,z=X.keywordError,M,F){let{it:L}=Z,{gen:O,compositeRule:D,allErrors:I}=L,j=K(Z,z,M);if(F!==null&&F!==void 0?F:D||I)U(O,j);else B(L,Q._`[${j}]`)}X.reportError=G;function $(Z,z=X.keywordError,M){let{it:F}=Z,{gen:L,compositeRule:O,allErrors:D}=F,I=K(Z,z,M);if(U(L,I),!(O||D))B(F,Y.default.vErrors)}X.reportExtraError=$;function W(Z,z){Z.assign(Y.default.errors,z),Z.if(Q._`${Y.default.vErrors} !== null`,()=>Z.if(z,()=>Z.assign(Q._`${Y.default.vErrors}.length`,z),()=>Z.assign(Y.default.vErrors,null)))}X.resetErrorsCount=W;function H({gen:Z,keyword:z,schemaValue:M,data:F,errsCount:L,it:O}){if(L===void 0)throw Error("ajv implementation error");let D=Z.name("err");Z.forRange("i",L,Y.default.errors,(I)=>{if(Z.const(D,Q._`${Y.default.vErrors}[${I}]`),Z.if(Q._`${D}.instancePath === undefined`,()=>Z.assign(Q._`${D}.instancePath`,(0,Q.strConcat)(Y.default.instancePath,O.errorPath))),Z.assign(Q._`${D}.schemaPath`,Q.str`${O.errSchemaPath}/${z}`),O.opts.verbose)Z.assign(Q._`${D}.schema`,M),Z.assign(Q._`${D}.data`,F)})}X.extendErrors=H;function U(Z,z){let M=Z.const("err",z);Z.if(Q._`${Y.default.vErrors} === null`,()=>Z.assign(Y.default.vErrors,Q._`[${M}]`),Q._`${Y.default.vErrors}.push(${M})`),Z.code(Q._`${Y.default.errors}++`)}function B(Z,z){let{gen:M,validateName:F,schemaEnv:L}=Z;if(L.$async)M.throw(Q._`new ${Z.ValidationError}(${z})`);else M.assign(Q._`${F}.errors`,z),M.return(!1)}var q={keyword:new Q.Name("keyword"),schemaPath:new Q.Name("schemaPath"),params:new Q.Name("params"),propertyName:new Q.Name("propertyName"),message:new Q.Name("message"),schema:new Q.Name("schema"),parentSchema:new Q.Name("parentSchema")};function K(Z,z,M){let{createErrors:F}=Z.it;if(F===!1)return Q._`{}`;return V(Z,z,M)}function V(Z,z,M={}){let{gen:F,it:L}=Z,O=[N(L,M),w(Z,M)];return A(Z,z,O),F.object(...O)}function N({errorPath:Z},{instancePath:z}){let M=z?Q.str`${Z}${(0,J.getErrorPath)(z,J.Type.Str)}`:Z;return[Y.default.instancePath,(0,Q.strConcat)(Y.default.instancePath,M)]}function w({keyword:Z,it:{errSchemaPath:z}},{schemaPath:M,parentSchema:F}){let L=F?z:Q.str`${z}/${Z}`;if(M)L=Q.str`${L}${(0,J.getErrorPath)(M,J.Type.Str)}`;return[q.schemaPath,L]}function A(Z,{params:z,message:M},F){let{keyword:L,data:O,schemaValue:D,it:I}=Z,{opts:j,propertyName:E,topSchemaRef:g,schemaPath:k}=I;if(F.push([q.keyword,L],[q.params,typeof z=="function"?z(Z):z||Q._`{}`]),j.messages)F.push([q.message,typeof M=="function"?M(Z):M]);if(j.verbose)F.push([q.schema,D],[q.parentSchema,Q._`${g}${k}`],[Y.default.data,O]);if(E)F.push([q.propertyName,E])}}),n$=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.boolOrEmptySchema=X.topBoolOrEmptySchema=void 0;var Q=Q6(),J=B0(),Y=v1(),G={message:"boolean schema is false"};function $(U){let{gen:B,schema:q,validateName:K}=U;if(q===!1)H(U,!1);else if(typeof q=="object"&&q.$async===!0)B.return(Y.default.data);else B.assign(J._`${K}.errors`,null),B.return(!0)}X.topBoolOrEmptySchema=$;function W(U,B){let{gen:q,schema:K}=U;if(K===!1)q.var(B,!1),H(U);else q.var(B,!0)}X.boolOrEmptySchema=W;function H(U,B){let{gen:q,data:K}=U,V={gen:q,keyword:"false schema",data:K,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:U};(0,Q.reportError)(V,G,void 0,B)}}),P5=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.getRules=X.isJSONType=void 0;var Q=["string","number","integer","boolean","null","object","array"],J=new Set(Q);function Y($){return typeof $=="string"&&J.has($)}X.isJSONType=Y;function G(){let $={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...$,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},$.number,$.string,$.array,$.object],post:{rules:[]},all:{},keywords:{}}}X.getRules=G}),T5=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.shouldUseRule=X.shouldUseGroup=X.schemaHasRulesForType=void 0;function Q({schema:G,self:$},W){let H=$.RULES.types[W];return H&&H!==!0&&J(G,H)}X.schemaHasRulesForType=Q;function J(G,$){return $.rules.some((W)=>Y(G,W))}X.shouldUseGroup=J;function Y(G,$){var W;return G[$.keyword]!==void 0||((W=$.definition.implements)===null||W===void 0?void 0:W.some((H)=>G[H]!==void 0))}X.shouldUseRule=Y}),c8=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.reportTypeError=X.checkDataTypes=X.checkDataType=X.coerceAndCheckDataType=X.getJSONTypes=X.getSchemaTypes=X.DataType=void 0;var Q=P5(),J=T5(),Y=Q6(),G=B0(),$=D0(),W;(function(F){F[F.Correct=0]="Correct",F[F.Wrong=1]="Wrong"})(W||(X.DataType=W={}));function H(F){let L=U(F.type);if(L.includes("null")){if(F.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!L.length&&F.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(F.nullable===!0)L.push("null")}return L}X.getSchemaTypes=H;function U(F){let L=Array.isArray(F)?F:F?[F]:[];if(L.every(Q.isJSONType))return L;throw Error("type must be JSONType or JSONType[]: "+L.join(","))}X.getJSONTypes=U;function B(F,L){let{gen:O,data:D,opts:I}=F,j=K(L,I.coerceTypes),E=L.length>0&&!(j.length===0&&L.length===1&&(0,J.schemaHasRulesForType)(F,L[0]));if(E){let g=A(L,D,I.strictNumbers,W.Wrong);O.if(g,()=>{if(j.length)V(F,L,j);else z(F)})}return E}X.coerceAndCheckDataType=B;var q=new Set(["string","number","integer","boolean","null"]);function K(F,L){return L?F.filter((O)=>q.has(O)||L==="array"&&O==="array"):[]}function V(F,L,O){let{gen:D,data:I,opts:j}=F,E=D.let("dataType",G._`typeof ${I}`),g=D.let("coerced",G._`undefined`);if(j.coerceTypes==="array")D.if(G._`${E} == 'object' && Array.isArray(${I}) && ${I}.length == 1`,()=>D.assign(I,G._`${I}[0]`).assign(E,G._`typeof ${I}`).if(A(L,I,j.strictNumbers),()=>D.assign(g,I)));D.if(G._`${g} !== undefined`);for(let x of O)if(q.has(x)||x==="array"&&j.coerceTypes==="array")k(x);D.else(),z(F),D.endIf(),D.if(G._`${g} !== undefined`,()=>{D.assign(I,g),N(F,g)});function k(x){switch(x){case"string":D.elseIf(G._`${E} == "number" || ${E} == "boolean"`).assign(g,G._`"" + ${I}`).elseIf(G._`${I} === null`).assign(g,G._`""`);return;case"number":D.elseIf(G._`${E} == "boolean" || ${I} === null
168
+ || (${E} == "string" && ${I} && ${I} == +${I})`).assign(g,G._`+${I}`);return;case"integer":D.elseIf(G._`${E} === "boolean" || ${I} === null
169
+ || (${E} === "string" && ${I} && ${I} == +${I} && !(${I} % 1))`).assign(g,G._`+${I}`);return;case"boolean":D.elseIf(G._`${I} === "false" || ${I} === 0 || ${I} === null`).assign(g,!1).elseIf(G._`${I} === "true" || ${I} === 1`).assign(g,!0);return;case"null":D.elseIf(G._`${I} === "" || ${I} === 0 || ${I} === false`),D.assign(g,null);return;case"array":D.elseIf(G._`${E} === "string" || ${E} === "number"
170
+ || ${E} === "boolean" || ${I} === null`).assign(g,G._`[${I}]`)}}}function N({gen:F,parentData:L,parentDataProperty:O},D){F.if(G._`${L} !== undefined`,()=>F.assign(G._`${L}[${O}]`,D))}function w(F,L,O,D=W.Correct){let I=D===W.Correct?G.operators.EQ:G.operators.NEQ,j;switch(F){case"null":return G._`${L} ${I} null`;case"array":j=G._`Array.isArray(${L})`;break;case"object":j=G._`${L} && typeof ${L} == "object" && !Array.isArray(${L})`;break;case"integer":j=E(G._`!(${L} % 1) && !isNaN(${L})`);break;case"number":j=E();break;default:return G._`typeof ${L} ${I} ${F}`}return D===W.Correct?j:(0,G.not)(j);function E(g=G.nil){return(0,G.and)(G._`typeof ${L} == "number"`,g,O?G._`isFinite(${L})`:G.nil)}}X.checkDataType=w;function A(F,L,O,D){if(F.length===1)return w(F[0],L,O,D);let I,j=(0,$.toHash)(F);if(j.array&&j.object){let E=G._`typeof ${L} != "object"`;I=j.null?E:G._`!${L} || ${E}`,delete j.null,delete j.array,delete j.object}else I=G.nil;if(j.number)delete j.integer;for(let E in j)I=(0,G.and)(I,w(E,L,O,D));return I}X.checkDataTypes=A;var Z={message:({schema:F})=>`must be ${F}`,params:({schema:F,schemaValue:L})=>typeof F=="string"?G._`{type: ${F}}`:G._`{type: ${L}}`};function z(F){let L=M(F);(0,Y.reportError)(L,Z)}X.reportTypeError=z;function M(F){let{gen:L,data:O,schema:D}=F,I=(0,$.schemaRefOrVal)(F,D,"type");return{gen:L,keyword:"type",data:O,schema:D.type,schemaCode:I,schemaValue:I,parentSchema:D,params:{},it:F}}}),r$=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.assignDefaults=void 0;var Q=B0(),J=D0();function Y($,W){let{properties:H,items:U}=$.schema;if(W==="object"&&H)for(let B in H)G($,B,H[B].default);else if(W==="array"&&Array.isArray(U))U.forEach((B,q)=>G($,q,B.default))}X.assignDefaults=Y;function G($,W,H){let{gen:U,compositeRule:B,data:q,opts:K}=$;if(H===void 0)return;let V=Q._`${q}${(0,Q.getProperty)(W)}`;if(B){(0,J.checkStrictMode)($,`default is ignored for: ${V}`);return}let N=Q._`${V} === undefined`;if(K.useDefaults==="empty")N=Q._`${N} || ${V} === null || ${V} === ""`;U.if(N,Q._`${V} = ${(0,Q.stringify)(H)}`)}}),H1=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.validateUnion=X.validateArray=X.usePattern=X.callValidateCode=X.schemaProperties=X.allSchemaProperties=X.noPropertyInData=X.propertyInData=X.isOwnProperty=X.hasPropFunc=X.reportMissingProp=X.checkMissingProp=X.checkReportMissingProp=void 0;var Q=B0(),J=D0(),Y=v1(),G=D0();function $(F,L){let{gen:O,data:D,it:I}=F;O.if(K(O,D,L,I.opts.ownProperties),()=>{F.setParams({missingProperty:Q._`${L}`},!0),F.error()})}X.checkReportMissingProp=$;function W({gen:F,data:L,it:{opts:O}},D,I){return(0,Q.or)(...D.map((j)=>(0,Q.and)(K(F,L,j,O.ownProperties),Q._`${I} = ${j}`)))}X.checkMissingProp=W;function H(F,L){F.setParams({missingProperty:L},!0),F.error()}X.reportMissingProp=H;function U(F){return F.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Q._`Object.prototype.hasOwnProperty`})}X.hasPropFunc=U;function B(F,L,O){return Q._`${U(F)}.call(${L}, ${O})`}X.isOwnProperty=B;function q(F,L,O,D){let I=Q._`${L}${(0,Q.getProperty)(O)} !== undefined`;return D?Q._`${I} && ${B(F,L,O)}`:I}X.propertyInData=q;function K(F,L,O,D){let I=Q._`${L}${(0,Q.getProperty)(O)} === undefined`;return D?(0,Q.or)(I,(0,Q.not)(B(F,L,O))):I}X.noPropertyInData=K;function V(F){return F?Object.keys(F).filter((L)=>L!=="__proto__"):[]}X.allSchemaProperties=V;function N(F,L){return V(L).filter((O)=>!(0,J.alwaysValidSchema)(F,L[O]))}X.schemaProperties=N;function w({schemaCode:F,data:L,it:{gen:O,topSchemaRef:D,schemaPath:I,errorPath:j},it:E},g,k,x){let u=x?Q._`${F}, ${L}, ${D}${I}`:L,l=[[Y.default.instancePath,(0,Q.strConcat)(Y.default.instancePath,j)],[Y.default.parentData,E.parentData],[Y.default.parentDataProperty,E.parentDataProperty],[Y.default.rootData,Y.default.rootData]];if(E.opts.dynamicRef)l.push([Y.default.dynamicAnchors,Y.default.dynamicAnchors]);let Y0=Q._`${u}, ${O.object(...l)}`;return k!==Q.nil?Q._`${g}.call(${k}, ${Y0})`:Q._`${g}(${Y0})`}X.callValidateCode=w;var A=Q._`new RegExp`;function Z({gen:F,it:{opts:L}},O){let D=L.unicodeRegExp?"u":"",{regExp:I}=L.code,j=I(O,D);return F.scopeValue("pattern",{key:j.toString(),ref:j,code:Q._`${I.code==="new RegExp"?A:(0,G.useFunc)(F,I)}(${O}, ${D})`})}X.usePattern=Z;function z(F){let{gen:L,data:O,keyword:D,it:I}=F,j=L.name("valid");if(I.allErrors){let g=L.let("valid",!0);return E(()=>L.assign(g,!1)),g}return L.var(j,!0),E(()=>L.break()),j;function E(g){let k=L.const("len",Q._`${O}.length`);L.forRange("i",0,k,(x)=>{F.subschema({keyword:D,dataProp:x,dataPropType:J.Type.Num},j),L.if((0,Q.not)(j),g)})}}X.validateArray=z;function M(F){let{gen:L,schema:O,keyword:D,it:I}=F;if(!Array.isArray(O))throw Error("ajv implementation error");if(O.some((k)=>(0,J.alwaysValidSchema)(I,k))&&!I.opts.unevaluated)return;let E=L.let("valid",!1),g=L.name("_valid");L.block(()=>O.forEach((k,x)=>{let u=F.subschema({keyword:D,schemaProp:x,compositeRule:!0},g);if(L.assign(E,Q._`${E} || ${g}`),!F.mergeValidEvaluated(u,g))L.if((0,Q.not)(E))})),F.result(E,()=>F.reset(),()=>F.error(!0))}X.validateUnion=M}),o$=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.validateKeywordUsage=X.validSchemaType=X.funcKeywordCode=X.macroKeywordCode=void 0;var Q=B0(),J=v1(),Y=H1(),G=Q6();function $(N,w){let{gen:A,keyword:Z,schema:z,parentSchema:M,it:F}=N,L=w.macro.call(F.self,z,M,F),O=q(A,Z,L);if(F.opts.validateSchema!==!1)F.self.validateSchema(L,!0);let D=A.name("valid");N.subschema({schema:L,schemaPath:Q.nil,errSchemaPath:`${F.errSchemaPath}/${Z}`,topSchemaRef:O,compositeRule:!0},D),N.pass(D,()=>N.error(!0))}X.macroKeywordCode=$;function W(N,w){var A;let{gen:Z,keyword:z,schema:M,parentSchema:F,$data:L,it:O}=N;B(O,w);let D=!L&&w.compile?w.compile.call(O.self,M,F,O):w.validate,I=q(Z,z,D),j=Z.let("valid");N.block$data(j,E),N.ok((A=w.valid)!==null&&A!==void 0?A:j);function E(){if(w.errors===!1){if(x(),w.modifying)H(N);u(()=>N.error())}else{let l=w.async?g():k();if(w.modifying)H(N);u(()=>U(N,l))}}function g(){let l=Z.let("ruleErrs",null);return Z.try(()=>x(Q._`await `),(Y0)=>Z.assign(j,!1).if(Q._`${Y0} instanceof ${O.ValidationError}`,()=>Z.assign(l,Q._`${Y0}.errors`),()=>Z.throw(Y0))),l}function k(){let l=Q._`${I}.errors`;return Z.assign(l,null),x(Q.nil),l}function x(l=w.async?Q._`await `:Q.nil){let Y0=O.opts.passContext?J.default.this:J.default.self,O0=!(("compile"in w)&&!L||w.schema===!1);Z.assign(j,Q._`${l}${(0,Y.callValidateCode)(N,I,Y0,O0)}`,w.modifying)}function u(l){var Y0;Z.if((0,Q.not)((Y0=w.valid)!==null&&Y0!==void 0?Y0:j),l)}}X.funcKeywordCode=W;function H(N){let{gen:w,data:A,it:Z}=N;w.if(Z.parentData,()=>w.assign(A,Q._`${Z.parentData}[${Z.parentDataProperty}]`))}function U(N,w){let{gen:A}=N;A.if(Q._`Array.isArray(${w})`,()=>{A.assign(J.default.vErrors,Q._`${J.default.vErrors} === null ? ${w} : ${J.default.vErrors}.concat(${w})`).assign(J.default.errors,Q._`${J.default.vErrors}.length`),(0,G.extendErrors)(N)},()=>N.error())}function B({schemaEnv:N},w){if(w.async&&!N.$async)throw Error("async keyword in sync schema")}function q(N,w,A){if(A===void 0)throw Error(`keyword "${w}" failed to compile`);return N.scopeValue("keyword",typeof A=="function"?{ref:A}:{ref:A,code:(0,Q.stringify)(A)})}function K(N,w,A=!1){return!w.length||w.some((Z)=>Z==="array"?Array.isArray(N):Z==="object"?N&&typeof N=="object"&&!Array.isArray(N):typeof N==Z||A&&typeof N>"u")}X.validSchemaType=K;function V({schema:N,opts:w,self:A,errSchemaPath:Z},z,M){if(Array.isArray(z.keyword)?!z.keyword.includes(M):z.keyword!==M)throw Error("ajv implementation error");let F=z.dependencies;if(F===null||F===void 0?void 0:F.some((L)=>!Object.prototype.hasOwnProperty.call(N,L)))throw Error(`parent schema must have dependencies of ${M}: ${F.join(",")}`);if(z.validateSchema){if(!z.validateSchema(N[M])){let O=`keyword "${M}" value is invalid at path "${Z}": `+A.errorsText(z.validateSchema.errors);if(w.validateSchema==="log")A.logger.error(O);else throw Error(O)}}}X.validateKeywordUsage=V}),a$=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.extendSubschemaMode=X.extendSubschemaData=X.getSubschema=void 0;var Q=B0(),J=D0();function Y(W,{keyword:H,schemaProp:U,schema:B,schemaPath:q,errSchemaPath:K,topSchemaRef:V}){if(H!==void 0&&B!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(H!==void 0){let N=W.schema[H];return U===void 0?{schema:N,schemaPath:Q._`${W.schemaPath}${(0,Q.getProperty)(H)}`,errSchemaPath:`${W.errSchemaPath}/${H}`}:{schema:N[U],schemaPath:Q._`${W.schemaPath}${(0,Q.getProperty)(H)}${(0,Q.getProperty)(U)}`,errSchemaPath:`${W.errSchemaPath}/${H}/${(0,J.escapeFragment)(U)}`}}if(B!==void 0){if(q===void 0||K===void 0||V===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:B,schemaPath:q,topSchemaRef:V,errSchemaPath:K}}throw Error('either "keyword" or "schema" must be passed')}X.getSubschema=Y;function G(W,H,{dataProp:U,dataPropType:B,data:q,dataTypes:K,propertyName:V}){if(q!==void 0&&U!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:N}=H;if(U!==void 0){let{errorPath:A,dataPathArr:Z,opts:z}=H,M=N.let("data",Q._`${H.data}${(0,Q.getProperty)(U)}`,!0);w(M),W.errorPath=Q.str`${A}${(0,J.getErrorPath)(U,B,z.jsPropertySyntax)}`,W.parentDataProperty=Q._`${U}`,W.dataPathArr=[...Z,W.parentDataProperty]}if(q!==void 0){let A=q instanceof Q.Name?q:N.let("data",q,!0);if(w(A),V!==void 0)W.propertyName=V}if(K)W.dataTypes=K;function w(A){W.data=A,W.dataLevel=H.dataLevel+1,W.dataTypes=[],H.definedProperties=new Set,W.parentData=H.data,W.dataNames=[...H.dataNames,A]}}X.extendSubschemaData=G;function $(W,{jtdDiscriminator:H,jtdMetadata:U,compositeRule:B,createErrors:q,allErrors:K}){if(B!==void 0)W.compositeRule=B;if(q!==void 0)W.createErrors=q;if(K!==void 0)W.allErrors=K;W.jtdDiscriminator=H,W.jtdMetadata=U}X.extendSubschemaMode=$}),S5=i((X,Q)=>{Q.exports=function J(Y,G){if(Y===G)return!0;if(Y&&G&&typeof Y=="object"&&typeof G=="object"){if(Y.constructor!==G.constructor)return!1;var $,W,H;if(Array.isArray(Y)){if($=Y.length,$!=G.length)return!1;for(W=$;W--!==0;)if(!J(Y[W],G[W]))return!1;return!0}if(Y.constructor===RegExp)return Y.source===G.source&&Y.flags===G.flags;if(Y.valueOf!==Object.prototype.valueOf)return Y.valueOf()===G.valueOf();if(Y.toString!==Object.prototype.toString)return Y.toString()===G.toString();if(H=Object.keys(Y),$=H.length,$!==Object.keys(G).length)return!1;for(W=$;W--!==0;)if(!Object.prototype.hasOwnProperty.call(G,H[W]))return!1;for(W=$;W--!==0;){var U=H[W];if(!J(Y[U],G[U]))return!1}return!0}return Y!==Y&&G!==G}}),s$=i((X,Q)=>{var J=Q.exports=function($,W,H){if(typeof W=="function")H=W,W={};H=W.cb||H;var U=typeof H=="function"?H:H.pre||function(){},B=H.post||function(){};Y(W,U,B,$,"",$)};J.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},J.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},J.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},J.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Y($,W,H,U,B,q,K,V,N,w){if(U&&typeof U=="object"&&!Array.isArray(U)){W(U,B,q,K,V,N,w);for(var A in U){var Z=U[A];if(Array.isArray(Z)){if(A in J.arrayKeywords)for(var z=0;z<Z.length;z++)Y($,W,H,Z[z],B+"/"+A+"/"+z,q,B,A,U,z)}else if(A in J.propsKeywords){if(Z&&typeof Z=="object")for(var M in Z)Y($,W,H,Z[M],B+"/"+A+"/"+G(M),q,B,A,U,M)}else if(A in J.keywords||$.allKeys&&!(A in J.skipKeywords))Y($,W,H,Z,B+"/"+A,q,B,A,U)}H(U,B,q,K,V,N,w)}}function G($){return $.replace(/~/g,"~0").replace(/\//g,"~1")}}),J6=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.getSchemaRefs=X.resolveUrl=X.normalizeId=X._getFullPath=X.getFullPath=X.inlineRef=void 0;var Q=D0(),J=S5(),Y=s$(),G=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function $(Z,z=!0){if(typeof Z=="boolean")return!0;if(z===!0)return!H(Z);if(!z)return!1;return U(Z)<=z}X.inlineRef=$;var W=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function H(Z){for(let z in Z){if(W.has(z))return!0;let M=Z[z];if(Array.isArray(M)&&M.some(H))return!0;if(typeof M=="object"&&H(M))return!0}return!1}function U(Z){let z=0;for(let M in Z){if(M==="$ref")return 1/0;if(z++,G.has(M))continue;if(typeof Z[M]=="object")(0,Q.eachItem)(Z[M],(F)=>z+=U(F));if(z===1/0)return 1/0}return z}function B(Z,z="",M){if(M!==!1)z=V(z);let F=Z.parse(z);return q(Z,F)}X.getFullPath=B;function q(Z,z){return Z.serialize(z).split("#")[0]+"#"}X._getFullPath=q;var K=/#\/?$/;function V(Z){return Z?Z.replace(K,""):""}X.normalizeId=V;function N(Z,z,M){return M=V(M),Z.resolve(z,M)}X.resolveUrl=N;var w=/^[a-z_][-a-z0-9._]*$/i;function A(Z,z){if(typeof Z=="boolean")return{};let{schemaId:M,uriResolver:F}=this.opts,L=V(Z[M]||z),O={"":L},D=B(F,L,!1),I={},j=new Set;return Y(Z,{allKeys:!0},(k,x,u,l)=>{if(l===void 0)return;let Y0=D+x,O0=O[l];if(typeof k[M]=="string")O0=_0.call(this,k[M]);h0.call(this,k.$anchor),h0.call(this,k.$dynamicAnchor),O[x]=O0;function _0(q0){let S=this.opts.uriResolver.resolve;if(q0=V(O0?S(O0,q0):q0),j.has(q0))throw g(q0);j.add(q0);let b=this.refs[q0];if(typeof b=="string")b=this.refs[b];if(typeof b=="object")E(k,b.schema,q0);else if(q0!==V(Y0))if(q0[0]==="#")E(k,I[q0],q0),I[q0]=k;else this.refs[q0]=Y0;return q0}function h0(q0){if(typeof q0=="string"){if(!w.test(q0))throw Error(`invalid anchor "${q0}"`);_0.call(this,`#${q0}`)}}}),I;function E(k,x,u){if(x!==void 0&&!J(k,x))throw g(u)}function g(k){return Error(`reference "${k}" resolves to more than one schema`)}}X.getSchemaRefs=A}),Y6=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.getData=X.KeywordCxt=X.validateFunctionCode=void 0;var Q=n$(),J=c8(),Y=T5(),G=c8(),$=r$(),W=o$(),H=a$(),U=B0(),B=v1(),q=J6(),K=D0(),V=Q6();function N(P){if(D(P)){if(j(P),O(P)){z(P);return}}w(P,()=>(0,Q.topBoolOrEmptySchema)(P))}X.validateFunctionCode=N;function w({gen:P,validateName:_,schema:h,schemaEnv:a,opts:e},z0){if(e.code.es5)P.func(_,U._`${B.default.data}, ${B.default.valCxt}`,a.$async,()=>{P.code(U._`"use strict"; ${F(h,e)}`),Z(P,e),P.code(z0)});else P.func(_,U._`${B.default.data}, ${A(e)}`,a.$async,()=>P.code(F(h,e)).code(z0))}function A(P){return U._`{${B.default.instancePath}="", ${B.default.parentData}, ${B.default.parentDataProperty}, ${B.default.rootData}=${B.default.data}${P.dynamicRef?U._`, ${B.default.dynamicAnchors}={}`:U.nil}}={}`}function Z(P,_){P.if(B.default.valCxt,()=>{if(P.var(B.default.instancePath,U._`${B.default.valCxt}.${B.default.instancePath}`),P.var(B.default.parentData,U._`${B.default.valCxt}.${B.default.parentData}`),P.var(B.default.parentDataProperty,U._`${B.default.valCxt}.${B.default.parentDataProperty}`),P.var(B.default.rootData,U._`${B.default.valCxt}.${B.default.rootData}`),_.dynamicRef)P.var(B.default.dynamicAnchors,U._`${B.default.valCxt}.${B.default.dynamicAnchors}`)},()=>{if(P.var(B.default.instancePath,U._`""`),P.var(B.default.parentData,U._`undefined`),P.var(B.default.parentDataProperty,U._`undefined`),P.var(B.default.rootData,B.default.data),_.dynamicRef)P.var(B.default.dynamicAnchors,U._`{}`)})}function z(P){let{schema:_,opts:h,gen:a}=P;w(P,()=>{if(h.$comment&&_.$comment)l(P);if(k(P),a.let(B.default.vErrors,null),a.let(B.default.errors,0),h.unevaluated)M(P);E(P),Y0(P)});return}function M(P){let{gen:_,validateName:h}=P;P.evaluated=_.const("evaluated",U._`${h}.evaluated`),_.if(U._`${P.evaluated}.dynamicProps`,()=>_.assign(U._`${P.evaluated}.props`,U._`undefined`)),_.if(U._`${P.evaluated}.dynamicItems`,()=>_.assign(U._`${P.evaluated}.items`,U._`undefined`))}function F(P,_){let h=typeof P=="object"&&P[_.schemaId];return h&&(_.code.source||_.code.process)?U._`/*# sourceURL=${h} */`:U.nil}function L(P,_){if(D(P)){if(j(P),O(P)){I(P,_);return}}(0,Q.boolOrEmptySchema)(P,_)}function O({schema:P,self:_}){if(typeof P=="boolean")return!P;for(let h in P)if(_.RULES.all[h])return!0;return!1}function D(P){return typeof P.schema!="boolean"}function I(P,_){let{schema:h,gen:a,opts:e}=P;if(e.$comment&&h.$comment)l(P);x(P),u(P);let z0=a.const("_errs",B.default.errors);E(P,z0),a.var(_,U._`${z0} === ${B.default.errors}`)}function j(P){(0,K.checkUnknownRules)(P),g(P)}function E(P,_){if(P.opts.jtd)return _0(P,[],!1,_);let h=(0,J.getSchemaTypes)(P.schema),a=(0,J.coerceAndCheckDataType)(P,h);_0(P,h,!a,_)}function g(P){let{schema:_,errSchemaPath:h,opts:a,self:e}=P;if(_.$ref&&a.ignoreKeywordsWithRef&&(0,K.schemaHasRulesButRef)(_,e.RULES))e.logger.warn(`$ref: keywords ignored in schema at path "${h}"`)}function k(P){let{schema:_,opts:h}=P;if(_.default!==void 0&&h.useDefaults&&h.strictSchema)(0,K.checkStrictMode)(P,"default is ignored in the schema root")}function x(P){let _=P.schema[P.opts.schemaId];if(_)P.baseId=(0,q.resolveUrl)(P.opts.uriResolver,P.baseId,_)}function u(P){if(P.schema.$async&&!P.schemaEnv.$async)throw Error("async schema in sync schema")}function l({gen:P,schemaEnv:_,schema:h,errSchemaPath:a,opts:e}){let z0=h.$comment;if(e.$comment===!0)P.code(U._`${B.default.self}.logger.log(${z0})`);else if(typeof e.$comment=="function"){let p0=U.str`${a}/$comment`,s0=P.scopeValue("root",{ref:_.root});P.code(U._`${B.default.self}.opts.$comment(${z0}, ${p0}, ${s0}.schema)`)}}function Y0(P){let{gen:_,schemaEnv:h,validateName:a,ValidationError:e,opts:z0}=P;if(h.$async)_.if(U._`${B.default.errors} === 0`,()=>_.return(B.default.data),()=>_.throw(U._`new ${e}(${B.default.vErrors})`));else{if(_.assign(U._`${a}.errors`,B.default.vErrors),z0.unevaluated)O0(P);_.return(U._`${B.default.errors} === 0`)}}function O0({gen:P,evaluated:_,props:h,items:a}){if(h instanceof U.Name)P.assign(U._`${_}.props`,h);if(a instanceof U.Name)P.assign(U._`${_}.items`,a)}function _0(P,_,h,a){let{gen:e,schema:z0,data:p0,allErrors:s0,opts:L1,self:i0}=P,{RULES:f0}=i0;if(z0.$ref&&(L1.ignoreKeywordsWithRef||!(0,K.schemaHasRulesButRef)(z0,f0))){e.block(()=>U0(P,"$ref",f0.all.$ref.definition));return}if(!L1.jtd)q0(P,_);e.block(()=>{for(let t0 of f0.rules)Y9(t0);Y9(f0.post)});function Y9(t0){if(!(0,Y.shouldUseGroup)(z0,t0))return;if(t0.type){if(e.if((0,G.checkDataType)(t0.type,p0,L1.strictNumbers)),h0(P,t0),_.length===1&&_[0]===t0.type&&h)e.else(),(0,G.reportTypeError)(P);e.endIf()}else h0(P,t0);if(!s0)e.if(U._`${B.default.errors} === ${a||0}`)}}function h0(P,_){let{gen:h,schema:a,opts:{useDefaults:e}}=P;if(e)(0,$.assignDefaults)(P,_.type);h.block(()=>{for(let z0 of _.rules)if((0,Y.shouldUseRule)(a,z0))U0(P,z0.keyword,z0.definition,_.type)})}function q0(P,_){if(P.schemaEnv.meta||!P.opts.strictTypes)return;if(S(P,_),!P.opts.allowUnionTypes)b(P,_);f(P,P.dataTypes)}function S(P,_){if(!_.length)return;if(!P.dataTypes.length){P.dataTypes=_;return}_.forEach((h)=>{if(!T(P.dataTypes,h))r(P,`type "${h}" not allowed by context "${P.dataTypes.join(",")}"`)}),C(P,_)}function b(P,_){if(_.length>1&&!(_.length===2&&_.includes("null")))r(P,"use allowUnionTypes to allow union type keyword")}function f(P,_){let h=P.self.RULES.all;for(let a in h){let e=h[a];if(typeof e=="object"&&(0,Y.shouldUseRule)(P.schema,e)){let{type:z0}=e.definition;if(z0.length&&!z0.some((p0)=>R(_,p0)))r(P,`missing type "${z0.join(",")}" for keyword "${a}"`)}}}function R(P,_){return P.includes(_)||_==="number"&&P.includes("integer")}function T(P,_){return P.includes(_)||_==="integer"&&P.includes("number")}function C(P,_){let h=[];for(let a of P.dataTypes)if(T(_,a))h.push(a);else if(_.includes("integer")&&a==="number")h.push("integer");P.dataTypes=h}function r(P,_){let h=P.schemaEnv.baseId+P.errSchemaPath;_+=` at "${h}" (strictTypes)`,(0,K.checkStrictMode)(P,_,P.opts.strictTypes)}class X0{constructor(P,_,h){if((0,W.validateKeywordUsage)(P,_,h),this.gen=P.gen,this.allErrors=P.allErrors,this.keyword=h,this.data=P.data,this.schema=P.schema[h],this.$data=_.$data&&P.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,K.schemaRefOrVal)(P,this.schema,h,this.$data),this.schemaType=_.schemaType,this.parentSchema=P.schema,this.params={},this.it=P,this.def=_,this.$data)this.schemaCode=P.gen.const("vSchema",G1(this.$data,P));else if(this.schemaCode=this.schemaValue,!(0,W.validSchemaType)(this.schema,_.schemaType,_.allowUndefined))throw Error(`${h} value must be ${JSON.stringify(_.schemaType)}`);if("code"in _?_.trackErrors:_.errors!==!1)this.errsCount=P.gen.const("_errs",B.default.errors)}result(P,_,h){this.failResult((0,U.not)(P),_,h)}failResult(P,_,h){if(this.gen.if(P),h)h();else this.error();if(_){if(this.gen.else(),_(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(P,_){this.failResult((0,U.not)(P),void 0,_)}fail(P){if(P===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(P),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(P){if(!this.$data)return this.fail(P);let{schemaCode:_}=this;this.fail(U._`${_} !== undefined && (${(0,U.or)(this.invalid$data(),P)})`)}error(P,_,h){if(_){this.setParams(_),this._error(P,h),this.setParams({});return}this._error(P,h)}_error(P,_){(P?V.reportExtraError:V.reportError)(this,this.def.error,_)}$dataError(){(0,V.reportError)(this,this.def.$dataError||V.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,V.resetErrorsCount)(this.gen,this.errsCount)}ok(P){if(!this.allErrors)this.gen.if(P)}setParams(P,_){if(_)Object.assign(this.params,P);else this.params=P}block$data(P,_,h=U.nil){this.gen.block(()=>{this.check$data(P,h),_()})}check$data(P=U.nil,_=U.nil){if(!this.$data)return;let{gen:h,schemaCode:a,schemaType:e,def:z0}=this;if(h.if((0,U.or)(U._`${a} === undefined`,_)),P!==U.nil)h.assign(P,!0);if(e.length||z0.validateSchema){if(h.elseIf(this.invalid$data()),this.$dataError(),P!==U.nil)h.assign(P,!1)}h.else()}invalid$data(){let{gen:P,schemaCode:_,schemaType:h,def:a,it:e}=this;return(0,U.or)(z0(),p0());function z0(){if(h.length){if(!(_ instanceof U.Name))throw Error("ajv implementation error");let s0=Array.isArray(h)?h:[h];return U._`${(0,G.checkDataTypes)(s0,_,e.opts.strictNumbers,G.DataType.Wrong)}`}return U.nil}function p0(){if(a.validateSchema){let s0=P.scopeValue("validate$data",{ref:a.validateSchema});return U._`!${s0}(${_})`}return U.nil}}subschema(P,_){let h=(0,H.getSubschema)(this.it,P);(0,H.extendSubschemaData)(h,this.it,P),(0,H.extendSubschemaMode)(h,P);let a={...this.it,...h,items:void 0,props:void 0};return L(a,_),a}mergeEvaluated(P,_){let{it:h,gen:a}=this;if(!h.opts.unevaluated)return;if(h.props!==!0&&P.props!==void 0)h.props=K.mergeEvaluated.props(a,P.props,h.props,_);if(h.items!==!0&&P.items!==void 0)h.items=K.mergeEvaluated.items(a,P.items,h.items,_)}mergeValidEvaluated(P,_){let{it:h,gen:a}=this;if(h.opts.unevaluated&&(h.props!==!0||h.items!==!0))return a.if(_,()=>this.mergeEvaluated(P,U.Name)),!0}}X.KeywordCxt=X0;function U0(P,_,h,a){let e=new X0(P,h,_);if("code"in h)h.code(e,a);else if(e.$data&&h.validate)(0,W.funcKeywordCode)(e,h);else if("macro"in h)(0,W.macroKeywordCode)(e,h);else if(h.compile||h.validate)(0,W.funcKeywordCode)(e,h)}var Q0=/^\/(?:[^~]|~0|~1)*$/,S0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function G1(P,{dataLevel:_,dataNames:h,dataPathArr:a}){let e,z0;if(P==="")return B.default.rootData;if(P[0]==="/"){if(!Q0.test(P))throw Error(`Invalid JSON-pointer: ${P}`);e=P,z0=B.default.rootData}else{let i0=S0.exec(P);if(!i0)throw Error(`Invalid JSON-pointer: ${P}`);let f0=+i0[1];if(e=i0[2],e==="#"){if(f0>=_)throw Error(L1("property/index",f0));return a[_-f0]}if(f0>_)throw Error(L1("data",f0));if(z0=h[_-f0],!e)return z0}let p0=z0,s0=e.split("/");for(let i0 of s0)if(i0)z0=U._`${z0}${(0,U.getProperty)((0,K.unescapeJsonPointer)(i0))}`,p0=U._`${p0} && ${z0}`;return p0;function L1(i0,f0){return`Cannot access ${i0} ${f0} levels up, current level is ${_}`}}X.getData=G1}),kX=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});class Q extends Error{constructor(J){super("validation failed");this.errors=J,this.ajv=this.validation=!0}}X.default=Q}),G6=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=J6();class J extends Error{constructor(Y,G,$,W){super(W||`can't resolve reference ${$} from id ${G}`);this.missingRef=(0,Q.resolveUrl)(Y,G,$),this.missingSchema=(0,Q.normalizeId)((0,Q.getFullPath)(Y,this.missingRef))}}X.default=J}),vX=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.resolveSchema=X.getCompilingSchema=X.resolveRef=X.compileSchema=X.SchemaEnv=void 0;var Q=B0(),J=kX(),Y=v1(),G=J6(),$=D0(),W=Y6();class H{constructor(z){var M;this.refs={},this.dynamicAnchors={};let F;if(typeof z.schema=="object")F=z.schema;this.schema=z.schema,this.schemaId=z.schemaId,this.root=z.root||this,this.baseId=(M=z.baseId)!==null&&M!==void 0?M:(0,G.normalizeId)(F===null||F===void 0?void 0:F[z.schemaId||"$id"]),this.schemaPath=z.schemaPath,this.localRefs=z.localRefs,this.meta=z.meta,this.$async=F===null||F===void 0?void 0:F.$async,this.refs={}}}X.SchemaEnv=H;function U(z){let M=K.call(this,z);if(M)return M;let F=(0,G.getFullPath)(this.opts.uriResolver,z.root.baseId),{es5:L,lines:O}=this.opts.code,{ownProperties:D}=this.opts,I=new Q.CodeGen(this.scope,{es5:L,lines:O,ownProperties:D}),j;if(z.$async)j=I.scopeValue("Error",{ref:J.default,code:Q._`require("ajv/dist/runtime/validation_error").default`});let E=I.scopeName("validate");z.validateName=E;let g={gen:I,allErrors:this.opts.allErrors,data:Y.default.data,parentData:Y.default.parentData,parentDataProperty:Y.default.parentDataProperty,dataNames:[Y.default.data],dataPathArr:[Q.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:I.scopeValue("schema",this.opts.code.source===!0?{ref:z.schema,code:(0,Q.stringify)(z.schema)}:{ref:z.schema}),validateName:E,ValidationError:j,schema:z.schema,schemaEnv:z,rootId:F,baseId:z.baseId||F,schemaPath:Q.nil,errSchemaPath:z.schemaPath||(this.opts.jtd?"":"#"),errorPath:Q._`""`,opts:this.opts,self:this},k;try{this._compilations.add(z),(0,W.validateFunctionCode)(g),I.optimize(this.opts.code.optimize);let x=I.toString();if(k=`${I.scopeRefs(Y.default.scope)}return ${x}`,this.opts.code.process)k=this.opts.code.process(k,z);let l=Function(`${Y.default.self}`,`${Y.default.scope}`,k)(this,this.scope.get());if(this.scope.value(E,{ref:l}),l.errors=null,l.schema=z.schema,l.schemaEnv=z,z.$async)l.$async=!0;if(this.opts.code.source===!0)l.source={validateName:E,validateCode:x,scopeValues:I._values};if(this.opts.unevaluated){let{props:Y0,items:O0}=g;if(l.evaluated={props:Y0 instanceof Q.Name?void 0:Y0,items:O0 instanceof Q.Name?void 0:O0,dynamicProps:Y0 instanceof Q.Name,dynamicItems:O0 instanceof Q.Name},l.source)l.source.evaluated=(0,Q.stringify)(l.evaluated)}return z.validate=l,z}catch(x){if(delete z.validate,delete z.validateName,k)this.logger.error("Error compiling schema, function code:",k);throw x}finally{this._compilations.delete(z)}}X.compileSchema=U;function B(z,M,F){var L;F=(0,G.resolveUrl)(this.opts.uriResolver,M,F);let O=z.refs[F];if(O)return O;let D=N.call(this,z,F);if(D===void 0){let I=(L=z.localRefs)===null||L===void 0?void 0:L[F],{schemaId:j}=this.opts;if(I)D=new H({schema:I,schemaId:j,root:z,baseId:M})}if(D===void 0)return;return z.refs[F]=q.call(this,D)}X.resolveRef=B;function q(z){if((0,G.inlineRef)(z.schema,this.opts.inlineRefs))return z.schema;return z.validate?z:U.call(this,z)}function K(z){for(let M of this._compilations)if(V(M,z))return M}X.getCompilingSchema=K;function V(z,M){return z.schema===M.schema&&z.root===M.root&&z.baseId===M.baseId}function N(z,M){let F;while(typeof(F=this.refs[M])=="string")M=F;return F||this.schemas[M]||w.call(this,z,M)}function w(z,M){let F=this.opts.uriResolver.parse(M),L=(0,G._getFullPath)(this.opts.uriResolver,F),O=(0,G.getFullPath)(this.opts.uriResolver,z.baseId,void 0);if(Object.keys(z.schema).length>0&&L===O)return Z.call(this,F,z);let D=(0,G.normalizeId)(L),I=this.refs[D]||this.schemas[D];if(typeof I=="string"){let j=w.call(this,z,I);if(typeof(j===null||j===void 0?void 0:j.schema)!=="object")return;return Z.call(this,F,j)}if(typeof(I===null||I===void 0?void 0:I.schema)!=="object")return;if(!I.validate)U.call(this,I);if(D===(0,G.normalizeId)(M)){let{schema:j}=I,{schemaId:E}=this.opts,g=j[E];if(g)O=(0,G.resolveUrl)(this.opts.uriResolver,O,g);return new H({schema:j,schemaId:E,root:z,baseId:O})}return Z.call(this,F,I)}X.resolveSchema=w;var A=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Z(z,{baseId:M,schema:F,root:L}){var O;if(((O=z.fragment)===null||O===void 0?void 0:O[0])!=="/")return;for(let j of z.fragment.slice(1).split("/")){if(typeof F==="boolean")return;let E=F[(0,$.unescapeFragment)(j)];if(E===void 0)return;F=E;let g=typeof F==="object"&&F[this.opts.schemaId];if(!A.has(j)&&g)M=(0,G.resolveUrl)(this.opts.uriResolver,M,g)}let D;if(typeof F!="boolean"&&F.$ref&&!(0,$.schemaHasRulesButRef)(F,this.RULES)){let j=(0,G.resolveUrl)(this.opts.uriResolver,M,F.$ref);D=w.call(this,L,j)}let{schemaId:I}=this.opts;if(D=D||new H({schema:F,schemaId:I,root:L,baseId:M}),D.schema!==D.root.schema)return D;return}}),t$=i((X,Q)=>{Q.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),e$=i((X,Q)=>{var J={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Q.exports={HEX:J}}),XW=i((X,Q)=>{var{HEX:J}=e$(),Y=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function G(z){if(B(z,".")<3)return{host:z,isIPV4:!1};let M=z.match(Y)||[],[F]=M;if(F)return{host:U(F,"."),isIPV4:!0};else return{host:z,isIPV4:!1}}function $(z,M=!1){let F="",L=!0;for(let O of z){if(J[O]===void 0)return;if(O!=="0"&&L===!0)L=!1;if(!L)F+=O}if(M&&F.length===0)F="0";return F}function W(z){let M=0,F={error:!1,address:"",zone:""},L=[],O=[],D=!1,I=!1,j=!1;function E(){if(O.length){if(D===!1){let g=$(O);if(g!==void 0)L.push(g);else return F.error=!0,!1}O.length=0}return!0}for(let g=0;g<z.length;g++){let k=z[g];if(k==="["||k==="]")continue;if(k===":"){if(I===!0)j=!0;if(!E())break;if(M++,L.push(":"),M>7){F.error=!0;break}if(g-1>=0&&z[g-1]===":")I=!0;continue}else if(k==="%"){if(!E())break;D=!0}else{O.push(k);continue}}if(O.length)if(D)F.zone=O.join("");else if(j)L.push(O.join(""));else L.push($(O));return F.address=L.join(""),F}function H(z){if(B(z,":")<2)return{host:z,isIPV6:!1};let M=W(z);if(!M.error){let{address:F,address:L}=M;if(M.zone)F+="%"+M.zone,L+="%25"+M.zone;return{host:F,escapedHost:L,isIPV6:!0}}else return{host:z,isIPV6:!1}}function U(z,M){let F="",L=!0,O=z.length;for(let D=0;D<O;D++){let I=z[D];if(I==="0"&&L){if(D+1<=O&&z[D+1]===M||D+1===O)F+=I,L=!1}else{if(I===M)L=!0;else L=!1;F+=I}}return F}function B(z,M){let F=0;for(let L=0;L<z.length;L++)if(z[L]===M)F++;return F}var q=/^\.\.?\//u,K=/^\/\.(?:\/|$)/u,V=/^\/\.\.(?:\/|$)/u,N=/^\/?(?:.|\n)*?(?=\/|$)/u;function w(z){let M=[];while(z.length)if(z.match(q))z=z.replace(q,"");else if(z.match(K))z=z.replace(K,"/");else if(z.match(V))z=z.replace(V,"/"),M.pop();else if(z==="."||z==="..")z="";else{let F=z.match(N);if(F){let L=F[0];z=z.slice(L.length),M.push(L)}else throw Error("Unexpected dot segment condition")}return M.join("")}function A(z,M){let F=M!==!0?escape:unescape;if(z.scheme!==void 0)z.scheme=F(z.scheme);if(z.userinfo!==void 0)z.userinfo=F(z.userinfo);if(z.host!==void 0)z.host=F(z.host);if(z.path!==void 0)z.path=F(z.path);if(z.query!==void 0)z.query=F(z.query);if(z.fragment!==void 0)z.fragment=F(z.fragment);return z}function Z(z){let M=[];if(z.userinfo!==void 0)M.push(z.userinfo),M.push("@");if(z.host!==void 0){let F=unescape(z.host),L=G(F);if(L.isIPV4)F=L.host;else{let O=H(L.host);if(O.isIPV6===!0)F=`[${O.escapedHost}]`;else F=z.host}M.push(F)}if(typeof z.port==="number"||typeof z.port==="string")M.push(":"),M.push(String(z.port));return M.length?M.join(""):void 0}Q.exports={recomposeAuthority:Z,normalizeComponentEncoding:A,removeDotSegments:w,normalizeIPv4:G,normalizeIPv6:H,stringArrayToHexStripped:$}}),QW=i((X,Q)=>{var J=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,Y=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function G(L){return typeof L.secure==="boolean"?L.secure:String(L.scheme).toLowerCase()==="wss"}function $(L){if(!L.host)L.error=L.error||"HTTP URIs must have a host.";return L}function W(L){let O=String(L.scheme).toLowerCase()==="https";if(L.port===(O?443:80)||L.port==="")L.port=void 0;if(!L.path)L.path="/";return L}function H(L){return L.secure=G(L),L.resourceName=(L.path||"/")+(L.query?"?"+L.query:""),L.path=void 0,L.query=void 0,L}function U(L){if(L.port===(G(L)?443:80)||L.port==="")L.port=void 0;if(typeof L.secure==="boolean")L.scheme=L.secure?"wss":"ws",L.secure=void 0;if(L.resourceName){let[O,D]=L.resourceName.split("?");L.path=O&&O!=="/"?O:void 0,L.query=D,L.resourceName=void 0}return L.fragment=void 0,L}function B(L,O){if(!L.path)return L.error="URN can not be parsed",L;let D=L.path.match(Y);if(D){let I=O.scheme||L.scheme||"urn";L.nid=D[1].toLowerCase(),L.nss=D[2];let j=`${I}:${O.nid||L.nid}`,E=F[j];if(L.path=void 0,E)L=E.parse(L,O)}else L.error=L.error||"URN can not be parsed.";return L}function q(L,O){let D=O.scheme||L.scheme||"urn",I=L.nid.toLowerCase(),j=`${D}:${O.nid||I}`,E=F[j];if(E)L=E.serialize(L,O);let g=L,k=L.nss;return g.path=`${I||O.nid}:${k}`,O.skipEscape=!0,g}function K(L,O){let D=L;if(D.uuid=D.nss,D.nss=void 0,!O.tolerant&&(!D.uuid||!J.test(D.uuid)))D.error=D.error||"UUID is not valid.";return D}function V(L){let O=L;return O.nss=(L.uuid||"").toLowerCase(),O}var N={scheme:"http",domainHost:!0,parse:$,serialize:W},w={scheme:"https",domainHost:N.domainHost,parse:$,serialize:W},A={scheme:"ws",domainHost:!0,parse:H,serialize:U},Z={scheme:"wss",domainHost:A.domainHost,parse:A.parse,serialize:A.serialize},z={scheme:"urn",parse:B,serialize:q,skipNormalize:!0},M={scheme:"urn:uuid",parse:K,serialize:V,skipNormalize:!0},F={http:N,https:w,ws:A,wss:Z,urn:z,"urn:uuid":M};Q.exports=F}),JW=i((X,Q)=>{var{normalizeIPv6:J,normalizeIPv4:Y,removeDotSegments:G,recomposeAuthority:$,normalizeComponentEncoding:W}=XW(),H=QW();function U(M,F){if(typeof M==="string")M=V(Z(M,F),F);else if(typeof M==="object")M=Z(V(M,F),F);return M}function B(M,F,L){let O=Object.assign({scheme:"null"},L),D=q(Z(M,O),Z(F,O),O,!0);return V(D,{...O,skipEscape:!0})}function q(M,F,L,O){let D={};if(!O)M=Z(V(M,L),L),F=Z(V(F,L),L);if(L=L||{},!L.tolerant&&F.scheme)D.scheme=F.scheme,D.userinfo=F.userinfo,D.host=F.host,D.port=F.port,D.path=G(F.path||""),D.query=F.query;else{if(F.userinfo!==void 0||F.host!==void 0||F.port!==void 0)D.userinfo=F.userinfo,D.host=F.host,D.port=F.port,D.path=G(F.path||""),D.query=F.query;else{if(!F.path)if(D.path=M.path,F.query!==void 0)D.query=F.query;else D.query=M.query;else{if(F.path.charAt(0)==="/")D.path=G(F.path);else{if((M.userinfo!==void 0||M.host!==void 0||M.port!==void 0)&&!M.path)D.path="/"+F.path;else if(!M.path)D.path=F.path;else D.path=M.path.slice(0,M.path.lastIndexOf("/")+1)+F.path;D.path=G(D.path)}D.query=F.query}D.userinfo=M.userinfo,D.host=M.host,D.port=M.port}D.scheme=M.scheme}return D.fragment=F.fragment,D}function K(M,F,L){if(typeof M==="string")M=unescape(M),M=V(W(Z(M,L),!0),{...L,skipEscape:!0});else if(typeof M==="object")M=V(W(M,!0),{...L,skipEscape:!0});if(typeof F==="string")F=unescape(F),F=V(W(Z(F,L),!0),{...L,skipEscape:!0});else if(typeof F==="object")F=V(W(F,!0),{...L,skipEscape:!0});return M.toLowerCase()===F.toLowerCase()}function V(M,F){let L={host:M.host,scheme:M.scheme,userinfo:M.userinfo,port:M.port,path:M.path,query:M.query,nid:M.nid,nss:M.nss,uuid:M.uuid,fragment:M.fragment,reference:M.reference,resourceName:M.resourceName,secure:M.secure,error:""},O=Object.assign({},F),D=[],I=H[(O.scheme||L.scheme||"").toLowerCase()];if(I&&I.serialize)I.serialize(L,O);if(L.path!==void 0)if(!O.skipEscape){if(L.path=escape(L.path),L.scheme!==void 0)L.path=L.path.split("%3A").join(":")}else L.path=unescape(L.path);if(O.reference!=="suffix"&&L.scheme)D.push(L.scheme,":");let j=$(L);if(j!==void 0){if(O.reference!=="suffix")D.push("//");if(D.push(j),L.path&&L.path.charAt(0)!=="/")D.push("/")}if(L.path!==void 0){let E=L.path;if(!O.absolutePath&&(!I||!I.absolutePath))E=G(E);if(j===void 0)E=E.replace(/^\/\//u,"/%2F");D.push(E)}if(L.query!==void 0)D.push("?",L.query);if(L.fragment!==void 0)D.push("#",L.fragment);return D.join("")}var N=Array.from({length:127},(M,F)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(F)));function w(M){let F=0;for(let L=0,O=M.length;L<O;++L)if(F=M.charCodeAt(L),F>126||N[F])return!0;return!1}var A=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Z(M,F){let L=Object.assign({},F),O={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},D=M.indexOf("%")!==-1,I=!1;if(L.reference==="suffix")M=(L.scheme?L.scheme+":":"")+"//"+M;let j=M.match(A);if(j){if(O.scheme=j[1],O.userinfo=j[3],O.host=j[4],O.port=parseInt(j[5],10),O.path=j[6]||"",O.query=j[7],O.fragment=j[8],isNaN(O.port))O.port=j[5];if(O.host){let g=Y(O.host);if(g.isIPV4===!1){let k=J(g.host);O.host=k.host.toLowerCase(),I=k.isIPV6}else O.host=g.host,I=!0}if(O.scheme===void 0&&O.userinfo===void 0&&O.host===void 0&&O.port===void 0&&O.query===void 0&&!O.path)O.reference="same-document";else if(O.scheme===void 0)O.reference="relative";else if(O.fragment===void 0)O.reference="absolute";else O.reference="uri";if(L.reference&&L.reference!=="suffix"&&L.reference!==O.reference)O.error=O.error||"URI is not a "+L.reference+" reference.";let E=H[(L.scheme||O.scheme||"").toLowerCase()];if(!L.unicodeSupport&&(!E||!E.unicodeSupport)){if(O.host&&(L.domainHost||E&&E.domainHost)&&I===!1&&w(O.host))try{O.host=URL.domainToASCII(O.host.toLowerCase())}catch(g){O.error=O.error||"Host's domain name can not be converted to ASCII: "+g}}if(!E||E&&!E.skipNormalize){if(D&&O.scheme!==void 0)O.scheme=unescape(O.scheme);if(D&&O.host!==void 0)O.host=unescape(O.host);if(O.path)O.path=escape(unescape(O.path));if(O.fragment)O.fragment=encodeURI(decodeURIComponent(O.fragment))}if(E&&E.parse)E.parse(O,L)}else O.error=O.error||"URI can not be parsed.";return O}var z={SCHEMES:H,normalize:U,resolve:B,resolveComponents:q,equal:K,serialize:V,parse:Z};Q.exports=z,Q.exports.default=z,Q.exports.fastUri=z}),YW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=JW();Q.code='require("ajv/dist/runtime/uri").default',X.default=Q}),GW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.CodeGen=X.Name=X.nil=X.stringify=X.str=X._=X.KeywordCxt=void 0;var Q=Y6();Object.defineProperty(X,"KeywordCxt",{enumerable:!0,get:function(){return Q.KeywordCxt}});var J=B0();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return J._}}),Object.defineProperty(X,"str",{enumerable:!0,get:function(){return J.str}}),Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return J.stringify}}),Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return J.nil}}),Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return J.Name}}),Object.defineProperty(X,"CodeGen",{enumerable:!0,get:function(){return J.CodeGen}});var Y=kX(),G=G6(),$=P5(),W=vX(),H=B0(),U=J6(),B=c8(),q=D0(),K=t$(),V=YW(),N=(S,b)=>new RegExp(S,b);N.code="new RegExp";var w=["removeAdditional","useDefaults","coerceTypes"],A=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Z={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},z={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},M=200;function F(S){var b,f,R,T,C,r,X0,U0,Q0,S0,G1,P,_,h,a,e,z0,p0,s0,L1,i0,f0,Y9,t0,WX;let v9=S.strict,HX=(b=S.code)===null||b===void 0?void 0:b.optimize,N4=HX===!0||HX===void 0?1:HX||0,R4=(R=(f=S.code)===null||f===void 0?void 0:f.regExp)!==null&&R!==void 0?R:N,cG=(T=S.uriResolver)!==null&&T!==void 0?T:V.default;return{strictSchema:(r=(C=S.strictSchema)!==null&&C!==void 0?C:v9)!==null&&r!==void 0?r:!0,strictNumbers:(U0=(X0=S.strictNumbers)!==null&&X0!==void 0?X0:v9)!==null&&U0!==void 0?U0:!0,strictTypes:(S0=(Q0=S.strictTypes)!==null&&Q0!==void 0?Q0:v9)!==null&&S0!==void 0?S0:"log",strictTuples:(P=(G1=S.strictTuples)!==null&&G1!==void 0?G1:v9)!==null&&P!==void 0?P:"log",strictRequired:(h=(_=S.strictRequired)!==null&&_!==void 0?_:v9)!==null&&h!==void 0?h:!1,code:S.code?{...S.code,optimize:N4,regExp:R4}:{optimize:N4,regExp:R4},loopRequired:(a=S.loopRequired)!==null&&a!==void 0?a:M,loopEnum:(e=S.loopEnum)!==null&&e!==void 0?e:M,meta:(z0=S.meta)!==null&&z0!==void 0?z0:!0,messages:(p0=S.messages)!==null&&p0!==void 0?p0:!0,inlineRefs:(s0=S.inlineRefs)!==null&&s0!==void 0?s0:!0,schemaId:(L1=S.schemaId)!==null&&L1!==void 0?L1:"$id",addUsedSchema:(i0=S.addUsedSchema)!==null&&i0!==void 0?i0:!0,validateSchema:(f0=S.validateSchema)!==null&&f0!==void 0?f0:!0,validateFormats:(Y9=S.validateFormats)!==null&&Y9!==void 0?Y9:!0,unicodeRegExp:(t0=S.unicodeRegExp)!==null&&t0!==void 0?t0:!0,int32range:(WX=S.int32range)!==null&&WX!==void 0?WX:!0,uriResolver:cG}}class L{constructor(S={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,S=this.opts={...S,...F(S)};let{es5:b,lines:f}=this.opts.code;this.scope=new H.ValueScope({scope:{},prefixes:A,es5:b,lines:f}),this.logger=x(S.logger);let R=S.validateFormats;if(S.validateFormats=!1,this.RULES=(0,$.getRules)(),O.call(this,Z,S,"NOT SUPPORTED"),O.call(this,z,S,"DEPRECATED","warn"),this._metaOpts=g.call(this),S.formats)j.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),S.keywords)E.call(this,S.keywords);if(typeof S.meta=="object")this.addMetaSchema(S.meta);I.call(this),S.validateFormats=R}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:S,meta:b,schemaId:f}=this.opts,R=K;if(f==="id")R={...K},R.id=R.$id,delete R.$id;if(b&&S)this.addMetaSchema(R,R[f],!1)}defaultMeta(){let{meta:S,schemaId:b}=this.opts;return this.opts.defaultMeta=typeof S=="object"?S[b]||S:void 0}validate(S,b){let f;if(typeof S=="string"){if(f=this.getSchema(S),!f)throw Error(`no schema with key or ref "${S}"`)}else f=this.compile(S);let R=f(b);if(!("$async"in f))this.errors=f.errors;return R}compile(S,b){let f=this._addSchema(S,b);return f.validate||this._compileSchemaEnv(f)}compileAsync(S,b){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:f}=this.opts;return R.call(this,S,b);async function R(Q0,S0){await T.call(this,Q0.$schema);let G1=this._addSchema(Q0,S0);return G1.validate||C.call(this,G1)}async function T(Q0){if(Q0&&!this.getSchema(Q0))await R.call(this,{$ref:Q0},!0)}async function C(Q0){try{return this._compileSchemaEnv(Q0)}catch(S0){if(!(S0 instanceof G.default))throw S0;return r.call(this,S0),await X0.call(this,S0.missingSchema),C.call(this,Q0)}}function r({missingSchema:Q0,missingRef:S0}){if(this.refs[Q0])throw Error(`AnySchema ${Q0} is loaded but ${S0} cannot be resolved`)}async function X0(Q0){let S0=await U0.call(this,Q0);if(!this.refs[Q0])await T.call(this,S0.$schema);if(!this.refs[Q0])this.addSchema(S0,Q0,b)}async function U0(Q0){let S0=this._loading[Q0];if(S0)return S0;try{return await(this._loading[Q0]=f(Q0))}finally{delete this._loading[Q0]}}}addSchema(S,b,f,R=this.opts.validateSchema){if(Array.isArray(S)){for(let C of S)this.addSchema(C,void 0,f,R);return this}let T;if(typeof S==="object"){let{schemaId:C}=this.opts;if(T=S[C],T!==void 0&&typeof T!="string")throw Error(`schema ${C} must be string`)}return b=(0,U.normalizeId)(b||T),this._checkUnique(b),this.schemas[b]=this._addSchema(S,f,b,R,!0),this}addMetaSchema(S,b,f=this.opts.validateSchema){return this.addSchema(S,b,!0,f),this}validateSchema(S,b){if(typeof S=="boolean")return!0;let f;if(f=S.$schema,f!==void 0&&typeof f!="string")throw Error("$schema must be a string");if(f=f||this.opts.defaultMeta||this.defaultMeta(),!f)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let R=this.validate(f,S);if(!R&&b){let T="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(T);else throw Error(T)}return R}getSchema(S){let b;while(typeof(b=D.call(this,S))=="string")S=b;if(b===void 0){let{schemaId:f}=this.opts,R=new W.SchemaEnv({schema:{},schemaId:f});if(b=W.resolveSchema.call(this,R,S),!b)return;this.refs[S]=b}return b.validate||this._compileSchemaEnv(b)}removeSchema(S){if(S instanceof RegExp)return this._removeAllSchemas(this.schemas,S),this._removeAllSchemas(this.refs,S),this;switch(typeof S){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let b=D.call(this,S);if(typeof b=="object")this._cache.delete(b.schema);return delete this.schemas[S],delete this.refs[S],this}case"object":{let b=S;this._cache.delete(b);let f=S[this.opts.schemaId];if(f)f=(0,U.normalizeId)(f),delete this.schemas[f],delete this.refs[f];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(S){for(let b of S)this.addKeyword(b);return this}addKeyword(S,b){let f;if(typeof S=="string"){if(f=S,typeof b=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),b.keyword=f}else if(typeof S=="object"&&b===void 0){if(b=S,f=b.keyword,Array.isArray(f)&&!f.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(l.call(this,f,b),!b)return(0,q.eachItem)(f,(T)=>Y0.call(this,T)),this;_0.call(this,b);let R={...b,type:(0,B.getJSONTypes)(b.type),schemaType:(0,B.getJSONTypes)(b.schemaType)};return(0,q.eachItem)(f,R.type.length===0?(T)=>Y0.call(this,T,R):(T)=>R.type.forEach((C)=>Y0.call(this,T,R,C))),this}getKeyword(S){let b=this.RULES.all[S];return typeof b=="object"?b.definition:!!b}removeKeyword(S){let{RULES:b}=this;delete b.keywords[S],delete b.all[S];for(let f of b.rules){let R=f.rules.findIndex((T)=>T.keyword===S);if(R>=0)f.rules.splice(R,1)}return this}addFormat(S,b){if(typeof b=="string")b=new RegExp(b);return this.formats[S]=b,this}errorsText(S=this.errors,{separator:b=", ",dataVar:f="data"}={}){if(!S||S.length===0)return"No errors";return S.map((R)=>`${f}${R.instancePath} ${R.message}`).reduce((R,T)=>R+b+T)}$dataMetaSchema(S,b){let f=this.RULES.all;S=JSON.parse(JSON.stringify(S));for(let R of b){let T=R.split("/").slice(1),C=S;for(let r of T)C=C[r];for(let r in f){let X0=f[r];if(typeof X0!="object")continue;let{$data:U0}=X0.definition,Q0=C[r];if(U0&&Q0)C[r]=q0(Q0)}}return S}_removeAllSchemas(S,b){for(let f in S){let R=S[f];if(!b||b.test(f)){if(typeof R=="string")delete S[f];else if(R&&!R.meta)this._cache.delete(R.schema),delete S[f]}}}_addSchema(S,b,f,R=this.opts.validateSchema,T=this.opts.addUsedSchema){let C,{schemaId:r}=this.opts;if(typeof S=="object")C=S[r];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof S!="boolean")throw Error("schema must be object or boolean");let X0=this._cache.get(S);if(X0!==void 0)return X0;f=(0,U.normalizeId)(C||f);let U0=U.getSchemaRefs.call(this,S,f);if(X0=new W.SchemaEnv({schema:S,schemaId:r,meta:b,baseId:f,localRefs:U0}),this._cache.set(X0.schema,X0),T&&!f.startsWith("#")){if(f)this._checkUnique(f);this.refs[f]=X0}if(R)this.validateSchema(S,!0);return X0}_checkUnique(S){if(this.schemas[S]||this.refs[S])throw Error(`schema with key or id "${S}" already exists`)}_compileSchemaEnv(S){if(S.meta)this._compileMetaSchema(S);else W.compileSchema.call(this,S);if(!S.validate)throw Error("ajv implementation error");return S.validate}_compileMetaSchema(S){let b=this.opts;this.opts=this._metaOpts;try{W.compileSchema.call(this,S)}finally{this.opts=b}}}L.ValidationError=Y.default,L.MissingRefError=G.default,X.default=L;function O(S,b,f,R="error"){for(let T in S){let C=T;if(C in b)this.logger[R](`${f}: option ${T}. ${S[C]}`)}}function D(S){return S=(0,U.normalizeId)(S),this.schemas[S]||this.refs[S]}function I(){let S=this.opts.schemas;if(!S)return;if(Array.isArray(S))this.addSchema(S);else for(let b in S)this.addSchema(S[b],b)}function j(){for(let S in this.opts.formats){let b=this.opts.formats[S];if(b)this.addFormat(S,b)}}function E(S){if(Array.isArray(S)){this.addVocabulary(S);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let b in S){let f=S[b];if(!f.keyword)f.keyword=b;this.addKeyword(f)}}function g(){let S={...this.opts};for(let b of w)delete S[b];return S}var k={log(){},warn(){},error(){}};function x(S){if(S===!1)return k;if(S===void 0)return console;if(S.log&&S.warn&&S.error)return S;throw Error("logger must implement log, warn and error methods")}var u=/^[a-z_$][a-z0-9_$:-]*$/i;function l(S,b){let{RULES:f}=this;if((0,q.eachItem)(S,(R)=>{if(f.keywords[R])throw Error(`Keyword ${R} is already defined`);if(!u.test(R))throw Error(`Keyword ${R} has invalid name`)}),!b)return;if(b.$data&&!(("code"in b)||("validate"in b)))throw Error('$data keyword must have "code" or "validate" function')}function Y0(S,b,f){var R;let T=b===null||b===void 0?void 0:b.post;if(f&&T)throw Error('keyword with "post" flag cannot have "type"');let{RULES:C}=this,r=T?C.post:C.rules.find(({type:U0})=>U0===f);if(!r)r={type:f,rules:[]},C.rules.push(r);if(C.keywords[S]=!0,!b)return;let X0={keyword:S,definition:{...b,type:(0,B.getJSONTypes)(b.type),schemaType:(0,B.getJSONTypes)(b.schemaType)}};if(b.before)O0.call(this,r,X0,b.before);else r.rules.push(X0);C.all[S]=X0,(R=b.implements)===null||R===void 0||R.forEach((U0)=>this.addKeyword(U0))}function O0(S,b,f){let R=S.rules.findIndex((T)=>T.keyword===f);if(R>=0)S.rules.splice(R,0,b);else S.rules.push(b),this.logger.warn(`rule ${f} is not defined`)}function _0(S){let{metaSchema:b}=S;if(b===void 0)return;if(S.$data&&this.opts.$data)b=q0(b);S.validateSchema=this.compile(b,!0)}var h0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function q0(S){return{anyOf:[S,h0]}}}),$W=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};X.default=Q}),WW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.callRef=X.getValidate=void 0;var Q=G6(),J=H1(),Y=B0(),G=v1(),$=vX(),W=D0(),H={keyword:"$ref",schemaType:"string",code(q){let{gen:K,schema:V,it:N}=q,{baseId:w,schemaEnv:A,validateName:Z,opts:z,self:M}=N,{root:F}=A;if((V==="#"||V==="#/")&&w===F.baseId)return O();let L=$.resolveRef.call(M,F,w,V);if(L===void 0)throw new Q.default(N.opts.uriResolver,w,V);if(L instanceof $.SchemaEnv)return D(L);return I(L);function O(){if(A===F)return B(q,Z,A,A.$async);let j=K.scopeValue("root",{ref:F});return B(q,Y._`${j}.validate`,F,F.$async)}function D(j){let E=U(q,j);B(q,E,j,j.$async)}function I(j){let E=K.scopeValue("schema",z.code.source===!0?{ref:j,code:(0,Y.stringify)(j)}:{ref:j}),g=K.name("valid"),k=q.subschema({schema:j,dataTypes:[],schemaPath:Y.nil,topSchemaRef:E,errSchemaPath:V},g);q.mergeEvaluated(k),q.ok(g)}}};function U(q,K){let{gen:V}=q;return K.validate?V.scopeValue("validate",{ref:K.validate}):Y._`${V.scopeValue("wrapper",{ref:K})}.validate`}X.getValidate=U;function B(q,K,V,N){let{gen:w,it:A}=q,{allErrors:Z,schemaEnv:z,opts:M}=A,F=M.passContext?G.default.this:Y.nil;if(N)L();else O();function L(){if(!z.$async)throw Error("async schema referenced by sync schema");let j=w.let("valid");w.try(()=>{if(w.code(Y._`await ${(0,J.callValidateCode)(q,K,F)}`),I(K),!Z)w.assign(j,!0)},(E)=>{if(w.if(Y._`!(${E} instanceof ${A.ValidationError})`,()=>w.throw(E)),D(E),!Z)w.assign(j,!1)}),q.ok(j)}function O(){q.result((0,J.callValidateCode)(q,K,F),()=>I(K),()=>D(K))}function D(j){let E=Y._`${j}.errors`;w.assign(G.default.vErrors,Y._`${G.default.vErrors} === null ? ${E} : ${G.default.vErrors}.concat(${E})`),w.assign(G.default.errors,Y._`${G.default.vErrors}.length`)}function I(j){var E;if(!A.opts.unevaluated)return;let g=(E=V===null||V===void 0?void 0:V.validate)===null||E===void 0?void 0:E.evaluated;if(A.props!==!0)if(g&&!g.dynamicProps){if(g.props!==void 0)A.props=W.mergeEvaluated.props(w,g.props,A.props)}else{let k=w.var("props",Y._`${j}.evaluated.props`);A.props=W.mergeEvaluated.props(w,k,A.props,Y.Name)}if(A.items!==!0)if(g&&!g.dynamicItems){if(g.items!==void 0)A.items=W.mergeEvaluated.items(w,g.items,A.items)}else{let k=w.var("items",Y._`${j}.evaluated.items`);A.items=W.mergeEvaluated.items(w,k,A.items,Y.Name)}}}X.callRef=B,X.default=H}),HW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=$W(),J=WW(),Y=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Q.default,J.default];X.default=Y}),UW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=B0(),J=Q.operators,Y={maximum:{okStr:"<=",ok:J.LTE,fail:J.GT},minimum:{okStr:">=",ok:J.GTE,fail:J.LT},exclusiveMaximum:{okStr:"<",ok:J.LT,fail:J.GTE},exclusiveMinimum:{okStr:">",ok:J.GT,fail:J.LTE}},G={message:({keyword:W,schemaCode:H})=>Q.str`must be ${Y[W].okStr} ${H}`,params:({keyword:W,schemaCode:H})=>Q._`{comparison: ${Y[W].okStr}, limit: ${H}}`},$={keyword:Object.keys(Y),type:"number",schemaType:"number",$data:!0,error:G,code(W){let{keyword:H,data:U,schemaCode:B}=W;W.fail$data(Q._`${U} ${Y[H].fail} ${B} || isNaN(${U})`)}};X.default=$}),BW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=B0(),J={message:({schemaCode:G})=>Q.str`must be multiple of ${G}`,params:({schemaCode:G})=>Q._`{multipleOf: ${G}}`},Y={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:J,code(G){let{gen:$,data:W,schemaCode:H,it:U}=G,B=U.opts.multipleOfPrecision,q=$.let("res"),K=B?Q._`Math.abs(Math.round(${q}) - ${q}) > 1e-${B}`:Q._`${q} !== parseInt(${q})`;G.fail$data(Q._`(${H} === 0 || (${q} = ${W}/${H}, ${K}))`)}};X.default=Y}),zW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});function Q(J){let Y=J.length,G=0,$=0,W;while($<Y)if(G++,W=J.charCodeAt($++),W>=55296&&W<=56319&&$<Y){if(W=J.charCodeAt($),(W&64512)===56320)$++}return G}X.default=Q,Q.code='require("ajv/dist/runtime/ucs2length").default'}),LW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=B0(),J=D0(),Y=zW(),G={message({keyword:W,schemaCode:H}){let U=W==="maxLength"?"more":"fewer";return Q.str`must NOT have ${U} than ${H} characters`},params:({schemaCode:W})=>Q._`{limit: ${W}}`},$={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:G,code(W){let{keyword:H,data:U,schemaCode:B,it:q}=W,K=H==="maxLength"?Q.operators.GT:Q.operators.LT,V=q.opts.unicode===!1?Q._`${U}.length`:Q._`${(0,J.useFunc)(W.gen,Y.default)}(${U})`;W.fail$data(Q._`${V} ${K} ${B}`)}};X.default=$}),qW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=H1(),J=B0(),Y={message:({schemaCode:$})=>J.str`must match pattern "${$}"`,params:({schemaCode:$})=>J._`{pattern: ${$}}`},G={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Y,code($){let{data:W,$data:H,schema:U,schemaCode:B,it:q}=$,K=q.opts.unicodeRegExp?"u":"",V=H?J._`(new RegExp(${B}, ${K}))`:(0,Q.usePattern)($,U);$.fail$data(J._`!${V}.test(${W})`)}};X.default=G}),FW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=B0(),J={message({keyword:G,schemaCode:$}){let W=G==="maxProperties"?"more":"fewer";return Q.str`must NOT have ${W} than ${$} properties`},params:({schemaCode:G})=>Q._`{limit: ${G}}`},Y={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:J,code(G){let{keyword:$,data:W,schemaCode:H}=G,U=$==="maxProperties"?Q.operators.GT:Q.operators.LT;G.fail$data(Q._`Object.keys(${W}).length ${U} ${H}`)}};X.default=Y}),KW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=H1(),J=B0(),Y=D0(),G={message:({params:{missingProperty:W}})=>J.str`must have required property '${W}'`,params:({params:{missingProperty:W}})=>J._`{missingProperty: ${W}}`},$={keyword:"required",type:"object",schemaType:"array",$data:!0,error:G,code(W){let{gen:H,schema:U,schemaCode:B,data:q,$data:K,it:V}=W,{opts:N}=V;if(!K&&U.length===0)return;let w=U.length>=N.loopRequired;if(V.allErrors)A();else Z();if(N.strictRequired){let F=W.parentSchema.properties,{definedProperties:L}=W.it;for(let O of U)if((F===null||F===void 0?void 0:F[O])===void 0&&!L.has(O)){let D=V.schemaEnv.baseId+V.errSchemaPath,I=`required property "${O}" is not defined at "${D}" (strictRequired)`;(0,Y.checkStrictMode)(V,I,V.opts.strictRequired)}}function A(){if(w||K)W.block$data(J.nil,z);else for(let F of U)(0,Q.checkReportMissingProp)(W,F)}function Z(){let F=H.let("missing");if(w||K){let L=H.let("valid",!0);W.block$data(L,()=>M(F,L)),W.ok(L)}else H.if((0,Q.checkMissingProp)(W,U,F)),(0,Q.reportMissingProp)(W,F),H.else()}function z(){H.forOf("prop",B,(F)=>{W.setParams({missingProperty:F}),H.if((0,Q.noPropertyInData)(H,q,F,N.ownProperties),()=>W.error())})}function M(F,L){W.setParams({missingProperty:F}),H.forOf(F,B,()=>{H.assign(L,(0,Q.propertyInData)(H,q,F,N.ownProperties)),H.if((0,J.not)(L),()=>{W.error(),H.break()})},J.nil)}}};X.default=$}),VW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=B0(),J={message({keyword:G,schemaCode:$}){let W=G==="maxItems"?"more":"fewer";return Q.str`must NOT have ${W} than ${$} items`},params:({schemaCode:G})=>Q._`{limit: ${G}}`},Y={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:J,code(G){let{keyword:$,data:W,schemaCode:H}=G,U=$==="maxItems"?Q.operators.GT:Q.operators.LT;G.fail$data(Q._`${W}.length ${U} ${H}`)}};X.default=Y}),yX=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=S5();Q.code='require("ajv/dist/runtime/equal").default',X.default=Q}),MW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=c8(),J=B0(),Y=D0(),G=yX(),$={message:({params:{i:H,j:U}})=>J.str`must NOT have duplicate items (items ## ${U} and ${H} are identical)`,params:({params:{i:H,j:U}})=>J._`{i: ${H}, j: ${U}}`},W={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:$,code(H){let{gen:U,data:B,$data:q,schema:K,parentSchema:V,schemaCode:N,it:w}=H;if(!q&&!K)return;let A=U.let("valid"),Z=V.items?(0,Q.getSchemaTypes)(V.items):[];H.block$data(A,z,J._`${N} === false`),H.ok(A);function z(){let O=U.let("i",J._`${B}.length`),D=U.let("j");H.setParams({i:O,j:D}),U.assign(A,!0),U.if(J._`${O} > 1`,()=>(M()?F:L)(O,D))}function M(){return Z.length>0&&!Z.some((O)=>O==="object"||O==="array")}function F(O,D){let I=U.name("item"),j=(0,Q.checkDataTypes)(Z,I,w.opts.strictNumbers,Q.DataType.Wrong),E=U.const("indices",J._`{}`);U.for(J._`;${O}--;`,()=>{if(U.let(I,J._`${B}[${O}]`),U.if(j,J._`continue`),Z.length>1)U.if(J._`typeof ${I} == "string"`,J._`${I} += "_"`);U.if(J._`typeof ${E}[${I}] == "number"`,()=>{U.assign(D,J._`${E}[${I}]`),H.error(),U.assign(A,!1).break()}).code(J._`${E}[${I}] = ${O}`)})}function L(O,D){let I=(0,Y.useFunc)(U,G.default),j=U.name("outer");U.label(j).for(J._`;${O}--;`,()=>U.for(J._`${D} = ${O}; ${D}--;`,()=>U.if(J._`${I}(${B}[${O}], ${B}[${D}])`,()=>{H.error(),U.assign(A,!1).break(j)})))}}};X.default=W}),DW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=B0(),J=D0(),Y=yX(),G={message:"must be equal to constant",params:({schemaCode:W})=>Q._`{allowedValue: ${W}}`},$={keyword:"const",$data:!0,error:G,code(W){let{gen:H,data:U,$data:B,schemaCode:q,schema:K}=W;if(B||K&&typeof K=="object")W.fail$data(Q._`!${(0,J.useFunc)(H,Y.default)}(${U}, ${q})`);else W.fail(Q._`${K} !== ${U}`)}};X.default=$}),ZW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=B0(),J=D0(),Y=yX(),G={message:"must be equal to one of the allowed values",params:({schemaCode:W})=>Q._`{allowedValues: ${W}}`},$={keyword:"enum",schemaType:"array",$data:!0,error:G,code(W){let{gen:H,data:U,$data:B,schema:q,schemaCode:K,it:V}=W;if(!B&&q.length===0)throw Error("enum must have non-empty array");let N=q.length>=V.opts.loopEnum,w,A=()=>w!==null&&w!==void 0?w:w=(0,J.useFunc)(H,Y.default),Z;if(N||B)Z=H.let("valid"),W.block$data(Z,z);else{if(!Array.isArray(q))throw Error("ajv implementation error");let F=H.const("vSchema",K);Z=(0,Q.or)(...q.map((L,O)=>M(F,O)))}W.pass(Z);function z(){H.assign(Z,!1),H.forOf("v",K,(F)=>H.if(Q._`${A()}(${U}, ${F})`,()=>H.assign(Z,!0).break()))}function M(F,L){let O=q[L];return typeof O==="object"&&O!==null?Q._`${A()}(${U}, ${F}[${L}])`:Q._`${U} === ${O}`}}};X.default=$}),OW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=UW(),J=BW(),Y=LW(),G=qW(),$=FW(),W=KW(),H=VW(),U=MW(),B=DW(),q=ZW(),K=[Q.default,J.default,Y.default,G.default,$.default,W.default,H.default,U.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},B.default,q.default];X.default=K}),E5=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.validateAdditionalItems=void 0;var Q=B0(),J=D0(),Y={message:({params:{len:W}})=>Q.str`must NOT have more than ${W} items`,params:({params:{len:W}})=>Q._`{limit: ${W}}`},G={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Y,code(W){let{parentSchema:H,it:U}=W,{items:B}=H;if(!Array.isArray(B)){(0,J.checkStrictMode)(U,'"additionalItems" is ignored when "items" is not an array of schemas');return}$(W,B)}};function $(W,H){let{gen:U,schema:B,data:q,keyword:K,it:V}=W;V.items=!0;let N=U.const("len",Q._`${q}.length`);if(B===!1)W.setParams({len:H.length}),W.pass(Q._`${N} <= ${H.length}`);else if(typeof B=="object"&&!(0,J.alwaysValidSchema)(V,B)){let A=U.var("valid",Q._`${N} <= ${H.length}`);U.if((0,Q.not)(A),()=>w(A)),W.ok(A)}function w(A){U.forRange("i",H.length,N,(Z)=>{if(W.subschema({keyword:K,dataProp:Z,dataPropType:J.Type.Num},A),!V.allErrors)U.if((0,Q.not)(A),()=>U.break())})}}X.validateAdditionalItems=$,X.default=G}),b5=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.validateTuple=void 0;var Q=B0(),J=D0(),Y=H1(),G={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(W){let{schema:H,it:U}=W;if(Array.isArray(H))return $(W,"additionalItems",H);if(U.items=!0,(0,J.alwaysValidSchema)(U,H))return;W.ok((0,Y.validateArray)(W))}};function $(W,H,U=W.schema){let{gen:B,parentSchema:q,data:K,keyword:V,it:N}=W;if(Z(q),N.opts.unevaluated&&U.length&&N.items!==!0)N.items=J.mergeEvaluated.items(B,U.length,N.items);let w=B.name("valid"),A=B.const("len",Q._`${K}.length`);U.forEach((z,M)=>{if((0,J.alwaysValidSchema)(N,z))return;B.if(Q._`${A} > ${M}`,()=>W.subschema({keyword:V,schemaProp:M,dataProp:M},w)),W.ok(w)});function Z(z){let{opts:M,errSchemaPath:F}=N,L=U.length,O=L===z.minItems&&(L===z.maxItems||z[H]===!1);if(M.strictTuples&&!O){let D=`"${V}" is ${L}-tuple, but minItems or maxItems/${H} are not specified or different at path "${F}"`;(0,J.checkStrictMode)(N,D,M.strictTuples)}}}X.validateTuple=$,X.default=G}),AW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=b5(),J={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Y)=>(0,Q.validateTuple)(Y,"items")};X.default=J}),NW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=B0(),J=D0(),Y=H1(),G=E5(),$={message:({params:{len:H}})=>Q.str`must NOT have more than ${H} items`,params:({params:{len:H}})=>Q._`{limit: ${H}}`},W={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:$,code(H){let{schema:U,parentSchema:B,it:q}=H,{prefixItems:K}=B;if(q.items=!0,(0,J.alwaysValidSchema)(q,U))return;if(K)(0,G.validateAdditionalItems)(H,K);else H.ok((0,Y.validateArray)(H))}};X.default=W}),RW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=B0(),J=D0(),Y={message:({params:{min:$,max:W}})=>W===void 0?Q.str`must contain at least ${$} valid item(s)`:Q.str`must contain at least ${$} and no more than ${W} valid item(s)`,params:({params:{min:$,max:W}})=>W===void 0?Q._`{minContains: ${$}}`:Q._`{minContains: ${$}, maxContains: ${W}}`},G={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Y,code($){let{gen:W,schema:H,parentSchema:U,data:B,it:q}=$,K,V,{minContains:N,maxContains:w}=U;if(q.opts.next)K=N===void 0?1:N,V=w;else K=1;let A=W.const("len",Q._`${B}.length`);if($.setParams({min:K,max:V}),V===void 0&&K===0){(0,J.checkStrictMode)(q,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(V!==void 0&&K>V){(0,J.checkStrictMode)(q,'"minContains" > "maxContains" is always invalid'),$.fail();return}if((0,J.alwaysValidSchema)(q,H)){let L=Q._`${A} >= ${K}`;if(V!==void 0)L=Q._`${L} && ${A} <= ${V}`;$.pass(L);return}q.items=!0;let Z=W.name("valid");if(V===void 0&&K===1)M(Z,()=>W.if(Z,()=>W.break()));else if(K===0){if(W.let(Z,!0),V!==void 0)W.if(Q._`${B}.length > 0`,z)}else W.let(Z,!1),z();$.result(Z,()=>$.reset());function z(){let L=W.name("_valid"),O=W.let("count",0);M(L,()=>W.if(L,()=>F(O)))}function M(L,O){W.forRange("i",0,A,(D)=>{$.subschema({keyword:"contains",dataProp:D,dataPropType:J.Type.Num,compositeRule:!0},L),O()})}function F(L){if(W.code(Q._`${L}++`),V===void 0)W.if(Q._`${L} >= ${K}`,()=>W.assign(Z,!0).break());else if(W.if(Q._`${L} > ${V}`,()=>W.assign(Z,!1).break()),K===1)W.assign(Z,!0);else W.if(Q._`${L} >= ${K}`,()=>W.assign(Z,!0))}}};X.default=G}),IW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.validateSchemaDeps=X.validatePropertyDeps=X.error=void 0;var Q=B0(),J=D0(),Y=H1();X.error={message:({params:{property:U,depsCount:B,deps:q}})=>{let K=B===1?"property":"properties";return Q.str`must have ${K} ${q} when property ${U} is present`},params:({params:{property:U,depsCount:B,deps:q,missingProperty:K}})=>Q._`{property: ${U},
171
+ missingProperty: ${K},
172
+ depsCount: ${B},
173
+ deps: ${q}}`};var G={keyword:"dependencies",type:"object",schemaType:"object",error:X.error,code(U){let[B,q]=$(U);W(U,B),H(U,q)}};function $({schema:U}){let B={},q={};for(let K in U){if(K==="__proto__")continue;let V=Array.isArray(U[K])?B:q;V[K]=U[K]}return[B,q]}function W(U,B=U.schema){let{gen:q,data:K,it:V}=U;if(Object.keys(B).length===0)return;let N=q.let("missing");for(let w in B){let A=B[w];if(A.length===0)continue;let Z=(0,Y.propertyInData)(q,K,w,V.opts.ownProperties);if(U.setParams({property:w,depsCount:A.length,deps:A.join(", ")}),V.allErrors)q.if(Z,()=>{for(let z of A)(0,Y.checkReportMissingProp)(U,z)});else q.if(Q._`${Z} && (${(0,Y.checkMissingProp)(U,A,N)})`),(0,Y.reportMissingProp)(U,N),q.else()}}X.validatePropertyDeps=W;function H(U,B=U.schema){let{gen:q,data:K,keyword:V,it:N}=U,w=q.name("valid");for(let A in B){if((0,J.alwaysValidSchema)(N,B[A]))continue;q.if((0,Y.propertyInData)(q,K,A,N.opts.ownProperties),()=>{let Z=U.subschema({keyword:V,schemaProp:A},w);U.mergeValidEvaluated(Z,w)},()=>q.var(w,!0)),U.ok(w)}}X.validateSchemaDeps=H,X.default=G}),jW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=B0(),J=D0(),Y={message:"property name must be valid",params:({params:$})=>Q._`{propertyName: ${$.propertyName}}`},G={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Y,code($){let{gen:W,schema:H,data:U,it:B}=$;if((0,J.alwaysValidSchema)(B,H))return;let q=W.name("valid");W.forIn("key",U,(K)=>{$.setParams({propertyName:K}),$.subschema({keyword:"propertyNames",data:K,dataTypes:["string"],propertyName:K,compositeRule:!0},q),W.if((0,Q.not)(q),()=>{if($.error(!0),!B.allErrors)W.break()})}),$.ok(q)}};X.default=G}),C5=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=H1(),J=B0(),Y=v1(),G=D0(),$={message:"must NOT have additional properties",params:({params:H})=>J._`{additionalProperty: ${H.additionalProperty}}`},W={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:$,code(H){let{gen:U,schema:B,parentSchema:q,data:K,errsCount:V,it:N}=H;if(!V)throw Error("ajv implementation error");let{allErrors:w,opts:A}=N;if(N.props=!0,A.removeAdditional!=="all"&&(0,G.alwaysValidSchema)(N,B))return;let Z=(0,Q.allSchemaProperties)(q.properties),z=(0,Q.allSchemaProperties)(q.patternProperties);M(),H.ok(J._`${V} === ${Y.default.errors}`);function M(){U.forIn("key",K,(I)=>{if(!Z.length&&!z.length)O(I);else U.if(F(I),()=>O(I))})}function F(I){let j;if(Z.length>8){let E=(0,G.schemaRefOrVal)(N,q.properties,"properties");j=(0,Q.isOwnProperty)(U,E,I)}else if(Z.length)j=(0,J.or)(...Z.map((E)=>J._`${I} === ${E}`));else j=J.nil;if(z.length)j=(0,J.or)(j,...z.map((E)=>J._`${(0,Q.usePattern)(H,E)}.test(${I})`));return(0,J.not)(j)}function L(I){U.code(J._`delete ${K}[${I}]`)}function O(I){if(A.removeAdditional==="all"||A.removeAdditional&&B===!1){L(I);return}if(B===!1){if(H.setParams({additionalProperty:I}),H.error(),!w)U.break();return}if(typeof B=="object"&&!(0,G.alwaysValidSchema)(N,B)){let j=U.name("valid");if(A.removeAdditional==="failing")D(I,j,!1),U.if((0,J.not)(j),()=>{H.reset(),L(I)});else if(D(I,j),!w)U.if((0,J.not)(j),()=>U.break())}}function D(I,j,E){let g={keyword:"additionalProperties",dataProp:I,dataPropType:G.Type.Str};if(E===!1)Object.assign(g,{compositeRule:!0,createErrors:!1,allErrors:!1});H.subschema(g,j)}}};X.default=W}),wW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=Y6(),J=H1(),Y=D0(),G=C5(),$={keyword:"properties",type:"object",schemaType:"object",code(W){let{gen:H,schema:U,parentSchema:B,data:q,it:K}=W;if(K.opts.removeAdditional==="all"&&B.additionalProperties===void 0)G.default.code(new Q.KeywordCxt(K,G.default,"additionalProperties"));let V=(0,J.allSchemaProperties)(U);for(let z of V)K.definedProperties.add(z);if(K.opts.unevaluated&&V.length&&K.props!==!0)K.props=Y.mergeEvaluated.props(H,(0,Y.toHash)(V),K.props);let N=V.filter((z)=>!(0,Y.alwaysValidSchema)(K,U[z]));if(N.length===0)return;let w=H.name("valid");for(let z of N){if(A(z))Z(z);else{if(H.if((0,J.propertyInData)(H,q,z,K.opts.ownProperties)),Z(z),!K.allErrors)H.else().var(w,!0);H.endIf()}W.it.definedProperties.add(z),W.ok(w)}function A(z){return K.opts.useDefaults&&!K.compositeRule&&U[z].default!==void 0}function Z(z){W.subschema({keyword:"properties",schemaProp:z,dataProp:z},w)}}};X.default=$}),PW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=H1(),J=B0(),Y=D0(),G=D0(),$={keyword:"patternProperties",type:"object",schemaType:"object",code(W){let{gen:H,schema:U,data:B,parentSchema:q,it:K}=W,{opts:V}=K,N=(0,Q.allSchemaProperties)(U),w=N.filter((O)=>(0,Y.alwaysValidSchema)(K,U[O]));if(N.length===0||w.length===N.length&&(!K.opts.unevaluated||K.props===!0))return;let A=V.strictSchema&&!V.allowMatchingProperties&&q.properties,Z=H.name("valid");if(K.props!==!0&&!(K.props instanceof J.Name))K.props=(0,G.evaluatedPropsToName)(H,K.props);let{props:z}=K;M();function M(){for(let O of N){if(A)F(O);if(K.allErrors)L(O);else H.var(Z,!0),L(O),H.if(Z)}}function F(O){for(let D in A)if(new RegExp(O).test(D))(0,Y.checkStrictMode)(K,`property ${D} matches pattern ${O} (use allowMatchingProperties)`)}function L(O){H.forIn("key",B,(D)=>{H.if(J._`${(0,Q.usePattern)(W,O)}.test(${D})`,()=>{let I=w.includes(O);if(!I)W.subschema({keyword:"patternProperties",schemaProp:O,dataProp:D,dataPropType:G.Type.Str},Z);if(K.opts.unevaluated&&z!==!0)H.assign(J._`${z}[${D}]`,!0);else if(!I&&!K.allErrors)H.if((0,J.not)(Z),()=>H.break())})})}}};X.default=$}),TW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=D0(),J={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Y){let{gen:G,schema:$,it:W}=Y;if((0,Q.alwaysValidSchema)(W,$)){Y.fail();return}let H=G.name("valid");Y.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},H),Y.failResult(H,()=>Y.reset(),()=>Y.error())},error:{message:"must NOT be valid"}};X.default=J}),SW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=H1(),J={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Q.validateUnion,error:{message:"must match a schema in anyOf"}};X.default=J}),EW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=B0(),J=D0(),Y={message:"must match exactly one schema in oneOf",params:({params:$})=>Q._`{passingSchemas: ${$.passing}}`},G={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Y,code($){let{gen:W,schema:H,parentSchema:U,it:B}=$;if(!Array.isArray(H))throw Error("ajv implementation error");if(B.opts.discriminator&&U.discriminator)return;let q=H,K=W.let("valid",!1),V=W.let("passing",null),N=W.name("_valid");$.setParams({passing:V}),W.block(w),$.result(K,()=>$.reset(),()=>$.error(!0));function w(){q.forEach((A,Z)=>{let z;if((0,J.alwaysValidSchema)(B,A))W.var(N,!0);else z=$.subschema({keyword:"oneOf",schemaProp:Z,compositeRule:!0},N);if(Z>0)W.if(Q._`${N} && ${K}`).assign(K,!1).assign(V,Q._`[${V}, ${Z}]`).else();W.if(N,()=>{if(W.assign(K,!0),W.assign(V,Z),z)$.mergeEvaluated(z,Q.Name)})})}}};X.default=G}),bW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=D0(),J={keyword:"allOf",schemaType:"array",code(Y){let{gen:G,schema:$,it:W}=Y;if(!Array.isArray($))throw Error("ajv implementation error");let H=G.name("valid");$.forEach((U,B)=>{if((0,Q.alwaysValidSchema)(W,U))return;let q=Y.subschema({keyword:"allOf",schemaProp:B},H);Y.ok(H),Y.mergeEvaluated(q)})}};X.default=J}),CW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=B0(),J=D0(),Y={message:({params:W})=>Q.str`must match "${W.ifClause}" schema`,params:({params:W})=>Q._`{failingKeyword: ${W.ifClause}}`},G={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Y,code(W){let{gen:H,parentSchema:U,it:B}=W;if(U.then===void 0&&U.else===void 0)(0,J.checkStrictMode)(B,'"if" without "then" and "else" is ignored');let q=$(B,"then"),K=$(B,"else");if(!q&&!K)return;let V=H.let("valid",!0),N=H.name("_valid");if(w(),W.reset(),q&&K){let Z=H.let("ifClause");W.setParams({ifClause:Z}),H.if(N,A("then",Z),A("else",Z))}else if(q)H.if(N,A("then"));else H.if((0,Q.not)(N),A("else"));W.pass(V,()=>W.error(!0));function w(){let Z=W.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},N);W.mergeEvaluated(Z)}function A(Z,z){return()=>{let M=W.subschema({keyword:Z},N);if(H.assign(V,N),W.mergeValidEvaluated(M,V),z)H.assign(z,Q._`${Z}`);else W.setParams({ifClause:Z})}}}};function $(W,H){let U=W.schema[H];return U!==void 0&&!(0,J.alwaysValidSchema)(W,U)}X.default=G}),_W=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=D0(),J={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Y,parentSchema:G,it:$}){if(G.if===void 0)(0,Q.checkStrictMode)($,`"${Y}" without "if" is ignored`)}};X.default=J}),kW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=E5(),J=AW(),Y=b5(),G=NW(),$=RW(),W=IW(),H=jW(),U=C5(),B=wW(),q=PW(),K=TW(),V=SW(),N=EW(),w=bW(),A=CW(),Z=_W();function z(M=!1){let F=[K.default,V.default,N.default,w.default,A.default,Z.default,H.default,U.default,W.default,B.default,q.default];if(M)F.push(J.default,G.default);else F.push(Q.default,Y.default);return F.push($.default),F}X.default=z}),vW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=B0(),J={message:({schemaCode:G})=>Q.str`must match format "${G}"`,params:({schemaCode:G})=>Q._`{format: ${G}}`},Y={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:J,code(G,$){let{gen:W,data:H,$data:U,schema:B,schemaCode:q,it:K}=G,{opts:V,errSchemaPath:N,schemaEnv:w,self:A}=K;if(!V.validateFormats)return;if(U)Z();else z();function Z(){let M=W.scopeValue("formats",{ref:A.formats,code:V.code.formats}),F=W.const("fDef",Q._`${M}[${q}]`),L=W.let("fType"),O=W.let("format");W.if(Q._`typeof ${F} == "object" && !(${F} instanceof RegExp)`,()=>W.assign(L,Q._`${F}.type || "string"`).assign(O,Q._`${F}.validate`),()=>W.assign(L,Q._`"string"`).assign(O,F)),G.fail$data((0,Q.or)(D(),I()));function D(){if(V.strictSchema===!1)return Q.nil;return Q._`${q} && !${O}`}function I(){let j=w.$async?Q._`(${F}.async ? await ${O}(${H}) : ${O}(${H}))`:Q._`${O}(${H})`,E=Q._`(typeof ${O} == "function" ? ${j} : ${O}.test(${H}))`;return Q._`${O} && ${O} !== true && ${L} === ${$} && !${E}`}}function z(){let M=A.formats[B];if(!M){D();return}if(M===!0)return;let[F,L,O]=I(M);if(F===$)G.pass(j());function D(){if(V.strictSchema===!1){A.logger.warn(E());return}throw Error(E());function E(){return`unknown format "${B}" ignored in schema at path "${N}"`}}function I(E){let g=E instanceof RegExp?(0,Q.regexpCode)(E):V.code.formats?Q._`${V.code.formats}${(0,Q.getProperty)(B)}`:void 0,k=W.scopeValue("formats",{key:B,ref:E,code:g});if(typeof E=="object"&&!(E instanceof RegExp))return[E.type||"string",E.validate,Q._`${k}.validate`];return["string",E,k]}function j(){if(typeof M=="object"&&!(M instanceof RegExp)&&M.async){if(!w.$async)throw Error("async format in sync schema");return Q._`await ${O}(${H})`}return typeof L=="function"?Q._`${O}(${H})`:Q._`${O}.test(${H})`}}}};X.default=Y}),yW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=vW(),J=[Q.default];X.default=J}),xW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.contentVocabulary=X.metadataVocabulary=void 0,X.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],X.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),gW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=HW(),J=OW(),Y=kW(),G=yW(),$=xW(),W=[Q.default,J.default,(0,Y.default)(),G.default,$.metadataVocabulary,$.contentVocabulary];X.default=W}),hW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.DiscrError=void 0;var Q;(function(J){J.Tag="tag",J.Mapping="mapping"})(Q||(X.DiscrError=Q={}))}),fW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0});var Q=B0(),J=hW(),Y=vX(),G=G6(),$=D0(),W={message:({params:{discrError:U,tagName:B}})=>U===J.DiscrError.Tag?`tag "${B}" must be string`:`value of tag "${B}" must be in oneOf`,params:({params:{discrError:U,tag:B,tagName:q}})=>Q._`{error: ${U}, tag: ${q}, tagValue: ${B}}`},H={keyword:"discriminator",type:"object",schemaType:"object",error:W,code(U){let{gen:B,data:q,schema:K,parentSchema:V,it:N}=U,{oneOf:w}=V;if(!N.opts.discriminator)throw Error("discriminator: requires discriminator option");let A=K.propertyName;if(typeof A!="string")throw Error("discriminator: requires propertyName");if(K.mapping)throw Error("discriminator: mapping is not supported");if(!w)throw Error("discriminator: requires oneOf keyword");let Z=B.let("valid",!1),z=B.const("tag",Q._`${q}${(0,Q.getProperty)(A)}`);B.if(Q._`typeof ${z} == "string"`,()=>M(),()=>U.error(!1,{discrError:J.DiscrError.Tag,tag:z,tagName:A})),U.ok(Z);function M(){let O=L();B.if(!1);for(let D in O)B.elseIf(Q._`${z} === ${D}`),B.assign(Z,F(O[D]));B.else(),U.error(!1,{discrError:J.DiscrError.Mapping,tag:z,tagName:A}),B.endIf()}function F(O){let D=B.name("valid"),I=U.subschema({keyword:"oneOf",schemaProp:O},D);return U.mergeEvaluated(I,Q.Name),D}function L(){var O;let D={},I=E(V),j=!0;for(let x=0;x<w.length;x++){let u=w[x];if((u===null||u===void 0?void 0:u.$ref)&&!(0,$.schemaHasRulesButRef)(u,N.self.RULES)){let Y0=u.$ref;if(u=Y.resolveRef.call(N.self,N.schemaEnv.root,N.baseId,Y0),u instanceof Y.SchemaEnv)u=u.schema;if(u===void 0)throw new G.default(N.opts.uriResolver,N.baseId,Y0)}let l=(O=u===null||u===void 0?void 0:u.properties)===null||O===void 0?void 0:O[A];if(typeof l!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${A}"`);j=j&&(I||E(u)),g(l,x)}if(!j)throw Error(`discriminator: "${A}" must be required`);return D;function E({required:x}){return Array.isArray(x)&&x.includes(A)}function g(x,u){if(x.const)k(x.const,u);else if(x.enum)for(let l of x.enum)k(l,u);else throw Error(`discriminator: "properties/${A}" must have "const" or "enum"`)}function k(x,u){if(typeof x!="string"||x in D)throw Error(`discriminator: "${A}" values must be unique strings`);D[x]=u}}}};X.default=H}),uW=i((X,Q)=>{Q.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),_5=i((X,Q)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.MissingRefError=X.ValidationError=X.CodeGen=X.Name=X.nil=X.stringify=X.str=X._=X.KeywordCxt=X.Ajv=void 0;var J=GW(),Y=gW(),G=fW(),$=uW(),W=["/properties"],H="http://json-schema.org/draft-07/schema";class U extends J.default{_addVocabularies(){if(super._addVocabularies(),Y.default.forEach((N)=>this.addVocabulary(N)),this.opts.discriminator)this.addKeyword(G.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let N=this.opts.$data?this.$dataMetaSchema($,W):$;this.addMetaSchema(N,H,!1),this.refs["http://json-schema.org/schema"]=H}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(H)?H:void 0)}}X.Ajv=U,Q.exports=X=U,Q.exports.Ajv=U,Object.defineProperty(X,"__esModule",{value:!0}),X.default=U;var B=Y6();Object.defineProperty(X,"KeywordCxt",{enumerable:!0,get:function(){return B.KeywordCxt}});var q=B0();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return q._}}),Object.defineProperty(X,"str",{enumerable:!0,get:function(){return q.str}}),Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return q.stringify}}),Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return q.nil}}),Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return q.Name}}),Object.defineProperty(X,"CodeGen",{enumerable:!0,get:function(){return q.CodeGen}});var K=kX();Object.defineProperty(X,"ValidationError",{enumerable:!0,get:function(){return K.default}});var V=G6();Object.defineProperty(X,"MissingRefError",{enumerable:!0,get:function(){return V.default}})}),mW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.formatNames=X.fastFormats=X.fullFormats=void 0;function Q(k,x){return{validate:k,compare:x}}X.fullFormats={date:Q($,W),time:Q(U(!0),B),"date-time":Q(V(!0),N),"iso-time":Q(U(),q),"iso-date-time":Q(V(),w),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:z,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:g,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:F,int32:{type:"number",validate:D},int64:{type:"number",validate:I},float:{type:"number",validate:j},double:{type:"number",validate:j},password:!0,binary:!0},X.fastFormats={...X.fullFormats,date:Q(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,W),time:Q(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,B),"date-time":Q(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,N),"iso-time":Q(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,q),"iso-date-time":Q(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,w),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},X.formatNames=Object.keys(X.fullFormats);function J(k){return k%4===0&&(k%100!==0||k%400===0)}var Y=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,G=[0,31,28,31,30,31,30,31,31,30,31,30,31];function $(k){let x=Y.exec(k);if(!x)return!1;let u=+x[1],l=+x[2],Y0=+x[3];return l>=1&&l<=12&&Y0>=1&&Y0<=(l===2&&J(u)?29:G[l])}function W(k,x){if(!(k&&x))return;if(k>x)return 1;if(k<x)return-1;return 0}var H=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function U(k){return function(u){let l=H.exec(u);if(!l)return!1;let Y0=+l[1],O0=+l[2],_0=+l[3],h0=l[4],q0=l[5]==="-"?-1:1,S=+(l[6]||0),b=+(l[7]||0);if(S>23||b>59||k&&!h0)return!1;if(Y0<=23&&O0<=59&&_0<60)return!0;let f=O0-b*q0,R=Y0-S*q0-(f<0?1:0);return(R===23||R===-1)&&(f===59||f===-1)&&_0<61}}function B(k,x){if(!(k&&x))return;let u=new Date("2020-01-01T"+k).valueOf(),l=new Date("2020-01-01T"+x).valueOf();if(!(u&&l))return;return u-l}function q(k,x){if(!(k&&x))return;let u=H.exec(k),l=H.exec(x);if(!(u&&l))return;if(k=u[1]+u[2]+u[3],x=l[1]+l[2]+l[3],k>x)return 1;if(k<x)return-1;return 0}var K=/t|\s/i;function V(k){let x=U(k);return function(l){let Y0=l.split(K);return Y0.length===2&&$(Y0[0])&&x(Y0[1])}}function N(k,x){if(!(k&&x))return;let u=new Date(k).valueOf(),l=new Date(x).valueOf();if(!(u&&l))return;return u-l}function w(k,x){if(!(k&&x))return;let[u,l]=k.split(K),[Y0,O0]=x.split(K),_0=W(u,Y0);if(_0===void 0)return;return _0||B(l,O0)}var A=/\/|:/,Z=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function z(k){return A.test(k)&&Z.test(k)}var M=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function F(k){return M.lastIndex=0,M.test(k)}var L=-2147483648,O=2147483647;function D(k){return Number.isInteger(k)&&k<=O&&k>=L}function I(k){return Number.isInteger(k)}function j(){return!0}var E=/[^\\]\\Z/;function g(k){if(E.test(k))return!1;try{return new RegExp(k),!0}catch(x){return!1}}}),lW=i((X)=>{Object.defineProperty(X,"__esModule",{value:!0}),X.formatLimitDefinition=void 0;var Q=_5(),J=B0(),Y=J.operators,G={formatMaximum:{okStr:"<=",ok:Y.LTE,fail:Y.GT},formatMinimum:{okStr:">=",ok:Y.GTE,fail:Y.LT},formatExclusiveMaximum:{okStr:"<",ok:Y.LT,fail:Y.GTE},formatExclusiveMinimum:{okStr:">",ok:Y.GT,fail:Y.LTE}},$={message:({keyword:H,schemaCode:U})=>J.str`should be ${G[H].okStr} ${U}`,params:({keyword:H,schemaCode:U})=>J._`{comparison: ${G[H].okStr}, limit: ${U}}`};X.formatLimitDefinition={keyword:Object.keys(G),type:"string",schemaType:"string",$data:!0,error:$,code(H){let{gen:U,data:B,schemaCode:q,keyword:K,it:V}=H,{opts:N,self:w}=V;if(!N.validateFormats)return;let A=new Q.KeywordCxt(V,w.RULES.all.format.definition,"format");if(A.$data)Z();else z();function Z(){let F=U.scopeValue("formats",{ref:w.formats,code:N.code.formats}),L=U.const("fmt",J._`${F}[${A.schemaCode}]`);H.fail$data((0,J.or)(J._`typeof ${L} != "object"`,J._`${L} instanceof RegExp`,J._`typeof ${L}.compare != "function"`,M(L)))}function z(){let F=A.schema,L=w.formats[F];if(!L||L===!0)return;if(typeof L!="object"||L instanceof RegExp||typeof L.compare!="function")throw Error(`"${K}": format "${F}" does not define "compare" function`);let O=U.scopeValue("formats",{key:F,ref:L,code:N.code.formats?J._`${N.code.formats}${(0,J.getProperty)(F)}`:void 0});H.fail$data(M(O))}function M(F){return J._`${F}.compare(${B}, ${q}) ${G[K].fail} 0`}},dependencies:["format"]};var W=(H)=>{return H.addKeyword(X.formatLimitDefinition),H};X.default=W}),cW=i((X,Q)=>{Object.defineProperty(X,"__esModule",{value:!0});var J=mW(),Y=lW(),G=B0(),$=new G.Name("fullFormats"),W=new G.Name("fastFormats"),H=(B,q={keywords:!0})=>{if(Array.isArray(q))return U(B,q,J.fullFormats,$),B;let[K,V]=q.mode==="fast"?[J.fastFormats,W]:[J.fullFormats,$],N=q.formats||J.formatNames;if(U(B,N,K,V),q.keywords)(0,Y.default)(B);return B};H.get=(B,q="full")=>{let V=(q==="fast"?J.fastFormats:J.fullFormats)[B];if(!V)throw Error(`Unknown format "${B}"`);return V};function U(B,q,K,V){var N,w;(N=(w=B.opts.code).formats)!==null&&N!==void 0||(w.formats=G._`require("ajv-formats/dist/formats").${V}`);for(let A of q)B.addFormat(A,K[A])}Q.exports=X=H,Object.defineProperty(X,"__esModule",{value:!0}),X.default=H}),iW=50;function k5(X=iW){let Q=new AbortController;return dW(X,Q.signal),Q}var aW=typeof global=="object"&&global&&global.Object===Object&&global,sW=aW,tW=typeof self=="object"&&self&&self.Object===Object&&self,eW=sW||tW||Function("return this")(),xX=eW,XH=xX.Symbol,p8=XH,v5=Object.prototype,QH=v5.hasOwnProperty,JH=v5.toString,g9=p8?p8.toStringTag:void 0;function YH(X){var Q=QH.call(X,g9),J=X[g9];try{X[g9]=void 0;var Y=!0}catch($){}var G=JH.call(X);if(Y)if(Q)X[g9]=J;else delete X[g9];return G}var GH=YH,$H=Object.prototype,WH=$H.toString;function HH(X){return WH.call(X)}var UH=HH,BH="[object Null]",zH="[object Undefined]",i4=p8?p8.toStringTag:void 0;function LH(X){if(X==null)return X===void 0?zH:BH;return i4&&i4 in Object(X)?GH(X):UH(X)}var qH=LH;function FH(X){var Q=typeof X;return X!=null&&(Q=="object"||Q=="function")}var y5=FH,KH="[object AsyncFunction]",VH="[object Function]",MH="[object GeneratorFunction]",DH="[object Proxy]";function ZH(X){if(!y5(X))return!1;var Q=qH(X);return Q==VH||Q==MH||Q==KH||Q==DH}var OH=ZH,AH=xX["__core-js_shared__"],ZX=AH,n4=function(){var X=/[^.]+$/.exec(ZX&&ZX.keys&&ZX.keys.IE_PROTO||"");return X?"Symbol(src)_1."+X:""}();function NH(X){return!!n4&&n4 in X}var RH=NH,IH=Function.prototype,jH=IH.toString;function wH(X){if(X!=null){try{return jH.call(X)}catch(Q){}try{return X+""}catch(Q){}}return""}var PH=wH,TH=/[\\^$.*+?()[\]{}|]/g,SH=/^\[object .+?Constructor\]$/,EH=Function.prototype,bH=Object.prototype,CH=EH.toString,_H=bH.hasOwnProperty,kH=RegExp("^"+CH.call(_H).replace(TH,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function vH(X){if(!y5(X)||RH(X))return!1;var Q=OH(X)?kH:SH;return Q.test(PH(X))}var yH=vH;function xH(X,Q){return X==null?void 0:X[Q]}var gH=xH;function hH(X,Q){var J=gH(X,Q);return yH(J)?J:void 0}var x5=hH,fH=x5(Object,"create"),m9=fH;function uH(){this.__data__=m9?m9(null):{},this.size=0}var mH=uH;function lH(X){var Q=this.has(X)&&delete this.__data__[X];return this.size-=Q?1:0,Q}var cH=lH,pH="__lodash_hash_undefined__",dH=Object.prototype,iH=dH.hasOwnProperty;function nH(X){var Q=this.__data__;if(m9){var J=Q[X];return J===pH?void 0:J}return iH.call(Q,X)?Q[X]:void 0}var rH=nH,oH=Object.prototype,aH=oH.hasOwnProperty;function sH(X){var Q=this.__data__;return m9?Q[X]!==void 0:aH.call(Q,X)}var tH=sH,eH="__lodash_hash_undefined__";function XU(X,Q){var J=this.__data__;return this.size+=this.has(X)?0:1,J[X]=m9&&Q===void 0?eH:Q,this}var QU=XU;function V9(X){var Q=-1,J=X==null?0:X.length;this.clear();while(++Q<J){var Y=X[Q];this.set(Y[0],Y[1])}}V9.prototype.clear=mH;V9.prototype.delete=cH;V9.prototype.get=rH;V9.prototype.has=tH;V9.prototype.set=QU;var r4=V9;function JU(){this.__data__=[],this.size=0}var YU=JU;function GU(X,Q){return X===Q||X!==X&&Q!==Q}var $U=GU;function WU(X,Q){var J=X.length;while(J--)if($U(X[J][0],Q))return J;return-1}var $6=WU,HU=Array.prototype,UU=HU.splice;function BU(X){var Q=this.__data__,J=$6(Q,X);if(J<0)return!1;var Y=Q.length-1;if(J==Y)Q.pop();else UU.call(Q,J,1);return--this.size,!0}var zU=BU;function LU(X){var Q=this.__data__,J=$6(Q,X);return J<0?void 0:Q[J][1]}var qU=LU;function FU(X){return $6(this.__data__,X)>-1}var KU=FU;function VU(X,Q){var J=this.__data__,Y=$6(J,X);if(Y<0)++this.size,J.push([X,Q]);else J[Y][1]=Q;return this}var MU=VU;function M9(X){var Q=-1,J=X==null?0:X.length;this.clear();while(++Q<J){var Y=X[Q];this.set(Y[0],Y[1])}}M9.prototype.clear=YU;M9.prototype.delete=zU;M9.prototype.get=qU;M9.prototype.has=KU;M9.prototype.set=MU;var DU=M9,ZU=x5(xX,"Map"),OU=ZU;function AU(){this.size=0,this.__data__={hash:new r4,map:new(OU||DU),string:new r4}}var NU=AU;function RU(X){var Q=typeof X;return Q=="string"||Q=="number"||Q=="symbol"||Q=="boolean"?X!=="__proto__":X===null}var IU=RU;function jU(X,Q){var J=X.__data__;return IU(Q)?J[typeof Q=="string"?"string":"hash"]:J.map}var W6=jU;function wU(X){var Q=W6(this,X).delete(X);return this.size-=Q?1:0,Q}var PU=wU;function TU(X){return W6(this,X).get(X)}var SU=TU;function EU(X){return W6(this,X).has(X)}var bU=EU;function CU(X,Q){var J=W6(this,X),Y=J.size;return J.set(X,Q),this.size+=J.size==Y?0:1,this}var _U=CU;function D9(X){var Q=-1,J=X==null?0:X.length;this.clear();while(++Q<J){var Y=X[Q];this.set(Y[0],Y[1])}}D9.prototype.clear=NU;D9.prototype.delete=PU;D9.prototype.get=SU;D9.prototype.has=bU;D9.prototype.set=_U;var g5=D9,kU="Expected a function";function gX(X,Q){if(typeof X!="function"||Q!=null&&typeof Q!="function")throw TypeError(kU);var J=function(){var Y=arguments,G=Q?Q.apply(this,Y):Y[0],$=J.cache;if($.has(G))return $.get(G);var W=X.apply(this,Y);return J.cache=$.set(G,W)||$,W};return J.cache=new(gX.Cache||g5),J}gX.Cache=g5;var J8=gX,o4=2000;function vU(X){if(process.stderr.destroyed)return;for(let Q=0;Q<X.length;Q+=o4)process.stderr.write(X.substring(Q,Q+o4))}var yU=J8((X)=>{if(!X||X.trim()==="")return null;let Q=X.split(",").map(($)=>$.trim()).filter(Boolean);if(Q.length===0)return null;let J=Q.some(($)=>$.startsWith("!")),Y=Q.some(($)=>!$.startsWith("!"));if(J&&Y)return null;let G=Q.map(($)=>$.replace(/^!/,"").toLowerCase());return{include:J?[]:G,exclude:J?G:[],isExclusive:J}});function xU(X){let Q=[],J=X.match(/^MCP server ["']([^"']+)["']/);if(J&&J[1])Q.push("mcp"),Q.push(J[1].toLowerCase());else{let $=X.match(/^([^:[]+):/);if($&&$[1])Q.push($[1].trim().toLowerCase())}let Y=X.match(/^\[([^\]]+)]/);if(Y&&Y[1])Q.push(Y[1].trim().toLowerCase());if(X.toLowerCase().includes("statsig event:"))Q.push("statsig");let G=X.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(G&&G[1]){let $=G[1].trim().toLowerCase();if($.length<30&&!$.includes(" "))Q.push($)}return Array.from(new Set(Q))}function gU(X,Q){if(!Q)return!0;if(X.length===0)return!1;if(Q.isExclusive)return!X.some((J)=>Q.exclude.includes(J));else return X.some((J)=>Q.include.includes(J))}function hU(X,Q){if(!Q)return!0;let J=xU(X);return gU(J,Q)}function h5(){return process.env.CLAUDE_CONFIG_DIR??fU(uU(),".claude")}function a4(X){if(!X)return!1;if(typeof X==="boolean")return X;let Q=X.toLowerCase().trim();return["1","true","yes","on"].includes(Q)}var OX=150000,x8=30000;function u5(X){return{name:X,default:x8,validate:(Q)=>{if(!Q)return{effective:x8,status:"valid"};let J=parseInt(Q,10);if(isNaN(J)||J<=0)return{effective:x8,status:"invalid",message:`Invalid value "${Q}" (using default: ${x8})`};if(J>OX)return{effective:OX,status:"capped",message:`Capped from ${J} to ${OX}`};return{effective:J,status:"valid"}}}}var pU=u5("BASH_MAX_OUTPUT_LENGTH"),_w=u5("TASK_MAX_OUTPUT_LENGTH"),dU={name:"CLAUDE_CODE_MAX_OUTPUT_TOKENS",default:32000,validate:(X)=>{if(!X)return{effective:32000,status:"valid"};let Y=parseInt(X,10);if(isNaN(Y)||Y<=0)return{effective:32000,status:"invalid",message:`Invalid value "${X}" (using default: 32000)`};if(Y>64000)return{effective:64000,status:"capped",message:`Capped from ${Y} to 64000`};return{effective:Y,status:"valid"}}};function iU(){let X="";if(typeof process<"u"&&typeof process.cwd==="function")X=lU(mU());return{originalCwd:X,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:X,modelUsage:{},mainLoopModelOverride:void 0,initialMainLoopModel:null,modelStrings:null,isInteractive:!1,clientType:"cli",sessionIngressToken:void 0,oauthTokenFromFd:void 0,apiKeyFromFd:void 0,flagSettingsPath:void 0,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,sessionId:cU(),loggerProvider:null,eventLogger:null,meterProvider:null,tracerProvider:null,agentColorMap:new Map,agentColorIndex:0,envVarValidators:[pU,dU],lastAPIRequest:null,inMemoryErrorLog:[],inlinePlugins:[],sessionBypassPermissionsMode:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,hasExitedDelegateMode:!1,needsDelegateModeExitAttachment:!1,lspRecommendationShownThisSession:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map,teleportedSessionInfo:null,invokedSkills:new Map,slowOperations:[],sdkBetas:void 0}}var i1=iU();function nU(){return i1.sessionId}var s4=10,rU=1e4;function m5(X,Q){return}function oU({writeFn:X,flushIntervalMs:Q=1000,maxBufferSize:J=100,immediateMode:Y=!1}){let G=[],$=null;function W(){if($)clearTimeout($),$=null}function H(){if(G.length===0)return;X(G.join("")),G=[],W()}function U(){if(!$)$=setTimeout(H,Q)}return{write(B){if(Y){X(B);return}if(G.push(B),U(),G.length>=J)H()},flush:H,dispose(){H()}}}var t4=new Set;function aU(X){return t4.add(X),()=>t4.delete(X)}var l5=1/0;function sU(X){if(X===null)return"null";if(X===void 0)return"undefined";if(Array.isArray(X))return`Array[${X.length}]`;if(typeof X==="object")return`Object{${Object.keys(X).length} keys}`;if(typeof X==="string")return`string(${X.length} chars)`;return typeof X}function c5(X,Q){let J=performance.now();try{return Q()}finally{let Y=performance.now()-J;if(Y>l5)R1(`[SLOW OPERATION DETECTED] ${X} (${Y.toFixed(1)}ms)`),m5(X,Y)}}function q1(X,Q,J){let Y=sU(X);return c5(`JSON.stringify(${Y})`,()=>JSON.stringify(X,Q,J))}var p5=(X,Q)=>{let J=typeof X==="string"?X.length:0;return c5(`JSON.parse(${J} chars)`,()=>JSON.parse(X,Q))},tU=J8(()=>{return a4(process.env.DEBUG)||a4(process.env.DEBUG_SDK)||process.argv.includes("--debug")||process.argv.includes("-d")||d5()||process.argv.some((X)=>X.startsWith("--debug="))}),eU=J8(()=>{let X=process.argv.find((J)=>J.startsWith("--debug="));if(!X)return null;let Q=X.substring(8);return yU(Q)}),d5=J8(()=>{return process.argv.includes("--debug-to-stderr")||process.argv.includes("-d2e")});function XB(X){if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let Q=eU();return hU(X,Q)}var QB=!1,g8=null;function JB(){if(!g8)g8=oU({writeFn:(X)=>{let Q=i5();if(!I1().existsSync(jX(Q)))I1().mkdirSync(jX(Q));I1().appendFileSync(Q,X),YB()},flushIntervalMs:1000,maxBufferSize:100,immediateMode:tU()}),aU(async()=>g8?.dispose());return g8}function R1(X,{level:Q}={level:"debug"}){if(!XB(X))return;if(QB&&X.includes(`
174
+ `))X=q1(X);let Y=`${new Date().toISOString()} [${Q.toUpperCase()}] ${X.trim()}
175
+ `;if(d5()){vU(Y);return}JB().write(Y)}function i5(){return process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??f5(h5(),"debug",`${nU()}.txt`)}var YB=J8(()=>{if(process.argv[2]==="--ripgrep")return;try{let X=i5(),Q=jX(X),J=f5(Q,"latest");if(!I1().existsSync(Q))I1().mkdirSync(Q);if(I1().existsSync(J))try{I1().unlinkSync(J)}catch{}I1().symlinkSync(X,J)}catch{}});function k0(X,Q){let J=performance.now();try{return Q()}finally{let Y=performance.now()-J;if(Y>l5)R1(`[SLOW OPERATION DETECTED] fs.${X} (${Y.toFixed(1)}ms)`),m5(`fs.${X}`,Y)}}var GB={cwd(){return process.cwd()},existsSync(X){return k0(`existsSync(${X})`,()=>W0.existsSync(X))},async stat(X){return oW(X)},statSync(X){return k0(`statSync(${X})`,()=>W0.statSync(X))},lstatSync(X){return k0(`lstatSync(${X})`,()=>W0.lstatSync(X))},readFileSync(X,Q){return k0(`readFileSync(${X})`,()=>W0.readFileSync(X,{encoding:Q.encoding}))},readFileBytesSync(X){return k0(`readFileBytesSync(${X})`,()=>W0.readFileSync(X))},readSync(X,Q){return k0(`readSync(${X}, ${Q.length} bytes)`,()=>{let J=void 0;try{J=W0.openSync(X,"r");let Y=Buffer.alloc(Q.length),G=W0.readSync(J,Y,0,Q.length,0);return{buffer:Y,bytesRead:G}}finally{if(J)W0.closeSync(J)}})},appendFileSync(X,Q,J){return k0(`appendFileSync(${X}, ${Q.length} chars)`,()=>{if(!W0.existsSync(X)&&J?.mode!==void 0){let Y=W0.openSync(X,"a",J.mode);try{W0.appendFileSync(Y,Q)}finally{W0.closeSync(Y)}}else W0.appendFileSync(X,Q)})},copyFileSync(X,Q){return k0(`copyFileSync(${X} → ${Q})`,()=>W0.copyFileSync(X,Q))},unlinkSync(X){return k0(`unlinkSync(${X})`,()=>W0.unlinkSync(X))},renameSync(X,Q){return k0(`renameSync(${X} → ${Q})`,()=>W0.renameSync(X,Q))},linkSync(X,Q){return k0(`linkSync(${X} → ${Q})`,()=>W0.linkSync(X,Q))},symlinkSync(X,Q){return k0(`symlinkSync(${X} → ${Q})`,()=>W0.symlinkSync(X,Q))},readlinkSync(X){return k0(`readlinkSync(${X})`,()=>W0.readlinkSync(X))},realpathSync(X){return k0(`realpathSync(${X})`,()=>W0.realpathSync(X))},mkdirSync(X,Q){return k0(`mkdirSync(${X})`,()=>{if(!W0.existsSync(X)){let J={recursive:!0};if(Q?.mode!==void 0)J.mode=Q.mode;W0.mkdirSync(X,J)}})},readdirSync(X){return k0(`readdirSync(${X})`,()=>W0.readdirSync(X,{withFileTypes:!0}))},readdirStringSync(X){return k0(`readdirStringSync(${X})`,()=>W0.readdirSync(X))},isDirEmptySync(X){return k0(`isDirEmptySync(${X})`,()=>{return this.readdirSync(X).length===0})},rmdirSync(X){return k0(`rmdirSync(${X})`,()=>W0.rmdirSync(X))},rmSync(X,Q){return k0(`rmSync(${X})`,()=>W0.rmSync(X,Q))},createWriteStream(X){return W0.createWriteStream(X)}},$B=GB;function I1(){return $B}class W9 extends Error{}function n5(){return process.versions.bun!==void 0}var h8=null,X5=!1;function zB(){if(X5)return h8;if(X5=!0,!process.env.DEBUG_CLAUDE_AGENT_SDK)return null;let X=e4(h5(),"debug");if(h8=e4(X,`sdk-${WB()}.txt`),!UB(X))BB(X,{recursive:!0});return process.stderr.write(`SDK debug logs: ${h8}
176
+ `),h8}function d1(X){let Q=zB();if(!Q)return;let Y=`${new Date().toISOString()} ${X}
177
+ `;HB(Q,Y)}function LB(X,Q){let J={...X};if(Q){let Y={sandbox:Q};if(J.settings)try{Y={...p5(J.settings),sandbox:Q}}catch{}J.settings=q1(Y)}return J}class r5{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitListeners=[];processExitHandler;abortHandler;constructor(X){this.options=X,this.abortController=X.abortController||k5(),this.initialize()}getDefaultExecutable(){return n5()?"bun":"node"}spawnLocalProcess(X){let{command:Q,args:J,cwd:Y,env:G,signal:$}=X,W=G.DEBUG_CLAUDE_AGENT_SDK||this.options.stderr?"pipe":"ignore",H=nW(Q,J,{cwd:Y,stdio:["pipe","pipe",W],signal:$,env:G,windowsHide:!0});if(G.DEBUG_CLAUDE_AGENT_SDK||this.options.stderr)H.stderr.on("data",(B)=>{let q=B.toString();if(d1(q),this.options.stderr)this.options.stderr(q)});return{stdin:H.stdin,stdout:H.stdout,get killed(){return H.killed},get exitCode(){return H.exitCode},kill:H.kill.bind(H),on:H.on.bind(H),once:H.once.bind(H),off:H.off.bind(H)}}initialize(){try{let{additionalDirectories:X=[],betas:Q,cwd:J,executable:Y=this.getDefaultExecutable(),executableArgs:G=[],extraArgs:$={},pathToClaudeCodeExecutable:W,env:H={...process.env},maxThinkingTokens:U,maxTurns:B,maxBudgetUsd:q,model:K,fallbackModel:V,jsonSchema:N,permissionMode:w,allowDangerouslySkipPermissions:A,permissionPromptToolName:Z,continueConversation:z,resume:M,settingSources:F,allowedTools:L=[],disallowedTools:O=[],tools:D,mcpServers:I,strictMcpConfig:j,canUseTool:E,includePartialMessages:g,plugins:k,sandbox:x}=this.options,u=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(U!==void 0)u.push("--max-thinking-tokens",U.toString());if(B)u.push("--max-turns",B.toString());if(q!==void 0)u.push("--max-budget-usd",q.toString());if(K)u.push("--model",K);if(Q&&Q.length>0)u.push("--betas",Q.join(","));if(N)u.push("--json-schema",q1(N));if(H.DEBUG_CLAUDE_AGENT_SDK)u.push("--debug-to-stderr");if(E){if(Z)throw Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");u.push("--permission-prompt-tool","stdio")}else if(Z)u.push("--permission-prompt-tool",Z);if(z)u.push("--continue");if(M)u.push("--resume",M);if(L.length>0)u.push("--allowedTools",L.join(","));if(O.length>0)u.push("--disallowedTools",O.join(","));if(D!==void 0)if(Array.isArray(D))if(D.length===0)u.push("--tools","");else u.push("--tools",D.join(","));else u.push("--tools","default");if(I&&Object.keys(I).length>0)u.push("--mcp-config",q1({mcpServers:I}));if(F)u.push("--setting-sources",F.join(","));if(j)u.push("--strict-mcp-config");if(w)u.push("--permission-mode",w);if(A)u.push("--allow-dangerously-skip-permissions");if(V){if(K&&V===K)throw Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");u.push("--fallback-model",V)}if(g)u.push("--include-partial-messages");for(let S of X)u.push("--add-dir",S);if(k&&k.length>0)for(let S of k)if(S.type==="local")u.push("--plugin-dir",S.path);else throw Error(`Unsupported plugin type: ${S.type}`);if(this.options.forkSession)u.push("--fork-session");if(this.options.resumeSessionAt)u.push("--resume-session-at",this.options.resumeSessionAt);if(this.options.persistSession===!1)u.push("--no-session-persistence");let l=LB($??{},x);for(let[S,b]of Object.entries(l))if(b===null)u.push(`--${S}`);else u.push(`--${S}`,b);if(!H.CLAUDE_CODE_ENTRYPOINT)H.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(delete H.NODE_OPTIONS,H.DEBUG_CLAUDE_AGENT_SDK)H.DEBUG="1";else delete H.DEBUG;let Y0=qB(W),O0=Y0?W:Y,_0=Y0?[...G,...u]:[...G,W,...u],h0={command:O0,args:_0,cwd:J,env:H,signal:this.abortController.signal};if(this.options.spawnClaudeCodeProcess)d1(`Spawning Claude Code (custom): ${O0} ${_0.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(h0);else{if(!I1().existsSync(W)){let b=Y0?`Claude Code native binary not found at ${W}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${W}. Is options.pathToClaudeCodeExecutable set?`;throw ReferenceError(b)}d1(`Spawning Claude Code: ${O0} ${_0.join(" ")}`),this.process=this.spawnLocalProcess(h0)}this.processStdin=this.process.stdin,this.processStdout=this.process.stdout;let q0=()=>{if(this.process&&!this.process.killed)this.process.kill("SIGTERM")};this.processExitHandler=q0,this.abortHandler=q0,process.on("exit",this.processExitHandler),this.abortController.signal.addEventListener("abort",this.abortHandler),this.process.on("error",(S)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new W9("Claude Code process aborted by user");else this.exitError=Error(`Failed to spawn Claude Code process: ${S.message}`),d1(this.exitError.message)}),this.process.on("exit",(S,b)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new W9("Claude Code process aborted by user");else{let f=this.getProcessExitError(S,b);if(f)this.exitError=f,d1(f.message)}}),this.ready=!0}catch(X){throw this.ready=!1,X}}getProcessExitError(X,Q){if(X!==0&&X!==null)return Error(`Claude Code process exited with code ${X}`);else if(Q)return Error(`Claude Code process terminated by signal ${Q}`);return}write(X){if(this.abortController.signal.aborted)throw new W9("Operation aborted");if(!this.ready||!this.processStdin)throw Error("ProcessTransport is not ready for writing");if(this.process?.killed||this.process?.exitCode!==null)throw Error("Cannot write to terminated process");if(this.exitError)throw Error(`Cannot write to process that exited with error: ${this.exitError.message}`);d1(`[ProcessTransport] Writing to stdin: ${X.substring(0,100)}`);try{if(!this.processStdin.write(X))d1("[ProcessTransport] Write buffer full, data queued")}catch(Q){throw this.ready=!1,Error(`Failed to write to process stdin: ${Q.message}`)}}close(){if(this.processStdin)this.processStdin.end(),this.processStdin=void 0;if(this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;for(let{handler:X}of this.exitListeners)this.process?.off("exit",X);if(this.exitListeners=[],this.process&&!this.process.killed)this.process.kill("SIGTERM"),setTimeout(()=>{if(this.process&&!this.process.killed)this.process.kill("SIGKILL")},5000);if(this.ready=!1,this.processExitHandler)process.off("exit",this.processExitHandler),this.processExitHandler=void 0}isReady(){return this.ready}async*readMessages(){if(!this.processStdout)throw Error("ProcessTransport output stream not available");let X=rW({input:this.processStdout});try{for await(let Q of X)if(Q.trim())yield p5(Q);await this.waitForExit()}catch(Q){throw Q}finally{X.close()}}endInput(){if(this.processStdin)this.processStdin.end()}getInputStream(){return this.processStdin}onExit(X){if(!this.process)return()=>{};let Q=(J,Y)=>{let G=this.getProcessExitError(J,Y);X(G)};return this.process.on("exit",Q),this.exitListeners.push({callback:X,handler:Q}),()=>{if(this.process)this.process.off("exit",Q);let J=this.exitListeners.findIndex((Y)=>Y.handler===Q);if(J!==-1)this.exitListeners.splice(J,1)}}async waitForExit(){if(!this.process){if(this.exitError)throw this.exitError;return}if(this.process.exitCode!==null||this.process.killed){if(this.exitError)throw this.exitError;return}return new Promise((X,Q)=>{let J=(G,$)=>{if(this.abortController.signal.aborted){Q(new W9("Operation aborted"));return}let W=this.getProcessExitError(G,$);if(W)Q(W);else X()};this.process.once("exit",J);let Y=(G)=>{this.process.off("exit",J),Q(G)};this.process.once("error",Y),this.process.once("exit",()=>{this.process.off("error",Y)})})}}function qB(X){return![".js",".mjs",".tsx",".ts",".jsx"].some((J)=>X.endsWith(J))}class o5{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(X){this.returned=X}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){if(this.queue.length>0)return Promise.resolve({done:!1,value:this.queue.shift()});if(this.isDone)return Promise.resolve({done:!0,value:void 0});if(this.hasError)return Promise.reject(this.hasError);return new Promise((X,Q)=>{this.readResolve=X,this.readReject=Q})}enqueue(X){if(this.readResolve){let Q=this.readResolve;this.readResolve=void 0,this.readReject=void 0,Q({done:!1,value:X})}else this.queue.push(X)}done(){if(this.isDone=!0,this.readResolve){let X=this.readResolve;this.readResolve=void 0,this.readReject=void 0,X({done:!0,value:void 0})}}error(X){if(this.hasError=X,this.readReject){let Q=this.readReject;this.readResolve=void 0,this.readReject=void 0,Q(X)}}return(){if(this.isDone=!0,this.returned)this.returned();return Promise.resolve({done:!0,value:void 0})}}class a5{sendMcpMessage;isClosed=!1;constructor(X){this.sendMcpMessage=X}onclose;onerror;onmessage;async start(){}async send(X){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(X)}async close(){if(this.isClosed)return;this.isClosed=!0,this.onclose?.()}}class s5{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new o5;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0}constructor(X,Q,J,Y,G,$=new Map,W,H){this.transport=X,this.isSingleUserTurn=Q,this.canUseTool=J,this.hooks=Y,this.abortController=G,this.jsonSchema=W,this.initConfig=H;for(let[U,B]of $)this.connectSdkMcpServer(U,B);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(X){this.inputStream.error(X)}cleanup(X){if(this.cleanupPerformed)return;this.cleanupPerformed=!0;try{this.transport.close(),this.pendingControlResponses.clear(),this.pendingMcpResponses.clear(),this.cancelControllers.clear(),this.hookCallbacks.clear();for(let Q of this.sdkMcpTransports.values())try{Q.close()}catch{}if(this.sdkMcpTransports.clear(),X)this.inputStream.error(X);else this.inputStream.done()}catch(Q){}}next(...[X]){return this.sdkMessages.next(...[X])}return(X){return this.sdkMessages.return(X)}throw(X){return this.sdkMessages.throw(X)}[Symbol.asyncIterator](){return this.sdkMessages}[Symbol.asyncDispose](){return this.sdkMessages[Symbol.asyncDispose]()}async readMessages(){try{for await(let X of this.transport.readMessages()){if(X.type==="control_response"){let Q=this.pendingControlResponses.get(X.response.request_id);if(Q)Q(X.response);continue}else if(X.type==="control_request"){this.handleControlRequest(X);continue}else if(X.type==="control_cancel_request"){this.handleControlCancelRequest(X);continue}else if(X.type==="keep_alive")continue;if(X.type==="result"){if(this.firstResultReceived=!0,this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.isSingleUserTurn)R1("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput()}this.inputStream.enqueue(X)}if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();this.inputStream.done(),this.cleanup()}catch(X){if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();this.inputStream.error(X),this.cleanup(X)}}async handleControlRequest(X){let Q=new AbortController;this.cancelControllers.set(X.request_id,Q);try{let J=await this.processControlRequest(X,Q.signal),Y={type:"control_response",response:{subtype:"success",request_id:X.request_id,response:J}};await Promise.resolve(this.transport.write(q1(Y)+`
178
+ `))}catch(J){let Y={type:"control_response",response:{subtype:"error",request_id:X.request_id,error:J.message||String(J)}};await Promise.resolve(this.transport.write(q1(Y)+`
179
+ `))}finally{this.cancelControllers.delete(X.request_id)}}handleControlCancelRequest(X){let Q=this.cancelControllers.get(X.request_id);if(Q)Q.abort(),this.cancelControllers.delete(X.request_id)}async processControlRequest(X,Q){if(X.request.subtype==="can_use_tool"){if(!this.canUseTool)throw Error("canUseTool callback is not provided.");return{...await this.canUseTool(X.request.tool_name,X.request.input,{signal:Q,suggestions:X.request.permission_suggestions,blockedPath:X.request.blocked_path,decisionReason:X.request.decision_reason,toolUseID:X.request.tool_use_id,agentID:X.request.agent_id}),toolUseID:X.request.tool_use_id}}else if(X.request.subtype==="hook_callback")return await this.handleHookCallbacks(X.request.callback_id,X.request.input,X.request.tool_use_id,Q);else if(X.request.subtype==="mcp_message"){let J=X.request,Y=this.sdkMcpTransports.get(J.server_name);if(!Y)throw Error(`SDK MCP server not found: ${J.server_name}`);if("method"in J.message&&"id"in J.message&&J.message.id!==null)return{mcp_response:await this.handleMcpControlRequest(J.server_name,J,Y)};else{if(Y.onmessage)Y.onmessage(J.message);return{mcp_response:{jsonrpc:"2.0",result:{},id:0}}}}throw Error("Unsupported control request subtype: "+X.request.subtype)}async*readSdkMessages(){for await(let X of this.inputStream)yield X}async initialize(){let X;if(this.hooks){X={};for(let[G,$]of Object.entries(this.hooks))if($.length>0)X[G]=$.map((W)=>{let H=[];for(let U of W.hooks){let B=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(B,U),H.push(B)}return{matcher:W.matcher,hookCallbackIds:H,timeout:W.timeout}})}let Q=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,J={subtype:"initialize",hooks:X,sdkMcpServers:Q,jsonSchema:this.jsonSchema,systemPrompt:this.initConfig?.systemPrompt,appendSystemPrompt:this.initConfig?.appendSystemPrompt,agents:this.initConfig?.agents};return(await this.request(J)).response}async interrupt(){await this.request({subtype:"interrupt"})}async setPermissionMode(X){await this.request({subtype:"set_permission_mode",mode:X})}async setModel(X){await this.request({subtype:"set_model",model:X})}async setMaxThinkingTokens(X){await this.request({subtype:"set_max_thinking_tokens",max_thinking_tokens:X})}async rewindFiles(X,Q){return(await this.request({subtype:"rewind_files",user_message_id:X,dry_run:Q?.dryRun})).response}async processPendingPermissionRequests(X){for(let Q of X)if(Q.request.subtype==="can_use_tool")this.handleControlRequest(Q).catch(()=>{})}request(X){let Q=Math.random().toString(36).substring(2,15),J={request_id:Q,type:"control_request",request:X};return new Promise((Y,G)=>{this.pendingControlResponses.set(Q,($)=>{if($.subtype==="success")Y($);else if(G(Error($.error)),$.pending_permission_requests)this.processPendingPermissionRequests($.pending_permission_requests)}),Promise.resolve(this.transport.write(q1(J)+`
180
+ `))})}async supportedCommands(){return(await this.initialization).commands}async supportedModels(){return(await this.initialization).models}async mcpServerStatus(){return(await this.request({subtype:"mcp_status"})).response.mcpServers}async setMcpServers(X){let Q={},J={};for(let[H,U]of Object.entries(X))if(U.type==="sdk"&&"instance"in U)Q[H]=U.instance;else J[H]=U;let Y=new Set(this.sdkMcpServerInstances.keys()),G=new Set(Object.keys(Q));for(let H of Y)if(!G.has(H))await this.disconnectSdkMcpServer(H);for(let[H,U]of Object.entries(Q))if(!Y.has(H))this.connectSdkMcpServer(H,U);let $={};for(let H of Object.keys(Q))$[H]={type:"sdk",name:H};return(await this.request({subtype:"mcp_set_servers",servers:{...J,...$}})).response}async accountInfo(){return(await this.initialization).account}async streamInput(X){R1("[Query.streamInput] Starting to process input stream");try{let Q=0;for await(let J of X){if(Q++,R1(`[Query.streamInput] Processing message ${Q}: ${J.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(q1(J)+`
181
+ `))}if(R1(`[Query.streamInput] Finished processing ${Q} messages from input stream`),Q>0&&this.hasBidirectionalNeeds())R1("[Query.streamInput] Has bidirectional needs, waiting for first result"),await this.waitForFirstResult();R1("[Query] Calling transport.endInput() to close stdin to CLI process"),this.transport.endInput()}catch(Q){if(!(Q instanceof W9))throw Q}}waitForFirstResult(){if(this.firstResultReceived)return R1("[Query.waitForFirstResult] Result already received, returning immediately"),Promise.resolve();return new Promise((X)=>{if(this.abortController?.signal.aborted){X();return}this.abortController?.signal.addEventListener("abort",()=>X(),{once:!0}),this.firstResultReceivedResolve=X})}handleHookCallbacks(X,Q,J,Y){let G=this.hookCallbacks.get(X);if(!G)throw Error(`No hook callback found for ID: ${X}`);return G(Q,J,{signal:Y})}connectSdkMcpServer(X,Q){let J=new a5((Y)=>this.sendMcpServerMessageToCli(X,Y));this.sdkMcpTransports.set(X,J),this.sdkMcpServerInstances.set(X,Q),Q.connect(J)}async disconnectSdkMcpServer(X){let Q=this.sdkMcpTransports.get(X);if(Q)await Q.close(),this.sdkMcpTransports.delete(X);this.sdkMcpServerInstances.delete(X)}sendMcpServerMessageToCli(X,Q){if("id"in Q&&Q.id!==null&&Q.id!==void 0){let Y=`${X}:${Q.id}`,G=this.pendingMcpResponses.get(Y);if(G){G.resolve(Q),this.pendingMcpResponses.delete(Y);return}}let J={type:"control_request",request_id:FB(),request:{subtype:"mcp_message",server_name:X,message:Q}};this.transport.write(q1(J)+`
182
+ `)}handleMcpControlRequest(X,Q,J){let Y="id"in Q.message?Q.message.id:null,G=`${X}:${Y}`;return new Promise(($,W)=>{let H=()=>{this.pendingMcpResponses.delete(G)},U=(q)=>{H(),$(q)},B=(q)=>{H(),W(q)};if(this.pendingMcpResponses.set(G,{resolve:U,reject:B}),J.onmessage)J.onmessage(Q.message);else{H(),W(Error("No message handler registered"));return}})}}var V0;(function(X){X.assertEqual=(G)=>{};function Q(G){}X.assertIs=Q;function J(G){throw Error()}X.assertNever=J,X.arrayToEnum=(G)=>{let $={};for(let W of G)$[W]=W;return $},X.getValidEnumValues=(G)=>{let $=X.objectKeys(G).filter((H)=>typeof G[G[H]]!=="number"),W={};for(let H of $)W[H]=G[H];return X.objectValues(W)},X.objectValues=(G)=>{return X.objectKeys(G).map(function($){return G[$]})},X.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let $=[];for(let W in G)if(Object.prototype.hasOwnProperty.call(G,W))$.push(W);return $},X.find=(G,$)=>{for(let W of G)if($(W))return W;return},X.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&Number.isFinite(G)&&Math.floor(G)===G;function Y(G,$=" | "){return G.map((W)=>typeof W==="string"?`'${W}'`:W).join($)}X.joinValues=Y,X.jsonStringifyReplacer=(G,$)=>{if(typeof $==="bigint")return $.toString();return $}})(V0||(V0={}));var Q5;(function(X){X.mergeShapes=(Q,J)=>{return{...Q,...J}}})(Q5||(Q5={}));var n=V0.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),C1=(X)=>{switch(typeof X){case"undefined":return n.undefined;case"string":return n.string;case"number":return Number.isNaN(X)?n.nan:n.number;case"boolean":return n.boolean;case"function":return n.function;case"bigint":return n.bigint;case"symbol":return n.symbol;case"object":if(Array.isArray(X))return n.array;if(X===null)return n.null;if(X.then&&typeof X.then==="function"&&X.catch&&typeof X.catch==="function")return n.promise;if(typeof Map<"u"&&X instanceof Map)return n.map;if(typeof Set<"u"&&X instanceof Set)return n.set;if(typeof Date<"u"&&X instanceof Date)return n.date;return n.object;default:return n.unknown}},m=V0.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class e0 extends Error{get errors(){return this.issues}constructor(X){super();this.issues=[],this.addIssue=(J)=>{this.issues=[...this.issues,J]},this.addIssues=(J=[])=>{this.issues=[...this.issues,...J]};let Q=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,Q);else this.__proto__=Q;this.name="ZodError",this.issues=X}format(X){let Q=X||function(G){return G.message},J={_errors:[]},Y=(G)=>{for(let $ of G.issues)if($.code==="invalid_union")$.unionErrors.map(Y);else if($.code==="invalid_return_type")Y($.returnTypeError);else if($.code==="invalid_arguments")Y($.argumentsError);else if($.path.length===0)J._errors.push(Q($));else{let W=J,H=0;while(H<$.path.length){let U=$.path[H];if(H!==$.path.length-1)W[U]=W[U]||{_errors:[]};else W[U]=W[U]||{_errors:[]},W[U]._errors.push(Q($));W=W[U],H++}}};return Y(this),J}static assert(X){if(!(X instanceof e0))throw Error(`Not a ZodError: ${X}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,V0.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(X=(Q)=>Q.message){let Q={},J=[];for(let Y of this.issues)if(Y.path.length>0){let G=Y.path[0];Q[G]=Q[G]||[],Q[G].push(X(Y))}else J.push(X(Y));return{formErrors:J,fieldErrors:Q}}get formErrors(){return this.flatten()}}e0.create=(X)=>{return new e0(X)};var KB=(X,Q)=>{let J;switch(X.code){case m.invalid_type:if(X.received===n.undefined)J="Required";else J=`Expected ${X.expected}, received ${X.received}`;break;case m.invalid_literal:J=`Invalid literal value, expected ${JSON.stringify(X.expected,V0.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:J=`Unrecognized key(s) in object: ${V0.joinValues(X.keys,", ")}`;break;case m.invalid_union:J="Invalid input";break;case m.invalid_union_discriminator:J=`Invalid discriminator value. Expected ${V0.joinValues(X.options)}`;break;case m.invalid_enum_value:J=`Invalid enum value. Expected ${V0.joinValues(X.options)}, received '${X.received}'`;break;case m.invalid_arguments:J="Invalid function arguments";break;case m.invalid_return_type:J="Invalid function return type";break;case m.invalid_date:J="Invalid date";break;case m.invalid_string:if(typeof X.validation==="object")if("includes"in X.validation){if(J=`Invalid input: must include "${X.validation.includes}"`,typeof X.validation.position==="number")J=`${J} at one or more positions greater than or equal to ${X.validation.position}`}else if("startsWith"in X.validation)J=`Invalid input: must start with "${X.validation.startsWith}"`;else if("endsWith"in X.validation)J=`Invalid input: must end with "${X.validation.endsWith}"`;else V0.assertNever(X.validation);else if(X.validation!=="regex")J=`Invalid ${X.validation}`;else J="Invalid";break;case m.too_small:if(X.type==="array")J=`Array must contain ${X.exact?"exactly":X.inclusive?"at least":"more than"} ${X.minimum} element(s)`;else if(X.type==="string")J=`String must contain ${X.exact?"exactly":X.inclusive?"at least":"over"} ${X.minimum} character(s)`;else if(X.type==="number")J=`Number must be ${X.exact?"exactly equal to ":X.inclusive?"greater than or equal to ":"greater than "}${X.minimum}`;else if(X.type==="bigint")J=`Number must be ${X.exact?"exactly equal to ":X.inclusive?"greater than or equal to ":"greater than "}${X.minimum}`;else if(X.type==="date")J=`Date must be ${X.exact?"exactly equal to ":X.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(X.minimum))}`;else J="Invalid input";break;case m.too_big:if(X.type==="array")J=`Array must contain ${X.exact?"exactly":X.inclusive?"at most":"less than"} ${X.maximum} element(s)`;else if(X.type==="string")J=`String must contain ${X.exact?"exactly":X.inclusive?"at most":"under"} ${X.maximum} character(s)`;else if(X.type==="number")J=`Number must be ${X.exact?"exactly":X.inclusive?"less than or equal to":"less than"} ${X.maximum}`;else if(X.type==="bigint")J=`BigInt must be ${X.exact?"exactly":X.inclusive?"less than or equal to":"less than"} ${X.maximum}`;else if(X.type==="date")J=`Date must be ${X.exact?"exactly":X.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(X.maximum))}`;else J="Invalid input";break;case m.custom:J="Invalid input";break;case m.invalid_intersection_types:J="Intersection results could not be merged";break;case m.not_multiple_of:J=`Number must be a multiple of ${X.multipleOf}`;break;case m.not_finite:J="Number must be finite";break;default:J=Q.defaultError,V0.assertNever(X)}return{message:J}},l9=KB,VB=l9;function wX(){return VB}var PX=(X)=>{let{data:Q,path:J,errorMaps:Y,issueData:G}=X,$=[...J,...G.path||[]],W={...G,path:$};if(G.message!==void 0)return{...G,path:$,message:G.message};let H="",U=Y.filter((B)=>!!B).slice().reverse();for(let B of U)H=B(W,{data:Q,defaultError:H}).message;return{...G,path:$,message:H}};function d(X,Q){let J=wX(),Y=PX({issueData:Q,data:X.data,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,J,J===l9?void 0:l9].filter((G)=>!!G)});X.common.issues.push(Y)}class d0{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(X,Q){let J=[];for(let Y of Q){if(Y.status==="aborted")return G0;if(Y.status==="dirty")X.dirty();J.push(Y.value)}return{status:X.value,value:J}}static async mergeObjectAsync(X,Q){let J=[];for(let Y of Q){let G=await Y.key,$=await Y.value;J.push({key:G,value:$})}return d0.mergeObjectSync(X,J)}static mergeObjectSync(X,Q){let J={};for(let Y of Q){let{key:G,value:$}=Y;if(G.status==="aborted")return G0;if($.status==="aborted")return G0;if(G.status==="dirty")X.dirty();if($.status==="dirty")X.dirty();if(G.value!=="__proto__"&&(typeof $.value<"u"||Y.alwaysSet))J[G.value]=$.value}return{status:X.value,value:J}}}var G0=Object.freeze({status:"aborted"}),h9=(X)=>({status:"dirty",value:X}),n0=(X)=>({status:"valid",value:X}),J5=(X)=>X.status==="aborted",Y5=(X)=>X.status==="dirty",U9=(X)=>X.status==="valid",d8=(X)=>typeof Promise<"u"&&X instanceof Promise,o;(function(X){X.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},X.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(o||(o={}));class $1{constructor(X,Q,J,Y){this._cachedPath=[],this.parent=X,this.data=Q,this._path=J,this._key=Y}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var G5=(X,Q)=>{if(U9(Q))return{success:!0,data:Q.value};else{if(!X.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let J=new e0(X.common.issues);return this._error=J,this._error}}}};function H0(X){if(!X)return{};let{errorMap:Q,invalid_type_error:J,required_error:Y,description:G}=X;if(Q&&(J||Y))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(Q)return{errorMap:Q,description:G};return{errorMap:(W,H)=>{let{message:U}=X;if(W.code==="invalid_enum_value")return{message:U??H.defaultError};if(typeof H.data>"u")return{message:U??Y??H.defaultError};if(W.code!=="invalid_type")return{message:H.defaultError};return{message:U??J??H.defaultError}},description:G}}class L0{get description(){return this._def.description}_getType(X){return C1(X.data)}_getOrReturnCtx(X,Q){return Q||{common:X.parent.common,data:X.data,parsedType:C1(X.data),schemaErrorMap:this._def.errorMap,path:X.path,parent:X.parent}}_processInputParams(X){return{status:new d0,ctx:{common:X.parent.common,data:X.data,parsedType:C1(X.data),schemaErrorMap:this._def.errorMap,path:X.path,parent:X.parent}}}_parseSync(X){let Q=this._parse(X);if(d8(Q))throw Error("Synchronous parse encountered promise.");return Q}_parseAsync(X){let Q=this._parse(X);return Promise.resolve(Q)}parse(X,Q){let J=this.safeParse(X,Q);if(J.success)return J.data;throw J.error}safeParse(X,Q){let J={common:{issues:[],async:Q?.async??!1,contextualErrorMap:Q?.errorMap},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:X,parsedType:C1(X)},Y=this._parseSync({data:X,path:J.path,parent:J});return G5(J,Y)}"~validate"(X){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:X,parsedType:C1(X)};if(!this["~standard"].async)try{let J=this._parseSync({data:X,path:[],parent:Q});return U9(J)?{value:J.value}:{issues:Q.common.issues}}catch(J){if(J?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;Q.common={issues:[],async:!0}}return this._parseAsync({data:X,path:[],parent:Q}).then((J)=>U9(J)?{value:J.value}:{issues:Q.common.issues})}async parseAsync(X,Q){let J=await this.safeParseAsync(X,Q);if(J.success)return J.data;throw J.error}async safeParseAsync(X,Q){let J={common:{issues:[],contextualErrorMap:Q?.errorMap,async:!0},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:X,parsedType:C1(X)},Y=this._parse({data:X,path:J.path,parent:J}),G=await(d8(Y)?Y:Promise.resolve(Y));return G5(J,G)}refine(X,Q){let J=(Y)=>{if(typeof Q==="string"||typeof Q>"u")return{message:Q};else if(typeof Q==="function")return Q(Y);else return Q};return this._refinement((Y,G)=>{let $=X(Y),W=()=>G.addIssue({code:m.custom,...J(Y)});if(typeof Promise<"u"&&$ instanceof Promise)return $.then((H)=>{if(!H)return W(),!1;else return!0});if(!$)return W(),!1;else return!0})}refinement(X,Q){return this._refinement((J,Y)=>{if(!X(J))return Y.addIssue(typeof Q==="function"?Q(J,Y):Q),!1;else return!0})}_refinement(X){return new M1({schema:this,typeName:$0.ZodEffects,effect:{type:"refinement",refinement:X}})}superRefine(X){return this._refinement(X)}constructor(X){this.spa=this.safeParseAsync,this._def=X,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(Q)=>this["~validate"](Q)}}optional(){return K1.create(this,this._def)}nullable(){return k1.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return F1.create(this)}promise(){return q9.create(this,this._def)}or(X){return i9.create([this,X],this._def)}and(X){return n9.create(this,X,this._def)}transform(X){return new M1({...H0(this._def),schema:this,typeName:$0.ZodEffects,effect:{type:"transform",transform:X}})}default(X){let Q=typeof X==="function"?X:()=>X;return new s9({...H0(this._def),innerType:this,defaultValue:Q,typeName:$0.ZodDefault})}brand(){return new fX({typeName:$0.ZodBranded,type:this,...H0(this._def)})}catch(X){let Q=typeof X==="function"?X:()=>X;return new t9({...H0(this._def),innerType:this,catchValue:Q,typeName:$0.ZodCatch})}describe(X){return new this.constructor({...this._def,description:X})}pipe(X){return H6.create(this,X)}readonly(){return e9.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var MB=/^c[^\s-]{8,}$/i,DB=/^[0-9a-z]+$/,ZB=/^[0-9A-HJKMNP-TV-Z]{26}$/i,OB=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,AB=/^[a-z0-9_-]{21}$/i,NB=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,RB=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,IB=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jB="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",AX,wB=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,PB=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,TB=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,SB=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,EB=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,bB=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,t5="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",CB=new RegExp(`^${t5}$`);function e5(X){let Q="[0-5]\\d";if(X.precision)Q=`${Q}\\.\\d{${X.precision}}`;else if(X.precision==null)Q=`${Q}(\\.\\d+)?`;let J=X.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${Q})${J}`}function _B(X){return new RegExp(`^${e5(X)}$`)}function kB(X){let Q=`${t5}T${e5(X)}`,J=[];if(J.push(X.local?"Z?":"Z"),X.offset)J.push("([+-]\\d{2}:?\\d{2})");return Q=`${Q}(${J.join("|")})`,new RegExp(`^${Q}$`)}function vB(X,Q){if((Q==="v4"||!Q)&&wB.test(X))return!0;if((Q==="v6"||!Q)&&TB.test(X))return!0;return!1}function yB(X,Q){if(!NB.test(X))return!1;try{let[J]=X.split(".");if(!J)return!1;let Y=J.replace(/-/g,"+").replace(/_/g,"/").padEnd(J.length+(4-J.length%4)%4,"="),G=JSON.parse(atob(Y));if(typeof G!=="object"||G===null)return!1;if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(Q&&G.alg!==Q)return!1;return!0}catch{return!1}}function xB(X,Q){if((Q==="v4"||!Q)&&PB.test(X))return!0;if((Q==="v6"||!Q)&&SB.test(X))return!0;return!1}class j1 extends L0{_parse(X){if(this._def.coerce)X.data=String(X.data);if(this._getType(X)!==n.string){let G=this._getOrReturnCtx(X);return d(G,{code:m.invalid_type,expected:n.string,received:G.parsedType}),G0}let J=new d0,Y=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(X.data.length<G.value)Y=this._getOrReturnCtx(X,Y),d(Y,{code:m.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),J.dirty()}else if(G.kind==="max"){if(X.data.length>G.value)Y=this._getOrReturnCtx(X,Y),d(Y,{code:m.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),J.dirty()}else if(G.kind==="length"){let $=X.data.length>G.value,W=X.data.length<G.value;if($||W){if(Y=this._getOrReturnCtx(X,Y),$)d(Y,{code:m.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(W)d(Y,{code:m.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});J.dirty()}}else if(G.kind==="email"){if(!IB.test(X.data))Y=this._getOrReturnCtx(X,Y),d(Y,{validation:"email",code:m.invalid_string,message:G.message}),J.dirty()}else if(G.kind==="emoji"){if(!AX)AX=new RegExp(jB,"u");if(!AX.test(X.data))Y=this._getOrReturnCtx(X,Y),d(Y,{validation:"emoji",code:m.invalid_string,message:G.message}),J.dirty()}else if(G.kind==="uuid"){if(!OB.test(X.data))Y=this._getOrReturnCtx(X,Y),d(Y,{validation:"uuid",code:m.invalid_string,message:G.message}),J.dirty()}else if(G.kind==="nanoid"){if(!AB.test(X.data))Y=this._getOrReturnCtx(X,Y),d(Y,{validation:"nanoid",code:m.invalid_string,message:G.message}),J.dirty()}else if(G.kind==="cuid"){if(!MB.test(X.data))Y=this._getOrReturnCtx(X,Y),d(Y,{validation:"cuid",code:m.invalid_string,message:G.message}),J.dirty()}else if(G.kind==="cuid2"){if(!DB.test(X.data))Y=this._getOrReturnCtx(X,Y),d(Y,{validation:"cuid2",code:m.invalid_string,message:G.message}),J.dirty()}else if(G.kind==="ulid"){if(!ZB.test(X.data))Y=this._getOrReturnCtx(X,Y),d(Y,{validation:"ulid",code:m.invalid_string,message:G.message}),J.dirty()}else if(G.kind==="url")try{new URL(X.data)}catch{Y=this._getOrReturnCtx(X,Y),d(Y,{validation:"url",code:m.invalid_string,message:G.message}),J.dirty()}else if(G.kind==="regex"){if(G.regex.lastIndex=0,!G.regex.test(X.data))Y=this._getOrReturnCtx(X,Y),d(Y,{validation:"regex",code:m.invalid_string,message:G.message}),J.dirty()}else if(G.kind==="trim")X.data=X.data.trim();else if(G.kind==="includes"){if(!X.data.includes(G.value,G.position))Y=this._getOrReturnCtx(X,Y),d(Y,{code:m.invalid_string,validation:{includes:G.value,position:G.position},message:G.message}),J.dirty()}else if(G.kind==="toLowerCase")X.data=X.data.toLowerCase();else if(G.kind==="toUpperCase")X.data=X.data.toUpperCase();else if(G.kind==="startsWith"){if(!X.data.startsWith(G.value))Y=this._getOrReturnCtx(X,Y),d(Y,{code:m.invalid_string,validation:{startsWith:G.value},message:G.message}),J.dirty()}else if(G.kind==="endsWith"){if(!X.data.endsWith(G.value))Y=this._getOrReturnCtx(X,Y),d(Y,{code:m.invalid_string,validation:{endsWith:G.value},message:G.message}),J.dirty()}else if(G.kind==="datetime"){if(!kB(G).test(X.data))Y=this._getOrReturnCtx(X,Y),d(Y,{code:m.invalid_string,validation:"datetime",message:G.message}),J.dirty()}else if(G.kind==="date"){if(!CB.test(X.data))Y=this._getOrReturnCtx(X,Y),d(Y,{code:m.invalid_string,validation:"date",message:G.message}),J.dirty()}else if(G.kind==="time"){if(!_B(G).test(X.data))Y=this._getOrReturnCtx(X,Y),d(Y,{code:m.invalid_string,validation:"time",message:G.message}),J.dirty()}else if(G.kind==="duration"){if(!RB.test(X.data))Y=this._getOrReturnCtx(X,Y),d(Y,{validation:"duration",code:m.invalid_string,message:G.message}),J.dirty()}else if(G.kind==="ip"){if(!vB(X.data,G.version))Y=this._getOrReturnCtx(X,Y),d(Y,{validation:"ip",code:m.invalid_string,message:G.message}),J.dirty()}else if(G.kind==="jwt"){if(!yB(X.data,G.alg))Y=this._getOrReturnCtx(X,Y),d(Y,{validation:"jwt",code:m.invalid_string,message:G.message}),J.dirty()}else if(G.kind==="cidr"){if(!xB(X.data,G.version))Y=this._getOrReturnCtx(X,Y),d(Y,{validation:"cidr",code:m.invalid_string,message:G.message}),J.dirty()}else if(G.kind==="base64"){if(!EB.test(X.data))Y=this._getOrReturnCtx(X,Y),d(Y,{validation:"base64",code:m.invalid_string,message:G.message}),J.dirty()}else if(G.kind==="base64url"){if(!bB.test(X.data))Y=this._getOrReturnCtx(X,Y),d(Y,{validation:"base64url",code:m.invalid_string,message:G.message}),J.dirty()}else V0.assertNever(G);return{status:J.value,value:X.data}}_regex(X,Q,J){return this.refinement((Y)=>X.test(Y),{validation:Q,code:m.invalid_string,...o.errToObj(J)})}_addCheck(X){return new j1({...this._def,checks:[...this._def.checks,X]})}email(X){return this._addCheck({kind:"email",...o.errToObj(X)})}url(X){return this._addCheck({kind:"url",...o.errToObj(X)})}emoji(X){return this._addCheck({kind:"emoji",...o.errToObj(X)})}uuid(X){return this._addCheck({kind:"uuid",...o.errToObj(X)})}nanoid(X){return this._addCheck({kind:"nanoid",...o.errToObj(X)})}cuid(X){return this._addCheck({kind:"cuid",...o.errToObj(X)})}cuid2(X){return this._addCheck({kind:"cuid2",...o.errToObj(X)})}ulid(X){return this._addCheck({kind:"ulid",...o.errToObj(X)})}base64(X){return this._addCheck({kind:"base64",...o.errToObj(X)})}base64url(X){return this._addCheck({kind:"base64url",...o.errToObj(X)})}jwt(X){return this._addCheck({kind:"jwt",...o.errToObj(X)})}ip(X){return this._addCheck({kind:"ip",...o.errToObj(X)})}cidr(X){return this._addCheck({kind:"cidr",...o.errToObj(X)})}datetime(X){if(typeof X==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:X});return this._addCheck({kind:"datetime",precision:typeof X?.precision>"u"?null:X?.precision,offset:X?.offset??!1,local:X?.local??!1,...o.errToObj(X?.message)})}date(X){return this._addCheck({kind:"date",message:X})}time(X){if(typeof X==="string")return this._addCheck({kind:"time",precision:null,message:X});return this._addCheck({kind:"time",precision:typeof X?.precision>"u"?null:X?.precision,...o.errToObj(X?.message)})}duration(X){return this._addCheck({kind:"duration",...o.errToObj(X)})}regex(X,Q){return this._addCheck({kind:"regex",regex:X,...o.errToObj(Q)})}includes(X,Q){return this._addCheck({kind:"includes",value:X,position:Q?.position,...o.errToObj(Q?.message)})}startsWith(X,Q){return this._addCheck({kind:"startsWith",value:X,...o.errToObj(Q)})}endsWith(X,Q){return this._addCheck({kind:"endsWith",value:X,...o.errToObj(Q)})}min(X,Q){return this._addCheck({kind:"min",value:X,...o.errToObj(Q)})}max(X,Q){return this._addCheck({kind:"max",value:X,...o.errToObj(Q)})}length(X,Q){return this._addCheck({kind:"length",value:X,...o.errToObj(Q)})}nonempty(X){return this.min(1,o.errToObj(X))}trim(){return new j1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new j1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new j1({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((X)=>X.kind==="datetime")}get isDate(){return!!this._def.checks.find((X)=>X.kind==="date")}get isTime(){return!!this._def.checks.find((X)=>X.kind==="time")}get isDuration(){return!!this._def.checks.find((X)=>X.kind==="duration")}get isEmail(){return!!this._def.checks.find((X)=>X.kind==="email")}get isURL(){return!!this._def.checks.find((X)=>X.kind==="url")}get isEmoji(){return!!this._def.checks.find((X)=>X.kind==="emoji")}get isUUID(){return!!this._def.checks.find((X)=>X.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((X)=>X.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((X)=>X.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((X)=>X.kind==="cuid2")}get isULID(){return!!this._def.checks.find((X)=>X.kind==="ulid")}get isIP(){return!!this._def.checks.find((X)=>X.kind==="ip")}get isCIDR(){return!!this._def.checks.find((X)=>X.kind==="cidr")}get isBase64(){return!!this._def.checks.find((X)=>X.kind==="base64")}get isBase64url(){return!!this._def.checks.find((X)=>X.kind==="base64url")}get minLength(){let X=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(X===null||Q.value>X)X=Q.value}return X}get maxLength(){let X=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(X===null||Q.value<X)X=Q.value}return X}}j1.create=(X)=>{return new j1({checks:[],typeName:$0.ZodString,coerce:X?.coerce??!1,...H0(X)})};function gB(X,Q){let J=(X.toString().split(".")[1]||"").length,Y=(Q.toString().split(".")[1]||"").length,G=J>Y?J:Y,$=Number.parseInt(X.toFixed(G).replace(".","")),W=Number.parseInt(Q.toFixed(G).replace(".",""));return $%W/10**G}class B9 extends L0{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(X){if(this._def.coerce)X.data=Number(X.data);if(this._getType(X)!==n.number){let G=this._getOrReturnCtx(X);return d(G,{code:m.invalid_type,expected:n.number,received:G.parsedType}),G0}let J=void 0,Y=new d0;for(let G of this._def.checks)if(G.kind==="int"){if(!V0.isInteger(X.data))J=this._getOrReturnCtx(X,J),d(J,{code:m.invalid_type,expected:"integer",received:"float",message:G.message}),Y.dirty()}else if(G.kind==="min"){if(G.inclusive?X.data<G.value:X.data<=G.value)J=this._getOrReturnCtx(X,J),d(J,{code:m.too_small,minimum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),Y.dirty()}else if(G.kind==="max"){if(G.inclusive?X.data>G.value:X.data>=G.value)J=this._getOrReturnCtx(X,J),d(J,{code:m.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),Y.dirty()}else if(G.kind==="multipleOf"){if(gB(X.data,G.value)!==0)J=this._getOrReturnCtx(X,J),d(J,{code:m.not_multiple_of,multipleOf:G.value,message:G.message}),Y.dirty()}else if(G.kind==="finite"){if(!Number.isFinite(X.data))J=this._getOrReturnCtx(X,J),d(J,{code:m.not_finite,message:G.message}),Y.dirty()}else V0.assertNever(G);return{status:Y.value,value:X.data}}gte(X,Q){return this.setLimit("min",X,!0,o.toString(Q))}gt(X,Q){return this.setLimit("min",X,!1,o.toString(Q))}lte(X,Q){return this.setLimit("max",X,!0,o.toString(Q))}lt(X,Q){return this.setLimit("max",X,!1,o.toString(Q))}setLimit(X,Q,J,Y){return new B9({...this._def,checks:[...this._def.checks,{kind:X,value:Q,inclusive:J,message:o.toString(Y)}]})}_addCheck(X){return new B9({...this._def,checks:[...this._def.checks,X]})}int(X){return this._addCheck({kind:"int",message:o.toString(X)})}positive(X){return this._addCheck({kind:"min",value:0,inclusive:!1,message:o.toString(X)})}negative(X){return this._addCheck({kind:"max",value:0,inclusive:!1,message:o.toString(X)})}nonpositive(X){return this._addCheck({kind:"max",value:0,inclusive:!0,message:o.toString(X)})}nonnegative(X){return this._addCheck({kind:"min",value:0,inclusive:!0,message:o.toString(X)})}multipleOf(X,Q){return this._addCheck({kind:"multipleOf",value:X,message:o.toString(Q)})}finite(X){return this._addCheck({kind:"finite",message:o.toString(X)})}safe(X){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:o.toString(X)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:o.toString(X)})}get minValue(){let X=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(X===null||Q.value>X)X=Q.value}return X}get maxValue(){let X=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(X===null||Q.value<X)X=Q.value}return X}get isInt(){return!!this._def.checks.find((X)=>X.kind==="int"||X.kind==="multipleOf"&&V0.isInteger(X.value))}get isFinite(){let X=null,Q=null;for(let J of this._def.checks)if(J.kind==="finite"||J.kind==="int"||J.kind==="multipleOf")return!0;else if(J.kind==="min"){if(Q===null||J.value>Q)Q=J.value}else if(J.kind==="max"){if(X===null||J.value<X)X=J.value}return Number.isFinite(Q)&&Number.isFinite(X)}}B9.create=(X)=>{return new B9({checks:[],typeName:$0.ZodNumber,coerce:X?.coerce||!1,...H0(X)})};class z9 extends L0{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(X){if(this._def.coerce)try{X.data=BigInt(X.data)}catch{return this._getInvalidInput(X)}if(this._getType(X)!==n.bigint)return this._getInvalidInput(X);let J=void 0,Y=new d0;for(let G of this._def.checks)if(G.kind==="min"){if(G.inclusive?X.data<G.value:X.data<=G.value)J=this._getOrReturnCtx(X,J),d(J,{code:m.too_small,type:"bigint",minimum:G.value,inclusive:G.inclusive,message:G.message}),Y.dirty()}else if(G.kind==="max"){if(G.inclusive?X.data>G.value:X.data>=G.value)J=this._getOrReturnCtx(X,J),d(J,{code:m.too_big,type:"bigint",maximum:G.value,inclusive:G.inclusive,message:G.message}),Y.dirty()}else if(G.kind==="multipleOf"){if(X.data%G.value!==BigInt(0))J=this._getOrReturnCtx(X,J),d(J,{code:m.not_multiple_of,multipleOf:G.value,message:G.message}),Y.dirty()}else V0.assertNever(G);return{status:Y.value,value:X.data}}_getInvalidInput(X){let Q=this._getOrReturnCtx(X);return d(Q,{code:m.invalid_type,expected:n.bigint,received:Q.parsedType}),G0}gte(X,Q){return this.setLimit("min",X,!0,o.toString(Q))}gt(X,Q){return this.setLimit("min",X,!1,o.toString(Q))}lte(X,Q){return this.setLimit("max",X,!0,o.toString(Q))}lt(X,Q){return this.setLimit("max",X,!1,o.toString(Q))}setLimit(X,Q,J,Y){return new z9({...this._def,checks:[...this._def.checks,{kind:X,value:Q,inclusive:J,message:o.toString(Y)}]})}_addCheck(X){return new z9({...this._def,checks:[...this._def.checks,X]})}positive(X){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:o.toString(X)})}negative(X){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:o.toString(X)})}nonpositive(X){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:o.toString(X)})}nonnegative(X){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:o.toString(X)})}multipleOf(X,Q){return this._addCheck({kind:"multipleOf",value:X,message:o.toString(Q)})}get minValue(){let X=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(X===null||Q.value>X)X=Q.value}return X}get maxValue(){let X=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(X===null||Q.value<X)X=Q.value}return X}}z9.create=(X)=>{return new z9({checks:[],typeName:$0.ZodBigInt,coerce:X?.coerce??!1,...H0(X)})};class i8 extends L0{_parse(X){if(this._def.coerce)X.data=Boolean(X.data);if(this._getType(X)!==n.boolean){let J=this._getOrReturnCtx(X);return d(J,{code:m.invalid_type,expected:n.boolean,received:J.parsedType}),G0}return n0(X.data)}}i8.create=(X)=>{return new i8({typeName:$0.ZodBoolean,coerce:X?.coerce||!1,...H0(X)})};class c9 extends L0{_parse(X){if(this._def.coerce)X.data=new Date(X.data);if(this._getType(X)!==n.date){let G=this._getOrReturnCtx(X);return d(G,{code:m.invalid_type,expected:n.date,received:G.parsedType}),G0}if(Number.isNaN(X.data.getTime())){let G=this._getOrReturnCtx(X);return d(G,{code:m.invalid_date}),G0}let J=new d0,Y=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(X.data.getTime()<G.value)Y=this._getOrReturnCtx(X,Y),d(Y,{code:m.too_small,message:G.message,inclusive:!0,exact:!1,minimum:G.value,type:"date"}),J.dirty()}else if(G.kind==="max"){if(X.data.getTime()>G.value)Y=this._getOrReturnCtx(X,Y),d(Y,{code:m.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),J.dirty()}else V0.assertNever(G);return{status:J.value,value:new Date(X.data.getTime())}}_addCheck(X){return new c9({...this._def,checks:[...this._def.checks,X]})}min(X,Q){return this._addCheck({kind:"min",value:X.getTime(),message:o.toString(Q)})}max(X,Q){return this._addCheck({kind:"max",value:X.getTime(),message:o.toString(Q)})}get minDate(){let X=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(X===null||Q.value>X)X=Q.value}return X!=null?new Date(X):null}get maxDate(){let X=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(X===null||Q.value<X)X=Q.value}return X!=null?new Date(X):null}}c9.create=(X)=>{return new c9({checks:[],coerce:X?.coerce||!1,typeName:$0.ZodDate,...H0(X)})};class n8 extends L0{_parse(X){if(this._getType(X)!==n.symbol){let J=this._getOrReturnCtx(X);return d(J,{code:m.invalid_type,expected:n.symbol,received:J.parsedType}),G0}return n0(X.data)}}n8.create=(X)=>{return new n8({typeName:$0.ZodSymbol,...H0(X)})};class p9 extends L0{_parse(X){if(this._getType(X)!==n.undefined){let J=this._getOrReturnCtx(X);return d(J,{code:m.invalid_type,expected:n.undefined,received:J.parsedType}),G0}return n0(X.data)}}p9.create=(X)=>{return new p9({typeName:$0.ZodUndefined,...H0(X)})};class d9 extends L0{_parse(X){if(this._getType(X)!==n.null){let J=this._getOrReturnCtx(X);return d(J,{code:m.invalid_type,expected:n.null,received:J.parsedType}),G0}return n0(X.data)}}d9.create=(X)=>{return new d9({typeName:$0.ZodNull,...H0(X)})};class r8 extends L0{constructor(){super(...arguments);this._any=!0}_parse(X){return n0(X.data)}}r8.create=(X)=>{return new r8({typeName:$0.ZodAny,...H0(X)})};class n1 extends L0{constructor(){super(...arguments);this._unknown=!0}_parse(X){return n0(X.data)}}n1.create=(X)=>{return new n1({typeName:$0.ZodUnknown,...H0(X)})};class w1 extends L0{_parse(X){let Q=this._getOrReturnCtx(X);return d(Q,{code:m.invalid_type,expected:n.never,received:Q.parsedType}),G0}}w1.create=(X)=>{return new w1({typeName:$0.ZodNever,...H0(X)})};class o8 extends L0{_parse(X){if(this._getType(X)!==n.undefined){let J=this._getOrReturnCtx(X);return d(J,{code:m.invalid_type,expected:n.void,received:J.parsedType}),G0}return n0(X.data)}}o8.create=(X)=>{return new o8({typeName:$0.ZodVoid,...H0(X)})};class F1 extends L0{_parse(X){let{ctx:Q,status:J}=this._processInputParams(X),Y=this._def;if(Q.parsedType!==n.array)return d(Q,{code:m.invalid_type,expected:n.array,received:Q.parsedType}),G0;if(Y.exactLength!==null){let $=Q.data.length>Y.exactLength.value,W=Q.data.length<Y.exactLength.value;if($||W)d(Q,{code:$?m.too_big:m.too_small,minimum:W?Y.exactLength.value:void 0,maximum:$?Y.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:Y.exactLength.message}),J.dirty()}if(Y.minLength!==null){if(Q.data.length<Y.minLength.value)d(Q,{code:m.too_small,minimum:Y.minLength.value,type:"array",inclusive:!0,exact:!1,message:Y.minLength.message}),J.dirty()}if(Y.maxLength!==null){if(Q.data.length>Y.maxLength.value)d(Q,{code:m.too_big,maximum:Y.maxLength.value,type:"array",inclusive:!0,exact:!1,message:Y.maxLength.message}),J.dirty()}if(Q.common.async)return Promise.all([...Q.data].map(($,W)=>{return Y.type._parseAsync(new $1(Q,$,Q.path,W))})).then(($)=>{return d0.mergeArray(J,$)});let G=[...Q.data].map(($,W)=>{return Y.type._parseSync(new $1(Q,$,Q.path,W))});return d0.mergeArray(J,G)}get element(){return this._def.type}min(X,Q){return new F1({...this._def,minLength:{value:X,message:o.toString(Q)}})}max(X,Q){return new F1({...this._def,maxLength:{value:X,message:o.toString(Q)}})}length(X,Q){return new F1({...this._def,exactLength:{value:X,message:o.toString(Q)}})}nonempty(X){return this.min(1,X)}}F1.create=(X,Q)=>{return new F1({type:X,minLength:null,maxLength:null,exactLength:null,typeName:$0.ZodArray,...H0(Q)})};function G9(X){if(X instanceof C0){let Q={};for(let J in X.shape){let Y=X.shape[J];Q[J]=K1.create(G9(Y))}return new C0({...X._def,shape:()=>Q})}else if(X instanceof F1)return new F1({...X._def,type:G9(X.element)});else if(X instanceof K1)return K1.create(G9(X.unwrap()));else if(X instanceof k1)return k1.create(G9(X.unwrap()));else if(X instanceof P1)return P1.create(X.items.map((Q)=>G9(Q)));else return X}class C0 extends L0{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let X=this._def.shape(),Q=V0.objectKeys(X);return this._cached={shape:X,keys:Q},this._cached}_parse(X){if(this._getType(X)!==n.object){let U=this._getOrReturnCtx(X);return d(U,{code:m.invalid_type,expected:n.object,received:U.parsedType}),G0}let{status:J,ctx:Y}=this._processInputParams(X),{shape:G,keys:$}=this._getCached(),W=[];if(!(this._def.catchall instanceof w1&&this._def.unknownKeys==="strip")){for(let U in Y.data)if(!$.includes(U))W.push(U)}let H=[];for(let U of $){let B=G[U],q=Y.data[U];H.push({key:{status:"valid",value:U},value:B._parse(new $1(Y,q,Y.path,U)),alwaysSet:U in Y.data})}if(this._def.catchall instanceof w1){let U=this._def.unknownKeys;if(U==="passthrough")for(let B of W)H.push({key:{status:"valid",value:B},value:{status:"valid",value:Y.data[B]}});else if(U==="strict"){if(W.length>0)d(Y,{code:m.unrecognized_keys,keys:W}),J.dirty()}else if(U==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let U=this._def.catchall;for(let B of W){let q=Y.data[B];H.push({key:{status:"valid",value:B},value:U._parse(new $1(Y,q,Y.path,B)),alwaysSet:B in Y.data})}}if(Y.common.async)return Promise.resolve().then(async()=>{let U=[];for(let B of H){let q=await B.key,K=await B.value;U.push({key:q,value:K,alwaysSet:B.alwaysSet})}return U}).then((U)=>{return d0.mergeObjectSync(J,U)});else return d0.mergeObjectSync(J,H)}get shape(){return this._def.shape()}strict(X){return o.errToObj,new C0({...this._def,unknownKeys:"strict",...X!==void 0?{errorMap:(Q,J)=>{let Y=this._def.errorMap?.(Q,J).message??J.defaultError;if(Q.code==="unrecognized_keys")return{message:o.errToObj(X).message??Y};return{message:Y}}}:{}})}strip(){return new C0({...this._def,unknownKeys:"strip"})}passthrough(){return new C0({...this._def,unknownKeys:"passthrough"})}extend(X){return new C0({...this._def,shape:()=>({...this._def.shape(),...X})})}merge(X){return new C0({unknownKeys:X._def.unknownKeys,catchall:X._def.catchall,shape:()=>({...this._def.shape(),...X._def.shape()}),typeName:$0.ZodObject})}setKey(X,Q){return this.augment({[X]:Q})}catchall(X){return new C0({...this._def,catchall:X})}pick(X){let Q={};for(let J of V0.objectKeys(X))if(X[J]&&this.shape[J])Q[J]=this.shape[J];return new C0({...this._def,shape:()=>Q})}omit(X){let Q={};for(let J of V0.objectKeys(this.shape))if(!X[J])Q[J]=this.shape[J];return new C0({...this._def,shape:()=>Q})}deepPartial(){return G9(this)}partial(X){let Q={};for(let J of V0.objectKeys(this.shape)){let Y=this.shape[J];if(X&&!X[J])Q[J]=Y;else Q[J]=Y.optional()}return new C0({...this._def,shape:()=>Q})}required(X){let Q={};for(let J of V0.objectKeys(this.shape))if(X&&!X[J])Q[J]=this.shape[J];else{let G=this.shape[J];while(G instanceof K1)G=G._def.innerType;Q[J]=G}return new C0({...this._def,shape:()=>Q})}keyof(){return XJ(V0.objectKeys(this.shape))}}C0.create=(X,Q)=>{return new C0({shape:()=>X,unknownKeys:"strip",catchall:w1.create(),typeName:$0.ZodObject,...H0(Q)})};C0.strictCreate=(X,Q)=>{return new C0({shape:()=>X,unknownKeys:"strict",catchall:w1.create(),typeName:$0.ZodObject,...H0(Q)})};C0.lazycreate=(X,Q)=>{return new C0({shape:X,unknownKeys:"strip",catchall:w1.create(),typeName:$0.ZodObject,...H0(Q)})};class i9 extends L0{_parse(X){let{ctx:Q}=this._processInputParams(X),J=this._def.options;function Y(G){for(let W of G)if(W.result.status==="valid")return W.result;for(let W of G)if(W.result.status==="dirty")return Q.common.issues.push(...W.ctx.common.issues),W.result;let $=G.map((W)=>new e0(W.ctx.common.issues));return d(Q,{code:m.invalid_union,unionErrors:$}),G0}if(Q.common.async)return Promise.all(J.map(async(G)=>{let $={...Q,common:{...Q.common,issues:[]},parent:null};return{result:await G._parseAsync({data:Q.data,path:Q.path,parent:$}),ctx:$}})).then(Y);else{let G=void 0,$=[];for(let H of J){let U={...Q,common:{...Q.common,issues:[]},parent:null},B=H._parseSync({data:Q.data,path:Q.path,parent:U});if(B.status==="valid")return B;else if(B.status==="dirty"&&!G)G={result:B,ctx:U};if(U.common.issues.length)$.push(U.common.issues)}if(G)return Q.common.issues.push(...G.ctx.common.issues),G.result;let W=$.map((H)=>new e0(H));return d(Q,{code:m.invalid_union,unionErrors:W}),G0}}get options(){return this._def.options}}i9.create=(X,Q)=>{return new i9({options:X,typeName:$0.ZodUnion,...H0(Q)})};var N1=(X)=>{if(X instanceof r9)return N1(X.schema);else if(X instanceof M1)return N1(X.innerType());else if(X instanceof o9)return[X.value];else if(X instanceof r1)return X.options;else if(X instanceof a9)return V0.objectValues(X.enum);else if(X instanceof s9)return N1(X._def.innerType);else if(X instanceof p9)return[void 0];else if(X instanceof d9)return[null];else if(X instanceof K1)return[void 0,...N1(X.unwrap())];else if(X instanceof k1)return[null,...N1(X.unwrap())];else if(X instanceof fX)return N1(X.unwrap());else if(X instanceof e9)return N1(X.unwrap());else if(X instanceof t9)return N1(X._def.innerType);else return[]};class hX extends L0{_parse(X){let{ctx:Q}=this._processInputParams(X);if(Q.parsedType!==n.object)return d(Q,{code:m.invalid_type,expected:n.object,received:Q.parsedType}),G0;let J=this.discriminator,Y=Q.data[J],G=this.optionsMap.get(Y);if(!G)return d(Q,{code:m.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[J]}),G0;if(Q.common.async)return G._parseAsync({data:Q.data,path:Q.path,parent:Q});else return G._parseSync({data:Q.data,path:Q.path,parent:Q})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(X,Q,J){let Y=new Map;for(let G of Q){let $=N1(G.shape[X]);if(!$.length)throw Error(`A discriminator value for key \`${X}\` could not be extracted from all schema options`);for(let W of $){if(Y.has(W))throw Error(`Discriminator property ${String(X)} has duplicate value ${String(W)}`);Y.set(W,G)}}return new hX({typeName:$0.ZodDiscriminatedUnion,discriminator:X,options:Q,optionsMap:Y,...H0(J)})}}function TX(X,Q){let J=C1(X),Y=C1(Q);if(X===Q)return{valid:!0,data:X};else if(J===n.object&&Y===n.object){let G=V0.objectKeys(Q),$=V0.objectKeys(X).filter((H)=>G.indexOf(H)!==-1),W={...X,...Q};for(let H of $){let U=TX(X[H],Q[H]);if(!U.valid)return{valid:!1};W[H]=U.data}return{valid:!0,data:W}}else if(J===n.array&&Y===n.array){if(X.length!==Q.length)return{valid:!1};let G=[];for(let $=0;$<X.length;$++){let W=X[$],H=Q[$],U=TX(W,H);if(!U.valid)return{valid:!1};G.push(U.data)}return{valid:!0,data:G}}else if(J===n.date&&Y===n.date&&+X===+Q)return{valid:!0,data:X};else return{valid:!1}}class n9 extends L0{_parse(X){let{status:Q,ctx:J}=this._processInputParams(X),Y=(G,$)=>{if(J5(G)||J5($))return G0;let W=TX(G.value,$.value);if(!W.valid)return d(J,{code:m.invalid_intersection_types}),G0;if(Y5(G)||Y5($))Q.dirty();return{status:Q.value,value:W.data}};if(J.common.async)return Promise.all([this._def.left._parseAsync({data:J.data,path:J.path,parent:J}),this._def.right._parseAsync({data:J.data,path:J.path,parent:J})]).then(([G,$])=>Y(G,$));else return Y(this._def.left._parseSync({data:J.data,path:J.path,parent:J}),this._def.right._parseSync({data:J.data,path:J.path,parent:J}))}}n9.create=(X,Q,J)=>{return new n9({left:X,right:Q,typeName:$0.ZodIntersection,...H0(J)})};class P1 extends L0{_parse(X){let{status:Q,ctx:J}=this._processInputParams(X);if(J.parsedType!==n.array)return d(J,{code:m.invalid_type,expected:n.array,received:J.parsedType}),G0;if(J.data.length<this._def.items.length)return d(J,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),G0;if(!this._def.rest&&J.data.length>this._def.items.length)d(J,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q.dirty();let G=[...J.data].map(($,W)=>{let H=this._def.items[W]||this._def.rest;if(!H)return null;return H._parse(new $1(J,$,J.path,W))}).filter(($)=>!!$);if(J.common.async)return Promise.all(G).then(($)=>{return d0.mergeArray(Q,$)});else return d0.mergeArray(Q,G)}get items(){return this._def.items}rest(X){return new P1({...this._def,rest:X})}}P1.create=(X,Q)=>{if(!Array.isArray(X))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new P1({items:X,typeName:$0.ZodTuple,rest:null,...H0(Q)})};class a8 extends L0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(X){let{status:Q,ctx:J}=this._processInputParams(X);if(J.parsedType!==n.object)return d(J,{code:m.invalid_type,expected:n.object,received:J.parsedType}),G0;let Y=[],G=this._def.keyType,$=this._def.valueType;for(let W in J.data)Y.push({key:G._parse(new $1(J,W,J.path,W)),value:$._parse(new $1(J,J.data[W],J.path,W)),alwaysSet:W in J.data});if(J.common.async)return d0.mergeObjectAsync(Q,Y);else return d0.mergeObjectSync(Q,Y)}get element(){return this._def.valueType}static create(X,Q,J){if(Q instanceof L0)return new a8({keyType:X,valueType:Q,typeName:$0.ZodRecord,...H0(J)});return new a8({keyType:j1.create(),valueType:X,typeName:$0.ZodRecord,...H0(Q)})}}class s8 extends L0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(X){let{status:Q,ctx:J}=this._processInputParams(X);if(J.parsedType!==n.map)return d(J,{code:m.invalid_type,expected:n.map,received:J.parsedType}),G0;let Y=this._def.keyType,G=this._def.valueType,$=[...J.data.entries()].map(([W,H],U)=>{return{key:Y._parse(new $1(J,W,J.path,[U,"key"])),value:G._parse(new $1(J,H,J.path,[U,"value"]))}});if(J.common.async){let W=new Map;return Promise.resolve().then(async()=>{for(let H of $){let U=await H.key,B=await H.value;if(U.status==="aborted"||B.status==="aborted")return G0;if(U.status==="dirty"||B.status==="dirty")Q.dirty();W.set(U.value,B.value)}return{status:Q.value,value:W}})}else{let W=new Map;for(let H of $){let{key:U,value:B}=H;if(U.status==="aborted"||B.status==="aborted")return G0;if(U.status==="dirty"||B.status==="dirty")Q.dirty();W.set(U.value,B.value)}return{status:Q.value,value:W}}}}s8.create=(X,Q,J)=>{return new s8({valueType:Q,keyType:X,typeName:$0.ZodMap,...H0(J)})};class L9 extends L0{_parse(X){let{status:Q,ctx:J}=this._processInputParams(X);if(J.parsedType!==n.set)return d(J,{code:m.invalid_type,expected:n.set,received:J.parsedType}),G0;let Y=this._def;if(Y.minSize!==null){if(J.data.size<Y.minSize.value)d(J,{code:m.too_small,minimum:Y.minSize.value,type:"set",inclusive:!0,exact:!1,message:Y.minSize.message}),Q.dirty()}if(Y.maxSize!==null){if(J.data.size>Y.maxSize.value)d(J,{code:m.too_big,maximum:Y.maxSize.value,type:"set",inclusive:!0,exact:!1,message:Y.maxSize.message}),Q.dirty()}let G=this._def.valueType;function $(H){let U=new Set;for(let B of H){if(B.status==="aborted")return G0;if(B.status==="dirty")Q.dirty();U.add(B.value)}return{status:Q.value,value:U}}let W=[...J.data.values()].map((H,U)=>G._parse(new $1(J,H,J.path,U)));if(J.common.async)return Promise.all(W).then((H)=>$(H));else return $(W)}min(X,Q){return new L9({...this._def,minSize:{value:X,message:o.toString(Q)}})}max(X,Q){return new L9({...this._def,maxSize:{value:X,message:o.toString(Q)}})}size(X,Q){return this.min(X,Q).max(X,Q)}nonempty(X){return this.min(1,X)}}L9.create=(X,Q)=>{return new L9({valueType:X,minSize:null,maxSize:null,typeName:$0.ZodSet,...H0(Q)})};class u9 extends L0{constructor(){super(...arguments);this.validate=this.implement}_parse(X){let{ctx:Q}=this._processInputParams(X);if(Q.parsedType!==n.function)return d(Q,{code:m.invalid_type,expected:n.function,received:Q.parsedType}),G0;function J(W,H){return PX({data:W,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,wX(),l9].filter((U)=>!!U),issueData:{code:m.invalid_arguments,argumentsError:H}})}function Y(W,H){return PX({data:W,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,wX(),l9].filter((U)=>!!U),issueData:{code:m.invalid_return_type,returnTypeError:H}})}let G={errorMap:Q.common.contextualErrorMap},$=Q.data;if(this._def.returns instanceof q9){let W=this;return n0(async function(...H){let U=new e0([]),B=await W._def.args.parseAsync(H,G).catch((V)=>{throw U.addIssue(J(H,V)),U}),q=await Reflect.apply($,this,B);return await W._def.returns._def.type.parseAsync(q,G).catch((V)=>{throw U.addIssue(Y(q,V)),U})})}else{let W=this;return n0(function(...H){let U=W._def.args.safeParse(H,G);if(!U.success)throw new e0([J(H,U.error)]);let B=Reflect.apply($,this,U.data),q=W._def.returns.safeParse(B,G);if(!q.success)throw new e0([Y(B,q.error)]);return q.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...X){return new u9({...this._def,args:P1.create(X).rest(n1.create())})}returns(X){return new u9({...this._def,returns:X})}implement(X){return this.parse(X)}strictImplement(X){return this.parse(X)}static create(X,Q,J){return new u9({args:X?X:P1.create([]).rest(n1.create()),returns:Q||n1.create(),typeName:$0.ZodFunction,...H0(J)})}}class r9 extends L0{get schema(){return this._def.getter()}_parse(X){let{ctx:Q}=this._processInputParams(X);return this._def.getter()._parse({data:Q.data,path:Q.path,parent:Q})}}r9.create=(X,Q)=>{return new r9({getter:X,typeName:$0.ZodLazy,...H0(Q)})};class o9 extends L0{_parse(X){if(X.data!==this._def.value){let Q=this._getOrReturnCtx(X);return d(Q,{received:Q.data,code:m.invalid_literal,expected:this._def.value}),G0}return{status:"valid",value:X.data}}get value(){return this._def.value}}o9.create=(X,Q)=>{return new o9({value:X,typeName:$0.ZodLiteral,...H0(Q)})};function XJ(X,Q){return new r1({values:X,typeName:$0.ZodEnum,...H0(Q)})}class r1 extends L0{_parse(X){if(typeof X.data!=="string"){let Q=this._getOrReturnCtx(X),J=this._def.values;return d(Q,{expected:V0.joinValues(J),received:Q.parsedType,code:m.invalid_type}),G0}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(X.data)){let Q=this._getOrReturnCtx(X),J=this._def.values;return d(Q,{received:Q.data,code:m.invalid_enum_value,options:J}),G0}return n0(X.data)}get options(){return this._def.values}get enum(){let X={};for(let Q of this._def.values)X[Q]=Q;return X}get Values(){let X={};for(let Q of this._def.values)X[Q]=Q;return X}get Enum(){let X={};for(let Q of this._def.values)X[Q]=Q;return X}extract(X,Q=this._def){return r1.create(X,{...this._def,...Q})}exclude(X,Q=this._def){return r1.create(this.options.filter((J)=>!X.includes(J)),{...this._def,...Q})}}r1.create=XJ;class a9 extends L0{_parse(X){let Q=V0.getValidEnumValues(this._def.values),J=this._getOrReturnCtx(X);if(J.parsedType!==n.string&&J.parsedType!==n.number){let Y=V0.objectValues(Q);return d(J,{expected:V0.joinValues(Y),received:J.parsedType,code:m.invalid_type}),G0}if(!this._cache)this._cache=new Set(V0.getValidEnumValues(this._def.values));if(!this._cache.has(X.data)){let Y=V0.objectValues(Q);return d(J,{received:J.data,code:m.invalid_enum_value,options:Y}),G0}return n0(X.data)}get enum(){return this._def.values}}a9.create=(X,Q)=>{return new a9({values:X,typeName:$0.ZodNativeEnum,...H0(Q)})};class q9 extends L0{unwrap(){return this._def.type}_parse(X){let{ctx:Q}=this._processInputParams(X);if(Q.parsedType!==n.promise&&Q.common.async===!1)return d(Q,{code:m.invalid_type,expected:n.promise,received:Q.parsedType}),G0;let J=Q.parsedType===n.promise?Q.data:Promise.resolve(Q.data);return n0(J.then((Y)=>{return this._def.type.parseAsync(Y,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}}q9.create=(X,Q)=>{return new q9({type:X,typeName:$0.ZodPromise,...H0(Q)})};class M1 extends L0{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$0.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(X){let{status:Q,ctx:J}=this._processInputParams(X),Y=this._def.effect||null,G={addIssue:($)=>{if(d(J,$),$.fatal)Q.abort();else Q.dirty()},get path(){return J.path}};if(G.addIssue=G.addIssue.bind(G),Y.type==="preprocess"){let $=Y.transform(J.data,G);if(J.common.async)return Promise.resolve($).then(async(W)=>{if(Q.value==="aborted")return G0;let H=await this._def.schema._parseAsync({data:W,path:J.path,parent:J});if(H.status==="aborted")return G0;if(H.status==="dirty")return h9(H.value);if(Q.value==="dirty")return h9(H.value);return H});else{if(Q.value==="aborted")return G0;let W=this._def.schema._parseSync({data:$,path:J.path,parent:J});if(W.status==="aborted")return G0;if(W.status==="dirty")return h9(W.value);if(Q.value==="dirty")return h9(W.value);return W}}if(Y.type==="refinement"){let $=(W)=>{let H=Y.refinement(W,G);if(J.common.async)return Promise.resolve(H);if(H instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return W};if(J.common.async===!1){let W=this._def.schema._parseSync({data:J.data,path:J.path,parent:J});if(W.status==="aborted")return G0;if(W.status==="dirty")Q.dirty();return $(W.value),{status:Q.value,value:W.value}}else return this._def.schema._parseAsync({data:J.data,path:J.path,parent:J}).then((W)=>{if(W.status==="aborted")return G0;if(W.status==="dirty")Q.dirty();return $(W.value).then(()=>{return{status:Q.value,value:W.value}})})}if(Y.type==="transform")if(J.common.async===!1){let $=this._def.schema._parseSync({data:J.data,path:J.path,parent:J});if(!U9($))return G0;let W=Y.transform($.value,G);if(W instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Q.value,value:W}}else return this._def.schema._parseAsync({data:J.data,path:J.path,parent:J}).then(($)=>{if(!U9($))return G0;return Promise.resolve(Y.transform($.value,G)).then((W)=>({status:Q.value,value:W}))});V0.assertNever(Y)}}M1.create=(X,Q,J)=>{return new M1({schema:X,typeName:$0.ZodEffects,effect:Q,...H0(J)})};M1.createWithPreprocess=(X,Q,J)=>{return new M1({schema:Q,effect:{type:"preprocess",transform:X},typeName:$0.ZodEffects,...H0(J)})};class K1 extends L0{_parse(X){if(this._getType(X)===n.undefined)return n0(void 0);return this._def.innerType._parse(X)}unwrap(){return this._def.innerType}}K1.create=(X,Q)=>{return new K1({innerType:X,typeName:$0.ZodOptional,...H0(Q)})};class k1 extends L0{_parse(X){if(this._getType(X)===n.null)return n0(null);return this._def.innerType._parse(X)}unwrap(){return this._def.innerType}}k1.create=(X,Q)=>{return new k1({innerType:X,typeName:$0.ZodNullable,...H0(Q)})};class s9 extends L0{_parse(X){let{ctx:Q}=this._processInputParams(X),J=Q.data;if(Q.parsedType===n.undefined)J=this._def.defaultValue();return this._def.innerType._parse({data:J,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}}s9.create=(X,Q)=>{return new s9({innerType:X,typeName:$0.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...H0(Q)})};class t9 extends L0{_parse(X){let{ctx:Q}=this._processInputParams(X),J={...Q,common:{...Q.common,issues:[]}},Y=this._def.innerType._parse({data:J.data,path:J.path,parent:{...J}});if(d8(Y))return Y.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new e0(J.common.issues)},input:J.data})}});else return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new e0(J.common.issues)},input:J.data})}}removeCatch(){return this._def.innerType}}t9.create=(X,Q)=>{return new t9({innerType:X,typeName:$0.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...H0(Q)})};class t8 extends L0{_parse(X){if(this._getType(X)!==n.nan){let J=this._getOrReturnCtx(X);return d(J,{code:m.invalid_type,expected:n.nan,received:J.parsedType}),G0}return{status:"valid",value:X.data}}}t8.create=(X)=>{return new t8({typeName:$0.ZodNaN,...H0(X)})};var gw=Symbol("zod_brand");class fX extends L0{_parse(X){let{ctx:Q}=this._processInputParams(X),J=Q.data;return this._def.type._parse({data:J,path:Q.path,parent:Q})}unwrap(){return this._def.type}}class H6 extends L0{_parse(X){let{status:Q,ctx:J}=this._processInputParams(X);if(J.common.async)return(async()=>{let G=await this._def.in._parseAsync({data:J.data,path:J.path,parent:J});if(G.status==="aborted")return G0;if(G.status==="dirty")return Q.dirty(),h9(G.value);else return this._def.out._parseAsync({data:G.value,path:J.path,parent:J})})();else{let Y=this._def.in._parseSync({data:J.data,path:J.path,parent:J});if(Y.status==="aborted")return G0;if(Y.status==="dirty")return Q.dirty(),{status:"dirty",value:Y.value};else return this._def.out._parseSync({data:Y.value,path:J.path,parent:J})}}static create(X,Q){return new H6({in:X,out:Q,typeName:$0.ZodPipeline})}}class e9 extends L0{_parse(X){let Q=this._def.innerType._parse(X),J=(Y)=>{if(U9(Y))Y.value=Object.freeze(Y.value);return Y};return d8(Q)?Q.then((Y)=>J(Y)):J(Q)}unwrap(){return this._def.innerType}}e9.create=(X,Q)=>{return new e9({innerType:X,typeName:$0.ZodReadonly,...H0(Q)})};var hw={object:C0.lazycreate},$0;(function(X){X.ZodString="ZodString",X.ZodNumber="ZodNumber",X.ZodNaN="ZodNaN",X.ZodBigInt="ZodBigInt",X.ZodBoolean="ZodBoolean",X.ZodDate="ZodDate",X.ZodSymbol="ZodSymbol",X.ZodUndefined="ZodUndefined",X.ZodNull="ZodNull",X.ZodAny="ZodAny",X.ZodUnknown="ZodUnknown",X.ZodNever="ZodNever",X.ZodVoid="ZodVoid",X.ZodArray="ZodArray",X.ZodObject="ZodObject",X.ZodUnion="ZodUnion",X.ZodDiscriminatedUnion="ZodDiscriminatedUnion",X.ZodIntersection="ZodIntersection",X.ZodTuple="ZodTuple",X.ZodRecord="ZodRecord",X.ZodMap="ZodMap",X.ZodSet="ZodSet",X.ZodFunction="ZodFunction",X.ZodLazy="ZodLazy",X.ZodLiteral="ZodLiteral",X.ZodEnum="ZodEnum",X.ZodEffects="ZodEffects",X.ZodNativeEnum="ZodNativeEnum",X.ZodOptional="ZodOptional",X.ZodNullable="ZodNullable",X.ZodDefault="ZodDefault",X.ZodCatch="ZodCatch",X.ZodPromise="ZodPromise",X.ZodBranded="ZodBranded",X.ZodPipeline="ZodPipeline",X.ZodReadonly="ZodReadonly"})($0||($0={}));var fw=j1.create,uw=B9.create,mw=t8.create,lw=z9.create,cw=i8.create,pw=c9.create,dw=n8.create,iw=p9.create,nw=d9.create,rw=r8.create,ow=n1.create,aw=w1.create,sw=o8.create,tw=F1.create,ew=C0.create,XP=C0.strictCreate,QP=i9.create,JP=hX.create,YP=n9.create,GP=P1.create,$P=a8.create,WP=s8.create,HP=L9.create,UP=u9.create,BP=r9.create,zP=o9.create,LP=r1.create,qP=a9.create,FP=q9.create,KP=M1.create,VP=K1.create,MP=k1.create,DP=M1.createWithPreprocess,ZP=H6.create,OP=Object.freeze({status:"aborted"});function y(X,Q,J){function Y(H,U){var B;Object.defineProperty(H,"_zod",{value:H._zod??{},enumerable:!1}),(B=H._zod).traits??(B.traits=new Set),H._zod.traits.add(X),Q(H,U);for(let q in W.prototype)if(!(q in H))Object.defineProperty(H,q,{value:W.prototype[q].bind(H)});H._zod.constr=W,H._zod.def=U}let G=J?.Parent??Object;class $ extends G{}Object.defineProperty($,"name",{value:X});function W(H){var U;let B=J?.Parent?new $:this;Y(B,H),(U=B._zod).deferred??(U.deferred=[]);for(let q of B._zod.deferred)q();return B}return Object.defineProperty(W,"init",{value:Y}),Object.defineProperty(W,Symbol.hasInstance,{value:(H)=>{if(J?.Parent&&H instanceof J.Parent)return!0;return H?._zod?.traits?.has(X)}}),Object.defineProperty(W,"name",{value:X}),W}var AP=Symbol("zod_brand");class F9 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var SX={};function T1(X){if(X)Object.assign(SX,X);return SX}var N0={};w5(N0,{unwrapMessage:()=>f9,stringifyPrimitive:()=>lX,required:()=>Jz,randomString:()=>dB,propertyKeyTypes:()=>$J,promiseAllObject:()=>pB,primitiveTypes:()=>rB,prefixIssues:()=>_1,pick:()=>sB,partial:()=>Qz,optionalKeys:()=>WJ,omit:()=>tB,numKeys:()=>iB,nullish:()=>B6,normalizeParams:()=>J0,merge:()=>Xz,jsonStringifyReplacer:()=>JJ,joinValues:()=>EX,issue:()=>UJ,isPlainObject:()=>Q8,isObject:()=>X8,getSizableOrigin:()=>Yz,getParsedType:()=>nB,getLengthableOrigin:()=>L6,getEnumValues:()=>QJ,getElementAtPath:()=>cB,floatSafeRemainder:()=>YJ,finalizeIssue:()=>S1,extend:()=>eB,escapeRegex:()=>Z9,esc:()=>$9,defineLazy:()=>R0,createTransparentProxy:()=>oB,clone:()=>y1,cleanRegex:()=>z6,cleanEnum:()=>Gz,captureStackTrace:()=>mX,cached:()=>U6,assignProp:()=>uX,assertNotEqual:()=>fB,assertNever:()=>mB,assertIs:()=>uB,assertEqual:()=>hB,assert:()=>lB,allowsEval:()=>GJ,aborted:()=>H9,NUMBER_FORMAT_RANGES:()=>HJ,Class:()=>BJ,BIGINT_FORMAT_RANGES:()=>aB});function hB(X){return X}function fB(X){return X}function uB(X){}function mB(X){throw Error()}function lB(X){}function QJ(X){let Q=Object.values(X).filter((Y)=>typeof Y==="number");return Object.entries(X).filter(([Y,G])=>Q.indexOf(+Y)===-1).map(([Y,G])=>G)}function EX(X,Q="|"){return X.map((J)=>lX(J)).join(Q)}function JJ(X,Q){if(typeof Q==="bigint")return Q.toString();return Q}function U6(X){return{get value(){{let J=X();return Object.defineProperty(this,"value",{value:J}),J}throw Error("cached value already set")}}}function B6(X){return X===null||X===void 0}function z6(X){let Q=X.startsWith("^")?1:0,J=X.endsWith("$")?X.length-1:X.length;return X.slice(Q,J)}function YJ(X,Q){let J=(X.toString().split(".")[1]||"").length,Y=(Q.toString().split(".")[1]||"").length,G=J>Y?J:Y,$=Number.parseInt(X.toFixed(G).replace(".","")),W=Number.parseInt(Q.toFixed(G).replace(".",""));return $%W/10**G}function R0(X,Q,J){Object.defineProperty(X,Q,{get(){{let G=J();return X[Q]=G,G}throw Error("cached value already set")},set(G){Object.defineProperty(X,Q,{value:G})},configurable:!0})}function uX(X,Q,J){Object.defineProperty(X,Q,{value:J,writable:!0,enumerable:!0,configurable:!0})}function cB(X,Q){if(!Q)return X;return Q.reduce((J,Y)=>J?.[Y],X)}function pB(X){let Q=Object.keys(X),J=Q.map((Y)=>X[Y]);return Promise.all(J).then((Y)=>{let G={};for(let $=0;$<Q.length;$++)G[Q[$]]=Y[$];return G})}function dB(X=10){let J="";for(let Y=0;Y<X;Y++)J+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return J}function $9(X){return JSON.stringify(X)}var mX=Error.captureStackTrace?Error.captureStackTrace:(...X)=>{};function X8(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}var GJ=U6(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(X){return!1}});function Q8(X){if(X8(X)===!1)return!1;let Q=X.constructor;if(Q===void 0)return!0;let J=Q.prototype;if(X8(J)===!1)return!1;if(Object.prototype.hasOwnProperty.call(J,"isPrototypeOf")===!1)return!1;return!0}function iB(X){let Q=0;for(let J in X)if(Object.prototype.hasOwnProperty.call(X,J))Q++;return Q}var nB=(X)=>{let Q=typeof X;switch(Q){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(X)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(X))return"array";if(X===null)return"null";if(X.then&&typeof X.then==="function"&&X.catch&&typeof X.catch==="function")return"promise";if(typeof Map<"u"&&X instanceof Map)return"map";if(typeof Set<"u"&&X instanceof Set)return"set";if(typeof Date<"u"&&X instanceof Date)return"date";if(typeof File<"u"&&X instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${Q}`)}},$J=new Set(["string","number","symbol"]),rB=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Z9(X){return X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function y1(X,Q,J){let Y=new X._zod.constr(Q??X._zod.def);if(!Q||J?.parent)Y._zod.parent=X;return Y}function J0(X){let Q=X;if(!Q)return{};if(typeof Q==="string")return{error:()=>Q};if(Q?.message!==void 0){if(Q?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");Q.error=Q.message}if(delete Q.message,typeof Q.error==="string")return{...Q,error:()=>Q.error};return Q}function oB(X){let Q;return new Proxy({},{get(J,Y,G){return Q??(Q=X()),Reflect.get(Q,Y,G)},set(J,Y,G,$){return Q??(Q=X()),Reflect.set(Q,Y,G,$)},has(J,Y){return Q??(Q=X()),Reflect.has(Q,Y)},deleteProperty(J,Y){return Q??(Q=X()),Reflect.deleteProperty(Q,Y)},ownKeys(J){return Q??(Q=X()),Reflect.ownKeys(Q)},getOwnPropertyDescriptor(J,Y){return Q??(Q=X()),Reflect.getOwnPropertyDescriptor(Q,Y)},defineProperty(J,Y,G){return Q??(Q=X()),Reflect.defineProperty(Q,Y,G)}})}function lX(X){if(typeof X==="bigint")return X.toString()+"n";if(typeof X==="string")return`"${X}"`;return`${X}`}function WJ(X){return Object.keys(X).filter((Q)=>{return X[Q]._zod.optin==="optional"&&X[Q]._zod.optout==="optional"})}var HJ={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},aB={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function sB(X,Q){let J={},Y=X._zod.def;for(let G in Q){if(!(G in Y.shape))throw Error(`Unrecognized key: "${G}"`);if(!Q[G])continue;J[G]=Y.shape[G]}return y1(X,{...X._zod.def,shape:J,checks:[]})}function tB(X,Q){let J={...X._zod.def.shape},Y=X._zod.def;for(let G in Q){if(!(G in Y.shape))throw Error(`Unrecognized key: "${G}"`);if(!Q[G])continue;delete J[G]}return y1(X,{...X._zod.def,shape:J,checks:[]})}function eB(X,Q){if(!Q8(Q))throw Error("Invalid input to extend: expected a plain object");let J={...X._zod.def,get shape(){let Y={...X._zod.def.shape,...Q};return uX(this,"shape",Y),Y},checks:[]};return y1(X,J)}function Xz(X,Q){return y1(X,{...X._zod.def,get shape(){let J={...X._zod.def.shape,...Q._zod.def.shape};return uX(this,"shape",J),J},catchall:Q._zod.def.catchall,checks:[]})}function Qz(X,Q,J){let Y=Q._zod.def.shape,G={...Y};if(J)for(let $ in J){if(!($ in Y))throw Error(`Unrecognized key: "${$}"`);if(!J[$])continue;G[$]=X?new X({type:"optional",innerType:Y[$]}):Y[$]}else for(let $ in Y)G[$]=X?new X({type:"optional",innerType:Y[$]}):Y[$];return y1(Q,{...Q._zod.def,shape:G,checks:[]})}function Jz(X,Q,J){let Y=Q._zod.def.shape,G={...Y};if(J)for(let $ in J){if(!($ in G))throw Error(`Unrecognized key: "${$}"`);if(!J[$])continue;G[$]=new X({type:"nonoptional",innerType:Y[$]})}else for(let $ in Y)G[$]=new X({type:"nonoptional",innerType:Y[$]});return y1(Q,{...Q._zod.def,shape:G,checks:[]})}function H9(X,Q=0){for(let J=Q;J<X.issues.length;J++)if(X.issues[J]?.continue!==!0)return!0;return!1}function _1(X,Q){return Q.map((J)=>{var Y;return(Y=J).path??(Y.path=[]),J.path.unshift(X),J})}function f9(X){return typeof X==="string"?X:X?.message}function S1(X,Q,J){let Y={...X,path:X.path??[]};if(!X.message){let G=f9(X.inst?._zod.def?.error?.(X))??f9(Q?.error?.(X))??f9(J.customError?.(X))??f9(J.localeError?.(X))??"Invalid input";Y.message=G}if(delete Y.inst,delete Y.continue,!Q?.reportInput)delete Y.input;return Y}function Yz(X){if(X instanceof Set)return"set";if(X instanceof Map)return"map";if(X instanceof File)return"file";return"unknown"}function L6(X){if(Array.isArray(X))return"array";if(typeof X==="string")return"string";return"unknown"}function UJ(...X){let[Q,J,Y]=X;if(typeof Q==="string")return{message:Q,code:"custom",input:J,inst:Y};return{...Q}}function Gz(X){return Object.entries(X).filter(([Q,J])=>{return Number.isNaN(Number.parseInt(Q,10))}).map((Q)=>Q[1])}class BJ{constructor(...X){}}var zJ=(X,Q)=>{X.name="$ZodError",Object.defineProperty(X,"_zod",{value:X._zod,enumerable:!1}),Object.defineProperty(X,"issues",{value:Q,enumerable:!1}),Object.defineProperty(X,"message",{get(){return JSON.stringify(Q,JJ,2)},enumerable:!0})},LJ=y("$ZodError",zJ),qJ=y("$ZodError",zJ,{Parent:Error});function $z(X,Q=(J)=>J.message){let J={},Y=[];for(let G of X.issues)if(G.path.length>0)J[G.path[0]]=J[G.path[0]]||[],J[G.path[0]].push(Q(G));else Y.push(Q(G));return{formErrors:Y,fieldErrors:J}}function Wz(X,Q){let J=Q||function($){return $.message},Y={_errors:[]},G=($)=>{for(let W of $.issues)if(W.code==="invalid_union"&&W.errors.length)W.errors.map((H)=>G({issues:H}));else if(W.code==="invalid_key")G({issues:W.issues});else if(W.code==="invalid_element")G({issues:W.issues});else if(W.path.length===0)Y._errors.push(J(W));else{let H=Y,U=0;while(U<W.path.length){let B=W.path[U];if(U!==W.path.length-1)H[B]=H[B]||{_errors:[]};else H[B]=H[B]||{_errors:[]},H[B]._errors.push(J(W));H=H[B],U++}}};return G(X),Y}var Hz=(X)=>(Q,J,Y,G)=>{let $=Y?Object.assign(Y,{async:!1}):{async:!1},W=Q._zod.run({value:J,issues:[]},$);if(W instanceof Promise)throw new F9;if(W.issues.length){let H=new(G?.Err??X)(W.issues.map((U)=>S1(U,$,T1())));throw mX(H,G?.callee),H}return W.value};var Uz=(X)=>async(Q,J,Y,G)=>{let $=Y?Object.assign(Y,{async:!0}):{async:!0},W=Q._zod.run({value:J,issues:[]},$);if(W instanceof Promise)W=await W;if(W.issues.length){let H=new(G?.Err??X)(W.issues.map((U)=>S1(U,$,T1())));throw mX(H,G?.callee),H}return W.value};var FJ=(X)=>(Q,J,Y)=>{let G=Y?{...Y,async:!1}:{async:!1},$=Q._zod.run({value:J,issues:[]},G);if($ instanceof Promise)throw new F9;return $.issues.length?{success:!1,error:new(X??LJ)($.issues.map((W)=>S1(W,G,T1())))}:{success:!0,data:$.value}},Bz=FJ(qJ),KJ=(X)=>async(Q,J,Y)=>{let G=Y?Object.assign(Y,{async:!0}):{async:!0},$=Q._zod.run({value:J,issues:[]},G);if($ instanceof Promise)$=await $;return $.issues.length?{success:!1,error:new X($.issues.map((W)=>S1(W,G,T1())))}:{success:!0,data:$.value}},zz=KJ(qJ),Lz=/^[cC][^\s-]{8,}$/,qz=/^[0-9a-z]+$/,Fz=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Kz=/^[0-9a-vA-V]{20}$/,Vz=/^[A-Za-z0-9]{27}$/,Mz=/^[a-zA-Z0-9_-]{21}$/,Dz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zz=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$5=(X)=>{if(!X)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${X}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Oz=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Az="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Nz(){return new RegExp(Az,"u")}var Rz=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Iz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,jz=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,wz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Pz=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,VJ=/^[A-Za-z0-9_-]*$/,Tz=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Sz=/^\+(?:[0-9]){6,14}[0-9]$/,MJ="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Ez=new RegExp(`^${MJ}$`);function DJ(X){return typeof X.precision==="number"?X.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":X.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${X.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function bz(X){return new RegExp(`^${DJ(X)}$`)}function Cz(X){let Q=DJ({precision:X.precision}),J=["Z"];if(X.local)J.push("");if(X.offset)J.push("([+-]\\d{2}:\\d{2})");let Y=`${Q}(?:${J.join("|")})`;return new RegExp(`^${MJ}T(?:${Y})$`)}var _z=(X)=>{let Q=X?`[\\s\\S]{${X?.minimum??0},${X?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Q}$`)},kz=/^\d+$/,vz=/^-?\d+(?:\.\d+)?/i,yz=/true|false/i,xz=/null/i,gz=/^[^A-Z]*$/,hz=/^[^a-z]*$/,r0=y("$ZodCheck",(X,Q)=>{var J;X._zod??(X._zod={}),X._zod.def=Q,(J=X._zod).onattach??(J.onattach=[])}),ZJ={number:"number",bigint:"bigint",object:"date"},OJ=y("$ZodCheckLessThan",(X,Q)=>{r0.init(X,Q);let J=ZJ[typeof Q.value];X._zod.onattach.push((Y)=>{let G=Y._zod.bag,$=(Q.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(Q.value<$)if(Q.inclusive)G.maximum=Q.value;else G.exclusiveMaximum=Q.value}),X._zod.check=(Y)=>{if(Q.inclusive?Y.value<=Q.value:Y.value<Q.value)return;Y.issues.push({origin:J,code:"too_big",maximum:Q.value,input:Y.value,inclusive:Q.inclusive,inst:X,continue:!Q.abort})}}),AJ=y("$ZodCheckGreaterThan",(X,Q)=>{r0.init(X,Q);let J=ZJ[typeof Q.value];X._zod.onattach.push((Y)=>{let G=Y._zod.bag,$=(Q.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(Q.value>$)if(Q.inclusive)G.minimum=Q.value;else G.exclusiveMinimum=Q.value}),X._zod.check=(Y)=>{if(Q.inclusive?Y.value>=Q.value:Y.value>Q.value)return;Y.issues.push({origin:J,code:"too_small",minimum:Q.value,input:Y.value,inclusive:Q.inclusive,inst:X,continue:!Q.abort})}}),fz=y("$ZodCheckMultipleOf",(X,Q)=>{r0.init(X,Q),X._zod.onattach.push((J)=>{var Y;(Y=J._zod.bag).multipleOf??(Y.multipleOf=Q.value)}),X._zod.check=(J)=>{if(typeof J.value!==typeof Q.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof J.value==="bigint"?J.value%Q.value===BigInt(0):YJ(J.value,Q.value)===0)return;J.issues.push({origin:typeof J.value,code:"not_multiple_of",divisor:Q.value,input:J.value,inst:X,continue:!Q.abort})}}),uz=y("$ZodCheckNumberFormat",(X,Q)=>{r0.init(X,Q),Q.format=Q.format||"float64";let J=Q.format?.includes("int"),Y=J?"int":"number",[G,$]=HJ[Q.format];X._zod.onattach.push((W)=>{let H=W._zod.bag;if(H.format=Q.format,H.minimum=G,H.maximum=$,J)H.pattern=kz}),X._zod.check=(W)=>{let H=W.value;if(J){if(!Number.isInteger(H)){W.issues.push({expected:Y,format:Q.format,code:"invalid_type",input:H,inst:X});return}if(!Number.isSafeInteger(H)){if(H>0)W.issues.push({input:H,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:X,origin:Y,continue:!Q.abort});else W.issues.push({input:H,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:X,origin:Y,continue:!Q.abort});return}}if(H<G)W.issues.push({origin:"number",input:H,code:"too_small",minimum:G,inclusive:!0,inst:X,continue:!Q.abort});if(H>$)W.issues.push({origin:"number",input:H,code:"too_big",maximum:$,inst:X})}}),mz=y("$ZodCheckMaxLength",(X,Q)=>{r0.init(X,Q),X._zod.when=(J)=>{let Y=J.value;return!B6(Y)&&Y.length!==void 0},X._zod.onattach.push((J)=>{let Y=J._zod.bag.maximum??Number.POSITIVE_INFINITY;if(Q.maximum<Y)J._zod.bag.maximum=Q.maximum}),X._zod.check=(J)=>{let Y=J.value;if(Y.length<=Q.maximum)return;let $=L6(Y);J.issues.push({origin:$,code:"too_big",maximum:Q.maximum,inclusive:!0,input:Y,inst:X,continue:!Q.abort})}}),lz=y("$ZodCheckMinLength",(X,Q)=>{r0.init(X,Q),X._zod.when=(J)=>{let Y=J.value;return!B6(Y)&&Y.length!==void 0},X._zod.onattach.push((J)=>{let Y=J._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(Q.minimum>Y)J._zod.bag.minimum=Q.minimum}),X._zod.check=(J)=>{let Y=J.value;if(Y.length>=Q.minimum)return;let $=L6(Y);J.issues.push({origin:$,code:"too_small",minimum:Q.minimum,inclusive:!0,input:Y,inst:X,continue:!Q.abort})}}),cz=y("$ZodCheckLengthEquals",(X,Q)=>{r0.init(X,Q),X._zod.when=(J)=>{let Y=J.value;return!B6(Y)&&Y.length!==void 0},X._zod.onattach.push((J)=>{let Y=J._zod.bag;Y.minimum=Q.length,Y.maximum=Q.length,Y.length=Q.length}),X._zod.check=(J)=>{let Y=J.value,G=Y.length;if(G===Q.length)return;let $=L6(Y),W=G>Q.length;J.issues.push({origin:$,...W?{code:"too_big",maximum:Q.length}:{code:"too_small",minimum:Q.length},inclusive:!0,exact:!0,input:J.value,inst:X,continue:!Q.abort})}}),q6=y("$ZodCheckStringFormat",(X,Q)=>{var J,Y;if(r0.init(X,Q),X._zod.onattach.push((G)=>{let $=G._zod.bag;if($.format=Q.format,Q.pattern)$.patterns??($.patterns=new Set),$.patterns.add(Q.pattern)}),Q.pattern)(J=X._zod).check??(J.check=(G)=>{if(Q.pattern.lastIndex=0,Q.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:Q.format,input:G.value,...Q.pattern?{pattern:Q.pattern.toString()}:{},inst:X,continue:!Q.abort})});else(Y=X._zod).check??(Y.check=()=>{})}),pz=y("$ZodCheckRegex",(X,Q)=>{q6.init(X,Q),X._zod.check=(J)=>{if(Q.pattern.lastIndex=0,Q.pattern.test(J.value))return;J.issues.push({origin:"string",code:"invalid_format",format:"regex",input:J.value,pattern:Q.pattern.toString(),inst:X,continue:!Q.abort})}}),dz=y("$ZodCheckLowerCase",(X,Q)=>{Q.pattern??(Q.pattern=gz),q6.init(X,Q)}),iz=y("$ZodCheckUpperCase",(X,Q)=>{Q.pattern??(Q.pattern=hz),q6.init(X,Q)}),nz=y("$ZodCheckIncludes",(X,Q)=>{r0.init(X,Q);let J=Z9(Q.includes),Y=new RegExp(typeof Q.position==="number"?`^.{${Q.position}}${J}`:J);Q.pattern=Y,X._zod.onattach.push((G)=>{let $=G._zod.bag;$.patterns??($.patterns=new Set),$.patterns.add(Y)}),X._zod.check=(G)=>{if(G.value.includes(Q.includes,Q.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:Q.includes,input:G.value,inst:X,continue:!Q.abort})}}),rz=y("$ZodCheckStartsWith",(X,Q)=>{r0.init(X,Q);let J=new RegExp(`^${Z9(Q.prefix)}.*`);Q.pattern??(Q.pattern=J),X._zod.onattach.push((Y)=>{let G=Y._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(J)}),X._zod.check=(Y)=>{if(Y.value.startsWith(Q.prefix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:Q.prefix,input:Y.value,inst:X,continue:!Q.abort})}}),oz=y("$ZodCheckEndsWith",(X,Q)=>{r0.init(X,Q);let J=new RegExp(`.*${Z9(Q.suffix)}$`);Q.pattern??(Q.pattern=J),X._zod.onattach.push((Y)=>{let G=Y._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(J)}),X._zod.check=(Y)=>{if(Y.value.endsWith(Q.suffix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:Q.suffix,input:Y.value,inst:X,continue:!Q.abort})}}),az=y("$ZodCheckOverwrite",(X,Q)=>{r0.init(X,Q),X._zod.check=(J)=>{J.value=Q.tx(J.value)}});class NJ{constructor(X=[]){if(this.content=[],this.indent=0,this)this.args=X}indented(X){this.indent+=1,X(this),this.indent-=1}write(X){if(typeof X==="function"){X(this,{execution:"sync"}),X(this,{execution:"async"});return}let J=X.split(`
183
+ `).filter(($)=>$),Y=Math.min(...J.map(($)=>$.length-$.trimStart().length)),G=J.map(($)=>$.slice(Y)).map(($)=>" ".repeat(this.indent*2)+$);for(let $ of G)this.content.push($)}compile(){let X=Function,Q=this?.args,Y=[...(this?.content??[""]).map((G)=>` ${G}`)];return new X(...Q,Y.join(`
184
+ `))}}var sz={major:4,minor:0,patch:0},I0=y("$ZodType",(X,Q)=>{var J;X??(X={}),X._zod.def=Q,X._zod.bag=X._zod.bag||{},X._zod.version=sz;let Y=[...X._zod.def.checks??[]];if(X._zod.traits.has("$ZodCheck"))Y.unshift(X);for(let G of Y)for(let $ of G._zod.onattach)$(X);if(Y.length===0)(J=X._zod).deferred??(J.deferred=[]),X._zod.deferred?.push(()=>{X._zod.run=X._zod.parse});else{let G=($,W,H)=>{let U=H9($),B;for(let q of W){if(q._zod.when){if(!q._zod.when($))continue}else if(U)continue;let K=$.issues.length,V=q._zod.check($);if(V instanceof Promise&&H?.async===!1)throw new F9;if(B||V instanceof Promise)B=(B??Promise.resolve()).then(async()=>{if(await V,$.issues.length===K)return;if(!U)U=H9($,K)});else{if($.issues.length===K)continue;if(!U)U=H9($,K)}}if(B)return B.then(()=>{return $});return $};X._zod.run=($,W)=>{let H=X._zod.parse($,W);if(H instanceof Promise){if(W.async===!1)throw new F9;return H.then((U)=>G(U,Y,W))}return G(H,Y,W)}}X["~standard"]={validate:(G)=>{try{let $=Bz(X,G);return $.success?{value:$.data}:{issues:$.error?.issues}}catch($){return zz(X,G).then((W)=>W.success?{value:W.data}:{issues:W.error?.issues})}},vendor:"zod",version:1}}),cX=y("$ZodString",(X,Q)=>{I0.init(X,Q),X._zod.pattern=[...X?._zod.bag?.patterns??[]].pop()??_z(X._zod.bag),X._zod.parse=(J,Y)=>{if(Q.coerce)try{J.value=String(J.value)}catch(G){}if(typeof J.value==="string")return J;return J.issues.push({expected:"string",code:"invalid_type",input:J.value,inst:X}),J}}),j0=y("$ZodStringFormat",(X,Q)=>{q6.init(X,Q),cX.init(X,Q)}),tz=y("$ZodGUID",(X,Q)=>{Q.pattern??(Q.pattern=Zz),j0.init(X,Q)}),ez=y("$ZodUUID",(X,Q)=>{if(Q.version){let Y={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[Q.version];if(Y===void 0)throw Error(`Invalid UUID version: "${Q.version}"`);Q.pattern??(Q.pattern=$5(Y))}else Q.pattern??(Q.pattern=$5());j0.init(X,Q)}),XL=y("$ZodEmail",(X,Q)=>{Q.pattern??(Q.pattern=Oz),j0.init(X,Q)}),QL=y("$ZodURL",(X,Q)=>{j0.init(X,Q),X._zod.check=(J)=>{try{let Y=J.value,G=new URL(Y),$=G.href;if(Q.hostname){if(Q.hostname.lastIndex=0,!Q.hostname.test(G.hostname))J.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Tz.source,input:J.value,inst:X,continue:!Q.abort})}if(Q.protocol){if(Q.protocol.lastIndex=0,!Q.protocol.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.protocol))J.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:Q.protocol.source,input:J.value,inst:X,continue:!Q.abort})}if(!Y.endsWith("/")&&$.endsWith("/"))J.value=$.slice(0,-1);else J.value=$;return}catch(Y){J.issues.push({code:"invalid_format",format:"url",input:J.value,inst:X,continue:!Q.abort})}}}),JL=y("$ZodEmoji",(X,Q)=>{Q.pattern??(Q.pattern=Nz()),j0.init(X,Q)}),YL=y("$ZodNanoID",(X,Q)=>{Q.pattern??(Q.pattern=Mz),j0.init(X,Q)}),GL=y("$ZodCUID",(X,Q)=>{Q.pattern??(Q.pattern=Lz),j0.init(X,Q)}),$L=y("$ZodCUID2",(X,Q)=>{Q.pattern??(Q.pattern=qz),j0.init(X,Q)}),WL=y("$ZodULID",(X,Q)=>{Q.pattern??(Q.pattern=Fz),j0.init(X,Q)}),HL=y("$ZodXID",(X,Q)=>{Q.pattern??(Q.pattern=Kz),j0.init(X,Q)}),UL=y("$ZodKSUID",(X,Q)=>{Q.pattern??(Q.pattern=Vz),j0.init(X,Q)}),BL=y("$ZodISODateTime",(X,Q)=>{Q.pattern??(Q.pattern=Cz(Q)),j0.init(X,Q)}),zL=y("$ZodISODate",(X,Q)=>{Q.pattern??(Q.pattern=Ez),j0.init(X,Q)}),LL=y("$ZodISOTime",(X,Q)=>{Q.pattern??(Q.pattern=bz(Q)),j0.init(X,Q)}),qL=y("$ZodISODuration",(X,Q)=>{Q.pattern??(Q.pattern=Dz),j0.init(X,Q)}),FL=y("$ZodIPv4",(X,Q)=>{Q.pattern??(Q.pattern=Rz),j0.init(X,Q),X._zod.onattach.push((J)=>{let Y=J._zod.bag;Y.format="ipv4"})}),KL=y("$ZodIPv6",(X,Q)=>{Q.pattern??(Q.pattern=Iz),j0.init(X,Q),X._zod.onattach.push((J)=>{let Y=J._zod.bag;Y.format="ipv6"}),X._zod.check=(J)=>{try{new URL(`http://[${J.value}]`)}catch{J.issues.push({code:"invalid_format",format:"ipv6",input:J.value,inst:X,continue:!Q.abort})}}}),VL=y("$ZodCIDRv4",(X,Q)=>{Q.pattern??(Q.pattern=jz),j0.init(X,Q)}),ML=y("$ZodCIDRv6",(X,Q)=>{Q.pattern??(Q.pattern=wz),j0.init(X,Q),X._zod.check=(J)=>{let[Y,G]=J.value.split("/");try{if(!G)throw Error();let $=Number(G);if(`${$}`!==G)throw Error();if($<0||$>128)throw Error();new URL(`http://[${Y}]`)}catch{J.issues.push({code:"invalid_format",format:"cidrv6",input:J.value,inst:X,continue:!Q.abort})}}});function RJ(X){if(X==="")return!0;if(X.length%4!==0)return!1;try{return atob(X),!0}catch{return!1}}var DL=y("$ZodBase64",(X,Q)=>{Q.pattern??(Q.pattern=Pz),j0.init(X,Q),X._zod.onattach.push((J)=>{J._zod.bag.contentEncoding="base64"}),X._zod.check=(J)=>{if(RJ(J.value))return;J.issues.push({code:"invalid_format",format:"base64",input:J.value,inst:X,continue:!Q.abort})}});function ZL(X){if(!VJ.test(X))return!1;let Q=X.replace(/[-_]/g,(Y)=>Y==="-"?"+":"/"),J=Q.padEnd(Math.ceil(Q.length/4)*4,"=");return RJ(J)}var OL=y("$ZodBase64URL",(X,Q)=>{Q.pattern??(Q.pattern=VJ),j0.init(X,Q),X._zod.onattach.push((J)=>{J._zod.bag.contentEncoding="base64url"}),X._zod.check=(J)=>{if(ZL(J.value))return;J.issues.push({code:"invalid_format",format:"base64url",input:J.value,inst:X,continue:!Q.abort})}}),AL=y("$ZodE164",(X,Q)=>{Q.pattern??(Q.pattern=Sz),j0.init(X,Q)});function NL(X,Q=null){try{let J=X.split(".");if(J.length!==3)return!1;let[Y]=J;if(!Y)return!1;let G=JSON.parse(atob(Y));if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(Q&&(!("alg"in G)||G.alg!==Q))return!1;return!0}catch{return!1}}var RL=y("$ZodJWT",(X,Q)=>{j0.init(X,Q),X._zod.check=(J)=>{if(NL(J.value,Q.alg))return;J.issues.push({code:"invalid_format",format:"jwt",input:J.value,inst:X,continue:!Q.abort})}}),IJ=y("$ZodNumber",(X,Q)=>{I0.init(X,Q),X._zod.pattern=X._zod.bag.pattern??vz,X._zod.parse=(J,Y)=>{if(Q.coerce)try{J.value=Number(J.value)}catch(W){}let G=J.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return J;let $=typeof G==="number"?Number.isNaN(G)?"NaN":!Number.isFinite(G)?"Infinity":void 0:void 0;return J.issues.push({expected:"number",code:"invalid_type",input:G,inst:X,...$?{received:$}:{}}),J}}),IL=y("$ZodNumber",(X,Q)=>{uz.init(X,Q),IJ.init(X,Q)}),jL=y("$ZodBoolean",(X,Q)=>{I0.init(X,Q),X._zod.pattern=yz,X._zod.parse=(J,Y)=>{if(Q.coerce)try{J.value=Boolean(J.value)}catch($){}let G=J.value;if(typeof G==="boolean")return J;return J.issues.push({expected:"boolean",code:"invalid_type",input:G,inst:X}),J}}),wL=y("$ZodNull",(X,Q)=>{I0.init(X,Q),X._zod.pattern=xz,X._zod.values=new Set([null]),X._zod.parse=(J,Y)=>{let G=J.value;if(G===null)return J;return J.issues.push({expected:"null",code:"invalid_type",input:G,inst:X}),J}}),PL=y("$ZodUnknown",(X,Q)=>{I0.init(X,Q),X._zod.parse=(J)=>J}),TL=y("$ZodNever",(X,Q)=>{I0.init(X,Q),X._zod.parse=(J,Y)=>{return J.issues.push({expected:"never",code:"invalid_type",input:J.value,inst:X}),J}});function W5(X,Q,J){if(X.issues.length)Q.issues.push(..._1(J,X.issues));Q.value[J]=X.value}var SL=y("$ZodArray",(X,Q)=>{I0.init(X,Q),X._zod.parse=(J,Y)=>{let G=J.value;if(!Array.isArray(G))return J.issues.push({expected:"array",code:"invalid_type",input:G,inst:X}),J;J.value=Array(G.length);let $=[];for(let W=0;W<G.length;W++){let H=G[W],U=Q.element._zod.run({value:H,issues:[]},Y);if(U instanceof Promise)$.push(U.then((B)=>W5(B,J,W)));else W5(U,J,W)}if($.length)return Promise.all($).then(()=>J);return J}});function f8(X,Q,J){if(X.issues.length)Q.issues.push(..._1(J,X.issues));Q.value[J]=X.value}function H5(X,Q,J,Y){if(X.issues.length)if(Y[J]===void 0)if(J in Y)Q.value[J]=void 0;else Q.value[J]=X.value;else Q.issues.push(..._1(J,X.issues));else if(X.value===void 0){if(J in Y)Q.value[J]=void 0}else Q.value[J]=X.value}var EL=y("$ZodObject",(X,Q)=>{I0.init(X,Q);let J=U6(()=>{let K=Object.keys(Q.shape);for(let N of K)if(!(Q.shape[N]instanceof I0))throw Error(`Invalid element at key "${N}": expected a Zod schema`);let V=WJ(Q.shape);return{shape:Q.shape,keys:K,keySet:new Set(K),numKeys:K.length,optionalKeys:new Set(V)}});R0(X._zod,"propValues",()=>{let K=Q.shape,V={};for(let N in K){let w=K[N]._zod;if(w.values){V[N]??(V[N]=new Set);for(let A of w.values)V[N].add(A)}}return V});let Y=(K)=>{let V=new NJ(["shape","payload","ctx"]),N=J.value,w=(M)=>{let F=$9(M);return`shape[${F}]._zod.run({ value: input[${F}], issues: [] }, ctx)`};V.write("const input = payload.value;");let A=Object.create(null),Z=0;for(let M of N.keys)A[M]=`key_${Z++}`;V.write("const newResult = {}");for(let M of N.keys)if(N.optionalKeys.has(M)){let F=A[M];V.write(`const ${F} = ${w(M)};`);let L=$9(M);V.write(`
185
+ if (${F}.issues.length) {
186
+ if (input[${L}] === undefined) {
187
+ if (${L} in input) {
188
+ newResult[${L}] = undefined;
189
+ }
190
+ } else {
191
+ payload.issues = payload.issues.concat(
192
+ ${F}.issues.map((iss) => ({
193
+ ...iss,
194
+ path: iss.path ? [${L}, ...iss.path] : [${L}],
195
+ }))
196
+ );
197
+ }
198
+ } else if (${F}.value === undefined) {
199
+ if (${L} in input) newResult[${L}] = undefined;
200
+ } else {
201
+ newResult[${L}] = ${F}.value;
202
+ }
203
+ `)}else{let F=A[M];V.write(`const ${F} = ${w(M)};`),V.write(`
204
+ if (${F}.issues.length) payload.issues = payload.issues.concat(${F}.issues.map(iss => ({
205
+ ...iss,
206
+ path: iss.path ? [${$9(M)}, ...iss.path] : [${$9(M)}]
207
+ })));`),V.write(`newResult[${$9(M)}] = ${F}.value`)}V.write("payload.value = newResult;"),V.write("return payload;");let z=V.compile();return(M,F)=>z(K,M,F)},G,$=X8,W=!SX.jitless,U=W&&GJ.value,B=Q.catchall,q;X._zod.parse=(K,V)=>{q??(q=J.value);let N=K.value;if(!$(N))return K.issues.push({expected:"object",code:"invalid_type",input:N,inst:X}),K;let w=[];if(W&&U&&V?.async===!1&&V.jitless!==!0){if(!G)G=Y(Q.shape);K=G(K,V)}else{K.value={};let F=q.shape;for(let L of q.keys){let O=F[L],D=O._zod.run({value:N[L],issues:[]},V),I=O._zod.optin==="optional"&&O._zod.optout==="optional";if(D instanceof Promise)w.push(D.then((j)=>I?H5(j,K,L,N):f8(j,K,L)));else if(I)H5(D,K,L,N);else f8(D,K,L)}}if(!B)return w.length?Promise.all(w).then(()=>K):K;let A=[],Z=q.keySet,z=B._zod,M=z.def.type;for(let F of Object.keys(N)){if(Z.has(F))continue;if(M==="never"){A.push(F);continue}let L=z.run({value:N[F],issues:[]},V);if(L instanceof Promise)w.push(L.then((O)=>f8(O,K,F)));else f8(L,K,F)}if(A.length)K.issues.push({code:"unrecognized_keys",keys:A,input:N,inst:X});if(!w.length)return K;return Promise.all(w).then(()=>{return K})}});function U5(X,Q,J,Y){for(let G of X)if(G.issues.length===0)return Q.value=G.value,Q;return Q.issues.push({code:"invalid_union",input:Q.value,inst:J,errors:X.map((G)=>G.issues.map(($)=>S1($,Y,T1())))}),Q}var jJ=y("$ZodUnion",(X,Q)=>{I0.init(X,Q),R0(X._zod,"optin",()=>Q.options.some((J)=>J._zod.optin==="optional")?"optional":void 0),R0(X._zod,"optout",()=>Q.options.some((J)=>J._zod.optout==="optional")?"optional":void 0),R0(X._zod,"values",()=>{if(Q.options.every((J)=>J._zod.values))return new Set(Q.options.flatMap((J)=>Array.from(J._zod.values)));return}),R0(X._zod,"pattern",()=>{if(Q.options.every((J)=>J._zod.pattern)){let J=Q.options.map((Y)=>Y._zod.pattern);return new RegExp(`^(${J.map((Y)=>z6(Y.source)).join("|")})$`)}return}),X._zod.parse=(J,Y)=>{let G=!1,$=[];for(let W of Q.options){let H=W._zod.run({value:J.value,issues:[]},Y);if(H instanceof Promise)$.push(H),G=!0;else{if(H.issues.length===0)return H;$.push(H)}}if(!G)return U5($,J,X,Y);return Promise.all($).then((W)=>{return U5(W,J,X,Y)})}}),bL=y("$ZodDiscriminatedUnion",(X,Q)=>{jJ.init(X,Q);let J=X._zod.parse;R0(X._zod,"propValues",()=>{let G={};for(let $ of Q.options){let W=$._zod.propValues;if(!W||Object.keys(W).length===0)throw Error(`Invalid discriminated union option at index "${Q.options.indexOf($)}"`);for(let[H,U]of Object.entries(W)){if(!G[H])G[H]=new Set;for(let B of U)G[H].add(B)}}return G});let Y=U6(()=>{let G=Q.options,$=new Map;for(let W of G){let H=W._zod.propValues[Q.discriminator];if(!H||H.size===0)throw Error(`Invalid discriminated union option at index "${Q.options.indexOf(W)}"`);for(let U of H){if($.has(U))throw Error(`Duplicate discriminator value "${String(U)}"`);$.set(U,W)}}return $});X._zod.parse=(G,$)=>{let W=G.value;if(!X8(W))return G.issues.push({code:"invalid_type",expected:"object",input:W,inst:X}),G;let H=Y.value.get(W?.[Q.discriminator]);if(H)return H._zod.run(G,$);if(Q.unionFallback)return J(G,$);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:W,path:[Q.discriminator],inst:X}),G}}),CL=y("$ZodIntersection",(X,Q)=>{I0.init(X,Q),X._zod.parse=(J,Y)=>{let G=J.value,$=Q.left._zod.run({value:G,issues:[]},Y),W=Q.right._zod.run({value:G,issues:[]},Y);if($ instanceof Promise||W instanceof Promise)return Promise.all([$,W]).then(([U,B])=>{return B5(J,U,B)});return B5(J,$,W)}});function bX(X,Q){if(X===Q)return{valid:!0,data:X};if(X instanceof Date&&Q instanceof Date&&+X===+Q)return{valid:!0,data:X};if(Q8(X)&&Q8(Q)){let J=Object.keys(Q),Y=Object.keys(X).filter(($)=>J.indexOf($)!==-1),G={...X,...Q};for(let $ of Y){let W=bX(X[$],Q[$]);if(!W.valid)return{valid:!1,mergeErrorPath:[$,...W.mergeErrorPath]};G[$]=W.data}return{valid:!0,data:G}}if(Array.isArray(X)&&Array.isArray(Q)){if(X.length!==Q.length)return{valid:!1,mergeErrorPath:[]};let J=[];for(let Y=0;Y<X.length;Y++){let G=X[Y],$=Q[Y],W=bX(G,$);if(!W.valid)return{valid:!1,mergeErrorPath:[Y,...W.mergeErrorPath]};J.push(W.data)}return{valid:!0,data:J}}return{valid:!1,mergeErrorPath:[]}}function B5(X,Q,J){if(Q.issues.length)X.issues.push(...Q.issues);if(J.issues.length)X.issues.push(...J.issues);if(H9(X))return X;let Y=bX(Q.value,J.value);if(!Y.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(Y.mergeErrorPath)}`);return X.value=Y.data,X}var _L=y("$ZodRecord",(X,Q)=>{I0.init(X,Q),X._zod.parse=(J,Y)=>{let G=J.value;if(!Q8(G))return J.issues.push({expected:"record",code:"invalid_type",input:G,inst:X}),J;let $=[];if(Q.keyType._zod.values){let W=Q.keyType._zod.values;J.value={};for(let U of W)if(typeof U==="string"||typeof U==="number"||typeof U==="symbol"){let B=Q.valueType._zod.run({value:G[U],issues:[]},Y);if(B instanceof Promise)$.push(B.then((q)=>{if(q.issues.length)J.issues.push(..._1(U,q.issues));J.value[U]=q.value}));else{if(B.issues.length)J.issues.push(..._1(U,B.issues));J.value[U]=B.value}}let H;for(let U in G)if(!W.has(U))H=H??[],H.push(U);if(H&&H.length>0)J.issues.push({code:"unrecognized_keys",input:G,inst:X,keys:H})}else{J.value={};for(let W of Reflect.ownKeys(G)){if(W==="__proto__")continue;let H=Q.keyType._zod.run({value:W,issues:[]},Y);if(H instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(H.issues.length){J.issues.push({origin:"record",code:"invalid_key",issues:H.issues.map((B)=>S1(B,Y,T1())),input:W,path:[W],inst:X}),J.value[H.value]=H.value;continue}let U=Q.valueType._zod.run({value:G[W],issues:[]},Y);if(U instanceof Promise)$.push(U.then((B)=>{if(B.issues.length)J.issues.push(..._1(W,B.issues));J.value[H.value]=B.value}));else{if(U.issues.length)J.issues.push(..._1(W,U.issues));J.value[H.value]=U.value}}}if($.length)return Promise.all($).then(()=>J);return J}}),kL=y("$ZodEnum",(X,Q)=>{I0.init(X,Q);let J=QJ(Q.entries);X._zod.values=new Set(J),X._zod.pattern=new RegExp(`^(${J.filter((Y)=>$J.has(typeof Y)).map((Y)=>typeof Y==="string"?Z9(Y):Y.toString()).join("|")})$`),X._zod.parse=(Y,G)=>{let $=Y.value;if(X._zod.values.has($))return Y;return Y.issues.push({code:"invalid_value",values:J,input:$,inst:X}),Y}}),vL=y("$ZodLiteral",(X,Q)=>{I0.init(X,Q),X._zod.values=new Set(Q.values),X._zod.pattern=new RegExp(`^(${Q.values.map((J)=>typeof J==="string"?Z9(J):J?J.toString():String(J)).join("|")})$`),X._zod.parse=(J,Y)=>{let G=J.value;if(X._zod.values.has(G))return J;return J.issues.push({code:"invalid_value",values:Q.values,input:G,inst:X}),J}}),yL=y("$ZodTransform",(X,Q)=>{I0.init(X,Q),X._zod.parse=(J,Y)=>{let G=Q.transform(J.value,J);if(Y.async)return(G instanceof Promise?G:Promise.resolve(G)).then((W)=>{return J.value=W,J});if(G instanceof Promise)throw new F9;return J.value=G,J}}),xL=y("$ZodOptional",(X,Q)=>{I0.init(X,Q),X._zod.optin="optional",X._zod.optout="optional",R0(X._zod,"values",()=>{return Q.innerType._zod.values?new Set([...Q.innerType._zod.values,void 0]):void 0}),R0(X._zod,"pattern",()=>{let J=Q.innerType._zod.pattern;return J?new RegExp(`^(${z6(J.source)})?$`):void 0}),X._zod.parse=(J,Y)=>{if(Q.innerType._zod.optin==="optional")return Q.innerType._zod.run(J,Y);if(J.value===void 0)return J;return Q.innerType._zod.run(J,Y)}}),gL=y("$ZodNullable",(X,Q)=>{I0.init(X,Q),R0(X._zod,"optin",()=>Q.innerType._zod.optin),R0(X._zod,"optout",()=>Q.innerType._zod.optout),R0(X._zod,"pattern",()=>{let J=Q.innerType._zod.pattern;return J?new RegExp(`^(${z6(J.source)}|null)$`):void 0}),R0(X._zod,"values",()=>{return Q.innerType._zod.values?new Set([...Q.innerType._zod.values,null]):void 0}),X._zod.parse=(J,Y)=>{if(J.value===null)return J;return Q.innerType._zod.run(J,Y)}}),hL=y("$ZodDefault",(X,Q)=>{I0.init(X,Q),X._zod.optin="optional",R0(X._zod,"values",()=>Q.innerType._zod.values),X._zod.parse=(J,Y)=>{if(J.value===void 0)return J.value=Q.defaultValue,J;let G=Q.innerType._zod.run(J,Y);if(G instanceof Promise)return G.then(($)=>z5($,Q));return z5(G,Q)}});function z5(X,Q){if(X.value===void 0)X.value=Q.defaultValue;return X}var fL=y("$ZodPrefault",(X,Q)=>{I0.init(X,Q),X._zod.optin="optional",R0(X._zod,"values",()=>Q.innerType._zod.values),X._zod.parse=(J,Y)=>{if(J.value===void 0)J.value=Q.defaultValue;return Q.innerType._zod.run(J,Y)}}),uL=y("$ZodNonOptional",(X,Q)=>{I0.init(X,Q),R0(X._zod,"values",()=>{let J=Q.innerType._zod.values;return J?new Set([...J].filter((Y)=>Y!==void 0)):void 0}),X._zod.parse=(J,Y)=>{let G=Q.innerType._zod.run(J,Y);if(G instanceof Promise)return G.then(($)=>L5($,X));return L5(G,X)}});function L5(X,Q){if(!X.issues.length&&X.value===void 0)X.issues.push({code:"invalid_type",expected:"nonoptional",input:X.value,inst:Q});return X}var mL=y("$ZodCatch",(X,Q)=>{I0.init(X,Q),X._zod.optin="optional",R0(X._zod,"optout",()=>Q.innerType._zod.optout),R0(X._zod,"values",()=>Q.innerType._zod.values),X._zod.parse=(J,Y)=>{let G=Q.innerType._zod.run(J,Y);if(G instanceof Promise)return G.then(($)=>{if(J.value=$.value,$.issues.length)J.value=Q.catchValue({...J,error:{issues:$.issues.map((W)=>S1(W,Y,T1()))},input:J.value}),J.issues=[];return J});if(J.value=G.value,G.issues.length)J.value=Q.catchValue({...J,error:{issues:G.issues.map(($)=>S1($,Y,T1()))},input:J.value}),J.issues=[];return J}}),lL=y("$ZodPipe",(X,Q)=>{I0.init(X,Q),R0(X._zod,"values",()=>Q.in._zod.values),R0(X._zod,"optin",()=>Q.in._zod.optin),R0(X._zod,"optout",()=>Q.out._zod.optout),X._zod.parse=(J,Y)=>{let G=Q.in._zod.run(J,Y);if(G instanceof Promise)return G.then(($)=>q5($,Q,Y));return q5(G,Q,Y)}});function q5(X,Q,J){if(H9(X))return X;return Q.out._zod.run({value:X.value,issues:X.issues},J)}var cL=y("$ZodReadonly",(X,Q)=>{I0.init(X,Q),R0(X._zod,"propValues",()=>Q.innerType._zod.propValues),R0(X._zod,"values",()=>Q.innerType._zod.values),R0(X._zod,"optin",()=>Q.innerType._zod.optin),R0(X._zod,"optout",()=>Q.innerType._zod.optout),X._zod.parse=(J,Y)=>{let G=Q.innerType._zod.run(J,Y);if(G instanceof Promise)return G.then(F5);return F5(G)}});function F5(X){return X.value=Object.freeze(X.value),X}var pL=y("$ZodCustom",(X,Q)=>{r0.init(X,Q),I0.init(X,Q),X._zod.parse=(J,Y)=>{return J},X._zod.check=(J)=>{let Y=J.value,G=Q.fn(Y);if(G instanceof Promise)return G.then(($)=>K5($,J,Y,X));K5(G,J,Y,X);return}});function K5(X,Q,J,Y){if(!X){let G={code:"custom",input:J,inst:Y,path:[...Y._zod.def.path??[]],continue:!Y._zod.def.abort};if(Y._zod.def.params)G.params=Y._zod.def.params;Q.issues.push(UJ(G))}}var dL=(X)=>{let Q=typeof X;switch(Q){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return Q},iL=()=>{let X={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function Q(Y){return X[Y]??null}let J={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(Y)=>{switch(Y.code){case"invalid_type":return`Invalid input: expected ${Y.expected}, received ${dL(Y.input)}`;case"invalid_value":if(Y.values.length===1)return`Invalid input: expected ${lX(Y.values[0])}`;return`Invalid option: expected one of ${EX(Y.values,"|")}`;case"too_big":{let G=Y.inclusive?"<=":"<",$=Q(Y.origin);if($)return`Too big: expected ${Y.origin??"value"} to have ${G}${Y.maximum.toString()} ${$.unit??"elements"}`;return`Too big: expected ${Y.origin??"value"} to be ${G}${Y.maximum.toString()}`}case"too_small":{let G=Y.inclusive?">=":">",$=Q(Y.origin);if($)return`Too small: expected ${Y.origin} to have ${G}${Y.minimum.toString()} ${$.unit}`;return`Too small: expected ${Y.origin} to be ${G}${Y.minimum.toString()}`}case"invalid_format":{let G=Y;if(G.format==="starts_with")return`Invalid string: must start with "${G.prefix}"`;if(G.format==="ends_with")return`Invalid string: must end with "${G.suffix}"`;if(G.format==="includes")return`Invalid string: must include "${G.includes}"`;if(G.format==="regex")return`Invalid string: must match pattern ${G.pattern}`;return`Invalid ${J[G.format]??Y.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${Y.divisor}`;case"unrecognized_keys":return`Unrecognized key${Y.keys.length>1?"s":""}: ${EX(Y.keys,", ")}`;case"invalid_key":return`Invalid key in ${Y.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${Y.origin}`;default:return"Invalid input"}}};function nL(){return{localeError:iL()}}var NP=Symbol("ZodOutput"),RP=Symbol("ZodInput");class wJ{constructor(){this._map=new WeakMap,this._idmap=new Map}add(X,...Q){let J=Q[0];if(this._map.set(X,J),J&&typeof J==="object"&&"id"in J){if(this._idmap.has(J.id))throw Error(`ID ${J.id} already exists in the registry`);this._idmap.set(J.id,X)}return this}remove(X){return this._map.delete(X),this}get(X){let Q=X._zod.parent;if(Q){let J={...this.get(Q)??{}};return delete J.id,{...J,...this._map.get(X)}}return this._map.get(X)}has(X){return this._map.has(X)}}function rL(){return new wJ}var u8=rL();function oL(X,Q){return new X({type:"string",...J0(Q)})}function aL(X,Q){return new X({type:"string",format:"email",check:"string_format",abort:!1,...J0(Q)})}function V5(X,Q){return new X({type:"string",format:"guid",check:"string_format",abort:!1,...J0(Q)})}function sL(X,Q){return new X({type:"string",format:"uuid",check:"string_format",abort:!1,...J0(Q)})}function tL(X,Q){return new X({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...J0(Q)})}function eL(X,Q){return new X({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...J0(Q)})}function Xq(X,Q){return new X({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...J0(Q)})}function Qq(X,Q){return new X({type:"string",format:"url",check:"string_format",abort:!1,...J0(Q)})}function Jq(X,Q){return new X({type:"string",format:"emoji",check:"string_format",abort:!1,...J0(Q)})}function Yq(X,Q){return new X({type:"string",format:"nanoid",check:"string_format",abort:!1,...J0(Q)})}function Gq(X,Q){return new X({type:"string",format:"cuid",check:"string_format",abort:!1,...J0(Q)})}function $q(X,Q){return new X({type:"string",format:"cuid2",check:"string_format",abort:!1,...J0(Q)})}function Wq(X,Q){return new X({type:"string",format:"ulid",check:"string_format",abort:!1,...J0(Q)})}function Hq(X,Q){return new X({type:"string",format:"xid",check:"string_format",abort:!1,...J0(Q)})}function Uq(X,Q){return new X({type:"string",format:"ksuid",check:"string_format",abort:!1,...J0(Q)})}function Bq(X,Q){return new X({type:"string",format:"ipv4",check:"string_format",abort:!1,...J0(Q)})}function zq(X,Q){return new X({type:"string",format:"ipv6",check:"string_format",abort:!1,...J0(Q)})}function Lq(X,Q){return new X({type:"string",format:"cidrv4",check:"string_format",abort:!1,...J0(Q)})}function qq(X,Q){return new X({type:"string",format:"cidrv6",check:"string_format",abort:!1,...J0(Q)})}function Fq(X,Q){return new X({type:"string",format:"base64",check:"string_format",abort:!1,...J0(Q)})}function Kq(X,Q){return new X({type:"string",format:"base64url",check:"string_format",abort:!1,...J0(Q)})}function Vq(X,Q){return new X({type:"string",format:"e164",check:"string_format",abort:!1,...J0(Q)})}function Mq(X,Q){return new X({type:"string",format:"jwt",check:"string_format",abort:!1,...J0(Q)})}function Dq(X,Q){return new X({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...J0(Q)})}function Zq(X,Q){return new X({type:"string",format:"date",check:"string_format",...J0(Q)})}function Oq(X,Q){return new X({type:"string",format:"time",check:"string_format",precision:null,...J0(Q)})}function Aq(X,Q){return new X({type:"string",format:"duration",check:"string_format",...J0(Q)})}function Nq(X,Q){return new X({type:"number",checks:[],...J0(Q)})}function Rq(X,Q){return new X({type:"number",check:"number_format",abort:!1,format:"safeint",...J0(Q)})}function Iq(X,Q){return new X({type:"boolean",...J0(Q)})}function jq(X,Q){return new X({type:"null",...J0(Q)})}function wq(X){return new X({type:"unknown"})}function Pq(X,Q){return new X({type:"never",...J0(Q)})}function M5(X,Q){return new OJ({check:"less_than",...J0(Q),value:X,inclusive:!1})}function NX(X,Q){return new OJ({check:"less_than",...J0(Q),value:X,inclusive:!0})}function D5(X,Q){return new AJ({check:"greater_than",...J0(Q),value:X,inclusive:!1})}function RX(X,Q){return new AJ({check:"greater_than",...J0(Q),value:X,inclusive:!0})}function Z5(X,Q){return new fz({check:"multiple_of",...J0(Q),value:X})}function PJ(X,Q){return new mz({check:"max_length",...J0(Q),maximum:X})}function e8(X,Q){return new lz({check:"min_length",...J0(Q),minimum:X})}function TJ(X,Q){return new cz({check:"length_equals",...J0(Q),length:X})}function Tq(X,Q){return new pz({check:"string_format",format:"regex",...J0(Q),pattern:X})}function Sq(X){return new dz({check:"string_format",format:"lowercase",...J0(X)})}function Eq(X){return new iz({check:"string_format",format:"uppercase",...J0(X)})}function bq(X,Q){return new nz({check:"string_format",format:"includes",...J0(Q),includes:X})}function Cq(X,Q){return new rz({check:"string_format",format:"starts_with",...J0(Q),prefix:X})}function _q(X,Q){return new oz({check:"string_format",format:"ends_with",...J0(Q),suffix:X})}function Y8(X){return new az({check:"overwrite",tx:X})}function kq(X){return Y8((Q)=>Q.normalize(X))}function vq(){return Y8((X)=>X.trim())}function yq(){return Y8((X)=>X.toLowerCase())}function xq(){return Y8((X)=>X.toUpperCase())}function gq(X,Q,J){return new X({type:"array",element:Q,...J0(J)})}function hq(X,Q,J){let Y=J0(J);return Y.abort??(Y.abort=!0),new X({type:"custom",check:"custom",fn:Q,...Y})}function fq(X,Q,J){return new X({type:"custom",check:"custom",fn:Q,...J0(J)})}var SJ={};w5(SJ,{time:()=>vJ,duration:()=>xJ,datetime:()=>bJ,date:()=>_J,ZodISOTime:()=>kJ,ZodISODuration:()=>yJ,ZodISODateTime:()=>EJ,ZodISODate:()=>CJ});var EJ=y("ZodISODateTime",(X,Q)=>{BL.init(X,Q),b0.init(X,Q)});function bJ(X){return Dq(EJ,X)}var CJ=y("ZodISODate",(X,Q)=>{zL.init(X,Q),b0.init(X,Q)});function _J(X){return Zq(CJ,X)}var kJ=y("ZodISOTime",(X,Q)=>{LL.init(X,Q),b0.init(X,Q)});function vJ(X){return Oq(kJ,X)}var yJ=y("ZodISODuration",(X,Q)=>{qL.init(X,Q),b0.init(X,Q)});function xJ(X){return Aq(yJ,X)}var gJ=(X,Q)=>{LJ.init(X,Q),X.name="ZodError",Object.defineProperties(X,{format:{value:(J)=>Wz(X,J)},flatten:{value:(J)=>$z(X,J)},addIssue:{value:(J)=>X.issues.push(J)},addIssues:{value:(J)=>X.issues.push(...J)},isEmpty:{get(){return X.issues.length===0}}})},IP=y("ZodError",gJ),F6=y("ZodError",gJ,{Parent:Error}),uq=Hz(F6),mq=Uz(F6),lq=FJ(F6),cq=KJ(F6),E0=y("ZodType",(X,Q)=>{return I0.init(X,Q),X.def=Q,Object.defineProperty(X,"_def",{value:Q}),X.check=(...J)=>{return X.clone({...Q,checks:[...Q.checks??[],...J.map((Y)=>typeof Y==="function"?{_zod:{check:Y,def:{check:"custom"},onattach:[]}}:Y)]})},X.clone=(J,Y)=>y1(X,J,Y),X.brand=()=>X,X.register=(J,Y)=>{return J.add(X,Y),X},X.parse=(J,Y)=>uq(X,J,Y,{callee:X.parse}),X.safeParse=(J,Y)=>lq(X,J,Y),X.parseAsync=async(J,Y)=>mq(X,J,Y,{callee:X.parseAsync}),X.safeParseAsync=async(J,Y)=>cq(X,J,Y),X.spa=X.safeParseAsync,X.refine=(J,Y)=>X.check(kF(J,Y)),X.superRefine=(J)=>X.check(vF(J)),X.overwrite=(J)=>X.check(Y8(J)),X.optional=()=>s(X),X.nullable=()=>N5(X),X.nullish=()=>s(N5(X)),X.nonoptional=(J)=>wF(X,J),X.array=()=>F0(X),X.or=(J)=>w0([X,J]),X.and=(J)=>pX(X,J),X.transform=(J)=>_X(X,pJ(J)),X.default=(J)=>RF(X,J),X.prefault=(J)=>jF(X,J),X.catch=(J)=>TF(X,J),X.pipe=(J)=>_X(X,J),X.readonly=()=>bF(X),X.describe=(J)=>{let Y=X.clone();return u8.add(Y,{description:J}),Y},Object.defineProperty(X,"description",{get(){return u8.get(X)?.description},configurable:!0}),X.meta=(...J)=>{if(J.length===0)return u8.get(X);let Y=X.clone();return u8.add(Y,J[0]),Y},X.isOptional=()=>X.safeParse(void 0).success,X.isNullable=()=>X.safeParse(null).success,X}),hJ=y("_ZodString",(X,Q)=>{cX.init(X,Q),E0.init(X,Q);let J=X._zod.bag;X.format=J.format??null,X.minLength=J.minimum??null,X.maxLength=J.maximum??null,X.regex=(...Y)=>X.check(Tq(...Y)),X.includes=(...Y)=>X.check(bq(...Y)),X.startsWith=(...Y)=>X.check(Cq(...Y)),X.endsWith=(...Y)=>X.check(_q(...Y)),X.min=(...Y)=>X.check(e8(...Y)),X.max=(...Y)=>X.check(PJ(...Y)),X.length=(...Y)=>X.check(TJ(...Y)),X.nonempty=(...Y)=>X.check(e8(1,...Y)),X.lowercase=(Y)=>X.check(Sq(Y)),X.uppercase=(Y)=>X.check(Eq(Y)),X.trim=()=>X.check(vq()),X.normalize=(...Y)=>X.check(kq(...Y)),X.toLowerCase=()=>X.check(yq()),X.toUpperCase=()=>X.check(xq())}),pq=y("ZodString",(X,Q)=>{cX.init(X,Q),hJ.init(X,Q),X.email=(J)=>X.check(aL(dq,J)),X.url=(J)=>X.check(Qq(iq,J)),X.jwt=(J)=>X.check(Mq(HF,J)),X.emoji=(J)=>X.check(Jq(nq,J)),X.guid=(J)=>X.check(V5(O5,J)),X.uuid=(J)=>X.check(sL(m8,J)),X.uuidv4=(J)=>X.check(tL(m8,J)),X.uuidv6=(J)=>X.check(eL(m8,J)),X.uuidv7=(J)=>X.check(Xq(m8,J)),X.nanoid=(J)=>X.check(Yq(rq,J)),X.guid=(J)=>X.check(V5(O5,J)),X.cuid=(J)=>X.check(Gq(oq,J)),X.cuid2=(J)=>X.check($q(aq,J)),X.ulid=(J)=>X.check(Wq(sq,J)),X.base64=(J)=>X.check(Fq(GF,J)),X.base64url=(J)=>X.check(Kq($F,J)),X.xid=(J)=>X.check(Hq(tq,J)),X.ksuid=(J)=>X.check(Uq(eq,J)),X.ipv4=(J)=>X.check(Bq(XF,J)),X.ipv6=(J)=>X.check(zq(QF,J)),X.cidrv4=(J)=>X.check(Lq(JF,J)),X.cidrv6=(J)=>X.check(qq(YF,J)),X.e164=(J)=>X.check(Vq(WF,J)),X.datetime=(J)=>X.check(bJ(J)),X.date=(J)=>X.check(_J(J)),X.time=(J)=>X.check(vJ(J)),X.duration=(J)=>X.check(xJ(J))});function v(X){return oL(pq,X)}var b0=y("ZodStringFormat",(X,Q)=>{j0.init(X,Q),hJ.init(X,Q)}),dq=y("ZodEmail",(X,Q)=>{XL.init(X,Q),b0.init(X,Q)}),O5=y("ZodGUID",(X,Q)=>{tz.init(X,Q),b0.init(X,Q)}),m8=y("ZodUUID",(X,Q)=>{ez.init(X,Q),b0.init(X,Q)}),iq=y("ZodURL",(X,Q)=>{QL.init(X,Q),b0.init(X,Q)}),nq=y("ZodEmoji",(X,Q)=>{JL.init(X,Q),b0.init(X,Q)}),rq=y("ZodNanoID",(X,Q)=>{YL.init(X,Q),b0.init(X,Q)}),oq=y("ZodCUID",(X,Q)=>{GL.init(X,Q),b0.init(X,Q)}),aq=y("ZodCUID2",(X,Q)=>{$L.init(X,Q),b0.init(X,Q)}),sq=y("ZodULID",(X,Q)=>{WL.init(X,Q),b0.init(X,Q)}),tq=y("ZodXID",(X,Q)=>{HL.init(X,Q),b0.init(X,Q)}),eq=y("ZodKSUID",(X,Q)=>{UL.init(X,Q),b0.init(X,Q)}),XF=y("ZodIPv4",(X,Q)=>{FL.init(X,Q),b0.init(X,Q)}),QF=y("ZodIPv6",(X,Q)=>{KL.init(X,Q),b0.init(X,Q)}),JF=y("ZodCIDRv4",(X,Q)=>{VL.init(X,Q),b0.init(X,Q)}),YF=y("ZodCIDRv6",(X,Q)=>{ML.init(X,Q),b0.init(X,Q)}),GF=y("ZodBase64",(X,Q)=>{DL.init(X,Q),b0.init(X,Q)}),$F=y("ZodBase64URL",(X,Q)=>{OL.init(X,Q),b0.init(X,Q)}),WF=y("ZodE164",(X,Q)=>{AL.init(X,Q),b0.init(X,Q)}),HF=y("ZodJWT",(X,Q)=>{RL.init(X,Q),b0.init(X,Q)}),fJ=y("ZodNumber",(X,Q)=>{IJ.init(X,Q),E0.init(X,Q),X.gt=(Y,G)=>X.check(D5(Y,G)),X.gte=(Y,G)=>X.check(RX(Y,G)),X.min=(Y,G)=>X.check(RX(Y,G)),X.lt=(Y,G)=>X.check(M5(Y,G)),X.lte=(Y,G)=>X.check(NX(Y,G)),X.max=(Y,G)=>X.check(NX(Y,G)),X.int=(Y)=>X.check(A5(Y)),X.safe=(Y)=>X.check(A5(Y)),X.positive=(Y)=>X.check(D5(0,Y)),X.nonnegative=(Y)=>X.check(RX(0,Y)),X.negative=(Y)=>X.check(M5(0,Y)),X.nonpositive=(Y)=>X.check(NX(0,Y)),X.multipleOf=(Y,G)=>X.check(Z5(Y,G)),X.step=(Y,G)=>X.check(Z5(Y,G)),X.finite=()=>X;let J=X._zod.bag;X.minValue=Math.max(J.minimum??Number.NEGATIVE_INFINITY,J.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,X.maxValue=Math.min(J.maximum??Number.POSITIVE_INFINITY,J.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,X.isInt=(J.format??"").includes("int")||Number.isSafeInteger(J.multipleOf??0.5),X.isFinite=!0,X.format=J.format??null});function A0(X){return Nq(fJ,X)}var UF=y("ZodNumberFormat",(X,Q)=>{IL.init(X,Q),fJ.init(X,Q)});function A5(X){return Rq(UF,X)}var BF=y("ZodBoolean",(X,Q)=>{jL.init(X,Q),E0.init(X,Q)});function m0(X){return Iq(BF,X)}var zF=y("ZodNull",(X,Q)=>{wL.init(X,Q),E0.init(X,Q)});function uJ(X){return jq(zF,X)}var LF=y("ZodUnknown",(X,Q)=>{PL.init(X,Q),E0.init(X,Q)});function y0(){return wq(LF)}var qF=y("ZodNever",(X,Q)=>{TL.init(X,Q),E0.init(X,Q)});function FF(X){return Pq(qF,X)}var KF=y("ZodArray",(X,Q)=>{SL.init(X,Q),E0.init(X,Q),X.element=Q.element,X.min=(J,Y)=>X.check(e8(J,Y)),X.nonempty=(J)=>X.check(e8(1,J)),X.max=(J,Y)=>X.check(PJ(J,Y)),X.length=(J,Y)=>X.check(TJ(J,Y)),X.unwrap=()=>X.element});function F0(X,Q){return gq(KF,X,Q)}var mJ=y("ZodObject",(X,Q)=>{EL.init(X,Q),E0.init(X,Q),N0.defineLazy(X,"shape",()=>Q.shape),X.keyof=()=>l0(Object.keys(X._zod.def.shape)),X.catchall=(J)=>X.clone({...X._zod.def,catchall:J}),X.passthrough=()=>X.clone({...X._zod.def,catchall:y0()}),X.loose=()=>X.clone({...X._zod.def,catchall:y0()}),X.strict=()=>X.clone({...X._zod.def,catchall:FF()}),X.strip=()=>X.clone({...X._zod.def,catchall:void 0}),X.extend=(J)=>{return N0.extend(X,J)},X.merge=(J)=>N0.merge(X,J),X.pick=(J)=>N0.pick(X,J),X.omit=(J)=>N0.omit(X,J),X.partial=(...J)=>N0.partial(dJ,X,J[0]),X.required=(...J)=>N0.required(iJ,X,J[0])});function c(X,Q){let J={type:"object",get shape(){return N0.assignProp(this,"shape",{...X}),this.shape},...N0.normalizeParams(Q)};return new mJ(J)}function W1(X,Q){return new mJ({type:"object",get shape(){return N0.assignProp(this,"shape",{...X}),this.shape},catchall:y0(),...N0.normalizeParams(Q)})}var lJ=y("ZodUnion",(X,Q)=>{jJ.init(X,Q),E0.init(X,Q),X.options=Q.options});function w0(X,Q){return new lJ({type:"union",options:X,...N0.normalizeParams(Q)})}var VF=y("ZodDiscriminatedUnion",(X,Q)=>{lJ.init(X,Q),bL.init(X,Q)});function cJ(X,Q,J){return new VF({type:"union",options:Q,discriminator:X,...N0.normalizeParams(J)})}var MF=y("ZodIntersection",(X,Q)=>{CL.init(X,Q),E0.init(X,Q)});function pX(X,Q){return new MF({type:"intersection",left:X,right:Q})}var DF=y("ZodRecord",(X,Q)=>{_L.init(X,Q),E0.init(X,Q),X.keyType=Q.keyType,X.valueType=Q.valueType});function x0(X,Q,J){return new DF({type:"record",keyType:X,valueType:Q,...N0.normalizeParams(J)})}var CX=y("ZodEnum",(X,Q)=>{kL.init(X,Q),E0.init(X,Q),X.enum=Q.entries,X.options=Object.values(Q.entries);let J=new Set(Object.keys(Q.entries));X.extract=(Y,G)=>{let $={};for(let W of Y)if(J.has(W))$[W]=Q.entries[W];else throw Error(`Key ${W} not found in enum`);return new CX({...Q,checks:[],...N0.normalizeParams(G),entries:$})},X.exclude=(Y,G)=>{let $={...Q.entries};for(let W of Y)if(J.has(W))delete $[W];else throw Error(`Key ${W} not found in enum`);return new CX({...Q,checks:[],...N0.normalizeParams(G),entries:$})}});function l0(X,Q){let J=Array.isArray(X)?Object.fromEntries(X.map((Y)=>[Y,Y])):X;return new CX({type:"enum",entries:J,...N0.normalizeParams(Q)})}var ZF=y("ZodLiteral",(X,Q)=>{vL.init(X,Q),E0.init(X,Q),X.values=new Set(Q.values),Object.defineProperty(X,"value",{get(){if(Q.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return Q.values[0]}})});function t(X,Q){return new ZF({type:"literal",values:Array.isArray(X)?X:[X],...N0.normalizeParams(Q)})}var OF=y("ZodTransform",(X,Q)=>{yL.init(X,Q),E0.init(X,Q),X._zod.parse=(J,Y)=>{J.addIssue=($)=>{if(typeof $==="string")J.issues.push(N0.issue($,J.value,Q));else{let W=$;if(W.fatal)W.continue=!1;W.code??(W.code="custom"),W.input??(W.input=J.value),W.inst??(W.inst=X),W.continue??(W.continue=!0),J.issues.push(N0.issue(W))}};let G=Q.transform(J.value,J);if(G instanceof Promise)return G.then(($)=>{return J.value=$,J});return J.value=G,J}});function pJ(X){return new OF({type:"transform",transform:X})}var dJ=y("ZodOptional",(X,Q)=>{xL.init(X,Q),E0.init(X,Q),X.unwrap=()=>X._zod.def.innerType});function s(X){return new dJ({type:"optional",innerType:X})}var AF=y("ZodNullable",(X,Q)=>{gL.init(X,Q),E0.init(X,Q),X.unwrap=()=>X._zod.def.innerType});function N5(X){return new AF({type:"nullable",innerType:X})}var NF=y("ZodDefault",(X,Q)=>{hL.init(X,Q),E0.init(X,Q),X.unwrap=()=>X._zod.def.innerType,X.removeDefault=X.unwrap});function RF(X,Q){return new NF({type:"default",innerType:X,get defaultValue(){return typeof Q==="function"?Q():Q}})}var IF=y("ZodPrefault",(X,Q)=>{fL.init(X,Q),E0.init(X,Q),X.unwrap=()=>X._zod.def.innerType});function jF(X,Q){return new IF({type:"prefault",innerType:X,get defaultValue(){return typeof Q==="function"?Q():Q}})}var iJ=y("ZodNonOptional",(X,Q)=>{uL.init(X,Q),E0.init(X,Q),X.unwrap=()=>X._zod.def.innerType});function wF(X,Q){return new iJ({type:"nonoptional",innerType:X,...N0.normalizeParams(Q)})}var PF=y("ZodCatch",(X,Q)=>{mL.init(X,Q),E0.init(X,Q),X.unwrap=()=>X._zod.def.innerType,X.removeCatch=X.unwrap});function TF(X,Q){return new PF({type:"catch",innerType:X,catchValue:typeof Q==="function"?Q:()=>Q})}var SF=y("ZodPipe",(X,Q)=>{lL.init(X,Q),E0.init(X,Q),X.in=Q.in,X.out=Q.out});function _X(X,Q){return new SF({type:"pipe",in:X,out:Q})}var EF=y("ZodReadonly",(X,Q)=>{cL.init(X,Q),E0.init(X,Q)});function bF(X){return new EF({type:"readonly",innerType:X})}var nJ=y("ZodCustom",(X,Q)=>{pL.init(X,Q),E0.init(X,Q)});function CF(X,Q){let J=new r0({check:"custom",...N0.normalizeParams(Q)});return J._zod.check=X,J}function _F(X,Q){return hq(nJ,X??(()=>!0),Q)}function kF(X,Q={}){return fq(nJ,X,Q)}function vF(X,Q){let J=CF((Y)=>{return Y.addIssue=(G)=>{if(typeof G==="string")Y.issues.push(N0.issue(G,Y.value,J._zod.def));else{let $=G;if($.fatal)$.continue=!1;$.code??($.code="custom"),$.input??($.input=Y.value),$.inst??($.inst=J),$.continue??($.continue=!J._zod.def.abort),Y.issues.push(N0.issue($))}},X(Y.value,Y)},Q);return J}function rJ(X,Q){return _X(pJ(X),Q)}T1(nL());var dX="io.modelcontextprotocol/related-task",K6="2.0",V1=_F((X)=>X!==null&&(typeof X==="object"||typeof X==="function")),oJ=w0([v(),A0().int()]),aJ=v(),yF=W1({ttl:w0([A0(),uJ()]).optional(),pollInterval:A0().optional()}),iX=W1({taskId:v()}),xF=W1({progressToken:oJ.optional(),[dX]:iX.optional()}),o0=W1({task:yF.optional(),_meta:xF.optional()}),u0=c({method:v(),params:o0.optional()}),o1=W1({_meta:c({[dX]:s(iX)}).passthrough().optional()}),X1=c({method:v(),params:o1.optional()}),c0=W1({_meta:W1({[dX]:iX.optional()}).optional()}),V6=w0([v(),A0().int()]),gF=c({jsonrpc:t(K6),id:V6,...u0.shape}).strict();var hF=c({jsonrpc:t(K6),...X1.shape}).strict();var fF=c({jsonrpc:t(K6),id:V6,result:c0}).strict();var R5;(function(X){X[X.ConnectionClosed=-32000]="ConnectionClosed",X[X.RequestTimeout=-32001]="RequestTimeout",X[X.ParseError=-32700]="ParseError",X[X.InvalidRequest=-32600]="InvalidRequest",X[X.MethodNotFound=-32601]="MethodNotFound",X[X.InvalidParams=-32602]="InvalidParams",X[X.InternalError=-32603]="InternalError",X[X.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(R5||(R5={}));var uF=c({jsonrpc:t(K6),id:V6,error:c({code:A0().int(),message:v(),data:s(y0())})}).strict();var jP=w0([gF,hF,fF,uF]),sJ=c0.strict(),mF=o1.extend({requestId:V6,reason:v().optional()}),tJ=X1.extend({method:t("notifications/cancelled"),params:mF}),lF=c({src:v(),mimeType:v().optional(),sizes:F0(v()).optional()}),G8=c({icons:F0(lF).optional()}),K9=c({name:v(),title:v().optional()}),eJ=K9.extend({...K9.shape,...G8.shape,version:v(),websiteUrl:v().optional()}),cF=pX(c({applyDefaults:m0().optional()}),x0(v(),y0())),pF=rJ((X)=>{if(X&&typeof X==="object"&&!Array.isArray(X)){if(Object.keys(X).length===0)return{form:{}}}return X},pX(c({form:cF.optional(),url:V1.optional()}),x0(v(),y0()).optional())),dF=c({list:s(c({}).passthrough()),cancel:s(c({}).passthrough()),requests:s(c({sampling:s(c({createMessage:s(c({}).passthrough())}).passthrough()),elicitation:s(c({create:s(c({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),iF=c({list:s(c({}).passthrough()),cancel:s(c({}).passthrough()),requests:s(c({tools:s(c({call:s(c({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),nF=c({experimental:x0(v(),V1).optional(),sampling:c({context:V1.optional(),tools:V1.optional()}).optional(),elicitation:pF.optional(),roots:c({listChanged:m0().optional()}).optional(),tasks:s(dF)}),rF=o0.extend({protocolVersion:v(),capabilities:nF,clientInfo:eJ}),oF=u0.extend({method:t("initialize"),params:rF}),aF=c({experimental:x0(v(),V1).optional(),logging:V1.optional(),completions:V1.optional(),prompts:s(c({listChanged:s(m0())})),resources:c({subscribe:m0().optional(),listChanged:m0().optional()}).optional(),tools:c({listChanged:m0().optional()}).optional(),tasks:s(iF)}).passthrough(),sF=c0.extend({protocolVersion:v(),capabilities:aF,serverInfo:eJ,instructions:v().optional()}),tF=X1.extend({method:t("notifications/initialized")}),X7=u0.extend({method:t("ping")}),eF=c({progress:A0(),total:s(A0()),message:s(v())}),XK=c({...o1.shape,...eF.shape,progressToken:oJ}),Q7=X1.extend({method:t("notifications/progress"),params:XK}),QK=o0.extend({cursor:aJ.optional()}),$8=u0.extend({params:QK.optional()}),W8=c0.extend({nextCursor:s(aJ)}),H8=c({taskId:v(),status:l0(["working","input_required","completed","failed","cancelled"]),ttl:w0([A0(),uJ()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:s(A0()),statusMessage:s(v())}),J7=c0.extend({task:H8}),JK=o1.merge(H8),Y7=X1.extend({method:t("notifications/tasks/status"),params:JK}),G7=u0.extend({method:t("tasks/get"),params:o0.extend({taskId:v()})}),$7=c0.merge(H8),W7=u0.extend({method:t("tasks/result"),params:o0.extend({taskId:v()})}),H7=$8.extend({method:t("tasks/list")}),U7=W8.extend({tasks:F0(H8)}),wP=u0.extend({method:t("tasks/cancel"),params:o0.extend({taskId:v()})}),PP=c0.merge(H8),B7=c({uri:v(),mimeType:s(v()),_meta:x0(v(),y0()).optional()}),z7=B7.extend({text:v()}),nX=v().refine((X)=>{try{return atob(X),!0}catch(Q){return!1}},{message:"Invalid Base64 string"}),L7=B7.extend({blob:nX}),O9=c({audience:F0(l0(["user","assistant"])).optional(),priority:A0().min(0).max(1).optional(),lastModified:SJ.datetime({offset:!0}).optional()}),q7=c({...K9.shape,...G8.shape,uri:v(),description:s(v()),mimeType:s(v()),annotations:O9.optional(),_meta:s(W1({}))}),YK=c({...K9.shape,...G8.shape,uriTemplate:v(),description:s(v()),mimeType:s(v()),annotations:O9.optional(),_meta:s(W1({}))}),GK=$8.extend({method:t("resources/list")}),$K=W8.extend({resources:F0(q7)}),WK=$8.extend({method:t("resources/templates/list")}),HK=W8.extend({resourceTemplates:F0(YK)}),rX=o0.extend({uri:v()}),UK=rX,BK=u0.extend({method:t("resources/read"),params:UK}),zK=c0.extend({contents:F0(w0([z7,L7]))}),LK=X1.extend({method:t("notifications/resources/list_changed")}),qK=rX,FK=u0.extend({method:t("resources/subscribe"),params:qK}),KK=rX,VK=u0.extend({method:t("resources/unsubscribe"),params:KK}),MK=o1.extend({uri:v()}),DK=X1.extend({method:t("notifications/resources/updated"),params:MK}),ZK=c({name:v(),description:s(v()),required:s(m0())}),OK=c({...K9.shape,...G8.shape,description:s(v()),arguments:s(F0(ZK)),_meta:s(W1({}))}),AK=$8.extend({method:t("prompts/list")}),NK=W8.extend({prompts:F0(OK)}),RK=o0.extend({name:v(),arguments:x0(v(),v()).optional()}),IK=u0.extend({method:t("prompts/get"),params:RK}),oX=c({type:t("text"),text:v(),annotations:O9.optional(),_meta:x0(v(),y0()).optional()}),aX=c({type:t("image"),data:nX,mimeType:v(),annotations:O9.optional(),_meta:x0(v(),y0()).optional()}),sX=c({type:t("audio"),data:nX,mimeType:v(),annotations:O9.optional(),_meta:x0(v(),y0()).optional()}),jK=c({type:t("tool_use"),name:v(),id:v(),input:c({}).passthrough(),_meta:s(c({}).passthrough())}).passthrough(),wK=c({type:t("resource"),resource:w0([z7,L7]),annotations:O9.optional(),_meta:x0(v(),y0()).optional()}),PK=q7.extend({type:t("resource_link")}),tX=w0([oX,aX,sX,PK,wK]),TK=c({role:l0(["user","assistant"]),content:tX}),SK=c0.extend({description:s(v()),messages:F0(TK)}),EK=X1.extend({method:t("notifications/prompts/list_changed")}),bK=c({title:v().optional(),readOnlyHint:m0().optional(),destructiveHint:m0().optional(),idempotentHint:m0().optional(),openWorldHint:m0().optional()}),CK=c({taskSupport:l0(["required","optional","forbidden"]).optional()}),F7=c({...K9.shape,...G8.shape,description:v().optional(),inputSchema:c({type:t("object"),properties:x0(v(),V1).optional(),required:F0(v()).optional()}).catchall(y0()),outputSchema:c({type:t("object"),properties:x0(v(),V1).optional(),required:F0(v()).optional()}).catchall(y0()).optional(),annotations:s(bK),execution:s(CK),_meta:x0(v(),y0()).optional()}),_K=$8.extend({method:t("tools/list")}),kK=W8.extend({tools:F0(F7)}),K7=c0.extend({content:F0(tX).default([]),structuredContent:x0(v(),y0()).optional(),isError:s(m0())}),TP=K7.or(c0.extend({toolResult:y0()})),vK=o0.extend({name:v(),arguments:s(x0(v(),y0()))}),yK=u0.extend({method:t("tools/call"),params:vK}),xK=X1.extend({method:t("notifications/tools/list_changed")}),V7=l0(["debug","info","notice","warning","error","critical","alert","emergency"]),gK=o0.extend({level:V7}),hK=u0.extend({method:t("logging/setLevel"),params:gK}),fK=o1.extend({level:V7,logger:v().optional(),data:y0()}),uK=X1.extend({method:t("notifications/message"),params:fK}),mK=c({name:v().optional()}),lK=c({hints:s(F0(mK)),costPriority:s(A0().min(0).max(1)),speedPriority:s(A0().min(0).max(1)),intelligencePriority:s(A0().min(0).max(1))}),cK=c({mode:s(l0(["auto","required","none"]))}),pK=c({type:t("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:F0(tX).default([]),structuredContent:c({}).passthrough().optional(),isError:s(m0()),_meta:s(c({}).passthrough())}).passthrough(),dK=cJ("type",[oX,aX,sX]),X6=cJ("type",[oX,aX,sX,jK,pK]),iK=c({role:l0(["user","assistant"]),content:w0([X6,F0(X6)]),_meta:s(c({}).passthrough())}).passthrough(),nK=o0.extend({messages:F0(iK),modelPreferences:lK.optional(),systemPrompt:v().optional(),includeContext:l0(["none","thisServer","allServers"]).optional(),temperature:A0().optional(),maxTokens:A0().int(),stopSequences:F0(v()).optional(),metadata:V1.optional(),tools:s(F0(F7)),toolChoice:s(cK)}),rK=u0.extend({method:t("sampling/createMessage"),params:nK}),oK=c0.extend({model:v(),stopReason:s(l0(["endTurn","stopSequence","maxTokens"]).or(v())),role:l0(["user","assistant"]),content:dK}),aK=c0.extend({model:v(),stopReason:s(l0(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:l0(["user","assistant"]),content:w0([X6,F0(X6)])}),sK=c({type:t("boolean"),title:v().optional(),description:v().optional(),default:m0().optional()}),tK=c({type:t("string"),title:v().optional(),description:v().optional(),minLength:A0().optional(),maxLength:A0().optional(),format:l0(["email","uri","date","date-time"]).optional(),default:v().optional()}),eK=c({type:l0(["number","integer"]),title:v().optional(),description:v().optional(),minimum:A0().optional(),maximum:A0().optional(),default:A0().optional()}),XV=c({type:t("string"),title:v().optional(),description:v().optional(),enum:F0(v()),default:v().optional()}),QV=c({type:t("string"),title:v().optional(),description:v().optional(),oneOf:F0(c({const:v(),title:v()})),default:v().optional()}),JV=c({type:t("string"),title:v().optional(),description:v().optional(),enum:F0(v()),enumNames:F0(v()).optional(),default:v().optional()}),YV=w0([XV,QV]),GV=c({type:t("array"),title:v().optional(),description:v().optional(),minItems:A0().optional(),maxItems:A0().optional(),items:c({type:t("string"),enum:F0(v())}),default:F0(v()).optional()}),$V=c({type:t("array"),title:v().optional(),description:v().optional(),minItems:A0().optional(),maxItems:A0().optional(),items:c({anyOf:F0(c({const:v(),title:v()}))}),default:F0(v()).optional()}),WV=w0([GV,$V]),HV=w0([JV,YV,WV]),UV=w0([HV,sK,tK,eK]),BV=o0.extend({mode:t("form").optional(),message:v(),requestedSchema:c({type:t("object"),properties:x0(v(),UV),required:F0(v()).optional()})}),zV=o0.extend({mode:t("url"),message:v(),elicitationId:v(),url:v().url()}),LV=w0([BV,zV]),qV=u0.extend({method:t("elicitation/create"),params:LV}),FV=o1.extend({elicitationId:v()}),KV=X1.extend({method:t("notifications/elicitation/complete"),params:FV}),VV=c0.extend({action:l0(["accept","decline","cancel"]),content:rJ((X)=>X===null?void 0:X,x0(v(),w0([v(),A0(),m0(),F0(v())])).optional())}),MV=c({type:t("ref/resource"),uri:v()}),DV=c({type:t("ref/prompt"),name:v()}),ZV=o0.extend({ref:w0([DV,MV]),argument:c({name:v(),value:v()}),context:c({arguments:x0(v(),v()).optional()}).optional()}),OV=u0.extend({method:t("completion/complete"),params:ZV});var AV=c0.extend({completion:W1({values:F0(v()).max(100),total:s(A0().int()),hasMore:s(m0())})}),NV=c({uri:v().startsWith("file://"),name:v().optional(),_meta:x0(v(),y0()).optional()}),RV=u0.extend({method:t("roots/list")}),IV=c0.extend({roots:F0(NV)}),jV=X1.extend({method:t("notifications/roots/list_changed")}),SP=w0([X7,oF,OV,hK,IK,AK,GK,WK,BK,FK,VK,yK,_K,G7,W7,H7]),EP=w0([tJ,Q7,tF,jV,Y7]),bP=w0([sJ,oK,aK,VV,IV,$7,U7,J7]),CP=w0([X7,rK,qV,RV,G7,W7,H7]),_P=w0([tJ,Q7,uK,DK,LK,xK,EK,Y7,KV]),kP=w0([sJ,sF,AV,SK,NK,$K,HK,zK,K7,kK,$7,U7,J7]);var vP=Symbol("Let zodToJsonSchema decide on which parser to use");var yP=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var xP=j5(_5(),1),gP=j5(cW(),1);var I5;(function(X){X.Completable="McpCompletable"})(I5||(I5={}));function M7({prompt:X,options:Q}){let{systemPrompt:J,settingSources:Y,sandbox:G,...$}=Q??{},W,H;if(J===void 0)W="";else if(typeof J==="string")W=J;else if(J.type==="preset")H=J.append;let U=$.pathToClaudeCodeExecutable;if(!U){let a=pW(import.meta.url),e=d4(a,"..");U=d4(e,"cli.js")}process.env.CLAUDE_AGENT_SDK_VERSION="0.2.1";let{abortController:B=k5(),additionalDirectories:q=[],agents:K,allowedTools:V=[],betas:N,canUseTool:w,continue:A,cwd:Z,disallowedTools:z=[],tools:M,env:F,executable:L=n5()?"bun":"node",executableArgs:O=[],extraArgs:D={},fallbackModel:I,enableFileCheckpointing:j,forkSession:E,hooks:g,includePartialMessages:k,persistSession:x,maxThinkingTokens:u,maxTurns:l,maxBudgetUsd:Y0,mcpServers:O0,model:_0,outputFormat:h0,permissionMode:q0="default",allowDangerouslySkipPermissions:S=!1,permissionPromptToolName:b,plugins:f,resume:R,resumeSessionAt:T,stderr:C,strictMcpConfig:r}=$,X0=h0?.type==="json_schema"?h0.schema:void 0,U0=F;if(!U0)U0={...process.env};if(!U0.CLAUDE_CODE_ENTRYPOINT)U0.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(j)U0.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true";if(!U)throw Error("pathToClaudeCodeExecutable is required");let Q0={},S0=new Map;if(O0)for(let[a,e]of Object.entries(O0))if(e.type==="sdk"&&"instance"in e)S0.set(a,e.instance),Q0[a]={type:"sdk",name:a};else Q0[a]=e;let G1=typeof X==="string",P=new r5({abortController:B,additionalDirectories:q,betas:N,cwd:Z,executable:L,executableArgs:O,extraArgs:D,pathToClaudeCodeExecutable:U,env:U0,forkSession:E,stderr:C,maxThinkingTokens:u,maxTurns:l,maxBudgetUsd:Y0,model:_0,fallbackModel:I,jsonSchema:X0,permissionMode:q0,allowDangerouslySkipPermissions:S,permissionPromptToolName:b,continueConversation:A,resume:R,resumeSessionAt:T,settingSources:Y??[],allowedTools:V,disallowedTools:z,tools:M,mcpServers:Q0,strictMcpConfig:r,canUseTool:!!w,hooks:!!g,includePartialMessages:k,persistSession:x,plugins:f,sandbox:G,spawnClaudeCodeProcess:$.spawnClaudeCodeProcess}),h=new s5(P,G1,w,g,B,S0,X0,{systemPrompt:W,appendSystemPrompt:H,agents:K});if(typeof X==="string")P.write(q1({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:X}]},parent_tool_use_id:null})+`
208
+ `);else h.streamInput(X);return h}class eX{category="cli";provider="claude-code";name;config;constructor(X,Q){this.name=X,this.config=Q}async run(X,Q){let{tool:J,cwd:Y,context:G}=Q,$=[],W=[],H=this.buildSystemPrompt(J),U=G?.allowedTools??this.config.allowedTools??["Read","Glob","Grep","Bash"],B=G?.disallowedTools??this.config.disallowedTools??["Edit","Write","NotebookEdit"],q={cwd:Y,model:this.config.model??"claude-sonnet-4-20250514",systemPrompt:H,allowedTools:U,disallowedTools:B,permissionMode:this.config.permissionMode??"acceptEdits",maxTurns:this.config.maxTurns??5,mcpServers:G?.mcpServers??this.config.mcpServers,settingSources:[]},K="";for await(let V of M7({prompt:X,options:q})){if(V.type==="assistant"){let N=V.message?.content;if(Array.isArray(N))for(let w of N){if(w.type==="text")K+=w.text;if(w.type==="tool_use"){let A=w;if(!$.includes(A.name))$.push(A.name)}}}if(V.type==="result"){let N=V;if(N.subtype==="success"&&N.result)K+=N.result}if(V.type==="tool_result"){let N=V;if(N.tool_name==="Read"&&typeof N.content==="string"){let w=N.content.match(/^Reading (.+)/);if(w)W.push(w[1])}}}return{response:K,toolsUsed:$,sources:W,metadata:{model:this.config.model??"claude-sonnet-4-20250514",category:this.category,provider:this.provider,target:this.name}}}buildSystemPrompt(X){return`You are helping a developer understand how to use "${X.name}": ${X.description}
72
209
 
73
- Respond ONLY with valid JSON, no markdown.`)).trim();if(J.startsWith("```"))J=J.replace(/```json?\n?/g,"").replace(/```$/g,"").trim();return JSON.parse(J)}async function k1($,X,J,Z){let z=[$.name,...X],Y=[];for(let W of J){Z?.(`Analyzing: ${W.name}`);let Q={};for(let q of z)Q[q.toLowerCase()]={mentions:0,total:W.questions.length,percentage:0,contexts:[]};for(let q of W.questions){let N=await U0(q);for(let w of z){let T=w.toLowerCase();if(new RegExp(`\\b${Y4(w)}\\b`,"gi").test(N)){if(Q[T].mentions++,Q[T].contexts.length<2){let c=J8(N,w);if(c)Q[T].contexts.push(c)}}}}let G="",V=0;for(let[q,N]of Object.entries(Q))if(N.percentage=Math.round(N.mentions/N.total*100),N.mentions>V)V=N.mentions,G=q;Y.push({topic:W.name,results:Q,leader:G})}return Y}function Y4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function J8($,X){let J=$.split(/[.!?]+/),Z=new RegExp(`\\b${Y4(X)}\\b`,"gi");for(let z of J)if(Z.test(z)){let Y=z.trim();if(Y.length>20&&Y.length<150)return Y}return null}async function y1($){let{readme:X,packageJson:J,repoUrl:Z,repo:z}=$,Y="";if(J)Y+=`Package: ${J.name||z}
74
- `,Y+=`Description: ${J.description||"N/A"}
75
- `,Y+=`Keywords: ${J.keywords?.join(", ")||"N/A"}
210
+ Your task is to answer questions about this tool accurately based on the available documentation.
76
211
 
77
- `;if(X)Y+=`README:
78
- ${X.slice(0,3000)}`;return{...await N0(`Analyze this developer tool:
212
+ You have access to read the codebase to find documentation, examples, and implementation details.
213
+ Look for README files, doc comments, examples directories, and source code.
79
214
 
80
- ${Y}
81
-
82
- Return JSON:
215
+ After answering, provide a structured assessment in JSON format:
216
+ \`\`\`json
83
217
  {
84
- "name": "tool name",
85
- "description": "one sentence description",
86
- "domain": "problem domain (e.g., 'schema validation')",
87
- "language": "primary language (e.g., 'TypeScript')"
88
- }`),url:Z}}async function _1($){return(await N0(`Given:
89
- - Name: ${$.name}
90
- - Description: ${$.description}
91
- - Domain: ${$.domain}
92
- - Language: ${$.language}
218
+ "answerable": "YES" | "PARTIAL" | "NO",
219
+ "confidence": 0-100,
220
+ "reason": "Brief explanation of your assessment",
221
+ "missing": ["List of missing documentation if applicable"] or null
222
+ }
223
+ \`\`\`
224
+
225
+ - YES: The documentation fully answers the question
226
+ - PARTIAL: Some information is available but incomplete
227
+ - NO: Cannot find relevant documentation`}}var A9={category:"cli",provider:"claude-code",model:"claude-sonnet-4-20250514"};function XQ(X,Q){let J=Q??A9;switch(J.category){case"cli":return wV(X,J);case"api":throw Error("API targets not yet implemented. Coming soon!");case"ide":throw Error("IDE targets not yet implemented. Coming soon!");default:throw Error(`Unknown target category: ${J.category}`)}}function wV(X,Q){switch(Q.provider){case"claude-code":return new eX(X,Q);case"gemini-cli":throw Error("Gemini CLI target not yet implemented. Coming soon!");case"amazon-q":throw Error("Amazon Q target not yet implemented. Coming soon!");default:throw Error(`Unknown CLI provider: ${Q.provider}`)}}function QQ(X,Q){if(!X)return{name:"default",config:A9};if(Q?.[X])return{name:X,config:Q[X]};return console.warn(`Target "${X}" not found, using default`),{name:"default",config:A9}}function JQ(X){let Q=X.match(/```json\s*([\s\S]*?)\s*```/);if(Q)try{let J=JSON.parse(Q[1]);return D7(J)}catch{}try{let J=JSON.parse(X);return D7(J)}catch{}return SV(X)}function D7(X){let Q=PV(X.answerable),J=TV(X.confidence),Y=String(X.reason||""),G=Array.isArray(X.missing)?X.missing.map(String):void 0;return{answerable:Q,confidence:J,reason:Y,missing:G}}function PV(X){let Q=String(X).toUpperCase();if(Q==="YES"||Q==="TRUE")return"YES";if(Q==="PARTIAL"||Q==="MAYBE")return"PARTIAL";return"NO"}function TV(X){let Q=Number(X);if(Number.isNaN(Q))return 50;if(Q>=0&&Q<=1)return Math.round(Q*100);return Math.max(0,Math.min(100,Math.round(Q)))}function SV(X){let Q=X.toLowerCase(),J=Q.includes("cannot find")||Q.includes("not documented")||Q.includes("no documentation")||Q.includes("unable to")||Q.includes("don't have information"),Y=Q.includes("partially")||Q.includes("some information")||Q.includes("limited documentation");if(J)return{answerable:"NO",confidence:30,reason:"Unable to find relevant documentation"};if(Y)return{answerable:"PARTIAL",confidence:60,reason:"Found some relevant information"};if(X.length>100)return{answerable:"YES",confidence:70,reason:"Found relevant information"};return{answerable:"PARTIAL",confidence:50,reason:"Unable to determine answer quality"}}async function YQ(X,Q,J={}){let{onProgress:Y}=J,G=[];if(Q.scenarios.length===0)throw Error("No scenarios defined in config");let $;if(Q.docs?.source){Y?.("Loading documentation...");try{$=await MX(Q.docs.source),Y?.(` Loaded: ${$.name}`)}catch(W){Y?.(` Warning: ${W instanceof Error?W.message:W}`),$=DX(X.path)}}Y?.("");for(let W of Q.scenarios){Y?.(`Running: ${W.name}`);try{let H=await EV(W,X,Q,{onProgress:Y});G.push(H);let U=H.answerable==="YES"?"✓":H.answerable==="PARTIAL"?"⚠":"✗";Y?.(` ${U} ${H.answerable} (${H.confidence}%)`)}catch(H){let U={scenario:W,answerable:"NO",confidence:0,response:"",reason:"Error during validation",error:H instanceof Error?H.message:String(H)};G.push(U),Y?.(` ✗ Error: ${H}`)}}return bV(X,$,G)}async function EV(X,Q,J,Y){let{name:G,config:$}=QQ(X.target,J.targets),H=await XQ(G,$).run(X.prompt,{tool:Q,cwd:Q.path,onProgress:Y.onProgress}),U=JQ(H.response);return{scenario:X,answerable:U.answerable,confidence:U.confidence,response:H.response,reason:U.reason,missing:U.missing,target:H.metadata,toolsUsed:H.toolsUsed,sources:H.sources}}function bV(X,Q,J){let Y=J.length,G=J.filter((W)=>W.answerable==="YES"||W.answerable==="PARTIAL").length,$=Y>0?Math.round(J.reduce((W,H)=>{if(H.answerable==="YES")return W+H.confidence;if(H.answerable==="PARTIAL")return W+H.confidence*0.5;return W},0)/Y):0;return{tool:{name:X.name,description:X.description,path:X.path},docs:Q?{source:Q.name,type:Q.type}:void 0,scenarios:J,summary:{total:Y,answered:G,unanswered:Y-G,score:$}}}var TG=j4(PG(),1);async function V4(X){let Q=`${X}/pickled.yml`,J=Bun.file(Q);if(!await J.exists())throw Error(`pickled.yml not found in ${X}`);try{let Y=await J.text();return TG.default.parse(Y)}catch(Y){throw Error(`Failed to parse pickled.yml: ${Y}`)}}var SG=(X=0)=>(Q)=>`\x1B[${Q+X}m`,EG=(X=0)=>(Q)=>`\x1B[${38+X};5;${Q}m`,bG=(X=0)=>(Q,J,Y)=>`\x1B[${38+X};2;${Q};${J};${Y}m`,P0={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},M2=Object.keys(P0.modifier),bj=Object.keys(P0.color),Cj=Object.keys(P0.bgColor),D2=[...bj,...Cj];function _j(){let X=new Map;for(let[Q,J]of Object.entries(P0)){for(let[Y,G]of Object.entries(J))P0[Y]={open:`\x1B[${G[0]}m`,close:`\x1B[${G[1]}m`},J[Y]=P0[Y],X.set(G[0],G[1]);Object.defineProperty(P0,Q,{value:J,enumerable:!1})}return Object.defineProperty(P0,"codes",{value:X,enumerable:!1}),P0.color.close="\x1B[39m",P0.bgColor.close="\x1B[49m",P0.color.ansi=SG(),P0.color.ansi256=EG(),P0.color.ansi16m=bG(),P0.bgColor.ansi=SG(10),P0.bgColor.ansi256=EG(10),P0.bgColor.ansi16m=bG(10),Object.defineProperties(P0,{rgbToAnsi256:{value(Q,J,Y){if(Q===J&&J===Y){if(Q<8)return 16;if(Q>248)return 231;return Math.round((Q-8)/247*24)+232}return 16+36*Math.round(Q/255*5)+6*Math.round(J/255*5)+Math.round(Y/255*5)},enumerable:!1},hexToRgb:{value(Q){let J=/[a-f\d]{6}|[a-f\d]{3}/i.exec(Q.toString(16));if(!J)return[0,0,0];let[Y]=J;if(Y.length===3)Y=[...Y].map(($)=>$+$).join("");let G=Number.parseInt(Y,16);return[G>>16&255,G>>8&255,G&255]},enumerable:!1},hexToAnsi256:{value:(Q)=>P0.rgbToAnsi256(...P0.hexToRgb(Q)),enumerable:!1},ansi256ToAnsi:{value(Q){if(Q<8)return 30+Q;if(Q<16)return 90+(Q-8);let J,Y,G;if(Q>=232)J=((Q-232)*10+8)/255,Y=J,G=J;else{Q-=16;let H=Q%36;J=Math.floor(Q/36)/5,Y=Math.floor(H/6)/5,G=H%6/5}let $=Math.max(J,Y,G)*2;if($===0)return 30;let W=30+(Math.round(G)<<2|Math.round(Y)<<1|Math.round(J));if($===2)W+=60;return W},enumerable:!1},rgbToAnsi:{value:(Q,J,Y)=>P0.ansi256ToAnsi(P0.rgbToAnsi256(Q,J,Y)),enumerable:!1},hexToAnsi:{value:(Q)=>P0.ansi256ToAnsi(P0.hexToAnsi256(Q)),enumerable:!1}}),P0}var kj=_j(),z1=kj;import M4 from"node:process";import vj from"node:os";import CG from"node:tty";function Y1(X,Q=globalThis.Deno?globalThis.Deno.args:M4.argv){let J=X.startsWith("-")?"":X.length===1?"-":"--",Y=Q.indexOf(J+X),G=Q.indexOf("--");return Y!==-1&&(G===-1||Y<G)}var{env:T0}=M4,YX;if(Y1("no-color")||Y1("no-colors")||Y1("color=false")||Y1("color=never"))YX=0;else if(Y1("color")||Y1("colors")||Y1("color=true")||Y1("color=always"))YX=1;function yj(){if("FORCE_COLOR"in T0){if(T0.FORCE_COLOR==="true")return 1;if(T0.FORCE_COLOR==="false")return 0;return T0.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(T0.FORCE_COLOR,10),3)}}function xj(X){if(X===0)return!1;return{level:X,hasBasic:!0,has256:X>=2,has16m:X>=3}}function gj(X,{streamIsTTY:Q,sniffFlags:J=!0}={}){let Y=yj();if(Y!==void 0)YX=Y;let G=J?YX:Y;if(G===0)return 0;if(J){if(Y1("color=16m")||Y1("color=full")||Y1("color=truecolor"))return 3;if(Y1("color=256"))return 2}if("TF_BUILD"in T0&&"AGENT_NAME"in T0)return 1;if(X&&!Q&&G===void 0)return 0;let $=G||0;if(T0.TERM==="dumb")return $;if(M4.platform==="win32"){let W=vj.release().split(".");if(Number(W[0])>=10&&Number(W[2])>=10586)return Number(W[2])>=14931?3:2;return 1}if("CI"in T0){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((W)=>(W in T0)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((W)=>(W in T0))||T0.CI_NAME==="codeship")return 1;return $}if("TEAMCITY_VERSION"in T0)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(T0.TEAMCITY_VERSION)?1:0;if(T0.COLORTERM==="truecolor")return 3;if(T0.TERM==="xterm-kitty")return 3;if(T0.TERM==="xterm-ghostty")return 3;if(T0.TERM==="wezterm")return 3;if("TERM_PROGRAM"in T0){let W=Number.parseInt((T0.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(T0.TERM_PROGRAM){case"iTerm.app":return W>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(T0.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(T0.TERM))return 1;if("COLORTERM"in T0)return 1;return $}function _G(X,Q={}){let J=gj(X,{streamIsTTY:X&&X.isTTY,...Q});return xj(J)}var hj={stdout:_G({isTTY:CG.isatty(1)}),stderr:_G({isTTY:CG.isatty(2)})},kG=hj;function vG(X,Q,J){let Y=X.indexOf(Q);if(Y===-1)return X;let G=Q.length,$=0,W="";do W+=X.slice($,Y)+Q+J,$=Y+G,Y=X.indexOf(Q,$);while(Y!==-1);return W+=X.slice($),W}function yG(X,Q,J,Y){let G=0,$="";do{let W=X[Y-1]==="\r";$+=X.slice(G,W?Y-1:Y)+Q+(W?`\r
228
+ `:`
229
+ `)+J,G=Y+1,Y=X.indexOf(`
230
+ `,G)}while(Y!==-1);return $+=X.slice(G),$}var{stdout:xG,stderr:gG}=kG,D4=Symbol("GENERATOR"),_9=Symbol("STYLER"),_8=Symbol("IS_EMPTY"),hG=["ansi","ansi","ansi256","ansi16m"],k9=Object.create(null),fj=(X,Q={})=>{if(Q.level&&!(Number.isInteger(Q.level)&&Q.level>=0&&Q.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let J=xG?xG.level:0;X.level=Q.level===void 0?J:Q.level};var uj=(X)=>{let Q=(...J)=>J.join(" ");return fj(Q,X),Object.setPrototypeOf(Q,k8.prototype),Q};function k8(X){return uj(X)}Object.setPrototypeOf(k8.prototype,Function.prototype);for(let[X,Q]of Object.entries(z1))k9[X]={get(){let J=GX(this,O4(Q.open,Q.close,this[_9]),this[_8]);return Object.defineProperty(this,X,{value:J}),J}};k9.visible={get(){let X=GX(this,this[_9],!0);return Object.defineProperty(this,"visible",{value:X}),X}};var Z4=(X,Q,J,...Y)=>{if(X==="rgb"){if(Q==="ansi16m")return z1[J].ansi16m(...Y);if(Q==="ansi256")return z1[J].ansi256(z1.rgbToAnsi256(...Y));return z1[J].ansi(z1.rgbToAnsi(...Y))}if(X==="hex")return Z4("rgb",Q,J,...z1.hexToRgb(...Y));return z1[J][X](...Y)},mj=["rgb","hex","ansi256"];for(let X of mj){k9[X]={get(){let{level:J}=this;return function(...Y){let G=O4(Z4(X,hG[J],"color",...Y),z1.color.close,this[_9]);return GX(this,G,this[_8])}}};let Q="bg"+X[0].toUpperCase()+X.slice(1);k9[Q]={get(){let{level:J}=this;return function(...Y){let G=O4(Z4(X,hG[J],"bgColor",...Y),z1.bgColor.close,this[_9]);return GX(this,G,this[_8])}}}}var lj=Object.defineProperties(()=>{},{...k9,level:{enumerable:!0,get(){return this[D4].level},set(X){this[D4].level=X}}}),O4=(X,Q,J)=>{let Y,G;if(J===void 0)Y=X,G=Q;else Y=J.openAll+X,G=Q+J.closeAll;return{open:X,close:Q,openAll:Y,closeAll:G,parent:J}},GX=(X,Q,J)=>{let Y=(...G)=>cj(Y,G.length===1?""+G[0]:G.join(" "));return Object.setPrototypeOf(Y,lj),Y[D4]=X,Y[_9]=Q,Y[_8]=J,Y},cj=(X,Q)=>{if(X.level<=0||!Q)return X[_8]?"":Q;let J=X[_9];if(J===void 0)return Q;let{openAll:Y,closeAll:G}=J;if(Q.includes("\x1B"))while(J!==void 0)Q=vG(Q,J.close,J.open),J=J.parent;let $=Q.indexOf(`
231
+ `);if($!==-1)Q=yG(Q,G,Y,$);return Y+Q+G};Object.defineProperties(k8.prototype,k9);var pj=k8(),T2=k8({level:gG?gG.level:0});var M0=pj;var fG="━".repeat(55);function dj(X){let Q=Math.round(X/20),J=5-Q;return"\uD83E\uDD52".repeat(Q)+"░".repeat(J)}function uG(X){if(X>=90)return{label:"Well preserved",color:M0.green};if(X>=70)return{label:"Fresh",color:M0.green};if(X>=50)return{label:"Going stale",color:M0.yellow};return{label:"Gone sour",color:M0.red}}function ij(X){if(X.error)return{icon:M0.red("✗"),status:`error: ${X.error.slice(0,40)}`,color:M0.red};let{label:Q,color:J}=uG(X.confidence);if(X.answerable==="YES")return{icon:M0.green("✓"),status:`${Q} (${X.confidence}%)`,color:J};if(X.answerable==="PARTIAL")return{icon:M0.yellow("⚠"),status:`${Q} (${X.confidence}%)`,color:M0.yellow};return{icon:M0.red("✗"),status:`Gone sour (${X.confidence}%)`,color:M0.red}}function A4(X){let{tool:Q,scenarios:J,summary:Y}=X,G=J;if(console.log(),console.log(M0.bold("\uD83E\uDD52 Freshness Check")),console.log(fG),console.log(),console.log(`Tool: ${M0.cyan(Q.name)}`),X.docs)console.log(`Docs: ${M0.dim(X.docs.source)}`);console.log();for(let W of G){let{icon:H,status:U}=ij(W),B=W.target?M0.dim(`[${W.target.target}]`):"";if(console.log(` ${B} ${H} "${W.scenario.name}" - ${U}`),W.reason&&W.answerable!=="YES")console.log(M0.dim(` ${W.reason}`));if(W.missing&&W.missing.length>0)console.log(M0.dim(` Missing: ${W.missing.join(", ")}`));if(W.toolsUsed&&W.toolsUsed.length>0)console.log(M0.dim(` Tools: ${W.toolsUsed.join(", ")}`))}console.log(),console.log(fG),console.log(`Freshness Score: ${Y.score}% ${dj(Y.score)}`),console.log();let{color:$}=uG(Y.score);if(Y.score>=90)console.log($("\uD83E\uDD52 Perfectly preserved! Your docs are in great shape."));else if(Y.score>=70)console.log($("\uD83E\uDD52 Looking fresh! Your docs are doing well."));else if(Y.score>=50)console.log($("\uD83E\uDD52 Starting to spoil... Some docs need attention."));else console.log($("\uD83E\uDD52 Something went sour. Time to freshen up your docs."));console.log()}function $X(X){return JSON.stringify(X,null,2)}async function mG(X,Q){let{json:J,output:Y,verbose:G}=Q,$=(K)=>!J&&console.log(M0.dim(K)),W=nj.resolve(X);$("\uD83E\uDD52 Loading pickled.yml...");let H;try{H=await V4(W)}catch(K){console.error(M0.red(`\uD83E\uDD52 ${K instanceof Error?K.message:K}`)),console.error(),console.error(M0.dim("Run `pickled init` to create a config file")),process.exit(1)}let U={name:H.tool.name,description:H.tool.description,path:W};if(G){$(` Tool: ${U.name}`),$(` Scenarios: ${H.scenarios.length}`);for(let K of H.scenarios)$(` - ${K.name}`)}$("\uD83E\uDD52 Checking your freshness..."),console.log();let B=await YQ(U,H,{onProgress:(K)=>{if(G||!J)console.log(M0.dim(` ${K}`))}});if(Y)await Bun.write(Y,$X(B)),$(`
232
+ \uD83E\uDD52 Report saved to ${Y}`);else if(J)console.log($X(B));else A4(B);let q=Q.threshold?parseInt(Q.threshold,10):H.threshold??0;if(B.summary.score<q)console.error(M0.red(`
233
+ \uD83E\uDD52 Freshness score ${B.summary.score}% is below threshold ${q}%`)),console.error(M0.dim(" Time to freshen up your docs!")),process.exit(1)}import rj from"node:path";var oj=`# \uD83E\uDD52 pickled.yml - Check your freshness!
93
234
 
94
- List 3-5 direct competitors. Return JSON:
95
- { "competitors": ["tool1", "tool2", "tool3"] }`)).competitors}async function b1($,X){return(await N0(`Given:
96
- - Name: ${$.name}
97
- - Description: ${$.description}
98
- - Domain: ${$.domain}
99
- - Competitors: ${X.join(", ")}
235
+ tool:
236
+ name: "your-tool"
237
+ description: "A short description of what your tool does"
100
238
 
101
- Generate 3-4 topics where developers would search for this tool.
102
- For each, create 5 natural questions a developer might ask an AI.
239
+ # Scenarios: Questions to test AI's knowledge of your tool
240
+ scenarios:
241
+ - name: "Getting started"
242
+ prompt: "How do I install and set up this tool?"
103
243
 
104
- Return JSON:
105
- {
106
- "topics": [
107
- { "name": "topic name", "questions": ["q1", "q2", "q3", "q4", "q5"] }
108
- ]
109
- }`)).topics}function Q4($){let J=$.trim().replace(/^https?:\/\//,"").replace(/^github\.com\//,"").replace(/\.git$/,"").replace(/\/$/,"").split("/");return J.length>=2?{owner:J[0],repo:J[1]}:null}async function h1($){let X=Q4($);if(!X)throw Error(`\uD83E\uDD52 Can't find that jar. Is the repo URL correct? (${$})`);let{owner:J,repo:Z}=X,z=`https://github.com/${J}/${Z}`,Y=await W4(J,Z,"README.md"),W=null;try{let Q=await W4(J,Z,"package.json");if(Q)W=JSON.parse(Q)}catch{}if(!Y&&!W)throw Error(`\uD83E\uDD52 Couldn't open the jar. GitHub might be having a moment. (${z})`);return{readme:Y,packageJson:W,repoUrl:z,owner:J,repo:Z}}async function W4($,X,J){let Z=[`https://raw.githubusercontent.com/${$}/${X}/main/${J}`,`https://raw.githubusercontent.com/${$}/${X}/master/${J}`];for(let z of Z){let Y=await fetch(z);if(Y.ok)return Y.text()}return""}var H0="━".repeat(55);function Z8($){if($>=80)return j.green("Well Preserved \uD83E\uDD52");if($>=60)return j.green("Looking Fresh \uD83E\uDD52");if($>=40)return j.yellow("Going Stale ⚠️");return j.red("Starting to Spoil \uD83E\uDD52")}function v1($){let{product:X,competitors:J,topics:Z,summary:z}=$;console.log(),console.log(j.bold(`\uD83E\uDD52 Freshness Report: ${X.name}`)),console.log(H0),console.log(),console.log(`\uD83D\uDCE6 What's in the jar: ${X.name} - ${X.description}`),console.log(`\uD83C\uDFF7️ Domain: ${X.domain}`),console.log(`\uD83E\uDED9 Who else is on the shelf: ${J.join(", ")}`),console.log(),console.log(H0),console.log(j.bold("\uD83D\uDCCA HOW FRESH ARE YOU?")),console.log(H0);for(let Y of Z)console.log(),z8(Y,X.name);if(console.log(),console.log(H0),console.log(j.bold("\uD83D\uDCC8 FRESHNESS SUMMARY")),console.log(H0),console.log(),console.log(`Overall freshness: ${z.overallVisibility}% - ${Z8(z.overallVisibility)}`),console.log(`Top of the shelf in: ${z.leadingTopics}/${z.totalTopics} topics`),z.opportunities.length>0)console.log(j.yellow(`Room to stay fresh: ${z.opportunities.join(", ")}`));if(console.log(),z.overallVisibility>=80)console.log(j.green("\uD83E\uDD52 You're kind of a big dill!"));console.log(j.dim("Stay fresh! \uD83E\uDD52")),console.log()}function z8($,X){let J=X.toLowerCase(),Z=$.leader===J;console.log(j.bold(`Topic: "${$.topic}"`));let z=Object.entries($.results).sort((Y,W)=>W[1].mentions-Y[1].mentions);for(let Y=0;Y<z.length;Y++){let[W,Q]=z[Y],G=W===J,q=`${Y===0?G?" \uD83E\uDD52":" ⚠️":Y===z.length-1?" └─":" ├─"} ${W}: ${Q.mentions}/${Q.total} (${Q.percentage}%)`;if(G&&Z)q+=j.green(" - Well preserved!");else if(G&&!Z)q+=j.yellow(" - Going stale");else if(Y===0&&!G)q+=j.dim(" ← Top of the shelf");if(console.log(q),G&&Q.contexts.length>0){let N=Q.contexts[0].slice(0,50);console.log(j.dim(` │ └─ "${N}..."`))}}}function n0($){return JSON.stringify($,null,2)}function g1($){let{product:X,topics:J,summary:Z}=$,z=X.name.toLowerCase(),Y=0,W=[];for(let Q of J){let G=Q.results[z];if(Q.leader!==z){Y++;let q=Q.results[Q.leader];W.push(` <testcase name="${w0(Q.topic)}" status="opportunity">
110
- <failure message="competitor ${w0(Q.leader)} leads with ${q?.percentage||0}%"/>
111
- <visibility>${G?.percentage||0}%</visibility>
112
- </testcase>`)}else W.push(` <testcase name="${w0(Q.topic)}" status="leading">
113
- <visibility>${G?.percentage||0}%</visibility>
114
- </testcase>`)}return`<?xml version="1.0" encoding="UTF-8"?>
115
- <testsuites name="pickled" tests="${J.length}" failures="${Y}">
116
- <testsuite name="${w0(X.name)}" tests="${J.length}" failures="${Y}">
117
- <properties>
118
- <property name="domain" value="${w0(X.domain)}"/>
119
- <property name="visibility" value="${Z.overallVisibility}%"/>
120
- </properties>
121
- ${W.join(`
122
- `)}
123
- </testsuite>
124
- </testsuites>`}function w0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}async function K4($,X){let{json:J,output:Z,verbose:z,competitors:Y}=X,W=(P)=>!J&&console.log(j.dim(P));W("\uD83E\uDD52 Opening the jar...");let Q=await h1($);if(z)W(` Found: ${Q.repoUrl}`);W("\uD83D\uDD0D Checking what's inside...");let G=await y1(Q);if(z)W(` ${G.name}: ${G.description}`);let V;if(Y)V=Y.split(",").map((P)=>P.trim()),W(`\uD83E\uDED9 Using provided shelf mates: ${V.join(", ")}`);else if(W("\uD83E\uDED9 Seeing who else is on the shelf..."),V=await _1(G),z)W(` Found: ${V.join(", ")}`);W("\uD83C\uDFF7️ Picking the right questions...");let q=await b1(G,V);if(z)for(let P of q)W(` - ${P.name} (${P.questions.length} questions)`);W("\uD83D\uDCCA Checking your freshness...");let N=await k1(G,V,q,(P)=>{if(z)W(` ${P}`)}),w=G.name.toLowerCase(),T=0,R=0,c=0,b=[];for(let P of N){let B$=P.results[w];if(T+=B$?.mentions||0,R+=B$?.total||0,P.leader===w)c++;else b.push(P.topic)}let A={product:G,competitors:V,topics:N,summary:{overallVisibility:R>0?Math.round(T/R*100):0,totalMentions:T,totalQuestions:R,leadingTopics:c,totalTopics:N.length,opportunities:b}};if(Z){let P=Z.endsWith(".xml")?g1(A):n0(A);await Bun.write(Z,P),W(`
125
- \uD83E\uDD52 Freshness report saved to ${Z}`)}else if(J)console.log(n0(A));else v1(A)}D0.name("pickled").description("Preserve your visibility in AI \uD83E\uDD52").version("0.1.0");D0.command("check").description("Check your freshness in AI").argument("<repo>","GitHub repo to check (e.g., github.com/user/repo)").option("--json","Output as fresh JSON").option("-o, --output <file>","Save report to file (.json or .xml)").option("-v, --verbose","Show the full pickling process").option("-c, --competitors <list>","Comma-separated competitor list (skip auto-discovery)").action(K4);D0.parse();
244
+ - name: "Basic usage"
245
+ prompt: "Show me a basic example of using this tool"
246
+
247
+ - name: "Error handling"
248
+ prompt: "How do I handle errors?"
249
+
250
+ # Optional: Fail CI if freshness score below threshold
251
+ # threshold: 80
252
+
253
+ # Advanced: Named targets for testing across different AI tools
254
+ # targets:
255
+ # claude-sonnet:
256
+ # category: cli
257
+ # provider: claude-code
258
+ # model: claude-sonnet-4-20250514
259
+ #
260
+ # Then reference in scenarios:
261
+ # scenarios:
262
+ # - name: "Test with Sonnet"
263
+ # prompt: "How do I install?"
264
+ # target: claude-sonnet
265
+ `;async function lG(X){let J=`${rj.resolve(X)}/pickled.yml`;if(await Bun.file(J).exists())console.error(M0.red("\uD83E\uDD52 pickled.yml already exists")),process.exit(1);await Bun.write(J,oj),console.log(M0.green("\uD83E\uDD52 Created pickled.yml")),console.log(),console.log(M0.dim("Next steps:")),console.log(M0.dim(" 1. Edit pickled.yml with your tool info and scenarios")),console.log(M0.dim(" 2. Run: pickled check")),console.log(),console.log(M0.dim("Stay fresh! \uD83E\uDD52"))}x9.name("pickled").description("Preserve your visibility in AI \uD83E\uDD52").version(l4.version);x9.command("init").description("Create a pickled.yml config file").argument("[path]","Path to your project (default: current directory)",".").action(lG);x9.command("check").description("Check if AI can answer questions about your tool").argument("[path]","Path to your project (default: current directory)",".").option("--json","Output as JSON").option("-o, --output <file>","Save report to file").option("-v, --verbose","Show detailed progress").option("-t, --threshold <percent>","Minimum score % to pass (overrides config)").action(mG);x9.parse();